zxq-com 0.0.31 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/utils/index.d.ts +1 -0
  3. package/dist/ws/zxqWs.d.ts +1 -1
  4. package/dist/zxq-com.cjs +321 -322
  5. package/dist/zxq-com.css +1 -1
  6. package/dist/zxq-com.js +2890 -4179
  7. package/dist/zxq-ws.cjs +1 -1
  8. package/dist/zxq-ws.js +1 -1
  9. package/dist/zxqWs-C8PKp6xW.cjs +1 -0
  10. package/dist/zxqWs-wYl2lV3c.js +127 -0
  11. package/package.json +1 -1
  12. package/dist/A2UIAudio-CjRHo_tK.cjs +0 -1
  13. package/dist/A2UIAudio-Dn4ur7h-.js +0 -31
  14. package/dist/A2UIButton-CnppLi7b.cjs +0 -1
  15. package/dist/A2UIButton-nOO3LOth.js +0 -35
  16. package/dist/A2UICard-BgjH40z6.js +0 -34
  17. package/dist/A2UICard-BhGyY9Gx.cjs +0 -1
  18. package/dist/A2UICheckbox-B5uHUsbP.cjs +0 -1
  19. package/dist/A2UICheckbox-DrC1_5iC.js +0 -41
  20. package/dist/A2UIDateTimeInput-BYdDpBR-.js +0 -58
  21. package/dist/A2UIDateTimeInput-D-aG6mZk.cjs +0 -1
  22. package/dist/A2UIDivider-Bzpy-f-q.js +0 -24
  23. package/dist/A2UIDivider-CvM6sA_R.cjs +0 -1
  24. package/dist/A2UIIcon-7d6g1X7l.cjs +0 -1
  25. package/dist/A2UIIcon-D0PvsBr4.js +0 -30
  26. package/dist/A2UIImage-BeT7cRh7.cjs +0 -1
  27. package/dist/A2UIImage-DvRMKAMK.js +0 -39
  28. package/dist/A2UIList-CVESfWJr.js +0 -32
  29. package/dist/A2UIList-DcLtvZb0.cjs +0 -1
  30. package/dist/A2UIModal-BNDMZHNM.cjs +0 -1
  31. package/dist/A2UIModal-B_MoIZYE.js +0 -47
  32. package/dist/A2UIMultipleChoice-DtMcPyuU.js +0 -41
  33. package/dist/A2UIMultipleChoice-n7GyQjXd.cjs +0 -1
  34. package/dist/A2UIRenderer-DqVIH5p7.cjs +0 -1
  35. package/dist/A2UIRenderer-lZ0ms8c-.js +0 -44
  36. package/dist/A2UISlider-Dd9OIXwb.js +0 -54
  37. package/dist/A2UISlider-NnRbh48d.cjs +0 -1
  38. package/dist/A2UITabs-CvuzauYt.cjs +0 -1
  39. package/dist/A2UITabs-DU1t9s1D.js +0 -39
  40. package/dist/A2UITextField-CC5S1AW9.js +0 -46
  41. package/dist/A2UITextField-D652Ge6_.cjs +0 -1
  42. package/dist/A2UIVideo-CNBhUnoP.js +0 -30
  43. package/dist/A2UIVideo-CRBBhgyW.cjs +0 -1
  44. package/dist/a2ui/catalog/A2UIAudio.vue.d.ts +0 -10
  45. package/dist/a2ui/catalog/A2UIButton.vue.d.ts +0 -9
  46. package/dist/a2ui/catalog/A2UICard.vue.d.ts +0 -8
  47. package/dist/a2ui/catalog/A2UICheckbox.vue.d.ts +0 -11
  48. package/dist/a2ui/catalog/A2UIColumn.vue.d.ts +0 -10
  49. package/dist/a2ui/catalog/A2UIDateTimeInput.vue.d.ts +0 -12
  50. package/dist/a2ui/catalog/A2UIDivider.vue.d.ts +0 -8
  51. package/dist/a2ui/catalog/A2UIIcon.vue.d.ts +0 -10
  52. package/dist/a2ui/catalog/A2UIImage.vue.d.ts +0 -12
  53. package/dist/a2ui/catalog/A2UIList.vue.d.ts +0 -9
  54. package/dist/a2ui/catalog/A2UIModal.vue.d.ts +0 -10
  55. package/dist/a2ui/catalog/A2UIMultipleChoice.vue.d.ts +0 -15
  56. package/dist/a2ui/catalog/A2UIRow.vue.d.ts +0 -10
  57. package/dist/a2ui/catalog/A2UISlider.vue.d.ts +0 -13
  58. package/dist/a2ui/catalog/A2UISurface.vue.d.ts +0 -7
  59. package/dist/a2ui/catalog/A2UITabs.vue.d.ts +0 -9
  60. package/dist/a2ui/catalog/A2UIText.vue.d.ts +0 -11
  61. package/dist/a2ui/catalog/A2UITextField.vue.d.ts +0 -12
  62. package/dist/a2ui/catalog/A2UIVideo.vue.d.ts +0 -10
  63. package/dist/a2ui/catalog/default.d.ts +0 -2
  64. package/dist/a2ui/config.d.ts +0 -10
  65. package/dist/a2ui/data/markdown.d.ts +0 -9
  66. package/dist/a2ui/data/processor.d.ts +0 -17
  67. package/dist/a2ui/data/types.d.ts +0 -12
  68. package/dist/a2ui/index.d.ts +0 -11
  69. package/dist/a2ui/rendering/A2UIRenderer.vue.d.ts +0 -7
  70. package/dist/a2ui/rendering/catalog.d.ts +0 -10
  71. package/dist/a2ui/rendering/useDynamicComponent.d.ts +0 -18
  72. package/dist/a2ui/theme.d.ts +0 -2
  73. package/dist/styles-BYpMnn-p.js +0 -442
  74. package/dist/styles-BZV65AUo.cjs +0 -453
  75. package/dist/useDynamicComponent-MEzwhjNJ.js +0 -470
  76. package/dist/useDynamicComponent-YT-u9Rpv.cjs +0 -1
  77. package/dist/zxqWs-B5VT5Q1P.js +0 -109
  78. package/dist/zxqWs-Dv99B0MJ.cjs +0 -1
@@ -1,470 +0,0 @@
1
- import { inject, provide, reactive } from "vue";
2
- var __plugin_vue_export_helper_default = (i, E) => {
3
- let D = i.__vccOpts || i;
4
- for (let [i, O] of E) D[i] = O;
5
- return D;
6
- };
7
- const A2UI_CONFIG_KEY = Symbol("a2ui-config");
8
- function provideA2UI(i) {
9
- provide(A2UI_CONFIG_KEY, i);
10
- }
11
- function useA2UIConfig() {
12
- let E = inject(A2UI_CONFIG_KEY);
13
- if (!E) throw Error("A2UI config not provided. Please call provideA2UI() in a parent component.");
14
- return E;
15
- }
16
- function isPath(i, E) {
17
- return i === "path" && typeof E == "string";
18
- }
19
- function isObject(i) {
20
- return typeof i == "object" && !!i && !Array.isArray(i);
21
- }
22
- function isComponentArrayReference(i) {
23
- return isObject(i) ? "explicitList" in i || "template" in i : !1;
24
- }
25
- function isStringValue(i) {
26
- return isObject(i) && ("path" in i || "literal" in i && typeof i.literal == "string" || "literalString" in i);
27
- }
28
- function isNumberValue(i) {
29
- return isObject(i) && ("path" in i || "literal" in i && typeof i.literal == "number" || "literalNumber" in i);
30
- }
31
- function isBooleanValue(i) {
32
- return isObject(i) && ("path" in i || "literal" in i && typeof i.literal == "boolean" || "literalBoolean" in i);
33
- }
34
- function isAnyComponentNode(i) {
35
- return !(!isObject(i) || !("id" in i && "type" in i && "properties" in i));
36
- }
37
- function isResolvedAudioPlayer(i) {
38
- return isObject(i) && "url" in i && isStringValue(i.url);
39
- }
40
- function isResolvedButton(i) {
41
- return isObject(i) && "child" in i && isAnyComponentNode(i.child) && "action" in i;
42
- }
43
- function isResolvedCard(i) {
44
- return isObject(i) ? "child" in i ? isAnyComponentNode(i.child) : "children" in i ? Array.isArray(i.children) && i.children.every(isAnyComponentNode) : !1 : !1;
45
- }
46
- function isResolvedCheckbox(i) {
47
- return isObject(i) && "label" in i && isStringValue(i.label) && "value" in i && isBooleanValue(i.value);
48
- }
49
- function isResolvedColumn(i) {
50
- return isObject(i) && "children" in i && Array.isArray(i.children) && i.children.every(isAnyComponentNode);
51
- }
52
- function isResolvedDateTimeInput(i) {
53
- return isObject(i) && "value" in i && isStringValue(i.value);
54
- }
55
- function isResolvedDivider(i) {
56
- return isObject(i);
57
- }
58
- function isResolvedImage(i) {
59
- return isObject(i) && "url" in i && isStringValue(i.url);
60
- }
61
- function isResolvedIcon(i) {
62
- return isObject(i) && "name" in i && isStringValue(i.name);
63
- }
64
- function isResolvedList(i) {
65
- return isObject(i) && "children" in i && Array.isArray(i.children) && i.children.every(isAnyComponentNode);
66
- }
67
- function isResolvedModal(i) {
68
- return isObject(i) && "entryPointChild" in i && isAnyComponentNode(i.entryPointChild) && "contentChild" in i && isAnyComponentNode(i.contentChild);
69
- }
70
- function isResolvedMultipleChoice(i) {
71
- return isObject(i) && "selections" in i;
72
- }
73
- function isResolvedRow(i) {
74
- return isObject(i) && "children" in i && Array.isArray(i.children) && i.children.every(isAnyComponentNode);
75
- }
76
- function isResolvedSlider(i) {
77
- return isObject(i) && "value" in i && isNumberValue(i.value);
78
- }
79
- function isResolvedTabItem(i) {
80
- return isObject(i) && "title" in i && isStringValue(i.title) && "child" in i && isAnyComponentNode(i.child);
81
- }
82
- function isResolvedTabs(i) {
83
- return isObject(i) && "tabItems" in i && Array.isArray(i.tabItems) && i.tabItems.every(isResolvedTabItem);
84
- }
85
- function isResolvedText(i) {
86
- return isObject(i) && "text" in i && isStringValue(i.text);
87
- }
88
- function isResolvedTextField(i) {
89
- return isObject(i) && "label" in i && isStringValue(i.label);
90
- }
91
- function isResolvedVideo(i) {
92
- return isObject(i) && "url" in i && isStringValue(i.url);
93
- }
94
- var A2uiMessageProcessor = class i {
95
- static #e = this.DEFAULT_SURFACE_ID = "@default";
96
- constructor(i = {
97
- mapCtor: Map,
98
- arrayCtor: Array,
99
- setCtor: Set,
100
- objCtor: Object
101
- }) {
102
- this.opts = i, this.mapCtor = Map, this.arrayCtor = Array, this.setCtor = Set, this.objCtor = Object, this.arrayCtor = i.arrayCtor, this.mapCtor = i.mapCtor, this.setCtor = i.setCtor, this.objCtor = i.objCtor, this.surfaces = new i.mapCtor();
103
- }
104
- getSurfaces() {
105
- return this.surfaces;
106
- }
107
- clearSurfaces() {
108
- this.surfaces.clear();
109
- }
110
- processMessages(i) {
111
- for (let E of i) E.beginRendering && this.handleBeginRendering(E.beginRendering, E.beginRendering.surfaceId), E.surfaceUpdate && this.handleSurfaceUpdate(E.surfaceUpdate, E.surfaceUpdate.surfaceId), E.dataModelUpdate && this.handleDataModelUpdate(E.dataModelUpdate, E.dataModelUpdate.surfaceId), E.deleteSurface && this.handleDeleteSurface(E.deleteSurface);
112
- }
113
- getData(E, D, O = i.DEFAULT_SURFACE_ID) {
114
- let k = this.getOrCreateSurface(O);
115
- if (!k) return null;
116
- let A;
117
- return A = D === "." || D === "" ? E.dataContextPath ?? "/" : this.resolvePath(D, E.dataContextPath), this.getDataByPath(k.dataModel, A);
118
- }
119
- setData(E, D, O, k = i.DEFAULT_SURFACE_ID) {
120
- if (!E) {
121
- console.warn("No component node set");
122
- return;
123
- }
124
- let A = this.getOrCreateSurface(k);
125
- if (!A) return;
126
- let j;
127
- j = D === "." || D === "" ? E.dataContextPath ?? "/" : this.resolvePath(D, E.dataContextPath), this.setDataByPath(A.dataModel, j, O);
128
- }
129
- resolvePath(i, E) {
130
- return i.startsWith("/") ? i : E && E !== "/" ? E.endsWith("/") ? `${E}${i}` : `${E}/${i}` : `/${i}`;
131
- }
132
- parseIfJsonString(i) {
133
- if (typeof i != "string") return i;
134
- let E = i.trim();
135
- if (E.startsWith("{") && E.endsWith("}") || E.startsWith("[") && E.endsWith("]")) try {
136
- return JSON.parse(i);
137
- } catch (E) {
138
- return console.warn(`Failed to parse potential JSON string: "${i.substring(0, 50)}..."`, E), i;
139
- }
140
- return i;
141
- }
142
- convertKeyValueArrayToMap(i) {
143
- let E = new this.mapCtor();
144
- for (let D of i) {
145
- if (!isObject(D) || !("key" in D)) continue;
146
- let i = D.key, O = this.findValueKey(D);
147
- if (!O) continue;
148
- let k = D[O];
149
- O === "valueMap" && Array.isArray(k) ? k = this.convertKeyValueArrayToMap(k) : typeof k == "string" && (k = this.parseIfJsonString(k)), this.setDataByPath(E, i, k);
150
- }
151
- return E;
152
- }
153
- setDataByPath(i, E, D) {
154
- if (Array.isArray(D) && (D.length === 0 || isObject(D[0]) && "key" in D[0])) if (D.length === 1 && isObject(D[0]) && D[0].key === ".") {
155
- let i = D[0], E = this.findValueKey(i);
156
- E ? (D = i[E], E === "valueMap" && Array.isArray(D) ? D = this.convertKeyValueArrayToMap(D) : typeof D == "string" && (D = this.parseIfJsonString(D))) : D = this.convertKeyValueArrayToMap(D);
157
- } else D = this.convertKeyValueArrayToMap(D);
158
- let O = this.normalizePath(E).split("/").filter((i) => i);
159
- if (O.length === 0) {
160
- if (D instanceof Map || isObject(D)) {
161
- !(D instanceof Map) && isObject(D) && (D = new this.mapCtor(Object.entries(D))), i.clear();
162
- for (let [E, O] of D.entries()) i.set(E, O);
163
- } else console.error("Cannot set root of DataModel to a non-Map value.");
164
- return;
165
- }
166
- let k = i;
167
- for (let i = 0; i < O.length - 1; i++) {
168
- let E = O[i], D;
169
- k instanceof Map ? D = k.get(E) : Array.isArray(k) && /^\d+$/.test(E) && (D = k[parseInt(E, 10)]), (D === void 0 || typeof D != "object" || !D) && (D = new this.mapCtor(), k instanceof this.mapCtor ? k.set(E, D) : Array.isArray(k) && (k[parseInt(E, 10)] = D)), k = D;
170
- }
171
- let A = O[O.length - 1], j = D;
172
- k instanceof this.mapCtor ? k.set(A, j) : Array.isArray(k) && /^\d+$/.test(A) && (k[parseInt(A, 10)] = j);
173
- }
174
- normalizePath(i) {
175
- return "/" + i.replace(/\[(\d+)\]/g, ".$1").split(".").filter((i) => i.length > 0).join("/");
176
- }
177
- getDataByPath(i, E) {
178
- let D = this.normalizePath(E).split("/").filter((i) => i), O = i;
179
- for (let i of D) {
180
- if (O == null) return null;
181
- if (O instanceof Map) O = O.get(i);
182
- else if (Array.isArray(O) && /^\d+$/.test(i)) O = O[parseInt(i, 10)];
183
- else if (isObject(O)) O = O[i];
184
- else return null;
185
- }
186
- return O;
187
- }
188
- getOrCreateSurface(i) {
189
- let E = this.surfaces.get(i);
190
- return E || (E = new this.objCtor({
191
- rootComponentId: null,
192
- componentTree: null,
193
- dataModel: new this.mapCtor(),
194
- components: new this.mapCtor(),
195
- styles: new this.objCtor()
196
- }), this.surfaces.set(i, E)), E;
197
- }
198
- handleBeginRendering(i, E) {
199
- let D = this.getOrCreateSurface(E);
200
- D.rootComponentId = i.root, D.styles = i.styles ?? {}, this.rebuildComponentTree(D);
201
- }
202
- handleSurfaceUpdate(i, E) {
203
- let D = this.getOrCreateSurface(E);
204
- for (let E of i.components) D.components.set(E.id, E);
205
- this.rebuildComponentTree(D);
206
- }
207
- handleDataModelUpdate(i, E) {
208
- let D = this.getOrCreateSurface(E), O = i.path ?? "/";
209
- this.setDataByPath(D.dataModel, O, i.contents), this.rebuildComponentTree(D);
210
- }
211
- handleDeleteSurface(i) {
212
- this.surfaces.delete(i.surfaceId);
213
- }
214
- rebuildComponentTree(i) {
215
- if (!i.rootComponentId) {
216
- i.componentTree = null;
217
- return;
218
- }
219
- let E = new this.setCtor();
220
- i.componentTree = this.buildNodeRecursive(i.rootComponentId, i, E, "/", "");
221
- }
222
- findValueKey(i) {
223
- return Object.keys(i).find((i) => i.startsWith("value"));
224
- }
225
- buildNodeRecursive(i, E, D, O, k = "") {
226
- let A = `${i}${k}`, { components: j } = E;
227
- if (!j.has(i)) return null;
228
- if (D.has(A)) throw Error(`Circular dependency for component "${A}".`);
229
- D.add(A);
230
- let M = j.get(i), P = M.component ?? {}, F = Object.keys(P)[0], I = P[F], L = new this.objCtor();
231
- if (isObject(I)) for (let [i, A] of Object.entries(I)) L[i] = this.resolvePropertyValue(A, E, D, O, k);
232
- D.delete(A);
233
- let R = {
234
- id: A,
235
- dataContextPath: O,
236
- weight: M.weight ?? "initial"
237
- };
238
- switch (F) {
239
- case "Text":
240
- if (!isResolvedText(L)) throw Error(`Invalid data; expected ${F}`);
241
- return new this.objCtor({
242
- ...R,
243
- type: "Text",
244
- properties: L
245
- });
246
- case "Image":
247
- if (!isResolvedImage(L)) throw Error(`Invalid data; expected ${F}`);
248
- return new this.objCtor({
249
- ...R,
250
- type: "Image",
251
- properties: L
252
- });
253
- case "Icon":
254
- if (!isResolvedIcon(L)) throw Error(`Invalid data; expected ${F}`);
255
- return new this.objCtor({
256
- ...R,
257
- type: "Icon",
258
- properties: L
259
- });
260
- case "Video":
261
- if (!isResolvedVideo(L)) throw Error(`Invalid data; expected ${F}`);
262
- return new this.objCtor({
263
- ...R,
264
- type: "Video",
265
- properties: L
266
- });
267
- case "AudioPlayer":
268
- if (!isResolvedAudioPlayer(L)) throw Error(`Invalid data; expected ${F}`);
269
- return new this.objCtor({
270
- ...R,
271
- type: "AudioPlayer",
272
- properties: L
273
- });
274
- case "Row":
275
- if (!isResolvedRow(L)) throw Error(`Invalid data; expected ${F}`);
276
- return new this.objCtor({
277
- ...R,
278
- type: "Row",
279
- properties: L
280
- });
281
- case "Column":
282
- if (!isResolvedColumn(L)) throw Error(`Invalid data; expected ${F}`);
283
- return new this.objCtor({
284
- ...R,
285
- type: "Column",
286
- properties: L
287
- });
288
- case "List":
289
- if (!isResolvedList(L)) throw Error(`Invalid data; expected ${F}`);
290
- return new this.objCtor({
291
- ...R,
292
- type: "List",
293
- properties: L
294
- });
295
- case "Card":
296
- if (!isResolvedCard(L)) throw Error(`Invalid data; expected ${F}`);
297
- return new this.objCtor({
298
- ...R,
299
- type: "Card",
300
- properties: L
301
- });
302
- case "Tabs":
303
- if (!isResolvedTabs(L)) throw Error(`Invalid data; expected ${F}`);
304
- return new this.objCtor({
305
- ...R,
306
- type: "Tabs",
307
- properties: L
308
- });
309
- case "Divider":
310
- if (!isResolvedDivider(L)) throw Error(`Invalid data; expected ${F}`);
311
- return new this.objCtor({
312
- ...R,
313
- type: "Divider",
314
- properties: L
315
- });
316
- case "Modal":
317
- if (!isResolvedModal(L)) throw Error(`Invalid data; expected ${F}`);
318
- return new this.objCtor({
319
- ...R,
320
- type: "Modal",
321
- properties: L
322
- });
323
- case "Button":
324
- if (!isResolvedButton(L)) throw Error(`Invalid data; expected ${F}`);
325
- return new this.objCtor({
326
- ...R,
327
- type: "Button",
328
- properties: L
329
- });
330
- case "CheckBox":
331
- if (!isResolvedCheckbox(L)) throw Error(`Invalid data; expected ${F}`);
332
- return new this.objCtor({
333
- ...R,
334
- type: "CheckBox",
335
- properties: L
336
- });
337
- case "TextField":
338
- if (!isResolvedTextField(L)) throw Error(`Invalid data; expected ${F}`);
339
- return new this.objCtor({
340
- ...R,
341
- type: "TextField",
342
- properties: L
343
- });
344
- case "DateTimeInput":
345
- if (!isResolvedDateTimeInput(L)) throw Error(`Invalid data; expected ${F}`);
346
- return new this.objCtor({
347
- ...R,
348
- type: "DateTimeInput",
349
- properties: L
350
- });
351
- case "MultipleChoice":
352
- if (!isResolvedMultipleChoice(L)) throw Error(`Invalid data; expected ${F}`);
353
- return new this.objCtor({
354
- ...R,
355
- type: "MultipleChoice",
356
- properties: L
357
- });
358
- case "Slider":
359
- if (!isResolvedSlider(L)) throw Error(`Invalid data; expected ${F}`);
360
- return new this.objCtor({
361
- ...R,
362
- type: "Slider",
363
- properties: L
364
- });
365
- default: return new this.objCtor({
366
- ...R,
367
- type: F,
368
- properties: L
369
- });
370
- }
371
- }
372
- resolvePropertyValue(i, E, D, O, k = "") {
373
- if (typeof i == "string" && E.components.has(i)) return this.buildNodeRecursive(i, E, D, O, k);
374
- if (isComponentArrayReference(i)) {
375
- if (i.explicitList) return i.explicitList.map((i) => this.buildNodeRecursive(i, E, D, O, k));
376
- if (i.template) {
377
- let k = this.resolvePath(i.template.dataBinding, O), A = this.getDataByPath(E.dataModel, k), j = i.template;
378
- return Array.isArray(A) ? A.map((i, A) => {
379
- let M = `:${[...O.split("/").filter((i) => /^\d+$/.test(i)), A].join(":")}`, N = `${k}/${A}`;
380
- return this.buildNodeRecursive(j.componentId, E, D, N, M);
381
- }) : A instanceof this.mapCtor ? Array.from(A.keys(), (i) => {
382
- let O = `:${i}`, A = `${k}/${i}`;
383
- return this.buildNodeRecursive(j.componentId, E, D, A, O);
384
- }) : new this.arrayCtor();
385
- }
386
- }
387
- if (Array.isArray(i)) return i.map((i) => this.resolvePropertyValue(i, E, D, O, k));
388
- if (isObject(i)) {
389
- let A = new this.objCtor();
390
- for (let [j, N] of Object.entries(i)) {
391
- let i = N;
392
- if (isPath(j, N) && O !== "/") {
393
- i = N.replace(/^\.?\/item/, "").replace(/^\.?\/text/, "").replace(/^\.?\/label/, "").replace(/^\.?\//, ""), A[j] = i;
394
- continue;
395
- }
396
- A[j] = this.resolvePropertyValue(i, E, D, O, k);
397
- }
398
- return A;
399
- }
400
- return i;
401
- }
402
- }, MessageProcessor = class extends A2uiMessageProcessor {
403
- constructor() {
404
- super(), this.eventHandlers = /* @__PURE__ */ new Set();
405
- }
406
- setData(i, E, D, O) {
407
- return super.setData(i, E, D, O ?? void 0);
408
- }
409
- dispatch(i) {
410
- return new Promise((E, D) => {
411
- let O = {
412
- message: i,
413
- resolve: E,
414
- reject: D
415
- };
416
- this.eventHandlers.forEach((i) => i(O));
417
- });
418
- }
419
- onEvent(i) {
420
- return this.eventHandlers.add(i), () => this.eventHandlers.delete(i);
421
- }
422
- };
423
- const MESSAGE_PROCESSOR_KEY = Symbol("message-processor");
424
- function useMessageProcessor() {
425
- let O = inject(MESSAGE_PROCESSOR_KEY, null);
426
- return O || (O = reactive(new MessageProcessor()), provide(MESSAGE_PROCESSOR_KEY, O)), O;
427
- }
428
- var idCounter = 0;
429
- function useDynamicComponent(i) {
430
- let { theme: E } = useA2UIConfig(), D = useMessageProcessor();
431
- function O(E) {
432
- let O = i.component, k = i.surfaceId ?? void 0, A = {};
433
- if (E.context) {
434
- for (let i of E.context) if (i.value.literalBoolean !== void 0) A[i.key] = i.value.literalBoolean;
435
- else if (i.value.literalNumber !== void 0) A[i.key] = i.value.literalNumber;
436
- else if (i.value.literalString !== void 0) A[i.key] = i.value.literalString;
437
- else if (i.value.path) {
438
- let E = D.resolvePath(i.value.path, O.dataContextPath), j = D.getData(O, E, k);
439
- A[i.key] = j;
440
- }
441
- }
442
- let j = { userAction: {
443
- name: E.name,
444
- sourceComponentId: O.id,
445
- surfaceId: k,
446
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
447
- context: A
448
- } };
449
- return D.dispatch(j);
450
- }
451
- function k(E) {
452
- let O = i.component, k = i.surfaceId;
453
- return !E || typeof E != "object" ? null : E.literal == null ? E.path ? D.getData(O, E.path, k ?? void 0) : "literalString" in E ? E.literalString ?? null : "literalNumber" in E ? E.literalNumber ?? null : "literalBoolean" in E ? E.literalBoolean ?? null : null : E.literal;
454
- }
455
- function A(i) {
456
- return `${i}-${idCounter++}`;
457
- }
458
- function M(i, E, O, k) {
459
- D.setData(i, E, O, k);
460
- }
461
- return {
462
- theme: E,
463
- processor: D,
464
- sendAction: O,
465
- resolvePrimitive: k,
466
- getUniqueId: A,
467
- setData: M
468
- };
469
- }
470
- export { useA2UIConfig as a, provideA2UI as i, MessageProcessor as n, __plugin_vue_export_helper_default as o, useMessageProcessor as r, useDynamicComponent as t };
@@ -1 +0,0 @@
1
- const e=require(`./zxq-com.cjs`);let t=require(`vue`);var n=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};const r=Symbol(`a2ui-config`);function i(e){(0,t.provide)(r,e)}function a(){let e=(0,t.inject)(r);if(!e)throw Error(`A2UI config not provided. Please call provideA2UI() in a parent component.`);return e}function o(e,t){return e===`path`&&typeof t==`string`}function s(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function c(e){return s(e)?`explicitList`in e||`template`in e:!1}function l(e){return s(e)&&(`path`in e||`literal`in e&&typeof e.literal==`string`||`literalString`in e)}function u(e){return s(e)&&(`path`in e||`literal`in e&&typeof e.literal==`number`||`literalNumber`in e)}function d(e){return s(e)&&(`path`in e||`literal`in e&&typeof e.literal==`boolean`||`literalBoolean`in e)}function f(e){return!(!s(e)||!(`id`in e&&`type`in e&&`properties`in e))}function p(e){return s(e)&&`url`in e&&l(e.url)}function m(e){return s(e)&&`child`in e&&f(e.child)&&`action`in e}function h(e){return s(e)?`child`in e?f(e.child):`children`in e?Array.isArray(e.children)&&e.children.every(f):!1:!1}function g(e){return s(e)&&`label`in e&&l(e.label)&&`value`in e&&d(e.value)}function _(e){return s(e)&&`children`in e&&Array.isArray(e.children)&&e.children.every(f)}function v(e){return s(e)&&`value`in e&&l(e.value)}function y(e){return s(e)}function b(e){return s(e)&&`url`in e&&l(e.url)}function x(e){return s(e)&&`name`in e&&l(e.name)}function S(e){return s(e)&&`children`in e&&Array.isArray(e.children)&&e.children.every(f)}function C(e){return s(e)&&`entryPointChild`in e&&f(e.entryPointChild)&&`contentChild`in e&&f(e.contentChild)}function w(e){return s(e)&&`selections`in e}function T(e){return s(e)&&`children`in e&&Array.isArray(e.children)&&e.children.every(f)}function E(e){return s(e)&&`value`in e&&u(e.value)}function D(e){return s(e)&&`title`in e&&l(e.title)&&`child`in e&&f(e.child)}function O(e){return s(e)&&`tabItems`in e&&Array.isArray(e.tabItems)&&e.tabItems.every(D)}function k(e){return s(e)&&`text`in e&&l(e.text)}function A(e){return s(e)&&`label`in e&&l(e.label)}function j(e){return s(e)&&`url`in e&&l(e.url)}var M=class e{static#e=this.DEFAULT_SURFACE_ID=`@default`;constructor(e={mapCtor:Map,arrayCtor:Array,setCtor:Set,objCtor:Object}){this.opts=e,this.mapCtor=Map,this.arrayCtor=Array,this.setCtor=Set,this.objCtor=Object,this.arrayCtor=e.arrayCtor,this.mapCtor=e.mapCtor,this.setCtor=e.setCtor,this.objCtor=e.objCtor,this.surfaces=new e.mapCtor}getSurfaces(){return this.surfaces}clearSurfaces(){this.surfaces.clear()}processMessages(e){for(let t of e)t.beginRendering&&this.handleBeginRendering(t.beginRendering,t.beginRendering.surfaceId),t.surfaceUpdate&&this.handleSurfaceUpdate(t.surfaceUpdate,t.surfaceUpdate.surfaceId),t.dataModelUpdate&&this.handleDataModelUpdate(t.dataModelUpdate,t.dataModelUpdate.surfaceId),t.deleteSurface&&this.handleDeleteSurface(t.deleteSurface)}getData(t,n,r=e.DEFAULT_SURFACE_ID){let i=this.getOrCreateSurface(r);if(!i)return null;let a;return a=n===`.`||n===``?t.dataContextPath??`/`:this.resolvePath(n,t.dataContextPath),this.getDataByPath(i.dataModel,a)}setData(t,n,r,i=e.DEFAULT_SURFACE_ID){if(!t){console.warn(`No component node set`);return}let a=this.getOrCreateSurface(i);if(!a)return;let o;o=n===`.`||n===``?t.dataContextPath??`/`:this.resolvePath(n,t.dataContextPath),this.setDataByPath(a.dataModel,o,r)}resolvePath(e,t){return e.startsWith(`/`)?e:t&&t!==`/`?t.endsWith(`/`)?`${t}${e}`:`${t}/${e}`:`/${e}`}parseIfJsonString(e){if(typeof e!=`string`)return e;let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`)||t.startsWith(`[`)&&t.endsWith(`]`))try{return JSON.parse(e)}catch(t){return console.warn(`Failed to parse potential JSON string: "${e.substring(0,50)}..."`,t),e}return e}convertKeyValueArrayToMap(e){let t=new this.mapCtor;for(let n of e){if(!s(n)||!(`key`in n))continue;let e=n.key,r=this.findValueKey(n);if(!r)continue;let i=n[r];r===`valueMap`&&Array.isArray(i)?i=this.convertKeyValueArrayToMap(i):typeof i==`string`&&(i=this.parseIfJsonString(i)),this.setDataByPath(t,e,i)}return t}setDataByPath(e,t,n){if(Array.isArray(n)&&(n.length===0||s(n[0])&&`key`in n[0]))if(n.length===1&&s(n[0])&&n[0].key===`.`){let e=n[0],t=this.findValueKey(e);t?(n=e[t],t===`valueMap`&&Array.isArray(n)?n=this.convertKeyValueArrayToMap(n):typeof n==`string`&&(n=this.parseIfJsonString(n))):n=this.convertKeyValueArrayToMap(n)}else n=this.convertKeyValueArrayToMap(n);let r=this.normalizePath(t).split(`/`).filter(e=>e);if(r.length===0){if(n instanceof Map||s(n)){!(n instanceof Map)&&s(n)&&(n=new this.mapCtor(Object.entries(n))),e.clear();for(let[t,r]of n.entries())e.set(t,r)}else console.error(`Cannot set root of DataModel to a non-Map value.`);return}let i=e;for(let e=0;e<r.length-1;e++){let t=r[e],n;i instanceof Map?n=i.get(t):Array.isArray(i)&&/^\d+$/.test(t)&&(n=i[parseInt(t,10)]),(n===void 0||typeof n!=`object`||!n)&&(n=new this.mapCtor,i instanceof this.mapCtor?i.set(t,n):Array.isArray(i)&&(i[parseInt(t,10)]=n)),i=n}let a=r[r.length-1],o=n;i instanceof this.mapCtor?i.set(a,o):Array.isArray(i)&&/^\d+$/.test(a)&&(i[parseInt(a,10)]=o)}normalizePath(e){return`/`+e.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(e=>e.length>0).join(`/`)}getDataByPath(e,t){let n=this.normalizePath(t).split(`/`).filter(e=>e),r=e;for(let e of n){if(r==null)return null;if(r instanceof Map)r=r.get(e);else if(Array.isArray(r)&&/^\d+$/.test(e))r=r[parseInt(e,10)];else if(s(r))r=r[e];else return null}return r}getOrCreateSurface(e){let t=this.surfaces.get(e);return t||(t=new this.objCtor({rootComponentId:null,componentTree:null,dataModel:new this.mapCtor,components:new this.mapCtor,styles:new this.objCtor}),this.surfaces.set(e,t)),t}handleBeginRendering(e,t){let n=this.getOrCreateSurface(t);n.rootComponentId=e.root,n.styles=e.styles??{},this.rebuildComponentTree(n)}handleSurfaceUpdate(e,t){let n=this.getOrCreateSurface(t);for(let t of e.components)n.components.set(t.id,t);this.rebuildComponentTree(n)}handleDataModelUpdate(e,t){let n=this.getOrCreateSurface(t),r=e.path??`/`;this.setDataByPath(n.dataModel,r,e.contents),this.rebuildComponentTree(n)}handleDeleteSurface(e){this.surfaces.delete(e.surfaceId)}rebuildComponentTree(e){if(!e.rootComponentId){e.componentTree=null;return}let t=new this.setCtor;e.componentTree=this.buildNodeRecursive(e.rootComponentId,e,t,`/`,``)}findValueKey(e){return Object.keys(e).find(e=>e.startsWith(`value`))}buildNodeRecursive(e,t,n,r,i=``){let a=`${e}${i}`,{components:o}=t;if(!o.has(e))return null;if(n.has(a))throw Error(`Circular dependency for component "${a}".`);n.add(a);let c=o.get(e),l=c.component??{},u=Object.keys(l)[0],d=l[u],f=new this.objCtor;if(s(d))for(let[e,a]of Object.entries(d))f[e]=this.resolvePropertyValue(a,t,n,r,i);n.delete(a);let D={id:a,dataContextPath:r,weight:c.weight??`initial`};switch(u){case`Text`:if(!k(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Text`,properties:f});case`Image`:if(!b(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Image`,properties:f});case`Icon`:if(!x(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Icon`,properties:f});case`Video`:if(!j(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Video`,properties:f});case`AudioPlayer`:if(!p(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`AudioPlayer`,properties:f});case`Row`:if(!T(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Row`,properties:f});case`Column`:if(!_(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Column`,properties:f});case`List`:if(!S(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`List`,properties:f});case`Card`:if(!h(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Card`,properties:f});case`Tabs`:if(!O(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Tabs`,properties:f});case`Divider`:if(!y(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Divider`,properties:f});case`Modal`:if(!C(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Modal`,properties:f});case`Button`:if(!m(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Button`,properties:f});case`CheckBox`:if(!g(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`CheckBox`,properties:f});case`TextField`:if(!A(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`TextField`,properties:f});case`DateTimeInput`:if(!v(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`DateTimeInput`,properties:f});case`MultipleChoice`:if(!w(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`MultipleChoice`,properties:f});case`Slider`:if(!E(f))throw Error(`Invalid data; expected ${u}`);return new this.objCtor({...D,type:`Slider`,properties:f});default:return new this.objCtor({...D,type:u,properties:f})}}resolvePropertyValue(e,t,n,r,i=``){if(typeof e==`string`&&t.components.has(e))return this.buildNodeRecursive(e,t,n,r,i);if(c(e)){if(e.explicitList)return e.explicitList.map(e=>this.buildNodeRecursive(e,t,n,r,i));if(e.template){let i=this.resolvePath(e.template.dataBinding,r),a=this.getDataByPath(t.dataModel,i),o=e.template;return Array.isArray(a)?a.map((e,a)=>{let s=`:${[...r.split(`/`).filter(e=>/^\d+$/.test(e)),a].join(`:`)}`,c=`${i}/${a}`;return this.buildNodeRecursive(o.componentId,t,n,c,s)}):a instanceof this.mapCtor?Array.from(a.keys(),e=>{let r=`:${e}`,a=`${i}/${e}`;return this.buildNodeRecursive(o.componentId,t,n,a,r)}):new this.arrayCtor}}if(Array.isArray(e))return e.map(e=>this.resolvePropertyValue(e,t,n,r,i));if(s(e)){let a=new this.objCtor;for(let[s,c]of Object.entries(e)){let e=c;if(o(s,c)&&r!==`/`){e=c.replace(/^\.?\/item/,``).replace(/^\.?\/text/,``).replace(/^\.?\/label/,``).replace(/^\.?\//,``),a[s]=e;continue}a[s]=this.resolvePropertyValue(e,t,n,r,i)}return a}return e}},N=class extends M{constructor(){super(),this.eventHandlers=new Set}setData(e,t,n,r){return super.setData(e,t,n,r??void 0)}dispatch(e){return new Promise((t,n)=>{let r={message:e,resolve:t,reject:n};this.eventHandlers.forEach(e=>e(r))})}onEvent(e){return this.eventHandlers.add(e),()=>this.eventHandlers.delete(e)}};const P=Symbol(`message-processor`);function F(){let e=(0,t.inject)(P,null);return e||(e=(0,t.reactive)(new N),(0,t.provide)(P,e)),e}var I=0;function L(e){let{theme:t}=a(),n=F();function r(t){let r=e.component,i=e.surfaceId??void 0,a={};if(t.context){for(let e of t.context)if(e.value.literalBoolean!==void 0)a[e.key]=e.value.literalBoolean;else if(e.value.literalNumber!==void 0)a[e.key]=e.value.literalNumber;else if(e.value.literalString!==void 0)a[e.key]=e.value.literalString;else if(e.value.path){let t=n.resolvePath(e.value.path,r.dataContextPath),o=n.getData(r,t,i);a[e.key]=o}}let o={userAction:{name:t.name,sourceComponentId:r.id,surfaceId:i,timestamp:new Date().toISOString(),context:a}};return n.dispatch(o)}function i(t){let r=e.component,i=e.surfaceId;return!t||typeof t!=`object`?null:t.literal==null?t.path?n.getData(r,t.path,i??void 0):`literalString`in t?t.literalString??null:`literalNumber`in t?t.literalNumber??null:`literalBoolean`in t?t.literalBoolean??null:null:t.literal}function o(e){return`${e}-${I++}`}function s(e,t,r,i){n.setData(e,t,r,i)}return{theme:t,processor:n,sendAction:r,resolvePrimitive:i,getUniqueId:o,setData:s}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return L}});
@@ -1,109 +0,0 @@
1
- import { onBeforeUnmount, ref, watch } from "vue";
2
- import { useWebSocket } from "@vueuse/core";
3
- function getUUID(e = "") {
4
- return e + (crypto?.randomUUID?.() || `${Date.now()}_${Math.random().toString(16).slice(2)}`);
5
- }
6
- function getCookie(e) {
7
- let m = document.cookie.match(/* @__PURE__ */ RegExp("(^| )" + e + "=([^;]+)"));
8
- return log("getCookie", e, m), console.log("getCookie", e, m), m ? m[2] : null;
9
- }
10
- function isDevelopment() {
11
- return typeof process < "u" && process?.env && typeof process.env.NODE_ENV == "string" ? process.env.NODE_ENV === "development" : typeof __DEV__ < "u" ? typeof __DEV__ == "boolean" ? __DEV__ : !1 : !!(typeof window < "u" && window.__VUE_DEVTOOLS_GLOBAL_HOOK__);
12
- }
13
- var wsConfig = {};
14
- function log(...e) {
15
- (isDevelopment() || wsConfig.debug) && console.log("【zxqWs】", ...e);
16
- }
17
- const EVENT_TYPE = {
18
- CLIENT_NAME: "__client-name",
19
- DEV1: "dev-1",
20
- DEV2: "dev-2"
21
- };
22
- var initialized = !1, urlRef = ref(), { status, data, send, close, open } = useWebSocket(urlRef, {
23
- immediate: !1,
24
- autoConnect: !1,
25
- heartbeat: {
26
- message: "ping",
27
- interval: 5e3,
28
- pongTimeout: 15e3
29
- },
30
- autoReconnect: {
31
- retries: 3,
32
- delay: 1e4,
33
- onFailed() {
34
- console.error("超过重连次数");
35
- }
36
- }
37
- });
38
- function sendMsg(e) {
39
- e.clientId = getCookie("zxq_app_client_id") || "dev", send(JSON.stringify(e));
40
- }
41
- const ws = {
42
- sendMsg,
43
- close,
44
- status
45
- };
46
- var subscribeMap = /* @__PURE__ */ new Map();
47
- function zwqWs(e, m) {
48
- initialized || (initialized = !0, Object.assign(wsConfig, m), urlRef.value = m.url, open(), watch(status, (e) => {
49
- log("ws status", e), e === "OPEN" && sendMsg({
50
- event: EVENT_TYPE.CLIENT_NAME,
51
- payload: { name: m.name }
52
- });
53
- }), watch(data, (e) => {
54
- if (e !== "pong") try {
55
- let { sourceIp: h, event: g, payload: _ } = JSON.parse(e);
56
- if (m?.trustIp && h !== m.trustIp) return;
57
- let v = subscribeMap.get(g);
58
- v && v.forEach(({ fn: e, off: m }) => {
59
- e(_), m && m();
60
- });
61
- } catch (e) {
62
- console.error("ws 数据格式有误", e);
63
- }
64
- }));
65
- }
66
- function useWs(m, h) {
67
- h && zwqWs(null, h), status.value === "CLOSED" && urlRef.value && !initialized && open();
68
- let g = getUUID();
69
- function v(e) {
70
- let h = subscribeMap.get(m);
71
- if (h) h.set(g, { fn: e });
72
- else {
73
- let h = (/* @__PURE__ */ new Map()).set(g, { fn: e });
74
- subscribeMap.set(m, h);
75
- }
76
- }
77
- function y() {
78
- let e = subscribeMap.get(m);
79
- e && e.has(g) && (e.delete(g), e.size === 0 && subscribeMap.delete(m));
80
- }
81
- function b(e) {
82
- log("ws once");
83
- let h = subscribeMap.get(m);
84
- if (h) h.set(g, {
85
- fn: e,
86
- off: y
87
- });
88
- else {
89
- let h = (/* @__PURE__ */ new Map()).set(g, {
90
- fn: e,
91
- off: y
92
- });
93
- subscribeMap.set(m, h);
94
- }
95
- }
96
- onBeforeUnmount(() => {
97
- y();
98
- });
99
- function x(e) {
100
- sendMsg(e);
101
- }
102
- return {
103
- on: v,
104
- off: y,
105
- once: b,
106
- emit: x
107
- };
108
- }
109
- export { zwqWs as a, ws as i, log as n, useWs as r, EVENT_TYPE as t };
@@ -1 +0,0 @@
1
- const e=require(`./zxq-com.cjs`);let t=require(`vue`),n=require(`@vueuse/core`);function r(e=``){return e+(crypto?.randomUUID?.()||`${Date.now()}_${Math.random().toString(16).slice(2)}`)}function i(e){let t=document.cookie.match(RegExp(`(^| )`+e+`=([^;]+)`));return s(`getCookie`,e,t),console.log(`getCookie`,e,t),t?t[2]:null}function a(){return typeof process<`u`&&process?.env&&typeof process.env.NODE_ENV==`string`?process.env.NODE_ENV===`development`:typeof __DEV__<`u`?typeof __DEV__==`boolean`?__DEV__:!1:!!(typeof window<`u`&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__)}var o={};function s(...e){(a()||o.debug)&&console.log(`【zxqWs】`,...e)}const c={CLIENT_NAME:`__client-name`,DEV1:`dev-1`,DEV2:`dev-2`};var l=!1,u=(0,t.ref)(),{status:d,data:f,send:p,close:m,open:h}=(0,n.useWebSocket)(u,{immediate:!1,autoConnect:!1,heartbeat:{message:`ping`,interval:5e3,pongTimeout:15e3},autoReconnect:{retries:3,delay:1e4,onFailed(){console.error(`超过重连次数`)}}});function g(e){e.clientId=i(`zxq_app_client_id`)||`dev`,p(JSON.stringify(e))}const _={sendMsg:g,close:m,status:d};var v=new Map;function y(e,n){l||(l=!0,Object.assign(o,n),u.value=n.url,h(),(0,t.watch)(d,e=>{s(`ws status`,e),e===`OPEN`&&g({event:c.CLIENT_NAME,payload:{name:n.name}})}),(0,t.watch)(f,e=>{if(e!==`pong`)try{let{sourceIp:t,event:r,payload:i}=JSON.parse(e);if(n?.trustIp&&t!==n.trustIp)return;let a=v.get(r);a&&a.forEach(({fn:e,off:t})=>{e(i),t&&t()})}catch(e){console.error(`ws 数据格式有误`,e)}}))}function b(e,n){n&&y(null,n),d.value===`CLOSED`&&u.value&&!l&&h();let i=r();function a(t){let n=v.get(e);if(n)n.set(i,{fn:t});else{let n=new Map().set(i,{fn:t});v.set(e,n)}}function o(){let t=v.get(e);t&&t.has(i)&&(t.delete(i),t.size===0&&v.delete(e))}function c(t){s(`ws once`);let n=v.get(e);if(n)n.set(i,{fn:t,off:o});else{let n=new Map().set(i,{fn:t,off:o});v.set(e,n)}}(0,t.onBeforeUnmount)(()=>{o()});function f(e){g(e)}return{on:a,off:o,once:c,emit:f}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}});