@futdevpro/ccap 1.1.4 → 1.1.5
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/cli/build/_commands/vault-key.d.ts +2 -2
- package/cli/build/_commands/vault-key.js +2 -2
- package/cli/build/program.js +1 -0
- package/cli/build/program.js.map +1 -1
- package/client-dist/{browser/chunk-YV5G3XYV.js → chunk-I3EQOLVU.js} +1 -1
- package/client-dist/chunk-NCN3S5MX.js +218 -0
- package/client-dist/{browser/index.html → index.html} +5 -3
- package/client-dist/main-XGKAOHPV.js +5 -0
- package/client-dist/styles-B2BQKIR4.css +1 -0
- package/package.json +10 -4
- package/server/build/package.json +2 -1
- package/server/build/src/_collections/contract-templates/context.contract-template.js +1 -1
- package/server/build/src/_collections/contract-templates/execution-summary.contract-template.js +1 -1
- package/server/build/src/_collections/contract-templates/history-summary.contract-template.js +1 -1
- package/server/build/src/_collections/contract-templates/run.contract-template.js +1 -1
- package/server/build/src/_collections/contract-templates/session.contract-template.js +1 -1
- package/server/build/src/_models/interfaces/ccap-channel-identifier.interface.js +1 -1
- package/server/build/src/_modules/agent/agentic-loop.control-service.js +3 -3
- package/server/build/src/_modules/agent/agentic-loop.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/analyze.control-service.js +1 -1
- package/server/build/src/_modules/agent/assemble-conversation.control-service.js +3 -2
- package/server/build/src/_modules/agent/assemble-conversation.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/compacting/_collections/compacting.const.js +1 -1
- package/server/build/src/_modules/agent/compacting/chat-history-compacting.control-service.js +1 -1
- package/server/build/src/_modules/agent/compacting/context-compacting.control-service.js +1 -1
- package/server/build/src/_modules/agent/compacting/conversation-full-active-compacting.control-service.js +2 -2
- package/server/build/src/_modules/agent/compacting/conversation-full-active-compacting.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/compacting/execution-history-compacting.control-service.js +1 -1
- package/server/build/src/_modules/agent/compacting/soul-compacting.control-service.js +2 -2
- package/server/build/src/_modules/agent/compacting/soul-compacting.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/compacting/tool-result-compacting.control-service.js +2 -2
- package/server/build/src/_modules/agent/compacting/tool-result-compacting.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/execution.control-service.js +2 -2
- package/server/build/src/_modules/agent/execution.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/history/chat-history.control-service.js +1 -1
- package/server/build/src/_modules/agent/history/execution-history.control-service.js +2 -2
- package/server/build/src/_modules/agent/history/execution-history.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/new-user-message-handling.control-service.js +3 -3
- package/server/build/src/_modules/agent/new-user-message-handling.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/run-finalization.control-service.js +1 -1
- package/server/build/src/_modules/agent/run-flow.control-service.js +6 -6
- package/server/build/src/_modules/agent/run-flow.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/run-initialization.control-service.js +2 -2
- package/server/build/src/_modules/agent/run-initialization.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/run.data-service.js +2 -2
- package/server/build/src/_modules/agent/run.data-service.js.map +1 -1
- package/server/build/src/_modules/agent/session-mutex.control-service.js +2 -2
- package/server/build/src/_modules/agent/session-mutex.control-service.js.map +1 -1
- package/server/build/src/_modules/agent/tool-calling.control-service.js +3 -3
- package/server/build/src/_modules/agent/tool-calling.control-service.js.map +1 -1
- package/server/build/src/_modules/context/context-builder.util-service.js +1 -1
- package/server/build/src/_modules/context/context-management.control-service.js +13 -13
- package/server/build/src/_modules/context/context-management.control-service.js.map +1 -1
- package/server/build/src/_modules/context/knowledge.data-service.js +2 -2
- package/server/build/src/_modules/context/knowledge.data-service.js.map +1 -1
- package/server/build/src/_modules/context/session-info-context.data-service.js +1 -1
- package/server/build/src/_modules/error-handling/error-collector.util-service.js +1 -1
- package/server/build/src/_modules/error-handling/error-table.data-service.js +1 -1
- package/server/build/src/_modules/llm/llm.control-service.js +3 -3
- package/server/build/src/_modules/llm/llm.control-service.js.map +1 -1
- package/server/build/src/_modules/llm/providers/custom-local-ai-llm.control-service.js +2 -2
- package/server/build/src/_modules/llm/providers/custom-local-ai-llm.control-service.js.map +1 -1
- package/server/build/src/_modules/llm/providers/openai-llm.control-service.js +2 -2
- package/server/build/src/_modules/llm/providers/openai-llm.control-service.js.map +1 -1
- package/server/build/src/_modules/llm/system-prompt.data-service.js +1 -1
- package/server/build/src/_modules/messaging/messaging-router.control-service.js +10 -8
- package/server/build/src/_modules/messaging/messaging-router.control-service.js.map +1 -1
- package/server/build/src/_modules/messaging/providers/ccap-client-messaging.control-service.js +4 -4
- package/server/build/src/_modules/messaging/providers/ccap-client-messaging.control-service.js.map +1 -1
- package/server/build/src/_modules/messaging/providers/ccap-client-socket-server.service.js +7 -2
- package/server/build/src/_modules/messaging/providers/ccap-client-socket-server.service.js.map +1 -1
- package/server/build/src/_modules/messaging/providers/cli-messaging.control-service.js +2 -2
- package/server/build/src/_modules/messaging/providers/cli-messaging.control-service.js.map +1 -1
- package/server/build/src/_modules/messaging/providers/discord-messaging.control-service.js +2 -2
- package/server/build/src/_modules/messaging/providers/discord-messaging.control-service.js.map +1 -1
- package/server/build/src/_modules/monitoring/monitoring.data-service.js +1 -1
- package/server/build/src/_modules/monitoring/monitoring.data-service.js.map +1 -1
- package/server/build/src/_modules/secrets-vault/secrets-vault.data-service.js +2 -2
- package/server/build/src/_modules/secrets-vault/secrets-vault.data-service.js.map +1 -1
- package/server/build/src/_modules/session/conversation.data-service.js +1 -1
- package/server/build/src/_modules/session/session.data-service.js +1 -1
- package/server/build/src/_modules/tools/_collections/tools.const.js +1 -1
- package/server/build/src/_modules/tools/fixed-tools/control/context-handling.tool.js +1 -1
- package/server/build/src/_modules/tools/fixed-tools/exec/exec.tool.js +1 -1
- package/server/build/src/_modules/tools/fixed-tools/file-handling/file-handling.tool.js +1 -1
- package/server/build/src/_modules/tools/fixed-tools/net/net.tool.js +1 -1
- package/server/build/src/_modules/tools/fixed-tools/tool-handling/tool-handling.tool.js +1 -1
- package/server/build/src/_modules/tools/tool-execution.control-service.js +1 -1
- package/server/build/src/_modules/tools/tool-execution.control-service.js.map +1 -1
- package/server/build/src/_modules/tools/tool-registry.control-service.js +5 -5
- package/server/build/src/_modules/tools/tool-registry.control-service.js.map +1 -1
- package/server/build/src/_modules/tools/tools-in-context.util-service.js +1 -1
- package/server/build/src/_routes/client-static/client-static.controller.js +53 -5
- package/server/build/src/_routes/client-static/client-static.controller.js.map +1 -1
- package/server/build/src/_routes/root-redirect/root-redirect.controller.js +30 -0
- package/server/build/src/_routes/root-redirect/root-redirect.controller.js.map +1 -0
- package/server/build/src/_routes/server/server-status/server-status.controller.js +8 -1
- package/server/build/src/_routes/server/server-status/server-status.controller.js.map +1 -1
- package/server/build/src/app.server.js +20 -9
- package/server/build/src/app.server.js.map +1 -1
- package/client-dist/3rdpartylicenses.txt +0 -569
- package/client-dist/browser/chunk-FMFEMJE7.js +0 -218
- package/client-dist/browser/main-XZGF4SOO.js +0 -2
- package/client-dist/browser/styles-TSK27CYC.css +0 -1
- /package/client-dist/{browser/polyfills-HGDOEU5L.js → polyfills-HGDOEU5L.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CCAP vault-key parancs: Vault Key megjelenítése (CCAP_VAULT_MASTER_KEY env).
|
|
3
|
-
* Cél: biztonsági mentés, közös MongoDB esetén más agent konfigurálása
|
|
2
|
+
* CCAP vault-key parancs: Vault Key megjelenítése (CCAP_VAULT_MASTER_KEY env) (REQ-SYS-006).
|
|
3
|
+
* Cél: biztonsági mentés, közös MongoDB esetén más agent konfigurálása.
|
|
4
4
|
* A kulcs csak a CLI futtatási környezetéből olvasható (env); setup előtt is lekérhető.
|
|
5
5
|
*/
|
|
6
6
|
export declare function c_ccapVaultKey(): void;
|
|
@@ -17,8 +17,8 @@ function maskVaultKey(key) {
|
|
|
17
17
|
return '****' + key.slice(-4);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* CCAP vault-key parancs: Vault Key megjelenítése (CCAP_VAULT_MASTER_KEY env).
|
|
21
|
-
* Cél: biztonsági mentés, közös MongoDB esetén más agent konfigurálása
|
|
20
|
+
* CCAP vault-key parancs: Vault Key megjelenítése (CCAP_VAULT_MASTER_KEY env) (REQ-SYS-006).
|
|
21
|
+
* Cél: biztonsági mentés, közös MongoDB esetén más agent konfigurálása.
|
|
22
22
|
* A kulcs csak a CLI futtatási környezetéből olvasható (env); setup előtt is lekérhető.
|
|
23
23
|
*/
|
|
24
24
|
function c_ccapVaultKey() {
|
package/cli/build/program.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/** CLI commander: ccap start, chat, config, status (REQ-TECH-002, REQ-TECH-003, REQ-SYS-002, REQ-SYS-003). */
|
|
4
5
|
const commander_1 = require("commander");
|
|
5
6
|
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
6
7
|
const start_1 = require("./_commands/start");
|
package/cli/build/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AAEpC,sDAAiD;AAEjD,6CAAgD;AAChD,2CAA8C;AAC9C,iDAAoD;AACpD,2CAA8C;AAC9C,+CAAkD;AAClD,2CAA8C;AAC9C,+CAAkD;AAClD,mDAAsD;AACtD,qDAAuD;AACvD,+CAAkD;AAClD,iDAAoD;AAEpD,oEAA+D;AAC/D,wEAA0E;AAC1E,gEAA4D;AAE5D,mBAAO;KACJ,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CACV,gDAAgD;MAC9C,uBAAuB,CAC1B;KACA,OAAO,CAAC,4BAAY,EAAE,eAAe,EAAE,4BAA4B,CAAC,CAAC;AAExE,+FAA+F;AAC/F,MAAM,wBAAwB,GAAW,KAAK,CAAC;AAE/C,mBAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,gDAAgD,CAAC;KAC7D,MAAM,CAAC,GAAS,EAAE;IACjB,CAAC,KAAK,IAAmB,EAAE;QACzB,MAAM,IAAA,mBAAW,GAAE,CAAC;QACpB,MAAM,QAAQ,GAAY,MAAM,IAAA,+BAAa,EAAC,wBAAwB,CAAC,CAAC;QACxE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,qBAAQ,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACxE,CAAC;QACD,MAAM,IAAA,0CAAsB,GAAE,CAAC;IACjC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAQ,EAAE;QAChC,qBAAQ,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,2BAA2B,CAAC;KACxC,MAAM,CAAC,iBAAU,CAAC,CAAC;AAEtB,mBAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,uBAAa,CAAC,CAAC;AAEzB,mBAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CACV,wEAAwE,CACzE;KACA,MAAM,CAAC,GAAS,EAAE;IACjB,IAAA,qBAAY,GAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAQ,EAAE;QAC1C,qBAAQ,CAAC,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,yBAAyB,CAAC;KACtC,MAAM,CAAC,iBAAU,CAAC,CAAC;AAEtB,mBAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,wCAAwC,CAAC;KACrD,MAAM,CAAC,GAAS,EAAE;IACjB,IAAA,qBAAY,GAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAQ,EAAE;QAC1C,qBAAQ,CAAC,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,mFAAmF,CAAC;KAChG,MAAM,CAAC,GAAS,EAAE;IACjB,IAAA,iBAAU,EAAC;QACT,SAAS,EAAE,GAAkB,EAAE,CAAC,IAAA,iBAAU,GAAE;KAC7C,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAQ,EAAE;QAC9B,qBAAQ,CAAC,KAAK,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,qBAAY,CAAC,CAAC;AAExB,mBAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,yBAAc,CAAC,CAAC;AAE1B,mBAAO;KACJ,OAAO,CAAC,WAAW,CAAC;KACpB,WAAW,CAAC,4DAA4D,CAAC;KACzE,MAAM,CAAC,0BAAc,CAAC,CAAC;AAE1B,mBAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,mBAAmB,CAAC;KAChC,MAAM,CAAC,uBAAa,CAAC,CAAC;AAEzB,mBAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,+BAA+B;AAC/B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,qBAAQ,CAAC,IAAI,CACX,kCAAkC;UAChC,kFAAkF,CACrF,CAAC;IAEF,mBAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":";;;AACA,8GAA8G;AAC9G,yCAAoC;AAEpC,sDAAiD;AAEjD,6CAAgD;AAChD,2CAA8C;AAC9C,iDAAoD;AACpD,2CAA8C;AAC9C,+CAAkD;AAClD,2CAA8C;AAC9C,+CAAkD;AAClD,mDAAsD;AACtD,qDAAuD;AACvD,+CAAkD;AAClD,iDAAoD;AAEpD,oEAA+D;AAC/D,wEAA0E;AAC1E,gEAA4D;AAE5D,mBAAO;KACJ,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CACV,gDAAgD;MAC9C,uBAAuB,CAC1B;KACA,OAAO,CAAC,4BAAY,EAAE,eAAe,EAAE,4BAA4B,CAAC,CAAC;AAExE,+FAA+F;AAC/F,MAAM,wBAAwB,GAAW,KAAK,CAAC;AAE/C,mBAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,gDAAgD,CAAC;KAC7D,MAAM,CAAC,GAAS,EAAE;IACjB,CAAC,KAAK,IAAmB,EAAE;QACzB,MAAM,IAAA,mBAAW,GAAE,CAAC;QACpB,MAAM,QAAQ,GAAY,MAAM,IAAA,+BAAa,EAAC,wBAAwB,CAAC,CAAC;QACxE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,qBAAQ,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACxE,CAAC;QACD,MAAM,IAAA,0CAAsB,GAAE,CAAC;IACjC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAQ,EAAE;QAChC,qBAAQ,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,2BAA2B,CAAC;KACxC,MAAM,CAAC,iBAAU,CAAC,CAAC;AAEtB,mBAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,uBAAa,CAAC,CAAC;AAEzB,mBAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CACV,wEAAwE,CACzE;KACA,MAAM,CAAC,GAAS,EAAE;IACjB,IAAA,qBAAY,GAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAQ,EAAE;QAC1C,qBAAQ,CAAC,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,yBAAyB,CAAC;KACtC,MAAM,CAAC,iBAAU,CAAC,CAAC;AAEtB,mBAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,wCAAwC,CAAC;KACrD,MAAM,CAAC,GAAS,EAAE;IACjB,IAAA,qBAAY,GAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAQ,EAAE;QAC1C,qBAAQ,CAAC,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,mFAAmF,CAAC;KAChG,MAAM,CAAC,GAAS,EAAE;IACjB,IAAA,iBAAU,EAAC;QACT,SAAS,EAAE,GAAkB,EAAE,CAAC,IAAA,iBAAU,GAAE;KAC7C,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAQ,EAAE;QAC9B,qBAAQ,CAAC,KAAK,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,qBAAY,CAAC,CAAC;AAExB,mBAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,yBAAc,CAAC,CAAC;AAE1B,mBAAO;KACJ,OAAO,CAAC,WAAW,CAAC;KACpB,WAAW,CAAC,4DAA4D,CAAC;KACzE,MAAM,CAAC,0BAAc,CAAC,CAAC;AAE1B,mBAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,mBAAmB,CAAC;KAChC,MAAM,CAAC,uBAAa,CAAC,CAAC;AAEzB,mBAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,+BAA+B;AAC/B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,qBAAQ,CAAC,IAAI,CACX,kCAAkC;UAChC,kFAAkF,CACrF,CAAC;IAEF,mBAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as ht,A as r,B as A,C as E,D as f,E as u,F as l,G as k,H as x,J as st,K as ot,L as rt,M as at,N as Be,O as ee,P as ct,Q as U,R as lt,S as Y,W as pt,X as ye,Y as ut,Z as dt,a as fn,b as tt,ba as ft,c as P,ca as mt,d as G,e as M,f as V,fa as _t,g as nt,h as L,ha as Ct,i as v,ia as B,j as it,k as xe,l as b,m as S,n as W,p as c,q as w,r as C,s as g,t as De,u as h,v as Z,w as ve,x as N,y as D,z as a}from"./chunk-FMFEMJE7.js";var F=Object.create(null);F.open="0";F.close="1";F.ping="2";F.pong="3";F.message="4";F.upgrade="5";F.noop="6";var ce=Object.create(null);Object.keys(F).forEach(t=>{ce[F[t]]=t});var le={type:"error",data:"parser error"};var vt=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",yt=typeof ArrayBuffer=="function",bt=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,pe=({type:t,data:n},e,i)=>vt&&n instanceof Blob?e?i(n):gt(n,i):yt&&(n instanceof ArrayBuffer||bt(n))?e?i(n):gt(new Blob([n]),i):i(F[t]+(n||"")),gt=(t,n)=>{let e=new FileReader;return e.onload=function(){let i=e.result.split(",")[1];n("b"+(i||""))},e.readAsDataURL(t)};function xt(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}var Fe;function St(t,n){if(vt&&t.data instanceof Blob)return t.data.arrayBuffer().then(xt).then(n);if(yt&&(t.data instanceof ArrayBuffer||bt(t.data)))return n(xt(t.data));pe(t,!1,e=>{Fe||(Fe=new TextEncoder),n(Fe.encode(e))})}var wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<wt.length;t++)ue[wt.charCodeAt(t)]=t;var Et=t=>{let n=t.length*.75,e=t.length,i,s=0,o,p,m,_;t[t.length-1]==="="&&(n--,t[t.length-2]==="="&&n--);let j=new ArrayBuffer(n),R=new Uint8Array(j);for(i=0;i<e;i+=4)o=ue[t.charCodeAt(i)],p=ue[t.charCodeAt(i+1)],m=ue[t.charCodeAt(i+2)],_=ue[t.charCodeAt(i+3)],R[s++]=o<<2|p>>4,R[s++]=(p&15)<<4|m>>2,R[s++]=(m&3)<<6|_&63;return j};var mn=typeof ArrayBuffer=="function",de=(t,n)=>{if(typeof t!="string")return{type:"message",data:Tt(t,n)};let e=t.charAt(0);return e==="b"?{type:"message",data:_n(t.substring(1),n)}:ce[e]?t.length>1?{type:ce[e],data:t.substring(1)}:{type:ce[e]}:le},_n=(t,n)=>{if(mn){let e=Et(t);return Tt(e,n)}else return{base64:!0,data:t}},Tt=(t,n)=>{switch(n){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}};var At="",kt=(t,n)=>{let e=t.length,i=new Array(e),s=0;t.forEach((o,p)=>{pe(o,!1,m=>{i[p]=m,++s===e&&n(i.join(At))})})},It=(t,n)=>{let e=t.split(At),i=[];for(let s=0;s<e.length;s++){let o=de(e[s],n);if(i.push(o),o.type==="error")break}return i};function Pt(){return new TransformStream({transform(t,n){St(t,e=>{let i=e.length,s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);let o=new DataView(s.buffer);o.setUint8(0,126),o.setUint16(1,i)}else{s=new Uint8Array(9);let o=new DataView(s.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(i))}t.data&&typeof t.data!="string"&&(s[0]|=128),n.enqueue(s),n.enqueue(e)})}})}var Ve;function be(t){return t.reduce((n,e)=>n+e.length,0)}function Se(t,n){if(t[0].length===n)return t.shift();let e=new Uint8Array(n),i=0;for(let s=0;s<n;s++)e[s]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),e}function Mt(t,n){Ve||(Ve=new TextDecoder);let e=[],i=0,s=-1,o=!1;return new TransformStream({transform(p,m){for(e.push(p);;){if(i===0){if(be(e)<1)break;let _=Se(e,1);o=(_[0]&128)===128,s=_[0]&127,s<126?i=3:s===126?i=1:i=2}else if(i===1){if(be(e)<2)break;let _=Se(e,2);s=new DataView(_.buffer,_.byteOffset,_.length).getUint16(0),i=3}else if(i===2){if(be(e)<8)break;let _=Se(e,8),j=new DataView(_.buffer,_.byteOffset,_.length),R=j.getUint32(0);if(R>Math.pow(2,21)-1){m.enqueue(le);break}s=R*Math.pow(2,32)+j.getUint32(4),i=3}else{if(be(e)<s)break;let _=Se(e,s);m.enqueue(de(o?_:Ve.decode(_),n)),i=0}if(s===0||s>t){m.enqueue(le);break}}}})}var Le=4;function y(t){if(t)return Cn(t)}function Cn(t){for(var n in y.prototype)t[n]=y.prototype[n];return t}y.prototype.on=y.prototype.addEventListener=function(t,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(n),this};y.prototype.once=function(t,n){function e(){this.off(t,e),n.apply(this,arguments)}return e.fn=n,this.on(t,e),this};y.prototype.off=y.prototype.removeListener=y.prototype.removeAllListeners=y.prototype.removeEventListener=function(t,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+t];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var i,s=0;s<e.length;s++)if(i=e[s],i===n||i.fn===n){e.splice(s,1);break}return e.length===0&&delete this._callbacks["$"+t],this};y.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),e=this._callbacks["$"+t],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,s=e.length;i<s;++i)e[i].apply(this,n)}return this};y.prototype.emitReserved=y.prototype.emit;y.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};y.prototype.hasListeners=function(t){return!!this.listeners(t).length};var q=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,e)=>e(n,0),I=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ot="arraybuffer";function we(t,...n){return n.reduce((e,i)=>(t.hasOwnProperty(i)&&(e[i]=t[i]),e),{})}var gn=I.setTimeout,xn=I.clearTimeout;function K(t,n){n.useNativeTimers?(t.setTimeoutFn=gn.bind(I),t.clearTimeoutFn=xn.bind(I)):(t.setTimeoutFn=I.setTimeout.bind(I),t.clearTimeoutFn=I.clearTimeout.bind(I))}var vn=1.33;function Rt(t){return typeof t=="string"?yn(t):Math.ceil((t.byteLength||t.size)*vn)}function yn(t){let n=0,e=0;for(let i=0,s=t.length;i<s;i++)n=t.charCodeAt(i),n<128?e+=1:n<2048?e+=2:n<55296||n>=57344?e+=3:(i++,e+=4);return e}function Ee(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Nt(t){let n="";for(let e in t)t.hasOwnProperty(e)&&(n.length&&(n+="&"),n+=encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return n}function Dt(t){let n={},e=t.split("&");for(let i=0,s=e.length;i<s;i++){let o=e[i].split("=");n[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return n}var Te=class extends Error{constructor(n,e,i){super(n),this.description=e,this.context=i,this.type="TransportError"}},$=class extends y{constructor(n){super(),this.writable=!1,K(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,e,i){return super.emitReserved("error",new Te(n,e,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){let e=de(n,this.socket.binaryType);this.onPacket(e)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,e={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){let e=Nt(n);return e.length?"?"+e:""}};var he=class extends ${constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";let e=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){let e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};It(n,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,kt(n,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let n=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Ee()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(n,e)}};var Bt=!1;try{Bt=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Ft=Bt;function bn(){}var Ue=class extends he{constructor(n){if(super(n),typeof location<"u"){let e=location.protocol==="https:",i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||i!==n.port}}doWrite(n,e){let i=this.request({method:"POST",data:n});i.on("success",e),i.on("error",(s,o)=>{this.onError("xhr post error",s,o)})}doPoll(){let n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=n}},Ae=(()=>{class t extends y{constructor(e,i,s){super(),this.createRequest=e,K(this,s),this._opts=s,this._method=s.method||"GET",this._uri=i,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;let i=we(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(i);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&s.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var o;s.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=t.requestsCount++,t.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=bn,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete t.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return t.requestsCount=0,t.requests={},t})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Vt);else if(typeof addEventListener=="function"){let t="onpagehide"in I?"pagehide":"unload";addEventListener(t,Vt,!1)}}function Vt(){for(let t in Ae.requests)Ae.requests.hasOwnProperty(t)&&Ae.requests[t].abort()}var Sn=function(){let t=Lt({xdomain:!1});return t&&t.responseType!==null}(),J=class extends Ue{constructor(n){super(n);let e=n&&n.forceBase64;this.supportsBinary=Sn&&!e}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Ae(Lt,this.uri(),n)}};function Lt(t){let n=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||Ft))return new XMLHttpRequest}catch{}if(!n)try{return new I[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var Ut=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",qe=class extends ${get name(){return"websocket"}doOpen(){let n=this.uri(),e=this.opts.protocols,i=Ut?{}:we(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,e,i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let e=0;e<n.length;e++){let i=n[e],s=e===n.length-1;pe(i,this.supportsBinary,o=>{try{this.doWrite(i,o)}catch{}s&&q(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let n=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Ee()),this.supportsBinary||(e.b64=1),this.createUri(n,e)}},je=I.WebSocket||I.MozWebSocket,X=class extends qe{createSocket(n,e,i){return Ut?new je(n,e,i):e?new je(n,e):new je(n)}doWrite(n,e){this.ws.send(e)}};var te=class extends ${get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{let e=Mt(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=n.readable.pipeThrough(e).getReader(),s=Pt();s.readable.pipeTo(n.writable),this._writer=s.writable.getWriter();let o=()=>{i.read().then(({done:m,value:_})=>{m||(this.onPacket(_),o())}).catch(m=>{})};o();let p={type:"open"};this.query.sid&&(p.data=`{"sid":"${this.query.sid}"}`),this._writer.write(p).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let e=0;e<n.length;e++){let i=n[e],s=e===n.length-1;this._writer.write(i).then(()=>{s&&q(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}};var Ke={websocket:X,webtransport:te,polling:J};var wn=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,En=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ne(t){if(t.length>8e3)throw"URI too long";let n=t,e=t.indexOf("["),i=t.indexOf("]");e!=-1&&i!=-1&&(t=t.substring(0,e)+t.substring(e,i).replace(/:/g,";")+t.substring(i,t.length));let s=wn.exec(t||""),o={},p=14;for(;p--;)o[En[p]]=s[p]||"";return e!=-1&&i!=-1&&(o.source=n,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=Tn(o,o.path),o.queryKey=An(o,o.query),o}function Tn(t,n){let e=/\/{2,9}/g,i=n.replace(e,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&i.splice(0,1),n.slice(-1)=="/"&&i.splice(i.length-1,1),i}function An(t,n){let e={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,o){s&&(e[s]=o)}),e}var $e=typeof addEventListener=="function"&&typeof removeEventListener=="function",ke=[];$e&&addEventListener("offline",()=>{ke.forEach(t=>t())},!1);var Ie=(()=>{class t extends y{constructor(e,i){if(super(),this.binaryType=Ot,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(i=e,e=null),e){let s=ne(e);i.hostname=s.host,i.secure=s.protocol==="https"||s.protocol==="wss",i.port=s.port,s.query&&(i.query=s.query)}else i.host&&(i.hostname=ne(i.host).host);K(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(s=>{let o=s.prototype.name;this.transports.push(o),this._transportsByName[o]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Dt(this.opts.query)),$e&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ke.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=Le,i.transport=e,this.id&&(i.sid=this.id);let s=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&t.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",t.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=new Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let s=0;s<this.writeBuffer.length;s++){let o=this.writeBuffer[s].data;if(o&&(i+=Rt(o)),s>0&&i>this._maxPayload)return this.writeBuffer.slice(0,s);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,q(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,s){return this._sendPacket("message",e,i,s),this}send(e,i,s){return this._sendPacket("message",e,i,s),this}_sendPacket(e,i,s,o){if(typeof i=="function"&&(o=i,i=void 0),typeof s=="function"&&(o=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let p={type:e,data:i,options:s};this.emitReserved("packetCreate",p),this.writeBuffer.push(p),o&&this.once("flush",o),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},s=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(t.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),$e&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let s=ke.indexOf(this._offlineEventListener);s!==-1&&ke.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}return t.protocol=Le,t})(),Pe=class extends Ie{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let e=this.createTransport(n),i=!1;Ie.priorWebsocketSuccess=!1;let s=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",H=>{if(!i)if(H.type==="pong"&&H.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;Ie.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(R(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let ae=new Error("probe error");ae.transport=e.name,this.emitReserved("upgradeError",ae)}}))};function o(){i||(i=!0,R(),e.close(),e=null)}let p=H=>{let ae=new Error("probe error: "+H);ae.transport=e.name,o(),this.emitReserved("upgradeError",ae)};function m(){p("transport closed")}function _(){p("socket closed")}function j(H){e&&H.name!==e.name&&o()}let R=()=>{e.removeListener("open",s),e.removeListener("error",p),e.removeListener("close",m),this.off("close",_),this.off("upgrading",j)};e.once("open",s),e.once("error",p),e.once("close",m),this.once("close",_),this.once("upgrading",j),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){let e=[];for(let i=0;i<n.length;i++)~this.transports.indexOf(n[i])&&e.push(n[i]);return e}},ie=class extends Pe{constructor(n,e={}){let i=typeof n=="object"?n:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(s=>Ke[s]).filter(s=>!!s)),super(n,i)}};var Qs=ie.protocol;function jt(t,n="",e){let i=t;e=e||typeof location<"u"&&location,t==null&&(t=e.protocol+"//"+e.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=e.protocol+t:t=e.host+t),/^(https?|wss?):\/\//.test(t)||(typeof e<"u"?t=e.protocol+"//"+t:t="https://"+t),i=ne(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let o=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+o+":"+i.port+n,i.href=i.protocol+"://"+o+(e&&e.port===i.port?"":":"+i.port),i}var Xe={};fn(Xe,{Decoder:()=>Ye,Encoder:()=>We,PacketType:()=>d,isPacketValid:()=>Fn,protocol:()=>Ht});var In=typeof ArrayBuffer=="function",Pn=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,qt=Object.prototype.toString,Mn=typeof Blob=="function"||typeof Blob<"u"&&qt.call(Blob)==="[object BlobConstructor]",On=typeof File=="function"||typeof File<"u"&&qt.call(File)==="[object FileConstructor]";function me(t){return In&&(t instanceof ArrayBuffer||Pn(t))||Mn&&t instanceof Blob||On&&t instanceof File}function fe(t,n){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let e=0,i=t.length;e<i;e++)if(fe(t[e]))return!0;return!1}if(me(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return fe(t.toJSON(),!0);for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&fe(t[e]))return!0;return!1}function Kt(t){let n=[],e=t.data,i=t;return i.data=ze(e,n),i.attachments=n.length,{packet:i,buffers:n}}function ze(t,n){if(!t)return t;if(me(t)){let e={_placeholder:!0,num:n.length};return n.push(t),e}else if(Array.isArray(t)){let e=new Array(t.length);for(let i=0;i<t.length;i++)e[i]=ze(t[i],n);return e}else if(typeof t=="object"&&!(t instanceof Date)){let e={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=ze(t[i],n));return e}return t}function $t(t,n){return t.data=He(t.data,n),delete t.attachments,t}function He(t,n){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<n.length)return n[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=He(t[e],n);else if(typeof t=="object")for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=He(t[e],n));return t}var zt=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ht=5,d=function(t){return t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK",t}(d||{}),We=class{constructor(n){this.replacer=n}encode(n){return(n.type===d.EVENT||n.type===d.ACK)&&fe(n)?this.encodeAsBinary({type:n.type===d.EVENT?d.BINARY_EVENT:d.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let e=""+n.type;return(n.type===d.BINARY_EVENT||n.type===d.BINARY_ACK)&&(e+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(e+=n.nsp+","),n.id!=null&&(e+=n.id),n.data!=null&&(e+=JSON.stringify(n.data,this.replacer)),e}encodeAsBinary(n){let e=Kt(n),i=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(i),s}},Ye=class t extends y{constructor(n){super(),this.reviver=n}add(n){let e;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(n);let i=e.type===d.BINARY_EVENT;i||e.type===d.BINARY_ACK?(e.type=i?d.EVENT:d.ACK,this.reconstructor=new Je(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(me(n)||n.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(n),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let e=0,i={type:Number(n.charAt(0))};if(d[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===d.BINARY_EVENT||i.type===d.BINARY_ACK){let o=e+1;for(;n.charAt(++e)!=="-"&&e!=n.length;);let p=n.substring(o,e);if(p!=Number(p)||n.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(p)}if(n.charAt(e+1)==="/"){let o=e+1;for(;++e&&!(n.charAt(e)===","||e===n.length););i.nsp=n.substring(o,e)}else i.nsp="/";let s=n.charAt(e+1);if(s!==""&&Number(s)==s){let o=e+1;for(;++e;){let p=n.charAt(e);if(p==null||Number(p)!=p){--e;break}if(e===n.length)break}i.id=Number(n.substring(o,e+1))}if(n.charAt(++e)){let o=this.tryParse(n.substr(e));if(t.isPayloadValid(i.type,o))i.data=o;else throw new Error("invalid payload")}return i}tryParse(n){try{return JSON.parse(n,this.reviver)}catch{return!1}}static isPayloadValid(n,e){switch(n){case d.CONNECT:return Me(e);case d.DISCONNECT:return e===void 0;case d.CONNECT_ERROR:return typeof e=="string"||Me(e);case d.EVENT:case d.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&zt.indexOf(e[0])===-1);case d.ACK:case d.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Je=class{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){let e=$t(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Rn(t){return typeof t=="string"}var Nn=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function Dn(t){return t===void 0||Nn(t)}function Me(t){return Object.prototype.toString.call(t)==="[object Object]"}function Bn(t,n){switch(t){case d.CONNECT:return n===void 0||Me(n);case d.DISCONNECT:return n===void 0;case d.EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&zt.indexOf(n[0])===-1);case d.ACK:return Array.isArray(n);case d.CONNECT_ERROR:return typeof n=="string"||Me(n);default:return!1}}function Fn(t){return Rn(t.nsp)&&Dn(t.id)&&Bn(t.type,t.data)}function O(t,n,e){return t.on(n,e),function(){t.off(n,e)}}var Vn=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),se=class extends y{constructor(n,e,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let n=this.io;this.subs=[O(n,"open",this.onopen.bind(this)),O(n,"packet",this.onpacket.bind(this)),O(n,"error",this.onerror.bind(this)),O(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...e){var i,s,o;if(Vn.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(e.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let p={type:d.EVENT,data:e};if(p.options={},p.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){let R=this.ids++,H=e.pop();this._registerAckCallback(R,H),p.id=R}let m=(s=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||s===void 0?void 0:s.writable,_=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!m||(_?(this.notifyOutgoingListeners(p),this.packet(p)):this.sendBuffer.push(p)),this.flags={},this}_registerAckCallback(n,e){var i;let s=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(s===void 0){this.acks[n]=e;return}let o=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===n&&this.sendBuffer.splice(m,1);e.call(this,new Error("operation has timed out"))},s),p=(...m)=>{this.io.clearTimeoutFn(o),e.apply(this,m)};p.withError=!0,this.acks[n]=p}emitWithAck(n,...e){return new Promise((i,s)=>{let o=(p,m)=>p?s(p):i(m);o.withError=!0,e.push(o),this.emit(n,...e)})}_addToQueue(n){let e;typeof n[n.length-1]=="function"&&(e=n.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((s,...o)=>(this._queue[0],s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(s)):(this._queue.shift(),e&&e(null,...o)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;let e=this._queue[0];e.pending&&!n||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:d.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(i=>String(i.id)===n)){let i=this.acks[n];delete this.acks[n],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case d.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case d.EVENT:case d.BINARY_EVENT:this.onevent(n);break;case d.ACK:case d.BINARY_ACK:this.onack(n);break;case d.DISCONNECT:this.ondisconnect();break;case d.CONNECT_ERROR:this.destroy();let i=new Error(n.data.message);i.data=n.data.data,this.emitReserved("connect_error",i);break}}onevent(n){let e=n.data||[];n.id!=null&&e.push(this.ack(n.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){let e=this._anyListeners.slice();for(let i of e)i.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){let e=this,i=!1;return function(...s){i||(i=!0,e.packet({type:d.ACK,id:n,data:s}))}}onack(n){let e=this.acks[n.id];typeof e=="function"&&(delete this.acks[n.id],e.withError&&n.data.unshift(null),e.apply(this,n.data))}onconnect(n,e){this.id=n,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:d.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){let e=this._anyListeners;for(let i=0;i<e.length;i++)if(n===e[i])return e.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){let e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(n===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let e=this._anyOutgoingListeners.slice();for(let i of e)i.apply(this,n.data)}}};function Q(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Q.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),e=Math.floor(n*this.jitter*t);t=Math.floor(n*10)&1?t+e:t-e}return Math.min(t,this.max)|0};Q.prototype.reset=function(){this.attempts=0};Q.prototype.setMin=function(t){this.ms=t};Q.prototype.setMax=function(t){this.max=t};Q.prototype.setJitter=function(t){this.jitter=t};var oe=class extends y{constructor(n,e){var i;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(e=n,n=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,K(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Q({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=n;let s=e.parser||Xe;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var e;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(e=this.backoff)===null||e===void 0||e.setMin(n),this)}randomizationFactor(n){var e;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(e=this.backoff)===null||e===void 0||e.setJitter(n),this)}reconnectionDelayMax(n){var e;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(e=this.backoff)===null||e===void 0||e.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new ie(this.uri,this.opts);let e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let s=O(e,"open",function(){i.onopen(),n&&n()}),o=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),n?n(m):this.maybeReconnectOnOpen()},p=O(e,"error",o);if(this._timeout!==!1){let m=this._timeout,_=this.setTimeoutFn(()=>{s(),o(new Error("timeout")),e.close()},m);this.opts.autoUnref&&_.unref(),this.subs.push(()=>{this.clearTimeoutFn(_)})}return this.subs.push(s),this.subs.push(p),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let n=this.engine;this.subs.push(O(n,"ping",this.onping.bind(this)),O(n,"data",this.ondata.bind(this)),O(n,"error",this.onerror.bind(this)),O(n,"close",this.onclose.bind(this)),O(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(e){this.onclose("parse error",e)}}ondecoded(n){q(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,e){let i=this.nsps[n];return i?this._autoConnect&&!i.active&&i.connect():(i=new se(this,n,e),this.nsps[n]=i),i}_destroy(n){let e=Object.keys(this.nsps);for(let i of e)if(this.nsps[i].active)return;this._close()}_packet(n){let e=this.encoder.encode(n);for(let i=0;i<e.length;i++)this.engine.write(e[i],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(s=>{s?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",s)):n.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}};var _e={};function Ce(t,n){typeof t=="object"&&(n=t,t=void 0),n=n||{};let e=jt(t,n.path||"/socket.io"),i=e.source,s=e.id,o=e.path,p=_e[s]&&o in _e[s].nsps,m=n.forceNew||n["force new connection"]||n.multiplex===!1||p,_;return m?_=new oe(i,n):(_e[s]||(_e[s]=new oe(i,n)),_=_e[s]),e.query&&!n.query&&(n.query=e.queryKey),_.socket(e.path,n)}Object.assign(Ce,{Manager:oe,Socket:se,io:Ce,connect:Ce});var Qe=tt(pt());var Oe=(()=>{class t{http;baseUrl=`${B.api.baseUrl}/session`;constructor(e){this.http=e}listSessions(){return M(this.http.get(this.baseUrl))}getSession(e){return M(this.http.get(`${this.baseUrl}/${e}`))}updateSession(e){return M(this.http.patch(`${this.baseUrl}/${e.sessionId}`,e.updates))}static \u0275fac=function(i){return new(i||t)(L(Y))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Yt=8e3,Ln=1e3,z=(()=>{class t{sessionApiService;activeSessionId="";sessionsSubject=new G([]);messagesSubject=new G([]);socket;connectedSubject=new G(!1);agentEventsSubject=new G({});contextUpdatedSubject=new G(null);monitoringEventSubject=new G(null);reconnectTimeoutId;sessions$=this.sessionsSubject.asObservable();messages$=this.messagesSubject.asObservable();connected$=this.connectedSubject.asObservable();agentEvents$=this.agentEventsSubject.asObservable();contextUpdated$=this.contextUpdatedSubject.asObservable();monitoringEvent$=this.monitoringEventSubject.asObservable();constructor(e){this.sessionApiService=e}loadSessions(){return P(this,null,function*(){try{let e=yield this.sessionApiService.listSessions();this.sessionsSubject.next(e.sessions)}catch(e){Qe.DyFM_Log.error("CCAP_SessionDS | Failed to load sessions",e)}})}setActiveSession(e){this.activeSessionId=e,this.connectSocket()}getActiveSessionId(){return this.activeSessionId}getSocketUrl(){return B.socketUrl??B.api.baseUrl}connectSocket(e=0){this.reconnectTimeoutId!=null&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=void 0),this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect());let i=this.getSocketUrl();this.socket=Ce(i,{transports:["websocket"]}),this.socket.on("connect",()=>{this.connectedSubject.next(!0)}),this.socket.on("disconnect",()=>{if(this.connectedSubject.next(!1),this.activeSessionId&&e<Yt){let s=e>0?Math.min(e*2,Yt):Ln;this.reconnectTimeoutId=setTimeout(()=>{this.reconnectTimeoutId=void 0,this.connectSocket(s)},s)}}),this.socket.on("answer",s=>{let o=this.messagesSubject.value,p={role:"assistant",content:s.content,timestamp:new Date(s.timestamp)};s.runId&&(p.runId=s.runId),o.push(p),this.messagesSubject.next([...o])}),this.socket.on("notify-user",s=>{Qe.DyFM_Log.testInfo(`CCAP_SessionDS | Notification: ${s.content}`)}),this.socket.on("agent-events",s=>{this.agentEventsSubject.next(s.eventData??{})}),this.socket.on("context:updated",s=>{this.contextUpdatedSubject.next({sessionId:s.sessionId,contextState:s.contextState??{}})}),this.socket.on("monitoring:event",s=>{this.monitoringEventSubject.next({sessionId:s.sessionId,event:s.event??{}})})}sendMessageViaSocket(e){if(!this.socket||!this.activeSessionId)return;let i=this.messagesSubject.value;i.push({role:"user",content:e,timestamp:new Date}),this.messagesSubject.next([...i]),this.socket.emit("new-user-msg",{channelId:`ccap-client-${this.activeSessionId}`,content:e,sessionId:this.activeSessionId})}clearMessages(){this.messagesSubject.next([])}ngOnDestroy(){this.reconnectTimeoutId!=null&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=void 0),this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect())}static \u0275fac=function(i){return new(i||t)(L(Oe))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Un=(t,n)=>n._id,jn=(t,n,e)=>({"text-green-500":t,"text-orange-500":n,"text-red-500":e});function qn(t,n){if(t&1){let e=E();a(0,"div",7),f("click",function(){let s=b(e).$implicit,o=u(2);return S(o.selectSession(s._id))}),a(1,"div",8),l(2),r(),a(3,"div",9)(4,"span",10),l(5),r(),a(6,"span"),l(7),r()()()}if(t&2){let e=n.$implicit;c(2),x(" ",e.name||"Unnamed Session"," "),c(2),g("ngClass",ee(4,jn,e.status==="active",e.status==="closed",e.status==="terminated")),c(),x(" ",e.status," "),c(2),k(e.sessionIntent)}}function Kn(t,n){if(t&1&&(a(0,"div",4),N(1,qn,8,8,"div",6,Un),r()),t&2){let e=u();c(),D(e.sessions)}}function $n(t,n){t&1&&(a(0,"div",5),l(1,"No sessions found."),r())}var Xt=(()=>{class t{sessionDS;router;sessions=[];constructor(e,i){this.sessionDS=e,this.router=i}ngOnInit(){this.sessionDS.sessions$.subscribe(e=>{this.sessions=e}),this.sessionDS.loadSessions()}selectSession(e){this.router.navigate(["/session",e])}refreshSessions(){this.sessionDS.loadSessions()}static \u0275fac=function(i){return new(i||t)(w(z),w(dt))};static \u0275cmp=v({type:t,selectors:[["app-ccap-session-list"]],decls:8,vars:1,consts:[[1,"p-4"],[1,"flex","justify-between","items-center","mb-4"],[1,"text-lg","font-bold"],[1,"px-4","py-2","border","border-neutral-600","rounded-md","bg-transparent","text-neutral-200","text-sm","cursor-pointer","hover:bg-neutral-800",3,"click"],[1,"flex","flex-col","gap-2"],[1,"py-6","text-center","text-neutral-500"],[1,"px-4","py-3","border","border-neutral-700","rounded-lg","cursor-pointer","transition-colors","duration-200","hover:bg-ccapSurface"],[1,"px-4","py-3","border","border-neutral-700","rounded-lg","cursor-pointer","transition-colors","duration-200","hover:bg-ccapSurface",3,"click"],[1,"font-semibold","text-sm","text-neutral-100"],[1,"flex","gap-3","mt-1","text-xs","text-neutral-400"],[1,"uppercase","text-[11px]","font-bold",3,"ngClass"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1)(2,"h2",2),l(3,"Sessions"),r(),a(4,"button",3),f("click",function(){return s.refreshSessions()}),l(5," Refresh "),r()(),C(6,Kn,3,0,"div",4)(7,$n,2,0,"div",5),r()),i&2&&(c(6),h(s.sessions.length?6:7))},dependencies:[U]})}return t})();var re=function(t){return t.conversation="conversation",t.conversationFull="conversation-full",t}(re||{});var Ne=(()=>{class t{http;baseUrl=`${B.api.baseUrl}/session`;constructor(e){this.http=e}getMessages(e){return M(this.http.get(`${this.baseUrl}/${e.sessionId}/messages`,{params:{viewMode:e.viewMode}}))}sendMessage(e){return M(this.http.post(`${this.baseUrl}/${e.sessionId}/messages`,{content:e.content}))}static \u0275fac=function(i){return new(i||t)(L(Y))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Ze=(()=>{class t{http;baseUrl=`${B.api.baseUrl}/session`;constructor(e){this.http=e}getEvents(e){return M(this.http.get(`${this.baseUrl}/${e}/events`))}getRunTrace(e){return M(this.http.get(`${this.baseUrl}/${e.sessionId}/runs/${e.runId}/trace`))}static \u0275fac=function(i){return new(i||t)(L(Y))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function Hn(t,n){if(t&1&&(a(0,"div")(1,"strong"),l(2,"Input size:"),r(),l(3),r()),t&2){let e=u();c(3),x(" ",e.event.inputSize,"")}}function Wn(t,n){if(t&1&&(a(0,"div")(1,"strong"),l(2,"Output size:"),r(),l(3),r()),t&2){let e=u();c(3),x(" ",e.event.outputSize,"")}}function Yn(t,n){if(t&1&&(a(0,"div")(1,"strong"),l(2,"Run ID:"),r(),l(3),r()),t&2){let e=u();c(3),x(" ",e.event.runId,"")}}function Jn(t,n){if(t&1&&(a(0,"div",5)(1,"h5",6),l(2,"DTS"),r(),a(3,"pre",7),l(4),r()()),t&2){let e=u();c(4),k(e.formatDataValue(e.event.data.dts))}}function Xn(t,n){if(t&1&&(a(0,"div",5)(1,"h5",6),l(2,"Conversation (felhaszn\xE1lt)"),r(),a(3,"pre",7),l(4),r()()),t&2){let e=u();c(4),k(e.formatDataValue(e.event.data.conversationSlice))}}function Gn(t,n){if(t&1&&(a(0,"div",5)(1,"h5",6),l(2,"D\xF6nt\xE9si pontok"),r(),a(3,"pre",7),l(4),r()()),t&2){let e=u();c(4),k(e.formatDataValue(e.event.data.decisionSummary))}}var et=(()=>{class t{event={eventType:"",timestamp:new Date,data:{},durationMs:0,status:"",sessionId:"",runId:"",inputSize:0,outputSize:0};close=new W;get formattedData(){return JSON.stringify(this.event.data,null,2)}formatDataValue(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2)}onClose(){this.close.emit()}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-trace-detail"]],inputs:{event:"event"},outputs:{close:"close"},decls:26,vars:10,consts:[[1,"fixed","right-0","top-0","w-[480px]","h-screen","bg-[#121220]","border-l","border-neutral-700","p-4","overflow-y-auto","z-[100]"],[1,"flex","justify-between","items-center","mb-4"],[1,"text-sm","font-bold"],[1,"px-2.5","py-1","border","border-neutral-600","rounded","bg-transparent","text-neutral-200","cursor-pointer","hover:bg-neutral-800",3,"click"],[1,"flex","flex-col","gap-1","text-[13px]","text-neutral-300","mb-4","pb-4","border-b","border-neutral-700"],[1,"mb-4"],[1,"text-xs","uppercase","text-neutral-400","mb-2"],[1,"bg-[#0a0a15]","border","border-neutral-700","rounded-md","p-3","text-xs","text-neutral-200","overflow-x-auto","whitespace-pre-wrap","break-words"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1)(2,"h4",2),l(3),r(),a(4,"button",3),f("click",function(){return s.onClose()}),l(5,"X"),r()(),a(6,"div",4)(7,"div")(8,"strong"),l(9,"Status:"),r(),l(10),r(),a(11,"div")(12,"strong"),l(13,"Duration:"),r(),l(14),r(),C(15,Hn,4,1,"div")(16,Wn,4,1,"div")(17,Yn,4,1,"div"),r(),C(18,Jn,5,1,"div",5)(19,Xn,5,1,"div",5)(20,Gn,5,1,"div",5),a(21,"div")(22,"h5",6),l(23,"Event Data"),r(),a(24,"pre",7),l(25),r()()()),i&2&&(c(3),x("",s.event.eventType," - Trace Detail"),c(7),x(" ",s.event.status,""),c(4),x(" ",s.event.durationMs,"ms"),c(),h(s.event.inputSize?15:-1),c(),h(s.event.outputSize?16:-1),c(),h(s.event.runId?17:-1),c(),h(s.event.data.dts?18:-1),c(),h(s.event.data.conversationSlice?19:-1),c(),h(s.event.data.decisionSummary?20:-1),c(5),k(s.formattedData))}})}return t})();function Qn(t,n){t&1&&(a(0,"span",3),l(1,"\u2192"),r())}function Zn(t,n){if(t&1){let e=E();C(0,Qn,2,0,"span",3),a(1,"button",4),f("click",function(){let s=b(e).$implicit,o=u();return S(o.onBubbleClick(s))}),l(2),r()}if(t&2){let e=n.$implicit,i=n.$index;h(i>0?0:-1),c(2),x(" ",e.eventType," ")}}function ei(t,n){t&1&&(a(0,"span",2),l(1,"Nincs l\xE9p\xE9s."),r())}var en=(()=>{class t{trace=[];eventSelected=new W;onBubbleClick(e){this.eventSelected.emit(e)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-run-flow-viz"]],inputs:{trace:"trace"},outputs:{eventSelected:"eventSelected"},decls:4,vars:1,consts:[[1,"flex","flex-wrap","items-center","gap-1","py-1"],[1,"px-2","py-1","rounded-md","text-xs","font-medium","bg-neutral-700","text-neutral-200","border","border-neutral-600","hover:bg-ccapAccent","hover:border-ccapAccent","hover:text-white","transition-colors"],[1,"text-neutral-500","text-xs"],[1,"text-neutral-600","text-[10px]"],[1,"px-2","py-1","rounded-md","text-xs","font-medium","bg-neutral-700","text-neutral-200","border","border-neutral-600","hover:bg-ccapAccent","hover:border-ccapAccent","hover:text-white","transition-colors",3,"click"]],template:function(i,s){i&1&&(a(0,"div",0),N(1,Zn,3,2,"button",1,Z),C(3,ei,2,0,"span",2),r()),i&2&&(c(),D(s.trace),c(2),h(s.trace.length?-1:3))},styles:["[_nghost-%COMP%]{display:block}"]})}return t})();var ni=()=>["user","assistant","system","tool"],ii=(t,n,e,i,s)=>({"self-end bg-indigo-950 text-indigo-100":t,"self-start bg-green-950 text-green-100":n,"self-center bg-neutral-800 text-neutral-400 italic text-xs":e,"self-start bg-amber-950 text-amber-200 font-mono text-xs":i,"self-start bg-neutral-700 text-neutral-200":s});function si(t,n){t&1&&(a(0,"div",8),A(1,"span",11),l(2," Event history bet\xF6lt\xE9se\u2026 "),r())}function oi(t,n){if(t&1){let e=E();a(0,"app-ccap-run-flow-viz",12),f("eventSelected",function(s){b(e);let o=u(3);return S(o.onFlowEventSelected(s))}),r()}if(t&2){let e=u(3);g("trace",e.runTrace)}}function ri(t,n){t&1&&(a(0,"p",10),l(1,"Nincs event."),r())}function ai(t,n){if(t&1&&(a(0,"div",7),C(1,si,3,0,"div",8)(2,oi,1,1,"app-ccap-run-flow-viz",9)(3,ri,2,0,"p",10),r()),t&2){let e=u(2);c(),h(e.runTraceLoading?1:e.runTrace.length?2:3)}}function ci(t,n){if(t&1){let e=E();a(0,"div",4)(1,"button",6),f("click",function(){b(e);let s=u();return S(s.toggleExpanded())}),l(2),r(),C(3,ai,4,1,"div",7),r()}if(t&2){let e=u();c(2),x(" ",e.expanded?"\u25BC H\xE1tt\xE9rfolyamatok":"\u25B6 H\xE1tt\xE9rfolyamatok"," "),c(),h(e.expanded?3:-1)}}function li(t,n){if(t&1){let e=E();a(0,"div",13),f("click",function(){b(e);let s=u();return S(s.closeTracePopup())}),A(1,"div",14),a(2,"div",15),f("click",function(s){return b(e),S(s.stopPropagation())}),a(3,"app-ccap-trace-detail",16),f("close",function(){b(e);let s=u();return S(s.closeTracePopup())}),r()()()}if(t&2){let e=u();c(3),g("event",e.selectedEventForPopup)}}var tn=(()=>{class t{monitoringApi;message={role:"",content:"",timestamp:new Date};sessionId="";expanded=!1;runTrace=[];runTraceLoading=!1;runTraceLoaded=!1;selectedEventForPopup=null;constructor(e){this.monitoringApi=e}closeTracePopup(){this.selectedEventForPopup=null}toggleExpanded(){this.expanded=!this.expanded,this.expanded&&this.message.runId&&this.sessionId&&!this.runTraceLoaded&&this.loadRunTrace()}onFlowEventSelected(e){this.selectedEventForPopup=e}loadRunTrace(){return P(this,null,function*(){if(!(!this.sessionId||!this.message.runId)){this.runTraceLoading=!0;try{let i=(yield this.monitoringApi.getRunTrace({sessionId:this.sessionId,runId:this.message.runId})).trace??[];this.runTrace=i.map(s=>{let o=s??{};return{eventType:o.eventType??"",timestamp:o.timestamp?new Date(o.timestamp):new Date,data:o.data??o,durationMs:o.durationMs??0,status:o.status??"",sessionId:o.sessionId??this.sessionId,runId:o.runId??this.message.runId??"",inputSize:o.inputSize??0,outputSize:o.outputSize??0}}),this.runTraceLoaded=!0}catch{this.runTrace=[],this.runTraceLoaded=!0}finally{this.runTraceLoading=!1}}})}static \u0275fac=function(i){return new(i||t)(w(Ze))};static \u0275cmp=v({type:t,selectors:[["app-ccap-message-bubble"]],inputs:{message:"message",sessionId:"sessionId"},decls:8,vars:12,consts:[[1,"flex","flex-col","gap-0","max-w-[80%]"],[1,"px-3.5","py-2.5","rounded-lg","break-words",3,"ngClass"],[1,"text-[10px]","uppercase","font-bold","mb-1","opacity-60"],[1,"whitespace-pre-wrap","leading-relaxed"],[1,"self-start","mt-1"],[1,"fixed","inset-0","z-[100]","flex","justify-end"],[1,"text-xs","text-neutral-400","hover:text-ccapAccent","px-1","py-0.5",3,"click"],[1,"mt-2","pl-2","border-l-2","border-neutral-600","space-y-1"],[1,"flex","items-center","gap-2","text-neutral-500","text-xs","py-2"],[3,"trace"],[1,"text-neutral-500","text-xs"],[1,"inline-block","w-2","h-2","rounded-full","bg-ccapAccent","animate-pulse"],[3,"eventSelected","trace"],[1,"fixed","inset-0","z-[100]","flex","justify-end",3,"click"],["aria-hidden","true",1,"absolute","inset-0","bg-black/50"],[1,"relative","z-10",3,"click"],[3,"close","event"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1)(2,"div",2),l(3),r(),a(4,"div",3),l(5),r()(),C(6,ci,4,2,"div",4)(7,li,4,1,"div",5),r()),i&2&&(c(),g("ngClass",ct(6,ii,s.message.role==="user",s.message.role==="assistant",s.message.role==="system",s.message.role==="tool",!s.message.role||!at(5,ni).includes(s.message.role))),c(2),x(" ",s.message.role||"message"," "),c(2),x(" ",s.message.content," "),c(),h(s.message.role==="assistant"&&s.message.runId?6:-1),c(),h(s.selectedEventForPopup?7:-1))},dependencies:[U,et,en]})}return t})();var nn=t=>({"bg-ccapAccent text-white":t}),sn=(()=>{class t{viewMode=re.conversation;viewModeChange=new W;viewModes=re;setViewMode(e){this.viewMode=e,this.viewModeChange.emit(e)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-view-mode-toggle"]],inputs:{viewMode:"viewMode"},outputs:{viewModeChange:"viewModeChange"},decls:5,vars:6,consts:[[1,"flex","border","border-neutral-600","rounded-md","overflow-hidden","w-fit"],[1,"px-3.5","py-1.5","border-none","bg-transparent","text-neutral-400","cursor-pointer","text-xs","transition-colors","border-r","border-neutral-600","hover:text-neutral-200",3,"click","ngClass"],[1,"px-3.5","py-1.5","border-none","bg-transparent","text-neutral-400","cursor-pointer","text-xs","transition-colors","hover:text-neutral-200",3,"click","ngClass"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"button",1),f("click",function(){return s.setViewMode(s.viewModes.conversation)}),l(2," Conversation "),r(),a(3,"button",2),f("click",function(){return s.setViewMode(s.viewModes.conversationFull)}),l(4," Full View "),r()()),i&2&&(c(),g("ngClass",Be(2,nn,s.viewMode===s.viewModes.conversation)),c(2),g("ngClass",Be(4,nn,s.viewMode===s.viewModes.conversationFull)))},dependencies:[U]})}return t})();function di(t,n){if(t&1&&A(0,"app-ccap-message-bubble",4),t&2){let e=n.$implicit,i=u();g("message",e)("sessionId",i.sessionId)}}function hi(t,n){if(t&1&&(a(0,"span"),l(1),r()),t&2){let e=u(2);c(),k(e.runStatusText)}}function fi(t,n){t&1&&(a(0,"span"),l(1,"Thinking\u2026"),r())}function mi(t,n){if(t&1&&(a(0,"div",5),A(1,"span",10),C(2,hi,2,1,"span")(3,fi,2,0,"span"),r()),t&2){let e=u();c(2),h(e.runStatusText?2:3)}}function _i(t,n){t&1&&(a(0,"div",6),l(1," No messages yet. Start a conversation. "),r())}var on=(()=>{class t{sessionDS;conversationApi;sessionId="";messages=[];newMessage="";viewMode=re.conversation;runStatusText="";isTyping=!1;constructor(e,i){this.sessionDS=e,this.conversationApi=i}ngOnInit(){this.sessionDS.messages$.subscribe(e=>{this.messages=e}),this.sessionDS.agentEvents$.subscribe(e=>{let i=e.phase??e.step??"",s=e.status??"";this.isTyping=!!(i||s),i==="analyze"||s==="analyzing"?this.runStatusText="Analyzing\u2026":i==="assemble"||s==="assembling"?this.runStatusText="Assembling conversation\u2026":i==="execution"||s==="executing"?this.runStatusText="Executing\u2026":i==="toolCall"||e.toolCall?this.runStatusText="Executing tool\u2026":i||s?this.runStatusText=s||i:this.runStatusText=""}),this.loadMessages()}loadMessages(){return P(this,null,function*(){let e=yield this.conversationApi.getMessages({sessionId:this.sessionId,viewMode:this.viewMode});this.messages=e.messages})}sendMessage(){this.newMessage.trim()&&(this.sessionDS.sendMessageViaSocket(this.newMessage),this.newMessage="")}onViewModeChange(e){this.viewMode=e,this.loadMessages()}static \u0275fac=function(i){return new(i||t)(w(z),w(Ne))};static \u0275cmp=v({type:t,selectors:[["app-ccap-chat"]],inputs:{sessionId:"sessionId"},decls:12,vars:4,consts:[[1,"flex","flex-col","h-full"],[1,"px-4","py-2","border-b","border-neutral-700"],[3,"viewModeChange","viewMode"],[1,"flex-1","overflow-y-auto","p-4","flex","flex-col","gap-2"],[3,"message","sessionId"],[1,"flex","items-center","gap-2","text-neutral-400","text-sm","py-1"],[1,"text-center","text-neutral-500","py-12"],[1,"flex","gap-2","px-4","py-3","border-t","border-neutral-700"],["type","text","placeholder","Type a message...",1,"flex-1","px-3.5","py-2.5","border","border-neutral-600","rounded-lg","bg-ccapSurface","text-neutral-100","text-sm","outline-none","focus:border-ccapAccent",3,"ngModelChange","keydown.enter","ngModel"],[1,"px-5","py-2.5","border-none","rounded-lg","bg-ccapAccent","text-white","cursor-pointer","text-sm","font-semibold","hover:bg-ccapAccentHover",3,"click"],[1,"inline-block","w-2","h-2","rounded-full","bg-ccapAccent","animate-pulse"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1)(2,"app-ccap-view-mode-toggle",2),f("viewModeChange",function(p){return s.onViewModeChange(p)}),r()(),a(3,"div",3),N(4,di,1,2,"app-ccap-message-bubble",4,Z),C(6,mi,4,1,"div",5)(7,_i,2,0,"div",6),r(),a(8,"div",7)(9,"input",8),rt("ngModelChange",function(p){return ot(s.newMessage,p)||(s.newMessage=p),p}),f("keydown.enter",function(){return s.sendMessage()}),r(),a(10,"button",9),f("click",function(){return s.sendMessage()}),l(11," Send "),r()()()),i&2&&(c(2),g("viewMode",s.viewMode),c(2),D(s.messages),c(2),h(s.isTyping?6:-1),c(),h(!s.messages.length&&!s.isTyping?7:-1),c(2),st("ngModel",s.newMessage))},dependencies:[ft,mt,_t,tn,sn]})}return t})();var gi=(t,n,e)=>({"text-green-500":t,"text-red-500":n,"text-orange-500":e});function xi(t,n){if(t&1&&(a(0,"div",6)(1,"strong"),l(2,"Goal:"),r(),l(3),r()),t&2){let e=u(2);c(3),x(" ",e.runGoal," ")}}function vi(t,n){if(t&1&&(a(0,"div",5),C(1,xi,4,1,"div",6),a(2,"div"),l(3),r()()),t&2){let e=u();c(),h(e.runGoal?1:-1),c(2),k(e.runSummary)}}var rn=(()=>{class t{runSummary="";runStatus="";runIntent="";runGoal="";collapsed=!0;toggleCollapse(){this.collapsed=!this.collapsed}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-run-summary"]],inputs:{runSummary:"runSummary",runStatus:"runStatus",runIntent:"runIntent",runGoal:"runGoal"},decls:9,vars:9,consts:[[1,"border","border-neutral-700","rounded-lg","my-2","overflow-hidden"],[1,"flex","items-center","gap-3","px-3.5","py-2.5","cursor-pointer","bg-ccapSurface","text-[13px]","hover:bg-neutral-800",3,"click"],[1,"font-bold","uppercase","text-[11px]",3,"ngClass"],[1,"flex-1","text-neutral-200"],[1,"text-neutral-400","text-base","font-bold"],[1,"px-3.5","py-3","text-[13px]","text-neutral-300","border-t","border-neutral-700"],[1,"mb-2","text-neutral-400"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1),f("click",function(){return s.toggleCollapse()}),a(2,"span",2),l(3),r(),a(4,"span",3),l(5),r(),a(6,"span",4),l(7),r()(),C(8,vi,4,2,"div",5),r()),i&2&&(c(2),g("ngClass",ee(5,gi,s.runStatus==="completed",s.runStatus==="failed",s.runStatus==="executing")),c(),x(" ",s.runStatus," "),c(2),k(s.runIntent),c(2),x(" ",s.collapsed?"+":"-"," "),c(),h(s.collapsed?-1:8))},dependencies:[U]})}return t})();function bi(t,n){if(t&1&&A(0,"app-ccap-run-summary",1),t&2){let e,i=u();g("runSummary","")("runStatus",i.runStatusText)("runIntent",i.session.sessionIntent)("runGoal",(e=i.session.sessionGoal)!==null&&e!==void 0?e:"")}}var an=(()=>{class t{route;sessionApi;sessionDS;sessionId="";session=null;runStatusText="";constructor(e,i,s){this.route=e,this.sessionApi=i,this.sessionDS=s}ngOnInit(){this.sessionId=this.route.snapshot.params.id??"",this.sessionDS.setActiveSession(this.sessionId),this.loadSession(),this.sessionDS.agentEvents$.subscribe(e=>{let i=e.phase??e.step??"";this.runStatusText=i?"executing":""})}loadSession(){return P(this,null,function*(){if(this.sessionId)try{let e=yield this.sessionApi.getSession(this.sessionId);this.session=e.session}catch{this.session=null}})}static \u0275fac=function(i){return new(i||t)(w(ye),w(Oe),w(z))};static \u0275cmp=v({type:t,selectors:[["app-ccap-session-detail"]],decls:4,vars:2,consts:[[1,"flex","flex-col","h-full"],[3,"runSummary","runStatus","runIntent","runGoal"],[1,"flex-1","overflow-hidden"],[3,"sessionId"]],template:function(i,s){i&1&&(a(0,"div",0),C(1,bi,1,4,"app-ccap-run-summary",1),a(2,"div",2),A(3,"app-ccap-chat",3),r()()),i&2&&(c(),h(s.session?1:-1),c(2),g("sessionId",s.sessionId))},dependencies:[on,rn]})}return t})();var cn=(()=>{class t{http;baseUrl=`${B.api.baseUrl}/session`;constructor(e){this.http=e}getContext(e){return M(this.http.get(`${this.baseUrl}/${e}/context`))}updateContextKey(e){return M(this.http.patch(`${this.baseUrl}/${e.sessionId}/context/keys/${e.key}`,{action:e.action}))}static \u0275fac=function(i){return new(i||t)(L(Y))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var wi=(t,n,e)=>({"border border-green-500":t,"border border-orange-500":n,"border border-neutral-600":e});function Ei(t,n){if(t&1){let e=E();a(0,"button",5),f("click",function(){b(e);let s=u();return S(s.emitAction("open"))}),l(1,"Open"),r()}}function Ti(t,n){if(t&1){let e=E();a(0,"button",5),f("click",function(){b(e);let s=u();return S(s.emitAction("pin"))}),l(1,"Pin"),r()}}function Ai(t,n){if(t&1){let e=E();a(0,"button",5),f("click",function(){b(e);let s=u();return S(s.emitAction("close"))}),l(1,"Close"),r()}}var ln=(()=>{class t{keyName="";status="";keyAction=new W;emitAction(e){this.keyAction.emit({key:this.keyName,action:e})}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-context-key-item"]],inputs:{keyName:"keyName",status:"status"},outputs:{keyAction:"keyAction"},decls:9,vars:10,consts:[[1,"flex","items-center","gap-2","px-2.5","py-1.5","rounded-md","mb-1","text-[13px]",3,"ngClass"],[1,"flex-1","font-mono","text-neutral-200"],[1,"text-[10px]","uppercase","text-neutral-400"],[1,"flex","gap-1"],[1,"px-2","py-0.5","border","border-neutral-600","rounded","text-[11px]","bg-transparent","text-neutral-300","cursor-pointer","hover:bg-neutral-800","hover:text-white"],[1,"px-2","py-0.5","border","border-neutral-600","rounded","text-[11px]","bg-transparent","text-neutral-300","cursor-pointer","hover:bg-neutral-800","hover:text-white",3,"click"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"span",1),l(2),r(),a(3,"span",2),l(4),r(),a(5,"div",3),C(6,Ei,2,0,"button",4)(7,Ti,2,0,"button",4)(8,Ai,2,0,"button",4),r()()),i&2&&(g("ngClass",ee(6,wi,s.status==="active",s.status==="pinned",s.status==="cached")),c(2),k(s.keyName),c(2),k(s.status),c(2),h(s.status!=="active"?6:-1),c(),h(s.status!=="pinned"?7:-1),c(),h(s.status==="active"?8:-1))},dependencies:[U]})}return t})();function Ii(t,n){if(t&1){let e=E();a(0,"app-ccap-context-key-item",7),f("keyAction",function(s){b(e);let o=u();return S(o.onKeyAction(s))}),r()}if(t&2){let e=n.$implicit;g("keyName",e)("status","active")}}function Pi(t,n){t&1&&(a(0,"div",5),l(1,"No active keys"),r())}function Mi(t,n){if(t&1){let e=E();a(0,"app-ccap-context-key-item",7),f("keyAction",function(s){b(e);let o=u();return S(o.onKeyAction(s))}),r()}if(t&2){let e=n.$implicit;g("keyName",e)("status","pinned")}}function Oi(t,n){t&1&&(a(0,"div",5),l(1,"No pinned keys"),r())}function Ri(t,n){if(t&1){let e=E();a(0,"app-ccap-context-key-item",7),f("keyAction",function(s){b(e);let o=u();return S(o.onKeyAction(s))}),r()}if(t&2){let e=n.$implicit;g("keyName",e)("status","cached")}}function Ni(t,n){t&1&&(a(0,"div",5),l(1,"No cached keys"),r())}var pn=(()=>{class t{contextApi;sessionDS;sessionId="";contextState={};activeKeys=[];pinnedKeys=[];cachedKeys=[];constructor(e,i){this.contextApi=e,this.sessionDS=i}ngOnInit(){this.sessionDS.contextUpdated$.subscribe(e=>{e&&e.sessionId===this.sessionId&&this.applyContextState(e.contextState)}),this.loadContext()}ngOnChanges(e){e.sessionId&&this.sessionId&&this.loadContext()}applyContextState(e){this.contextState=e,this.activeKeys=e.activeKeys??[],this.pinnedKeys=e.pinnedKeys??[],this.cachedKeys=e.cachedKeys??[]}loadContext(){return P(this,null,function*(){if(!this.sessionId)return;let e=yield this.contextApi.getContext(this.sessionId);this.applyContextState(e.context)})}onKeyAction(e){return P(this,null,function*(){yield this.contextApi.updateContextKey({sessionId:this.sessionId,key:e.key,action:e.action}),yield this.loadContext()})}static \u0275fac=function(i){return new(i||t)(w(cn),w(z))};static \u0275cmp=v({type:t,selectors:[["app-ccap-context-panel"]],inputs:{sessionId:"sessionId"},features:[xe],decls:23,vars:6,consts:[[1,"p-4","overflow-y-auto","h-full"],[1,"text-base","font-bold","mb-4"],[1,"mb-5"],[1,"text-xs","text-neutral-400","uppercase","mb-2"],[3,"keyName","status"],[1,"text-xs","text-neutral-600","px-2"],[1,"px-4","py-2","border","border-neutral-600","rounded-md","bg-transparent","text-neutral-200","cursor-pointer","hover:bg-neutral-800",3,"click"],[3,"keyAction","keyName","status"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"h3",1),l(2,"Context"),r(),a(3,"div",2)(4,"h4",3),l(5),r(),N(6,Ii,1,2,"app-ccap-context-key-item",4,ve),C(8,Pi,2,0,"div",5),r(),a(9,"div",2)(10,"h4",3),l(11),r(),N(12,Mi,1,2,"app-ccap-context-key-item",4,ve),C(14,Oi,2,0,"div",5),r(),a(15,"div",2)(16,"h4",3),l(17),r(),N(18,Ri,1,2,"app-ccap-context-key-item",4,ve),C(20,Ni,2,0,"div",5),r(),a(21,"button",6),f("click",function(){return s.loadContext()}),l(22," Refresh "),r()()),i&2&&(c(5),x(" Active Keys (",s.activeKeys.length,") "),c(),D(s.activeKeys),c(2),h(s.activeKeys.length?-1:8),c(3),x(" Pinned Keys (",s.pinnedKeys.length,") "),c(),D(s.pinnedKeys),c(2),h(s.pinnedKeys.length?-1:14),c(3),x(" Cached Keys (",s.cachedKeys.length,") "),c(),D(s.cachedKeys),c(2),h(s.cachedKeys.length?-1:20))},dependencies:[ln]})}return t})();var Bi=tt(pt());function Vi(t,n){if(t&1){let e=E();a(0,"button",3),f("click",function(){b(e);let s=u();return S(s.togglePanel())}),a(1,"span",4),l(2,"\u203A"),r()()}}function Li(t,n){t&1&&(a(0,"p",9),l(1,"V\xE1lassz sessiont a chat megtekint\xE9s\xE9hez."),r())}function Ui(t,n){t&1&&(a(0,"div",12),A(1,"span",15),l(2," Bet\xF6lt\xE9s\u2026 "),r())}function ji(t,n){if(t&1&&(a(0,"div",17)(1,"span",18),l(2),r(),a(3,"span",19),l(4),r()()),t&2){let e=n.$implicit;De("self-end",e.role==="user")("self-start",e.role!=="user"),c(2),x("",e.role,":"),c(2),x(" ",e.content.length>120?e.content.slice(0,120)+"\u2026":e.content," ")}}function qi(t,n){if(t&1&&(a(0,"div",13),N(1,ji,5,6,"div",16,Z),r()),t&2){let e=u(3);c(),D(e.conversationFullMessages)}}function Ki(t,n){t&1&&(a(0,"p",9),l(1,"Nincs \xFCzenet."),r())}function $i(t,n){if(t&1&&(a(0,"section",10)(1,"h4",11),l(2,"Conversation full"),r(),C(3,Ui,3,0,"div",12)(4,qi,3,0,"div",13)(5,Ki,2,0,"p",9),r(),a(6,"section")(7,"h4",11),l(8,"Aktu\xE1lis context"),r(),A(9,"app-ccap-context-panel",14),r()),t&2){let e=u(2);c(3),h(e.conversationFullLoading?3:e.conversationFullMessages.length?4:5),c(6),g("sessionId",e.sessionId)}}function zi(t,n){if(t&1){let e=E();a(0,"div",2)(1,"div",5)(2,"span",6),l(3,"Info panel"),r(),a(4,"button",7),f("click",function(){b(e);let s=u();return S(s.togglePanel())}),l(5," \u2715 "),r()(),a(6,"div",8),C(7,Li,2,0,"p",9)(8,$i,10,2),r()()}if(t&2){let e=u();c(7),h(e.sessionId?8:7)}}var un=(()=>{class t{conversationApi;sessionId="";isOpen=!1;conversationFullMessages=[];conversationFullLoading=!1;constructor(e){this.conversationApi=e}ngOnInit(){this.isOpen&&this.sessionId&&this.loadConversationFull()}ngOnChanges(e){e.sessionId&&this.isOpen&&this.sessionId&&this.loadConversationFull()}togglePanel(){this.isOpen=!this.isOpen,this.isOpen&&this.sessionId&&!this.conversationFullMessages.length&&this.loadConversationFull()}loadConversationFull(){return P(this,null,function*(){if(this.sessionId){this.conversationFullLoading=!0;try{let e=yield this.conversationApi.getMessages({sessionId:this.sessionId,viewMode:"conversationFull"});this.conversationFullMessages=e.messages}catch{this.conversationFullMessages=[]}finally{this.conversationFullLoading=!1}}})}static \u0275fac=function(i){return new(i||t)(w(Ne))};static \u0275cmp=v({type:t,selectors:[["app-ccap-info-panel"]],inputs:{sessionId:"sessionId"},features:[xe],decls:3,vars:5,consts:[[1,"flex","h-full"],["title","Info panel megnyit\xE1sa",1,"w-full","h-full","flex","items-center","justify-center","border-l","border-neutral-700","bg-ccapSurface","text-neutral-400","hover:text-neutral-200","hover:bg-neutral-800","transition-colors"],[1,"flex","flex-col","h-full","w-[360px]","border-l","border-neutral-700","bg-ccapSurface","overflow-hidden"],["title","Info panel megnyit\xE1sa",1,"w-full","h-full","flex","items-center","justify-center","border-l","border-neutral-700","bg-ccapSurface","text-neutral-400","hover:text-neutral-200","hover:bg-neutral-800","transition-colors",3,"click"],[1,"text-lg"],[1,"flex","items-center","justify-between","px-3","py-2","border-b","border-neutral-700","shrink-0"],[1,"text-sm","font-semibold","text-neutral-200"],["title","Bez\xE1r\xE1s",1,"px-2","py-1","text-neutral-400","hover:text-neutral-200",3,"click"],[1,"flex-1","overflow-y-auto","p-4"],[1,"text-neutral-500","text-sm"],[1,"mb-6"],[1,"text-xs","font-bold","text-neutral-400","uppercase","mb-2"],[1,"flex","items-center","gap-2","text-neutral-500","text-sm","py-2"],[1,"flex","flex-col","gap-1.5","max-h-48","overflow-y-auto"],[3,"sessionId"],[1,"inline-block","w-2","h-2","rounded-full","bg-ccapAccent","animate-pulse"],[1,"px-2","py-1.5","rounded","border","border-neutral-700","text-xs","bg-neutral-800/50",3,"self-end","self-start"],[1,"px-2","py-1.5","rounded","border","border-neutral-700","text-xs","bg-neutral-800/50"],[1,"font-semibold","text-neutral-400"],[1,"text-neutral-200","whitespace-pre-wrap","break-words"]],template:function(i,s){i&1&&(a(0,"div",0),C(1,Vi,3,0,"button",1)(2,zi,9,1,"div",2),r()),i&2&&(De("w-12",!s.isOpen)("w-[360px]",s.isOpen),c(),h(s.isOpen?2:1))},dependencies:[pn],styles:["[_nghost-%COMP%]{display:block;height:100%;flex-shrink:0}"]})}return t})();var dn=(()=>{class t{route;activeSessionId="";paramsSub=null;constructor(e){this.route=e}ngOnInit(){this.paramsSub=this.route.firstChild?.params?.subscribe(e=>{this.activeSessionId=e.id??""})??null,this.activeSessionId=this.route.snapshot.firstChild?.params.id??""}ngOnDestroy(){this.paramsSub&&this.paramsSub.unsubscribe()}static \u0275fac=function(i){return new(i||t)(w(ye))};static \u0275cmp=v({type:t,selectors:[["app-ccap-session-shell"]],decls:6,vars:1,consts:[[1,"flex","h-screen","w-full"],[1,"w-64","shrink-0","border-r","border-neutral-700","bg-ccapSurface","overflow-y-auto"],[1,"flex-1","min-w-0","overflow-hidden","flex","flex-col"],[3,"sessionId"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"aside",1),A(2,"app-ccap-session-list"),r(),a(3,"main",2),A(4,"router-outlet"),r(),A(5,"app-ccap-info-panel",3),r()),i&2&&(c(5),g("sessionId",s.activeSessionId))},dependencies:[ut,Xt,un],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%}"]})}return t})();var hn=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-session-placeholder"]],decls:3,vars:0,consts:[[1,"flex","flex-col","items-center","justify-center","h-full","text-center","px-4"],[1,"text-neutral-400","text-sm"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"p",1),l(2,"V\xE1lassz sessiont a bal oldali list\xE1b\xF3l."),r()())},styles:["[_nghost-%COMP%]{display:block;height:100%}"]})}return t})();var Wi=[{path:"",component:dn,children:[{path:"",pathMatch:"full",component:hn},{path:":id",component:an}]}],na=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=it({type:t});static \u0275inj=nt({imports:[lt,Ct,ht.forChild(Wi)]})}return t})();export{na as Session_Module};
|
|
1
|
+
import{$ as Y,A as h,B as Z,C as ve,D as N,E as D,F as a,G as r,H as A,I as E,J as f,K as u,L as l,M as k,N as x,Q as st,R as ot,S as rt,U as at,V as Be,W as ee,X as ct,Y as U,Z as lt,a as fn,b as tt,c as P,d as G,ea as pt,f as M,fa as ye,ga as ut,h as V,ha as dt,i as nt,j as L,ja as ht,l as v,la as ft,m as it,ma as mt,n as xe,o as b,p as S,pa as _t,ra as Ct,s as W,sa as B,v as c,w,x as C,y as g,z as De}from"./chunk-NCN3S5MX.js";var F=Object.create(null);F.open="0";F.close="1";F.ping="2";F.pong="3";F.message="4";F.upgrade="5";F.noop="6";var ce=Object.create(null);Object.keys(F).forEach(t=>{ce[F[t]]=t});var le={type:"error",data:"parser error"};var vt=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",yt=typeof ArrayBuffer=="function",bt=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,pe=({type:t,data:n},e,i)=>vt&&n instanceof Blob?e?i(n):gt(n,i):yt&&(n instanceof ArrayBuffer||bt(n))?e?i(n):gt(new Blob([n]),i):i(F[t]+(n||"")),gt=(t,n)=>{let e=new FileReader;return e.onload=function(){let i=e.result.split(",")[1];n("b"+(i||""))},e.readAsDataURL(t)};function xt(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}var Fe;function St(t,n){if(vt&&t.data instanceof Blob)return t.data.arrayBuffer().then(xt).then(n);if(yt&&(t.data instanceof ArrayBuffer||bt(t.data)))return n(xt(t.data));pe(t,!1,e=>{Fe||(Fe=new TextEncoder),n(Fe.encode(e))})}var wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<wt.length;t++)ue[wt.charCodeAt(t)]=t;var Et=t=>{let n=t.length*.75,e=t.length,i,s=0,o,p,m,_;t[t.length-1]==="="&&(n--,t[t.length-2]==="="&&n--);let j=new ArrayBuffer(n),R=new Uint8Array(j);for(i=0;i<e;i+=4)o=ue[t.charCodeAt(i)],p=ue[t.charCodeAt(i+1)],m=ue[t.charCodeAt(i+2)],_=ue[t.charCodeAt(i+3)],R[s++]=o<<2|p>>4,R[s++]=(p&15)<<4|m>>2,R[s++]=(m&3)<<6|_&63;return j};var mn=typeof ArrayBuffer=="function",de=(t,n)=>{if(typeof t!="string")return{type:"message",data:Tt(t,n)};let e=t.charAt(0);return e==="b"?{type:"message",data:_n(t.substring(1),n)}:ce[e]?t.length>1?{type:ce[e],data:t.substring(1)}:{type:ce[e]}:le},_n=(t,n)=>{if(mn){let e=Et(t);return Tt(e,n)}else return{base64:!0,data:t}},Tt=(t,n)=>{switch(n){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}};var At="",kt=(t,n)=>{let e=t.length,i=new Array(e),s=0;t.forEach((o,p)=>{pe(o,!1,m=>{i[p]=m,++s===e&&n(i.join(At))})})},It=(t,n)=>{let e=t.split(At),i=[];for(let s=0;s<e.length;s++){let o=de(e[s],n);if(i.push(o),o.type==="error")break}return i};function Pt(){return new TransformStream({transform(t,n){St(t,e=>{let i=e.length,s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);let o=new DataView(s.buffer);o.setUint8(0,126),o.setUint16(1,i)}else{s=new Uint8Array(9);let o=new DataView(s.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(i))}t.data&&typeof t.data!="string"&&(s[0]|=128),n.enqueue(s),n.enqueue(e)})}})}var Ve;function be(t){return t.reduce((n,e)=>n+e.length,0)}function Se(t,n){if(t[0].length===n)return t.shift();let e=new Uint8Array(n),i=0;for(let s=0;s<n;s++)e[s]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),e}function Mt(t,n){Ve||(Ve=new TextDecoder);let e=[],i=0,s=-1,o=!1;return new TransformStream({transform(p,m){for(e.push(p);;){if(i===0){if(be(e)<1)break;let _=Se(e,1);o=(_[0]&128)===128,s=_[0]&127,s<126?i=3:s===126?i=1:i=2}else if(i===1){if(be(e)<2)break;let _=Se(e,2);s=new DataView(_.buffer,_.byteOffset,_.length).getUint16(0),i=3}else if(i===2){if(be(e)<8)break;let _=Se(e,8),j=new DataView(_.buffer,_.byteOffset,_.length),R=j.getUint32(0);if(R>Math.pow(2,21)-1){m.enqueue(le);break}s=R*Math.pow(2,32)+j.getUint32(4),i=3}else{if(be(e)<s)break;let _=Se(e,s);m.enqueue(de(o?_:Ve.decode(_),n)),i=0}if(s===0||s>t){m.enqueue(le);break}}}})}var Le=4;function y(t){if(t)return Cn(t)}function Cn(t){for(var n in y.prototype)t[n]=y.prototype[n];return t}y.prototype.on=y.prototype.addEventListener=function(t,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(n),this};y.prototype.once=function(t,n){function e(){this.off(t,e),n.apply(this,arguments)}return e.fn=n,this.on(t,e),this};y.prototype.off=y.prototype.removeListener=y.prototype.removeAllListeners=y.prototype.removeEventListener=function(t,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+t];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var i,s=0;s<e.length;s++)if(i=e[s],i===n||i.fn===n){e.splice(s,1);break}return e.length===0&&delete this._callbacks["$"+t],this};y.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),e=this._callbacks["$"+t],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,s=e.length;i<s;++i)e[i].apply(this,n)}return this};y.prototype.emitReserved=y.prototype.emit;y.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};y.prototype.hasListeners=function(t){return!!this.listeners(t).length};var q=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,e)=>e(n,0),I=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ot="arraybuffer";function we(t,...n){return n.reduce((e,i)=>(t.hasOwnProperty(i)&&(e[i]=t[i]),e),{})}var gn=I.setTimeout,xn=I.clearTimeout;function K(t,n){n.useNativeTimers?(t.setTimeoutFn=gn.bind(I),t.clearTimeoutFn=xn.bind(I)):(t.setTimeoutFn=I.setTimeout.bind(I),t.clearTimeoutFn=I.clearTimeout.bind(I))}var vn=1.33;function Rt(t){return typeof t=="string"?yn(t):Math.ceil((t.byteLength||t.size)*vn)}function yn(t){let n=0,e=0;for(let i=0,s=t.length;i<s;i++)n=t.charCodeAt(i),n<128?e+=1:n<2048?e+=2:n<55296||n>=57344?e+=3:(i++,e+=4);return e}function Ee(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Nt(t){let n="";for(let e in t)t.hasOwnProperty(e)&&(n.length&&(n+="&"),n+=encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return n}function Dt(t){let n={},e=t.split("&");for(let i=0,s=e.length;i<s;i++){let o=e[i].split("=");n[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return n}var Te=class extends Error{constructor(n,e,i){super(n),this.description=e,this.context=i,this.type="TransportError"}},$=class extends y{constructor(n){super(),this.writable=!1,K(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,e,i){return super.emitReserved("error",new Te(n,e,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){let e=de(n,this.socket.binaryType);this.onPacket(e)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,e={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){let e=Nt(n);return e.length?"?"+e:""}};var he=class extends ${constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";let e=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){let e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};It(n,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,kt(n,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let n=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Ee()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(n,e)}};var Bt=!1;try{Bt=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Ft=Bt;function bn(){}var Ue=class extends he{constructor(n){if(super(n),typeof location<"u"){let e=location.protocol==="https:",i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||i!==n.port}}doWrite(n,e){let i=this.request({method:"POST",data:n});i.on("success",e),i.on("error",(s,o)=>{this.onError("xhr post error",s,o)})}doPoll(){let n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=n}},Ae=(()=>{class t extends y{constructor(e,i,s){super(),this.createRequest=e,K(this,s),this._opts=s,this._method=s.method||"GET",this._uri=i,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;let i=we(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(i);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&s.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var o;s.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=t.requestsCount++,t.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=bn,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete t.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return t.requestsCount=0,t.requests={},t})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Vt);else if(typeof addEventListener=="function"){let t="onpagehide"in I?"pagehide":"unload";addEventListener(t,Vt,!1)}}function Vt(){for(let t in Ae.requests)Ae.requests.hasOwnProperty(t)&&Ae.requests[t].abort()}var Sn=function(){let t=Lt({xdomain:!1});return t&&t.responseType!==null}(),J=class extends Ue{constructor(n){super(n);let e=n&&n.forceBase64;this.supportsBinary=Sn&&!e}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new Ae(Lt,this.uri(),n)}};function Lt(t){let n=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||Ft))return new XMLHttpRequest}catch{}if(!n)try{return new I[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var Ut=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",qe=class extends ${get name(){return"websocket"}doOpen(){let n=this.uri(),e=this.opts.protocols,i=Ut?{}:we(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,e,i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let e=0;e<n.length;e++){let i=n[e],s=e===n.length-1;pe(i,this.supportsBinary,o=>{try{this.doWrite(i,o)}catch{}s&&q(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let n=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Ee()),this.supportsBinary||(e.b64=1),this.createUri(n,e)}},je=I.WebSocket||I.MozWebSocket,X=class extends qe{createSocket(n,e,i){return Ut?new je(n,e,i):e?new je(n,e):new je(n)}doWrite(n,e){this.ws.send(e)}};var te=class extends ${get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{let e=Mt(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=n.readable.pipeThrough(e).getReader(),s=Pt();s.readable.pipeTo(n.writable),this._writer=s.writable.getWriter();let o=()=>{i.read().then(({done:m,value:_})=>{m||(this.onPacket(_),o())}).catch(m=>{})};o();let p={type:"open"};this.query.sid&&(p.data=`{"sid":"${this.query.sid}"}`),this._writer.write(p).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let e=0;e<n.length;e++){let i=n[e],s=e===n.length-1;this._writer.write(i).then(()=>{s&&q(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}};var Ke={websocket:X,webtransport:te,polling:J};var wn=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,En=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ne(t){if(t.length>8e3)throw"URI too long";let n=t,e=t.indexOf("["),i=t.indexOf("]");e!=-1&&i!=-1&&(t=t.substring(0,e)+t.substring(e,i).replace(/:/g,";")+t.substring(i,t.length));let s=wn.exec(t||""),o={},p=14;for(;p--;)o[En[p]]=s[p]||"";return e!=-1&&i!=-1&&(o.source=n,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=Tn(o,o.path),o.queryKey=An(o,o.query),o}function Tn(t,n){let e=/\/{2,9}/g,i=n.replace(e,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&i.splice(0,1),n.slice(-1)=="/"&&i.splice(i.length-1,1),i}function An(t,n){let e={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,o){s&&(e[s]=o)}),e}var $e=typeof addEventListener=="function"&&typeof removeEventListener=="function",ke=[];$e&&addEventListener("offline",()=>{ke.forEach(t=>t())},!1);var Ie=(()=>{class t extends y{constructor(e,i){if(super(),this.binaryType=Ot,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(i=e,e=null),e){let s=ne(e);i.hostname=s.host,i.secure=s.protocol==="https"||s.protocol==="wss",i.port=s.port,s.query&&(i.query=s.query)}else i.host&&(i.hostname=ne(i.host).host);K(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(s=>{let o=s.prototype.name;this.transports.push(o),this._transportsByName[o]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Dt(this.opts.query)),$e&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ke.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=Le,i.transport=e,this.id&&(i.sid=this.id);let s=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&t.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",t.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=new Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let s=0;s<this.writeBuffer.length;s++){let o=this.writeBuffer[s].data;if(o&&(i+=Rt(o)),s>0&&i>this._maxPayload)return this.writeBuffer.slice(0,s);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,q(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,s){return this._sendPacket("message",e,i,s),this}send(e,i,s){return this._sendPacket("message",e,i,s),this}_sendPacket(e,i,s,o){if(typeof i=="function"&&(o=i,i=void 0),typeof s=="function"&&(o=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let p={type:e,data:i,options:s};this.emitReserved("packetCreate",p),this.writeBuffer.push(p),o&&this.once("flush",o),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},s=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(t.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),$e&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let s=ke.indexOf(this._offlineEventListener);s!==-1&&ke.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}return t.protocol=Le,t})(),Pe=class extends Ie{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let e=this.createTransport(n),i=!1;Ie.priorWebsocketSuccess=!1;let s=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",H=>{if(!i)if(H.type==="pong"&&H.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;Ie.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(R(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let ae=new Error("probe error");ae.transport=e.name,this.emitReserved("upgradeError",ae)}}))};function o(){i||(i=!0,R(),e.close(),e=null)}let p=H=>{let ae=new Error("probe error: "+H);ae.transport=e.name,o(),this.emitReserved("upgradeError",ae)};function m(){p("transport closed")}function _(){p("socket closed")}function j(H){e&&H.name!==e.name&&o()}let R=()=>{e.removeListener("open",s),e.removeListener("error",p),e.removeListener("close",m),this.off("close",_),this.off("upgrading",j)};e.once("open",s),e.once("error",p),e.once("close",m),this.once("close",_),this.once("upgrading",j),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){let e=[];for(let i=0;i<n.length;i++)~this.transports.indexOf(n[i])&&e.push(n[i]);return e}},ie=class extends Pe{constructor(n,e={}){let i=typeof n=="object"?n:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(s=>Ke[s]).filter(s=>!!s)),super(n,i)}};var Qs=ie.protocol;function jt(t,n="",e){let i=t;e=e||typeof location<"u"&&location,t==null&&(t=e.protocol+"//"+e.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=e.protocol+t:t=e.host+t),/^(https?|wss?):\/\//.test(t)||(typeof e<"u"?t=e.protocol+"//"+t:t="https://"+t),i=ne(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let o=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+o+":"+i.port+n,i.href=i.protocol+"://"+o+(e&&e.port===i.port?"":":"+i.port),i}var Xe={};fn(Xe,{Decoder:()=>Ye,Encoder:()=>We,PacketType:()=>d,isPacketValid:()=>Fn,protocol:()=>Ht});var In=typeof ArrayBuffer=="function",Pn=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,qt=Object.prototype.toString,Mn=typeof Blob=="function"||typeof Blob<"u"&&qt.call(Blob)==="[object BlobConstructor]",On=typeof File=="function"||typeof File<"u"&&qt.call(File)==="[object FileConstructor]";function me(t){return In&&(t instanceof ArrayBuffer||Pn(t))||Mn&&t instanceof Blob||On&&t instanceof File}function fe(t,n){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let e=0,i=t.length;e<i;e++)if(fe(t[e]))return!0;return!1}if(me(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return fe(t.toJSON(),!0);for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&fe(t[e]))return!0;return!1}function Kt(t){let n=[],e=t.data,i=t;return i.data=ze(e,n),i.attachments=n.length,{packet:i,buffers:n}}function ze(t,n){if(!t)return t;if(me(t)){let e={_placeholder:!0,num:n.length};return n.push(t),e}else if(Array.isArray(t)){let e=new Array(t.length);for(let i=0;i<t.length;i++)e[i]=ze(t[i],n);return e}else if(typeof t=="object"&&!(t instanceof Date)){let e={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=ze(t[i],n));return e}return t}function $t(t,n){return t.data=He(t.data,n),delete t.attachments,t}function He(t,n){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<n.length)return n[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=He(t[e],n);else if(typeof t=="object")for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=He(t[e],n));return t}var zt=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ht=5,d=function(t){return t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK",t}(d||{}),We=class{constructor(n){this.replacer=n}encode(n){return(n.type===d.EVENT||n.type===d.ACK)&&fe(n)?this.encodeAsBinary({type:n.type===d.EVENT?d.BINARY_EVENT:d.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let e=""+n.type;return(n.type===d.BINARY_EVENT||n.type===d.BINARY_ACK)&&(e+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(e+=n.nsp+","),n.id!=null&&(e+=n.id),n.data!=null&&(e+=JSON.stringify(n.data,this.replacer)),e}encodeAsBinary(n){let e=Kt(n),i=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(i),s}},Ye=class t extends y{constructor(n){super(),this.reviver=n}add(n){let e;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(n);let i=e.type===d.BINARY_EVENT;i||e.type===d.BINARY_ACK?(e.type=i?d.EVENT:d.ACK,this.reconstructor=new Je(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(me(n)||n.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(n),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let e=0,i={type:Number(n.charAt(0))};if(d[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===d.BINARY_EVENT||i.type===d.BINARY_ACK){let o=e+1;for(;n.charAt(++e)!=="-"&&e!=n.length;);let p=n.substring(o,e);if(p!=Number(p)||n.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(p)}if(n.charAt(e+1)==="/"){let o=e+1;for(;++e&&!(n.charAt(e)===","||e===n.length););i.nsp=n.substring(o,e)}else i.nsp="/";let s=n.charAt(e+1);if(s!==""&&Number(s)==s){let o=e+1;for(;++e;){let p=n.charAt(e);if(p==null||Number(p)!=p){--e;break}if(e===n.length)break}i.id=Number(n.substring(o,e+1))}if(n.charAt(++e)){let o=this.tryParse(n.substr(e));if(t.isPayloadValid(i.type,o))i.data=o;else throw new Error("invalid payload")}return i}tryParse(n){try{return JSON.parse(n,this.reviver)}catch{return!1}}static isPayloadValid(n,e){switch(n){case d.CONNECT:return Me(e);case d.DISCONNECT:return e===void 0;case d.CONNECT_ERROR:return typeof e=="string"||Me(e);case d.EVENT:case d.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&zt.indexOf(e[0])===-1);case d.ACK:case d.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Je=class{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){let e=$t(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Rn(t){return typeof t=="string"}var Nn=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function Dn(t){return t===void 0||Nn(t)}function Me(t){return Object.prototype.toString.call(t)==="[object Object]"}function Bn(t,n){switch(t){case d.CONNECT:return n===void 0||Me(n);case d.DISCONNECT:return n===void 0;case d.EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&zt.indexOf(n[0])===-1);case d.ACK:return Array.isArray(n);case d.CONNECT_ERROR:return typeof n=="string"||Me(n);default:return!1}}function Fn(t){return Rn(t.nsp)&&Dn(t.id)&&Bn(t.type,t.data)}function O(t,n,e){return t.on(n,e),function(){t.off(n,e)}}var Vn=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),se=class extends y{constructor(n,e,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let n=this.io;this.subs=[O(n,"open",this.onopen.bind(this)),O(n,"packet",this.onpacket.bind(this)),O(n,"error",this.onerror.bind(this)),O(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...e){var i,s,o;if(Vn.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(e.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let p={type:d.EVENT,data:e};if(p.options={},p.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){let R=this.ids++,H=e.pop();this._registerAckCallback(R,H),p.id=R}let m=(s=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||s===void 0?void 0:s.writable,_=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!m||(_?(this.notifyOutgoingListeners(p),this.packet(p)):this.sendBuffer.push(p)),this.flags={},this}_registerAckCallback(n,e){var i;let s=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(s===void 0){this.acks[n]=e;return}let o=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===n&&this.sendBuffer.splice(m,1);e.call(this,new Error("operation has timed out"))},s),p=(...m)=>{this.io.clearTimeoutFn(o),e.apply(this,m)};p.withError=!0,this.acks[n]=p}emitWithAck(n,...e){return new Promise((i,s)=>{let o=(p,m)=>p?s(p):i(m);o.withError=!0,e.push(o),this.emit(n,...e)})}_addToQueue(n){let e;typeof n[n.length-1]=="function"&&(e=n.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((s,...o)=>(this._queue[0],s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(s)):(this._queue.shift(),e&&e(null,...o)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;let e=this._queue[0];e.pending&&!n||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:d.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(i=>String(i.id)===n)){let i=this.acks[n];delete this.acks[n],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case d.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case d.EVENT:case d.BINARY_EVENT:this.onevent(n);break;case d.ACK:case d.BINARY_ACK:this.onack(n);break;case d.DISCONNECT:this.ondisconnect();break;case d.CONNECT_ERROR:this.destroy();let i=new Error(n.data.message);i.data=n.data.data,this.emitReserved("connect_error",i);break}}onevent(n){let e=n.data||[];n.id!=null&&e.push(this.ack(n.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){let e=this._anyListeners.slice();for(let i of e)i.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){let e=this,i=!1;return function(...s){i||(i=!0,e.packet({type:d.ACK,id:n,data:s}))}}onack(n){let e=this.acks[n.id];typeof e=="function"&&(delete this.acks[n.id],e.withError&&n.data.unshift(null),e.apply(this,n.data))}onconnect(n,e){this.id=n,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:d.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){let e=this._anyListeners;for(let i=0;i<e.length;i++)if(n===e[i])return e.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){let e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(n===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let e=this._anyOutgoingListeners.slice();for(let i of e)i.apply(this,n.data)}}};function Q(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Q.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),e=Math.floor(n*this.jitter*t);t=Math.floor(n*10)&1?t+e:t-e}return Math.min(t,this.max)|0};Q.prototype.reset=function(){this.attempts=0};Q.prototype.setMin=function(t){this.ms=t};Q.prototype.setMax=function(t){this.max=t};Q.prototype.setJitter=function(t){this.jitter=t};var oe=class extends y{constructor(n,e){var i;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(e=n,n=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,K(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Q({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=n;let s=e.parser||Xe;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var e;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(e=this.backoff)===null||e===void 0||e.setMin(n),this)}randomizationFactor(n){var e;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(e=this.backoff)===null||e===void 0||e.setJitter(n),this)}reconnectionDelayMax(n){var e;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(e=this.backoff)===null||e===void 0||e.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new ie(this.uri,this.opts);let e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let s=O(e,"open",function(){i.onopen(),n&&n()}),o=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),n?n(m):this.maybeReconnectOnOpen()},p=O(e,"error",o);if(this._timeout!==!1){let m=this._timeout,_=this.setTimeoutFn(()=>{s(),o(new Error("timeout")),e.close()},m);this.opts.autoUnref&&_.unref(),this.subs.push(()=>{this.clearTimeoutFn(_)})}return this.subs.push(s),this.subs.push(p),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let n=this.engine;this.subs.push(O(n,"ping",this.onping.bind(this)),O(n,"data",this.ondata.bind(this)),O(n,"error",this.onerror.bind(this)),O(n,"close",this.onclose.bind(this)),O(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(e){this.onclose("parse error",e)}}ondecoded(n){q(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,e){let i=this.nsps[n];return i?this._autoConnect&&!i.active&&i.connect():(i=new se(this,n,e),this.nsps[n]=i),i}_destroy(n){let e=Object.keys(this.nsps);for(let i of e)if(this.nsps[i].active)return;this._close()}_packet(n){let e=this.encoder.encode(n);for(let i=0;i<e.length;i++)this.engine.write(e[i],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(s=>{s?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",s)):n.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}};var _e={};function Ce(t,n){typeof t=="object"&&(n=t,t=void 0),n=n||{};let e=jt(t,n.path||"/socket.io"),i=e.source,s=e.id,o=e.path,p=_e[s]&&o in _e[s].nsps,m=n.forceNew||n["force new connection"]||n.multiplex===!1||p,_;return m?_=new oe(i,n):(_e[s]||(_e[s]=new oe(i,n)),_=_e[s]),e.query&&!n.query&&(n.query=e.queryKey),_.socket(e.path,n)}Object.assign(Ce,{Manager:oe,Socket:se,io:Ce,connect:Ce});var Qe=tt(pt());var Oe=(()=>{class t{http;baseUrl=`${B.api.baseUrl}/session`;constructor(e){this.http=e}listSessions(){return M(this.http.get(this.baseUrl))}getSession(e){return M(this.http.get(`${this.baseUrl}/${e}`))}updateSession(e){return M(this.http.patch(`${this.baseUrl}/${e.sessionId}`,e.updates))}static \u0275fac=function(i){return new(i||t)(L(Y))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Yt=8e3,Ln=1e3,z=(()=>{class t{sessionApiService;activeSessionId="";sessionsSubject=new G([]);messagesSubject=new G([]);socket;connectedSubject=new G(!1);agentEventsSubject=new G({});contextUpdatedSubject=new G(null);monitoringEventSubject=new G(null);reconnectTimeoutId;sessions$=this.sessionsSubject.asObservable();messages$=this.messagesSubject.asObservable();connected$=this.connectedSubject.asObservable();agentEvents$=this.agentEventsSubject.asObservable();contextUpdated$=this.contextUpdatedSubject.asObservable();monitoringEvent$=this.monitoringEventSubject.asObservable();constructor(e){this.sessionApiService=e}loadSessions(){return P(this,null,function*(){try{let e=yield this.sessionApiService.listSessions();this.sessionsSubject.next(e.sessions)}catch(e){Qe.DyFM_Log.error("CCAP_SessionDS | Failed to load sessions",e)}})}setActiveSession(e){this.activeSessionId=e,this.connectSocket()}getActiveSessionId(){return this.activeSessionId}getSocketUrl(){return B.socketUrl??B.api.baseUrl}connectSocket(e=0){this.reconnectTimeoutId!=null&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=void 0),this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect());let i=this.getSocketUrl();this.socket=Ce(i,{transports:["websocket"]}),this.socket.on("connect",()=>{this.connectedSubject.next(!0)}),this.socket.on("disconnect",()=>{if(this.connectedSubject.next(!1),this.activeSessionId&&e<Yt){let s=e>0?Math.min(e*2,Yt):Ln;this.reconnectTimeoutId=setTimeout(()=>{this.reconnectTimeoutId=void 0,this.connectSocket(s)},s)}}),this.socket.on("answer",s=>{let o=this.messagesSubject.value,p={role:"assistant",content:s.content,timestamp:new Date(s.timestamp)};s.runId&&(p.runId=s.runId),o.push(p),this.messagesSubject.next([...o])}),this.socket.on("notify-user",s=>{Qe.DyFM_Log.info(`CCAP_SessionDS | Notification: ${s.content}`)}),this.socket.on("agent-events",s=>{this.agentEventsSubject.next(s.eventData??{})}),this.socket.on("context:updated",s=>{this.contextUpdatedSubject.next({sessionId:s.sessionId,contextState:s.contextState??{}})}),this.socket.on("monitoring:event",s=>{this.monitoringEventSubject.next({sessionId:s.sessionId,event:s.event??{}})})}sendMessageViaSocket(e){if(!this.socket||!this.activeSessionId)return;let i=this.messagesSubject.value;i.push({role:"user",content:e,timestamp:new Date}),this.messagesSubject.next([...i]),this.socket.emit("new-user-msg",{channelId:`ccap-client-${this.activeSessionId}`,content:e,sessionId:this.activeSessionId})}clearMessages(){this.messagesSubject.next([])}ngOnDestroy(){this.reconnectTimeoutId!=null&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=void 0),this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect())}static \u0275fac=function(i){return new(i||t)(L(Oe))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Un=(t,n)=>n._id,jn=(t,n,e)=>({"text-green-500":t,"text-orange-500":n,"text-red-500":e});function qn(t,n){if(t&1){let e=E();a(0,"div",7),f("click",function(){let s=b(e).$implicit,o=u(2);return S(o.selectSession(s._id))}),a(1,"div",8),l(2),r(),a(3,"div",9)(4,"span",10),l(5),r(),a(6,"span"),l(7),r()()()}if(t&2){let e=n.$implicit;c(2),x(" ",e.name||"Unnamed Session"," "),c(2),g("ngClass",ee(4,jn,e.status==="active",e.status==="closed",e.status==="terminated")),c(),x(" ",e.status," "),c(2),k(e.sessionIntent)}}function Kn(t,n){if(t&1&&(a(0,"div",4),N(1,qn,8,8,"div",6,Un),r()),t&2){let e=u();c(),D(e.sessions)}}function $n(t,n){t&1&&(a(0,"div",5),l(1,"No sessions found."),r())}var Xt=(()=>{class t{sessionDS;router;sessions=[];constructor(e,i){this.sessionDS=e,this.router=i}ngOnInit(){this.sessionDS.sessions$.subscribe(e=>{this.sessions=e}),this.sessionDS.loadSessions()}selectSession(e){this.router.navigate(["/session",e])}refreshSessions(){this.sessionDS.loadSessions()}static \u0275fac=function(i){return new(i||t)(w(z),w(dt))};static \u0275cmp=v({type:t,selectors:[["app-ccap-session-list"]],decls:8,vars:1,consts:[[1,"p-4"],[1,"flex","justify-between","items-center","mb-4"],[1,"text-lg","font-bold"],[1,"px-4","py-2","border","border-neutral-600","rounded-md","bg-transparent","text-neutral-200","text-sm","cursor-pointer","hover:bg-neutral-800",3,"click"],[1,"flex","flex-col","gap-2"],[1,"py-6","text-center","text-neutral-500"],[1,"px-4","py-3","border","border-neutral-700","rounded-lg","cursor-pointer","transition-colors","duration-200","hover:bg-ccapSurface"],[1,"px-4","py-3","border","border-neutral-700","rounded-lg","cursor-pointer","transition-colors","duration-200","hover:bg-ccapSurface",3,"click"],[1,"font-semibold","text-sm","text-neutral-100"],[1,"flex","gap-3","mt-1","text-xs","text-neutral-400"],[1,"uppercase","text-[11px]","font-bold",3,"ngClass"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1)(2,"h2",2),l(3,"Sessions"),r(),a(4,"button",3),f("click",function(){return s.refreshSessions()}),l(5," Refresh "),r()(),C(6,Kn,3,0,"div",4)(7,$n,2,0,"div",5),r()),i&2&&(c(6),h(s.sessions.length?6:7))},dependencies:[U]})}return t})();var re=function(t){return t.conversation="conversation",t.conversationFull="conversation-full",t}(re||{});var Ne=(()=>{class t{http;baseUrl=`${B.api.baseUrl}/session`;constructor(e){this.http=e}getMessages(e){return M(this.http.get(`${this.baseUrl}/${e.sessionId}/messages`,{params:{viewMode:e.viewMode}}))}sendMessage(e){return M(this.http.post(`${this.baseUrl}/${e.sessionId}/messages`,{content:e.content}))}static \u0275fac=function(i){return new(i||t)(L(Y))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Ze=(()=>{class t{http;baseUrl=`${B.api.baseUrl}/session`;constructor(e){this.http=e}getEvents(e){return M(this.http.get(`${this.baseUrl}/${e}/events`))}getRunTrace(e){return M(this.http.get(`${this.baseUrl}/${e.sessionId}/runs/${e.runId}/trace`))}static \u0275fac=function(i){return new(i||t)(L(Y))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function Hn(t,n){if(t&1&&(a(0,"div")(1,"strong"),l(2,"Input size:"),r(),l(3),r()),t&2){let e=u();c(3),x(" ",e.event.inputSize,"")}}function Wn(t,n){if(t&1&&(a(0,"div")(1,"strong"),l(2,"Output size:"),r(),l(3),r()),t&2){let e=u();c(3),x(" ",e.event.outputSize,"")}}function Yn(t,n){if(t&1&&(a(0,"div")(1,"strong"),l(2,"Run ID:"),r(),l(3),r()),t&2){let e=u();c(3),x(" ",e.event.runId,"")}}function Jn(t,n){if(t&1&&(a(0,"div",5)(1,"h5",6),l(2,"DTS"),r(),a(3,"pre",7),l(4),r()()),t&2){let e=u();c(4),k(e.formatDataValue(e.event.data.dts))}}function Xn(t,n){if(t&1&&(a(0,"div",5)(1,"h5",6),l(2,"Conversation (felhaszn\xE1lt)"),r(),a(3,"pre",7),l(4),r()()),t&2){let e=u();c(4),k(e.formatDataValue(e.event.data.conversationSlice))}}function Gn(t,n){if(t&1&&(a(0,"div",5)(1,"h5",6),l(2,"D\xF6nt\xE9si pontok"),r(),a(3,"pre",7),l(4),r()()),t&2){let e=u();c(4),k(e.formatDataValue(e.event.data.decisionSummary))}}var et=(()=>{class t{event={eventType:"",timestamp:new Date,data:{},durationMs:0,status:"",sessionId:"",runId:"",inputSize:0,outputSize:0};close=new W;get formattedData(){return JSON.stringify(this.event.data,null,2)}formatDataValue(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2)}onClose(){this.close.emit()}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-trace-detail"]],inputs:{event:"event"},outputs:{close:"close"},decls:26,vars:10,consts:[[1,"fixed","right-0","top-0","w-[480px]","h-screen","bg-[#121220]","border-l","border-neutral-700","p-4","overflow-y-auto","z-[100]"],[1,"flex","justify-between","items-center","mb-4"],[1,"text-sm","font-bold"],[1,"px-2.5","py-1","border","border-neutral-600","rounded","bg-transparent","text-neutral-200","cursor-pointer","hover:bg-neutral-800",3,"click"],[1,"flex","flex-col","gap-1","text-[13px]","text-neutral-300","mb-4","pb-4","border-b","border-neutral-700"],[1,"mb-4"],[1,"text-xs","uppercase","text-neutral-400","mb-2"],[1,"bg-[#0a0a15]","border","border-neutral-700","rounded-md","p-3","text-xs","text-neutral-200","overflow-x-auto","whitespace-pre-wrap","break-words"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1)(2,"h4",2),l(3),r(),a(4,"button",3),f("click",function(){return s.onClose()}),l(5,"X"),r()(),a(6,"div",4)(7,"div")(8,"strong"),l(9,"Status:"),r(),l(10),r(),a(11,"div")(12,"strong"),l(13,"Duration:"),r(),l(14),r(),C(15,Hn,4,1,"div")(16,Wn,4,1,"div")(17,Yn,4,1,"div"),r(),C(18,Jn,5,1,"div",5)(19,Xn,5,1,"div",5)(20,Gn,5,1,"div",5),a(21,"div")(22,"h5",6),l(23,"Event Data"),r(),a(24,"pre",7),l(25),r()()()),i&2&&(c(3),x("",s.event.eventType," - Trace Detail"),c(7),x(" ",s.event.status,""),c(4),x(" ",s.event.durationMs,"ms"),c(),h(s.event.inputSize?15:-1),c(),h(s.event.outputSize?16:-1),c(),h(s.event.runId?17:-1),c(),h(s.event.data.dts?18:-1),c(),h(s.event.data.conversationSlice?19:-1),c(),h(s.event.data.decisionSummary?20:-1),c(5),k(s.formattedData))}})}return t})();function Qn(t,n){t&1&&(a(0,"span",3),l(1,"\u2192"),r())}function Zn(t,n){if(t&1){let e=E();C(0,Qn,2,0,"span",3),a(1,"button",4),f("click",function(){let s=b(e).$implicit,o=u();return S(o.onBubbleClick(s))}),l(2),r()}if(t&2){let e=n.$implicit,i=n.$index;h(i>0?0:-1),c(2),x(" ",e.eventType," ")}}function ei(t,n){t&1&&(a(0,"span",2),l(1,"Nincs l\xE9p\xE9s."),r())}var en=(()=>{class t{trace=[];eventSelected=new W;onBubbleClick(e){this.eventSelected.emit(e)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-run-flow-viz"]],inputs:{trace:"trace"},outputs:{eventSelected:"eventSelected"},decls:4,vars:1,consts:[[1,"flex","flex-wrap","items-center","gap-1","py-1"],[1,"px-2","py-1","rounded-md","text-xs","font-medium","bg-neutral-700","text-neutral-200","border","border-neutral-600","hover:bg-ccapAccent","hover:border-ccapAccent","hover:text-white","transition-colors"],[1,"text-neutral-500","text-xs"],[1,"text-neutral-600","text-[10px]"],[1,"px-2","py-1","rounded-md","text-xs","font-medium","bg-neutral-700","text-neutral-200","border","border-neutral-600","hover:bg-ccapAccent","hover:border-ccapAccent","hover:text-white","transition-colors",3,"click"]],template:function(i,s){i&1&&(a(0,"div",0),N(1,Zn,3,2,"button",1,Z),C(3,ei,2,0,"span",2),r()),i&2&&(c(),D(s.trace),c(2),h(s.trace.length?-1:3))},styles:["[_nghost-%COMP%]{display:block}"]})}return t})();var ni=()=>["user","assistant","system","tool"],ii=(t,n,e,i,s)=>({"self-end bg-indigo-950 text-indigo-100":t,"self-start bg-green-950 text-green-100":n,"self-center bg-neutral-800 text-neutral-400 italic text-xs":e,"self-start bg-amber-950 text-amber-200 font-mono text-xs":i,"self-start bg-neutral-700 text-neutral-200":s});function si(t,n){t&1&&(a(0,"div",8),A(1,"span",11),l(2," Event history bet\xF6lt\xE9se\u2026 "),r())}function oi(t,n){if(t&1){let e=E();a(0,"app-ccap-run-flow-viz",12),f("eventSelected",function(s){b(e);let o=u(3);return S(o.onFlowEventSelected(s))}),r()}if(t&2){let e=u(3);g("trace",e.runTrace)}}function ri(t,n){t&1&&(a(0,"p",10),l(1,"Nincs event."),r())}function ai(t,n){if(t&1&&(a(0,"div",7),C(1,si,3,0,"div",8)(2,oi,1,1,"app-ccap-run-flow-viz",9)(3,ri,2,0,"p",10),r()),t&2){let e=u(2);c(),h(e.runTraceLoading?1:e.runTrace.length?2:3)}}function ci(t,n){if(t&1){let e=E();a(0,"div",4)(1,"button",6),f("click",function(){b(e);let s=u();return S(s.toggleExpanded())}),l(2),r(),C(3,ai,4,1,"div",7),r()}if(t&2){let e=u();c(2),x(" ",e.expanded?"\u25BC H\xE1tt\xE9rfolyamatok":"\u25B6 H\xE1tt\xE9rfolyamatok"," "),c(),h(e.expanded?3:-1)}}function li(t,n){if(t&1){let e=E();a(0,"div",13),f("click",function(){b(e);let s=u();return S(s.closeTracePopup())}),A(1,"div",14),a(2,"div",15),f("click",function(s){return b(e),S(s.stopPropagation())}),a(3,"app-ccap-trace-detail",16),f("close",function(){b(e);let s=u();return S(s.closeTracePopup())}),r()()()}if(t&2){let e=u();c(3),g("event",e.selectedEventForPopup)}}var tn=(()=>{class t{monitoringApi;message={role:"",content:"",timestamp:new Date};sessionId="";expanded=!1;runTrace=[];runTraceLoading=!1;runTraceLoaded=!1;selectedEventForPopup=null;constructor(e){this.monitoringApi=e}closeTracePopup(){this.selectedEventForPopup=null}toggleExpanded(){this.expanded=!this.expanded,this.expanded&&this.message.runId&&this.sessionId&&!this.runTraceLoaded&&this.loadRunTrace()}onFlowEventSelected(e){this.selectedEventForPopup=e}loadRunTrace(){return P(this,null,function*(){if(!(!this.sessionId||!this.message.runId)){this.runTraceLoading=!0;try{let i=(yield this.monitoringApi.getRunTrace({sessionId:this.sessionId,runId:this.message.runId})).trace??[];this.runTrace=i.map(s=>{let o=s??{};return{eventType:o.eventType??"",timestamp:o.timestamp?new Date(o.timestamp):new Date,data:o.data??o,durationMs:o.durationMs??0,status:o.status??"",sessionId:o.sessionId??this.sessionId,runId:o.runId??this.message.runId??"",inputSize:o.inputSize??0,outputSize:o.outputSize??0}}),this.runTraceLoaded=!0}catch{this.runTrace=[],this.runTraceLoaded=!0}finally{this.runTraceLoading=!1}}})}static \u0275fac=function(i){return new(i||t)(w(Ze))};static \u0275cmp=v({type:t,selectors:[["app-ccap-message-bubble"]],inputs:{message:"message",sessionId:"sessionId"},decls:8,vars:12,consts:[[1,"flex","flex-col","gap-0","max-w-[80%]"],[1,"px-3.5","py-2.5","rounded-lg","break-words",3,"ngClass"],[1,"text-[10px]","uppercase","font-bold","mb-1","opacity-60"],[1,"whitespace-pre-wrap","leading-relaxed"],[1,"self-start","mt-1"],[1,"fixed","inset-0","z-[100]","flex","justify-end"],[1,"text-xs","text-neutral-400","hover:text-ccapAccent","px-1","py-0.5",3,"click"],[1,"mt-2","pl-2","border-l-2","border-neutral-600","space-y-1"],[1,"flex","items-center","gap-2","text-neutral-500","text-xs","py-2"],[3,"trace"],[1,"text-neutral-500","text-xs"],[1,"inline-block","w-2","h-2","rounded-full","bg-ccapAccent","animate-pulse"],[3,"eventSelected","trace"],[1,"fixed","inset-0","z-[100]","flex","justify-end",3,"click"],["aria-hidden","true",1,"absolute","inset-0","bg-black/50"],[1,"relative","z-10",3,"click"],[3,"close","event"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1)(2,"div",2),l(3),r(),a(4,"div",3),l(5),r()(),C(6,ci,4,2,"div",4)(7,li,4,1,"div",5),r()),i&2&&(c(),g("ngClass",ct(6,ii,s.message.role==="user",s.message.role==="assistant",s.message.role==="system",s.message.role==="tool",!s.message.role||!at(5,ni).includes(s.message.role))),c(2),x(" ",s.message.role||"message"," "),c(2),x(" ",s.message.content," "),c(),h(s.message.role==="assistant"&&s.message.runId?6:-1),c(),h(s.selectedEventForPopup?7:-1))},dependencies:[U,et,en]})}return t})();var nn=t=>({"bg-ccapAccent text-white":t}),sn=(()=>{class t{viewMode=re.conversation;viewModeChange=new W;viewModes=re;setViewMode(e){this.viewMode=e,this.viewModeChange.emit(e)}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-view-mode-toggle"]],inputs:{viewMode:"viewMode"},outputs:{viewModeChange:"viewModeChange"},decls:5,vars:6,consts:[[1,"flex","border","border-neutral-600","rounded-md","overflow-hidden","w-fit"],[1,"px-3.5","py-1.5","border-none","bg-transparent","text-neutral-400","cursor-pointer","text-xs","transition-colors","border-r","border-neutral-600","hover:text-neutral-200",3,"click","ngClass"],[1,"px-3.5","py-1.5","border-none","bg-transparent","text-neutral-400","cursor-pointer","text-xs","transition-colors","hover:text-neutral-200",3,"click","ngClass"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"button",1),f("click",function(){return s.setViewMode(s.viewModes.conversation)}),l(2," Conversation "),r(),a(3,"button",2),f("click",function(){return s.setViewMode(s.viewModes.conversationFull)}),l(4," Full View "),r()()),i&2&&(c(),g("ngClass",Be(2,nn,s.viewMode===s.viewModes.conversation)),c(2),g("ngClass",Be(4,nn,s.viewMode===s.viewModes.conversationFull)))},dependencies:[U]})}return t})();function di(t,n){if(t&1&&A(0,"app-ccap-message-bubble",4),t&2){let e=n.$implicit,i=u();g("message",e)("sessionId",i.sessionId)}}function hi(t,n){if(t&1&&(a(0,"span"),l(1),r()),t&2){let e=u(2);c(),k(e.runStatusText)}}function fi(t,n){t&1&&(a(0,"span"),l(1,"Thinking\u2026"),r())}function mi(t,n){if(t&1&&(a(0,"div",5),A(1,"span",10),C(2,hi,2,1,"span")(3,fi,2,0,"span"),r()),t&2){let e=u();c(2),h(e.runStatusText?2:3)}}function _i(t,n){t&1&&(a(0,"div",6),l(1," No messages yet. Start a conversation. "),r())}var on=(()=>{class t{sessionDS;conversationApi;sessionId="";messages=[];newMessage="";viewMode=re.conversation;runStatusText="";isTyping=!1;constructor(e,i){this.sessionDS=e,this.conversationApi=i}ngOnInit(){this.sessionDS.messages$.subscribe(e=>{this.messages=e}),this.sessionDS.agentEvents$.subscribe(e=>{let i=e.phase??e.step??"",s=e.status??"";this.isTyping=!!(i||s),i==="analyze"||s==="analyzing"?this.runStatusText="Analyzing\u2026":i==="assemble"||s==="assembling"?this.runStatusText="Assembling conversation\u2026":i==="execution"||s==="executing"?this.runStatusText="Executing\u2026":i==="toolCall"||e.toolCall?this.runStatusText="Executing tool\u2026":i||s?this.runStatusText=s||i:this.runStatusText=""}),this.loadMessages()}loadMessages(){return P(this,null,function*(){let e=yield this.conversationApi.getMessages({sessionId:this.sessionId,viewMode:this.viewMode});this.messages=e.messages})}sendMessage(){this.newMessage.trim()&&(this.sessionDS.sendMessageViaSocket(this.newMessage),this.newMessage="")}onViewModeChange(e){this.viewMode=e,this.loadMessages()}static \u0275fac=function(i){return new(i||t)(w(z),w(Ne))};static \u0275cmp=v({type:t,selectors:[["app-ccap-chat"]],inputs:{sessionId:"sessionId"},decls:12,vars:4,consts:[[1,"flex","flex-col","h-full"],[1,"px-4","py-2","border-b","border-neutral-700"],[3,"viewModeChange","viewMode"],[1,"flex-1","overflow-y-auto","p-4","flex","flex-col","gap-2"],[3,"message","sessionId"],[1,"flex","items-center","gap-2","text-neutral-400","text-sm","py-1"],[1,"text-center","text-neutral-500","py-12"],[1,"flex","gap-2","px-4","py-3","border-t","border-neutral-700"],["type","text","placeholder","Type a message...",1,"flex-1","px-3.5","py-2.5","border","border-neutral-600","rounded-lg","bg-ccapSurface","text-neutral-100","text-sm","outline-none","focus:border-ccapAccent",3,"ngModelChange","keydown.enter","ngModel"],[1,"px-5","py-2.5","border-none","rounded-lg","bg-ccapAccent","text-white","cursor-pointer","text-sm","font-semibold","hover:bg-ccapAccentHover",3,"click"],[1,"inline-block","w-2","h-2","rounded-full","bg-ccapAccent","animate-pulse"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1)(2,"app-ccap-view-mode-toggle",2),f("viewModeChange",function(p){return s.onViewModeChange(p)}),r()(),a(3,"div",3),N(4,di,1,2,"app-ccap-message-bubble",4,Z),C(6,mi,4,1,"div",5)(7,_i,2,0,"div",6),r(),a(8,"div",7)(9,"input",8),rt("ngModelChange",function(p){return ot(s.newMessage,p)||(s.newMessage=p),p}),f("keydown.enter",function(){return s.sendMessage()}),r(),a(10,"button",9),f("click",function(){return s.sendMessage()}),l(11," Send "),r()()()),i&2&&(c(2),g("viewMode",s.viewMode),c(2),D(s.messages),c(2),h(s.isTyping?6:-1),c(),h(!s.messages.length&&!s.isTyping?7:-1),c(2),st("ngModel",s.newMessage))},dependencies:[ft,mt,_t,tn,sn]})}return t})();var gi=(t,n,e)=>({"text-green-500":t,"text-red-500":n,"text-orange-500":e});function xi(t,n){if(t&1&&(a(0,"div",6)(1,"strong"),l(2,"Goal:"),r(),l(3),r()),t&2){let e=u(2);c(3),x(" ",e.runGoal," ")}}function vi(t,n){if(t&1&&(a(0,"div",5),C(1,xi,4,1,"div",6),a(2,"div"),l(3),r()()),t&2){let e=u();c(),h(e.runGoal?1:-1),c(2),k(e.runSummary)}}var rn=(()=>{class t{runSummary="";runStatus="";runIntent="";runGoal="";collapsed=!0;toggleCollapse(){this.collapsed=!this.collapsed}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-run-summary"]],inputs:{runSummary:"runSummary",runStatus:"runStatus",runIntent:"runIntent",runGoal:"runGoal"},decls:9,vars:9,consts:[[1,"border","border-neutral-700","rounded-lg","my-2","overflow-hidden"],[1,"flex","items-center","gap-3","px-3.5","py-2.5","cursor-pointer","bg-ccapSurface","text-[13px]","hover:bg-neutral-800",3,"click"],[1,"font-bold","uppercase","text-[11px]",3,"ngClass"],[1,"flex-1","text-neutral-200"],[1,"text-neutral-400","text-base","font-bold"],[1,"px-3.5","py-3","text-[13px]","text-neutral-300","border-t","border-neutral-700"],[1,"mb-2","text-neutral-400"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"div",1),f("click",function(){return s.toggleCollapse()}),a(2,"span",2),l(3),r(),a(4,"span",3),l(5),r(),a(6,"span",4),l(7),r()(),C(8,vi,4,2,"div",5),r()),i&2&&(c(2),g("ngClass",ee(5,gi,s.runStatus==="completed",s.runStatus==="failed",s.runStatus==="executing")),c(),x(" ",s.runStatus," "),c(2),k(s.runIntent),c(2),x(" ",s.collapsed?"+":"-"," "),c(),h(s.collapsed?-1:8))},dependencies:[U]})}return t})();function bi(t,n){if(t&1&&A(0,"app-ccap-run-summary",1),t&2){let e,i=u();g("runSummary","")("runStatus",i.runStatusText)("runIntent",i.session.sessionIntent)("runGoal",(e=i.session.sessionGoal)!==null&&e!==void 0?e:"")}}var an=(()=>{class t{route;sessionApi;sessionDS;sessionId="";session=null;runStatusText="";constructor(e,i,s){this.route=e,this.sessionApi=i,this.sessionDS=s}ngOnInit(){this.sessionId=this.route.snapshot.params.id??"",this.sessionDS.setActiveSession(this.sessionId),this.loadSession(),this.sessionDS.agentEvents$.subscribe(e=>{let i=e.phase??e.step??"";this.runStatusText=i?"executing":""})}loadSession(){return P(this,null,function*(){if(this.sessionId)try{let e=yield this.sessionApi.getSession(this.sessionId);this.session=e.session}catch{this.session=null}})}static \u0275fac=function(i){return new(i||t)(w(ye),w(Oe),w(z))};static \u0275cmp=v({type:t,selectors:[["app-ccap-session-detail"]],decls:4,vars:2,consts:[[1,"flex","flex-col","h-full"],[3,"runSummary","runStatus","runIntent","runGoal"],[1,"flex-1","overflow-hidden"],[3,"sessionId"]],template:function(i,s){i&1&&(a(0,"div",0),C(1,bi,1,4,"app-ccap-run-summary",1),a(2,"div",2),A(3,"app-ccap-chat",3),r()()),i&2&&(c(),h(s.session?1:-1),c(2),g("sessionId",s.sessionId))},dependencies:[on,rn]})}return t})();var cn=(()=>{class t{http;baseUrl=`${B.api.baseUrl}/session`;constructor(e){this.http=e}getContext(e){return M(this.http.get(`${this.baseUrl}/${e}/context`))}updateContextKey(e){return M(this.http.patch(`${this.baseUrl}/${e.sessionId}/context/keys/${e.key}`,{action:e.action}))}static \u0275fac=function(i){return new(i||t)(L(Y))};static \u0275prov=V({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var wi=(t,n,e)=>({"border border-green-500":t,"border border-orange-500":n,"border border-neutral-600":e});function Ei(t,n){if(t&1){let e=E();a(0,"button",5),f("click",function(){b(e);let s=u();return S(s.emitAction("open"))}),l(1,"Open"),r()}}function Ti(t,n){if(t&1){let e=E();a(0,"button",5),f("click",function(){b(e);let s=u();return S(s.emitAction("pin"))}),l(1,"Pin"),r()}}function Ai(t,n){if(t&1){let e=E();a(0,"button",5),f("click",function(){b(e);let s=u();return S(s.emitAction("close"))}),l(1,"Close"),r()}}var ln=(()=>{class t{keyName="";status="";keyAction=new W;emitAction(e){this.keyAction.emit({key:this.keyName,action:e})}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-context-key-item"]],inputs:{keyName:"keyName",status:"status"},outputs:{keyAction:"keyAction"},decls:9,vars:10,consts:[[1,"flex","items-center","gap-2","px-2.5","py-1.5","rounded-md","mb-1","text-[13px]",3,"ngClass"],[1,"flex-1","font-mono","text-neutral-200"],[1,"text-[10px]","uppercase","text-neutral-400"],[1,"flex","gap-1"],[1,"px-2","py-0.5","border","border-neutral-600","rounded","text-[11px]","bg-transparent","text-neutral-300","cursor-pointer","hover:bg-neutral-800","hover:text-white"],[1,"px-2","py-0.5","border","border-neutral-600","rounded","text-[11px]","bg-transparent","text-neutral-300","cursor-pointer","hover:bg-neutral-800","hover:text-white",3,"click"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"span",1),l(2),r(),a(3,"span",2),l(4),r(),a(5,"div",3),C(6,Ei,2,0,"button",4)(7,Ti,2,0,"button",4)(8,Ai,2,0,"button",4),r()()),i&2&&(g("ngClass",ee(6,wi,s.status==="active",s.status==="pinned",s.status==="cached")),c(2),k(s.keyName),c(2),k(s.status),c(2),h(s.status!=="active"?6:-1),c(),h(s.status!=="pinned"?7:-1),c(),h(s.status==="active"?8:-1))},dependencies:[U]})}return t})();function Ii(t,n){if(t&1){let e=E();a(0,"app-ccap-context-key-item",7),f("keyAction",function(s){b(e);let o=u();return S(o.onKeyAction(s))}),r()}if(t&2){let e=n.$implicit;g("keyName",e)("status","active")}}function Pi(t,n){t&1&&(a(0,"div",5),l(1,"No active keys"),r())}function Mi(t,n){if(t&1){let e=E();a(0,"app-ccap-context-key-item",7),f("keyAction",function(s){b(e);let o=u();return S(o.onKeyAction(s))}),r()}if(t&2){let e=n.$implicit;g("keyName",e)("status","pinned")}}function Oi(t,n){t&1&&(a(0,"div",5),l(1,"No pinned keys"),r())}function Ri(t,n){if(t&1){let e=E();a(0,"app-ccap-context-key-item",7),f("keyAction",function(s){b(e);let o=u();return S(o.onKeyAction(s))}),r()}if(t&2){let e=n.$implicit;g("keyName",e)("status","cached")}}function Ni(t,n){t&1&&(a(0,"div",5),l(1,"No cached keys"),r())}var pn=(()=>{class t{contextApi;sessionDS;sessionId="";contextState={};activeKeys=[];pinnedKeys=[];cachedKeys=[];constructor(e,i){this.contextApi=e,this.sessionDS=i}ngOnInit(){this.sessionDS.contextUpdated$.subscribe(e=>{e&&e.sessionId===this.sessionId&&this.applyContextState(e.contextState)}),this.loadContext()}ngOnChanges(e){e.sessionId&&this.sessionId&&this.loadContext()}applyContextState(e){this.contextState=e,this.activeKeys=e.activeKeys??[],this.pinnedKeys=e.pinnedKeys??[],this.cachedKeys=e.cachedKeys??[]}loadContext(){return P(this,null,function*(){if(!this.sessionId)return;let e=yield this.contextApi.getContext(this.sessionId);this.applyContextState(e.context)})}onKeyAction(e){return P(this,null,function*(){yield this.contextApi.updateContextKey({sessionId:this.sessionId,key:e.key,action:e.action}),yield this.loadContext()})}static \u0275fac=function(i){return new(i||t)(w(cn),w(z))};static \u0275cmp=v({type:t,selectors:[["app-ccap-context-panel"]],inputs:{sessionId:"sessionId"},features:[xe],decls:23,vars:6,consts:[[1,"p-4","overflow-y-auto","h-full"],[1,"text-base","font-bold","mb-4"],[1,"mb-5"],[1,"text-xs","text-neutral-400","uppercase","mb-2"],[3,"keyName","status"],[1,"text-xs","text-neutral-600","px-2"],[1,"px-4","py-2","border","border-neutral-600","rounded-md","bg-transparent","text-neutral-200","cursor-pointer","hover:bg-neutral-800",3,"click"],[3,"keyAction","keyName","status"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"h3",1),l(2,"Context"),r(),a(3,"div",2)(4,"h4",3),l(5),r(),N(6,Ii,1,2,"app-ccap-context-key-item",4,ve),C(8,Pi,2,0,"div",5),r(),a(9,"div",2)(10,"h4",3),l(11),r(),N(12,Mi,1,2,"app-ccap-context-key-item",4,ve),C(14,Oi,2,0,"div",5),r(),a(15,"div",2)(16,"h4",3),l(17),r(),N(18,Ri,1,2,"app-ccap-context-key-item",4,ve),C(20,Ni,2,0,"div",5),r(),a(21,"button",6),f("click",function(){return s.loadContext()}),l(22," Refresh "),r()()),i&2&&(c(5),x(" Active Keys (",s.activeKeys.length,") "),c(),D(s.activeKeys),c(2),h(s.activeKeys.length?-1:8),c(3),x(" Pinned Keys (",s.pinnedKeys.length,") "),c(),D(s.pinnedKeys),c(2),h(s.pinnedKeys.length?-1:14),c(3),x(" Cached Keys (",s.cachedKeys.length,") "),c(),D(s.cachedKeys),c(2),h(s.cachedKeys.length?-1:20))},dependencies:[ln]})}return t})();var Bi=tt(pt());function Vi(t,n){if(t&1){let e=E();a(0,"button",3),f("click",function(){b(e);let s=u();return S(s.togglePanel())}),a(1,"span",4),l(2,"\u203A"),r()()}}function Li(t,n){t&1&&(a(0,"p",9),l(1,"V\xE1lassz sessiont a chat megtekint\xE9s\xE9hez."),r())}function Ui(t,n){t&1&&(a(0,"div",12),A(1,"span",15),l(2," Bet\xF6lt\xE9s\u2026 "),r())}function ji(t,n){if(t&1&&(a(0,"div",17)(1,"span",18),l(2),r(),a(3,"span",19),l(4),r()()),t&2){let e=n.$implicit;De("self-end",e.role==="user")("self-start",e.role!=="user"),c(2),x("",e.role,":"),c(2),x(" ",e.content.length>120?e.content.slice(0,120)+"\u2026":e.content," ")}}function qi(t,n){if(t&1&&(a(0,"div",13),N(1,ji,5,6,"div",16,Z),r()),t&2){let e=u(3);c(),D(e.conversationFullMessages)}}function Ki(t,n){t&1&&(a(0,"p",9),l(1,"Nincs \xFCzenet."),r())}function $i(t,n){if(t&1&&(a(0,"section",10)(1,"h4",11),l(2,"Conversation full"),r(),C(3,Ui,3,0,"div",12)(4,qi,3,0,"div",13)(5,Ki,2,0,"p",9),r(),a(6,"section")(7,"h4",11),l(8,"Aktu\xE1lis context"),r(),A(9,"app-ccap-context-panel",14),r()),t&2){let e=u(2);c(3),h(e.conversationFullLoading?3:e.conversationFullMessages.length?4:5),c(6),g("sessionId",e.sessionId)}}function zi(t,n){if(t&1){let e=E();a(0,"div",2)(1,"div",5)(2,"span",6),l(3,"Info panel"),r(),a(4,"button",7),f("click",function(){b(e);let s=u();return S(s.togglePanel())}),l(5," \u2715 "),r()(),a(6,"div",8),C(7,Li,2,0,"p",9)(8,$i,10,2),r()()}if(t&2){let e=u();c(7),h(e.sessionId?8:7)}}var un=(()=>{class t{conversationApi;sessionId="";isOpen=!1;conversationFullMessages=[];conversationFullLoading=!1;constructor(e){this.conversationApi=e}ngOnInit(){this.isOpen&&this.sessionId&&this.loadConversationFull()}ngOnChanges(e){e.sessionId&&this.isOpen&&this.sessionId&&this.loadConversationFull()}togglePanel(){this.isOpen=!this.isOpen,this.isOpen&&this.sessionId&&!this.conversationFullMessages.length&&this.loadConversationFull()}loadConversationFull(){return P(this,null,function*(){if(this.sessionId){this.conversationFullLoading=!0;try{let e=yield this.conversationApi.getMessages({sessionId:this.sessionId,viewMode:"conversationFull"});this.conversationFullMessages=e.messages}catch{this.conversationFullMessages=[]}finally{this.conversationFullLoading=!1}}})}static \u0275fac=function(i){return new(i||t)(w(Ne))};static \u0275cmp=v({type:t,selectors:[["app-ccap-info-panel"]],inputs:{sessionId:"sessionId"},features:[xe],decls:3,vars:5,consts:[[1,"flex","h-full"],["title","Info panel megnyit\xE1sa",1,"w-full","h-full","flex","items-center","justify-center","border-l","border-neutral-700","bg-ccapSurface","text-neutral-400","hover:text-neutral-200","hover:bg-neutral-800","transition-colors"],[1,"flex","flex-col","h-full","w-[360px]","border-l","border-neutral-700","bg-ccapSurface","overflow-hidden"],["title","Info panel megnyit\xE1sa",1,"w-full","h-full","flex","items-center","justify-center","border-l","border-neutral-700","bg-ccapSurface","text-neutral-400","hover:text-neutral-200","hover:bg-neutral-800","transition-colors",3,"click"],[1,"text-lg"],[1,"flex","items-center","justify-between","px-3","py-2","border-b","border-neutral-700","shrink-0"],[1,"text-sm","font-semibold","text-neutral-200"],["title","Bez\xE1r\xE1s",1,"px-2","py-1","text-neutral-400","hover:text-neutral-200",3,"click"],[1,"flex-1","overflow-y-auto","p-4"],[1,"text-neutral-500","text-sm"],[1,"mb-6"],[1,"text-xs","font-bold","text-neutral-400","uppercase","mb-2"],[1,"flex","items-center","gap-2","text-neutral-500","text-sm","py-2"],[1,"flex","flex-col","gap-1.5","max-h-48","overflow-y-auto"],[3,"sessionId"],[1,"inline-block","w-2","h-2","rounded-full","bg-ccapAccent","animate-pulse"],[1,"px-2","py-1.5","rounded","border","border-neutral-700","text-xs","bg-neutral-800/50",3,"self-end","self-start"],[1,"px-2","py-1.5","rounded","border","border-neutral-700","text-xs","bg-neutral-800/50"],[1,"font-semibold","text-neutral-400"],[1,"text-neutral-200","whitespace-pre-wrap","break-words"]],template:function(i,s){i&1&&(a(0,"div",0),C(1,Vi,3,0,"button",1)(2,zi,9,1,"div",2),r()),i&2&&(De("w-12",!s.isOpen)("w-[360px]",s.isOpen),c(),h(s.isOpen?2:1))},dependencies:[pn],styles:["[_nghost-%COMP%]{display:block;height:100%;flex-shrink:0}"]})}return t})();var dn=(()=>{class t{route;activeSessionId="";paramsSub=null;constructor(e){this.route=e}ngOnInit(){this.paramsSub=this.route.firstChild?.params?.subscribe(e=>{this.activeSessionId=e.id??""})??null,this.activeSessionId=this.route.snapshot.firstChild?.params.id??""}ngOnDestroy(){this.paramsSub&&this.paramsSub.unsubscribe()}static \u0275fac=function(i){return new(i||t)(w(ye))};static \u0275cmp=v({type:t,selectors:[["app-ccap-session-shell"]],decls:6,vars:1,consts:[[1,"flex","h-screen","w-full"],[1,"w-64","shrink-0","border-r","border-neutral-700","bg-ccapSurface","overflow-y-auto"],[1,"flex-1","min-w-0","overflow-hidden","flex","flex-col"],[3,"sessionId"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"aside",1),A(2,"app-ccap-session-list"),r(),a(3,"main",2),A(4,"router-outlet"),r(),A(5,"app-ccap-info-panel",3),r()),i&2&&(c(5),g("sessionId",s.activeSessionId))},dependencies:[ut,Xt,un],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%}"]})}return t})();var hn=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275cmp=v({type:t,selectors:[["app-ccap-session-placeholder"]],decls:3,vars:0,consts:[[1,"flex","flex-col","items-center","justify-center","h-full","text-center","px-4"],[1,"text-neutral-400","text-sm"]],template:function(i,s){i&1&&(a(0,"div",0)(1,"p",1),l(2,"V\xE1lassz sessiont a bal oldali list\xE1b\xF3l."),r()())},styles:["[_nghost-%COMP%]{display:block;height:100%}"]})}return t})();var Wi=[{path:"",component:dn,children:[{path:"",pathMatch:"full",component:hn},{path:":id",component:an}]}],na=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=it({type:t});static \u0275inj=nt({imports:[lt,Ct,ht.forChild(Wi)]})}return t})();export{na as Session_Module};
|