@hiai-gg/docsmint 2.1.0 → 2.1.1

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 (302) hide show
  1. package/README.md +7 -3
  2. package/dist/backend/index.js +49330 -66661
  3. package/dist/backend-account-runtime-cleanup.js +291 -291
  4. package/dist/backend-api-key-facade.js +4 -4
  5. package/dist/backend-pipeline-cancellation.js +285 -285
  6. package/dist/frontend/CategoryDialog-CVJi5PJu.js +602 -0
  7. package/dist/frontend/{ConfirmDialog-B1MjKlVQ.js → ConfirmDialog-0JwB8mKN.js} +5 -8
  8. package/dist/frontend/{CreateSnapshotDialog-BTMoPFdj.js → CreateSnapshotDialog-BLrtuYs5.js} +63 -68
  9. package/dist/frontend/{DatePicker-Bmjko3X7.js → DatePicker-BwSb8TRv.js} +17 -29
  10. package/dist/frontend/{DeleteDialog-BkfIeKXO.js → DeleteDialog-s7Dr6bXg.js} +51 -56
  11. package/dist/frontend/{FolderNode-Do8pIfyA.js → FolderNode-Y7cV9xeX.js} +105 -106
  12. package/dist/frontend/{FolderTreeSelector-FyxhcHjr.js → FolderTreeSelector-BR3lYmPU.js} +18 -20
  13. package/dist/frontend/HiAiEditor-BQERr-cd.js +3077 -0
  14. package/dist/frontend/{HiaiDocsExtensionProvider-Cc3yzW5I.js → HiaiDocsExtensionProvider-A2nGddUR.js} +2 -3
  15. package/dist/frontend/{Icon-3EYzvNyk.js → Icon-CiHcxcpv.js} +1 -2
  16. package/dist/frontend/SettingsDialog-BvS74JZu.js +978 -0
  17. package/dist/frontend/{ShareDialog-Ddvl7xvb.js → ShareDialog-Bo50h_Oe.js} +23 -25
  18. package/dist/frontend/Sidebar-i0kbanpg.js +2123 -0
  19. package/dist/frontend/{TagCreateDialog-DQmMJe_E.js → TagCreateDialog-DhKfsfv3.js} +78 -86
  20. package/dist/frontend/action_cancel-BdsWzQKU.js +4 -0
  21. package/dist/frontend/action_close-CVhfLPRQ.js +4 -0
  22. package/dist/frontend/action_create-ByaroO1_.js +4 -0
  23. package/dist/frontend/action_delete-SRloglWY.js +4 -0
  24. package/dist/frontend/action_go_to-DO1bicF-.js +4 -0
  25. package/dist/frontend/action_loading-iQ0KsN6i.js +4 -0
  26. package/dist/frontend/action_save-DeqrZQwV.js +4 -0
  27. package/dist/frontend/api/attachments.js +1 -2
  28. package/dist/frontend/api/categories.js +1 -2
  29. package/dist/frontend/api/documents.js +1 -2
  30. package/dist/frontend/api/folders.js +1 -2
  31. package/dist/frontend/api/settings.js +1 -2
  32. package/dist/frontend/api/share.js +1 -2
  33. package/dist/frontend/api/tags.js +1 -2
  34. package/dist/frontend/{api-keys-DIwAdYkg.js → api-keys-B63imiLr.js} +2 -3
  35. package/dist/frontend/app-shell.js +55 -79
  36. package/dist/frontend/{attachments-C225gTA7.js → attachments-Bfly-sam.js} +2 -3
  37. package/dist/frontend/{auth-client-C5EyWdAF.js → auth-client-Dx7d9Tzo.js} +252 -253
  38. package/dist/frontend/{bundle-mjs-CZ3g1Uzr.js → bundle-mjs-clTO1WW-.js} +5 -23
  39. package/dist/frontend/{camera-DtgHzfVI.js → camera-DsdOPOcD.js} +2 -3
  40. package/dist/frontend/{categories-C8AAkhCR.js → categories-CusvHb5Y.js} +3 -4
  41. package/dist/frontend/{categories_update_error-4aSI8PTr.js → categories_update_error-Cn8DBBHv.js} +2 -3
  42. package/dist/frontend/{check-DVx65aSv.js → check-DiMZRkKS.js} +2 -3
  43. package/dist/frontend/{chevron-down-C2tbZ8Ol.js → chevron-down-CxFrMFDJ.js} +2 -3
  44. package/dist/frontend/{circle-check-BAN-D7yg.js → circle-check-B4F_qgPx.js} +2 -3
  45. package/dist/frontend/{client-GbtOH90i.js → client-BDdDd84W.js} +1 -2
  46. package/dist/frontend/{clipboard-Cgzxc0_R.js → clipboard-Dt1oW6nm.js} +1 -2
  47. package/dist/frontend/{clock-ByiB0SwQ.js → clock-dcpueRk-.js} +2 -3
  48. package/dist/frontend/collaboration.js +6 -12
  49. package/dist/frontend/components/category-dialog.js +1 -2
  50. package/dist/frontend/components/create-snapshot-dialog.js +1 -2
  51. package/dist/frontend/components/delete-dialog.js +1 -2
  52. package/dist/frontend/components/editor/compact-editor.js +2 -3
  53. package/dist/frontend/components/editor/document-editor.js +1 -2
  54. package/dist/frontend/components/editor/document-title.js +3 -4
  55. package/dist/frontend/components/editor/docx-serializer.js +123 -167
  56. package/dist/frontend/components/editor/extensions.js +1 -2
  57. package/dist/frontend/components/editor/markdown-toggle.js +5 -6
  58. package/dist/frontend/components/editor/markdown.js +1 -2
  59. package/dist/frontend/components/folder-node.js +1 -2
  60. package/dist/frontend/components/folder-tree-selector.js +1 -2
  61. package/dist/frontend/components/save-as-dialog.js +86 -90
  62. package/dist/frontend/components/settings.js +1 -2
  63. package/dist/frontend/components/share-dialog.js +1 -2
  64. package/dist/frontend/components/sidebar.js +1 -2
  65. package/dist/frontend/components/tag-create-dialog.js +1 -2
  66. package/dist/frontend/components/version-history.js +177 -180
  67. package/dist/frontend/{context-D0zPFXZ4.js → context-BguSRnCt.js} +1 -2
  68. package/dist/frontend/{copy-CRzvfZGb.js → copy-Bag46YaR.js} +2 -3
  69. package/dist/frontend/dashboard.js +666 -690
  70. package/dist/frontend/{db-CgTtukT4.js → db-B1ZV452J.js} +22 -39
  71. package/dist/frontend/{dialog-a_ZcpEC5.js → dialog-C0Bpok1d.js} +10 -18
  72. package/dist/frontend/{dist-CcHOStsA.js → dist-BlcV_BOY.js} +2 -3
  73. package/dist/frontend/{dist-qd_OnyUC.js → dist-DjId3RKL.js} +8 -21
  74. package/dist/frontend/dist-Dl9qg10h.js +301 -0
  75. package/dist/frontend/{dndzone-CDhrbpTg.js → dndzone-C62yjeG3.js} +38 -53
  76. package/dist/frontend/doc-tabs.js +1 -2
  77. package/dist/frontend/doc_title_label-BOuZzvqv.js +4 -0
  78. package/dist/frontend/doc_title_placeholder-ZxpdWWEn.js +4 -0
  79. package/dist/frontend/{document-drop-coordinator-Da7HcXgv.js → document-drop-coordinator-C_o93kKW.js} +3 -4
  80. package/dist/frontend/document-drop-coordinator.js +1 -2
  81. package/dist/frontend/{documents-CwCs1rA7.js → documents-CDJb8dv-.js} +4 -8
  82. package/dist/frontend/{dropdown-menu-DrHYReIC.js → dropdown-menu-B3nk2aM-.js} +13 -24
  83. package/dist/frontend/{editor-content-sanitizer-CWjqiz0T.js → editor-content-sanitizer-5MjSVPVn.js} +1 -2
  84. package/dist/frontend/editor-preferences.js +1 -2
  85. package/dist/frontend/{editor-preferences.svelte-Bt_A9k7n.js → editor-preferences.svelte-BpTE4mbz.js} +3 -5
  86. package/dist/frontend/{editorExtensions-DPR-CjMu.js → editorExtensions-DbiFj4tn.js} +3 -4
  87. package/dist/frontend/{editor_markdown_placeholder-BIWDUF1E.js → editor_markdown_placeholder-BztIY9Ci.js} +2 -3
  88. package/dist/frontend/{ellipsis-vertical-qxNgoXu-.js → ellipsis-vertical-Oymsv1R4.js} +2 -3
  89. package/dist/frontend/{error_dismiss-Dx_JbRjs.js → error_dismiss-C651ZdWI.js} +2 -3
  90. package/dist/frontend/error_generic-BlWqOE-a.js +4 -0
  91. package/dist/frontend/extension.js +1 -2
  92. package/dist/frontend/{folder-D74E-Kdp.js → folder-BpmB_sAy.js} +3 -5
  93. package/dist/frontend/folder-refresh.js +1 -2
  94. package/dist/frontend/{folders-CC0UWkZH.js → folders-DgKSovXa.js} +2 -3
  95. package/dist/frontend/{folders_rename-BJo4Gipq.js → folders_rename-Cxbg5GIw.js} +2 -3
  96. package/dist/frontend/frontend.css +1 -1
  97. package/dist/frontend/i18n.js +144 -145
  98. package/dist/frontend/{identity-CNhtuCJV.js → identity-B7HeOzDJ.js} +4 -5
  99. package/dist/frontend/{input-Q_7qCfnU.js → input-CbeB9220.js} +2 -3
  100. package/dist/frontend/keyboard.js +1 -2
  101. package/dist/frontend/{keyboard.svelte-CApmX0vl.js → keyboard.svelte-BBUdhTsM.js} +2 -3
  102. package/dist/frontend/{label-Dj8FDEhf.js → label-CfBWf3gI.js} +2 -3
  103. package/dist/frontend/{lib-aUbBbIW2.js → lib-CITdCbKa.js} +176 -365
  104. package/dist/frontend/{loader-circle-D3t5NkvC.js → loader-circle-skKwfRCB.js} +2 -3
  105. package/dist/frontend/markdown-6E9TWC6V.js +11 -0
  106. package/dist/frontend/offline/identity.js +1 -2
  107. package/dist/frontend/{popper-layer-force-mount-CNtiLgbV.js → popper-layer-force-mount-BG0eyrCk.js} +112 -284
  108. package/dist/frontend/{resolve-BG4HgzpN.js → resolve-DbT-KhGZ.js} +2 -3
  109. package/dist/frontend/{rolldown-runtime-DArdT4gl.js → rolldown-runtime-CwxnZyOB.js} +2 -3
  110. package/dist/frontend/{rotate-ccw-B1ybQ8oQ.js → rotate-ccw-DAUX7np7.js} +2 -3
  111. package/dist/frontend/{route-context-DYQlUfzL.js → route-context-6OHiGtfb.js} +2 -4
  112. package/dist/frontend/{runtime-CwWSo6c9.js → runtime-CGUiMzK6.js} +1 -2
  113. package/dist/frontend/{schemas-1Na35n71.js → schemas-YXxhj5o8.js} +850 -880
  114. package/dist/frontend/scroll_to_top_aria-lJc2RSx_.js +4 -0
  115. package/dist/frontend/{search-preferences-B1GdbdUc.js → search-preferences-DuLDczRu.js} +1 -2
  116. package/dist/frontend/search.js +277 -292
  117. package/dist/frontend/{search_title-DOC0cPlQ.js → search_title-BETwQYJq.js} +2 -3
  118. package/dist/frontend/{select-value-BkI1W1bn.js → select-value-BY5Hw6Rl.js} +28 -65
  119. package/dist/frontend/{settings-CHx4wBwb.js → settings-DyePuqjp.js} +3 -4
  120. package/dist/frontend/{share-D5yo0JOh.js → share-3gWTTYvH.js} +2 -3
  121. package/dist/frontend/{share-context-BJ4GF4yT.js → share-context-C2xyVP9M.js} +29 -37
  122. package/dist/frontend/{share_copied-DPxVzfWh.js → share_copied-BuAnmpbz.js} +2 -3
  123. package/dist/frontend/{share_toggle_password-DdxfIjj1.js → share_toggle_password-LEYUeHWr.js} +2 -3
  124. package/dist/frontend/shared-document.js +27 -36
  125. package/dist/frontend/{sidebar_uncategorized-qJ2_Aonf.js → sidebar_uncategorized-C5PGOflV.js} +2 -3
  126. package/dist/frontend/{sort_relevance-DwYX5MO9.js → sort_relevance-DpCVLby_.js} +2 -3
  127. package/dist/frontend/{subfolders-refresh-store.svelte-DxP21a1c.js → subfolders-refresh-store.svelte-CeyqvNpu.js} +1 -2
  128. package/dist/frontend/{tag-qbTBLj-g.js → tag-Wdfe0rKU.js} +3 -5
  129. package/dist/frontend/{tag-store.svelte-ogVCMCbv.js → tag-store.svelte-C9VYWqLQ.js} +2 -3
  130. package/dist/frontend/{tags-CF_cqzSV.js → tags-DlDVothf.js} +3 -4
  131. package/dist/frontend/{tags_load_error-BKjA1pI0.js → tags_load_error-BINNpPPV.js} +2 -3
  132. package/dist/frontend/{tags_new-BiNAJ9Bx.js → tags_new-Dw0Uy43-.js} +2 -3
  133. package/dist/frontend/{textarea-BNK0LFUK.js → textarea-D6emvAwM.js} +2 -3
  134. package/dist/frontend/theme.js +2 -3
  135. package/dist/frontend/{theme.svelte-BRdxXd-B.js → theme.svelte-BiXvrqwh.js} +7 -23
  136. package/dist/frontend/{theme_system-BBNUhYKh.js → theme_system-YIfa_2Xt.js} +2 -3
  137. package/dist/frontend/utils/clipboard.js +1 -2
  138. package/dist/frontend/utils/dndzone.js +1 -2
  139. package/dist/frontend/{utils-BovMJHdA.js → utils-CnAmIMwr.js} +2 -3
  140. package/dist/frontend/utils-DH0uqK40.js +6 -0
  141. package/dist/frontend/utils.js +1 -2
  142. package/dist/frontend/version_create_snapshot-D8xjbuCq.js +4 -0
  143. package/dist/frontend/{version_restored_from-dVRN3Zdk.js → version_restored_from-DYFFSuQj.js} +2 -3
  144. package/dist/frontend/{version_snapshot_label_placeholder-DrMikux0.js → version_snapshot_label_placeholder-BhKq1NQ7.js} +2 -3
  145. package/dist/frontend/{weekday_we-C5H_M-df.js → weekday_we-BxbzNVWR.js} +2 -3
  146. package/dist/frontend/{x-CvSSnrjl.js → x-CBUgPygC.js} +2 -3
  147. package/dist/frontend/{yjs-VUcKqaKW.js → yjs-BbwnvxgY.js} +9 -23
  148. package/dist/frontend-ssr/api/attachments.js +2 -3
  149. package/dist/frontend-ssr/api/categories.js +1 -2
  150. package/dist/frontend-ssr/api/documents.js +1 -2
  151. package/dist/frontend-ssr/api/folders.js +1 -2
  152. package/dist/frontend-ssr/api/settings.js +1 -2
  153. package/dist/frontend-ssr/api/share.js +2 -3
  154. package/dist/frontend-ssr/api/tags.js +1 -2
  155. package/dist/frontend-ssr/app-shell.js +19 -28
  156. package/dist/frontend-ssr/assets/{CategoryDialog-DuZLLlt7.js → CategoryDialog-2CCX508O.js} +17 -20
  157. package/dist/frontend-ssr/assets/{ConfirmDialog-0WVu9BCE.js → ConfirmDialog-Cc6lcY1N.js} +8 -14
  158. package/dist/frontend-ssr/assets/{CreateSnapshotDialog-3vhDTFNu.js → CreateSnapshotDialog-BB8fXF9W.js} +9 -10
  159. package/dist/frontend-ssr/assets/{DatePicker-t12leL2Y.js → DatePicker-CfzKzipR.js} +9 -15
  160. package/dist/frontend-ssr/assets/{DeleteDialog-B0AU1fJR.js → DeleteDialog-DRU4UgOW.js} +4 -5
  161. package/dist/frontend-ssr/assets/{FolderNode-C-B-s8x1.js → FolderNode-Dg_5-orQ.js} +11 -12
  162. package/dist/frontend-ssr/assets/{FolderTreeSelector-DdQuEcj0.js → FolderTreeSelector-D0reTdFS.js} +5 -7
  163. package/dist/frontend-ssr/assets/{HiAiEditor-Cj3B2Dt6.js → HiAiEditor-DeHWAIj-.js} +44 -69
  164. package/dist/frontend-ssr/assets/{HiaiDocsExtensionProvider-BRKWmcDd.js → HiaiDocsExtensionProvider-D6cGL-9s.js} +2 -3
  165. package/dist/frontend-ssr/assets/{Icon-DE_3EnuF.js → Icon-CrIRbT5O.js} +4 -8
  166. package/dist/frontend-ssr/assets/{SettingsDialog-DAT-Zxu0.js → SettingsDialog-BpHY3IMb.js} +29 -40
  167. package/dist/frontend-ssr/assets/{ShareDialog-CpE9zd_f.js → ShareDialog-CY40nWZJ.js} +7 -9
  168. package/dist/frontend-ssr/assets/{Sidebar-B_Ey6QNL.js → Sidebar-fpYk5MGO.js} +55 -63
  169. package/dist/frontend-ssr/assets/{TagCreateDialog-DBHO1DPU.js → TagCreateDialog-C2tpdEuj.js} +13 -14
  170. package/dist/frontend-ssr/assets/{action_cancel-OVgQDP5Q.js → action_cancel-CsBbxW0m.js} +2 -3
  171. package/dist/frontend-ssr/assets/{action_close-DagDyMXk.js → action_close-lFKBqBwg.js} +2 -3
  172. package/dist/frontend-ssr/assets/{action_create-hqJWjyqh.js → action_create-BV4ZOcQW.js} +2 -3
  173. package/dist/frontend-ssr/assets/{action_delete-B1-16jSo.js → action_delete-CNmRhKQP.js} +2 -3
  174. package/dist/frontend-ssr/assets/{action_go_to-DQScgw7P.js → action_go_to-tN5I26xM.js} +2 -3
  175. package/dist/frontend-ssr/assets/{action_save-Bx7vlLZI.js → action_save-YCfMiKb4.js} +2 -3
  176. package/dist/frontend-ssr/assets/{api-keys-CHOrbU-Q.js → api-keys-G6oimJIv.js} +2 -3
  177. package/dist/frontend-ssr/assets/{auth-client-CITU3xkE.js → auth-client-BnnnJDAb.js} +102 -71
  178. package/dist/frontend-ssr/assets/{camera-B6ldo_Js.js → camera-OYNSMvMd.js} +2 -3
  179. package/dist/frontend-ssr/assets/{categories-C_dxFoHi.js → categories-bBPviKjl.js} +2 -3
  180. package/dist/frontend-ssr/assets/{categories_update_error-DkKgsqdD.js → categories_update_error-Bfx5vtvt.js} +11 -21
  181. package/dist/frontend-ssr/assets/{chevron-down-DQcr6JUc.js → chevron-down-DB6YsSbQ.js} +2 -3
  182. package/dist/frontend-ssr/assets/{chevron-right-9szrliZx.js → chevron-right-DOt2uY6b.js} +2 -3
  183. package/dist/frontend-ssr/assets/{circle-check-BgP9MRRv.js → circle-check-DQhTm9YR.js} +2 -3
  184. package/dist/frontend-ssr/assets/{client-rfwQYYHY.js → client-B2AniXwV.js} +1 -2
  185. package/dist/frontend-ssr/assets/{clipboard-CXOaoz2W.js → clipboard-CXKnyYba.js} +1 -2
  186. package/dist/frontend-ssr/assets/{clock-roNtGlT6.js → clock-B08dVWtf.js} +2 -3
  187. package/dist/frontend-ssr/assets/{context-Bi_mO-NS.js → context-C_xxvxnR.js} +1 -2
  188. package/dist/frontend-ssr/assets/{copy-BYqYnBIQ.js → copy-2jsznHar.js} +2 -3
  189. package/dist/frontend-ssr/assets/{db-DxRzq-kx.js → db-BEKLU5Fc.js} +2 -3
  190. package/dist/frontend-ssr/assets/{dialog-SqCnTT43.js → dialog-C6U-DqLr.js} +9 -17
  191. package/dist/frontend-ssr/assets/{dist-CaZQ1FhA.js → dist-DqXTz_zE.js} +9 -12
  192. package/dist/frontend-ssr/assets/{dist-CqxHwOlp.js → dist-ip9bPdma.js} +3 -6
  193. package/dist/frontend-ssr/assets/{dndzone-CnTCMhPd.js → dndzone-Dx3jt_e4.js} +4 -6
  194. package/dist/frontend-ssr/assets/{doc_title_label-Ev_ltlh3.js → doc_title_label-CE_l-Gum.js} +2 -3
  195. package/dist/frontend-ssr/assets/{doc_title_placeholder-DSHpUb7w.js → doc_title_placeholder-7_i7PtG6.js} +2 -3
  196. package/dist/frontend-ssr/assets/{document-drop-coordinator-CEaYACsC.js → document-drop-coordinator-BVytYy2K.js} +1 -2
  197. package/dist/frontend-ssr/assets/{documents-CEuA1V6N.js → documents-B_wpQFTh.js} +2 -3
  198. package/dist/frontend-ssr/assets/{dropdown-menu-CE6U0f1b.js → dropdown-menu-BS5fcN9l.js} +12 -23
  199. package/dist/frontend-ssr/assets/{editor-content-sanitizer-Gjm93iR-.js → editor-content-sanitizer-CIdFjBSC.js} +1 -2
  200. package/dist/frontend-ssr/assets/{editor-preferences.svelte-iI5jJM1x.js → editor-preferences.svelte-CdAXTd-I.js} +2 -4
  201. package/dist/frontend-ssr/assets/{editorExtensions-rhletNji.js → editorExtensions-2O7O2Nhv.js} +2 -3
  202. package/dist/frontend-ssr/assets/{editor_markdown_placeholder-BpezdkOr.js → editor_markdown_placeholder-CAeLJjFT.js} +3 -5
  203. package/dist/frontend-ssr/assets/{editor_toolbar_undo-CKJAOqv2.js → editor_toolbar_undo-CVCfQIS1.js} +29 -57
  204. package/dist/frontend-ssr/assets/{ellipsis-vertical-Cg1MrZsl.js → ellipsis-vertical-IFHt2NM1.js} +2 -3
  205. package/dist/frontend-ssr/assets/{error_generic-DTK0kwxT.js → error_generic-BB80i0Vk.js} +3 -5
  206. package/dist/frontend-ssr/assets/{folder-DHB-CEcQ.js → folder-CXa1_bm5.js} +2 -3
  207. package/dist/frontend-ssr/assets/{folders-BOXeb9hz.js → folders-CTLqWbMm.js} +2 -3
  208. package/dist/frontend-ssr/assets/{folders_rename-DvciOb6K.js → folders_rename-ydbfwQlj.js} +7 -13
  209. package/dist/frontend-ssr/assets/{identity-B7ngLQzZ.js → identity-DTz1SQwC.js} +2 -3
  210. package/dist/frontend-ssr/assets/{input-DVrBVPgs.js → input-Bxw9sFF0.js} +2 -3
  211. package/dist/frontend-ssr/assets/{keyboard.svelte-BgF47N3L.js → keyboard.svelte-njehUCm3.js} +1 -2
  212. package/dist/frontend-ssr/assets/{label-vtCK3pTp.js → label-CMWedjs6.js} +2 -3
  213. package/dist/frontend-ssr/assets/{loader-circle-D3NWhCif.js → loader-circle-zbKj9Qb-.js} +2 -3
  214. package/dist/frontend-ssr/assets/{markdown-Co31-Tl2.js → markdown-BmIhDQp7.js} +2 -3
  215. package/dist/frontend-ssr/assets/{popper-layer-force-mount-C4dMMt-f.js → popper-layer-force-mount-CSHZsG2E.js} +78 -156
  216. package/dist/frontend-ssr/assets/{resolve-BqHozBXl.js → resolve-Wqdff4CL.js} +1 -2
  217. package/dist/frontend-ssr/assets/{rotate-ccw-DNf3nwMD.js → rotate-ccw-B7SaTFWf.js} +2 -3
  218. package/dist/frontend-ssr/assets/{route-context-BPRerEtZ.js → route-context-BsqLFt5Y.js} +2 -4
  219. package/dist/frontend-ssr/assets/{runtime-O78RzRqx.js → runtime-BX6-jTn_.js} +1 -2
  220. package/dist/frontend-ssr/assets/{scroll_to_top_aria-BN4ZfOnM.js → scroll_to_top_aria-CAYSiGHO.js} +2 -3
  221. package/dist/frontend-ssr/assets/{search_title-CKUsQDT0.js → search_title-C7NVXXq3.js} +2 -3
  222. package/dist/frontend-ssr/assets/{search_toggle_filters-hS9rvQhC.js → search_toggle_filters-Bq_YVD8s.js} +15 -29
  223. package/dist/frontend-ssr/assets/{select-value-Ce5c_fuA.js → select-value-TgslfiUB.js} +18 -34
  224. package/dist/frontend-ssr/assets/{settings-BRxvn30Y.js → settings-B1MA_FjO.js} +3 -4
  225. package/dist/frontend-ssr/assets/{share-context-B4UpvTSw.js → share-context-RVh8AExX.js} +17 -22
  226. package/dist/frontend-ssr/assets/{share_copied-BxU9rjXG.js → share_copied-CrwEwkb3.js} +31 -61
  227. package/dist/frontend-ssr/assets/{share_toggle_password-C6OmroqR.js → share_toggle_password-Co56z0Ha.js} +11 -21
  228. package/dist/frontend-ssr/assets/{sidebar_uncategorized-Dx-LTd5w.js → sidebar_uncategorized-COWdmZ3d.js} +6 -11
  229. package/dist/frontend-ssr/assets/{subfolders-refresh-store.svelte-CXHxQWKh.js → subfolders-refresh-store.svelte-LxG18U0n.js} +1 -2
  230. package/dist/frontend-ssr/assets/{tag-Cqv0fWVG.js → tag-BGhtDKpP.js} +3 -5
  231. package/dist/frontend-ssr/assets/{tag-store.svelte-QRysvGKe.js → tag-store.svelte-CUUgAaDD.js} +2 -3
  232. package/dist/frontend-ssr/assets/{tags-BBCoFYro.js → tags-C7u-LBsl.js} +2 -3
  233. package/dist/frontend-ssr/assets/{tags_load_error-CPrc6Gzs.js → tags_load_error-DW4FbHvr.js} +19 -37
  234. package/dist/frontend-ssr/assets/{tags_new-VmMr9v2V.js → tags_new-Dr3ByMPZ.js} +4 -7
  235. package/dist/frontend-ssr/assets/{textarea-BdjOJJVb.js → textarea-Bz5Tz4rw.js} +2 -3
  236. package/dist/frontend-ssr/assets/{theme.svelte-D6bbaJ9m.js → theme.svelte-CdHah46l.js} +3 -5
  237. package/dist/frontend-ssr/assets/{theme_system-BucaNntV.js → theme_system-E97FASeq.js} +19 -37
  238. package/dist/frontend-ssr/assets/{utils-DvZnctjz.js → utils-085zSPe5.js} +1 -2
  239. package/dist/frontend-ssr/assets/{utils-D3X7I8nz.js → utils-DF6CmRDX.js} +1 -2
  240. package/dist/frontend-ssr/assets/{version_create_snapshot-COHzwjle.js → version_create_snapshot-DeeYB7bb.js} +2 -3
  241. package/dist/frontend-ssr/assets/{version_restored_from-CertjFDl.js → version_restored_from-CTt2LM4A.js} +13 -25
  242. package/dist/frontend-ssr/assets/{version_snapshot_label_placeholder-Cy_rMCij.js → version_snapshot_label_placeholder-BbGD9YuN.js} +12 -23
  243. package/dist/frontend-ssr/assets/{weekday_we-DrI3U230.js → weekday_we-BzGQ-iFc.js} +22 -43
  244. package/dist/frontend-ssr/collaboration.js +2 -4
  245. package/dist/frontend-ssr/components/category-dialog.js +1 -2
  246. package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -2
  247. package/dist/frontend-ssr/components/delete-dialog.js +1 -2
  248. package/dist/frontend-ssr/components/editor/compact-editor.js +2 -3
  249. package/dist/frontend-ssr/components/editor/document-editor.js +1 -2
  250. package/dist/frontend-ssr/components/editor/document-title.js +3 -4
  251. package/dist/frontend-ssr/components/editor/docx-serializer.js +1 -2
  252. package/dist/frontend-ssr/components/editor/extensions.js +1 -2
  253. package/dist/frontend-ssr/components/editor/markdown-toggle.js +4 -5
  254. package/dist/frontend-ssr/components/editor/markdown.js +1 -2
  255. package/dist/frontend-ssr/components/folder-node.js +1 -2
  256. package/dist/frontend-ssr/components/folder-tree-selector.js +1 -2
  257. package/dist/frontend-ssr/components/save-as-dialog.js +12 -13
  258. package/dist/frontend-ssr/components/settings.js +1 -2
  259. package/dist/frontend-ssr/components/share-dialog.js +1 -2
  260. package/dist/frontend-ssr/components/sidebar.js +1 -2
  261. package/dist/frontend-ssr/components/tag-create-dialog.js +1 -2
  262. package/dist/frontend-ssr/components/version-history.js +18 -21
  263. package/dist/frontend-ssr/dashboard.js +64 -88
  264. package/dist/frontend-ssr/doc-tabs.js +1 -2
  265. package/dist/frontend-ssr/document-drop-coordinator.js +1 -2
  266. package/dist/frontend-ssr/editor-preferences.js +1 -2
  267. package/dist/frontend-ssr/extension.js +1 -2
  268. package/dist/frontend-ssr/folder-refresh.js +1 -2
  269. package/dist/frontend-ssr/i18n.js +315 -603
  270. package/dist/frontend-ssr/keyboard.js +1 -2
  271. package/dist/frontend-ssr/offline/identity.js +1 -2
  272. package/dist/frontend-ssr/search.js +17 -20
  273. package/dist/frontend-ssr/shared-document.js +5 -8
  274. package/dist/frontend-ssr/theme.js +2 -3
  275. package/dist/frontend-ssr/utils/clipboard.js +1 -2
  276. package/dist/frontend-ssr/utils/dndzone.js +1 -2
  277. package/dist/frontend-ssr/utils.js +1 -2
  278. package/dist/lifecycle-runtime.js +3996 -17873
  279. package/dist/mcp-cli.js +64 -64
  280. package/dist/mcp-server.js +68 -68
  281. package/package.json +4 -4
  282. package/packages/cli/src/index.ts +1 -1
  283. package/server.json +2 -2
  284. package/dist/frontend/CategoryDialog-CJeAYxcd.js +0 -630
  285. package/dist/frontend/HiAiEditor-D6ad_auS.js +0 -3129
  286. package/dist/frontend/SettingsDialog-B8Oswuqb.js +0 -991
  287. package/dist/frontend/Sidebar-BV0IDqTS.js +0 -2149
  288. package/dist/frontend/action_cancel-Cuxsznzz.js +0 -5
  289. package/dist/frontend/action_close-BJm_52wm.js +0 -5
  290. package/dist/frontend/action_create-CtBQrRuj.js +0 -5
  291. package/dist/frontend/action_delete-BXBIzvn0.js +0 -5
  292. package/dist/frontend/action_go_to-VmK5jmEk.js +0 -5
  293. package/dist/frontend/action_loading-BLCGJVA9.js +0 -5
  294. package/dist/frontend/action_save-BRN2Z_GP.js +0 -5
  295. package/dist/frontend/dist-DcHl92QO.js +0 -316
  296. package/dist/frontend/doc_title_label-DS9jSIh2.js +0 -5
  297. package/dist/frontend/doc_title_placeholder-DBQpM1aH.js +0 -5
  298. package/dist/frontend/error_generic-CzNtmBT4.js +0 -5
  299. package/dist/frontend/markdown-O9YJA70S.js +0 -12
  300. package/dist/frontend/scroll_to_top_aria-CvkNF_Hu.js +0 -5
  301. package/dist/frontend/utils-BlHvR6OL.js +0 -7
  302. package/dist/frontend/version_create_snapshot-3bu-0qzH.js +0 -5
@@ -987,44 +987,44 @@ class Builder extends NotTagged {
987
987
  this.first = first;
988
988
  this.rest = rest;
989
989
  }
990
- build(before, parameters, types2, options) {
990
+ build(before, parameters, types, options) {
991
991
  const keyword = builders.map(([x, fn]) => ({ fn, i: before.search(x) })).sort((a, b) => a.i - b.i).pop();
992
- return keyword.i === -1 ? escapeIdentifiers(this.first, options) : keyword.fn(this.first, this.rest, parameters, types2, options);
992
+ return keyword.i === -1 ? escapeIdentifiers(this.first, options) : keyword.fn(this.first, this.rest, parameters, types, options);
993
993
  }
994
994
  }
995
- function handleValue(x, parameters, types2, options) {
995
+ function handleValue(x, parameters, types, options) {
996
996
  let value = x instanceof Parameter ? x.value : x;
997
997
  if (value === undefined) {
998
998
  x instanceof Parameter ? x.value = options.transform.undefined : value = x = options.transform.undefined;
999
999
  if (value === undefined)
1000
1000
  throw Errors.generic("UNDEFINED_VALUE", "Undefined values are not allowed");
1001
1001
  }
1002
- return "$" + types2.push(x instanceof Parameter ? (parameters.push(x.value), x.array ? x.array[x.type || inferType(x.value)] || x.type || firstIsString(x.value) : x.type) : (parameters.push(x), inferType(x)));
1002
+ return "$" + types.push(x instanceof Parameter ? (parameters.push(x.value), x.array ? x.array[x.type || inferType(x.value)] || x.type || firstIsString(x.value) : x.type) : (parameters.push(x), inferType(x)));
1003
1003
  }
1004
1004
  var defaultHandlers = typeHandlers(types);
1005
- function stringify(q, string, value, parameters, types2, options) {
1005
+ function stringify(q, string, value, parameters, types, options) {
1006
1006
  for (let i = 1;i < q.strings.length; i++) {
1007
- string += stringifyValue(string, value, parameters, types2, options) + q.strings[i];
1007
+ string += stringifyValue(string, value, parameters, types, options) + q.strings[i];
1008
1008
  value = q.args[i];
1009
1009
  }
1010
1010
  return string;
1011
1011
  }
1012
- function stringifyValue(string, value, parameters, types2, o) {
1013
- return value instanceof Builder ? value.build(string, parameters, types2, o) : value instanceof Query ? fragment(value, parameters, types2, o) : value instanceof Identifier ? value.value : value && value[0] instanceof Query ? value.reduce((acc, x) => acc + " " + fragment(x, parameters, types2, o), "") : handleValue(value, parameters, types2, o);
1012
+ function stringifyValue(string, value, parameters, types, o) {
1013
+ return value instanceof Builder ? value.build(string, parameters, types, o) : value instanceof Query ? fragment(value, parameters, types, o) : value instanceof Identifier ? value.value : value && value[0] instanceof Query ? value.reduce((acc, x) => acc + " " + fragment(x, parameters, types, o), "") : handleValue(value, parameters, types, o);
1014
1014
  }
1015
- function fragment(q, parameters, types2, options) {
1015
+ function fragment(q, parameters, types, options) {
1016
1016
  q.fragment = true;
1017
- return stringify(q, q.strings[0], q.args[0], parameters, types2, options);
1017
+ return stringify(q, q.strings[0], q.args[0], parameters, types, options);
1018
1018
  }
1019
- function valuesBuilder(first, parameters, types2, columns, options) {
1020
- return first.map((row) => "(" + columns.map((column) => stringifyValue("values", row[column], parameters, types2, options)).join(",") + ")").join(",");
1019
+ function valuesBuilder(first, parameters, types, columns, options) {
1020
+ return first.map((row) => "(" + columns.map((column) => stringifyValue("values", row[column], parameters, types, options)).join(",") + ")").join(",");
1021
1021
  }
1022
- function values(first, rest, parameters, types2, options) {
1022
+ function values(first, rest, parameters, types, options) {
1023
1023
  const multi = Array.isArray(first[0]);
1024
1024
  const columns = rest.length ? rest.flat() : Object.keys(multi ? first[0] : first);
1025
- return valuesBuilder(multi ? first : [first], parameters, types2, columns, options);
1025
+ return valuesBuilder(multi ? first : [first], parameters, types, columns, options);
1026
1026
  }
1027
- function select(first, rest, parameters, types2, options) {
1027
+ function select(first, rest, parameters, types, options) {
1028
1028
  typeof first === "string" && (first = [first].concat(rest));
1029
1029
  if (Array.isArray(first))
1030
1030
  return escapeIdentifiers(first, options);
@@ -1032,7 +1032,7 @@ function select(first, rest, parameters, types2, options) {
1032
1032
  const columns = rest.length ? rest.flat() : Object.keys(first);
1033
1033
  return columns.map((x) => {
1034
1034
  value = first[x];
1035
- return (value instanceof Query ? fragment(value, parameters, types2, options) : value instanceof Identifier ? value.value : handleValue(value, parameters, types2, options)) + " as " + escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x);
1035
+ return (value instanceof Query ? fragment(value, parameters, types, options) : value instanceof Identifier ? value.value : handleValue(value, parameters, types, options)) + " as " + escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x);
1036
1036
  }).join(",");
1037
1037
  }
1038
1038
  var builders = Object.entries({
@@ -1045,12 +1045,12 @@ var builders = Object.entries({
1045
1045
  as: select,
1046
1046
  returning: select,
1047
1047
  "\\(": select,
1048
- update(first, rest, parameters, types2, options) {
1049
- return (rest.length ? rest.flat() : Object.keys(first)).map((x) => escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x) + "=" + stringifyValue("values", first[x], parameters, types2, options));
1048
+ update(first, rest, parameters, types, options) {
1049
+ return (rest.length ? rest.flat() : Object.keys(first)).map((x) => escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x) + "=" + stringifyValue("values", first[x], parameters, types, options));
1050
1050
  },
1051
- insert(first, rest, parameters, types2, options) {
1051
+ insert(first, rest, parameters, types, options) {
1052
1052
  const columns = rest.length ? rest.flat() : Object.keys(Array.isArray(first) ? first[0] : first);
1053
- return "(" + escapeIdentifiers(columns, options) + ")values" + valuesBuilder(Array.isArray(first) ? first : [first], parameters, types2, columns, options);
1053
+ return "(" + escapeIdentifiers(columns, options) + ")values" + valuesBuilder(Array.isArray(first) ? first : [first], parameters, types, columns, options);
1054
1054
  }
1055
1055
  }).map(([x, fn]) => [new RegExp("((?:^|[\\s(])" + x + "(?:$|[\\s(]))(?![\\s\\S]*\\1)", "i"), fn]);
1056
1056
  function notTagged() {
@@ -1063,19 +1063,19 @@ function firstIsString(x) {
1063
1063
  return firstIsString(x[0]);
1064
1064
  return typeof x === "string" ? 1009 : 0;
1065
1065
  }
1066
- var mergeUserTypes = function(types2) {
1067
- const user = typeHandlers(types2 || {});
1066
+ var mergeUserTypes = function(types) {
1067
+ const user = typeHandlers(types || {});
1068
1068
  return {
1069
1069
  serializers: Object.assign({}, serializers, user.serializers),
1070
1070
  parsers: Object.assign({}, parsers, user.parsers)
1071
1071
  };
1072
1072
  };
1073
- function typeHandlers(types2) {
1074
- return Object.keys(types2).reduce((acc, k) => {
1075
- types2[k].from && [].concat(types2[k].from).forEach((x) => acc.parsers[x] = types2[k].parse);
1076
- if (types2[k].serialize) {
1077
- acc.serializers[types2[k].to] = types2[k].serialize;
1078
- types2[k].from && [].concat(types2[k].from).forEach((x) => acc.serializers[x] = types2[k].serialize);
1073
+ function typeHandlers(types) {
1074
+ return Object.keys(types).reduce((acc, k) => {
1075
+ types[k].from && [].concat(types[k].from).forEach((x) => acc.parsers[x] = types[k].parse);
1076
+ if (types[k].serialize) {
1077
+ acc.serializers[types[k].to] = types[k].serialize;
1078
+ types[k].from && [].concat(types[k].from).forEach((x) => acc.serializers[x] = types[k].serialize);
1079
1079
  }
1080
1080
  return acc;
1081
1081
  }, { parsers: {}, serializers: {} });
@@ -1086,15 +1086,15 @@ function escapeIdentifiers(xs, { transform: { column } }) {
1086
1086
  var escapeIdentifier = function escape(str) {
1087
1087
  return '"' + str.replace(/"/g, '""').replace(/\./g, '"."') + '"';
1088
1088
  };
1089
- var inferType = function inferType2(x) {
1090
- return x instanceof Parameter ? x.type : x instanceof Date ? 1184 : x instanceof Uint8Array ? 17 : x === true || x === false ? 16 : typeof x === "bigint" ? 20 : Array.isArray(x) ? inferType2(x[0]) : 0;
1089
+ var inferType = function inferType(x) {
1090
+ return x instanceof Parameter ? x.type : x instanceof Date ? 1184 : x instanceof Uint8Array ? 17 : x === true || x === false ? 16 : typeof x === "bigint" ? 20 : Array.isArray(x) ? inferType(x[0]) : 0;
1091
1091
  };
1092
1092
  var escapeBackslash = /\\/g;
1093
1093
  var escapeQuote = /"/g;
1094
1094
  function arrayEscape(x) {
1095
1095
  return x.replace(escapeBackslash, "\\\\").replace(escapeQuote, "\\\"");
1096
1096
  }
1097
- var arraySerializer = function arraySerializer2(xs, serializer, options, typarray) {
1097
+ var arraySerializer = function arraySerializer(xs, serializer, options, typarray) {
1098
1098
  if (Array.isArray(xs) === false)
1099
1099
  return xs;
1100
1100
  if (!xs.length)
@@ -1102,7 +1102,7 @@ var arraySerializer = function arraySerializer2(xs, serializer, options, typarra
1102
1102
  const first = xs[0];
1103
1103
  const delimiter = typarray === 1020 ? ";" : ",";
1104
1104
  if (Array.isArray(first) && !first.type)
1105
- return "{" + xs.map((x) => arraySerializer2(x, serializer, options, typarray)).join(delimiter) + "}";
1105
+ return "{" + xs.map((x) => arraySerializer(x, serializer, options, typarray)).join(delimiter) + "}";
1106
1106
  return "{" + xs.map((x) => {
1107
1107
  if (x === undefined) {
1108
1108
  x = options.transform.undefined;
@@ -1119,7 +1119,7 @@ var arrayParserState = {
1119
1119
  quoted: false,
1120
1120
  last: 0
1121
1121
  };
1122
- var arrayParser = function arrayParser2(x, parser, typarray) {
1122
+ var arrayParser = function arrayParser(x, parser, typarray) {
1123
1123
  arrayParserState.i = arrayParserState.last = 0;
1124
1124
  return arrayParserLoop(arrayParserState, x, parser, typarray);
1125
1125
  };
@@ -1176,7 +1176,7 @@ var fromPascal = (x) => (x.slice(0, 1) + x.slice(1).replace(/([A-Z])/g, "_$1")).
1176
1176
  var fromKebab = (x) => x.replace(/-/g, "_");
1177
1177
  function createJsonTransform(fn) {
1178
1178
  return function jsonTransform(x, column) {
1179
- return typeof x === "object" && x !== null && (column.type === 114 || column.type === 3802) ? Array.isArray(x) ? x.map((x2) => jsonTransform(x2, column)) : Object.entries(x).reduce((acc, [k, v]) => Object.assign(acc, { [fn(k)]: jsonTransform(v, column) }), {}) : x;
1179
+ return typeof x === "object" && x !== null && (column.type === 114 || column.type === 3802) ? Array.isArray(x) ? x.map((x) => jsonTransform(x, column)) : Object.entries(x).reduce((acc, [k, v]) => Object.assign(acc, { [fn(k)]: jsonTransform(v, column) }), {}) : x;
1180
1180
  };
1181
1181
  }
1182
1182
  toCamel.column = { from: toCamel };
@@ -1223,23 +1223,23 @@ class Result extends Array {
1223
1223
  var queue_default = Queue;
1224
1224
  function Queue(initial = []) {
1225
1225
  let xs = initial.slice();
1226
- let index2 = 0;
1226
+ let index = 0;
1227
1227
  return {
1228
1228
  get length() {
1229
- return xs.length - index2;
1229
+ return xs.length - index;
1230
1230
  },
1231
1231
  remove: (x) => {
1232
- const index3 = xs.indexOf(x);
1233
- return index3 === -1 ? null : (xs.splice(index3, 1), x);
1232
+ const index = xs.indexOf(x);
1233
+ return index === -1 ? null : (xs.splice(index, 1), x);
1234
1234
  },
1235
1235
  push: (x) => (xs.push(x), x),
1236
1236
  shift: () => {
1237
- const out = xs[index2++];
1238
- if (index2 === xs.length) {
1239
- index2 = 0;
1237
+ const out = xs[index++];
1238
+ if (index === xs.length) {
1239
+ index = 0;
1240
1240
  xs = [];
1241
1241
  } else {
1242
- xs[index2 - 1] = undefined;
1242
+ xs[index - 1] = undefined;
1243
1243
  }
1244
1244
  return out;
1245
1245
  }
@@ -1362,7 +1362,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1362
1362
  host,
1363
1363
  port,
1364
1364
  database,
1365
- parsers: parsers2,
1365
+ parsers,
1366
1366
  transform,
1367
1367
  onnotice,
1368
1368
  onnotify,
@@ -1374,11 +1374,11 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1374
1374
  } = options;
1375
1375
  const sent = queue_default(), id = uid++, backend = { pid: null, secret: null }, idleTimer = timer(end, options.idle_timeout), lifeTimer = timer(end, options.max_lifetime), connectTimer = timer(connectTimedOut, options.connect_timeout);
1376
1376
  let socket = null, cancelMessage, errorResponse = null, result = new Result, incoming = Buffer.alloc(0), needsTypes = options.fetch_types, backendParameters = {}, statements = {}, statementId = Math.random().toString(36).slice(2), statementCount = 1, closedTime = 0, remaining = 0, hostIndex = 0, retries = 0, length = 0, delay = 0, rows = 0, serverSignature = null, nextWriteTimer = null, terminated = false, incomings = null, results = null, initial = null, ending = null, stream = null, chunk = null, ended = null, nonce = null, query = null, final = null;
1377
- const connection2 = {
1377
+ const connection = {
1378
1378
  queue: queues.closed,
1379
1379
  idleTimer,
1380
- connect(query2) {
1381
- initial = query2;
1380
+ connect(query) {
1381
+ initial = query;
1382
1382
  reconnect();
1383
1383
  },
1384
1384
  terminate,
@@ -1388,8 +1388,8 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1388
1388
  count: 0,
1389
1389
  id
1390
1390
  };
1391
- queues.closed && queues.closed.push(connection2);
1392
- return connection2;
1391
+ queues.closed && queues.closed.push(connection);
1392
+ return connection;
1393
1393
  async function createSocket() {
1394
1394
  let x;
1395
1395
  try {
@@ -1409,8 +1409,8 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1409
1409
  await connect();
1410
1410
  socket.once("error", reject);
1411
1411
  socket.once("close", resolve);
1412
- } catch (error2) {
1413
- reject(error2);
1412
+ } catch (error) {
1413
+ reject(error);
1414
1414
  }
1415
1415
  }
1416
1416
  function execute(q) {
@@ -1424,10 +1424,10 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1424
1424
  q.state = backend;
1425
1425
  query ? sent.push(q) : (query = q, query.active = true);
1426
1426
  build(q);
1427
- return write(toBuffer(q)) && !q.describeFirst && !q.cursorFn && sent.length < max_pipeline && (!q.options.onexecute || q.options.onexecute(connection2));
1428
- } catch (error2) {
1427
+ return write(toBuffer(q)) && !q.describeFirst && !q.cursorFn && sent.length < max_pipeline && (!q.options.onexecute || q.options.onexecute(connection));
1428
+ } catch (error) {
1429
1429
  sent.length === 0 && write(Sync);
1430
- errored(error2);
1430
+ errored(error);
1431
1431
  return true;
1432
1432
  }
1433
1433
  }
@@ -1456,18 +1456,18 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1456
1456
  ]);
1457
1457
  }
1458
1458
  function build(q) {
1459
- const parameters = [], types2 = [];
1460
- const string = stringify(q, q.strings[0], q.args[0], parameters, types2, options);
1461
- !q.tagged && q.args.forEach((x) => handleValue(x, parameters, types2, options));
1459
+ const parameters = [], types = [];
1460
+ const string = stringify(q, q.strings[0], q.args[0], parameters, types, options);
1461
+ !q.tagged && q.args.forEach((x) => handleValue(x, parameters, types, options));
1462
1462
  q.prepare = options.prepare && ("prepare" in q.options ? q.options.prepare : true);
1463
1463
  q.string = string;
1464
- q.signature = q.prepare && types2 + string;
1464
+ q.signature = q.prepare && types + string;
1465
1465
  q.onlyDescribe && delete statements[q.signature];
1466
1466
  q.parameters = q.parameters || parameters;
1467
1467
  q.prepared = q.prepare && q.signature in statements;
1468
1468
  q.describeFirst = q.onlyDescribe || parameters.length && !q.prepared;
1469
- q.statement = q.prepared ? statements[q.signature] : { string, types: types2, name: q.prepare ? statementId + statementCount++ : "" };
1470
- typeof options.debug === "function" && options.debug(id, string, parameters, types2);
1469
+ q.statement = q.prepared ? statements[q.signature] : { string, types, name: q.prepare ? statementId + statementCount++ : "" };
1470
+ typeof options.debug === "function" && options.debug(id, string, parameters, types);
1471
1471
  }
1472
1472
  function write(x, fn) {
1473
1473
  chunk = chunk ? Buffer.concat([chunk, x]) : Buffer.from(x);
@@ -1493,25 +1493,25 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1493
1493
  if (!canSSL && ssl === "prefer")
1494
1494
  return connected();
1495
1495
  }
1496
- const options2 = {
1496
+ const options = {
1497
1497
  socket,
1498
1498
  servername: net.isIP(socket.host) ? undefined : socket.host
1499
1499
  };
1500
1500
  if (sslnegotiation === "direct")
1501
- options2.ALPNProtocols = ["postgresql"];
1501
+ options.ALPNProtocols = ["postgresql"];
1502
1502
  if (ssl === "require" || ssl === "allow" || ssl === "prefer")
1503
- options2.rejectUnauthorized = false;
1503
+ options.rejectUnauthorized = false;
1504
1504
  else if (typeof ssl === "object")
1505
- Object.assign(options2, ssl);
1505
+ Object.assign(options, ssl);
1506
1506
  socket.removeAllListeners();
1507
- socket = tls.connect(options2);
1507
+ socket = tls.connect(options);
1508
1508
  socket.on("secureConnect", connected);
1509
1509
  socket.on("error", error);
1510
1510
  socket.on("close", closed);
1511
1511
  socket.on("drain", drain);
1512
1512
  }
1513
1513
  function drain() {
1514
- !query && onopen(connection2);
1514
+ !query && onopen(connection);
1515
1515
  }
1516
1516
  function data(x) {
1517
1517
  if (incomings) {
@@ -1576,7 +1576,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1576
1576
  }
1577
1577
  }
1578
1578
  function error(err) {
1579
- if (connection2.queue === queues.connecting && options.host[retries + 1])
1579
+ if (connection.queue === queues.connecting && options.host[retries + 1])
1580
1580
  return;
1581
1581
  errored(err);
1582
1582
  while (sent.length)
@@ -1587,23 +1587,23 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1587
1587
  query && queryError(query, err);
1588
1588
  initial && (queryError(initial, err), initial = null);
1589
1589
  }
1590
- function queryError(query2, err) {
1591
- if (query2.reserve)
1592
- return query2.reject(err);
1590
+ function queryError(query, err) {
1591
+ if (query.reserve)
1592
+ return query.reject(err);
1593
1593
  if (!err || typeof err !== "object")
1594
1594
  err = new Error(err);
1595
1595
  "query" in err || "parameters" in err || Object.defineProperties(err, {
1596
- stack: { value: err.stack + query2.origin.replace(/.*\n/, `
1596
+ stack: { value: err.stack + query.origin.replace(/.*\n/, `
1597
1597
  `), enumerable: options.debug },
1598
- query: { value: query2.string, enumerable: options.debug },
1599
- parameters: { value: query2.parameters, enumerable: options.debug },
1600
- args: { value: query2.args, enumerable: options.debug },
1601
- types: { value: query2.statement && query2.statement.types, enumerable: options.debug }
1598
+ query: { value: query.string, enumerable: options.debug },
1599
+ parameters: { value: query.parameters, enumerable: options.debug },
1600
+ args: { value: query.args, enumerable: options.debug },
1601
+ types: { value: query.statement && query.statement.types, enumerable: options.debug }
1602
1602
  });
1603
- query2.reject(err);
1603
+ query.reject(err);
1604
1604
  }
1605
1605
  function end() {
1606
- return ending || (!connection2.reserved && onend(connection2), !connection2.reserved && !initial && !query && sent.length === 0 ? (terminate(), new Promise((r) => socket && socket.readyState !== "closed" ? socket.once("close", r) : r())) : ending = new Promise((r) => ended = r));
1606
+ return ending || (!connection.reserved && onend(connection), !connection.reserved && !initial && !query && sent.length === 0 ? (terminate(), new Promise((r) => socket && socket.readyState !== "closed" ? socket.once("close", r) : r())) : ending = new Promise((r) => ended = r));
1607
1607
  }
1608
1608
  function terminate() {
1609
1609
  terminated = true;
@@ -1635,22 +1635,22 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1635
1635
  closedTime = performance.now();
1636
1636
  hadError && options.shared.retries++;
1637
1637
  delay = (typeof backoff === "function" ? backoff(options.shared.retries) : backoff) * 1000;
1638
- onclose(connection2, Errors.connection("CONNECTION_CLOSED", options, socket));
1638
+ onclose(connection, Errors.connection("CONNECTION_CLOSED", options, socket));
1639
1639
  }
1640
1640
  function handle(xs, x = xs[0]) {
1641
1641
  (x === 68 ? DataRow : x === 100 ? CopyData : x === 65 ? NotificationResponse : x === 83 ? ParameterStatus : x === 90 ? ReadyForQuery : x === 67 ? CommandComplete : x === 50 ? BindComplete : x === 49 ? ParseComplete : x === 116 ? ParameterDescription : x === 84 ? RowDescription : x === 82 ? Authentication : x === 110 ? NoData : x === 75 ? BackendKeyData : x === 69 ? ErrorResponse : x === 115 ? PortalSuspended : x === 51 ? CloseComplete : x === 71 ? CopyInResponse : x === 78 ? NoticeResponse : x === 72 ? CopyOutResponse : x === 99 ? CopyDone : x === 73 ? EmptyQueryResponse : x === 86 ? FunctionCallResponse : x === 118 ? NegotiateProtocolVersion : x === 87 ? CopyBothResponse : UnknownMessage)(xs);
1642
1642
  }
1643
1643
  function DataRow(x) {
1644
- let index2 = 7;
1645
- let length2;
1644
+ let index = 7;
1645
+ let length;
1646
1646
  let column;
1647
1647
  let value;
1648
1648
  const row = query.isRaw ? new Array(query.statement.columns.length) : {};
1649
1649
  for (let i = 0;i < query.statement.columns.length; i++) {
1650
1650
  column = query.statement.columns[i];
1651
- length2 = x.readInt32BE(index2);
1652
- index2 += 4;
1653
- value = length2 === -1 ? null : query.isRaw === true ? x.subarray(index2, index2 += length2) : column.parser === undefined ? x.toString("utf8", index2, index2 += length2) : column.parser.array === true ? column.parser(x.toString("utf8", index2 + 1, index2 += length2)) : column.parser(x.toString("utf8", index2, index2 += length2));
1651
+ length = x.readInt32BE(index);
1652
+ index += 4;
1653
+ value = length === -1 ? null : query.isRaw === true ? x.subarray(index, index += length) : column.parser === undefined ? x.toString("utf8", index, index += length) : column.parser.array === true ? column.parser(x.toString("utf8", index + 1, index += length)) : column.parser(x.toString("utf8", index, index += length));
1654
1654
  query.isRaw ? row[i] = query.isRaw === true ? value : transform.value.from ? transform.value.from(value, column) : value : row[column.name] = transform.value.from ? transform.value.from(value, column) : value;
1655
1655
  }
1656
1656
  query.forEachFn ? query.forEachFn(transform.row.from ? transform.row.from(row) : row, result) : result[rows++] = transform.row.from ? transform.row.from(row) : row;
@@ -1696,7 +1696,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1696
1696
  Connection(options).cancel(query.state, query.cancelled.resolve, query.cancelled.reject);
1697
1697
  if (query)
1698
1698
  return;
1699
- connection2.reserved ? !connection2.reserved.release && x[5] === 73 ? ending ? terminate() : (connection2.reserved = null, onopen(connection2)) : connection2.reserved() : ending ? terminate() : onopen(connection2);
1699
+ connection.reserved ? !connection.reserved.release && x[5] === 73 ? ending ? terminate() : (connection.reserved = null, onopen(connection)) : connection.reserved() : ending ? terminate() : onopen(connection);
1700
1700
  }
1701
1701
  function CommandComplete(x) {
1702
1702
  rows = 0;
@@ -1710,7 +1710,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1710
1710
  }
1711
1711
  }
1712
1712
  final && (final(), final = null);
1713
- if (result.command === "BEGIN" && max !== 1 && !connection2.reserved)
1713
+ if (result.command === "BEGIN" && max !== 1 && !connection.reserved)
1714
1714
  return errored(Errors.generic("UNSAFE_TRANSACTION", "Only use sql.begin, sql.reserved or max: 1"));
1715
1715
  if (query.options.simple)
1716
1716
  return BindComplete();
@@ -1727,8 +1727,8 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1727
1727
  result.columns = query.statement.columns;
1728
1728
  }
1729
1729
  function ParameterDescription(x) {
1730
- const length2 = x.readUInt16BE(5);
1731
- for (let i = 0;i < length2; ++i)
1730
+ const length = x.readUInt16BE(5);
1731
+ for (let i = 0;i < length; ++i)
1732
1732
  !query.statement.types[i] && (query.statement.types[i] = x.readUInt32BE(7 + i * 4));
1733
1733
  query.prepare && (statements[query.signature] = query.statement);
1734
1734
  query.describeFirst && !query.onlyDescribe && (write(prepared(query)), query.describeFirst = false);
@@ -1740,25 +1740,25 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1740
1740
  result.count = null;
1741
1741
  query.statement.columns = null;
1742
1742
  }
1743
- const length2 = x.readUInt16BE(5);
1744
- let index2 = 7;
1743
+ const length = x.readUInt16BE(5);
1744
+ let index = 7;
1745
1745
  let start;
1746
- query.statement.columns = Array(length2);
1747
- for (let i = 0;i < length2; ++i) {
1748
- start = index2;
1749
- while (x[index2++] !== 0)
1746
+ query.statement.columns = Array(length);
1747
+ for (let i = 0;i < length; ++i) {
1748
+ start = index;
1749
+ while (x[index++] !== 0)
1750
1750
  ;
1751
- const table = x.readUInt32BE(index2);
1752
- const number = x.readUInt16BE(index2 + 4);
1753
- const type = x.readUInt32BE(index2 + 6);
1751
+ const table = x.readUInt32BE(index);
1752
+ const number = x.readUInt16BE(index + 4);
1753
+ const type = x.readUInt32BE(index + 6);
1754
1754
  query.statement.columns[i] = {
1755
- name: transform.column.from ? transform.column.from(x.toString("utf8", start, index2 - 1)) : x.toString("utf8", start, index2 - 1),
1756
- parser: parsers2[type],
1755
+ name: transform.column.from ? transform.column.from(x.toString("utf8", start, index - 1)) : x.toString("utf8", start, index - 1),
1756
+ parser: parsers[type],
1757
1757
  table,
1758
1758
  number,
1759
1759
  type
1760
1760
  };
1761
- index2 += 18;
1761
+ index += 18;
1762
1762
  }
1763
1763
  result.statement = query.statement;
1764
1764
  if (query.onlyDescribe)
@@ -1785,7 +1785,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1785
1785
  write(bytes_default.inc(4).str("n,,n=*,r=" + nonce).i32(bytes_default.i - i - 4, i).end());
1786
1786
  }
1787
1787
  async function SASLContinue(x) {
1788
- const res = x.toString("utf8", 9).split(",").reduce((acc, x2) => (acc[x2[0]] = x2.slice(2), acc), {});
1788
+ const res = x.toString("utf8", 9).split(",").reduce((acc, x) => (acc[x[0]] = x.slice(2), acc), {});
1789
1789
  const saltedPassword = await crypto.pbkdf2Sync(await Pass(), Buffer.from(res.s, "base64"), parseInt(res.i), 32, "sha256");
1790
1790
  const clientKey = await hmac(saltedPassword, "Client Key");
1791
1791
  const auth = "n=*,r=" + nonce + "," + "r=" + res.r + ",s=" + res.s + ",i=" + res.i + ",c=biws,r=" + res.r;
@@ -1814,7 +1814,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1814
1814
  }
1815
1815
  async function fetchArrayTypes() {
1816
1816
  needsTypes = false;
1817
- const types2 = await new Query([`
1817
+ const types = await new Query([`
1818
1818
  select b.oid, b.typarray
1819
1819
  from pg_catalog.pg_type a
1820
1820
  left join pg_catalog.pg_type b on b.oid = a.typelem
@@ -1822,7 +1822,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1822
1822
  group by b.oid, b.typarray
1823
1823
  order by b.oid
1824
1824
  `], [], execute);
1825
- types2.forEach(({ oid, typarray }) => addArrayType(oid, typarray));
1825
+ types.forEach(({ oid, typarray }) => addArrayType(oid, typarray));
1826
1826
  }
1827
1827
  function addArrayType(oid, typarray) {
1828
1828
  if (!!options.parsers[typarray] && !!options.serializers[typarray])
@@ -1837,15 +1837,15 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1837
1837
  return x === "read-write" && xs.default_transaction_read_only === "on" || x === "read-only" && xs.default_transaction_read_only === "off" || x === "primary" && xs.in_hot_standby === "on" || x === "standby" && xs.in_hot_standby === "off" || x === "prefer-standby" && xs.in_hot_standby === "off" && options.host[retries];
1838
1838
  }
1839
1839
  function fetchState() {
1840
- const query2 = new Query([`
1840
+ const query = new Query([`
1841
1841
  show transaction_read_only;
1842
1842
  select pg_catalog.pg_is_in_recovery()
1843
1843
  `], [], execute, null, { simple: true });
1844
- query2.resolve = ([[a], [b2]]) => {
1844
+ query.resolve = ([[a], [b]]) => {
1845
1845
  backendParameters.default_transaction_read_only = a.transaction_read_only;
1846
- backendParameters.in_hot_standby = b2.pg_is_in_recovery ? "on" : "off";
1846
+ backendParameters.in_hot_standby = b.pg_is_in_recovery ? "on" : "off";
1847
1847
  };
1848
- query2.execute();
1848
+ query.execute();
1849
1849
  }
1850
1850
  function ErrorResponse(x) {
1851
1851
  if (query) {
@@ -1855,18 +1855,18 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1855
1855
  errored(Errors.postgres(parseError(x)));
1856
1856
  }
1857
1857
  }
1858
- function retry(q, error2) {
1858
+ function retry(q, error) {
1859
1859
  delete statements[q.signature];
1860
- q.retried = error2;
1860
+ q.retried = error;
1861
1861
  execute(q);
1862
1862
  }
1863
1863
  function NotificationResponse(x) {
1864
1864
  if (!onnotify)
1865
1865
  return;
1866
- let index2 = 9;
1867
- while (x[index2++] !== 0)
1866
+ let index = 9;
1867
+ while (x[index++] !== 0)
1868
1868
  ;
1869
- onnotify(x.toString("utf8", 9, index2 - 1), x.toString("utf8", index2, x.length - 1));
1869
+ onnotify(x.toString("utf8", 9, index - 1), x.toString("utf8", index, x.length - 1));
1870
1870
  }
1871
1871
  async function PortalSuspended() {
1872
1872
  try {
@@ -1885,12 +1885,12 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1885
1885
  function CopyInResponse() {
1886
1886
  stream = new Stream.Writable({
1887
1887
  autoDestroy: true,
1888
- write(chunk2, encoding, callback) {
1889
- socket.write(bytes_default().d().raw(chunk2).end(), callback);
1888
+ write(chunk, encoding, callback) {
1889
+ socket.write(bytes_default().d().raw(chunk).end(), callback);
1890
1890
  },
1891
- destroy(error2, callback) {
1892
- callback(error2);
1893
- socket.write(bytes_default().f().str(error2 + bytes_default.N).end());
1891
+ destroy(error, callback) {
1892
+ callback(error);
1893
+ socket.write(bytes_default().f().str(error + bytes_default.N).end());
1894
1894
  stream = null;
1895
1895
  },
1896
1896
  final(callback) {
@@ -1915,12 +1915,12 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1915
1915
  read() {
1916
1916
  socket.resume();
1917
1917
  },
1918
- write(chunk2, encoding, callback) {
1919
- socket.write(bytes_default().d().raw(chunk2).end(), callback);
1918
+ write(chunk, encoding, callback) {
1919
+ socket.write(bytes_default().d().raw(chunk).end(), callback);
1920
1920
  },
1921
- destroy(error2, callback) {
1922
- callback(error2);
1923
- socket.write(bytes_default().f().str(error2 + bytes_default.N).end());
1921
+ destroy(error, callback) {
1922
+ callback(error);
1923
+ socket.write(bytes_default().f().str(error + bytes_default.N).end());
1924
1924
  stream = null;
1925
1925
  },
1926
1926
  final(callback) {
@@ -1953,13 +1953,13 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1953
1953
  function UnknownAuth(x, type) {
1954
1954
  console.error("Postgres.js : Unknown Auth:", type);
1955
1955
  }
1956
- function Bind(parameters, types2, statement = "", portal = "") {
1956
+ function Bind(parameters, types, statement = "", portal = "") {
1957
1957
  let prev, type;
1958
1958
  bytes_default().B().str(portal + bytes_default.N).str(statement + bytes_default.N).i16(0).i16(parameters.length);
1959
1959
  parameters.forEach((x, i) => {
1960
1960
  if (x === null)
1961
1961
  return bytes_default.i32(4294967295);
1962
- type = types2[i];
1962
+ type = types[i];
1963
1963
  parameters[i] = x = type in options.serializers ? options.serializers[type](x) : "" + x;
1964
1964
  prev = bytes_default.i;
1965
1965
  bytes_default.inc(4).str(x).i32(bytes_default.i - prev - 4, prev);
@@ -1967,17 +1967,17 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
1967
1967
  bytes_default.i16(0);
1968
1968
  return bytes_default.end();
1969
1969
  }
1970
- function Parse(str, parameters, types2, name = "") {
1970
+ function Parse(str, parameters, types, name = "") {
1971
1971
  bytes_default().P().str(name + bytes_default.N).str(str + bytes_default.N).i16(parameters.length);
1972
- parameters.forEach((x, i) => bytes_default.i32(types2[i] || 0));
1972
+ parameters.forEach((x, i) => bytes_default.i32(types[i] || 0));
1973
1973
  return bytes_default.end();
1974
1974
  }
1975
1975
  function Describe(x, name = "") {
1976
1976
  return bytes_default().D().str(x).str(name + bytes_default.N).end();
1977
1977
  }
1978
- function Execute(portal = "", rows2 = 0) {
1978
+ function Execute(portal = "", rows = 0) {
1979
1979
  return Buffer.concat([
1980
- bytes_default().E().str(portal + bytes_default.N).i32(rows2).end(),
1980
+ bytes_default().E().str(portal + bytes_default.N).i32(rows).end(),
1981
1981
  Flush
1982
1982
  ]);
1983
1983
  }
@@ -2015,39 +2015,39 @@ function hmac(key, x) {
2015
2015
  function sha256(x) {
2016
2016
  return crypto.createHash("sha256").update(x).digest();
2017
2017
  }
2018
- function xor(a, b2) {
2019
- const length = Math.max(a.length, b2.length);
2020
- const buffer2 = Buffer.allocUnsafe(length);
2018
+ function xor(a, b) {
2019
+ const length = Math.max(a.length, b.length);
2020
+ const buffer = Buffer.allocUnsafe(length);
2021
2021
  for (let i = 0;i < length; i++)
2022
- buffer2[i] = a[i] ^ b2[i];
2023
- return buffer2;
2022
+ buffer[i] = a[i] ^ b[i];
2023
+ return buffer;
2024
2024
  }
2025
2025
  function timer(fn, seconds) {
2026
2026
  seconds = typeof seconds === "function" ? seconds() : seconds;
2027
2027
  if (!seconds)
2028
2028
  return { cancel: noop, start: noop };
2029
- let timer2;
2029
+ let timer;
2030
2030
  return {
2031
2031
  cancel() {
2032
- timer2 && (clearTimeout(timer2), timer2 = null);
2032
+ timer && (clearTimeout(timer), timer = null);
2033
2033
  },
2034
2034
  start() {
2035
- timer2 && clearTimeout(timer2);
2036
- timer2 = setTimeout(done, seconds * 1000, arguments);
2035
+ timer && clearTimeout(timer);
2036
+ timer = setTimeout(done, seconds * 1000, arguments);
2037
2037
  }
2038
2038
  };
2039
2039
  function done(args) {
2040
2040
  fn.apply(null, args);
2041
- timer2 = null;
2041
+ timer = null;
2042
2042
  }
2043
2043
  }
2044
2044
 
2045
2045
  // ../../node_modules/.bun/postgres@3.4.9/node_modules/postgres/src/subscribe.js
2046
2046
  var noop2 = () => {};
2047
- function Subscribe(postgres2, options) {
2047
+ function Subscribe(postgres, options) {
2048
2048
  const subscribers = new Map, slot = "postgresjs_" + Math.random().toString(36).slice(2), state = {};
2049
- let connection2, stream, ended = false;
2050
- const sql2 = subscribe.sql = postgres2({
2049
+ let connection, stream, ended = false;
2050
+ const sql = subscribe.sql = postgres({
2051
2051
  ...options,
2052
2052
  transform: { column: {}, value: {}, row: {} },
2053
2053
  max: 1,
@@ -2063,37 +2063,37 @@ function Subscribe(postgres2, options) {
2063
2063
  return;
2064
2064
  stream = null;
2065
2065
  state.pid = state.secret = undefined;
2066
- connected(await init(sql2, slot, options.publications));
2066
+ connected(await init(sql, slot, options.publications));
2067
2067
  subscribers.forEach((event) => event.forEach(({ onsubscribe }) => onsubscribe()));
2068
2068
  },
2069
2069
  no_subscribe: true
2070
2070
  });
2071
- const { end, close } = sql2;
2072
- sql2.end = async () => {
2071
+ const { end, close } = sql;
2072
+ sql.end = async () => {
2073
2073
  ended = true;
2074
2074
  stream && await new Promise((r) => (stream.once("close", r), stream.end()));
2075
2075
  return end();
2076
2076
  };
2077
- sql2.close = async () => {
2077
+ sql.close = async () => {
2078
2078
  stream && await new Promise((r) => (stream.once("close", r), stream.end()));
2079
2079
  return close();
2080
2080
  };
2081
2081
  return subscribe;
2082
2082
  async function subscribe(event, fn, onsubscribe = noop2, onerror = noop2) {
2083
2083
  event = parseEvent(event);
2084
- if (!connection2)
2085
- connection2 = init(sql2, slot, options.publications);
2084
+ if (!connection)
2085
+ connection = init(sql, slot, options.publications);
2086
2086
  const subscriber = { fn, onsubscribe };
2087
2087
  const fns = subscribers.has(event) ? subscribers.get(event).add(subscriber) : subscribers.set(event, new Set([subscriber])).get(event);
2088
2088
  const unsubscribe = () => {
2089
2089
  fns.delete(subscriber);
2090
2090
  fns.size === 0 && subscribers.delete(event);
2091
2091
  };
2092
- return connection2.then((x) => {
2092
+ return connection.then((x) => {
2093
2093
  connected(x);
2094
2094
  onsubscribe();
2095
2095
  stream && stream.on("error", onerror);
2096
- return { unsubscribe, state, sql: sql2 };
2096
+ return { unsubscribe, state, sql };
2097
2097
  });
2098
2098
  }
2099
2099
  function connected(x) {
@@ -2101,74 +2101,74 @@ function Subscribe(postgres2, options) {
2101
2101
  state.pid = x.state.pid;
2102
2102
  state.secret = x.state.secret;
2103
2103
  }
2104
- async function init(sql3, slot2, publications) {
2104
+ async function init(sql, slot, publications) {
2105
2105
  if (!publications)
2106
2106
  throw new Error("Missing publication names");
2107
- const xs = await sql3.unsafe(`CREATE_REPLICATION_SLOT ${slot2} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`);
2107
+ const xs = await sql.unsafe(`CREATE_REPLICATION_SLOT ${slot} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`);
2108
2108
  const [x] = xs;
2109
- const stream2 = await sql3.unsafe(`START_REPLICATION SLOT ${slot2} LOGICAL ${x.consistent_point} (proto_version '1', publication_names '${publications}')`).writable();
2110
- const state2 = {
2111
- lsn: Buffer.concat(x.consistent_point.split("/").map((x2) => Buffer.from(("00000000" + x2).slice(-8), "hex")))
2109
+ const stream = await sql.unsafe(`START_REPLICATION SLOT ${slot} LOGICAL ${x.consistent_point} (proto_version '1', publication_names '${publications}')`).writable();
2110
+ const state = {
2111
+ lsn: Buffer.concat(x.consistent_point.split("/").map((x) => Buffer.from(("00000000" + x).slice(-8), "hex")))
2112
2112
  };
2113
- stream2.on("data", data);
2114
- stream2.on("error", error);
2115
- stream2.on("close", sql3.close);
2116
- return { stream: stream2, state: xs.state };
2113
+ stream.on("data", data);
2114
+ stream.on("error", error);
2115
+ stream.on("close", sql.close);
2116
+ return { stream, state: xs.state };
2117
2117
  function error(e) {
2118
2118
  console.error("Unexpected error during logical streaming - reconnecting", e);
2119
2119
  }
2120
- function data(x2) {
2121
- if (x2[0] === 119) {
2122
- parse(x2.subarray(25), state2, sql3.options.parsers, handle, options.transform);
2123
- } else if (x2[0] === 107 && x2[17]) {
2124
- state2.lsn = x2.subarray(1, 9);
2120
+ function data(x) {
2121
+ if (x[0] === 119) {
2122
+ parse(x.subarray(25), state, sql.options.parsers, handle, options.transform);
2123
+ } else if (x[0] === 107 && x[17]) {
2124
+ state.lsn = x.subarray(1, 9);
2125
2125
  pong();
2126
2126
  }
2127
2127
  }
2128
- function handle(a, b2) {
2129
- const path = b2.relation.schema + "." + b2.relation.table;
2130
- call("*", a, b2);
2131
- call("*:" + path, a, b2);
2132
- b2.relation.keys.length && call("*:" + path + "=" + b2.relation.keys.map((x2) => a[x2.name]), a, b2);
2133
- call(b2.command, a, b2);
2134
- call(b2.command + ":" + path, a, b2);
2135
- b2.relation.keys.length && call(b2.command + ":" + path + "=" + b2.relation.keys.map((x2) => a[x2.name]), a, b2);
2128
+ function handle(a, b) {
2129
+ const path = b.relation.schema + "." + b.relation.table;
2130
+ call("*", a, b);
2131
+ call("*:" + path, a, b);
2132
+ b.relation.keys.length && call("*:" + path + "=" + b.relation.keys.map((x) => a[x.name]), a, b);
2133
+ call(b.command, a, b);
2134
+ call(b.command + ":" + path, a, b);
2135
+ b.relation.keys.length && call(b.command + ":" + path + "=" + b.relation.keys.map((x) => a[x.name]), a, b);
2136
2136
  }
2137
2137
  function pong() {
2138
- const x2 = Buffer.alloc(34);
2139
- x2[0] = 114;
2140
- x2.fill(state2.lsn, 1);
2141
- x2.writeBigInt64BE(BigInt(Date.now() - Date.UTC(2000, 0, 1)) * BigInt(1000), 25);
2142
- stream2.write(x2);
2138
+ const x = Buffer.alloc(34);
2139
+ x[0] = 114;
2140
+ x.fill(state.lsn, 1);
2141
+ x.writeBigInt64BE(BigInt(Date.now() - Date.UTC(2000, 0, 1)) * BigInt(1000), 25);
2142
+ stream.write(x);
2143
2143
  }
2144
2144
  }
2145
- function call(x, a, b2) {
2146
- subscribers.has(x) && subscribers.get(x).forEach(({ fn }) => fn(a, b2, x));
2145
+ function call(x, a, b) {
2146
+ subscribers.has(x) && subscribers.get(x).forEach(({ fn }) => fn(a, b, x));
2147
2147
  }
2148
2148
  }
2149
2149
  function Time(x) {
2150
2150
  return new Date(Date.UTC(2000, 0, 1) + Number(x / BigInt(1000)));
2151
2151
  }
2152
- function parse(x, state, parsers2, handle, transform) {
2152
+ function parse(x, state, parsers, handle, transform) {
2153
2153
  const char = (acc, [k, v]) => (acc[k.charCodeAt(0)] = v, acc);
2154
2154
  Object.entries({
2155
- R: (x2) => {
2155
+ R: (x) => {
2156
2156
  let i = 1;
2157
- const r = state[x2.readUInt32BE(i)] = {
2158
- schema: x2.toString("utf8", i += 4, i = x2.indexOf(0, i)) || "pg_catalog",
2159
- table: x2.toString("utf8", i + 1, i = x2.indexOf(0, i + 1)),
2160
- columns: Array(x2.readUInt16BE(i += 2)),
2157
+ const r = state[x.readUInt32BE(i)] = {
2158
+ schema: x.toString("utf8", i += 4, i = x.indexOf(0, i)) || "pg_catalog",
2159
+ table: x.toString("utf8", i + 1, i = x.indexOf(0, i + 1)),
2160
+ columns: Array(x.readUInt16BE(i += 2)),
2161
2161
  keys: []
2162
2162
  };
2163
2163
  i += 2;
2164
2164
  let columnIndex = 0, column;
2165
- while (i < x2.length) {
2165
+ while (i < x.length) {
2166
2166
  column = r.columns[columnIndex++] = {
2167
- key: x2[i++],
2168
- name: transform.column.from ? transform.column.from(x2.toString("utf8", i, i = x2.indexOf(0, i))) : x2.toString("utf8", i, i = x2.indexOf(0, i)),
2169
- type: x2.readUInt32BE(i += 1),
2170
- parser: parsers2[x2.readUInt32BE(i)],
2171
- atttypmod: x2.readUInt32BE(i += 4)
2167
+ key: x[i++],
2168
+ name: transform.column.from ? transform.column.from(x.toString("utf8", i, i = x.indexOf(0, i))) : x.toString("utf8", i, i = x.indexOf(0, i)),
2169
+ type: x.readUInt32BE(i += 1),
2170
+ parser: parsers[x.readUInt32BE(i)],
2171
+ atttypmod: x.readUInt32BE(i += 4)
2172
2172
  };
2173
2173
  column.key && r.keys.push(column);
2174
2174
  i += 4;
@@ -2176,38 +2176,38 @@ function parse(x, state, parsers2, handle, transform) {
2176
2176
  },
2177
2177
  Y: () => {},
2178
2178
  O: () => {},
2179
- B: (x2) => {
2180
- state.date = Time(x2.readBigInt64BE(9));
2181
- state.lsn = x2.subarray(1, 9);
2179
+ B: (x) => {
2180
+ state.date = Time(x.readBigInt64BE(9));
2181
+ state.lsn = x.subarray(1, 9);
2182
2182
  },
2183
- I: (x2) => {
2183
+ I: (x) => {
2184
2184
  let i = 1;
2185
- const relation = state[x2.readUInt32BE(i)];
2186
- const { row } = tuples(x2, relation.columns, i += 7, transform);
2185
+ const relation = state[x.readUInt32BE(i)];
2186
+ const { row } = tuples(x, relation.columns, i += 7, transform);
2187
2187
  handle(row, {
2188
2188
  command: "insert",
2189
2189
  relation
2190
2190
  });
2191
2191
  },
2192
- D: (x2) => {
2192
+ D: (x) => {
2193
2193
  let i = 1;
2194
- const relation = state[x2.readUInt32BE(i)];
2194
+ const relation = state[x.readUInt32BE(i)];
2195
2195
  i += 4;
2196
- const key = x2[i] === 75;
2197
- handle(key || x2[i] === 79 ? tuples(x2, relation.columns, i += 3, transform).row : null, {
2196
+ const key = x[i] === 75;
2197
+ handle(key || x[i] === 79 ? tuples(x, relation.columns, i += 3, transform).row : null, {
2198
2198
  command: "delete",
2199
2199
  relation,
2200
2200
  key
2201
2201
  });
2202
2202
  },
2203
- U: (x2) => {
2203
+ U: (x) => {
2204
2204
  let i = 1;
2205
- const relation = state[x2.readUInt32BE(i)];
2205
+ const relation = state[x.readUInt32BE(i)];
2206
2206
  i += 4;
2207
- const key = x2[i] === 75;
2208
- const xs = key || x2[i] === 79 ? tuples(x2, relation.columns, i += 3, transform) : null;
2207
+ const key = x[i] === 75;
2208
+ const xs = key || x[i] === 79 ? tuples(x, relation.columns, i += 3, transform) : null;
2209
2209
  xs && (i = xs.i);
2210
- const { row } = tuples(x2, relation.columns, i + 3, transform);
2210
+ const { row } = tuples(x, relation.columns, i + 3, transform);
2211
2211
  handle(row, {
2212
2212
  command: "update",
2213
2213
  relation,
@@ -2240,22 +2240,22 @@ function parseEvent(x) {
2240
2240
 
2241
2241
  // ../../node_modules/.bun/postgres@3.4.9/node_modules/postgres/src/large.js
2242
2242
  import Stream2 from "stream";
2243
- function largeObject(sql2, oid, mode = 131072 | 262144) {
2243
+ function largeObject(sql, oid, mode = 131072 | 262144) {
2244
2244
  return new Promise(async (resolve, reject) => {
2245
- await sql2.begin(async (sql3) => {
2245
+ await sql.begin(async (sql) => {
2246
2246
  let finish;
2247
- !oid && ([{ oid }] = await sql3`select lo_creat(-1) as oid`);
2248
- const [{ fd }] = await sql3`select lo_open(${oid}, ${mode}) as fd`;
2247
+ !oid && ([{ oid }] = await sql`select lo_creat(-1) as oid`);
2248
+ const [{ fd }] = await sql`select lo_open(${oid}, ${mode}) as fd`;
2249
2249
  const lo = {
2250
2250
  writable,
2251
2251
  readable,
2252
- close: () => sql3`select lo_close(${fd})`.then(finish),
2253
- tell: () => sql3`select lo_tell64(${fd})`,
2254
- read: (x) => sql3`select loread(${fd}, ${x}) as data`,
2255
- write: (x) => sql3`select lowrite(${fd}, ${x})`,
2256
- truncate: (x) => sql3`select lo_truncate64(${fd}, ${x})`,
2257
- seek: (x, whence = 0) => sql3`select lo_lseek64(${fd}, ${x}, ${whence})`,
2258
- size: () => sql3`
2252
+ close: () => sql`select lo_close(${fd})`.then(finish),
2253
+ tell: () => sql`select lo_tell64(${fd})`,
2254
+ read: (x) => sql`select loread(${fd}, ${x}) as data`,
2255
+ write: (x) => sql`select lowrite(${fd}, ${x})`,
2256
+ truncate: (x) => sql`select lo_truncate64(${fd}, ${x})`,
2257
+ seek: (x, whence = 0) => sql`select lo_lseek64(${fd}, ${x}, ${whence})`,
2258
+ size: () => sql`
2259
2259
  select
2260
2260
  lo_lseek64(${fd}, location, 0) as position,
2261
2261
  seek.size
@@ -2278,12 +2278,12 @@ function largeObject(sql2, oid, mode = 131072 | 262144) {
2278
2278
  start && await lo.seek(start);
2279
2279
  return new Stream2.Readable({
2280
2280
  highWaterMark,
2281
- async read(size2) {
2282
- const l = size2 > max ? size2 - max : size2;
2283
- max -= size2;
2281
+ async read(size) {
2282
+ const l = size > max ? size - max : size;
2283
+ max -= size;
2284
2284
  const [{ data }] = await lo.read(l);
2285
2285
  this.push(data);
2286
- if (data.length < size2)
2286
+ if (data.length < size)
2287
2287
  this.push(null);
2288
2288
  }
2289
2289
  });
@@ -2324,17 +2324,17 @@ Object.assign(Postgres, {
2324
2324
  }
2325
2325
  });
2326
2326
  var src_default = Postgres;
2327
- function Postgres(a, b2) {
2328
- const options = parseOptions(a, b2), subscribe = options.no_subscribe || Subscribe(Postgres, { ...options });
2327
+ function Postgres(a, b) {
2328
+ const options = parseOptions(a, b), subscribe = options.no_subscribe || Subscribe(Postgres, { ...options });
2329
2329
  let ending = false;
2330
2330
  const queries = queue_default(), connecting = queue_default(), reserved = queue_default(), closed = queue_default(), ended = queue_default(), open = queue_default(), busy = queue_default(), full = queue_default(), queues = { connecting, reserved, closed, ended, open, busy, full };
2331
2331
  const connections = [...Array(options.max)].map(() => connection_default(options, queues, { onopen, onend, onclose }));
2332
- const sql2 = Sql(handler);
2333
- Object.assign(sql2, {
2332
+ const sql = Sql(handler);
2333
+ Object.assign(sql, {
2334
2334
  get parameters() {
2335
2335
  return options.parameters;
2336
2336
  },
2337
- largeObject: largeObject.bind(null, sql2),
2337
+ largeObject: largeObject.bind(null, sql),
2338
2338
  subscribe,
2339
2339
  CLOSE,
2340
2340
  END: CLOSE,
@@ -2346,14 +2346,14 @@ function Postgres(a, b2) {
2346
2346
  close,
2347
2347
  end
2348
2348
  });
2349
- return sql2;
2350
- function Sql(handler2) {
2351
- handler2.debug = options.debug;
2349
+ return sql;
2350
+ function Sql(handler) {
2351
+ handler.debug = options.debug;
2352
2352
  Object.entries(options.types).reduce((acc, [name, type]) => {
2353
2353
  acc[name] = (x) => new Parameter(x, type.to);
2354
2354
  return acc;
2355
2355
  }, typed);
2356
- Object.assign(sql3, {
2356
+ Object.assign(sql, {
2357
2357
  types: typed,
2358
2358
  typed,
2359
2359
  unsafe,
@@ -2362,51 +2362,51 @@ function Postgres(a, b2) {
2362
2362
  json,
2363
2363
  file
2364
2364
  });
2365
- return sql3;
2365
+ return sql;
2366
2366
  function typed(value, type) {
2367
2367
  return new Parameter(value, type);
2368
2368
  }
2369
- function sql3(strings, ...args) {
2370
- const query = strings && Array.isArray(strings.raw) ? new Query(strings, args, handler2, cancel) : typeof strings === "string" && !args.length ? new Identifier(options.transform.column.to ? options.transform.column.to(strings) : strings) : new Builder(strings, args);
2369
+ function sql(strings, ...args) {
2370
+ const query = strings && Array.isArray(strings.raw) ? new Query(strings, args, handler, cancel) : typeof strings === "string" && !args.length ? new Identifier(options.transform.column.to ? options.transform.column.to(strings) : strings) : new Builder(strings, args);
2371
2371
  return query;
2372
2372
  }
2373
- function unsafe(string, args = [], options2 = {}) {
2374
- arguments.length === 2 && !Array.isArray(args) && (options2 = args, args = []);
2375
- const query = new Query([string], args, handler2, cancel, {
2373
+ function unsafe(string, args = [], options = {}) {
2374
+ arguments.length === 2 && !Array.isArray(args) && (options = args, args = []);
2375
+ const query = new Query([string], args, handler, cancel, {
2376
2376
  prepare: false,
2377
- ...options2,
2378
- simple: "simple" in options2 ? options2.simple : args.length === 0
2377
+ ...options,
2378
+ simple: "simple" in options ? options.simple : args.length === 0
2379
2379
  });
2380
2380
  return query;
2381
2381
  }
2382
- function file(path, args = [], options2 = {}) {
2383
- arguments.length === 2 && !Array.isArray(args) && (options2 = args, args = []);
2384
- const query = new Query([], args, (query2) => {
2382
+ function file(path, args = [], options = {}) {
2383
+ arguments.length === 2 && !Array.isArray(args) && (options = args, args = []);
2384
+ const query = new Query([], args, (query) => {
2385
2385
  fs.readFile(path, "utf8", (err, string) => {
2386
2386
  if (err)
2387
- return query2.reject(err);
2388
- query2.strings = [string];
2389
- handler2(query2);
2387
+ return query.reject(err);
2388
+ query.strings = [string];
2389
+ handler(query);
2390
2390
  });
2391
2391
  }, cancel, {
2392
- ...options2,
2393
- simple: "simple" in options2 ? options2.simple : args.length === 0
2392
+ ...options,
2393
+ simple: "simple" in options ? options.simple : args.length === 0
2394
2394
  });
2395
2395
  return query;
2396
2396
  }
2397
2397
  }
2398
2398
  async function listen(name, fn, onlisten) {
2399
2399
  const listener = { fn, onlisten };
2400
- const sql3 = listen.sql || (listen.sql = Postgres({
2400
+ const sql = listen.sql || (listen.sql = Postgres({
2401
2401
  ...options,
2402
2402
  max: 1,
2403
2403
  idle_timeout: null,
2404
2404
  max_lifetime: null,
2405
2405
  fetch_types: false,
2406
2406
  onclose() {
2407
- Object.entries(listen.channels).forEach(([name2, { listeners }]) => {
2408
- delete listen.channels[name2];
2409
- Promise.all(listeners.map((l) => listen(name2, l.fn, l.onlisten).catch(() => {})));
2407
+ Object.entries(listen.channels).forEach(([name, { listeners }]) => {
2408
+ delete listen.channels[name];
2409
+ Promise.all(listeners.map((l) => listen(name, l.fn, l.onlisten).catch(() => {})));
2410
2410
  });
2411
2411
  },
2412
2412
  onnotify(c, x) {
@@ -2416,11 +2416,11 @@ function Postgres(a, b2) {
2416
2416
  const channels = listen.channels || (listen.channels = {}), exists = name in channels;
2417
2417
  if (exists) {
2418
2418
  channels[name].listeners.push(listener);
2419
- const result2 = await channels[name].result;
2419
+ const result = await channels[name].result;
2420
2420
  listener.onlisten && listener.onlisten();
2421
- return { state: result2.state, unlisten };
2421
+ return { state: result.state, unlisten };
2422
2422
  }
2423
- channels[name] = { result: sql3`listen ${sql3.unsafe('"' + name.replace(/"/g, '""') + '"')}`, listeners: [listener] };
2423
+ channels[name] = { result: sql`listen ${sql.unsafe('"' + name.replace(/"/g, '""') + '"')}`, listeners: [listener] };
2424
2424
  const result = await channels[name].result;
2425
2425
  listener.onlisten && listener.onlisten();
2426
2426
  return { state: result.state, unlisten };
@@ -2431,11 +2431,11 @@ function Postgres(a, b2) {
2431
2431
  if (channels[name].listeners.length)
2432
2432
  return;
2433
2433
  delete channels[name];
2434
- return sql3`unlisten ${sql3.unsafe('"' + name.replace(/"/g, '""') + '"')}`;
2434
+ return sql`unlisten ${sql.unsafe('"' + name.replace(/"/g, '""') + '"')}`;
2435
2435
  }
2436
2436
  }
2437
2437
  async function notify(channel, payload) {
2438
- return await sql2`select pg_notify(${channel}, ${"" + payload})`;
2438
+ return await sql`select pg_notify(${channel}, ${"" + payload})`;
2439
2439
  }
2440
2440
  async function reserve() {
2441
2441
  const queue = queue_default();
@@ -2447,65 +2447,65 @@ function Postgres(a, b2) {
2447
2447
  move(c, reserved);
2448
2448
  c.reserved = () => queue.length ? c.execute(queue.shift()) : move(c, reserved);
2449
2449
  c.reserved.release = true;
2450
- const sql3 = Sql(handler2);
2451
- sql3.release = () => {
2450
+ const sql = Sql(handler);
2451
+ sql.release = () => {
2452
2452
  c.reserved = null;
2453
2453
  onopen(c);
2454
2454
  };
2455
- return sql3;
2456
- function handler2(q) {
2455
+ return sql;
2456
+ function handler(q) {
2457
2457
  c.queue === full ? queue.push(q) : c.execute(q) || move(c, full);
2458
2458
  }
2459
2459
  }
2460
- async function begin(options2, fn) {
2461
- !fn && (fn = options2, options2 = "");
2462
- const queries2 = queue_default();
2463
- let savepoints = 0, connection2, prepare = null;
2460
+ async function begin(options, fn) {
2461
+ !fn && (fn = options, options = "");
2462
+ const queries = queue_default();
2463
+ let savepoints = 0, connection, prepare = null;
2464
2464
  try {
2465
- await sql2.unsafe("begin " + options2.replace(/[^a-z ]/ig, ""), [], { onexecute }).execute();
2465
+ await sql.unsafe("begin " + options.replace(/[^a-z ]/ig, ""), [], { onexecute }).execute();
2466
2466
  return await Promise.race([
2467
- scope(connection2, fn),
2468
- new Promise((_, reject) => connection2.onclose = reject)
2467
+ scope(connection, fn),
2468
+ new Promise((_, reject) => connection.onclose = reject)
2469
2469
  ]);
2470
2470
  } catch (error) {
2471
2471
  throw error;
2472
2472
  }
2473
- async function scope(c, fn2, name) {
2474
- const sql3 = Sql(handler2);
2475
- sql3.savepoint = savepoint;
2476
- sql3.prepare = (x) => prepare = x.replace(/[^a-z0-9$-_. ]/gi);
2473
+ async function scope(c, fn, name) {
2474
+ const sql = Sql(handler);
2475
+ sql.savepoint = savepoint;
2476
+ sql.prepare = (x) => prepare = x.replace(/[^a-z0-9$-_. ]/gi);
2477
2477
  let uncaughtError, result;
2478
- name && await sql3`savepoint ${sql3(name)}`;
2478
+ name && await sql`savepoint ${sql(name)}`;
2479
2479
  try {
2480
2480
  result = await new Promise((resolve, reject) => {
2481
- const x = fn2(sql3);
2481
+ const x = fn(sql);
2482
2482
  Promise.resolve(Array.isArray(x) ? Promise.all(x) : x).then(resolve, reject);
2483
2483
  });
2484
2484
  if (uncaughtError)
2485
2485
  throw uncaughtError;
2486
2486
  } catch (e) {
2487
- await (name ? sql3`rollback to ${sql3(name)}` : sql3`rollback`);
2487
+ await (name ? sql`rollback to ${sql(name)}` : sql`rollback`);
2488
2488
  throw e instanceof PostgresError && e.code === "25P02" && uncaughtError || e;
2489
2489
  }
2490
2490
  if (!name) {
2491
- prepare ? await sql3`prepare transaction '${sql3.unsafe(prepare)}'` : await sql3`commit`;
2491
+ prepare ? await sql`prepare transaction '${sql.unsafe(prepare)}'` : await sql`commit`;
2492
2492
  }
2493
2493
  return result;
2494
- function savepoint(name2, fn3) {
2495
- if (name2 && Array.isArray(name2.raw))
2496
- return savepoint((sql4) => sql4.apply(sql4, arguments));
2497
- arguments.length === 1 && (fn3 = name2, name2 = null);
2498
- return scope(c, fn3, "s" + savepoints++ + (name2 ? "_" + name2 : ""));
2494
+ function savepoint(name, fn) {
2495
+ if (name && Array.isArray(name.raw))
2496
+ return savepoint((sql) => sql.apply(sql, arguments));
2497
+ arguments.length === 1 && (fn = name, name = null);
2498
+ return scope(c, fn, "s" + savepoints++ + (name ? "_" + name : ""));
2499
2499
  }
2500
- function handler2(q) {
2500
+ function handler(q) {
2501
2501
  q.catch((e) => uncaughtError || (uncaughtError = e));
2502
- c.queue === full ? queries2.push(q) : c.execute(q) || move(c, full);
2502
+ c.queue === full ? queries.push(q) : c.execute(q) || move(c, full);
2503
2503
  }
2504
2504
  }
2505
2505
  function onexecute(c) {
2506
- connection2 = c;
2506
+ connection = c;
2507
2507
  move(c, reserved);
2508
- c.reserved = () => queries2.length ? c.execute(queries2.shift()) : move(c, reserved);
2508
+ c.reserved = () => queries.length ? c.execute(queries.shift()) : move(c, reserved);
2509
2509
  }
2510
2510
  }
2511
2511
  function move(c, queue) {
@@ -2544,11 +2544,11 @@ function Postgres(a, b2) {
2544
2544
  if (ending)
2545
2545
  return ending;
2546
2546
  await 1;
2547
- let timer2;
2547
+ let timer;
2548
2548
  return ending = Promise.race([
2549
- new Promise((r) => timeout !== null && (timer2 = setTimeout(destroy, timeout * 1000, r))),
2549
+ new Promise((r) => timeout !== null && (timer = setTimeout(destroy, timeout * 1000, r))),
2550
2550
  Promise.all(connections.map((c) => c.end()).concat(listen.sql ? listen.sql.end({ timeout: 0 }) : [], subscribe.sql ? subscribe.sql.end({ timeout: 0 }) : []))
2551
- ]).then(() => clearTimeout(timer2));
2551
+ ]).then(() => clearTimeout(timer));
2552
2552
  }
2553
2553
  async function close() {
2554
2554
  await Promise.all(connections.map((c) => c.end()));
@@ -2587,10 +2587,10 @@ function Postgres(a, b2) {
2587
2587
  queries.length && connect(c, queries.shift());
2588
2588
  }
2589
2589
  }
2590
- function parseOptions(a, b2) {
2590
+ function parseOptions(a, b) {
2591
2591
  if (a && a.shared)
2592
2592
  return a;
2593
- const env = process.env, o = (!a || typeof a === "string" ? b2 : a) || {}, { url, multihost } = parseUrl(a), query = [...url.searchParams].reduce((a2, [b3, c]) => (a2[b3] = c, a2), {}), host = o.hostname || o.host || multihost || url.hostname || env.PGHOST || "localhost", port = o.port || url.port || env.PGPORT || 5432, user = o.user || o.username || url.username || env.PGUSERNAME || env.PGUSER || osUsername();
2593
+ const env = process.env, o = (!a || typeof a === "string" ? b : a) || {}, { url, multihost } = parseUrl(a), query = [...url.searchParams].reduce((a, [b, c]) => (a[b] = c, a), {}), host = o.hostname || o.host || multihost || url.hostname || env.PGHOST || "localhost", port = o.port || url.port || env.PGPORT || 5432, user = o.user || o.username || url.username || env.PGUSERNAME || env.PGUSER || osUsername();
2594
2594
  o.no_prepare && (o.prepare = false);
2595
2595
  query.sslmode && (query.ssl = query.sslmode, delete query.sslmode);
2596
2596
  "timeout" in o && (console.log("The timeout option is deprecated, use idle_timeout instead"), o.idle_timeout = o.timeout);