47 changed files with 2545 additions and 850 deletions

No files matched your search

+10 -1
View File
@@ -9,7 +9,7 @@ GLOBAL_API_KEY=429683C4C977415CAAFCCE10F7D57E11
WADEBUG=DEBUG
LOGTYPE=console
WEBHOOKFILES=true
WEBHOOK_FILES=true
CONNECT_ON_STARTUP=true
@@ -20,6 +20,15 @@ AMQP_GLOBAL_ENABLED=false
WEBHOOK_URL=https://webhook.site/2e6af2fa-6b04-497f-b4a1-13a905728d83
# Proxy Configuration
# PROXY_PROTOCOL can be http, https or socks5. If omitted, it is inferred from
# the port (1080/2080/42000-43000 → socks5; otherwise http).
# PROXY_PROTOCOL=http
# PROXY_HOST=proxy.example.com
# PROXY_PORT=8080
# PROXY_USERNAME=user
# PROXY_PASSWORD=secret
# Minio Configuration
MINIO_ENABLED=true
MINIO_ENDPOINT=localhost:9000
@@ -0,0 +1,89 @@
name: Bug Report
description: Create a report to help us improve.
labels:
- bug
- en
body:
- type: checkboxes
id: terms
attributes:
label: Welcome!
description: |
The issue tracker is only for reporting bugs and feature requests.
For support questions, please visit:
- [Community](https://evolutionfoundation.com.br/community)
- [WhatsApp Support](https://wa.me/553196219989)
<br/>
**DO NOT OPEN AN ISSUE FOR GENERAL SUPPORT QUESTIONS.**
options:
- label: Yes, I have searched for similar issues on [GitHub](https://github.com/EvolutionAPI/evolution-go/issues) and found none.
required: true
- type: textarea
attributes:
label: What did you do?
description: |
- Respect the issue template as much as possible.
- The title should be short and descriptive.
- Explain the conditions that led you to report this issue.
- Be clear and concise.
placeholder: Describe the problem you encountered in detail.
validations:
required: true
- type: textarea
attributes:
label: What did you expect?
placeholder: Describe what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: What did you observe instead of what you expected?
placeholder: Explain what actually happens when you follow the steps above.
validations:
required: true
- type: textarea
attributes:
label: Screenshots/Videos
placeholder: If possible, add screenshots or videos that illustrate the problem.
- type: textarea
attributes:
label: Which version are you using?
description: Check the VERSION file or the startup log.
placeholder: e.g. 0.6.1
validations:
required: true
- type: dropdown
id: select
attributes:
label: What is your environment?
options:
- Linux
- Docker
- Mac
- Windows
- Other
validations:
required: true
- type: textarea
attributes:
label: If applicable, paste the log output
description: Please attach any logs related to the issue.
placeholder: Paste the application log here.
validations:
required: false
- type: textarea
attributes:
label: Additional Notes
description: Include any other information you think might be useful.
validations:
required: false
@@ -0,0 +1,62 @@
name: Feature Request
description: Suggest ideas for the project.
labels:
- enhancement
- en
body:
- type: checkboxes
id: terms
attributes:
label: Welcome!
description: '**DO NOT OPEN FOR GENERAL SUPPORT QUESTIONS.**'
options:
- label: Yes, I have searched for similar requests on [GitHub](https://github.com/EvolutionAPI/evolution-go/issues) and found none.
required: true
- type: dropdown
attributes:
label: What type of feature?
options:
- Integration
- Functionality
- Endpoint
- Performance
- Other
validations:
required: true
- type: textarea
attributes:
label: What is the motivation for the request?
description: |
What problem does the feature seek to solve?
Clearly describe the functionality you want implemented.
placeholder: Detailed description
validations:
required: true
- type: textarea
attributes:
label: Usage Examples
description: Provide specific examples of how this functionality could be used.
placeholder: text - image - video - flowcharts
validations:
required: false
- type: textarea
attributes:
label: How should the feature be developed?
description: |
Should it be inserted directly into the code?
If you have implementation ideas, please share them here.
placeholder: Insert feature ideas here
validations:
required: false
- type: textarea
attributes:
label: Additional Notes
description: Any other information relevant to your request.
placeholder: Insert your observations here.
validations:
required: false
@@ -0,0 +1,89 @@
name: Relatório de bug
description: Crie um relatório para nos ajudar a melhorar.
labels:
- bug
- pt-br
body:
- type: checkboxes
id: termos
attributes:
label: Bem-vindo!
description: |
O rastreador de problemas é apenas para relatar bugs e solicitações de recursos.
Para perguntas de suporte, acesse:
- [Comunidade](https://evolutionfoundation.com.br/community)
- [WhatsApp Suporte](https://wa.me/553196219989)
<br/>
**NÃO ABRA UM PROBLEMA PARA PERGUNTAS GERAIS DE SUPORTE.**
options:
- label: Sim, pesquisei problemas semelhantes no [GitHub](https://github.com/EvolutionAPI/evolution-go/issues) e não encontrei nenhum.
required: true
- type: textarea
attributes:
label: O que você fez?
description: |
- Respeite o modelo de problema tanto quanto possível.
- O título deve ser curto e descritivo.
- Explique as condições que o levaram a reportar este problema.
- Seja claro e conciso.
placeholder: Descreva detalhadamente o problema que você encontrou.
validations:
required: true
- type: textarea
attributes:
label: O que você esperava?
placeholder: Descreva o que você esperava que acontecesse.
validations:
required: true
- type: textarea
attributes:
label: O que você observou ao invés do que esperava?
placeholder: Explique o que realmente acontece quando você segue os passos acima.
validations:
required: true
- type: textarea
attributes:
label: Capturas de Tela/Vídeos
placeholder: Se possível, adicione capturas de tela ou vídeos que ilustrem o problema.
- type: textarea
attributes:
label: Qual versão você está usando?
description: Verifique o arquivo VERSION ou o log de inicialização.
placeholder: ex. 0.6.1
validations:
required: true
- type: dropdown
id: select
attributes:
label: Qual é o seu ambiente?
options:
- Linux
- Docker
- Mac
- Windows
- Outro
validations:
required: true
- type: textarea
attributes:
label: Se aplicável, cole a saída do log
description: Por favor, anexe os logs que possam estar relacionados ao problema.
placeholder: Cole aqui o log da aplicação.
validations:
required: false
- type: textarea
attributes:
label: Notas Adicionais
description: Inclua qualquer outra informação que possa ser útil.
validations:
required: false
@@ -0,0 +1,62 @@
name: Solicitação de recursos
description: Sugira ideias para o projeto.
labels:
- enhancement
- pt-br
body:
- type: checkboxes
id: termos
attributes:
label: Bem-vindo!
description: '**NÃO ABRA PARA PERGUNTAS GERAIS DE SUPORTE.**'
options:
- label: Sim, pesquisei solicitações semelhantes no [GitHub](https://github.com/EvolutionAPI/evolution-go/issues) e não encontrei nenhum.
required: true
- type: dropdown
attributes:
label: Qual tipo de recurso?
options:
- Integração
- Funcionalidade
- Endpoint
- Performance
- Outro
validations:
required: true
- type: textarea
attributes:
label: Qual a motivação para a solicitação?
description: |
Qual problema o recurso busca resolver?
Descreva claramente a funcionalidade que você deseja que seja implementada.
placeholder: Descrição detalhada
validations:
required: true
- type: textarea
attributes:
label: Exemplos de Uso
description: Forneça exemplos específicos de como essa funcionalidade poderia ser utilizada.
placeholder: texto - imagem - video - fluxogramas
validations:
required: false
- type: textarea
attributes:
label: Como o recurso deve ser desenvolvido?
description: |
Deve ser inserido diretamente no código?
Se você tem ideias de implementação, por favor compartilhe aqui.
placeholder: Insira ideias para o recurso
validations:
required: false
- type: textarea
attributes:
label: Notas Adicionais
description: Qualquer outra informação relevante para a sua solicitação.
placeholder: Insira aqui as suas observações.
validations:
required: false
+29
View File
@@ -0,0 +1,29 @@
## Description
<!-- Describe your changes in detail -->
## Related Issue
<!-- Link to the issue this PR addresses -->
Closes #(issue_number)
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
- [ ] Refactoring (no functional changes)
- [ ] Performance improvement
## Testing
- [ ] Manual testing completed
- [ ] Functionality verified in development environment
- [ ] No breaking changes introduced
## Screenshots (if applicable)
## Checklist
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have tested my changes thoroughly
- [ ] Any dependent changes have been merged and published
## Additional Notes
+11 -3
View File
@@ -17,6 +17,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Read version
id: version
run: echo "version=$(cat VERSION 2>/dev/null || echo '0.0.0')" >> $GITHUB_OUTPUT
- name: Docker meta
id: meta
@@ -24,9 +30,8 @@ jobs:
with:
images: evoapicloud/evolution-go
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ steps.version.outputs.version }}
type=raw,value=latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -44,12 +49,15 @@ jobs:
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ steps.version.outputs.version }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
-1
View File
@@ -7,4 +7,3 @@ coverage.*
.idea/
.vscode/
.DS_Store
.cursorrules
+3
View File
@@ -0,0 +1,3 @@
[submodule "whatsmeow-lib"]
path = whatsmeow-lib
url = https://github.com/EvolutionAPI/whatsmeow.git
+36
View File
@@ -1,5 +1,41 @@
# Evolution GO - Changelog
## v0.7.0
**Docker:** `evoapicloud/evolution-go:0.7.0`
### 🆕 New Features
- **Multi-platform interactive messages** — Buttons, lists and carousel working on Android, iOS and WhatsApp Web/Desktop
- **SendButton**: removed `ViewOnceMessage` wrapper that blocked rendering on iOS and WhatsApp Web; `Footer` and `Header` are now conditional
- **SendList**: migrated from `InteractiveMessage`/`NativeFlowMessage` to legacy `ListMessage` (native protobuf) for broad compatibility
- **SendCarousel**: new endpoint `POST /send/carousel` with cards (image, text, footer, buttons) and automatic JPEG thumbnail generation for instant image loading
- `whatsmeow-lib`: added `biz` node for `InteractiveMessage` and pinned `product_list` type on the `biz` node for `ListMessage`
- **Base64 media support on `/send/media`** — The `url` field on `POST /send/media` now also accepts base64-encoded media. When the value does not start with `http://` or `https://`, it is treated as base64 and decoded; reuses the existing `SendMediaFile` flow
- **WhatsApp status endpoints** — new `POST /send/status/text` and `POST /send/status/media` publish text/image/video status to `status@broadcast`. Media endpoint supports both JSON (with URL) and multipart/form-data (file upload). Thanks @Eduardo-gato (#15)
- **Webhook routing for GROUP / NEWSLETTER** — when the primary `MESSAGE` / `SEND_MESSAGE` / `READ_RECEIPT` subscription is absent, events from `@g.us` chats are forwarded to `GROUP` subscribers and events from `@newsletter` chats to `NEWSLETTER` subscribers. Thanks @oismaelash (#18)
### 🔧 Improvements
- **Proxy protocol** — new optional `protocol` field (and `PROXY_PROTOCOL` env) supporting `http`, `https`, `socks5`. Replaces the hardcoded SOCKS5 dialer with `client.SetProxyAddress`, fixing HTTP-proxy QR pairing (#12). Thanks @TBDevMaster (#13)
- **WhatsApp Web version cache** — `fetchWhatsAppWebVersion` now caches the result for 1 hour with a mutex instead of issuing one request per instance startup. Thanks @VitorS0uza (#24)
- **Manager flicker fix** — instance page no longer replaces the list with skeleton cards on every 5s polling cycle (`hasLoaded` flag). Thanks @TBDevMaster (#14), closes #11
- **`WEBHOOKFILES` → `WEBHOOK_FILES`** — `.env.example`, docker-compose and docs aligned with the env var the runtime actually reads. Thanks @VitorS0uza (#22)
- **Dependency cleanup** — removed unused `github.com/EvolutionAPI/evo-gate` from `go.mod`
- **whatsmeow-lib** bumped to `0923702fb`
- **Telemetry removed** — dropped legacy `pkg/telemetry`
### 🐛 Bug Fixes
- **`/message/edit`** — was silently ignored because the edit payload used `Conversation` while the original message was sent as `ExtendedTextMessage`. WhatsApp requires matching types; now the edit uses `ExtendedTextMessage` and the response returns the actual server timestamp instead of the zero value. Closes #16
- **Sticker upload to S3/MinIO** — when `webp.Decode` or `png.Encode` failed, the whole media pipeline aborted and the sticker was lost from the webhook. Now we log a warning and keep the raw `.webp` bytes so the sticker still reaches the bucket. Closes #5
- **Multipart `/send/media`** — the binary-upload branch silently dropped `mentionAll`, `mentionedJid` and `quoted`. These fields now parse from the form (with `mentionedJid` accepting repeated or comma-separated values) and reach the send service. Closes #2
### ⚠️ Breaking changes
- **Proxy** — previously all proxies were forced through SOCKS5. If you run SOCKS5 on a non-standard port (anything outside 1080/2080/42000-43000), set `PROXY_PROTOCOL=socks5` in the env or pass `"protocol": "socks5"` in the proxy body explicitly — otherwise the new protocol inference will fall back to HTTP.
### 📝 Docs
- **README** — updated WhatsApp support number and issue templates
- **Interactive messages guide** — new `docs/wiki/guias-api/api-interactive.md`
- **Proxy docs** — environment variables, configuration guide and API reference updated with the new `protocol` field
## v0.6.1
### 🆕 New Features
+1
View File
@@ -27,6 +27,7 @@ WORKDIR /app
COPY --from=build /build/server .
COPY --from=build /build/manager/dist ./manager/dist
COPY --from=build /build/VERSION ./VERSION
ENV TZ=America/Sao_Paulo
+28 -59
View File
@@ -1,3 +1,4 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@@ -9,7 +10,8 @@
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity granting the License.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
@@ -34,45 +36,40 @@
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(which shall not include communications that are solely written
by copyright holders to be excluded from the License).
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based upon (or derived from) the Work and for which the
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and derivative works thereof.
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
submitted to the Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control
systems, and issue tracking systems that are managed by, or on behalf
of, the Licensor for the purpose of discussing and improving the Work,
but excluding communication that is conspicuously marked or otherwise
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
on behalf of whom a Contribution has been received by the Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to use, reproduce, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Work, and to
permit persons to whom the Work is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Work.
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
@@ -110,7 +107,7 @@
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
within such NOTICE file, excluding any notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
@@ -124,7 +121,7 @@
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright notice to Your modifications and
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
@@ -166,29 +163,20 @@
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Support. You may choose to offer, and to
charge a fee for, warranty, support, indemnity or other liability
obligations and/or rights consistent with this License. However, in
accepting such obligations, You may act only on Your own behalf and
on Your sole responsibility, not on behalf of any other Contributor,
and only if You agree to indemnify, defend, and hold each Contributor
harmless for any liability incurred by, or claims asserted against,
such Contributor by reason of your accepting any such warranty or support.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same page as the copyright notice for easier identification within
third-party archives.
Copyright 2025 Evolution API
Copyright 2026 Evolution Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -201,22 +189,3 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
ADDITIONAL CONDITIONS:
1. LOGO and copyright information: In the process of using Evolution Go API's
frontend components, you may not remove or modify the LOGO or copyright
information in the Evolution API console or applications. This restriction
is inapplicable to uses of Evolution Go API that do not involve its frontend
components.
2. Usage Notification Requirement: If Evolution Go API is used as part of any
project, including closed-source systems (e.g., proprietary software), the
user is required to display a clear notification within the system that
Evolution Go API is being utilized. This notification should be visible to
system administrators and accessible from the system's documentation or
settings page. Failure to comply with this requirement may result in the
necessity for a commercial license, as determined by the producer.
Please contact [email protected] to inquire about licensing matters.
+7
View File
@@ -0,0 +1,7 @@
Evolution Foundation
Copyright 2026 Evolution Foundation
This product includes software developed by Evolution Foundation.
Trademark notice
"Evolution Foundation" and "Evolution" are trademarks of Evolution Foundation. The Evolution Foundation logo, wordmark, and Evolution Foundation visual identity are governed by the Evolution Foundation Trademark and Brand Assets Policy included in this repository.
+1 -1
View File
@@ -168,7 +168,7 @@ evolution-go/
| Website | [evolutionfoundation.com.br](https://evolutionfoundation.com.br/) |
| Documentation | [docs.evolutionfoundation.com.br](https://docs.evolutionfoundation.com.br/) |
| Community | [evolutionfoundation.com.br/community](https://evolutionfoundation.com.br/community) |
| WhatsApp Support | [+55 31 7503-8350](https://wa.me/553175038350) |
| WhatsApp Support | [+55 31 9621-9989](https://wa.me/553196219989) |
| GitHub Issues | [evolution-go/issues](https://github.com/EvolutionAPI/evolution-go/issues) |
## Hosting
+87
View File
@@ -0,0 +1,87 @@
# EVO AI TRADEMARK AND BRAND ASSETS POLICY
Version 1.0, 2026.03.02
"Evolution Foundation" and "Evolution" are trademarks of Evolution Foundation.
The "evoai" wordmark and the Evolution Foundation logo are trademarks of Evolution Foundation.
## 1. Scope and purpose
This policy governs the use of Evolution Foundation trademarks and Evolution Foundation brand assets. It is intended to protect users from confusion and to preserve the official Evolution Foundation Community Edition visual identity.
This policy applies to any use of:
(a) the product names and marks "Evolution Foundation" and "Evolution";
(b) the official logo and wordmark: the "evoai" wordmark with the neural network or molecule icon in neon green to the right;
(c) the copyright line "© 2026 Evolution Foundation"; and
(d) any materials that implement or express the Evolution Foundation official look and feel, including the Protected Visual Identity Elements listed in Section 3.
This policy does not change the software license for the source code, which is licensed under the Apache License 2.0. This policy controls only trademarks and brand assets.
## 2. Permitted trademark and brand asset use
2.1. You may truthfully refer to Evolution Foundation to describe that your software is based on, compatible with, or derived from this project, provided that such use does not imply endorsement by Evolution Foundation.
2.2. You may distribute and publicly host unmodified official builds of the Evolution Foundation Community Edition that include Evolution Foundation brand assets, provided that you comply with Section 3 and do not suggest endorsement beyond being an official unmodified build.
2.3. You may use Evolution Foundation marks in nominative ways, such as "based on Evolution Foundation",
provided that the use is accurate and does not create confusion.
## 3. Protected Visual Identity Elements (Brand Assets)
The following are the "Protected Visual Identity Elements":
(a) Product names and marks: "Evolution Foundation" and "Evolution";
(b) Official logo and wordmark: the "evoai" wordmark with the neural network
or molecule icon in neon green to the right;
(c) Copyright line: "© 2026 Evolution Foundation";
(d) Community Edition theme requirement: Dark Mode is the default and required
theme for the Community Edition user interface;
(e) Official palette for the Community Edition user interface:
Background main: #0a0a0a
Background cards and popovers: #0a0a0a
Sidebar background: #171717
Primary neon green: #00ffa7
Primary green for light mode references: #01b274
Main text: #fafafa
Muted text: #a1a1a1
Borders and inputs: #262626
Muted background: #262626
Ring and focus: #555555
Destructive: approximately oklch 0.396 0.141 25.723
(f) Typography: ui sans serif, system ui, sans serif with base size 16px;
(g) Border radius: 0.625rem (10px) as the default component radius;
(h) Protected UI presentation elements:
Left sidebar with icons and navigation in white or green accents
Active navigation item highlighted with dark green background and neon
green text
Topbar with workspace selector showing "Evolution"
Notification badge and user avatar on the top right
Sidebar footer showing "Evolution Foundation / © 2026 Evolution Foundation / Documentation / Need help"
## 4. Restrictions for forks, modified versions, and redistributions
4.1. No modification of Protected Visual Identity Elements when using Evolution Foundation brand assets. If you distribute or publicly host any version of the user interface that uses Evolution Foundation brand assets, you may not remove, replace, modify, disable, or bypass any Protected Visual Identity Element.
4.2. Modified UI must remove Evolution Foundation brand assets.
If you distribute or publicly host a modified user interface or user experience (including changes to branding or visual identity), you must:
(a) remove and replace all Evolution Foundation trademarks and brand assets from the user
interface, product name display, and related marketing materials for that
distribution; and
(b) choose a name and branding that are clearly distinct from Evolution Foundation.
4.3. No endorsement.
You may not use Evolution Foundation trademarks or brand assets in a way that implies Evolution Foundation sponsors, endorses, or is affiliated with your distribution, except for unmodified official builds.
4.4. No derivative works of the logo and wordmark.
You may not modify, adapt, recolor, redesign, or create derivative works of the Evolution Foundation logo or wordmark.
## 5. Permission requests
Any use not expressly permitted by this policy requires prior written permission from Evolution Foundation.
## 6. Enforcement and termination
Any violation of this policy terminates your permission to use Evolution Foundation brand assets. You must promptly cease use and remove Evolution Foundation trademarks and brand assets from your distribution and any public hosting.
## 7. Disclaimer
This policy is provided "as is" and does not grant any rights beyond what is expressly stated. All rights not expressly granted are reserved by Evolution Foundation.
+1 -1
View File
@@ -1 +1 @@
0.6.1
0.7.0
+7 -8
View File
@@ -59,7 +59,6 @@ import (
server_handler "github.com/EvolutionAPI/evolution-go/pkg/server/handler"
storage_interfaces "github.com/EvolutionAPI/evolution-go/pkg/storage/interfaces"
minio_storage "github.com/EvolutionAPI/evolution-go/pkg/storage/minio"
"github.com/EvolutionAPI/evolution-go/pkg/telemetry"
user_handler "github.com/EvolutionAPI/evolution-go/pkg/user/handler"
user_service "github.com/EvolutionAPI/evolution-go/pkg/user/service"
whatsmeow_service "github.com/EvolutionAPI/evolution-go/pkg/whatsmeow/service"
@@ -68,12 +67,16 @@ import (
var devMode = flag.Bool("dev", false, "Enable development mode")
var version = "dev"
var version = "0.0.0"
func init() {
if version == "dev" {
// ldflags -X main.version= sets this at compile time.
// If not set (or still default), try reading from VERSION file.
if version == "0.0.0" {
if v, err := os.ReadFile("VERSION"); err == nil {
version = strings.TrimSpace(string(v))
if trimmed := strings.TrimSpace(string(v)); trimmed != "" {
version = trimmed
}
}
}
}
@@ -196,8 +199,6 @@ func setupRouter(db *gorm.DB, authDB *sql.DB, sqliteDB *sql.DB, config *config.C
// NOVO: PollHandler usando PollService já inicializado no whatsmeowService (evita dupla inicialização)
pollHandler := poll_handler.NewPollHandler(whatsmeowService.GetPollService(), loggerWrapper)
telemetry := telemetry.NewTelemetryService()
r := gin.Default()
// CORS middleware — must be before everything else
@@ -214,8 +215,6 @@ func setupRouter(db *gorm.DB, authDB *sql.DB, sqliteDB *sql.DB, config *config.C
c.Next()
})
r.Use(telemetry.TelemetryMiddleware())
r.Use(core.GateMiddleware(runtimeCtx))
// License routes (always accessible, even without license)
+1 -1
View File
@@ -58,7 +58,7 @@ LOG_COMPRESS=true
CONNECT_ON_STARTUP=false
# Enviar arquivos via webhook
WEBHOOKFILES=true
WEBHOOK_FILES=true
# Nome do sistema operacional
OS_NAME=Linux
+1 -1
View File
@@ -31,7 +31,7 @@ services:
# Conexão
CONNECT_ON_STARTUP: "false"
WEBHOOKFILES: "true"
WEBHOOK_FILES: "true"
# Sistema
OS_NAME: "Linux"
+1 -1
View File
@@ -29,7 +29,7 @@ services:
# Conexão
CONNECT_ON_STARTUP: "true"
WEBHOOKFILES: "true"
WEBHOOK_FILES: "true"
# Sistema
OS_NAME: "Linux"
+1 -1
View File
@@ -31,7 +31,7 @@ services:
# Conexão
CONNECT_ON_STARTUP: "false"
WEBHOOKFILES: "true"
WEBHOOK_FILES: "true"
# Sistema
OS_NAME: "Linux"
@@ -85,7 +85,7 @@ services:
WADEBUG: "INFO"
LOGTYPE: "console"
CONNECT_ON_STARTUP: "false"
WEBHOOKFILES: "true"
WEBHOOK_FILES: "true"
volumes:
- evolution_data:/app/dbdata
@@ -469,7 +469,7 @@ data:
WADEBUG: "INFO"
LOGTYPE: "console"
CONNECT_ON_STARTUP: "false"
WEBHOOKFILES: "true"
WEBHOOK_FILES: "true"
DATABASE_SAVE_MESSAGES: "false"
```
@@ -147,7 +147,7 @@ LOGTYPE=console
# Configurações de desenvolvimento
CONNECT_ON_STARTUP=false
WEBHOOKFILES=true
WEBHOOK_FILES=true
OS_NAME=Linux
```
+3 -3
View File
@@ -211,7 +211,7 @@ CONNECT_ON_STARTUP=false
**Recomendação**: `false` para maior controle sobre o ciclo de vida das instâncias.
### WEBHOOKFILES
### WEBHOOK_FILES
Envia URLs de mídia nos payloads de webhook.
@@ -219,7 +219,7 @@ Envia URLs de mídia nos payloads de webhook.
- **Padrão**: `true`
```env
WEBHOOKFILES=true
WEBHOOK_FILES=true
```
### QRCODE_MAX_COUNT
@@ -540,7 +540,7 @@ LOGTYPE=console
# Comportamento
CONNECT_ON_STARTUP=false
WEBHOOKFILES=true
WEBHOOK_FILES=true
CHECK_USER_EXISTS=true
EVENT_IGNORE_STATUS=true
```
+1 -1
View File
@@ -198,7 +198,7 @@ DATABASE_SAVE_MESSAGES=false
WADEBUG=DEBUG
LOGTYPE=console
CONNECT_ON_STARTUP=false
WEBHOOKFILES=true
WEBHOOK_FILES=true
OS_NAME=Linux
```
+724
View File
@@ -0,0 +1,724 @@
# API de Mensagens Interativas
Documentação completa dos endpoints para enviar mensagens interativas no WhatsApp: botões, listas e carrosséis. Todos os endpoints são compatíveis com **Android**, **iOS (iPhone)** e **WhatsApp Web/Desktop**.
## 📋 Índice
- [Enviar Botões](#enviar-botões)
- [Enviar Lista](#enviar-lista)
- [Enviar Carrossel](#enviar-carrossel)
- [Evento ButtonClick (Rastreio)](#evento-buttonclick)
- [Tipos de Botões](#tipos-de-botões)
- [Notas de Compatibilidade](#notas-de-compatibilidade)
---
## Enviar Botões
Envia uma mensagem com botões interativos. Suporta botões de resposta rápida (reply), URL, ligação (call), cópia (copy) e PIX.
**Endpoint**: `POST /send/button`
**Headers**:
```
Content-Type: application/json
apikey: SUA-CHAVE-API
```
**Body**:
```json
{
"number": "5511999999999",
"title": "Título da Mensagem",
"description": "Texto do corpo da mensagem",
"footer": "Texto do rodapé",
"buttons": [
{
"type": "reply",
"displayText": "Texto do Botão",
"id": "identificador_unico"
}
],
"delay": 1000,
"quoted": {
"messageId": "BAE5..."
}
}
```
**Parâmetros**:
| Campo | Tipo | Obrigatório | Descrição |
|-------|------|-------------|-----------|
| `number` | string | ✅ Sim | Número do destinatário (formato: DDI + DDD + número) |
| `description` | string | ✅ Sim | Texto do corpo da mensagem |
| `buttons` | array | ✅ Sim | Array de botões (ver [Tipos de Botões](#tipos-de-botões)) |
| `title` | string | ❌ Não | Título exibido em negrito acima do corpo |
| `footer` | string | ❌ Não | Texto pequeno no rodapé. **Não enviar vazio** |
| `delay` | int32 | ❌ Não | Delay em milissegundos antes de enviar |
| `mentionedJid` | string | ❌ Não | JID do usuário a mencionar |
| `mentionAll` | bool | ❌ Não | Mencionar todos os participantes (apenas grupos) |
| `formatJid` | bool | ❌ Não | Formatar número automaticamente (padrão: true) |
| `quoted` | object | ❌ Não | Mensagem a ser citada |
**Resposta de Sucesso (200)**:
```json
{
"message": "success",
"data": {
"Info": {
"ID": "3EB034D434158AD2CC0B9A",
"Chat": "[email protected]",
"Type": "ButtonMessage",
"Timestamp": "2026-04-01T17:54:09Z"
}
}
}
```
**Resposta de Erro (400)**:
```json
{
"error": "phone number is required"
}
```
### Exemplo 1: Botões Quick Reply
Máximo 3 botões. Não pode misturar com outros tipos.
```bash
curl -X POST http://localhost:4000/send/button \
-H "Content-Type: application/json" \
-H "apikey: SUA-CHAVE-API" \
-d '{
"number": "5511999999999",
"title": "Atendimento",
"description": "Como podemos ajudar você hoje?",
"footer": "Responda clicando em um botão",
"buttons": [
{"type": "reply", "displayText": "Suporte Técnico", "id": "suporte"},
{"type": "reply", "displayText": "Financeiro", "id": "financeiro"},
{"type": "reply", "displayText": "Vendas", "id": "vendas"}
]
}'
```
### Exemplo 2: Botões Mistos (URL + Call + Copy)
Podem ser combinados entre si livremente.
```bash
curl -X POST http://localhost:4000/send/button \
-H "Content-Type: application/json" \
-H "apikey: SUA-CHAVE-API" \
-d '{
"number": "5511999999999",
"title": "Nossos Canais",
"description": "Escolha como deseja entrar em contato:",
"footer": "Empresa XYZ",
"buttons": [
{"type": "url", "displayText": "Acessar Site", "url": "https://empresa.com"},
{"type": "call", "displayText": "Ligar para Nós", "phoneNumber": "+5511999999999"},
{"type": "copy", "displayText": "Copiar Email", "copyCode": "[email protected]"}
]
}'
```
### Exemplo 3: Botão PIX
Deve ser enviado **sozinho**, sem outros botões.
```bash
curl -X POST http://localhost:4000/send/button \
-H "Content-Type: application/json" \
-H "apikey: SUA-CHAVE-API" \
-d '{
"number": "5511999999999",
"title": "Pagamento PIX",
"description": "Realize o pagamento via PIX:",
"buttons": [
{
"type": "pix",
"currency": "BRL",
"name": "Empresa XYZ LTDA",
"keyType": "CNPJ",
"key": "12345678000199"
}
]
}'
```
---
## Enviar Lista
Envia uma mensagem com lista de opções organizadas em seções. O usuário toca no botão para abrir a lista e seleciona uma opção.
**Endpoint**: `POST /send/list`
**Headers**:
```
Content-Type: application/json
apikey: SUA-CHAVE-API
```
**Body**:
```json
{
"number": "5511999999999",
"title": "Título da Lista",
"description": "Texto do corpo da mensagem",
"buttonText": "Texto do botão que abre a lista",
"footerText": "Texto do rodapé",
"sections": [
{
"title": "Nome da Seção",
"rows": [
{
"title": "Título da Opção",
"description": "Descrição da opção",
"rowId": "identificador_unico"
}
]
}
],
"delay": 1000,
"quoted": {
"messageId": "BAE5..."
}
}
```
**Parâmetros**:
| Campo | Tipo | Obrigatório | Descrição |
|-------|------|-------------|-----------|
| `number` | string | ✅ Sim | Número do destinatário |
| `description` | string | ✅ Sim | Texto do corpo da mensagem |
| `sections` | array | ✅ Sim | Array de seções contendo rows |
| `buttonText` | string | ❌ Não | Texto do botão que abre a lista (padrão: "Ver Menu") |
| `title` | string | ❌ Não | Título em negrito no topo |
| `footerText` | string | ❌ Não | Texto do rodapé |
| `delay` | int32 | ❌ Não | Delay em milissegundos antes de enviar |
| `mentionedJid` | string | ❌ Não | JID do usuário a mencionar |
| `mentionAll` | bool | ❌ Não | Mencionar todos (apenas grupos) |
| `formatJid` | bool | ❌ Não | Formatar número automaticamente |
| `quoted` | object | ❌ Não | Mensagem a ser citada |
**Parâmetros da Seção**:
| Campo | Tipo | Obrigatório | Descrição |
|-------|------|-------------|-----------|
| `title` | string | ✅ Sim | Nome da seção |
| `rows` | array | ✅ Sim | Array de opções da seção |
**Parâmetros da Row**:
| Campo | Tipo | Obrigatório | Descrição |
|-------|------|-------------|-----------|
| `title` | string | ✅ Sim | Texto da opção |
| `description` | string | ❌ Não | Descrição da opção |
| `rowId` | string | ✅ Sim | ID único para rastreio do clique |
**Resposta de Sucesso (200)**:
```json
{
"message": "success",
"data": {
"Info": {
"ID": "3EB0C5A277F7F9B6C599",
"Chat": "[email protected]",
"Type": "ListMessage",
"Timestamp": "2026-04-01T18:00:00Z"
}
}
}
```
**Resposta de Erro (400)**:
```json
{
"error": "sections are required"
}
```
### Exemplo 1: Cardápio Digital
```bash
curl -X POST http://localhost:4000/send/list \
-H "Content-Type: application/json" \
-H "apikey: SUA-CHAVE-API" \
-d '{
"number": "5511999999999",
"title": "Cardápio Digital",
"description": "Escolha um item do nosso cardápio:",
"buttonText": "Ver Cardápio",
"footerText": "Restaurante XYZ",
"sections": [
{
"title": "Pratos Principais",
"rows": [
{"title": "Filé Mignon", "description": "Com arroz e batata - R$ 45,90", "rowId": "file_mignon"},
{"title": "Salmão Grelhado", "description": "Com legumes - R$ 52,90", "rowId": "salmao"},
{"title": "Frango Parmegiana", "description": "Com purê - R$ 35,90", "rowId": "frango"}
]
},
{
"title": "Bebidas",
"rows": [
{"title": "Suco Natural", "description": "Laranja, Limão ou Maracujá - R$ 8,00", "rowId": "suco"},
{"title": "Refrigerante", "description": "Lata 350ml - R$ 6,00", "rowId": "refri"},
{"title": "Água Mineral", "description": "500ml - R$ 4,00", "rowId": "agua"}
]
},
{
"title": "Sobremesas",
"rows": [
{"title": "Pudim", "description": "R$ 12,00", "rowId": "pudim"},
{"title": "Petit Gâteau", "description": "R$ 18,00", "rowId": "petit_gateau"}
]
}
]
}'
```
### Exemplo 2: Menu de Serviços
```bash
curl -X POST http://localhost:4000/send/list \
-H "Content-Type: application/json" \
-H "apikey: SUA-CHAVE-API" \
-d '{
"number": "5511999999999",
"description": "Selecione o serviço desejado:",
"buttonText": "Ver Serviços",
"sections": [
{
"title": "Atendimento",
"rows": [
{"title": "Falar com Atendente", "description": "Atendimento humano", "rowId": "atendente"},
{"title": "FAQ", "description": "Perguntas frequentes", "rowId": "faq"},
{"title": "Abrir Ticket", "description": "Registrar ocorrência", "rowId": "ticket"}
]
}
]
}'
```
---
## Enviar Carrossel
Envia uma mensagem com cards deslizáveis (carrossel), cada um com imagem, texto, rodapé e botões. Ideal para catálogos de produtos, planos e portfólios.
**Endpoint**: `POST /send/carousel`
**Headers**:
```
Content-Type: application/json
apikey: SUA-CHAVE-API
```
**Body**:
```json
{
"number": "5511999999999",
"body": "Texto do corpo principal",
"footer": "Texto do rodapé principal",
"cards": [
{
"header": {
"title": "Título do Card",
"imageUrl": "https://url-da-imagem.com/foto.jpg"
},
"body": "Texto do corpo do card",
"footer": "Rodapé do card",
"buttons": [
{
"type": "REPLY",
"displayText": "Texto do Botão",
"id": "id_rastreio"
}
]
}
],
"delay": 1000,
"quoted": {
"messageId": "BAE5..."
}
}
```
**Parâmetros**:
| Campo | Tipo | Obrigatório | Descrição |
|-------|------|-------------|-----------|
| `number` | string | ✅ Sim | Número do destinatário |
| `cards` | array | ✅ Sim | Array de cards (mínimo 2, máximo ~10) |
| `body` | string | ❌ Não | Texto do corpo principal (acima dos cards) |
| `footer` | string | ❌ Não | Rodapé principal |
| `delay` | int32 | ❌ Não | Delay em milissegundos antes de enviar |
| `formatJid` | bool | ❌ Não | Formatar número automaticamente |
| `quoted` | object | ❌ Não | Mensagem a ser citada |
**Parâmetros do Card**:
| Campo | Tipo | Obrigatório | Descrição |
|-------|------|-------------|-----------|
| `header` | object | ✅ Sim | Cabeçalho do card (deve conter imagem) |
| `header.title` | string | ❌ Não | Título do card |
| `header.subtitle` | string | ❌ Não | Subtítulo do card |
| `header.imageUrl` | string | ✅ Sim* | URL da imagem do card |
| `header.videoUrl` | string | ❌ Não | URL de vídeo (alternativa à imagem) |
| `body` | string | ✅ Sim | Texto do corpo do card |
| `footer` | string | ❌ Não | Rodapé do card |
| `buttons` | array | ❌ Não | Array de botões do card |
> ⚠️ **Importante**: Todos os cards **devem** ter imagem (`imageUrl`) para o carrossel renderizar corretamente em todos os dispositivos. As imagens recebem thumbnail JPEG automaticamente para carregamento instantâneo.
**Parâmetros do Botão do Card**:
| Campo | Tipo | Obrigatório | Descrição |
|-------|------|-------------|-----------|
| `type` | string | ❌ Não | Tipo do botão: `REPLY`, `URL`, `CALL`, `COPY` (padrão: `REPLY`) |
| `displayText` | string | ✅ Sim | Texto visível do botão |
| `id` | string | ✅ Sim* | ID para rastreio (reply) ou URL/telefone (url/call) |
| `copyCode` | string | ✅ Sim* | Texto a copiar (apenas tipo `COPY`) |
**Resposta de Sucesso (200)**:
```json
{
"message": "success",
"data": {
"Info": {
"ID": "3EB0C5A277F7F9B6C599",
"Chat": "[email protected]",
"Type": "InteractiveMessage",
"Timestamp": "2026-04-01T18:30:00Z"
}
}
}
```
**Resposta de Erro (400)**:
```json
{
"error": "cards are required (minimum 1)"
}
```
### Exemplo 1: Catálogo de Produtos
```bash
curl -X POST http://localhost:4000/send/carousel \
-H "Content-Type: application/json" \
-H "apikey: SUA-CHAVE-API" \
-d '{
"number": "5511999999999",
"body": "Confira nossos produtos em destaque!",
"footer": "Loja Virtual XYZ",
"cards": [
{
"header": {
"title": "Smartphone Pro Max",
"imageUrl": "https://placehold.co/600x400/1a1a2e/white?text=Smartphone"
},
"body": "Tela 6.7 AMOLED, 256GB, Câmera 108MP.\nDe R$ 4.999 por R$ 3.799!",
"footer": "12x sem juros",
"buttons": [
{"type": "REPLY", "displayText": "Comprar", "id": "comprar_smartphone"},
{"type": "URL", "displayText": "Ver Detalhes", "id": "https://loja.com/smartphone"}
]
},
{
"header": {
"title": "Notebook Ultra",
"imageUrl": "https://placehold.co/600x400/16213e/white?text=Notebook"
},
"body": "Intel i7, 16GB RAM, SSD 512GB, Tela 15.6 FHD.\nPor apenas R$ 5.299!",
"footer": "Frete grátis",
"buttons": [
{"type": "REPLY", "displayText": "Comprar", "id": "comprar_notebook"},
{"type": "URL", "displayText": "Ver Detalhes", "id": "https://loja.com/notebook"}
]
},
{
"header": {
"title": "Fone Bluetooth",
"imageUrl": "https://placehold.co/600x400/0f3460/white?text=Fone"
},
"body": "Cancelamento de ruído ativo, 30h bateria.\nR$ 299,90",
"footer": "Envio imediato",
"buttons": [
{"type": "REPLY", "displayText": "Comprar", "id": "comprar_fone"},
{"type": "CALL", "displayText": "Ligar p/ Comprar", "id": "+5511999999999"}
]
}
]
}'
```
### Exemplo 2: Planos de Serviço
```bash
curl -X POST http://localhost:4000/send/carousel \
-H "Content-Type: application/json" \
-H "apikey: SUA-CHAVE-API" \
-d '{
"number": "5511999999999",
"body": "Conheça nossos planos:",
"cards": [
{
"header": {
"title": "Plano Básico",
"imageUrl": "https://placehold.co/600x400/2ecc71/white?text=Basico"
},
"body": "Ideal para pequenas empresas.\n- 1.000 mensagens/mês\n- 1 instância\n- Suporte email\n\nR$ 97/mês",
"buttons": [
{"type": "REPLY", "displayText": "Contratar Básico", "id": "plano_basico"},
{"type": "COPY", "displayText": "Copiar Link", "copyCode": "https://planos.com/basico"}
]
},
{
"header": {
"title": "Plano Pro",
"imageUrl": "https://placehold.co/600x400/3498db/white?text=Pro"
},
"body": "Para empresas em crescimento.\n- 10.000 mensagens/mês\n- 5 instâncias\n- Suporte prioritário\n\nR$ 297/mês",
"buttons": [
{"type": "REPLY", "displayText": "Contratar Pro", "id": "plano_pro"},
{"type": "COPY", "displayText": "Copiar Link", "copyCode": "https://planos.com/pro"}
]
},
{
"header": {
"title": "Plano Enterprise",
"imageUrl": "https://placehold.co/600x400/9b59b6/white?text=Enterprise"
},
"body": "Solução completa.\n- Mensagens ilimitadas\n- Instâncias ilimitadas\n- Suporte 24/7\n\nSob consulta",
"buttons": [
{"type": "REPLY", "displayText": "Solicitar Orçamento", "id": "plano_enterprise"},
{"type": "CALL", "displayText": "Falar com Vendas", "id": "+5511999999999"}
]
}
]
}'
```
---
## Evento ButtonClick
Quando um usuário clica em um botão, seleciona um item de lista ou interage com um card de carrossel, a API dispara o evento `ButtonClick` para todos os canais configurados na instância.
### Canais de Disparo
- **Webhook** - Callback HTTP para URL configurada
- **WebSocket** - Evento em tempo real
- **RabbitMQ** - Mensagem na fila
- **NATS** - Mensagem no tópico
### Requisito
A instância deve ter o evento `BUTTON_CLICK` ou `MESSAGE` habilitado na configuração de events.
### Payload do Evento
```json
{
"event": "ButtonClick",
"data": {
"buttonId": "suporte",
"buttonText": "Suporte Técnico",
"type": "native_flow_response",
"phone": "5511999999999",
"jid": "[email protected]",
"pushName": "João Silva",
"messageId": "3EB034D434158AD2CC0B9A",
"chat": "[email protected]",
"fromMe": false,
"timestamp": 1711990500,
"extraData": {}
},
"instanceToken": "token_da_instancia",
"instanceId": "uuid-da-instancia",
"instanceName": "nome_da_instancia"
}
```
### Campos do Evento
| Campo | Tipo | Descrição |
|-------|------|-----------|
| `buttonId` | string | ID do botão/row clicado (conforme definido no envio) |
| `buttonText` | string | Texto exibido no botão/row |
| `type` | string | Tipo de resposta (ver tabela abaixo) |
| `phone` | string | Número do usuário que clicou |
| `jid` | string | JID completo do usuário |
| `pushName` | string | Nome do contato no WhatsApp |
| `messageId` | string | ID da mensagem de resposta |
| `chat` | string | JID do chat |
| `fromMe` | bool | Se a mensagem é própria |
| `timestamp` | int64 | Timestamp Unix do clique |
### Tipos de Resposta
| Valor de `type` | Origem |
|-----------------|--------|
| `native_flow_response` | Clique em botão enviado via `/send/button` ou `/send/carousel` |
| `list_response` | Seleção de item em lista enviada via `/send/list` |
| `buttons_response` | Resposta a botões legados (ButtonsMessage) |
| `template_button_reply` | Resposta a template buttons |
### Exemplo: Botão Reply Clicado
```json
{
"event": "ButtonClick",
"data": {
"buttonId": "vendas",
"buttonText": "Vendas",
"type": "native_flow_response",
"phone": "5511999999999",
"jid": "[email protected]",
"pushName": "Maria Santos",
"messageId": "3EB0XXXXXXXXXXXXXX",
"chat": "[email protected]",
"fromMe": false,
"timestamp": 1711991000
},
"instanceToken": "teste123",
"instanceId": "4ee8ab07-8a67-42a8-a029-f382315912b1",
"instanceName": "minha_instancia"
}
```
### Exemplo: Item de Lista Selecionado
```json
{
"event": "ButtonClick",
"data": {
"buttonId": "file_mignon",
"buttonText": "Filé Mignon",
"type": "list_response",
"phone": "5511999999999",
"jid": "[email protected]",
"pushName": "Pedro Oliveira",
"messageId": "3EB0XXXXXXXXXXXXXX",
"chat": "[email protected]",
"fromMe": false,
"timestamp": 1711991500
},
"instanceToken": "teste123",
"instanceId": "4ee8ab07-8a67-42a8-a029-f382315912b1",
"instanceName": "minha_instancia"
}
```
### Exemplo: Botão de Carrossel Clicado
```json
{
"event": "ButtonClick",
"data": {
"buttonId": "comprar_smartphone",
"buttonText": "Comprar",
"type": "native_flow_response",
"phone": "5511999999999",
"jid": "[email protected]",
"pushName": "Ana Costa",
"messageId": "3EB0XXXXXXXXXXXXXX",
"chat": "[email protected]",
"fromMe": false,
"timestamp": 1711992000
},
"instanceToken": "teste123",
"instanceId": "4ee8ab07-8a67-42a8-a029-f382315912b1",
"instanceName": "minha_instancia"
}
```
---
## Tipos de Botões
### Resumo por Endpoint
| Tipo | SendButton | SendCarousel | Campo obrigatório |
|------|-----------|-------------|-------------------|
| Reply | `"reply"` | `"REPLY"` (padrão) | `displayText`, `id` |
| URL | `"url"` | `"URL"` | `displayText`, `url` ou `id` |
| Call | `"call"` | `"CALL"` | `displayText`, `phoneNumber` ou `id` |
| Copy | `"copy"` | `"COPY"` | `displayText`, `copyCode` |
| PIX | `"pix"` | N/A | `currency`, `name`, `keyType`, `key` |
### Regras de Combinação
- **Reply**: Máximo 3 botões. **Não** pode misturar com outros tipos no mesmo envio.
- **PIX**: Deve ser enviado **sozinho**, sem outros botões.
- **URL / Call / Copy**: Podem ser combinados livremente entre si.
- **Carrossel**: Todos os tipos (exceto PIX) podem ser combinados no mesmo card.
- **Lista**: Não possui botões nos items. Usa `rowId` para rastreio.
### Estrutura de Cada Tipo
**Reply** (Resposta Rápida):
```json
{"type": "reply", "displayText": "Suporte", "id": "btn_suporte"}
```
**URL** (Abre Link):
```json
{"type": "url", "displayText": "Acessar Site", "url": "https://empresa.com"}
```
**Call** (Ligação):
```json
{"type": "call", "displayText": "Ligar Agora", "phoneNumber": "+5511999999999"}
```
**Copy** (Copiar Texto):
```json
{"type": "copy", "displayText": "Copiar Código", "copyCode": "DESCONTO20"}
```
**PIX** (Pagamento):
```json
{
"type": "pix",
"currency": "BRL",
"name": "Empresa XYZ",
"keyType": "CPF",
"key": "12345678901"
}
```
---
## Notas de Compatibilidade
### Regras para Funcionamento em Todos os Dispositivos
| Regra | Detalhe |
|-------|---------|
| Footer vazio | **Não** envie campo `footer` vazio. Omita o campo ou preencha com texto |
| Imagens no carrossel | **Todos** os cards devem ter `imageUrl` para renderizar corretamente |
| Mínimo de cards | Carrossel requer no **mínimo 2 cards** |
| Thumbnails | Gerados automaticamente pela API (72px JPEG) para carregamento instantâneo |
| Formato do número | DDI + DDD + número, sem caracteres especiais (`5511999999999`) |
| Grupos | Use o JID do grupo (ex: `[email protected]`) |
| Mensagem quoted | Adicione `"quoted": {"messageId": "ID"}` ao payload |
### Compatibilidade Testada
| Tipo de Mensagem | Android | iOS (iPhone) | WhatsApp Web |
|------------------|---------|--------------|--------------|
| Botões (reply) | ✅ | ✅ | ✅ |
| Botões (url) | ✅ | ✅ | ✅ |
| Botões (call) | ✅ | ✅ | ✅ |
| Botões (copy) | ✅ | ✅ | ✅ |
| Botões (pix) | ✅ | ✅ | ✅ |
| Lista | ✅ | ✅ | ✅ |
| Carrossel | ✅ | ✅ | ✅ |
+3 -2
View File
@@ -12,8 +12,9 @@ Documentação completa dos endpoints para enviar e gerenciar mensagens WhatsApp
- [Enviar Sticker](#enviar-sticker)
- [Enviar Localização](#enviar-localização)
- [Enviar Contato](#enviar-contato)
- [~~Enviar Botões~~](#enviar-botões) ⚠️ **DEPRECIADO**
- [~~Enviar Lista~~](#enviar-lista) ⚠️ **DEPRECIADO**
- [Enviar Botões](api-interactive.md#enviar-botões) ➡️ **Ver [API de Mensagens Interativas](api-interactive.md)**
- [Enviar Lista](api-interactive.md#enviar-lista) ➡️ **Ver [API de Mensagens Interativas](api-interactive.md)**
- [Enviar Carrossel](api-interactive.md#enviar-carrossel) ➡️ **Ver [API de Mensagens Interativas](api-interactive.md)**
### Gerenciar Mensagens
- [Reagir a Mensagem](#reagir-a-mensagem)
@@ -59,7 +59,7 @@ POSTGRES_USERS_DB=postgresql://user:pass@host:5432/evogo_users?sslmode=disable
| Variável | Padrão | Descrição |
|----------|--------|-----------|
| `CONNECT_ON_STARTUP` | `false` | Conectar instâncias ao iniciar servidor |
| `WEBHOOKFILES` | `true` | Enviar URLs de mídia em webhooks |
| `WEBHOOK_FILES` | `true` | Enviar URLs de mídia em webhooks |
| `QRCODE_MAX_COUNT` | `5` | Tentativas máximas de QR Code |
| `CHECK_USER_EXISTS` | `true` | Validar destinatário antes de enviar |
@@ -197,7 +197,7 @@ LOGTYPE=console
# Comportamento
CONNECT_ON_STARTUP=false
WEBHOOKFILES=true
WEBHOOK_FILES=true
CHECK_USER_EXISTS=true
EVENT_IGNORE_STATUS=true
Executable
BIN
View File
Binary file not shown.
-1
View File
@@ -3,7 +3,6 @@ module github.com/EvolutionAPI/evolution-go
go 1.25.0
require (
github.com/EvolutionAPI/evo-gate v0.1.2
github.com/chai2010/webp v1.1.1
github.com/gabriel-vasile/mimetype v1.4.5
github.com/gin-gonic/gin v1.10.0
-2
View File
@@ -2,8 +2,6 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
github.com/EvolutionAPI/evo-gate v0.1.2 h1:ZPQ9SZ7OlajNU1pbtYqbMg1U/ZiUSKmlrYk0GHWOXkc=
github.com/EvolutionAPI/evo-gate v0.1.2/go.mod h1:48tcAgZ0yVojqLdmLpOSyWDGqPODBYXYRSEs2yIUI/w=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM=
-1
View File
@@ -1 +0,0 @@
@layer properties;@layer theme,base,components,utilities;@layer theme{:root,:host{--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-100: oklch(93.6% .032 17.717);--color-red-500: oklch(63.7% .237 25.331);--color-red-600: oklch(57.7% .245 27.325);--color-red-700: oklch(50.5% .213 27.518);--color-red-800: oklch(44.4% .177 26.899);--color-orange-100: oklch(95.4% .038 75.164);--color-orange-500: oklch(70.5% .213 47.604);--color-orange-600: oklch(64.6% .222 41.116);--color-orange-700: oklch(55.3% .195 38.402);--color-yellow-100: oklch(97.3% .071 103.193);--color-yellow-400: oklch(85.2% .199 91.936);--color-yellow-500: oklch(79.5% .184 86.047);--color-yellow-600: oklch(68.1% .162 75.834);--color-yellow-700: oklch(55.4% .135 66.442);--color-green-50: oklch(98.2% .018 155.826);--color-green-100: oklch(96.2% .044 156.743);--color-green-200: oklch(92.5% .084 155.995);--color-green-400: oklch(79.2% .209 151.711);--color-green-500: oklch(72.3% .219 149.579);--color-green-600: oklch(62.7% .194 149.214);--color-green-700: oklch(52.7% .154 150.069);--color-green-800: oklch(44.8% .119 151.328);--color-blue-50: oklch(97% .014 254.604);--color-blue-100: oklch(93.2% .032 255.585);--color-blue-200: oklch(88.2% .059 254.128);--color-blue-400: oklch(70.7% .165 254.624);--color-blue-500: oklch(62.3% .214 259.815);--color-blue-600: oklch(54.6% .245 262.881);--color-blue-700: oklch(48.8% .243 264.376);--color-blue-800: oklch(42.4% .199 265.638);--color-blue-900: oklch(37.9% .146 265.522);--color-purple-50: oklch(97.7% .014 308.299);--color-purple-100: oklch(94.6% .033 307.174);--color-purple-200: oklch(90.2% .063 306.703);--color-purple-500: oklch(62.7% .265 303.9);--color-purple-600: oklch(55.8% .288 302.321);--color-purple-700: oklch(49.6% .265 301.924);--color-purple-900: oklch(38.1% .176 304.987);--color-pink-50: oklch(97.1% .014 343.198);--color-pink-500: oklch(65.6% .241 354.308);--color-pink-600: oklch(59.2% .249 .584);--color-slate-50: oklch(98.4% .003 247.858);--color-slate-800: oklch(27.9% .041 260.031);--color-slate-900: oklch(20.8% .042 265.755);--color-gray-400: oklch(70.7% .022 261.325);--color-gray-600: oklch(44.6% .03 256.802);--color-gray-700: oklch(37.3% .034 259.733);--color-gray-900: oklch(21% .034 264.665);--color-black: #000;--color-white: #fff;--spacing: .25rem;--container-xs: 20rem;--container-sm: 24rem;--container-md: 28rem;--container-lg: 32rem;--container-2xl: 42rem;--container-4xl: 56rem;--container-6xl: 72rem;--text-xs: .75rem;--text-xs--line-height: calc(1 / .75);--text-sm: .875rem;--text-sm--line-height: calc(1.25 / .875);--text-base: 1rem;--text-base--line-height: 1.5 ;--text-lg: 1.125rem;--text-lg--line-height: calc(1.75 / 1.125);--text-xl: 1.25rem;--text-xl--line-height: calc(1.75 / 1.25);--text-2xl: 1.5rem;--text-2xl--line-height: calc(2 / 1.5);--text-3xl: 1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl: 2.25rem;--text-4xl--line-height: calc(2.5 / 2.25);--font-weight-normal: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--tracking-tight: -.025em;--tracking-widest: .1em;--leading-tight: 1.25;--leading-snug: 1.375;--leading-relaxed: 1.625;--radius-xs: .125rem;--ease-in-out: cubic-bezier(.4, 0, .2, 1);--animate-spin: spin 1s linear infinite;--animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--aspect-video: 16 / 9;--default-transition-duration: .15s;--default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);--default-font-family: var(--font-sans);--default-mono-font-family: var(--font-mono);--color-background: var(--background);--color-foreground: var(--foreground);--color-primary: var(--primary);--color-primary-foreground: var(--primary-foreground);--color-secondary: var(--secondary);--color-secondary-foreground: var(--secondary-foreground);--color-muted: var(--muted);--color-muted-foreground: var(--muted-foreground);--color-accent: var(--accent);--color-accent-foreground: var(--accent-foreground);--color-destructive: var(--destructive);--color-destructive-foreground: var(--destructive-foreground);--color-border: var(--border);--color-input: var(--input);--color-ring: var(--ring)}}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1Line truncated
-340
View File
@@ -1,340 +0,0 @@
var iC=Object.defineProperty;var lC=(t,n,r)=>n in t?iC(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r;var tb=(t,n,r)=>lC(t,typeof n!="symbol"?n+"":n,r);function cC(t,n){for(var r=0;r<n.length;r++){const s=n[r];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in t)){const c=Object.getOwnPropertyDescriptor(s,i);c&&Object.defineProperty(t,i,c.get?c:{enumerable:!0,get:()=>s[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const c of i)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function r(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(i){if(i.ep)return;i.ep=!0;const c=r(i);fetch(i.href,c)}})();function ix(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var om={exports:{}},Pi={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var nb;function uC(){if(nb)return Pi;nb=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(s,i,c){var u=null;if(c!==void 0&&(u=""+c),i.key!==void 0&&(u=""+i.key),"key"in i){c={};for(var f in i)f!=="key"&&(c[f]=i[f])}else c=i;return i=c.ref,{$$typeof:t,type:s,key:u,ref:i!==void 0?i:null,props:c}}return Pi.Fragment=n,Pi.jsx=r,Pi.jsxs=r,Pi}var ab;function dC(){return ab||(ab=1,om.exports=uC()),om.exports}var p=dC(),im={exports:{}},Pe={};/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var rb;function fC(){if(rb)return Pe;rb=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),w=Symbol.iterator;function N(T){return T===null||typeof T!="object"?null:(T=w&&T[w]||T["@@iterator"],typeof T=="function"?T:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function A(T,Y,D){this.props=T,this.context=Y,this.refs=C,this.updater=D||E}A.prototype.isReactComponent={},A.prototype.setState=function(T,Y){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,Y,"setState")},A.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function O(){}O.prototype=A.prototype;function R(T,Y,D){this.props=T,this.context=Y,this.refs=C,this.updater=D||E}var L=R.prototype=new O;L.constructor=R,S(L,A.prototype),L.isPureReactComponent=!0;var I=Array.isArray;function ee(){}var U={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function le(T,Y,D){var V=D.ref;return{$$typeof:t,type:T,key:Y,ref:V!==void 0?V:null,props:D}}function ue(T,Y){return le(T.type,Y,T.props)}function me(T){return typeof T=="object"&&T!==null&&T.$$typeof===t}function re(T){var Y={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(D){return Y[D]})}var X=/\/+/g;function he(T,Y){return typeof T=="object"&&T!==null&&T.key!=null?re(""+T.key):Y.toString(36)}function be(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(ee,ee):(T.status="pending",T.then(function(Y){T.status==="pending"&&(T.status="fulfilled",T.value=Y)},function(Y){T.status==="pending"&&(T.status="rejected",T.reason=Y)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function j(T,Y,D,V,te){var fe=typeof T;(fe==="undefined"||fe==="boolean")&&(T=null);var oe=!1;if(T===null)oe=!0;else switch(fe){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(T.$$typeof){case t:case n:oe=!0;break;case v:return oe=T._init,j(oe(T._payload),Y,D,V,te)}}if(oe)return te=te(T),oe=V===""?"."+he(T,0):V,I(te)?(D="",oe!=null&&(D=oe.replace(X,"$&/")+"/"),j(te,Y,D,"",function(_e){return _e})):te!=null&&(me(te)&&(te=ue(te,D+(te.key==null||T&&T.key===te.key?"":(""+te.key).replace(X,"$&/")+"/")+oe)),Y.push(te)),1;oe=0;var K=V===""?".":V+":";if(I(T))for(var de=0;de<T.length;de++)V=T[de],fe=K+he(V,de),oe+=j(V,Y,D,fe,te);else if(de=N(T),typeof de=="function")for(T=de.call(T),de=0;!(V=T.next()).done;)V=V.value,fe=K+he(V,de++),oe+=j(V,Y,D,fe,te);else if(fe==="object"){if(typeof T.then=="function")return j(be(T),Y,D,V,te);throw Y=String(T),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return oe}function Z(T,Y,D){if(T==null)return T;var V=[],te=0;return j(T,V,"","",function(fe){return Y.call(D,fe,te++)}),V}function P(T){if(T._status===-1){var Y=T._result;Y=Y(),Y.then(function(D){(T._status===0||T._status===-1)&&(T._status=1,T._result=D)},function(D){(T._status===0||T._status===-1)&&(T._status=2,T._result=D)}),T._status===-1&&(T._status=0,T._result=Y)}if(T._status===1)return T._result.default;throw T._result}var se=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},we={map:Z,forEach:function(T,Y,D){Z(T,function(){Y.apply(this,arguments)},D)},count:function(T){var Y=0;return Z(T,function(){Y++}),Y},toArray:function(T){return Z(T,function(Y){return Y})||[]},only:function(T){if(!me(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Pe.Activity=y,Pe.Children=we,Pe.Component=A,Pe.Fragment=r,Pe.Profiler=i,Pe.PureComponent=R,Pe.StrictMode=s,Pe.Suspense=g,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(T){return U.H.useMemoCache(T)}},Pe.cache=function(T){return function(){return T.apply(null,arguments)}},Pe.cacheSignal=function(){return null},Pe.cloneElement=function(T,Y,D){if(T==null)throw Error("Line truncated
* @license React
* scheduler.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ob;function mC(){return ob||(ob=1,(function(t){function n(j,Z){var P=j.length;j.push(Z);e:for(;0<P;){var se=P-1>>>1,we=j[se];if(0<i(we,Z))j[se]=Z,j[P]=we,P=se;else break e}}function r(j){return j.length===0?null:j[0]}function s(j){if(j.length===0)return null;var Z=j[0],P=j.pop();if(P!==Z){j[0]=P;e:for(var se=0,we=j.length,T=we>>>1;se<T;){var Y=2*(se+1)-1,D=j[Y],V=Y+1,te=j[V];if(0>i(D,P))V<we&&0>i(te,D)?(j[se]=te,j[V]=P,se=V):(j[se]=D,j[Y]=P,se=Y);else if(V<we&&0>i(te,P))j[se]=te,j[V]=P,se=V;else break e}}return Z}function i(j,Z){var P=j.sortIndex-Z.sortIndex;return P!==0?P:j.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();t.unstable_now=function(){return u.now()-f}}var g=[],h=[],v=1,y=null,w=3,N=!1,E=!1,S=!1,C=!1,A=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function L(j){for(var Z=r(h);Z!==null;){if(Z.callback===null)s(h);else if(Z.startTime<=j)s(h),Z.sortIndex=Z.expirationTime,n(g,Z);else break;Z=r(h)}}function I(j){if(S=!1,L(j),!E)if(r(g)!==null)E=!0,ee||(ee=!0,re());else{var Z=r(h);Z!==null&&be(I,Z.startTime-j)}}var ee=!1,U=-1,Q=5,le=-1;function ue(){return C?!0:!(t.unstable_now()-le<Q)}function me(){if(C=!1,ee){var j=t.unstable_now();le=j;var Z=!0;try{e:{E=!1,S&&(S=!1,O(U),U=-1),N=!0;var P=w;try{t:{for(L(j),y=r(g);y!==null&&!(y.expirationTime>j&&ue());){var se=y.callback;if(typeof se=="function"){y.callback=null,w=y.priorityLevel;var we=se(y.expirationTime<=j);if(j=t.unstable_now(),typeof we=="function"){y.callback=we,L(j),Z=!0;break t}y===r(g)&&s(g),L(j)}else s(g);y=r(g)}if(y!==null)Z=!0;else{var T=r(h);T!==null&&be(I,T.startTime-j),Z=!1}}break e}finally{y=null,w=P,N=!1}Z=void 0}}finally{Z?re():ee=!1}}}var re;if(typeof R=="function")re=function(){R(me)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,he=X.port2;X.port1.onmessage=me,re=function(){he.postMessage(null)}}else re=function(){A(me,0)};function be(j,Z){U=A(function(){j(t.unstable_now())},Z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(j){j.callback=null},t.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<j?Math.floor(1e3/j):5},t.unstable_getCurrentPriorityLevel=function(){return w},t.unstable_next=function(j){switch(w){case 1:case 2:case 3:var Z=3;break;default:Z=w}var P=w;w=Z;try{return j()}finally{w=P}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(j,Z){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var P=w;w=j;try{return Z()}finally{w=P}},t.unstable_scheduleCallback=function(j,Z,P){var se=t.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?se+P:se):P=se,j){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=P+we,j={id:v++,callback:Z,priorityLevel:j,startTime:P,expirationTime:we,sortIndex:-1},P>se?(j.sortIndex=P,n(h,j),r(g)===null&&j===r(h)&&(S?(O(U),U=-1):S=!0,be(I,P-se))):(j.sortIndex=we,n(g,j),E||N||(E=!0,ee||(ee=!0,re()))),j},t.unstable_shouldYield=ue,t.unstable_wrapCallback=function(j){var Z=w;return function(){var P=w;w=Z;try{return j.apply(this,arguments)}finally{w=P}}}})(um)),um}var ib;function hC(){return ib||(ib=1,cm.exports=mC()),cm.exports}var dm={exports:{}},cn={};/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var lb;function pC(){if(lb)return cn;lb=1;var t=mh();function n(g){var h="https://react.dev/errors/"+g;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+g+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal");function c(g,h,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:y==null?null:""+y,children:g,containerInfo:h,implementation:v}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(g,h){if(g==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,cn.createPortal=function(g,h){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(n(299));return c(g,h,null,v)},cn.flushSync=function(g){var h=u.T,v=s.p;try{if(u.T=null,s.p=2,g)return g()}finally{u.T=h,s.p=v,s.d.f()}},cn.preconnect=function(g,h){typeof g=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(g,h))},cn.prefetchDNS=function(g){typeof g=="string"&&s.d.D(g)},cn.preinit=function(g,h){if(typeof g=="string"&&h&&typeof h.as=="string"){var v=h.as,y=f(v,h.crossOrigin),w=typeof h.integrity=="string"?h.integrity:void 0,N=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;v==="style"?s.d.S(g,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:w,fetchPriority:N}):v==="script"&&s.d.X(g,{crossOrigin:y,integrity:w,fetchPriority:N,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},cn.preinitModule=function(g,h){if(typeof g=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var v=f(h.as,h.crossOrigin);s.d.M(g,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(g)},cn.preload=function(g,h){if(typeof g=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var v=h.as,y=f(v,h.crossOrigin);s.d.L(g,v,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},cn.preloadModule=function(g,h){if(typeof g=="string")if(h){var v=f(h.as,h.crossOrigin);s.d.m(g,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(g)},cn.requestFormReset=function(g){s.d.r(g)},cn.unstable_batchedUpdates=function(g,h){return g(h)},cn.useFormState=function(g,h,v){return u.H.useFormState(g,h,v)},cn.useFormStatus=function(){return u.H.useHostTransitionStatus()},cn.version="19.2.0",cn}var cb;function lx(){if(cb)return dm.exports;cb=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(n){console.error(n)}}return t(),dm.exports=pC(),dm.exports}/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ub;function gC(){if(ub)return Hi;ub=1;var t=hC(),n=mh(),r=lx();function s(e){var a="https://react.dev/errors/"+e;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)a+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+e+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var a=e,o=e;if(e.alternate)for(;a.return;)a=a.return;else{e=a;do a=e,(a.flags&4098)!==0&&(o=a.return),e=a.return;while(e)}return a.tag===3?o:null}function u(e){if(e.tag===13){var a=e.memoizedState;if(a===null&&(e=e.alternate,e!==null&&(a=e.memoizedState)),a!==null)return a.dehydrated}return null}function f(e){if(e.tag===31){var a=e.memoizedState;if(a===null&&(e=e.alternate,e!==null&&(a=e.memoizedState)),a!==null)return a.dehydrated}return null}function g(e){if(c(e)!==e)throw Error(s(188))}function h(e){var a=e.alternate;if(!a){if(a=c(e),a===null)throw Error(s(188));return a!==e?null:e}for(var o=e,l=a;;){var d=o.return;if(d===null)break;var m=d.alternate;if(m===null){if(l=d.return,l!==null){o=l;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===o)return g(d),e;if(m===l)return g(d),a;m=m.sibling}throw Error(s(188))}if(o.return!==l.return)o=d,l=m;else{for(var x=!1,_=d.child;_;){if(_===o){x=!0,o=d,l=m;break}if(_===l){x=!0,l=d,o=m;break}_=_.sibling}if(!x){for(_=m.child;_;){if(_===o){x=!0,o=m,l=d;break}if(_===l){x=!0,l=m,o=d;break}_=_.sibling}if(!x)throw Error(s(189))}}if(o.alternate!==l)throw Error(s(190))}if(o.tag!==3)throw Error(s(188));return o.stateNode.current===o?e:a}function v(e){var a=e.tag;if(a===5||a===26||a===27||a===6)return e;for(e=e.child;e!==null;){if(a=v(e),a!==null)return a;e=e.sibling}return null}var y=Object.assign,w=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),R=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),ue=Symbol.for("react.memo_cache_sentinel"),me=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=me&&e[me]||e["@@iterator"],typeof e=="function"?e:null)}var X=Symbol.for("react.client.reference");function he(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===X?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case A:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case ee:return"SuspenseList";case le:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case R:return e.displayName||"Context";case O:return(e._context.displayName||"Context")+".Consumer";case L:var a=e.render;return e=e.displayName,e||(e=a.displayName||a.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case U:return a=e.displayName||null,a!==null?a:he(e.type)||"Memo";case Q:a=e._payload,e=e._init;try{return he(e(a))}catch{}}return null}var be=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},se=[],we=-1;function T(e){return{current:e}}function Y(e){0>we||(e.current=se[we],se[we]=null,we--)}function D(e,a){we++,se[we]=e.current,e.current=a}var V=T(null),te=T(null),fe=T(null),oe=T(null);function K(e,a){switch(D(fe,a),D(te,e),D(V,null),a.nodeType){case 9:case 11:e=(e=a.documentElement)&&(e=e.namespaceURI)?_v(e):0;break;default:if(e=a.tagName,a=a.namespaceURI)a=_v(a),e=Cv(a,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(V),D(V,e)}function de(){Y(V),Y(te),Y(fe)}function _e(e){e.memoizedState!==null&&D(oe,e);var a=V.current,o=Cv(a,e.type);a!==o&&(D(te,e),D(V,o))}function rt(e){te.current===e&&(Y(V),Y(te)),oe.current===e&&(Y(oe),zi._currentValue=P)}var De,Le;function xe(e){if(De===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);De=a&&a[1]||"",Le=-1<o.stack.indexOf(`
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
`+De+e+Le}var je=!1;function at(e,a){if(!e||je)return"";je=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(a){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(J){var G=J}Reflect.construct(e,[],ce)}else{try{ce.call()}catch(J){G=J}e.call(ce.prototype)}}else{try{throw Error()}catch(J){G=J}(ce=e())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(J){if(J&&G&&typeof J.stack=="string")return[J.stack,G.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=l.DetermineComponentFrameRoot(),x=m[0],_=m[1];if(x&&_){var M=x.split(`
`),F=_.split(`
`);for(d=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;d<F.length&&!F[d].includes("DetermineComponentFrameRoot");)d++;if(l===M.length||d===F.length)for(l=M.length-1,d=F.length-1;1<=l&&0<=d&&M[l]!==F[d];)d--;for(;1<=l&&0<=d;l--,d--)if(M[l]!==F[d]){if(l!==1||d!==1)do if(l--,d--,0>d||M[l]!==F[d]){var ne=`
`+M[l].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=l&&0<=d);break}}}finally{je=!1,Error.prepareStackTrace=o}return(o=e?e.displayName||e.name:"")?xe(o):""}function pt(e,a){switch(e.tag){case 26:case 27:case 5:return xe(e.type);case 16:return xe("Lazy");case 13:return e.child!==a&&a!==null?xe("Suspense Fallback"):xe("Suspense");case 19:return xe("SuspenseList");case 0:case 15:return at(e.type,!1);case 11:return at(e.type.render,!1);case 1:return at(e.type,!0);case 31:return xe("Activity");default:return""}}function Je(e){try{var a="",o=null;do a+=pt(e,o),o=e,e=e.return;while(e);return a}catch(l){return`
Error generating stack: `+l.message+`
`+l.stack}}var Ue=Object.prototype.hasOwnProperty,k=t.unstable_scheduleCallback,H=t.unstable_cancelCallback,$=t.unstable_shouldYield,ye=t.unstable_requestPaint,pe=t.unstable_now,ge=t.unstable_getCurrentPriorityLevel,Se=t.unstable_ImmediatePriority,qe=t.unstable_UserBlockingPriority,Xe=t.unstable_NormalPriority,Ot=t.unstable_LowPriority,on=t.unstable_IdlePriority,dn=t.log,Fn=t.unstable_setDisableYieldValue,Ft=null,Nt=null;function fn(e){if(typeof dn=="function"&&Fn(e),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(Ft,e)}catch{}}var $t=Math.clz32?Math.clz32:ya,Xo=Math.log,cr=Math.LN2;function ya(e){return e>>>=0,e===0?32:31-(Xo(e)/cr|0)|0}var As=256,Rs=262144,Xr=4194304;function va(e){var a=e&42;if(a!==0)return a;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Be(e,a,o){var l=e.pendingLanes;if(l===0)return 0;var d=0,m=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var _=l&134217727;return _!==0?(l=_&~m,l!==0?d=va(l):(x&=_,x!==0?d=va(x):o||(o=_&~e,o!==0&&(d=va(o))))):(_=l&~m,_!==0?d=va(_):x!==0?d=va(x):o||(o=l&~e,o!==0&&(d=va(o)))),d===0?0:a!==0&&a!==d&&(a&m)===0&&(m=d&-d,o=a&-a,m>=o||m===32&&(o&4194048)!==0)?a:d}function Et(e,a){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&a)===0}function Kt(e,a){switch(e){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ln(){var e=Xr;return Xr<<=1,(Xr&62914560)===0&&(Xr=4194304),e}function ur(e){for(var a=[],o=0;31>o;o++)a.push(e);return a}function At(e,a){e.pendingLanes|=a,a!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gn(e,a,o,l,d,m){var x=e.pendingLanes;e.pendingLanes=o,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=o,e.entangledLanes&=o,e.errorRecoveryDisabledLanes&=o,e.shellSuspendCounter=0;var _=e.entanglements,M=e.expirationTimes,F=e.hiddenUpdates;for(o=x&~o;0<o;){var ne=31-$t(o),ce=1<<ne;_[ne]=0,M[ne]=-1;var G=F[ne];if(G!==null)for(F[ne]=null,ne=0;ne<G.length;ne++){var J=G[ne];J!==null&&(J.lane&=-536870913)}o&=~ce}l!==0&&Kr(e,l,0),m!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=m&~(x&~a))}function Kr(e,a,o){e.pendingLanes|=a,e.suspendedLanes&=~a;var l=31-$t(a);e.entangledLanes|=a,e.entanglements[l]=e.entanglements[l]|1073741824|o&261930}function yn(e,a){var o=e.entangledLanes|=a;for(e=e.entanglements;o;){var l=31-$t(o),d=1<<l;d&a|e[l]&a&&(e[l]|=a),o&=~d}}function vn(e,a){var o=a&-a;return o=(o&42)!==0?1:Ts(o),(o&(e.suspendedLanes|a))!==0?0:o}function Ts(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function sa(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Xu(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Zv(e.type))}function up(e,a){var o=Z.p;try{return Z.p=e,a()}finally{Z.p=o}}var dr=Math.random().toString(36).slice(2),en="__reactFiber$"+dr,bn="__reactProps$"+dr,js="__reactContainer$"+dr,Ku="__reactEvents$"+dr,KS="__reactListeners$"+dr,QS="__reactHandles$"+dr,dp="__reactResources$"+dr,Ko="__reactMarker$"+dr;function Qu(e){delete e[en],delete e[bn],delete e[Ku],delete e[KS],delete e[QS]}function Os(e){var a=e[en];if(a)return a;for(var o=e.parentNode;o;){if(a=o[js]||o[en]){if(o=a.alternate,a.child!==null||o!==null&&o.child!==null)for(e=kv(e);e!==null;){if(o=e[en])return o;e=kv(e)}return a}e=o,o=e.parentNode}return null}function ks(e){if(e=e[en]||e[js]){var a=e.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return e}return null}function Qo(e){var a=e.tag;if(a===5||a===26||a===27||a===6)return e.stateNode;throw Error(s(33))}function Ms(e){var a=e[dp];return a||(a=e[dp]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Qt(e){e[Ko]=!0}var fp=new Set,mp={};function Qr(e,a){Ds(e,a),Ds(e+"Capture",a)}function Ds(e,a){for(mp[e]=a,e=0;e<a.length;e++)fp.add(a[e])}var WS=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2 Line truncated
`).replace(T_,"")}function Sv(e,a){return a=wv(a),wv(e)===a}function yt(e,a,o,l,d,m){switch(o){case"children":typeof l=="string"?a==="body"||a==="textarea"&&l===""||Ls(e,l):(typeof l=="number"||typeof l=="bigint")&&a!=="body"&&Ls(e,""+l);break;case"className":bl(e,"class",l);break;case"tabIndex":bl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":bl(e,o,l);break;case"style":Sp(e,l,m);break;case"data":if(a!=="object"){bl(e,"data",l);break}case"src":case"href":if(l===""&&(a!=="a"||o!=="href")){e.removeAttribute(o);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(o);break}l=wl(""+l),e.setAttribute(o,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof m=="function"&&(o==="formAction"?(a!=="input"&&yt(e,a,"name",d.name,d,null),yt(e,a,"formEncType",d.formEncType,d,null),yt(e,a,"formMethod",d.formMethod,d,null),yt(e,a,"formTarget",d.formTarget,d,null)):(yt(e,a,"encType",d.encType,d,null),yt(e,a,"method",d.method,d,null),yt(e,a,"target",d.target,d,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(o);break}l=wl(""+l),e.setAttribute(o,l);break;case"onClick":l!=null&&(e.onclick=La);break;case"onScroll":l!=null&&Qe("scroll",e);break;case"onScrollEnd":l!=null&&Qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(o=l.__html,o!=null){if(d.children!=null)throw Error(s(60));e.innerHTML=o}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}o=wl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(o,""+l):e.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(o,""):e.removeAttribute(o);break;case"capture":case"download":l===!0?e.setAttribute(o,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(o,l):e.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(o,l):e.removeAttribute(o);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(o):e.setAttribute(o,l);break;case"popover":Qe("beforetoggle",e),Qe("toggle",e),vl(e,"popover",l);break;case"xlinkActuate":za(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":za(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":za(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":za(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":za(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":za(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":za(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":za(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":za(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":vl(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=aE.get(o)||o,vl(e,o,l))}}function If(e,a,o,l,d,m){switch(o){case"style":Sp(e,l,m);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(o=l.__html,o!=null){if(d.children!=null)throw Error(s(60));e.innerHTML=o}}break;case"children":typeof l=="string"?Ls(e,l):(typeof l=="number"||typeof l=="bigint")&&Ls(e,""+l);break;case"onScroll":l!=null&&Qe("scroll",e);break;case"onScrollEnd":l!=null&&Qe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=La);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne Line truncated
* react-router v7.9.5
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/var fb="popstate";function bC(t={}){function n(s,i){let{pathname:c,search:u,hash:f}=s.location;return Um("",{pathname:c,search:u,hash:f},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(s,i){return typeof i=="string"?i:Wi(i)}return wC(n,r,null,t)}function Ct(t,n){if(t===!1||t===null||typeof t>"u")throw new Error(n)}function da(t,n){if(!t){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function xC(){return Math.random().toString(36).substring(2,10)}function mb(t,n){return{usr:t.state,key:t.key,idx:n}}function Um(t,n,r=null,s){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof n=="string"?Bo(n):n,state:r,key:n&&n.key||s||xC()}}function Wi({pathname:t="/",search:n="",hash:r=""}){return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Bo(t){let n={};if(t){let r=t.indexOf("#");r>=0&&(n.hash=t.substring(r),t=t.substring(0,r));let s=t.indexOf("?");s>=0&&(n.search=t.substring(s),t=t.substring(0,s)),t&&(n.pathname=t)}return n}function wC(t,n,r,s={}){let{window:i=document.defaultView,v5Compat:c=!1}=s,u=i.history,f="POP",g=null,h=v();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function v(){return(u.state||{idx:null}).idx}function y(){f="POP";let C=v(),A=C==null?null:C-h;h=C,g&&g({action:f,location:S.location,delta:A})}function w(C,A){f="PUSH";let O=Um(S.location,C,A);h=v()+1;let R=mb(O,h),L=S.createHref(O);try{u.pushState(R,"",L)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(L)}c&&g&&g({action:f,location:S.location,delta:1})}function N(C,A){f="REPLACE";let O=Um(S.location,C,A);h=v();let R=mb(O,h),L=S.createHref(O);u.replaceState(R,"",L),c&&g&&g({action:f,location:S.location,delta:0})}function E(C){return SC(C)}let S={get action(){return f},get location(){return t(i,u)},listen(C){if(g)throw new Error("A history only accepts one active listener");return i.addEventListener(fb,y),g=C,()=>{i.removeEventListener(fb,y),g=null}},createHref(C){return n(i,C)},createURL:E,encodeLocation(C){let A=E(C);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:w,replace:N,go(C){return u.go(C)}};return S}function SC(t,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Ct(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Wi(t);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function cx(t,n,r="/"){return EC(t,n,r,!1)}function EC(t,n,r,s){let i=typeof n=="string"?Bo(n):n,c=ar(i.pathname||"/",r);if(c==null)return null;let u=ux(t);_C(u);let f=null;for(let g=0;f==null&&g<u.length;++g){let h=zC(c);f=MC(u[g],h,s)}return f}function ux(t,n=[],r=[],s="",i=!1){let c=(u,f,g=i,h)=>{let v={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(s)&&g)return;Ct(v.relativePath.startsWith(s),`Absolute route path "${v.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(s.length)}let y=nr([s,v.relativePath]),w=r.concat(v);u.children&&u.children.length>0&&(Ct(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),ux(u.children,n,w,y,g)),!(u.path==null&&!u.index)&&n.push({path:y,score:OC(y,u.index),routesMeta:w})};return t.forEach((u,f)=>{var g;if(u.path===""||!((g=u.path)!=null&&g.includes("?")))c(u,f);else for(let h of dx(u.path))c(u,f,!0,h)}),n}function dx(t){let n=t.split("/");if(n.length===0)return[];let[r,...s]=n,i=r.endsWith("?"),c=r.replace(/\?$/,"");if(s.length===0)return i?[c,""]:[c];let u=dx(s.join("/")),f=[];return f.push(...u.map(g=>g===""?c:[c,g].join("/"))),i&&f.push(...u),f.map(g=>t.startsWith("/")&&g===""?"/":g)}function _C(t){t.sort((n,r)=>n.score!==r.score?r.score-n.score:kC(n.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var CC=/^:[\w-]+$/,NC=3,AC=2,RC=1,TC=10,jC=-2,hb=t=>t==="*";function OC(t,n){let r=t.split("/"),s=r.length;return r.some(hb)&&(s+=jC),n&&(s+=AC),r.filter(i=>!hb(i)).reduce((i,c)=>i+(CC.test(c)?NC:c===""?RC:TC),s)}function kC(t,n){return t.length===n.length&&t.slice(0,-1).every((s,i)=>s===n[i])?t[t.length-1]-n[n.length-1]:0}function MC(t,n,r=!1){let{routesMeta:s}=t,i={},c="/",u=[];for(let f=0;f<s.length;++f){let g=s[f],h=f===s.length-1,v=c==="/"?n:n.slice(c.length)||"/",y=Wc({path:g.relativePath,caseSensitive:g.caseSensitive,end:h},v),w=g.route;if(!y&&h&&r&&!s[s.length-1].route.index&&(y=Wc({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},v)),!y)return null;Object.assign(i,y.params),u.push({params:i,pathname:nr([c,y.pathname]),pathnameBase:PC(nr([c,y.pathnameBase])),route:w}),y.pathnameBase!=="/"&&(c=nr([c,y.pathnameBase]))}return u}function Wc(t,n){typeof t=="string"&&(t={path Line truncated
Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let w=Yr(),N;if(n){let R=typeof n=="string"?Bo(n):n;Ct(v==="/"||((O=R.pathname)==null?void 0:O.startsWith(v)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${v}" but pathname "${R.pathname}" was given in the \`location\` prop.`),N=R}else N=w;let E=N.pathname||"/",S=E;if(v!=="/"){let R=v.replace(/^\//,"").split("/");S="/"+E.replace(/^\//,"").split("/").slice(R.length).join("/")}let C=cx(t,{pathname:S});da(y||C!=null,`No routes matched location "${N.pathname}${N.search}${N.hash}" `),da(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${N.pathname}${N.search}${N.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=n2(C&&C.map(R=>Object.assign({},R,{params:Object.assign({},g,R.params),pathname:nr([v,c.encodeLocation?c.encodeLocation(R.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?v:nr([v,c.encodeLocation?c.encodeLocation(R.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),u,r,s,i);return n&&A?b.createElement(il.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...N},navigationType:"POP"}},A):A}function WC(){let t=i2(),n=IC(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,s="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:s},c={padding:"2px 4px",backgroundColor:s},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:c},"ErrorBoundary")," or"," ",b.createElement("code",{style:c},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},n),r?b.createElement("pre",{style:i},r):null,u)}var JC=b.createElement(WC,null),e2=class extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){this.props.unstable_onError?this.props.unstable_onError(t,n):console.error("React Router caught the following error during render",t)}render(){return this.state.error!==void 0?b.createElement(aa.Provider,{value:this.props.routeContext},b.createElement(gh.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function t2({routeContext:t,match:n,children:r}){let s=b.useContext(Po);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(aa.Provider,{value:t},r)}function n2(t,n=[],r=null,s=null,i=null){if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(n.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let c=t,u=r==null?void 0:r.errors;if(u!=null){let h=c.findIndex(v=>v.route.id&&(u==null?void 0:u[v.route.id])!==void 0);Ct(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,h+1))}let f=!1,g=-1;if(r)for(let h=0;h<c.length;h++){let v=c[h];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(g=h),v.route.id){let{loaderData:y,errors:w}=r,N=v.route.loader&&!y.hasOwnProperty(v.route.id)&&(!w||w[v.route.id]===void 0);if(v.route.lazy||N){f=!0,g>=0?c=c.slice(0,g+1):c=[c[0]];break}}}return c.reduceRight((h,v,y)=>{let w,N=!1,E=null,S=null;r&&(w=u&&v.route.id?u[v.route.id]:void 0,E=v.route.errorElement||JC,f&&(g<0&&y===0?(yx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,S=null):g===y&&(N=!0,S=v.route.hydrateFallbackElement||null)));let C=n.concat(c.slice(0,y+1)),A=()=>{let O;return w?O=E:N?O=S:v.route.Component?O=b.createElement(v.route.Component,null):v.route.element?O=v.route.element:O=h,b.createElement(t2,{match:v,routeContext:{outlet:h,matches:C,isDataRoute:r!=null},children:O})};return r&&(v.route.ErrorBoundary||v.route.errorElement||y===0)?b.createElement(e2,{location:r.loLine truncated
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yN=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vN=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,s)=>s?s.toUpperCase():r.toLowerCase()),bb=t=>{const n=vN(t);return n.charAt(0).toUpperCase()+n.slice(1)},Nx=(...t)=>t.filter((n,r,s)=>!!n&&n.trim()!==""&&s.indexOf(n)===r).join(" ").trim(),bN=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var xN={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wN=b.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:i="",children:c,iconNode:u,...f},g)=>b.createElement("svg",{ref:g,...xN,width:n,height:n,stroke:t,strokeWidth:s?Number(r)*24/Number(n):r,className:Nx("lucide",i),...!c&&!bN(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,v])=>b.createElement(h,v)),...Array.isArray(c)?c:[c]]));/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ot=(t,n)=>{const r=b.forwardRef(({className:s,...i},c)=>b.createElement(wN,{ref:c,iconNode:n,className:Nx(`lucide-${yN(bb(t))}`,`lucide-${t}`,s),...i}));return r.displayName=bb(t),r};/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const SN=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],xb=ot("arrow-left",SN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const EN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],_N=ot("arrow-right",EN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const CN=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Hm=ot("chevron-down",CN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const NN=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wb=ot("chevron-right",NN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const AN=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],RN=ot("chevron-up",AN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const TN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],jN=ot("circle-alert",TN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ON=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Sb=ot("circle-check",ON);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kN=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],MN=ot("ellipsis-vertical",kN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const DN=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],zN=ot("eye-off",DN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const LN=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],UN=ot("eye",LN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const BN=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],PN=ot("funnel",BN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const HN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],VN=ot("globe",HN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const IN=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],qN=ot("layers",IN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const FN=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],$N=ot("layout-dashboard",FN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const GN=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],YN=ot("loader-circle",GN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ZN=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],XN=ot("log-out",ZN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const KN=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],QN=ot("message-square",KN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const WN=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],JN=ot("moon",WN);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Vm=ot("plus",eA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tA=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],nA=ot("power-off",tA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const aA=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Ax=ot("power",aA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rA=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Eb=ot("qr-code",rA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],_b=ot("refresh-cw",sA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const oA=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Cb=ot("save",oA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const iA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],lA=ot("search",iA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cA=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],uA=ot("settings",cA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dA=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],fA=ot("shield",dA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],hA=ot("smartphone",mA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pA=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],gA=ot("sun",pA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yA=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Sh=ot("trash-2",yA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vA=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],bA=ot("triangle-alert",vA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ji=ot("x",xA);/**
* @license lucide-react v0.525.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],SA=ot("zap",wA);class EA extends b.Component{constructor(r){super(r);tb(this,"handleReset",()=>{this.setState({hasError:!1,error:null,errorInfo:null})});this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r,errorInfo:null}}componentDidCatch(r,s){console.error("ErrorBoundary caught an error:",r,s),this.setState({error:r,errorInfo:s})}render(){return this.state.hasError?this.props.fallback?this.props.fallback:p.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gray-50 px-4",children:p.jsxs("div",{className:"w-full max-w-md rounded-lg bg-white p-8 shadow-lg",children:[p.jsx("div",{className:"mb-4 flex items-center justify-center",children:p.jsx("div",{className:"rounded-full bg-red-100 p-3",children:p.jsx(bA,{className:"h-8 w-8 text-red-600"})})}),p.jsx("h1",{className:"mb-2 text-center text-2xl font-bold text-gray-900",children:"Algo deu errado"}),p.jsx("p",{className:"mb-6 text-center text-gray-600",children:"Ocorreu um erro inesperado na aplicação."}),this.state.error&&p.jsxs("div",{className:"mb-6 rounded-md bg-red-50 p-4",children:[p.jsx("p",{className:"text-sm font-medium text-red-800",children:this.state.error.message}),!1]}),p.jsxs("div",{className:"flex gap-3",children:[p.jsx("button",{onClick:this.handleReset,className:"flex-1 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",children:"Tentar novamente"}),p.jsx("button",{onClick:()=>window.location.href="/",className:"flex-1 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",children:"Voltar ao início"})]})]})}):this.props.children}}function Rx(t){var n,r,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(n=0;n<i;n++)t[n]&&(r=Rx(t[n]))&&(s&&(s+=" "),s+=r)}else for(r in t)t[r]&&(s&&(s+=" "),s+=r);return s}function Eh(){for(var t,n,r=0,s="",i=arguments.length;r<i;r++)(t=arguments[r])&&(n=Rx(t))&&(s&&(s+=" "),s+=n);return s}const _A=(t,n)=>{const r=new Array(t.length+n.length);for(let s=0;s<t.length;s++)r[s]=t[s];for(let s=0;s<n.length;s++)r[t.length+s]=n[s];return r},CA=(t,n)=>({classGroupId:t,validator:n}),Tx=(t=new Map,n=null,r)=>({nextPart:t,validators:n,classGroupId:r}),Jc="-",Nb=[],NA="arbitrary..",AA=t=>{const n=TA(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return RA(u);const f=u.split(Jc),g=f[0]===""&&f.length>1?1:0;return jx(f,g,n)},getConflictingClassGroupIds:(u,f)=>{if(f){const g=s[u],h=r[u];return g?h?_A(h,g):g:h||Nb}return r[u]||Nb}}},jx=(t,n,r)=>{if(t.length-n===0)return r.classGroupId;const i=t[n],c=r.nextPart.get(i);if(c){const h=jx(t,n+1,c);if(h)return h}const u=r.validators;if(u===null)return;const f=n===0?t.join(Jc):t.slice(n).join(Jc),g=u.length;for(let h=0;h<g;h++){const v=u[h];if(v.validator(f))return v.classGroupId}},RA=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=t.slice(1,-1),r=n.indexOf(":"),s=n.slice(0,r);return s?NA+s:void 0})(),TA=t=>{const{theme:n,classGroups:r}=t;return jA(r,n)},jA=(t,n)=>{const r=Tx();for(const s in t){const i=t[s];_h(i,r,s,n)}return r},_h=(t,n,r,s)=>{const i=t.length;for(let c=0;c<i;c++){const u=t[c];OA(u,n,r,s)}},OA=(t,n,r,s)=>{if(typeof t=="string"){kA(t,n,r);return}if(typeof t=="function"){MA(t,n,r,s);return}DA(t,n,r,s)},kA=(t,n,r)=>{const s=t===""?n:Ox(n,t);s.classGroupId=r},MA=(t,n,r,s)=>{if(zA(t)){_h(t(s),n,r,s);return}n.validators===null&&(n.validators=[]),n.validators.push(CA(r,t))},DA=(t,n,r,s)=>{const i=Object.entries(t),c=i.length;for(let u=0;u<c;u++){const[f,g]=i[u];_h(g,Ox(n,f),r,s)}},Ox=(t,n)=>{let r=t;const s=n.split(Jc),i=s.length;for(let c=0;c<i;c++){const u=s[c];let f=r.nextPart.get(u);f||(f=Tx(),r.nextPart.set(u,f)),r=f}return r},zA=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,LA=t=>{if(t<1)return{get:()=>{},set:()=>{}};let n=0,r=Object.create(null),s=Object.create(null);const i=(c,u)=>{r[c]=u,n++,n>t&&(n=0,s=r,r=Object.create(null))};return{get(c){let u=r[c];if(u!==void 0)return u;if((u=s[c])!==void 0)return i(c,u),u},set(c,u){c in r?r[c]=u:i(c,u)}}},Im="!",Ab=":",UA=[],Rb=(t,n,r,s,i)=>({modifiers:t,hasImportantModifier:n,baseClassName:r,maybePostfixModifierPosition:s,isExternal:i}),BA=t=>{const{prefix:n,experimentalParseClassName:r}=t;let s=i=>{const c=[];let u=0,f=0,g=0,h;const v=i.length;for(let S=0;S<v;S++){const C=i[S];if(u===0&&f===0){if(C===Ab){c.push(i.slice(g,S)),g=S+1;continue}if(C==="/"){h=S;continue}}C==="["?u++:C==="]"?u--:C==="("?f++:C===")"&&f--}const y=c.length===0?i:i.slice(g);let w=y,N=!1;y.endsWith(ILine truncated
`).forEach(function(u){i=u.indexOf(":"),r=u.substring(0,i).trim().toLowerCase(),s=u.substring(i+1).trim(),!(!r||n[r]&&wT[r])&&(r==="set-cookie"?n[r]?n[r].push(s):n[r]=[s]:n[r]=n[r]?n[r]+", "+s:s)}),n},Lb=Symbol("internals");function qi(t){return t&&String(t).trim().toLowerCase()}function Yc(t){return t===!1||t==null?t:W.isArray(t)?t.map(Yc):String(t)}function ET(t){const n=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(t);)n[s[1]]=s[2];return n}const _T=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ym(t,n,r,s,i){if(W.isFunction(s))return s.call(this,n,r);if(i&&(n=r),!!W.isString(n)){if(W.isString(s))return n.indexOf(s)!==-1;if(W.isRegExp(s))return s.test(n)}}function CT(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(n,r,s)=>r.toUpperCase()+s)}function NT(t,n){const r=W.toCamelCase(" "+n);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+r,{value:function(i,c,u){return this[s].call(this,n,i,c,u)},configurable:!0})})}let Tn=class{constructor(n){n&&this.set(n)}set(n,r,s){const i=this;function c(f,g,h){const v=qi(g);if(!v)throw new Error("header name must be a non-empty string");const y=W.findKey(i,v);(!y||i[y]===void 0||h===!0||h===void 0&&i[y]!==!1)&&(i[y||g]=Yc(f))}const u=(f,g)=>W.forEach(f,(h,v)=>c(h,v,g));if(W.isPlainObject(n)||n instanceof this.constructor)u(n,r);else if(W.isString(n)&&(n=n.trim())&&!_T(n))u(ST(n),r);else if(W.isObject(n)&&W.isIterable(n)){let f={},g,h;for(const v of n){if(!W.isArray(v))throw TypeError("Object iterator must return a key-value pair");f[h=v[0]]=(g=f[h])?W.isArray(g)?[...g,v[1]]:[g,v[1]]:v[1]}u(f,r)}else n!=null&&c(r,n,s);return this}get(n,r){if(n=qi(n),n){const s=W.findKey(this,n);if(s){const i=this[s];if(!r)return i;if(r===!0)return ET(i);if(W.isFunction(r))return r.call(this,i,s);if(W.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(n,r){if(n=qi(n),n){const s=W.findKey(this,n);return!!(s&&this[s]!==void 0&&(!r||ym(this,this[s],s,r)))}return!1}delete(n,r){const s=this;let i=!1;function c(u){if(u=qi(u),u){const f=W.findKey(s,u);f&&(!r||ym(s,s[f],f,r))&&(delete s[f],i=!0)}}return W.isArray(n)?n.forEach(c):c(n),i}clear(n){const r=Object.keys(this);let s=r.length,i=!1;for(;s--;){const c=r[s];(!n||ym(this,this[c],c,n,!0))&&(delete this[c],i=!0)}return i}normalize(n){const r=this,s={};return W.forEach(this,(i,c)=>{const u=W.findKey(s,c);if(u){r[u]=Yc(i),delete r[c];return}const f=n?CT(c):String(c).trim();f!==c&&delete r[c],r[f]=Yc(i),s[f]=!0}),this}concat(...n){return this.constructor.concat(this,...n)}toJSON(n){const r=Object.create(null);return W.forEach(this,(s,i)=>{s!=null&&s!==!1&&(r[i]=n&&W.isArray(s)?s.join(", "):s)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([n,r])=>n+": "+r).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(n){return n instanceof this?n:new this(n)}static concat(n,...r){const s=new this(n);return r.forEach(i=>s.set(i)),s}static accessor(n){const s=(this[Lb]=this[Lb]={accessors:{}}).accessors,i=this.prototype;function c(u){const f=qi(u);s[f]||(NT(i,u),s[f]=!0)}return W.isArray(n)?n.forEach(c):c(n),this}};Tn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);W.reduceDescriptors(Tn.prototype,({value:t},n)=>{let r=n[0].toUpperCase()+n.slice(1);return{get:()=>t,set(s){this[r]=s}}});W.freezeMethods(Tn);function vm(t,n){const r=this||fl,s=n||r,i=Tn.from(s.headers);let c=s.data;return W.forEach(t,function(f){c=f.call(r,c,i.normalize(),n?n.status:void 0)}),i.normalize(),c}function r1(t){return!!(t&&t.__CANCEL__)}function $o(t,n,r){$e.call(this,t??"canceled",$e.ERR_CANCELED,n,r),this.name="CanceledError"}W.inherits($o,$e,{__CANCEL__:!0});function s1(t,n,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?t(r):n(new $e("Request failed with status code "+r.status,[$e.ERR_BAD_REQUEST,$e.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function AT(t){const n=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return n&&n[1]||""}function RT(t,n){t=t||10;const r=new Array(t),s=new Array(t);let i=0,c=0,u;return n=n!==void 0?n:1e3,function(g){const h=Date.now(),v=s[c];u||(u=h),r[i]=g,s[i]=h;let y=c,w=0;for(;y!==i;)w+=r[y++],y=y%t;if(i=(i+1)%t,i===c&&(c=(c+1)%t),h-u<n)return;const N=v&&h-v;return N?Math.round(w*1e3/N):void 0}}function TT(t,n){let r=0,s=1e3/n,i,c;const u=(h,v=Date.now())=>{r=v,i=null,c&&(clearTimeout(c),c=null),t(...h)};return[(...h)=>{const v=Date.now(),y=v-r;y>=s?u(h,v):(i=h,c||(c=setTimeout(()=>{c=null,u(i)},s-y)))},()=>i&&u(i)]}const eu=(t,n,r=3)=>{let s=0;const i=RT(50,250);return TT(c=>{const u=c.loaded,f=c.lengthComputable?c.total:void 0,g=u-s,h=i(g),v=u<=f;s=u;const y={loaded:u,total:f,progress:f?u/f:void 0,bytes:g,rate:h||void 0,estimated:h&&f&&v?(f-u)/h:void 0,event:c,lengthComputable:f!=null,[n?"download":"upload"]:!0};t(y)},r)},Ub=(t,n)=>{const r=t!=null;return[s=>n[0]({lengthComputable:r,total:t,loaded:s}),n[1]]},Bb=t=>(...n)=>W.asap(()=>t(...n)),jT=un.hasStandardBrowserEnv?((t,n)=>r=>(r=new URL(r,un.origin),t.protocol===r.protocol&&t.host===r.host&&(n||t.port===r.port)))(new URL(un.origin),un.navigator&&/(msie|trident)/i.test(un.navigator.userAgent)):()=>!0,OT=un.hasStandardBrowserEnv?{write(t,n,r,s,i,c,u){if(typeof document>"u")return;const f=[`${t}=${encodeURIComponent(n)}`];W.isNumber(r)&&f.push(`expires=${new Date(r).toUTCString()}`),W.isString(s)&&f.push(`path=${s}`),W.isString(i)&&f.push(`domain=${i}`),c===!0&&f.push("secure"),W.isString(u)&&f.push(`SameSite=${u}`),document.cookie=f.join("; ")},read(t){if(typeof document>"u")return null;const n=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return n?decodeURIComponent(n[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function kT(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function MT(t,n){return n?t.replace(/\/?\/$/,"")+"/"+n.replace(/^\/+/,""):t}function o1(t,n,r){let s=!kT(n);return t&&(s||r==!1)?MT(t,n):n}const Pb=t=>t instanceof Tn?{...t}:t;function bs(t,n){n=n||{};const r={};function s(h,v,y,w){return W.isPlainObject(h)&&W.isPlainObject(v)?W.merge.call({caseless:w},h,v):W.isPlainObject(v)?W.merge({},v):W.isArray(v)?v.slice():v}function i(h,v,y,w){if(W.isUndefined(v)){if(!W.isUndefined(h))return s(void 0,h,y,w)}else return s(h,v,y,w)}function c(h,v){if(!W.isUndefined(v))return s(void 0,v)}function u(h,v){if(W.isUndefined(v)){if(!W.isUndefined(h))return s(void 0,h)}else return s(void 0,v)}function f(h,v,y){if(y in n)return s(h,v);if(y in t)return s(void 0,h)}const g={url:c,method:c,data:c,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:f,headers:(h,v,y)=>i(Pb(h),Pb(v),y,!0)};return W.forEach(Object.keys({...t,...n}),function(v){const y=g[v]||i,w=y(t[v],n[v],v);W.isUndefined(w)&&y!==f||(r[v]=w)}),r}const i1=t=>{const n=bs({},t);let{data:r,withXSRFToken:s,xsrfHeaderName:i,xsrfCookieName:c,headers:u,auth:f}=n;if(n.headers=u=Tn.from(u),n.url=t1(o1(n.baseURL,n.url,n.allowAbsoluteUrls),t.params,t.paramsSerializer),f&&u.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),W.isFormData(r)){if(un.hasStandardBrowserEnv||un.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(W.isFunction(r.getHeaders)){const g=r.getHeaders(),h=["content-type","content-length"];Object.entries(g).forEach(([v,y])=>{h.inclu Line truncated
`+u.map($b).join(`
`):" "+$b(u[0]):"as no adapter specified";throw new $e("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return i}const c1={getAdapter:FT,adapters:Rh};function bm(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new $o(null,t)}function Gb(t){return bm(t),t.headers=Tn.from(t.headers),t.data=vm.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),c1.getAdapter(t.adapter||fl.adapter,t)(t).then(function(s){return bm(t),s.data=vm.call(t,t.transformResponse,s),s.headers=Tn.from(s.headers),s},function(s){return r1(s)||(bm(t),s&&s.response&&(s.response.data=vm.call(t,t.transformResponse,s.response),s.response.headers=Tn.from(s.response.headers))),Promise.reject(s)})}const u1="1.13.2",Ou={};["object","boolean","number","function","string","symbol"].forEach((t,n)=>{Ou[t]=function(s){return typeof s===t||"a"+(n<1?"n ":" ")+t}});const Yb={};Ou.transitional=function(n,r,s){function i(c,u){return"[Axios v"+u1+"] Transitional option '"+c+"'"+u+(s?". "+s:"")}return(c,u,f)=>{if(n===!1)throw new $e(i(u," has been removed"+(r?" in "+r:"")),$e.ERR_DEPRECATED);return r&&!Yb[u]&&(Yb[u]=!0,console.warn(i(u," has been deprecated since v"+r+" and will be removed in the near future"))),n?n(c,u,f):!0}};Ou.spelling=function(n){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${n}`),!0)};function $T(t,n,r){if(typeof t!="object")throw new $e("options must be an object",$e.ERR_BAD_OPTION_VALUE);const s=Object.keys(t);let i=s.length;for(;i-- >0;){const c=s[i],u=n[c];if(u){const f=t[c],g=f===void 0||u(f,c,t);if(g!==!0)throw new $e("option "+c+" must be "+g,$e.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new $e("Unknown option "+c,$e.ERR_BAD_OPTION)}}const Zc={assertOptions:$T,validators:Ou},_a=Zc.validators;let vs=class{constructor(n){this.defaults=n||{},this.interceptors={request:new zb,response:new zb}}async request(n,r){try{return await this._request(n,r)}catch(s){if(s instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const c=i.stack?i.stack.replace(/^.+\n/,""):"";try{s.stack?c&&!String(s.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(s.stack+=`
`+c):s.stack=c}catch{}}throw s}}_request(n,r){typeof n=="string"?(r=r||{},r.url=n):r=n||{},r=bs(this.defaults,r);const{transitional:s,paramsSerializer:i,headers:c}=r;s!==void 0&&Zc.assertOptions(s,{silentJSONParsing:_a.transitional(_a.boolean),forcedJSONParsing:_a.transitional(_a.boolean),clarifyTimeoutError:_a.transitional(_a.boolean)},!1),i!=null&&(W.isFunction(i)?r.paramsSerializer={serialize:i}:Zc.assertOptions(i,{encode:_a.function,serialize:_a.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Zc.assertOptions(r,{baseUrl:_a.spelling("baseURL"),withXsrfToken:_a.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let u=c&&W.merge(c.common,c[r.method]);c&&W.forEach(["delete","get","head","post","put","patch","common"],E=>{delete c[E]}),r.headers=Tn.concat(u,c);const f=[];let g=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(r)===!1||(g=g&&S.synchronous,f.unshift(S.fulfilled,S.rejected))});const h=[];this.interceptors.response.forEach(function(S){h.push(S.fulfilled,S.rejected)});let v,y=0,w;if(!g){const E=[Gb.bind(this),void 0];for(E.unshift(...f),E.push(...h),w=E.length,v=Promise.resolve(r);y<w;)v=v.then(E[y++],E[y++]);return v}w=f.length;let N=r;for(;y<w;){const E=f[y++],S=f[y++];try{N=E(N)}catch(C){S.call(this,C);break}}try{v=Gb.call(this,N)}catch(E){return Promise.reject(E)}for(y=0,w=h.length;y<w;)v=v.then(h[y++],h[y++]);return v}getUri(n){n=bs(this.defaults,n);const r=o1(n.baseURL,n.url,n.allowAbsoluteUrls);return t1(r,n.params,n.paramsSerializer)}};W.forEach(["delete","get","head","options"],function(n){vs.prototype[n]=function(r,s){return this.request(bs(s||{},{method:n,url:r,data:(s||{}).data}))}});W.forEach(["post","put","patch"],function(n){function r(s){return function(c,u,f){return this.request(bs(f||{},{method:n,headers:s?{"Content-Type":"multipart/form-data"}:{},url:c,data:u}))}}vs.prototype[n]=r(),vs.prototype[n+"Form"]=r(!0)});let GT=class d1{constructor(n){if(typeof n!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(c){r=c});const s=this;this.promise.then(i=>{if(!s._listeners)return;let c=s._listeners.length;for(;c-- >0;)s._listeners[c](i);s._listeners=null}),this.promise.then=i=>{let c;const u=new Promise(f=>{s.subscribe(f),c=f}).then(i);return u.cancel=function(){s.unsubscribe(c)},u},n(function(c,u,f){s.reason||(s.reason=new $o(c,u,f),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]}unsubscribe(n){if(!this._listeners)return;const r=this._listeners.indexOf(n);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const n=new AbortController,r=s=>{n.abort(s)};return this.subscribe(r),n.signal.unsubscribe=()=>this.unsubscribe(r),n.signal}static source(){let n;return{token:new d1(function(i){n=i}),cancel:n}}};function YT(t){return function(r){return t.apply(null,r)}}function ZT(t){return W.isObject(t)&&t.isAxiosError===!0}const Zm={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Zm).forEach(([t,n])=>{Zm[n]=t});function f1(t){const n=new vs(t),r=qx(vs.prototype.request,n);return W.extend(r,vs.prototype,n,{allOwnKeys:!0}),W.extend(r,n,null,{allOwnKeys:!0}),r.create=function(i){return f1(bs(t,i))},r}const zt=f1(fl);zt.Axios=vs;zt.CanceledError=$o;zt.CancelToken=GT;zt.isCancel=r1;zt.VERSION=u1;zt.toFormData=ju;zt.AxiosError=$e;zt.Cancel=zt.CanceledError;zt.all=function(n){return Promise.all(n)};zt.spread=YT;zt.isAxiosError=ZT;zt.mergeConfig=bs;zt.AxiosH Line truncated
* @license lucide-react v0.522.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ej=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_j=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,s)=>s?s.toUpperCase():r.toLowerCase()),Kb=t=>{const n=_j(t);return n.charAt(0).toUpperCase()+n.slice(1)},y1=(...t)=>t.filter((n,r,s)=>!!n&&n.trim()!==""&&s.indexOf(n)===r).join(" ").trim(),Cj=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};/**
* @license lucide-react v0.522.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var Nj={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.522.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Aj=b.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:i="",children:c,iconNode:u,...f},g)=>b.createElement("svg",{ref:g,...Nj,width:n,height:n,stroke:t,strokeWidth:s?Number(r)*24/Number(n):r,className:y1("lucide",i),...!c&&!Cj(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,v])=>b.createElement(h,v)),...Array.isArray(c)?c:[c]]));/**
* @license lucide-react v0.522.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Rj=(t,n)=>{const r=b.forwardRef(({className:s,...i},c)=>b.createElement(Aj,{ref:c,iconNode:n,className:y1(`lucide-${Ej(Kb(t))}`,`lucide-${t}`,s),...i}));return r.displayName=Kb(t),r};/**
* @license lucide-react v0.522.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Tj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jj=Rj("x",Tj),Qb=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Wb=Eh,Oh=(t,n)=>r=>{var s;if((n==null?void 0:n.variants)==null)return Wb(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:c}=n,u=Object.keys(i).map(h=>{const v=r==null?void 0:r[h],y=c==null?void 0:c[h];if(v===null)return null;const w=Qb(v)||Qb(y);return i[h][w]}),f=r&&Object.entries(r).reduce((h,v)=>{let[y,w]=v;return w===void 0||(h[y]=w),h},{}),g=n==null||(s=n.compoundVariants)===null||s===void 0?void 0:s.reduce((h,v)=>{let{class:y,className:w,...N}=v;return Object.entries(N).every(E=>{let[S,C]=E;return Array.isArray(C)?C.includes({...c,...f}[S]):{...c,...f}[S]===C})?[...h,y,w]:h},[]);return Wb(t,u,g,r==null?void 0:r.class,r==null?void 0:r.className)};function rr(t){const n=b.useRef(t);return b.useEffect(()=>{n.current=t}),b.useMemo(()=>(...r)=>{var s;return(s=n.current)==null?void 0:s.call(n,...r)},[])}function Oj(t,n=globalThis==null?void 0:globalThis.document){const r=rr(t);b.useEffect(()=>{const s=i=>{i.key==="Escape"&&r(i)};return n.addEventListener("keydown",s,{capture:!0}),()=>n.removeEventListener("keydown",s,{capture:!0})},[r,n])}var kj="DismissableLayer",Xm="dismissableLayer.update",Mj="dismissableLayer.pointerDownOutside",Dj="dismissableLayer.focusOutside",Jb,v1=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ku=b.forwardRef((t,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...g}=t,h=b.useContext(v1),[v,y]=b.useState(null),w=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,N]=b.useState({}),E=Zt(n,U=>y(U)),S=Array.from(h.layers),[C]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),A=S.indexOf(C),O=v?S.indexOf(v):-1,R=h.layersWithOutsidePointerEventsDisabled.size>0,L=O>=A,I=Uj(U=>{const Q=U.target,le=[...h.branches].some(ue=>ue.contains(Q));!L||le||(i==null||i(U),u==null||u(U),U.defaultPrevented||f==null||f())},w),ee=Bj(U=>{const Q=U.target;[...h.branches].some(ue=>ue.contains(Q))||(c==null||c(U),u==null||u(U),U.defaultPrevented||f==null||f())},w);return Oj(U=>{O===h.layers.size-1&&(s==null||s(U),!U.defaultPrevented&&f&&(U.preventDefault(),f()))},w),b.useEffect(()=>{if(v)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Jb=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(v)),h.layers.add(v),e0(),()=>{r&&h.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=Jb)}},[v,w,r,h]),b.useEffect(()=>()=>{v&&(h.layers.delete(v),h.layersWithOutsidePointerEventsDisabled.delete(v),e0())},[v,h]),b.useEffect(()=>{const U=()=>N({});return document.addEventListener(Xm,U),()=>document.removeEventListener(Xm,U)},[]),p.jsx(jt.div,{...g,ref:E,style:{pointerEvents:R?L?"auto":"none":void 0,...t.style},onFocusCapture:Ve(t.onFocusCapture,ee.onFocusCapture),onBlurCapture:Ve(t.onBlurCapture,ee.onBlurCapture),onPointerDownCapture:Ve(t.onPointerDownCapture,I.onPointerDownCapture)})});ku.displayName=kj;var zj="DismissableLayerBranch",Lj=b.forwardRef((t,n)=>{const r=b.useContext(v1),s=b.useRef(null),i=Zt(n,s);return b.useEffect(()=>{const c=s.current;if(c)return r.branches.add(c),()=>{r.branches.delete(c)}},[r.branches]),p.jsx(jt.div,{...t,ref:i})});Lj.displayName=zj;function Uj(t,n=globalThis==null?void 0:globalThis.document){const r=rr(t),s=b.useRef(!1),i=b.useRef(()=>{});return b.useEffect(()=>{const c=f=>{if(f.target&&!s.current){let g=function(){b1(Mj,r,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(n.removeEventListener("click",i.current),i.current=g,n.addEventListener("click",i.current,{once:!0})):g()}else n.removeEventListener("click",i.current);s.current=!1},u=window.setTimeout(()=>{n.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),n.removeEventListener("pointerdown",c),n.removeEventListener("click",i.current)}},[n,r]),{onPointerDownCapture:()=>s.current=!0}}function Bj(t,n=globalThis==null?void 0:globalThis.document){const r=rr(t),s=b.useRef(!1);return b.useEffect(()=>{const i=c=>{c.target&&!s.current&&b1(Dj,r,{originalEvent:c},{discrete:!1})};return n.addEventListener("focusin",i),()=>n.removeEventListener("focusin",i)},[n,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function e0(){const t=new CustomEvent(Xm);document.dispatchEvent(t)}function b1(t,n,r,{discrete:s}){const i=r.originalEvent.target,c=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});n&&i.addEventListener(t,n,{once:!0}),s?p1(i,c):i.dispatchEvent(c)}var xm="focusScope.autoFocusOnMount",wm="focusScope.autoFocusOnUnmount",t0={bubbles:!1,cancelable:!0},Pj="FocusScope",Mu=b.forwardRef((t,n)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:c,...u}=t,[f,g]=b.useState(null),h=rr(i),v=rr(c),y=b.useRef(null),w=Zt(n,S=>Line truncated
.`.concat(Zj,` {
overflow: hidden `).concat(s,`;
padding-right: `).concat(f,"px ").concat(s,`;
}
body[`).concat(No,`] {
overflow: hidden `).concat(s,`;
overscroll-behavior: contain;
`).concat([n&&"position: relative ".concat(s,";"),r==="margin"&&`
padding-left: `.concat(i,`px;
padding-top: `).concat(c,`px;
padding-right: `).concat(u,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(f,"px ").concat(s,`;
`),r==="padding"&&"padding-right: ".concat(f,"px ").concat(s,";")].filter(Boolean).join(""),`
}
.`).concat(Xc,` {
right: `).concat(f,"px ").concat(s,`;
}
.`).concat(Kc,` {
margin-right: `).concat(f,"px ").concat(s,`;
}
.`).concat(Xc," .").concat(Xc,` {
right: 0 `).concat(s,`;
}
.`).concat(Kc," .").concat(Kc,` {
margin-right: 0 `).concat(s,`;
}
body[`).concat(No,`] {
`).concat(Xj,": ").concat(f,`px;
}
`)},i0=function(){var t=parseInt(document.body.getAttribute(No)||"0",10);return isFinite(t)?t:0},hO=function(){b.useEffect(function(){return document.body.setAttribute(No,(i0()+1).toString()),function(){var t=i0()-1;t<=0?document.body.removeAttribute(No):document.body.setAttribute(No,t.toString())}},[])},pO=function(t){var n=t.noRelative,r=t.noImportant,s=t.gapMode,i=s===void 0?"margin":s;hO();var c=b.useMemo(function(){return dO(i)},[i]);return b.createElement(fO,{styles:mO(c,!n,i,r?"":"!important")})},Km=!1;if(typeof window<"u")try{var Lc=Object.defineProperty({},"passive",{get:function(){return Km=!0,!0}});window.addEventListener("test",Lc,Lc),window.removeEventListener("test",Lc,Lc)}catch{Km=!1}var go=Km?{passive:!1}:!1,gO=function(t){return t.tagName==="TEXTAREA"},C1=function(t,n){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!gO(t)&&r[n]==="visible")},yO=function(t){return C1(t,"overflowY")},vO=function(t){return C1(t,"overflowX")},l0=function(t,n){var r=n.ownerDocument,s=n;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=N1(t,s);if(i){var c=A1(t,s),u=c[1],f=c[2];if(u>f)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},bO=function(t){var n=t.scrollTop,r=t.scrollHeight,s=t.clientHeight;return[n,r,s]},xO=function(t){var n=t.scrollLeft,r=t.scrollWidth,s=t.clientWidth;return[n,r,s]},N1=function(t,n){return t==="v"?yO(n):vO(n)},A1=function(t,n){return t==="v"?bO(n):xO(n)},wO=function(t,n){return t==="h"&&n==="rtl"?-1:1},SO=function(t,n,r,s,i){var c=wO(t,window.getComputedStyle(n).direction),u=c*s,f=r.target,g=n.contains(f),h=!1,v=u>0,y=0,w=0;do{if(!f)break;var N=A1(t,f),E=N[0],S=N[1],C=N[2],A=S-C-c*E;(E||A)&&N1(t,f)&&(y+=A,w+=E);var O=f.parentNode;f=O&&O.nodeType===Node.DOCUMENT_FRAGMENT_NODE?O.host:O}while(!g&&f!==document.body||g&&(n.contains(f)||n===f));return(v&&Math.abs(y)<1||!v&&Math.abs(w)<1)&&(h=!0),h},Uc=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},c0=function(t){return[t.deltaX,t.deltaY]},u0=function(t){return t&&"current"in t?t.current:t},EO=function(t,n){return t[0]===n[0]&&t[1]===n[1]},_O=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},CO=0,yo=[];function NO(t){var n=b.useRef([]),r=b.useRef([0,0]),s=b.useRef(),i=b.useState(CO++)[0],c=b.useState(_1)[0],u=b.useRef(t);b.useEffect(function(){u.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=Yj([t.lockRef.current],(t.shards||[]).map(u0),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var f=b.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var A=Uc(S),O=r.current,R="deltaX"in S?S.deltaX:O[0]-A[0],L="deltaY"in S?S.deltaY:O[1]-A[1],I,ee=S.target,U=Math.abs(R)>Math.abs(L)?"h":"v";if("touches"in S&&U==="h"&&ee.type==="range")return!1;var Q=l0(U,ee);if(!Q)return!0;if(Q?I=U:(I=U==="v"?"h":"v",Q=l0(U,ee)),!Q)return!1;if(!s.current&&"changedTouches"in S&&(R||L)&&(s.current=I),!I)return!0;var le=s.current||I;return SO(le,C,S,le==="h"?R:L)},[]),g=b.useCallback(function(S){var C=S;if(!(!yo.length||yo[yo.length-1]!==c)){var A="deltaY"in C?c0(C):Uc(C),O=n.current.filter(function(I){return I.name===C.type&&(I.target===C.target||C.target===I.shadowParent)&&EO(I.delta,A)})[0];if(O&&O.should){C.cancelable&&C.preventDefault();return}if(!O){var R=(u.current.shards||[]).map(u0).filter(Boolean).filter(function(I){return I.contains(C.target)}),L=R.length>0?f(C,R[0]):!u.current.noIsolation;L&&C.cancelable&&C.preventDefault()}}},[]),h=b.useCallback(function(S,C,A,O){var R={name:S,delta:C,target:A,should:O,shadowParent:AO(A)};n.current.push(R),setTimeout(function(){n.current=n.current.filter(function(L){return L!==R})},1)},[]),v=b.useCallback(function(S){r.current=Uc(S),s.current=void 0},[]),y=b.useCallback(function(S){h(S.type,c0(S),S.target,f(S,t.lockRef.current))},[]),w=b.useCallback(function(S){h(S.type,Uc(S),S.target,f(S,t.lockRef.current))},[]);b.useEffect(function(){return yo.push(c),t.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:w}),document.addEventListener("wheel",g,go),document.addEventListener("touchmove",g,go),document.addEventListener("touchstart",v,go),function(){yo=yo.filter(function(S){return S!==c}),document.removeEventListener("wheel",g,go),document.removeEventListener("touchmove",g,go),document.removeEventListener("touchstart",v,go)}},[]);var N=t.removeScrollBar,E=t.inert;return b.createElement(b.Fragment,null,E?b.createElement(c,{styles:_O(i)}):null,N?b.createElement(pO,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function AO(t){for(var n=null;t!==null;)t instanceof ShadowRoot&&(n=t.host,t=t.host),t=t.parentNode;return n}const RO=nO(E1,NO);var Lu=b.forwardRef(function(t,n){return b.createElement(zu,Aa({},t,{ref:n,sideCar:RO}))});Lu.classNames=zu.classNames;var TO=function(t){if(typeof document>"u")return null;var n=Array.isArray(t)?t[0]:t;return n.ownerDocument.body},vo=new WeakMap,Bc=new WeakMap,Pc={},Nm=0,R1=function(t){return t&&(t.host||R1(t.parentNode))},jO=function(t,n){return n.map(function(r){if(t.contains(r))return r;var s=R1(r);return s&&t.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},OO=function(t,n,r,s){var i=jO(n,Array.isArray(t)?t:[t]);Pc[r]||(Pc[r]=new WeakMap);var c=Pc[r],u=[],f=new Set,g=new Set(i),h=function(y){!y||f.has(y)||(f.add(y),h(y.parentNode))};i.forEach(h);var v=function(y){!y||g.has(y)||Array.prototype.forEach.call(y.children,function(w){if(f.has(w))v(w);else try{var N=w.getAttribute(s),E=N!==null&&N!=="false",S=(vo.get(w)||0)+1,C=(c.get(w)||0)+1;vo.set(w,S),c.set(w,C),u.push(w),S===1&&E&&Bc.set(w,!0),C===1&&w.setAttribute(r,"true"),E||w.setAttribute(s,"true")}catch(A){console.error("aria-hidden: cannot operate on ",w,A)}})};return v(n),f.clear(),Nm++,function(){u.forEach(function(y){var w=vo.get(y)-1,N=c.get(y)-1;vo.set(y,w),c.set(y,N),w||(Bc.has(y)||y.removeAttribute(s),Bc.delete(y)),N||y.removeAttribute(r)}),Nm--,Nm||(vo=new WeakMap,vo=new WeakMap,Bc=new WeakMap,Pc={})}},Mh=function(t,n,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),i=TO(t);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live], script"))),OO(s,i,r,"aria-hidden")):function(){return null}};function kO(t){const n=MO(t),r=b.forwardRef((s,i)=>{const{children:c,...u}=s,f=b.Children.toArray(c),g=f.find(zO);if(g){const h=g.props.children,v=f.map(y=>y===g?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:y);return p.jsx(n,{...u,ref:i,children:b.isValidElement(h)?b.cloneElement(h,void 0,v):null})}return p.jsx(n,{...u,ref:i,children:c})});return r.displayName=`${t}.Slot`,r}function MO(t){const n=b.forwardRef((r,s)=>{const{children:i,...c}=r;if(b.isValidElement(i)){const u=UO(i),f=LO(c,i.props);return i.type!==b. Line truncated
If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},GO="DialogDescriptionWarning",YO=({contentRef:t,descriptionId:n})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${q1(GO).contentName}}.`;return b.useEffect(()=>{var c;const i=(c=t.current)==null?void 0:c.getAttribute("aria-describedby");n&&i&&(document.getElementById(n)||console.warn(s))},[s,t,n]),null},ZO=j1,XO=M1,F1=D1,$1=z1,KO=U1,QO=P1,WO=V1,JO=Symbol.for("react.lazy"),nu=_u[" use ".trim().toString()];function ek(t){return typeof t=="object"&&t!==null&&"then"in t}function G1(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===JO&&"_payload"in t&&ek(t._payload)}function Y1(t){const n=tk(t),r=b.forwardRef((s,i)=>{let{children:c,...u}=s;G1(c)&&typeof nu=="function"&&(c=nu(c._payload));const f=b.Children.toArray(c),g=f.find(ak);if(g){const h=g.props.children,v=f.map(y=>y===g?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:y);return p.jsx(n,{...u,ref:i,children:b.isValidElement(h)?b.cloneElement(h,void 0,v):null})}return p.jsx(n,{...u,ref:i,children:c})});return r.displayName=`${t}.Slot`,r}var Z1=Y1("Slot");function tk(t){const n=b.forwardRef((r,s)=>{let{children:i,...c}=r;if(G1(i)&&typeof nu=="function"&&(i=nu(i._payload)),b.isValidElement(i)){const u=sk(i),f=rk(c,i.props);return i.type!==b.Fragment&&(f.ref=s?lr(s,u):u),b.cloneElement(i,f)}return b.Children.count(i)>1?b.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var nk=Symbol("radix.slottable");function ak(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===nk}function rk(t,n){const r={...n};for(const s in n){const i=t[s],c=n[s];/^on[A-Z]/.test(s)?i&&c?r[s]=(...f)=>{const g=c(...f);return i(...f),g}:i&&(r[s]=i):s==="style"?r[s]={...i,...c}:s==="className"&&(r[s]=[i,c].filter(Boolean).join(" "))}return{...t,...r}}function sk(t){var s,i;let n=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function ok(t){const[n,r]=b.useState(void 0);return Ir(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const c=i[0];let u,f;if("borderBoxSize"in c){const g=c.borderBoxSize,h=Array.isArray(g)?g[0]:g;u=h.inlineSize,f=h.blockSize}else u=t.offsetWidth,f=t.offsetHeight;r({width:u,height:f})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else r(void 0)},[t]),n}const ik=["top","right","bottom","left"],qr=Math.min,Bn=Math.max,au=Math.round,Hc=Math.floor,ja=t=>({x:t,y:t}),lk={left:"right",right:"left",bottom:"top",top:"bottom"},ck={start:"end",end:"start"};function Qm(t,n,r){return Bn(t,qr(n,r))}function sr(t,n){return typeof t=="function"?t(n):t}function or(t){return t.split("-")[0]}function Go(t){return t.split("-")[1]}function Uh(t){return t==="x"?"y":"x"}function Bh(t){return t==="y"?"height":"width"}const uk=new Set(["top","bottom"]);function Ta(t){return uk.has(or(t))?"y":"x"}function Ph(t){return Uh(Ta(t))}function dk(t,n,r){r===void 0&&(r=!1);const s=Go(t),i=Ph(t),c=Bh(i);let u=i==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return n.reference[c]>n.floating[c]&&(u=ru(u)),[u,ru(u)]}function fk(t){const n=ru(t);return[Wm(t),n,Wm(n)]}function Wm(t){return t.replace(/start|end/g,n=>ck[n])}const d0=["left","right"],f0=["right","left"],mk=["top","bottom"],hk=["bottom","top"];function pk(t,n,r){switch(t){case"top":case"bottom":return r?n?f0:d0:n?d0:f0;case"left":case"right":return n?mk:hk;default:return[]}}function gk(t,n,r,s){const i=Go(t);let c=pk(or(t),r==="start",s);return i&&(c=c.map(u=>u+"-"+i),n&&(c=c.concat(c.map(Wm)))),c}function ru(t){return t.replace(/left|right|bottom|top/g,n=>lk[n])}function yk(t){return{top:0,right:0,bottom:0,left:0,...t}}function X1(t){return typeof t!="number"?yk(t):{top:t,right:t,bottom:t,left:t}}function su(t){const{x:n,y:r,width:s,height:i}=t;return{width:s,height:i,top:r,left:n,right:n+s,bottom:r+i,x:n,y:r}}function m0(t,n,r){let{reference:s,floating:i}=t;const c=Ta(n),u=Ph(n),f=Bh(u),g=or(n),h=c==="y",v=s.x+s.width/2-i.width/2,y=s.y+s.height/2-i.height/2,w=s[f]/2-i[f]/2;let N;switch(g){case"top":N={x:v,y:s.y-i.height};break;case"bottom":N={x:v,y:s.y+s.height};break;case"right":N={x:s.x+s.width,y};break;case"left":N={x:s.x-i.width,y};break;default:N={x:s.x,y:s.y}}switch(Go(n)){case"start":N[u]-=w*(r&&h?-1:1);break;case"end":N[u]+=w*(r&&h?-1:1);break}return N}const vk=async(t,n,r)=>{const{placement:s="bottom",strategy:i="absolute",middleware:c=[],platform:u}=r,f=c.filter(Boolean),g=await(u.isRTL==null?void 0:u.isRTL(n));let h=await u.getElementRects({reference:t,floating:n,st Line truncated
[data-state=closed]
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function zD(t,n){typeof t=="function"?t(n):t!=null&&(t.current=n)}function LD(...t){return n=>t.forEach(r=>zD(r,n))}function Yw(...t){return b.useCallback(LD(...t),t)}const E0=t=>{switch(t){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return t}};function jm(t,n){if(!t)return()=>{};const r=t.style.cssText;return Object.assign(t.style,n),()=>{t.style.cssText=r}}function UD(...t){return(...n)=>{for(const r of t)typeof r=="function"&&r(...n)}}const Om={DURATION:.5,EASE:[.32,.72,0,1]},BD=8,PD=26,HD=()=>()=>{};function VD(){const{direction:t,isOpen:n,shouldScaleBackground:r,setBackgroundColorOnScale:s,noBodyStyles:i}=$u(),c=ae.useRef(null),u=b.useMemo(()=>document.body.style.backgroundColor,[]);function f(){return(window.innerWidth-PD)/window.innerWidth}ae.useEffect(()=>{if(n&&r){c.current&&clearTimeout(c.current);const g=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!g)return;UD(s&&!i?jm(document.body,{background:"black"}):HD,jm(g,{transformOrigin:E0(t)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Om.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Om.EASE.join(",")})`}));const h=jm(g,{borderRadius:`${BD}px`,overflow:"hidden",...E0(t)?{transform:`scale(${f()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${f()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{h(),c.current=window.setTimeout(()=>{u?document.body.style.background=u:document.body.style.removeProperty("background")},Om.DURATION*1e3)}}},[n,r,u])}const ID=ae.forwardRef(function({...t},n){const{overlayRef:r,snapPoints:s,onRelease:i,shouldFade:c,isOpen:u,modal:f,shouldAnimate:g}=$u(),h=Yw(n,r),v=s&&s.length>0;if(!f)return null;const y=ae.useCallback(w=>i(w),[i]);return ae.createElement(F1,{onMouseUp:y,ref:h,"data-vaul-overlay":"","data-vaul-snap-points":u&&v?"true":"false","data-vaul-snap-points-overlay":u&&c?"true":"false","data-vaul-animate":g!=null&&g.current?"true":"false",...t})});ID.displayName="Drawer.Overlay";const qD=ae.forwardRef(function({onPointerDownOutside:t,style:n,onOpenAutoFocus:r,...s},i){const{drawerRef:c,onPress:u,onRelease:f,onDrag:g,keyboardIsOpen:h,snapPointsOffset:v,activeSnapPointIndex:y,modal:w,isOpen:N,direction:E,snapPoints:S,container:C,handleOnly:A,shouldAnimate:O,autoFocus:R}=$u(),[L,I]=ae.useState(!1),ee=Yw(i,c),U=ae.useRef(null),Q=ae.useRef(null),le=ae.useRef(!1),ue=S&&S.length>0;VD();const me=(X,he,be=0)=>{if(le.current)return!0;const j=Math.abs(X.y),Z=Math.abs(X.x),P=Z>j,se=["bottom","right"].includes(he)?1:-1;if(he==="left"||he==="right"){if(!(X.x*se<0)&&Z>=0&&Z<=be)return P}else if(!(X.y*se<0)&&j>=0&&j<=be)return!P;return le.current=!0,!0};ae.useEffect(()=>{ue&&window.requestAnimationFrame(()=>{I(!0)})},[]);function re(X){U.current=null,le.current=!1,f(X)}return ae.createElement($1,{"data-vaul-drawer-direction":E,"data-vaul-drawer":"","data-vaul-delayed-snap-points":L?"true":"false","data-vaul-snap-points":N&&ue?"true":"false","data-vaul-custom-container":C?"true":"false","data-vaul-animate":O!=null&&O.current?"true":"false",...s,ref:ee,style:v&&v.length>0?{"--snap-point-height":`${v[y??0]}px`,...n}:n,onPointerDown:X=>{A||(s.onPointerDown==null||s.onPointerDown.call(s,X),U.current={x:X.pageX,y:X.pageY},u(X))},onOpenAutoFocus:X=>{r==null||r(X),R||X.preventDefault()},onPointerDownOutside:X=>{if Line truncated
[data-input-otp] {
--nojs-bg: white !important;
--nojs-fg: black !important;
background-color: var(--nojs-bg) !important;
color: var(--nojs-fg) !important;
caret-color: var(--nojs-fg) !important;
letter-spacing: .25em !important;
text-align: center !important;
border: 1px solid var(--nojs-fg) !important;
border-radius: 4px !important;
width: 100% !important;
}
@media (prefers-color-scheme: dark) {
[data-input-otp] {
--nojs-bg: black !important;
--nojs-fg: white !important;
}
}`;function cz(t){const n=uz(t),r=b.forwardRef((s,i)=>{const{children:c,...u}=s,f=b.Children.toArray(c),g=f.find(fz);if(g){const h=g.props.children,v=f.map(y=>y===g?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:y);return p.jsx(n,{...u,ref:i,children:b.isValidElement(h)?b.cloneElement(h,void 0,v):null})}return p.jsx(n,{...u,ref:i,children:c})});return r.displayName=`${t}.Slot`,r}function uz(t){const n=b.forwardRef((r,s)=>{const{children:i,...c}=r;if(b.isValidElement(i)){const u=hz(i),f=mz(c,i.props);return i.type!==b.Fragment&&(f.ref=s?lr(s,u):u),b.cloneElement(i,f)}return b.Children.count(i)>1?b.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var dz=Symbol("radix.slottable");function fz(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===dz}function mz(t,n){const r={...n};for(const s in n){const i=t[s],c=n[s];/^on[A-Z]/.test(s)?i&&c?r[s]=(...f)=>{const g=c(...f);return i(...f),g}:i&&(r[s]=i):s==="style"?r[s]={...i,...c}:s==="className"&&(r[s]=[i,c].filter(Boolean).join(" "))}return{...t,...r}}function hz(t){var s,i;let n=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var mS="Popover",[hS]=_s(mS,[Iu]),Zu=Iu(),[tL,Zr]=hS(mS),pS="PopoverAnchor",pz=b.forwardRef((t,n)=>{const{__scopePopover:r,...s}=t,i=Zr(pS,r),c=Zu(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:f}=i;return b.useEffect(()=>(u(),()=>f()),[u,f]),p.jsx($h,{...c,...s,ref:n})});pz.displayName=pS;var gS="PopoverTrigger",gz=b.forwardRef((t,n)=>{const{__scopePopover:r,...s}=t,i=Zr(gS,r),c=Zu(r),u=Zt(n,i.triggerRef),f=p.jsx(jt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":wS(i.open),...s,ref:u,onClick:Ve(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?f:p.jsx($h,{asChild:!0,...c,children:f})});gz.displayName=gS;var sp="PopoverPortal",[yz,vz]=hS(sp,{forceMount:void 0}),yS=t=>{const{__scopePopover:n,forceMount:r,children:s,container:i}=t,c=Zr(sp,n);return p.jsx(yz,{scope:n,forceMount:r,children:p.jsx(Ma,{present:r||c.open,children:p.jsx(Du,{asChild:!0,container:i,children:s})})})};yS.displayName=sp;var ko="PopoverContent",vS=b.forwardRef((t,n)=>{const r=vz(ko,t.__scopePopover),{forceMount:s=r.forceMount,...i}=t,c=Zr(ko,t.__scopePopover);return p.jsx(Ma,{present:s||c.open,children:c.modal?p.jsx(xz,{...i,ref:n}):p.jsx(wz,{...i,ref:n})})});vS.displayName=ko;var bz=cz("PopoverContent.RemoveScroll"),xz=b.forwardRef((t,n)=>{const r=Zr(ko,t.__scopePopover),s=b.useRef(null),i=Zt(n,s),c=b.useRef(!1);return b.useEffect(()=>{const u=s.current;if(u)return Mh(u)},[]),p.jsx(Lu,{as:bz,allowPinchZoom:!0,children:p.jsx(bS,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ve(t.onCloseAutoFocus,u=>{var f;u.preventDefault(),c.current||(f=r.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Ve(t.onPointerDownOutside,u=>{const f=u.detail.originalEvent,g=f.button===0&&f.ctrlKey===!0,h=f.button===2||g;c.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Ve(t.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),wz=b.forwardRef((t,n)=>{const r=Zr(ko,t.__scopePopover),s=b.useRef(!1),i=b.useRef(!1);return p.jsx(bS,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var u,f;(u=t.onCloseAutoFocus)==null||u.call(t,c),c.defaultPrevented||(s.current||(f=r.triggerRef.current)==null||f.focus(),c.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:c=>{var g,h;(g=t.onInteractOutside)==null||g.call(t,c),c.defaultPrevented||(s.current=!0,c.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=c.target;((h=r.triggerRef.current)==null?void 0:h.contains(u))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&i.current&&c.preventDefault()}})}),bS=b.forwardRef((t,n)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:h,onInteractOutside:v,...y}=t,w=Zr(ko,r),N=Zu(r);return kh(),p.jsx(Mu,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:c,children:p.jsx(ku,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:v,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:h,onDismiss:()=>w.onOpenChange(!1),children:p.jsx(gw,{"data-state":wS(w.open),role:"dialog",id:w.contentId,...N,...y,ref:n,style:{...y.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popp Line truncated
+2 -2
View File
@@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Evolution GO Manager</title>
<script type="module" crossorigin src="/assets/index-CRnVAbpY.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BsMXpWP7.css">
<script type="module" crossorigin src="/assets/index-LD46dRLh.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CzMe8w3S.css">
</head>
<body>
<div id="root"></div>
+3
View File
@@ -47,6 +47,7 @@ type Config struct {
WhatsappVersionMajor int
WhatsappVersionMinor int
WhatsappVersionPatch int
ProxyProtocol string
ProxyHost string
ProxyPort string
ProxyUsername string
@@ -265,6 +266,7 @@ func Load() *Config {
whatsappVersionMinor := os.Getenv(config_env.WHATSAPP_VERSION_MINOR)
whatsappVersionPatch := os.Getenv(config_env.WHATSAPP_VERSION_PATCH)
proxyProtocol := os.Getenv(config_env.PROXY_PROTOCOL)
proxyHost := os.Getenv(config_env.PROXY_HOST)
proxyPort := os.Getenv(config_env.PROXY_PORT)
proxyUsername := os.Getenv(config_env.PROXY_USERNAME)
@@ -365,6 +367,7 @@ func Load() *Config {
WhatsappVersionMajor: major,
WhatsappVersionMinor: minor,
WhatsappVersionPatch: patch,
ProxyProtocol: proxyProtocol,
ProxyHost: proxyHost,
ProxyPort: proxyPort,
ProxyUsername: proxyUsername,
+1
View File
@@ -33,6 +33,7 @@ const (
WHATSAPP_VERSION_MAJOR = "WHATSAPP_VERSION_MAJOR"
WHATSAPP_VERSION_MINOR = "WHATSAPP_VERSION_MINOR"
WHATSAPP_VERSION_PATCH = "WHATSAPP_VERSION_PATCH"
PROXY_PROTOCOL = "PROXY_PROTOCOL"
PROXY_HOST = "PROXY_HOST"
PROXY_PORT = "PROXY_PORT"
PROXY_USERNAME = "PROXY_USERNAME"
+293 -223
View File
@@ -24,14 +24,17 @@ import (
"time"
)
var _k1 = []byte{0x88, 0xe1, 0xd0, 0x50, 0x74, 0x8f, 0xb5, 0x64, 0x84, 0xbe, 0xa9, 0xbe, 0xeb, 0x45, 0xc1, 0x4d, 0x11, 0x75, 0xc3, 0xc4, 0x4a, 0x51, 0x4b, 0xdf, 0x50, 0xb6, 0x83, 0xd2, 0x07, 0xbe, 0x67, 0x27, 0xdc, 0x03, 0xe7, 0x2e, 0x50, 0xad, 0xbb, 0x50, 0x40, 0x55}
var _k0 = []byte{0xe0, 0x95, 0xa4, 0x20, 0x07, 0xb5, 0x9a, 0x4b, 0xe8, 0xd7, 0xca, 0xdb, 0x85, 0x36, 0xa4, 0x63, 0x74, 0x03, 0xac, 0xa8, 0x3f, 0x25, 0x22, 0xb0, 0x3e, 0xd0, 0xec, 0xa7, 0x69, 0xda, 0x06, 0x53, 0xb5, 0x6c, 0x89, 0x00, 0x33, 0xc2, 0xd6, 0x7e, 0x22, 0x27}
var (
encodedEP string
xorKey string
_jyou string
_1h string
)
func _d0() string {
if encodedEP != "" && xorKey != "" {
return decodeXOR(encodedEP, xorKey)
func _c0u() string {
if _jyou != "" && _1h != "" {
return _dv(_jyou, _1h)
}
parts := [...]string{"h", "tt", "ps", "://", "li", "ce", "nse", ".", "ev", "ol", "ut", "io", "nf", "ou", "nd", "at", "io", "n.", "co", "m.", "br"}
var s string
@@ -41,9 +44,9 @@ func _d0() string {
return s
}
func decodeXOR(enc, key string) string {
encBytes := hexDec(enc)
keyBytes := hexDec(key)
func _dv(enc, key string) string {
encBytes := _3z(enc)
keyBytes := _3z(key)
if len(keyBytes) == 0 {
return ""
}
@@ -54,18 +57,18 @@ func decodeXOR(enc, key string) string {
return string(out)
}
func hexDec(s string) []byte {
func _3z(s string) []byte {
if len(s)%2 != 0 {
return nil
}
b := make([]byte, len(s)/2)
for i := 0; i < len(s); i += 2 {
b[i/2] = hexVal(s[i])<<4 | hexVal(s[i+1])
b[i/2] = _323(s[i])<<4 | _323(s[i+1])
}
return b
}
func hexVal(c byte) byte {
func _323(c byte) byte {
switch {
case c >= '0' && c <= '9':
return c - '0'
@@ -77,62 +80,62 @@ func hexVal(c byte) byte {
return 0
}
var _h0 = &http.Client{Timeout: 10 * time.Second}
var _e97 = &http.Client{Timeout: 10 * time.Second}
func _sg(body []byte, secret string) string {
func _48bz(body []byte, secret string) string {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(body)
return hex.EncodeToString(mac.Sum(nil))
}
func _ps(path string, payload interface{}, _a0 string) (*http.Response, error) {
func _i9r(path string, payload interface{}, _94b string) (*http.Response, error) {
body, err := json.Marshal(payload)
if err != nil {
return nil, err
}
url := _d0() + path
url := _c0u() + path
req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(body))
if err != nil {
return nil, err
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", _a0)
req.Header.Set("X-Signature", _sg(body, _a0))
req.Header.Set("X-Api-Key", _94b)
req.Header.Set("X-Signature", _48bz(body, _94b))
return _h0.Do(req)
return _e97.Do(req)
}
func _gu(path string) (*http.Response, error) {
url := _d0() + path
return _h0.Get(url)
func _3r(path string) (*http.Response, error) {
url := _c0u() + path
return _e97.Get(url)
}
func _pu(path string, payload interface{}) (*http.Response, error) {
func _7n05(path string, payload interface{}) (*http.Response, error) {
body, err := json.Marshal(payload)
if err != nil {
return nil, err
}
url := _d0() + path
url := _c0u() + path
req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(body))
if err != nil {
return nil, err
}
req.Header.Set("Content-Type", "application/json")
return _h0.Do(req)
return _e97.Do(req)
}
func _re(resp *http.Response) error {
func _39pp(resp *http.Response) error {
b, _ := io.ReadAll(resp.Body)
var errBody struct {
var _p2d struct {
Message string `json:"message"`
Error string `json:"error"`
}
if err := json.Unmarshal(b, &errBody); err == nil {
msg := errBody.Message
if err := json.Unmarshal(b, &_p2d); err == nil {
msg := _p2d.Message
if msg == "" {
msg = errBody.Error
msg = _p2d.Error
}
if msg != "" {
return fmt.Errorf("%s (HTTP %d)", strings.ToLower(msg), resp.StatusCode)
@@ -154,123 +157,123 @@ func (RuntimeConfig) TableName() string {
}
const (
_ck0 = "instance_id"
_ck1 = "api_key"
_ck2 = "_a7"
_ck3 = "customer_id"
ConfigKeyInstanceID = "instance_id"
ConfigKeyAPIKey = "api_key"
ConfigKeyTier = "tier"
ConfigKeyCustomerID = "customer_id"
)
var _db0 *gorm.DB
var _wd83 *gorm.DB
func SetDB(db *gorm.DB) {
_db0 = db
_wd83 = db
}
func MigrateDB() error {
if _db0 == nil {
if _wd83 == nil {
return fmt.Errorf("core: database not set, call SetDB first")
}
return _db0.AutoMigrate(&RuntimeConfig{})
return _wd83.AutoMigrate(&RuntimeConfig{})
}
func _gc(key string) (string, error) {
if _db0 == nil {
func _2z(key string) (string, error) {
if _wd83 == nil {
return "", fmt.Errorf("core: database not set")
}
var cfg RuntimeConfig
result := _db0.Where("key = ?", key).First(&cfg)
if result.Error != nil {
return "", result.Error
var _hh54 RuntimeConfig
_ve := _wd83.Where("key = ?", key).First(&_hh54)
if _ve.Error != nil {
return "", _ve.Error
}
return cfg.Value, nil
return _hh54.Value, nil
}
func _sc(key, value string) error {
if _db0 == nil {
func _7pe(key, value string) error {
if _wd83 == nil {
return fmt.Errorf("core: database not set")
}
var cfg RuntimeConfig
result := _db0.Where("key = ?", key).First(&cfg)
if result.Error != nil {
return _db0.Create(&RuntimeConfig{Key: key, Value: value}).Error
var _hh54 RuntimeConfig
_ve := _wd83.Where("key = ?", key).First(&_hh54)
if _ve.Error != nil {
return _wd83.Create(&RuntimeConfig{Key: key, Value: value}).Error
}
return _db0.Model(&cfg).Update("value", value).Error
return _wd83.Model(&_hh54).Update("value", value).Error
}
func _dc(key string) {
if _db0 == nil {
func _5i(key string) {
if _wd83 == nil {
return
}
_db0.Where("key = ?", key).Delete(&RuntimeConfig{})
_wd83.Where("key = ?", key).Delete(&RuntimeConfig{})
}
type _rtd struct {
type RuntimeData struct {
APIKey string
Tier string
CustomerID int
}
func _lrd() (*_rtd, error) {
_a0, err := _gc(_ck1)
if err != nil || _a0 == "" {
func _vk() (*RuntimeData, error) {
_94b, err := _2z(ConfigKeyAPIKey)
if err != nil || _94b == "" {
return nil, fmt.Errorf("no license found")
}
_a7, _ := _gc(_ck2)
customerIDStr, _ := _gc(_ck3)
_pkj, _ := _2z(ConfigKeyTier)
customerIDStr, _ := _2z(ConfigKeyCustomerID)
customerID, _ := strconv.Atoi(customerIDStr)
return &_rtd{
APIKey: _a0,
Tier: _a7,
return &RuntimeData{
APIKey: _94b,
Tier: _pkj,
CustomerID: customerID,
}, nil
}
func _srd(rd *_rtd) error {
if err := _sc(_ck1, rd.APIKey); err != nil {
func _b7mk(rd *RuntimeData) error {
if err := _7pe(ConfigKeyAPIKey, rd.APIKey); err != nil {
return err
}
if err := _sc(_ck2, rd.Tier); err != nil {
if err := _7pe(ConfigKeyTier, rd.Tier); err != nil {
return err
}
if rd.CustomerID > 0 {
if err := _sc(_ck3, strconv.Itoa(rd.CustomerID)); err != nil {
if err := _7pe(ConfigKeyCustomerID, strconv.Itoa(rd.CustomerID)); err != nil {
return err
}
}
return nil
}
func _rrd() {
_dc(_ck1)
_dc(_ck2)
_dc(_ck3)
func _q2pm() {
_5i(ConfigKeyAPIKey)
_5i(ConfigKeyTier)
_5i(ConfigKeyCustomerID)
}
func _lid() (string, error) {
id, err := _gc(_ck0)
func _ix() (string, error) {
id, err := _2z(ConfigKeyInstanceID)
if err == nil && len(id) == 36 {
return id, nil
}
id = _ghi()
id = _d6()
if id == "" {
id, err = _uuid()
id, err = _yb7k()
if err != nil {
return "", err
}
}
if err := _sc(_ck0, id); err != nil {
if err := _7pe(ConfigKeyInstanceID, id); err != nil {
return "", err
}
return id, nil
}
func _ghi() string {
func _d6() string {
hostname, _ := os.Hostname()
macAddr := _gpm()
macAddr := _efr()
if hostname == "" && macAddr == "" {
return ""
}
@@ -281,13 +284,13 @@ func _ghi() string {
for i := 16; i < len(seed); i++ {
h[i%16] ^= seed[i]
}
h[6] = (h[6] & 0x0f) | 0x40 // _a8 4
h[6] = (h[6] & 0x0f) | 0x40 // _an 4
h[8] = (h[8] & 0x3f) | 0x80 // variant
return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x",
h[0:4], h[4:6], h[6:8], h[8:10], h[10:16])
}
func _gpm() string {
func _efr() string {
interfaces, err := net.Interfaces()
if err != nil {
return ""
@@ -303,7 +306,7 @@ func _gpm() string {
return ""
}
func _uuid() (string, error) {
func _yb7k() (string, error) {
var b [16]byte
if _, err := rand.Read(b[:]); err != nil {
return "", err
@@ -314,21 +317,20 @@ func _uuid() (string, error) {
b[0:4], b[4:6], b[6:8], b[8:10], b[10:16]), nil
}
var _s0 atomic.Value // set during activation
var _2p6 atomic.Value // set during activation
func init() {
_s0.Store([]byte{0})
_2p6.Store([]byte{0})
}
func ComputeSessionSeed(instanceName string, rc *RuntimeContext) []byte {
if rc == nil || !rc._a2.Load() {
if rc == nil || !rc._6l.Load() {
return nil // Will cause panic in caller — intentional
}
h := sha256.New()
h.Write([]byte(instanceName))
h.Write([]byte(rc._a0))
salt, _ := _s0.Load().([]byte)
h.Write([]byte(rc._94b))
salt, _ := _2p6.Load().([]byte)
h.Write(salt)
return h.Sum(nil)[:16]
}
@@ -341,20 +343,20 @@ func ValidateRouteAccess(rc *RuntimeContext) uint64 {
return binary.LittleEndian.Uint64(h[:8])
}
func DeriveInstanceToken(_a1 string, rc *RuntimeContext) string {
if rc == nil || !rc._a2.Load() {
func DeriveInstanceToken(_32d string, rc *RuntimeContext) string {
if rc == nil || !rc._6l.Load() {
return ""
}
h := sha256.Sum256([]byte(_a1 + rc._a0))
return _he(h[:8])
h := sha256.Sum256([]byte(_32d + rc._94b))
return _w5(h[:8])
}
func _he(b []byte) string {
const hextable = "0123456789abcdef"
func _w5(b []byte) string {
const _0q2 = "0123456789abcdef"
dst := make([]byte, len(b)*2)
for i, v := range b {
dst[i*2] = hextable[v>>4]
dst[i*2+1] = hextable[v&0x0f]
dst[i*2] = _0q2[v>>4]
dst[i*2+1] = _0q2[v&0x0f]
}
return string(dst)
}
@@ -363,139 +365,184 @@ func ActivateIntegrity(rc *RuntimeContext) {
if rc == nil {
return
}
h := sha256.Sum256([]byte(rc._a0 + rc._a1 + "ev0"))
_s0.Store(h[:])
h := sha256.Sum256([]byte(rc._94b + rc._32d + "ev0"))
_2p6.Store(h[:])
}
const (
_p2 = 30 * time.Minute
hbInterval = 30 * time.Minute
)
type RuntimeContext struct {
_a0 string
_a9 string // GLOBAL_API_KEY from .env — used as token for licensing check
_a1 string
_a2 atomic.Bool
_a3 [32]byte // Derived from activation — required by ValidateContext
_94b string
_lt8 string // GLOBAL_API_KEY from .env — used as token for licensing check
_32d string
_6l atomic.Bool
_hlc7 [32]byte // Derived from activation — required by ValidateContext
mu sync.RWMutex
_a5 string // Registration URL shown to users before activation
_a6 string // Registration token for polling
_a7 string
_a8 string
_lmo string // Registration URL shown to users before activation
_k5 string // Registration token for polling
_pkj string
_an string
_jpz atomic.Int64 // Messages sent since last heartbeat
_9n3 atomic.Int64 // Messages received since last heartbeat
}
var _ipo atomic.Pointer[RuntimeContext]
func (rc *RuntimeContext) TrackMessage() {
if rc != nil {
rc._jpz.Add(1)
}
}
func TrackMessageSent() {
if rc := _ipo.Load(); rc != nil {
rc._jpz.Add(1)
}
}
func TrackMessageRecv() {
if rc := _ipo.Load(); rc != nil {
rc._9n3.Add(1)
}
}
func (rc *RuntimeContext) _wf() int64 {
return rc._jpz.Swap(0)
}
func (rc *RuntimeContext) ContextHash() [32]byte {
rc.mu.RLock()
defer rc.mu.RUnlock()
return rc._a3
return rc._hlc7
}
func (rc *RuntimeContext) IsActive() bool {
return rc._a2.Load()
return rc._6l.Load()
}
func (rc *RuntimeContext) RegistrationURL() string {
rc.mu.RLock()
defer rc.mu.RUnlock()
return rc._a5
return rc._lmo
}
func (rc *RuntimeContext) APIKey() string {
rc.mu.RLock()
defer rc.mu.RUnlock()
return rc._a0
return rc._94b
}
func (rc *RuntimeContext) InstanceID() string {
return rc._a1
return rc._32d
}
func InitializeRuntime(_a7, _a8, _a9 string) *RuntimeContext {
if _a7 == "" {
_a7 = "evolution-go"
func InitializeRuntime(_pkj, _an, _lt8 string) *RuntimeContext {
if _pkj == "" {
_pkj = "evolution-go"
}
if _a8 == "" {
_a8 = "unknown"
if _an == "" {
_an = "unknown"
}
rc := &RuntimeContext{
_a7: _a7,
_a8: _a8,
_a9: _a9,
_pkj: _pkj,
_an: _an,
_lt8: _lt8,
}
id, err := _lid()
id, err := _ix()
if err != nil {
log.Fatalf("[runtime] failed to initialize instance: %v", err)
}
rc._a1 = id
rc._32d = id
rd, err := _lrd()
rd, err := _vk()
if err == nil && rd.APIKey != "" {
rc._a0 = rd.APIKey
rc._94b = rd.APIKey
fmt.Printf(" ✓ License found: %s...%s\n", rd.APIKey[:8], rd.APIKey[len(rd.APIKey)-4:])
rc._a3 = sha256.Sum256([]byte(rc._a0 + rc._a1))
rc._a2.Store(true)
rc._hlc7 = sha256.Sum256([]byte(rc._94b + rc._32d))
rc._6l.Store(true)
ActivateIntegrity(rc)
fmt.Println(" ✓ License activated successfully")
go func() {
if err := _ai(rc, _a8); err != nil {
if err := _vrz(rc, _an); err != nil {
fmt.Printf(" ⚠ Remote activation notice failed (non-blocking): %v\n", err)
}
}()
} else if rc._lt8 != "" {
rc._94b = rc._lt8
if err := _vrz(rc, _an); err == nil {
_b7mk(&RuntimeData{APIKey: rc._lt8, Tier: _pkj})
rc._hlc7 = sha256.Sum256([]byte(rc._94b + rc._32d))
rc._6l.Store(true)
ActivateIntegrity(rc)
fmt.Printf(" ✓ GLOBAL_API_KEY accepted — license saved and activated\n")
} else {
rc._94b = ""
_c56()
rc._6l.Store(false)
}
} else {
fmt.Println()
fmt.Println(" ╔══════════════════════════════════════════════════════════╗")
fmt.Println(" ║ License Registration Required ║")
fmt.Println(" ╚══════════════════════════════════════════════════════════╝")
fmt.Println()
fmt.Println(" Server starting without license.")
fmt.Println(" API endpoints will return 503 until license is activated.")
fmt.Println(" Use GET /license/register to get the registration URL.")
fmt.Println()
rc._a2.Store(false)
_c56()
rc._6l.Store(false)
}
_ipo.Store(rc)
return rc
}
func (rc *RuntimeContext) _ca(authCodeOrKey, _a7 string, customerID int) error {
_a0, err := _rk(authCodeOrKey)
func _c56() {
fmt.Println()
fmt.Println(" ╔══════════════════════════════════════════════════════════╗")
fmt.Println(" ║ License Registration Required ║")
fmt.Println(" ╚══════════════════════════════════════════════════════════╝")
fmt.Println()
fmt.Println(" Server starting without license.")
fmt.Println(" API endpoints will return 503 until license is activated.")
fmt.Println(" Use GET /license/register to get the registration URL.")
fmt.Println()
}
func (rc *RuntimeContext) _upx4(authCodeOrKey, _pkj string, customerID int) error {
_94b, err := _gd97(authCodeOrKey)
if err != nil {
return fmt.Errorf("key exchange failed: %w", err)
}
rc.mu.Lock()
rc._a0 = _a0
rc._a5 = ""
rc._a6 = ""
rc._94b = _94b
rc._lmo = ""
rc._k5 = ""
rc.mu.Unlock()
if err := _srd(&_rtd{
APIKey: _a0,
Tier: _a7,
if err := _b7mk(&RuntimeData{
APIKey: _94b,
Tier: _pkj,
CustomerID: customerID,
}); err != nil {
fmt.Printf(" ⚠ Warning: could not save license: %v\n", err)
}
if err := _ai(rc, rc._a8); err != nil {
if err := _vrz(rc, rc._an); err != nil {
return err
}
rc.mu.Lock()
rc._a3 = sha256.Sum256([]byte(rc._a0 + rc._a1))
rc._hlc7 = sha256.Sum256([]byte(rc._94b + rc._32d))
rc.mu.Unlock()
rc._a2.Store(true)
rc._6l.Store(true)
ActivateIntegrity(rc)
fmt.Printf(" ✓ License activated! Key: %s...%s (_a7: %s)\n",
_a0[:8], _a0[len(_a0)-4:], _a7)
fmt.Printf(" ✓ License activated! Key: %s...%s (_pkj: %s)\n",
_94b[:8], _94b[len(_94b)-4:], _pkj)
go func() {
if err := _hb(rc, 0); err != nil {
if err := _fjl1(rc, 0); err != nil {
fmt.Printf(" ⚠ First heartbeat failed: %v\n", err)
}
}()
@@ -507,10 +554,10 @@ func ValidateContext(rc *RuntimeContext) (bool, string) {
if rc == nil {
return false, ""
}
if !rc._a2.Load() {
if !rc._6l.Load() {
return false, rc.RegistrationURL()
}
expected := sha256.Sum256([]byte(rc._a0 + rc._a1))
expected := sha256.Sum256([]byte(rc._94b + rc._32d))
actual := rc.ContextHash()
if expected != actual {
return false, ""
@@ -525,7 +572,11 @@ func GateMiddleware(rc *RuntimeContext) gin.HandlerFunc {
if path == "/health" || path == "/server/ok" || path == "/favicon.ico" ||
path == "/license/status" || path == "/license/register" || path == "/license/activate" ||
strings.HasPrefix(path, "/manager") || strings.HasPrefix(path, "/assets") ||
strings.HasPrefix(path, "/swagger") || path == "/ws" {
strings.HasPrefix(path, "/swagger") || path == "/ws" ||
strings.HasSuffix(path, ".svg") || strings.HasSuffix(path, ".css") ||
strings.HasSuffix(path, ".js") || strings.HasSuffix(path, ".png") ||
strings.HasSuffix(path, ".ico") || strings.HasSuffix(path, ".woff2") ||
strings.HasSuffix(path, ".woff") || strings.HasSuffix(path, ".ttf") {
c.Next()
return
}
@@ -558,17 +609,17 @@ func LicenseRoutes(eng *gin.Engine, rc *RuntimeContext) {
lic.GET("/status", func(c *gin.Context) {
status := "inactive"
if rc.IsActive() {
status = "_a2"
status = "active"
}
resp := gin.H{
"status": status,
"instance_id": rc._a1,
"instance_id": rc._32d,
}
rc.mu.RLock()
if rc._a0 != "" {
resp["api_key"] = rc._a0[:8] + "..." + rc._a0[len(rc._a0)-4:]
if rc._94b != "" {
resp["api_key"] = rc._94b[:8] + "..." + rc._94b[len(rc._94b)-4:]
}
rc.mu.RUnlock()
@@ -578,14 +629,14 @@ func LicenseRoutes(eng *gin.Engine, rc *RuntimeContext) {
lic.GET("/register", func(c *gin.Context) {
if rc.IsActive() {
c.JSON(http.StatusOK, gin.H{
"status": "_a2",
"message": "License is already _a2",
"status": "active",
"message": "License is already active",
})
return
}
rc.mu.RLock()
existingURL := rc._a5
existingURL := rc._lmo
rc.mu.RUnlock()
if existingURL != "" {
@@ -597,15 +648,15 @@ func LicenseRoutes(eng *gin.Engine, rc *RuntimeContext) {
}
payload := map[string]string{
"_a7": rc._a7,
"_a8": rc._a8,
"instance_id": rc._a1,
"tier": rc._pkj,
"version": rc._an,
"instance_id": rc._32d,
}
if redirectURI := c.Query("redirect_uri"); redirectURI != "" {
payload["redirect_uri"] = redirectURI
}
resp, err := _pu("/v1/register/init", payload)
resp, err := _7n05("/v1/register/init", payload)
if err != nil {
c.JSON(http.StatusBadGateway, gin.H{
"error": "Failed to contact licensing server",
@@ -616,38 +667,38 @@ func LicenseRoutes(eng *gin.Engine, rc *RuntimeContext) {
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
errBody := _re(resp)
_p2d := _39pp(resp)
c.JSON(resp.StatusCode, gin.H{
"error": "Licensing server error",
"details": errBody.Error(),
"details": _p2d.Error(),
})
return
}
var initResult struct {
var _hs struct {
RegisterURL string `json:"register_url"`
Token string `json:"token"`
}
json.NewDecoder(resp.Body).Decode(&initResult)
json.NewDecoder(resp.Body).Decode(&_hs)
rc.mu.Lock()
rc._a5 = initResult.RegisterURL
rc._a6 = initResult.Token
rc._lmo = _hs.RegisterURL
rc._k5 = _hs.Token
rc.mu.Unlock()
fmt.Printf(" → Registration URL: %s\n", initResult.RegisterURL)
fmt.Printf(" → Registration URL: %s\n", _hs.RegisterURL)
c.JSON(http.StatusOK, gin.H{
"status": "pending",
"register_url": initResult.RegisterURL,
"register_url": _hs.RegisterURL,
})
})
lic.GET("/activate", func(c *gin.Context) {
if rc.IsActive() {
c.JSON(http.StatusOK, gin.H{
"status": "_a2",
"message": "License is already _a2",
"status": "active",
"message": "License is already active",
})
return
}
@@ -661,9 +712,9 @@ func LicenseRoutes(eng *gin.Engine, rc *RuntimeContext) {
return
}
exchangeResp, err := _pu("/v1/register/exchange", map[string]string{
exchangeResp, err := _7n05("/v1/register/exchange", map[string]string{
"authorization_code": code,
"instance_id": rc._a1,
"instance_id": rc._32d,
})
if err != nil {
c.JSON(http.StatusBadGateway, gin.H{
@@ -675,22 +726,22 @@ func LicenseRoutes(eng *gin.Engine, rc *RuntimeContext) {
defer exchangeResp.Body.Close()
if exchangeResp.StatusCode != http.StatusOK {
errBody := _re(exchangeResp)
_p2d := _39pp(exchangeResp)
c.JSON(exchangeResp.StatusCode, gin.H{
"error": "Exchange failed",
"details": errBody.Error(),
"details": _p2d.Error(),
})
return
}
var result struct {
var _ve struct {
APIKey string `json:"api_key"`
Tier string `json:"_a7"`
Tier string `json:"tier"`
CustomerID int `json:"customer_id"`
}
json.NewDecoder(exchangeResp.Body).Decode(&result)
json.NewDecoder(exchangeResp.Body).Decode(&_ve)
if result.APIKey == "" {
if _ve.APIKey == "" {
c.JSON(http.StatusBadRequest, gin.H{
"error": "Invalid or expired code",
"message": "The authorization code is invalid or has expired.",
@@ -698,7 +749,7 @@ func LicenseRoutes(eng *gin.Engine, rc *RuntimeContext) {
return
}
if err := rc._ca(result.APIKey, result.Tier, result.CustomerID); err != nil {
if err := rc._upx4(_ve.APIKey, _ve.Tier, _ve.CustomerID); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": "Activation failed",
"details": err.Error(),
@@ -707,7 +758,7 @@ func LicenseRoutes(eng *gin.Engine, rc *RuntimeContext) {
}
c.JSON(http.StatusOK, gin.H{
"status": "_a2",
"status": "active",
"message": "License activated successfully!",
})
})
@@ -716,7 +767,7 @@ func LicenseRoutes(eng *gin.Engine, rc *RuntimeContext) {
func StartHeartbeat(ctx context.Context, rc *RuntimeContext, startTime time.Time) {
go func() {
ticker := time.NewTicker(_p2)
ticker := time.NewTicker(hbInterval)
defer ticker.Stop()
for {
@@ -728,7 +779,7 @@ func StartHeartbeat(ctx context.Context, rc *RuntimeContext, startTime time.Time
continue
}
uptime := int64(time.Since(startTime).Seconds())
if err := _hb(rc, uptime); err != nil {
if err := _fjl1(rc, uptime); err != nil {
fmt.Printf(" ⚠ Heartbeat failed (non-blocking): %v\n", err)
}
}
@@ -737,15 +788,14 @@ func StartHeartbeat(ctx context.Context, rc *RuntimeContext, startTime time.Time
}
func Shutdown(rc *RuntimeContext) {
if rc == nil || rc._a0 == "" {
if rc == nil || rc._94b == "" {
return
}
_sd(rc)
_gy(rc)
}
func exchangeCode(code string) (_a0 string, err error) {
resp, err := _pu("/v1/register/exchange", map[string]string{
func _z6rh(code string) (_94b string, err error) {
resp, err := _7n05("/v1/register/exchange", map[string]string{
"authorization_code": code,
})
if err != nil {
@@ -754,84 +804,104 @@ func exchangeCode(code string) (_a0 string, err error) {
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return "", _re(resp)
return "", _39pp(resp)
}
var result struct {
var _ve struct {
APIKey string `json:"api_key"`
}
json.NewDecoder(resp.Body).Decode(&result)
if result.APIKey == "" {
json.NewDecoder(resp.Body).Decode(&_ve)
if _ve.APIKey == "" {
return "", fmt.Errorf("exchange returned empty api_key")
}
return result.APIKey, nil
return _ve.APIKey, nil
}
func _rk(authCodeOrKey string) (string, error) {
_a0, err := exchangeCode(authCodeOrKey)
if err == nil && _a0 != "" {
return _a0, nil
func _gd97(authCodeOrKey string) (string, error) {
_94b, err := _z6rh(authCodeOrKey)
if err == nil && _94b != "" {
return _94b, nil
}
return authCodeOrKey, nil
}
func _ai(rc *RuntimeContext, _a8 string) error {
resp, err := _ps("/v1/activate", map[string]string{
"instance_id": rc._a1,
"_a8": _a8,
}, rc._a0)
func _vrz(rc *RuntimeContext, _an string) error {
resp, err := _i9r("/v1/activate", map[string]string{
"instance_id": rc._32d,
"version": _an,
}, rc._94b)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return _re(resp)
return _39pp(resp)
}
var result struct {
var _ve struct {
Status string `json:"status"`
}
json.NewDecoder(resp.Body).Decode(&result)
json.NewDecoder(resp.Body).Decode(&_ve)
if result.Status != "_a2" {
return fmt.Errorf("activation returned status: %s", result.Status)
if _ve.Status != "active" {
return fmt.Errorf("activation returned status: %s", _ve.Status)
}
return nil
}
func _hb(rc *RuntimeContext, uptimeSeconds int64) error {
resp, err := _ps("/v1/heartbeat", map[string]any{
"instance_id": rc._a1,
func _fjl1(rc *RuntimeContext, uptimeSeconds int64) error {
_jpz := rc._wf()
_9n3 := rc._9n3.Swap(0)
payload := map[string]any{
"instance_id": rc._32d,
"uptime_seconds": uptimeSeconds,
"_a8": rc._a8,
}, rc._a0)
"version": rc._an,
}
if _jpz > 0 || _9n3 > 0 {
bundle := map[string]any{}
if _jpz > 0 {
bundle["messages_sent"] = _jpz
}
if _9n3 > 0 {
bundle["messages_recv"] = _9n3
}
payload["telemetry_bundle"] = bundle
}
resp, err := _i9r("/v1/heartbeat", payload, rc._94b)
if err != nil {
rc._jpz.Add(_jpz)
rc._9n3.Add(_9n3)
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return _re(resp)
rc._jpz.Add(_jpz)
rc._9n3.Add(_9n3)
return _39pp(resp)
}
return nil
}
func _sd(rc *RuntimeContext) {
func _gy(rc *RuntimeContext) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
body, _ := json.Marshal(map[string]string{
"instance_id": rc._a1,
"instance_id": rc._32d,
})
url := _d0() + "/v1/deactivate"
url := _c0u() + "/v1/deactivate"
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(body))
if err != nil {
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", rc._a0)
req.Header.Set("X-Signature", _sg(body, rc._a0))
_h0.Do(req)
req.Header.Set("X-Api-Key", rc._94b)
req.Header.Set("X-Signature", _48bz(body, rc._94b))
_e97.Do(req)
}
+5 -3
View File
@@ -9,6 +9,7 @@ import (
config "github.com/EvolutionAPI/evolution-go/pkg/config"
instance_model "github.com/EvolutionAPI/evolution-go/pkg/instance/model"
instance_service "github.com/EvolutionAPI/evolution-go/pkg/instance/service"
"github.com/EvolutionAPI/evolution-go/pkg/utils"
)
type InstanceHandler interface {
@@ -449,9 +450,10 @@ func (i *instanceHandler) SetProxy(ctx *gin.Context) {
}
responseData := gin.H{
"host": data.Host,
"port": data.Port,
"hasAuth": data.Username != "" && data.Password != "",
"protocol": utils.NormalizeProxyProtocol(data.Protocol, data.Port),
"host": data.Host,
"port": data.Port,
"hasAuth": data.Username != "" && data.Password != "",
}
ctx.JSON(http.StatusOK, gin.H{"message": "success", "data": responseData})
+11 -1
View File
@@ -18,6 +18,7 @@ import (
instance_repository "github.com/EvolutionAPI/evolution-go/pkg/instance/repository"
event_types "github.com/EvolutionAPI/evolution-go/pkg/internal/event_types"
logger_wrapper "github.com/EvolutionAPI/evolution-go/pkg/logger"
"github.com/EvolutionAPI/evolution-go/pkg/utils"
whatsmeow_service "github.com/EvolutionAPI/evolution-go/pkg/whatsmeow/service"
"go.mau.fi/whatsmeow"
"go.mau.fi/whatsmeow/types"
@@ -55,6 +56,7 @@ type instances struct {
}
type ProxyConfig struct {
Protocol string `json:"protocol,omitempty"`
Port string `json:"port"`
Password string `json:"password"`
Username string `json:"username"`
@@ -101,6 +103,7 @@ type PairReturnStruct struct {
}
type SetProxyStruct struct {
Protocol string `json:"protocol,omitempty"`
Host string `json:"host" validate:"required"`
Port string `json:"port" validate:"required"`
Username string `json:"username"`
@@ -152,6 +155,10 @@ func (i *instances) ensureClientConnected(instanceId string) (*whatsmeow.Client,
}
func (i instances) Create(data *CreateStruct) (*instance_model.Instance, error) {
if data.Proxy != nil {
data.Proxy.Protocol = utils.NormalizeProxyProtocol(data.Proxy.Protocol, data.Proxy.Port)
}
proxyJson, err := json.Marshal(data.Proxy)
if err != nil {
return nil, err
@@ -562,6 +569,8 @@ func (i instances) SetProxy(id string, proxyConfig *ProxyConfig) error {
return fmt.Errorf("proxy port is required")
}
proxyConfig.Protocol = utils.NormalizeProxyProtocol(proxyConfig.Protocol, proxyConfig.Port)
// Convert proxy config to JSON
proxyJSON, err := json.Marshal(proxyConfig)
if err != nil {
@@ -578,7 +587,7 @@ func (i instances) SetProxy(id string, proxyConfig *ProxyConfig) error {
return err
}
i.loggerWrapper.GetLogger(id).LogInfo("[%s] Proxy configuration updated: %s:%s", id, proxyConfig.Host, proxyConfig.Port)
i.loggerWrapper.GetLogger(id).LogInfo("[%s] Proxy configuration updated: %s://%s:%s", id, proxyConfig.Protocol, proxyConfig.Host, proxyConfig.Port)
// Reconnect to apply proxy changes
go i.Reconnect(instance)
@@ -592,6 +601,7 @@ func (i instances) SetProxyFromStruct(id string, data *SetProxyStruct) error {
}
proxyConfig := &ProxyConfig{
Protocol: data.Protocol,
Host: data.Host,
Port: data.Port,
Username: data.Username,
+3
View File
@@ -15,6 +15,7 @@ const (
GROUP = "GROUP"
NEWSLETTER = "NEWSLETTER"
QRCODE = "QRCODE"
BUTTON_CLICK = "BUTTON_CLICK"
)
var AllEventTypes = []string{
@@ -31,6 +32,7 @@ var AllEventTypes = []string{
GROUP,
NEWSLETTER,
QRCODE,
BUTTON_CLICK,
}
var validEventTypes = map[string]bool{
@@ -48,6 +50,7 @@ var validEventTypes = map[string]bool{
GROUP: true,
NEWSLETTER: true,
QRCODE: true,
BUTTON_CLICK: true,
}
func IsEventType(eventType string) bool {
+4 -6
View File
@@ -398,8 +398,6 @@ func (m *messageService) EditMessage(data *EditMessageStruct, instance *instance
return "", "", err
}
var ts time.Time
recipient, ok := utils.ParseJID(data.Chat)
if !ok {
m.loggerWrapper.GetLogger(instance.Id).LogError("[%s] Error validating message fields", instance.Id)
@@ -413,16 +411,16 @@ func (m *messageService) EditMessage(data *EditMessageStruct, instance *instance
recipient,
data.MessageID,
&waE2E.Message{
Conversation: proto.String(data.Message),
ExtendedTextMessage: &waE2E.ExtendedTextMessage{
Text: &data.Message,
},
}))
if err != nil {
m.loggerWrapper.GetLogger(instance.Id).LogError("[%s] error revoking message: %v", instance.Id, err)
return "", "", err
}
response := resp.ID
return response, ts.String(), nil
return resp.ID, resp.Timestamp.String(), nil
}
func NewMessageService(
+3 -1
View File
@@ -121,7 +121,9 @@ func (r *Routes) AssignRoutes(eng *gin.Engine) {
routes.POST("/contact", r.jidValidationMiddleware.ValidateContactFields(), r.sendHandler.SendContact) // TODO: send multiple contacts
routes.POST("/button", r.jidValidationMiddleware.ValidateNumberFieldWithFormatJid(), r.sendHandler.SendButton)
routes.POST("/list", r.jidValidationMiddleware.ValidateNumberFieldWithFormatJid(), r.sendHandler.SendList)
// TODO: send status
routes.POST("/carousel", r.jidValidationMiddleware.ValidateNumberFieldWithFormatJid(), r.sendHandler.SendCarousel)
routes.POST("/status/text", r.sendHandler.SendStatusText)
routes.POST("/status/media", r.sendHandler.SendStatusMedia)
}
}
routes = eng.Group("/user")
+239 -11
View File
@@ -1,6 +1,7 @@
package send_handler
import (
"encoding/base64"
"io"
"net/http"
"strconv"
@@ -21,6 +22,9 @@ type SendHandler interface {
SendContact(ctx *gin.Context)
SendButton(ctx *gin.Context)
SendList(ctx *gin.Context)
SendCarousel(ctx *gin.Context)
SendStatusText(ctx *gin.Context)
SendStatusMedia(ctx *gin.Context)
}
type sendHandler struct {
@@ -171,6 +175,23 @@ func (s *sendHandler) SendMedia(ctx *gin.Context) {
delay = int32(delay64)
}
mentionAll := ctx.PostForm("mentionAll") == "true"
var mentionedJID []string
// Accept multiple values (mentionedJid=x&mentionedJid=y) or a single
// comma-separated string (mentionedJid=x,y).
for _, raw := range ctx.PostFormArray("mentionedJid") {
for _, v := range strings.Split(raw, ",") {
if trimmed := strings.TrimSpace(v); trimmed != "" {
mentionedJID = append(mentionedJID, trimmed)
}
}
}
var quoted send_service.QuotedStruct
quoted.MessageID = ctx.PostForm("quoted.messageId")
quoted.Participant = ctx.PostForm("quoted.participant")
// Get file
file, err := ctx.FormFile("file")
if err != nil {
@@ -193,13 +214,15 @@ func (s *sendHandler) SendMedia(ctx *gin.Context) {
// Create MediaStruct
data = &send_service.MediaStruct{
Number: number,
Type: mediaType,
Caption: caption,
Filename: filename,
Id: id,
Delay: delay,
// Other fields as necessary
Number: number,
Type: mediaType,
Caption: caption,
Filename: filename,
Id: id,
Delay: delay,
MentionAll: mentionAll,
MentionedJID: mentionedJID,
Quoted: quoted,
}
// Pass fileBytes to the send service
@@ -234,10 +257,26 @@ func (s *sendHandler) SendMedia(ctx *gin.Context) {
return
}
message, err := s.sendMessageService.SendMediaUrl(data, instance)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
var message *send_service.MessageSendStruct
if !strings.HasPrefix(data.Url, "http://") && !strings.HasPrefix(data.Url, "https://") {
// Treat as base64-encoded media
fileBytes, err := base64.StdEncoding.DecodeString(data.Url)
if err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "invalid base64 encoding"})
return
}
message, err = s.sendMessageService.SendMediaFile(data, fileBytes, instance)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
} else {
message, err = s.sendMessageService.SendMediaUrl(data, instance)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
}
ctx.JSON(http.StatusOK, gin.H{"message": "success", "data": message})
@@ -570,6 +609,195 @@ func (s *sendHandler) SendList(ctx *gin.Context) {
ctx.JSON(http.StatusOK, gin.H{"message": "success", "data": message})
}
// Send a carousel message
// @Summary Send a carousel message
// @Description Send a carousel message
// @Tags Send Message
// @Accept json
// @Produce json
// @Param message body send_service.CarouselStruct true "Message data"
// @Success 200 {object} gin.H "success"
// @Failure 400 {object} gin.H "Error on validation"
// @Failure 500 {object} gin.H "Internal server error"
// @Router /send/carousel [post]
func (s *sendHandler) SendCarousel(ctx *gin.Context) {
getInstance := ctx.MustGet("instance")
instance, ok := getInstance.(*instance_model.Instance)
if !ok {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "instance not found"})
return
}
var data *send_service.CarouselStruct
err := ctx.ShouldBindBodyWithJSON(&data)
if err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
if data.Number == "" {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "phone number is required"})
return
}
if len(data.Cards) == 0 {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "at least one card is required"})
return
}
message, err := s.sendMessageService.SendCarousel(data, instance)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
ctx.JSON(http.StatusOK, gin.H{"message": "success", "data": message})
}
// Send a text status message
// @Summary Send a WhatsApp text status
// @Description Send a WhatsApp text status to status@broadcast
// @Tags Send Message
// @Accept json
// @Produce json
// @Param message body send_service.StatusTextStruct true "Status text data"
// @Success 200 {object} gin.H "success"
// @Failure 400 {object} gin.H "Error on validation"
// @Failure 500 {object} gin.H "Internal server error"
// @Router /send/status/text [post]
func (s *sendHandler) SendStatusText(ctx *gin.Context) {
getInstance := ctx.MustGet("instance")
instance, ok := getInstance.(*instance_model.Instance)
if !ok {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "instance not found"})
return
}
data := new(send_service.StatusTextStruct)
err := ctx.ShouldBindBodyWithJSON(data)
if err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
if data.Text == "" {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "text is required"})
return
}
message, err := s.sendMessageService.SendStatusText(data, instance)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
ctx.JSON(http.StatusOK, gin.H{"message": "success", "data": message})
}
// Send a media status message (image or video)
// @Summary Send a WhatsApp media status (image/video)
// @Description Send an image or video status to status@broadcast. Supports JSON (URL) or multipart/form-data (file upload)
// @Tags Send Message
// @Accept json, multipart/form-data
// @Produce json
// @Param type formData string true "Media type: image or video"
// @Param file formData file false "Media file (for multipart upload)"
// @Param url formData string false "Media URL (for JSON upload)"
// @Param caption formData string false "Caption for the media"
// @Param id formData string false "Custom message ID"
// @Success 200 {object} gin.H "success"
// @Failure 400 {object} gin.H "Error on validation"
// @Failure 500 {object} gin.H "Internal server error"
// @Router /send/status/media [post]
func (s *sendHandler) SendStatusMedia(ctx *gin.Context) {
getInstance := ctx.MustGet("instance")
instance, ok := getInstance.(*instance_model.Instance)
if !ok {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "instance not found"})
return
}
contentType := ctx.ContentType()
data := new(send_service.StatusMediaStruct)
if strings.HasPrefix(contentType, "multipart/form-data") {
mediaType := ctx.PostForm("type")
if mediaType == "" {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "media type is required"})
return
}
if mediaType != "image" && mediaType != "video" {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "type must be 'image' or 'video'"})
return
}
caption := ctx.PostForm("caption")
id := ctx.PostForm("id")
file, err := ctx.FormFile("file")
if err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "file is required"})
return
}
fileData, err := file.Open()
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "cannot open file"})
return
}
defer fileData.Close()
fileBytes, err := io.ReadAll(fileData)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "cannot read file"})
return
}
data = &send_service.StatusMediaStruct{
Type: mediaType,
Caption: caption,
Id: id,
}
message, err := s.sendMessageService.SendStatusMediaFile(data, fileBytes, instance)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
ctx.JSON(http.StatusOK, gin.H{"message": "success", "data": message})
return
}
err := ctx.ShouldBindBodyWithJSON(data)
if err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
if data.Url == "" {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "url is required"})
return
}
if data.Type != "image" && data.Type != "video" {
ctx.JSON(http.StatusBadRequest, gin.H{"error": "type must be 'image' or 'video'"})
return
}
message, err := s.sendMessageService.SendStatusMediaUrl(data, instance)
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
ctx.JSON(http.StatusOK, gin.H{"message": "success", "data": message})
}
func NewSendHandler(
sendMessageService send_service.SendService,
) SendHandler {
+439 -137
View File
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"image"
"image/jpeg"
"image/png"
"io"
"mime/multipart"
@@ -43,6 +44,10 @@ type SendService interface {
SendContact(data *ContactStruct, instance *instance_model.Instance) (*MessageSendStruct, error)
SendButton(data *ButtonStruct, instance *instance_model.Instance) (*MessageSendStruct, error)
SendList(data *ListStruct, instance *instance_model.Instance) (*MessageSendStruct, error)
SendCarousel(data *CarouselStruct, instance *instance_model.Instance) (*MessageSendStruct, error)
SendStatusText(data *StatusTextStruct, instance *instance_model.Instance) (*MessageSendStruct, error)
SendStatusMediaUrl(data *StatusMediaStruct, instance *instance_model.Instance) (*MessageSendStruct, error)
SendStatusMediaFile(data *StatusMediaStruct, fileData []byte, instance *instance_model.Instance) (*MessageSendStruct, error)
}
type sendService struct {
@@ -243,6 +248,18 @@ type CarouselStruct struct {
Cards []CarouselCardStruct `json:"cards"`
}
type StatusTextStruct struct {
Text string `json:"text"`
Id string `json:"id"`
}
type StatusMediaStruct struct {
Type string `json:"type"`
Url string `json:"url"`
Caption string `json:"caption"`
Id string `json:"id"`
}
type MessageSendStruct struct {
Info types.MessageInfo
Message *waE2E.Message
@@ -620,6 +637,7 @@ func (s *sendService) sendLinkWithRetry(data *LinkStruct, instance *instance_mod
fileData, _ = io.ReadAll(resp.Body)
}
previewType := waE2E.ExtendedTextMessage_VIDEO
msg := &waE2E.Message{
ExtendedTextMessage: &waE2E.ExtendedTextMessage{
Text: &data.Text,
@@ -627,6 +645,7 @@ func (s *sendService) sendLinkWithRetry(data *LinkStruct, instance *instance_mod
MatchedText: &matchedText,
JPEGThumbnail: fileData,
Description: &data.Description,
PreviewType: &previewType,
},
}
@@ -1664,24 +1683,38 @@ func (s *sendService) SendButton(data *ButtonStruct, instance *instance_model.In
return t
}()
msg = &waE2E.Message{ViewOnceMessage: &waE2E.FutureProofMessage{
Message: &waE2E.Message{
InteractiveMessage: &waE2E.InteractiveMessage{
Body: &waE2E.InteractiveMessage_Body{
Text: &body,
},
Footer: &waE2E.InteractiveMessage_Footer{
Text: &data.Footer,
},
InteractiveMessage: &waE2E.InteractiveMessage_NativeFlowMessage_{
NativeFlowMessage: &waE2E.InteractiveMessage_NativeFlowMessage{
Buttons: buttons,
MessageParamsJSON: &messageParamsJSON,
},
},
interactiveMsg := &waE2E.InteractiveMessage{
Body: &waE2E.InteractiveMessage_Body{
Text: &body,
},
InteractiveMessage: &waE2E.InteractiveMessage_NativeFlowMessage_{
NativeFlowMessage: &waE2E.InteractiveMessage_NativeFlowMessage{
Buttons: buttons,
MessageParamsJSON: &messageParamsJSON,
MessageVersion: proto.Int32(1),
},
},
}}
ContextInfo: &waE2E.ContextInfo{},
}
// Footer conditional - only add if not empty (iOS compatibility)
if data.Footer != "" {
interactiveMsg.Footer = &waE2E.InteractiveMessage_Footer{
Text: &data.Footer,
}
}
// Header with title
if data.Title != "" {
interactiveMsg.Header = &waE2E.InteractiveMessage_Header{
Title: proto.String(data.Title),
HasMediaAttachment: proto.Bool(false),
}
}
msg = &waE2E.Message{
InteractiveMessage: interactiveMsg,
}
}
recipient, err := s.validateAndCheckUserExists(data.Number, data.FormatJid, &data.Quoted.MessageID, &data.Quoted.MessageID, instance)
@@ -1741,15 +1774,16 @@ func stringPointer(s string) *string {
func sectionsToString(data *ListStruct) (string, error) {
type row struct {
Header *string `json:"header,omitempty"`
Title string `json:"title"`
Description *string `json:"description,omitempty"`
ID string `json:"id"`
Header string `json:"header"`
Title string `json:"title"`
Description string `json:"description"`
ID string `json:"id"`
}
type listSection struct {
Title string `json:"title"`
Rows []row `json:"rows"`
Title string `json:"title"`
HighlightLabel string `json:"highlight_label"`
Rows []row `json:"rows"`
}
type list struct {
@@ -1760,26 +1794,49 @@ func sectionsToString(data *ListStruct) (string, error) {
sections := []listSection{}
for _, s := range data.Sections {
sectionTitle := s.Title
if sectionTitle == "" {
sectionTitle = " "
}
rows := []row{}
for _, r := range s.Rows {
rowTitle := r.Title
if rowTitle == "" {
rowTitle = " "
}
rowDesc := r.Description
if rowDesc == "" {
rowDesc = " "
}
rowId := r.RowId
if rowId == "" {
rowId = fmt.Sprintf("row_%d", len(rows))
}
rows = append(rows, row{
Title: r.Title,
Description: stringPointer(r.Description),
ID: r.RowId,
Header: rowTitle,
Title: rowTitle,
Description: rowDesc,
ID: rowId,
})
}
section := listSection{
Title: s.Title,
Rows: rows,
Title: sectionTitle,
HighlightLabel: "",
Rows: rows,
}
sections = append(sections, section)
}
buttonText := data.ButtonText
if buttonText == "" {
buttonText = "Ver Menu"
}
listData := list{
Title: data.ButtonText,
Title: buttonText,
Sections: sections,
}
@@ -1792,105 +1849,70 @@ func sectionsToString(data *ListStruct) (string, error) {
}
func (s *sendService) SendList(data *ListStruct, instance *instance_model.Instance) (*MessageSendStruct, error) {
client, err := s.ensureClientConnected(instance.Id)
if err != nil {
return nil, err
// Legacy ListMessage format - works on iOS, Android and Web
// Matching PAPI Node.js default (non-modern) path exactly
buttonText := data.ButtonText
if buttonText == "" {
buttonText = "Ver Menu"
}
messageId := client.GenerateMessageID()
templateId := strconv.FormatInt(time.Now().UnixNano()/1000000, 10)
messageParamsJSON := `{"from":"api","templateId":` + templateId + `}`
buttons := []*waE2E.InteractiveMessage_NativeFlowMessage_NativeFlowButton{}
sectionString, err := sectionsToString(data)
if err != nil {
return nil, err
// Build sections in legacy ListMessage format
var sections []*waE2E.ListMessage_Section
for _, sec := range data.Sections {
sectionTitle := sec.Title
if sectionTitle == "" {
sectionTitle = " "
}
var rows []*waE2E.ListMessage_Row
for i, r := range sec.Rows {
rowTitle := r.Title
if rowTitle == "" {
rowTitle = " "
}
rowId := r.RowId
if rowId == "" {
rowId = fmt.Sprintf("row_%d_%d", i, len(rows))
}
rows = append(rows, &waE2E.ListMessage_Row{
Title: proto.String(rowTitle),
Description: proto.String(r.Description),
RowID: proto.String(rowId),
})
}
sections = append(sections, &waE2E.ListMessage_Section{
Title: proto.String(sectionTitle),
Rows: rows,
})
}
buttons = append(buttons, &waE2E.InteractiveMessage_NativeFlowMessage_NativeFlowButton{
Name: proto.String("single_select"),
ButtonParamsJSON: proto.String(sectionString),
listType := waE2E.ListMessage_SINGLE_SELECT
listMessage := &waE2E.ListMessage{
Title: proto.String(data.Title),
Description: proto.String(data.Description),
ButtonText: proto.String(buttonText),
FooterText: proto.String(data.FooterText),
ListType: &listType,
Sections: sections,
}
// Send as plain ListMessage (NO ViewOnceMessage wrapper) - matching PAPI Node.js
msg := &waE2E.Message{
ListMessage: listMessage,
}
message, err := s.SendMessage(instance, msg, "ListMessage", &SendDataStruct{
Number: data.Number,
Delay: data.Delay,
})
body := func() string {
t := "*" + data.Title + "*"
if data.Description != "" {
t += "\n\n" + data.Description + "\n"
}
return t
}()
msg := &waE2E.Message{ViewOnceMessage: &waE2E.FutureProofMessage{
Message: &waE2E.Message{
InteractiveMessage: &waE2E.InteractiveMessage{
Body: &waE2E.InteractiveMessage_Body{
Text: &body,
},
Footer: &waE2E.InteractiveMessage_Footer{
Text: &data.FooterText,
},
InteractiveMessage: &waE2E.InteractiveMessage_NativeFlowMessage_{
NativeFlowMessage: &waE2E.InteractiveMessage_NativeFlowMessage{
Buttons: buttons,
MessageParamsJSON: &messageParamsJSON,
},
},
},
},
}}
recipient, err := s.validateAndCheckUserExists(data.Number, data.FormatJid, &data.Quoted.MessageID, &data.Quoted.MessageID, instance)
if err != nil {
s.loggerWrapper.GetLogger(instance.Id).LogError("[%s] Error validating message fields or user check: %v", instance.Id, err)
s.loggerWrapper.GetLogger(instance.Id).LogError("[%s] Error sending list: %v", instance.Id, err)
return nil, err
}
if data.Delay > 0 {
err := client.SendChatPresence(context.Background(), recipient, types.ChatPresence("composing"), types.ChatPresenceMedia(""))
if err != nil {
return nil, err
}
time.Sleep(time.Duration(data.Delay) * time.Millisecond)
err = s.clientPointer[instance.Id].SendChatPresence(context.Background(), recipient, types.ChatPresence("paused"), types.ChatPresenceMedia(""))
if err != nil {
return nil, err
}
}
response, err := s.clientPointer[instance.Id].SendMessage(context.Background(), recipient, msg, whatsmeow.SendRequestExtra{ID: messageId})
if err != nil {
return nil, err
}
messageInfo := types.MessageInfo{
MessageSource: types.MessageSource{
Chat: recipient,
Sender: *s.clientPointer[instance.Id].Store.ID,
IsFromMe: true,
IsGroup: false,
},
ID: messageId,
Timestamp: time.Now(),
ServerID: response.ServerID,
Type: "ListMessage",
}
messageSent := &MessageSendStruct{
Info: messageInfo,
Message: msg,
MessageContextInfo: &waE2E.ContextInfo{
StanzaID: proto.String(data.Quoted.MessageID),
Participant: proto.String(data.Quoted.Participant),
QuotedMessage: &waE2E.Message{Conversation: proto.String("")},
},
}
return messageSent, nil
s.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] List sent to %s", instance.Id, data.Number)
return message, nil
}
func (s *sendService) SendMessage(instance *instance_model.Instance, msg *waE2E.Message, messageType string, data *SendDataStruct) (*MessageSendStruct, error) {
@@ -2008,6 +2030,22 @@ func (s *sendService) SendMessage(instance *instance_model.Instance, msg *waE2E.
Participant: proto.String(data.Quoted.Participant),
QuotedMessage: &waE2E.Message{Conversation: proto.String("")},
}
case "InteractiveMessage":
if msg.InteractiveMessage != nil {
msg.InteractiveMessage.ContextInfo = &waE2E.ContextInfo{
StanzaID: proto.String(data.Quoted.MessageID),
Participant: proto.String(data.Quoted.Participant),
QuotedMessage: &waE2E.Message{Conversation: proto.String("")},
}
}
case "ListMessage":
if msg.ListMessage != nil {
msg.ListMessage.ContextInfo = &waE2E.ContextInfo{
StanzaID: proto.String(data.Quoted.MessageID),
Participant: proto.String(data.Quoted.Participant),
QuotedMessage: &waE2E.Message{Conversation: proto.String("")},
}
}
default:
return nil, fmt.Errorf("invalid messageType: %s", messageType)
}
@@ -2042,6 +2080,10 @@ func (s *sendService) SendMessage(instance *instance_model.Instance, msg *waE2E.
msg.LocationMessage.ContextInfo = &waE2E.ContextInfo{}
case "ContactMessage":
msg.ContactMessage.ContextInfo = &waE2E.ContextInfo{}
case "InteractiveMessage":
// ContextInfo already set in SendCarousel/SendButton/SendList
case "ListMessage":
// ContextInfo already set in SendList
default:
return nil, fmt.Errorf("invalid messageType: %s", messageType)
}
@@ -2360,9 +2402,8 @@ func (s *sendService) SendCarousel(data *CarouselStruct, instance *instance_mode
if card.Header.ImageUrl != "" || card.Header.VideoUrl != "" {
header := interactiveCard.Header
// Add media to header if URL provided
if card.Header.ImageUrl != "" {
// Download and upload image
// Download image
resp, err := http.Get(card.Header.ImageUrl)
if err == nil {
defer resp.Body.Close()
@@ -2370,16 +2411,42 @@ func (s *sendService) SendCarousel(data *CarouselStruct, instance *instance_mode
if err == nil {
uploaded, err := client.Upload(context.Background(), fileData, whatsmeow.MediaImage)
if err == nil {
// Generate JPEG thumbnail for iOS compatibility
var jpegThumb []byte
img, _, decErr := image.Decode(bytes.NewReader(fileData))
if decErr == nil {
// Resize to 72px thumbnail
bounds := img.Bounds()
thumbWidth := 72
thumbHeight := int(float64(bounds.Dy()) * float64(thumbWidth) / float64(bounds.Dx()))
if thumbHeight < 1 {
thumbHeight = 1
}
thumbImg := image.NewRGBA(image.Rect(0, 0, thumbWidth, thumbHeight))
for y := 0; y < thumbHeight; y++ {
for x := 0; x < thumbWidth; x++ {
srcX := x * bounds.Dx() / thumbWidth
srcY := y * bounds.Dy() / thumbHeight
thumbImg.Set(x, y, img.At(srcX+bounds.Min.X, srcY+bounds.Min.Y))
}
}
var thumbBuf bytes.Buffer
if jpeg.Encode(&thumbBuf, thumbImg, &jpeg.Options{Quality: 50}) == nil {
jpegThumb = thumbBuf.Bytes()
}
}
header.HasMediaAttachment = proto.Bool(true)
header.Media = &waE2E.InteractiveMessage_Header_ImageMessage{
ImageMessage: &waE2E.ImageMessage{
URL: proto.String(uploaded.URL),
DirectPath: proto.String(uploaded.DirectPath),
MediaKey: uploaded.MediaKey,
Mimetype: proto.String("image/jpeg"),
FileEncSHA256: uploaded.FileEncSHA256,
FileSHA256: uploaded.FileSHA256,
FileLength: proto.Uint64(uint64(len(fileData))),
URL: proto.String(uploaded.URL),
DirectPath: proto.String(uploaded.DirectPath),
MediaKey: uploaded.MediaKey,
Mimetype: proto.String("image/jpeg"),
FileEncSHA256: uploaded.FileEncSHA256,
FileSHA256: uploaded.FileSHA256,
FileLength: proto.Uint64(uint64(len(fileData))),
JPEGThumbnail: jpegThumb,
},
}
}
@@ -2458,14 +2525,11 @@ func (s *sendService) SendCarousel(data *CarouselStruct, instance *instance_mode
}
}
// messageParamsJSON is REQUIRED for NativeFlowMessage with buttons
messageParamsJSON := fmt.Sprintf(`{"from":"api","templateId":"%d"}`, time.Now().UnixNano()/1000000)
// Cards in carousel: do NOT set MessageParamsJSON or MessageVersion
// (matching PAPI Node.js behavior for iOS compatibility)
interactiveCard.InteractiveMessage = &waE2E.InteractiveMessage_NativeFlowMessage_{
NativeFlowMessage: &waE2E.InteractiveMessage_NativeFlowMessage{
Buttons: buttons,
MessageParamsJSON: proto.String(messageParamsJSON),
MessageVersion: proto.Int32(1),
Buttons: buttons,
},
}
}
@@ -2473,14 +2537,12 @@ func (s *sendService) SendCarousel(data *CarouselStruct, instance *instance_mode
cards[i] = interactiveCard
}
// Build carousel message
carouselCardType := waE2E.InteractiveMessage_CarouselMessage_HSCROLL_CARDS
// Build carousel message (do NOT set CarouselCardType - matching PAPI Node.js for iOS)
interactiveMsg := &waE2E.InteractiveMessage{
InteractiveMessage: &waE2E.InteractiveMessage_CarouselMessage_{
CarouselMessage: &waE2E.InteractiveMessage_CarouselMessage{
Cards: cards,
MessageVersion: &messageVersion,
CarouselCardType: &carouselCardType,
Cards: cards,
MessageVersion: &messageVersion,
},
},
}
@@ -2539,6 +2601,246 @@ func (s *sendService) SendCarousel(data *CarouselStruct, instance *instance_mode
return message, nil
}
func (s *sendService) SendStatusText(data *StatusTextStruct, instance *instance_model.Instance) (*MessageSendStruct, error) {
client, err := s.ensureClientConnected(instance.Id)
if err != nil {
return nil, err
}
if data.Text == "" {
return nil, errors.New("text is required")
}
msg := &waE2E.Message{
ExtendedTextMessage: &waE2E.ExtendedTextMessage{
Text: &data.Text,
},
}
messageID := data.Id
if messageID == "" {
messageID = client.GenerateMessageID()
}
recipient := types.NewJID("status", "broadcast")
response, err := client.SendMessage(context.Background(), recipient, msg, whatsmeow.SendRequestExtra{ID: messageID})
if err != nil {
return nil, err
}
messageInfo := types.MessageInfo{
MessageSource: types.MessageSource{
Chat: recipient,
Sender: *client.Store.ID,
IsFromMe: true,
IsGroup: false,
},
ID: messageID,
Timestamp: time.Now(),
ServerID: response.ServerID,
Type: "StatusTextMessage",
}
messageSent := &MessageSendStruct{
Info: messageInfo,
Message: msg,
MessageContextInfo: &waE2E.ContextInfo{
StanzaID: proto.String(""),
Participant: proto.String(""),
QuotedMessage: &waE2E.Message{Conversation: proto.String("")},
},
}
s.sendStatusWebhook(messageSent, instance, "text")
s.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Status text sent successfully", instance.Id)
return messageSent, nil
}
func (s *sendService) SendStatusMediaUrl(data *StatusMediaStruct, instance *instance_model.Instance) (*MessageSendStruct, error) {
client, err := s.ensureClientConnected(instance.Id)
if err != nil {
return nil, err
}
if data.Url == "" {
return nil, errors.New("url is required")
}
if data.Type != "image" && data.Type != "video" {
return nil, errors.New("type must be 'image' or 'video'")
}
req, err := http.NewRequest("GET", data.Url, nil)
if err != nil {
return nil, err
}
req.Header.Set("User-Agent", "Evolution-GO/1.0")
httpClient := &http.Client{}
resp, err := httpClient.Do(req)
if err != nil {
return nil, fmt.Errorf("failed to download file from URL: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode > 299 {
return nil, fmt.Errorf("failed to download file: HTTP status %d", resp.StatusCode)
}
fileData, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return s.sendStatusMedia(client, data, fileData, instance)
}
func (s *sendService) SendStatusMediaFile(data *StatusMediaStruct, fileData []byte, instance *instance_model.Instance) (*MessageSendStruct, error) {
client, err := s.ensureClientConnected(instance.Id)
if err != nil {
return nil, err
}
if data.Type != "image" && data.Type != "video" {
return nil, errors.New("type must be 'image' or 'video'")
}
return s.sendStatusMedia(client, data, fileData, instance)
}
func (s *sendService) sendStatusMedia(client *whatsmeow.Client, data *StatusMediaStruct, fileData []byte, instance *instance_model.Instance) (*MessageSendStruct, error) {
mime, _ := mimetype.DetectReader(bytes.NewReader(fileData))
mimeType := mime.String()
var uploadType whatsmeow.MediaType
switch data.Type {
case "image":
if mimeType != "image/jpeg" && mimeType != "image/png" && mimeType != "image/webp" {
return nil, fmt.Errorf("invalid file format: '%s'. Only 'image/jpeg', 'image/png' and 'image/webp' are accepted", mimeType)
}
if mimeType == "image/webp" {
mimeType = "image/jpeg"
}
uploadType = whatsmeow.MediaImage
case "video":
if mimeType != "video/mp4" {
return nil, fmt.Errorf("invalid file format: '%s'. Only 'video/mp4' is accepted", mimeType)
}
uploadType = whatsmeow.MediaVideo
default:
return nil, errors.New("invalid media type")
}
uploaded, err := client.Upload(context.Background(), fileData, uploadType)
if err != nil {
return nil, err
}
s.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Status media uploaded, size: %d", instance.Id, uploaded.FileLength)
var media *waE2E.Message
var mediaType string
switch data.Type {
case "image":
media = &waE2E.Message{ImageMessage: &waE2E.ImageMessage{
Caption: proto.String(data.Caption),
URL: proto.String(uploaded.URL),
DirectPath: proto.String(uploaded.DirectPath),
MediaKey: uploaded.MediaKey,
Mimetype: proto.String(mimeType),
FileEncSHA256: uploaded.FileEncSHA256,
FileSHA256: uploaded.FileSHA256,
FileLength: proto.Uint64(uint64(len(fileData))),
}}
mediaType = "ImageMessage"
case "video":
media = &waE2E.Message{VideoMessage: &waE2E.VideoMessage{
Caption: proto.String(data.Caption),
URL: proto.String(uploaded.URL),
DirectPath: proto.String(uploaded.DirectPath),
MediaKey: uploaded.MediaKey,
Mimetype: proto.String(mimeType),
FileEncSHA256: uploaded.FileEncSHA256,
FileSHA256: uploaded.FileSHA256,
FileLength: proto.Uint64(uint64(len(fileData))),
}}
mediaType = "VideoMessage"
}
messageID := data.Id
if messageID == "" {
messageID = client.GenerateMessageID()
}
recipient := types.NewJID("status", "broadcast")
response, err := client.SendMessage(context.Background(), recipient, media, whatsmeow.SendRequestExtra{ID: messageID})
if err != nil {
return nil, err
}
messageInfo := types.MessageInfo{
MessageSource: types.MessageSource{
Chat: recipient,
Sender: *client.Store.ID,
IsFromMe: true,
IsGroup: false,
},
ID: messageID,
Timestamp: time.Now(),
ServerID: response.ServerID,
Type: mediaType,
}
messageSent := &MessageSendStruct{
Info: messageInfo,
Message: media,
MessageContextInfo: &waE2E.ContextInfo{
StanzaID: proto.String(""),
Participant: proto.String(""),
QuotedMessage: &waE2E.Message{Conversation: proto.String("")},
},
}
s.sendStatusWebhook(messageSent, instance, "media")
return messageSent, nil
}
func (s *sendService) sendStatusWebhook(messageSent *MessageSendStruct, instance *instance_model.Instance, messageType string) {
postMap := make(map[string]interface{})
postMap["event"] = "SendStatus"
messageData := make(map[string]interface{})
messageData["Info"] = messageSent.Info
msgBytes, err := json.Marshal(messageSent.Message)
if err != nil {
s.loggerWrapper.GetLogger(instance.Id).LogError("[%s] Failed to marshal status message: %v", instance.Id, err)
return
}
var msgMap map[string]interface{}
if err := json.Unmarshal(msgBytes, &msgMap); err != nil {
s.loggerWrapper.GetLogger(instance.Id).LogError("[%s] Failed to unmarshal status message: %v", instance.Id, err)
return
}
messageData["Message"] = msgMap
messageData["MessageContextInfo"] = messageSent.MessageContextInfo
postMap["data"] = messageData
postMap["instanceToken"] = instance.Token
postMap["instanceId"] = instance.Id
postMap["instanceName"] = instance.Name
values, err := json.Marshal(postMap)
if err != nil {
s.loggerWrapper.GetLogger(instance.Id).LogError("[%s] Failed to marshal webhook payload: %v", instance.Id, err)
return
}
go s.whatsmeowService.CallWebhook(instance, "sendstatus", values)
if s.config.AmqpGlobalEnabled || s.config.NatsGlobalEnabled {
go s.whatsmeowService.SendToGlobalQueues("SendStatus", values, instance.Id)
}
s.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Status %s sent successfully", instance.Id, messageType)
}
func NewSendService(
clientPointer map[string]*whatsmeow.Client,
whatsmeowService whatsmeow_service.WhatsmeowService,
+63
View File
@@ -3,6 +3,7 @@ package utils
import (
"encoding/json"
"fmt"
"net"
"net/http"
"net/url"
"runtime"
@@ -253,6 +254,66 @@ func CreateSocks5Proxy(socks5Host, socks5Port, user, password string) (proxy.Dia
// }, nil
}
// NormalizeProxyProtocol returns the proxy protocol normalized to one of
// http/https/socks5. If not supplied, it is inferred from the port — ports
// 1080, 2080, and 42000-43000 map to socks5; everything else defaults to http.
func NormalizeProxyProtocol(protocol, port string) string {
normalized := strings.ToLower(strings.TrimSpace(protocol))
switch normalized {
case "socks":
return "socks5"
case "http", "https", "socks5":
return normalized
}
switch strings.TrimSpace(port) {
case "1080", "2080":
return "socks5"
}
portNum, err := strconv.Atoi(strings.TrimSpace(port))
if err == nil && portNum >= 42000 && portNum <= 43000 {
return "socks5"
}
return "http"
}
// BuildProxyAddress builds a proxy URL string suitable for whatsmeow's
// client.SetProxyAddress — it supports http, https, and socks5 with optional
// basic auth credentials.
func BuildProxyAddress(protocol, host, port, user, password string) (string, error) {
if strings.TrimSpace(host) == "" {
return "", fmt.Errorf("proxy host is required")
}
if strings.TrimSpace(port) == "" {
return "", fmt.Errorf("proxy port is required")
}
normalizedProtocol := NormalizeProxyProtocol(protocol, port)
if normalizedProtocol != "http" && normalizedProtocol != "https" && normalizedProtocol != "socks5" {
return "", fmt.Errorf("unsupported proxy protocol %q", protocol)
}
proxyURL := &url.URL{
Scheme: normalizedProtocol,
Host: net.JoinHostPort(strings.TrimSpace(host), strings.TrimSpace(port)),
}
if user != "" {
if password != "" {
proxyURL.User = url.UserPassword(user, password)
} else {
proxyURL.User = url.User(user)
}
}
return proxyURL.String(), nil
}
func UpdateUserInfo(values interface{}, field string, value string) interface{} {
v, ok := values.(Values)
if !ok {
@@ -447,6 +508,8 @@ func GetMessageType(waMsg *waE2E.Message) string {
return "template button reply"
case waMsg.InteractiveMessage != nil:
return "interactive"
case waMsg.GetInteractiveResponseMessage() != nil:
return "interactive response"
case waMsg.ListMessage != nil:
return "list"
case waMsg.ProductMessage != nil:
+215 -33
View File
@@ -15,6 +15,7 @@ import (
"regexp"
"strconv"
"strings"
"sync"
"time"
"golang.org/x/image/webp"
@@ -141,6 +142,7 @@ type UserCollection struct {
}
type ProxyConfig struct {
Protocol string `json:"protocol,omitempty"`
Host string `json:"host"`
Password string `json:"password"`
Port string `json:"port"`
@@ -398,6 +400,7 @@ func (w whatsmeowService) StartClient(cd *ClientData) {
return
}
proxyProtocol := proxyConfig.Protocol
proxyHost := proxyConfig.Host
proxyPort := proxyConfig.Port
proxyUsername := proxyConfig.Username
@@ -411,6 +414,10 @@ func (w whatsmeowService) StartClient(cd *ClientData) {
proxyPort = w.config.ProxyPort
}
if proxyConfig.Protocol == "" {
proxyProtocol = w.config.ProxyProtocol
}
if proxyConfig.Username == "" {
proxyUsername = w.config.ProxyUsername
}
@@ -419,12 +426,16 @@ func (w whatsmeowService) StartClient(cd *ClientData) {
proxyPassword = w.config.ProxyPassword
}
proxy, err := utils.CreateSocks5Proxy(proxyHost, proxyPort, proxyUsername, proxyPassword)
proxyAddress, err := utils.BuildProxyAddress(proxyProtocol, proxyHost, proxyPort, proxyUsername, proxyPassword)
if err != nil {
w.loggerWrapper.GetLogger(cd.Instance.Id).LogWarn("[%s] Proxy error, continuing without proxy: %v", cd.Instance.Id, err)
} else {
client.SetSOCKSProxy(proxy)
w.loggerWrapper.GetLogger(cd.Instance.Id).LogInfo("[%s] Proxy enabled", cd.Instance.Id)
err = client.SetProxyAddress(proxyAddress)
if err != nil {
w.loggerWrapper.GetLogger(cd.Instance.Id).LogWarn("[%s] Proxy error, continuing without proxy: %v", cd.Instance.Id, err)
} else {
w.loggerWrapper.GetLogger(cd.Instance.Id).LogInfo("[%s] Proxy enabled (%s)", cd.Instance.Id, utils.NormalizeProxyProtocol(proxyProtocol, proxyPort))
}
}
}
@@ -1337,20 +1348,21 @@ func (mycli *MyClient) myEventHandler(rawEvt interface{}) {
if err == nil {
webpReader := bytes.NewReader(data)
img, err := webp.Decode(webpReader)
if err != nil {
mycli.loggerWrapper.GetLogger(mycli.userID).LogError("[%s] Failed to decode webp image: %v", mycli.userID, err)
return
img, decErr := webp.Decode(webpReader)
if decErr != nil {
mycli.loggerWrapper.GetLogger(mycli.userID).LogWarn("[%s] Failed to decode webp sticker, keeping raw webp: %v", mycli.userID, decErr)
extension = ".webp"
mimeType = "image/webp"
} else {
var pngBuffer bytes.Buffer
if encErr := png.Encode(&pngBuffer, img); encErr != nil {
mycli.loggerWrapper.GetLogger(mycli.userID).LogWarn("[%s] Failed to encode png from sticker, keeping raw webp: %v", mycli.userID, encErr)
extension = ".webp"
mimeType = "image/webp"
} else {
data = pngBuffer.Bytes()
}
}
var pngBuffer bytes.Buffer
err = png.Encode(&pngBuffer, img)
if err != nil {
mycli.loggerWrapper.GetLogger(mycli.userID).LogError("[%s] Failed to encode png image: %v", mycli.userID, err)
return
}
data = pngBuffer.Bytes()
}
// Handle associated child media messages
} else if associatedImg != nil {
@@ -1379,21 +1391,24 @@ func (mycli *MyClient) myEventHandler(rawEvt interface{}) {
mimeType = "image/png"
mycli.loggerWrapper.GetLogger(mycli.userID).LogInfo("[%s] Processing associated child sticker message", mycli.userID)
webpReader := bytes.NewReader(data)
img, err := webp.Decode(webpReader)
if err != nil {
mycli.loggerWrapper.GetLogger(mycli.userID).LogError("[%s] Failed to decode webp image: %v", mycli.userID, err)
return
if err == nil {
webpReader := bytes.NewReader(data)
img, decErr := webp.Decode(webpReader)
if decErr != nil {
mycli.loggerWrapper.GetLogger(mycli.userID).LogWarn("[%s] Failed to decode webp sticker, keeping raw webp: %v", mycli.userID, decErr)
extension = ".webp"
mimeType = "image/webp"
} else {
var pngBuffer bytes.Buffer
if encErr := png.Encode(&pngBuffer, img); encErr != nil {
mycli.loggerWrapper.GetLogger(mycli.userID).LogWarn("[%s] Failed to encode png from associated sticker, keeping raw webp: %v", mycli.userID, encErr)
extension = ".webp"
mimeType = "image/webp"
} else {
data = pngBuffer.Bytes()
}
}
}
var pngBuffer bytes.Buffer
err = png.Encode(&pngBuffer, img)
if err != nil {
mycli.loggerWrapper.GetLogger(mycli.userID).LogError("[%s] Failed to encode png image: %v", mycli.userID, err)
return
}
data = pngBuffer.Bytes()
}
downloadDuration := time.Since(downloadStart)
@@ -1499,6 +1514,97 @@ func (mycli *MyClient) myEventHandler(rawEvt interface{}) {
postMap["data"] = dataMap
// ===== BUTTON CLICK EVENT DETECTION =====
// Detecta cliques em botões e emite evento separado "ButtonClick"
// Suporta 3 formatos: ButtonsResponseMessage, InteractiveResponseMessage (NativeFlow), TemplateButtonReplyMessage
var buttonClickData map[string]interface{}
if resp := evt.Message.GetButtonsResponseMessage(); resp != nil {
// Legacy buttons response
buttonClickData = map[string]interface{}{
"buttonId": resp.GetSelectedButtonID(),
"buttonText": resp.GetSelectedDisplayText(),
"type": "buttons_response",
}
mycli.loggerWrapper.GetLogger(mycli.userID).LogInfo("[%s] Button click detected (legacy): buttonId=%s, buttonText=%s", mycli.userID, resp.GetSelectedButtonID(), resp.GetSelectedDisplayText())
} else if resp := evt.Message.GetInteractiveResponseMessage(); resp != nil {
// NativeFlow interactive response (quick_reply, cta_url, cta_call, cta_copy)
if nf := resp.GetNativeFlowResponseMessage(); nf != nil {
buttonId := ""
buttonText := ""
// Parse paramsJSON to extract id and display_text
if nf.GetParamsJSON() != "" {
var params map[string]interface{}
if err := json.Unmarshal([]byte(nf.GetParamsJSON()), &params); err == nil {
if id, ok := params["id"].(string); ok {
buttonId = id
}
if dt, ok := params["display_text"].(string); ok {
buttonText = dt
}
}
}
buttonClickData = map[string]interface{}{
"buttonId": buttonId,
"buttonText": buttonText,
"type": "native_flow_response",
"name": nf.GetName(),
"paramsJSON": nf.GetParamsJSON(),
}
mycli.loggerWrapper.GetLogger(mycli.userID).LogInfo("[%s] Button click detected (native_flow): name=%s, buttonId=%s, buttonText=%s", mycli.userID, nf.GetName(), buttonId, buttonText)
}
} else if resp := evt.Message.GetTemplateButtonReplyMessage(); resp != nil {
// Template button reply
buttonClickData = map[string]interface{}{
"buttonId": resp.GetSelectedID(),
"buttonText": resp.GetSelectedDisplayText(),
"type": "template_button_reply",
}
mycli.loggerWrapper.GetLogger(mycli.userID).LogInfo("[%s] Button click detected (template): buttonId=%s, buttonText=%s", mycli.userID, resp.GetSelectedID(), resp.GetSelectedDisplayText())
} else if resp := evt.Message.GetListResponseMessage(); resp != nil {
// List response (single select)
buttonClickData = map[string]interface{}{
"buttonId": resp.GetSingleSelectReply().GetSelectedRowID(),
"buttonText": resp.GetTitle(),
"type": "list_response",
"description": resp.GetDescription(),
}
mycli.loggerWrapper.GetLogger(mycli.userID).LogInfo("[%s] List selection detected: rowId=%s, title=%s", mycli.userID, resp.GetSingleSelectReply().GetSelectedRowID(), resp.GetTitle())
}
// Se detectou clique em botão, emite evento separado "ButtonClick"
if buttonClickData != nil {
buttonClickMap := map[string]interface{}{
"event": "ButtonClick",
"data": map[string]interface{}{
"buttonId": buttonClickData["buttonId"],
"buttonText": buttonClickData["buttonText"],
"type": buttonClickData["type"],
"phone": dataMap["Sender"],
"jid": dataMap["Sender"],
"pushName": dataMap["PushName"],
"messageId": dataMap["ID"],
"chat": dataMap["Chat"],
"fromMe": dataMap["FromMe"],
"timestamp": evt.Info.Timestamp.Unix(),
"extraData": buttonClickData,
},
"instanceToken": mycli.token,
"instanceId": mycli.userID,
"instanceName": mycli.Instance.Name,
}
buttonClickJSON, err := json.Marshal(buttonClickMap)
if err == nil {
buttonClickQueue := strings.ToLower(fmt.Sprintf("%s.buttonclick", userID))
go mycli.service.CallWebhook(mycli.Instance, buttonClickQueue, buttonClickJSON)
if mycli.config.AmqpGlobalEnabled || mycli.config.NatsGlobalEnabled {
go mycli.service.SendToGlobalQueues("ButtonClick", buttonClickJSON, mycli.userID)
}
mycli.loggerWrapper.GetLogger(mycli.userID).LogInfo("[%s] ===== BUTTON CLICK EVENT DISPATCHED ===== Type: %s, ButtonId: %s", mycli.userID, buttonClickData["type"], buttonClickData["buttonId"])
}
}
mycli.loggerWrapper.GetLogger(mycli.userID).LogInfo("[%s] ===== MESSAGE PROCESSING COMPLETED ===== ID: %s, From: %s, Type: %s, Webhook: %v", mycli.userID, evt.Info.ID, evt.Info.Chat.String(), evt.Info.Type, doWebhook)
case *events.Receipt:
doWebhook = true
@@ -1914,16 +2020,57 @@ func (w *whatsmeowService) CallWebhook(instance *instance_model.Instance, queueN
if contains(subscriptions, "MESSAGE") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
} else {
// Forward to GROUP/NEWSLETTER subscribers even without MESSAGE subscription
if dataMap, ok := data["data"].(map[string]interface{}); ok {
if infoMap, ok := dataMap["Info"].(map[string]interface{}); ok {
if chat, ok := infoMap["Chat"].(string); ok {
if strings.HasSuffix(chat, "@g.us") && contains(subscriptions, "GROUP") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s (Group)", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
} else if strings.HasSuffix(chat, "@newsletter") && contains(subscriptions, "NEWSLETTER") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s (Newsletter)", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
}
}
}
}
}
case "SendMessage":
if contains(subscriptions, "SEND_MESSAGE") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
} else {
if dataMap, ok := data["data"].(map[string]interface{}); ok {
if infoMap, ok := dataMap["Info"].(map[string]interface{}); ok {
if chat, ok := infoMap["Chat"].(string); ok {
if strings.HasSuffix(chat, "@g.us") && contains(subscriptions, "GROUP") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s (Group)", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
} else if strings.HasSuffix(chat, "@newsletter") && contains(subscriptions, "NEWSLETTER") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s (Newsletter)", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
}
}
}
}
}
case "Receipt":
if contains(subscriptions, "READ_RECEIPT") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
} else {
if dataMap, ok := data["data"].(map[string]interface{}); ok {
if chat, ok := dataMap["Chat"].(string); ok {
if strings.HasSuffix(chat, "@g.us") && contains(subscriptions, "GROUP") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s (Group)", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
} else if strings.HasSuffix(chat, "@newsletter") && contains(subscriptions, "NEWSLETTER") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s (Newsletter)", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
}
}
}
}
case "Presence":
if contains(subscriptions, "PRESENCE") {
@@ -1975,6 +2122,11 @@ func (w *whatsmeowService) CallWebhook(instance *instance_model.Instance, queueN
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
}
case "ButtonClick":
if contains(subscriptions, "BUTTON_CLICK") || contains(subscriptions, "MESSAGE") {
w.loggerWrapper.GetLogger(instance.Id).LogInfo("[%s] Event received of type %s", instance.Id, eventType)
w.sendToQueueOrWebhook(instance, queueName, jsonData)
}
default:
return
@@ -2035,7 +2187,21 @@ func (w whatsmeowService) StartInstance(instanceId string) error {
}
if instance.Proxy == "" && w.config.ProxyHost != "" && w.config.ProxyPort != "" && w.config.ProxyUsername != "" && w.config.ProxyPassword != "" {
instance.Proxy = fmt.Sprintf(`{"host": "%s", "port": "%s", "username": "%s", "password": "%s"}`, w.config.ProxyHost, w.config.ProxyPort, w.config.ProxyUsername, w.config.ProxyPassword)
proxyConfig := ProxyConfig{
Protocol: utils.NormalizeProxyProtocol(w.config.ProxyProtocol, w.config.ProxyPort),
Host: w.config.ProxyHost,
Port: w.config.ProxyPort,
Username: w.config.ProxyUsername,
Password: w.config.ProxyPassword,
}
proxyJSON, err := json.Marshal(proxyConfig)
if err != nil {
w.loggerWrapper.GetLogger(instanceId).LogError("[%s] Failed to marshal proxy config: %v", instanceId, err)
return err
}
instance.Proxy = string(proxyJSON)
err = w.instanceRepository.UpdateProxy(instance.Id, instance.Proxy)
if err != nil {
@@ -2293,7 +2459,21 @@ func (w *whatsmeowService) SendToGlobalQueues(eventType string, payload []byte,
}
}
var (
cachedWebVersion *clientVersion
cachedWebVersionAt time.Time
cachedWebVersionMu sync.Mutex
webVersionCacheTTL = 1 * time.Hour
)
func fetchWhatsAppWebVersion() (*clientVersion, error) {
cachedWebVersionMu.Lock()
defer cachedWebVersionMu.Unlock()
if cachedWebVersion != nil && time.Since(cachedWebVersionAt) < webVersionCacheTTL {
return cachedWebVersion, nil
}
resp, err := http.Get("https://web.whatsapp.com/sw.js")
if err != nil {
return nil, fmt.Errorf("failed to fetch WhatsApp Web version: %v", err)
@@ -2327,11 +2507,13 @@ func fetchWhatsAppWebVersion() (*clientVersion, error) {
// Log qual padrão funcionou
if clientRevision > 0 {
return &clientVersion{
cachedWebVersion = &clientVersion{
Major: 2,
Minor: 3000,
Patch: clientRevision,
}, nil
}
cachedWebVersionAt = time.Now()
return cachedWebVersion, nil
}
}
}
Submodule
+1
Submodule whatsmeow-lib added at 0923702fb3.