nextclaw 0.16.30 → 0.16.32
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 +93 -52
- package/package.json +12 -12
- package/ui-dist/assets/{ChannelsList-DAx7wv0_.js → ChannelsList-Zeys_w43.js} +6 -6
- package/ui-dist/assets/ChatPage-DWOU_8P6.js +43 -0
- package/ui-dist/assets/DocBrowser-B9OaZjmg.js +1 -0
- package/ui-dist/assets/{DocBrowser-DKkE3Y4I.js → DocBrowser-BmtBLFU0.js} +1 -1
- package/ui-dist/assets/{DocBrowserContext-BcZRBsCg.js → DocBrowserContext-YIKkPb76.js} +1 -1
- package/ui-dist/assets/{LogoBadge-BIPDLEwK.js → LogoBadge-F7ZWdxLT.js} +1 -1
- package/ui-dist/assets/MarketplacePage-BfaTTqN6.js +1 -0
- package/ui-dist/assets/{MarketplacePage-Dlp5BgCh.js → MarketplacePage-Cd4faegU.js} +2 -2
- package/ui-dist/assets/{McpMarketplacePage-CwKtAil8.js → McpMarketplacePage-C09Ngs7O.js} +2 -2
- package/ui-dist/assets/ModelConfig-DJgdcgvQ.js +1 -0
- package/ui-dist/assets/ProvidersList-w0rVFIBf.js +1 -0
- package/ui-dist/assets/RemoteAccessPage-BJ_ckkOV.js +1 -0
- package/ui-dist/assets/RuntimeConfig-Cmn2xPQO.js +1 -0
- package/ui-dist/assets/{SearchConfig-v46R5a2U.js → SearchConfig-BT13qpR_.js} +1 -1
- package/ui-dist/assets/{SecretsConfig-CXvUpbB_.js → SecretsConfig-CvqEVn0B.js} +2 -2
- package/ui-dist/assets/{SessionsConfig-7vUHMtOh.js → SessionsConfig-DHHcYznk.js} +2 -2
- package/ui-dist/assets/{book-open-DzSduAaw.js → book-open-CXoF5nQC.js} +1 -1
- package/ui-dist/assets/chat-session-display-VW6ZMvZP.js +1 -0
- package/ui-dist/assets/{chunk-JZWAC4HX-C1vpvW4r.js → chunk-JZWAC4HX-CvRWvTy5.js} +1 -1
- package/ui-dist/assets/{config-Df97LeLR.js → config-DJswxxE8.js} +1 -1
- package/ui-dist/assets/{createLucideIcon-CcR5wVoU.js → createLucideIcon-CjGHOWb6.js} +1 -1
- package/ui-dist/assets/{dist-Dii9v3X9.js → dist-Cl2QB-2y.js} +1 -1
- package/ui-dist/assets/{dist-BMlnBah3.js → dist-nqTTbVdA.js} +1 -1
- package/ui-dist/assets/{external-link-CnSDrvJE.js → external-link-tIO7zING.js} +1 -1
- package/ui-dist/assets/{hash-CAnX6PNt.js → hash-JWUyl1pT.js} +1 -1
- package/ui-dist/assets/i18n-CDHMXlRZ.js +1 -0
- package/ui-dist/assets/index-BlH4-cBw.css +1 -0
- package/ui-dist/assets/{index-B0DzQqwv.js → index-C6d0xmtm.js} +3 -3
- package/ui-dist/assets/{label-CtIFj7_6.js → label-BIpeNu4r.js} +1 -1
- package/ui-dist/assets/loader-circle-Cs8XVFTw.js +1 -0
- package/ui-dist/assets/{logos-3KFNiOej.js → logos-DThdM9lk.js} +1 -1
- package/ui-dist/assets/{page-layout-BMwpn87D.js → page-layout-D3Xo605Z.js} +1 -1
- package/ui-dist/assets/plus-PHf8q-Ct.js +1 -0
- package/ui-dist/assets/{popover-BIzq25oH.js → popover-BJRUGA_H.js} +1 -1
- package/ui-dist/assets/provider-models-bz5y28rq.js +1 -0
- package/ui-dist/assets/{react-ji6GGP_j.js → react-7ZHqQtEV.js} +1 -1
- package/ui-dist/assets/refresh-ccw-CC6-_QuL.js +1 -0
- package/ui-dist/assets/{save-CMgYkJ-y.js → save-DJM5RRWW.js} +1 -1
- package/ui-dist/assets/search-C91yH_6y.js +1 -0
- package/ui-dist/assets/{security-config-Xi5DYW7j.js → security-config-T5zpg16O.js} +1 -1
- package/ui-dist/assets/{select-Cz82gl01.js → select-DSkTc61S.js} +1 -1
- package/ui-dist/assets/skeleton-Dzg-HOiN.js +1 -0
- package/ui-dist/assets/{status-dot-C7q1HvLH.js → status-dot-LNBlDu3q.js} +1 -1
- package/ui-dist/assets/{switch-DYswvkYj.js → switch-Bo-Y46HZ.js} +1 -1
- package/ui-dist/assets/tabs-custom-DXv507_2.js +1 -0
- package/ui-dist/assets/{trash-2-DfXI7-ap.js → trash-2-DFZmW6Gg.js} +1 -1
- package/ui-dist/assets/useConfirmDialog-Bs5Ll17m.js +1 -0
- package/ui-dist/assets/{useMutation-s2sn2yzh.js → useMutation-DrZrOgVL.js} +1 -1
- package/ui-dist/assets/x-D7Q1yqSF.js +1 -0
- package/ui-dist/index.html +18 -18
- package/ui-dist/assets/ChatPage-l2PYwCeB.js +0 -38
- package/ui-dist/assets/DocBrowser-CIHLqoIm.js +0 -1
- package/ui-dist/assets/MarketplacePage-TVeyVOuO.js +0 -1
- package/ui-dist/assets/ModelConfig-Dg6F3Ldb.js +0 -1
- package/ui-dist/assets/ProvidersList-f7bQdRxA.js +0 -1
- package/ui-dist/assets/RemoteAccessPage-w_dY7P4T.js +0 -1
- package/ui-dist/assets/RuntimeConfig-M4OKjmgU.js +0 -1
- package/ui-dist/assets/chat-session-display-CGfXhJoT.js +0 -1
- package/ui-dist/assets/i18n-CXBpwAwA.js +0 -1
- package/ui-dist/assets/index-BahpXJg8.css +0 -1
- package/ui-dist/assets/loader-circle-qgU4zQDw.js +0 -1
- package/ui-dist/assets/plus-C9cYVbL-.js +0 -1
- package/ui-dist/assets/provider-models-C8JQUd1E.js +0 -1
- package/ui-dist/assets/search-sl1OeJFl.js +0 -1
- package/ui-dist/assets/skeleton-rgIt7a5q.js +0 -1
- package/ui-dist/assets/tabs-custom-DKYQxrx1.js +0 -1
- package/ui-dist/assets/useConfirmDialog-CXDAxtRL.js +0 -1
- package/ui-dist/assets/x-MIimOGs6.js +0 -1
- /package/ui-dist/assets/{config-hints-fGnUjDe9.js → config-hints-WtpHP_DW.js} +0 -0
- /package/ui-dist/assets/{config-layout-B-7erZRN.js → config-layout-LQ10ozRC.js} +0 -0
- /package/ui-dist/assets/{marketplace-localization-CXeGRf6E.js → marketplace-localization-CxSTG9wr.js} +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -698,11 +698,13 @@ function collectFiles(rootDir) {
|
|
|
698
698
|
}
|
|
699
699
|
function installBuiltinSkill(workdir, destinationDir, skillName) {
|
|
700
700
|
const loader = new SkillsLoader(workdir);
|
|
701
|
-
const
|
|
702
|
-
|
|
703
|
-
|
|
701
|
+
const workspaceSkill = loader.listSkills(false).find((skill) => {
|
|
702
|
+
return skill.name === skillName && skill.source === "workspace";
|
|
703
|
+
});
|
|
704
|
+
if (!workspaceSkill) {
|
|
705
|
+
throw new Error(`Workspace skill not found in local installation: ${skillName}`);
|
|
704
706
|
}
|
|
705
|
-
cpSync(dirname(
|
|
707
|
+
cpSync(dirname(workspaceSkill.path), destinationDir, { recursive: true, force: true });
|
|
706
708
|
}
|
|
707
709
|
async function fetchMarketplaceSkillItem(apiBase, slug) {
|
|
708
710
|
return runWithMarketplaceNetworkRetry(async () => {
|
|
@@ -5261,6 +5263,8 @@ import {
|
|
|
5261
5263
|
InputBudgetPruner,
|
|
5262
5264
|
getWorkspacePath as getWorkspacePath7,
|
|
5263
5265
|
parseThinkingLevel as parseThinkingLevel2,
|
|
5266
|
+
readSessionProjectRoot,
|
|
5267
|
+
resolveSessionWorkspacePath,
|
|
5264
5268
|
resolveThinkingLevel
|
|
5265
5269
|
} from "@nextclaw/core";
|
|
5266
5270
|
|
|
@@ -6011,7 +6015,7 @@ var NextclawNcpContextBuilder = class {
|
|
|
6011
6015
|
this.options = options;
|
|
6012
6016
|
}
|
|
6013
6017
|
inputBudgetPruner = new InputBudgetPruner();
|
|
6014
|
-
prepare(input, _options) {
|
|
6018
|
+
prepare = (input, _options) => {
|
|
6015
6019
|
const config2 = this.options.getConfig();
|
|
6016
6020
|
const profile = resolvePrimaryAgentProfile(config2);
|
|
6017
6021
|
const requestMetadata = mergeInputMetadata(input);
|
|
@@ -6021,6 +6025,10 @@ var NextclawNcpContextBuilder = class {
|
|
|
6021
6025
|
requestMetadata,
|
|
6022
6026
|
fallbackModel: profile.model
|
|
6023
6027
|
});
|
|
6028
|
+
const effectiveWorkspace = resolveSessionWorkspacePath({
|
|
6029
|
+
sessionMetadata: session.metadata,
|
|
6030
|
+
workspace: profile.workspace
|
|
6031
|
+
});
|
|
6024
6032
|
syncSessionThinkingPreference({ session, requestMetadata });
|
|
6025
6033
|
const { channel, chatId } = resolveSessionChannelContext({
|
|
6026
6034
|
session,
|
|
@@ -6058,7 +6066,7 @@ var NextclawNcpContextBuilder = class {
|
|
|
6058
6066
|
model: effectiveModel,
|
|
6059
6067
|
restrictToWorkspace: profile.restrictToWorkspace,
|
|
6060
6068
|
searchConfig: profile.searchConfig,
|
|
6061
|
-
workspace:
|
|
6069
|
+
workspace: effectiveWorkspace
|
|
6062
6070
|
});
|
|
6063
6071
|
const accountId = readAccountIdForHints(requestMetadata, session.metadata);
|
|
6064
6072
|
const messageToolHints = this.options.resolveMessageToolHints?.({
|
|
@@ -6068,7 +6076,14 @@ var NextclawNcpContextBuilder = class {
|
|
|
6068
6076
|
accountId: accountId ?? null
|
|
6069
6077
|
});
|
|
6070
6078
|
const toolDefinitions = this.options.toolRegistry.getToolDefinitions();
|
|
6071
|
-
const contextBuilder = new ContextBuilder(
|
|
6079
|
+
const contextBuilder = new ContextBuilder(
|
|
6080
|
+
effectiveWorkspace,
|
|
6081
|
+
config2.agents.context,
|
|
6082
|
+
{
|
|
6083
|
+
hostWorkspace: profile.workspace,
|
|
6084
|
+
sessionProjectRoot: readSessionProjectRoot(session.metadata)
|
|
6085
|
+
}
|
|
6086
|
+
);
|
|
6072
6087
|
const sessionMessages = _options?.sessionMessages ?? [];
|
|
6073
6088
|
const messages = contextBuilder.buildMessages({
|
|
6074
6089
|
history: toLegacyMessages([...sessionMessages], {
|
|
@@ -6098,11 +6113,20 @@ var NextclawNcpContextBuilder = class {
|
|
|
6098
6113
|
model: effectiveModel,
|
|
6099
6114
|
thinkingLevel: runtimeThinking
|
|
6100
6115
|
};
|
|
6101
|
-
}
|
|
6116
|
+
};
|
|
6102
6117
|
};
|
|
6103
6118
|
|
|
6104
6119
|
// src/cli/commands/ncp/nextclaw-agent-session-store.ts
|
|
6105
6120
|
import { sanitizeAssistantReplyTags as sanitizeAssistantReplyTags2 } from "@nextclaw/ncp";
|
|
6121
|
+
|
|
6122
|
+
// src/cli/commands/ncp/nextclaw-agent-session-metadata.utils.ts
|
|
6123
|
+
function resolvePersistedSessionMetadata(params) {
|
|
6124
|
+
const messageMetadata = extractMessageMetadata(params.sessionRecord.messages);
|
|
6125
|
+
const nextMetadata = params.preserveExistingMetadata ? mergeSessionMetadata(params.currentMetadata, messageMetadata) : mergeSessionMetadata({}, messageMetadata);
|
|
6126
|
+
return mergeSessionMetadata(nextMetadata, cloneMetadata(params.sessionRecord.metadata));
|
|
6127
|
+
}
|
|
6128
|
+
|
|
6129
|
+
// src/cli/commands/ncp/nextclaw-agent-session-store.ts
|
|
6106
6130
|
function tryParseJson(value) {
|
|
6107
6131
|
try {
|
|
6108
6132
|
return JSON.parse(value);
|
|
@@ -6138,6 +6162,19 @@ function contentToParts(content) {
|
|
|
6138
6162
|
}
|
|
6139
6163
|
return [];
|
|
6140
6164
|
}
|
|
6165
|
+
function normalizeToolResultPayload(value) {
|
|
6166
|
+
if (typeof value !== "string") {
|
|
6167
|
+
return structuredClone(value);
|
|
6168
|
+
}
|
|
6169
|
+
const trimmed = value.trim();
|
|
6170
|
+
if (!trimmed) {
|
|
6171
|
+
return value;
|
|
6172
|
+
}
|
|
6173
|
+
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
|
|
6174
|
+
return value;
|
|
6175
|
+
}
|
|
6176
|
+
return tryParseJson(trimmed);
|
|
6177
|
+
}
|
|
6141
6178
|
function parseLegacyToolCalls(value) {
|
|
6142
6179
|
if (!Array.isArray(value)) {
|
|
6143
6180
|
return [];
|
|
@@ -6169,8 +6206,7 @@ function parseLegacyToolCalls(value) {
|
|
|
6169
6206
|
}).filter((entry) => entry !== null);
|
|
6170
6207
|
}
|
|
6171
6208
|
function createMessageId(sessionId, index, role, timestamp) {
|
|
6172
|
-
|
|
6173
|
-
return `${sessionId}:${safeRole}:${index}:${timestamp}`;
|
|
6209
|
+
return `${sessionId}:${role.trim().toLowerCase() || "message"}:${index}:${timestamp}`;
|
|
6174
6210
|
}
|
|
6175
6211
|
function isNcpMessagePart(value) {
|
|
6176
6212
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value) && typeof value.type === "string";
|
|
@@ -6252,15 +6288,23 @@ function buildGenericMessage(params) {
|
|
|
6252
6288
|
};
|
|
6253
6289
|
}
|
|
6254
6290
|
function attachToolResult(target, toolCallId, result, toolName) {
|
|
6291
|
+
const normalizedResult = normalizeToolResultPayload(result);
|
|
6255
6292
|
target.parts = target.parts.map((part) => {
|
|
6256
6293
|
if (part.type !== "tool-invocation" || part.toolCallId !== toolCallId) {
|
|
6257
6294
|
return part;
|
|
6258
6295
|
}
|
|
6296
|
+
const alreadyHasResolvedResult = part.state === "result" && Object.prototype.hasOwnProperty.call(part, "result");
|
|
6297
|
+
if (alreadyHasResolvedResult) {
|
|
6298
|
+
return {
|
|
6299
|
+
...part,
|
|
6300
|
+
...toolName ? { toolName } : {}
|
|
6301
|
+
};
|
|
6302
|
+
}
|
|
6259
6303
|
return {
|
|
6260
6304
|
...part,
|
|
6261
6305
|
toolName: toolName ?? part.toolName,
|
|
6262
6306
|
state: "result",
|
|
6263
|
-
result
|
|
6307
|
+
result: normalizedResult
|
|
6264
6308
|
};
|
|
6265
6309
|
});
|
|
6266
6310
|
}
|
|
@@ -6339,19 +6383,14 @@ var NextclawAgentSessionStore = class {
|
|
|
6339
6383
|
this.sessionManager = sessionManager;
|
|
6340
6384
|
this.options = options;
|
|
6341
6385
|
}
|
|
6342
|
-
async
|
|
6386
|
+
getSession = async (sessionId) => {
|
|
6343
6387
|
const session = this.sessionManager.getIfExists(sessionId);
|
|
6344
6388
|
if (!session) {
|
|
6345
6389
|
return null;
|
|
6346
6390
|
}
|
|
6347
|
-
return {
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
updatedAt: session.updatedAt.toISOString(),
|
|
6351
|
-
metadata: structuredClone(session.metadata)
|
|
6352
|
-
};
|
|
6353
|
-
}
|
|
6354
|
-
async listSessions() {
|
|
6391
|
+
return { sessionId, messages: toNcpMessages(sessionId, session.messages), updatedAt: session.updatedAt.toISOString(), metadata: structuredClone(session.metadata) };
|
|
6392
|
+
};
|
|
6393
|
+
listSessions = async () => {
|
|
6355
6394
|
const records = this.sessionManager.listSessions();
|
|
6356
6395
|
const sessions = [];
|
|
6357
6396
|
for (const record of records) {
|
|
@@ -6363,27 +6402,22 @@ var NextclawAgentSessionStore = class {
|
|
|
6363
6402
|
if (!session) {
|
|
6364
6403
|
continue;
|
|
6365
6404
|
}
|
|
6366
|
-
sessions.push({
|
|
6367
|
-
sessionId,
|
|
6368
|
-
messages: toNcpMessages(sessionId, session.messages),
|
|
6369
|
-
updatedAt: session.updatedAt.toISOString(),
|
|
6370
|
-
metadata: structuredClone(session.metadata)
|
|
6371
|
-
});
|
|
6405
|
+
sessions.push({ sessionId, messages: toNcpMessages(sessionId, session.messages), updatedAt: session.updatedAt.toISOString(), metadata: structuredClone(session.metadata) });
|
|
6372
6406
|
}
|
|
6373
6407
|
sessions.sort((left, right) => right.updatedAt.localeCompare(left.updatedAt));
|
|
6374
6408
|
return sessions;
|
|
6375
|
-
}
|
|
6376
|
-
async
|
|
6409
|
+
};
|
|
6410
|
+
persistSession = async (sessionRecord, options) => {
|
|
6377
6411
|
if (this.options.writeMode === "runtime-owned") {
|
|
6378
6412
|
return;
|
|
6379
6413
|
}
|
|
6380
6414
|
const session = this.sessionManager.getIfExists(sessionRecord.sessionId) ?? this.sessionManager.getOrCreate(sessionRecord.sessionId);
|
|
6381
6415
|
const legacyMessages = toLegacyMessages(sessionRecord.messages);
|
|
6382
|
-
|
|
6383
|
-
session.metadata,
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6416
|
+
session.metadata = resolvePersistedSessionMetadata({
|
|
6417
|
+
currentMetadata: session.metadata,
|
|
6418
|
+
sessionRecord,
|
|
6419
|
+
preserveExistingMetadata: options.preserveExistingMetadata
|
|
6420
|
+
});
|
|
6387
6421
|
this.sessionManager.clear(session);
|
|
6388
6422
|
for (const message of legacyMessages) {
|
|
6389
6423
|
this.sessionManager.appendEvent(session, {
|
|
@@ -6399,8 +6433,18 @@ var NextclawAgentSessionStore = class {
|
|
|
6399
6433
|
}
|
|
6400
6434
|
this.sessionManager.save(session);
|
|
6401
6435
|
this.options.onSessionUpdated?.(sessionRecord.sessionId);
|
|
6402
|
-
}
|
|
6403
|
-
async
|
|
6436
|
+
};
|
|
6437
|
+
saveSession = async (sessionRecord) => {
|
|
6438
|
+
await this.persistSession(sessionRecord, {
|
|
6439
|
+
preserveExistingMetadata: true
|
|
6440
|
+
});
|
|
6441
|
+
};
|
|
6442
|
+
replaceSession = async (sessionRecord) => {
|
|
6443
|
+
await this.persistSession(sessionRecord, {
|
|
6444
|
+
preserveExistingMetadata: false
|
|
6445
|
+
});
|
|
6446
|
+
};
|
|
6447
|
+
deleteSession = async (sessionId) => {
|
|
6404
6448
|
const existing = await this.getSession(sessionId);
|
|
6405
6449
|
if (!existing) {
|
|
6406
6450
|
return null;
|
|
@@ -6408,7 +6452,7 @@ var NextclawAgentSessionStore = class {
|
|
|
6408
6452
|
this.sessionManager.delete(sessionId);
|
|
6409
6453
|
this.options.onSessionUpdated?.(sessionId);
|
|
6410
6454
|
return existing;
|
|
6411
|
-
}
|
|
6455
|
+
};
|
|
6412
6456
|
};
|
|
6413
6457
|
|
|
6414
6458
|
// src/cli/commands/ncp/ncp-subagent-completion-message.ts
|
|
@@ -8427,7 +8471,7 @@ var UiSessionService = class {
|
|
|
8427
8471
|
onSessionUpdated: options.onSessionUpdated
|
|
8428
8472
|
});
|
|
8429
8473
|
}
|
|
8430
|
-
async
|
|
8474
|
+
listSessions = async (options) => {
|
|
8431
8475
|
const sessions = await this.sessionStore.listSessions();
|
|
8432
8476
|
return applyLimit(
|
|
8433
8477
|
sessions.map(
|
|
@@ -8441,15 +8485,15 @@ var UiSessionService = class {
|
|
|
8441
8485
|
),
|
|
8442
8486
|
options?.limit
|
|
8443
8487
|
);
|
|
8444
|
-
}
|
|
8445
|
-
async
|
|
8488
|
+
};
|
|
8489
|
+
listSessionMessages = async (sessionId, options) => {
|
|
8446
8490
|
const session = await this.sessionStore.getSession(sessionId);
|
|
8447
8491
|
if (!session) {
|
|
8448
8492
|
return [];
|
|
8449
8493
|
}
|
|
8450
8494
|
return applyLimit(session.messages.map((message) => structuredClone(message)), options?.limit);
|
|
8451
|
-
}
|
|
8452
|
-
async
|
|
8495
|
+
};
|
|
8496
|
+
getSession = async (sessionId) => {
|
|
8453
8497
|
const session = await this.sessionStore.getSession(sessionId);
|
|
8454
8498
|
if (!session) {
|
|
8455
8499
|
return null;
|
|
@@ -8461,26 +8505,23 @@ var UiSessionService = class {
|
|
|
8461
8505
|
status: "idle",
|
|
8462
8506
|
metadata: session.metadata
|
|
8463
8507
|
});
|
|
8464
|
-
}
|
|
8465
|
-
async
|
|
8508
|
+
};
|
|
8509
|
+
updateSession = async (sessionId, patch) => {
|
|
8466
8510
|
const session = await this.sessionStore.getSession(sessionId);
|
|
8467
|
-
|
|
8468
|
-
return null;
|
|
8469
|
-
}
|
|
8470
|
-
await this.sessionStore.saveSession({
|
|
8511
|
+
await this.sessionStore.replaceSession({
|
|
8471
8512
|
sessionId,
|
|
8472
|
-
messages: session.messages.map((message) => structuredClone(message)),
|
|
8513
|
+
messages: session ? session.messages.map((message) => structuredClone(message)) : [],
|
|
8473
8514
|
updatedAt: now(),
|
|
8474
8515
|
metadata: buildUpdatedMetadata({
|
|
8475
|
-
existingMetadata: session
|
|
8516
|
+
existingMetadata: session?.metadata,
|
|
8476
8517
|
patch
|
|
8477
8518
|
})
|
|
8478
8519
|
});
|
|
8479
8520
|
return await this.getSession(sessionId);
|
|
8480
|
-
}
|
|
8481
|
-
async
|
|
8521
|
+
};
|
|
8522
|
+
deleteSession = async (sessionId) => {
|
|
8482
8523
|
await this.sessionStore.deleteSession(sessionId);
|
|
8483
|
-
}
|
|
8524
|
+
};
|
|
8484
8525
|
};
|
|
8485
8526
|
|
|
8486
8527
|
// src/cli/commands/service-deferred-ncp-session-service.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextclaw",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.32",
|
|
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/core": "0.11.
|
|
43
|
-
"@nextclaw/
|
|
44
|
-
"@nextclaw/ncp-mcp": "0.1.
|
|
45
|
-
"@nextclaw/
|
|
46
|
-
"@nextclaw/
|
|
47
|
-
"@nextclaw/
|
|
48
|
-
"@nextclaw/
|
|
49
|
-
"@nextclaw/
|
|
50
|
-
"@nextclaw/
|
|
51
|
-
"@nextclaw/
|
|
42
|
+
"@nextclaw/core": "0.11.16",
|
|
43
|
+
"@nextclaw/mcp": "0.1.63",
|
|
44
|
+
"@nextclaw/ncp-mcp": "0.1.65",
|
|
45
|
+
"@nextclaw/ncp-toolkit": "0.4.16",
|
|
46
|
+
"@nextclaw/openclaw-compat": "0.3.57",
|
|
47
|
+
"@nextclaw/remote": "0.1.75",
|
|
48
|
+
"@nextclaw/runtime": "0.2.30",
|
|
49
|
+
"@nextclaw/server": "0.11.23",
|
|
50
|
+
"@nextclaw/ncp-agent-runtime": "0.3.6",
|
|
51
|
+
"@nextclaw/ncp": "0.4.6"
|
|
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": "^4.1.2",
|
|
60
|
-
"@nextclaw/ui": "0.11.
|
|
60
|
+
"@nextclaw/ui": "0.11.22"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"dev": "tsx watch --tsconfig tsconfig.json src/cli/index.ts",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{_ as e,a as t,h as n,l as r,m as i,p as a,r as o,u as s}from"./i18n-CXBpwAwA.js";import{n as c,o as l,r as u,u as d}from"./dist-Dii9v3X9.js";import{t as f}from"./useMutation-s2sn2yzh.js";import{O as p,a as m,i as h,n as g,r as _,t as v}from"./select-Cz82gl01.js";import{t as y}from"./createLucideIcon-CcR5wVoU.js";import{t as b}from"./book-open-DzSduAaw.js";import{t as x}from"./external-link-CnSDrvJE.js";import{n as S,t as C}from"./logos-3KFNiOej.js";import{t as w}from"./hash-CAnX6PNt.js";import{t as T}from"./loader-circle-qgU4zQDw.js";import{t as E}from"./search-sl1OeJFl.js";import{t as D}from"./x-MIimOGs6.js";import{T as ee,U as O,c as k,ct as A,g as te,l as j,pt as M,u as ne,ut as N}from"./index-B0DzQqwv.js";import{t as P}from"./LogoBadge-BIPDLEwK.js";import{n as F,t as I}from"./page-layout-BMwpn87D.js";import{t as L}from"./tabs-custom-DKYQxrx1.js";import{t as R}from"./status-dot-C7q1HvLH.js";import{t as z}from"./config-hints-fGnUjDe9.js";import{i as re,n as ie,r as ae,t as oe}from"./config-layout-B-7erZRN.js";import{t as se}from"./label-CtIFj7_6.js";import{t as ce}from"./switch-DYswvkYj.js";var le=y(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),ue=y(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),de=y(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),fe=y(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),B=e(i(),1);function V(e){let n=t();return e.tutorialUrls?.[n]||e.tutorialUrls?.default||e.tutorialUrl}var H=a();function pe({value:e,onChange:t,className:n,placeholder:i=``}){let[a,o]=(0,B.useState)(``),c=n=>{n.key===`Enter`&&a.trim()?(n.preventDefault(),t([...e,a.trim()]),o(``)):n.key===`Backspace`&&!a&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,H.jsxs)(`div`,{className:s(`flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]`,n),children:[e.map((e,t)=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm`,children:[e,(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`hover:text-red-300 transition-colors`,children:(0,H.jsx)(D,{className:`h-3 w-3`})})]},t)),(0,H.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||r(`enterTag`)})]})}function me(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,H.jsx)(M,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,H.jsx)(S,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,H.jsx)(le,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,H.jsx)(w,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,H.jsx)(fe,{className:`h-3.5 w-3.5 text-gray-500`}):(0,H.jsx)(A,{className:`h-3.5 w-3.5 text-gray-500`})}function U({channelName:e,fields:t,formData:n,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,H.jsx)(H.Fragment,{children:t.map(t=>{let c=z(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,H.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,H.jsxs)(se,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[me(t.name),l]}),t.type===`boolean`&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?r(`enabled`):r(`disabled`)}),(0,H.jsx)(ce,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,H.jsx)(O,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,H.jsx)(O,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??r(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,H.jsx)(O,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,H.jsx)(pe,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,H.jsxs)(v,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,H.jsx)(h,{className:`rounded-xl`,children:(0,H.jsx)(m,{})}),(0,H.jsx)(g,{children:(t.options??[]).map(e=>(0,H.jsx)(_,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,H.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.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`})]},t.name)})})}var W=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],G=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],he=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function ge(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`token`,type:`password`,label:r(`botToken`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)},{name:`proxy`,type:`text`,label:r(`proxy`)},{name:`accountId`,type:`text`,label:r(`accountId`)},{name:`dmPolicy`,type:`select`,label:r(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:r(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:r(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:r(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:r(`mentionPatterns`)},{name:`groups`,type:`json`,label:r(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`token`,type:`password`,label:r(`botToken`)},{name:`allowBots`,type:`boolean`,label:r(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:r(`gatewayUrl`)},{name:`intents`,type:`number`,label:r(`intents`)},{name:`proxy`,type:`text`,label:r(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:r(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:r(`streamingMode`),options:he},{name:`draftChunk`,type:`json`,label:r(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:r(`textChunkLimit`)},{name:`accountId`,type:`text`,label:r(`accountId`)},{name:`dmPolicy`,type:`select`,label:r(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:r(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:r(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:r(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:r(`mentionPatterns`)},{name:`groups`,type:`json`,label:r(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`bridgeUrl`,type:`text`,label:r(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)}]},feishu:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`appId`,type:`text`,label:r(`appId`)},{name:`appSecret`,type:`password`,label:r(`appSecret`)},{name:`encryptKey`,type:`password`,label:r(`encryptKey`)},{name:`verificationToken`,type:`password`,label:r(`verificationToken`)},{name:`domain`,type:`text`,label:`Domain`},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)},{name:`dmPolicy`,type:`select`,label:r(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:r(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:r(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:r(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:r(`mentionPatterns`)},{name:`groups`,type:`json`,label:r(`groupRulesJson`)},{name:`accounts`,type:`json`,label:r(`accountsJson`)}]},dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`clientId`,type:`text`,label:r(`clientId`)},{name:`clientSecret`,type:`password`,label:r(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`corpId`,type:`text`,label:r(`corpId`)},{name:`agentId`,type:`text`,label:r(`agentId`)},{name:`secret`,type:`password`,label:r(`secret`)},{name:`token`,type:`password`,label:r(`token`)},{name:`callbackPort`,type:`number`,label:r(`callbackPort`)},{name:`callbackPath`,type:`text`,label:r(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:r(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:r(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:r(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)},{name:`accounts`,type:`json`,label:r(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:r(`weixinAuthAdvancedTitle`),description:r(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`mode`,type:`text`,label:r(`mode`)},{name:`webhookPath`,type:`text`,label:r(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:r(`allowBotMessages`)},{name:`botToken`,type:`password`,label:r(`botToken`)},{name:`appToken`,type:`password`,label:r(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`consentGranted`,type:`boolean`,label:r(`consentGranted`)},{name:`imapHost`,type:`text`,label:r(`imapHost`)},{name:`imapPort`,type:`number`,label:r(`imapPort`)},{name:`imapUsername`,type:`text`,label:r(`imapUsername`)},{name:`imapPassword`,type:`password`,label:r(`imapPassword`)},{name:`fromAddress`,type:`email`,label:r(`fromAddress`)}]},mochat:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`baseUrl`,type:`text`,label:r(`baseUrl`)},{name:`clawToken`,type:`password`,label:r(`clawToken`)},{name:`agentUserId`,type:`text`,label:r(`agentUserId`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`appId`,type:`text`,label:r(`appId`)},{name:`secret`,type:`password`,label:r(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:r(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)}]}}}var _e=n(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),K=n((e=>{var t,n=[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];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),q=n((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.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 Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ve=n(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),ye=n(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),be=n((e=>{var t=K().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),xe=n((e=>{var t=K().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Se=n((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),J=n((e=>{var t=q(),n=[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],r=[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];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Ce=n((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),we=n((e=>{var t=Ce();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Te=n(((e,t)=>{var n=we();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),Y=n((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),X=n((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
|
-
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),Z=
|
|
3
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Me=
|
|
4
|
-
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Pe=
|
|
1
|
+
import{_ as e,h as t,i as n,m as r,n as i,o as a,p as o,u as s}from"./i18n-CDHMXlRZ.js";import{n as c,o as l,r as u,u as d}from"./dist-Cl2QB-2y.js";import{t as f}from"./useMutation-DrZrOgVL.js";import{O as p,a as m,i as h,n as g,r as _,t as v}from"./select-DSkTc61S.js";import{t as y}from"./createLucideIcon-CjGHOWb6.js";import{t as b}from"./book-open-CXoF5nQC.js";import{t as x}from"./external-link-tIO7zING.js";import{n as S,t as C}from"./logos-DThdM9lk.js";import{t as w}from"./hash-JWUyl1pT.js";import{t as T}from"./loader-circle-Cs8XVFTw.js";import{t as E}from"./search-C91yH_6y.js";import{t as D}from"./x-D7Q1yqSF.js";import{E as ee,W as O,c as k,dt as A,g as te,l as j,lt as M,mt as ne,u as N}from"./index-C6d0xmtm.js";import{t as P}from"./LogoBadge-F7ZWdxLT.js";import{t as F}from"./label-BIpeNu4r.js";import{n as I,t as L}from"./page-layout-D3Xo605Z.js";import{t as re}from"./tabs-custom-DXv507_2.js";import{t as R}from"./status-dot-LNBlDu3q.js";import{t as z}from"./config-hints-WtpHP_DW.js";import{i as ie,n as ae,r as oe,t as se}from"./config-layout-LQ10ozRC.js";import{t as ce}from"./switch-Bo-Y46HZ.js";var le=y(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),ue=y(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),de=y(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),fe=y(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),B=e(r(),1);function V(e){let t=a();return e.tutorialUrls?.[t]||e.tutorialUrls?.default||e.tutorialUrl}var H=o();function pe({value:e,onChange:t,className:r,placeholder:i=``}){let[a,o]=(0,B.useState)(``),c=n=>{n.key===`Enter`&&a.trim()?(n.preventDefault(),t([...e,a.trim()]),o(``)):n.key===`Backspace`&&!a&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,H.jsxs)(`div`,{className:s(`flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]`,r),children:[e.map((e,t)=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm`,children:[e,(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`hover:text-red-300 transition-colors`,children:(0,H.jsx)(D,{className:`h-3 w-3`})})]},t)),(0,H.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:i||n(`enterTag`)})]})}function me(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,H.jsx)(ne,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,H.jsx)(S,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,H.jsx)(le,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,H.jsx)(w,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,H.jsx)(fe,{className:`h-3.5 w-3.5 text-gray-500`}):(0,H.jsx)(M,{className:`h-3.5 w-3.5 text-gray-500`})}function U({channelName:e,fields:t,formData:r,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,H.jsx)(H.Fragment,{children:t.map(t=>{let c=z(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,H.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,H.jsxs)(F,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[me(t.name),l]}),t.type===`boolean`&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,H.jsx)(`span`,{className:`text-sm text-gray-500`,children:r[t.name]?n(`enabled`):n(`disabled`)}),(0,H.jsx)(ce,{id:t.name,checked:r[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,H.jsx)(O,{id:t.name,type:t.type,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,H.jsx)(O,{id:t.name,type:`password`,value:r[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??n(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,H.jsx)(O,{id:t.name,type:`number`,value:r[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,H.jsx)(pe,{value:r[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,H.jsxs)(v,{value:r[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,H.jsx)(h,{className:`rounded-xl`,children:(0,H.jsx)(m,{})}),(0,H.jsx)(g,{children:(t.options??[]).map(e=>(0,H.jsx)(_,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,H.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.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`})]},t.name)})})}var W=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],G=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],he=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function ge(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`token`,type:`password`,label:n(`botToken`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`proxy`,type:`text`,label:n(`proxy`)},{name:`accountId`,type:`text`,label:n(`accountId`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`token`,type:`password`,label:n(`botToken`)},{name:`allowBots`,type:`boolean`,label:n(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:n(`gatewayUrl`)},{name:`intents`,type:`number`,label:n(`intents`)},{name:`proxy`,type:`text`,label:n(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:n(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:n(`streamingMode`),options:he},{name:`draftChunk`,type:`json`,label:n(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:n(`textChunkLimit`)},{name:`accountId`,type:`text`,label:n(`accountId`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`bridgeUrl`,type:`text`,label:n(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},feishu:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`appId`,type:`text`,label:n(`appId`)},{name:`appSecret`,type:`password`,label:n(`appSecret`)},{name:`encryptKey`,type:`password`,label:n(`encryptKey`)},{name:`verificationToken`,type:`password`,label:n(`verificationToken`)},{name:`domain`,type:`text`,label:`Domain`},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`dmPolicy`,type:`select`,label:n(`dmPolicy`),options:W},{name:`groupPolicy`,type:`select`,label:n(`groupPolicy`),options:G},{name:`groupAllowFrom`,type:`tags`,label:n(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:n(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:n(`mentionPatterns`)},{name:`groups`,type:`json`,label:n(`groupRulesJson`)},{name:`accounts`,type:`json`,label:n(`accountsJson`)}]},dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`clientId`,type:`text`,label:n(`clientId`)},{name:`clientSecret`,type:`password`,label:n(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`corpId`,type:`text`,label:n(`corpId`)},{name:`agentId`,type:`text`,label:n(`agentId`)},{name:`secret`,type:`password`,label:n(`secret`)},{name:`token`,type:`password`,label:n(`token`)},{name:`callbackPort`,type:`number`,label:n(`callbackPort`)},{name:`callbackPath`,type:`text`,label:n(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:n(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:n(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:n(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)},{name:`accounts`,type:`json`,label:n(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:n(`weixinAuthAdvancedTitle`),description:n(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`mode`,type:`text`,label:n(`mode`)},{name:`webhookPath`,type:`text`,label:n(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:n(`allowBotMessages`)},{name:`botToken`,type:`password`,label:n(`botToken`)},{name:`appToken`,type:`password`,label:n(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`consentGranted`,type:`boolean`,label:n(`consentGranted`)},{name:`imapHost`,type:`text`,label:n(`imapHost`)},{name:`imapPort`,type:`number`,label:n(`imapPort`)},{name:`imapUsername`,type:`text`,label:n(`imapUsername`)},{name:`imapPassword`,type:`password`,label:n(`imapPassword`)},{name:`fromAddress`,type:`email`,label:n(`fromAddress`)}]},mochat:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`baseUrl`,type:`text`,label:n(`baseUrl`)},{name:`clawToken`,type:`password`,label:n(`clawToken`)},{name:`agentUserId`,type:`text`,label:n(`agentUserId`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:n(`enabled`)},{name:`appId`,type:`text`,label:n(`appId`)},{name:`secret`,type:`password`,label:n(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:n(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:n(`allowFrom`)}]}}}var _e=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),K=t((e=>{var t,n=[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];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),q=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.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 Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ve=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),ye=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),be=t((e=>{var t=K().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),xe=t((e=>{var t=K().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Se=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),J=t((e=>{var t=q(),n=[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],r=[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];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Ce=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),we=t((e=>{var t=Ce();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Te=t(((e,t)=>{var n=we();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),Y=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),X=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
|
+
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),Z=t((e=>{var t=Y(),n=X();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(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw 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 Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Ee=t((e=>{var t=K(),n=J(),r=q(),i=Z(),a=Y(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),De=t((e=>{var t=K(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Oe=t(((e,t)=>{var n=Z();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),ke=t(((e,t)=>{var n=Z(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Ae=t(((e,t)=>{var n=Z();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),je=t(((e,t)=>{var n=Z(),r=K();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
|
+
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Me=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Ne=t((e=>{var t=Z(),n=Oe(),r=ke(),i=Ae(),a=je(),o=X(),s=K(),c=Me();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
|
+
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Pe=t((e=>{var t=K(),n=q(),r=ve(),i=ye(),a=be(),o=xe(),s=Se(),c=J(),l=Te(),u=Ee(),d=De(),f=Z(),p=Ne();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
5
5
|
The chosen QR Code version cannot contain this amount of data.
|
|
6
6
|
Minimum version required to store current data is: `+c+`.
|
|
7
|
-
`);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Q=
|
|
8
|
-
`;return typeof a==`function`&&a(null,p),p}})),Le=n((e=>{var t=_e(),n=Pe(),r=Fe(),i=Ie();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))();async function Re(e,t={}){let n=await u.post(`/api/config/channels/${e}/auth/start`,t);if(!n.ok)throw Error(n.error.message);return n.data}async function ze(e,t){let n=await u.post(`/api/config/channels/${e}/auth/poll`,t);if(!n.ok)throw Error(n.error.message);return n.data}function Be(){return f({mutationFn:({channel:e,data:t})=>Re(e,t)})}function Ve(){return f({mutationFn:({channel:e,data:t})=>ze(e,t)})}function He(e){let t=e.accounts,n=new Set;if(typeof e.defaultAccountId==`string`&&e.defaultAccountId.trim()&&n.add(e.defaultAccountId.trim()),t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t)){let t=e.trim();t&&n.add(t)}return[...n]}function Ue(e,t){if(typeof e.baseUrl==`string`&&e.baseUrl.trim())return e.baseUrl.trim();if(typeof t.baseUrl==`string`&&t.baseUrl.trim())return t.baseUrl.trim()}function We({channelConfig:e,formData:t,channelEnabled:n,disabled:i=!1}){let a=d(),u=Be(),f=Ve(),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(null),y=(0,B.useMemo)(()=>He(e),[e]),b=y[0],S=Ue(t,e),C=y.length>0;(0,B.useEffect)(()=>{C&&(m(null),g(e=>e?.status===`authorized`?e:{channel:`weixin`,status:`authorized`,message:r(`weixinAuthAuthorized`),accountId:b??null}))},[C,b]),(0,B.useEffect)(()=>{if(!p){v(null);return}let e=!1;return(0,Le.toDataURL)(p.qrCodeUrl,{errorCorrectionLevel:`M`,margin:1,width:480}).then(t=>{e||v(t)}).catch(()=>{e||v(null)}),()=>{e=!0}},[p]),(0,B.useEffect)(()=>{if(!p)return;let e=!1,t=null,n=async()=>{try{let i=await f.mutateAsync({channel:`weixin`,data:{sessionId:p.sessionId}});if(e)return;if(g(i),i.status===`authorized`){await a.invalidateQueries({queryKey:[`config`]}),await a.invalidateQueries({queryKey:[`config-meta`]}),c.success(i.message||r(`weixinAuthAuthorized`)),m(null);return}if(i.status===`expired`||i.status===`error`){c.error(i.message||r(`weixinAuthRetryRequired`)),m(null);return}t=setTimeout(n,i.nextPollMs??p.intervalMs)}catch(t){if(e)return;let n=t instanceof Error?t.message:String(t);c.error(`${r(`error`)}: ${n}`),m(null)}};return t=setTimeout(n,p.intervalMs),()=>{e=!0,t&&clearTimeout(t)}},[p,f,a]);let w=async()=>{try{let e=await u.mutateAsync({channel:`weixin`,data:{baseUrl:S,accountId:typeof t.defaultAccountId==`string`&&t.defaultAccountId.trim()?t.defaultAccountId.trim():void 0}});m(e),g({channel:`weixin`,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){let t=e instanceof Error?e.message:String(e);c.error(`${r(`error`)}: ${t}`)}},E=p?h?.status===`scanned`?r(`weixinAuthScanned`):r(`weixinAuthWaiting`):r(C?n?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),D=u.isPending?r(`weixinAuthStarting`):r(p?`weixinAuthWaiting`:C?`weixinAuthReconnect`:`weixinAuthConnect`);return(0,H.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-gradient-to-br from-primary-50/70 via-white to-emerald-50/60 p-5`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-white/90 px-3 py-1 text-xs font-medium text-primary shadow-sm`,children:[(0,H.jsx)(de,{className:`h-3.5 w-3.5`}),r(`weixinAuthTitle`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:r(`weixinAuthDescription`)}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:r(`weixinAuthHint`)})]}),(0,H.jsxs)(`div`,{className:s(`inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-medium`,p?`bg-amber-50 text-amber-700`:C?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-600`),children:[p?(0,H.jsx)(T,{className:`h-3.5 w-3.5 animate-spin`}):(0,H.jsx)(ue,{className:`h-3.5 w-3.5`}),E]}),(0,H.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,H.jsx)(`p`,{children:r(n||!C?`weixinAuthCapabilityHint`:`weixinAuthDisabledHint`)}),b?(0,H.jsxs)(`p`,{children:[r(`weixinAuthPrimaryAccount`),`: `,(0,H.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:b})]}):null,y.length>1?(0,H.jsxs)(`p`,{children:[r(`weixinAuthConnectedAccounts`),`: `,(0,H.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:y.join(`, `)})]}):null,S?(0,H.jsxs)(`p`,{children:[r(`weixinAuthBaseUrl`),`: `,(0,H.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:S})]}):null]}),(0,H.jsx)(l,{type:`button`,onClick:w,disabled:i||u.isPending||!!p,className:`rounded-xl`,children:D})]}),(0,H.jsx)(`div`,{className:`w-full max-w-sm rounded-2xl border border-dashed border-primary/25 bg-white/85 p-4 shadow-sm`,children:p?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:_?(0,H.jsx)(`img`,{src:_,alt:r(`weixinAuthQrAlt`),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,H.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,H.jsx)(T,{className:`h-5 w-5 animate-spin`}),(0,H.jsx)(`p`,{className:`text-xs`,children:r(`weixinAuthStarting`)})]})})}),(0,H.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,H.jsx)(`p`,{children:h?.message||p.note||r(`weixinAuthScanPrompt`)}),(0,H.jsxs)(`p`,{children:[r(`weixinAuthExpiresAt`),`: `,o(p.expiresAt)]})]}),(0,H.jsxs)(`a`,{href:p.qrCodeUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,H.jsx)(x,{className:`h-3.5 w-3.5`}),r(`weixinAuthOpenQr`)]})]}):(0,H.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center rounded-2xl bg-gray-50/80 px-6 text-center`,children:[(0,H.jsx)(de,{className:`h-9 w-9 text-gray-300`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:r(`weixinAuthReadyTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:r(`weixinAuthReadyDescription`)})]})})]})})}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ge(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if($(t)&&$(r)){n[e]=Ge(t,r);continue}n[e]=r}return n}function Ke(e,t){let n=e.split(`.`),r={},i=r;for(let e=0;e<n.length-1;e+=1){let t=n[e];i[t]={},i=i[t]}return i[n[n.length-1]]=t,r}function qe(e,t){return t===`all`?e:t===`primary`?e.filter(e=>e.section===`primary`):e.filter(e=>e.section!==`primary`)}function Je({channelName:e}){let{data:t}=k(),{data:n}=j(),{data:i}=ne(),a=ee(),o=te(),[u,d]=(0,B.useState)({}),[f,m]=(0,B.useState)({}),[h,g]=(0,B.useState)(null),_=e?t?.channels[e]:null,v=(0,B.useMemo)(()=>ge(),[]),y=e?v[e]:void 0,x=y?.fields??[],S=y?.layout??[{type:`fields`,section:`all`}],w=i?.uiHints,T=e?`channels.${e}`:null,E=i?.actions?.filter(e=>e.scope===T)??[],D=e&&(z(`channels.${e}`,w)?.label??e),O=n?.channels.find(t=>t.name===e),A=O?V(O):void 0;(0,B.useEffect)(()=>{if(_){d({..._});let e={};x.filter(e=>e.type===`json`).forEach(t=>{let n=_[t.name];e[t.name]=JSON.stringify(n??{},null,2)}),m(e)}else d({}),m({})},[_,x]);let M=(e,t)=>{d(n=>({...n,[e]:t}))},N=t=>{if(t.preventDefault(),!e)return;let n={...u};for(let e of x){if(e.type!==`password`)continue;let t=n[e.name];(typeof t!=`string`||t.length===0)&&delete n[e.name]}for(let e of x){if(e.type!==`json`)continue;let t=f[e.name]??``;try{n[e.name]=t.trim()?JSON.parse(t):{}}catch{c.error(`${r(`invalidJson`)}: ${e.name}`);return}}a.mutate({channel:e,data:n})},F=t=>{if(!t||!e)return;let n=t.channels;if(!$(n))return;let r=n[e];$(r)&&d(e=>Ge(e,r))},I=async t=>{if(!(!e||!T)){g(t.id);try{let n={...u};t.saveBeforeRun&&(n={...n,...t.savePatch??{}},d(n),await a.mutateAsync({channel:e,data:n}));let i=await o.mutateAsync({actionId:t.id,data:{scope:T,draftConfig:Ke(T,n)}});F(i.patch),i.ok?c.success(i.message||r(`success`)):c.error(i.message||r(`error`))}catch(e){let t=e instanceof Error?e.message:String(e);c.error(`${r(`error`)}: ${t}`)}finally{g(null)}}};if(!e||!O||!_)return(0,H.jsx)(`div`,{className:ie,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:r(`channelsSelectTitle`)}),(0,H.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:r(`channelsSelectDescription`)})]})});let L=typeof u.enabled==`boolean`?u.enabled:!!_.enabled;return(0,H.jsxs)(`div`,{className:oe,children:[(0,H.jsx)(`div`,{className:`border-b border-gray-100 px-6 py-5`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(P,{name:e,src:C(e),className:s(`h-9 w-9 rounded-lg border`,L?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,H.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:e[0]})}),(0,H.jsx)(`h3`,{className:`truncate text-lg font-semibold text-gray-900 capitalize`,children:D})]}),(0,H.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:r(`channelsFormDescription`)}),A&&(0,H.jsxs)(`a`,{href:A,className:`mt-2 inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,H.jsx)(b,{className:`h-3.5 w-3.5`}),r(`channelsGuideTitle`)]})]}),(0,H.jsx)(R,{status:L?`active`:`inactive`,label:r(L?`statusActive`:`statusInactive`)})]})}),(0,H.jsxs)(`form`,{onSubmit:N,className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto overscroll-contain px-6 py-5`,children:S.map((t,n)=>{if(t.type===`fields`){let r=qe(x,t.section);return r.length===0?null:t.collapsible?(0,H.jsxs)(`details`,{className:`group rounded-2xl border border-gray-200/80 bg-white`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-5 py-4 text-sm font-medium text-gray-900`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{children:t.collapsible.title}),t.collapsible.description?(0,H.jsx)(`p`,{className:`mt-1 text-xs font-normal text-gray-500`,children:t.collapsible.description}):null]}),(0,H.jsx)(p,{className:`h-4 w-4 text-gray-400 transition-transform group-open:rotate-180`})]}),(0,H.jsx)(`div`,{className:`space-y-6 border-t border-gray-100 px-5 py-5`,children:(0,H.jsx)(U,{channelName:e,fields:r,formData:u,jsonDrafts:f,setJsonDrafts:m,updateField:M,uiHints:w})})]},`${t.type}-${t.section}-${n}`):(0,H.jsx)(U,{channelName:e,fields:r,formData:u,jsonDrafts:f,setJsonDrafts:m,updateField:M,uiHints:w},`${t.type}-${t.section}-${n}`)}return t.sectionId===`weixin-auth`?(0,H.jsx)(We,{channelConfig:_,formData:u,channelEnabled:L,disabled:a.isPending||!!h},`${t.type}-${t.sectionId}-${n}`):null})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-gray-100 px-6 py-4`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:E.filter(e=>e.trigger===`manual`).map(e=>(0,H.jsx)(l,{type:`button`,onClick:()=>I(e),disabled:a.isPending||!!h,variant:`secondary`,children:h===e.id?r(`connecting`):e.title},e.id))}),(0,H.jsx)(l,{type:`submit`,disabled:a.isPending||!!h,children:a.isPending?r(`saving`):r(`save`)})]})]})]})}var Ye={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`};function Xe(){let{data:e}=k(),{data:t}=j(),{data:n}=ne(),[i,a]=(0,B.useState)(`enabled`),[o,c]=(0,B.useState)(),[l,u]=(0,B.useState)(``),d=n?.uiHints,f=t?.channels,p=e?.channels,m=[{id:`enabled`,label:r(`channelsTabEnabled`),count:(f??[]).filter(e=>p?.[e.name]?.enabled).length},{id:`all`,label:r(`channelsTabAll`),count:(f??[]).length}],h=(0,B.useMemo)(()=>{let e=l.trim().toLowerCase();return(f??[]).filter(e=>{let t=p?.[e.name]?.enabled||!1;return i===`enabled`?t:!0}).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[i,p,f,l]);return(0,B.useEffect)(()=>{if(h.length===0){c(void 0);return}h.some(e=>e.name===o)||c(h[0].name)},[h,o]),!e||!t?(0,H.jsx)(`div`,{className:`p-8 text-gray-400`,children:r(`channelsLoading`)}):(0,H.jsxs)(F,{className:`xl:flex xl:h-full xl:min-h-0 xl:flex-col xl:pb-0`,children:[(0,H.jsx)(I,{title:r(`channelsPageTitle`),description:r(`channelsPageDescription`)}),(0,H.jsxs)(`div`,{className:s(re,`xl:min-h-0 xl:flex-1`),children:[(0,H.jsxs)(`section`,{className:ae,children:[(0,H.jsx)(`div`,{className:`border-b border-gray-100 px-4 pt-4`,children:(0,H.jsx)(L,{tabs:m,activeTab:i,onChange:a,className:`mb-0`})}),(0,H.jsx)(`div`,{className:`border-b border-gray-100 px-4 py-3`,children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(E,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,H.jsx)(O,{value:l,onChange:e=>u(e.target.value),placeholder:r(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-3`,children:[h.map(t=>{let n=e.channels[t.name]?.enabled||!1,i=z(`channels.${t.name}`,d),a=V(t),l=i?.help||r(Ye[t.name]||`channelDescriptionDefault`);return(0,H.jsx)(`button`,{type:`button`,onClick:()=>c(t.name),className:s(`w-full rounded-xl border p-2.5 text-left transition-all`,o===t.name?`border-primary/30 bg-primary-50/40 shadow-sm`:`border-gray-200/70 bg-white hover:border-gray-300 hover:bg-gray-50/70`),children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.jsx)(P,{name:t.name,src:C(t.name),className:s(`h-10 w-10 rounded-lg border`,n?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,H.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:t.name[0]})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:t.displayName||t.name}),(0,H.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-gray-500`,children:l})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a&&(0,H.jsx)(`a`,{href:a,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-300 transition-colors hover:bg-gray-100/70 hover:text-gray-500`,title:r(`channelsGuideTitle`),children:(0,H.jsx)(x,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(R,{status:n?`active`:`inactive`,label:r(n?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},t.name)}),h.length===0&&(0,H.jsxs)(`div`,{className:`flex h-full min-h-[220px] flex-col items-center justify-center rounded-xl border border-dashed border-gray-200 bg-gray-50/70 py-10 text-center`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white`,children:(0,H.jsx)(N,{className:`h-5 w-5 text-gray-300`})}),(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-700`,children:r(`channelsNoMatch`)})]})]})]}),(0,H.jsx)(Je,{channelName:o})]})]})}export{Xe as ChannelsList};
|
|
7
|
+
`);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Q=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[a[t*i+r]?1:0]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Fe=t((e=>{var t=Q();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Ie=t((e=>{var t=Q();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
|
|
8
|
+
`;return typeof a==`function`&&a(null,p),p}})),Le=t((e=>{var t=_e(),n=Pe(),r=Fe(),i=Ie();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))();async function Re(e,t={}){let n=await u.post(`/api/config/channels/${e}/auth/start`,t);if(!n.ok)throw Error(n.error.message);return n.data}async function ze(e,t){let n=await u.post(`/api/config/channels/${e}/auth/poll`,t);if(!n.ok)throw Error(n.error.message);return n.data}function Be(){return f({mutationFn:({channel:e,data:t})=>Re(e,t)})}function Ve(){return f({mutationFn:({channel:e,data:t})=>ze(e,t)})}function He(e){let t=e.accounts,n=new Set;if(typeof e.defaultAccountId==`string`&&e.defaultAccountId.trim()&&n.add(e.defaultAccountId.trim()),t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t)){let t=e.trim();t&&n.add(t)}return[...n]}function Ue(e,t){if(typeof e.baseUrl==`string`&&e.baseUrl.trim())return e.baseUrl.trim();if(typeof t.baseUrl==`string`&&t.baseUrl.trim())return t.baseUrl.trim()}function We({channelConfig:e,formData:t,channelEnabled:r,disabled:a=!1}){let o=d(),u=Be(),f=Ve(),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(null),y=(0,B.useMemo)(()=>He(e),[e]),b=y[0],S=Ue(t,e),C=y.length>0;(0,B.useEffect)(()=>{C&&(m(null),g(e=>e?.status===`authorized`?e:{channel:`weixin`,status:`authorized`,message:n(`weixinAuthAuthorized`),accountId:b??null}))},[C,b]),(0,B.useEffect)(()=>{if(!p){v(null);return}let e=!1;return(0,Le.toDataURL)(p.qrCodeUrl,{errorCorrectionLevel:`M`,margin:1,width:480}).then(t=>{e||v(t)}).catch(()=>{e||v(null)}),()=>{e=!0}},[p]),(0,B.useEffect)(()=>{if(!p)return;let e=!1,t=null,r=async()=>{try{let i=await f.mutateAsync({channel:`weixin`,data:{sessionId:p.sessionId}});if(e)return;if(g(i),i.status===`authorized`){await o.invalidateQueries({queryKey:[`config`]}),await o.invalidateQueries({queryKey:[`config-meta`]}),c.success(i.message||n(`weixinAuthAuthorized`)),m(null);return}if(i.status===`expired`||i.status===`error`){c.error(i.message||n(`weixinAuthRetryRequired`)),m(null);return}t=setTimeout(r,i.nextPollMs??p.intervalMs)}catch(t){if(e)return;let r=t instanceof Error?t.message:String(t);c.error(`${n(`error`)}: ${r}`),m(null)}};return t=setTimeout(r,p.intervalMs),()=>{e=!0,t&&clearTimeout(t)}},[p,f,o]);let w=async()=>{try{let e=await u.mutateAsync({channel:`weixin`,data:{baseUrl:S,accountId:typeof t.defaultAccountId==`string`&&t.defaultAccountId.trim()?t.defaultAccountId.trim():void 0}});m(e),g({channel:`weixin`,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){let t=e instanceof Error?e.message:String(e);c.error(`${n(`error`)}: ${t}`)}},E=p?h?.status===`scanned`?n(`weixinAuthScanned`):n(`weixinAuthWaiting`):n(C?r?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),D=u.isPending?n(`weixinAuthStarting`):n(p?`weixinAuthWaiting`:C?`weixinAuthReconnect`:`weixinAuthConnect`);return(0,H.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-gradient-to-br from-primary-50/70 via-white to-emerald-50/60 p-5`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-white/90 px-3 py-1 text-xs font-medium text-primary shadow-sm`,children:[(0,H.jsx)(de,{className:`h-3.5 w-3.5`}),n(`weixinAuthTitle`)]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:n(`weixinAuthDescription`)}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:n(`weixinAuthHint`)})]}),(0,H.jsxs)(`div`,{className:s(`inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-medium`,p?`bg-amber-50 text-amber-700`:C?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-600`),children:[p?(0,H.jsx)(T,{className:`h-3.5 w-3.5 animate-spin`}):(0,H.jsx)(ue,{className:`h-3.5 w-3.5`}),E]}),(0,H.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,H.jsx)(`p`,{children:n(r||!C?`weixinAuthCapabilityHint`:`weixinAuthDisabledHint`)}),b?(0,H.jsxs)(`p`,{children:[n(`weixinAuthPrimaryAccount`),`: `,(0,H.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:b})]}):null,y.length>1?(0,H.jsxs)(`p`,{children:[n(`weixinAuthConnectedAccounts`),`: `,(0,H.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:y.join(`, `)})]}):null,S?(0,H.jsxs)(`p`,{children:[n(`weixinAuthBaseUrl`),`: `,(0,H.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:S})]}):null]}),(0,H.jsx)(l,{type:`button`,onClick:w,disabled:a||u.isPending||!!p,className:`rounded-xl`,children:D})]}),(0,H.jsx)(`div`,{className:`w-full max-w-sm rounded-2xl border border-dashed border-primary/25 bg-white/85 p-4 shadow-sm`,children:p?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:_?(0,H.jsx)(`img`,{src:_,alt:n(`weixinAuthQrAlt`),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,H.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,H.jsx)(T,{className:`h-5 w-5 animate-spin`}),(0,H.jsx)(`p`,{className:`text-xs`,children:n(`weixinAuthStarting`)})]})})}),(0,H.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,H.jsx)(`p`,{children:h?.message||p.note||n(`weixinAuthScanPrompt`)}),(0,H.jsxs)(`p`,{children:[n(`weixinAuthExpiresAt`),`: `,i(p.expiresAt)]})]}),(0,H.jsxs)(`a`,{href:p.qrCodeUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,H.jsx)(x,{className:`h-3.5 w-3.5`}),n(`weixinAuthOpenQr`)]})]}):(0,H.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center rounded-2xl bg-gray-50/80 px-6 text-center`,children:[(0,H.jsx)(de,{className:`h-9 w-9 text-gray-300`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:n(`weixinAuthReadyTitle`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:n(`weixinAuthReadyDescription`)})]})})]})})}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ge(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if($(t)&&$(r)){n[e]=Ge(t,r);continue}n[e]=r}return n}function Ke(e,t){let n=e.split(`.`),r={},i=r;for(let e=0;e<n.length-1;e+=1){let t=n[e];i[t]={},i=i[t]}return i[n[n.length-1]]=t,r}function qe(e,t){return t===`all`?e:t===`primary`?e.filter(e=>e.section===`primary`):e.filter(e=>e.section!==`primary`)}function Je({channelName:e}){let{data:t}=k(),{data:r}=j(),{data:i}=N(),a=ee(),o=te(),[u,d]=(0,B.useState)({}),[f,m]=(0,B.useState)({}),[h,g]=(0,B.useState)(null),_=e?t?.channels[e]:null,v=(0,B.useMemo)(()=>ge(),[]),y=e?v[e]:void 0,x=y?.fields??[],S=y?.layout??[{type:`fields`,section:`all`}],w=i?.uiHints,T=e?`channels.${e}`:null,E=i?.actions?.filter(e=>e.scope===T)??[],D=e&&(z(`channels.${e}`,w)?.label??e),O=r?.channels.find(t=>t.name===e),A=O?V(O):void 0;(0,B.useEffect)(()=>{if(_){d({..._});let e={};x.filter(e=>e.type===`json`).forEach(t=>{let n=_[t.name];e[t.name]=JSON.stringify(n??{},null,2)}),m(e)}else d({}),m({})},[_,x]);let M=(e,t)=>{d(n=>({...n,[e]:t}))},ne=t=>{if(t.preventDefault(),!e)return;let r={...u};for(let e of x){if(e.type!==`password`)continue;let t=r[e.name];(typeof t!=`string`||t.length===0)&&delete r[e.name]}for(let e of x){if(e.type!==`json`)continue;let t=f[e.name]??``;try{r[e.name]=t.trim()?JSON.parse(t):{}}catch{c.error(`${n(`invalidJson`)}: ${e.name}`);return}}a.mutate({channel:e,data:r})},F=t=>{if(!t||!e)return;let n=t.channels;if(!$(n))return;let r=n[e];$(r)&&d(e=>Ge(e,r))},I=async t=>{if(!(!e||!T)){g(t.id);try{let r={...u};t.saveBeforeRun&&(r={...r,...t.savePatch??{}},d(r),await a.mutateAsync({channel:e,data:r}));let i=await o.mutateAsync({actionId:t.id,data:{scope:T,draftConfig:Ke(T,r)}});F(i.patch),i.ok?c.success(i.message||n(`success`)):c.error(i.message||n(`error`))}catch(e){let t=e instanceof Error?e.message:String(e);c.error(`${n(`error`)}: ${t}`)}finally{g(null)}}};if(!e||!O||!_)return(0,H.jsx)(`div`,{className:ae,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:n(`channelsSelectTitle`)}),(0,H.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:n(`channelsSelectDescription`)})]})});let L=typeof u.enabled==`boolean`?u.enabled:!!_.enabled;return(0,H.jsxs)(`div`,{className:se,children:[(0,H.jsx)(`div`,{className:`border-b border-gray-100 px-6 py-5`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(P,{name:e,src:C(e),className:s(`h-9 w-9 rounded-lg border`,L?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,H.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:e[0]})}),(0,H.jsx)(`h3`,{className:`truncate text-lg font-semibold text-gray-900 capitalize`,children:D})]}),(0,H.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:n(`channelsFormDescription`)}),A&&(0,H.jsxs)(`a`,{href:A,className:`mt-2 inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,H.jsx)(b,{className:`h-3.5 w-3.5`}),n(`channelsGuideTitle`)]})]}),(0,H.jsx)(R,{status:L?`active`:`inactive`,label:n(L?`statusActive`:`statusInactive`)})]})}),(0,H.jsxs)(`form`,{onSubmit:ne,className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto overscroll-contain px-6 py-5`,children:S.map((t,n)=>{if(t.type===`fields`){let r=qe(x,t.section);return r.length===0?null:t.collapsible?(0,H.jsxs)(`details`,{className:`group rounded-2xl border border-gray-200/80 bg-white`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-5 py-4 text-sm font-medium text-gray-900`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{children:t.collapsible.title}),t.collapsible.description?(0,H.jsx)(`p`,{className:`mt-1 text-xs font-normal text-gray-500`,children:t.collapsible.description}):null]}),(0,H.jsx)(p,{className:`h-4 w-4 text-gray-400 transition-transform group-open:rotate-180`})]}),(0,H.jsx)(`div`,{className:`space-y-6 border-t border-gray-100 px-5 py-5`,children:(0,H.jsx)(U,{channelName:e,fields:r,formData:u,jsonDrafts:f,setJsonDrafts:m,updateField:M,uiHints:w})})]},`${t.type}-${t.section}-${n}`):(0,H.jsx)(U,{channelName:e,fields:r,formData:u,jsonDrafts:f,setJsonDrafts:m,updateField:M,uiHints:w},`${t.type}-${t.section}-${n}`)}return t.sectionId===`weixin-auth`?(0,H.jsx)(We,{channelConfig:_,formData:u,channelEnabled:L,disabled:a.isPending||!!h},`${t.type}-${t.sectionId}-${n}`):null})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-gray-100 px-6 py-4`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:E.filter(e=>e.trigger===`manual`).map(e=>(0,H.jsx)(l,{type:`button`,onClick:()=>I(e),disabled:a.isPending||!!h,variant:`secondary`,children:h===e.id?n(`connecting`):e.title},e.id))}),(0,H.jsx)(l,{type:`submit`,disabled:a.isPending||!!h,children:a.isPending?n(`saving`):n(`save`)})]})]})]})}var Ye={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`};function Xe(){let{data:e}=k(),{data:t}=j(),{data:r}=N(),[i,a]=(0,B.useState)(`enabled`),[o,c]=(0,B.useState)(),[l,u]=(0,B.useState)(``),d=r?.uiHints,f=t?.channels,p=e?.channels,m=[{id:`enabled`,label:n(`channelsTabEnabled`),count:(f??[]).filter(e=>p?.[e.name]?.enabled).length},{id:`all`,label:n(`channelsTabAll`),count:(f??[]).length}],h=(0,B.useMemo)(()=>{let e=l.trim().toLowerCase();return(f??[]).filter(e=>{let t=p?.[e.name]?.enabled||!1;return i===`enabled`?t:!0}).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[i,p,f,l]);return(0,B.useEffect)(()=>{if(h.length===0){c(void 0);return}h.some(e=>e.name===o)||c(h[0].name)},[h,o]),!e||!t?(0,H.jsx)(`div`,{className:`p-8 text-gray-400`,children:n(`channelsLoading`)}):(0,H.jsxs)(I,{className:`xl:flex xl:h-full xl:min-h-0 xl:flex-col xl:pb-0`,children:[(0,H.jsx)(L,{title:n(`channelsPageTitle`),description:n(`channelsPageDescription`)}),(0,H.jsxs)(`div`,{className:s(ie,`xl:min-h-0 xl:flex-1`),children:[(0,H.jsxs)(`section`,{className:oe,children:[(0,H.jsx)(`div`,{className:`border-b border-gray-100 px-4 pt-4`,children:(0,H.jsx)(re,{tabs:m,activeTab:i,onChange:a,className:`mb-0`})}),(0,H.jsx)(`div`,{className:`border-b border-gray-100 px-4 py-3`,children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(E,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,H.jsx)(O,{value:l,onChange:e=>u(e.target.value),placeholder:n(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-3`,children:[h.map(t=>{let r=e.channels[t.name]?.enabled||!1,i=z(`channels.${t.name}`,d),a=V(t),l=i?.help||n(Ye[t.name]||`channelDescriptionDefault`);return(0,H.jsx)(`button`,{type:`button`,onClick:()=>c(t.name),className:s(`w-full rounded-xl border p-2.5 text-left transition-all`,o===t.name?`border-primary/30 bg-primary-50/40 shadow-sm`:`border-gray-200/70 bg-white hover:border-gray-300 hover:bg-gray-50/70`),children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.jsx)(P,{name:t.name,src:C(t.name),className:s(`h-10 w-10 rounded-lg border`,r?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,H.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:t.name[0]})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:t.displayName||t.name}),(0,H.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-gray-500`,children:l})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a&&(0,H.jsx)(`a`,{href:a,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-300 transition-colors hover:bg-gray-100/70 hover:text-gray-500`,title:n(`channelsGuideTitle`),children:(0,H.jsx)(x,{className:`h-3.5 w-3.5`})}),(0,H.jsx)(R,{status:r?`active`:`inactive`,label:n(r?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},t.name)}),h.length===0&&(0,H.jsxs)(`div`,{className:`flex h-full min-h-[220px] flex-col items-center justify-center rounded-xl border border-dashed border-gray-200 bg-gray-50/70 py-10 text-center`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white`,children:(0,H.jsx)(A,{className:`h-5 w-5 text-gray-300`})}),(0,H.jsx)(`p`,{className:`text-sm font-medium text-gray-700`,children:n(`channelsNoMatch`)})]})]})]}),(0,H.jsx)(Je,{channelName:o})]})]})}export{Xe as ChannelsList};
|