@vibe80/vibe80 0.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.
- package/LICENSE +201 -0
- package/README.md +52 -0
- package/bin/vibe80.js +176 -0
- package/client/dist/assets/DiffPanel-C_IGzKI5.js +1 -0
- package/client/dist/assets/ExplorerPanel-BtlyAT00.js +11 -0
- package/client/dist/assets/LogsPanel-BW79JWzR.js +1 -0
- package/client/dist/assets/SettingsPanel-b9B7ygP_.js +1 -0
- package/client/dist/assets/TerminalPanel-C3fc1HbK.js +1 -0
- package/client/dist/assets/browser-e3WgtMs-.js +8 -0
- package/client/dist/assets/index-CgqGyssr.css +32 -0
- package/client/dist/assets/index-DnwKjoj7.js +706 -0
- package/client/dist/assets/vibe80_dark-D7OVPKcU.svg +51 -0
- package/client/dist/assets/vibe80_light-BJK37ybI.svg +50 -0
- package/client/dist/favicon.ico +0 -0
- package/client/dist/favicon.png +0 -0
- package/client/dist/favicon.svg +35 -0
- package/client/dist/index.html +14 -0
- package/client/index.html +16 -0
- package/client/package.json +34 -0
- package/client/public/favicon.ico +0 -0
- package/client/public/favicon.png +0 -0
- package/client/public/favicon.svg +35 -0
- package/client/public/pwa-192x192.png +0 -0
- package/client/public/pwa-512x512.png +0 -0
- package/client/src/App.jsx +3131 -0
- package/client/src/assets/logo_small.png +0 -0
- package/client/src/assets/vibe80_dark.svg +51 -0
- package/client/src/assets/vibe80_light.svg +50 -0
- package/client/src/components/Chat/ChatComposer.jsx +228 -0
- package/client/src/components/Chat/ChatMessages.jsx +811 -0
- package/client/src/components/Chat/ChatToolbar.jsx +109 -0
- package/client/src/components/Chat/useChatComposer.js +462 -0
- package/client/src/components/Diff/DiffPanel.jsx +129 -0
- package/client/src/components/Explorer/ExplorerPanel.jsx +449 -0
- package/client/src/components/Logs/LogsPanel.jsx +80 -0
- package/client/src/components/SessionGate/SessionGate.jsx +874 -0
- package/client/src/components/Settings/SettingsPanel.jsx +212 -0
- package/client/src/components/Terminal/TerminalPanel.jsx +39 -0
- package/client/src/components/Topbar/Topbar.jsx +101 -0
- package/client/src/components/WorktreeTabs.css +419 -0
- package/client/src/components/WorktreeTabs.jsx +604 -0
- package/client/src/hooks/useAttachments.jsx +125 -0
- package/client/src/hooks/useBacklog.js +254 -0
- package/client/src/hooks/useChatClear.js +90 -0
- package/client/src/hooks/useChatCollapse.js +42 -0
- package/client/src/hooks/useChatCommands.js +294 -0
- package/client/src/hooks/useChatExport.js +144 -0
- package/client/src/hooks/useChatMessagesState.js +69 -0
- package/client/src/hooks/useChatSend.js +158 -0
- package/client/src/hooks/useChatSocket.js +1239 -0
- package/client/src/hooks/useDiffNavigation.js +19 -0
- package/client/src/hooks/useExplorerActions.js +1184 -0
- package/client/src/hooks/useGitIdentity.js +114 -0
- package/client/src/hooks/useLayoutMode.js +31 -0
- package/client/src/hooks/useLocalPreferences.js +131 -0
- package/client/src/hooks/useMessageSync.js +30 -0
- package/client/src/hooks/useNotifications.js +132 -0
- package/client/src/hooks/usePaneNavigation.js +67 -0
- package/client/src/hooks/usePanelState.js +13 -0
- package/client/src/hooks/useProviderSelection.js +70 -0
- package/client/src/hooks/useRepoBranchesModels.js +218 -0
- package/client/src/hooks/useRepoStatus.js +350 -0
- package/client/src/hooks/useRpcLogActions.js +19 -0
- package/client/src/hooks/useRpcLogView.js +58 -0
- package/client/src/hooks/useSessionHandoff.js +97 -0
- package/client/src/hooks/useSessionLifecycle.js +287 -0
- package/client/src/hooks/useSessionReset.js +63 -0
- package/client/src/hooks/useSessionResync.js +77 -0
- package/client/src/hooks/useTerminalSession.js +328 -0
- package/client/src/hooks/useToolbarExport.js +27 -0
- package/client/src/hooks/useTurnInterrupt.js +43 -0
- package/client/src/hooks/useVibe80Forms.js +128 -0
- package/client/src/hooks/useWorkspaceAuth.js +932 -0
- package/client/src/hooks/useWorktreeCloseConfirm.js +46 -0
- package/client/src/hooks/useWorktrees.js +396 -0
- package/client/src/i18n.jsx +87 -0
- package/client/src/index.css +5147 -0
- package/client/src/locales/en.json +37 -0
- package/client/src/locales/fr.json +321 -0
- package/client/src/main.jsx +16 -0
- package/client/vite.config.js +62 -0
- package/docs/api/asyncapi.json +1511 -0
- package/docs/api/openapi.json +3242 -0
- package/git_hooks/prepare-commit-msg +35 -0
- package/package.json +36 -0
- package/server/package.json +29 -0
- package/server/scripts/rotate-workspace-secret.js +101 -0
- package/server/src/claudeClient.js +454 -0
- package/server/src/clientEvents.js +594 -0
- package/server/src/clientFactory.js +164 -0
- package/server/src/codexClient.js +468 -0
- package/server/src/config.js +27 -0
- package/server/src/helpers.js +138 -0
- package/server/src/index.js +1641 -0
- package/server/src/middleware/auth.js +93 -0
- package/server/src/middleware/debug.js +89 -0
- package/server/src/middleware/errorTypes.js +60 -0
- package/server/src/providerLogger.js +60 -0
- package/server/src/routes/files.js +114 -0
- package/server/src/routes/git.js +183 -0
- package/server/src/routes/health.js +13 -0
- package/server/src/routes/sessions.js +407 -0
- package/server/src/routes/workspaces.js +296 -0
- package/server/src/routes/worktrees.js +993 -0
- package/server/src/runAs.js +458 -0
- package/server/src/runtimeStore.js +32 -0
- package/server/src/services/auth.js +157 -0
- package/server/src/services/claudeThreadDirectory.js +33 -0
- package/server/src/services/session.js +918 -0
- package/server/src/services/workspace.js +858 -0
- package/server/src/storage/index.js +17 -0
- package/server/src/storage/redis.js +412 -0
- package/server/src/storage/sqlite.js +649 -0
- package/server/src/worktreeManager.js +717 -0
- package/server/tests/README.md +13 -0
- package/server/tests/factories/workspaceFactory.js +13 -0
- package/server/tests/fixtures/workspaceCredentials.json +4 -0
- package/server/tests/integration/routes/workspaces-routes.test.js +626 -0
- package/server/tests/setup/env.js +9 -0
- package/server/tests/unit/helpers.test.js +95 -0
- package/server/tests/unit/services/auth.test.js +181 -0
- package/server/tests/unit/services/workspace.test.js +115 -0
- package/server/vitest.config.js +23 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# vibe80
|
|
2
|
+
|
|
3
|
+
Vibe80 is an open-source, AI-assisted coding platform that orchestrates LLM agents over Git repositories through a real-time web interface. It acts as a bridge between developers and AI coding agents — currently supporting Codex (OpenAI) and Claude Code (Anthropic) — providing a structured environment where these agents can read, write, and modify code within isolated, sandboxed workspaces.
|
|
4
|
+
|
|
5
|
+
## Key Capabilities
|
|
6
|
+
|
|
7
|
+
- Real-time AI chat — Stream-based conversation with AI agents that can read, write, and execute code in your repository.
|
|
8
|
+
- Multi-provider support — Switch between Codex (OpenAI) and Claude Code (Anthropic) within the same session, with independent model and reasoning configuration per provider
|
|
9
|
+
- Parallel worktrees — Create multiple isolated git worktrees (branches) within a session, each with its own AI agent, enabling parallel development tracks. Supports forking a worktree to inherit the conversation context
|
|
10
|
+
- Web terminal — Full PTY-based terminal access to the repository environment via xterm.js
|
|
11
|
+
- Mobile companion — Native Android (Jetpack Compose) and iOS (SwiftUI) apps built with Kotlin Multiplatform, with QR-code session handoff.
|
|
12
|
+
- Sandboxing — Landlock LSM, seccomp, and network control restrict what AI agents can access on the filesystem and network
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
- Node.js >= 18
|
|
17
|
+
- Git
|
|
18
|
+
- `codex` installed & configured (optional)
|
|
19
|
+
- `claude code` installed & configured (optional)
|
|
20
|
+
|
|
21
|
+
At least one of `codex` or `claude code` must be installed before starting.
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
0. Clone this repo.
|
|
26
|
+
|
|
27
|
+
1. Install dependencies:
|
|
28
|
+
```bash
|
|
29
|
+
npm install
|
|
30
|
+
# Optional global install:
|
|
31
|
+
# npm install -g .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
2. Run:
|
|
35
|
+
```bash
|
|
36
|
+
vibe80
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
3. A one-shot authentication link is printed to the console — open it to be automatically logged in.
|
|
40
|
+
- The server starts on http://localhost:5179
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## Docker installation
|
|
44
|
+
|
|
45
|
+
TODO
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
This project is licensed under the **Apache License 2.0**.
|
|
50
|
+
|
|
51
|
+
- Full license text: [LICENSE](LICENSE)
|
|
52
|
+
- Attribution notices: [NOTICE](NOTICE)
|
package/bin/vibe80.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawn } = require("child_process");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const os = require("os");
|
|
8
|
+
|
|
9
|
+
const rootDir = path.resolve(__dirname, "..");
|
|
10
|
+
const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
11
|
+
const homeDir = process.env.HOME || os.homedir();
|
|
12
|
+
const monoAuthUrlFile = path.join(
|
|
13
|
+
os.tmpdir(),
|
|
14
|
+
`vibe80-mono-auth-${process.pid}-${Date.now()}.url`
|
|
15
|
+
);
|
|
16
|
+
const defaultEnv = {
|
|
17
|
+
DEPLOYMENT_MODE: "mono_user",
|
|
18
|
+
JWT_KEY_PATH: path.join(homeDir, ".vibe80", "jwt.key"),
|
|
19
|
+
STORAGE_BACKEND: "sqlite",
|
|
20
|
+
SQLITE_PATH: path.join(homeDir, ".vibe80", "data.sqlite"),
|
|
21
|
+
};
|
|
22
|
+
const deploymentMode = process.env.DEPLOYMENT_MODE || defaultEnv.DEPLOYMENT_MODE;
|
|
23
|
+
const serverPort = process.env.PORT || "5179";
|
|
24
|
+
|
|
25
|
+
const spawnProcess = (args, label, extraEnv = {}) => {
|
|
26
|
+
const child = spawn(npmCmd, args, {
|
|
27
|
+
cwd: rootDir,
|
|
28
|
+
env: {
|
|
29
|
+
...defaultEnv,
|
|
30
|
+
...process.env,
|
|
31
|
+
...extraEnv,
|
|
32
|
+
},
|
|
33
|
+
stdio: "inherit",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
child.on("error", (error) => {
|
|
37
|
+
console.error(`[vibe80] Failed to start ${label}:`, error.message || error);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return child;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const runBuild = () =>
|
|
44
|
+
new Promise((resolve, reject) => {
|
|
45
|
+
const build = spawnProcess(
|
|
46
|
+
["--workspace", "client", "run", "build"],
|
|
47
|
+
"client build"
|
|
48
|
+
);
|
|
49
|
+
build.on("exit", (code) => {
|
|
50
|
+
if (code === 0) {
|
|
51
|
+
resolve();
|
|
52
|
+
} else {
|
|
53
|
+
reject(new Error(`Client build failed with exit code ${code}`));
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
let server = null;
|
|
59
|
+
|
|
60
|
+
let shuttingDown = false;
|
|
61
|
+
|
|
62
|
+
const unlinkMonoAuthUrlFile = () => {
|
|
63
|
+
try {
|
|
64
|
+
fs.unlinkSync(monoAuthUrlFile);
|
|
65
|
+
} catch {
|
|
66
|
+
// ignore
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const tryOpenUrl = (url) =>
|
|
71
|
+
new Promise((resolve) => {
|
|
72
|
+
if (!url) {
|
|
73
|
+
resolve(false);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const command = process.platform === "darwin"
|
|
77
|
+
? "open"
|
|
78
|
+
: process.platform === "win32"
|
|
79
|
+
? "cmd"
|
|
80
|
+
: "xdg-open";
|
|
81
|
+
const args = process.platform === "darwin"
|
|
82
|
+
? [url]
|
|
83
|
+
: process.platform === "win32"
|
|
84
|
+
? ["/c", "start", "", url]
|
|
85
|
+
: [url];
|
|
86
|
+
const opener = spawn(command, args, {
|
|
87
|
+
stdio: "ignore",
|
|
88
|
+
detached: true,
|
|
89
|
+
});
|
|
90
|
+
opener.on("error", () => resolve(false));
|
|
91
|
+
opener.on("exit", (code) => resolve(code === 0));
|
|
92
|
+
opener.unref();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const waitForMonoAuthUrl = (timeoutMs = 15000) =>
|
|
96
|
+
new Promise((resolve) => {
|
|
97
|
+
const deadline = Date.now() + timeoutMs;
|
|
98
|
+
const poll = () => {
|
|
99
|
+
if (Date.now() >= deadline) {
|
|
100
|
+
resolve("");
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
let url = "";
|
|
104
|
+
try {
|
|
105
|
+
if (fs.existsSync(monoAuthUrlFile)) {
|
|
106
|
+
url = fs.readFileSync(monoAuthUrlFile, "utf8").trim();
|
|
107
|
+
}
|
|
108
|
+
} catch {
|
|
109
|
+
url = "";
|
|
110
|
+
}
|
|
111
|
+
if (url) {
|
|
112
|
+
resolve(url);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
setTimeout(poll, 250);
|
|
116
|
+
};
|
|
117
|
+
poll();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const maybeOpenMonoAuthUrl = async () => {
|
|
121
|
+
if (deploymentMode !== "mono_user") {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const url = await waitForMonoAuthUrl();
|
|
125
|
+
if (!url) {
|
|
126
|
+
console.log(`==> Open this URL to access the application: http://localhost:${serverPort}`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const opened = await tryOpenUrl(url);
|
|
130
|
+
if (!opened) {
|
|
131
|
+
console.log(`==> Open this URL to authenticate: ${url}`);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const shutdown = (code = 0) => {
|
|
136
|
+
if (shuttingDown) return;
|
|
137
|
+
shuttingDown = true;
|
|
138
|
+
unlinkMonoAuthUrlFile();
|
|
139
|
+
if (server?.pid) {
|
|
140
|
+
server.kill("SIGTERM");
|
|
141
|
+
}
|
|
142
|
+
process.exit(code);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const startServer = () => {
|
|
146
|
+
unlinkMonoAuthUrlFile();
|
|
147
|
+
server = spawnProcess(
|
|
148
|
+
["--workspace", "server", "run", "start"],
|
|
149
|
+
"server",
|
|
150
|
+
{ VIBE80_MONO_AUTH_URL_FILE: monoAuthUrlFile }
|
|
151
|
+
);
|
|
152
|
+
void maybeOpenMonoAuthUrl();
|
|
153
|
+
|
|
154
|
+
server.on("exit", (code, signal) => {
|
|
155
|
+
if (shuttingDown) return;
|
|
156
|
+
if (code && code !== 0) {
|
|
157
|
+
shutdown(code);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (signal && signal !== "SIGTERM") {
|
|
161
|
+
shutdown(1);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
shutdown(0);
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
runBuild()
|
|
169
|
+
.then(() => startServer())
|
|
170
|
+
.catch((error) => {
|
|
171
|
+
console.error(`[vibe80] ${error.message || error}`);
|
|
172
|
+
shutdown(1);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
process.on("SIGINT", () => shutdown(0));
|
|
176
|
+
process.on("SIGTERM", () => shutdown(0));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as d,i as b,H as v}from"./index-DnwKjoj7.js";function k({t:i,activePane:j,isInWorktree:N,diffStatusLines:l,connected:f,currentProcessing:t,hasCurrentChanges:r,sendCommitMessage:h,diffFiles:m,currentDiff:o,untrackedFilePanels:c,untrackedLoading:u}){const x=Array.isArray(c)&&c.length>0,p=e=>{const s=String(e||"").split(/\r?\n/);return d.jsx("table",{className:"diff-view untracked-diff-view",children:d.jsx("tbody",{children:s.map((n,a)=>d.jsxs("tr",{className:"diff-line diff-line-add",children:[d.jsx("td",{className:"diff-gutter diff-gutter-added",children:d.jsx("span",{className:"diff-line-number",children:a+1})}),d.jsx("td",{className:"diff-code diff-code-added",children:n.length>0?n:" "})]},`line-${a}`))})})};return d.jsxs("div",{className:`diff-panel ${j==="diff"?"":"is-hidden"}`,children:[d.jsxs("div",{className:"diff-header",children:[d.jsx("div",{className:"diff-title",children:i(N?"Worktree diff":"Repository diff")}),l.length>0&&d.jsx("div",{className:"diff-count",children:i("{{count}} files modified",{count:l.length})}),d.jsxs("div",{className:"diff-actions",children:[d.jsx("button",{type:"button",className:"diff-action-button",onClick:()=>h("Commit"),disabled:!f||t||!r,title:i("Send 'Commit' in chat"),children:i("Commit")}),d.jsx("button",{type:"button",className:"diff-action-button primary",onClick:()=>h("Commit & Push"),disabled:!f||t||!r,title:i("Send 'Commit & Push' in chat"),children:i("Commit & Push")})]})]}),l.length>0&&d.jsx("div",{className:"diff-status",children:l.map((e,s)=>d.jsx("div",{children:e},`${e}-${s}`))}),m.length>0||x?d.jsxs("div",{className:"diff-body",children:[m.map(e=>{const s=e.newPath||e.oldPath||i("Diff");return d.jsxs("div",{className:"diff-file",children:[d.jsx("div",{className:"diff-file-header",children:s}),d.jsx(b,{viewType:"unified",diffType:e.type,hunks:e.hunks,children:n=>n.map(a=>d.jsx(v,{hunk:a},a.content))})]},`${e.oldPath}-${e.newPath}-${e.type}`)}),x&&c.map(e=>d.jsxs("div",{className:"diff-file",children:[d.jsx("div",{className:"diff-file-header",children:`?? ${e.path}`}),e.error?d.jsx("pre",{className:"diff-fallback",children:i("Unable to load file.")}):e.binary?d.jsx("pre",{className:"diff-fallback",children:i("binary data")}):d.jsxs(d.Fragment,{children:[p(e.content||""),e.truncated&&d.jsx("div",{className:"diff-file-note",children:i("File truncated for display.")})]})]},`untracked-${e.path}`)),u&&d.jsx("div",{className:"diff-file-note",children:i("Loading untracked files...")})]}):o.diff?d.jsx("pre",{className:"diff-fallback",children:o.diff}):d.jsx("div",{className:"diff-empty",children:i("No changes detected.")})]})}export{k as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{r as s,W as U,j as a,F,f as we,a as xe,b as Oe,c as Me}from"./index-DnwKjoj7.js";function ae(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function Pe(e){if(Array.isArray(e))return e}function Ne(e,r,t){return(r=Ee(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Ce(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n,i,c,d,y=[],v=!0,f=!1;try{if(c=(t=t.call(e)).next,r!==0)for(;!(v=(n=c.call(t)).done)&&(y.push(n.value),y.length!==r);v=!0);}catch(S){f=!0,i=S}finally{try{if(!v&&t.return!=null&&(d=t.return(),Object(d)!==d))return}finally{if(f)throw i}}return y}}function Se(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ue(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function le(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?ue(Object(t),!0).forEach(function(n){Ne(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ue(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function Re(e,r){if(e==null)return{};var t,n,i=Le(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)t=c[n],r.indexOf(t)===-1&&{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function Le(e,r){if(e==null)return{};var t={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(r.indexOf(n)!==-1)continue;t[n]=e[n]}return t}function Ie(e,r){return Pe(e)||Ce(e,r)||Te(e,r)||Se()}function De(e,r){if(typeof e!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Ee(e){var r=De(e,"string");return typeof r=="symbol"?r:r+""}function Te(e,r){if(e){if(typeof e=="string")return ae(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ae(e,r):void 0}}function Ae(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ce(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function se(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?ce(Object(t),!0).forEach(function(n){Ae(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ce(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function $e(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return function(n){return r.reduceRight(function(i,c){return c(i)},n)}}function J(e){return function r(){for(var t=this,n=arguments.length,i=new Array(n),c=0;c<n;c++)i[c]=arguments[c];return i.length>=e.length?e.apply(this,i):function(){for(var d=arguments.length,y=new Array(d),v=0;v<d;v++)y[v]=arguments[v];return r.apply(t,[].concat(i,y))}}}function re(e){return{}.toString.call(e).includes("Object")}function Ve(e){return!Object.keys(e).length}function X(e){return typeof e=="function"}function Be(e,r){return Object.prototype.hasOwnProperty.call(e,r)}function qe(e,r){return re(r)||A("changeType"),Object.keys(r).some(function(t){return!Be(e,t)})&&A("changeField"),r}function ze(e){X(e)||A("selectorType")}function Ue(e){X(e)||re(e)||A("handlerType"),re(e)&&Object.values(e).some(function(r){return!X(r)})&&A("handlersType")}function He(e){e||A("initialIsRequired"),re(e)||A("initialType"),Ve(e)&&A("initialContent")}function Ke(e,r){throw new Error(e[r]||e.default)}var Ge={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},A=J(Ke)(Ge),W={changes:qe,selector:ze,handler:Ue,initial:He};function Ye(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};W.initial(e),W.handler(r);var t={current:e},n=J(Qe)(t,r),i=J(Je)(t),c=J(W.changes)(e),d=J(_e)(t);function y(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(S){return S};return W.selector(f),f(t.current)}function v(f){$e(n,i,c,d)(f)}return[y,v]}function _e(e,r){return X(r)?r(e.current):r}function Je(e,r){return e.current=se(se({},e.current),r),r}function Qe(e,r,t){return X(r)?r(e.current):Object.keys(t).forEach(function(n){var i;return(i=r[n])===null||i===void 0?void 0:i.call(r,e.current[n])}),t}var Xe={create:Ye},Ze={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function ke(e){return function r(){for(var t=this,n=arguments.length,i=new Array(n),c=0;c<n;c++)i[c]=arguments[c];return i.length>=e.length?e.apply(this,i):function(){for(var d=arguments.length,y=new Array(d),v=0;v<d;v++)y[v]=arguments[v];return r.apply(t,[].concat(i,y))}}}function Fe(e){return{}.toString.call(e).includes("Object")}function We(e){return e||de("configIsRequired"),Fe(e)||de("configType"),e.urls?(er(),{paths:{vs:e.urls.monacoBase}}):e}function er(){console.warn(fe.deprecation)}function rr(e,r){throw new Error(e[r]||e.default)}var fe={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
3
|
+
You are using deprecated way of configuration.
|
|
4
|
+
|
|
5
|
+
Instead of using
|
|
6
|
+
monaco.config({ urls: { monacoBase: '...' } })
|
|
7
|
+
use
|
|
8
|
+
monaco.config({ paths: { vs: '...' } })
|
|
9
|
+
|
|
10
|
+
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
11
|
+
`},de=ke(rr)(fe),tr={config:We},nr=function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return function(i){return t.reduceRight(function(c,d){return d(c)},i)}};function pe(e,r){return Object.keys(r).forEach(function(t){r[t]instanceof Object&&e[t]&&Object.assign(r[t],pe(e[t],r[t]))}),le(le({},e),r)}var or={type:"cancelation",msg:"operation is manually canceled"};function ne(e){var r=!1,t=new Promise(function(n,i){e.then(function(c){return r?i(or):n(c)}),e.catch(i)});return t.cancel=function(){return r=!0},t}var ir=["monaco"],ar=Xe.create({config:Ze,isInitialized:!1,resolve:null,reject:null,monaco:null}),ge=Ie(ar,2),Z=ge[0],te=ge[1];function ur(e){var r=tr.config(e),t=r.monaco,n=Re(r,ir);te(function(i){return{config:pe(i.config,n),monaco:t}})}function lr(){var e=Z(function(r){var t=r.monaco,n=r.isInitialized,i=r.resolve;return{monaco:t,isInitialized:n,resolve:i}});if(!e.isInitialized){if(te({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),ne(oe);if(window.monaco&&window.monaco.editor)return he(window.monaco),e.resolve(window.monaco),ne(oe);nr(cr,dr)(fr)}return ne(oe)}function cr(e){return document.body.appendChild(e)}function sr(e){var r=document.createElement("script");return e&&(r.src=e),r}function dr(e){var r=Z(function(n){var i=n.config,c=n.reject;return{config:i,reject:c}}),t=sr("".concat(r.config.paths.vs,"/loader.js"));return t.onload=function(){return e()},t.onerror=r.reject,t}function fr(){var e=Z(function(t){var n=t.config,i=t.resolve,c=t.reject;return{config:n,resolve:i,reject:c}}),r=window.require;r.config(e.config),r(["vs/editor/editor.main"],function(t){var n=t.m||t;he(n),e.resolve(n)},function(t){e.reject(t)})}function he(e){Z().monaco||te({monaco:e})}function pr(){return Z(function(e){var r=e.monaco;return r})}var oe=new Promise(function(e,r){return te({resolve:e,reject:r})}),me={config:ur,init:lr,__getMonacoInstance:pr},gr={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ie=gr,hr={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},mr=hr;function br({children:e}){return U.createElement("div",{style:mr.container},e)}var yr=br,vr=yr;function jr({width:e,height:r,isEditorReady:t,loading:n,_ref:i,className:c,wrapperProps:d}){return U.createElement("section",{style:{...ie.wrapper,width:e,height:r},...d},!t&&U.createElement(vr,null,n),U.createElement("div",{ref:i,style:{...ie.fullWidth,...!t&&ie.hide},className:c}))}var wr=jr,be=s.memo(wr);function xr(e){s.useEffect(e,[])}var ye=xr;function Or(e,r,t=!0){let n=s.useRef(!0);s.useEffect(n.current||!t?()=>{n.current=!1}:e,r)}var M=Or;function Q(){}function z(e,r,t,n){return Mr(e,n)||Pr(e,r,t,n)}function Mr(e,r){return e.editor.getModel(ve(e,r))}function Pr(e,r,t,n){return e.editor.createModel(r,t,n?ve(e,n):void 0)}function ve(e,r){return e.Uri.parse(r)}function Nr({original:e,modified:r,language:t,originalLanguage:n,modifiedLanguage:i,originalModelPath:c,modifiedModelPath:d,keepCurrentOriginalModel:y=!1,keepCurrentModifiedModel:v=!1,theme:f="light",loading:S="Loading...",options:P={},height:H="100%",width:$="100%",className:K,wrapperProps:G={},beforeMount:Y=Q,onMount:_=Q}){let[O,V]=s.useState(!1),[L,w]=s.useState(!0),g=s.useRef(null),j=s.useRef(null),x=s.useRef(null),o=s.useRef(_),h=s.useRef(Y),N=s.useRef(!1);ye(()=>{let l=me.init();return l.then(m=>(j.current=m)&&w(!1)).catch(m=>(m==null?void 0:m.type)!=="cancelation"&&console.error("Monaco initialization: error:",m)),()=>g.current?C():l.cancel()}),M(()=>{if(g.current&&j.current){let l=g.current.getOriginalEditor(),m=z(j.current,e||"",n||t||"text",c||"");m!==l.getModel()&&l.setModel(m)}},[c],O),M(()=>{if(g.current&&j.current){let l=g.current.getModifiedEditor(),m=z(j.current,r||"",i||t||"text",d||"");m!==l.getModel()&&l.setModel(m)}},[d],O),M(()=>{let l=g.current.getModifiedEditor();l.getOption(j.current.editor.EditorOption.readOnly)?l.setValue(r||""):r!==l.getValue()&&(l.executeEdits("",[{range:l.getModel().getFullModelRange(),text:r||"",forceMoveMarkers:!0}]),l.pushUndoStop())},[r],O),M(()=>{var l,m;(m=(l=g.current)==null?void 0:l.getModel())==null||m.original.setValue(e||"")},[e],O),M(()=>{let{original:l,modified:m}=g.current.getModel();j.current.editor.setModelLanguage(l,n||t||"text"),j.current.editor.setModelLanguage(m,i||t||"text")},[t,n,i],O),M(()=>{var l;(l=j.current)==null||l.editor.setTheme(f)},[f],O),M(()=>{var l;(l=g.current)==null||l.updateOptions(P)},[P],O);let I=s.useCallback(()=>{var R;if(!j.current)return;h.current(j.current);let l=z(j.current,e||"",n||t||"text",c||""),m=z(j.current,r||"",i||t||"text",d||"");(R=g.current)==null||R.setModel({original:l,modified:m})},[t,r,i,e,n,c,d]),D=s.useCallback(()=>{var l;!N.current&&x.current&&(g.current=j.current.editor.createDiffEditor(x.current,{automaticLayout:!0,...P}),I(),(l=j.current)==null||l.editor.setTheme(f),V(!0),N.current=!0)},[P,f,I]);s.useEffect(()=>{O&&o.current(g.current,j.current)},[O]),s.useEffect(()=>{!L&&!O&&D()},[L,O,D]);function C(){var m,R,T,B;let l=(m=g.current)==null?void 0:m.getModel();y||((R=l==null?void 0:l.original)==null||R.dispose()),v||((T=l==null?void 0:l.modified)==null||T.dispose()),(B=g.current)==null||B.dispose()}return U.createElement(be,{width:$,height:H,isEditorReady:O,loading:S,_ref:x,className:K,wrapperProps:G})}var Cr=Nr;s.memo(Cr);function Sr(e){let r=s.useRef();return s.useEffect(()=>{r.current=e},[e]),r.current}var Rr=Sr,ee=new Map;function Lr({defaultValue:e,defaultLanguage:r,defaultPath:t,value:n,language:i,path:c,theme:d="light",line:y,loading:v="Loading...",options:f={},overrideServices:S={},saveViewState:P=!0,keepCurrentModel:H=!1,width:$="100%",height:K="100%",className:G,wrapperProps:Y={},beforeMount:_=Q,onMount:O=Q,onChange:V,onValidate:L=Q}){let[w,g]=s.useState(!1),[j,x]=s.useState(!0),o=s.useRef(null),h=s.useRef(null),N=s.useRef(null),I=s.useRef(O),D=s.useRef(_),C=s.useRef(),l=s.useRef(n),m=Rr(c),R=s.useRef(!1),T=s.useRef(!1);ye(()=>{let p=me.init();return p.then(u=>(o.current=u)&&x(!1)).catch(u=>(u==null?void 0:u.type)!=="cancelation"&&console.error("Monaco initialization: error:",u)),()=>h.current?k():p.cancel()}),M(()=>{var u,b,q,E;let p=z(o.current,e||n||"",r||i||"",c||t||"");p!==((u=h.current)==null?void 0:u.getModel())&&(P&&ee.set(m,(b=h.current)==null?void 0:b.saveViewState()),(q=h.current)==null||q.setModel(p),P&&((E=h.current)==null||E.restoreViewState(ee.get(c))))},[c],w),M(()=>{var p;(p=h.current)==null||p.updateOptions(f)},[f],w),M(()=>{!h.current||n===void 0||(h.current.getOption(o.current.editor.EditorOption.readOnly)?h.current.setValue(n):n!==h.current.getValue()&&(T.current=!0,h.current.executeEdits("",[{range:h.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),h.current.pushUndoStop(),T.current=!1))},[n],w),M(()=>{var u,b;let p=(u=h.current)==null?void 0:u.getModel();p&&i&&((b=o.current)==null||b.editor.setModelLanguage(p,i))},[i],w),M(()=>{var p;y!==void 0&&((p=h.current)==null||p.revealLine(y))},[y],w),M(()=>{var p;(p=o.current)==null||p.editor.setTheme(d)},[d],w);let B=s.useCallback(()=>{var p;if(!(!N.current||!o.current)&&!R.current){D.current(o.current);let u=c||t,b=z(o.current,n||e||"",r||i||"",u||"");h.current=(p=o.current)==null?void 0:p.editor.create(N.current,{model:b,automaticLayout:!0,...f},S),P&&h.current.restoreViewState(ee.get(u)),o.current.editor.setTheme(d),y!==void 0&&h.current.revealLine(y),g(!0),R.current=!0}},[e,r,t,n,i,c,f,S,P,d,y]);s.useEffect(()=>{w&&I.current(h.current,o.current)},[w]),s.useEffect(()=>{!j&&!w&&B()},[j,w,B]),l.current=n,s.useEffect(()=>{var p,u;w&&V&&((p=C.current)==null||p.dispose(),C.current=(u=h.current)==null?void 0:u.onDidChangeModelContent(b=>{T.current||V(h.current.getValue(),b)}))},[w,V]),s.useEffect(()=>{if(w){let p=o.current.editor.onDidChangeMarkers(u=>{var q;let b=(q=h.current.getModel())==null?void 0:q.uri;if(b&&u.find(E=>E.path===b.path)){let E=o.current.editor.getModelMarkers({resource:b});L==null||L(E)}});return()=>{p==null||p.dispose()}}return()=>{}},[w,L]);function k(){var p,u;(p=C.current)==null||p.dispose(),H?P&&ee.set(c,h.current.saveViewState()):(u=h.current.getModel())==null||u.dispose(),h.current.dispose()}return U.createElement(be,{width:$,height:K,isEditorReady:w,loading:v,_ref:N,className:G,wrapperProps:Y})}var Ir=Lr,Dr=s.memo(Ir),Er=Dr;function Ar({t:e,activePane:r,repoName:t,activeWorktree:n,isInWorktree:i,activeWorktreeId:c,attachmentSession:d,requestExplorerTree:y,requestExplorerStatus:v,activeExplorer:f,renderExplorerNodes:S,explorerStatusByPath:P,explorerDirStatus:H,saveExplorerFile:$,updateExplorerDraft:K,setActiveExplorerFile:G,closeExplorerFile:Y,startExplorerRename:_,createExplorerFile:O,deleteExplorerSelection:V,getLanguageForPath:L,themeMode:w}){var p;const g=c||"main",j=Array.isArray(f.openTabPaths)?f.openTabPaths:[],x=f.activeFilePath||"",o=x?(p=f.filesByPath)==null?void 0:p[x]:null,[h,N]=s.useState(!1),[I,D]=s.useState(""),[C,l]=s.useState(!1),m=f.selectedPath||"",R=!!m,T=!!m;s.useEffect(()=>{if(r!=="explorer")return;const u=b=>{(b.ctrlKey||b.metaKey)&&b.key.toLowerCase()==="s"&&(!x||o!=null&&o.binary||o!=null&&o.saving||(b.preventDefault(),$(g,x)))};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[r,x,o==null?void 0:o.binary,o==null?void 0:o.saving,$,g]);const B=u=>{if(!u)return"";const b=u.split("/");return b[b.length-1]||u},k=s.useMemo(()=>i?(n==null?void 0:n.branchName)||(n==null?void 0:n.name)||"":t||"",[i,n==null?void 0:n.branchName,n==null?void 0:n.name,t]);return a.jsxs("div",{className:`explorer-panel ${r==="explorer"?"":"is-hidden"}`,children:[a.jsx("div",{className:"explorer-header",children:a.jsxs("div",{children:[a.jsx("div",{className:"explorer-title",children:e("Explorer")}),k?a.jsx("div",{className:"explorer-subtitle",children:k}):null]})}),a.jsxs("div",{className:"explorer-body",children:[a.jsxs("div",{className:"explorer-tree-wrap",children:[a.jsxs("div",{className:"explorer-tree-header",children:[a.jsx("button",{type:"button",className:"explorer-tree-icon-btn",title:e("New file"),"aria-label":e("New file"),onClick:()=>{D(""),N(!0)},disabled:!(d!=null&&d.sessionId),children:a.jsx(F,{icon:we})}),a.jsx("button",{type:"button",className:"explorer-tree-icon-btn",title:e("Rename"),"aria-label":e("Rename"),onClick:()=>_(g),disabled:!(d!=null&&d.sessionId)||!R,children:a.jsx(F,{icon:xe})}),a.jsx("button",{type:"button",className:"explorer-tree-icon-btn",title:e("Delete"),"aria-label":e("Delete"),onClick:()=>{V(g)},disabled:!(d!=null&&d.sessionId)||!T||!!f.deletingPath,children:a.jsx(F,{icon:Oe})}),a.jsx("button",{type:"button",className:"explorer-tree-icon-btn",title:e("Refresh"),"aria-label":e("Refresh"),onClick:()=>{y(g,!0),v(g,!0)},disabled:!(d!=null&&d.sessionId),children:a.jsx(F,{icon:Me})})]}),a.jsx("div",{className:"explorer-tree",children:f.loading?a.jsx("div",{className:"explorer-empty",children:e("Loading...")}):f.error?a.jsx("div",{className:"explorer-empty",children:f.error}):Array.isArray(f.tree)&&f.tree.length>0?a.jsxs(a.Fragment,{children:[S(f.tree,g,new Set(f.expandedPaths||[]),f.selectedPath||x,f.selectedType||null,f.renamingPath||null,f.renameDraft||"",P,H),f.treeTruncated&&a.jsx("div",{className:"explorer-truncated",children:e("List truncated after {{count}} entries.",{count:f.treeTotal})})]}):a.jsx("div",{className:"explorer-empty",children:e("No file found.")})})]}),a.jsxs("div",{className:"explorer-editor",children:[a.jsxs("div",{className:"explorer-editor-tabs",children:[a.jsx("div",{className:"explorer-editor-tabs-list",children:j.map(u=>{var E;const b=(E=f.filesByPath)==null?void 0:E[u],q=u===x;return a.jsxs("div",{className:`explorer-editor-tab ${q?"is-active":""}`,children:[a.jsxs("button",{type:"button",className:"explorer-editor-tab-open",onClick:()=>G(g,u),children:[B(u),b!=null&&b.isDirty?" *":""]}),a.jsx("button",{type:"button",className:"explorer-editor-tab-close",onClick:je=>{je.stopPropagation(),Y(g,u)},"aria-label":e("Close"),children:"×"})]},u)})}),a.jsx("div",{className:"explorer-editor-tabs-actions",children:x&&!(o!=null&&o.binary)&&a.jsx("button",{type:"button",className:"explorer-action primary",onClick:()=>$(g,x),disabled:(o==null?void 0:o.saving)||!(o!=null&&o.isDirty),children:o!=null&&o.saving?e("Saving..."):e("Save")})})]}),o!=null&&o.loading?a.jsx("div",{className:"explorer-editor-empty",children:e("Loading...")}):o!=null&&o.error?a.jsx("div",{className:"explorer-editor-empty",children:o.error}):o!=null&&o.binary?a.jsx("div",{className:"explorer-editor-empty",children:e("Binary file not displayed.")}):x?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"explorer-editor-input",children:a.jsx(Er,{value:(o==null?void 0:o.draftContent)||"",onChange:u=>K(g,x,u||""),language:L(x),theme:w==="dark"?"vs-dark":"light",options:{minimap:{enabled:!1},fontSize:12,lineHeight:18,fontFamily:'"Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',scrollBeyondLastLine:!1,automaticLayout:!0,wordWrap:"off",readOnly:!1}},x)}),(o==null?void 0:o.saveError)&&a.jsx("div",{className:"explorer-truncated",children:o.saveError}),(o==null?void 0:o.truncated)&&a.jsx("div",{className:"explorer-truncated",children:e("File truncated for display.")})]}):a.jsx("div",{className:"explorer-editor-empty",children:e("Select a file in the tree.")})]})]}),h&&a.jsx("div",{className:"explorer-file-dialog-overlay",onClick:()=>{C||N(!1)},children:a.jsxs("div",{className:"explorer-file-dialog",onClick:u=>u.stopPropagation(),children:[a.jsx("h3",{children:e("New file")}),a.jsxs("div",{className:"explorer-file-dialog-field",children:[a.jsx("label",{htmlFor:"explorer-new-file-input",children:e("File path")}),a.jsx("input",{id:"explorer-new-file-input",type:"text",value:I,onChange:u=>D(u.target.value),placeholder:e("e.g. src/new-file.ts"),autoFocus:!0,onKeyDown:u=>{u.key==="Enter"&&!C&&(u.preventDefault(),l(!0),O(g,I).then(b=>{b&&(N(!1),D(""))}).finally(()=>l(!1)))}})]}),a.jsxs("div",{className:"explorer-file-dialog-actions",children:[a.jsx("button",{type:"button",className:"session-button secondary",onClick:()=>N(!1),disabled:C,children:e("Cancel")}),a.jsx("button",{type:"button",className:"session-button primary",disabled:C||!I.trim(),onClick:()=>{l(!0),O(g,I).then(u=>{u&&(N(!1),D(""))}).finally(()=>l(!1))},children:e(C?"Creating":"Create")})]})]})})]})}export{Ar as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./index-DnwKjoj7.js";function r({t:l,activePane:n,filteredRpcLogs:e,logFilter:i,setLogFilter:o,scopedRpcLogs:t,handleClearRpcLogs:c}){return s.jsxs("div",{className:`logs-panel ${n==="logs"?"":"is-hidden"}`,children:[s.jsxs("div",{className:"logs-header",children:[s.jsx("div",{className:"logs-title",children:l("JSON-RPC")}),s.jsxs("div",{className:"logs-controls",children:[s.jsx("div",{className:"logs-count",children:l("{{count}} item(s)",{count:e.length})}),s.jsxs("div",{className:"logs-filters",children:[s.jsx("button",{type:"button",className:`logs-filter ${i==="all"?"is-active":""}`,onClick:()=>o("all"),children:l("All")}),s.jsx("button",{type:"button",className:`logs-filter ${i==="stdin"?"is-active":""}`,onClick:()=>o("stdin"),children:l("Stdin")}),s.jsx("button",{type:"button",className:`logs-filter ${i==="stdout"?"is-active":""}`,onClick:()=>o("stdout"),children:l("Stdout")})]}),s.jsx("button",{type:"button",className:"logs-clear",onClick:c,disabled:t.length===0,children:l("Clear")})]})]}),e.length===0?s.jsx("div",{className:"logs-empty",children:l("No logs yet.")}):s.jsx("div",{className:"logs-list",children:e.map((a,m)=>{var d;return s.jsxs("div",{className:`logs-item logs-${a.direction}`,children:[s.jsxs("div",{className:"logs-meta",children:[s.jsx("span",{className:"logs-direction",children:a.direction==="stdin"?l("stdin"):l("stdout")}),s.jsx("span",{className:"logs-time",children:a.timeLabel}),((d=a.payload)==null?void 0:d.method)&&s.jsx("span",{className:"logs-method",children:a.payload.method})]}),s.jsx("pre",{className:"logs-payload",children:JSON.stringify(a.payload,null,2)})]},`${a.timestamp}-${m}`)})})]})}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s,F as P,d as J}from"./index-DnwKjoj7.js";function O({t:e,activePane:m,handleSettingsBack:h,language:g,setLanguage:o,showChatCommands:x,setShowChatCommands:j,showToolResults:p,setShowToolResults:N,notificationsEnabled:u,setNotificationsEnabled:b,themeMode:v,setThemeMode:k,composerInputMode:f,setComposerInputMode:w,debugMode:C,setDebugMode:F,gitIdentityName:y,setGitIdentityName:E,gitIdentityEmail:A,setGitIdentityEmail:B,gitIdentityGlobal:l,gitIdentityRepo:i,gitIdentityLoading:t,gitIdentitySaving:c,gitIdentityError:r,gitIdentityMessage:d,handleSaveGitIdentity:D,attachmentSession:n}){return s.jsxs("div",{className:`settings-panel ${m==="settings"?"":"is-hidden"}`,children:[s.jsxs("div",{className:"settings-header",children:[s.jsx("button",{type:"button",className:"settings-back icon-button",onClick:h,"aria-label":e("Back to previous view"),title:e("Back"),children:s.jsx("span",{"aria-hidden":"true",children:s.jsx(P,{icon:J})})}),s.jsxs("div",{className:"settings-heading",children:[s.jsx("div",{className:"settings-title",children:e("User settings")}),s.jsx("div",{className:"settings-subtitle",children:e("These settings are stored in your browser.")})]})]}),s.jsxs("div",{className:"settings-group",children:[s.jsxs("label",{className:"settings-item",children:[s.jsxs("span",{className:"settings-text",children:[s.jsx("span",{className:"settings-name",children:e("Language")}),s.jsx("span",{className:"settings-hint",children:e("Select a language")})]}),s.jsxs("select",{className:"settings-select",value:g,onChange:a=>o(a.target.value),children:[s.jsx("option",{value:"fr",children:e("French")}),s.jsx("option",{value:"en",children:e("English")})]})]}),s.jsxs("label",{className:"settings-item",children:[s.jsxs("span",{className:"settings-text",children:[s.jsx("span",{className:"settings-name",children:e("Show commands in chat")}),s.jsx("span",{className:"settings-hint",children:e("Show executed command blocks in the conversation.")})]}),s.jsx("input",{type:"checkbox",className:"settings-toggle",checked:x,onChange:a=>j(a.target.checked)})]}),s.jsxs("label",{className:"settings-item",children:[s.jsxs("span",{className:"settings-text",children:[s.jsx("span",{className:"settings-name",children:e("Show tool results in chat")}),s.jsx("span",{className:"settings-hint",children:e("Show tool_result blocks in the conversation.")})]}),s.jsx("input",{type:"checkbox",className:"settings-toggle",checked:p,onChange:a=>N(a.target.checked)})]}),s.jsxs("label",{className:"settings-item",children:[s.jsxs("span",{className:"settings-text",children:[s.jsx("span",{className:"settings-name",children:e("Notifications")}),s.jsx("span",{className:"settings-hint",children:e("Show a notification and sound when a new message arrives.")})]}),s.jsx("input",{type:"checkbox",className:"settings-toggle",checked:u,onChange:a=>b(a.target.checked)})]}),s.jsxs("label",{className:"settings-item",children:[s.jsxs("span",{className:"settings-text",children:[s.jsx("span",{className:"settings-name",children:e("Dark mode")}),s.jsx("span",{className:"settings-hint",children:e("Enable the dark theme for the interface.")})]}),s.jsx("input",{type:"checkbox",className:"settings-toggle",checked:v==="dark",onChange:a=>k(a.target.checked?"dark":"light")})]}),s.jsxs("label",{className:"settings-item",children:[s.jsxs("span",{className:"settings-text",children:[s.jsx("span",{className:"settings-name",children:e("Input style")}),s.jsx("span",{className:"settings-hint",children:e("Choose a single or multi-line input.")})]}),s.jsxs("select",{className:"settings-select",value:f,onChange:a=>w(a.target.value),children:[s.jsx("option",{value:"single",children:e("Single line")}),s.jsx("option",{value:"multi",children:e("Multi-line")})]})]}),s.jsxs("label",{className:"settings-item",children:[s.jsxs("span",{className:"settings-text",children:[s.jsx("span",{className:"settings-name",children:e("Debug mode")}),s.jsx("span",{className:"settings-hint",children:e("Enable access to logs and Markdown/JSON export.")})]}),s.jsx("input",{type:"checkbox",className:"settings-toggle",checked:C,onChange:a=>F(a.target.checked)})]})]}),s.jsx("div",{className:"settings-group",children:s.jsxs("div",{className:"settings-item settings-item--stacked",children:[s.jsxs("div",{className:"settings-text",children:[s.jsx("span",{className:"settings-name",children:e("Git identity for this repository")}),s.jsx("span",{className:"settings-hint",children:e("Provide user.name and user.email for repository commits.")}),s.jsx("span",{className:"settings-hint",children:e("Global values: {{name}} / {{email}}.",{name:l.name||e("Not set"),email:l.email||e("Not set")})}),s.jsx("span",{className:"settings-hint",children:i.name||i.email?e("Repository values: {{name}} / {{email}}.",{name:i.name||e("Not set"),email:i.email||e("Not set")}):e("No repository-specific values.")})]}),s.jsxs("div",{className:"settings-fields",children:[s.jsxs("label",{className:"settings-field",children:[s.jsx("span",{className:"settings-field-label",children:e("user.name")}),s.jsx("input",{type:"text",className:"settings-input",value:y,onChange:a=>E(a.target.value),placeholder:l.name||e("Full name"),disabled:t||c||!(n!=null&&n.sessionId)})]}),s.jsxs("label",{className:"settings-field",children:[s.jsx("span",{className:"settings-field-label",children:e("user.email")}),s.jsx("input",{type:"email",className:"settings-input",value:A,onChange:a=>B(a.target.value),placeholder:l.email||e("your.email@example.com"),disabled:t||c||!(n!=null&&n.sessionId)})]})]}),s.jsxs("div",{className:"settings-actions",children:[s.jsx("button",{type:"button",className:"settings-button",onClick:D,disabled:t||c||!(n!=null&&n.sessionId),children:e(c?"Saving...":"Save")}),t?s.jsx("span",{className:"settings-status",children:e("Loading...")}):null,r?s.jsx("span",{className:"settings-status is-error",children:r}):null,d?s.jsx("span",{className:"settings-status",children:d}):null]})]})})]})}export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as n}from"./index-DnwKjoj7.js";function h({t:m,terminalEnabled:a,activePane:x,repoName:d,activeWorktree:l,isInWorktree:j,terminalContainerRef:i,attachmentSession:s}){return a?n.jsxs("div",{className:`terminal-panel ${x==="terminal"?"":"is-hidden"}`,children:[n.jsxs("div",{className:"terminal-header",children:[n.jsx("div",{className:"terminal-title",children:m("Terminal")}),(d||(l==null?void 0:l.branchName)||(l==null?void 0:l.name))&&n.jsx("div",{className:"terminal-meta",children:j?(l==null?void 0:l.branchName)||(l==null?void 0:l.name):d})]}),n.jsx("div",{className:"terminal-body",ref:i}),!(s!=null&&s.sessionId)&&n.jsx("div",{className:"terminal-empty",children:m("Start a session to open the terminal.")})]}):null}export{h as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var V={},Pt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},dt={},I={};let it;const Rt=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];I.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};I.getSymbolTotalCodewords=function(t){return Rt[t]};I.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};I.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');it=t};I.isKanjiModeEnabled=function(){return typeof it<"u"};I.toSJIS=function(t){return it(t)};var j={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+i)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,n){if(e.isValid(o))return o;try{return t(o)}catch{return n}}})(j);function ht(){this.buffer=[],this.length=0}ht.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let i=0;i<t;i++)this.putBit((e>>>t-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var Lt=ht;function H(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}H.prototype.set=function(e,t,i,o){const n=e*this.size+t;this.data[n]=i,o&&(this.reservedBit[n]=!0)};H.prototype.get=function(e,t){return this.data[e*this.size+t]};H.prototype.xor=function(e,t,i){this.data[e*this.size+t]^=i};H.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var _t=H,wt={};(function(e){const t=I.getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const n=Math.floor(o/7)+2,r=t(o),s=r===145?26:Math.ceil((r-13)/(2*n-2))*2,c=[r-7];for(let u=1;u<n-1;u++)c[u]=c[u-1]-s;return c.push(6),c.reverse()},e.getPositions=function(o){const n=[],r=e.getRowColCoords(o),s=r.length;for(let c=0;c<s;c++)for(let u=0;u<s;u++)c===0&&u===0||c===0&&u===s-1||c===s-1&&u===0||n.push([r[c],r[u]]);return n}})(wt);var mt={};const Dt=I.getSymbolSize,lt=7;mt.getPositions=function(t){const i=Dt(t);return[[0,0],[i-lt,0],[0,i-lt]]};var yt={};(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},e.from=function(n){return e.isValid(n)?parseInt(n,10):void 0},e.getPenaltyN1=function(n){const r=n.size;let s=0,c=0,u=0,a=null,l=null;for(let p=0;p<r;p++){c=u=0,a=l=null;for(let w=0;w<r;w++){let f=n.get(p,w);f===a?c++:(c>=5&&(s+=t.N1+(c-5)),a=f,c=1),f=n.get(w,p),f===l?u++:(u>=5&&(s+=t.N1+(u-5)),l=f,u=1)}c>=5&&(s+=t.N1+(c-5)),u>=5&&(s+=t.N1+(u-5))}return s},e.getPenaltyN2=function(n){const r=n.size;let s=0;for(let c=0;c<r-1;c++)for(let u=0;u<r-1;u++){const a=n.get(c,u)+n.get(c,u+1)+n.get(c+1,u)+n.get(c+1,u+1);(a===4||a===0)&&s++}return s*t.N2},e.getPenaltyN3=function(n){const r=n.size;let s=0,c=0,u=0;for(let a=0;a<r;a++){c=u=0;for(let l=0;l<r;l++)c=c<<1&2047|n.get(a,l),l>=10&&(c===1488||c===93)&&s++,u=u<<1&2047|n.get(l,a),l>=10&&(u===1488||u===93)&&s++}return s*t.N3},e.getPenaltyN4=function(n){let r=0;const s=n.data.length;for(let u=0;u<s;u++)r+=n.data[u];return Math.abs(Math.ceil(r*100/s/5)-10)*t.N4};function i(o,n,r){switch(o){case e.Patterns.PATTERN000:return(n+r)%2===0;case e.Patterns.PATTERN001:return n%2===0;case e.Patterns.PATTERN010:return r%3===0;case e.Patterns.PATTERN011:return(n+r)%3===0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2===0;case e.Patterns.PATTERN101:return n*r%2+n*r%3===0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2===0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2===0;default:throw new Error("bad maskPattern:"+o)}}e.applyMask=function(n,r){const s=r.size;for(let c=0;c<s;c++)for(let u=0;u<s;u++)r.isReserved(u,c)||r.xor(u,c,i(n,u,c))},e.getBestMask=function(n,r){const s=Object.keys(e.Patterns).length;let c=0,u=1/0;for(let a=0;a<s;a++){r(a),e.applyMask(a,n);const l=e.getPenaltyN1(n)+e.getPenaltyN2(n)+e.getPenaltyN3(n)+e.getPenaltyN4(n);e.applyMask(a,n),l<u&&(u=l,c=a)}return c}})(yt);var G={};const R=j,K=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],J=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];G.getBlocksCount=function(t,i){switch(i){case R.L:return K[(t-1)*4+0];case R.M:return K[(t-1)*4+1];case R.Q:return K[(t-1)*4+2];case R.H:return K[(t-1)*4+3];default:return}};G.getTotalCodewordsCount=function(t,i){switch(i){case R.L:return J[(t-1)*4+0];case R.M:return J[(t-1)*4+1];case R.Q:return J[(t-1)*4+2];case R.H:return J[(t-1)*4+3];default:return}};var Et={},Q={};const z=new Uint8Array(512),O=new Uint8Array(256);(function(){let t=1;for(let i=0;i<255;i++)z[i]=t,O[t]=i,t<<=1,t&256&&(t^=285);for(let i=255;i<512;i++)z[i]=z[i-255]})();Q.log=function(t){if(t<1)throw new Error("log("+t+")");return O[t]};Q.exp=function(t){return z[t]};Q.mul=function(t,i){return t===0||i===0?0:z[O[t]+O[i]]};(function(e){const t=Q;e.mul=function(o,n){const r=new Uint8Array(o.length+n.length-1);for(let s=0;s<o.length;s++)for(let c=0;c<n.length;c++)r[s+c]^=t.mul(o[s],n[c]);return r},e.mod=function(o,n){let r=new Uint8Array(o);for(;r.length-n.length>=0;){const s=r[0];for(let u=0;u<n.length;u++)r[u]^=t.mul(n[u],s);let c=0;for(;c<r.length&&r[c]===0;)c++;r=r.slice(c)}return r},e.generateECPolynomial=function(o){let n=new Uint8Array([1]);for(let r=0;r<o;r++)n=e.mul(n,new Uint8Array([1,t.exp(r)]));return n}})(Et);const Ct=Et;function st(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}st.prototype.initialize=function(t){this.degree=t,this.genPoly=Ct.generateECPolynomial(this.degree)};st.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const i=new Uint8Array(t.length+this.degree);i.set(t);const o=Ct.mod(i,this.genPoly),n=this.degree-o.length;if(n>0){const r=new Uint8Array(this.degree);return r.set(o,n),r}return o};var Ut=st,pt={},L={},ut={};ut.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var b={};const Bt="[0-9]+",Ft="[A-Z $%*+\\-./:]+";let v="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";v=v.replace(/u/g,"\\u");const kt="(?:(?![A-Z0-9 $%*+\\-./:]|"+v+`)(?:.|[\r
|
|
2
|
+
]))+`;b.KANJI=new RegExp(v,"g");b.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");b.BYTE=new RegExp(kt,"g");b.NUMERIC=new RegExp(Bt,"g");b.ALPHANUMERIC=new RegExp(Ft,"g");const zt=new RegExp("^"+v+"$"),vt=new RegExp("^"+Bt+"$"),Vt=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");b.testKanji=function(t){return zt.test(t)};b.testNumeric=function(t){return vt.test(t)};b.testAlphanumeric=function(t){return Vt.test(t)};(function(e){const t=ut,i=b;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(r,s){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?r.ccBits[0]:s<27?r.ccBits[1]:r.ccBits[2]},e.getBestModeForData=function(r){return i.testNumeric(r)?e.NUMERIC:i.testAlphanumeric(r)?e.ALPHANUMERIC:i.testKanji(r)?e.KANJI:e.BYTE},e.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},e.isValid=function(r){return r&&r.bit&&r.ccBits};function o(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+n)}}e.from=function(r,s){if(e.isValid(r))return r;try{return o(r)}catch{return s}}})(L);(function(e){const t=I,i=G,o=j,n=L,r=ut,s=7973,c=t.getBCHDigit(s);function u(w,f,m){for(let y=1;y<=40;y++)if(f<=e.getCapacity(y,m,w))return y}function a(w,f){return n.getCharCountIndicator(w,f)+4}function l(w,f){let m=0;return w.forEach(function(y){const T=a(y.mode,f);m+=T+y.getBitsLength()}),m}function p(w,f){for(let m=1;m<=40;m++)if(l(w,m)<=e.getCapacity(m,f,n.MIXED))return m}e.from=function(f,m){return r.isValid(f)?parseInt(f,10):m},e.getCapacity=function(f,m,y){if(!r.isValid(f))throw new Error("Invalid QR Code version");typeof y>"u"&&(y=n.BYTE);const T=t.getSymbolTotalCodewords(f),h=i.getTotalCodewordsCount(f,m),E=(T-h)*8;if(y===n.MIXED)return E;const d=E-a(y,f);switch(y){case n.NUMERIC:return Math.floor(d/10*3);case n.ALPHANUMERIC:return Math.floor(d/11*2);case n.KANJI:return Math.floor(d/13);case n.BYTE:default:return Math.floor(d/8)}},e.getBestVersionForData=function(f,m){let y;const T=o.from(m,o.M);if(Array.isArray(f)){if(f.length>1)return p(f,T);if(f.length===0)return 1;y=f[0]}else y=f;return u(y.mode,y.getLength(),T)},e.getEncodedBits=function(f){if(!r.isValid(f)||f<7)throw new Error("Invalid QR Code version");let m=f<<12;for(;t.getBCHDigit(m)-c>=0;)m^=s<<t.getBCHDigit(m)-c;return f<<12|m}})(pt);var At={};const et=I,Tt=1335,Ht=21522,ft=et.getBCHDigit(Tt);At.getEncodedBits=function(t,i){const o=t.bit<<3|i;let n=o<<10;for(;et.getBCHDigit(n)-ft>=0;)n^=Tt<<et.getBCHDigit(n)-ft;return(o<<10|n)^Ht};var It={};const Kt=L;function _(e){this.mode=Kt.NUMERIC,this.data=e.toString()}_.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};_.prototype.getLength=function(){return this.data.length};_.prototype.getBitsLength=function(){return _.getBitsLength(this.data.length)};_.prototype.write=function(t){let i,o,n;for(i=0;i+3<=this.data.length;i+=3)o=this.data.substr(i,3),n=parseInt(o,10),t.put(n,10);const r=this.data.length-i;r>0&&(o=this.data.substr(i),n=parseInt(o,10),t.put(n,r*3+1))};var Jt=_;const Ot=L,Z=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function D(e){this.mode=Ot.ALPHANUMERIC,this.data=e}D.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};D.prototype.getLength=function(){return this.data.length};D.prototype.getBitsLength=function(){return D.getBitsLength(this.data.length)};D.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let o=Z.indexOf(this.data[i])*45;o+=Z.indexOf(this.data[i+1]),t.put(o,11)}this.data.length%2&&t.put(Z.indexOf(this.data[i]),6)};var Yt=D;const jt=L;function U(e){this.mode=jt.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}U.getBitsLength=function(t){return t*8};U.prototype.getLength=function(){return this.data.length};U.prototype.getBitsLength=function(){return U.getBitsLength(this.data.length)};U.prototype.write=function(e){for(let t=0,i=this.data.length;t<i;t++)e.put(this.data[t],8)};var Gt=U;const Qt=L,qt=I;function F(e){this.mode=Qt.KANJI,this.data=e}F.getBitsLength=function(t){return t*13};F.prototype.getLength=function(){return this.data.length};F.prototype.getBitsLength=function(){return F.getBitsLength(this.data.length)};F.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let i=qt.toSJIS(this.data[t]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
|
|
3
|
+
Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),e.put(i,13)}};var Wt=F,Nt={exports:{}};(function(e){var t={single_source_shortest_paths:function(i,o,n){var r={},s={};s[o]=0;var c=t.PriorityQueue.make();c.push(o,0);for(var u,a,l,p,w,f,m,y,T;!c.empty();){u=c.pop(),a=u.value,p=u.cost,w=i[a]||{};for(l in w)w.hasOwnProperty(l)&&(f=w[l],m=p+f,y=s[l],T=typeof s[l]>"u",(T||y>m)&&(s[l]=m,c.push(l,m),r[l]=a))}if(typeof n<"u"&&typeof s[n]>"u"){var h=["Could not find a path from ",o," to ",n,"."].join("");throw new Error(h)}return r},extract_shortest_path_from_predecessor_list:function(i,o){for(var n=[],r=o;r;)n.push(r),i[r],r=i[r];return n.reverse(),n},find_path:function(i,o,n){var r=t.single_source_shortest_paths(i,o,n);return t.extract_shortest_path_from_predecessor_list(r,n)},PriorityQueue:{make:function(i){var o=t.PriorityQueue,n={},r;i=i||{};for(r in o)o.hasOwnProperty(r)&&(n[r]=o[r]);return n.queue=[],n.sorter=i.sorter||o.default_sorter,n},default_sorter:function(i,o){return i.cost-o.cost},push:function(i,o){var n={value:i,cost:o};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Nt);var Zt=Nt.exports;(function(e){const t=L,i=Jt,o=Yt,n=Gt,r=Wt,s=b,c=I,u=Zt;function a(h){return unescape(encodeURIComponent(h)).length}function l(h,E,d){const g=[];let C;for(;(C=h.exec(d))!==null;)g.push({data:C[0],index:C.index,mode:E,length:C[0].length});return g}function p(h){const E=l(s.NUMERIC,t.NUMERIC,h),d=l(s.ALPHANUMERIC,t.ALPHANUMERIC,h);let g,C;return c.isKanjiModeEnabled()?(g=l(s.BYTE,t.BYTE,h),C=l(s.KANJI,t.KANJI,h)):(g=l(s.BYTE_KANJI,t.BYTE,h),C=[]),E.concat(d,g,C).sort(function(A,N){return A.index-N.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function w(h,E){switch(E){case t.NUMERIC:return i.getBitsLength(h);case t.ALPHANUMERIC:return o.getBitsLength(h);case t.KANJI:return r.getBitsLength(h);case t.BYTE:return n.getBitsLength(h)}}function f(h){return h.reduce(function(E,d){const g=E.length-1>=0?E[E.length-1]:null;return g&&g.mode===d.mode?(E[E.length-1].data+=d.data,E):(E.push(d),E)},[])}function m(h){const E=[];for(let d=0;d<h.length;d++){const g=h[d];switch(g.mode){case t.NUMERIC:E.push([g,{data:g.data,mode:t.ALPHANUMERIC,length:g.length},{data:g.data,mode:t.BYTE,length:g.length}]);break;case t.ALPHANUMERIC:E.push([g,{data:g.data,mode:t.BYTE,length:g.length}]);break;case t.KANJI:E.push([g,{data:g.data,mode:t.BYTE,length:a(g.data)}]);break;case t.BYTE:E.push([{data:g.data,mode:t.BYTE,length:a(g.data)}])}}return E}function y(h,E){const d={},g={start:{}};let C=["start"];for(let B=0;B<h.length;B++){const A=h[B],N=[];for(let P=0;P<A.length;P++){const M=A[P],k=""+B+P;N.push(k),d[k]={node:M,lastCount:0},g[k]={};for(let W=0;W<C.length;W++){const S=C[W];d[S]&&d[S].node.mode===M.mode?(g[S][k]=w(d[S].lastCount+M.length,M.mode)-w(d[S].lastCount,M.mode),d[S].lastCount+=M.length):(d[S]&&(d[S].lastCount=M.length),g[S][k]=w(M.length,M.mode)+4+t.getCharCountIndicator(M.mode,E))}}C=N}for(let B=0;B<C.length;B++)g[C[B]].end=0;return{map:g,table:d}}function T(h,E){let d;const g=t.getBestModeForData(h);if(d=t.from(E,g),d!==t.BYTE&&d.bit<g.bit)throw new Error('"'+h+'" cannot be encoded with mode '+t.toString(d)+`.
|
|
4
|
+
Suggested mode is: `+t.toString(g));switch(d===t.KANJI&&!c.isKanjiModeEnabled()&&(d=t.BYTE),d){case t.NUMERIC:return new i(h);case t.ALPHANUMERIC:return new o(h);case t.KANJI:return new r(h);case t.BYTE:return new n(h)}}e.fromArray=function(E){return E.reduce(function(d,g){return typeof g=="string"?d.push(T(g,null)):g.data&&d.push(T(g.data,g.mode)),d},[])},e.fromString=function(E,d){const g=p(E,c.isKanjiModeEnabled()),C=m(g),B=y(C,d),A=u.find_path(B.map,"start","end"),N=[];for(let P=1;P<A.length-1;P++)N.push(B.table[A[P]].node);return e.fromArray(f(N))},e.rawSplit=function(E){return e.fromArray(p(E,c.isKanjiModeEnabled()))}})(It);const q=I,X=j,Xt=Lt,xt=_t,$t=wt,te=mt,nt=yt,ot=G,ee=Ut,Y=pt,ne=At,oe=L,x=It;function re(e,t){const i=e.size,o=te.getPositions(t);for(let n=0;n<o.length;n++){const r=o[n][0],s=o[n][1];for(let c=-1;c<=7;c++)if(!(r+c<=-1||i<=r+c))for(let u=-1;u<=7;u++)s+u<=-1||i<=s+u||(c>=0&&c<=6&&(u===0||u===6)||u>=0&&u<=6&&(c===0||c===6)||c>=2&&c<=4&&u>=2&&u<=4?e.set(r+c,s+u,!0,!0):e.set(r+c,s+u,!1,!0))}}function ie(e){const t=e.size;for(let i=8;i<t-8;i++){const o=i%2===0;e.set(i,6,o,!0),e.set(6,i,o,!0)}}function se(e,t){const i=$t.getPositions(t);for(let o=0;o<i.length;o++){const n=i[o][0],r=i[o][1];for(let s=-2;s<=2;s++)for(let c=-2;c<=2;c++)s===-2||s===2||c===-2||c===2||s===0&&c===0?e.set(n+s,r+c,!0,!0):e.set(n+s,r+c,!1,!0)}}function ue(e,t){const i=e.size,o=Y.getEncodedBits(t);let n,r,s;for(let c=0;c<18;c++)n=Math.floor(c/3),r=c%3+i-8-3,s=(o>>c&1)===1,e.set(n,r,s,!0),e.set(r,n,s,!0)}function $(e,t,i){const o=e.size,n=ne.getEncodedBits(t,i);let r,s;for(r=0;r<15;r++)s=(n>>r&1)===1,r<6?e.set(r,8,s,!0):r<8?e.set(r+1,8,s,!0):e.set(o-15+r,8,s,!0),r<8?e.set(8,o-r-1,s,!0):r<9?e.set(8,15-r-1+1,s,!0):e.set(8,15-r-1,s,!0);e.set(o-8,8,1,!0)}function ce(e,t){const i=e.size;let o=-1,n=i-1,r=7,s=0;for(let c=i-1;c>0;c-=2)for(c===6&&c--;;){for(let u=0;u<2;u++)if(!e.isReserved(n,c-u)){let a=!1;s<t.length&&(a=(t[s]>>>r&1)===1),e.set(n,c-u,a),r--,r===-1&&(s++,r=7)}if(n+=o,n<0||i<=n){n-=o,o=-o;break}}}function ae(e,t,i){const o=new Xt;i.forEach(function(u){o.put(u.mode.bit,4),o.put(u.getLength(),oe.getCharCountIndicator(u.mode,e)),u.write(o)});const n=q.getSymbolTotalCodewords(e),r=ot.getTotalCodewordsCount(e,t),s=(n-r)*8;for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!==0;)o.putBit(0);const c=(s-o.getLengthInBits())/8;for(let u=0;u<c;u++)o.put(u%2?17:236,8);return le(o,e,t)}function le(e,t,i){const o=q.getSymbolTotalCodewords(t),n=ot.getTotalCodewordsCount(t,i),r=o-n,s=ot.getBlocksCount(t,i),c=o%s,u=s-c,a=Math.floor(o/s),l=Math.floor(r/s),p=l+1,w=a-l,f=new ee(w);let m=0;const y=new Array(s),T=new Array(s);let h=0;const E=new Uint8Array(e.buffer);for(let A=0;A<s;A++){const N=A<u?l:p;y[A]=E.slice(m,m+N),T[A]=f.encode(y[A]),m+=N,h=Math.max(h,N)}const d=new Uint8Array(o);let g=0,C,B;for(C=0;C<h;C++)for(B=0;B<s;B++)C<y[B].length&&(d[g++]=y[B][C]);for(C=0;C<w;C++)for(B=0;B<s;B++)d[g++]=T[B][C];return d}function fe(e,t,i,o){let n;if(Array.isArray(e))n=x.fromArray(e);else if(typeof e=="string"){let a=t;if(!a){const l=x.rawSplit(e);a=Y.getBestVersionForData(l,i)}n=x.fromString(e,a||40)}else throw new Error("Invalid data");const r=Y.getBestVersionForData(n,i);if(!r)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=r;else if(t<r)throw new Error(`
|
|
5
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
+
Minimum version required to store current data is: `+r+`.
|
|
7
|
+
`);const s=ae(t,i,n),c=q.getSymbolSize(t),u=new xt(c);return re(u,t),ie(u),se(u,t),$(u,i,0),t>=7&&ue(u,t),ce(u,s),isNaN(o)&&(o=nt.getBestMask(u,$.bind(null,u,i))),nt.applyMask(o,u),$(u,i,o),{modules:u,version:t,errorCorrectionLevel:i,maskPattern:o,segments:n}}dt.create=function(t,i){if(typeof t>"u"||t==="")throw new Error("No input text");let o=X.M,n,r;return typeof i<"u"&&(o=X.from(i.errorCorrectionLevel,X.M),n=Y.from(i.version),r=nt.from(i.maskPattern),i.toSJISFunc&&q.setToSJISFunction(i.toSJISFunc)),fe(t,n,o,r)};var Mt={},ct={};(function(e){function t(i){if(typeof i=="number"&&(i=i.toString()),typeof i!="string")throw new Error("Color should be defined as hex string");let o=i.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+i);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(r){return[r,r]}))),o.length===6&&o.push("F","F");const n=parseInt(o.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+o.slice(0,6).join("")}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,r=o.width&&o.width>=21?o.width:void 0,s=o.scale||4;return{width:r,scale:r?4:s,margin:n,color:{dark:t(o.color.dark||"#000000ff"),light:t(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(o,n){return n.width&&n.width>=o+n.margin*2?n.width/(o+n.margin*2):n.scale},e.getImageWidth=function(o,n){const r=e.getScale(o,n);return Math.floor((o+n.margin*2)*r)},e.qrToImageData=function(o,n,r){const s=n.modules.size,c=n.modules.data,u=e.getScale(s,r),a=Math.floor((s+r.margin*2)*u),l=r.margin*u,p=[r.color.light,r.color.dark];for(let w=0;w<a;w++)for(let f=0;f<a;f++){let m=(w*a+f)*4,y=r.color.light;if(w>=l&&f>=l&&w<a-l&&f<a-l){const T=Math.floor((w-l)/u),h=Math.floor((f-l)/u);y=p[c[T*s+h]?1:0]}o[m++]=y.r,o[m++]=y.g,o[m++]=y.b,o[m]=y.a}}})(ct);(function(e){const t=ct;function i(n,r,s){n.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=s,r.width=s,r.style.height=s+"px",r.style.width=s+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(r,s,c){let u=c,a=s;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),s||(a=o()),u=t.getOptions(u);const l=t.getImageWidth(r.modules.size,u),p=a.getContext("2d"),w=p.createImageData(l,l);return t.qrToImageData(w.data,r,u),i(p,a,l),p.putImageData(w,0,0),a},e.renderToDataURL=function(r,s,c){let u=c;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),u||(u={});const a=e.render(r,s,u),l=u.type||"image/png",p=u.rendererOpts||{};return a.toDataURL(l,p.quality)}})(Mt);var bt={};const ge=ct;function gt(e,t){const i=e.a/255,o=t+'="'+e.hex+'"';return i<1?o+" "+t+'-opacity="'+i.toFixed(2).slice(1)+'"':o}function tt(e,t,i){let o=e+t;return typeof i<"u"&&(o+=" "+i),o}function de(e,t,i){let o="",n=0,r=!1,s=0;for(let c=0;c<e.length;c++){const u=Math.floor(c%t),a=Math.floor(c/t);!u&&!r&&(r=!0),e[c]?(s++,c>0&&u>0&&e[c-1]||(o+=r?tt("M",u+i,.5+a+i):tt("m",n,0),n=0,r=!1),u+1<t&&e[c+1]||(o+=tt("h",s),s=0)):n++}return o}bt.render=function(t,i,o){const n=ge.getOptions(i),r=t.modules.size,s=t.modules.data,c=r+n.margin*2,u=n.color.light.a?"<path "+gt(n.color.light,"fill")+' d="M0 0h'+c+"v"+c+'H0z"/>':"",a="<path "+gt(n.color.dark,"stroke")+' d="'+de(s,r,n.margin)+'"/>',l='viewBox="0 0 '+c+" "+c+'"',w='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+l+' shape-rendering="crispEdges">'+u+a+`</svg>
|
|
8
|
+
`;return typeof o=="function"&&o(null,w),w};const he=Pt,rt=dt,St=Mt,we=bt;function at(e,t,i,o,n){const r=[].slice.call(arguments,1),s=r.length,c=typeof r[s-1]=="function";if(!c&&!he())throw new Error("Callback required as last argument");if(c){if(s<2)throw new Error("Too few arguments provided");s===2?(n=i,i=t,t=o=void 0):s===3&&(t.getContext&&typeof n>"u"?(n=o,o=void 0):(n=o,o=i,i=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(i=t,t=o=void 0):s===2&&!t.getContext&&(o=i,i=t,t=void 0),new Promise(function(u,a){try{const l=rt.create(i,o);u(e(l,t,o))}catch(l){a(l)}})}try{const u=rt.create(i,o);n(null,e(u,t,o))}catch(u){n(u)}}V.create=rt.create;V.toCanvas=at.bind(null,St.render);V.toDataURL=at.bind(null,St.renderToDataURL);V.toString=at.bind(null,function(e,t,i){return we.render(e,i)});const me=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));export{me as b};
|