@swarm.ing/pieui 2.0.19 → 2.0.21
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/README.md +6 -2
- package/dist/cli.js +402 -28
- package/dist/code/args.d.ts.map +1 -1
- package/dist/code/commands/cardRemote/cardRef.d.ts +3 -0
- package/dist/code/commands/cardRemote/cardRef.d.ts.map +1 -1
- package/dist/code/commands/cardRemote/history.d.ts +9 -0
- package/dist/code/commands/cardRemote/history.d.ts.map +1 -0
- package/dist/code/commands/cardRemote/private.d.ts +2 -0
- package/dist/code/commands/cardRemote/private.d.ts.map +1 -0
- package/dist/code/commands/cardRemote/public.d.ts +2 -0
- package/dist/code/commands/cardRemote/public.d.ts.map +1 -0
- package/dist/code/commands/cardRemote/pull.d.ts.map +1 -1
- package/dist/code/commands/cardRemote/push.d.ts.map +1 -1
- package/dist/code/services/models.d.ts +37 -0
- package/dist/code/services/models.d.ts.map +1 -1
- package/dist/code/services/storage.d.ts +40 -1
- package/dist/code/services/storage.d.ts.map +1 -1
- package/dist/code/types.d.ts +5 -1
- package/dist/code/types.d.ts.map +1 -1
- package/dist/components/PieBaseRoot/index.d.ts.map +1 -1
- package/dist/components/PieMaxRoot/index.d.ts.map +1 -1
- package/dist/components/PieRoot/index.d.ts.map +1 -1
- package/dist/components/PieRoot/types/index.d.ts +7 -0
- package/dist/components/PieRoot/types/index.d.ts.map +1 -1
- package/dist/components/PieTelegramRoot/index.d.ts.map +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.js +2 -2
- package/dist/tests/ajaxCommonUtils.test.d.ts +15 -0
- package/dist/tests/ajaxCommonUtils.test.d.ts.map +1 -0
- package/dist/tests/lazy.test.d.ts +14 -0
- package/dist/tests/lazy.test.d.ts.map +1 -0
- package/dist/tests/pieName.test.d.ts +12 -0
- package/dist/tests/pieName.test.d.ts.map +1 -0
- package/dist/tests/waitForSidAvailable.test.d.ts +20 -0
- package/dist/tests/waitForSidAvailable.test.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type CardRemoteHistoryOptions = {
|
|
2
|
+
componentName: string;
|
|
3
|
+
page?: number;
|
|
4
|
+
perPage?: number;
|
|
5
|
+
from?: number;
|
|
6
|
+
to?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const cardRemoteHistoryCommand: (options: CardRemoteHistoryOptions) => Promise<void>;
|
|
9
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/code/commands/cardRemote/history.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,wBAAwB,GAAG;IACnC,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAkDD,eAAO,MAAM,wBAAwB,GACjC,SAAS,wBAAwB,KAClC,OAAO,CAAC,IAAI,CAgDd,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private.d.ts","sourceRoot":"","sources":["../../../../src/code/commands/cardRemote/private.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,GACjC,eAAe,MAAM,KACtB,OAAO,CAAC,IAAI,CAkBd,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../../src/code/commands/cardRemote/public.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,GAChC,eAAe,MAAM,KACtB,OAAO,CAAC,IAAI,CA0Bd,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../../src/code/commands/cardRemote/pull.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../../src/code/commands/cardRemote/pull.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAsEzE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../../src/code/commands/cardRemote/push.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qBAAqB,GAC9B,SAAS,MAAM,KAChB,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../../src/code/commands/cardRemote/push.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qBAAqB,GAC9B,SAAS,MAAM,KAChB,OAAO,CAAC,IAAI,CAoEd,CAAA"}
|
|
@@ -33,5 +33,42 @@ export type ComponentRevisionList = {
|
|
|
33
33
|
};
|
|
34
34
|
export declare const parseComponentRevisionList: (raw: unknown) => ComponentRevisionList;
|
|
35
35
|
export declare const parseComponentObject: (raw: unknown) => ComponentObject;
|
|
36
|
+
export type PublicComponentState = {
|
|
37
|
+
userId: string;
|
|
38
|
+
project: string;
|
|
39
|
+
componentName: string;
|
|
40
|
+
isPublic: boolean;
|
|
41
|
+
publicRegistryName: string | null;
|
|
42
|
+
};
|
|
43
|
+
export declare const parsePublicComponentState: (raw: unknown) => PublicComponentState;
|
|
44
|
+
export type HistoryFileStatus = 'added' | 'modified' | 'deleted';
|
|
45
|
+
export type HistoryFileEntry = {
|
|
46
|
+
key: string;
|
|
47
|
+
status: HistoryFileStatus;
|
|
48
|
+
isBinary: boolean;
|
|
49
|
+
additions: number;
|
|
50
|
+
deletions: number;
|
|
51
|
+
patch?: string;
|
|
52
|
+
};
|
|
53
|
+
export type HistoryEntry = {
|
|
54
|
+
revision: number;
|
|
55
|
+
previousRevision: number | null;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
mutation: string;
|
|
58
|
+
deleted: boolean;
|
|
59
|
+
files: HistoryFileEntry[];
|
|
60
|
+
};
|
|
61
|
+
export type ComponentHistory = {
|
|
62
|
+
userId: string;
|
|
63
|
+
project: string;
|
|
64
|
+
componentName: string;
|
|
65
|
+
page: number;
|
|
66
|
+
perPage: number;
|
|
67
|
+
totalRevisions: number;
|
|
68
|
+
fromRevision: number | null;
|
|
69
|
+
toRevision: number | null;
|
|
70
|
+
entries: HistoryEntry[];
|
|
71
|
+
};
|
|
72
|
+
export declare const parseComponentHistory: (raw: unknown) => ComponentHistory;
|
|
36
73
|
export declare const parseProjectComponentList: (raw: unknown) => ProjectComponentList;
|
|
37
74
|
//# sourceMappingURL=models.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/code/services/models.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,mBAAmB,CAAA;CACnC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE3B,MAAM,MAAM,qBAAqB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpD,MAAM,MAAM,oBAAoB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,qBAAqB,EAAE,CAAA;CACt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O,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,gBAAgB,EAAE,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,EAAE,YAAY,EAAE,CAAA;CAC1B,CAAA;AAgED,eAAO,MAAM,qBAAqB,GAAI,KAAK,OAAO,KAAG,gBAiBpD,CAAA;AAED,eAAO,MAAM,yBAAyB,GAClC,KAAK,OAAO,KACb,oBAsBF,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Settings } from './settings';
|
|
2
|
-
import { type ComponentObject, type ComponentRevisionList, type ComponentTree, type ProjectComponentList } from './models';
|
|
2
|
+
import { type ComponentHistory, type ComponentObject, type ComponentRevisionList, type ComponentTree, type ProjectComponentList, type PublicComponentState } from './models';
|
|
3
3
|
export declare const STORAGE_LANGUAGE = "typescript";
|
|
4
4
|
export type SchemaKind = 'jsonSchema' | 'eventSchema' | 'llms.txt';
|
|
5
5
|
export declare class PieStorageError extends Error {
|
|
@@ -18,6 +18,7 @@ export declare class PieStorageService {
|
|
|
18
18
|
componentName: string;
|
|
19
19
|
userId?: string;
|
|
20
20
|
project?: string;
|
|
21
|
+
isPublic?: boolean;
|
|
21
22
|
}): string;
|
|
22
23
|
languageFileUrl(args: {
|
|
23
24
|
componentName: string;
|
|
@@ -25,18 +26,34 @@ export declare class PieStorageService {
|
|
|
25
26
|
userId?: string;
|
|
26
27
|
project?: string;
|
|
27
28
|
revision?: number;
|
|
29
|
+
isPublic?: boolean;
|
|
28
30
|
}): string;
|
|
29
31
|
componentTreeUrl(args: {
|
|
30
32
|
componentName: string;
|
|
31
33
|
userId?: string;
|
|
32
34
|
project?: string;
|
|
33
35
|
revision?: number;
|
|
36
|
+
isPublic?: boolean;
|
|
34
37
|
}): string;
|
|
35
38
|
revisionsUrl(args: {
|
|
36
39
|
componentName: string;
|
|
37
40
|
userId?: string;
|
|
38
41
|
project?: string;
|
|
39
42
|
}): string;
|
|
43
|
+
publicMarkUrl(args: {
|
|
44
|
+
componentName: string;
|
|
45
|
+
userId?: string;
|
|
46
|
+
project?: string;
|
|
47
|
+
}): string;
|
|
48
|
+
historyUrl(args: {
|
|
49
|
+
componentName: string;
|
|
50
|
+
userId?: string;
|
|
51
|
+
project?: string;
|
|
52
|
+
page?: number;
|
|
53
|
+
perPage?: number;
|
|
54
|
+
from?: number;
|
|
55
|
+
to?: number;
|
|
56
|
+
}): string;
|
|
40
57
|
languageBatchUrl(args: {
|
|
41
58
|
componentName: string;
|
|
42
59
|
userId?: string;
|
|
@@ -57,12 +74,32 @@ export declare class PieStorageService {
|
|
|
57
74
|
userId?: string;
|
|
58
75
|
project?: string;
|
|
59
76
|
revision?: number;
|
|
77
|
+
isPublic?: boolean;
|
|
60
78
|
}): Promise<ComponentTree>;
|
|
61
79
|
listRevisions(args: {
|
|
62
80
|
componentName: string;
|
|
63
81
|
userId?: string;
|
|
64
82
|
project?: string;
|
|
65
83
|
}): Promise<ComponentRevisionList>;
|
|
84
|
+
markComponentPublic(args: {
|
|
85
|
+
componentName: string;
|
|
86
|
+
userId?: string;
|
|
87
|
+
project?: string;
|
|
88
|
+
}): Promise<PublicComponentState>;
|
|
89
|
+
markComponentPrivate(args: {
|
|
90
|
+
componentName: string;
|
|
91
|
+
userId?: string;
|
|
92
|
+
project?: string;
|
|
93
|
+
}): Promise<PublicComponentState>;
|
|
94
|
+
getHistory(args: {
|
|
95
|
+
componentName: string;
|
|
96
|
+
userId?: string;
|
|
97
|
+
project?: string;
|
|
98
|
+
page?: number;
|
|
99
|
+
perPage?: number;
|
|
100
|
+
from?: number;
|
|
101
|
+
to?: number;
|
|
102
|
+
}): Promise<ComponentHistory>;
|
|
66
103
|
deleteComponent(args: {
|
|
67
104
|
componentName: string;
|
|
68
105
|
userId?: string;
|
|
@@ -107,6 +144,7 @@ export declare class PieStorageService {
|
|
|
107
144
|
userId?: string;
|
|
108
145
|
project?: string;
|
|
109
146
|
revision?: number;
|
|
147
|
+
isPublic?: boolean;
|
|
110
148
|
}): Promise<string>;
|
|
111
149
|
downloadComponentDirectory(args: {
|
|
112
150
|
componentName: string;
|
|
@@ -114,6 +152,7 @@ export declare class PieStorageService {
|
|
|
114
152
|
userId?: string;
|
|
115
153
|
project?: string;
|
|
116
154
|
revision?: number;
|
|
155
|
+
isPublic?: boolean;
|
|
117
156
|
}): Promise<string[]>;
|
|
118
157
|
private headers;
|
|
119
158
|
private request;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/code/services/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/code/services/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAMH,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC5B,MAAM,UAAU,CAAA;AAEjB,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAsB5C,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,UAAU,CAAA;AAkBlE,qBAAa,eAAgB,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI9B;AAID,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,KAAG,MAYnD,CAA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O,CAAC,OAAO;YAUD,OAAO;CA6BxB"}
|
package/dist/code/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const REGISTER_FUNCTION = "registerPieComponent";
|
|
|
4
4
|
export type ComponentType = 'simple' | 'complex' | 'simple-container' | 'complex-container';
|
|
5
5
|
export type ListFilter = 'all' | ComponentType;
|
|
6
6
|
export type CardAction = 'add' | 'remote';
|
|
7
|
-
export type CardRemoteAction = 'push' | 'pull' | 'list' | 'remove';
|
|
7
|
+
export type CardRemoteAction = 'push' | 'pull' | 'list' | 'remove' | 'history' | 'public' | 'private';
|
|
8
8
|
export type PageAction = 'add';
|
|
9
9
|
export type ParsedArgs = {
|
|
10
10
|
command: string;
|
|
@@ -25,6 +25,10 @@ export type ParsedArgs = {
|
|
|
25
25
|
remoteProject?: string;
|
|
26
26
|
pageAction?: PageAction;
|
|
27
27
|
pagePath?: string;
|
|
28
|
+
historyPage?: number;
|
|
29
|
+
historyPerPage?: number;
|
|
30
|
+
historyFrom?: number;
|
|
31
|
+
historyTo?: number;
|
|
28
32
|
};
|
|
29
33
|
export type CardScaffoldOptions = {
|
|
30
34
|
ajax?: boolean;
|
package/dist/code/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/code/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,wBAAwB,CAAA;AAElD,eAAO,MAAM,iBAAiB,0BAA0B,CAAA;AACxD,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AAEvD,MAAM,MAAM,aAAa,GACnB,QAAQ,GACR,SAAS,GACT,kBAAkB,GAClB,mBAAmB,CAAA;AAEzB,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,aAAa,CAAA;AAC9C,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,QAAQ,CAAA;AACzC,MAAM,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceR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AAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,EAAE,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,GAAG,CAAC,UAAU,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;CACvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieBaseRoot/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieBaseRoot/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AA6D1C;;;;;;;;;;GAUG;AACH,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CAY3C,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieMaxRoot/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieMaxRoot/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAmL/C;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAYtC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieRoot/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieRoot/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAmLtC;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,OAAO,GAAI,OAAO,YAAY,4CAYnC,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -45,5 +45,12 @@ export interface PieRootProps {
|
|
|
45
45
|
config: PieConfig;
|
|
46
46
|
/** Optional react-query overrides; see {@link PieQueryOptions}. */
|
|
47
47
|
queryOptions?: PieQueryOptions;
|
|
48
|
+
/**
|
|
49
|
+
* When `true`, the implicit `<form id="piedata_global_form">` wrapper is
|
|
50
|
+
* not rendered. Use this when the host application owns its own form
|
|
51
|
+
* element or when PieUI is embedded inside another form and a nested
|
|
52
|
+
* `<form>` would be invalid HTML.
|
|
53
|
+
*/
|
|
54
|
+
disableGlobalForm?: boolean;
|
|
48
55
|
}
|
|
49
56
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/PieRoot/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAC9B,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,EACzC,UAAU,GAAG,SAAS,GAAG,SAAS,CACrC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,QAAQ,EAAE;QACN,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE,MAAM,CAAA;KACjB,CAAA;IACD;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACvC,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,oEAAoE;IACpE,MAAM,EAAE,SAAS,CAAA;IACjB,mEAAmE;IACnE,YAAY,CAAC,EAAE,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/PieRoot/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAC9B,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,EACzC,UAAU,GAAG,SAAS,GAAG,SAAS,CACrC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,QAAQ,EAAE;QACN,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE,MAAM,CAAA;KACjB,CAAA;IACD;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACvC,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,oEAAoE;IACpE,MAAM,EAAE,SAAS,CAAA;IACjB,mEAAmE;IACnE,YAAY,CAAC,EAAE,eAAe,CAAA;IAC9B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieTelegramRoot/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PieTelegramRoot/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAqL/C;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAY3C,CAAA;AAED,eAAe,eAAe,CAAA"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useContext as Vf,useEffect as If,useRef as MU}from"react";import{createContext as BU,useContext as WU}from"react";var j=BU(null),h=()=>{let f=WU(j);if(!f)throw new Error("usePieConfig must be used within PieConfigProvider");return f},x=()=>{let{apiServer:f}=h();return f},e=x,d=()=>{let{centrifugeServer:f}=h();return f};var L=()=>{let{enableRenderingLog:f}=h();return f},Lf=L,Mf=()=>{let{pageProcessor:f}=h();return f};var Gf="__piedemo__";import{createContext as QU}from"react";import{Centrifuge as Af}from"centrifuge";var Nf=new Map,u=(f,U)=>{if(!U)return null;let D=`${f}::${U}`,H=Nf.get(D);if(H)return H;async function z(){let $=await fetch(f+"api/centrifuge/gen_token");if(!$.ok){if($.status===403)throw new Af.UnauthorizedError("Backend is not answering");throw new Error(`Unexpected status code ${$.status}`)}return(await $.json()).token}let Z=new Af(U,{getToken:z});return Nf.set(D,Z),Z},CU=QU(null),y=CU;import{io as OU}from"socket.io-client";import{createContext as _U}from"react";var yf=new Map,b=(f)=>{let U=yf.get(f);if(U)return U;let D=OU(f,{autoConnect:!1,transports:["websocket"]});return yf.set(f,D),D},RU=_U(null),o=RU;import wU from"mitt";import{createContext as FU,useCallback as KU,useContext as SU}from"react";var Pf=null;function E(){if(!Pf)Pf=wU();return Pf}var of=FU(null);function LU(f){let U=SU(of);return KU((D,H)=>{(U??E()).emit(`pie${D}_${f}`,H)},[f,U])}var K=of;var AU=({card:f,data:U,children:D,useSocketioSupport:H=!1,useCentrifugeSupport:z=!1,useMittSupport:Z=!1,centrifugeChannel:$=void 0,methods:G=void 0})=>{let T=Lf(),P=MU(G);if(P.current=G,T)console.log("[PieCard] Rendering card:",f),console.log("[PieCard] Card data:",U),console.log("[PieCard] Component name:",U?.name),console.log("[PieCard] Real-time support:",{socketio:H,centrifuge:z,mitt:Z,centrifugeChannel:$}),console.log("[PieCard] Methods:",G?Object.keys(G):"none"),console.log("[PieCard] Has children:",!!D);let X=Vf(o),B=Vf(y),q=Vf(K);if(If(()=>{if(!X||!H||!P.current||!U.name){if(T&&H)console.log("[PieCard] Socket.IO setup skipped:",{hasSocket:!!X,useSocketioSupport:H,hasMethods:!!P.current,hasDataName:!!U?.name});return}let I=Object.keys(P.current??{}).map((V)=>{let J=`pie${V}_${U.name}`;if(T)console.log(`[PieCard] Socket.IO registering event: ${J}`);let W=(Q)=>{P.current?.[V]?.(Q)};return X.on(J,W),[J,W]});return()=>{I.forEach(([V,J])=>{if(T)console.log(`[PieCard] Socket.IO unregistering event: ${V}`);X.off(V,J)})}},[X,U.name,H]),If(()=>{if(!B||!z||!$||!U.name){if(T&&z)console.log("[PieCard] Centrifuge setup skipped:",{hasCentrifuge:!!B,useCentrifugeSupport:z,hasCentrifugeChannel:!!$,hasMethods:!!P.current,hasDataName:!!U?.name});return}let I=Object.keys(P.current??{}).map((V)=>{let J=`pie${V}_${U.name}_${$}`;if(T)console.log(`[PieCard] Centrifuge subscribing to channel: ${J}`);let W=B.newSubscription(J);return W.on("publication",(Q)=>{if(T)console.log(`[PieCard] Centrifuge received data on ${J}:`,Q.data);P.current?.[V]?.(Q.data)}),W.subscribe(),W});return()=>{I.forEach((V)=>{if(T)console.log("[PieCard] Centrifuge unsubscribing from channel");V.unsubscribe(),B.removeSubscription(V)})}},[B,$,U.name,z]),If(()=>{if(!q||!Z||!U.name){if(T&&Z)console.log("[PieCard] Mitt setup skipped:",{hasMitt:!!q,useMittSupport:Z,hasMethods:!!P.current,hasDataName:!!U?.name});return}let Y=Object.keys(P.current??{}),I={};return Y.forEach((V)=>{let J=`pie${V}_${U.name}`,W=(Q)=>{if(T)console.log(`[PieCard] Mitt registering event: ${J}`);P.current?.[V]?.(Q)};I[J]=W,q.on(J,W)}),()=>{Object.entries(I).forEach(([V,J])=>{if(T)console.log(`[PieCard] Mitt unregistering event: ${V}`);q.off(V,J)})}},[q,U.name,Z]),T)console.log("[PieCard] Rendering complete, returning children");return D},_=AU;import{lazy as NU}from"react";var Jf=new Map;function Ef(f,U){return NU(()=>{if(Jf.has(U))return Jf.get(U);let D=f().then((H)=>H);return Jf.set(U,D),D})}var g=new Map,yU=(f)=>{if(!f.name)throw new Error("Component registration requires a name");if(!f.component&&!f.loader)throw new Error(`Component "${f.name}" requires component or loader`);let U={name:f.name,component:f.component,loader:f.loader,metadata:f.metadata,fallback:f.fallback,isLazy:!1};if(!U.component&&U.loader)U.component=Ef(U.loader,f.name),U.loader=void 0,U.isLazy=!0;return U};function O(f){let U=yU(f);return g.set(U.name,U),U.component}var oU=(f)=>{f.forEach((U)=>O(U))},EU=(f)=>{g.delete(f)},mU=(f)=>{return g.has(f)},kU=(f)=>{return g.get(f)?.metadata},r=(f)=>{return g.get(f)},jU=()=>{return Array.from(g.keys())},xU=()=>{return g.size};import{Suspense as vU,useContext as pU,memo as cU}from"react";import{createContext as dU}from"react";import{jsx as gU,Fragment as bU}from"react/jsx-runtime";var uU=dU(gU(bU,{})),w=uU;import{jsx as Yf}from"react/jsx-runtime";function hU({uiConfig:f,setUiAjaxConfiguration:U}){let D=pU(w),H=L();if(H)console.log("[UI] Rendering component:",f.card),console.log("[UI] Component data:",f.data),console.log("[UI] Component content:",f.content),console.log("[UI] Has setUiAjaxConfiguration:",!!U);let z=r(f.card);if(!z?.component){if(H)console.warn(`[UI] Component not found in registry: ${f.card}`),console.log("[UI] Returning fallback component");return D}if(H)console.log("[UI] Found component in registry:",{name:z.name,isLazy:z.isLazy,hasMetadata:!!z.metadata});let Z=z.component,$=Yf(Z,{data:f.data,content:f.content,setUiAjaxConfiguration:U});if(z.isLazy){if(H)console.log("[UI] Rendering lazy component with Suspense:",z.name);return Yf(vU,{fallback:z.fallback?Yf(z.fallback,{}):D,children:$},`${z.name}`)}if(H)console.log("[UI] Rendering component directly:",z.name);return $}var F=cU(hU);import{Suspense as nU,useContext as sU}from"react";import{createContext as lU}from"react";var rU=lU(null),k=rU;import{jsx as ff}from"react/jsx-runtime";function mf({uiConfig:f,setUiAjaxConfiguration:U}){let D=sU(w),H=L();if(H)console.log("[UILoading] Rendering fallback for:",f.card),console.log("[UILoading] Component data:",f.data),console.log("[UILoading] Component content:",f.content),console.log("[UILoading] Has setUiAjaxConfiguration:",!!U);let z=r(f.card);if(!z?.component){if(H)console.warn(`[UILoading] Component not found in registry: ${f.card}`),console.log("[UILoading] Returning fallback component");return D}if(H)console.log("[UILoading] Found component in registry:",{name:z.name,isLazy:z.isLazy,hasMetadata:!!z.metadata,hasFallback:!!z.fallback});if(z.fallback){if(H)console.log("[UILoading] Rendering fallback for:",z.name);let G=z.fallback;return ff(G,{})}if(H)console.log("[UILoading] No fallback, rendering full component:",z.name);let Z=z.component,$=ff(k.Provider,{value:mf,children:ff(Z,{data:f.data,content:f.content,setUiAjaxConfiguration:U})});if(z.isLazy)return ff(nU,{fallback:D,children:$},`${z.name}`);return $}var Xf=mf;import{useContext as iU}from"react";import{jsx as qf}from"react/jsx-runtime";var tU=({data:f,content:U,setUiAjaxConfiguration:D})=>{let{name:H,sx:z}=f,Z=iU(k)??F;return qf(_,{card:H,data:f,children:qf("div",{style:z,id:H,children:U.map(($,G)=>{return qf(Z,{uiConfig:$,setUiAjaxConfiguration:D},`children-${G}`)})})})},kf=tU;var aU=O({name:"SequenceCard",component:kf,metadata:{author:"Swarm.ing",description:"Simple div with styles joining few components"}});import{useContext as eU}from"react";import{jsx as jf}from"react/jsx-runtime";var fH=({data:f,content:U,setUiAjaxConfiguration:D})=>{let{name:H}=f,z=eU(k)??F;return jf(_,{card:H,data:f,children:U.map((Z,$)=>{return jf(z,{uiConfig:Z,setUiAjaxConfiguration:D},`children-${$}`)})})},xf=fH;var UH=O({name:"UnionCard",component:xf,metadata:{author:"Swarm.ing",description:"Renders one of many components"}});import{useEffect as DH,useState as $H}from"react";import TH from"html-react-parser";import{useCallback as Uf,useEffect as HH,useRef as Bf,useState as ZH}from"react";function zH(){let f=new AudioContext,U=f.createOscillator(),D=U.connect(f.createMediaStreamDestination());U.start();let H=D.stream.getAudioTracks()[0];return H.enabled=!1,H}function Hf(f=null,U){let[D,H]=ZH(!1),z=Bf(null),Z=Bf(null),$=Bf(null),G=Uf(async(B,q=!0)=>{if(z.current)T();let Y=new RTCPeerConnection;if(Y.onconnectionstatechange=()=>{if(Y.connectionState==="connected")H(!0);else if(["disconnected","failed","closed"].includes(Y.connectionState))H(!1)},Y.ontrack=(R)=>{if(f)f.srcObject=R.streams[0]},q){let R=await navigator.mediaDevices.getUserMedia({audio:!0});Y.addTrack(R.getTracks()[0],R)}else{let R=zH();Y.addTrack(R)}let I=Y.createDataChannel("oai-events");Z.current=I,$.current=new Promise((R)=>{I.addEventListener("open",()=>{R()})});let V=await Y.createOffer();await Y.setLocalDescription(V);let C=await(await fetch(`${"https://api.openai.com/v1/realtime/calls"}?model=${"gpt-realtime"}`,{method:"POST",body:V.sdp,headers:{Authorization:`Bearer ${B}`,"Content-Type":"application/sdp"}})).text();await Y.setRemoteDescription({type:"answer",sdp:C}),z.current=Y,await $.current},[f]),T=Uf(()=>{let B=Z.current;if(B)B.close();z.current?.getSenders()?.forEach((q)=>q.track?.stop()),z.current?.close(),H(!1),z.current=null,Z.current=null,$.current=null},[f]),P=Uf((B)=>{let q=Z.current;if(!q){console.error("Data channel is not ready",B);return}let Y=new Date().toLocaleTimeString();if(B.event_id=B.event_id||crypto.randomUUID(),q.send(JSON.stringify(B)),!B.timestamp)B.timestamp=Y;U?.(B)},[U,f]),X=Uf((B)=>{if(!Z.current){console.error("Data channel is not ready");return}let Y=()=>{P({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:B}]}}),P({type:"response.create"})};if($.current)$.current.then(Y);else Y()},[U,f]);return HH(()=>{let B=Z.current;if(!B)return;let q=(Y)=>{let I=JSON.parse(Y.data);if(!I.timestamp)I.timestamp=new Date().toLocaleTimeString();U?.(I)};return B.addEventListener("message",q),()=>{B.removeEventListener("message",q)}},[U,f]),{isSessionActive:D,startSession:G,stopSession:T,sendTextMessage:X}}import{jsx as PH}from"react/jsx-runtime";var GH=({data:f})=>{let{html:U,useSocketioSupport:D,useCentrifugeSupport:H,useMittSupport:z,centrifugeChannel:Z}=f,[$,G]=$H(U),{isSessionActive:T,startSession:P,sendTextMessage:X}=Hf(null,(I)=>{if(console.log(I.type,I.type==="response.output_text.delta"&&I.delta),I.type==="response.output_text.delta"&&I.delta)G((V)=>V+I.delta)});return DH(()=>{G(U)},[U]),PH(_,{card:"HTMLEmbedCard",data:f,methods:{update:(I)=>{G(I.value)},generateUsingAI:async(I)=>{try{if(!T&&I.token)await P(I.token,!1);X(I.prompt)}catch(V){console.error("Failed to generate using AI",V)}},initializeAI:async(I)=>{if(!T&&I.token)await P(I.token,!1)}},useCentrifugeSupport:H,useSocketioSupport:D,useMittSupport:z,centrifugeChannel:Z,children:TH($)})},df=GH;var VH=O({name:"HTMLEmbedCard",component:df,metadata:{author:"Swarm.ing"}});import{useEffect as IH,useState as JH}from"react";import{jsx as uf}from"react/jsx-runtime";var YH=({data:f})=>{let{name:U,value:D,useSocketioSupport:H,useCentrifugeSupport:z,useMittSupport:Z,centrifugeChannel:$}=f,[G,T]=JH(D);return IH(()=>{T(D)},[D]),uf(_,{card:"HiddenCard",data:f,useSocketioSupport:H,useCentrifugeSupport:z,useMittSupport:Z,centrifugeChannel:$,methods:{update:({value:P})=>{T(P)}},children:uf("input",{type:"hidden",id:U,name:U,value:G})})},bf=YH;var XH=O({name:"HiddenCard",component:bf,metadata:{author:"Swarm.ing"}});import{useContext as gf,useEffect as WH}from"react";import{createContext as qH}from"react";var BH=qH(void 0),S=BH;import{jsx as OH,Fragment as CH}from"react/jsx-runtime";var QH=({data:f})=>{let{url:U}=f,D=gf(S),H=gf(w);return WH(()=>{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(U))window.location.href=U;else D?.(U)},[U,D]),OH(CH,{children:H})},vf=QH;var _H=O({name:"AutoRedirectCard",component:vf,metadata:{author:"Swarm.ing"}});import{Bounce as RH,Slide as wH,Zoom as FH,Flip as KH}from"react-toastify";import{toast as SH,ToastContainer as LH}from"react-toastify";import{useContext as MH,useMemo as AH,useRef as NH}from"react";import{jsx as Wf,Fragment as jH}from"react/jsx-runtime";var yH={bounce:RH,slide:wH,zoom:FH,flip:KH},oH=(f)=>{let U={...f,type:f.alertType,transition:f.transition?yH[f.transition]:void 0,position:f.position??"bottom-right",autoClose:f.autoClose??3000,style:{backgroundColor:"black",...f.sx}};SH(f.message,U)},EH=(f)=>{console.log("Log event",f)},mH=(f)=>{if(typeof window==="undefined"||!window.Notification){console.warn("[IOEventsCard] Notifications API is not available");return}let U=()=>{try{new window.Notification(f.title,{body:f.message??f.subtitle,icon:f.icon,silent:f.silent})}catch(H){console.error("[IOEventsCard] Failed to show notification",H)}},D=window.Notification.permission;if(D==="granted"){U();return}if(D==="denied"){console.warn("[IOEventsCard] Notification permission denied");return}window.Notification.requestPermission().then((H)=>{if(H==="granted")U()})},kH=({data:f})=>{let{useCentrifugeSupport:U,useSocketioSupport:D,useMittSupport:H,centrifugeChannel:z}=f,Z=MH(S),$=NH(Z);$.current=Z;let G=AH(()=>({alert:oH,log:EH,push:mH,redirect:(T)=>{if(T.to){let P=T.to;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(P))window.location.href=P;else $.current?.(P)}else window.location.reload()},reload:(T)=>{if(T.to){let P=T.to;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(P))window.location.href=P;else $.current?.(P)}else window.location.reload()}}),[]);return Wf(jH,{children:Wf(_,{card:"IOEventsCard",data:f,useCentrifugeSupport:U,useSocketioSupport:D,useMittSupport:H,centrifugeChannel:z,methods:G,children:Wf(LH,{})})})},pf=kH;var xH=O({name:"IOEventsCard",component:pf,metadata:{author:"Swarm.ing"}});import{useEffect as cf,useState as dH}from"react";import{jsx as hf}from"react/jsx-runtime";var uH=({data:f})=>{let{name:U,key:D,value:H,useSocketioSupport:z,useCentrifugeSupport:Z,useMittSupport:$,centrifugeChannel:G}=f,[T,P]=dH(H);return cf(()=>{P(H)},[H]),cf(()=>{if(typeof window==="undefined")return;sessionStorage.setItem(D,T)},[D,T]),hf(_,{card:"SessionStorageCard",data:f,useSocketioSupport:z,useCentrifugeSupport:Z,useMittSupport:$,centrifugeChannel:G,methods:{update:({value:X})=>{P(X)},remove:()=>{sessionStorage.removeItem(D),P("")}},children:hf("input",{type:"hidden",id:U,name:U,value:T})})},lf=uH;var bH=O({name:"SessionStorageCard",component:lf,metadata:{author:"PieData"}});import{useEffect as rf,useState as gH}from"react";import{jsx as nf}from"react/jsx-runtime";var vH=({data:f})=>{let{name:U,key:D,value:H,useSocketioSupport:z,useCentrifugeSupport:Z,useMittSupport:$,centrifugeChannel:G}=f,[T,P]=gH(H);return rf(()=>{P(H)},[H]),rf(()=>{if(typeof window==="undefined")return;localStorage.setItem(D,T)},[D,T]),nf(_,{card:"DeviceStorageCard",data:f,useSocketioSupport:z,useCentrifugeSupport:Z,useMittSupport:$,centrifugeChannel:G,methods:{update:({value:X})=>{P(X)},remove:()=>{localStorage.removeItem(D),P("")}},children:nf("input",{type:"hidden",id:U,name:U,value:T})})},sf=vH;var pH=O({name:"DeviceStorageCard",component:sf,metadata:{author:"PieData"}});import{useEffect as tf,useState as cH}from"react";import{jsx as af}from"react/jsx-runtime";var hH=({data:f})=>{let{name:U,key:D,value:H,useSocketioSupport:z,useCentrifugeSupport:Z,useMittSupport:$,centrifugeChannel:G}=f,[T,P]=cH(H);return tf(()=>{P(H)},[H]),tf(()=>{if(typeof window==="undefined")return;let X=window.Telegram?.WebApp?.CloudStorage;if(!X)return;X.setItem(D,T)},[D,T]),af(_,{card:"CloudStorageCard",data:f,useSocketioSupport:z,useCentrifugeSupport:Z,useMittSupport:$,centrifugeChannel:G,methods:{update:({value:X})=>{P(X)},remove:()=>{let X=window.Telegram?.WebApp?.CloudStorage;if(X)X.removeItem(D);P("")}},children:af("input",{type:"hidden",id:U,name:U,value:T})})},ef=hH;var lH=O({name:"CloudStorageCard",component:ef,metadata:{author:"PieData"}});import{useEffect as fU,useState as rH}from"react";import{jsx as UU}from"react/jsx-runtime";var nH=({data:f})=>{let{name:U,key:D,value:H,useSocketioSupport:z,useCentrifugeSupport:Z,useMittSupport:$,centrifugeChannel:G}=f,[T,P]=rH(H);return fU(()=>{P(H)},[H]),fU(()=>{if(typeof window==="undefined")return;let X=window.Telegram?.WebApp?.SecureStorage;if(!X)return;X.setItem(D,T)},[D,T]),UU(_,{card:"SecureStorageCard",data:f,useSocketioSupport:z,useCentrifugeSupport:Z,useMittSupport:$,centrifugeChannel:G,methods:{update:({value:X})=>{P(X)},remove:()=>{let X=window.Telegram?.WebApp?.SecureStorage;if(X)X.removeItem(D);P("")}},children:UU("input",{type:"hidden",id:U,name:U,value:T})})},HU=nH;var sH=O({name:"SecureStorageCard",component:HU,metadata:{author:"PieData"}});import{useCallback as Qf,useContext as Cf,useEffect as iH,useRef as tH,useState as ZU}from"react";import{jsx as zU}from"react/jsx-runtime";var aH=({data:f,content:U})=>{let{useLoader:D,noReturn:H,returnType:z,useSocketioSupport:Z,useCentrifugeSupport:$,useMittSupport:G,centrifugeChannel:T}=f,P=Cf(w),X=Cf(k)??F,[B,q]=ZU(!1),[Y,I]=ZU(null),V=tH(U),J=Cf(K),W=Qf((R)=>{if(R===null)q(!0);else if(q(!1),!H)V.current=R;if(!H)I(R)},[H]),Q=Qf((R)=>{V.current=R.content,I(R.content)},[]),C=Qf((R)=>{if(R===null)q(!0);else if(q(!1),!H)for(let t of R)J?.emit(t.name,t.data)},[H,J]);if(iH(()=>{I(U),q(!1)},[U]),!Y&&D)return P;return zU(_,{card:"AjaxGroupCard",data:f,methods:{changeContent:Q},useSocketioSupport:Z,useCentrifugeSupport:$,useMittSupport:G,centrifugeChannel:T,children:zU(X,{uiConfig:Y??V.current,setUiAjaxConfiguration:z==="events"?C:W})})},DU=aH;var eH=O({name:"AjaxGroupCard",component:DU,metadata:{author:"Swarm.ing",description:"Group card with AJAX support"}});import{useContext as $U}from"react";import{jsx as Of}from"react/jsx-runtime";var fZ=({data:f,content:U,setUiAjaxConfiguration:D})=>{let{name:H,url:z,sx:Z}=f,$=$U(S),G=$U(k)??F;return Of(_,{card:H,data:f,children:Of("div",{style:Z,id:H,onClick:(P)=>{if(z)if(P.stopPropagation(),/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(z))window.location.href=z;else $?.(z)},children:Of(G,{setUiAjaxConfiguration:D,uiConfig:U})})})},TU=fZ;var UZ=O({name:"BoxCard",component:TU,metadata:{author:"Swarm.ing",description:"Simple div with styles joining few components"}});import{useMemo as n}from"react";import{QueryClient as IZ,QueryClientProvider as JZ,useQuery as YZ}from"@tanstack/react-query";import{useContext as zZ,useEffect as DZ}from"react";import{useEffect as HZ,useState as ZZ}from"react";var Zf=new Map,zf=new Map;function Df(f,U){let D=`${f}::${U}`,H=f?Zf.get(D):void 0,[z,Z]=ZZ(H??null);return HZ(()=>{if(!f)return;if(Zf.has(D)){Z(Zf.get(D));return}let $=zf.get(D);if(!$)$=fetch(f+`api/support/${U}`,{method:"GET"}).then((T)=>T.json()).then((T)=>{return Zf.set(D,T),zf.delete(D),T}).catch((T)=>{throw zf.delete(D),T}),zf.set(D,$);let G=!1;return $.then((T)=>{if(!G)Z(T)}).catch(()=>{}),()=>{G=!0}},[f,U,D]),z}var _f=null,GU=null;function PU(){GU?.()}function Rf(){if(typeof window==="undefined")return Promise.resolve();if(typeof window.sid!=="undefined")return Promise.resolve();if(!_f)_f=new Promise((f)=>{GU=()=>{f()}});return _f}var $Z=({children:f})=>{let U=zZ(o),D=e(),H=Df(D,"socketIO"),z=(Z)=>{if(typeof window!=="undefined")window.sid=Z.sid,PU(),console.log(`SocketIO initialized: ${window.sid}`)};return DZ(()=>{if(!U)return;let Z=()=>{console.log("SocketIO connected")},$=(G)=>{console.log(`SocketIO disconnected: ${G}`),U.connect()};if(H)U.on("pieinit",z),U.on("connect",Z),U.on("disconnect",$),U.connect();return()=>{if(H)U.off("pieinit",z),U.off("connect",Z),U.off("disconnect",$),U.disconnect()}},[U,H]),f},v=$Z;import{useContext as TZ,useEffect as GZ}from"react";var PZ=({children:f})=>{let U=TZ(y),D=e(),H=Df(D,"centrifuge");return GZ(()=>{if(!U)return;let z=()=>{console.log("Centrifuge connected")},Z=($)=>{console.log("Centrifuge disconnected:",$)};if(H)U.on("connected",z),U.on("disconnected",Z),U.connect();return()=>{if(H)U.disconnect()}},[U,H]),f},p=PZ;import{createAxiosDateTransformer as XZ}from"axios-date-transformer";import{jsx as VZ}from"react/jsx-runtime";function l(f,U,D){if(!U)return D;let H=f.replace(/^\//,""),z=U[H];if(!z)return D;return VZ(Xf,{uiConfig:z})}import{jsx as M,Fragment as WZ}from"react/jsx-runtime";var qZ=({location:f,fallback:U,piecache:D,onError:H,queryOptions:z})=>{let Z=x(),$=d(),G=L(),T=n(()=>XZ({baseURL:Z||""}),[Z]),P=n(()=>E(),[]),X=n(()=>Z?b(Z):null,[Z]),B=n(()=>Z?u(Z,$):null,[Z,$]),{data:q,isLoading:Y,error:I}=YZ({queryKey:["uiConfig",f.pathname+f.search,Z],enabled:!!Z,queryFn:async()=>{let J=new URLSearchParams(f.search);J.set("__pieroot","web");let W="/api/content"+f.pathname+"?"+J.toString();if(G)console.log("[PieRoot] Fetching UI configuration from:",W);let Q=await T.get(W,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS","Content-type":"application/json"},withCredentials:!0});if(G)console.log("[PieRoot] Received UI configuration:",Q.data);return Q.data},staleTime:1/0,gcTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:!0,retryDelay:(J)=>Math.min(1000*2**J,30000),...z}),V=l(f.pathname,D,U);if(!Z)return V??null;if(G)console.log("[PieRoot] Rendering with location:",f),console.log("[PieRoot] API_SERVER:",Z),console.log("[PieRoot] CENTRIFUGE_SERVER:",$),console.log("[PieRoot] Fallback provided:",!!U),console.log("[PieRoot] Piecache provided:",!!D);if(I){if(G)console.error("[PieRoot] Error fetching UI configuration:",I),console.error("[PieRoot] Error details:",{message:I.message,status:I.response?.status,data:I.response?.data});return H?.(),V}if(Y||!q){if(G)console.log("[PieRoot] Loading state:",{isLoading:Y,hasUiConfiguration:!!q});return V}if(G)console.log("[PieRoot] UI configuration loaded successfully:",q),console.log("[PieRoot] Rendering UI with configuration");return M(K.Provider,{value:P,children:M(o.Provider,{value:X,children:M(y.Provider,{value:B,children:M(w.Provider,{value:U??M(WZ,{}),children:M(v,{children:M(p,{children:M("form",{id:"piedata_global_form",action:Z+"api/process"+f.pathname,method:"post",encType:"multipart/form-data",children:M(F,{uiConfig:q})})})})})})})})},BZ=(f)=>{let U=n(()=>new IZ,[]);return M(S.Provider,{value:f.onNavigate,children:M(j.Provider,{value:f.config,children:M(JZ,{client:U,children:M(qZ,{...f})})})})},QZ=BZ;import{useMemo as s}from"react";import{QueryClient as _Z,QueryClientProvider as RZ,useQuery as wZ}from"@tanstack/react-query";import{createAxiosDateTransformer as FZ}from"axios-date-transformer";import{useEffect as CZ,useState as OZ}from"react";var wf=({onError:f}={})=>{let[U,D]=OZ(null),H=Mf();return CZ(()=>{if(typeof window==="undefined")return;let z=window.Telegram?.WebApp;if(!z)return;try{z.ready?.()}catch(Z){f?.()}if(H==="telegram_expanded"&&(z.platform==="ios"||z.platform==="android"))z.expand();D(z)},[]),U};import{jsx as A,Fragment as LZ}from"react/jsx-runtime";var KZ=({location:f,fallback:U,piecache:D,onError:H,queryOptions:z})=>{let Z=x(),$=d(),G=L(),T=s(()=>FZ({baseURL:Z}),[Z]),P=s(()=>E(),[]),X=s(()=>Z?b(Z):null,[Z]),B=s(()=>Z?u(Z,$):null,[Z,$]),q=wf({onError:H}),{data:Y,isLoading:I,error:V}=wZ({queryKey:["uiConfig",f.pathname+f.search,q?.initData],enabled:!!q?.initData,queryFn:async()=>{let W=new URLSearchParams(f.search);if(W.set("__pieroot","telegram"),q?.initData)W.set("initData",q.initData);let Q="/api/content"+f.pathname+"?"+W.toString();if(G)console.log("[PieRoot] Fetching UI configuration from:",Q);let C=await T.get(Q,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS","Content-type":"application/json"},withCredentials:!0});if(G)console.log("[PieRoot] Received UI configuration:",C.data);return C.data},staleTime:1/0,gcTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:!0,retryDelay:(W)=>Math.min(1000*2**W,30000),...z}),J=l(f.pathname,D,U);if(!Z)throw Error("Set PIE_API_SERVER and PIE_CENTRIFUGE_SERVER");if(V&&G)return console.error("[PieRoot] Error fetching UI configuration:",V),console.error("[PieRoot] Error details:",{message:V.message,status:V.response?.status,data:V.response?.data}),H?.(),J;if(I||!Y){if(G)console.log("[PieRoot] Loading state:",{isLoading:I,hasUiConfiguration:!!Y});return J}if(G)console.log("[PieRoot] UI configuration loaded successfully:",Y),console.log("[PieRoot] Rendering UI with configuration");return A(K.Provider,{value:P,children:A(o.Provider,{value:X,children:A(y.Provider,{value:B,children:A(w.Provider,{value:U??A(LZ,{}),children:A(v,{children:A(p,{children:A("form",{id:"piedata_global_form",action:Z+"api/process"+f.pathname,method:"post",encType:"multipart/form-data",children:A(F,{uiConfig:Y})})})})})})})})},SZ=(f)=>{let U=s(()=>new _Z,[]);return A(S.Provider,{value:f.onNavigate,children:A(j.Provider,{value:f.config,children:A(RZ,{client:U,children:A(KZ,{...f})})})})},MZ=SZ;import{useMemo as Ff,useState as AZ}from"react";import{QueryClient as NZ,QueryClientProvider as yZ}from"@tanstack/react-query";import{jsx as m,Fragment as mZ}from"react/jsx-runtime";var oZ=({location:f,fallback:U,children:D})=>{let H=x(),z=d(),Z=L(),$=Ff(()=>E(),[]),G=Ff(()=>H?b(H):null,[H]),T=Ff(()=>H?u(H,z):null,[H,z]);if(Z)console.log("[PieRoot] Rendering with location:",f),console.log("[PieRoot] API_SERVER:",H),console.log("[PieRoot] CENTRIFUGE_SERVER:",z),console.log("[PieRoot] Fallback provided:",!!U);return m(K.Provider,{value:$,children:m(o.Provider,{value:G,children:m(y.Provider,{value:T,children:m(w.Provider,{value:U??m(mZ,{}),children:m(v,{children:m(p,{children:m("form",{id:"piedata_global_form",action:H+"api/process"+f.pathname,method:"post",encType:"multipart/form-data",children:D})})})})})})})},EZ=(f)=>{let[U]=AZ(()=>new NZ);return m(S.Provider,{value:f.onNavigate,children:m(j.Provider,{value:f.config,children:m(yZ,{client:U,children:m(oZ,{...f})})})})},kZ=EZ;import{useMemo as i}from"react";import{QueryClient as dZ,QueryClientProvider as uZ,useQuery as bZ}from"@tanstack/react-query";import{createAxiosDateTransformer as gZ}from"axios-date-transformer";import{useEffect as jZ,useState as xZ}from"react";var Kf=()=>{let[f,U]=xZ(null);return jZ(()=>{if(typeof window==="undefined")return;let D=window.WebApp;if(!D)return;D.ready(),U(D)},[]),f};import{jsx as N,Fragment as cZ}from"react/jsx-runtime";var vZ=({location:f,fallback:U,piecache:D,onError:H,queryOptions:z})=>{let Z=x(),$=d(),G=L(),T=i(()=>gZ({baseURL:Z}),[Z]),P=i(()=>E(),[]),X=i(()=>Z?b(Z):null,[Z]),B=i(()=>Z?u(Z,$):null,[Z,$]),q=Kf(),{data:Y,isLoading:I,error:V}=bZ({queryKey:["uiConfig",f.pathname+f.search,q?.initData],queryFn:async()=>{let W=new URLSearchParams(f.search);if(W.set("__pieroot","max"),q?.initData)W.set("initData",q.initData);let Q="/api/content"+f.pathname+"?"+W.toString();if(G)console.log("[PieRoot] Fetching UI configuration from:",Q);let C=await T.get(Q,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS","Content-type":"application/json"},withCredentials:!0});if(G)console.log("[PieRoot] Received UI configuration:",C.data);return C.data},enabled:!!q?.initData,staleTime:1/0,gcTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:!0,retryDelay:(W)=>Math.min(1000*2**W,30000),...z}),J=l(f.pathname,D,U);if(!Z)throw Error("Set PIE_API_SERVER and PIE_CENTRIFUGE_SERVER");if(V&&G)return console.error("[PieRoot] Error fetching UI configuration:",V),console.error("[PieRoot] Error details:",{message:V.message,status:V.response?.status,data:V.response?.data}),H?.(),J;if(I||!Y){if(G)console.log("[PieRoot] Loading state:",{isLoading:I,hasUiConfiguration:!!Y});return J}if(G)console.log("[PieRoot] UI configuration loaded successfully:",Y),console.log("[PieRoot] Rendering UI with configuration");return N(K.Provider,{value:P,children:N(o.Provider,{value:X,children:N(y.Provider,{value:B,children:N(w.Provider,{value:U??N(cZ,{}),children:N(v,{children:N(p,{children:N("form",{id:"piedata_global_form",action:Z+"api/process"+f.pathname,method:"post",encType:"multipart/form-data",children:N(F,{uiConfig:Y})})})})})})})})},pZ=(f)=>{let U=i(()=>new dZ,[]);return N(S.Provider,{value:f.onNavigate,children:N(j.Provider,{value:f.config,children:N(uZ,{client:U,children:N(vZ,{...f})})})})},hZ=pZ;import{useMemo as lZ}from"react";var rZ=(f,U={},D=[],H,z)=>{let Z=z?.renderingLogEnabled??!1,$=z?.timeout,G=z?.retryPolicy,T=G?.maxRetries??0,P=G?.baseDelay??1000,X=G?.retryOn??[502,503,504];if(Z)console.log("Registering AJAX: ",H,U,D);return async(B={})=>{if(typeof window==="undefined"||typeof document==="undefined"){if(Z)console.warn("getAjaxSubmit called on server, skipping DOM-dependent logic");return}let q=z?.apiServer;if(!q){if(Z)console.warn("AJAX skipped: apiServer is missing");return}if(!H||!f){if(Z)console.warn("AJAX skipped: pathname or setUiAjaxConfiguration is missing");return}if(D.includes("sid"))await Rf();let Y=new FormData;for(let[J,W]of Object.entries({...U,...B}))Y.append(J,W);for(let J of D)if(J==="sid"){if(!window.sid)throw new Error("SocketIO isn't initialized properly");Y.append("sid",window.sid)}else{let W=document.getElementsByName(J);if(!W.length){if(Z)console.warn(`No input found with name ${J}`);continue}let Q=W[0];if(Q instanceof HTMLInputElement)if(Q.type==="file"&&Q.files)Array.from(Q.files).forEach((C)=>Y.append(J,C));else Y.append(J,Q.value);else if(Q instanceof HTMLTextAreaElement)Y.append(J,Q.value)}let I=q+"api/ajax_content"+H;f(null);let V;for(let J=0;J<=T;J++){if(J>0){let C=P*2**(J-1);if(Z)console.log(`AJAX retry ${J}/${T} after ${C}ms`);await new Promise((R)=>setTimeout(R,C))}let W=$!=null?new AbortController:null,Q=W&&setTimeout(()=>W.abort(),$);try{let C=await fetch(I,{method:"POST",body:Y,signal:W?.signal});if(Q)clearTimeout(Q);if(!C.ok&&X.includes(C.status)&&J<T){V=new Error(`HTTP ${C.status}`);continue}let t=(C.headers.get("content-type")||"").includes("application/json");if(!!C.body?.getReader&&!t){let a=C.body.getReader(),JU=new TextDecoder,c="";while(!0){let{done:$f,value:YU}=await a.read();if($f)break;c+=JU.decode(YU,{stream:!0});let Sf=c.split(`
|
|
3
|
-
`);c=Sf.pop()??"";for(let
|
|
2
|
+
import{useContext as Jf,useEffect as Yf,useRef as MU}from"react";import{createContext as BU,useContext as WU}from"react";var j=BU(null),h=()=>{let f=WU(j);if(!f)throw new Error("usePieConfig must be used within PieConfigProvider");return f},x=()=>{let{apiServer:f}=h();return f},e=x,u=()=>{let{centrifugeServer:f}=h();return f};var N=()=>{let{enableRenderingLog:f}=h();return f},Lf=N,Mf=()=>{let{pageProcessor:f}=h();return f};var Pf="__piedemo__";import{createContext as QU}from"react";import{Centrifuge as Af}from"centrifuge";var Nf=new Map,d=(f,U)=>{if(!U)return null;let z=`${f}::${U}`,Z=Nf.get(z);if(Z)return Z;async function H(){let D=await fetch(f+"api/centrifuge/gen_token");if(!D.ok){if(D.status===403)throw new Af.UnauthorizedError("Backend is not answering");throw new Error(`Unexpected status code ${D.status}`)}return(await D.json()).token}let T=new Af(U,{getToken:H});return Nf.set(z,T),T},OU=QU(null),y=OU;import{io as _U}from"socket.io-client";import{createContext as CU}from"react";var yf=new Map,b=(f)=>{let U=yf.get(f);if(U)return U;let z=_U(f,{autoConnect:!1,transports:["websocket"]});return yf.set(f,z),z},RU=CU(null),E=RU;import wU from"mitt";import{createContext as KU,useCallback as FU,useContext as SU}from"react";var Vf=null;function o(){if(!Vf)Vf=wU();return Vf}var Ef=KU(null);function LU(f){let U=SU(Ef);return FU((z,Z)=>{(U??o()).emit(`pie${z}_${f}`,Z)},[f,U])}var F=Ef;var AU=({card:f,data:U,children:z,useSocketioSupport:Z=!1,useCentrifugeSupport:H=!1,useMittSupport:T=!1,centrifugeChannel:D=void 0,methods:V=void 0})=>{let $=Lf(),P=MU(V);if(P.current=V,$)console.log("[PieCard] Rendering card:",f),console.log("[PieCard] Card data:",U),console.log("[PieCard] Component name:",U?.name),console.log("[PieCard] Real-time support:",{socketio:Z,centrifuge:H,mitt:T,centrifugeChannel:D}),console.log("[PieCard] Methods:",V?Object.keys(V):"none"),console.log("[PieCard] Has children:",!!z);let G=Jf(E),B=Jf(y),W=Jf(F);if(Yf(()=>{if(!G||!Z||!P.current||!U.name){if($&&Z)console.log("[PieCard] Socket.IO setup skipped:",{hasSocket:!!G,useSocketioSupport:Z,hasMethods:!!P.current,hasDataName:!!U?.name});return}let Y=Object.keys(P.current??{}).map((I)=>{let J=`pie${I}_${U.name}`;if($)console.log(`[PieCard] Socket.IO registering event: ${J}`);let Q=(q)=>{P.current?.[I]?.(q)};return G.on(J,Q),[J,Q]});return()=>{Y.forEach(([I,J])=>{if($)console.log(`[PieCard] Socket.IO unregistering event: ${I}`);G.off(I,J)})}},[G,U.name,Z]),Yf(()=>{if(!B||!H||!D||!U.name){if($&&H)console.log("[PieCard] Centrifuge setup skipped:",{hasCentrifuge:!!B,useCentrifugeSupport:H,hasCentrifugeChannel:!!D,hasMethods:!!P.current,hasDataName:!!U?.name});return}let Y=Object.keys(P.current??{}).map((I)=>{let J=`pie${I}_${U.name}_${D}`;if($)console.log(`[PieCard] Centrifuge subscribing to channel: ${J}`);let Q=B.newSubscription(J);return Q.on("publication",(q)=>{if($)console.log(`[PieCard] Centrifuge received data on ${J}:`,q.data);P.current?.[I]?.(q.data)}),Q.subscribe(),Q});return()=>{Y.forEach((I)=>{if($)console.log("[PieCard] Centrifuge unsubscribing from channel");I.unsubscribe(),B.removeSubscription(I)})}},[B,D,U.name,H]),Yf(()=>{if(!W||!T||!U.name){if($&&T)console.log("[PieCard] Mitt setup skipped:",{hasMitt:!!W,useMittSupport:T,hasMethods:!!P.current,hasDataName:!!U?.name});return}let X=Object.keys(P.current??{}),Y={};return X.forEach((I)=>{let J=`pie${I}_${U.name}`,Q=(q)=>{if($)console.log(`[PieCard] Mitt registering event: ${J}`);P.current?.[I]?.(q)};Y[J]=Q,W.on(J,Q)}),()=>{Object.entries(Y).forEach(([I,J])=>{if($)console.log(`[PieCard] Mitt unregistering event: ${I}`);W.off(I,J)})}},[W,U.name,T]),$)console.log("[PieCard] Rendering complete, returning children");return z},R=AU;import{lazy as NU}from"react";var Xf=new Map;function of(f,U){return NU(()=>{if(Xf.has(U))return Xf.get(U);let z=f().then((Z)=>Z);return Xf.set(U,z),z})}var g=new Map,yU=(f)=>{if(!f.name)throw new Error("Component registration requires a name");if(!f.component&&!f.loader)throw new Error(`Component "${f.name}" requires component or loader`);let U={name:f.name,component:f.component,loader:f.loader,metadata:f.metadata,fallback:f.fallback,isLazy:!1};if(!U.component&&U.loader)U.component=of(U.loader,f.name),U.loader=void 0,U.isLazy=!0;return U};function C(f){let U=yU(f);return g.set(U.name,U),U.component}var EU=(f)=>{f.forEach((U)=>C(U))},oU=(f)=>{g.delete(f)},mU=(f)=>{return g.has(f)},kU=(f)=>{return g.get(f)?.metadata},r=(f)=>{return g.get(f)},jU=()=>{return Array.from(g.keys())},xU=()=>{return g.size};import{Suspense as vU,useContext as pU,memo as cU}from"react";import{createContext as uU}from"react";import{jsx as gU,Fragment as bU}from"react/jsx-runtime";var dU=uU(gU(bU,{})),K=dU;import{jsx as If}from"react/jsx-runtime";function hU({uiConfig:f,setUiAjaxConfiguration:U}){let z=pU(K),Z=N();if(Z)console.log("[UI] Rendering component:",f.card),console.log("[UI] Component data:",f.data),console.log("[UI] Component content:",f.content),console.log("[UI] Has setUiAjaxConfiguration:",!!U);let H=r(f.card);if(!H?.component){if(Z)console.warn(`[UI] Component not found in registry: ${f.card}`),console.log("[UI] Returning fallback component");return z}if(Z)console.log("[UI] Found component in registry:",{name:H.name,isLazy:H.isLazy,hasMetadata:!!H.metadata});let T=H.component,D=If(T,{data:f.data,content:f.content,setUiAjaxConfiguration:U});if(H.isLazy){if(Z)console.log("[UI] Rendering lazy component with Suspense:",H.name);return If(vU,{fallback:H.fallback?If(H.fallback,{}):z,children:D},`${H.name}`)}if(Z)console.log("[UI] Rendering component directly:",H.name);return D}var w=cU(hU);import{Suspense as nU,useContext as sU}from"react";import{createContext as lU}from"react";var rU=lU(null),k=rU;import{jsx as ff}from"react/jsx-runtime";function mf({uiConfig:f,setUiAjaxConfiguration:U}){let z=sU(K),Z=N();if(Z)console.log("[UILoading] Rendering fallback for:",f.card),console.log("[UILoading] Component data:",f.data),console.log("[UILoading] Component content:",f.content),console.log("[UILoading] Has setUiAjaxConfiguration:",!!U);let H=r(f.card);if(!H?.component){if(Z)console.warn(`[UILoading] Component not found in registry: ${f.card}`),console.log("[UILoading] Returning fallback component");return z}if(Z)console.log("[UILoading] Found component in registry:",{name:H.name,isLazy:H.isLazy,hasMetadata:!!H.metadata,hasFallback:!!H.fallback});if(H.fallback){if(Z)console.log("[UILoading] Rendering fallback for:",H.name);let V=H.fallback;return ff(V,{})}if(Z)console.log("[UILoading] No fallback, rendering full component:",H.name);let T=H.component,D=ff(k.Provider,{value:mf,children:ff(T,{data:f.data,content:f.content,setUiAjaxConfiguration:U})});if(H.isLazy)return ff(nU,{fallback:z,children:D},`${H.name}`);return D}var Gf=mf;import{useContext as iU}from"react";import{jsx as qf}from"react/jsx-runtime";var tU=({data:f,content:U,setUiAjaxConfiguration:z})=>{let{name:Z,sx:H}=f,T=iU(k)??w;return qf(R,{card:Z,data:f,children:qf("div",{style:H,id:Z,children:U.map((D,V)=>{return qf(T,{uiConfig:D,setUiAjaxConfiguration:z},`children-${V}`)})})})},kf=tU;var aU=C({name:"SequenceCard",component:kf,metadata:{author:"Swarm.ing",description:"Simple div with styles joining few components"}});import{useContext as eU}from"react";import{jsx as jf}from"react/jsx-runtime";var fH=({data:f,content:U,setUiAjaxConfiguration:z})=>{let{name:Z}=f,H=eU(k)??w;return jf(R,{card:Z,data:f,children:U.map((T,D)=>{return jf(H,{uiConfig:T,setUiAjaxConfiguration:z},`children-${D}`)})})},xf=fH;var UH=C({name:"UnionCard",component:xf,metadata:{author:"Swarm.ing",description:"Renders one of many components"}});import{useEffect as DH,useState as $H}from"react";import TH from"html-react-parser";import{useCallback as Uf,useEffect as HH,useRef as Bf,useState as ZH}from"react";function zH(){let f=new AudioContext,U=f.createOscillator(),z=U.connect(f.createMediaStreamDestination());U.start();let Z=z.stream.getAudioTracks()[0];return Z.enabled=!1,Z}function Hf(f=null,U){let[z,Z]=ZH(!1),H=Bf(null),T=Bf(null),D=Bf(null),V=Uf(async(B,W=!0)=>{if(H.current)$();let X=new RTCPeerConnection;if(X.onconnectionstatechange=()=>{if(X.connectionState==="connected")Z(!0);else if(["disconnected","failed","closed"].includes(X.connectionState))Z(!1)},X.ontrack=(_)=>{if(f)f.srcObject=_.streams[0]},W){let _=await navigator.mediaDevices.getUserMedia({audio:!0});X.addTrack(_.getTracks()[0],_)}else{let _=zH();X.addTrack(_)}let Y=X.createDataChannel("oai-events");T.current=Y,D.current=new Promise((_)=>{Y.addEventListener("open",()=>{_()})});let I=await X.createOffer();await X.setLocalDescription(I);let O=await(await fetch(`${"https://api.openai.com/v1/realtime/calls"}?model=${"gpt-realtime"}`,{method:"POST",body:I.sdp,headers:{Authorization:`Bearer ${B}`,"Content-Type":"application/sdp"}})).text();await X.setRemoteDescription({type:"answer",sdp:O}),H.current=X,await D.current},[f]),$=Uf(()=>{let B=T.current;if(B)B.close();H.current?.getSenders()?.forEach((W)=>W.track?.stop()),H.current?.close(),Z(!1),H.current=null,T.current=null,D.current=null},[f]),P=Uf((B)=>{let W=T.current;if(!W){console.error("Data channel is not ready",B);return}let X=new Date().toLocaleTimeString();if(B.event_id=B.event_id||crypto.randomUUID(),W.send(JSON.stringify(B)),!B.timestamp)B.timestamp=X;U?.(B)},[U,f]),G=Uf((B)=>{if(!T.current){console.error("Data channel is not ready");return}let X=()=>{P({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:B}]}}),P({type:"response.create"})};if(D.current)D.current.then(X);else X()},[U,f]);return HH(()=>{let B=T.current;if(!B)return;let W=(X)=>{let Y=JSON.parse(X.data);if(!Y.timestamp)Y.timestamp=new Date().toLocaleTimeString();U?.(Y)};return B.addEventListener("message",W),()=>{B.removeEventListener("message",W)}},[U,f]),{isSessionActive:z,startSession:V,stopSession:$,sendTextMessage:G}}import{jsx as VH}from"react/jsx-runtime";var PH=({data:f})=>{let{html:U,useSocketioSupport:z,useCentrifugeSupport:Z,useMittSupport:H,centrifugeChannel:T}=f,[D,V]=$H(U),{isSessionActive:$,startSession:P,sendTextMessage:G}=Hf(null,(Y)=>{if(console.log(Y.type,Y.type==="response.output_text.delta"&&Y.delta),Y.type==="response.output_text.delta"&&Y.delta)V((I)=>I+Y.delta)});return DH(()=>{V(U)},[U]),VH(R,{card:"HTMLEmbedCard",data:f,methods:{update:(Y)=>{V(Y.value)},generateUsingAI:async(Y)=>{try{if(!$&&Y.token)await P(Y.token,!1);G(Y.prompt)}catch(I){console.error("Failed to generate using AI",I)}},initializeAI:async(Y)=>{if(!$&&Y.token)await P(Y.token,!1)}},useCentrifugeSupport:Z,useSocketioSupport:z,useMittSupport:H,centrifugeChannel:T,children:TH(D)})},uf=PH;var JH=C({name:"HTMLEmbedCard",component:uf,metadata:{author:"Swarm.ing"}});import{useEffect as YH,useState as XH}from"react";import{jsx as df}from"react/jsx-runtime";var IH=({data:f})=>{let{name:U,value:z,useSocketioSupport:Z,useCentrifugeSupport:H,useMittSupport:T,centrifugeChannel:D}=f,[V,$]=XH(z);return YH(()=>{$(z)},[z]),df(R,{card:"HiddenCard",data:f,useSocketioSupport:Z,useCentrifugeSupport:H,useMittSupport:T,centrifugeChannel:D,methods:{update:({value:P})=>{$(P)}},children:df("input",{type:"hidden",id:U,name:U,value:V})})},bf=IH;var GH=C({name:"HiddenCard",component:bf,metadata:{author:"Swarm.ing"}});import{useContext as gf,useEffect as WH}from"react";import{createContext as qH}from"react";var BH=qH(void 0),S=BH;import{jsx as _H,Fragment as OH}from"react/jsx-runtime";var QH=({data:f})=>{let{url:U}=f,z=gf(S),Z=gf(K);return WH(()=>{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(U))window.location.href=U;else z?.(U)},[U,z]),_H(OH,{children:Z})},vf=QH;var CH=C({name:"AutoRedirectCard",component:vf,metadata:{author:"Swarm.ing"}});import{Bounce as RH,Slide as wH,Zoom as KH,Flip as FH}from"react-toastify";import{toast as SH,ToastContainer as LH}from"react-toastify";import{useContext as MH,useMemo as AH,useRef as NH}from"react";import{jsx as Wf,Fragment as jH}from"react/jsx-runtime";var yH={bounce:RH,slide:wH,zoom:KH,flip:FH},EH=(f)=>{let U={...f,type:f.alertType,transition:f.transition?yH[f.transition]:void 0,position:f.position??"bottom-right",autoClose:f.autoClose??3000,style:{backgroundColor:"black",...f.sx}};SH(f.message,U)},oH=(f)=>{console.log("Log event",f)},mH=(f)=>{if(typeof window==="undefined"||!window.Notification){console.warn("[IOEventsCard] Notifications API is not available");return}let U=()=>{try{new window.Notification(f.title,{body:f.message??f.subtitle,icon:f.icon,silent:f.silent})}catch(Z){console.error("[IOEventsCard] Failed to show notification",Z)}},z=window.Notification.permission;if(z==="granted"){U();return}if(z==="denied"){console.warn("[IOEventsCard] Notification permission denied");return}window.Notification.requestPermission().then((Z)=>{if(Z==="granted")U()})},kH=({data:f})=>{let{useCentrifugeSupport:U,useSocketioSupport:z,useMittSupport:Z,centrifugeChannel:H}=f,T=MH(S),D=NH(T);D.current=T;let V=AH(()=>({alert:EH,log:oH,push:mH,redirect:($)=>{if($.to){let P=$.to;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(P))window.location.href=P;else D.current?.(P)}else window.location.reload()},reload:($)=>{if($.to){let P=$.to;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(P))window.location.href=P;else D.current?.(P)}else window.location.reload()}}),[]);return Wf(jH,{children:Wf(R,{card:"IOEventsCard",data:f,useCentrifugeSupport:U,useSocketioSupport:z,useMittSupport:Z,centrifugeChannel:H,methods:V,children:Wf(LH,{})})})},pf=kH;var xH=C({name:"IOEventsCard",component:pf,metadata:{author:"Swarm.ing"}});import{useEffect as cf,useState as uH}from"react";import{jsx as hf}from"react/jsx-runtime";var dH=({data:f})=>{let{name:U,key:z,value:Z,useSocketioSupport:H,useCentrifugeSupport:T,useMittSupport:D,centrifugeChannel:V}=f,[$,P]=uH(Z);return cf(()=>{P(Z)},[Z]),cf(()=>{if(typeof window==="undefined")return;sessionStorage.setItem(z,$)},[z,$]),hf(R,{card:"SessionStorageCard",data:f,useSocketioSupport:H,useCentrifugeSupport:T,useMittSupport:D,centrifugeChannel:V,methods:{update:({value:G})=>{P(G)},remove:()=>{sessionStorage.removeItem(z),P("")}},children:hf("input",{type:"hidden",id:U,name:U,value:$})})},lf=dH;var bH=C({name:"SessionStorageCard",component:lf,metadata:{author:"PieData"}});import{useEffect as rf,useState as gH}from"react";import{jsx as nf}from"react/jsx-runtime";var vH=({data:f})=>{let{name:U,key:z,value:Z,useSocketioSupport:H,useCentrifugeSupport:T,useMittSupport:D,centrifugeChannel:V}=f,[$,P]=gH(Z);return rf(()=>{P(Z)},[Z]),rf(()=>{if(typeof window==="undefined")return;localStorage.setItem(z,$)},[z,$]),nf(R,{card:"DeviceStorageCard",data:f,useSocketioSupport:H,useCentrifugeSupport:T,useMittSupport:D,centrifugeChannel:V,methods:{update:({value:G})=>{P(G)},remove:()=>{localStorage.removeItem(z),P("")}},children:nf("input",{type:"hidden",id:U,name:U,value:$})})},sf=vH;var pH=C({name:"DeviceStorageCard",component:sf,metadata:{author:"PieData"}});import{useEffect as tf,useState as cH}from"react";import{jsx as af}from"react/jsx-runtime";var hH=({data:f})=>{let{name:U,key:z,value:Z,useSocketioSupport:H,useCentrifugeSupport:T,useMittSupport:D,centrifugeChannel:V}=f,[$,P]=cH(Z);return tf(()=>{P(Z)},[Z]),tf(()=>{if(typeof window==="undefined")return;let G=window.Telegram?.WebApp?.CloudStorage;if(!G)return;G.setItem(z,$)},[z,$]),af(R,{card:"CloudStorageCard",data:f,useSocketioSupport:H,useCentrifugeSupport:T,useMittSupport:D,centrifugeChannel:V,methods:{update:({value:G})=>{P(G)},remove:()=>{let G=window.Telegram?.WebApp?.CloudStorage;if(G)G.removeItem(z);P("")}},children:af("input",{type:"hidden",id:U,name:U,value:$})})},ef=hH;var lH=C({name:"CloudStorageCard",component:ef,metadata:{author:"PieData"}});import{useEffect as fU,useState as rH}from"react";import{jsx as UU}from"react/jsx-runtime";var nH=({data:f})=>{let{name:U,key:z,value:Z,useSocketioSupport:H,useCentrifugeSupport:T,useMittSupport:D,centrifugeChannel:V}=f,[$,P]=rH(Z);return fU(()=>{P(Z)},[Z]),fU(()=>{if(typeof window==="undefined")return;let G=window.Telegram?.WebApp?.SecureStorage;if(!G)return;G.setItem(z,$)},[z,$]),UU(R,{card:"SecureStorageCard",data:f,useSocketioSupport:H,useCentrifugeSupport:T,useMittSupport:D,centrifugeChannel:V,methods:{update:({value:G})=>{P(G)},remove:()=>{let G=window.Telegram?.WebApp?.SecureStorage;if(G)G.removeItem(z);P("")}},children:UU("input",{type:"hidden",id:U,name:U,value:$})})},HU=nH;var sH=C({name:"SecureStorageCard",component:HU,metadata:{author:"PieData"}});import{useCallback as Qf,useContext as Of,useEffect as iH,useRef as tH,useState as ZU}from"react";import{jsx as zU}from"react/jsx-runtime";var aH=({data:f,content:U})=>{let{useLoader:z,noReturn:Z,returnType:H,useSocketioSupport:T,useCentrifugeSupport:D,useMittSupport:V,centrifugeChannel:$}=f,P=Of(K),G=Of(k)??w,[B,W]=ZU(!1),[X,Y]=ZU(null),I=tH(U),J=Of(F),Q=Qf((_)=>{if(_===null)W(!0);else if(W(!1),!Z)I.current=_;if(!Z)Y(_)},[Z]),q=Qf((_)=>{I.current=_.content,Y(_.content)},[]),O=Qf((_)=>{if(_===null)W(!0);else if(W(!1),!Z)for(let t of _)J?.emit(t.name,t.data)},[Z,J]);if(iH(()=>{Y(U),W(!1)},[U]),!X&&z)return P;return zU(R,{card:"AjaxGroupCard",data:f,methods:{changeContent:q},useSocketioSupport:T,useCentrifugeSupport:D,useMittSupport:V,centrifugeChannel:$,children:zU(G,{uiConfig:X??I.current,setUiAjaxConfiguration:H==="events"?O:Q})})},DU=aH;var eH=C({name:"AjaxGroupCard",component:DU,metadata:{author:"Swarm.ing",description:"Group card with AJAX support"}});import{useContext as $U}from"react";import{jsx as _f}from"react/jsx-runtime";var fZ=({data:f,content:U,setUiAjaxConfiguration:z})=>{let{name:Z,url:H,sx:T}=f,D=$U(S),V=$U(k)??w;return _f(R,{card:Z,data:f,children:_f("div",{style:T,id:Z,onClick:(P)=>{if(H)if(P.stopPropagation(),/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(H))window.location.href=H;else D?.(H)},children:_f(V,{setUiAjaxConfiguration:z,uiConfig:U})})})},TU=fZ;var UZ=C({name:"BoxCard",component:TU,metadata:{author:"Swarm.ing",description:"Simple div with styles joining few components"}});import{useMemo as n}from"react";import{QueryClient as YZ,QueryClientProvider as XZ,useQuery as IZ}from"@tanstack/react-query";import{useContext as zZ,useEffect as DZ}from"react";import{useEffect as HZ,useState as ZZ}from"react";var Zf=new Map,zf=new Map;function Df(f,U){let z=`${f}::${U}`,Z=f?Zf.get(z):void 0,[H,T]=ZZ(Z??null);return HZ(()=>{if(!f)return;if(Zf.has(z)){T(Zf.get(z));return}let D=zf.get(z);if(!D)D=fetch(f+`api/support/${U}`,{method:"GET"}).then(($)=>$.json()).then(($)=>{return Zf.set(z,$),zf.delete(z),$}).catch(($)=>{throw zf.delete(z),$}),zf.set(z,D);let V=!1;return D.then(($)=>{if(!V)T($)}).catch(()=>{}),()=>{V=!0}},[f,U,z]),H}var Cf=null,PU=null;function VU(){PU?.()}function Rf(){if(typeof window==="undefined")return Promise.resolve();if(typeof window.sid!=="undefined")return Promise.resolve();if(!Cf)Cf=new Promise((f)=>{PU=()=>{f()}});return Cf}var $Z=({children:f})=>{let U=zZ(E),z=e(),Z=Df(z,"socketIO"),H=(T)=>{if(typeof window!=="undefined")window.sid=T.sid,VU(),console.log(`SocketIO initialized: ${window.sid}`)};return DZ(()=>{if(!U)return;let T=()=>{console.log("SocketIO connected")},D=(V)=>{console.log(`SocketIO disconnected: ${V}`),U.connect()};if(Z)U.on("pieinit",H),U.on("connect",T),U.on("disconnect",D),U.connect();return()=>{if(Z)U.off("pieinit",H),U.off("connect",T),U.off("disconnect",D),U.disconnect()}},[U,Z]),f},v=$Z;import{useContext as TZ,useEffect as PZ}from"react";var VZ=({children:f})=>{let U=TZ(y),z=e(),Z=Df(z,"centrifuge");return PZ(()=>{if(!U)return;let H=()=>{console.log("Centrifuge connected")},T=(D)=>{console.log("Centrifuge disconnected:",D)};if(Z)U.on("connected",H),U.on("disconnected",T),U.connect();return()=>{if(Z)U.disconnect()}},[U,Z]),f},p=VZ;import{createAxiosDateTransformer as GZ}from"axios-date-transformer";import{jsx as JZ}from"react/jsx-runtime";function l(f,U,z){if(!U)return z;let Z=f.replace(/^\//,""),H=U[Z];if(!H)return z;return JZ(Gf,{uiConfig:H})}import{jsx as L,Fragment as WZ}from"react/jsx-runtime";var qZ=({location:f,fallback:U,piecache:z,onError:Z,queryOptions:H,disableGlobalForm:T})=>{let D=x(),V=u(),$=N(),P=n(()=>GZ({baseURL:D||""}),[D]),G=n(()=>o(),[]),B=n(()=>D?b(D):null,[D]),W=n(()=>D?d(D,V):null,[D,V]),{data:X,isLoading:Y,error:I}=IZ({queryKey:["uiConfig",f.pathname+f.search,D],enabled:!!D,queryFn:async()=>{let Q=new URLSearchParams(f.search);Q.set("__pieroot","web");let q="/api/content"+f.pathname+"?"+Q.toString();if($)console.log("[PieRoot] Fetching UI configuration from:",q);let O=await P.get(q,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS","Content-type":"application/json"},withCredentials:!0});if($)console.log("[PieRoot] Received UI configuration:",O.data);return O.data},staleTime:1/0,gcTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:!0,retryDelay:(Q)=>Math.min(1000*2**Q,30000),...H}),J=l(f.pathname,z,U);if(!D)return J??null;if($)console.log("[PieRoot] Rendering with location:",f),console.log("[PieRoot] API_SERVER:",D),console.log("[PieRoot] CENTRIFUGE_SERVER:",V),console.log("[PieRoot] Fallback provided:",!!U),console.log("[PieRoot] Piecache provided:",!!z);if(I){if($)console.error("[PieRoot] Error fetching UI configuration:",I),console.error("[PieRoot] Error details:",{message:I.message,status:I.response?.status,data:I.response?.data});return Z?.(),J}if(Y||!X){if($)console.log("[PieRoot] Loading state:",{isLoading:Y,hasUiConfiguration:!!X});return J}if($)console.log("[PieRoot] UI configuration loaded successfully:",X),console.log("[PieRoot] Rendering UI with configuration");return L(F.Provider,{value:G,children:L(E.Provider,{value:B,children:L(y.Provider,{value:W,children:L(K.Provider,{value:U??L(WZ,{}),children:L(v,{children:L(p,{children:T?L(w,{uiConfig:X}):L("form",{id:"piedata_global_form",action:D+"api/process"+f.pathname,method:"post",encType:"multipart/form-data",children:L(w,{uiConfig:X})})})})})})})})},BZ=(f)=>{let U=n(()=>new YZ,[]);return L(S.Provider,{value:f.onNavigate,children:L(j.Provider,{value:f.config,children:L(XZ,{client:U,children:L(qZ,{...f})})})})},QZ=BZ;import{useMemo as s}from"react";import{QueryClient as CZ,QueryClientProvider as RZ,useQuery as wZ}from"@tanstack/react-query";import{createAxiosDateTransformer as KZ}from"axios-date-transformer";import{useEffect as OZ,useState as _Z}from"react";var wf=({onError:f}={})=>{let[U,z]=_Z(null),Z=Mf();return OZ(()=>{if(typeof window==="undefined")return;let H=window.Telegram?.WebApp;if(!H)return;try{H.ready?.()}catch(T){f?.()}if(Z==="telegram_expanded"&&(H.platform==="ios"||H.platform==="android"))H.expand();z(H)},[]),U};import{jsx as M,Fragment as LZ}from"react/jsx-runtime";var FZ=({location:f,fallback:U,piecache:z,onError:Z,queryOptions:H,disableGlobalForm:T})=>{let D=x(),V=u(),$=N(),P=s(()=>KZ({baseURL:D}),[D]),G=s(()=>o(),[]),B=s(()=>D?b(D):null,[D]),W=s(()=>D?d(D,V):null,[D,V]),X=wf({onError:Z}),{data:Y,isLoading:I,error:J}=wZ({queryKey:["uiConfig",f.pathname+f.search,X?.initData],enabled:!!X?.initData,queryFn:async()=>{let q=new URLSearchParams(f.search);if(q.set("__pieroot","telegram"),X?.initData)q.set("initData",X.initData);let O="/api/content"+f.pathname+"?"+q.toString();if($)console.log("[PieRoot] Fetching UI configuration from:",O);let _=await P.get(O,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS","Content-type":"application/json"},withCredentials:!0});if($)console.log("[PieRoot] Received UI configuration:",_.data);return _.data},staleTime:1/0,gcTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:!0,retryDelay:(q)=>Math.min(1000*2**q,30000),...H}),Q=l(f.pathname,z,U);if(!D)throw Error("Set PIE_API_SERVER and PIE_CENTRIFUGE_SERVER");if(J&&$)return console.error("[PieRoot] Error fetching UI configuration:",J),console.error("[PieRoot] Error details:",{message:J.message,status:J.response?.status,data:J.response?.data}),Z?.(),Q;if(I||!Y){if($)console.log("[PieRoot] Loading state:",{isLoading:I,hasUiConfiguration:!!Y});return Q}if($)console.log("[PieRoot] UI configuration loaded successfully:",Y),console.log("[PieRoot] Rendering UI with configuration");return M(F.Provider,{value:G,children:M(E.Provider,{value:B,children:M(y.Provider,{value:W,children:M(K.Provider,{value:U??M(LZ,{}),children:M(v,{children:M(p,{children:T?M(w,{uiConfig:Y}):M("form",{id:"piedata_global_form",action:D+"api/process"+f.pathname,method:"post",encType:"multipart/form-data",children:M(w,{uiConfig:Y})})})})})})})})},SZ=(f)=>{let U=s(()=>new CZ,[]);return M(S.Provider,{value:f.onNavigate,children:M(j.Provider,{value:f.config,children:M(RZ,{client:U,children:M(FZ,{...f})})})})},MZ=SZ;import{useMemo as Kf,useState as AZ}from"react";import{QueryClient as NZ,QueryClientProvider as yZ}from"@tanstack/react-query";import{jsx as m,Fragment as mZ}from"react/jsx-runtime";var EZ=({location:f,fallback:U,children:z,disableGlobalForm:Z})=>{let H=x(),T=u(),D=N(),V=Kf(()=>o(),[]),$=Kf(()=>H?b(H):null,[H]),P=Kf(()=>H?d(H,T):null,[H,T]);if(D)console.log("[PieRoot] Rendering with location:",f),console.log("[PieRoot] API_SERVER:",H),console.log("[PieRoot] CENTRIFUGE_SERVER:",T),console.log("[PieRoot] Fallback provided:",!!U);return m(F.Provider,{value:V,children:m(E.Provider,{value:$,children:m(y.Provider,{value:P,children:m(K.Provider,{value:U??m(mZ,{}),children:m(v,{children:m(p,{children:Z?z:m("form",{id:"piedata_global_form",action:H+"api/process"+f.pathname,method:"post",encType:"multipart/form-data",children:z})})})})})})})},oZ=(f)=>{let[U]=AZ(()=>new NZ);return m(S.Provider,{value:f.onNavigate,children:m(j.Provider,{value:f.config,children:m(yZ,{client:U,children:m(EZ,{...f})})})})},kZ=oZ;import{useMemo as i}from"react";import{QueryClient as uZ,QueryClientProvider as dZ,useQuery as bZ}from"@tanstack/react-query";import{createAxiosDateTransformer as gZ}from"axios-date-transformer";import{useEffect as jZ,useState as xZ}from"react";var Ff=()=>{let[f,U]=xZ(null);return jZ(()=>{if(typeof window==="undefined")return;let z=window.WebApp;if(!z)return;z.ready(),U(z)},[]),f};import{jsx as A,Fragment as cZ}from"react/jsx-runtime";var vZ=({location:f,fallback:U,piecache:z,onError:Z,queryOptions:H,disableGlobalForm:T})=>{let D=x(),V=u(),$=N(),P=i(()=>gZ({baseURL:D}),[D]),G=i(()=>o(),[]),B=i(()=>D?b(D):null,[D]),W=i(()=>D?d(D,V):null,[D,V]),X=Ff(),{data:Y,isLoading:I,error:J}=bZ({queryKey:["uiConfig",f.pathname+f.search,X?.initData],queryFn:async()=>{let q=new URLSearchParams(f.search);if(q.set("__pieroot","max"),X?.initData)q.set("initData",X.initData);let O="/api/content"+f.pathname+"?"+q.toString();if($)console.log("[PieRoot] Fetching UI configuration from:",O);let _=await P.get(O,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS","Content-type":"application/json"},withCredentials:!0});if($)console.log("[PieRoot] Received UI configuration:",_.data);return _.data},enabled:!!X?.initData,staleTime:1/0,gcTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:!0,retryDelay:(q)=>Math.min(1000*2**q,30000),...H}),Q=l(f.pathname,z,U);if(!D)throw Error("Set PIE_API_SERVER and PIE_CENTRIFUGE_SERVER");if(J&&$)return console.error("[PieRoot] Error fetching UI configuration:",J),console.error("[PieRoot] Error details:",{message:J.message,status:J.response?.status,data:J.response?.data}),Z?.(),Q;if(I||!Y){if($)console.log("[PieRoot] Loading state:",{isLoading:I,hasUiConfiguration:!!Y});return Q}if($)console.log("[PieRoot] UI configuration loaded successfully:",Y),console.log("[PieRoot] Rendering UI with configuration");return A(F.Provider,{value:G,children:A(E.Provider,{value:B,children:A(y.Provider,{value:W,children:A(K.Provider,{value:U??A(cZ,{}),children:A(v,{children:A(p,{children:T?A(w,{uiConfig:Y}):A("form",{id:"piedata_global_form",action:D+"api/process"+f.pathname,method:"post",encType:"multipart/form-data",children:A(w,{uiConfig:Y})})})})})})})})},pZ=(f)=>{let U=i(()=>new uZ,[]);return A(S.Provider,{value:f.onNavigate,children:A(j.Provider,{value:f.config,children:A(dZ,{client:U,children:A(vZ,{...f})})})})},hZ=pZ;import{useMemo as lZ}from"react";var rZ=(f,U={},z=[],Z,H)=>{let T=H?.renderingLogEnabled??!1,D=H?.timeout,V=H?.retryPolicy,$=V?.maxRetries??0,P=V?.baseDelay??1000,G=V?.retryOn??[502,503,504];if(T)console.log("Registering AJAX: ",Z,U,z);return async(B={})=>{if(typeof window==="undefined"||typeof document==="undefined"){if(T)console.warn("getAjaxSubmit called on server, skipping DOM-dependent logic");return}let W=H?.apiServer;if(!W){if(T)console.warn("AJAX skipped: apiServer is missing");return}if(!Z||!f){if(T)console.warn("AJAX skipped: pathname or setUiAjaxConfiguration is missing");return}if(z.includes("sid"))await Rf();let X=new FormData;for(let[J,Q]of Object.entries({...U,...B}))X.append(J,Q);for(let J of z)if(J==="sid"){if(!window.sid)throw new Error("SocketIO isn't initialized properly");X.append("sid",window.sid)}else{let Q=document.getElementsByName(J);if(!Q.length){if(T)console.warn(`No input found with name ${J}`);continue}let q=Q[0];if(q instanceof HTMLInputElement)if(q.type==="file"&&q.files)Array.from(q.files).forEach((O)=>X.append(J,O));else X.append(J,q.value);else if(q instanceof HTMLTextAreaElement)X.append(J,q.value)}let Y=W+"api/ajax_content"+Z;f(null);let I;for(let J=0;J<=$;J++){if(J>0){let O=P*2**(J-1);if(T)console.log(`AJAX retry ${J}/${$} after ${O}ms`);await new Promise((_)=>setTimeout(_,O))}let Q=D!=null?new AbortController:null,q=Q&&setTimeout(()=>Q.abort(),D);try{let O=await fetch(Y,{method:"POST",body:X,signal:Q?.signal});if(q)clearTimeout(q);if(!O.ok&&G.includes(O.status)&&J<$){I=new Error(`HTTP ${O.status}`);continue}let t=(O.headers.get("content-type")||"").includes("application/json");if(!!O.body?.getReader&&!t){let a=O.body.getReader(),XU=new TextDecoder,c="";while(!0){let{done:$f,value:IU}=await a.read();if($f)break;c+=XU.decode(IU,{stream:!0});let Sf=c.split(`
|
|
3
|
+
`);c=Sf.pop()??"";for(let GU of Sf){let Tf=GU.trim();if(!Tf)continue;try{let qU=JSON.parse(Tf);f([qU])}catch{if(T)console.warn("Failed to parse streamed line:",Tf)}}}if(c.trim())try{let $f=JSON.parse(c);f([$f])}catch{if(T)console.warn("Failed to parse final streamed line:",c)}return{}}else{let a=await O.json();return f(a),a}}catch(O){if(q)clearTimeout(q);if(I=O,J<$)continue;if(T)console.error("AJAX request failed:",O);return f(null),O}}if(T)console.error("AJAX request failed after retries:",I);return f(null),I}},nZ=(f,U={},z=[],Z,H)=>{let{apiServer:T,enableRenderingLog:D}=h(),V=JSON.stringify(U),$=JSON.stringify(z),P=JSON.stringify(H);return lZ(()=>rZ(f,U,z,Z,{apiServer:T,renderingLogEnabled:D,timeout:H?.timeout,retryPolicy:H?.retryPolicy}),[f,V,$,Z,T,D,P])};import{tool as sZ}from"@openai/agents";import{useContext as iZ,useMemo as tZ}from"react";var JU=/^pie(.+?)_(.+)$/;function YU(f=o(),U={}){let z=[],Z=new Set;for(let H of f.all.keys()){if(typeof H!=="string")continue;let T=H.match(JU);if(!T)continue;let[,D,V]=T,$={methodName:D,cardName:V,eventName:H};if(U.filter&&!U.filter($))continue;let P=U.nameFor?.($)??`${V}_${D}`;if(Z.has(P))continue;Z.add(P);let G=U.describe?.($)??`Invokes the "${D}" method on the PieCard "${V}" by emitting the in-process mitt event "${H}". The optional "payload" argument is forwarded verbatim to the card's handler.`;z.push(sZ({name:P,description:G,strict:!1,parameters:{type:"object",properties:{payload:{description:"Arbitrary JSON payload forwarded to the PieCard method handler. Omit for fire-and-forget calls."}},required:[],additionalProperties:!0},execute:async(B)=>{let W=B?.payload;return f.emit(H,W),`Emitted "${H}"`}}))}return z}function aZ(f={}){let z=iZ(F)??o(),Z=[];for(let $ of z.all.keys())if(typeof $==="string"&&JU.test($))Z.push($);Z.sort();let H=Z.join("|"),{filter:T,describe:D,nameFor:V}=f;return tZ(()=>YU(z,{filter:T,describe:D,nameFor:V}),[z,H,T,D,V])}import{clsx as eZ}from"clsx";import{twMerge as fz}from"tailwind-merge";function Uz(...f){return fz(eZ(f))}var Hz=()=>{if(typeof document==="undefined")return;let f=document.getElementById("piedata_global_form");f&&f.submit()};var Zz=(f,U)=>`${f}${Pf}${U}`;export{wf as useWebApp,aZ as usePieMittAgentTools,LU as usePieEmit,Hf as useOpenAIWebRTC,Ff as useMaxWebApp,nZ as useAjaxSubmit,oU as unregisterComponent,Hz as submitGlobalForm,g as registry,C as registerPieComponent,EU as registerMultipleComponents,Zz as pieName,mU as hasComponent,xU as getRegistrySize,r as getRegistryEntry,YU as getMittAgentTools,kU as getComponentMeta,jU as getAllRegisteredComponents,Uz as cn,UH as UnionCard,k as UIRendererContext,Gf as UILoading,w as UI,bH as SessionStorageCard,aU as SequenceCard,sH as SecureStorageCard,MZ as PieTelegramRoot,QZ as PieRoot,hZ as PieMaxRoot,R as PieCard,kZ as PieBaseRoot,Pf as PIEBREAK,xH as IOEventsCard,GH as HiddenCard,JH as HTMLEmbedCard,pH as DeviceStorageCard,lH as CloudStorageCard,UZ as BoxCard,CH as AutoRedirectCard,eH as AjaxGroupCard};
|