planche 0.7.19 → 0.7.20

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 (119) hide show
  1. package/THIRD-PARTY-NOTICES.md +269 -1
  2. package/app/assets/AboutDialog-dKk703-Z.js +1 -0
  3. package/app/assets/BigInteger-BlV0QR66.js +1 -0
  4. package/app/assets/ConnectDialog-DdXULzdj.js +1 -0
  5. package/app/assets/CopyDatabaseDialog-B7w3Ek74.js +1 -0
  6. package/app/assets/CopyTableDialog-B0kK-0Bl.js +1 -0
  7. package/app/assets/CreateDatabaseDialog-Dnulabm5.js +1 -0
  8. package/app/assets/CreateSchemaDialog-Lvff6Tdj.js +1 -0
  9. package/app/assets/DataDiffDialog-DNTu-7-T.js +1 -0
  10. package/app/assets/{DownloadToCSVDialog-BC6Sq8Ce.js → DownloadToCSVDialog-jxCkzB3J.js} +2 -2
  11. package/app/assets/EditSchemaDialog-CFrD-8z9.js +2 -0
  12. package/app/assets/FindReplaceDialog-CyNlKq00.js +1 -0
  13. package/app/assets/{FlushDialog-BX0F3dJQ.js → FlushDialog-Cp7W6Ck1.js} +1 -1
  14. package/app/assets/GroupByDialog-CHwsURs9.js +1 -0
  15. package/app/assets/LicenseDialog-RY0SOUb1.js +1 -0
  16. package/app/assets/LinkColumnDialog-BD9rpsyg.js +1 -0
  17. package/app/assets/LocalHistoryDialog-LnF86KJl.js +1 -0
  18. package/app/assets/ProcessListDialog-Jt-1b88E.js +1 -0
  19. package/app/assets/QuickCommandPalette-DEFuPaG7.js +1 -0
  20. package/app/assets/RowFormDialog-mM6FFZQr.js +2 -0
  21. package/app/assets/SafetySettingsDialog-B3MafT1S.js +1 -0
  22. package/app/assets/SchemaDiffDialog-BvNzQo5m.js +7 -0
  23. package/app/assets/{SchemaToHTMLDialog-DjZQwEbM.js → SchemaToHTMLDialog-Da8c-rAe.js} +2 -2
  24. package/app/assets/StatusDialog-mibIDpmA.js +1 -0
  25. package/app/assets/SyncDialog-BIDs_FZr.js +1 -0
  26. package/app/assets/{TermsDialog-B53To0oi.js → TermsDialog-CWw3XSw0.js} +1 -1
  27. package/app/assets/UserAddDialog-D-TQNCsa.js +1 -0
  28. package/app/assets/UserManagerDialog-DTxhu0T8.js +1 -0
  29. package/app/assets/VariablesDialog-CCzXtQQV.js +1 -0
  30. package/app/assets/app-storage-C_1RLCyI.js +1 -0
  31. package/app/assets/button-B2EsmMJs.js +1 -0
  32. package/app/assets/chevron-up-CBnVjNE1.js +1 -0
  33. package/app/assets/connection-store-Ds9Gjt3K.js +1 -0
  34. package/app/assets/contract-D2InX341.js +1 -0
  35. package/app/assets/database-eJWHFM-2.js +1 -0
  36. package/app/assets/de-D9wNOTjH.js +2 -0
  37. package/app/assets/dialog-FBpgH0QJ.js +1 -0
  38. package/app/assets/dist-BUXw8brT.js +1 -0
  39. package/app/assets/dist-BYhFWvmC.js +41 -0
  40. package/app/assets/dist-BrzYmjQV.js +1 -0
  41. package/app/assets/dist-C2vlTGNz.js +1 -0
  42. package/app/assets/editor-registry-ukUyoekH.js +1 -0
  43. package/app/assets/{engine-CpwlM_Ww.js → engine-DtZy_Zk0.js} +1 -1
  44. package/app/assets/fr-CMT9T7_Z.js +2 -0
  45. package/app/assets/hmr-singleton-Bit0Kfog.js +1 -0
  46. package/app/assets/i18n-BAv7QdV3.js +2 -0
  47. package/app/assets/ja-C5Z0_8jZ.js +2 -0
  48. package/app/assets/ko-BF4ZzLce.js +2 -0
  49. package/app/assets/license-store-BfuSb6KZ.js +1 -0
  50. package/app/assets/{main-BLydvBDF.js → main-BPskUSLM.js} +198 -197
  51. package/app/assets/main-DmICiyzI.css +2 -0
  52. package/app/assets/mariadb-BT1adDMU.js +17 -0
  53. package/app/assets/mysql-BEg8tI_S.js +17 -0
  54. package/app/assets/postgresql-erqhE-5Q.js +19 -0
  55. package/app/assets/pro-gate-IRkx6bbE.js +1 -0
  56. package/app/assets/pro-upsell-lFmxmise.js +1 -0
  57. package/app/assets/pro-usage-WSD_KOk4.js +1 -0
  58. package/app/assets/query-execution-C5QxvBZj.js +7 -0
  59. package/app/assets/query-store-BR6Saeed.js +1 -0
  60. package/app/assets/rolldown-runtime-hePW80VL.js +1 -0
  61. package/app/assets/select-C3A-RS4G.js +1 -0
  62. package/app/assets/settings-store-CSMhaLcw.js +1 -0
  63. package/app/assets/table-copy-BJBmJ9OO.js +1 -0
  64. package/app/assets/transactsql-BVCsopZt.js +16 -0
  65. package/app/assets/tunneling-rujGqkfQ.js +1 -0
  66. package/app/assets/ui-store-5IssrgmG.js +1 -0
  67. package/app/assets/{use-engine-B9GBHTL_.js → use-engine-CxcEyIko.js} +1 -1
  68. package/app/assets/{user-store-l9ZslFwK.js → user-store-DOy2VMsT.js} +1 -1
  69. package/app/assets/zh-BpFgSEeR.js +2 -0
  70. package/app/index.html +29 -20
  71. package/app/landing.css +96 -0
  72. package/app/third-party-notices.txt +269 -1
  73. package/dist/index.js +69 -11
  74. package/package.json +1 -1
  75. package/app/assets/AboutDialog-BaQAZjtT.js +0 -1
  76. package/app/assets/ConnectDialog-BmJvDi1P.js +0 -1
  77. package/app/assets/CopyDatabaseDialog-BEM-56Og.js +0 -1
  78. package/app/assets/CopyTableDialog-C2r7l2Ck.js +0 -1
  79. package/app/assets/CreateDatabaseDialog-CZhIpgiO.js +0 -1
  80. package/app/assets/CreateSchemaDialog-CNq4nZum.js +0 -1
  81. package/app/assets/DataDiffDialog-mUg2rIWn.js +0 -1
  82. package/app/assets/EditSchemaDialog-B0dCI4Lb.js +0 -2
  83. package/app/assets/FindReplaceDialog-DXJp2TN6.js +0 -1
  84. package/app/assets/GroupByDialog-BQPTetJF.js +0 -1
  85. package/app/assets/LinkColumnDialog-BEuhj8o8.js +0 -1
  86. package/app/assets/LocalHistoryDialog-BGF91HKS.js +0 -1
  87. package/app/assets/ProcessListDialog-VezdyrHo.js +0 -1
  88. package/app/assets/QuickCommandPalette-BseiwcpU.js +0 -1
  89. package/app/assets/RowFormDialog-XRuG3rMt.js +0 -2
  90. package/app/assets/SafetySettingsDialog-Zh_a4nml.js +0 -1
  91. package/app/assets/SchemaDiffDialog-BrnruiVP.js +0 -7
  92. package/app/assets/StatusDialog-a7NhoFvt.js +0 -1
  93. package/app/assets/UserAddDialog-BBYoKeBv.js +0 -1
  94. package/app/assets/UserManagerDialog-BPC_IoO6.js +0 -1
  95. package/app/assets/VariablesDialog-CzHDGRpy.js +0 -1
  96. package/app/assets/button--s6nUzD8.js +0 -1
  97. package/app/assets/chevron-up-QmvRX9Fw.js +0 -1
  98. package/app/assets/connection-store-N-ZwIkVg.js +0 -1
  99. package/app/assets/database-CpQt6YGv.js +0 -1
  100. package/app/assets/de-Ci_btQN-.js +0 -2
  101. package/app/assets/dialog-CJoWJzRo.js +0 -1
  102. package/app/assets/dist-BAFbxkKh.js +0 -1
  103. package/app/assets/dist-CBYDYlja.js +0 -41
  104. package/app/assets/dist-DgJHEXPr.js +0 -1
  105. package/app/assets/dist-pKt0y9E-.js +0 -1
  106. package/app/assets/editor-registry-DhF4Rf_I.js +0 -1
  107. package/app/assets/fr-rLx93rAO.js +0 -2
  108. package/app/assets/hmr-singleton-DWC1xbJ4.js +0 -1
  109. package/app/assets/i18n-57fo5jb0.js +0 -2
  110. package/app/assets/ja-DkiQpTGb.js +0 -2
  111. package/app/assets/ko-DHI7mstP.js +0 -2
  112. package/app/assets/main-DX7Tr5cg.css +0 -2
  113. package/app/assets/pro-usage-VxPxjJqt.js +0 -1
  114. package/app/assets/query-execution-4-JHu9gp.js +0 -7
  115. package/app/assets/select-ibmUj7AE.js +0 -1
  116. package/app/assets/settings-store-WUA0-UcP.js +0 -1
  117. package/app/assets/table-copy-C1ivtmj8.js +0 -1
  118. package/app/assets/ui-store-DfspmPOn.js +0 -1
  119. package/app/assets/zh-mgKu2Zwj.js +0 -2
@@ -5,7 +5,7 @@ own license, reproduced here in full. Nothing in the Planche License Agreement
5
5
  limits the rights those licenses grant you.
6
6
 
7
7
  Generated from the production dependencies of the web application.
8
- 105 packages.
8
+ 108 packages.
9
9
 
10
10
  ---
11
11
 
@@ -2058,6 +2058,34 @@ SOFTWARE.
2058
2058
 
2059
2059
  ---
2060
2060
 
2061
+ ## @types/pegjs 0.10.6
2062
+ License: MIT
2063
+ Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pegjs
2064
+
2065
+ MIT License
2066
+
2067
+ Copyright (c) Microsoft Corporation.
2068
+
2069
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2070
+ of this software and associated documentation files (the "Software"), to deal
2071
+ in the Software without restriction, including without limitation the rights
2072
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2073
+ copies of the Software, and to permit persons to whom the Software is
2074
+ furnished to do so, subject to the following conditions:
2075
+
2076
+ The above copyright notice and this permission notice shall be included in all
2077
+ copies or substantial portions of the Software.
2078
+
2079
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2080
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2081
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2082
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2083
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2084
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2085
+ SOFTWARE
2086
+
2087
+ ---
2088
+
2061
2089
  ## aria-hidden 1.2.6
2062
2090
  License: MIT
2063
2091
  Homepage: https://github.com/theKashey/aria-hidden#readme
@@ -2087,6 +2115,37 @@ SOFTWARE.
2087
2115
 
2088
2116
  ---
2089
2117
 
2118
+ ## big-integer 1.6.52
2119
+ License: Unlicense
2120
+ Author: Peter Olson <peter.e.c.olson+npm@gmail.com>
2121
+
2122
+ This is free and unencumbered software released into the public domain.
2123
+
2124
+ Anyone is free to copy, modify, publish, use, compile, sell, or
2125
+ distribute this software, either in source code form or as a compiled
2126
+ binary, for any purpose, commercial or non-commercial, and by any
2127
+ means.
2128
+
2129
+ In jurisdictions that recognize copyright laws, the author or authors
2130
+ of this software dedicate any and all copyright interest in the
2131
+ software to the public domain. We make this dedication for the benefit
2132
+ of the public at large and to the detriment of our heirs and
2133
+ successors. We intend this dedication to be an overt act of
2134
+ relinquishment in perpetuity of all present and future rights to this
2135
+ software under copyright law.
2136
+
2137
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2138
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2139
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2140
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
2141
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2142
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2143
+ OTHER DEALINGS IN THE SOFTWARE.
2144
+
2145
+ For more information, please refer to <http://unlicense.org>
2146
+
2147
+ ---
2148
+
2090
2149
  ## class-variance-authority 0.7.1
2091
2150
  License: Apache-2.0
2092
2151
  Homepage: https://github.com/joe-bell/cva#readme
@@ -3205,6 +3264,215 @@ SOFTWARE.
3205
3264
 
3206
3265
  ---
3207
3266
 
3267
+ ## node-sql-parser 5.4.0
3268
+ License: Apache-2.0
3269
+ Homepage: https://github.com/taozhi8833998/node-sql-parser#readme
3270
+ Author: taozhi8833998 <taozhi8833998@163.com>
3271
+
3272
+ Apache License
3273
+ Version 2.0, January 2004
3274
+ http://www.apache.org/licenses/
3275
+
3276
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
3277
+
3278
+ 1. Definitions.
3279
+
3280
+ "License" shall mean the terms and conditions for use, reproduction,
3281
+ and distribution as defined by Sections 1 through 9 of this document.
3282
+
3283
+ "Licensor" shall mean the copyright owner or entity authorized by
3284
+ the copyright owner that is granting the License.
3285
+
3286
+ "Legal Entity" shall mean the union of the acting entity and all
3287
+ other entities that control, are controlled by, or are under common
3288
+ control with that entity. For the purposes of this definition,
3289
+ "control" means (i) the power, direct or indirect, to cause the
3290
+ direction or management of such entity, whether by contract or
3291
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
3292
+ outstanding shares, or (iii) beneficial ownership of such entity.
3293
+
3294
+ "You" (or "Your") shall mean an individual or Legal Entity
3295
+ exercising permissions granted by this License.
3296
+
3297
+ "Source" form shall mean the preferred form for making modifications,
3298
+ including but not limited to software source code, documentation
3299
+ source, and configuration files.
3300
+
3301
+ "Object" form shall mean any form resulting from mechanical
3302
+ transformation or translation of a Source form, including but
3303
+ not limited to compiled object code, generated documentation,
3304
+ and conversions to other media types.
3305
+
3306
+ "Work" shall mean the work of authorship, whether in Source or
3307
+ Object form, made available under the License, as indicated by a
3308
+ copyright notice that is included in or attached to the work
3309
+ (an example is provided in the Appendix below).
3310
+
3311
+ "Derivative Works" shall mean any work, whether in Source or Object
3312
+ form, that is based on (or derived from) the Work and for which the
3313
+ editorial revisions, annotations, elaborations, or other modifications
3314
+ represent, as a whole, an original work of authorship. For the purposes
3315
+ of this License, Derivative Works shall not include works that remain
3316
+ separable from, or merely link (or bind by name) to the interfaces of,
3317
+ the Work and Derivative Works thereof.
3318
+
3319
+ "Contribution" shall mean any work of authorship, including
3320
+ the original version of the Work and any modifications or additions
3321
+ to that Work or Derivative Works thereof, that is intentionally
3322
+ submitted to Licensor for inclusion in the Work by the copyright owner
3323
+ or by an individual or Legal Entity authorized to submit on behalf of
3324
+ the copyright owner. For the purposes of this definition, "submitted"
3325
+ means any form of electronic, verbal, or written communication sent
3326
+ to the Licensor or its representatives, including but not limited to
3327
+ communication on electronic mailing lists, source code control systems,
3328
+ and issue tracking systems that are managed by, or on behalf of, the
3329
+ Licensor for the purpose of discussing and improving the Work, but
3330
+ excluding communication that is conspicuously marked or otherwise
3331
+ designated in writing by the copyright owner as "Not a Contribution."
3332
+
3333
+ "Contributor" shall mean Licensor and any individual or Legal Entity
3334
+ on behalf of whom a Contribution has been received by Licensor and
3335
+ subsequently incorporated within the Work.
3336
+
3337
+ 2. Grant of Copyright License. Subject to the terms and conditions of
3338
+ this License, each Contributor hereby grants to You a perpetual,
3339
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
3340
+ copyright license to reproduce, prepare Derivative Works of,
3341
+ publicly display, publicly perform, sublicense, and distribute the
3342
+ Work and such Derivative Works in Source or Object form.
3343
+
3344
+ 3. Grant of Patent License. Subject to the terms and conditions of
3345
+ this License, each Contributor hereby grants to You a perpetual,
3346
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
3347
+ (except as stated in this section) patent license to make, have made,
3348
+ use, offer to sell, sell, import, and otherwise transfer the Work,
3349
+ where such license applies only to those patent claims licensable
3350
+ by such Contributor that are necessarily infringed by their
3351
+ Contribution(s) alone or by combination of their Contribution(s)
3352
+ with the Work to which such Contribution(s) was submitted. If You
3353
+ institute patent litigation against any entity (including a
3354
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
3355
+ or a Contribution incorporated within the Work constitutes direct
3356
+ or contributory patent infringement, then any patent licenses
3357
+ granted to You under this License for that Work shall terminate
3358
+ as of the date such litigation is filed.
3359
+
3360
+ 4. Redistribution. You may reproduce and distribute copies of the
3361
+ Work or Derivative Works thereof in any medium, with or without
3362
+ modifications, and in Source or Object form, provided that You
3363
+ meet the following conditions:
3364
+
3365
+ (a) You must give any other recipients of the Work or
3366
+ Derivative Works a copy of this License; and
3367
+
3368
+ (b) You must cause any modified files to carry prominent notices
3369
+ stating that You changed the files; and
3370
+
3371
+ (c) You must retain, in the Source form of any Derivative Works
3372
+ that You distribute, all copyright, patent, trademark, and
3373
+ attribution notices from the Source form of the Work,
3374
+ excluding those notices that do not pertain to any part of
3375
+ the Derivative Works; and
3376
+
3377
+ (d) If the Work includes a "NOTICE" text file as part of its
3378
+ distribution, then any Derivative Works that You distribute must
3379
+ include a readable copy of the attribution notices contained
3380
+ within such NOTICE file, excluding those notices that do not
3381
+ pertain to any part of the Derivative Works, in at least one
3382
+ of the following places: within a NOTICE text file distributed
3383
+ as part of the Derivative Works; within the Source form or
3384
+ documentation, if provided along with the Derivative Works; or,
3385
+ within a display generated by the Derivative Works, if and
3386
+ wherever such third-party notices normally appear. The contents
3387
+ of the NOTICE file are for informational purposes only and
3388
+ do not modify the License. You may add Your own attribution
3389
+ notices within Derivative Works that You distribute, alongside
3390
+ or as an addendum to the NOTICE text from the Work, provided
3391
+ that such additional attribution notices cannot be construed
3392
+ as modifying the License.
3393
+
3394
+ You may add Your own copyright statement to Your modifications and
3395
+ may provide additional or different license terms and conditions
3396
+ for use, reproduction, or distribution of Your modifications, or
3397
+ for any such Derivative Works as a whole, provided Your use,
3398
+ reproduction, and distribution of the Work otherwise complies with
3399
+ the conditions stated in this License.
3400
+
3401
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
3402
+ any Contribution intentionally submitted for inclusion in the Work
3403
+ by You to the Licensor shall be under the terms and conditions of
3404
+ this License, without any additional terms or conditions.
3405
+ Notwithstanding the above, nothing herein shall supersede or modify
3406
+ the terms of any separate license agreement you may have executed
3407
+ with Licensor regarding such Contributions.
3408
+
3409
+ 6. Trademarks. This License does not grant permission to use the trade
3410
+ names, trademarks, service marks, or product names of the Licensor,
3411
+ except as required for reasonable and customary use in describing the
3412
+ origin of the Work and reproducing the content of the NOTICE file.
3413
+
3414
+ 7. Disclaimer of Warranty. Unless required by applicable law or
3415
+ agreed to in writing, Licensor provides the Work (and each
3416
+ Contributor provides its Contributions) on an "AS IS" BASIS,
3417
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
3418
+ implied, including, without limitation, any warranties or conditions
3419
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
3420
+ PARTICULAR PURPOSE. You are solely responsible for determining the
3421
+ appropriateness of using or redistributing the Work and assume any
3422
+ risks associated with Your exercise of permissions under this License.
3423
+
3424
+ 8. Limitation of Liability. In no event and under no legal theory,
3425
+ whether in tort (including negligence), contract, or otherwise,
3426
+ unless required by applicable law (such as deliberate and grossly
3427
+ negligent acts) or agreed to in writing, shall any Contributor be
3428
+ liable to You for damages, including any direct, indirect, special,
3429
+ incidental, or consequential damages of any character arising as a
3430
+ result of this License or out of the use or inability to use the
3431
+ Work (including but not limited to damages for loss of goodwill,
3432
+ work stoppage, computer failure or malfunction, or any and all
3433
+ other commercial damages or losses), even if such Contributor
3434
+ has been advised of the possibility of such damages.
3435
+
3436
+ 9. Accepting Warranty or Additional Liability. While redistributing
3437
+ the Work or Derivative Works thereof, You may choose to offer,
3438
+ and charge a fee for, acceptance of support, warranty, indemnity,
3439
+ or other liability obligations and/or rights consistent with this
3440
+ License. However, in accepting such obligations, You may act only
3441
+ on Your own behalf and on Your sole responsibility, not on behalf
3442
+ of any other Contributor, and only if You agree to indemnify,
3443
+ defend, and hold each Contributor harmless for any liability
3444
+ incurred by, or claims asserted against, such Contributor by reason
3445
+ of your accepting any such warranty or additional liability.
3446
+
3447
+ END OF TERMS AND CONDITIONS
3448
+
3449
+ APPENDIX: How to apply the Apache License to your work.
3450
+
3451
+ To apply the Apache License to your work, attach the following
3452
+ boilerplate notice, with the fields enclosed by brackets "{}"
3453
+ replaced with your own identifying information. (Don't include
3454
+ the brackets!) The text should be enclosed in the appropriate
3455
+ comment syntax for the file format. We also recommend that a
3456
+ file or class name and description of purpose be included on the
3457
+ same "printed page" as the copyright notice for easier
3458
+ identification within third-party archives.
3459
+
3460
+ Copyright {yyyy} {name of copyright owner}
3461
+
3462
+ Licensed under the Apache License, Version 2.0 (the "License");
3463
+ you may not use this file except in compliance with the License.
3464
+ You may obtain a copy of the License at
3465
+
3466
+ http://www.apache.org/licenses/LICENSE-2.0
3467
+
3468
+ Unless required by applicable law or agreed to in writing, software
3469
+ distributed under the License is distributed on an "AS IS" BASIS,
3470
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3471
+ See the License for the specific language governing permissions and
3472
+ limitations under the License.
3473
+
3474
+ ---
3475
+
3208
3476
  ## radix-ui 1.6.7
3209
3477
  License: MIT
3210
3478
  Homepage: https://radix-ui.com/primitives
package/dist/index.js CHANGED
@@ -915,6 +915,23 @@ var oracleDriverFactory = {
915
915
 
916
916
  // src/drivers/d1.ts
917
917
  var API = "https://api.cloudflare.com/client/v4";
918
+ var LOCAL_API = "/cdn-cgi/local/explorer/api";
919
+ var SELECT_STAR = /^\s*SELECT\s+(?:DISTINCT\s+)?\*/i;
920
+ var localRawUrl = (origin, databaseId) => `${origin}${LOCAL_API}/d1/database/${encodeURIComponent(databaseId)}/raw`;
921
+ var LOOPBACK = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1", "0.0.0.0"]);
922
+ function parseDevUrl(raw) {
923
+ let url;
924
+ try {
925
+ url = new URL(raw);
926
+ } catch {
927
+ throw new Error(`Not a valid URL: ${raw}`);
928
+ }
929
+ if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("devUrl must be an http(s) URL");
930
+ if (!LOOPBACK.has(url.hostname.toLowerCase())) {
931
+ throw new Error("devUrl must point at a wrangler dev server on this machine (localhost).");
932
+ }
933
+ return url.origin;
934
+ }
918
935
  var D1Error = class extends Error {
919
936
  constructor(message, status) {
920
937
  super(message);
@@ -958,6 +975,7 @@ function firstNonNull2(records, index) {
958
975
  var D1Driver = class {
959
976
  type = "d1";
960
977
  label;
978
+ /** Not readonly: a local database resolves its id lazily (see `resolveUrl`). */
961
979
  url;
962
980
  headers;
963
981
  /** Declared column types per table, for result-source resolution. */
@@ -972,18 +990,53 @@ var D1Driver = class {
972
990
  async cancel() {
973
991
  this.inFlight?.abort();
974
992
  }
993
+ /** Local databases resolve their id on first use; the remote ones know it up front. */
994
+ local;
995
+ resolving = null;
975
996
  constructor(config) {
976
- this.label = `d1:${config.databaseId}`;
977
- this.url = `${API}/accounts/${encodeURIComponent(config.accountId)}/d1/database/${encodeURIComponent(config.databaseId)}/raw`;
978
- this.headers = { Authorization: `Bearer ${config.apiToken}`, "Content-Type": "application/json" };
997
+ this.local = config.devUrl ?? null;
998
+ this.label = `d1:${config.databaseId || this.local || ""}`;
999
+ if (this.local) {
1000
+ this.headers = { "Content-Type": "application/json" };
1001
+ this.url = config.databaseId ? localRawUrl(this.local, config.databaseId) : "";
1002
+ } else {
1003
+ this.headers = { Authorization: `Bearer ${config.apiToken ?? ""}`, "Content-Type": "application/json" };
1004
+ this.url = `${API}/accounts/${encodeURIComponent(config.accountId ?? "")}/d1/database/${encodeURIComponent(config.databaseId ?? "")}/raw`;
1005
+ }
1006
+ }
1007
+ /**
1008
+ * A local dev server usually binds one database, so the connection form does
1009
+ * not have to ask for a uuid it would only copy from wrangler's config.
1010
+ */
1011
+ async resolveUrl() {
1012
+ if (this.url) return this.url;
1013
+ this.resolving ??= (async () => {
1014
+ const listed = await fetch(`${this.local}${LOCAL_API}/d1/database`, { signal: AbortSignal.timeout(1e4) });
1015
+ if (!listed.ok) throw new D1Error(`No wrangler dev server answering at ${this.local}`, 400);
1016
+ const body = await listed.json();
1017
+ const bound = body.result ?? [];
1018
+ if (bound.length === 0) throw new D1Error("That wrangler dev server has no D1 database bound.", 400);
1019
+ const databases = [...new Map(bound.map((d) => [d.uuid ?? "", d])).values()];
1020
+ if (databases.length > 1) {
1021
+ const choices = databases.map((d) => `${d.name ?? "?"} (${d.uuid ?? "?"})`).join(", ");
1022
+ throw new D1Error(
1023
+ `That dev server binds ${databases.length} databases; put one of these ids in the Database ID field: ${choices}`,
1024
+ 400
1025
+ );
1026
+ }
1027
+ this.url = localRawUrl(this.local, databases[0].uuid ?? "");
1028
+ return this.url;
1029
+ })();
1030
+ return this.resolving;
979
1031
  }
980
1032
  async raw(sql2) {
1033
+ const url = this.url || await this.resolveUrl();
981
1034
  let res;
982
1035
  try {
983
1036
  const controller = new AbortController();
984
1037
  this.inFlight = controller;
985
1038
  try {
986
- res = await fetch(this.url, {
1039
+ res = await fetch(url, {
987
1040
  method: "POST",
988
1041
  headers: this.headers,
989
1042
  body: JSON.stringify({ sql: sql2 }),
@@ -1064,7 +1117,8 @@ var D1Driver = class {
1064
1117
  }
1065
1118
  const source = RESULT_KIND.test(text) ? singleSourceTable2(text) : null;
1066
1119
  const known = source ? await this.tableColumns(source) : null;
1067
- const fields = columns.map((name, index) => {
1120
+ const names = columns.length > 0 ? columns : known && SELECT_STAR.test(text) ? [...known.keys()] : [];
1121
+ const fields = names.map((name, index) => {
1068
1122
  const fromTable = known?.has(name) ?? false;
1069
1123
  const type = (fromTable ? known?.get(name) : null) ?? inferTypeFromValue2(firstNonNull2(records, index));
1070
1124
  return {
@@ -1099,8 +1153,10 @@ var d1DriverFactory = {
1099
1153
  const accountId = typeof body.accountId === "string" ? body.accountId.trim() : "";
1100
1154
  const databaseId = typeof body.databaseId === "string" ? body.databaseId.trim() : "";
1101
1155
  const apiToken = typeof body.apiToken === "string" ? body.apiToken.trim() : "";
1156
+ const devUrl = typeof body.devUrl === "string" ? body.devUrl.trim() : "";
1157
+ if (devUrl) return { driver: "d1", devUrl: parseDevUrl(devUrl), databaseId: databaseId || void 0 };
1102
1158
  if (!accountId || !databaseId || !apiToken) {
1103
- throw new Error("accountId, databaseId and apiToken are required");
1159
+ throw new Error("accountId, databaseId and apiToken are required (or devUrl for a local wrangler dev database)");
1104
1160
  }
1105
1161
  return { driver: "d1", accountId, databaseId, apiToken };
1106
1162
  }
@@ -1551,8 +1607,8 @@ var DoDriver = class {
1551
1607
  this.columns.clear();
1552
1608
  }
1553
1609
  };
1554
- var LOOPBACK = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1", "0.0.0.0"]);
1555
- function parseDevUrl(raw) {
1610
+ var LOOPBACK2 = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1", "0.0.0.0"]);
1611
+ function parseDevUrl2(raw) {
1556
1612
  let url;
1557
1613
  try {
1558
1614
  url = new URL(raw);
@@ -1562,7 +1618,7 @@ function parseDevUrl(raw) {
1562
1618
  if (url.protocol !== "http:" && url.protocol !== "https:") {
1563
1619
  throw new Error("devUrl must be an http(s) URL");
1564
1620
  }
1565
- if (!LOOPBACK.has(url.hostname.toLowerCase())) {
1621
+ if (!LOOPBACK2.has(url.hostname.toLowerCase())) {
1566
1622
  throw new Error(
1567
1623
  "devUrl must point at a wrangler dev server on this machine (localhost). Use the deployed Durable Objects connection for objects that are not local."
1568
1624
  );
@@ -1581,7 +1637,7 @@ var doDriverFactory = {
1581
1637
  parseConfig(body) {
1582
1638
  const devUrl = typeof body.devUrl === "string" ? body.devUrl.trim() : "";
1583
1639
  if (!devUrl) throw new Error("devUrl is required");
1584
- return { driver: "do", devUrl: parseDevUrl(devUrl) };
1640
+ return { driver: "do", devUrl: parseDevUrl2(devUrl) };
1585
1641
  }
1586
1642
  };
1587
1643
  var doRemoteDriverFactory = {
@@ -2020,9 +2076,11 @@ var PRO_FEATURES = [
2020
2076
  "compare_schemas",
2021
2077
  "compare_data",
2022
2078
  "copy_table",
2079
+ "dry_run",
2023
2080
  "federated",
2024
2081
  "scratchpad",
2025
- "column_link"
2082
+ "column_link",
2083
+ "sync"
2026
2084
  ];
2027
2085
 
2028
2086
  // src/usage.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "planche",
3
- "version": "0.7.19",
3
+ "version": "0.7.20",
4
4
  "description": "Local agent for Planche — lets the browser-based Planche SQL client reach MySQL/MariaDB/PostgreSQL/SQLite/SQL Server/Oracle/Neon/Supabase/Cloudflare D1 databases and local Durable Object storage from your machine.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://planche.dev",
@@ -1 +0,0 @@
1
- import{n as e}from"./ui-store-DfspmPOn.js";import{t}from"./main-BLydvBDF.js";import{l as n,m as r,t as i}from"./button--s6nUzD8.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./dialog-CJoWJzRo.js";var d=n(),f=`https://planche.dev`,p=`/third-party-notices.txt`;function m(){let n=e(e=>e.activeDialog),m=e(e=>e.closeDialog),{t:h}=r();return(0,d.jsx)(u,{open:n===`about`,onOpenChange:e=>{e||m()},children:(0,d.jsxs)(s,{className:`sm:max-w-[440px]`,children:[(0,d.jsx)(a,{children:(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(t,{size:44,className:`shrink-0`}),(0,d.jsxs)(`div`,{className:`grid gap-1`,children:[(0,d.jsx)(c,{children:h(`about.title`)}),(0,d.jsx)(l,{children:h(`about.tagline`)})]})]})}),(0,d.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,d.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1`,children:[(0,d.jsx)(`dt`,{className:`text-muted-foreground`,children:h(`about.version`)}),(0,d.jsx)(`dd`,{children:`0.1.1`}),(0,d.jsx)(`dt`,{className:`text-muted-foreground`,children:h(`about.website`)}),(0,d.jsx)(`dd`,{children:(0,d.jsx)(`a`,{href:f,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:f})}),(0,d.jsx)(`dt`,{className:`text-muted-foreground`,children:h(`about.licenses`)}),(0,d.jsx)(`dd`,{children:(0,d.jsx)(`a`,{href:p,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:h(`about.licensesLink`)})})]}),(0,d.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`© 2026 Juwon Jeong. `,h(`about.rights`)]}),(0,d.jsx)(`p`,{className:`rounded-md border bg-muted/40 p-3 text-xs text-muted-foreground`,children:h(`about.disclaimer`)}),(0,d.jsxs)(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-muted-foreground`,children:[(0,d.jsx)(`p`,{className:`mb-1 font-medium text-amber-600 dark:text-amber-400`,children:h(`pro.noticeTitle`)}),(0,d.jsx)(`p`,{children:h(`pro.notice`)})]})]}),(0,d.jsx)(o,{children:(0,d.jsx)(i,{onClick:m,children:h(`settings.done`)})})]})})}export{m as AboutDialog};
@@ -1 +0,0 @@
1
- import{h as e,n as t,t as n,v as r}from"./ui-store-DfspmPOn.js";import{C as i,F as a,M as o,N as s,S as c,a as l,b as u,c as d,d as f,i as p,j as m,l as h,n as g,nt as _,o as v,r as y,s as b,u as x,w as S,x as C,y as w}from"./main-BLydvBDF.js";import{l as T,m as E,t as D}from"./button--s6nUzD8.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-ibmUj7AE.js";import{t as N}from"./connection-store-N-ZwIkVg.js";import{r as ee}from"./hmr-singleton-DWC1xbJ4.js";import{D as te,E as ne,M as P,P as F,S as re,d as I,g as ie,i as ae,j as L,l as R,r as oe,w as se}from"./database-CpQt6YGv.js";import{n as z,t as B}from"./dbms-BwnatOMe.js";import{a as ce,i as le,n as ue,o as de,t as fe}from"./dialog-CJoWJzRo.js";var V=r(e(),1),H=new Set([`postgres:`,`postgresql:`]);function U(e){let t=e.trim().replace(/^psql\s+(['"])?/,``).replace(/['"]$/,``);if(!/^postgres(ql)?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(!H.has(n.protocol.toLowerCase())||!n.hostname)return null;let r=e=>{try{return decodeURIComponent(e)}catch{return e}},i={host:n.hostname};n.port&&(i.port=Number(n.port)),n.username&&(i.user=r(n.username)),n.password&&(i.pass=r(n.password));let a=r(n.pathname.replace(/^\//,``));return a&&(i.database=a),i}var W=T(),G=[`utf8`,`utf8mb4`,`latin1`,`ascii`,`euckr`,`sjis`,`big5`],K={enabled:!1,host:``,port:22,user:``,auth:`key`};function q({label:e,htmlFor:t,children:n}){return(0,W.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-center gap-2`,children:[(0,W.jsx)(h,{htmlFor:t,children:e}),n]})}function pe({value:e,onChange:t}){let{t:n}=E();function r(n,r){t({...e,[n]:r})}let i=e.dbms===`sqlite`,c=e.transport??`browser`,l=i&&c===`browser`,u=P.has(e.dbms),d=e.dbms===`d1`,p=e.dbms===`do`,m=B.find(t=>t.id===e.dbms)?.capabilities,h=e.ssh??K,[g,_]=(0,V.useState)(``),y=g.trim()===``?`empty`:U(g)?`applied`:`invalid`,S=e.dbms===`supabase`&&e.port===6543;function C(n){_(n);let r=U(n);r&&t({...e,host:r.host??e.host,port:r.port??B.find(t=>t.id===e.dbms)?.defaultPort??e.port,user:r.user??e.user,pass:r.pass??e.pass,database:r.database??e.database})}function w(n){t({...e,ssh:{...h,...n}})}async function T(e){e&&w({privateKey:await e.text(),privateKeyName:e.name})}return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,W.jsx)(q,{label:n(`connection.form.hostName`),htmlFor:`conn-hostName`,children:(0,W.jsx)(x,{id:`conn-hostName`,placeholder:n(`connection.form.hostNamePlaceholder`),value:e.hostName,onChange:e=>r(`hostName`,e.target.value)})}),(0,W.jsx)(q,{label:n(`connection.form.dataSource`),children:(0,W.jsxs)(M,{value:e.dbms,onValueChange:n=>{let r=B.find(e=>e.id===n);if(!r)return;let i=r.id,a=P.has(i)||i===`d1`||i===`do`;_(``),t({...e,dbms:i,transactionMode:r.capabilities.transactions?e.transactionMode:`auto`,port:r.defaultPort??e.port,host:a&&e.host===`localhost`?``:!a&&e.host===``?`localhost`:e.host,user:a||u||d||p?b(i):e.user,devUrl:i===`do`?e.devUrl||`http://localhost:8787`:e.devUrl,database:e.database&&!a&&!u&&!d&&!p?e.database:v(i)??e.database})},children:[(0,W.jsx)(k,{id:`conn-dbms`,className:`w-full`,children:(0,W.jsx)(O,{})}),(0,W.jsx)(A,{children:B.map(e=>(0,W.jsx)(j,{value:e.id,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(f,{dbms:e.id}),e.label]})},e.id))})]})}),u&&(0,W.jsx)(q,{label:n(`connection.form.connectionString`),htmlFor:`conn-uri`,children:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(x,{id:`conn-uri`,type:`password`,autoComplete:`off`,spellCheck:!1,className:`font-mono text-xs`,placeholder:e.dbms===`neon`?`postgresql://neondb_owner:npg_…@ep-….neon.tech/neondb?sslmode=require`:`postgresql://postgres.[ref]:[password]@aws-0-….pooler.supabase.com:5432/postgres`,value:g,onChange:e=>C(e.target.value)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed ${y===`invalid`?`text-destructive`:`text-muted-foreground`}`,children:n(y===`invalid`?`connection.form.connectionStringInvalid`:y===`applied`?`connection.form.connectionStringApplied`:e.dbms===`neon`?`connection.form.neonHint`:`connection.form.supabaseHint`)})]})}),i&&(0,W.jsxs)(q,{label:n(`connection.form.openVia`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`transport`,value:`browser`,checked:c===`browser`,onChange:()=>r(`transport`,`browser`),className:`accent-primary`}),n(`connection.form.viaBrowser`)]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`transport`,value:`tunnel`,checked:c===`tunnel`,onChange:()=>r(`transport`,`tunnel`),className:`accent-primary`}),n(`connection.form.viaAgent`)]})]}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(c===`browser`?`connection.form.viaBrowserHint`:`connection.form.viaAgentHint`)})]}),l?(0,W.jsx)(q,{label:n(`connection.form.databaseFile`),children:(0,W.jsxs)(`div`,{className:`min-w-0 text-xs text-muted-foreground leading-relaxed`,children:[e.file?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,W.jsx)(`span`,{className:`min-w-0 break-all text-foreground`,title:e.file,children:e.file}),(0,W.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>{R(e.id),r(`file`,``)},children:n(`connection.form.changeFile`)})]}):(0,W.jsx)(`p`,{children:n(`connection.form.filePickerHint`)}),(0,W.jsx)(`p`,{className:`mt-1`,children:n(`connection.form.fileRememberedHint`)})]})}):null,!l&&(0,W.jsx)(q,{label:n(`connection.form.authToken`),htmlFor:`conn-authToken`,children:(0,W.jsx)(x,{id:`conn-authToken`,type:`password`,placeholder:n(`connection.form.authTokenPlaceholder`),value:e.authToken,onChange:e=>r(`authToken`,e.target.value.trim())})}),l?null:p?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.doDevUrl`),htmlFor:`conn-do-url`,children:(0,W.jsx)(x,{id:`conn-do-url`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doHint`)}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doLimitsHint`)})]}):d?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.d1AccountId`),htmlFor:`conn-d1-account`,children:(0,W.jsx)(x,{id:`conn-d1-account`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:e.accountId??``,onChange:e=>r(`accountId`,e.target.value.trim())})}),(0,W.jsx)(q,{label:n(`connection.form.d1DatabaseId`),htmlFor:`conn-d1-database`,children:(0,W.jsx)(x,{id:`conn-d1-database`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,value:e.databaseId??``,onChange:e=>r(`databaseId`,e.target.value.trim())})}),(0,W.jsx)(q,{label:n(`connection.form.d1ApiToken`),htmlFor:`conn-pass`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(x,{id:`conn-pass`,type:`password`,value:e.pass,onChange:e=>r(`pass`,e.target.value.trim())}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1Hint`)}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1LimitsHint`)})]}):i?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.databaseFile`),htmlFor:`conn-file`,children:(0,W.jsx)(x,{id:`conn-file`,placeholder:n(`connection.form.filePathPlaceholder`),value:e.file??``,onChange:e=>r(`file`,e.target.value)})}),(0,W.jsx)(q,{label:n(`connection.form.createIfMissing`),htmlFor:`conn-create`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-create`,type:`checkbox`,checked:e.createIfMissing??!1,onChange:e=>r(`createIfMissing`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.createIfMissingHint`)})]})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.host`),htmlFor:`conn-host`,children:(0,W.jsx)(x,{id:`conn-host`,placeholder:e.dbms===`neon`?`ep-….aws.neon.tech`:e.dbms===`supabase`?`aws-0-….pooler.supabase.com`:`localhost`,value:e.host,onChange:e=>r(`host`,e.target.value)})}),(0,W.jsx)(q,{label:n(`connection.form.port`),htmlFor:`conn-port`,children:(0,W.jsx)(x,{id:`conn-port`,type:`number`,value:e.port,onChange:t=>r(`port`,Number(t.target.value)||B.find(t=>t.id===e.dbms)?.defaultPort||3306)})}),S&&(0,W.jsx)(`p`,{className:`col-start-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2 py-1.5 text-xs leading-relaxed text-foreground`,children:n(`connection.form.supabasePoolerWarning`)}),(F(e.dbms)||e.dbms===`mssql`||e.dbms===`oracle`)&&(0,W.jsx)(q,{label:e.dbms===`oracle`?n(`connection.form.serviceName`):n(`connection.form.database`),htmlFor:`conn-database`,children:(0,W.jsx)(x,{id:`conn-database`,placeholder:v(e.dbms),value:e.database??``,onChange:e=>r(`database`,e.target.value.trim())})}),(0,W.jsx)(q,{label:n(`connection.form.user`),htmlFor:`conn-user`,children:(0,W.jsx)(x,{id:`conn-user`,placeholder:b(e.dbms),value:e.user,onChange:e=>r(`user`,e.target.value)})}),(0,W.jsx)(q,{label:n(`connection.form.password`),htmlFor:`conn-pass`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(x,{id:`conn-pass`,type:`password`,value:e.pass,onChange:e=>r(`pass`,e.target.value)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),u&&(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.managedTlsHint`)}),!u&&e.dbms!==`oracle`&&(0,W.jsx)(q,{label:n(`connection.form.tls`),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.ssl??!1,onChange:e=>r(`ssl`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsEnable`)]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer ${e.ssl?``:`opacity-50`}`,title:n(`connection.form.tlsVerifyHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,disabled:!e.ssl,checked:e.sslVerify??!1,onChange:e=>r(`sslVerify`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsVerify`)]})]})}),!u&&(0,W.jsx)(q,{label:n(`connection.form.charset`),children:(0,W.jsxs)(M,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,W.jsx)(k,{className:`w-full`,children:(0,W.jsx)(O,{})}),(0,W.jsx)(A,{children:G.map(e=>(0,W.jsx)(j,{value:e,children:e},e))})]})})]}),!i&&!u&&!d&&!p&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mt-1 flex items-center border-t pt-3 text-xs font-medium text-muted-foreground`,children:[n(`connection.form.ssh`),(0,W.jsx)(a,{className:`ml-2`})]}),(0,W.jsx)(q,{label:n(`connection.form.sshTunnel`),htmlFor:`conn-ssh`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-ssh`,type:`checkbox`,checked:h.enabled,onChange:e=>w({enabled:e.target.checked}),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.sshTunnelHint`)})]})}),h.enabled&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.sshHost`),htmlFor:`conn-ssh-host`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(x,{id:`conn-ssh-host`,placeholder:n(`connection.form.sshHostPlaceholder`),value:h.host,onChange:e=>w({host:e.target.value.trim()})}),(0,W.jsx)(x,{"aria-label":n(`connection.form.sshPort`),type:`number`,className:`w-24 shrink-0`,value:h.port,onChange:e=>w({port:Number(e.target.value)||22})})]})}),(0,W.jsx)(q,{label:n(`connection.form.sshUser`),htmlFor:`conn-ssh-user`,children:(0,W.jsx)(x,{id:`conn-ssh-user`,placeholder:n(`connection.form.sshUserPlaceholder`),value:h.user,onChange:e=>w({user:e.target.value.trim()})})}),(0,W.jsx)(q,{label:n(`connection.form.sshAuth`),children:(0,W.jsxs)(M,{value:h.auth,onValueChange:e=>w({auth:e}),children:[(0,W.jsx)(k,{className:`w-full`,children:(0,W.jsx)(O,{})}),(0,W.jsxs)(A,{children:[(0,W.jsx)(j,{value:`key`,children:n(`connection.form.sshAuthKey`)}),(0,W.jsx)(j,{value:`password`,children:n(`connection.form.sshAuthPassword`)}),(0,W.jsx)(j,{value:`agent`,children:n(`connection.form.sshAuthAgent`)})]})]})}),h.auth===`password`&&(0,W.jsx)(q,{label:n(`connection.form.sshPassword`),htmlFor:`conn-ssh-pass`,children:(0,W.jsx)(x,{id:`conn-ssh-pass`,type:`password`,value:h.password??``,onChange:e=>w({password:e.target.value})})}),h.auth===`key`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:n(`connection.form.sshKey`),htmlFor:`conn-ssh-key`,children:(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-ssh-key`,type:`file`,className:`hidden`,onChange:e=>{T(e.target.files?.[0]),e.target.value=``}}),(0,W.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 px-2 text-xs`,onClick:()=>document.getElementById(`conn-ssh-key`)?.click(),children:h.privateKey?n(`connection.form.changeFile`):n(`connection.form.sshKeyPick`)}),(0,W.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:h.privateKeyName,children:h.privateKey?h.privateKeyName||n(`connection.form.sshKeyLoaded`):n(`connection.form.sshKeyHint`)})]})}),(0,W.jsx)(q,{label:n(`connection.form.sshPassphrase`),htmlFor:`conn-ssh-passphrase`,children:(0,W.jsx)(x,{id:`conn-ssh-passphrase`,type:`password`,placeholder:n(`connection.form.sshPassphrasePlaceholder`),value:h.passphrase??``,onChange:e=>w({passphrase:e.target.value})})})]}),h.auth===`agent`&&(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshAuthAgentHint`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshTargetHint`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshSecretsHint`)})]})]}),(0,W.jsx)(q,{label:n(`connection.form.autoConnection`),htmlFor:`conn-auto`,children:(0,W.jsx)(`div`,{className:`flex items-center`,children:(0,W.jsx)(`input`,{id:`conn-auto`,type:`checkbox`,checked:e.autoConnection,onChange:e=>r(`autoConnection`,e.target.checked),className:`size-4 accent-primary cursor-pointer`})})}),(0,W.jsx)(`div`,{className:`mt-1 border-t pt-3 text-xs font-medium text-muted-foreground`,children:n(`connection.form.safety`)}),(0,W.jsx)(q,{label:n(`connection.form.environment`),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o.map(t=>{let n=(e.environmentColor??`none`)===t.id;return(0,W.jsx)(`button`,{type:`button`,title:s(t.id),"aria-label":s(t.id),"aria-pressed":n,onClick:()=>r(`environmentColor`,t.id),className:`size-6 rounded-full border-2 transition-transform ${n?`scale-110 border-foreground`:`border-transparent hover:scale-105`}`,style:{background:t.id===`none`?`repeating-linear-gradient(45deg, transparent, transparent 3px, var(--muted-foreground) 3px, var(--muted-foreground) 4px)`:t.hex}},t.id)}),(0,W.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:n(`connection.form.environmentHint`)})]})}),(0,W.jsx)(q,{label:n(`connection.form.readOnly`),htmlFor:`conn-readonly`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-readonly`,type:`checkbox`,checked:e.readOnly??!1,onChange:e=>r(`readOnly`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.readOnlyHint`)})]})}),m?.transactions!==!1&&(0,W.jsx)(q,{label:n(`connection.form.transactions`),children:(0,W.jsxs)(M,{value:e.transactionMode??`auto`,onValueChange:e=>r(`transactionMode`,e),children:[(0,W.jsx)(k,{className:`w-full`,children:(0,W.jsx)(O,{})}),(0,W.jsxs)(A,{children:[(0,W.jsx)(j,{value:`auto`,children:n(`connection.form.txAuto`)}),(0,W.jsx)(j,{value:`manual`,children:n(`connection.form.txManual`)})]})]})})]})}function J(){let{t:e}=E(),{activeDialog:r,closeDialog:a,showMessage:o}=t(),[s,h]=(0,V.useState)(!1),{savedConnections:v,addSavedConnection:b,updateSavedConnection:x,deleteSavedConnection:T,openConnection:O}=N(),k=n(`connect`)?.profileId,[A,j]=(0,V.useState)(()=>k??null),[M,P]=(0,V.useState)(()=>{let e=k?v.find(e=>e.id===k):void 0;return e?{...e}:null}),F=r===`connect`,[R,B]=(0,V.useState)(null),[H,U]=(0,V.useState)(null),G=d(e=>e.url),K=d(e=>e.token);(0,V.useEffect)(()=>{if(!F)return;let e=!1;return(async()=>{try{let t=await se();if(e||t.state!==`online`||!t.gateway){e||B(null);return}let n=await ne();e||(B({name:n.gateway,profiles:n.profiles}),U(null))}catch(t){e||U(t instanceof Error?t.message:String(t))}})(),()=>{e=!0}},[F,G,K]);function q(n){let r=v.find(e=>e.gatewayProfile===n.name);if(r){Y(r);return}let i=y(n);b(i),Y(i),t.getState().setFooterMessage(e(`connection.dialog.gatewayAdded`,{name:n.name}))}function J(e){e||(a(),j(null),P(null))}function Y(e){j(e.id),P({...e})}function me(e){P(e),x(e.id,e)}function he(){let e=l();b(e),j(e.id),P(e)}function ge(){A&&(T(A),j(null),P(null))}let[_e,X]=(0,V.useState)(!1),ve=ee(e=>e.addQueryTab);function Z(t){let n=N.getState().activeConnections.some(e=>e.id===t.id);if(O(t),n){re.getState().removeTree(t.id),a(),j(null),P(null);return}ve(t.id,{id:`tab-${Date.now()}`,title:e(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),a(),j(null),P(null)}async function ye(n){let r=await oe(n.id,{interactive:!0});if(!r)return;let i={...n,file:r.fileName,serverConnectionId:r.connectionId};x(n.id,{file:r.fileName}),Z(i),N.getState().setFileDetached(n.id,r.fileDetached),r.restoredUnsaved?t.getState().setFooterMessage(e(r.diskChanged?`connection.dialog.restoredUnsavedDiskChanged`:`connection.dialog.restoredUnsaved`,{file:r.fileName})):r.wal&&!r.walApplied?t.getState().setFooterMessage(e(`connection.dialog.walPending`,{file:r.fileName})):r.walApplied&&t.getState().setFooterMessage(e(`connection.dialog.walApplied`,{file:r.fileName}))}async function Q(n,r){try{return await r(n)}catch(i){let a=te(i);if(!a||!(`ssh`in n)||!n.ssh||!await t.getState().requestDestructiveConfirm({title:e(`connection.dialog.hostKeyTitle`),description:e(`connection.dialog.hostKeyDescription`,a),confirmLabel:e(`connection.dialog.hostKeyAccept`)}))throw i;return r({...n,ssh:{...n.ssh,acceptHostKey:a.fingerprint}})}}async function $(){if(M){X(!0);try{if(I(M)===`browser`){await ye(M);return}let t=await Q(L(M),e=>ae(e,M.authToken||void 0));t.success?Z({...M,serverConnectionId:t.connectionId}):o({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){o({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{X(!1)}}}async function be(){if(M){if(I(M)===`browser`){o({tone:`info`,title:e(`connection.dialog.testConnection`),description:e(`connection.dialog.browserTestHint`)});return}h(!0);try{let t=await Q(L(M),e=>ie(e,M.authToken||void 0));t.success?o({tone:`success`,title:e(`connection.dialog.testSuccess`),description:e(`connection.dialog.testSuccessDescription`)}):o({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){o({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{h(!1)}}}return(0,W.jsx)(fe,{open:F,onOpenChange:J,children:(0,W.jsxs)(ue,{className:`sm:max-w-[1100px] h-[85vh] max-h-[85vh] flex flex-col`,children:[(0,W.jsx)(ce,{children:(0,W.jsx)(de,{children:e(`connection.dialog.title`)})}),(0,W.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-catppuccin-green/40 bg-catppuccin-green/10 px-3 py-2 text-xs leading-relaxed text-foreground`,children:[(0,W.jsx)(_,{className:`mt-0.5 size-4 shrink-0 text-catppuccin-green`,"aria-hidden":!0}),(0,W.jsx)(`span`,{children:e(`connection.dialog.privacy`)})]}),(0,W.jsxs)(`div`,{className:`flex flex-1 gap-4 overflow-hidden min-h-0`,children:[(0,W.jsxs)(`div`,{className:`w-[460px] shrink-0 border rounded-md overflow-hidden flex flex-col`,children:[(R||H)&&(0,W.jsxs)(`div`,{className:`border-b p-2 text-xs space-y-1 max-h-40 overflow-auto`,children:[(0,W.jsxs)(`p`,{className:`font-medium`,children:[e(`connection.dialog.gatewayTitle`),R?` — ${R.name}`:``]}),H&&(0,W.jsx)(`p`,{className:`text-destructive`,children:e(`connection.dialog.gatewayLoadFailed`,{error:H})}),R?.profiles.map(t=>(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,W.jsx)(f,{dbms:g[t.driver],className:`size-3.5`}),(0,W.jsx)(`span`,{className:`truncate`,children:t.name}),(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),`)`]})]}),(0,W.jsx)(D,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>q(t),children:e(`connection.dialog.gatewayAdd`)})]},t.name))]}),(0,W.jsx)(m,{className:`h-full`,children:(0,W.jsxs)(w,{className:`table-fixed`,children:[(0,W.jsx)(i,{children:(0,W.jsxs)(S,{children:[(0,W.jsx)(c,{className:`w-[32%]`,children:e(`connection.dialog.colHostName`)}),(0,W.jsx)(c,{className:`w-[40%]`,children:e(`connection.dialog.colTarget`)}),(0,W.jsx)(c,{className:`w-[28%]`,children:e(`connection.dialog.colDbms`)})]})}),(0,W.jsx)(u,{children:v.length===0?(0,W.jsx)(S,{children:(0,W.jsx)(C,{colSpan:3,className:`text-center text-muted-foreground`,children:e(`connection.dialog.noSaved`)})}):v.map(t=>(0,W.jsxs)(S,{"data-state":A===t.id?`selected`:void 0,className:`cursor-pointer`,onClick:()=>Y(t),onDoubleClick:()=>{Y(t),$()},children:[(0,W.jsx)(C,{className:`truncate font-medium`,title:t.hostName,children:t.hostName||e(`connection.dialog.unnamed`)}),(0,W.jsx)(C,{className:`truncate`,title:t.dbms===`sqlite`?t.file:t.dbms===`d1`?t.databaseId:t.dbms===`do`?t.devUrl:`${t.user}@${t.host}:${t.port}`,children:t.dbms===`sqlite`?t.file||(I(t)===`browser`?e(`connection.dialog.pickOnConnect`):e(`connection.dialog.noFile`)):t.dbms===`d1`?t.databaseId||`—`:t.dbms===`do`?t.devUrl||`—`:`${t.user}@${t.host}:${t.port}`}),(0,W.jsx)(C,{className:`truncate`,title:z(t.dbms).label,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(f,{dbms:t.dbms,className:`size-3.5`}),(0,W.jsx)(`span`,{className:`truncate`,children:z(t.dbms).label})]})})]},t.id))})]})})]}),(0,W.jsx)(`div`,{className:`flex-1 border rounded-md overflow-auto`,children:M?(0,W.jsxs)(W.Fragment,{children:[I(M)!==`browser`&&(0,W.jsx)(`div`,{className:`p-4 pb-0`,children:(0,W.jsx)(p,{})}),M.gatewayProfile?(0,W.jsxs)(`div`,{className:`p-4 space-y-2 text-sm`,children:[(0,W.jsxs)(`p`,{className:`font-medium flex items-center gap-2`,children:[(0,W.jsx)(f,{dbms:M.dbms,className:`size-4`}),M.hostName]}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:e(`connection.dialog.gatewayProfileHint`,{name:M.gatewayProfile})}),(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[M.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),M.database?` · ${M.database}`:``]})]}):(0,W.jsx)(pe,{value:M,onChange:me})]}):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:e(`connection.dialog.selectPrompt`)})})]}),(0,W.jsxs)(le,{className:`sm:justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(D,{variant:`outline`,onClick:he,children:e(`connection.dialog.addNew`)}),(0,W.jsx)(D,{variant:`destructive`,onClick:ge,disabled:!A,children:e(`connection.dialog.delete`)})]}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(D,{variant:`outline`,onClick:be,disabled:!M||s,children:e(`connection.dialog.testConnection`)}),(0,W.jsx)(D,{onClick:$,disabled:!M||_e,children:e(`connection.dialog.connect`)}),(0,W.jsx)(D,{variant:`outline`,onClick:()=>J(!1),children:e(`connection.dialog.close`)})]})]})]})})}export{J as ConnectDialog};
@@ -1 +0,0 @@
1
- import{h as e,n as t,t as n,v as r}from"./ui-store-DfspmPOn.js";import{l as i,u as a}from"./main-BLydvBDF.js";import{l as o,m as s,t as c}from"./button--s6nUzD8.js";import{t as l}from"./connection-store-N-ZwIkVg.js";import{a as u}from"./database-CpQt6YGv.js";import{n as d}from"./engine-CpwlM_Ww.js";import{c as f,f as p}from"./query-execution-4-JHu9gp.js";import{n as m,t as h}from"./table-copy-C1ivtmj8.js";import{a as g,i as _,n as v,o as y,t as b}from"./dialog-CJoWJzRo.js";var x=r(e(),1),S=o();function C(){let{t:e}=s(),{activeDialog:r,closeDialog:o}=t(),C=n(`copy-database`),w=r===`copy-database`,T=C?.database??``,[E,D]=(0,x.useState)(``),[O,k]=(0,x.useState)(`structure_data`),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(null);function P(e){e||(o(),N(null),j(null),D(``),k(`structure_data`))}async function F(){let t=l.getState().activeConnectionId,n=E.trim();if(!t||!n||!T)return;N(null);let r=d(t),i=l.getState().activeConnections.find(e=>e.id===t);if(i?.serverConnectionId)try{j(e(`database.copy.creating`,{database:n})),await f(t,r.getQuery(`CREATE_DATABASE`,n,`utf8mb4`,`utf8mb4_general_ci`));let a=u(i.serverConnectionId),o=await r.introspect.listTables(a,T);for(let[r,i]of o.entries()){j(e(`database.copy.copying`,{table:i.name,index:r+1,total:o.length}));let a={connectionId:t,database:T,table:i.name},s={connectionId:t,database:n,table:i.name},c=await h(a,s);await m({source:a,target:s,mode:O,onConflict:`abort`,createSql:d(t).ddl.createTable(c)})}await p(t),P(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(null)}}return(0,S.jsx)(b,{open:w,onOpenChange:P,children:(0,S.jsxs)(v,{className:`sm:max-w-[450px]`,children:[(0,S.jsx)(g,{children:(0,S.jsx)(y,{children:e(`database.copy.title`)})}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(i,{children:e(`database.copy.source`)}),(0,S.jsx)(a,{value:T,disabled:!0})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(i,{htmlFor:`target-db-name`,children:e(`database.copy.target`)}),(0,S.jsx)(a,{id:`target-db-name`,value:E,onChange:e=>D(e.target.value),placeholder:e(`database.copy.targetPlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(i,{children:e(`database.copy.options`)}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_data`,checked:O===`structure_data`,onChange:()=>k(`structure_data`)}),e(`database.copy.structureAndData`)]}),(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_only`,checked:O===`structure_only`,onChange:()=>k(`structure_only`)}),e(`database.copy.structureOnly`)]})]})]})]}),A&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:A}),M&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:M}),(0,S.jsxs)(_,{children:[(0,S.jsx)(c,{variant:`outline`,onClick:()=>P(!1),children:e(`database.copy.cancel`)}),(0,S.jsx)(c,{onClick:()=>void F(),disabled:!E.trim()||A!==null,children:e(`database.copy.copy`)})]})]})})}export{C as CopyDatabaseDialog};
@@ -1 +0,0 @@
1
- import{h as e,n as t,t as n,v as r}from"./ui-store-DfspmPOn.js";import{P as i,l as a,u as o}from"./main-BLydvBDF.js";import{l as s,m as ee,t as c}from"./button--s6nUzD8.js";import{a as l,i as u,n as d,r as f,t as p}from"./select-ibmUj7AE.js";import{t as te}from"./connection-store-N-ZwIkVg.js";import{a as ne}from"./database-CpQt6YGv.js";import{n as m}from"./engine-CpwlM_Ww.js";import{t as re}from"./query-execution-4-JHu9gp.js";import{n as ie,t as h}from"./table-copy-C1ivtmj8.js";import{a as ae,i as g,n as oe,o as se,t as ce}from"./dialog-CJoWJzRo.js";var _=r(e(),1),v=s(),y=e=>e instanceof Error?e.message:String(e),b=e=>e.hostName||e.host||e.file||e.id,le=`w-full rounded border bg-background px-2 py-1 text-xs font-mono outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 min-h-[160px] resize-y`;function x(){let{t:e}=ee(),r=t(e=>e.activeDialog),s=t(e=>e.closeDialog),x=t(e=>e.showMessage),S=n(`copy-table`),C=te(e=>e.activeConnections),w=r===`copy-table`,T=S?.connectionId??``,E=String(S?.metadata?.database??``),D=S?.nodeText??``,O=C.find(e=>e.id===T),ue=C.filter(e=>e.serverConnectionId),[k,de]=(0,_.useState)(T),[A,j]=(0,_.useState)([]),[M,N]=(0,_.useState)(``),[P,F]=(0,_.useState)(D),[I,L]=(0,_.useState)(`structure_data`),[R,z]=(0,_.useState)(`abort`),[B,V]=(0,_.useState)(``),[H,U]=(0,_.useState)(null),[W,G]=(0,_.useState)(null),[K,q]=(0,_.useState)(null),[J,Y]=(0,_.useState)(!1),X=(0,_.useRef)(null),Z=C.find(e=>e.id===k),Q=Z?m(k):null,fe=!!O&&!!Z&&m(T).id===Q?.id;(0,_.useEffect)(()=>{if(!w||!Z?.serverConnectionId)return;let e=!1,t=m(k),n=ne(Z.serverConnectionId);return(async()=>{j([]);try{let r=await t.introspect.listDatabases(n);if(e)return;j(r);let i=k===T,a=i||r.includes(E)?E:r[0]??``;N(a),F(e=>i&&a===E&&e===D?`${D}_copy`:e)}catch(t){e||q(y(t))}})(),()=>{e=!0}},[w,k]),(0,_.useEffect)(()=>{if(!w||!Z||!M||!P.trim()||!O)return;let e=!1;return(async()=>{U(null);try{let t=await h({connectionId:T,database:E,table:D},{connectionId:k,database:M,table:P.trim()});e||V(m(k).ddl.createTable(t))}catch(t){e||U(y(t))}})(),()=>{e=!0}},[w,k,M,P]);function $(e){if(!e){if(J){X.current?.abort();return}s()}}async function pe(){if(!M||!P.trim()||!B.trim())return;Y(!0),q(null),G({phase:`create`,copied:0,total:null});let t=new AbortController;X.current=t;try{let n=await ie({source:{connectionId:T,database:E,table:D},target:{connectionId:k,database:M,table:P.trim()},mode:I,onConflict:R,createSql:B},G,t.signal);s(),await x({title:e(`table.copy.doneTitle`),description:I===`structure_data`?e(`table.copy.doneRows`,{count:n.rows,table:P.trim()}):e(`table.copy.doneStructure`,{table:P.trim()}),tone:`success`})}catch(e){e instanceof re||q(y(e)),G(null)}finally{Y(!1),X.current=null}}let me=W?.phase===`copy`&&W.total?Math.min(100,Math.round(W.copied/W.total*100)):null,he=W?W.phase===`create`?e(`table.copy.progressCreate`):W.phase===`count`?e(`table.copy.progressCount`):W.phase===`copy`?e(`table.copy.progressRows`,{copied:W.copied,total:W.total??`?`}):e(`table.copy.progressDone`):``;return(0,v.jsx)(ce,{open:w,onOpenChange:$,children:(0,v.jsxs)(oe,{className:`sm:max-w-[640px]`,children:[(0,v.jsx)(ae,{children:(0,v.jsx)(se,{children:e(`table.copy.title`)})}),(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(a,{children:e(`table.copy.source`)}),(0,v.jsx)(o,{value:O?`${b(O)} / ${E} / ${D}`:``,disabled:!0})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(a,{htmlFor:`copy-target-conn`,children:e(`table.copy.targetConnection`)}),(0,v.jsxs)(p,{value:k,onValueChange:de,disabled:J,children:[(0,v.jsx)(u,{id:`copy-target-conn`,className:`w-full`,children:(0,v.jsx)(l,{})}),(0,v.jsx)(d,{children:ue.map(t=>(0,v.jsxs)(f,{value:t.id,children:[b(t),t.readOnly?` (${e(`table.copy.readOnly`)})`:``]},t.id))})]})]}),(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(a,{htmlFor:`copy-target-db`,children:e(`table.copy.targetDatabase`)}),(0,v.jsxs)(p,{value:M,onValueChange:N,disabled:J||A.length===0,children:[(0,v.jsx)(u,{id:`copy-target-db`,className:`w-full`,children:(0,v.jsx)(l,{placeholder:e(`table.copy.loading`)})}),(0,v.jsx)(d,{children:A.map(e=>(0,v.jsx)(f,{value:e,children:e},e))})]})]})]}),(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(a,{htmlFor:`copy-target-table`,children:e(`table.copy.targetTable`)}),(0,v.jsx)(o,{id:`copy-target-table`,value:P,onChange:e=>F(e.target.value),disabled:J,spellCheck:!1})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(a,{children:e(`table.copy.what`)}),(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,v.jsx)(`input`,{type:`radio`,name:`copy-mode`,checked:I===`structure_data`,onChange:()=>L(`structure_data`),disabled:J}),e(`table.copy.structureAndData`)]}),(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,v.jsx)(`input`,{type:`radio`,name:`copy-mode`,checked:I===`structure_only`,onChange:()=>L(`structure_only`),disabled:J}),e(`table.copy.structureOnly`)]})]})]}),(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(a,{children:e(`table.copy.ifExists`)}),(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,v.jsx)(`input`,{type:`radio`,name:`copy-conflict`,checked:R===`abort`,onChange:()=>z(`abort`),disabled:J}),e(`table.copy.abort`)]}),(0,v.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer text-destructive`,children:[(0,v.jsx)(`input`,{type:`radio`,name:`copy-conflict`,checked:R===`drop`,onChange:()=>z(`drop`),disabled:J}),e(`table.copy.dropAndRecreate`)]})]})]})]}),(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(a,{htmlFor:`copy-ddl`,children:e(`table.copy.preview`)}),!fe&&Q&&(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`table.copy.crossEngineHint`,{engine:Q.label})}),(0,v.jsx)(`textarea`,{id:`copy-ddl`,className:le,value:B,onChange:e=>V(e.target.value),disabled:J,spellCheck:!1}),H&&(0,v.jsx)(`p`,{className:`text-xs text-destructive`,children:H})]}),W&&(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsx)(i,{value:me??(W.phase===`done`?100:0)}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:he})]}),K&&(0,v.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:K})]}),(0,v.jsxs)(g,{children:[(0,v.jsx)(c,{variant:`outline`,onClick:()=>$(!1),children:e(J?`table.copy.stop`:`table.copy.cancel`)}),(0,v.jsx)(c,{onClick:()=>{pe()},disabled:J||!M||!P.trim()||!B.trim()||!!H,children:e(`table.copy.copy`)})]})]})})}export{x as CopyTableDialog};
@@ -1 +0,0 @@
1
- import{h as e,n as t,v as n}from"./ui-store-DfspmPOn.js";import{l as r,u as i}from"./main-BLydvBDF.js";import{l as a,m as o,t as s}from"./button--s6nUzD8.js";import{a as c,i as l,n as u,r as d,t as f}from"./select-ibmUj7AE.js";import{t as p}from"./connection-store-N-ZwIkVg.js";import{n as m}from"./engine-CpwlM_Ww.js";import{c as h,f as g}from"./query-execution-4-JHu9gp.js";import{a as _,i as v,n as y,o as b,t as x}from"./dialog-CJoWJzRo.js";var S=n(e(),1),C=a(),w=[`utf8mb4`,`utf8`,`latin1`,`ascii`,`binary`,`cp1251`,`euckr`,`gb2312`,`gbk`,`sjis`,`ucs2`,`utf16`,`utf32`],T={utf8mb4:[`utf8mb4_general_ci`,`utf8mb4_unicode_ci`,`utf8mb4_bin`,`utf8mb4_0900_ai_ci`],utf8:[`utf8_general_ci`,`utf8_unicode_ci`,`utf8_bin`],latin1:[`latin1_swedish_ci`,`latin1_general_ci`,`latin1_bin`],ascii:[`ascii_general_ci`,`ascii_bin`],binary:[`binary`],cp1251:[`cp1251_general_ci`,`cp1251_bin`],euckr:[`euckr_korean_ci`,`euckr_bin`],gb2312:[`gb2312_chinese_ci`,`gb2312_bin`],gbk:[`gbk_chinese_ci`,`gbk_bin`],sjis:[`sjis_japanese_ci`,`sjis_bin`],ucs2:[`ucs2_general_ci`,`ucs2_unicode_ci`,`ucs2_bin`],utf16:[`utf16_general_ci`,`utf16_unicode_ci`,`utf16_bin`],utf32:[`utf32_general_ci`,`utf32_unicode_ci`,`utf32_bin`]};function E(){let{t:e}=o(),{activeDialog:n,closeDialog:a}=t(),E=n===`create-database`,[D,O]=(0,S.useState)(``),[k,A]=(0,S.useState)(`utf8mb4`),[j,M]=(0,S.useState)(`utf8mb4_general_ci`),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(null);function L(e){e||(a(),I(null),O(``),A(`utf8mb4`),M(`utf8mb4_general_ci`))}function R(e){A(e);let t=T[e];M(t?.[0]??``)}async function z(){let e=p.getState().activeConnectionId,t=D.trim();if(!(!e||!t)){I(null),P(!0);try{let n=m(e).getQuery(`CREATE_DATABASE`,t,k,j);await h(e,n),await g(e),L(!1)}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}}let B=T[k]??[];return(0,C.jsx)(x,{open:E,onOpenChange:L,children:(0,C.jsxs)(y,{className:`sm:max-w-[450px]`,children:[(0,C.jsx)(_,{children:(0,C.jsx)(b,{children:e(`database.create.title`)})}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(r,{htmlFor:`db-name`,children:e(`database.create.name`)}),(0,C.jsx)(i,{id:`db-name`,value:D,onChange:e=>O(e.target.value),placeholder:e(`database.create.namePlaceholder`)})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(r,{htmlFor:`db-charset`,children:e(`database.create.charset`)}),(0,C.jsxs)(f,{value:k,onValueChange:R,children:[(0,C.jsx)(l,{id:`db-charset`,className:`w-full`,children:(0,C.jsx)(c,{})}),(0,C.jsx)(u,{children:w.map(e=>(0,C.jsx)(d,{value:e,children:e},e))})]})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(r,{htmlFor:`db-collation`,children:e(`database.create.collation`)}),(0,C.jsxs)(f,{value:j,onValueChange:M,children:[(0,C.jsx)(l,{id:`db-collation`,className:`w-full`,children:(0,C.jsx)(c,{})}),(0,C.jsx)(u,{children:B.map(e=>(0,C.jsx)(d,{value:e,children:e},e))})]})]})]}),F&&(0,C.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:F}),(0,C.jsxs)(v,{children:[(0,C.jsx)(s,{variant:`outline`,onClick:()=>L(!1),children:e(`database.create.cancel`)}),(0,C.jsx)(s,{onClick:()=>void z(),disabled:!D.trim()||N,children:e(`database.create.create`)})]})]})})}export{E as CreateDatabaseDialog};
@@ -1 +0,0 @@
1
- import{h as e,n as t,t as n,v as r}from"./ui-store-DfspmPOn.js";import{l as i,u as a}from"./main-BLydvBDF.js";import{l as o,m as s,t as c}from"./button--s6nUzD8.js";import{t as l}from"./connection-store-N-ZwIkVg.js";import{n as u}from"./engine-CpwlM_Ww.js";import{c as d,f}from"./query-execution-4-JHu9gp.js";import{a as p,i as m,n as h,o as g,t as _}from"./dialog-CJoWJzRo.js";var v=r(e(),1),y=o();function b(){let{t:e}=s(),{activeDialog:r,closeDialog:o}=t(),b=n(`create-schema`),x=r===`create-schema`,[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(null);function O(e){e||(o(),C(``),D(null))}async function k(){let e=b?.connectionId??l.getState().activeConnectionId,t=S.trim();if(!(!e||!t)){D(null),T(!0);try{await d(e,u(e).getQuery(`CREATE_SCHEMA`,t)),await f(e),O(!1)}catch(e){D(e instanceof Error?e.message:String(e))}finally{T(!1)}}}return(0,y.jsx)(_,{open:x,onOpenChange:O,children:(0,y.jsxs)(h,{className:`sm:max-w-[420px]`,children:[(0,y.jsx)(p,{children:(0,y.jsx)(g,{children:e(`database.schema.createTitle`)})}),(0,y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,y.jsx)(i,{htmlFor:`schema-name`,children:e(`database.schema.name`)}),(0,y.jsx)(a,{id:`schema-name`,value:S,autoFocus:!0,placeholder:e(`database.schema.namePlaceholder`),onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k()}})]}),E&&(0,y.jsx)(`p`,{className:`text-xs text-destructive leading-relaxed`,children:E}),(0,y.jsxs)(m,{children:[(0,y.jsx)(c,{variant:`outline`,onClick:()=>O(!1),children:e(`database.schema.cancel`)}),(0,y.jsx)(c,{onClick:()=>void k(),disabled:!S.trim()||w,children:e(`database.schema.create`)})]})]})})}export{b as CreateSchemaDialog};
@@ -1 +0,0 @@
1
- import{c as e,h as t,n,t as r,v as i}from"./ui-store-DfspmPOn.js";import{A as a,R as o,_ as s,g as c,l,v as u}from"./main-BLydvBDF.js";import{l as d,m as f,t as p}from"./button--s6nUzD8.js";import{a as m,i as h,n as g,r as _,t as v}from"./select-ibmUj7AE.js";import{t as y}from"./connection-store-N-ZwIkVg.js";import{a as b}from"./database-CpQt6YGv.js";import{n as x}from"./engine-CpwlM_Ww.js";import{t as ee}from"./pro-usage-VxPxjJqt.js";import{a as te,i as ne,n as S,o as C,t as w}from"./dialog-CJoWJzRo.js";var T=i(t(),1),E=d(),re=e=>e instanceof Error?e.message:String(e),D=e=>e.hostName||e.host||e.file||e.id,O=5e4;function k({id:e,label:t,side:n,onChange:r,connections:i,disabled:a}){let{t:o}=f(),[s,c]=(0,T.useState)([]),[u,d]=(0,T.useState)([]),p=i.find(e=>e.id===n.connectionId);return(0,T.useEffect)(()=>{if(!p?.serverConnectionId)return;let e=!1;return(async()=>{try{let t=await x(p.id).introspect.listDatabases(b(p.serverConnectionId));if(e)return;c(t),t.includes(n.database)||r({connectionId:p.id,database:t[0]??``,table:``})}catch{e||c([])}})(),()=>{e=!0}},[p?.id,p?.serverConnectionId]),(0,T.useEffect)(()=>{if(!p?.serverConnectionId||!n.database)return;let e=!1;return(async()=>{try{let t=await x(p.id).introspect.listTables(b(p.serverConnectionId),n.database);if(e)return;let i=t.map(e=>e.name);d(i),n.table&&!i.includes(n.table)&&r({...n,table:``})}catch{e||d([])}})(),()=>{e=!0}},[p?.id,p?.serverConnectionId,n.database]),(0,E.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[(0,E.jsx)(l,{className:`font-medium`,children:t}),(0,E.jsxs)(v,{value:n.connectionId,onValueChange:e=>r({connectionId:e,database:``,table:``}),disabled:a,children:[(0,E.jsx)(h,{id:`${e}-conn`,className:`w-full`,children:(0,E.jsx)(m,{placeholder:o(`database.diff.pickConnection`)})}),(0,E.jsx)(g,{children:i.map(e=>(0,E.jsx)(_,{value:e.id,children:D(e)},e.id))})]}),(0,E.jsxs)(v,{value:n.database,onValueChange:e=>r({...n,database:e,table:``}),disabled:a||s.length===0,children:[(0,E.jsx)(h,{id:`${e}-db`,className:`w-full`,children:(0,E.jsx)(m,{placeholder:o(`database.diff.pickDatabase`)})}),(0,E.jsx)(g,{children:s.map(e=>(0,E.jsx)(_,{value:e,children:e},e))})]}),(0,E.jsxs)(v,{value:n.table,onValueChange:e=>r({...n,table:e}),disabled:a||u.length===0,children:[(0,E.jsx)(h,{id:`${e}-table`,className:`w-full`,children:(0,E.jsx)(m,{placeholder:o(`database.dataDiff.pickTable`)})}),(0,E.jsx)(g,{children:u.map(e=>(0,E.jsx)(_,{value:e,children:e},e))})]})]})}async function A(e,t){let n=await o({connectionId:e.connectionId,database:e.database,table:e.table,limit:O,onProgress:t}),r=[];for await(let e of n.pages)r.push(...e);return{rows:r,columns:n.fields.map(e=>e.name),capped:r.length>=O}}function j({diff:e,row:t,other:n,changed:r}){let{t:i}=f(),a=[...e.keyColumns,...e.compareColumns];return(0,E.jsxs)(`table`,{className:`w-full text-xs font-mono`,children:[(0,E.jsx)(`thead`,{className:`text-muted-foreground`,children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{className:`text-left font-normal pr-2`,children:i(`database.diff.column`)}),(0,E.jsx)(`th`,{className:`text-left font-normal pr-2`,children:i(`database.diff.source`)}),(0,E.jsx)(`th`,{className:`text-left font-normal`,children:i(`database.diff.target`)})]})}),(0,E.jsx)(`tbody`,{children:a.map(e=>(0,E.jsxs)(`tr`,{className:r?.includes(e)?`text-amber-600 dark:text-amber-400`:``,children:[(0,E.jsx)(`td`,{className:`pr-2 align-top whitespace-nowrap`,children:e}),(0,E.jsx)(`td`,{className:`pr-2 align-top break-all`,children:s(t[e])}),(0,E.jsx)(`td`,{className:`align-top break-all`,children:n?s(n[e]):`—`})]},e))})]})}function M(){let{t}=f(),i=n(e=>e.activeDialog),o=n(e=>e.closeDialog),l=r(`data-diff`),d=y(e=>e.activeConnections),m=(0,T.useMemo)(()=>d.filter(e=>e.serverConnectionId),[d]),h=y(e=>e.activeConnectionId),g=i===`data-diff`,[_,v]=(0,T.useState)(()=>l&&m.some(e=>e.id===l.connectionId)?{connectionId:l.connectionId,database:l.database,table:l.table}:{connectionId:h&&m.some(e=>e.id===h)?h:m[0]?.id??``,database:``,table:``}),[D,M]=(0,T.useState)(()=>({connectionId:m.find(e=>e.id!==_.connectionId)?.id??_.connectionId,database:``,table:``})),[N,P]=(0,T.useState)([]),[F,I]=(0,T.useState)(null),[ie,ae]=(0,T.useState)(!1),[L,R]=(0,T.useState)(`changed`),[z,B]=(0,T.useState)(0),[V,oe]=(0,T.useState)(!1),[H,U]=(0,T.useState)(!1),[W,G]=(0,T.useState)({source:null,target:null}),[K,q]=(0,T.useState)(null),se=e=>M(e.database&&!e.table&&_.table?{...e,table:_.table}:e),J=_.connectionId===D.connectionId&&_.database===D.database&&_.table===D.table,ce=!!_.table&&!!D.table&&!J,Y=D.connectionId?x(D.connectionId):null;async function X(){U(!0),q(null),I(null);try{let n=y.getState().activeConnections.find(e=>e.id===_.connectionId);if(!n?.serverConnectionId)throw Error(t(`services.query.notConnected`));let r=await x(_.connectionId).introspect.getPrimaryKeys(b(n.serverConnectionId),_.database,_.table);if(r.length===0)throw Error(t(`database.dataDiff.noPrimaryKey`,{table:_.table}));G({source:{loaded:0,total:null},target:{loaded:0,total:null}});let[i,a]=await Promise.all([A(_,e=>G(t=>({...t,source:e}))),A(D,e=>G(t=>({...t,target:e})))]);if(r.some(e=>!a.columns.includes(e)))throw Error(t(`database.dataDiff.keyMissingInTarget`,{columns:r.join(`, `)}));let o=u(i.rows,a.rows,r,i.columns,a.columns);P(r),ae(i.capped||a.capped),I(o),R(o.changed.length>0?`changed`:o.added.length>0?`added`:`removed`),B(0),ee(`compare_data`),e(`data_diff`,{source_dbms:x(_.connectionId).id,target_dbms:Y?.id??`unknown`,added:o.added.length,changed:o.changed.length,removed:o.removed.length})}catch(e){q(re(e))}finally{U(!1),G({source:null,target:null})}}let Z=e=>e?e.total===null?e.loaded.toLocaleString():`${e.loaded.toLocaleString()} / ${e.total.toLocaleString()}`:``,Q=(0,T.useMemo)(()=>F&&Y?c(F,Y,{database:D.database,table:D.table},{includeDeletes:V}):``,[F,Y,D.database,D.table,V]);function le(){Q&&(a(D.connectionId,Q,D.database,t(`database.dataDiff.tabTitle`,{table:D.table})),o())}let $=F?L===`added`?F.added:L===`removed`?F.removed:F.changed.map(e=>e.source):[],ue=!!F&&F.added.length+F.changed.length+F.removed.length>0,de=e=>N.map(t=>s(e[t])).join(`, `);return(0,E.jsx)(w,{open:g,onOpenChange:e=>{e||o()},children:(0,E.jsxs)(S,{className:`sm:max-w-[900px]`,children:[(0,E.jsx)(te,{children:(0,E.jsx)(C,{children:t(`database.dataDiff.title`)})}),(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,E.jsx)(k,{id:`ddiff-source`,label:t(`database.diff.source`),side:_,onChange:v,connections:m,disabled:H}),(0,E.jsx)(k,{id:`ddiff-target`,label:t(`database.diff.target`),side:D,onChange:se,connections:m,disabled:H})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`database.dataDiff.hint`,{cap:O.toLocaleString()})}),J&&_.table&&(0,E.jsx)(`p`,{className:`text-xs text-destructive`,children:t(`database.dataDiff.sameSide`)}),K&&(0,E.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:K}),H&&(W.source||W.target)&&(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`database.dataDiff.loading`,{source:Z(W.source),target:Z(W.target)})}),F&&(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs`,children:[(0,E.jsx)(`span`,{className:`text-muted-foreground`,children:t(`database.dataDiff.summary`,{key:N.join(`, `),added:F.added.length,changed:F.changed.length,removed:F.removed.length,identical:F.identical})}),ie&&(0,E.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:t(`database.dataDiff.capped`,{cap:O.toLocaleString()})}),(F.sourceOnlyColumns.length>0||F.targetOnlyColumns.length>0)&&(0,E.jsx)(`span`,{className:`text-muted-foreground`,children:t(`database.dataDiff.ignoredColumns`,{columns:[...F.sourceOnlyColumns,...F.targetOnlyColumns].join(`, `)})})]}),(0,E.jsx)(`div`,{className:`flex gap-1 text-xs`,children:[`added`,`changed`,`removed`].map(e=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>{R(e),B(0)},className:`rounded border px-2 py-0.5 ${L===e?`bg-accent`:``}`,children:t(`database.dataDiff.${e}`,{count:e===`added`?F.added.length:e===`removed`?F.removed.length:F.changed.length})},e))}),(0,E.jsxs)(`div`,{className:`grid grid-cols-[240px_1fr] gap-3 h-[280px]`,children:[(0,E.jsxs)(`ul`,{className:`overflow-auto rounded-md border text-sm font-mono`,children:[$.slice(0,2e3).map((e,t)=>(0,E.jsx)(`li`,{className:`px-2 py-1 cursor-pointer ${z===t?`bg-accent`:``}`,onClick:()=>B(t),children:de(e)},t)),$.length===0&&(0,E.jsx)(`li`,{className:`px-2 py-1 text-muted-foreground`,children:t(`database.dataDiff.none`)}),$.length>2e3&&(0,E.jsx)(`li`,{className:`px-2 py-1 text-muted-foreground`,children:t(`database.dataDiff.more`,{count:$.length-2e3})})]}),(0,E.jsx)(`div`,{className:`overflow-auto rounded-md border p-2`,children:$[z]?L===`changed`?(0,E.jsx)(j,{diff:F,row:F.changed[z].source,other:F.changed[z].target,changed:F.changed[z].columns}):L===`removed`?(0,E.jsx)(j,{diff:F,row:{},other:$[z]}):(0,E.jsx)(j,{diff:F,row:$[z]}):(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`database.diff.selectTable`)})})]}),(0,E.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:V,onChange:e=>oe(e.target.checked)}),(0,E.jsx)(`span`,{className:V?`text-destructive`:``,children:t(`database.dataDiff.includeDeletes`)})]})]})]}),(0,E.jsxs)(ne,{children:[(0,E.jsx)(p,{variant:`outline`,onClick:o,children:t(`database.diff.close`)}),(0,E.jsx)(p,{variant:`secondary`,onClick:()=>{X()},disabled:!ce||H,children:t(H?`database.diff.comparing`:`database.diff.compare`)}),(0,E.jsx)(p,{onClick:le,disabled:!ue,children:t(`database.diff.openScript`)})]})]})})}export{M as DataDiffDialog};