nextclaw 0.16.24 → 0.16.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +132 -29
- package/package.json +12 -12
- package/ui-dist/assets/{ChannelsList-CvK4qHfg.js → ChannelsList-UKA-5t02.js} +1 -1
- package/ui-dist/assets/ChatPage-xdBp-ddG.js +37 -0
- package/ui-dist/assets/{DocBrowser-BFmW6e-4.js → DocBrowser-DBUIWJer.js} +1 -1
- package/ui-dist/assets/{LogoBadge-DZL-zQTr.js → LogoBadge-CsSBHZeV.js} +1 -1
- package/ui-dist/assets/{MarketplacePage-B__MZRrD.js → MarketplacePage-BSH836_G.js} +1 -1
- package/ui-dist/assets/{McpMarketplacePage-C_VKm1uq.js → McpMarketplacePage-B9_kPnnM.js} +1 -1
- package/ui-dist/assets/{ModelConfig-CqJubuwU.js → ModelConfig-DbEKVVg4.js} +1 -1
- package/ui-dist/assets/{ProvidersList-BoSsFBk5.js → ProvidersList-Ck5PgTF2.js} +1 -1
- package/ui-dist/assets/{RemoteAccessPage-S1ChRWMX.js → RemoteAccessPage-4JED9IcK.js} +1 -1
- package/ui-dist/assets/{RuntimeConfig-WnFUsayT.js → RuntimeConfig-CB04ug9v.js} +1 -1
- package/ui-dist/assets/{SearchConfig-D9V07oqj.js → SearchConfig-DmuvL9Pn.js} +1 -1
- package/ui-dist/assets/{SecretsConfig-Ci8sEzaV.js → SecretsConfig-Dw2sRiSs.js} +1 -1
- package/ui-dist/assets/{SessionsConfig-5Nznhx9P.js → SessionsConfig-c-Z9X3xH.js} +1 -1
- package/ui-dist/assets/{chat-session-display-D0ZcEkUq.js → chat-session-display-z9RvX-D3.js} +1 -1
- package/ui-dist/assets/{index-BvCYcN48.js → index-DqzLj8Sw.js} +3 -3
- package/ui-dist/assets/{label-AurG3ZpO.js → label-DPGDZvhm.js} +1 -1
- package/ui-dist/assets/{page-layout-Q2hHkfJy.js → page-layout-DMA_ZiHj.js} +1 -1
- package/ui-dist/assets/{popover-BKInm43u.js → popover-BBLXwfva.js} +1 -1
- package/ui-dist/assets/{security-config-BbPGNJAB.js → security-config-FYNEE2eR.js} +1 -1
- package/ui-dist/assets/{skeleton-CuKw6-Ww.js → skeleton-DLM_39_P.js} +1 -1
- package/ui-dist/assets/{status-dot-DLk8UxLB.js → status-dot-BOzEprxw.js} +1 -1
- package/ui-dist/assets/{switch-BxMSKsQS.js → switch-rE_Ew8fl.js} +1 -1
- package/ui-dist/assets/{tabs-custom-B6gK-RY6.js → tabs-custom-BkfMUTHE.js} +1 -1
- package/ui-dist/assets/{useConfirmDialog-Dth62a0a.js → useConfirmDialog-0owrqZcT.js} +1 -1
- package/ui-dist/index.html +1 -1
- package/ui-dist/assets/ChatPage-Co3GqIVP.js +0 -37
package/dist/cli/index.js
CHANGED
|
@@ -5431,8 +5431,9 @@ function buildLegacyAssistantMessages(message, timestamp) {
|
|
|
5431
5431
|
return messages;
|
|
5432
5432
|
}
|
|
5433
5433
|
function buildLegacyNonAssistantMessage(message, timestamp, options) {
|
|
5434
|
+
const role = message.role === "service" ? "system" : message.role;
|
|
5434
5435
|
return {
|
|
5435
|
-
role
|
|
5436
|
+
role,
|
|
5436
5437
|
content: buildLegacyUserContent(message.parts, options),
|
|
5437
5438
|
timestamp,
|
|
5438
5439
|
ncp_message_id: message.id,
|
|
@@ -5614,6 +5615,7 @@ function buildCurrentTurnState(params) {
|
|
|
5614
5615
|
originalText
|
|
5615
5616
|
});
|
|
5616
5617
|
return {
|
|
5618
|
+
currentRole: latestUserMessage?.role === "system" ? "system" : "user",
|
|
5617
5619
|
currentUserContent: buildLegacyUserContent(currentParts, {
|
|
5618
5620
|
assetStore: params.assetStore
|
|
5619
5621
|
}),
|
|
@@ -5710,6 +5712,8 @@ var NextclawNcpToolRegistry = class {
|
|
|
5710
5712
|
}
|
|
5711
5713
|
await this.options.writeSubagentCompletionToSession({
|
|
5712
5714
|
sessionId,
|
|
5715
|
+
runId: params.runId,
|
|
5716
|
+
toolCallId: params.origin.toolCallId,
|
|
5713
5717
|
label: params.label,
|
|
5714
5718
|
task: params.task,
|
|
5715
5719
|
result: params.result,
|
|
@@ -5763,7 +5767,7 @@ var NextclawNcpToolRegistry = class {
|
|
|
5763
5767
|
}
|
|
5764
5768
|
async execute(toolCallId, toolName, args) {
|
|
5765
5769
|
if (this.registry.has(toolName)) {
|
|
5766
|
-
return this.registry.
|
|
5770
|
+
return this.registry.executeRaw(toolName, toToolParams(args), toolCallId);
|
|
5767
5771
|
}
|
|
5768
5772
|
return this.tools.get(toolName)?.execute(args);
|
|
5769
5773
|
}
|
|
@@ -6081,7 +6085,7 @@ var NextclawNcpContextBuilder = class {
|
|
|
6081
6085
|
availableTools: buildToolCatalogEntries(toolDefinitions)
|
|
6082
6086
|
});
|
|
6083
6087
|
messages[messages.length - 1] = {
|
|
6084
|
-
role:
|
|
6088
|
+
role: currentTurn.currentRole,
|
|
6085
6089
|
content: currentTurn.currentUserContent
|
|
6086
6090
|
};
|
|
6087
6091
|
const pruned = this.inputBudgetPruner.prune({
|
|
@@ -6408,37 +6412,39 @@ var NextclawAgentSessionStore = class {
|
|
|
6408
6412
|
};
|
|
6409
6413
|
|
|
6410
6414
|
// src/cli/commands/ncp/ncp-subagent-completion-message.ts
|
|
6411
|
-
|
|
6415
|
+
import {
|
|
6416
|
+
NCP_INTERNAL_VISIBILITY_METADATA_KEY
|
|
6417
|
+
} from "@nextclaw/ncp";
|
|
6418
|
+
function buildSubagentCompletionFollowUpMessage(params) {
|
|
6412
6419
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
6413
6420
|
const statusLabel = params.status === "ok" ? "completed" : "failed";
|
|
6414
6421
|
return {
|
|
6415
|
-
id: `${params.sessionId}:
|
|
6422
|
+
id: `${params.sessionId}:system:subagent-follow-up:${timestamp}`,
|
|
6416
6423
|
sessionId: params.sessionId,
|
|
6417
|
-
role: "
|
|
6424
|
+
role: "system",
|
|
6418
6425
|
status: "final",
|
|
6419
6426
|
timestamp,
|
|
6420
6427
|
parts: [
|
|
6421
6428
|
{
|
|
6422
6429
|
type: "text",
|
|
6423
6430
|
text: [
|
|
6424
|
-
`
|
|
6425
|
-
|
|
6426
|
-
|
|
6431
|
+
`[SYSTEM EVENT: SUBAGENT_${params.status === "ok" ? "COMPLETED" : "FAILED"}]`,
|
|
6432
|
+
"This is not a new user message.",
|
|
6433
|
+
"A subagent that you previously spawned for this same conversation has just finished.",
|
|
6434
|
+
`Subagent label: ${params.label}`,
|
|
6435
|
+
`Delegated task: ${params.task}`,
|
|
6436
|
+
`Subagent outcome: ${statusLabel}`,
|
|
6437
|
+
`Subagent result: ${params.result}`,
|
|
6438
|
+
"Your job now is to continue the parent task using this subagent result.",
|
|
6439
|
+
"If the user's request is now complete, answer the user directly.",
|
|
6440
|
+
"If more work is still needed, continue reasoning and use tools.",
|
|
6441
|
+
"Do not say that you received a hidden system event unless the user explicitly asks about internal behavior."
|
|
6427
6442
|
].join("\n\n")
|
|
6428
|
-
},
|
|
6429
|
-
{
|
|
6430
|
-
type: "extension",
|
|
6431
|
-
extensionType: "nextclaw.subagent.completion",
|
|
6432
|
-
data: {
|
|
6433
|
-
label: params.label,
|
|
6434
|
-
task: params.task,
|
|
6435
|
-
result: params.result,
|
|
6436
|
-
status: params.status,
|
|
6437
|
-
completedAt: timestamp
|
|
6438
|
-
}
|
|
6439
6443
|
}
|
|
6440
6444
|
],
|
|
6441
6445
|
metadata: {
|
|
6446
|
+
[NCP_INTERNAL_VISIBILITY_METADATA_KEY]: "hidden",
|
|
6447
|
+
system_event_kind: "subagent_completion_follow_up",
|
|
6442
6448
|
subagent_label: params.label,
|
|
6443
6449
|
subagent_status: params.status,
|
|
6444
6450
|
subagent_task: params.task
|
|
@@ -6446,6 +6452,61 @@ function buildSubagentCompletionMessage(params) {
|
|
|
6446
6452
|
};
|
|
6447
6453
|
}
|
|
6448
6454
|
|
|
6455
|
+
// src/cli/commands/ncp/ncp-subagent-completion-follow-up.ts
|
|
6456
|
+
async function consumeAgentRun(events) {
|
|
6457
|
+
for await (const _event of events) {
|
|
6458
|
+
void _event;
|
|
6459
|
+
}
|
|
6460
|
+
}
|
|
6461
|
+
async function sleep(ms) {
|
|
6462
|
+
await new Promise((resolve16) => setTimeout(resolve16, ms));
|
|
6463
|
+
}
|
|
6464
|
+
async function waitForSessionToBecomeIdle(params) {
|
|
6465
|
+
const timeoutMs = params.timeoutMs ?? 15e3;
|
|
6466
|
+
const intervalMs = params.intervalMs ?? 150;
|
|
6467
|
+
const deadline = Date.now() + timeoutMs;
|
|
6468
|
+
while (Date.now() <= deadline) {
|
|
6469
|
+
const summary = await params.backend.getSession(params.sessionId);
|
|
6470
|
+
if (!summary) {
|
|
6471
|
+
return false;
|
|
6472
|
+
}
|
|
6473
|
+
if (summary.status !== "running") {
|
|
6474
|
+
return true;
|
|
6475
|
+
}
|
|
6476
|
+
await sleep(intervalMs);
|
|
6477
|
+
}
|
|
6478
|
+
return false;
|
|
6479
|
+
}
|
|
6480
|
+
async function persistSubagentCompletionAndResumeParent(params) {
|
|
6481
|
+
const isIdle = await waitForSessionToBecomeIdle({
|
|
6482
|
+
backend: params.backend,
|
|
6483
|
+
sessionId: params.completion.sessionId
|
|
6484
|
+
});
|
|
6485
|
+
if (!isIdle) {
|
|
6486
|
+
return;
|
|
6487
|
+
}
|
|
6488
|
+
if (params.completion.toolCallId?.trim()) {
|
|
6489
|
+
await params.backend.updateToolCallResult(
|
|
6490
|
+
params.completion.sessionId,
|
|
6491
|
+
params.completion.toolCallId.trim(),
|
|
6492
|
+
{
|
|
6493
|
+
kind: "nextclaw.subagent_run",
|
|
6494
|
+
runId: params.completion.runId,
|
|
6495
|
+
label: params.completion.label,
|
|
6496
|
+
task: params.completion.task,
|
|
6497
|
+
status: params.completion.status === "ok" ? "completed" : "failed",
|
|
6498
|
+
result: params.completion.result
|
|
6499
|
+
}
|
|
6500
|
+
);
|
|
6501
|
+
}
|
|
6502
|
+
await consumeAgentRun(
|
|
6503
|
+
params.backend.send({
|
|
6504
|
+
sessionId: params.completion.sessionId,
|
|
6505
|
+
message: buildSubagentCompletionFollowUpMessage(params.completion)
|
|
6506
|
+
})
|
|
6507
|
+
);
|
|
6508
|
+
}
|
|
6509
|
+
|
|
6449
6510
|
// src/cli/commands/ncp/provider-manager-ncp-llm-api.ts
|
|
6450
6511
|
import { parseThinkingLevel as parseThinkingLevel3 } from "@nextclaw/core";
|
|
6451
6512
|
function normalizeModel(value) {
|
|
@@ -6751,16 +6812,18 @@ function createNativeRuntimeFactory(params, mcpToolRegistryAdapter, assetStore,
|
|
|
6751
6812
|
if (!backend) {
|
|
6752
6813
|
throw new Error("NCP backend is not ready for subagent completion persistence.");
|
|
6753
6814
|
}
|
|
6754
|
-
await
|
|
6755
|
-
|
|
6756
|
-
|
|
6815
|
+
await persistSubagentCompletionAndResumeParent({
|
|
6816
|
+
backend,
|
|
6817
|
+
completion: {
|
|
6757
6818
|
sessionId: completion.sessionId,
|
|
6819
|
+
runId: completion.runId,
|
|
6820
|
+
toolCallId: completion.toolCallId,
|
|
6758
6821
|
label: completion.label,
|
|
6759
6822
|
task: completion.task,
|
|
6760
6823
|
result: completion.result,
|
|
6761
6824
|
status: completion.status
|
|
6762
|
-
}
|
|
6763
|
-
);
|
|
6825
|
+
}
|
|
6826
|
+
});
|
|
6764
6827
|
},
|
|
6765
6828
|
getAdditionalTools: (context) => [
|
|
6766
6829
|
...createAssetTools({
|
|
@@ -6892,6 +6955,7 @@ async function createUiNcpAgent(params) {
|
|
|
6892
6955
|
backend = new DefaultNcpAgentBackend({
|
|
6893
6956
|
endpointId: "nextclaw-ui-agent",
|
|
6894
6957
|
sessionStore,
|
|
6958
|
+
onSessionRunStatusChanged: params.onSessionRunStatusChanged,
|
|
6895
6959
|
createRuntime: (runtimeParams) => {
|
|
6896
6960
|
pluginRuntimeRegistrationController.refreshPluginRuntimeRegistrations();
|
|
6897
6961
|
return runtimeRegistry.createRuntime(runtimeParams);
|
|
@@ -8245,6 +8309,12 @@ async function startDeferredGatewayStartup(params) {
|
|
|
8245
8309
|
getConfig: params.getConfig,
|
|
8246
8310
|
getExtensionRegistry: params.getExtensionRegistry,
|
|
8247
8311
|
onSessionUpdated: params.publishSessionChange,
|
|
8312
|
+
onSessionRunStatusChanged: (payload) => {
|
|
8313
|
+
params.uiStartup?.publish({
|
|
8314
|
+
type: "session.run-status",
|
|
8315
|
+
payload
|
|
8316
|
+
});
|
|
8317
|
+
},
|
|
8248
8318
|
resolveMessageToolHints: ({ channel, accountId }) => params.resolveMessageToolHints({ channel, accountId })
|
|
8249
8319
|
})
|
|
8250
8320
|
);
|
|
@@ -8439,30 +8509,63 @@ function createDeferredUiNcpSessionService(fallbackService) {
|
|
|
8439
8509
|
}
|
|
8440
8510
|
|
|
8441
8511
|
// src/cli/commands/service-ncp-session-realtime-bridge.ts
|
|
8512
|
+
function createLatestOnlySessionChangePublisher(publishSessionChange) {
|
|
8513
|
+
const inFlightTasks = /* @__PURE__ */ new Map();
|
|
8514
|
+
const rerunKeys = /* @__PURE__ */ new Set();
|
|
8515
|
+
const flushSessionChange = async (sessionKey) => {
|
|
8516
|
+
do {
|
|
8517
|
+
rerunKeys.delete(sessionKey);
|
|
8518
|
+
await publishSessionChange(sessionKey);
|
|
8519
|
+
} while (rerunKeys.has(sessionKey));
|
|
8520
|
+
};
|
|
8521
|
+
return async (sessionKey) => {
|
|
8522
|
+
const normalizedSessionKey = sessionKey.trim();
|
|
8523
|
+
if (!normalizedSessionKey) {
|
|
8524
|
+
return;
|
|
8525
|
+
}
|
|
8526
|
+
const activeTask = inFlightTasks.get(normalizedSessionKey);
|
|
8527
|
+
if (activeTask) {
|
|
8528
|
+
rerunKeys.add(normalizedSessionKey);
|
|
8529
|
+
await activeTask;
|
|
8530
|
+
return;
|
|
8531
|
+
}
|
|
8532
|
+
const task = flushSessionChange(normalizedSessionKey).finally(() => {
|
|
8533
|
+
if (inFlightTasks.get(normalizedSessionKey) === task) {
|
|
8534
|
+
inFlightTasks.delete(normalizedSessionKey);
|
|
8535
|
+
}
|
|
8536
|
+
});
|
|
8537
|
+
inFlightTasks.set(normalizedSessionKey, task);
|
|
8538
|
+
await task;
|
|
8539
|
+
};
|
|
8540
|
+
}
|
|
8442
8541
|
function createServiceNcpSessionRealtimeBridge(params) {
|
|
8443
8542
|
let publishUiEvent = params.publishUiEvent;
|
|
8444
8543
|
let publishSessionChange = async (_sessionKey) => {
|
|
8445
8544
|
};
|
|
8545
|
+
let scheduleSessionChange = async (_sessionKey) => {
|
|
8546
|
+
};
|
|
8446
8547
|
const persistedSessionService = new UiSessionService(params.sessionManager, {
|
|
8447
8548
|
onSessionUpdated: (sessionKey) => {
|
|
8448
|
-
void
|
|
8549
|
+
void scheduleSessionChange(sessionKey);
|
|
8449
8550
|
}
|
|
8450
8551
|
});
|
|
8451
8552
|
const deferredSessionService = createDeferredUiNcpSessionService(persistedSessionService);
|
|
8452
|
-
|
|
8553
|
+
const publishLatestSessionChange = async (sessionKey) => {
|
|
8453
8554
|
await createNcpSessionRealtimeChangePublisher({
|
|
8454
8555
|
sessionApi: deferredSessionService.service,
|
|
8455
8556
|
publishUiEvent
|
|
8456
8557
|
}).publishSessionChange(sessionKey);
|
|
8457
8558
|
};
|
|
8559
|
+
scheduleSessionChange = createLatestOnlySessionChangePublisher(publishLatestSessionChange);
|
|
8560
|
+
publishSessionChange = scheduleSessionChange;
|
|
8458
8561
|
return {
|
|
8459
8562
|
sessionService: deferredSessionService.service,
|
|
8460
8563
|
deferredSessionService,
|
|
8461
8564
|
publishSessionChange,
|
|
8462
|
-
setUiEventPublisher(nextPublishUiEvent) {
|
|
8565
|
+
setUiEventPublisher: (nextPublishUiEvent) => {
|
|
8463
8566
|
publishUiEvent = nextPublishUiEvent;
|
|
8464
8567
|
},
|
|
8465
|
-
clear() {
|
|
8568
|
+
clear: () => {
|
|
8466
8569
|
deferredSessionService.clear();
|
|
8467
8570
|
}
|
|
8468
8571
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextclaw",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.26",
|
|
4
4
|
"description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"chokidar": "^3.6.0",
|
|
40
40
|
"commander": "^12.1.0",
|
|
41
41
|
"yaml": "^2.8.1",
|
|
42
|
-
"@nextclaw/
|
|
43
|
-
"@nextclaw/ncp-agent-runtime": "0.3.
|
|
44
|
-
"@nextclaw/
|
|
45
|
-
"@nextclaw/
|
|
46
|
-
"@nextclaw/
|
|
47
|
-
"@nextclaw/
|
|
48
|
-
"@nextclaw/
|
|
49
|
-
"@nextclaw/
|
|
50
|
-
"@nextclaw/
|
|
51
|
-
"@nextclaw/
|
|
42
|
+
"@nextclaw/ncp": "0.4.2",
|
|
43
|
+
"@nextclaw/ncp-agent-runtime": "0.3.2",
|
|
44
|
+
"@nextclaw/core": "0.11.11",
|
|
45
|
+
"@nextclaw/mcp": "0.1.58",
|
|
46
|
+
"@nextclaw/remote": "0.1.69",
|
|
47
|
+
"@nextclaw/ncp-mcp": "0.1.59",
|
|
48
|
+
"@nextclaw/openclaw-compat": "0.3.51",
|
|
49
|
+
"@nextclaw/server": "0.11.17",
|
|
50
|
+
"@nextclaw/ncp-toolkit": "0.4.10",
|
|
51
|
+
"@nextclaw/runtime": "0.2.25"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^20.17.6",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"tsx": "^4.19.2",
|
|
58
58
|
"typescript": "^5.6.3",
|
|
59
59
|
"vitest": "^2.1.2",
|
|
60
|
-
"@nextclaw/ui": "0.11.
|
|
60
|
+
"@nextclaw/ui": "0.11.16"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"dev": "tsx watch --tsconfig tsconfig.json src/cli/index.ts",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as L,j as u,X as It,K as Pt,aw as Bt,b0 as Tt,b1 as Mt,b2 as Rt,a0 as Lt,g as ut,f as kt,b3 as Me,ae as Re,b4 as Dt,aj as dt,e as q,a3 as Ft,i as Ut,G as qt,H as _t}from"./vendor-MCpnpiKt.js";import{W as zt,t as c,c as K,I as Q,S as Ot,e as Ht,f as Kt,g as Jt,h as Vt,Y as ft,B as je,i as Gt,u as gt,a as ht,b as mt,Z as Yt,_ as Qt}from"./index-BvCYcN48.js";import{S as pt}from"./status-dot-DLk8UxLB.js";import{L as yt}from"./LogoBadge-DZL-zQTr.js";import{h as Se}from"./config-hints-CApS3K_7.js";import{c as Wt,b as Zt,a as Xt,C as $t}from"./config-layout-BHnOoweL.js";import{L as en}from"./label-AurG3ZpO.js";import{S as tn}from"./switch-BxMSKsQS.js";import{T as nn}from"./tabs-custom-B6gK-RY6.js";import{P as rn,a as sn}from"./page-layout-Q2hHkfJy.js";function bt(e){var n,t;const s=zt();return((n=e.tutorialUrls)==null?void 0:n[s])||((t=e.tutorialUrls)==null?void 0:t.default)||e.tutorialUrl}const an={telegram:"telegram.svg",slack:"slack.svg",discord:"discord.svg",whatsapp:"whatsapp.svg",qq:"qq.svg",feishu:"feishu.svg",dingtalk:"dingtalk.svg",wecom:"wecom.svg",weixin:"weixin.svg",mochat:"mochat.svg",email:"email.svg"};function on(e,s){const a=s.toLowerCase(),n=e[a];return n?`/logos/${n}`:null}function wt(e){return on(an,e)}function ln({value:e,onChange:s,className:a,placeholder:n=""}){const[t,r]=L.useState(""),i=l=>{l.key==="Enter"&&t.trim()?(l.preventDefault(),s([...e,t.trim()]),r("")):l.key==="Backspace"&&!t&&e.length>0&&s(e.slice(0,-1))},o=l=>{s(e.filter((d,h)=>h!==l))};return u.jsxs("div",{className:K("flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]",a),children:[e.map((l,d)=>u.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm",children:[l,u.jsx("button",{type:"button",onClick:()=>o(d),className:"hover:text-red-300 transition-colors",children:u.jsx(It,{className:"h-3 w-3"})})]},d)),u.jsx("input",{type:"text",value:t,onChange:l=>r(l.target.value),onKeyDown:i,className:"flex-1 outline-none min-w-[100px] bg-transparent text-sm",placeholder:n||c("enterTag")})]})}function cn(e){return e.includes("token")||e.includes("secret")||e.includes("password")?u.jsx(Pt,{className:"h-3.5 w-3.5 text-gray-500"}):e.includes("url")||e.includes("host")?u.jsx(Bt,{className:"h-3.5 w-3.5 text-gray-500"}):e.includes("email")||e.includes("mail")?u.jsx(Tt,{className:"h-3.5 w-3.5 text-gray-500"}):e.includes("id")||e.includes("from")?u.jsx(Mt,{className:"h-3.5 w-3.5 text-gray-500"}):e==="enabled"||e==="consentGranted"?u.jsx(Rt,{className:"h-3.5 w-3.5 text-gray-500"}):u.jsx(Lt,{className:"h-3.5 w-3.5 text-gray-500"})}function Le({channelName:e,fields:s,formData:a,jsonDrafts:n,setJsonDrafts:t,updateField:r,uiHints:i}){return u.jsx(u.Fragment,{children:s.map(o=>{const l=Se(`channels.${e}.${o.name}`,i),d=(l==null?void 0:l.label)??o.label,h=l==null?void 0:l.placeholder;return u.jsxs("div",{className:"space-y-2.5",children:[u.jsxs(en,{htmlFor:o.name,className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[cn(o.name),d]}),o.type==="boolean"&&u.jsxs("div",{className:"flex items-center justify-between rounded-xl bg-gray-50 p-3",children:[u.jsx("span",{className:"text-sm text-gray-500",children:a[o.name]?c("enabled"):c("disabled")}),u.jsx(tn,{id:o.name,checked:a[o.name]||!1,onCheckedChange:f=>r(o.name,f),className:"data-[state=checked]:bg-emerald-500"})]}),(o.type==="text"||o.type==="email")&&u.jsx(Q,{id:o.name,type:o.type,value:a[o.name]||"",onChange:f=>r(o.name,f.target.value),placeholder:h,className:"rounded-xl"}),o.type==="password"&&u.jsx(Q,{id:o.name,type:"password",value:a[o.name]||"",onChange:f=>r(o.name,f.target.value),placeholder:h??c("leaveBlankToKeepUnchanged"),className:"rounded-xl"}),o.type==="number"&&u.jsx(Q,{id:o.name,type:"number",value:a[o.name]||0,onChange:f=>r(o.name,parseInt(f.target.value,10)||0),placeholder:h,className:"rounded-xl"}),o.type==="tags"&&u.jsx(ln,{value:a[o.name]||[],onChange:f=>r(o.name,f)}),o.type==="select"&&u.jsxs(Ot,{value:a[o.name]||"",onValueChange:f=>r(o.name,f),children:[u.jsx(Ht,{className:"rounded-xl",children:u.jsx(Kt,{})}),u.jsx(Jt,{children:(o.options??[]).map(f=>u.jsx(Vt,{value:f.value,children:f.label},f.value))})]}),o.type==="json"&&u.jsx("textarea",{id:o.name,value:n[o.name]??"{}",onChange:f=>t(x=>({...x,[o.name]:f.target.value})),className:"min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono"})]},o.name)})})}const te=[{value:"pairing",label:"pairing"},{value:"allowlist",label:"allowlist"},{value:"open",label:"open"},{value:"disabled",label:"disabled"}],ne=[{value:"open",label:"open"},{value:"allowlist",label:"allowlist"},{value:"disabled",label:"disabled"}],un=[{value:"off",label:"off"},{value:"partial",label:"partial"},{value:"block",label:"block"},{value:"progress",label:"progress"}];function ke(){return{telegram:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"token",type:"password",label:c("botToken")},{name:"allowFrom",type:"tags",label:c("allowFrom")},{name:"proxy",type:"text",label:c("proxy")},{name:"accountId",type:"text",label:c("accountId")},{name:"dmPolicy",type:"select",label:c("dmPolicy"),options:te},{name:"groupPolicy",type:"select",label:c("groupPolicy"),options:ne},{name:"groupAllowFrom",type:"tags",label:c("groupAllowFrom")},{name:"requireMention",type:"boolean",label:c("requireMention")},{name:"mentionPatterns",type:"tags",label:c("mentionPatterns")},{name:"groups",type:"json",label:c("groupRulesJson")}],discord:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"token",type:"password",label:c("botToken")},{name:"allowBots",type:"boolean",label:c("allowBotMessages")},{name:"allowFrom",type:"tags",label:c("allowFrom")},{name:"gatewayUrl",type:"text",label:c("gatewayUrl")},{name:"intents",type:"number",label:c("intents")},{name:"proxy",type:"text",label:c("proxy")},{name:"mediaMaxMb",type:"number",label:c("attachmentMaxSizeMb")},{name:"streaming",type:"select",label:c("streamingMode"),options:un},{name:"draftChunk",type:"json",label:c("draftChunkingJson")},{name:"textChunkLimit",type:"number",label:c("textChunkLimit")},{name:"accountId",type:"text",label:c("accountId")},{name:"dmPolicy",type:"select",label:c("dmPolicy"),options:te},{name:"groupPolicy",type:"select",label:c("groupPolicy"),options:ne},{name:"groupAllowFrom",type:"tags",label:c("groupAllowFrom")},{name:"requireMention",type:"boolean",label:c("requireMention")},{name:"mentionPatterns",type:"tags",label:c("mentionPatterns")},{name:"groups",type:"json",label:c("groupRulesJson")}],whatsapp:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"bridgeUrl",type:"text",label:c("bridgeUrl")},{name:"allowFrom",type:"tags",label:c("allowFrom")}],feishu:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"appId",type:"text",label:c("appId")},{name:"appSecret",type:"password",label:c("appSecret")},{name:"encryptKey",type:"password",label:c("encryptKey")},{name:"verificationToken",type:"password",label:c("verificationToken")},{name:"domain",type:"text",label:"Domain"},{name:"allowFrom",type:"tags",label:c("allowFrom")},{name:"dmPolicy",type:"select",label:c("dmPolicy"),options:te},{name:"groupPolicy",type:"select",label:c("groupPolicy"),options:ne},{name:"groupAllowFrom",type:"tags",label:c("groupAllowFrom")},{name:"requireMention",type:"boolean",label:c("requireMention")},{name:"mentionPatterns",type:"tags",label:c("mentionPatterns")},{name:"groups",type:"json",label:c("groupRulesJson")},{name:"accounts",type:"json",label:c("accountsJson")}],dingtalk:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"clientId",type:"text",label:c("clientId")},{name:"clientSecret",type:"password",label:c("clientSecret")},{name:"allowFrom",type:"tags",label:c("allowFrom")}],wecom:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"corpId",type:"text",label:c("corpId")},{name:"agentId",type:"text",label:c("agentId")},{name:"secret",type:"password",label:c("secret")},{name:"token",type:"password",label:c("token")},{name:"callbackPort",type:"number",label:c("callbackPort")},{name:"callbackPath",type:"text",label:c("callbackPath")},{name:"allowFrom",type:"tags",label:c("allowFrom")}],weixin:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"defaultAccountId",type:"text",label:c("defaultAccountId")},{name:"baseUrl",type:"text",label:c("baseUrl")},{name:"pollTimeoutMs",type:"number",label:c("pollTimeoutMs")},{name:"allowFrom",type:"tags",label:c("allowFrom")},{name:"accounts",type:"json",label:c("accountsJson")}],slack:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"mode",type:"text",label:c("mode")},{name:"webhookPath",type:"text",label:c("webhookPath")},{name:"allowBots",type:"boolean",label:c("allowBotMessages")},{name:"botToken",type:"password",label:c("botToken")},{name:"appToken",type:"password",label:c("appToken")}],email:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"consentGranted",type:"boolean",label:c("consentGranted")},{name:"imapHost",type:"text",label:c("imapHost")},{name:"imapPort",type:"number",label:c("imapPort")},{name:"imapUsername",type:"text",label:c("imapUsername")},{name:"imapPassword",type:"password",label:c("imapPassword")},{name:"fromAddress",type:"email",label:c("fromAddress")}],mochat:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"baseUrl",type:"text",label:c("baseUrl")},{name:"clawToken",type:"password",label:c("clawToken")},{name:"agentUserId",type:"text",label:c("agentUserId")},{name:"allowFrom",type:"tags",label:c("allowFrom")}],qq:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"appId",type:"text",label:c("appId")},{name:"secret",type:"password",label:c("appSecret")},{name:"markdownSupport",type:"boolean",label:c("markdownSupport")},{name:"allowFrom",type:"tags",label:c("allowFrom")}]}}var H={},re,De;function dn(){return De||(De=1,re=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),re}var se={},U={},Fe;function _(){if(Fe)return U;Fe=1;let e;const s=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return U.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},U.getSymbolTotalCodewords=function(n){return s[n]},U.getBCHDigit=function(a){let n=0;for(;a!==0;)n++,a>>>=1;return n},U.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},U.isKanjiModeEnabled=function(){return typeof e<"u"},U.toSJIS=function(n){return e(n)},U}var ae={},Ue;function Ie(){return Ue||(Ue=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function s(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+a)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,t){if(e.isValid(n))return n;try{return s(n)}catch{return t}}})(ae)),ae}var oe,qe;function fn(){if(qe)return oe;qe=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(s){const a=Math.floor(s/8);return(this.buffer[a]>>>7-s%8&1)===1},put:function(s,a){for(let n=0;n<a;n++)this.putBit((s>>>a-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(s){const a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),s&&(this.buffer[a]|=128>>>this.length%8),this.length++}},oe=e,oe}var ie,_e;function gn(){if(_e)return ie;_e=1;function e(s){if(!s||s<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=s,this.data=new Uint8Array(s*s),this.reservedBit=new Uint8Array(s*s)}return e.prototype.set=function(s,a,n,t){const r=s*this.size+a;this.data[r]=n,t&&(this.reservedBit[r]=!0)},e.prototype.get=function(s,a){return this.data[s*this.size+a]},e.prototype.xor=function(s,a,n){this.data[s*this.size+a]^=n},e.prototype.isReserved=function(s,a){return this.reservedBit[s*this.size+a]},ie=e,ie}var le={},ze;function hn(){return ze||(ze=1,(function(e){const s=_().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const t=Math.floor(n/7)+2,r=s(n),i=r===145?26:Math.ceil((r-13)/(2*t-2))*2,o=[r-7];for(let l=1;l<t-1;l++)o[l]=o[l-1]-i;return o.push(6),o.reverse()},e.getPositions=function(n){const t=[],r=e.getRowColCoords(n),i=r.length;for(let o=0;o<i;o++)for(let l=0;l<i;l++)o===0&&l===0||o===0&&l===i-1||o===i-1&&l===0||t.push([r[o],r[l]]);return t}})(le)),le}var ce={},Oe;function mn(){if(Oe)return ce;Oe=1;const e=_().getSymbolSize,s=7;return ce.getPositions=function(n){const t=e(n);return[[0,0],[t-s,0],[0,t-s]]},ce}var ue={},He;function pn(){return He||(He=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const s={N1:3,N2:3,N3:40,N4:10};e.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(t){const r=t.size;let i=0,o=0,l=0,d=null,h=null;for(let f=0;f<r;f++){o=l=0,d=h=null;for(let x=0;x<r;x++){let g=t.get(f,x);g===d?o++:(o>=5&&(i+=s.N1+(o-5)),d=g,o=1),g=t.get(x,f),g===h?l++:(l>=5&&(i+=s.N1+(l-5)),h=g,l=1)}o>=5&&(i+=s.N1+(o-5)),l>=5&&(i+=s.N1+(l-5))}return i},e.getPenaltyN2=function(t){const r=t.size;let i=0;for(let o=0;o<r-1;o++)for(let l=0;l<r-1;l++){const d=t.get(o,l)+t.get(o,l+1)+t.get(o+1,l)+t.get(o+1,l+1);(d===4||d===0)&&i++}return i*s.N2},e.getPenaltyN3=function(t){const r=t.size;let i=0,o=0,l=0;for(let d=0;d<r;d++){o=l=0;for(let h=0;h<r;h++)o=o<<1&2047|t.get(d,h),h>=10&&(o===1488||o===93)&&i++,l=l<<1&2047|t.get(h,d),h>=10&&(l===1488||l===93)&&i++}return i*s.N3},e.getPenaltyN4=function(t){let r=0;const i=t.data.length;for(let l=0;l<i;l++)r+=t.data[l];return Math.abs(Math.ceil(r*100/i/5)-10)*s.N4};function a(n,t,r){switch(n){case e.Patterns.PATTERN000:return(t+r)%2===0;case e.Patterns.PATTERN001:return t%2===0;case e.Patterns.PATTERN010:return r%3===0;case e.Patterns.PATTERN011:return(t+r)%3===0;case e.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case e.Patterns.PATTERN101:return t*r%2+t*r%3===0;case e.Patterns.PATTERN110:return(t*r%2+t*r%3)%2===0;case e.Patterns.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(t,r){const i=r.size;for(let o=0;o<i;o++)for(let l=0;l<i;l++)r.isReserved(l,o)||r.xor(l,o,a(t,l,o))},e.getBestMask=function(t,r){const i=Object.keys(e.Patterns).length;let o=0,l=1/0;for(let d=0;d<i;d++){r(d),e.applyMask(d,t);const h=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(d,t),h<l&&(l=h,o=d)}return o}})(ue)),ue}var Y={},Ke;function xt(){if(Ke)return Y;Ke=1;const e=Ie(),s=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],a=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Y.getBlocksCount=function(t,r){switch(r){case e.L:return s[(t-1)*4+0];case e.M:return s[(t-1)*4+1];case e.Q:return s[(t-1)*4+2];case e.H:return s[(t-1)*4+3];default:return}},Y.getTotalCodewordsCount=function(t,r){switch(r){case e.L:return a[(t-1)*4+0];case e.M:return a[(t-1)*4+1];case e.Q:return a[(t-1)*4+2];case e.H:return a[(t-1)*4+3];default:return}},Y}var de={},V={},Je;function yn(){if(Je)return V;Je=1;const e=new Uint8Array(512),s=new Uint8Array(256);return(function(){let n=1;for(let t=0;t<255;t++)e[t]=n,s[n]=t,n<<=1,n&256&&(n^=285);for(let t=255;t<512;t++)e[t]=e[t-255]})(),V.log=function(n){if(n<1)throw new Error("log("+n+")");return s[n]},V.exp=function(n){return e[n]},V.mul=function(n,t){return n===0||t===0?0:e[s[n]+s[t]]},V}var Ve;function bn(){return Ve||(Ve=1,(function(e){const s=yn();e.mul=function(n,t){const r=new Uint8Array(n.length+t.length-1);for(let i=0;i<n.length;i++)for(let o=0;o<t.length;o++)r[i+o]^=s.mul(n[i],t[o]);return r},e.mod=function(n,t){let r=new Uint8Array(n);for(;r.length-t.length>=0;){const i=r[0];for(let l=0;l<t.length;l++)r[l]^=s.mul(t[l],i);let o=0;for(;o<r.length&&r[o]===0;)o++;r=r.slice(o)}return r},e.generateECPolynomial=function(n){let t=new Uint8Array([1]);for(let r=0;r<n;r++)t=e.mul(t,new Uint8Array([1,s.exp(r)]));return t}})(de)),de}var fe,Ge;function wn(){if(Ge)return fe;Ge=1;const e=bn();function s(a){this.genPoly=void 0,this.degree=a,this.degree&&this.initialize(this.degree)}return s.prototype.initialize=function(n){this.degree=n,this.genPoly=e.generateECPolynomial(this.degree)},s.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(n.length+this.degree);t.set(n);const r=e.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){const o=new Uint8Array(this.degree);return o.set(r,i),o}return r},fe=s,fe}var ge={},he={},me={},Ye;function Ct(){return Ye||(Ye=1,me.isValid=function(s){return!isNaN(s)&&s>=1&&s<=40}),me}var k={},Qe;function At(){if(Qe)return k;Qe=1;const e="[0-9]+",s="[A-Z $%*+\\-./:]+";let a="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";a=a.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+a+`)(?:.|[\r
|
|
1
|
+
import{r as L,j as u,X as It,K as Pt,aw as Bt,b0 as Tt,b1 as Mt,b2 as Rt,a0 as Lt,g as ut,f as kt,b3 as Me,ae as Re,b4 as Dt,aj as dt,e as q,a3 as Ft,i as Ut,G as qt,H as _t}from"./vendor-MCpnpiKt.js";import{W as zt,t as c,c as K,I as Q,S as Ot,e as Ht,f as Kt,g as Jt,h as Vt,Y as ft,B as je,i as Gt,u as gt,a as ht,b as mt,Z as Yt,_ as Qt}from"./index-DqzLj8Sw.js";import{S as pt}from"./status-dot-BOzEprxw.js";import{L as yt}from"./LogoBadge-CsSBHZeV.js";import{h as Se}from"./config-hints-CApS3K_7.js";import{c as Wt,b as Zt,a as Xt,C as $t}from"./config-layout-BHnOoweL.js";import{L as en}from"./label-DPGDZvhm.js";import{S as tn}from"./switch-rE_Ew8fl.js";import{T as nn}from"./tabs-custom-BkfMUTHE.js";import{P as rn,a as sn}from"./page-layout-DMA_ZiHj.js";function bt(e){var n,t;const s=zt();return((n=e.tutorialUrls)==null?void 0:n[s])||((t=e.tutorialUrls)==null?void 0:t.default)||e.tutorialUrl}const an={telegram:"telegram.svg",slack:"slack.svg",discord:"discord.svg",whatsapp:"whatsapp.svg",qq:"qq.svg",feishu:"feishu.svg",dingtalk:"dingtalk.svg",wecom:"wecom.svg",weixin:"weixin.svg",mochat:"mochat.svg",email:"email.svg"};function on(e,s){const a=s.toLowerCase(),n=e[a];return n?`/logos/${n}`:null}function wt(e){return on(an,e)}function ln({value:e,onChange:s,className:a,placeholder:n=""}){const[t,r]=L.useState(""),i=l=>{l.key==="Enter"&&t.trim()?(l.preventDefault(),s([...e,t.trim()]),r("")):l.key==="Backspace"&&!t&&e.length>0&&s(e.slice(0,-1))},o=l=>{s(e.filter((d,h)=>h!==l))};return u.jsxs("div",{className:K("flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]",a),children:[e.map((l,d)=>u.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm",children:[l,u.jsx("button",{type:"button",onClick:()=>o(d),className:"hover:text-red-300 transition-colors",children:u.jsx(It,{className:"h-3 w-3"})})]},d)),u.jsx("input",{type:"text",value:t,onChange:l=>r(l.target.value),onKeyDown:i,className:"flex-1 outline-none min-w-[100px] bg-transparent text-sm",placeholder:n||c("enterTag")})]})}function cn(e){return e.includes("token")||e.includes("secret")||e.includes("password")?u.jsx(Pt,{className:"h-3.5 w-3.5 text-gray-500"}):e.includes("url")||e.includes("host")?u.jsx(Bt,{className:"h-3.5 w-3.5 text-gray-500"}):e.includes("email")||e.includes("mail")?u.jsx(Tt,{className:"h-3.5 w-3.5 text-gray-500"}):e.includes("id")||e.includes("from")?u.jsx(Mt,{className:"h-3.5 w-3.5 text-gray-500"}):e==="enabled"||e==="consentGranted"?u.jsx(Rt,{className:"h-3.5 w-3.5 text-gray-500"}):u.jsx(Lt,{className:"h-3.5 w-3.5 text-gray-500"})}function Le({channelName:e,fields:s,formData:a,jsonDrafts:n,setJsonDrafts:t,updateField:r,uiHints:i}){return u.jsx(u.Fragment,{children:s.map(o=>{const l=Se(`channels.${e}.${o.name}`,i),d=(l==null?void 0:l.label)??o.label,h=l==null?void 0:l.placeholder;return u.jsxs("div",{className:"space-y-2.5",children:[u.jsxs(en,{htmlFor:o.name,className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[cn(o.name),d]}),o.type==="boolean"&&u.jsxs("div",{className:"flex items-center justify-between rounded-xl bg-gray-50 p-3",children:[u.jsx("span",{className:"text-sm text-gray-500",children:a[o.name]?c("enabled"):c("disabled")}),u.jsx(tn,{id:o.name,checked:a[o.name]||!1,onCheckedChange:f=>r(o.name,f),className:"data-[state=checked]:bg-emerald-500"})]}),(o.type==="text"||o.type==="email")&&u.jsx(Q,{id:o.name,type:o.type,value:a[o.name]||"",onChange:f=>r(o.name,f.target.value),placeholder:h,className:"rounded-xl"}),o.type==="password"&&u.jsx(Q,{id:o.name,type:"password",value:a[o.name]||"",onChange:f=>r(o.name,f.target.value),placeholder:h??c("leaveBlankToKeepUnchanged"),className:"rounded-xl"}),o.type==="number"&&u.jsx(Q,{id:o.name,type:"number",value:a[o.name]||0,onChange:f=>r(o.name,parseInt(f.target.value,10)||0),placeholder:h,className:"rounded-xl"}),o.type==="tags"&&u.jsx(ln,{value:a[o.name]||[],onChange:f=>r(o.name,f)}),o.type==="select"&&u.jsxs(Ot,{value:a[o.name]||"",onValueChange:f=>r(o.name,f),children:[u.jsx(Ht,{className:"rounded-xl",children:u.jsx(Kt,{})}),u.jsx(Jt,{children:(o.options??[]).map(f=>u.jsx(Vt,{value:f.value,children:f.label},f.value))})]}),o.type==="json"&&u.jsx("textarea",{id:o.name,value:n[o.name]??"{}",onChange:f=>t(x=>({...x,[o.name]:f.target.value})),className:"min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono"})]},o.name)})})}const te=[{value:"pairing",label:"pairing"},{value:"allowlist",label:"allowlist"},{value:"open",label:"open"},{value:"disabled",label:"disabled"}],ne=[{value:"open",label:"open"},{value:"allowlist",label:"allowlist"},{value:"disabled",label:"disabled"}],un=[{value:"off",label:"off"},{value:"partial",label:"partial"},{value:"block",label:"block"},{value:"progress",label:"progress"}];function ke(){return{telegram:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"token",type:"password",label:c("botToken")},{name:"allowFrom",type:"tags",label:c("allowFrom")},{name:"proxy",type:"text",label:c("proxy")},{name:"accountId",type:"text",label:c("accountId")},{name:"dmPolicy",type:"select",label:c("dmPolicy"),options:te},{name:"groupPolicy",type:"select",label:c("groupPolicy"),options:ne},{name:"groupAllowFrom",type:"tags",label:c("groupAllowFrom")},{name:"requireMention",type:"boolean",label:c("requireMention")},{name:"mentionPatterns",type:"tags",label:c("mentionPatterns")},{name:"groups",type:"json",label:c("groupRulesJson")}],discord:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"token",type:"password",label:c("botToken")},{name:"allowBots",type:"boolean",label:c("allowBotMessages")},{name:"allowFrom",type:"tags",label:c("allowFrom")},{name:"gatewayUrl",type:"text",label:c("gatewayUrl")},{name:"intents",type:"number",label:c("intents")},{name:"proxy",type:"text",label:c("proxy")},{name:"mediaMaxMb",type:"number",label:c("attachmentMaxSizeMb")},{name:"streaming",type:"select",label:c("streamingMode"),options:un},{name:"draftChunk",type:"json",label:c("draftChunkingJson")},{name:"textChunkLimit",type:"number",label:c("textChunkLimit")},{name:"accountId",type:"text",label:c("accountId")},{name:"dmPolicy",type:"select",label:c("dmPolicy"),options:te},{name:"groupPolicy",type:"select",label:c("groupPolicy"),options:ne},{name:"groupAllowFrom",type:"tags",label:c("groupAllowFrom")},{name:"requireMention",type:"boolean",label:c("requireMention")},{name:"mentionPatterns",type:"tags",label:c("mentionPatterns")},{name:"groups",type:"json",label:c("groupRulesJson")}],whatsapp:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"bridgeUrl",type:"text",label:c("bridgeUrl")},{name:"allowFrom",type:"tags",label:c("allowFrom")}],feishu:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"appId",type:"text",label:c("appId")},{name:"appSecret",type:"password",label:c("appSecret")},{name:"encryptKey",type:"password",label:c("encryptKey")},{name:"verificationToken",type:"password",label:c("verificationToken")},{name:"domain",type:"text",label:"Domain"},{name:"allowFrom",type:"tags",label:c("allowFrom")},{name:"dmPolicy",type:"select",label:c("dmPolicy"),options:te},{name:"groupPolicy",type:"select",label:c("groupPolicy"),options:ne},{name:"groupAllowFrom",type:"tags",label:c("groupAllowFrom")},{name:"requireMention",type:"boolean",label:c("requireMention")},{name:"mentionPatterns",type:"tags",label:c("mentionPatterns")},{name:"groups",type:"json",label:c("groupRulesJson")},{name:"accounts",type:"json",label:c("accountsJson")}],dingtalk:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"clientId",type:"text",label:c("clientId")},{name:"clientSecret",type:"password",label:c("clientSecret")},{name:"allowFrom",type:"tags",label:c("allowFrom")}],wecom:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"corpId",type:"text",label:c("corpId")},{name:"agentId",type:"text",label:c("agentId")},{name:"secret",type:"password",label:c("secret")},{name:"token",type:"password",label:c("token")},{name:"callbackPort",type:"number",label:c("callbackPort")},{name:"callbackPath",type:"text",label:c("callbackPath")},{name:"allowFrom",type:"tags",label:c("allowFrom")}],weixin:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"defaultAccountId",type:"text",label:c("defaultAccountId")},{name:"baseUrl",type:"text",label:c("baseUrl")},{name:"pollTimeoutMs",type:"number",label:c("pollTimeoutMs")},{name:"allowFrom",type:"tags",label:c("allowFrom")},{name:"accounts",type:"json",label:c("accountsJson")}],slack:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"mode",type:"text",label:c("mode")},{name:"webhookPath",type:"text",label:c("webhookPath")},{name:"allowBots",type:"boolean",label:c("allowBotMessages")},{name:"botToken",type:"password",label:c("botToken")},{name:"appToken",type:"password",label:c("appToken")}],email:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"consentGranted",type:"boolean",label:c("consentGranted")},{name:"imapHost",type:"text",label:c("imapHost")},{name:"imapPort",type:"number",label:c("imapPort")},{name:"imapUsername",type:"text",label:c("imapUsername")},{name:"imapPassword",type:"password",label:c("imapPassword")},{name:"fromAddress",type:"email",label:c("fromAddress")}],mochat:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"baseUrl",type:"text",label:c("baseUrl")},{name:"clawToken",type:"password",label:c("clawToken")},{name:"agentUserId",type:"text",label:c("agentUserId")},{name:"allowFrom",type:"tags",label:c("allowFrom")}],qq:[{name:"enabled",type:"boolean",label:c("enabled")},{name:"appId",type:"text",label:c("appId")},{name:"secret",type:"password",label:c("appSecret")},{name:"markdownSupport",type:"boolean",label:c("markdownSupport")},{name:"allowFrom",type:"tags",label:c("allowFrom")}]}}var H={},re,De;function dn(){return De||(De=1,re=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),re}var se={},U={},Fe;function _(){if(Fe)return U;Fe=1;let e;const s=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return U.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},U.getSymbolTotalCodewords=function(n){return s[n]},U.getBCHDigit=function(a){let n=0;for(;a!==0;)n++,a>>>=1;return n},U.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},U.isKanjiModeEnabled=function(){return typeof e<"u"},U.toSJIS=function(n){return e(n)},U}var ae={},Ue;function Ie(){return Ue||(Ue=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function s(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+a)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,t){if(e.isValid(n))return n;try{return s(n)}catch{return t}}})(ae)),ae}var oe,qe;function fn(){if(qe)return oe;qe=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(s){const a=Math.floor(s/8);return(this.buffer[a]>>>7-s%8&1)===1},put:function(s,a){for(let n=0;n<a;n++)this.putBit((s>>>a-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(s){const a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),s&&(this.buffer[a]|=128>>>this.length%8),this.length++}},oe=e,oe}var ie,_e;function gn(){if(_e)return ie;_e=1;function e(s){if(!s||s<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=s,this.data=new Uint8Array(s*s),this.reservedBit=new Uint8Array(s*s)}return e.prototype.set=function(s,a,n,t){const r=s*this.size+a;this.data[r]=n,t&&(this.reservedBit[r]=!0)},e.prototype.get=function(s,a){return this.data[s*this.size+a]},e.prototype.xor=function(s,a,n){this.data[s*this.size+a]^=n},e.prototype.isReserved=function(s,a){return this.reservedBit[s*this.size+a]},ie=e,ie}var le={},ze;function hn(){return ze||(ze=1,(function(e){const s=_().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const t=Math.floor(n/7)+2,r=s(n),i=r===145?26:Math.ceil((r-13)/(2*t-2))*2,o=[r-7];for(let l=1;l<t-1;l++)o[l]=o[l-1]-i;return o.push(6),o.reverse()},e.getPositions=function(n){const t=[],r=e.getRowColCoords(n),i=r.length;for(let o=0;o<i;o++)for(let l=0;l<i;l++)o===0&&l===0||o===0&&l===i-1||o===i-1&&l===0||t.push([r[o],r[l]]);return t}})(le)),le}var ce={},Oe;function mn(){if(Oe)return ce;Oe=1;const e=_().getSymbolSize,s=7;return ce.getPositions=function(n){const t=e(n);return[[0,0],[t-s,0],[0,t-s]]},ce}var ue={},He;function pn(){return He||(He=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const s={N1:3,N2:3,N3:40,N4:10};e.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(t){const r=t.size;let i=0,o=0,l=0,d=null,h=null;for(let f=0;f<r;f++){o=l=0,d=h=null;for(let x=0;x<r;x++){let g=t.get(f,x);g===d?o++:(o>=5&&(i+=s.N1+(o-5)),d=g,o=1),g=t.get(x,f),g===h?l++:(l>=5&&(i+=s.N1+(l-5)),h=g,l=1)}o>=5&&(i+=s.N1+(o-5)),l>=5&&(i+=s.N1+(l-5))}return i},e.getPenaltyN2=function(t){const r=t.size;let i=0;for(let o=0;o<r-1;o++)for(let l=0;l<r-1;l++){const d=t.get(o,l)+t.get(o,l+1)+t.get(o+1,l)+t.get(o+1,l+1);(d===4||d===0)&&i++}return i*s.N2},e.getPenaltyN3=function(t){const r=t.size;let i=0,o=0,l=0;for(let d=0;d<r;d++){o=l=0;for(let h=0;h<r;h++)o=o<<1&2047|t.get(d,h),h>=10&&(o===1488||o===93)&&i++,l=l<<1&2047|t.get(h,d),h>=10&&(l===1488||l===93)&&i++}return i*s.N3},e.getPenaltyN4=function(t){let r=0;const i=t.data.length;for(let l=0;l<i;l++)r+=t.data[l];return Math.abs(Math.ceil(r*100/i/5)-10)*s.N4};function a(n,t,r){switch(n){case e.Patterns.PATTERN000:return(t+r)%2===0;case e.Patterns.PATTERN001:return t%2===0;case e.Patterns.PATTERN010:return r%3===0;case e.Patterns.PATTERN011:return(t+r)%3===0;case e.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case e.Patterns.PATTERN101:return t*r%2+t*r%3===0;case e.Patterns.PATTERN110:return(t*r%2+t*r%3)%2===0;case e.Patterns.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(t,r){const i=r.size;for(let o=0;o<i;o++)for(let l=0;l<i;l++)r.isReserved(l,o)||r.xor(l,o,a(t,l,o))},e.getBestMask=function(t,r){const i=Object.keys(e.Patterns).length;let o=0,l=1/0;for(let d=0;d<i;d++){r(d),e.applyMask(d,t);const h=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(d,t),h<l&&(l=h,o=d)}return o}})(ue)),ue}var Y={},Ke;function xt(){if(Ke)return Y;Ke=1;const e=Ie(),s=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],a=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Y.getBlocksCount=function(t,r){switch(r){case e.L:return s[(t-1)*4+0];case e.M:return s[(t-1)*4+1];case e.Q:return s[(t-1)*4+2];case e.H:return s[(t-1)*4+3];default:return}},Y.getTotalCodewordsCount=function(t,r){switch(r){case e.L:return a[(t-1)*4+0];case e.M:return a[(t-1)*4+1];case e.Q:return a[(t-1)*4+2];case e.H:return a[(t-1)*4+3];default:return}},Y}var de={},V={},Je;function yn(){if(Je)return V;Je=1;const e=new Uint8Array(512),s=new Uint8Array(256);return(function(){let n=1;for(let t=0;t<255;t++)e[t]=n,s[n]=t,n<<=1,n&256&&(n^=285);for(let t=255;t<512;t++)e[t]=e[t-255]})(),V.log=function(n){if(n<1)throw new Error("log("+n+")");return s[n]},V.exp=function(n){return e[n]},V.mul=function(n,t){return n===0||t===0?0:e[s[n]+s[t]]},V}var Ve;function bn(){return Ve||(Ve=1,(function(e){const s=yn();e.mul=function(n,t){const r=new Uint8Array(n.length+t.length-1);for(let i=0;i<n.length;i++)for(let o=0;o<t.length;o++)r[i+o]^=s.mul(n[i],t[o]);return r},e.mod=function(n,t){let r=new Uint8Array(n);for(;r.length-t.length>=0;){const i=r[0];for(let l=0;l<t.length;l++)r[l]^=s.mul(t[l],i);let o=0;for(;o<r.length&&r[o]===0;)o++;r=r.slice(o)}return r},e.generateECPolynomial=function(n){let t=new Uint8Array([1]);for(let r=0;r<n;r++)t=e.mul(t,new Uint8Array([1,s.exp(r)]));return t}})(de)),de}var fe,Ge;function wn(){if(Ge)return fe;Ge=1;const e=bn();function s(a){this.genPoly=void 0,this.degree=a,this.degree&&this.initialize(this.degree)}return s.prototype.initialize=function(n){this.degree=n,this.genPoly=e.generateECPolynomial(this.degree)},s.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(n.length+this.degree);t.set(n);const r=e.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){const o=new Uint8Array(this.degree);return o.set(r,i),o}return r},fe=s,fe}var ge={},he={},me={},Ye;function Ct(){return Ye||(Ye=1,me.isValid=function(s){return!isNaN(s)&&s>=1&&s<=40}),me}var k={},Qe;function At(){if(Qe)return k;Qe=1;const e="[0-9]+",s="[A-Z $%*+\\-./:]+";let a="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";a=a.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+a+`)(?:.|[\r
|
|
2
2
|
]))+`;k.KANJI=new RegExp(a,"g"),k.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),k.BYTE=new RegExp(n,"g"),k.NUMERIC=new RegExp(e,"g"),k.ALPHANUMERIC=new RegExp(s,"g");const t=new RegExp("^"+a+"$"),r=new RegExp("^"+e+"$"),i=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return k.testKanji=function(l){return t.test(l)},k.testNumeric=function(l){return r.test(l)},k.testAlphanumeric=function(l){return i.test(l)},k}var We;function z(){return We||(We=1,(function(e){const s=Ct(),a=At();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(r,i){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!s.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?r.ccBits[0]:i<27?r.ccBits[1]:r.ccBits[2]},e.getBestModeForData=function(r){return a.testNumeric(r)?e.NUMERIC:a.testAlphanumeric(r)?e.ALPHANUMERIC:a.testKanji(r)?e.KANJI:e.BYTE},e.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},e.isValid=function(r){return r&&r.bit&&r.ccBits};function n(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}e.from=function(r,i){if(e.isValid(r))return r;try{return n(r)}catch{return i}}})(he)),he}var Ze;function xn(){return Ze||(Ze=1,(function(e){const s=_(),a=xt(),n=Ie(),t=z(),r=Ct(),i=7973,o=s.getBCHDigit(i);function l(x,g,y){for(let A=1;A<=40;A++)if(g<=e.getCapacity(A,y,x))return A}function d(x,g){return t.getCharCountIndicator(x,g)+4}function h(x,g){let y=0;return x.forEach(function(A){const T=d(A.mode,g);y+=T+A.getBitsLength()}),y}function f(x,g){for(let y=1;y<=40;y++)if(h(x,y)<=e.getCapacity(y,g,t.MIXED))return y}e.from=function(g,y){return r.isValid(g)?parseInt(g,10):y},e.getCapacity=function(g,y,A){if(!r.isValid(g))throw new Error("Invalid QR Code version");typeof A>"u"&&(A=t.BYTE);const T=s.getSymbolTotalCodewords(g),E=a.getTotalCodewordsCount(g,y),B=(T-E)*8;if(A===t.MIXED)return B;const b=B-d(A,g);switch(A){case t.NUMERIC:return Math.floor(b/10*3);case t.ALPHANUMERIC:return Math.floor(b/11*2);case t.KANJI:return Math.floor(b/13);case t.BYTE:default:return Math.floor(b/8)}},e.getBestVersionForData=function(g,y){let A;const T=n.from(y,n.M);if(Array.isArray(g)){if(g.length>1)return f(g,T);if(g.length===0)return 1;A=g[0]}else A=g;return l(A.mode,A.getLength(),T)},e.getEncodedBits=function(g){if(!r.isValid(g)||g<7)throw new Error("Invalid QR Code version");let y=g<<12;for(;s.getBCHDigit(y)-o>=0;)y^=i<<s.getBCHDigit(y)-o;return g<<12|y}})(ge)),ge}var pe={},Xe;function Cn(){if(Xe)return pe;Xe=1;const e=_(),s=1335,a=21522,n=e.getBCHDigit(s);return pe.getEncodedBits=function(r,i){const o=r.bit<<3|i;let l=o<<10;for(;e.getBCHDigit(l)-n>=0;)l^=s<<e.getBCHDigit(l)-n;return(o<<10|l)^a},pe}var ye={},be,$e;function An(){if($e)return be;$e=1;const e=z();function s(a){this.mode=e.NUMERIC,this.data=a.toString()}return s.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(n){let t,r,i;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),i=parseInt(r,10),n.put(i,10);const o=this.data.length-t;o>0&&(r=this.data.substr(t),i=parseInt(r,10),n.put(i,o*3+1))},be=s,be}var we,et;function vn(){if(et)return we;et=1;const e=z(),s=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function a(n){this.mode=e.ALPHANUMERIC,this.data=n}return a.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let i=s.indexOf(this.data[r])*45;i+=s.indexOf(this.data[r+1]),t.put(i,11)}this.data.length%2&&t.put(s.indexOf(this.data[r]),6)},we=a,we}var xe,tt;function Nn(){if(tt)return xe;tt=1;const e=z();function s(a){this.mode=e.BYTE,typeof a=="string"?this.data=new TextEncoder().encode(a):this.data=new Uint8Array(a)}return s.getBitsLength=function(n){return n*8},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(a){for(let n=0,t=this.data.length;n<t;n++)a.put(this.data[n],8)},xe=s,xe}var Ce,nt;function En(){if(nt)return Ce;nt=1;const e=z(),s=_();function a(n){this.mode=e.KANJI,this.data=n}return a.getBitsLength=function(t){return t*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(n){let t;for(t=0;t<this.data.length;t++){let r=s.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
|
|
3
3
|
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),n.put(r,13)}},Ce=a,Ce}var Ae={exports:{}},rt;function jn(){return rt||(rt=1,(function(e){var s={single_source_shortest_paths:function(a,n,t){var r={},i={};i[n]=0;var o=s.PriorityQueue.make();o.push(n,0);for(var l,d,h,f,x,g,y,A,T;!o.empty();){l=o.pop(),d=l.value,f=l.cost,x=a[d]||{};for(h in x)x.hasOwnProperty(h)&&(g=x[h],y=f+g,A=i[h],T=typeof i[h]>"u",(T||A>y)&&(i[h]=y,o.push(h,y),r[h]=d))}if(typeof t<"u"&&typeof i[t]>"u"){var E=["Could not find a path from ",n," to ",t,"."].join("");throw new Error(E)}return r},extract_shortest_path_from_predecessor_list:function(a,n){for(var t=[],r=n;r;)t.push(r),a[r],r=a[r];return t.reverse(),t},find_path:function(a,n,t){var r=s.single_source_shortest_paths(a,n,t);return s.extract_shortest_path_from_predecessor_list(r,t)},PriorityQueue:{make:function(a){var n=s.PriorityQueue,t={},r;a=a||{};for(r in n)n.hasOwnProperty(r)&&(t[r]=n[r]);return t.queue=[],t.sorter=a.sorter||n.default_sorter,t},default_sorter:function(a,n){return a.cost-n.cost},push:function(a,n){var t={value:a,cost:n};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=s})(Ae)),Ae.exports}var st;function Sn(){return st||(st=1,(function(e){const s=z(),a=An(),n=vn(),t=Nn(),r=En(),i=At(),o=_(),l=jn();function d(E){return unescape(encodeURIComponent(E)).length}function h(E,B,b){const N=[];let M;for(;(M=E.exec(b))!==null;)N.push({data:M[0],index:M.index,mode:B,length:M[0].length});return N}function f(E){const B=h(i.NUMERIC,s.NUMERIC,E),b=h(i.ALPHANUMERIC,s.ALPHANUMERIC,E);let N,M;return o.isKanjiModeEnabled()?(N=h(i.BYTE,s.BYTE,E),M=h(i.KANJI,s.KANJI,E)):(N=h(i.BYTE_KANJI,s.BYTE,E),M=[]),B.concat(b,N,M).sort(function(S,I){return S.index-I.index}).map(function(S){return{data:S.data,mode:S.mode,length:S.length}})}function x(E,B){switch(B){case s.NUMERIC:return a.getBitsLength(E);case s.ALPHANUMERIC:return n.getBitsLength(E);case s.KANJI:return r.getBitsLength(E);case s.BYTE:return t.getBitsLength(E)}}function g(E){return E.reduce(function(B,b){const N=B.length-1>=0?B[B.length-1]:null;return N&&N.mode===b.mode?(B[B.length-1].data+=b.data,B):(B.push(b),B)},[])}function y(E){const B=[];for(let b=0;b<E.length;b++){const N=E[b];switch(N.mode){case s.NUMERIC:B.push([N,{data:N.data,mode:s.ALPHANUMERIC,length:N.length},{data:N.data,mode:s.BYTE,length:N.length}]);break;case s.ALPHANUMERIC:B.push([N,{data:N.data,mode:s.BYTE,length:N.length}]);break;case s.KANJI:B.push([N,{data:N.data,mode:s.BYTE,length:d(N.data)}]);break;case s.BYTE:B.push([{data:N.data,mode:s.BYTE,length:d(N.data)}])}}return B}function A(E,B){const b={},N={start:{}};let M=["start"];for(let w=0;w<E.length;w++){const S=E[w],I=[];for(let v=0;v<S.length;v++){const P=S[v],j=""+w+v;I.push(j),b[j]={node:P,lastCount:0},N[j]={};for(let m=0;m<M.length;m++){const p=M[m];b[p]&&b[p].node.mode===P.mode?(N[p][j]=x(b[p].lastCount+P.length,P.mode)-x(b[p].lastCount,P.mode),b[p].lastCount+=P.length):(b[p]&&(b[p].lastCount=P.length),N[p][j]=x(P.length,P.mode)+4+s.getCharCountIndicator(P.mode,B))}}M=I}for(let w=0;w<M.length;w++)N[M[w]].end=0;return{map:N,table:b}}function T(E,B){let b;const N=s.getBestModeForData(E);if(b=s.from(B,N),b!==s.BYTE&&b.bit<N.bit)throw new Error('"'+E+'" cannot be encoded with mode '+s.toString(b)+`.
|
|
4
4
|
Suggested mode is: `+s.toString(N));switch(b===s.KANJI&&!o.isKanjiModeEnabled()&&(b=s.BYTE),b){case s.NUMERIC:return new a(E);case s.ALPHANUMERIC:return new n(E);case s.KANJI:return new r(E);case s.BYTE:return new t(E)}}e.fromArray=function(B){return B.reduce(function(b,N){return typeof N=="string"?b.push(T(N,null)):N.data&&b.push(T(N.data,N.mode)),b},[])},e.fromString=function(B,b){const N=f(B,o.isKanjiModeEnabled()),M=y(N),w=A(M,b),S=l.find_path(w.map,"start","end"),I=[];for(let v=1;v<S.length-1;v++)I.push(w.table[S[v]].node);return e.fromArray(g(I))},e.rawSplit=function(B){return e.fromArray(f(B,o.isKanjiModeEnabled()))}})(ye)),ye}var at;function In(){if(at)return se;at=1;const e=_(),s=Ie(),a=fn(),n=gn(),t=hn(),r=mn(),i=pn(),o=xt(),l=wn(),d=xn(),h=Cn(),f=z(),x=Sn();function g(w,S){const I=w.size,v=r.getPositions(S);for(let P=0;P<v.length;P++){const j=v[P][0],m=v[P][1];for(let p=-1;p<=7;p++)if(!(j+p<=-1||I<=j+p))for(let C=-1;C<=7;C++)m+C<=-1||I<=m+C||(p>=0&&p<=6&&(C===0||C===6)||C>=0&&C<=6&&(p===0||p===6)||p>=2&&p<=4&&C>=2&&C<=4?w.set(j+p,m+C,!0,!0):w.set(j+p,m+C,!1,!0))}}function y(w){const S=w.size;for(let I=8;I<S-8;I++){const v=I%2===0;w.set(I,6,v,!0),w.set(6,I,v,!0)}}function A(w,S){const I=t.getPositions(S);for(let v=0;v<I.length;v++){const P=I[v][0],j=I[v][1];for(let m=-2;m<=2;m++)for(let p=-2;p<=2;p++)m===-2||m===2||p===-2||p===2||m===0&&p===0?w.set(P+m,j+p,!0,!0):w.set(P+m,j+p,!1,!0)}}function T(w,S){const I=w.size,v=d.getEncodedBits(S);let P,j,m;for(let p=0;p<18;p++)P=Math.floor(p/3),j=p%3+I-8-3,m=(v>>p&1)===1,w.set(P,j,m,!0),w.set(j,P,m,!0)}function E(w,S,I){const v=w.size,P=h.getEncodedBits(S,I);let j,m;for(j=0;j<15;j++)m=(P>>j&1)===1,j<6?w.set(j,8,m,!0):j<8?w.set(j+1,8,m,!0):w.set(v-15+j,8,m,!0),j<8?w.set(8,v-j-1,m,!0):j<9?w.set(8,15-j-1+1,m,!0):w.set(8,15-j-1,m,!0);w.set(v-8,8,1,!0)}function B(w,S){const I=w.size;let v=-1,P=I-1,j=7,m=0;for(let p=I-1;p>0;p-=2)for(p===6&&p--;;){for(let C=0;C<2;C++)if(!w.isReserved(P,p-C)){let R=!1;m<S.length&&(R=(S[m]>>>j&1)===1),w.set(P,p-C,R),j--,j===-1&&(m++,j=7)}if(P+=v,P<0||I<=P){P-=v,v=-v;break}}}function b(w,S,I){const v=new a;I.forEach(function(C){v.put(C.mode.bit,4),v.put(C.getLength(),f.getCharCountIndicator(C.mode,w)),C.write(v)});const P=e.getSymbolTotalCodewords(w),j=o.getTotalCodewordsCount(w,S),m=(P-j)*8;for(v.getLengthInBits()+4<=m&&v.put(0,4);v.getLengthInBits()%8!==0;)v.putBit(0);const p=(m-v.getLengthInBits())/8;for(let C=0;C<p;C++)v.put(C%2?17:236,8);return N(v,w,S)}function N(w,S,I){const v=e.getSymbolTotalCodewords(S),P=o.getTotalCodewordsCount(S,I),j=v-P,m=o.getBlocksCount(S,I),p=v%m,C=m-p,R=Math.floor(v/m),J=Math.floor(j/m),Et=J+1,Pe=R-J,jt=new l(Pe);let Z=0;const G=new Array(m),Be=new Array(m);let X=0;const St=new Uint8Array(w.buffer);for(let O=0;O<m;O++){const ee=O<C?J:Et;G[O]=St.slice(Z,Z+ee),Be[O]=jt.encode(G[O]),Z+=ee,X=Math.max(X,ee)}const $=new Uint8Array(v);let Te=0,D,F;for(D=0;D<X;D++)for(F=0;F<m;F++)D<G[F].length&&($[Te++]=G[F][D]);for(D=0;D<Pe;D++)for(F=0;F<m;F++)$[Te++]=Be[F][D];return $}function M(w,S,I,v){let P;if(Array.isArray(w))P=x.fromArray(w);else if(typeof w=="string"){let R=S;if(!R){const J=x.rawSplit(w);R=d.getBestVersionForData(J,I)}P=x.fromString(w,R||40)}else throw new Error("Invalid data");const j=d.getBestVersionForData(P,I);if(!j)throw new Error("The amount of data is too big to be stored in a QR Code");if(!S)S=j;else if(S<j)throw new Error(`
|