mirror of
https://github.com/GMWalletApp/epusdt.git
synced 2026-07-07 18:26:16 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 049a15cb95 | |||
| 2a36a10e7f |
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/GMWalletApp/epusdt/model/mdb"
|
||||
"github.com/GMWalletApp/epusdt/model/request"
|
||||
"github.com/GMWalletApp/epusdt/model/service"
|
||||
"github.com/GMWalletApp/epusdt/util/log"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
@@ -147,23 +148,43 @@ func (c *BaseAdminController) CloseOrder(ctx echo.Context) error {
|
||||
// @Router /admin/api/v1/orders/{trade_id}/mark-paid [post]
|
||||
func (c *BaseAdminController) MarkOrderPaid(ctx echo.Context) error {
|
||||
tradeID := ctx.Param("trade_id")
|
||||
adminUserID := currentAdminUserID(ctx)
|
||||
req := new(MarkPaidRequest)
|
||||
if err := ctx.Bind(req); err != nil {
|
||||
log.Sugar.Warnf("[admin-order] mark-paid bind failed admin_user_id=%d trade_id=%s err=%v", adminUserID, tradeID, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
req.BlockTransactionId = strings.TrimSpace(req.BlockTransactionId)
|
||||
if err := c.ValidateStruct(ctx, req); err != nil {
|
||||
log.Sugar.Warnf("[admin-order] mark-paid validation failed admin_user_id=%d trade_id=%s block_transaction_id=%s err=%v", adminUserID, tradeID, req.BlockTransactionId, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
order, err := data.GetOrderInfoByTradeId(tradeID)
|
||||
if err != nil {
|
||||
log.Sugar.Warnf("[admin-order] mark-paid load failed admin_user_id=%d trade_id=%s block_transaction_id=%s err=%v", adminUserID, tradeID, req.BlockTransactionId, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
if order.ID == 0 {
|
||||
return c.FailJson(ctx, errors.New("order not found"))
|
||||
err = errors.New("order not found")
|
||||
log.Sugar.Warnf("[admin-order] mark-paid rejected admin_user_id=%d trade_id=%s block_transaction_id=%s err=%v", adminUserID, tradeID, req.BlockTransactionId, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
if order.Status != mdb.StatusWaitPay {
|
||||
return c.FailJson(ctx, errors.New("order is not waiting payment"))
|
||||
err = errors.New("order is not waiting payment")
|
||||
log.Sugar.Warnf("[admin-order] mark-paid rejected admin_user_id=%d trade_id=%s status=%d block_transaction_id=%s err=%v", adminUserID, tradeID, order.Status, req.BlockTransactionId, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
if !isOnChainOrder(order.PayProvider) {
|
||||
err = errors.New("order is not an on-chain payment order")
|
||||
log.Sugar.Warnf("[admin-order] mark-paid rejected admin_user_id=%d trade_id=%s pay_provider=%s block_transaction_id=%s err=%v", adminUserID, tradeID, order.PayProvider, req.BlockTransactionId, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
verifiedBlockTransactionID, err := service.ValidateManualOrderPayment(order, req.BlockTransactionId)
|
||||
if err != nil {
|
||||
log.Sugar.Warnf("[admin-order] mark-paid chain verification failed admin_user_id=%d trade_id=%s network=%s token=%s amount=%.8f block_transaction_id=%s err=%v", adminUserID, tradeID, order.Network, order.Token, order.ActualAmount, req.BlockTransactionId, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
req.BlockTransactionId = verifiedBlockTransactionID
|
||||
err = service.OrderProcessing(&request.OrderProcessingRequest{
|
||||
ReceiveAddress: order.ReceiveAddress,
|
||||
Currency: order.Currency,
|
||||
@@ -174,8 +195,10 @@ func (c *BaseAdminController) MarkOrderPaid(ctx echo.Context) error {
|
||||
BlockTransactionId: req.BlockTransactionId,
|
||||
})
|
||||
if err != nil {
|
||||
log.Sugar.Warnf("[admin-order] mark-paid processing failed admin_user_id=%d trade_id=%s block_transaction_id=%s err=%v", adminUserID, tradeID, req.BlockTransactionId, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
log.Sugar.Infof("[admin-order] mark-paid success admin_user_id=%d trade_id=%s block_transaction_id=%s", adminUserID, tradeID, req.BlockTransactionId)
|
||||
return c.SucJson(ctx, nil)
|
||||
}
|
||||
|
||||
@@ -193,16 +216,46 @@ func (c *BaseAdminController) MarkOrderPaid(ctx echo.Context) error {
|
||||
// @Router /admin/api/v1/orders/{trade_id}/resend-callback [post]
|
||||
func (c *BaseAdminController) ResendCallback(ctx echo.Context) error {
|
||||
tradeID := ctx.Param("trade_id")
|
||||
adminUserID := currentAdminUserID(ctx)
|
||||
order, err := data.GetOrderInfoByTradeId(tradeID)
|
||||
if err != nil {
|
||||
log.Sugar.Warnf("[admin-order] resend-callback load failed admin_user_id=%d trade_id=%s err=%v", adminUserID, tradeID, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
if order.ID == 0 {
|
||||
err = errors.New("order not found")
|
||||
log.Sugar.Warnf("[admin-order] resend-callback rejected admin_user_id=%d trade_id=%s err=%v", adminUserID, tradeID, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
if order.Status != mdb.StatusPaySuccess {
|
||||
err = errors.New("order is not paid (callback not applicable)")
|
||||
log.Sugar.Warnf("[admin-order] resend-callback rejected admin_user_id=%d trade_id=%s status=%d err=%v", adminUserID, tradeID, order.Status, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
if strings.TrimSpace(order.NotifyUrl) == "" {
|
||||
err = errors.New("order has empty notify_url")
|
||||
log.Sugar.Warnf("[admin-order] resend-callback rejected admin_user_id=%d trade_id=%s err=%v", adminUserID, tradeID, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
ok, err := data.ReopenOrderCallback(tradeID)
|
||||
if err != nil {
|
||||
log.Sugar.Warnf("[admin-order] resend-callback reopen failed admin_user_id=%d trade_id=%s err=%v", adminUserID, tradeID, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
if !ok {
|
||||
return c.FailJson(ctx, errors.New("order is not paid (callback not applicable)"))
|
||||
err = errors.New("resend callback failed (concurrent state change)")
|
||||
log.Sugar.Warnf("[admin-order] resend-callback rejected admin_user_id=%d trade_id=%s err=%v", adminUserID, tradeID, err)
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
log.Sugar.Infof("[admin-order] resend-callback queued admin_user_id=%d trade_id=%s", adminUserID, tradeID)
|
||||
return c.SucJson(ctx, nil)
|
||||
}
|
||||
|
||||
func isOnChainOrder(payProvider string) bool {
|
||||
payProvider = strings.TrimSpace(payProvider)
|
||||
return payProvider == "" || payProvider == mdb.PaymentProviderOnChain
|
||||
}
|
||||
|
||||
// ExportOrders streams matching orders as CSV. No pagination — the
|
||||
// caller drives what rows to include via filter params. Capped at
|
||||
// 10k rows to keep the response bounded.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package comm
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/GMWalletApp/epusdt/model/response"
|
||||
"github.com/GMWalletApp/epusdt/model/service"
|
||||
"github.com/labstack/echo/v4"
|
||||
@@ -10,23 +8,18 @@ import (
|
||||
|
||||
// CheckoutCounter 收银台
|
||||
// @Summary Checkout counter page
|
||||
// @Description Render the payment checkout counter JSON response for a given trade
|
||||
// @Description Return checkout initialization data when the order exists. This endpoint only confirms order existence and returns base order data; call /pay/check-status/{trade_id} for the current order status (1=waiting payment, 2=paid, 3=expired).
|
||||
// @Tags Payment
|
||||
// @Produce json
|
||||
// @Param trade_id path string true "Trade ID"
|
||||
// @Success 200 {object} response.CheckoutCounterResponse
|
||||
// @Success 200 {object} response.ApiResponse{data=response.CheckoutCounterResponse}
|
||||
// @Failure 400 {object} response.ApiResponse "Order not found (status_code=10008) or other request error"
|
||||
// @Router /pay/checkout-counter-resp/{trade_id} [get]
|
||||
func (c *BaseCommController) CheckoutCounter(ctx echo.Context) (err error) {
|
||||
tradeId := ctx.Param("trade_id")
|
||||
resp, err := service.GetCheckoutCounterByTradeId(tradeId)
|
||||
if err != nil {
|
||||
if err == service.ErrOrder {
|
||||
// Unknown trade id: render the page with empty payload
|
||||
// (client side shows a friendly "order not found" screen).
|
||||
emptyResp := response.CheckoutCounterResponse{}
|
||||
return c.SucJson(ctx, emptyResp)
|
||||
}
|
||||
return ctx.String(http.StatusInternalServerError, err.Error())
|
||||
return c.FailJson(ctx, err)
|
||||
}
|
||||
|
||||
return c.SucJson(ctx, resp)
|
||||
@@ -34,12 +27,12 @@ func (c *BaseCommController) CheckoutCounter(ctx echo.Context) (err error) {
|
||||
|
||||
// CheckStatus 支付状态检测
|
||||
// @Summary Check payment status
|
||||
// @Description Check the payment status of an order by trade ID
|
||||
// @Description Return the current order status by trade ID. Status: 1=waiting payment, 2=paid, 3=expired.
|
||||
// @Tags Payment
|
||||
// @Produce json
|
||||
// @Param trade_id path string true "Trade ID"
|
||||
// @Success 200 {object} response.ApiResponse{data=response.CheckStatusResponse}
|
||||
// @Failure 400 {object} response.ApiResponse
|
||||
// @Failure 400 {object} response.ApiResponse "Order not found (status_code=10008) or other request error"
|
||||
// @Router /pay/check-status/{trade_id} [get]
|
||||
func (c *BaseCommController) CheckStatus(ctx echo.Context) (err error) {
|
||||
tradeId := ctx.Param("trade_id")
|
||||
|
||||
@@ -53,8 +53,13 @@ func buildSupportedAssets() ([]response.NetworkTokenSupport, error) {
|
||||
continue
|
||||
}
|
||||
sort.Strings(symbols)
|
||||
displayName := strings.TrimSpace(ch.DisplayName)
|
||||
if displayName == "" {
|
||||
displayName = network
|
||||
}
|
||||
supports = append(supports, response.NetworkTokenSupport{
|
||||
Network: network,
|
||||
DisplayName: displayName,
|
||||
Tokens: symbols,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -108,6 +108,56 @@ func GetOrderByBlockIdWithTransaction(tx *gorm.DB, blockID string) (*mdb.Orders,
|
||||
return order, err
|
||||
}
|
||||
|
||||
// GetOrderByBlockTransactionIDs fetches the first order whose stored tx id
|
||||
// matches any equivalent spelling supplied by the caller.
|
||||
func GetOrderByBlockTransactionIDs(blockIDs []string) (*mdb.Orders, error) {
|
||||
order := new(mdb.Orders)
|
||||
seen := make(map[string]struct{}, len(blockIDs))
|
||||
candidates := make([]string, 0, len(blockIDs))
|
||||
for _, blockID := range blockIDs {
|
||||
blockID = strings.TrimSpace(blockID)
|
||||
if blockID == "" {
|
||||
continue
|
||||
}
|
||||
if _, ok := seen[blockID]; ok {
|
||||
continue
|
||||
}
|
||||
seen[blockID] = struct{}{}
|
||||
candidates = append(candidates, blockID)
|
||||
}
|
||||
if len(candidates) == 0 {
|
||||
return order, nil
|
||||
}
|
||||
err := dao.Mdb.Model(order).Where("block_transaction_id IN ?", candidates).Limit(1).Find(order).Error
|
||||
return order, err
|
||||
}
|
||||
|
||||
// GetOrderByBlockTransactionIDsCaseInsensitive fetches the first order whose
|
||||
// stored tx id matches any candidate after ASCII case folding. This is used
|
||||
// only for hex-based chain tx ids; case-sensitive signatures must keep using
|
||||
// GetOrderByBlockTransactionIDs.
|
||||
func GetOrderByBlockTransactionIDsCaseInsensitive(blockIDs []string) (*mdb.Orders, error) {
|
||||
order := new(mdb.Orders)
|
||||
seen := make(map[string]struct{}, len(blockIDs))
|
||||
candidates := make([]string, 0, len(blockIDs))
|
||||
for _, blockID := range blockIDs {
|
||||
blockID = strings.ToLower(strings.TrimSpace(blockID))
|
||||
if blockID == "" {
|
||||
continue
|
||||
}
|
||||
if _, ok := seen[blockID]; ok {
|
||||
continue
|
||||
}
|
||||
seen[blockID] = struct{}{}
|
||||
candidates = append(candidates, blockID)
|
||||
}
|
||||
if len(candidates) == 0 {
|
||||
return order, nil
|
||||
}
|
||||
err := dao.Mdb.Model(order).Where("LOWER(block_transaction_id) IN ?", candidates).Limit(1).Find(order).Error
|
||||
return order, err
|
||||
}
|
||||
|
||||
// OrderSuccessWithTransaction marks an order as paid only if it is still waiting for payment.
|
||||
func OrderSuccessWithTransaction(tx *gorm.DB, req *request.OrderProcessingRequest) (bool, error) {
|
||||
result := tx.Model(&mdb.Orders{}).
|
||||
|
||||
@@ -9,7 +9,7 @@ const (
|
||||
NetworkTron = "tron"
|
||||
NetworkSolana = "solana"
|
||||
NetworkEthereum = "ethereum"
|
||||
NetworkBsc = "bsc"
|
||||
NetworkBsc = "binance"
|
||||
NetworkPolygon = "polygon"
|
||||
NetworkPlasma = "plasma"
|
||||
)
|
||||
|
||||
@@ -2,6 +2,7 @@ package response
|
||||
|
||||
type NetworkTokenSupport struct {
|
||||
Network string `json:"network" example:"tron"`
|
||||
DisplayName string `json:"display_name" example:"TRON"`
|
||||
Tokens []string `json:"tokens" example:"USDT,USDC"`
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,832 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/big"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
tron "github.com/GMWalletApp/epusdt/crypto"
|
||||
"github.com/GMWalletApp/epusdt/model/data"
|
||||
"github.com/GMWalletApp/epusdt/model/mdb"
|
||||
"github.com/GMWalletApp/epusdt/util/constant"
|
||||
"github.com/GMWalletApp/epusdt/util/math"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
const manualVerifyRequestTimeout = 15 * time.Second
|
||||
|
||||
var erc20TransferEventHash = common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")
|
||||
|
||||
var (
|
||||
manualOrderPaymentValidatorMu sync.Mutex
|
||||
manualOrderPaymentValidator manualOrderPaymentValidatorFunc = validateManualOrderPaymentDefault
|
||||
)
|
||||
|
||||
type manualOrderPaymentValidatorFunc func(*mdb.Orders, string) (string, error)
|
||||
|
||||
// ValidateManualOrderPayment verifies that the supplied chain transaction
|
||||
// really settles the order before an admin manually marks it paid. It returns
|
||||
// the canonical transaction id that should be persisted for duplicate checks.
|
||||
func ValidateManualOrderPayment(order *mdb.Orders, blockTransactionID string) (string, error) {
|
||||
manualOrderPaymentValidatorMu.Lock()
|
||||
validator := manualOrderPaymentValidator
|
||||
manualOrderPaymentValidatorMu.Unlock()
|
||||
return validator(order, blockTransactionID)
|
||||
}
|
||||
|
||||
// SetManualOrderPaymentValidatorForTest swaps the chain verifier in tests so
|
||||
// route/controller tests don't depend on public RPC availability.
|
||||
func SetManualOrderPaymentValidatorForTest(fn func(*mdb.Orders, string) (string, error)) func() {
|
||||
manualOrderPaymentValidatorMu.Lock()
|
||||
old := manualOrderPaymentValidator
|
||||
if fn == nil {
|
||||
manualOrderPaymentValidator = validateManualOrderPaymentDefault
|
||||
} else {
|
||||
manualOrderPaymentValidator = fn
|
||||
}
|
||||
manualOrderPaymentValidatorMu.Unlock()
|
||||
return func() {
|
||||
manualOrderPaymentValidatorMu.Lock()
|
||||
manualOrderPaymentValidator = old
|
||||
manualOrderPaymentValidatorMu.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
func validateManualOrderPaymentDefault(order *mdb.Orders, blockTransactionID string) (string, error) {
|
||||
if order == nil || order.ID == 0 {
|
||||
return "", fmt.Errorf("order not found")
|
||||
}
|
||||
txID := strings.TrimSpace(blockTransactionID)
|
||||
if txID == "" {
|
||||
return "", fmt.Errorf("block_transaction_id is required")
|
||||
}
|
||||
|
||||
var canonicalTxID string
|
||||
var err error
|
||||
switch strings.ToLower(strings.TrimSpace(order.Network)) {
|
||||
case mdb.NetworkTron:
|
||||
canonicalTxID, err = validateManualTronPayment(order, txID)
|
||||
case mdb.NetworkSolana:
|
||||
canonicalTxID, err = validateManualSolanaPayment(order, txID)
|
||||
case mdb.NetworkEthereum, mdb.NetworkBsc, mdb.NetworkPolygon, mdb.NetworkPlasma:
|
||||
canonicalTxID, err = validateManualEvmPayment(order, txID)
|
||||
default:
|
||||
return "", fmt.Errorf("unsupported manual payment verification network: %s", order.Network)
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err = ensureManualBlockTransactionUnused(order, canonicalTxID); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return canonicalTxID, nil
|
||||
}
|
||||
|
||||
func ensureManualBlockTransactionUnused(order *mdb.Orders, canonicalTxID string) error {
|
||||
candidates := equivalentManualBlockTransactionIDs(order.Network, canonicalTxID)
|
||||
var existing *mdb.Orders
|
||||
var err error
|
||||
if manualBlockTransactionIDIsHex(order.Network) {
|
||||
existing, err = data.GetOrderByBlockTransactionIDsCaseInsensitive(candidates)
|
||||
} else {
|
||||
existing, err = data.GetOrderByBlockTransactionIDs(candidates)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if existing.ID > 0 && existing.ID != order.ID {
|
||||
return constant.OrderBlockAlreadyProcess
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func manualBlockTransactionIDIsHex(network string) bool {
|
||||
switch strings.ToLower(strings.TrimSpace(network)) {
|
||||
case mdb.NetworkTron, mdb.NetworkEthereum, mdb.NetworkBsc, mdb.NetworkPolygon, mdb.NetworkPlasma:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func equivalentManualBlockTransactionIDs(network, canonicalTxID string) []string {
|
||||
network = strings.ToLower(strings.TrimSpace(network))
|
||||
canonicalTxID = strings.TrimSpace(canonicalTxID)
|
||||
seen := make(map[string]struct{})
|
||||
out := make([]string, 0, 6)
|
||||
add := func(value string) {
|
||||
value = strings.TrimSpace(value)
|
||||
if value == "" {
|
||||
return
|
||||
}
|
||||
if _, ok := seen[value]; ok {
|
||||
return
|
||||
}
|
||||
seen[value] = struct{}{}
|
||||
out = append(out, value)
|
||||
}
|
||||
|
||||
add(canonicalTxID)
|
||||
switch network {
|
||||
case mdb.NetworkEthereum, mdb.NetworkBsc, mdb.NetworkPolygon, mdb.NetworkPlasma:
|
||||
body := strings.TrimPrefix(strings.TrimPrefix(canonicalTxID, "0x"), "0X")
|
||||
body = strings.ToLower(body)
|
||||
add("0x" + body)
|
||||
add("0x" + strings.ToUpper(body))
|
||||
add("0X" + body)
|
||||
add("0X" + strings.ToUpper(body))
|
||||
add(body)
|
||||
add(strings.ToUpper(body))
|
||||
case mdb.NetworkTron:
|
||||
body := strings.TrimPrefix(strings.TrimPrefix(canonicalTxID, "0x"), "0X")
|
||||
body = strings.ToLower(body)
|
||||
add(body)
|
||||
add(strings.ToUpper(body))
|
||||
add("0x" + body)
|
||||
add("0x" + strings.ToUpper(body))
|
||||
add("0X" + body)
|
||||
add("0X" + strings.ToUpper(body))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func validateManualEvmPayment(order *mdb.Orders, txID string) (string, error) {
|
||||
txHash, canonicalTxID, err := canonicalEvmHash(txID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
token, err := data.GetEnabledChainTokenBySymbol(order.Network, order.Token)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if token == nil || token.ID == 0 || strings.TrimSpace(token.ContractAddress) == "" {
|
||||
return "", fmt.Errorf("enabled token contract not configured for %s/%s", order.Network, order.Token)
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), manualVerifyRequestTimeout)
|
||||
defer cancel()
|
||||
|
||||
clients, err := dialManualEvmClients(ctx, order.Network)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer closeManualEvmClients(clients)
|
||||
|
||||
if err = validateManualEvmPaymentAcrossClients(ctx, clients, order, txHash, token); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return canonicalTxID, nil
|
||||
}
|
||||
|
||||
type evmChainReader interface {
|
||||
TransactionReceipt(context.Context, common.Hash) (*types.Receipt, error)
|
||||
HeaderByNumber(context.Context, *big.Int) (*types.Header, error)
|
||||
}
|
||||
|
||||
type manualEvmClient struct {
|
||||
label string
|
||||
reader evmChainReader
|
||||
close func()
|
||||
}
|
||||
|
||||
func closeManualEvmClients(clients []manualEvmClient) {
|
||||
for _, item := range clients {
|
||||
if item.close != nil {
|
||||
item.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func validateManualEvmPaymentAcrossClients(ctx context.Context, clients []manualEvmClient, order *mdb.Orders, txHash common.Hash, token *mdb.ChainToken) error {
|
||||
var verifyErrors []string
|
||||
for _, item := range clients {
|
||||
if err := validateManualEvmPaymentWithClient(ctx, item.reader, order, txHash, token); err != nil {
|
||||
verifyErrors = append(verifyErrors, fmt.Sprintf("%s: %v", item.label, err))
|
||||
continue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if len(verifyErrors) > 0 {
|
||||
return fmt.Errorf("manual EVM verification failed: %s", strings.Join(verifyErrors, "; "))
|
||||
}
|
||||
return fmt.Errorf("no enabled %s WS/HTTP RPC node configured", order.Network)
|
||||
}
|
||||
|
||||
func validateManualEvmPaymentWithClient(ctx context.Context, client evmChainReader, order *mdb.Orders, txHash common.Hash, token *mdb.ChainToken) error {
|
||||
receipt, err := client.TransactionReceipt(ctx, txHash)
|
||||
if err != nil {
|
||||
return fmt.Errorf("fetch transaction receipt: %w", err)
|
||||
}
|
||||
if receipt.Status != types.ReceiptStatusSuccessful {
|
||||
return fmt.Errorf("transaction is not successful")
|
||||
}
|
||||
if receipt.BlockNumber == nil {
|
||||
return fmt.Errorf("transaction receipt missing block number")
|
||||
}
|
||||
txHeader, err := client.HeaderByNumber(ctx, receipt.BlockNumber)
|
||||
if err != nil {
|
||||
return fmt.Errorf("fetch transaction block header: %w", err)
|
||||
}
|
||||
if err = ensureEvmTransactionNotBeforeOrder(txHeader.Time, order); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = ensureEvmConfirmations(ctx, client, order.Network, receipt.BlockNumber); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
contract, err := normalizeEvmAddress(token.ContractAddress)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid token contract address: %w", err)
|
||||
}
|
||||
to, err := normalizeEvmAddress(order.ReceiveAddress)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid order receive address: %w", err)
|
||||
}
|
||||
amountMismatch := false
|
||||
for _, item := range receipt.Logs {
|
||||
if item == nil || !strings.EqualFold(item.Address.Hex(), contract.Hex()) {
|
||||
continue
|
||||
}
|
||||
if len(item.Topics) < 3 || item.Topics[0] != erc20TransferEventHash {
|
||||
continue
|
||||
}
|
||||
if !strings.EqualFold(common.BytesToAddress(item.Topics[2].Bytes()).Hex(), to.Hex()) {
|
||||
continue
|
||||
}
|
||||
rawAmount := new(big.Int).SetBytes(item.Data)
|
||||
if amountMatchesRaw(order.ActualAmount, rawAmount, token.Decimals) {
|
||||
return nil
|
||||
}
|
||||
amountMismatch = true
|
||||
}
|
||||
|
||||
if amountMismatch {
|
||||
return fmt.Errorf("transaction amount mismatch")
|
||||
}
|
||||
return fmt.Errorf("matching token transfer to order address not found")
|
||||
}
|
||||
|
||||
func dialManualEvmClients(ctx context.Context, network string) ([]manualEvmClient, error) {
|
||||
var clients []manualEvmClient
|
||||
var connectErrors []string
|
||||
for _, nodeType := range []string{mdb.RpcNodeTypeWs, mdb.RpcNodeTypeHttp} {
|
||||
node, err := data.SelectRpcNode(network, nodeType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if node == nil || node.ID == 0 || strings.TrimSpace(node.Url) == "" {
|
||||
continue
|
||||
}
|
||||
rpcURL := strings.TrimSpace(node.Url)
|
||||
client, err := ethclient.DialContext(ctx, rpcURL)
|
||||
if err == nil {
|
||||
clients = append(clients, manualEvmClient{
|
||||
label: fmt.Sprintf("%s %s", nodeType, rpcURL),
|
||||
reader: client,
|
||||
close: client.Close,
|
||||
})
|
||||
continue
|
||||
}
|
||||
connectErrors = append(connectErrors, fmt.Sprintf("%s %s: %v", nodeType, rpcURL, err))
|
||||
}
|
||||
if len(clients) > 0 {
|
||||
return clients, nil
|
||||
}
|
||||
if len(connectErrors) > 0 {
|
||||
return nil, fmt.Errorf("connect %s RPC failed: %s", network, strings.Join(connectErrors, "; "))
|
||||
}
|
||||
return nil, fmt.Errorf("no enabled %s WS/HTTP RPC node configured", network)
|
||||
}
|
||||
|
||||
func ensureEvmTransactionNotBeforeOrder(blockTime uint64, order *mdb.Orders) error {
|
||||
if order == nil {
|
||||
return fmt.Errorf("order not found")
|
||||
}
|
||||
if int64(blockTime)*1000 < order.CreatedAt.TimestampMilli() {
|
||||
return fmt.Errorf("transaction predates the order")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ensureEvmConfirmations(ctx context.Context, client evmChainReader, network string, txBlock *big.Int) error {
|
||||
chain, err := data.GetChainByNetwork(network)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
minConfirmations := 1
|
||||
if chain != nil && chain.MinConfirmations > 0 {
|
||||
minConfirmations = chain.MinConfirmations
|
||||
}
|
||||
header, err := client.HeaderByNumber(ctx, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("fetch latest block: %w", err)
|
||||
}
|
||||
confirmations := new(big.Int).Sub(header.Number, txBlock)
|
||||
confirmations.Add(confirmations, big.NewInt(1))
|
||||
if confirmations.Sign() < 0 || confirmations.Cmp(big.NewInt(int64(minConfirmations))) < 0 {
|
||||
return fmt.Errorf("transaction confirmations %s below required %d", confirmations.String(), minConfirmations)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type tronContractParam struct {
|
||||
TypeURL string `json:"type_url"`
|
||||
Value json.RawMessage `json:"value"`
|
||||
}
|
||||
|
||||
type manualTronTransaction struct {
|
||||
TxID string `json:"txID"`
|
||||
RawData struct {
|
||||
Contract []struct {
|
||||
Type string `json:"type"`
|
||||
Parameter tronContractParam `json:"parameter"`
|
||||
} `json:"contract"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
} `json:"raw_data"`
|
||||
Ret []struct {
|
||||
ContractRet string `json:"contractRet"`
|
||||
} `json:"ret"`
|
||||
}
|
||||
|
||||
type manualTronTxInfo struct {
|
||||
ID string `json:"id"`
|
||||
BlockNumber int64 `json:"blockNumber"`
|
||||
BlockTimeStamp int64 `json:"blockTimeStamp"`
|
||||
ContractResult []string `json:"contractResult"`
|
||||
Log []manualTronEventLog `json:"log"`
|
||||
Receipt struct {
|
||||
Result string `json:"result"`
|
||||
} `json:"receipt"`
|
||||
}
|
||||
|
||||
type manualTronEventLog struct {
|
||||
Address string `json:"address"`
|
||||
Topics []string `json:"topics"`
|
||||
Data string `json:"data"`
|
||||
}
|
||||
|
||||
type manualTronBlock struct {
|
||||
BlockHeader struct {
|
||||
RawData struct {
|
||||
Number int64 `json:"number"`
|
||||
} `json:"raw_data"`
|
||||
} `json:"block_header"`
|
||||
}
|
||||
|
||||
type manualTronTransferContractValue struct {
|
||||
OwnerAddress string `json:"owner_address"`
|
||||
ToAddress string `json:"to_address"`
|
||||
Amount int64 `json:"amount"`
|
||||
}
|
||||
|
||||
func validateManualTronPayment(order *mdb.Orders, txID string) (string, error) {
|
||||
normalizedTxID, err := normalizeTronTxID(txID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
baseURL, apiKey, err := ResolveTronNode()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var tx manualTronTransaction
|
||||
if err = tronPostJSON(baseURL, apiKey, "/wallet/gettransactionbyid", map[string]interface{}{"value": normalizedTxID}, &tx); err != nil {
|
||||
return "", fmt.Errorf("fetch tron transaction: %w", err)
|
||||
}
|
||||
if strings.TrimSpace(tx.TxID) == "" {
|
||||
return "", fmt.Errorf("transaction not found")
|
||||
}
|
||||
if strings.TrimSpace(tx.TxID) != "" && !strings.EqualFold(strings.TrimSpace(tx.TxID), normalizedTxID) {
|
||||
return "", fmt.Errorf("transaction id mismatch")
|
||||
}
|
||||
if len(tx.Ret) > 0 && tx.Ret[0].ContractRet != "" && tx.Ret[0].ContractRet != "SUCCESS" {
|
||||
return "", fmt.Errorf("transaction is not successful: %s", tx.Ret[0].ContractRet)
|
||||
}
|
||||
|
||||
var info manualTronTxInfo
|
||||
if err = tronPostJSON(baseURL, apiKey, "/wallet/gettransactioninfobyid", map[string]interface{}{"value": normalizedTxID}, &info); err != nil {
|
||||
return "", fmt.Errorf("fetch tron transaction info: %w", err)
|
||||
}
|
||||
if info.BlockNumber <= 0 {
|
||||
return "", fmt.Errorf("transaction is not confirmed")
|
||||
}
|
||||
if info.Receipt.Result != "" && info.Receipt.Result != "SUCCESS" {
|
||||
return "", fmt.Errorf("transaction is not successful: %s", info.Receipt.Result)
|
||||
}
|
||||
if err = ensureTronConfirmations(baseURL, apiKey, order.Network, info.BlockNumber); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if info.BlockTimeStamp <= 0 {
|
||||
return "", fmt.Errorf("transaction block timestamp missing")
|
||||
}
|
||||
if info.BlockTimeStamp < order.CreatedAt.TimestampMilli() {
|
||||
return "", fmt.Errorf("transaction predates the order")
|
||||
}
|
||||
|
||||
if strings.EqualFold(strings.TrimSpace(order.Token), "TRX") {
|
||||
if err = validateManualTronNativeTransfer(order, &tx); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return normalizedTxID, nil
|
||||
}
|
||||
if err = validateManualTronTRC20Transfer(order, &tx, &info); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return normalizedTxID, nil
|
||||
}
|
||||
|
||||
func validateManualTronNativeTransfer(order *mdb.Orders, tx *manualTronTransaction) error {
|
||||
if len(tx.RawData.Contract) == 0 || tx.RawData.Contract[0].Type != "TransferContract" {
|
||||
return fmt.Errorf("transaction is not a TRX transfer")
|
||||
}
|
||||
var val manualTronTransferContractValue
|
||||
if err := json.Unmarshal(tx.RawData.Contract[0].Parameter.Value, &val); err != nil {
|
||||
return err
|
||||
}
|
||||
toAddr, err := tronHexToAddress(val.ToAddress)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid TRX recipient address: %w", err)
|
||||
}
|
||||
if !strings.EqualFold(toAddr, order.ReceiveAddress) {
|
||||
return fmt.Errorf("transaction recipient mismatch")
|
||||
}
|
||||
if !amountMatchesRaw(order.ActualAmount, big.NewInt(val.Amount), 6) {
|
||||
return fmt.Errorf("transaction amount mismatch")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateManualTronTRC20Transfer(order *mdb.Orders, tx *manualTronTransaction, info *manualTronTxInfo) error {
|
||||
token, err := data.GetEnabledChainTokenBySymbol(mdb.NetworkTron, order.Token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if token == nil || token.ID == 0 || strings.TrimSpace(token.ContractAddress) == "" {
|
||||
return fmt.Errorf("enabled token contract not configured for tron/%s", order.Token)
|
||||
}
|
||||
if len(tx.RawData.Contract) == 0 || tx.RawData.Contract[0].Type != "TriggerSmartContract" {
|
||||
return fmt.Errorf("transaction is not a TRC20 transfer")
|
||||
}
|
||||
contractHex, err := tronAddressToHex(token.ContractAddress)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid configured TRC20 contract: %w", err)
|
||||
}
|
||||
return validateManualTronTRC20TransferEvent(order, info, contractHex, token.Decimals)
|
||||
}
|
||||
|
||||
func validateManualTronTRC20TransferEvent(order *mdb.Orders, info *manualTronTxInfo, contractHex string, decimals int) error {
|
||||
if info == nil || len(info.Log) == 0 {
|
||||
return fmt.Errorf("matching TRC20 transfer event to order address not found")
|
||||
}
|
||||
toHex, err := tronAddressToHex(order.ReceiveAddress)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid order receive address: %w", err)
|
||||
}
|
||||
transferTopic := strings.TrimPrefix(erc20TransferEventHash.Hex(), "0x")
|
||||
amountMismatch := false
|
||||
for _, event := range info.Log {
|
||||
eventContractHex, err := normalizeTronAddressHex(event.Address)
|
||||
if err != nil || eventContractHex != contractHex {
|
||||
continue
|
||||
}
|
||||
if len(event.Topics) < 3 || normalizeEventTopic(event.Topics[0]) != transferTopic {
|
||||
continue
|
||||
}
|
||||
eventToHex, err := tronTopicAddressToHex(event.Topics[2])
|
||||
if err != nil || eventToHex != toHex {
|
||||
continue
|
||||
}
|
||||
rawAmount, err := tronEventDataAmount(event.Data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid TRC20 transfer event amount: %w", err)
|
||||
}
|
||||
if amountMatchesRaw(order.ActualAmount, rawAmount, decimals) {
|
||||
return nil
|
||||
}
|
||||
amountMismatch = true
|
||||
}
|
||||
if amountMismatch {
|
||||
return fmt.Errorf("transaction amount mismatch")
|
||||
}
|
||||
return fmt.Errorf("matching TRC20 transfer event to order address not found")
|
||||
}
|
||||
|
||||
func ensureTronConfirmations(baseURL, apiKey, network string, txBlock int64) error {
|
||||
var latest manualTronBlock
|
||||
if err := tronPostJSON(baseURL, apiKey, "/wallet/getnowblock", map[string]interface{}{}, &latest); err != nil {
|
||||
return fmt.Errorf("fetch latest tron block: %w", err)
|
||||
}
|
||||
chain, err := data.GetChainByNetwork(network)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
minConfirmations := 1
|
||||
if chain != nil && chain.MinConfirmations > 0 {
|
||||
minConfirmations = chain.MinConfirmations
|
||||
}
|
||||
confirmations := latest.BlockHeader.RawData.Number - txBlock + 1
|
||||
if confirmations < int64(minConfirmations) {
|
||||
return fmt.Errorf("transaction confirmations %d below required %d", confirmations, minConfirmations)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func tronPostJSON(baseURL, apiKey, path string, body interface{}, out interface{}) error {
|
||||
payload, _ := json.Marshal(body)
|
||||
req, err := http.NewRequest(http.MethodPost, strings.TrimRight(baseURL, "/")+path, bytes.NewReader(payload))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("Accept", "application/json")
|
||||
if apiKey = strings.TrimSpace(apiKey); apiKey != "" {
|
||||
req.Header.Set("TRON-PRO-API-KEY", apiKey)
|
||||
}
|
||||
client := &http.Client{Timeout: manualVerifyRequestTimeout}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
raw, _ := io.ReadAll(resp.Body)
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("HTTP %d: %s", resp.StatusCode, string(raw))
|
||||
}
|
||||
return json.Unmarshal(raw, out)
|
||||
}
|
||||
|
||||
func validateManualSolanaPayment(order *mdb.Orders, sig string) (string, error) {
|
||||
sig = strings.TrimSpace(sig)
|
||||
txData, err := SolGetTransaction(sig)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("fetch solana transaction: %w", err)
|
||||
}
|
||||
if !gjson.GetBytes(txData, "result").Exists() || gjson.GetBytes(txData, "result").Type == gjson.Null {
|
||||
return "", fmt.Errorf("transaction not found")
|
||||
}
|
||||
if err = ensureSolanaConfirmations(order.Network, sig); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
tokens, err := data.ListEnabledChainTokensByNetwork(mdb.NetworkSolana)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
mintTokens := make(map[string]*mdb.ChainToken, len(tokens))
|
||||
var nativeSolToken *mdb.ChainToken
|
||||
for i := range tokens {
|
||||
sym := strings.ToUpper(strings.TrimSpace(tokens[i].Symbol))
|
||||
mint := strings.TrimSpace(tokens[i].ContractAddress)
|
||||
if sym == "SOL" && mint == "" {
|
||||
nativeSolToken = &tokens[i]
|
||||
continue
|
||||
}
|
||||
if mint != "" {
|
||||
mintTokens[mint] = &tokens[i]
|
||||
}
|
||||
}
|
||||
|
||||
instructions := gjson.GetBytes(txData, "result.transaction.message.instructions").Array()
|
||||
amountMismatch := false
|
||||
for _, instruction := range instructions {
|
||||
transferInfo, parseErr := ParseTransferInfoFromInstruction(instruction, txData)
|
||||
if parseErr != nil || transferInfo == nil {
|
||||
continue
|
||||
}
|
||||
if !isTransferToAddress(transferInfo, order.ReceiveAddress) {
|
||||
continue
|
||||
}
|
||||
token, amount := resolveSolTokenAndAmount(transferInfo, mintTokens, nativeSolToken)
|
||||
if !strings.EqualFold(token, order.Token) {
|
||||
continue
|
||||
}
|
||||
if err = ensureSolanaTransferNotBeforeOrder(transferInfo.BlockTime, order); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if amountMatchesFloat(order.ActualAmount, amount) {
|
||||
return sig, nil
|
||||
}
|
||||
amountMismatch = true
|
||||
}
|
||||
if amountMismatch {
|
||||
return "", fmt.Errorf("transaction amount mismatch")
|
||||
}
|
||||
return "", fmt.Errorf("matching solana transfer to order address not found")
|
||||
}
|
||||
|
||||
func ensureSolanaTransferNotBeforeOrder(blockTime int64, order *mdb.Orders) error {
|
||||
if order == nil {
|
||||
return fmt.Errorf("order not found")
|
||||
}
|
||||
if blockTime <= 0 {
|
||||
return fmt.Errorf("transaction block time missing")
|
||||
}
|
||||
if blockTime*1000 < order.CreatedAt.TimestampMilli() {
|
||||
return fmt.Errorf("transaction predates the order")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ensureSolanaConfirmations(network, sig string) error {
|
||||
chain, err := data.GetChainByNetwork(network)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
minConfirmations := 1
|
||||
if chain != nil && chain.MinConfirmations > 0 {
|
||||
minConfirmations = chain.MinConfirmations
|
||||
}
|
||||
if minConfirmations <= 1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
body, err := SolRetryClient("getSignatureStatuses", []interface{}{
|
||||
[]string{sig},
|
||||
map[string]interface{}{"searchTransactionHistory": true},
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("fetch solana signature status: %w", err)
|
||||
}
|
||||
status := gjson.GetBytes(body, "result.value.0")
|
||||
if !status.Exists() || status.Type == gjson.Null {
|
||||
return fmt.Errorf("transaction status not found")
|
||||
}
|
||||
if errValue := status.Get("err"); errValue.Exists() && errValue.Type != gjson.Null {
|
||||
return fmt.Errorf("transaction is not successful: %s", errValue.Raw)
|
||||
}
|
||||
if status.Get("confirmationStatus").String() == "finalized" {
|
||||
return nil
|
||||
}
|
||||
confirmations := status.Get("confirmations").Int()
|
||||
if confirmations < int64(minConfirmations) {
|
||||
return fmt.Errorf("transaction confirmations %d below required %d", confirmations, minConfirmations)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func amountMatchesRaw(expected float64, rawAmount *big.Int, decimals int) bool {
|
||||
if rawAmount == nil || rawAmount.Sign() <= 0 {
|
||||
return false
|
||||
}
|
||||
if decimals < 0 {
|
||||
decimals = 0
|
||||
}
|
||||
actual := decimal.NewFromBigInt(rawAmount, -int32(decimals))
|
||||
return roundedAmount(expected).Equal(actual.Round(int32(data.GetAmountPrecision())))
|
||||
}
|
||||
|
||||
func amountMatchesFloat(expected, actual float64) bool {
|
||||
return roundedAmount(expected).Equal(roundedAmount(actual))
|
||||
}
|
||||
|
||||
func roundedAmount(amount float64) decimal.Decimal {
|
||||
precision := data.GetAmountPrecision()
|
||||
return decimal.NewFromFloat(math.MustParsePrecFloat64(amount, precision)).Round(int32(precision))
|
||||
}
|
||||
|
||||
func tronHexToAddress(hexAddr string) (string, error) {
|
||||
hexAddr, err := normalizeTronAddressHex(hexAddr)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
raw, err := hex.DecodeString(hexAddr)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return tron.EncodeCheck(raw), nil
|
||||
}
|
||||
|
||||
func tronAddressToHex(addr string) (string, error) {
|
||||
raw, err := tron.DecodeCheck(strings.TrimSpace(addr))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(raw) != 21 || raw[0] != tron.PrefixMainnet {
|
||||
return "", fmt.Errorf("invalid tron address")
|
||||
}
|
||||
return strings.ToLower(hex.EncodeToString(raw)), nil
|
||||
}
|
||||
|
||||
func normalizeTronAddressHex(hexAddr string) (string, error) {
|
||||
hexAddr = normalizeTronHexAddress(hexAddr)
|
||||
raw, err := hex.DecodeString(hexAddr)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
switch len(raw) {
|
||||
case 20:
|
||||
raw = append([]byte{tron.PrefixMainnet}, raw...)
|
||||
case 21:
|
||||
if raw[0] != tron.PrefixMainnet {
|
||||
return "", fmt.Errorf("invalid tron address prefix")
|
||||
}
|
||||
default:
|
||||
return "", fmt.Errorf("invalid address length: %d", len(raw))
|
||||
}
|
||||
return strings.ToLower(hex.EncodeToString(raw)), nil
|
||||
}
|
||||
|
||||
func normalizeTronHexAddress(hexAddr string) string {
|
||||
hexAddr = strings.TrimSpace(hexAddr)
|
||||
hexAddr = strings.TrimPrefix(hexAddr, "0x")
|
||||
hexAddr = strings.TrimPrefix(hexAddr, "0X")
|
||||
return strings.ToLower(hexAddr)
|
||||
}
|
||||
|
||||
func normalizeEventTopic(value string) string {
|
||||
value = strings.TrimSpace(value)
|
||||
value = strings.TrimPrefix(value, "0x")
|
||||
value = strings.TrimPrefix(value, "0X")
|
||||
return strings.ToLower(value)
|
||||
}
|
||||
|
||||
func tronTopicAddressToHex(topic string) (string, error) {
|
||||
topic = normalizeEventTopic(topic)
|
||||
if len(topic) != 64 {
|
||||
return "", fmt.Errorf("invalid TRON event address topic length")
|
||||
}
|
||||
if _, err := hex.DecodeString(topic); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return normalizeTronAddressHex(topic[24:])
|
||||
}
|
||||
|
||||
func tronEventDataAmount(data string) (*big.Int, error) {
|
||||
data = normalizeEventTopic(data)
|
||||
if data == "" {
|
||||
return nil, fmt.Errorf("empty event data")
|
||||
}
|
||||
if len(data)%2 != 0 {
|
||||
return nil, fmt.Errorf("odd-length event data")
|
||||
}
|
||||
raw, err := hex.DecodeString(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return new(big.Int).SetBytes(raw), nil
|
||||
}
|
||||
|
||||
func isEvmHash(value string) bool {
|
||||
value = strings.TrimSpace(value)
|
||||
value = strings.TrimPrefix(value, "0x")
|
||||
value = strings.TrimPrefix(value, "0X")
|
||||
if len(value) != 64 {
|
||||
return false
|
||||
}
|
||||
_, err := hex.DecodeString(value)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func canonicalEvmHash(value string) (common.Hash, string, error) {
|
||||
value = strings.TrimSpace(value)
|
||||
value = strings.TrimPrefix(value, "0x")
|
||||
value = strings.TrimPrefix(value, "0X")
|
||||
if len(value) != 64 {
|
||||
return common.Hash{}, "", fmt.Errorf("invalid EVM transaction hash")
|
||||
}
|
||||
if _, err := hex.DecodeString(value); err != nil {
|
||||
return common.Hash{}, "", err
|
||||
}
|
||||
hash := common.HexToHash("0x" + strings.ToLower(value))
|
||||
return hash, hash.Hex(), nil
|
||||
}
|
||||
|
||||
func normalizeTronTxID(value string) (string, error) {
|
||||
value = strings.TrimSpace(value)
|
||||
value = strings.TrimPrefix(value, "0x")
|
||||
value = strings.TrimPrefix(value, "0X")
|
||||
if len(value) != 64 {
|
||||
return "", fmt.Errorf("invalid TRON transaction id length")
|
||||
}
|
||||
if _, err := hex.DecodeString(value); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.ToLower(value), nil
|
||||
}
|
||||
|
||||
func normalizeEvmAddress(value string) (common.Address, error) {
|
||||
value = strings.TrimSpace(value)
|
||||
value = strings.TrimPrefix(value, "0x")
|
||||
value = strings.TrimPrefix(value, "0X")
|
||||
if len(value) != 40 {
|
||||
return common.Address{}, fmt.Errorf("invalid address length")
|
||||
}
|
||||
if _, err := hex.DecodeString(value); err != nil {
|
||||
return common.Address{}, err
|
||||
}
|
||||
return common.HexToAddress("0x" + value), nil
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/GMWalletApp/epusdt/internal/testutil"
|
||||
"github.com/GMWalletApp/epusdt/model/dao"
|
||||
"github.com/GMWalletApp/epusdt/model/mdb"
|
||||
"github.com/dromara/carbon/v2"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
)
|
||||
|
||||
func TestManualVerifyEvmHashAcceptsOptional0x(t *testing.T) {
|
||||
hash := strings.Repeat("a", 64)
|
||||
if !isEvmHash(hash) {
|
||||
t.Fatal("expected bare EVM hash to be valid")
|
||||
}
|
||||
if !isEvmHash("0x" + hash) {
|
||||
t.Fatal("expected 0x-prefixed EVM hash to be valid")
|
||||
}
|
||||
if isEvmHash("0x" + strings.Repeat("a", 63)) {
|
||||
t.Fatal("expected short EVM hash to be invalid")
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyNormalizeEvmAddressAcceptsOptional0x(t *testing.T) {
|
||||
addr := "1111111111111111111111111111111111111111"
|
||||
want := common.HexToAddress("0x" + addr)
|
||||
got, err := normalizeEvmAddress(addr)
|
||||
if err != nil {
|
||||
t.Fatalf("normalize bare address: %v", err)
|
||||
}
|
||||
if got != want {
|
||||
t.Fatalf("bare address = %s, want %s", got.Hex(), want.Hex())
|
||||
}
|
||||
got, err = normalizeEvmAddress("0X" + strings.ToUpper(addr))
|
||||
if err != nil {
|
||||
t.Fatalf("normalize prefixed address: %v", err)
|
||||
}
|
||||
if got != want {
|
||||
t.Fatalf("prefixed address = %s, want %s", got.Hex(), want.Hex())
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyNormalizeTronAddressHexAcceptsOptionalPrefix(t *testing.T) {
|
||||
body := "a614f803b6fd780986a42c78ec9c7f77e6ded13c"
|
||||
want := "41" + body
|
||||
|
||||
for _, input := range []string{body, "0x" + body, want, "0X" + strings.ToUpper(want)} {
|
||||
got, err := normalizeTronAddressHex(input)
|
||||
if err != nil {
|
||||
t.Fatalf("normalizeTronAddressHex(%q): %v", input, err)
|
||||
}
|
||||
if got != want {
|
||||
t.Fatalf("normalizeTronAddressHex(%q) = %q, want %q", input, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyNormalizeTronTxIDAcceptsOptional0x(t *testing.T) {
|
||||
txID := strings.Repeat("a", 64)
|
||||
got, err := normalizeTronTxID(txID)
|
||||
if err != nil {
|
||||
t.Fatalf("normalize bare txid: %v", err)
|
||||
}
|
||||
if got != txID {
|
||||
t.Fatalf("bare txid = %q, want %q", got, txID)
|
||||
}
|
||||
got, err = normalizeTronTxID("0X" + strings.ToUpper(txID))
|
||||
if err != nil {
|
||||
t.Fatalf("normalize prefixed txid: %v", err)
|
||||
}
|
||||
if got != txID {
|
||||
t.Fatalf("prefixed txid = %q, want %q", got, txID)
|
||||
}
|
||||
if _, err = normalizeTronTxID("0x" + strings.Repeat("a", 63)); err == nil {
|
||||
t.Fatal("expected short txid to fail")
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyDialEvmClientsIncludesHTTPNode(t *testing.T) {
|
||||
cleanup := testutil.SetupTestDatabases(t)
|
||||
defer cleanup()
|
||||
|
||||
if err := dao.Mdb.Create(&mdb.RpcNode{
|
||||
Network: mdb.NetworkEthereum,
|
||||
Type: mdb.RpcNodeTypeHttp,
|
||||
Url: "http://127.0.0.1:1",
|
||||
Enabled: true,
|
||||
Status: mdb.RpcNodeStatusOk,
|
||||
}).Error; err != nil {
|
||||
t.Fatalf("create rpc node: %v", err)
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
defer cancel()
|
||||
clients, err := dialManualEvmClients(ctx, mdb.NetworkEthereum)
|
||||
if err != nil {
|
||||
t.Fatalf("dialManualEvmClients(): %v", err)
|
||||
}
|
||||
defer closeManualEvmClients(clients)
|
||||
if len(clients) != 1 {
|
||||
t.Fatalf("client count = %d, want 1", len(clients))
|
||||
}
|
||||
if !strings.Contains(clients[0].label, mdb.RpcNodeTypeHttp) {
|
||||
t.Fatalf("client label = %q, want HTTP node", clients[0].label)
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyEvmRejectsTransactionBeforeOrder(t *testing.T) {
|
||||
order := &mdb.Orders{BaseModel: mdb.BaseModel{CreatedAt: *carbon.NewTime(carbon.CreateFromTimestampMilli(time.Now().UnixMilli()))}}
|
||||
txTime := uint64(time.Now().Add(-time.Hour).Unix())
|
||||
if err := ensureEvmTransactionNotBeforeOrder(txTime, order); err == nil {
|
||||
t.Fatal("expected transaction before order to be rejected")
|
||||
}
|
||||
txTime = uint64(time.Now().Add(time.Minute).Unix())
|
||||
if err := ensureEvmTransactionNotBeforeOrder(txTime, order); err != nil {
|
||||
t.Fatalf("expected transaction after order to pass: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyCanonicalEvmHash(t *testing.T) {
|
||||
hash := strings.Repeat("a", 64)
|
||||
_, canonical, err := canonicalEvmHash("0X" + strings.ToUpper(hash))
|
||||
if err != nil {
|
||||
t.Fatalf("canonicalEvmHash(): %v", err)
|
||||
}
|
||||
if canonical != "0x"+hash {
|
||||
t.Fatalf("canonical hash = %q, want %q", canonical, "0x"+hash)
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyEquivalentBlockIDsCatchLegacyVariants(t *testing.T) {
|
||||
cleanup := testutil.SetupTestDatabases(t)
|
||||
defer cleanup()
|
||||
|
||||
hash := strings.Repeat("b", 64)
|
||||
mixedHash := "0x" + strings.Repeat("bB", 32)
|
||||
if err := dao.Mdb.Create(&mdb.Orders{
|
||||
TradeId: "paid-legacy-hash",
|
||||
OrderId: "paid-legacy-hash",
|
||||
Status: mdb.StatusPaySuccess,
|
||||
Network: mdb.NetworkEthereum,
|
||||
BlockTransactionId: mixedHash,
|
||||
}).Error; err != nil {
|
||||
t.Fatalf("create existing order: %v", err)
|
||||
}
|
||||
|
||||
order := &mdb.Orders{BaseModel: mdb.BaseModel{ID: 999}, Network: mdb.NetworkEthereum}
|
||||
if err := ensureManualBlockTransactionUnused(order, "0x"+hash); err == nil {
|
||||
t.Fatal("expected legacy hash variant to be treated as already processed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyEvmRequestFailureFallsBackToNextClient(t *testing.T) {
|
||||
cleanup := testutil.SetupTestDatabases(t)
|
||||
defer cleanup()
|
||||
|
||||
contract := common.HexToAddress("0x1111111111111111111111111111111111111111")
|
||||
to := common.HexToAddress("0x2222222222222222222222222222222222222222")
|
||||
rawAmount := big.NewInt(1230000)
|
||||
receipt := &types.Receipt{
|
||||
Status: types.ReceiptStatusSuccessful,
|
||||
BlockNumber: big.NewInt(10),
|
||||
Logs: []*types.Log{{
|
||||
Address: contract,
|
||||
Topics: []common.Hash{
|
||||
erc20TransferEventHash,
|
||||
common.Hash{},
|
||||
common.BytesToHash(to.Bytes()),
|
||||
},
|
||||
Data: common.LeftPadBytes(rawAmount.Bytes(), 32),
|
||||
}},
|
||||
}
|
||||
order := &mdb.Orders{
|
||||
Network: mdb.NetworkEthereum,
|
||||
Token: "USDT",
|
||||
ActualAmount: 1.23,
|
||||
ReceiveAddress: to.Hex(),
|
||||
BaseModel: mdb.BaseModel{CreatedAt: *carbon.NewTime(carbon.CreateFromTimestampMilli(time.Now().Add(-time.Minute).UnixMilli()))},
|
||||
}
|
||||
token := &mdb.ChainToken{Network: mdb.NetworkEthereum, Symbol: "USDT", ContractAddress: contract.Hex(), Decimals: 6}
|
||||
|
||||
err := validateManualEvmPaymentAcrossClients(context.Background(), []manualEvmClient{
|
||||
{label: "ws bad", reader: &fakeEvmReader{receiptErr: errors.New("ws receipt failed")}},
|
||||
{label: "http ok", reader: &fakeEvmReader{
|
||||
receipt: receipt,
|
||||
headers: map[string]*types.Header{
|
||||
"10": {Number: big.NewInt(10), Time: uint64(time.Now().Unix())},
|
||||
"latest": {Number: big.NewInt(12), Time: uint64(time.Now().Unix())},
|
||||
},
|
||||
}},
|
||||
}, order, common.HexToHash("0x"+strings.Repeat("c", 64)), token)
|
||||
if err != nil {
|
||||
t.Fatalf("validateManualEvmPaymentAcrossClients(): %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyTronTRC20UsesTransferEvent(t *testing.T) {
|
||||
cleanup := testutil.SetupTestDatabases(t)
|
||||
defer cleanup()
|
||||
|
||||
contractHex := "411111111111111111111111111111111111111111"
|
||||
recipientHex := "41a614f803b6fd780986a42c78ec9c7f77e6ded13c"
|
||||
contractAddress, err := tronHexToAddress(contractHex)
|
||||
if err != nil {
|
||||
t.Fatalf("contract address: %v", err)
|
||||
}
|
||||
recipientAddress, err := tronHexToAddress(recipientHex)
|
||||
if err != nil {
|
||||
t.Fatalf("recipient address: %v", err)
|
||||
}
|
||||
if err = dao.Mdb.Create(&mdb.ChainToken{
|
||||
Network: mdb.NetworkTron,
|
||||
Symbol: "USDT",
|
||||
ContractAddress: contractAddress,
|
||||
Decimals: 6,
|
||||
Enabled: true,
|
||||
}).Error; err != nil {
|
||||
t.Fatalf("create token: %v", err)
|
||||
}
|
||||
|
||||
rawAmount := big.NewInt(1230000)
|
||||
tx := manualTronTransactionFromCallData(t, contractHex, recipientHex, rawAmount)
|
||||
info := &manualTronTxInfo{Log: []manualTronEventLog{{
|
||||
Address: strings.TrimPrefix(contractHex, "41"),
|
||||
Topics: []string{
|
||||
"0x" + strings.TrimPrefix(erc20TransferEventHash.Hex(), "0x"),
|
||||
strings.Repeat("0", 64),
|
||||
"0x" + strings.Repeat("0", 24) + strings.TrimPrefix(recipientHex, "41"),
|
||||
},
|
||||
Data: "0x" + fmt.Sprintf("%064x", rawAmount),
|
||||
}}}
|
||||
order := &mdb.Orders{ReceiveAddress: recipientAddress, Token: "USDT", ActualAmount: 1.23}
|
||||
|
||||
if err = validateManualTronTRC20Transfer(order, &tx, info); err != nil {
|
||||
t.Fatalf("validateManualTronTRC20Transfer(): %v", err)
|
||||
}
|
||||
|
||||
info.Log[0].Data = "0x" + fmt.Sprintf("%064x", big.NewInt(1240000))
|
||||
if err = validateManualTronTRC20Transfer(order, &tx, info); err == nil {
|
||||
t.Fatal("expected event amount mismatch to fail")
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifyTronPaymentHTTPFlow(t *testing.T) {
|
||||
cleanup := testutil.SetupTestDatabases(t)
|
||||
defer cleanup()
|
||||
|
||||
txID := strings.Repeat("a", 64)
|
||||
contractHex := "411111111111111111111111111111111111111111"
|
||||
recipientHex := "41a614f803b6fd780986a42c78ec9c7f77e6ded13c"
|
||||
contractAddress, err := tronHexToAddress(contractHex)
|
||||
if err != nil {
|
||||
t.Fatalf("contract address: %v", err)
|
||||
}
|
||||
recipientAddress, err := tronHexToAddress(recipientHex)
|
||||
if err != nil {
|
||||
t.Fatalf("recipient address: %v", err)
|
||||
}
|
||||
|
||||
rawAmount := big.NewInt(1230000)
|
||||
blockTimeMs := time.Now().Add(time.Minute).UnixMilli()
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
var req map[string]string
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
t.Errorf("decode tron request: %v", err)
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if r.URL.Path != "/wallet/getnowblock" && req["value"] != txID {
|
||||
t.Errorf("request tx id = %q, want %q", req["value"], txID)
|
||||
http.Error(w, "bad tx id", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
switch r.URL.Path {
|
||||
case "/wallet/gettransactionbyid":
|
||||
_ = json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"txID": txID,
|
||||
"raw_data": map[string]interface{}{
|
||||
"contract": []map[string]interface{}{{
|
||||
"type": "TriggerSmartContract",
|
||||
"parameter": map[string]interface{}{
|
||||
"value": map[string]interface{}{},
|
||||
},
|
||||
}},
|
||||
},
|
||||
"ret": []map[string]string{{"contractRet": "SUCCESS"}},
|
||||
})
|
||||
case "/wallet/gettransactioninfobyid":
|
||||
_ = json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"id": txID,
|
||||
"blockNumber": 100,
|
||||
"blockTimeStamp": blockTimeMs,
|
||||
"receipt": map[string]string{"result": "SUCCESS"},
|
||||
"log": []map[string]interface{}{{
|
||||
"address": strings.TrimPrefix(contractHex, "41"),
|
||||
"topics": []string{
|
||||
strings.TrimPrefix(erc20TransferEventHash.Hex(), "0x"),
|
||||
strings.Repeat("0", 64),
|
||||
"0X" + strings.ToUpper(strings.Repeat("0", 24)+strings.TrimPrefix(recipientHex, "41")),
|
||||
},
|
||||
"data": fmt.Sprintf("%064x", rawAmount),
|
||||
}},
|
||||
})
|
||||
case "/wallet/getnowblock":
|
||||
_ = json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"block_header": map[string]interface{}{
|
||||
"raw_data": map[string]interface{}{"number": 110},
|
||||
},
|
||||
})
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
if err = dao.Mdb.Create(&mdb.RpcNode{
|
||||
Network: mdb.NetworkTron,
|
||||
Type: mdb.RpcNodeTypeHttp,
|
||||
Url: server.URL,
|
||||
Enabled: true,
|
||||
Status: mdb.RpcNodeStatusOk,
|
||||
}).Error; err != nil {
|
||||
t.Fatalf("create tron rpc node: %v", err)
|
||||
}
|
||||
if err = dao.Mdb.Create(&mdb.ChainToken{
|
||||
Network: mdb.NetworkTron,
|
||||
Symbol: "USDT",
|
||||
ContractAddress: contractAddress,
|
||||
Decimals: 6,
|
||||
Enabled: true,
|
||||
}).Error; err != nil {
|
||||
t.Fatalf("create token: %v", err)
|
||||
}
|
||||
order := &mdb.Orders{
|
||||
TradeId: "manual-tron-http-flow",
|
||||
OrderId: "manual-tron-http-flow",
|
||||
ActualAmount: 1.23,
|
||||
ReceiveAddress: recipientAddress,
|
||||
Token: "USDT",
|
||||
Network: mdb.NetworkTron,
|
||||
Status: mdb.StatusWaitPay,
|
||||
PayProvider: mdb.PaymentProviderOnChain,
|
||||
}
|
||||
if err = dao.Mdb.Create(order).Error; err != nil {
|
||||
t.Fatalf("create order: %v", err)
|
||||
}
|
||||
|
||||
got, err := ValidateManualOrderPayment(order, "0X"+strings.ToUpper(txID))
|
||||
if err != nil {
|
||||
t.Fatalf("ValidateManualOrderPayment(): %v", err)
|
||||
}
|
||||
if got != txID {
|
||||
t.Fatalf("canonical tx id = %q, want %q", got, txID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestManualVerifySolanaRejectsMissingBlockTime(t *testing.T) {
|
||||
order := &mdb.Orders{BaseModel: mdb.BaseModel{CreatedAt: *carbon.NewTime(carbon.CreateFromTimestampMilli(time.Now().UnixMilli()))}}
|
||||
if err := ensureSolanaTransferNotBeforeOrder(0, order); err == nil {
|
||||
t.Fatal("expected missing block time to fail")
|
||||
}
|
||||
if err := ensureSolanaTransferNotBeforeOrder(time.Now().Add(time.Minute).Unix(), order); err != nil {
|
||||
t.Fatalf("expected future block time to pass: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
type fakeEvmReader struct {
|
||||
receipt *types.Receipt
|
||||
receiptErr error
|
||||
headers map[string]*types.Header
|
||||
headerErr error
|
||||
}
|
||||
|
||||
func (f *fakeEvmReader) TransactionReceipt(context.Context, common.Hash) (*types.Receipt, error) {
|
||||
if f.receiptErr != nil {
|
||||
return nil, f.receiptErr
|
||||
}
|
||||
return f.receipt, nil
|
||||
}
|
||||
|
||||
func (f *fakeEvmReader) HeaderByNumber(_ context.Context, number *big.Int) (*types.Header, error) {
|
||||
if f.headerErr != nil {
|
||||
return nil, f.headerErr
|
||||
}
|
||||
key := "latest"
|
||||
if number != nil {
|
||||
key = number.String()
|
||||
}
|
||||
header := f.headers[key]
|
||||
if header == nil {
|
||||
return nil, fmt.Errorf("missing header %s", key)
|
||||
}
|
||||
return header, nil
|
||||
}
|
||||
|
||||
func manualTronTransactionFromCallData(t *testing.T, contractHex, recipientHex string, amount *big.Int) manualTronTransaction {
|
||||
t.Helper()
|
||||
body := strings.TrimPrefix(recipientHex, "41")
|
||||
raw := fmt.Sprintf(`{
|
||||
"raw_data": {
|
||||
"contract": [{
|
||||
"type": "TriggerSmartContract",
|
||||
"parameter": {
|
||||
"value": {
|
||||
"contract_address": %q,
|
||||
"data": %q
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
}`, contractHex, "a9059cbb"+strings.Repeat("0", 24)+body+fmt.Sprintf("%064x", amount))
|
||||
var tx manualTronTransaction
|
||||
if err := json.Unmarshal([]byte(raw), &tx); err != nil {
|
||||
t.Fatalf("unmarshal tron tx: %v", err)
|
||||
}
|
||||
return tx
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/GMWalletApp/epusdt/config"
|
||||
"github.com/GMWalletApp/epusdt/model/data"
|
||||
"github.com/GMWalletApp/epusdt/model/mdb"
|
||||
"github.com/GMWalletApp/epusdt/model/response"
|
||||
"github.com/GMWalletApp/epusdt/util/constant"
|
||||
)
|
||||
|
||||
var ErrOrder = errors.New("不存在待支付订单或已过期")
|
||||
// ErrOrder is returned when checkout initialization cannot find the trade id.
|
||||
var ErrOrder = constant.OrderNotExists
|
||||
|
||||
// GetCheckoutCounterByTradeId returns checkout info for a pending order.
|
||||
// GetCheckoutCounterByTradeId returns checkout initialization data for an existing order.
|
||||
// It does not decide the payment state; callers should use CheckStatus for that.
|
||||
func GetCheckoutCounterByTradeId(tradeId string) (*response.CheckoutCounterResponse, error) {
|
||||
orderInfo, err := data.GetOrderInfoByTradeId(tradeId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if orderInfo.ID <= 0 || orderInfo.Status != mdb.StatusWaitPay {
|
||||
if orderInfo.ID <= 0 {
|
||||
return nil, ErrOrder
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package route
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
"github.com/GMWalletApp/epusdt/model/dao"
|
||||
"github.com/GMWalletApp/epusdt/model/data"
|
||||
"github.com/GMWalletApp/epusdt/model/mdb"
|
||||
"github.com/GMWalletApp/epusdt/model/service"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
@@ -647,6 +649,138 @@ func TestAdminOrders_MarkPaidNotFound(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdminOrders_MarkPaidSuccessAfterVerification(t *testing.T) {
|
||||
e, token := setupAdminTestEnv(t)
|
||||
order := &mdb.Orders{
|
||||
TradeId: "trade-admin-mark-paid-ok",
|
||||
OrderId: "order-admin-mark-paid-ok",
|
||||
Amount: 10,
|
||||
Currency: "CNY",
|
||||
ActualAmount: 1.23,
|
||||
ReceiveAddress: "TTestTronAddress001",
|
||||
Token: "USDT",
|
||||
Network: mdb.NetworkTron,
|
||||
Status: mdb.StatusWaitPay,
|
||||
NotifyUrl: "https://merchant.example/notify",
|
||||
PayProvider: mdb.PaymentProviderOnChain,
|
||||
}
|
||||
if err := dao.Mdb.Create(order).Error; err != nil {
|
||||
t.Fatalf("create order: %v", err)
|
||||
}
|
||||
|
||||
verified := false
|
||||
restore := service.SetManualOrderPaymentValidatorForTest(func(got *mdb.Orders, blockID string) (string, error) {
|
||||
verified = true
|
||||
if got.TradeId != order.TradeId {
|
||||
t.Fatalf("validator trade_id = %s, want %s", got.TradeId, order.TradeId)
|
||||
}
|
||||
if blockID != "block-admin-ok" {
|
||||
t.Fatalf("validator block id = %s, want block-admin-ok", blockID)
|
||||
}
|
||||
return "canonical-block-admin-ok", nil
|
||||
})
|
||||
defer restore()
|
||||
|
||||
rec := doPostAdmin(e, "/admin/api/v1/orders/"+order.TradeId+"/mark-paid", map[string]interface{}{
|
||||
"block_transaction_id": "block-admin-ok",
|
||||
}, token)
|
||||
t.Logf("MarkOrderPaid success: status=%d body=%s", rec.Code, rec.Body.String())
|
||||
assertOK(t, rec)
|
||||
if !verified {
|
||||
t.Fatal("expected chain verifier to be called")
|
||||
}
|
||||
|
||||
paid, err := data.GetOrderInfoByTradeId(order.TradeId)
|
||||
if err != nil {
|
||||
t.Fatalf("reload order: %v", err)
|
||||
}
|
||||
if paid.Status != mdb.StatusPaySuccess {
|
||||
t.Fatalf("status = %d, want %d", paid.Status, mdb.StatusPaySuccess)
|
||||
}
|
||||
if paid.BlockTransactionId != "canonical-block-admin-ok" {
|
||||
t.Fatalf("block_transaction_id = %q", paid.BlockTransactionId)
|
||||
}
|
||||
if paid.CallBackConfirm != mdb.CallBackConfirmNo {
|
||||
t.Fatalf("callback_confirm = %d, want %d", paid.CallBackConfirm, mdb.CallBackConfirmNo)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdminOrders_MarkPaidRejectsVerificationFailure(t *testing.T) {
|
||||
e, token := setupAdminTestEnv(t)
|
||||
order := &mdb.Orders{
|
||||
TradeId: "trade-admin-mark-paid-bad-proof",
|
||||
OrderId: "order-admin-mark-paid-bad-proof",
|
||||
Amount: 10,
|
||||
Currency: "CNY",
|
||||
ActualAmount: 1.23,
|
||||
ReceiveAddress: "TTestTronAddress001",
|
||||
Token: "USDT",
|
||||
Network: mdb.NetworkTron,
|
||||
Status: mdb.StatusWaitPay,
|
||||
NotifyUrl: "https://merchant.example/notify",
|
||||
PayProvider: mdb.PaymentProviderOnChain,
|
||||
}
|
||||
if err := dao.Mdb.Create(order).Error; err != nil {
|
||||
t.Fatalf("create order: %v", err)
|
||||
}
|
||||
restore := service.SetManualOrderPaymentValidatorForTest(func(*mdb.Orders, string) (string, error) {
|
||||
return "", errors.New("transaction amount mismatch")
|
||||
})
|
||||
defer restore()
|
||||
|
||||
rec := doPostAdmin(e, "/admin/api/v1/orders/"+order.TradeId+"/mark-paid", map[string]interface{}{
|
||||
"block_transaction_id": "block-admin-bad",
|
||||
}, token)
|
||||
t.Logf("MarkOrderPaid verifier failure: status=%d body=%s", rec.Code, rec.Body.String())
|
||||
if rec.Code == http.StatusOK {
|
||||
t.Fatalf("expected failure, got 200: %s", rec.Body.String())
|
||||
}
|
||||
reloaded, err := data.GetOrderInfoByTradeId(order.TradeId)
|
||||
if err != nil {
|
||||
t.Fatalf("reload order: %v", err)
|
||||
}
|
||||
if reloaded.Status != mdb.StatusWaitPay || reloaded.BlockTransactionId != "" {
|
||||
t.Fatalf("order changed after failed verification: status=%d block=%q", reloaded.Status, reloaded.BlockTransactionId)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdminOrders_MarkPaidRejectsNonOnChainOrder(t *testing.T) {
|
||||
e, token := setupAdminTestEnv(t)
|
||||
order := &mdb.Orders{
|
||||
TradeId: "trade-admin-mark-paid-provider",
|
||||
OrderId: "order-admin-mark-paid-provider",
|
||||
Amount: 10,
|
||||
Currency: "CNY",
|
||||
ActualAmount: 1.23,
|
||||
ReceiveAddress: "TTestTronAddress001",
|
||||
Token: "USDT",
|
||||
Network: mdb.NetworkTron,
|
||||
Status: mdb.StatusWaitPay,
|
||||
NotifyUrl: "https://merchant.example/notify",
|
||||
PayProvider: mdb.PaymentProviderOkPay,
|
||||
}
|
||||
if err := dao.Mdb.Create(order).Error; err != nil {
|
||||
t.Fatalf("create order: %v", err)
|
||||
}
|
||||
called := false
|
||||
restore := service.SetManualOrderPaymentValidatorForTest(func(*mdb.Orders, string) (string, error) {
|
||||
called = true
|
||||
return "block-admin-provider", nil
|
||||
})
|
||||
defer restore()
|
||||
|
||||
rec := doPostAdmin(e, "/admin/api/v1/orders/"+order.TradeId+"/mark-paid", map[string]interface{}{
|
||||
"block_transaction_id": "block-admin-provider",
|
||||
}, token)
|
||||
t.Logf("MarkOrderPaid provider order: status=%d body=%s", rec.Code, rec.Body.String())
|
||||
if rec.Code == http.StatusOK {
|
||||
t.Fatalf("expected failure, got 200: %s", rec.Body.String())
|
||||
}
|
||||
if called {
|
||||
t.Fatal("verifier should not run for non-on-chain order")
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdminOrders_ResendCallbackNotFound verifies resend-callback graceful error.
|
||||
func TestAdminOrders_ResendCallbackNotFound(t *testing.T) {
|
||||
e, token := setupAdminTestEnv(t)
|
||||
@@ -657,6 +791,59 @@ func TestAdminOrders_ResendCallbackNotFound(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdminOrders_ResendCallbackRejectsEmptyNotifyURL(t *testing.T) {
|
||||
e, token := setupAdminTestEnv(t)
|
||||
order := &mdb.Orders{
|
||||
TradeId: "trade-admin-resend-empty-url",
|
||||
OrderId: "order-admin-resend-empty-url",
|
||||
Status: mdb.StatusPaySuccess,
|
||||
CallBackConfirm: mdb.CallBackConfirmOk,
|
||||
CallbackNum: 3,
|
||||
}
|
||||
if err := dao.Mdb.Create(order).Error; err != nil {
|
||||
t.Fatalf("create order: %v", err)
|
||||
}
|
||||
|
||||
rec := doPostAdmin(e, "/admin/api/v1/orders/"+order.TradeId+"/resend-callback", nil, token)
|
||||
t.Logf("ResendCallback empty notify_url: status=%d body=%s", rec.Code, rec.Body.String())
|
||||
if rec.Code == http.StatusOK {
|
||||
t.Fatalf("expected failure, got 200: %s", rec.Body.String())
|
||||
}
|
||||
reloaded, err := data.GetOrderInfoByTradeId(order.TradeId)
|
||||
if err != nil {
|
||||
t.Fatalf("reload order: %v", err)
|
||||
}
|
||||
if reloaded.CallBackConfirm != mdb.CallBackConfirmOk || reloaded.CallbackNum != 3 {
|
||||
t.Fatalf("callback state changed: confirm=%d num=%d", reloaded.CallBackConfirm, reloaded.CallbackNum)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdminOrders_ResendCallbackRequeuesPaidOrder(t *testing.T) {
|
||||
e, token := setupAdminTestEnv(t)
|
||||
order := &mdb.Orders{
|
||||
TradeId: "trade-admin-resend-ok",
|
||||
OrderId: "order-admin-resend-ok",
|
||||
Status: mdb.StatusPaySuccess,
|
||||
NotifyUrl: "https://merchant.example/notify",
|
||||
CallBackConfirm: mdb.CallBackConfirmOk,
|
||||
CallbackNum: 3,
|
||||
}
|
||||
if err := dao.Mdb.Create(order).Error; err != nil {
|
||||
t.Fatalf("create order: %v", err)
|
||||
}
|
||||
|
||||
rec := doPostAdmin(e, "/admin/api/v1/orders/"+order.TradeId+"/resend-callback", nil, token)
|
||||
t.Logf("ResendCallback success: status=%d body=%s", rec.Code, rec.Body.String())
|
||||
assertOK(t, rec)
|
||||
reloaded, err := data.GetOrderInfoByTradeId(order.TradeId)
|
||||
if err != nil {
|
||||
t.Fatalf("reload order: %v", err)
|
||||
}
|
||||
if reloaded.CallBackConfirm != mdb.CallBackConfirmNo || reloaded.CallbackNum != 0 {
|
||||
t.Fatalf("callback state = confirm %d num %d, want no/0", reloaded.CallBackConfirm, reloaded.CallbackNum)
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Dashboard ───────────────────────────────────────────────────────────────
|
||||
|
||||
// TestAdminDashboard_AllRoutes verifies all dashboard endpoints return 200.
|
||||
|
||||
+167
-30
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/GMWalletApp/epusdt/util/http_client"
|
||||
"github.com/GMWalletApp/epusdt/util/log"
|
||||
"github.com/GMWalletApp/epusdt/util/sign"
|
||||
"github.com/dromara/carbon/v2"
|
||||
"github.com/go-resty/resty/v2"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/spf13/viper"
|
||||
@@ -578,6 +579,12 @@ func TestGetPublicConfig(t *testing.T) {
|
||||
row := item.(map[string]interface{})
|
||||
network := row["network"].(string)
|
||||
seen[network] = true
|
||||
if _, ok := row["display_name"].(string); !ok {
|
||||
t.Fatalf("supported_assets[%s].display_name missing or not string: %#v", network, row["display_name"])
|
||||
}
|
||||
if network == "tron" && row["display_name"] != "TRON" {
|
||||
t.Fatalf("supported_assets.tron.display_name = %v, want TRON", row["display_name"])
|
||||
}
|
||||
}
|
||||
for _, n := range []string{"tron", "solana"} {
|
||||
if !seen[n] {
|
||||
@@ -989,51 +996,64 @@ func TestCheckStatus_NotFound(t *testing.T) {
|
||||
rec := httptest.NewRecorder()
|
||||
e.ServeHTTP(rec, req)
|
||||
t.Logf("CheckStatus(not found): status=%d body=%s", rec.Code, rec.Body.String())
|
||||
if rec.Code >= 500 {
|
||||
t.Fatalf("unexpected server error: %d %s", rec.Code, rec.Body.String())
|
||||
if rec.Code != http.StatusBadRequest {
|
||||
t.Fatalf("expected 400, got %d: %s", rec.Code, rec.Body.String())
|
||||
}
|
||||
if rec.Code == http.StatusNotFound && rec.Body.Len() == 0 {
|
||||
t.Fatalf("route returned 404 with empty body — route may not be registered")
|
||||
var resp map[string]interface{}
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("unmarshal check-status error response: %v", err)
|
||||
}
|
||||
if got := int(resp["status_code"].(float64)); got != 10008 {
|
||||
t.Fatalf("status_code = %d, want 10008; response=%v", got, resp)
|
||||
}
|
||||
}
|
||||
|
||||
// TestCheckStatus_WithOrder verifies /pay/check-status/:trade_id returns 200
|
||||
// and a status field when the order exists.
|
||||
// TestCheckStatus_WithOrder verifies /pay/check-status/:trade_id returns the
|
||||
// real order status for existing orders in all checkout-relevant states.
|
||||
func TestCheckStatus_WithOrder(t *testing.T) {
|
||||
e := setupTestEnv(t)
|
||||
|
||||
// Create an order first via the GMPAY route.
|
||||
body := signBody(map[string]interface{}{
|
||||
"order_id": "check-status-001",
|
||||
"amount": 1.00,
|
||||
"token": "usdt",
|
||||
"currency": "cny",
|
||||
"network": "tron",
|
||||
"notify_url": "http://localhost/notify",
|
||||
})
|
||||
createRec := doPost(e, "/payments/gmpay/v1/order/create-transaction", body)
|
||||
if createRec.Code != http.StatusOK {
|
||||
t.Fatalf("create order failed: %d %s", createRec.Code, createRec.Body.String())
|
||||
}
|
||||
var createResp map[string]interface{}
|
||||
json.Unmarshal(createRec.Body.Bytes(), &createResp)
|
||||
tradeId, _ := createResp["data"].(map[string]interface{})["trade_id"].(string)
|
||||
if tradeId == "" {
|
||||
t.Fatal("no trade_id in create response")
|
||||
cases := []struct {
|
||||
name string
|
||||
status int
|
||||
}{
|
||||
{name: "wait-pay", status: mdb.StatusWaitPay},
|
||||
{name: "paid", status: mdb.StatusPaySuccess},
|
||||
{name: "expired", status: mdb.StatusExpired},
|
||||
}
|
||||
|
||||
// Now check status.
|
||||
req := httptest.NewRequest(http.MethodGet, "/pay/check-status/"+tradeId, nil)
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tradeID := createCheckoutCounterRespTestOrder(t, e, "check-status-"+tc.name)
|
||||
if err := dao.Mdb.Model(&mdb.Orders{}).
|
||||
Where("trade_id = ?", tradeID).
|
||||
Update("status", tc.status).Error; err != nil {
|
||||
t.Fatalf("update status: %v", err)
|
||||
}
|
||||
|
||||
req := httptest.NewRequest(http.MethodGet, "/pay/check-status/"+tradeID, nil)
|
||||
rec := httptest.NewRecorder()
|
||||
e.ServeHTTP(rec, req)
|
||||
t.Logf("CheckStatus: status=%d body=%s", rec.Code, rec.Body.String())
|
||||
t.Logf("CheckStatus(%s): status=%d body=%s", tc.name, rec.Code, rec.Body.String())
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
var resp map[string]interface{}
|
||||
json.Unmarshal(rec.Body.Bytes(), &resp)
|
||||
if resp["data"] == nil {
|
||||
t.Fatal("expected data in check-status response")
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("unmarshal check-status response: %v", err)
|
||||
}
|
||||
data, ok := resp["data"].(map[string]interface{})
|
||||
if !ok {
|
||||
t.Fatalf("expected data in check-status response, got: %v", resp)
|
||||
}
|
||||
if got, _ := data["trade_id"].(string); got != tradeID {
|
||||
t.Fatalf("trade_id = %q, want %q", got, tradeID)
|
||||
}
|
||||
if got := int(data["status"].(float64)); got != tc.status {
|
||||
t.Fatalf("status = %d, want %d", got, tc.status)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1061,6 +1081,123 @@ func TestCheckoutCounter_NotFound(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckoutCounterResp_ReturnsPaidOrder(t *testing.T) {
|
||||
e := setupTestEnv(t)
|
||||
tradeID := createCheckoutCounterRespTestOrder(t, e, "checkout-counter-paid-001")
|
||||
|
||||
if err := dao.Mdb.Model(&mdb.Orders{}).
|
||||
Where("trade_id = ?", tradeID).
|
||||
Update("status", mdb.StatusPaySuccess).Error; err != nil {
|
||||
t.Fatalf("mark order paid: %v", err)
|
||||
}
|
||||
|
||||
data := getCheckoutCounterRespData(t, e, tradeID)
|
||||
if got, _ := data["trade_id"].(string); got != tradeID {
|
||||
t.Fatalf("trade_id = %q, want %q; data=%v", got, tradeID, data)
|
||||
}
|
||||
if got, _ := data["redirect_url"].(string); got != "https://merchant.example/return" {
|
||||
t.Fatalf("redirect_url = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckoutCounterResp_ReturnsExpiredOrder(t *testing.T) {
|
||||
e := setupTestEnv(t)
|
||||
tradeID := createCheckoutCounterRespTestOrder(t, e, "checkout-counter-expired-001")
|
||||
expiredCreatedAt := carbon.Now().SubMinutes(config.GetOrderExpirationTime() + 1)
|
||||
|
||||
if err := dao.Mdb.Model(&mdb.Orders{}).
|
||||
Where("trade_id = ?", tradeID).
|
||||
Updates(map[string]interface{}{
|
||||
"status": mdb.StatusExpired,
|
||||
"created_at": expiredCreatedAt,
|
||||
}).Error; err != nil {
|
||||
t.Fatalf("mark order expired: %v", err)
|
||||
}
|
||||
|
||||
data := getCheckoutCounterRespData(t, e, tradeID)
|
||||
if got, _ := data["trade_id"].(string); got != tradeID {
|
||||
t.Fatalf("trade_id = %q, want %q; data=%v", got, tradeID, data)
|
||||
}
|
||||
expirationTime, _ := data["expiration_time"].(float64)
|
||||
if int64(expirationTime) > carbon.Now().TimestampMilli() {
|
||||
t.Fatalf("expiration_time = %.0f, want expired timestamp", expirationTime)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckoutCounterResp_UnknownOrderReturnsClearError(t *testing.T) {
|
||||
e := setupTestEnv(t)
|
||||
req := httptest.NewRequest(http.MethodGet, "/pay/checkout-counter-resp/nonexistent-trade-id", nil)
|
||||
rec := httptest.NewRecorder()
|
||||
e.ServeHTTP(rec, req)
|
||||
if rec.Code != http.StatusBadRequest {
|
||||
t.Fatalf("expected 400, got %d: %s", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
var resp map[string]interface{}
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("unmarshal checkout counter error response: %v", err)
|
||||
}
|
||||
if got := int(resp["status_code"].(float64)); got != 10008 {
|
||||
t.Fatalf("status_code = %d, want 10008; response=%v", got, resp)
|
||||
}
|
||||
if resp["message"] == "" {
|
||||
t.Fatalf("expected error message, got: %v", resp)
|
||||
}
|
||||
}
|
||||
|
||||
func createCheckoutCounterRespTestOrder(t *testing.T, e *echo.Echo, orderID string) string {
|
||||
t.Helper()
|
||||
|
||||
body := signBody(map[string]interface{}{
|
||||
"order_id": orderID,
|
||||
"amount": 1.00,
|
||||
"token": "usdt",
|
||||
"currency": "cny",
|
||||
"network": "tron",
|
||||
"notify_url": "http://localhost/notify",
|
||||
"redirect_url": "https://merchant.example/return",
|
||||
})
|
||||
rec := doPost(e, "/payments/gmpay/v1/order/create-transaction", body)
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("create order failed: %d %s", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
var resp map[string]interface{}
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("unmarshal create response: %v", err)
|
||||
}
|
||||
data, ok := resp["data"].(map[string]interface{})
|
||||
if !ok {
|
||||
t.Fatalf("expected create response data, got: %v", resp)
|
||||
}
|
||||
tradeID, _ := data["trade_id"].(string)
|
||||
if tradeID == "" {
|
||||
t.Fatalf("missing trade_id in create response: %v", resp)
|
||||
}
|
||||
return tradeID
|
||||
}
|
||||
|
||||
func getCheckoutCounterRespData(t *testing.T, e *echo.Echo, tradeID string) map[string]interface{} {
|
||||
t.Helper()
|
||||
|
||||
req := httptest.NewRequest(http.MethodGet, "/pay/checkout-counter-resp/"+tradeID, nil)
|
||||
rec := httptest.NewRecorder()
|
||||
e.ServeHTTP(rec, req)
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
var resp map[string]interface{}
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("unmarshal checkout counter response: %v", err)
|
||||
}
|
||||
data, ok := resp["data"].(map[string]interface{})
|
||||
if !ok {
|
||||
t.Fatalf("expected checkout counter data, got: %v", resp)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// TestSwitchNetwork_MissingFields verifies that /pay/switch-network validates
|
||||
// required fields and returns a graceful error when they are missing.
|
||||
func TestSwitchNetwork_MissingFields(t *testing.T) {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
import{t as e}from"./unauthorized-error-BfqXR-z5.js";var t=e;export{t as component};
|
||||
@@ -0,0 +1 @@
|
||||
import{t as e}from"./unauthorized-error-MToTZ-fm.js";var t=e;export{t as component};
|
||||
@@ -0,0 +1 @@
|
||||
import{t as e}from"./forbidden-Dnfepx4V.js";var t=e;export{t as component};
|
||||
@@ -1 +0,0 @@
|
||||
import{t as e}from"./forbidden-BKAmFUZf.js";var t=e;export{t as component};
|
||||
@@ -0,0 +1 @@
|
||||
import{t as e}from"./not-found-error-Zz2FacG5.js";var t=e;export{t as component};
|
||||
@@ -1 +0,0 @@
|
||||
import{t as e}from"./not-found-error-BtnqPSZ8.js";var t=e;export{t as component};
|
||||
@@ -1 +0,0 @@
|
||||
import{t as e}from"./general-error-CX-5x5zG.js";var t=e;export{t as component};
|
||||
@@ -0,0 +1 @@
|
||||
import{t as e}from"./general-error-B5vyck1f.js";var t=e;export{t as component};
|
||||
@@ -1 +0,0 @@
|
||||
import{t as e}from"./maintenance-error-iY3svc2d.js";var t=e;export{t as component};
|
||||
@@ -0,0 +1 @@
|
||||
import{t as e}from"./maintenance-error-CSCtVDBb.js";var t=e;export{t as component};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";import{o as r,s as i,t as a}from"./useRouter-DVaO3x1M.js";import{t as o}from"./useStore-C0QnsklM.js";import{f as s}from"./ClientOnly-C2xi1NZw.js";import"./redirect-dE0wk0WH.js";import{a as c,i as l,r as u,s as d,t as f}from"./Match-2kn-2UmU.js";import{n as p}from"./matchContext-DY0RaDqI.js";import{t as m}from"./atom-DI1Bn-1s.js";function h(e){if(typeof document<`u`&&document.querySelector){let t=e.stores.location.get(),n=t.state.__hashScrollIntoViewOptions??!0;if(n&&t.hash!==``){let e=document.getElementById(t.hash);e&&e.scrollIntoView(n)}}}var g=e(t(),1);function _(){let e=a(),t=g.useRef({router:e,mounted:!1}),[n,c]=g.useState(!1),l=o(e.stores.isLoading,e=>e),u=o(e.stores.hasPending,e=>e),f=i(l),p=l||n||u,_=i(p),v=l||u,y=i(v);return e.startTransition=e=>{c(!0),g.startTransition(()=>{e(),c(!1)})},g.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return s(e.latestLocation.publicHref)!==s(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),r(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),r(()=>{f&&!l&&e.emit({type:`onLoad`,...d(e.stores.location.get(),e.stores.resolvedLocation.get())})},[f,e,l]),r(()=>{y&&!v&&e.emit({type:`onBeforeRouteMount`,...d(e.stores.location.get(),e.stores.resolvedLocation.get())})},[v,y,e]),r(()=>{if(_&&!p){let t=d(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),m(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())}),t.hrefChanged&&h(e)}},[p,_,e]),null}var v=n();function y(){let e=a(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,v.jsx)(t,{}):null,r=(0,v.jsxs)(typeof document<`u`&&e.ssr?u:g.Suspense,{fallback:n,children:[(0,v.jsx)(_,{}),(0,v.jsx)(b,{})]});return e.options.InnerWrap?(0,v.jsx)(e.options.InnerWrap,{children:r}):r}function b(){let e=a(),t=o(e.stores.firstId,e=>e),n=o(e.stores.loadedAt,e=>e),r=t?(0,v.jsx)(f,{matchId:t}):null;return(0,v.jsx)(p.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,v.jsx)(l,{getResetKey:()=>n,errorComponent:c,onCatch:void 0,children:r})})}function x(){let e=a();return o(e.stores.matchRouteDeps,e=>e),g.useCallback(t=>{let{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a,...o}=t;return e.matchRoute(o,{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a})},[e])}export{x as n,y as t};
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{o as r,s as i,t as a}from"./useRouter-BP80Cbua.js";import{t as o}from"./useStore-Exbiv5rk.js";import{f as s}from"./ClientOnly-Z4uY-q9B.js";import"./redirect-dE0wk0WH.js";import{a as c,i as l,r as u,s as d,t as f}from"./Match-CiZKPccq.js";import{n as p}from"./matchContext-B9SKKWgV.js";import{t as m}from"./atom-DI1Bn-1s.js";function h(e){if(typeof document<`u`&&document.querySelector){let t=e.stores.location.get(),n=t.state.__hashScrollIntoViewOptions??!0;if(n&&t.hash!==``){let e=document.getElementById(t.hash);e&&e.scrollIntoView(n)}}}var g=t(e(),1);function _(){let e=a(),t=g.useRef({router:e,mounted:!1}),[n,c]=g.useState(!1),l=o(e.stores.isLoading,e=>e),u=o(e.stores.hasPending,e=>e),f=i(l),p=l||n||u,_=i(p),v=l||u,y=i(v);return e.startTransition=e=>{c(!0),g.startTransition(()=>{e(),c(!1)})},g.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return s(e.latestLocation.publicHref)!==s(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),r(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),r(()=>{f&&!l&&e.emit({type:`onLoad`,...d(e.stores.location.get(),e.stores.resolvedLocation.get())})},[f,e,l]),r(()=>{y&&!v&&e.emit({type:`onBeforeRouteMount`,...d(e.stores.location.get(),e.stores.resolvedLocation.get())})},[v,y,e]),r(()=>{if(_&&!p){let t=d(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),m(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())}),t.hrefChanged&&h(e)}},[p,_,e]),null}var v=n();function y(){let e=a(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,v.jsx)(t,{}):null,r=(0,v.jsxs)(typeof document<`u`&&e.ssr?u:g.Suspense,{fallback:n,children:[(0,v.jsx)(_,{}),(0,v.jsx)(b,{})]});return e.options.InnerWrap?(0,v.jsx)(e.options.InnerWrap,{children:r}):r}function b(){let e=a(),t=o(e.stores.firstId,e=>e),n=o(e.stores.loadedAt,e=>e),r=t?(0,v.jsx)(f,{matchId:t}):null;return(0,v.jsx)(p.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,v.jsx)(l,{getResetKey:()=>n,errorComponent:c,onCatch:void 0,children:r})})}function x(){let e=a();return o(e.stores.matchRouteDeps,e=>e),g.useCallback(t=>{let{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a,...o}=t;return e.matchRoute(o,{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a})},[e])}export{x as n,y as t};
|
||||
@@ -0,0 +1 @@
|
||||
import{if as e}from"./messages-BSgosaSa.js";import{m as t}from"./search-provider-Dt_F-pkS.js";import{n,t as r}from"./theme-switch-DzxlVGFK.js";import{t as i}from"./general-error-B5vyck1f.js";import{t as a}from"./not-found-error-Zz2FacG5.js";import{t as o}from"./_error-DfUrvDhK.js";import{t as s}from"./unauthorized-error-MToTZ-fm.js";import{t as c}from"./forbidden-Dnfepx4V.js";import{t as l}from"./maintenance-error-CSCtVDBb.js";import{n as u,r as d,t as f}from"./header-BoelcHSz.js";var p=e();function m(){let{error:e}=o.useParams(),m={unauthorized:s,forbidden:c,"not-found":a,"internal-server-error":i,"maintenance-error":l}[e]||a;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(f,{className:`border-b`,fixed:!0,children:[(0,p.jsx)(u,{}),(0,p.jsxs)(`div`,{className:`ms-auto flex items-center space-x-4`,children:[(0,p.jsx)(n,{}),(0,p.jsx)(r,{}),(0,p.jsx)(t,{}),(0,p.jsx)(d,{})]})]}),(0,p.jsx)(`div`,{className:`flex-1 [&>div]:h-full`,children:(0,p.jsx)(m,{})})]})}export{m as component};
|
||||
@@ -1 +0,0 @@
|
||||
import{tf as e}from"./messages-BvSF842O.js";import{m as t}from"./search-provider-S_pK7Mew.js";import{n,t as r}from"./theme-switch-LtlARoAw.js";import{t as i}from"./general-error-CX-5x5zG.js";import{t as a}from"./not-found-error-BtnqPSZ8.js";import{t as o}from"./_error-DYN8rorm.js";import{t as s}from"./unauthorized-error-BfqXR-z5.js";import{t as c}from"./forbidden-BKAmFUZf.js";import{t as l}from"./maintenance-error-iY3svc2d.js";import{n as u,r as d,t as f}from"./header-BarMDbkJ.js";var p=e();function m(){let{error:e}=o.useParams(),m={unauthorized:s,forbidden:c,"not-found":a,"internal-server-error":i,"maintenance-error":l}[e]||a;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(f,{className:`border-b`,fixed:!0,children:[(0,p.jsx)(u,{}),(0,p.jsxs)(`div`,{className:`ms-auto flex items-center space-x-4`,children:[(0,p.jsx)(n,{}),(0,p.jsx)(r,{}),(0,p.jsx)(t,{}),(0,p.jsx)(d,{})]})]}),(0,p.jsx)(`div`,{className:`flex-1 [&>div]:h-full`,children:(0,p.jsx)(m,{})})]})}export{m as component};
|
||||
@@ -1,2 +0,0 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_error-BJEoAZn5.js","assets/messages-BvSF842O.js","assets/search-provider-S_pK7Mew.js","assets/dist-BOyWZkOA.js","assets/dist-gwfT6Lh0.js","assets/confirm-dialog-BINqXK0b.js","assets/button-D5xmeb32.js","assets/dist-CCr-5-sC.js","assets/dist-CCJTittj.js","assets/dist-BbslaEHP.js","assets/dist-BPr298C3.js","assets/es2015-DJhPRjvM.js","assets/dist-BJxEqcEF.js","assets/dist-ibg4sB6V.js","assets/dist-BtKF_Fdt.js","assets/dist-DJOPBXks.js","assets/dist-ClhK3NkD.js","assets/dist-DdarLBQJ.js","assets/separator-S9ojZdzv.js","assets/tooltip-D20upJw9.js","assets/dist-DWza9pO6.js","assets/dist-DNwhj9Co.js","assets/auth-store-2l354uaq.js","assets/dist-C7U751gb.js","assets/with-selector-CWUgF2FI.js","assets/cookies-C6BqVyqT.js","assets/useRouter-DVaO3x1M.js","assets/useNavigate-DGiKRiQU.js","assets/useStore-C0QnsklM.js","assets/command-NHXN_saF.js","assets/createLucideIcon-BGQWeu8F.js","assets/x-CJvS5f0_.js","assets/skeleton-CbqiOymc.js","assets/wallet-BEnVSmzH.js","assets/sun-eqHSs_DP.js","assets/shield-check-ncnxEJs4.js","assets/logo-BmsPR42p.js","assets/input-CPAfWtuT.js","assets/font-provider-3vIeNUj6.js","assets/theme-provider-DOdLvAnl.js","assets/theme-switch-LtlARoAw.js","assets/dropdown-menu-Cvv2xK8F.js","assets/check-Bv7wmlvP.js","assets/header-BarMDbkJ.js","assets/link-CeK9z2o_.js","assets/ClientOnly-C2xi1NZw.js","assets/forbidden-BKAmFUZf.js","assets/general-error-CX-5x5zG.js","assets/maintenance-error-iY3svc2d.js","assets/not-found-error-BtnqPSZ8.js","assets/unauthorized-error-BfqXR-z5.js"])))=>i.map(i=>d[i]);
|
||||
import{n as e,r as t,t as n}from"./preload-helper-Co27Ga7q.js";var r=t(`/_authenticated/errors/$error`)({component:e(()=>n(()=>import(`./_error-BJEoAZn5.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50])),`component`)});export{r as t};
|
||||
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_error-B6Nmwvub.js","assets/messages-BSgosaSa.js","assets/search-provider-Dt_F-pkS.js","assets/dist-BTQ1T4Z1.js","assets/dist-BX7-FFVx.js","assets/confirm-dialog-QFIvwt2-.js","assets/button-gsP5wmrs.js","assets/dist-C-eeUszQ.js","assets/dist-2NlRabHs.js","assets/dist-C3yztW6j.js","assets/dist-fWONwgan.js","assets/es2015-BoIOHfI5.js","assets/dist-CnRb3IO0.js","assets/dist-I_iv6zg5.js","assets/dist-VmAyFekA.js","assets/dist-ywuA9477.js","assets/dist-AW7rpZT7.js","assets/dist-BIHhvYX3.js","assets/dist-8mLdRaED.js","assets/separator-Ba9h8msf.js","assets/tooltip-DUTki-7-.js","assets/dist-FnsKqpTh.js","assets/dist-C1p3aui5.js","assets/auth-store-BFY9rMhZ.js","assets/dist-CFhr9Gp2.js","assets/with-selector-dqI4ImyX.js","assets/cookies-DtK8C3EL.js","assets/useRouter-BP80Cbua.js","assets/useNavigate-BNXxwDKM.js","assets/useStore-Exbiv5rk.js","assets/command-BOJV7P-9.js","assets/createLucideIcon-D--4ckBc.js","assets/x-Bm8bW9NP.js","assets/skeleton-UXXshNZm.js","assets/wallet-nm6u5kXR.js","assets/sun-BoHcAocg.js","assets/shield-check-Mb6GAKRJ.js","assets/logo-DvJMKKKo.js","assets/input-C0_2W2RZ.js","assets/font-provider-BJBBVY9T.js","assets/theme-provider-B5C7xoKA.js","assets/theme-switch-DzxlVGFK.js","assets/dropdown-menu-DLlHTZjq.js","assets/check-Cg6qKB39.js","assets/header-BoelcHSz.js","assets/link-fq4EwgoM.js","assets/ClientOnly-Z4uY-q9B.js","assets/forbidden-Dnfepx4V.js","assets/general-error-B5vyck1f.js","assets/maintenance-error-CSCtVDBb.js","assets/not-found-error-Zz2FacG5.js","assets/unauthorized-error-MToTZ-fm.js"])))=>i.map(i=>d[i]);
|
||||
import{n as e,r as t,t as n}from"./preload-helper-BeOhTAPJ.js";var r=t(`/_authenticated/errors/$error`)({component:e(()=>n(()=>import(`./_error-B6Nmwvub.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51])),`component`)});export{r as t};
|
||||
@@ -1,2 +0,0 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_trade_id-Fw6UGEEp.js","assets/messages-BvSF842O.js","assets/button-D5xmeb32.js","assets/select-BvqNeB11.js","assets/dist-DWza9pO6.js","assets/dist-gwfT6Lh0.js","assets/dist-BbslaEHP.js","assets/dist-BPr298C3.js","assets/dist-DdarLBQJ.js","assets/dist-BOyWZkOA.js","assets/dist-DJOPBXks.js","assets/dist-ibg4sB6V.js","assets/dist-CCJTittj.js","assets/es2015-DJhPRjvM.js","assets/dist-ClhK3NkD.js","assets/dist-DNwhj9Co.js","assets/createLucideIcon-BGQWeu8F.js","assets/check-Bv7wmlvP.js","assets/chevron-down-DXILDlcC.js","assets/auth-store-2l354uaq.js","assets/dist-C7U751gb.js","assets/with-selector-CWUgF2FI.js","assets/cookies-C6BqVyqT.js","assets/useNavigate-DGiKRiQU.js","assets/useRouter-DVaO3x1M.js","assets/copy-to-clipboard-CgiNCkz-.js","assets/arrow-left-Bnh1rsc-.js","assets/radio-group-un6EA-ec.js","assets/dist-BtKF_Fdt.js","assets/dist-BJxEqcEF.js","assets/loader-circle-Duqd1vVQ.js","assets/triangle-alert-CEMQD8Oa.js","assets/x-CJvS5f0_.js","assets/checkout-model-CxAw66kk.js"])))=>i.map(i=>d[i]);
|
||||
import{n as e,r as t,t as n}from"./preload-helper-Co27Ga7q.js";var r=t(`/cashier/$trade_id/`)({component:e(()=>n(()=>import(`./_trade_id-Fw6UGEEp.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33])),`component`)});export{r as t};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_trade_id-DcU1zP3I.js","assets/messages-BSgosaSa.js","assets/button-gsP5wmrs.js","assets/select-L52xnO1_.js","assets/dist-FnsKqpTh.js","assets/dist-BX7-FFVx.js","assets/dist-C3yztW6j.js","assets/dist-fWONwgan.js","assets/dist-8mLdRaED.js","assets/dist-BTQ1T4Z1.js","assets/dist-AW7rpZT7.js","assets/dist-I_iv6zg5.js","assets/dist-2NlRabHs.js","assets/es2015-BoIOHfI5.js","assets/dist-BIHhvYX3.js","assets/dist-C1p3aui5.js","assets/createLucideIcon-D--4ckBc.js","assets/check-Cg6qKB39.js","assets/chevron-down-gjYmTBfu.js","assets/auth-store-BFY9rMhZ.js","assets/dist-CFhr9Gp2.js","assets/with-selector-dqI4ImyX.js","assets/cookies-DtK8C3EL.js","assets/useNavigate-BNXxwDKM.js","assets/useRouter-BP80Cbua.js","assets/copy-to-clipboard-OC73aS5y.js","assets/arrow-left-Ob-XM86J.js","assets/radio-group-D5H97-KZ.js","assets/dist-VmAyFekA.js","assets/dist-CnRb3IO0.js","assets/dist-ywuA9477.js","assets/loader-circle-o4dbK3VT.js","assets/triangle-alert-k9A8_9KW.js","assets/x-Bm8bW9NP.js","assets/checkout-model-mW5oFIG-.js","assets/checkout-display-CSXzV3v2.js","assets/copy-DIIY1PDt.js"])))=>i.map(i=>d[i]);
|
||||
import{n as e,r as t,t as n}from"./preload-helper-BeOhTAPJ.js";var r=t(`/cashier/$trade_id/`)({component:e(()=>n(()=>import(`./_trade_id-DcU1zP3I.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36])),`component`)});export{r as t};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{Ud as e,Wd as t,an as n,cn as r,dn as i,ln as a,on as o,sn as s,tf as c,un as l}from"./messages-BvSF842O.js";import{i as u,n as d,t as f}from"./button-D5xmeb32.js";import{n as p,r as m}from"./font-provider-3vIeNUj6.js";import{n as h}from"./theme-provider-DOdLvAnl.js";import{t as g}from"./chevron-down-DXILDlcC.js";import{n as _,t as v}from"./radio-group-un6EA-ec.js";import{r as y,s as b}from"./zod-ClGKjEyB.js";import{a as x,c as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k}from"./form-iIuz3zSX.js";import{t as A}from"./page-header-D58MnYJU.js";import{t as j}from"./show-submitted-data-Bl1Wpk1q.js";var M=c(),N=b({theme:y([`light`,`dark`]),font:y(m)});function P(){let{font:i,setFont:c}=p(),{theme:l,setTheme:y}=h(),b={theme:l,font:i},A=w({resolver:S(N),defaultValues:b});function P(e){e.font!==i&&c(e.font),e.theme!==l&&y(e.theme),j(e)}return(0,M.jsx)(k,{...A,children:(0,M.jsxs)(`form`,{className:`space-y-8`,onSubmit:A.handleSubmit(P),children:[(0,M.jsx)(C,{control:A.control,name:`font`,render:({field:e})=>(0,M.jsxs)(x,{children:[(0,M.jsx)(E,{children:a()}),(0,M.jsxs)(`div`,{className:`relative w-max`,children:[(0,M.jsx)(T,{children:(0,M.jsx)(`select`,{className:u(d({variant:`outline`}),`w-50 appearance-none font-normal capitalize`,`dark:bg-background dark:hover:bg-background`),...e,children:m.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))})}),(0,M.jsx)(g,{className:`absolute inset-e-3 top-2.5 h-4 w-4 opacity-50`})]}),(0,M.jsx)(D,{className:`font-manrope`,children:r()}),(0,M.jsx)(O,{})]})}),(0,M.jsx)(C,{control:A.control,name:`theme`,render:({field:n})=>(0,M.jsxs)(x,{children:[(0,M.jsx)(E,{children:s()}),(0,M.jsx)(D,{children:o()}),(0,M.jsx)(O,{}),(0,M.jsxs)(v,{className:`grid max-w-md grid-cols-2 gap-8 pt-2`,defaultValue:n.value,onValueChange:n.onChange,children:[(0,M.jsx)(x,{children:(0,M.jsxs)(E,{className:`[&:has([data-state=checked])>div]:border-primary`,children:[(0,M.jsx)(T,{children:(0,M.jsx)(_,{className:`sr-only`,value:`light`})}),(0,M.jsx)(`div`,{className:`items-center rounded-md border-2 border-muted p-1 hover:border-accent`,children:(0,M.jsxs)(`div`,{className:`space-y-2 rounded-sm bg-[#ecedef] p-2`,children:[(0,M.jsxs)(`div`,{className:`space-y-2 rounded-md bg-white p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-2 w-20 rounded-lg bg-[#ecedef]`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-[#ecedef]`})]}),(0,M.jsxs)(`div`,{className:`flex items-center space-x-2 rounded-md bg-white p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-[#ecedef]`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-[#ecedef]`})]}),(0,M.jsxs)(`div`,{className:`flex items-center space-x-2 rounded-md bg-white p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-[#ecedef]`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-[#ecedef]`})]})]})}),(0,M.jsx)(`span`,{className:`block w-full p-2 text-center font-normal`,children:t()})]})}),(0,M.jsx)(x,{children:(0,M.jsxs)(E,{className:`[&:has([data-state=checked])>div]:border-primary`,children:[(0,M.jsx)(T,{children:(0,M.jsx)(_,{className:`sr-only`,value:`dark`})}),(0,M.jsx)(`div`,{className:`items-center rounded-md border-2 border-muted bg-popover p-1 hover:bg-accent hover:text-accent-foreground`,children:(0,M.jsxs)(`div`,{className:`space-y-2 rounded-sm bg-slate-950 p-2`,children:[(0,M.jsxs)(`div`,{className:`space-y-2 rounded-md bg-slate-800 p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-2 w-20 rounded-lg bg-slate-400`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-slate-400`})]}),(0,M.jsxs)(`div`,{className:`flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-slate-400`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-slate-400`})]}),(0,M.jsxs)(`div`,{className:`flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-slate-400`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-slate-400`})]})]})}),(0,M.jsx)(`span`,{className:`block w-full p-2 text-center font-normal`,children:e()})]})})]})]})}),(0,M.jsx)(f,{type:`submit`,children:n()})]})})}function F(){return(0,M.jsx)(A,{description:l(),title:i(),variant:`section`,children:(0,M.jsx)(P,{})})}var I=F;export{I as component};
|
||||
import{Kd as e,an as t,cn as n,dn as r,if as i,ln as a,on as o,qd as s,sn as c,un as l}from"./messages-BSgosaSa.js";import{i as u,n as d,t as f}from"./button-gsP5wmrs.js";import{n as p,r as m}from"./font-provider-BJBBVY9T.js";import{n as h}from"./theme-provider-B5C7xoKA.js";import{t as g}from"./chevron-down-gjYmTBfu.js";import{n as _,t as v}from"./radio-group-D5H97-KZ.js";import{r as y,s as b}from"./zod-Cmg_v3kW.js";import{a as x,c as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k}from"./form-s9C7GZ5q.js";import{t as A}from"./page-header-lpyPiG0-.js";import{t as j}from"./show-submitted-data-CczCj3vK.js";var M=i(),N=b({theme:y([`light`,`dark`]),font:y(m)});function P(){let{font:r,setFont:i}=p(),{theme:l,setTheme:y}=h(),b={theme:l,font:r},A=w({resolver:S(N),defaultValues:b});function P(e){e.font!==r&&i(e.font),e.theme!==l&&y(e.theme),j(e)}return(0,M.jsx)(k,{...A,children:(0,M.jsxs)(`form`,{className:`space-y-8`,onSubmit:A.handleSubmit(P),children:[(0,M.jsx)(C,{control:A.control,name:`font`,render:({field:e})=>(0,M.jsxs)(x,{children:[(0,M.jsx)(E,{children:a()}),(0,M.jsxs)(`div`,{className:`relative w-max`,children:[(0,M.jsx)(T,{children:(0,M.jsx)(`select`,{className:u(d({variant:`outline`}),`w-50 appearance-none font-normal capitalize`,`dark:bg-background dark:hover:bg-background`),...e,children:m.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))})}),(0,M.jsx)(g,{className:`absolute inset-e-3 top-2.5 h-4 w-4 opacity-50`})]}),(0,M.jsx)(D,{className:`font-manrope`,children:n()}),(0,M.jsx)(O,{})]})}),(0,M.jsx)(C,{control:A.control,name:`theme`,render:({field:t})=>(0,M.jsxs)(x,{children:[(0,M.jsx)(E,{children:c()}),(0,M.jsx)(D,{children:o()}),(0,M.jsx)(O,{}),(0,M.jsxs)(v,{className:`grid max-w-md grid-cols-2 gap-8 pt-2`,defaultValue:t.value,onValueChange:t.onChange,children:[(0,M.jsx)(x,{children:(0,M.jsxs)(E,{className:`[&:has([data-state=checked])>div]:border-primary`,children:[(0,M.jsx)(T,{children:(0,M.jsx)(_,{className:`sr-only`,value:`light`})}),(0,M.jsx)(`div`,{className:`items-center rounded-md border-2 border-muted p-1 hover:border-accent`,children:(0,M.jsxs)(`div`,{className:`space-y-2 rounded-sm bg-[#ecedef] p-2`,children:[(0,M.jsxs)(`div`,{className:`space-y-2 rounded-md bg-white p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-2 w-20 rounded-lg bg-[#ecedef]`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-[#ecedef]`})]}),(0,M.jsxs)(`div`,{className:`flex items-center space-x-2 rounded-md bg-white p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-[#ecedef]`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-[#ecedef]`})]}),(0,M.jsxs)(`div`,{className:`flex items-center space-x-2 rounded-md bg-white p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-[#ecedef]`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-[#ecedef]`})]})]})}),(0,M.jsx)(`span`,{className:`block w-full p-2 text-center font-normal`,children:s()})]})}),(0,M.jsx)(x,{children:(0,M.jsxs)(E,{className:`[&:has([data-state=checked])>div]:border-primary`,children:[(0,M.jsx)(T,{children:(0,M.jsx)(_,{className:`sr-only`,value:`dark`})}),(0,M.jsx)(`div`,{className:`items-center rounded-md border-2 border-muted bg-popover p-1 hover:bg-accent hover:text-accent-foreground`,children:(0,M.jsxs)(`div`,{className:`space-y-2 rounded-sm bg-slate-950 p-2`,children:[(0,M.jsxs)(`div`,{className:`space-y-2 rounded-md bg-slate-800 p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-2 w-20 rounded-lg bg-slate-400`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-slate-400`})]}),(0,M.jsxs)(`div`,{className:`flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-slate-400`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-slate-400`})]}),(0,M.jsxs)(`div`,{className:`flex items-center space-x-2 rounded-md bg-slate-800 p-2 shadow-xs`,children:[(0,M.jsx)(`div`,{className:`h-4 w-4 rounded-full bg-slate-400`}),(0,M.jsx)(`div`,{className:`h-2 w-25 rounded-lg bg-slate-400`})]})]})}),(0,M.jsx)(`span`,{className:`block w-full p-2 text-center font-normal`,children:e()})]})})]})]})}),(0,M.jsx)(f,{type:`submit`,children:t()})]})})}function F(){return(0,M.jsx)(A,{description:l(),title:r(),variant:`section`,children:(0,M.jsx)(P,{})})}var I=F;export{I as component};
|
||||
@@ -1 +1 @@
|
||||
import{t as e}from"./createLucideIcon-BGQWeu8F.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";var r=e(t(),1),i=n(),a=(0,r.createContext)({isTyping:!1,passwordLength:0,setIsTyping:()=>void 0,setPasswordLength:()=>void 0,setShowPassword:()=>void 0,showPassword:!1});function o({children:e}){let[t,n]=(0,r.useState)(!1),[o,s]=(0,r.useState)(!1),[c,l]=(0,r.useState)(0);return(0,i.jsx)(a.Provider,{value:{isTyping:t,passwordLength:c,setIsTyping:n,setPasswordLength:l,setShowPassword:s,showPassword:o},children:e})}function s(){return(0,r.useContext)(a)}export{s as n,o as t};
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";var r=t(e(),1),i=n(),a=(0,r.createContext)({isTyping:!1,passwordLength:0,setIsTyping:()=>void 0,setPasswordLength:()=>void 0,setShowPassword:()=>void 0,showPassword:!1});function o({children:e}){let[t,n]=(0,r.useState)(!1),[o,s]=(0,r.useState)(!1),[c,l]=(0,r.useState)(0);return(0,i.jsx)(a.Provider,{value:{isTyping:t,passwordLength:c,setIsTyping:n,setPasswordLength:l,setShowPassword:s,showPassword:o},children:e})}function s(){return(0,r.useContext)(a)}export{s as n,o as t};
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{tf as e}from"./messages-BvSF842O.js";import{i as t,r as n,s as r}from"./button-D5xmeb32.js";var i=e(),a=n(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-full border border-transparent px-2 py-0.5 font-medium text-xs transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function o({className:e,variant:n=`default`,asChild:o=!1,...s}){return(0,i.jsx)(o?r:`span`,{className:t(a({variant:n}),e),"data-slot":`badge`,"data-variant":n,...s})}export{o as t};
|
||||
import{if as e}from"./messages-BSgosaSa.js";import{i as t,r as n,s as r}from"./button-gsP5wmrs.js";var i=e(),a=n(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-full border border-transparent px-2 py-0.5 font-medium text-xs transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function o({className:e,variant:n=`default`,asChild:o=!1,...s}){return(0,i.jsx)(o?r:`span`,{className:t(a({variant:n}),e),"data-slot":`badge`,"data-variant":n,...s})}export{o as t};
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{tf as e}from"./messages-BvSF842O.js";import{i as t}from"./button-D5xmeb32.js";var n=e();function r({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),"data-slot":`card`,...r})}function i({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),"data-slot":`card-header`,...r})}function a({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`font-semibold leading-none`,e),"data-slot":`card-title`,...r})}function o({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`text-muted-foreground text-sm`,e),"data-slot":`card-description`,...r})}function s({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`px-6`,e),"data-slot":`card-content`,...r})}export{a,i,s as n,o as r,r as t};
|
||||
import{if as e}from"./messages-BSgosaSa.js";import{i as t}from"./button-gsP5wmrs.js";var n=e();function r({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),"data-slot":`card`,...r})}function i({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),"data-slot":`card-header`,...r})}function a({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`font-semibold leading-none`,e),"data-slot":`card-title`,...r})}function o({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`text-muted-foreground text-sm`,e),"data-slot":`card-description`,...r})}function s({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`px-6`,e),"data-slot":`card-content`,...r})}export{a,i,s as n,o as r,r as t};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{af as e,nf as t}from"./messages-BvSF842O.js";import{a as n,d as r,u as i}from"./auth-store-2l354uaq.js";import{t as a}from"./createLucideIcon-BGQWeu8F.js";var o=a(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),s=e(t(),1),c=new i({chains:[],loading:!1});function l(e){c.setState(t=>({...t,chains:e}))}function u(e){c.setState(t=>({...t,loading:e}))}function d(){let e=r(c,e=>e.chains),t=r(c,e=>e.loading),i=n.useQuery(`get`,`/admin/api/v1/chains`);return(0,s.useEffect)(()=>{u(i.isLoading)},[i.isLoading]),(0,s.useEffect)(()=>{i.data?.data&&l(i.data.data)},[i.data?.data]),{chains:e,loading:t,refetch:i.refetch}}export{o as n,d as t};
|
||||
import{af as e,cf as t}from"./messages-BSgosaSa.js";import{a as n,d as r,u as i}from"./auth-store-BFY9rMhZ.js";import{t as a}from"./createLucideIcon-D--4ckBc.js";var o=a(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),s=t(e(),1),c=new i({chains:[],loading:!1});function l(e){c.setState(t=>({...t,chains:e}))}function u(e){c.setState(t=>({...t,loading:e}))}function d(){let e=r(c,e=>e.chains),t=r(c,e=>e.loading),i=n.useQuery(`get`,`/admin/api/v1/chains`);return(0,s.useEffect)(()=>{u(i.isLoading)},[i.isLoading]),(0,s.useEffect)(()=>{i.data?.data&&l(i.data.data)},[i.data?.data]),{chains:e,loading:t,refetch:i.refetch}}export{o as n,d as t};
|
||||
@@ -1 +0,0 @@
|
||||
import{t as e}from"./createLucideIcon-BGQWeu8F.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
|
||||
@@ -0,0 +1 @@
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";import{t as r}from"./dist-BPr298C3.js";import{d as i,i as a}from"./button-D5xmeb32.js";import{a as o,r as s,t as c}from"./dist-gwfT6Lh0.js";import{t as l}from"./dist-BJxEqcEF.js";import{t as u}from"./dist-ClhK3NkD.js";import{t as d}from"./dist-DdarLBQJ.js";import{t as f}from"./check-Bv7wmlvP.js";var p=e(t(),1),m=n(),h=`Checkbox`,[g,_]=o(h),[v,y]=g(h);function b(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[g,_]=c({prop:n,defaultProp:i??!1,onChange:l,caller:h}),[y,b]=p.useState(null),[x,S]=p.useState(null),C=p.useRef(!1),w=y?!!o||!!y.closest(`form`):!0,T={checked:g,disabled:a,setChecked:_,control:y,setControl:b,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:C,required:u,defaultChecked:k(i)?!1:i,isFormControl:w,bubbleInput:x,setBubbleInput:S};return(0,m.jsx)(v,{scope:t,...T,children:O(f)?f(T):r})}var x=`CheckboxTrigger`,S=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},o)=>{let{control:c,value:l,disabled:u,checked:d,required:f,setControl:h,setChecked:g,hasConsumerStoppedPropagationRef:_,isFormControl:v,bubbleInput:b}=y(x,e),S=i(o,h),C=p.useRef(d);return p.useEffect(()=>{let e=c?.form;if(e){let t=()=>g(C.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[c,g]),(0,m.jsx)(r.button,{type:`button`,role:`checkbox`,"aria-checked":k(d)?`mixed`:d,"aria-required":f,"data-state":A(d),"data-disabled":u?``:void 0,disabled:u,value:l,...a,ref:S,onKeyDown:s(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:s(n,e=>{g(e=>k(e)?!0:!e),b&&v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})})});S.displayName=x;var C=p.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,m.jsx)(b,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(S,{...d,ref:t,__scopeCheckbox:n}),e&&(0,m.jsx)(D,{__scopeCheckbox:n})]})})});C.displayName=h;var w=`CheckboxIndicator`,T=p.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:i,...a}=e,o=y(w,n);return(0,m.jsx)(l,{present:i||k(o.checked)||o.checked===!0,children:(0,m.jsx)(r.span,{"data-state":A(o.checked),"data-disabled":o.disabled?``:void 0,...a,ref:t,style:{pointerEvents:`none`,...e.style}})})});T.displayName=w;var E=`CheckboxBubbleInput`,D=p.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:a,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:c,required:l,disabled:f,name:h,value:g,form:_,bubbleInput:v,setBubbleInput:b}=y(E,e),x=i(n,b),S=u(s),C=d(a);p.useEffect(()=>{let e=v;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!o.current;if(S!==s&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=k(s),n.call(e,k(s)?!1:s),e.dispatchEvent(t)}},[v,S,s,o]);let w=p.useRef(k(s)?!1:s);return(0,m.jsx)(r.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??w.current,required:l,disabled:f,name:h,value:g,form:_,...t,tabIndex:-1,ref:x,style:{...t.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});D.displayName=E;function O(e){return typeof e==`function`}function k(e){return e===`indeterminate`}function A(e){return k(e)?`indeterminate`:e?`checked`:`unchecked`}function j({className:e,...t}){return(0,m.jsx)(C,{className:a(`peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:aria-invalid:ring-destructive/40`,e),"data-slot":`checkbox`,...t,children:(0,m.jsx)(T,{className:`grid place-content-center text-current transition-none`,"data-slot":`checkbox-indicator`,children:(0,m.jsx)(f,{className:`size-3.5`})})})}export{j as t};
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{t as r}from"./dist-fWONwgan.js";import{d as i,i as a}from"./button-gsP5wmrs.js";import{a as o,r as s,t as c}from"./dist-BX7-FFVx.js";import{t as l}from"./dist-CnRb3IO0.js";import{t as u}from"./dist-BIHhvYX3.js";import{t as d}from"./dist-8mLdRaED.js";import{t as f}from"./check-Cg6qKB39.js";var p=t(e(),1),m=n(),h=`Checkbox`,[g,_]=o(h),[v,y]=g(h);function b(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[g,_]=c({prop:n,defaultProp:i??!1,onChange:l,caller:h}),[y,b]=p.useState(null),[x,S]=p.useState(null),C=p.useRef(!1),w=y?!!o||!!y.closest(`form`):!0,T={checked:g,disabled:a,setChecked:_,control:y,setControl:b,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:C,required:u,defaultChecked:k(i)?!1:i,isFormControl:w,bubbleInput:x,setBubbleInput:S};return(0,m.jsx)(v,{scope:t,...T,children:O(f)?f(T):r})}var x=`CheckboxTrigger`,S=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},o)=>{let{control:c,value:l,disabled:u,checked:d,required:f,setControl:h,setChecked:g,hasConsumerStoppedPropagationRef:_,isFormControl:v,bubbleInput:b}=y(x,e),S=i(o,h),C=p.useRef(d);return p.useEffect(()=>{let e=c?.form;if(e){let t=()=>g(C.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[c,g]),(0,m.jsx)(r.button,{type:`button`,role:`checkbox`,"aria-checked":k(d)?`mixed`:d,"aria-required":f,"data-state":A(d),"data-disabled":u?``:void 0,disabled:u,value:l,...a,ref:S,onKeyDown:s(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:s(n,e=>{g(e=>k(e)?!0:!e),b&&v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})})});S.displayName=x;var C=p.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,m.jsx)(b,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(S,{...d,ref:t,__scopeCheckbox:n}),e&&(0,m.jsx)(D,{__scopeCheckbox:n})]})})});C.displayName=h;var w=`CheckboxIndicator`,T=p.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:i,...a}=e,o=y(w,n);return(0,m.jsx)(l,{present:i||k(o.checked)||o.checked===!0,children:(0,m.jsx)(r.span,{"data-state":A(o.checked),"data-disabled":o.disabled?``:void 0,...a,ref:t,style:{pointerEvents:`none`,...e.style}})})});T.displayName=w;var E=`CheckboxBubbleInput`,D=p.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:a,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:c,required:l,disabled:f,name:h,value:g,form:_,bubbleInput:v,setBubbleInput:b}=y(E,e),x=i(n,b),S=u(s),C=d(a);p.useEffect(()=>{let e=v;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!o.current;if(S!==s&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=k(s),n.call(e,k(s)?!1:s),e.dispatchEvent(t)}},[v,S,s,o]);let w=p.useRef(k(s)?!1:s);return(0,m.jsx)(r.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??w.current,required:l,disabled:f,name:h,value:g,form:_,...t,tabIndex:-1,ref:x,style:{...t.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});D.displayName=E;function O(e){return typeof e==`function`}function k(e){return e===`indeterminate`}function A(e){return k(e)?`indeterminate`:e?`checked`:`unchecked`}function j({className:e,...t}){return(0,m.jsx)(C,{className:a(`peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:aria-invalid:ring-destructive/40`,e),"data-slot":`checkbox`,...t,children:(0,m.jsx)(T,{className:`grid place-content-center text-current transition-none`,"data-slot":`checkbox-indicator`,children:(0,m.jsx)(f,{className:`size-3.5`})})})}export{j as t};
|
||||
@@ -0,0 +1 @@
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{i as r,t as i}from"./button-gsP5wmrs.js";import{t as a}from"./check-Cg6qKB39.js";import{t as o}from"./copy-DIIY1PDt.js";var s=t(e(),1),c=n(),l=1400,u=`https://cdn.jsdmirror.com/gh/GMWalletApp/crypto-icons@latest/assets/64/`,d=`https://cdn.jsdmirror.com/gh/GMWalletApp/crypto-icons@latest/maps/colors.json`,f=null,p=null;function m(e){return String(e??``).trim().toLowerCase()}function h(e){let t=m(e);return t?`${u}${t}.png`:null}function g(){return f?Promise.resolve(f):(p||=fetch(d).then(e=>{if(!e.ok)throw Error(`Failed to load icon colors: ${e.status}`);return e.json()}).then(e=>(f=e,e)).catch(()=>(p=null,{})),p)}function _(e,t){let n=e.replace(`#`,``);if(/^[\da-f]{6}$/i.test(n))return`rgba(${Number.parseInt(n.slice(0,2),16)}, ${Number.parseInt(n.slice(2,4),16)}, ${Number.parseInt(n.slice(4,6),16)}, ${t})`}function v(e){return h(e)}function y(e,t){return t?.trim()||e||`--`}function b(e){return h(e)}function x(e){let t=m(e),[n,r]=(0,s.useState)(()=>f?.[t]);return(0,s.useEffect)(()=>{let e=!1;if(!t){r(void 0);return}if(f){r(f[t]);return}return g().then(n=>{e||r(n[t])}),()=>{e=!0}},[t]),n}function S(e){if(e)return{background:_(e,.16),color:e}}function C(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,i=e=>String(e).padStart(2,`0`);return t>0?`${i(t)}:${i(n)}:${i(r)}`:`${i(n)}:${i(r)}`}function w({displayName:e,network:t}){let n=v(t);return(0,c.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[n?(0,c.jsx)(`img`,{alt:``,className:`size-4 rounded-full`,height:16,src:n,width:16}):null,(0,c.jsx)(`span`,{className:`truncate`,children:y(t,e)})]})}function T({token:e}){let t=b(e);return(0,c.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[t?(0,c.jsx)(`img`,{alt:``,className:r(`size-4 rounded-full`),height:16,src:t,width:16}):null,(0,c.jsx)(`span`,{className:`truncate`,children:e})]})}function E({className:e,onClick:t}){let[n,u]=(0,s.useState)(!1),d=(0,s.useRef)(void 0);return(0,s.useEffect)(()=>()=>{d.current!==void 0&&window.clearTimeout(d.current)},[]),(0,c.jsx)(i,{className:r(`mb-0.5 shrink-0`,e),onClick:()=>{if(d.current!==void 0&&window.clearTimeout(d.current),t()===!1){u(!1);return}u(!0),d.current=window.setTimeout(()=>{u(!1),d.current=void 0},l)},size:`icon-sm`,type:`button`,variant:`secondary`,children:n?(0,c.jsx)(a,{className:`text-emerald-600 dark:text-emerald-400`}):(0,c.jsx)(o,{})})}export{y as a,b as c,v as i,x as l,w as n,C as o,T as r,S as s,E as t};
|
||||
+1
-1
@@ -1 +1 @@
|
||||
var e=5e3,t=3e3,n=[10008,10013,404],r=10010,i=`Request failed`;function a(e){return{trade_id:e.trade_id,amount:e.amount,actual_amount:e.actual_amount,token:e.token?.toUpperCase(),currency:e.currency?.toUpperCase(),network:e.network,payment_url:e.payment_url,receive_address:e.receive_address,expiration_time:e.expiration_time,redirect_url:e.redirect_url,created_at:e.created_at,is_selected:e.is_selected}}function o(e){if(e!=null)return typeof e==`object`&&`data`in e?e.data:e}function s(e){return typeof e==`boolean`?e:typeof e==`number`?e!==0:[`1`,`true`,`yes`].includes(String(e??``).toLowerCase())}function c(e){if(e&&typeof e==`object`){if(`status_code`in e&&typeof e.status_code==`number`)return e.status_code;if(`code`in e&&typeof e.code==`number`)return e.code;if(`data`in e)return c(e.data)}}function l(e){if(e==null||e===``)return null;if(typeof e==`number`||/^\d+$/.test(String(e))){let t=Number(e);return new Date(t<0xe8d4a51000?t*1e3:t)}let t=new Date(String(e));return Number.isNaN(t.getTime())?null:t}function u(e,t){return String(e??``).toLowerCase()===String(t??``).toLowerCase()}function d(e){let t=Math.max(0,Math.min(1,e));return t>=.5?`#22c55e`:t>=.2?`#f97316`:`#ef4444`}function f(e,t,n){return e.length===0?null:e.find(e=>u(e.network,n?.network)&&u(e.token,n?.token))||e.find(e=>u(e.network,n?.network))||e.find(e=>u(e.token,n?.token))||e.find(e=>u(e.network,t?.network)&&u(e.token,t?.token))||(e.find(e=>u(e.network,t?.network))??e.find(e=>u(e.token,t?.token))??e[0])}function p(e){return e?.supported_assets?.flatMap(e=>(e.tokens??[]).filter(t=>!!(t&&e.network)).map(t=>({network:e.network,token:t.toUpperCase()})))??[]}function m(e,t){return new Promise((n,r)=>{let i=window.setTimeout(n,e);t?.addEventListener(`abort`,()=>{window.clearTimeout(i),r(t.reason)},{once:!0})})}export{t as a,c,l as d,u as f,o as h,e as i,s as l,p as m,i as n,m as o,d as p,n as r,f as s,r as t,a as u};
|
||||
var e=5e3,t=3e3,n=[10008,10013,404],r=10010,i=`Request failed`;function a(e){return{trade_id:e.trade_id,amount:e.amount,actual_amount:e.actual_amount,token:e.token?.toUpperCase(),currency:e.currency?.toUpperCase(),network:e.network,payment_url:e.payment_url,receive_address:e.receive_address,expiration_time:e.expiration_time,redirect_url:e.redirect_url,created_at:e.created_at,is_selected:e.is_selected}}function o(e){if(e!=null)return typeof e==`object`&&`data`in e?e.data:e}function s(e){return typeof e==`boolean`?e:typeof e==`number`?e!==0:[`1`,`true`,`yes`].includes(String(e??``).toLowerCase())}function c(e){if(e&&typeof e==`object`){if(`status_code`in e&&typeof e.status_code==`number`)return e.status_code;if(`code`in e&&typeof e.code==`number`)return e.code;if(`data`in e)return c(e.data)}}function l(e){if(e==null||e===``)return null;if(typeof e==`number`||/^\d+$/.test(String(e))){let t=Number(e);return new Date(t<0xe8d4a51000?t*1e3:t)}let t=new Date(String(e));return Number.isNaN(t.getTime())?null:t}function u(e,t){return String(e??``).toLowerCase()===String(t??``).toLowerCase()}function d(e){let t=Math.max(0,Math.min(1,e));return t>=.5?`#22c55e`:t>=.2?`#f97316`:`#ef4444`}function f(e,t,n){return e.length===0?null:e.find(e=>u(e.network,n?.network)&&u(e.token,n?.token))||e.find(e=>u(e.network,n?.network))||e.find(e=>u(e.token,n?.token))||e.find(e=>u(e.network,t?.network)&&u(e.token,t?.token))||(e.find(e=>u(e.network,t?.network))??e.find(e=>u(e.token,t?.token))??e[0])}function p(e){return e?.supported_assets?.flatMap(e=>(e.tokens??[]).filter(t=>!!(t&&e.network)).map(t=>({network:e.network,token:t.toUpperCase(),displayName:e.display_name})))??[]}function m(e,t){return new Promise((n,r)=>{let i=window.setTimeout(n,e);t?.addEventListener(`abort`,()=>{window.clearTimeout(i),r(t.reason)},{once:!0})})}export{t as a,c,l as d,u as f,o as h,e as i,s as l,p as m,i as n,m as o,d as p,n as r,f as s,r as t,a as u};
|
||||
@@ -1 +1 @@
|
||||
import{t as e}from"./createLucideIcon-BGQWeu8F.js";var t=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]);export{t};
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]);export{t};
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{t as e}from"./createLucideIcon-BGQWeu8F.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
|
||||
@@ -1 +1 @@
|
||||
import{t as e}from"./createLucideIcon-BGQWeu8F.js";var t=e(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]);export{t};
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]);export{t};
|
||||
@@ -0,0 +1 @@
|
||||
import{Bd as e,Vd as t,if as n,zd as r}from"./messages-BSgosaSa.js";import{d as i,l as a,m as o,p as s,u as c}from"./command-BOJV7P-9.js";import{t as l}from"./telescope-1xQBKzAV.js";var u=n();function d({open:n,onOpenChange:d}){return(0,u.jsx)(a,{onOpenChange:d,open:n,children:(0,u.jsx)(c,{className:`sm:max-w-sm`,children:(0,u.jsxs)(s,{className:`items-center text-center`,children:[(0,u.jsx)(l,{className:`mb-2 size-12 text-muted-foreground`}),(0,u.jsx)(o,{children:t()}),(0,u.jsxs)(i,{children:[e(),(0,u.jsx)(`br`,{}),(0,u.jsx)(`p`,{className:`mt-2 text-center`,children:r()})]})]})})})}export{d as t};
|
||||
@@ -1 +0,0 @@
|
||||
import{Id as e,Ld as t,Rd as n,tf as r}from"./messages-BvSF842O.js";import{d as i,l as a,m as o,p as s,u as c}from"./command-NHXN_saF.js";import{t as l}from"./telescope-DmBD-aeq.js";var u=r();function d({open:r,onOpenChange:d}){return(0,u.jsx)(a,{onOpenChange:d,open:r,children:(0,u.jsx)(c,{className:`sm:max-w-sm`,children:(0,u.jsxs)(s,{className:`items-center text-center`,children:[(0,u.jsx)(l,{className:`mb-2 size-12 text-muted-foreground`}),(0,u.jsx)(o,{children:n()}),(0,u.jsxs)(i,{children:[t(),(0,u.jsx)(`br`,{}),(0,u.jsx)(`p`,{className:`mt-2 text-center`,children:e()})]})]})})})}export{d as t};
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{Xd as e,Yd as t,af as n,nf as r,tf as i}from"./messages-BvSF842O.js";import{d as a,i as o,l as s,t as c}from"./button-D5xmeb32.js";import{a as l,r as u}from"./dist-gwfT6Lh0.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as ee,t as v,u as y}from"./dist-CCr-5-sC.js";var b=n(r(),1),x=i(),S=`AlertDialog`,[C,te]=l(S,[y]),w=y(),T=e=>{let{__scopeAlertDialog:t,...n}=e,r=w(t);return(0,x.jsx)(g,{...r,...n,modal:!0})};T.displayName=S;var E=`AlertDialogTrigger`,D=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(f,{...i,...r,ref:t})});D.displayName=E;var O=`AlertDialogPortal`,k=e=>{let{__scopeAlertDialog:t,...n}=e,r=w(t);return(0,x.jsx)(d,{...r,...n})};k.displayName=O;var A=`AlertDialogOverlay`,j=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(p,{...i,...r,ref:t})});j.displayName=A;var M=`AlertDialogContent`,[N,P]=C(M),F=s(`AlertDialogContent`),I=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,o=w(n),s=b.useRef(null),c=a(t,s),l=b.useRef(null);return(0,x.jsx)(m,{contentName:M,titleName:L,docsSlug:`alert-dialog`,children:(0,x.jsx)(N,{scope:n,cancelRef:l,children:(0,x.jsxs)(h,{role:`alertdialog`,...o,...i,ref:c,onOpenAutoFocus:u(i.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,x.jsx)(F,{children:r}),(0,x.jsx)(G,{contentRef:s})]})})})});I.displayName=M;var L=`AlertDialogTitle`,R=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(ee,{...i,...r,ref:t})});R.displayName=L;var z=`AlertDialogDescription`,B=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(_,{...i,...r,ref:t})});B.displayName=z;var V=`AlertDialogAction`,H=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(v,{...i,...r,ref:t})});H.displayName=V;var U=`AlertDialogCancel`,W=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=P(U,n),o=w(n),s=a(t,i);return(0,x.jsx)(v,{...o,...r,ref:s})});W.displayName=U;var G=({contentRef:e})=>{let t=`\`${M}\` requires a description for the component to be accessible for screen reader users.
|
||||
import{$d as e,Qd as t,af as n,cf as r,if as i}from"./messages-BSgosaSa.js";import{d as a,i as o,l as s,t as c}from"./button-gsP5wmrs.js";import{a as l,r as u}from"./dist-BX7-FFVx.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as ee,t as v,u as y}from"./dist-C-eeUszQ.js";var b=r(n(),1),x=i(),S=`AlertDialog`,[C,te]=l(S,[y]),w=y(),T=e=>{let{__scopeAlertDialog:t,...n}=e,r=w(t);return(0,x.jsx)(g,{...r,...n,modal:!0})};T.displayName=S;var E=`AlertDialogTrigger`,D=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(f,{...i,...r,ref:t})});D.displayName=E;var O=`AlertDialogPortal`,k=e=>{let{__scopeAlertDialog:t,...n}=e,r=w(t);return(0,x.jsx)(d,{...r,...n})};k.displayName=O;var A=`AlertDialogOverlay`,j=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(p,{...i,...r,ref:t})});j.displayName=A;var M=`AlertDialogContent`,[N,P]=C(M),F=s(`AlertDialogContent`),I=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,o=w(n),s=b.useRef(null),c=a(t,s),l=b.useRef(null);return(0,x.jsx)(m,{contentName:M,titleName:L,docsSlug:`alert-dialog`,children:(0,x.jsx)(N,{scope:n,cancelRef:l,children:(0,x.jsxs)(h,{role:`alertdialog`,...o,...i,ref:c,onOpenAutoFocus:u(i.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,x.jsx)(F,{children:r}),(0,x.jsx)(G,{contentRef:s})]})})})});I.displayName=M;var L=`AlertDialogTitle`,R=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(ee,{...i,...r,ref:t})});R.displayName=L;var z=`AlertDialogDescription`,B=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(_,{...i,...r,ref:t})});B.displayName=z;var V=`AlertDialogAction`,H=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=w(n);return(0,x.jsx)(v,{...i,...r,ref:t})});H.displayName=V;var U=`AlertDialogCancel`,W=b.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=P(U,n),o=w(n),s=a(t,i);return(0,x.jsx)(v,{...o,...r,ref:s})});W.displayName=U;var G=({contentRef:e})=>{let t=`\`${M}\` requires a description for the component to be accessible for screen reader users.
|
||||
|
||||
You can add a description to the \`${M}\` by passing a \`${z}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]);export{t};
|
||||
@@ -1 +0,0 @@
|
||||
import{rf as e}from"./messages-BvSF842O.js";import{t}from"./createLucideIcon-BGQWeu8F.js";var n=t(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),r=e(((e,t)=>{t.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case`INPUT`:case`TEXTAREA`:t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type===`Caret`&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}}})),i=e(((e,t)=>{var n=r(),i={"text/plain":`Text`,"text/html":`Url`,default:`Text`},a=`Copy to clipboard: #{key}, Enter`;function o(e){var t=(/mac os x/i.test(navigator.userAgent)?`⌘`:`Ctrl`)+`+C`;return e.replace(/#{\s*key\s*}/g,t)}function s(e,t){var r,s,c,l,u,d,f=!1;t||={},r=t.debug||!1;try{if(c=n(),l=document.createRange(),u=document.getSelection(),d=document.createElement(`span`),d.textContent=e,d.ariaHidden=`true`,d.style.all=`unset`,d.style.position=`fixed`,d.style.top=0,d.style.clip=`rect(0, 0, 0, 0)`,d.style.whiteSpace=`pre`,d.style.webkitUserSelect=`text`,d.style.MozUserSelect=`text`,d.style.msUserSelect=`text`,d.style.userSelect=`text`,d.addEventListener(`copy`,function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),n.clipboardData===void 0){r&&console.warn(`unable to use e.clipboardData`),r&&console.warn(`trying IE specific stuff`),window.clipboardData.clearData();var a=i[t.format]||i.default;window.clipboardData.setData(a,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(d),l.selectNodeContents(d),u.addRange(l),!document.execCommand(`copy`))throw Error(`copy command was unsuccessful`);f=!0}catch(n){r&&console.error(`unable to copy using execCommand: `,n),r&&console.warn(`trying IE specific stuff`);try{window.clipboardData.setData(t.format||`text`,e),t.onCopy&&t.onCopy(window.clipboardData),f=!0}catch(n){r&&console.error(`unable to copy using clipboardData: `,n),r&&console.error(`falling back to prompt`),s=o(`message`in t?t.message:a),window.prompt(s,e)}}finally{u&&(typeof u.removeRange==`function`?u.removeRange(l):u.removeAllRanges()),d&&document.body.removeChild(d),c()}return f}t.exports=s}));export{n,i as t};
|
||||
@@ -0,0 +1 @@
|
||||
import{of as e}from"./messages-BSgosaSa.js";var t=e(((e,t)=>{t.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case`INPUT`:case`TEXTAREA`:t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type===`Caret`&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}}})),n=e(((e,n)=>{var r=t(),i={"text/plain":`Text`,"text/html":`Url`,default:`Text`},a=`Copy to clipboard: #{key}, Enter`;function o(e){var t=(/mac os x/i.test(navigator.userAgent)?`⌘`:`Ctrl`)+`+C`;return e.replace(/#{\s*key\s*}/g,t)}function s(e,t){var n,s,c,l,u,d,f=!1;t||={},n=t.debug||!1;try{if(c=r(),l=document.createRange(),u=document.getSelection(),d=document.createElement(`span`),d.textContent=e,d.ariaHidden=`true`,d.style.all=`unset`,d.style.position=`fixed`,d.style.top=0,d.style.clip=`rect(0, 0, 0, 0)`,d.style.whiteSpace=`pre`,d.style.webkitUserSelect=`text`,d.style.MozUserSelect=`text`,d.style.msUserSelect=`text`,d.style.userSelect=`text`,d.addEventListener(`copy`,function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),r.clipboardData===void 0){n&&console.warn(`unable to use e.clipboardData`),n&&console.warn(`trying IE specific stuff`),window.clipboardData.clearData();var a=i[t.format]||i.default;window.clipboardData.setData(a,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))}),document.body.appendChild(d),l.selectNodeContents(d),u.addRange(l),!document.execCommand(`copy`))throw Error(`copy command was unsuccessful`);f=!0}catch(r){n&&console.error(`unable to copy using execCommand: `,r),n&&console.warn(`trying IE specific stuff`);try{window.clipboardData.setData(t.format||`text`,e),t.onCopy&&t.onCopy(window.clipboardData),f=!0}catch(r){n&&console.error(`unable to copy using clipboardData: `,r),n&&console.error(`falling back to prompt`),s=o(`message`in t?t.message:a),window.prompt(s,e)}}finally{u&&(typeof u.removeRange==`function`?u.removeRange(l):u.removeAllRanges()),d&&document.body.removeChild(d),c()}return f}n.exports=s}));export{n as t};
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{af as e,nf as t}from"./messages-BvSF842O.js";var n=e(t()),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),o=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},s={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`},c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(0,n.createContext)({}),u=()=>(0,n.useContext)(l),d=(0,n.forwardRef)(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:a,className:o=``,children:l,iconNode:d,...f},p)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,color:_=`currentColor`,className:v=``}=u()??{},y=a??g?Number(i??h)*24/Number(t??m):i??h;return(0,n.createElement)(`svg`,{ref:p,...s,width:t??m??s.width,height:t??m??s.height,stroke:e??_,strokeWidth:y,className:r(`lucide`,v,o),...!l&&!c(f)&&{"aria-hidden":`true`},...f},[...d.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])}),f=(e,t)=>{let a=(0,n.forwardRef)(({className:a,...s},c)=>(0,n.createElement)(d,{ref:c,iconNode:t,className:r(`lucide-${i(o(e))}`,`lucide-${e}`,a),...s}));return a.displayName=o(e),a};export{f as t};
|
||||
import{af as e,cf as t}from"./messages-BSgosaSa.js";var n=t(e()),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),o=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},s={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`},c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(0,n.createContext)({}),u=()=>(0,n.useContext)(l),d=(0,n.forwardRef)(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:a,className:o=``,children:l,iconNode:d,...f},p)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,color:_=`currentColor`,className:v=``}=u()??{},y=a??g?Number(i??h)*24/Number(t??m):i??h;return(0,n.createElement)(`svg`,{ref:p,...s,width:t??m??s.width,height:t??m??s.height,stroke:e??_,strokeWidth:y,className:r(`lucide`,v,o),...!l&&!c(f)&&{"aria-hidden":`true`},...f},[...d.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])}),f=(e,t)=>{let a=(0,n.forwardRef)(({className:a,...s},c)=>(0,n.createElement)(d,{ref:c,iconNode:t,className:r(`lucide-${i(o(e))}`,`lucide-${e}`,a),...s}));return a.displayName=o(e),a};export{f as t};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{$t as e,Jt as t,Qt as n,Xt as r,Yt as i,Zt as a,en as o,in as s,nn as c,qt as l,rn as u,tf as d,tn as f}from"./messages-BvSF842O.js";import{t as p}from"./button-D5xmeb32.js";import{t as m}from"./checkbox-DH45pekP.js";import{c as h,i as g,s as _}from"./zod-ClGKjEyB.js";import{a as v,c as y,i as b,l as x,n as S,o as C,r as w,s as T,t as E}from"./form-iIuz3zSX.js";import{t as D}from"./page-header-D58MnYJU.js";import{t as O}from"./show-submitted-data-Bl1Wpk1q.js";var k=d(),A=[{id:`recents`,label:c()},{id:`home`,label:f()},{id:`applications`,label:o()},{id:`desktop`,label:e()},{id:`downloads`,label:n()},{id:`documents`,label:a()}],j=_({items:g(h()).refine(e=>e.some(e=>e),{message:r()})}),M={items:[`recents`,`home`]};function N(){let e=x({resolver:y(j),defaultValues:M});return(0,k.jsx)(E,{...e,children:(0,k.jsxs)(`form`,{className:`space-y-8`,onSubmit:e.handleSubmit(e=>O(e)),children:[(0,k.jsx)(b,{control:e.control,name:`items`,render:()=>(0,k.jsxs)(v,{children:[(0,k.jsxs)(`div`,{className:`mb-4`,children:[(0,k.jsx)(C,{className:`text-base`,children:i()}),(0,k.jsx)(w,{children:t()})]}),A.map(t=>(0,k.jsx)(b,{control:e.control,name:`items`,render:({field:e})=>(0,k.jsxs)(v,{className:`flex flex-row items-start`,children:[(0,k.jsx)(S,{children:(0,k.jsx)(m,{checked:e.value?.includes(t.id),onCheckedChange:n=>n?e.onChange([...e.value,t.id]):e.onChange(e.value?.filter(e=>e!==t.id))})}),(0,k.jsx)(C,{className:`font-normal`,children:t.label})]},t.id)},t.id)),(0,k.jsx)(T,{})]})}),(0,k.jsx)(p,{type:`submit`,children:l()})]})})}function P(){return(0,k.jsx)(D,{description:u(),title:s(),variant:`section`,children:(0,k.jsx)(N,{})})}var F=P;export{F as component};
|
||||
import{$t as e,Jt as t,Qt as n,Xt as r,Yt as i,Zt as a,en as o,if as s,in as c,nn as l,qt as u,rn as d,tn as f}from"./messages-BSgosaSa.js";import{t as p}from"./button-gsP5wmrs.js";import{t as m}from"./checkbox-CurizX_C.js";import{c as h,i as g,s as _}from"./zod-Cmg_v3kW.js";import{a as v,c as y,i as b,l as x,n as S,o as C,r as w,s as T,t as E}from"./form-s9C7GZ5q.js";import{t as D}from"./page-header-lpyPiG0-.js";import{t as O}from"./show-submitted-data-CczCj3vK.js";var k=s(),A=[{id:`recents`,label:l()},{id:`home`,label:f()},{id:`applications`,label:o()},{id:`desktop`,label:e()},{id:`downloads`,label:n()},{id:`documents`,label:a()}],j=_({items:g(h()).refine(e=>e.some(e=>e),{message:r()})}),M={items:[`recents`,`home`]};function N(){let e=x({resolver:y(j),defaultValues:M});return(0,k.jsx)(E,{...e,children:(0,k.jsxs)(`form`,{className:`space-y-8`,onSubmit:e.handleSubmit(e=>O(e)),children:[(0,k.jsx)(b,{control:e.control,name:`items`,render:()=>(0,k.jsxs)(v,{children:[(0,k.jsxs)(`div`,{className:`mb-4`,children:[(0,k.jsx)(C,{className:`text-base`,children:i()}),(0,k.jsx)(w,{children:t()})]}),A.map(t=>(0,k.jsx)(b,{control:e.control,name:`items`,render:({field:e})=>(0,k.jsxs)(v,{className:`flex flex-row items-start`,children:[(0,k.jsx)(S,{children:(0,k.jsx)(m,{checked:e.value?.includes(t.id),onCheckedChange:n=>n?e.onChange([...e.value,t.id]):e.onChange(e.value?.filter(e=>e!==t.id))})}),(0,k.jsx)(C,{className:`font-normal`,children:t.label})]},t.id)},t.id)),(0,k.jsx)(T,{})]})}),(0,k.jsx)(p,{type:`submit`,children:u()})]})})}function P(){return(0,k.jsx)(D,{description:d(),title:c(),variant:`section`,children:(0,k.jsx)(N,{})})}var F=P;export{F as component};
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";import{n as r,r as i,t as a}from"./dist-BPr298C3.js";import{d as o}from"./button-D5xmeb32.js";import{n as s,r as c}from"./dist-gwfT6Lh0.js";import{t as l}from"./dist-BbslaEHP.js";var u=e(t(),1);function d(e,t=globalThis?.document){let n=l(e);u.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var f=n(),p=`DismissableLayer`,m=`dismissableLayer.update`,h=`dismissableLayer.pointerDownOutside`,g=`dismissableLayer.focusOutside`,_,v=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),y=u.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:p,...h}=e,g=u.useContext(v),[y,b]=u.useState(null),x=y?.ownerDocument??globalThis?.document,[,T]=u.useState({}),E=o(t,e=>b(e)),D=Array.from(g.layers),[O]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),k=D.indexOf(O),A=y?D.indexOf(y):-1,j=g.layersWithOutsidePointerEventsDisabled.size>0,M=A>=k,N=S(e=>{let t=e.target,n=[...g.branches].some(e=>e.contains(t));!M||n||(i?.(e),l?.(e),e.defaultPrevented||p?.())},x),P=C(e=>{let t=e.target;[...g.branches].some(e=>e.contains(t))||(s?.(e),l?.(e),e.defaultPrevented||p?.())},x);return d(e=>{A===g.layers.size-1&&(r?.(e),!e.defaultPrevented&&p&&(e.preventDefault(),p()))},x),u.useEffect(()=>{if(y)return n&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(_=x.body.style.pointerEvents,x.body.style.pointerEvents=`none`),g.layersWithOutsidePointerEventsDisabled.add(y)),g.layers.add(y),w(),()=>{n&&g.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=_)}},[y,x,n,g]),u.useEffect(()=>()=>{y&&(g.layers.delete(y),g.layersWithOutsidePointerEventsDisabled.delete(y),w())},[y,g]),u.useEffect(()=>{let e=()=>T({});return document.addEventListener(m,e),()=>document.removeEventListener(m,e)},[]),(0,f.jsx)(a.div,{...h,ref:E,style:{pointerEvents:j?M?`auto`:`none`:void 0,...e.style},onFocusCapture:c(e.onFocusCapture,P.onFocusCapture),onBlurCapture:c(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:c(e.onPointerDownCapture,N.onPointerDownCapture)})});y.displayName=p;var b=`DismissableLayerBranch`,x=u.forwardRef((e,t)=>{let n=u.useContext(v),r=u.useRef(null),i=o(t,r);return u.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,f.jsx)(a.div,{...e,ref:i})});x.displayName=b;function S(e,t=globalThis?.document){let n=l(e),r=u.useRef(!1),i=u.useRef(()=>{});return u.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){T(h,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function C(e,t=globalThis?.document){let n=l(e),r=u.useRef(!1);return u.useEffect(()=>{let e=e=>{e.target&&!r.current&&T(g,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function w(){let e=new CustomEvent(m);document.dispatchEvent(e)}function T(e,t,n,{discrete:i}){let a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),i?r(a,o):a.dispatchEvent(o)}var E=e(i(),1),D=`Portal`,O=u.forwardRef((e,t)=>{let{container:n,...r}=e,[i,o]=u.useState(!1);s(()=>o(!0),[]);let c=n||i&&globalThis?.document?.body;return c?E.createPortal((0,f.jsx)(a.div,{...r,ref:t}),c):null});O.displayName=D;export{y as n,O as t};
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{n as r,r as i,t as a}from"./dist-fWONwgan.js";import{d as o}from"./button-gsP5wmrs.js";import{n as s,r as c}from"./dist-BX7-FFVx.js";import{t as l}from"./dist-C3yztW6j.js";var u=t(e(),1);function d(e,t=globalThis?.document){let n=l(e);u.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var f=n(),p=`DismissableLayer`,m=`dismissableLayer.update`,h=`dismissableLayer.pointerDownOutside`,g=`dismissableLayer.focusOutside`,_,v=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),y=u.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:p,...h}=e,g=u.useContext(v),[y,b]=u.useState(null),x=y?.ownerDocument??globalThis?.document,[,T]=u.useState({}),E=o(t,e=>b(e)),D=Array.from(g.layers),[O]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),k=D.indexOf(O),A=y?D.indexOf(y):-1,j=g.layersWithOutsidePointerEventsDisabled.size>0,M=A>=k,N=S(e=>{let t=e.target,n=[...g.branches].some(e=>e.contains(t));!M||n||(i?.(e),l?.(e),e.defaultPrevented||p?.())},x),P=C(e=>{let t=e.target;[...g.branches].some(e=>e.contains(t))||(s?.(e),l?.(e),e.defaultPrevented||p?.())},x);return d(e=>{A===g.layers.size-1&&(r?.(e),!e.defaultPrevented&&p&&(e.preventDefault(),p()))},x),u.useEffect(()=>{if(y)return n&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(_=x.body.style.pointerEvents,x.body.style.pointerEvents=`none`),g.layersWithOutsidePointerEventsDisabled.add(y)),g.layers.add(y),w(),()=>{n&&g.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=_)}},[y,x,n,g]),u.useEffect(()=>()=>{y&&(g.layers.delete(y),g.layersWithOutsidePointerEventsDisabled.delete(y),w())},[y,g]),u.useEffect(()=>{let e=()=>T({});return document.addEventListener(m,e),()=>document.removeEventListener(m,e)},[]),(0,f.jsx)(a.div,{...h,ref:E,style:{pointerEvents:j?M?`auto`:`none`:void 0,...e.style},onFocusCapture:c(e.onFocusCapture,P.onFocusCapture),onBlurCapture:c(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:c(e.onPointerDownCapture,N.onPointerDownCapture)})});y.displayName=p;var b=`DismissableLayerBranch`,x=u.forwardRef((e,t)=>{let n=u.useContext(v),r=u.useRef(null),i=o(t,r);return u.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,f.jsx)(a.div,{...e,ref:i})});x.displayName=b;function S(e,t=globalThis?.document){let n=l(e),r=u.useRef(!1),i=u.useRef(()=>{});return u.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){T(h,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function C(e,t=globalThis?.document){let n=l(e),r=u.useRef(!1);return u.useEffect(()=>{let e=e=>{e.target&&!r.current&&T(g,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function w(){let e=new CustomEvent(m);document.dispatchEvent(e)}function T(e,t,n,{discrete:i}){let a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),i?r(a,o):a.dispatchEvent(o)}var E=t(i(),1),D=`Portal`,O=u.forwardRef((e,t)=>{let{container:n,...r}=e,[i,o]=u.useState(!1);s(()=>o(!0),[]);let c=n||i&&globalThis?.document?.body;return c?E.createPortal((0,f.jsx)(a.div,{...r,ref:t}),c):null});O.displayName=D;export{y as n,O as t};
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t}from"./messages-BvSF842O.js";import{n}from"./dist-gwfT6Lh0.js";var r=e(t(),1);function i(e){let[t,i]=r.useState(void 0);return n(()=>{if(e){i({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n=t[0],r,a;if(`borderBoxSize`in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,a=t.blockSize}else r=e.offsetWidth,a=e.offsetHeight;i({width:r,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else i(void 0)},[e]),t}export{i as t};
|
||||
import{af as e,cf as t}from"./messages-BSgosaSa.js";import{n}from"./dist-BX7-FFVx.js";var r=t(e(),1);function i(e){let[t,i]=r.useState(void 0);return n(()=>{if(e){i({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n=t[0],r,a;if(`borderBoxSize`in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,a=t.blockSize}else r=e.offsetWidth,a=e.offsetHeight;i({width:r,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else i(void 0)},[e]),t}export{i as t};
|
||||
@@ -0,0 +1 @@
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{c as r,d as i}from"./button-gsP5wmrs.js";import{a}from"./dist-BX7-FFVx.js";var o=t(e(),1),s=n();function c(e){let t=e+`CollectionProvider`,[n,c]=a(t),[l,u]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=e=>{let{scope:t,children:n}=e,r=o.useRef(null),i=o.useRef(new Map).current;return(0,s.jsx)(l,{scope:t,itemMap:i,collectionRef:r,children:n})};d.displayName=t;let f=e+`CollectionSlot`,p=r(f),m=o.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,s.jsx)(p,{ref:i(t,u(f,n).collectionRef),children:r})});m.displayName=f;let h=e+`CollectionItemSlot`,g=`data-radix-collection-item`,_=r(h),v=o.forwardRef((e,t)=>{let{scope:n,children:r,...a}=e,c=o.useRef(null),l=i(t,c),d=u(h,n);return o.useEffect(()=>(d.itemMap.set(c,{ref:c,...a}),()=>void d.itemMap.delete(c))),(0,s.jsx)(_,{[g]:``,ref:l,children:r})});v.displayName=h;function y(t){let n=u(e+`CollectionConsumer`,t);return o.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:d,Slot:m,ItemSlot:v},y,c]}export{c as t};
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t}from"./messages-BvSF842O.js";var n=e(t(),1);function r(e){let t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}export{r as t};
|
||||
import{af as e,cf as t}from"./messages-BSgosaSa.js";var n=t(e(),1);function r(e){let t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}export{r as t};
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";var r=e(t(),1),i=n();function a(e,t){let n=r.createContext(t),a=e=>{let{children:t,...a}=e,o=r.useMemo(()=>a,Object.values(a));return(0,i.jsx)(n.Provider,{value:o,children:t})};a.displayName=e+`Provider`;function o(i){let a=r.useContext(n);if(a)return a;if(t!==void 0)return t;throw Error(`\`${i}\` must be used within \`${e}\``)}return[a,o]}function o(e,t=[]){let n=[];function a(t,a){let o=r.createContext(a),s=n.length;n=[...n,a];let c=t=>{let{scope:n,children:a,...c}=t,l=n?.[e]?.[s]||o,u=r.useMemo(()=>c,Object.values(c));return(0,i.jsx)(l.Provider,{value:u,children:a})};c.displayName=t+`Provider`;function l(n,i){let c=i?.[e]?.[s]||o,l=r.useContext(c);if(l)return l;if(a!==void 0)return a;throw Error(`\`${n}\` must be used within \`${t}\``)}return[c,l]}let o=()=>{let t=n.map(e=>r.createContext(e));return function(n){let i=n?.[e]||t;return r.useMemo(()=>({[`__scope${e}`]:{...n,[e]:i}}),[n,i])}};return o.scopeName=e,[a,s(o,...t)]}function s(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let i=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return r.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function c(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var l=globalThis?.document?r.useLayoutEffect:()=>{},u=r.useInsertionEffect||l;function d({prop:e,defaultProp:t,onChange:n=()=>{},caller:i}){let[a,o,s]=f({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:a;{let t=r.useRef(e!==void 0);r.useEffect(()=>{let e=t.current;e!==c&&console.warn(`${i} is changing from ${e?`controlled`:`uncontrolled`} to ${c?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=c},[c,i])}return[l,r.useCallback(t=>{if(c){let n=p(t)?t(e):t;n!==e&&s.current?.(n)}else o(t)},[c,e,o,s])]}function f({defaultProp:e,onChange:t}){let[n,i]=r.useState(e),a=r.useRef(n),o=r.useRef(t);return u(()=>{o.current=t},[t]),r.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,i,o]}function p(e){return typeof e==`function`}export{o as a,a as i,l as n,c as r,d as t};
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";var r=t(e(),1),i=n();function a(e,t){let n=r.createContext(t),a=e=>{let{children:t,...a}=e,o=r.useMemo(()=>a,Object.values(a));return(0,i.jsx)(n.Provider,{value:o,children:t})};a.displayName=e+`Provider`;function o(i){let a=r.useContext(n);if(a)return a;if(t!==void 0)return t;throw Error(`\`${i}\` must be used within \`${e}\``)}return[a,o]}function o(e,t=[]){let n=[];function a(t,a){let o=r.createContext(a),s=n.length;n=[...n,a];let c=t=>{let{scope:n,children:a,...c}=t,l=n?.[e]?.[s]||o,u=r.useMemo(()=>c,Object.values(c));return(0,i.jsx)(l.Provider,{value:u,children:a})};c.displayName=t+`Provider`;function l(n,i){let c=i?.[e]?.[s]||o,l=r.useContext(c);if(l)return l;if(a!==void 0)return a;throw Error(`\`${n}\` must be used within \`${t}\``)}return[c,l]}let o=()=>{let t=n.map(e=>r.createContext(e));return function(n){let i=n?.[e]||t;return r.useMemo(()=>({[`__scope${e}`]:{...n,[e]:i}}),[n,i])}};return o.scopeName=e,[a,s(o,...t)]}function s(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let i=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return r.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function c(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var l=globalThis?.document?r.useLayoutEffect:()=>{},u=r.useInsertionEffect||l;function d({prop:e,defaultProp:t,onChange:n=()=>{},caller:i}){let[a,o,s]=f({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:a;{let t=r.useRef(e!==void 0);r.useEffect(()=>{let e=t.current;e!==c&&console.warn(`${i} is changing from ${e?`controlled`:`uncontrolled`} to ${c?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=c},[c,i])}return[l,r.useCallback(t=>{if(c){let n=p(t)?t(e):t;n!==e&&s.current?.(n)}else o(t)},[c,e,o,s])]}function f({defaultProp:e,onChange:t}){let[n,i]=r.useState(e),a=r.useRef(n),o=r.useRef(t);return u(()=>{o.current=t},[t]),r.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,i,o]}function p(e){return typeof e==`function`}export{o as a,a as i,l as n,c as r,d as t};
|
||||
@@ -1,4 +1,4 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";import{t as r}from"./dist-BPr298C3.js";import{c as i,d as a}from"./button-D5xmeb32.js";import{a as o,i as s,r as c,t as l}from"./dist-gwfT6Lh0.js";import{t as u}from"./dist-BJxEqcEF.js";import{n as d}from"./dist-BbslaEHP.js";import{n as f,t as p}from"./dist-CCJTittj.js";import{i as m,n as h,r as g,t as _}from"./es2015-DJhPRjvM.js";var v=e(t(),1),y=n(),b=`Dialog`,[x,S]=o(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[u,f]=l({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:s,contentRef:c,contentId:d(),titleId:d(),descriptionId:d(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=w(E,n),s=a(t,o.triggerRef);return(0,y.jsx)(r.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":o.open,"aria-controls":o.contentId,"data-state":q(o.open),...i,ref:s,onClick:c(e.onClick,o.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(u,{present:n||a.open,children:(0,y.jsx)(p,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(u,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=i(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(M,n);return(0,y.jsx)(h,{as:P,allowPinchZoom:!0,shards:[a.contentRef],children:(0,y.jsx)(r.div,{"data-state":q(a.open),...i,ref:t,style:{pointerEvents:`auto`,...i.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(u,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(null),i=a(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return _(e)},[]),(0,y.jsx)(B,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:c(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:c(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,c=w(I,n),l=v.useRef(null),u=a(t,l);return g(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(m,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:(0,y.jsx)(f,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":q(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Z,{titleId:c.titleId}),(0,y.jsx)($,{contentRef:l,descriptionId:c.descriptionId})]})]})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(V,n);return(0,y.jsx)(r.h2,{id:a.titleId,...i,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(U,n);return(0,y.jsx)(r.p,{id:a.descriptionId,...i,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(G,n);return(0,y.jsx)(r.button,{type:`button`,...i,ref:t,onClick:c(e.onClick,()=>a.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}var J=`DialogTitleWarning`,[Y,X]=s(J,{contentName:I,titleName:V,docsSlug:`dialog`}),Z=({titleId:e})=>{let t=X(J),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{t as r}from"./dist-fWONwgan.js";import{c as i,d as a}from"./button-gsP5wmrs.js";import{a as o,i as s,r as c,t as l}from"./dist-BX7-FFVx.js";import{t as u}from"./dist-CnRb3IO0.js";import{n as d}from"./dist-C3yztW6j.js";import{n as f,t as p}from"./dist-2NlRabHs.js";import{i as m,n as h,r as g,t as _}from"./es2015-BoIOHfI5.js";var v=t(e(),1),y=n(),b=`Dialog`,[x,S]=o(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[u,f]=l({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:s,contentRef:c,contentId:d(),titleId:d(),descriptionId:d(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=w(E,n),s=a(t,o.triggerRef);return(0,y.jsx)(r.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":o.open,"aria-controls":o.contentId,"data-state":q(o.open),...i,ref:s,onClick:c(e.onClick,o.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(u,{present:n||a.open,children:(0,y.jsx)(p,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(u,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=i(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(M,n);return(0,y.jsx)(h,{as:P,allowPinchZoom:!0,shards:[a.contentRef],children:(0,y.jsx)(r.div,{"data-state":q(a.open),...i,ref:t,style:{pointerEvents:`auto`,...i.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(u,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(null),i=a(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return _(e)},[]),(0,y.jsx)(B,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:c(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:c(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,c=w(I,n),l=v.useRef(null),u=a(t,l);return g(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(m,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:(0,y.jsx)(f,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":q(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Z,{titleId:c.titleId}),(0,y.jsx)($,{contentRef:l,descriptionId:c.descriptionId})]})]})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(V,n);return(0,y.jsx)(r.h2,{id:a.titleId,...i,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(U,n);return(0,y.jsx)(r.p,{id:a.descriptionId,...i,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(G,n);return(0,y.jsx)(r.button,{type:`button`,...i,ref:t,onClick:c(e.onClick,()=>a.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}var J=`DialogTitleWarning`,[Y,X]=s(J,{contentName:I,titleName:V,docsSlug:`dialog`}),Z=({titleId:e})=>{let t=X(J),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
||||
|
||||
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||||
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";import{t as r}from"./dist-BPr298C3.js";var i=e(t(),1),a=n(),o=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),s=`VisuallyHidden`,c=i.forwardRef((e,t)=>(0,a.jsx)(r.span,{...e,ref:t,style:{...o,...e.style}}));c.displayName=s;var l=c;export{o as n,l as t};
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{t as r}from"./dist-fWONwgan.js";var i=t(e(),1),a=n(),o=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),s=`VisuallyHidden`,c=i.forwardRef((e,t)=>(0,a.jsx)(r.span,{...e,ref:t,style:{...o,...e.style}}));c.displayName=s;var l=c;export{o as n,l as t};
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t}from"./messages-BvSF842O.js";import{n}from"./dist-gwfT6Lh0.js";var r=e(t(),1),i=r.useId||(()=>void 0),a=0;function o(e){let[t,o]=r.useState(i());return n(()=>{e||o(e=>e??String(a++))},[e]),e||(t?`radix-${t}`:``)}function s(e){let t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>(...e)=>t.current?.(...e),[])}export{o as n,s as t};
|
||||
import{af as e,cf as t}from"./messages-BSgosaSa.js";import{n}from"./dist-BX7-FFVx.js";var r=t(e(),1),i=r.useId||(()=>void 0),a=0;function o(e){let[t,o]=r.useState(i());return n(()=>{e||o(e=>e??String(a++))},[e]),e||(t?`radix-${t}`:``)}function s(e){let t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>(...e)=>t.current?.(...e),[])}export{o as n,s as t};
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{af as e,nf as t}from"./messages-BvSF842O.js";import{d as n}from"./button-D5xmeb32.js";import{n as r}from"./dist-gwfT6Lh0.js";var i=e(t(),1);function a(e,t){return i.useReducer((e,n)=>t[e][n]??e,e)}var o=e=>{let{present:t,children:r}=e,a=s(t),o=typeof r==`function`?r({present:a.isPresent}):i.Children.only(r),c=n(a.ref,l(o));return typeof r==`function`||a.isPresent?i.cloneElement(o,{ref:c}):null};o.displayName=`Presence`;function s(e){let[t,n]=i.useState(),o=i.useRef(null),s=i.useRef(e),l=i.useRef(`none`),[u,d]=a(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return i.useEffect(()=>{let e=c(o.current);l.current=u===`mounted`?e:`none`},[u]),r(()=>{let t=o.current,n=s.current;if(n!==e){let r=l.current,i=c(t);e?d(`MOUNT`):i===`none`||t?.display===`none`?d(`UNMOUNT`):d(n&&r!==i?`ANIMATION_OUT`:`UNMOUNT`),s.current=e}},[e,d]),r(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,r=r=>{let i=c(o.current).includes(CSS.escape(r.animationName));if(r.target===t&&i&&(d(`ANIMATION_END`),!s.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},i=e=>{e.target===t&&(l.current=c(o.current))};return t.addEventListener(`animationstart`,i),t.addEventListener(`animationcancel`,r),t.addEventListener(`animationend`,r),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,i),t.removeEventListener(`animationcancel`,r),t.removeEventListener(`animationend`,r)}}else d(`ANIMATION_END`)},[t,d]),{isPresent:[`mounted`,`unmountSuspended`].includes(u),ref:i.useCallback(e=>{o.current=e?getComputedStyle(e):null,n(e)},[])}}function c(e){return e?.animationName||`none`}function l(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}export{o as t};
|
||||
import{af as e,cf as t}from"./messages-BSgosaSa.js";import{d as n}from"./button-gsP5wmrs.js";import{n as r}from"./dist-BX7-FFVx.js";var i=t(e(),1);function a(e,t){return i.useReducer((e,n)=>t[e][n]??e,e)}var o=e=>{let{present:t,children:r}=e,a=s(t),o=typeof r==`function`?r({present:a.isPresent}):i.Children.only(r),c=n(a.ref,l(o));return typeof r==`function`||a.isPresent?i.cloneElement(o,{ref:c}):null};o.displayName=`Presence`;function s(e){let[t,n]=i.useState(),o=i.useRef(null),s=i.useRef(e),l=i.useRef(`none`),[u,d]=a(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return i.useEffect(()=>{let e=c(o.current);l.current=u===`mounted`?e:`none`},[u]),r(()=>{let t=o.current,n=s.current;if(n!==e){let r=l.current,i=c(t);e?d(`MOUNT`):i===`none`||t?.display===`none`?d(`UNMOUNT`):d(n&&r!==i?`ANIMATION_OUT`:`UNMOUNT`),s.current=e}},[e,d]),r(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,r=r=>{let i=c(o.current).includes(CSS.escape(r.animationName));if(r.target===t&&i&&(d(`ANIMATION_END`),!s.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},i=e=>{e.target===t&&(l.current=c(o.current))};return t.addEventListener(`animationstart`,i),t.addEventListener(`animationcancel`,r),t.addEventListener(`animationend`,r),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,i),t.removeEventListener(`animationcancel`,r),t.removeEventListener(`animationend`,r)}}else d(`ANIMATION_END`)},[t,d]),{isPresent:[`mounted`,`unmountSuspended`].includes(u),ref:i.useCallback(e=>{o.current=e?getComputedStyle(e):null,n(e)},[])}}function c(e){return e?.animationName||`none`}function l(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}export{o as t};
|
||||
@@ -1 +0,0 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";import{t as r}from"./dist-BPr298C3.js";import{c as i,d as a}from"./button-D5xmeb32.js";import{a as o,r as s,t as c}from"./dist-gwfT6Lh0.js";import{n as l,t as u}from"./dist-BbslaEHP.js";import{n as d}from"./dist-ibg4sB6V.js";var f=e(t(),1),p=n();function m(e){let t=e+`CollectionProvider`,[n,r]=o(t),[s,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=e=>{let{scope:t,children:n}=e,r=f.useRef(null),i=f.useRef(new Map).current;return(0,p.jsx)(s,{scope:t,itemMap:i,collectionRef:r,children:n})};l.displayName=t;let u=e+`CollectionSlot`,d=i(u),m=f.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,p.jsx)(d,{ref:a(t,c(u,n).collectionRef),children:r})});m.displayName=u;let h=e+`CollectionItemSlot`,g=`data-radix-collection-item`,_=i(h),v=f.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=f.useRef(null),s=a(t,o),l=c(h,n);return f.useEffect(()=>(l.itemMap.set(o,{ref:o,...i}),()=>void l.itemMap.delete(o))),(0,p.jsx)(_,{[g]:``,ref:s,children:r})});v.displayName=h;function y(t){let n=c(e+`CollectionConsumer`,t);return f.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:l,Slot:m,ItemSlot:v},y,r]}var h=`rovingFocusGroup.onEntryFocus`,g={bubbles:!1,cancelable:!0},_=`RovingFocusGroup`,[v,y,b]=m(_),[x,S]=o(_,[b]),[C,w]=x(_),T=f.forwardRef((e,t)=>(0,p.jsx)(v.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(v.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(E,{...e,ref:t})})}));T.displayName=_;var E=f.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:i,loop:o=!1,dir:l,currentTabStopId:m,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:b,onEntryFocus:x,preventScrollOnEntryFocus:S=!1,...w}=e,T=f.useRef(null),E=a(t,T),D=d(l),[O,k]=c({prop:m,defaultProp:v??null,onChange:b,caller:_}),[A,j]=f.useState(!1),N=u(x),P=y(n),F=f.useRef(!1),[I,L]=f.useState(0);return f.useEffect(()=>{let e=T.current;if(e)return e.addEventListener(h,N),()=>e.removeEventListener(h,N)},[N]),(0,p.jsx)(C,{scope:n,orientation:i,dir:D,loop:o,currentTabStopId:O,onItemFocus:f.useCallback(e=>k(e),[k]),onItemShiftTab:f.useCallback(()=>j(!0),[]),onFocusableItemAdd:f.useCallback(()=>L(e=>e+1),[]),onFocusableItemRemove:f.useCallback(()=>L(e=>e-1),[]),children:(0,p.jsx)(r.div,{tabIndex:A||I===0?-1:0,"data-orientation":i,...w,ref:E,style:{outline:`none`,...e.style},onMouseDown:s(e.onMouseDown,()=>{F.current=!0}),onFocus:s(e.onFocus,e=>{let t=!F.current;if(e.target===e.currentTarget&&t&&!A){let t=new CustomEvent(h,g);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=P().filter(e=>e.focusable);M([e.find(e=>e.active),e.find(e=>e.id===O),...e].filter(Boolean).map(e=>e.ref.current),S)}}F.current=!1}),onBlur:s(e.onBlur,()=>j(!1))})})}),D=`RovingFocusGroupItem`,O=f.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:i=!0,active:a=!1,tabStopId:o,children:c,...u}=e,d=l(),m=o||d,h=w(D,n),g=h.currentTabStopId===m,_=y(n),{onFocusableItemAdd:b,onFocusableItemRemove:x,currentTabStopId:S}=h;return f.useEffect(()=>{if(i)return b(),()=>x()},[i,b,x]),(0,p.jsx)(v.ItemSlot,{scope:n,id:m,focusable:i,active:a,children:(0,p.jsx)(r.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:s(e.onMouseDown,e=>{i?h.onItemFocus(m):e.preventDefault()}),onFocus:s(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:s(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){h.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=j(e,h.orientation,h.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=_().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=h.loop?N(n,r+1):n.slice(r+1)}setTimeout(()=>M(n))}}),children:typeof c==`function`?c({isCurrentTabStop:g,hasTabStop:S!=null}):c})})});O.displayName=D;var k={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function A(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function j(e,t,n){let r=A(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return k[r]}function M(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function N(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var P=T,F=O;export{m as i,P as n,S as r,F as t};
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";var r=e(t(),1),i=n(),a=r.createContext(void 0),o=e=>{let{dir:t,children:n}=e;return(0,i.jsx)(a.Provider,{value:t,children:n})};function s(e){let t=r.useContext(a);return e||t||`ltr`}export{s as n,o as t};
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";var r=t(e(),1),i=n(),a=r.createContext(void 0),o=e=>{let{dir:t,children:n}=e;return(0,i.jsx)(a.Provider,{value:t,children:n})};function s(e){let t=r.useContext(a);return e||t||`ltr`}export{s as n,o as t};
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";import{t as r}from"./dist-BPr298C3.js";import{d as i}from"./button-D5xmeb32.js";import{a,r as o,t as s}from"./dist-gwfT6Lh0.js";import{n as c,r as l,t as u}from"./dist-DJOPBXks.js";import{t as d}from"./dist-BJxEqcEF.js";import{n as f}from"./dist-ibg4sB6V.js";import{t as p}from"./dist-ClhK3NkD.js";import{t as m}from"./dist-DdarLBQJ.js";var h=e(t(),1),g=n(),_=`Radio`,[v,y]=a(_),[b,x]=v(_),S=h.forwardRef((e,t)=>{let{__scopeRadio:n,name:a,checked:s=!1,required:c,disabled:l,value:u=`on`,onCheck:d,form:f,...p}=e,[m,_]=h.useState(null),v=i(t,e=>_(e)),y=h.useRef(!1),x=m?f||!!m.closest(`form`):!0;return(0,g.jsxs)(b,{scope:n,checked:s,disabled:l,children:[(0,g.jsx)(r.button,{type:`button`,role:`radio`,"aria-checked":s,"data-state":D(s),"data-disabled":l?``:void 0,disabled:l,value:u,...p,ref:v,onClick:o(e.onClick,e=>{s||d?.(),x&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),x&&(0,g.jsx)(E,{control:m,bubbles:!y.current,name:a,value:u,checked:s,required:c,disabled:l,form:f,style:{transform:`translateX(-100%)`}})]})});S.displayName=_;var C=`RadioIndicator`,w=h.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:i,...a}=e,o=x(C,n);return(0,g.jsx)(d,{present:i||o.checked,children:(0,g.jsx)(r.span,{"data-state":D(o.checked),"data-disabled":o.disabled?``:void 0,...a,ref:t})})});w.displayName=C;var T=`RadioBubbleInput`,E=h.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:a=!0,...o},s)=>{let c=h.useRef(null),l=i(c,s),u=p(n),d=m(t);return h.useEffect(()=>{let e=c.current;if(!e)return;let t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,`checked`).set;if(u!==n&&r){let t=new Event(`click`,{bubbles:a});r.call(e,n),e.dispatchEvent(t)}},[u,n,a]),(0,g.jsx)(r.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...d,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});E.displayName=T;function D(e){return e?`checked`:`unchecked`}var O=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],k=`RadioGroup`,[A,j]=a(k,[l,y]),M=l(),N=y(),[P,F]=A(k),I=h.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:i,defaultValue:a,value:o,required:l=!1,disabled:u=!1,orientation:d,dir:p,loop:m=!0,onValueChange:h,..._}=e,v=M(n),y=f(p),[b,x]=s({prop:o,defaultProp:a??null,onChange:h,caller:k});return(0,g.jsx)(P,{scope:n,name:i,required:l,disabled:u,value:b,onValueChange:x,children:(0,g.jsx)(c,{asChild:!0,...v,orientation:d,dir:y,loop:m,children:(0,g.jsx)(r.div,{role:`radiogroup`,"aria-required":l,"aria-orientation":d,"data-disabled":u?``:void 0,dir:y,..._,ref:t})})})});I.displayName=k;var L=`RadioGroupItem`,R=h.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...a}=e,s=F(L,n),c=s.disabled||r,l=M(n),d=N(n),f=h.useRef(null),p=i(t,f),m=s.value===a.value,_=h.useRef(!1);return h.useEffect(()=>{let e=e=>{O.includes(e.key)&&(_.current=!0)},t=()=>_.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,g.jsx)(u,{asChild:!0,...l,focusable:!c,active:m,children:(0,g.jsx)(S,{disabled:c,required:s.required,checked:m,...d,...a,name:s.name,ref:p,onCheck:()=>s.onValueChange(a.value),onKeyDown:o(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:o(a.onFocus,()=>{_.current&&f.current?.click()})})})});R.displayName=L;var z=`RadioGroupIndicator`,B=h.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,g.jsx)(w,{...N(n),...r,ref:t})});B.displayName=z;var V=I,H=R,U=B;export{H as n,V as r,U as t};
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{t as r}from"./dist-fWONwgan.js";import{d as i}from"./button-gsP5wmrs.js";import{a,r as o,t as s}from"./dist-BX7-FFVx.js";import{t as c}from"./dist-CnRb3IO0.js";import{n as l}from"./dist-I_iv6zg5.js";import{t as u}from"./dist-BIHhvYX3.js";import{t as d}from"./dist-8mLdRaED.js";import{n as f,r as p,t as m}from"./dist-ywuA9477.js";var h=t(e(),1),g=n(),_=`Radio`,[v,y]=a(_),[b,x]=v(_),S=h.forwardRef((e,t)=>{let{__scopeRadio:n,name:a,checked:s=!1,required:c,disabled:l,value:u=`on`,onCheck:d,form:f,...p}=e,[m,_]=h.useState(null),v=i(t,e=>_(e)),y=h.useRef(!1),x=m?f||!!m.closest(`form`):!0;return(0,g.jsxs)(b,{scope:n,checked:s,disabled:l,children:[(0,g.jsx)(r.button,{type:`button`,role:`radio`,"aria-checked":s,"data-state":D(s),"data-disabled":l?``:void 0,disabled:l,value:u,...p,ref:v,onClick:o(e.onClick,e=>{s||d?.(),x&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),x&&(0,g.jsx)(E,{control:m,bubbles:!y.current,name:a,value:u,checked:s,required:c,disabled:l,form:f,style:{transform:`translateX(-100%)`}})]})});S.displayName=_;var C=`RadioIndicator`,w=h.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:i,...a}=e,o=x(C,n);return(0,g.jsx)(c,{present:i||o.checked,children:(0,g.jsx)(r.span,{"data-state":D(o.checked),"data-disabled":o.disabled?``:void 0,...a,ref:t})})});w.displayName=C;var T=`RadioBubbleInput`,E=h.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:a=!0,...o},s)=>{let c=h.useRef(null),l=i(c,s),f=u(n),p=d(t);return h.useEffect(()=>{let e=c.current;if(!e)return;let t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,`checked`).set;if(f!==n&&r){let t=new Event(`click`,{bubbles:a});r.call(e,n),e.dispatchEvent(t)}},[f,n,a]),(0,g.jsx)(r.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...p,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});E.displayName=T;function D(e){return e?`checked`:`unchecked`}var O=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],k=`RadioGroup`,[A,j]=a(k,[p,y]),M=p(),N=y(),[P,F]=A(k),I=h.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:i,defaultValue:a,value:o,required:c=!1,disabled:u=!1,orientation:d,dir:p,loop:m=!0,onValueChange:h,..._}=e,v=M(n),y=l(p),[b,x]=s({prop:o,defaultProp:a??null,onChange:h,caller:k});return(0,g.jsx)(P,{scope:n,name:i,required:c,disabled:u,value:b,onValueChange:x,children:(0,g.jsx)(f,{asChild:!0,...v,orientation:d,dir:y,loop:m,children:(0,g.jsx)(r.div,{role:`radiogroup`,"aria-required":c,"aria-orientation":d,"data-disabled":u?``:void 0,dir:y,..._,ref:t})})})});I.displayName=k;var L=`RadioGroupItem`,R=h.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...a}=e,s=F(L,n),c=s.disabled||r,l=M(n),u=N(n),d=h.useRef(null),f=i(t,d),p=s.value===a.value,_=h.useRef(!1);return h.useEffect(()=>{let e=e=>{O.includes(e.key)&&(_.current=!0)},t=()=>_.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,g.jsx)(m,{asChild:!0,...l,focusable:!c,active:p,children:(0,g.jsx)(S,{disabled:c,required:s.required,checked:p,...u,...a,name:s.name,ref:f,onCheck:()=>s.onValueChange(a.value),onKeyDown:o(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:o(a.onFocus,()=>{_.current&&d.current?.click()})})})});R.displayName=L;var z=`RadioGroupIndicator`,B=h.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,g.jsx)(w,{...N(n),...r,ref:t})});B.displayName=z;var V=I,H=R,U=B;export{H as n,V as r,U as t};
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t,rf as n,tf as r}from"./messages-BvSF842O.js";import{c as i}from"./button-D5xmeb32.js";var a=n((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),o=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e(t(),1),c=e(o(),1),l=r(),u=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=i(`Primitive.${t}`),r=s.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,l.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function d(e,t){e&&c.flushSync(()=>e.dispatchEvent(t))}export{d as n,o as r,u as t};
|
||||
import{af as e,cf as t,if as n,of as r}from"./messages-BSgosaSa.js";import{c as i}from"./button-gsP5wmrs.js";var a=r((t=>{var n=e();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,t.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},t.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},t.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},t.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},t.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},t.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},t.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},t.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},t.requestFormReset=function(e){a.d.r(e)},t.unstable_batchedUpdates=function(e,t){return e(t)},t.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},t.useFormStatus=function(){return c.H.useHostTransitionStatus()},t.version=`19.2.5`})),o=r(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=t(e(),1),c=t(o(),1),l=n(),u=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=i(`Primitive.${t}`),r=s.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,l.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function d(e,t){e&&c.flushSync(()=>e.dispatchEvent(t))}export{d as n,o as r,u as t};
|
||||
@@ -0,0 +1 @@
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{t as r}from"./dist-fWONwgan.js";import{d as i}from"./button-gsP5wmrs.js";import{a,r as o,t as s}from"./dist-BX7-FFVx.js";import{t as c}from"./dist-AW7rpZT7.js";import{n as l,t as u}from"./dist-C3yztW6j.js";import{n as d}from"./dist-I_iv6zg5.js";var f=t(e(),1),p=n(),m=`rovingFocusGroup.onEntryFocus`,h={bubbles:!1,cancelable:!0},g=`RovingFocusGroup`,[_,v,y]=c(g),[b,x]=a(g,[y]),[S,C]=b(g),w=f.forwardRef((e,t)=>(0,p.jsx)(_.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(_.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(T,{...e,ref:t})})}));w.displayName=g;var T=f.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:a,loop:c=!1,dir:l,currentTabStopId:_,defaultCurrentTabStopId:y,onCurrentTabStopIdChange:b,onEntryFocus:x,preventScrollOnEntryFocus:C=!1,...w}=e,T=f.useRef(null),E=i(t,T),D=d(l),[O,k]=s({prop:_,defaultProp:y??null,onChange:b,caller:g}),[A,M]=f.useState(!1),N=u(x),P=v(n),F=f.useRef(!1),[I,L]=f.useState(0);return f.useEffect(()=>{let e=T.current;if(e)return e.addEventListener(m,N),()=>e.removeEventListener(m,N)},[N]),(0,p.jsx)(S,{scope:n,orientation:a,dir:D,loop:c,currentTabStopId:O,onItemFocus:f.useCallback(e=>k(e),[k]),onItemShiftTab:f.useCallback(()=>M(!0),[]),onFocusableItemAdd:f.useCallback(()=>L(e=>e+1),[]),onFocusableItemRemove:f.useCallback(()=>L(e=>e-1),[]),children:(0,p.jsx)(r.div,{tabIndex:A||I===0?-1:0,"data-orientation":a,...w,ref:E,style:{outline:`none`,...e.style},onMouseDown:o(e.onMouseDown,()=>{F.current=!0}),onFocus:o(e.onFocus,e=>{let t=!F.current;if(e.target===e.currentTarget&&t&&!A){let t=new CustomEvent(m,h);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=P().filter(e=>e.focusable);j([e.find(e=>e.active),e.find(e=>e.id===O),...e].filter(Boolean).map(e=>e.ref.current),C)}}F.current=!1}),onBlur:o(e.onBlur,()=>M(!1))})})}),E=`RovingFocusGroupItem`,D=f.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:i=!0,active:a=!1,tabStopId:s,children:c,...u}=e,d=l(),m=s||d,h=C(E,n),g=h.currentTabStopId===m,y=v(n),{onFocusableItemAdd:b,onFocusableItemRemove:x,currentTabStopId:S}=h;return f.useEffect(()=>{if(i)return b(),()=>x()},[i,b,x]),(0,p.jsx)(_.ItemSlot,{scope:n,id:m,focusable:i,active:a,children:(0,p.jsx)(r.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:o(e.onMouseDown,e=>{i?h.onItemFocus(m):e.preventDefault()}),onFocus:o(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:o(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){h.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=A(e,h.orientation,h.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=y().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=h.loop?M(n,r+1):n.slice(r+1)}setTimeout(()=>j(n))}}),children:typeof c==`function`?c({isCurrentTabStop:g,hasTabStop:S!=null}):c})})});D.displayName=E;var O={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function k(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function A(e,t,n){let r=k(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return O[r]}function j(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function M(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var N=w,P=D;export{N as n,x as r,P as t};
|
||||
@@ -1 +1 @@
|
||||
import{t as e}from"./createLucideIcon-BGQWeu8F.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{t as e}from"./createLucideIcon-BGQWeu8F.js";var t=e(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]);export{t};
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]);export{t};
|
||||
@@ -1 +1 @@
|
||||
import{nt as e,tf as t}from"./messages-BvSF842O.js";import{i as n}from"./button-D5xmeb32.js";import{t as r}from"./createLucideIcon-BGQWeu8F.js";var i=r(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),a=r(`refresh-cw`,[[`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`}]]),o=r(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),s=t();function c({className:t,description:r=e(),icon:a,title:o}){return(0,s.jsxs)(`div`,{className:n(`flex flex-col items-center justify-center gap-3 py-16 text-center`,t),children:[(0,s.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full bg-muted text-muted-foreground`,children:a??(0,s.jsx)(i,{className:`size-6`})}),o&&(0,s.jsx)(`p`,{className:`font-medium text-sm`,children:o}),(0,s.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r})]})}export{o as n,a as r,c as t};
|
||||
import{if as e,nt as t}from"./messages-BSgosaSa.js";import{i as n}from"./button-gsP5wmrs.js";import{t as r}from"./createLucideIcon-D--4ckBc.js";var i=r(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),a=r(`refresh-cw`,[[`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`}]]),o=r(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),s=e();function c({className:e,description:r=t(),icon:a,title:o}){return(0,s.jsxs)(`div`,{className:n(`flex flex-col items-center justify-center gap-3 py-16 text-center`,e),children:[(0,s.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full bg-muted text-muted-foreground`,children:a??(0,s.jsx)(i,{className:`size-6`})}),o&&(0,s.jsx)(`p`,{className:`font-medium text-sm`,children:o}),(0,s.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r})]})}export{o as n,a as r,c as t};
|
||||
@@ -0,0 +1 @@
|
||||
import{Fu as e,Iu as t,Nu as n,Pu as r,af as i,cf as a,fn as o,if as s,mn as c,pn as l}from"./messages-BSgosaSa.js";import{a as u}from"./auth-store-BFY9rMhZ.js";import{t as d}from"./button-gsP5wmrs.js";import{a as f,i as p,n as m,r as h,t as g}from"./select-L52xnO1_.js";import{c as _,s as v}from"./zod-Cmg_v3kW.js";import{a as y,c as b,i as x,l as S,n as C,o as w,s as T,t as E}from"./form-s9C7GZ5q.js";import{t as D}from"./input-C0_2W2RZ.js";import{t as O}from"./page-header-lpyPiG0-.js";import{n as k,r as A}from"./checkout-display-CSXzV3v2.js";import{a as j,i as M,n as N,t as P}from"./lib-Bzu2DGLF.js";var F=a(i(),1),I=s(),L=v({defaultToken:_().min(1,e()),defaultCurrency:_().min(1,r()),defaultNetwork:_().min(1,n())});function R(){let t=M(`epay`),i=u.useQuery(`get`,`/admin/api/v1/config`),a=j(),s=S({resolver:b(L),defaultValues:{defaultToken:``,defaultCurrency:``,defaultNetwork:``}}),c=(0,F.useMemo)(()=>i.data?.data?.supported_assets??[],[i.data?.data?.supported_assets]),_=(0,F.useMemo)(()=>z(c),[c]),v=s.watch(`defaultNetwork`),O=(0,F.useMemo)(()=>B(c,v),[c,v]);(0,F.useEffect)(()=>{let e=t.data?.data;e&&s.reset({defaultToken:P(e,`epay.default_token`),defaultCurrency:P(e,`epay.default_currency`),defaultNetwork:P(e,`epay.default_network`)})},[t.data,s]),(0,F.useEffect)(()=>{if(!_.length)return;let e=s.getValues(`defaultNetwork`),t=_.find(t=>V(t.network,e))?.network||_[0]?.network||e||``;t!==e&&s.setValue(`defaultNetwork`,t);let n=B(c,t),r=s.getValues(`defaultToken`),i=n.find(e=>V(e.value,r))?.value||(r&&n.length===0?r.toLowerCase():n[0]?.value||``);i&&i!==r&&s.setValue(`defaultToken`,i)},[s,_,c]);async function R(e){await N(a.mutateAsync,[{group:`epay`,key:`epay.default_token`,type:`string`,value:e.defaultToken},{group:`epay`,key:`epay.default_currency`,type:`string`,value:e.defaultCurrency},{group:`epay`,key:`epay.default_network`,type:`string`,value:e.defaultNetwork}],l()),await t.refetch()}return(0,I.jsx)(E,{...s,children:(0,I.jsxs)(`form`,{className:`space-y-6`,onSubmit:s.handleSubmit(R),children:[(0,I.jsx)(x,{control:s.control,name:`defaultToken`,render:({field:t})=>(0,I.jsxs)(y,{children:[(0,I.jsx)(w,{children:e()}),(0,I.jsxs)(g,{disabled:i.isLoading||O.length===0,onValueChange:t.onChange,value:t.value,children:[(0,I.jsx)(C,{children:(0,I.jsx)(p,{children:(0,I.jsx)(f,{placeholder:`usdt`})})}),(0,I.jsx)(m,{children:O.map(e=>(0,I.jsx)(h,{value:e.value,children:(0,I.jsx)(A,{token:e.displayName})},e.value))})]}),(0,I.jsx)(T,{})]})}),(0,I.jsx)(x,{control:s.control,name:`defaultCurrency`,render:({field:e})=>(0,I.jsxs)(y,{children:[(0,I.jsx)(w,{children:r()}),(0,I.jsx)(C,{children:(0,I.jsx)(D,{placeholder:`cny`,...e})}),(0,I.jsx)(T,{})]})}),(0,I.jsx)(x,{control:s.control,name:`defaultNetwork`,render:({field:e})=>(0,I.jsxs)(y,{children:[(0,I.jsx)(w,{children:n()}),(0,I.jsxs)(g,{disabled:i.isLoading||_.length===0,onValueChange:t=>{e.onChange(t);let n=B(c,t)[0]?.value;n&&s.setValue(`defaultToken`,n,{shouldDirty:!0,shouldValidate:!0})},value:e.value,children:[(0,I.jsx)(C,{children:(0,I.jsx)(p,{children:(0,I.jsx)(f,{placeholder:`tron`})})}),(0,I.jsx)(m,{children:_.map(e=>(0,I.jsx)(h,{value:e.network,children:(0,I.jsx)(k,{displayName:e.displayName,network:e.network})},e.network))})]}),(0,I.jsx)(T,{})]})}),(0,I.jsx)(d,{disabled:a.isPending||t.isLoading,type:`submit`,children:o()})]})})}function z(e){let t=new Map;for(let n of e){if(!n.network)continue;let e=n.network.toLowerCase();t.has(e)||t.set(e,{displayName:n.display_name,network:n.network})}return Array.from(t.values())}function B(e,t){let n=new Map;for(let r of e)if(V(r.network,t))for(let e of r.tokens??[]){if(!e)continue;let t=e.toLowerCase();n.has(t)||n.set(t,{displayName:e.toUpperCase(),value:t})}return Array.from(n.values())}function V(e,t){return String(e??``).toLowerCase()===String(t??``).toLowerCase()}function H(){return(0,I.jsx)(O,{description:c(),title:t(),variant:`section`,children:(0,I.jsx)(R,{})})}var U=H;export{U as component};
|
||||
@@ -1 +0,0 @@
|
||||
import{Au as e,Mu as t,Nu as n,af as r,fn as i,ju as a,mn as o,nf as s,pn as c,tf as l}from"./messages-BvSF842O.js";import{t as u}from"./button-D5xmeb32.js";import{c as d,s as f}from"./zod-ClGKjEyB.js";import{a as p,c as m,i as h,l as g,n as _,o as v,s as y,t as b}from"./form-iIuz3zSX.js";import{t as x}from"./input-CPAfWtuT.js";import{t as S}from"./page-header-D58MnYJU.js";import{a as C,i as w,n as T,t as E}from"./lib-CVxH5aBl.js";var D=r(s(),1),O=l(),k=f({defaultToken:d().min(1,t()),defaultCurrency:d().min(1,a()),defaultNetwork:d().min(1,e())});function A(){let n=w(`epay`),r=C(),o=g({resolver:m(k),defaultValues:{defaultToken:``,defaultCurrency:``,defaultNetwork:``}});(0,D.useEffect)(()=>{let e=n.data?.data;e&&o.reset({defaultToken:E(e,`epay.default_token`),defaultCurrency:E(e,`epay.default_currency`),defaultNetwork:E(e,`epay.default_network`)})},[n.data,o]);async function s(e){await T(r.mutateAsync,[{group:`epay`,key:`epay.default_token`,type:`string`,value:e.defaultToken},{group:`epay`,key:`epay.default_currency`,type:`string`,value:e.defaultCurrency},{group:`epay`,key:`epay.default_network`,type:`string`,value:e.defaultNetwork}],c()),await n.refetch()}return(0,O.jsx)(b,{...o,children:(0,O.jsxs)(`form`,{className:`space-y-6`,onSubmit:o.handleSubmit(s),children:[(0,O.jsx)(h,{control:o.control,name:`defaultToken`,render:({field:e})=>(0,O.jsxs)(p,{children:[(0,O.jsx)(v,{children:t()}),(0,O.jsx)(_,{children:(0,O.jsx)(x,{placeholder:`usdt`,...e})}),(0,O.jsx)(y,{})]})}),(0,O.jsx)(h,{control:o.control,name:`defaultCurrency`,render:({field:e})=>(0,O.jsxs)(p,{children:[(0,O.jsx)(v,{children:a()}),(0,O.jsx)(_,{children:(0,O.jsx)(x,{placeholder:`cny`,...e})}),(0,O.jsx)(y,{})]})}),(0,O.jsx)(h,{control:o.control,name:`defaultNetwork`,render:({field:t})=>(0,O.jsxs)(p,{children:[(0,O.jsx)(v,{children:e()}),(0,O.jsx)(_,{children:(0,O.jsx)(x,{placeholder:`tron`,...t})}),(0,O.jsx)(y,{})]})}),(0,O.jsx)(u,{disabled:r.isPending||n.isLoading,type:`submit`,children:i()})]})})}function j(){return(0,O.jsx)(S,{description:o(),title:n(),variant:`section`,children:(0,O.jsx)(A,{})})}var M=j;export{M as component};
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{t as e}from"./createLucideIcon-BGQWeu8F.js";var t=e(`eye`,[[`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`}]]);export{t};
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`eye`,[[`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`}]]);export{t};
|
||||
@@ -1 +1 @@
|
||||
import{t as e}from"./createLucideIcon-BGQWeu8F.js";var t=e(`eye-off`,[[`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`}]]);export{t};
|
||||
import{t as e}from"./createLucideIcon-D--4ckBc.js";var t=e(`eye-off`,[[`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`}]]);export{t};
|
||||
@@ -1 +1 @@
|
||||
import{af as e,nf as t,tf as n}from"./messages-BvSF842O.js";import{n as r,r as i,t as a}from"./cookies-C6BqVyqT.js";var o=e(t(),1),s=[`inter`,`manrope`,`noto`,`system`],c=n(),l=`font`,u=3600*24*365,d=(0,o.createContext)(null);function f({children:e}){let[t,n]=(0,o.useState)(()=>{let e=a(l);return s.includes(e)?e:s[0]});return(0,o.useEffect)(()=>{(e=>{let t=document.documentElement;t.classList.remove(...[...t.classList].filter(e=>e.startsWith(`font-`))),t.classList.add(`font-${e}`)})(t)},[t]),(0,c.jsx)(d,{value:{font:t,setFont:e=>{i(l,e,u),n(e)},resetFont:()=>{r(l),n(s[0])}},children:e})}var p=()=>{let e=(0,o.useContext)(d);if(!e)throw Error(`useFont must be used within a FontProvider`);return e};export{p as n,s as r,f as t};
|
||||
import{af as e,cf as t,if as n}from"./messages-BSgosaSa.js";import{n as r,r as i,t as a}from"./cookies-DtK8C3EL.js";var o=t(e(),1),s=[`inter`,`manrope`,`noto`,`system`],c=n(),l=`font`,u=3600*24*365,d=(0,o.createContext)(null);function f({children:e}){let[t,n]=(0,o.useState)(()=>{let e=a(l);return s.includes(e)?e:s[0]});return(0,o.useEffect)(()=>{(e=>{let t=document.documentElement;t.classList.remove(...[...t.classList].filter(e=>e.startsWith(`font-`))),t.classList.add(`font-${e}`)})(t)},[t]),(0,c.jsx)(d,{value:{font:t,setFont:e=>{i(l,e,u),n(e)},resetFont:()=>{r(l),n(s[0])}},children:e})}var p=()=>{let e=(0,o.useContext)(d);if(!e)throw Error(`useFont must be used within a FontProvider`);return e};export{p as n,s as r,f as t};
|
||||
@@ -1 +1 @@
|
||||
import{Ct as e,St as t,cu as n,su as r,tf as i,xt as a}from"./messages-BvSF842O.js";import{t as o}from"./useRouter-DVaO3x1M.js";import{t as s}from"./useNavigate-DGiKRiQU.js";import{t as c}from"./button-D5xmeb32.js";var l=i();function u(){let i=s(),{history:u}=o();return(0,l.jsx)(`div`,{className:`h-svh`,children:(0,l.jsxs)(`div`,{className:`m-auto flex h-full w-full flex-col items-center justify-center gap-2`,children:[(0,l.jsx)(`h1`,{className:`font-bold text-[7rem] leading-tight`,children:`403`}),(0,l.jsx)(`span`,{className:`font-medium`,children:e()}),(0,l.jsxs)(`p`,{className:`text-center text-muted-foreground`,children:[t(),` `,(0,l.jsx)(`br`,{}),a()]}),(0,l.jsxs)(`div`,{className:`mt-6 flex gap-4`,children:[(0,l.jsx)(c,{onClick:()=>u.go(-1),variant:`outline`,children:n()}),(0,l.jsx)(c,{onClick:()=>i({to:`/dashboard`}),children:r()})]})]})})}export{u as t};
|
||||
import{Ct as e,St as t,du as n,if as r,uu as i,xt as a}from"./messages-BSgosaSa.js";import{t as o}from"./useRouter-BP80Cbua.js";import{t as s}from"./useNavigate-BNXxwDKM.js";import{t as c}from"./button-gsP5wmrs.js";var l=r();function u(){let r=s(),{history:u}=o();return(0,l.jsx)(`div`,{className:`h-svh`,children:(0,l.jsxs)(`div`,{className:`m-auto flex h-full w-full flex-col items-center justify-center gap-2`,children:[(0,l.jsx)(`h1`,{className:`font-bold text-[7rem] leading-tight`,children:`403`}),(0,l.jsx)(`span`,{className:`font-medium`,children:e()}),(0,l.jsxs)(`p`,{className:`text-center text-muted-foreground`,children:[t(),` `,(0,l.jsx)(`br`,{}),a()]}),(0,l.jsxs)(`div`,{className:`mt-6 flex gap-4`,children:[(0,l.jsx)(c,{onClick:()=>u.go(-1),variant:`outline`,children:n()}),(0,l.jsx)(c,{onClick:()=>r({to:`/dashboard`}),children:i()})]})]})})}export{u as t};
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{cu as e,lu as t,su as n,tf as r,uu as i}from"./messages-BvSF842O.js";import{t as a}from"./useRouter-DVaO3x1M.js";import{t as o}from"./useNavigate-DGiKRiQU.js";import{i as s,t as c}from"./button-D5xmeb32.js";var l=r();function u({className:r,minimal:u=!1}){let d=o(),{history:f}=a();return(0,l.jsx)(`div`,{className:s(`h-svh w-full`,r),children:(0,l.jsxs)(`div`,{className:`m-auto flex h-full w-full flex-col items-center justify-center gap-2`,children:[!u&&(0,l.jsx)(`h1`,{className:`font-bold text-[7rem] leading-tight`,children:`500`}),(0,l.jsx)(`span`,{className:`font-medium`,children:i()}),(0,l.jsx)(`p`,{className:`text-center text-muted-foreground`,children:t()}),!u&&(0,l.jsxs)(`div`,{className:`mt-6 flex gap-4`,children:[(0,l.jsx)(c,{onClick:()=>f.go(-1),variant:`outline`,children:e()}),(0,l.jsx)(c,{onClick:()=>d({to:`/dashboard`}),children:n()})]})]})})}export{u as t};
|
||||
import{du as e,fu as t,if as n,pu as r,uu as i}from"./messages-BSgosaSa.js";import{t as a}from"./useRouter-BP80Cbua.js";import{t as o}from"./useNavigate-BNXxwDKM.js";import{i as s,t as c}from"./button-gsP5wmrs.js";var l=n();function u({className:n,minimal:u=!1}){let d=o(),{history:f}=a();return(0,l.jsx)(`div`,{className:s(`h-svh w-full`,n),children:(0,l.jsxs)(`div`,{className:`m-auto flex h-full w-full flex-col items-center justify-center gap-2`,children:[!u&&(0,l.jsx)(`h1`,{className:`font-bold text-[7rem] leading-tight`,children:`500`}),(0,l.jsx)(`span`,{className:`font-medium`,children:r()}),(0,l.jsx)(`p`,{className:`text-center text-muted-foreground`,children:t()}),!u&&(0,l.jsxs)(`div`,{className:`mt-6 flex gap-4`,children:[(0,l.jsx)(c,{onClick:()=>f.go(-1),variant:`outline`,children:e()}),(0,l.jsx)(c,{onClick:()=>d({to:`/dashboard`}),children:i()})]})]})})}export{u as t};
|
||||
@@ -1 +1 @@
|
||||
import{Jd as e,Zd as t,af as n,el as r,ll as i,mt as a,nf as o,qd as s,tf as c,tl as l}from"./messages-BvSF842O.js";import{i as u}from"./auth-store-2l354uaq.js";import{t as d}from"./link-CeK9z2o_.js";import{F as f,L as p,R as m,d as h,f as g,h as _,j as v,l as y,n as b,o as x,p as S,u as C,z as w}from"./search-provider-S_pK7Mew.js";import{i as T,t as E}from"./button-D5xmeb32.js";import{a as D,i as O,l as k,o as A,r as j,s as M,t as N}from"./dropdown-menu-Cvv2xK8F.js";import{t as P}from"./separator-S9ojZdzv.js";import{h as F}from"./command-NHXN_saF.js";var I=n(o(),1),L=c();function R(){let[t,n]=y(),[o,c]=(0,I.useState)(!1),{user:v}=u(),b=v?.username?.trim()||a(),T=b.charAt(0).toUpperCase()||`U`,P=v?.last_login_at?l({time:x(v.last_login_at)}):r();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(f,{onOpenChange:c,open:o,children:(0,L.jsx)(_,{})}),(0,L.jsxs)(N,{modal:!1,children:[(0,L.jsx)(k,{asChild:!0,children:(0,L.jsx)(E,{className:`relative h-8 w-8 rounded-full`,variant:`ghost`,children:(0,L.jsxs)(C,{className:`h-8 w-8`,children:[(0,L.jsx)(g,{alt:b,src:`/avatars/01.png`}),(0,L.jsx)(h,{children:T})]})})}),(0,L.jsxs)(j,{align:`end`,className:`w-56`,forceMount:!0,children:[(0,L.jsx)(A,{className:`p-0 font-normal`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1.5 text-start text-sm`,children:[(0,L.jsxs)(C,{className:`h-8 w-8 rounded-lg`,children:[(0,L.jsx)(g,{alt:b,src:`/avatars/01.png`}),(0,L.jsx)(h,{className:`rounded-lg`,children:T})]}),(0,L.jsxs)(`div`,{className:`grid flex-1 text-start text-sm leading-tight`,children:[(0,L.jsx)(`span`,{className:`truncate font-semibold`,children:b}),(0,L.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:P})]})]})}),(0,L.jsx)(M,{}),(0,L.jsxs)(O,{children:[(0,L.jsx)(D,{asChild:!0,children:(0,L.jsxs)(d,{to:`/account/password`,children:[(0,L.jsx)(w,{className:`mr-2 size-4`}),e()]})}),(0,L.jsxs)(D,{onClick:()=>c(!0),onSelect:e=>e.preventDefault(),children:[(0,L.jsx)(p,{className:`mr-2 size-4`}),i()]})]}),(0,L.jsx)(M,{}),(0,L.jsxs)(D,{onClick:()=>n(!0),variant:`destructive`,children:[(0,L.jsx)(m,{className:`mr-2 size-4`}),s()]})]})]}),(0,L.jsx)(S,{onOpenChange:n,open:!!t})]})}function z({className:e=``,placeholder:n}){let{setOpen:r}=b();return(0,L.jsxs)(E,{className:T(`group relative h-8 w-full flex-1 justify-start rounded-md bg-muted/25 font-normal text-muted-foreground text-sm shadow-none hover:bg-accent sm:w-40 sm:pe-12 md:flex-none lg:w-52 xl:w-64`,e),onClick:()=>r(!0),variant:`outline`,children:[(0,L.jsx)(F,{"aria-hidden":`true`,className:`absolute inset-s-1.5 top-1/2 -translate-y-1/2`,size:16}),(0,L.jsx)(`span`,{className:`ms-4`,children:n??t()}),(0,L.jsxs)(`kbd`,{className:`pointer-events-none absolute inset-e-[0.3rem] top-[0.3rem] hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-medium font-mono text-[10px] opacity-100 group-hover:bg-accent sm:flex`,children:[(0,L.jsx)(`span`,{className:`text-xs`,children:`⌘`}),`K`]})]})}function B({className:e,fixed:t,children:n,...r}){let[i,a]=(0,I.useState)(0);return(0,I.useEffect)(()=>{let e=()=>{a(document.body.scrollTop||document.documentElement.scrollTop)};return document.addEventListener(`scroll`,e,{passive:!0}),()=>document.removeEventListener(`scroll`,e)},[]),(0,L.jsx)(`header`,{className:T(`z-50 h-16`,t&&`header-fixed peer/header sticky top-0 w-[inherit]`,i>10&&t?`shadow`:`shadow-none`,e),...r,children:(0,L.jsxs)(`div`,{className:T(`relative flex h-full items-center gap-3 p-4 sm:gap-4`,i>10&&t&&`after:absolute after:inset-0 after:-z-10 after:bg-background/20 after:backdrop-blur-lg`),children:[(0,L.jsx)(v,{className:`max-md:scale-125`,variant:`outline`}),(0,L.jsx)(P,{className:`h-6`,orientation:`vertical`}),n]})})}export{z as n,R as r,B as t};
|
||||
import{Xd as e,Zd as t,af as n,cf as r,ef as i,fl as a,if as o,il as s,mt as c,rl as l}from"./messages-BSgosaSa.js";import{i as u}from"./auth-store-BFY9rMhZ.js";import{t as d}from"./link-fq4EwgoM.js";import{F as f,L as p,R as m,d as h,f as g,h as _,j as v,l as y,n as b,o as x,p as S,u as C,z as w}from"./search-provider-Dt_F-pkS.js";import{i as T,t as E}from"./button-gsP5wmrs.js";import{a as D,i as O,l as k,o as A,r as j,s as M,t as N}from"./dropdown-menu-DLlHTZjq.js";import{t as P}from"./separator-Ba9h8msf.js";import{h as F}from"./command-BOJV7P-9.js";var I=r(n(),1),L=o();function R(){let[n,r]=y(),[i,o]=(0,I.useState)(!1),{user:v}=u(),b=v?.username?.trim()||c(),T=b.charAt(0).toUpperCase()||`U`,P=v?.last_login_at?s({time:x(v.last_login_at)}):l();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(f,{onOpenChange:o,open:i,children:(0,L.jsx)(_,{})}),(0,L.jsxs)(N,{modal:!1,children:[(0,L.jsx)(k,{asChild:!0,children:(0,L.jsx)(E,{className:`relative h-8 w-8 rounded-full`,variant:`ghost`,children:(0,L.jsxs)(C,{className:`h-8 w-8`,children:[(0,L.jsx)(g,{alt:b,src:`/avatars/01.png`}),(0,L.jsx)(h,{children:T})]})})}),(0,L.jsxs)(j,{align:`end`,className:`w-56`,forceMount:!0,children:[(0,L.jsx)(A,{className:`p-0 font-normal`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1.5 text-start text-sm`,children:[(0,L.jsxs)(C,{className:`h-8 w-8 rounded-lg`,children:[(0,L.jsx)(g,{alt:b,src:`/avatars/01.png`}),(0,L.jsx)(h,{className:`rounded-lg`,children:T})]}),(0,L.jsxs)(`div`,{className:`grid flex-1 text-start text-sm leading-tight`,children:[(0,L.jsx)(`span`,{className:`truncate font-semibold`,children:b}),(0,L.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:P})]})]})}),(0,L.jsx)(M,{}),(0,L.jsxs)(O,{children:[(0,L.jsx)(D,{asChild:!0,children:(0,L.jsxs)(d,{to:`/account/password`,children:[(0,L.jsx)(w,{className:`mr-2 size-4`}),t()]})}),(0,L.jsxs)(D,{onClick:()=>o(!0),onSelect:e=>e.preventDefault(),children:[(0,L.jsx)(p,{className:`mr-2 size-4`}),a()]})]}),(0,L.jsx)(M,{}),(0,L.jsxs)(D,{onClick:()=>r(!0),variant:`destructive`,children:[(0,L.jsx)(m,{className:`mr-2 size-4`}),e()]})]})]}),(0,L.jsx)(S,{onOpenChange:r,open:!!n})]})}function z({className:e=``,placeholder:t}){let{setOpen:n}=b();return(0,L.jsxs)(E,{className:T(`group relative h-8 w-full flex-1 justify-start rounded-md bg-muted/25 font-normal text-muted-foreground text-sm shadow-none hover:bg-accent sm:w-40 sm:pe-12 md:flex-none lg:w-52 xl:w-64`,e),onClick:()=>n(!0),variant:`outline`,children:[(0,L.jsx)(F,{"aria-hidden":`true`,className:`absolute inset-s-1.5 top-1/2 -translate-y-1/2`,size:16}),(0,L.jsx)(`span`,{className:`ms-4`,children:t??i()}),(0,L.jsxs)(`kbd`,{className:`pointer-events-none absolute inset-e-[0.3rem] top-[0.3rem] hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-medium font-mono text-[10px] opacity-100 group-hover:bg-accent sm:flex`,children:[(0,L.jsx)(`span`,{className:`text-xs`,children:`⌘`}),`K`]})]})}function B({className:e,fixed:t,children:n,...r}){let[i,a]=(0,I.useState)(0);return(0,I.useEffect)(()=>{let e=()=>{a(document.body.scrollTop||document.documentElement.scrollTop)};return document.addEventListener(`scroll`,e,{passive:!0}),()=>document.removeEventListener(`scroll`,e)},[]),(0,L.jsx)(`header`,{className:T(`z-50 h-16`,t&&`header-fixed peer/header sticky top-0 w-[inherit]`,i>10&&t?`shadow`:`shadow-none`,e),...r,children:(0,L.jsxs)(`div`,{className:T(`relative flex h-full items-center gap-3 p-4 sm:gap-4`,i>10&&t&&`after:absolute after:inset-0 after:-z-10 after:bg-background/20 after:backdrop-blur-lg`),children:[(0,L.jsx)(v,{className:`max-md:scale-125`,variant:`outline`}),(0,L.jsx)(P,{className:`h-6`,orientation:`vertical`}),n]})})}export{z as n,R as r,B as t};
|
||||
@@ -1 +1 @@
|
||||
import{Id as e,Ld as t,Rd as n,tf as r}from"./messages-BvSF842O.js";import{t as i}from"./telescope-DmBD-aeq.js";var a=r();function o(){return(0,a.jsx)(`div`,{className:`h-svh`,children:(0,a.jsxs)(`div`,{className:`m-auto flex h-full w-full flex-col items-center justify-center gap-2`,children:[(0,a.jsx)(i,{size:72}),(0,a.jsx)(`h1`,{className:`font-bold text-4xl leading-tight`,children:n()}),(0,a.jsxs)(`p`,{className:`text-center text-muted-foreground`,children:[t(),` `,(0,a.jsx)(`br`,{}),e()]})]})})}var s=o;export{s as component};
|
||||
import{Bd as e,Vd as t,if as n,zd as r}from"./messages-BSgosaSa.js";import{t as i}from"./telescope-1xQBKzAV.js";var a=n();function o(){return(0,a.jsx)(`div`,{className:`h-svh`,children:(0,a.jsxs)(`div`,{className:`m-auto flex h-full w-full flex-col items-center justify-center gap-2`,children:[(0,a.jsx)(i,{size:72}),(0,a.jsx)(`h1`,{className:`font-bold text-4xl leading-tight`,children:t()}),(0,a.jsxs)(`p`,{className:`text-center text-muted-foreground`,children:[e(),` `,(0,a.jsx)(`br`,{}),r()]})]})})}var s=o;export{s as component};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user