buzzcasting-utils 1.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Hywax
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # BuzzCasting Storage
2
+
3
+ This is a wrapper class to use multiple storage options with BuzzCasting.
4
+
5
+ BuzzCasting Social Media Wall & Dataviz [More info](https://www.touchflows.com/services-buzzcasting-social-media-wall/).
6
+
7
+ Currently supported are: Local Storage, Session Storage, IDB Keyval, Dexie, Window object
8
+
9
+ ## Features
10
+
11
+ - ✨ Fully customized [eslint](https://eslint.org/) configuration based on the config by [Antfu](https://github.com/antfu/eslint-config)
12
+ - πŸ§ͺ Write tests quickly and conveniently with [vitest](https://vitest.dev/)
13
+ - 🀝 Supports [conventional commits](https://www.conventionalcommits.org/)
14
+ - πŸ’… Generate beautiful changelogs with [changelogen](https://github.com/unjs/changelogen)
15
+ - ♾️ GitHub CI for your build
16
+ - πŸ€– Ready configuration for [renovatebot](https://github.com/apps/renovate) with [renovate-config](https://github.com/hywax/renovate-config)
17
+ - πŸš€ Library releases with just one command
18
+
19
+ ## Get started
20
+
21
+ Example call:
22
+
23
+ ```ts
24
+ import BuzzcastingStorageManager, {
25
+ IMessages,
26
+ IQuery,
27
+ IStorageManager,
28
+ } from 'buzzcasting-storage'
29
+
30
+ const options: IStorageManager = {
31
+ app: 'my-subdomain',
32
+ version: 'v4',
33
+ token: 'meta',
34
+ bearer: 'bearer_token',
35
+ storage: 'dexie',
36
+ moderation: 'none',
37
+ beforeTime: null,
38
+ delay: 0,
39
+ period: 0,
40
+ }
41
+
42
+ const storageManager = new BuzzcastingStorageManager(options)
43
+
44
+ const query: IQuery = {
45
+ type: 'messages',
46
+ dashboard: 'dashboard_id',
47
+ widget: 'widget_id',
48
+ }
49
+
50
+ const data: IMessages = storageManager.getMessages(query)
51
+ ```
52
+
53
+ This will initiate a call to the buzzcasting backoffice to retrieve results
54
+
55
+ The Storage Manager will carry out the API call for the subscriber, and send out a BroadcastChannel on `app` to inform the subcriber that it can retrieve new data. The broadcast channel facilitates its incorporation in for example a Web Worker.
56
+
57
+ ```ts
58
+ const broadcastChannel = new BroadcastChannel('my-subdomain')
59
+
60
+ broadcastChannel.onmessage = (messageEvent: MessageEvent) => {
61
+ this.actions(messageEvent)
62
+ }
63
+
64
+ actions = (messageEvent: MessageEvent) => {
65
+ switch (messageEvent.data.event) {
66
+ case 'widget-update':
67
+ // handle update
68
+ this.widgetUpdated.emit(messageEvent.data.data)
69
+ break
70
+ default:
71
+ // console.log('[storage]', messageEvent.data)
72
+ }
73
+ }
74
+ ```
75
+
76
+ ### Git Clone
77
+
78
+ ```shell
79
+ git clone https://github.com/TouchFlows/buzzcasting-storage.git
80
+ cd buzzcasting-storage
81
+ pnpm install
82
+ ````
83
+
84
+ ## Usage
85
+
86
+ The project contains the following scripts:
87
+
88
+ - `dev` - Start the development server
89
+ - `build` - Build for production
90
+ - `release` - Generate changelog and npm publish
91
+ - `lint` - Checks your code for any linting errors
92
+ - `test` - Run all tests
93
+ - `test:watch` - Run all tests with watch mode
94
+ - `test:coverage` - Run all tests with code coverage report
95
+ - `prepare` - Script for setting up husky hooks
96
+
97
+ ## License
98
+
99
+ This template was created under the [MIT License](LICENSE).
@@ -0,0 +1,555 @@
1
+ export declare function anonymize(name: string): string;
2
+
3
+ export declare enum API {
4
+ MESSAGES = "messages",
5
+ CLOUD = "cloud",
6
+ SERIES = "series",
7
+ TOPICS = "topics",
8
+ WIDGET = "widget",
9
+ WIDGETS = "widgets",
10
+ DASHBOARD = "dashboard",
11
+ DASHBOARDS = "dashboards",
12
+ SLIDE = "slide",
13
+ SLIDES = "slides",
14
+ PRESENTATION = "presentation",
15
+ PRESENTATIONS = "presentations",
16
+ PREFERENCE = "preference",
17
+ PREFERENCES = "preferences"
18
+ }
19
+
20
+ export declare type ApiData = ISeries & IMessages & ICloud;
21
+
22
+ export declare function attachedMedia(message: IMessage): IAttachedMedia_2;
23
+
24
+ export declare function attrs(attributes: NamedNodeMap): any;
25
+
26
+ export declare function brandLogo(channel: string, size: string): string;
27
+
28
+ /**
29
+ * Convert string containing hyphens to camelCase
30
+ * @param str
31
+ * @returns string
32
+ */
33
+ export declare function camelCase(str: string): string;
34
+
35
+ export declare function camelCasedProps(attributes: NamedNodeMap): IFilteredAttributes;
36
+
37
+ /**
38
+ * Convert string containing hyphens to camelCase
39
+ * @param str
40
+ * @returns camilized string
41
+ */
42
+ export declare function camelize(str: string): string;
43
+
44
+ export declare const capitalizeFirstLetter: (prop: string) => string;
45
+
46
+ /**
47
+ * Clear Container range contents of template code when the web component is connected to the DOM
48
+ * @param myNode
49
+ */
50
+ export declare function clearContents(myNode: HTMLElement): void;
51
+
52
+ declare enum CSS_2 {
53
+ API = "color:white;background-color:grey;padding:0 4px 0 4px;border-radius:5px;",
54
+ APP = "color:white;background-color:navy;padding:0 4px 0 4px;border-radius:5px;",
55
+ BROADCAST = "color:navy;background-color:orange;padding:0 4px 0 4px;border-radius:5px;",
56
+ CLOUD = "color:purple;background-color:mistyrose;padding:0 4px 0 4px;border-radius:5px;",
57
+ DATA = "color:grey;background-color:lightskyblue;padding:0 4px 0 4px;border-radius:5px;",
58
+ ERROR = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;",
59
+ GET_DATA = "color:black;background-color:lime;padding:0 4px 0 4px;border-radius:5px;",
60
+ HIDE = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;",
61
+ KO = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;",
62
+ MESSAGES = "color:white;background-color:darkslateblue;padding:0 4px 0 4px;border-radius:5px;",
63
+ NO_UPDATES = "color:grey;border:1px solid grey;padding:0 4px 0 4px;border-radius:5px;",
64
+ NONE = "color:transparent;background-color:transparent;",
65
+ OK = "color:black;background-color:lime;padding:0 4px 0 4px;border-radius:5px;",
66
+ PRESENTATION = "color:white;background-color:darkred;padding:0 4px 0 4px;border-radius:5px;",
67
+ SERIES = "color:purple;background-color:thistle;padding:0 4px 0 4px;border-radius:5px;",
68
+ SLIDE = "color:black;background-color:yellow;padding:0 4px 0 4px;border-radius:5px;",
69
+ STORAGE = "color:black;background-color:cyan;padding:0 4px 0 4px;border-radius:5px;",
70
+ SUBSCRIBE = "color:white;background-color:dodgerblue;padding:0 4px 0 4px;border-radius:5px;",
71
+ WIDGET = "color:gret;background-color:lemonchiffon;padding:0 4px 0 4px;border-radius:5px;",
72
+ WS = "color:white;background-color:green;padding:0 4px 0 4px;border-radius:5px;"
73
+ }
74
+ export { CSS_2 as CSS }
75
+
76
+ export declare function deepMerge(objs: any): void;
77
+
78
+ export declare enum EVENTS {
79
+ ADD_SLIDE = "addSlide",
80
+ APP_READY = "appReady",
81
+ API_UPDATE = "apiUpdate",
82
+ WS_API_REQUEST = "wsApiRequest",
83
+ WS_API_RESPONSE = "wsApiResponse",
84
+ WS_API_UPDATE = "wsApiRUpdate",
85
+ APPROVE_MESSAGE = "approveMessage",
86
+ CHANNEL = "channel",
87
+ CLEAN_MESSAGES = "cleanMessages",
88
+ CLOSE_MODAL = "closeModal",
89
+ CLOSE_BUILDER_MODAL = "closeBuilderModal",
90
+ DASHBOARD_LOAD = "loadDashboard",
91
+ DASHBOARD_STORE = "storeDashboard",
92
+ ERROR = "error",
93
+ HIDE_MESSAGE = "hideMessage",
94
+ HIDE_LABELS = "hideLabels",
95
+ MAUPPUT_UPDATE = "layoutUpdate",
96
+ PREV_SLIDE = "prevSlide",
97
+ RELOAD_PRESENTATION = "reloadPresentation",
98
+ SHOW_MODAL = "showModal",
99
+ STAR_MESSAGE = "starMessage",
100
+ GOTO_SLIDE = "gotoSlide",
101
+ NEXT_SLIDE = "nextSlide",
102
+ PREFERENCE_LOAD = "loadPreference",
103
+ PREFERENCE_STORE = "storePreference",
104
+ PAUSE_PRESENTATION = "pausePresentation",
105
+ PRESENTATION_READY = "presentationReady",
106
+ PRESENTATION_LOAD = "loadPresentation",
107
+ PRESENTATION_STORE = "storePresentation",
108
+ SHOW_BUILDER_MODAL = "showBuilderModal",
109
+ SLIDE_DID_LOAD = "slideDidLoad",
110
+ SLIDE_GOTO = "slideGoto",
111
+ SLIDE_READY = "slideReady",
112
+ SLIDE_LOAD = "loadSlide",
113
+ SLIDE_STORE = "storeSlide",
114
+ SLIDE_TRANSITIONER = "slideTransitioner",
115
+ START_TRANSITIONER = "startTransitioner",
116
+ STORAGE_INIT = "storageInit",
117
+ SUBSCRIBE = "subscribe",
118
+ SUSPEND_ACCOUNT = "suspendAccount",
119
+ SWITCH_PRESENTATION = "switchPresentation",
120
+ REMOVE_CLOUD = "removeCloud",
121
+ UPDATE = "update",
122
+ VERSION = "version",
123
+ WIDGETS_CLEAR = "widgetsClear",
124
+ WIDGET_LOAD = "widgetLoad",
125
+ WIDGET_STORE = "widgetStore",
126
+ WIDGET_UPDATE = "widgetUpdate"
127
+ }
128
+
129
+ export declare function filterAttributes(attributes: NamedNodeMap): IFilteredAttributes;
130
+
131
+ export declare function formatContent(message: IMessage, titleCss?: string): string;
132
+
133
+ export declare const getGuid: () => string;
134
+
135
+ export declare function getKey(query: IQuery): string;
136
+
137
+ export declare function getParameterByName(key: string): string | null;
138
+
139
+ export declare const getQueryParam: (param: string) => any;
140
+
141
+ export declare function hashSum(o: any): string | any[];
142
+
143
+ export declare const html2json: (html: string) => {
144
+ node: string;
145
+ child: never[];
146
+ };
147
+
148
+ export declare const HTMLParser: (html: any, handler: any) => void;
149
+
150
+ export declare const HTMLtoDOM: (html: string, doc: any) => any;
151
+
152
+ export declare const HTMLtoXML: (html: string) => string;
153
+
154
+ export declare interface IAttachedMedia {
155
+ image?: string;
156
+ background: {
157
+ backgroundimage?: string;
158
+ } | null;
159
+ video?: string;
160
+ }
161
+
162
+ declare interface IAttachedMedia_2 {
163
+ image?: string;
164
+ background: {
165
+ backgroundimage?: string;
166
+ } | null;
167
+ video?: string;
168
+ }
169
+
170
+ export declare interface ICategory {
171
+ type: string;
172
+ data: string[];
173
+ }
174
+
175
+ /**
176
+ * Cloud
177
+ */
178
+ export declare interface ICloud {
179
+ labels: ILabel[];
180
+ current: any[];
181
+ previous: any[];
182
+ type: string;
183
+ total: number;
184
+ current_total: number;
185
+ previous_total: number;
186
+ }
187
+
188
+ declare interface ICloudIndicators {
189
+ total: number;
190
+ positive: number;
191
+ negative: number;
192
+ neutral: number;
193
+ engagement: number;
194
+ reach: number;
195
+ velocity: number;
196
+ }
197
+
198
+ export declare interface IDashboard {
199
+ id: string;
200
+ title: string;
201
+ project: {
202
+ id: string;
203
+ title: string;
204
+ };
205
+ commandcenter: any;
206
+ widgets?: IWidget[];
207
+ }
208
+
209
+ export declare interface IDashboards {
210
+ dashboards: IDashboard[];
211
+ }
212
+
213
+ export declare interface IDynamics {
214
+ engagement?: number;
215
+ semrush_visits?: number;
216
+ potential_reach?: number;
217
+ facebook_engagement?: number;
218
+ facebook_insights_reach?: number;
219
+ facebook_insights_impressions?: number;
220
+ facebook_insights_link_clicks?: number;
221
+ facebook_reactions?: number;
222
+ facebook_shares?: number;
223
+ instagram_followers?: number;
224
+ instagram_likes?: number;
225
+ retweets?: number;
226
+ twitter_shares?: number;
227
+ twitter_bookmarks?: number;
228
+ twitter_followers?: number;
229
+ twitter_impressions?: number;
230
+ twitter_insights_retweets?: number;
231
+ twitter_likes?: number;
232
+ twitter_replies?: number;
233
+ twitter_video_views?: number;
234
+ total_comments?: number;
235
+ trending_score?: number;
236
+ }
237
+
238
+ export declare interface IFilteredAttributes {
239
+ [key: string]: string | object;
240
+ }
241
+
242
+ export declare interface IGeo {
243
+ latitude?: number;
244
+ longitude?: number;
245
+ zip?: string;
246
+ street: string;
247
+ city?: string;
248
+ country: string;
249
+ }
250
+
251
+ export declare interface IIndicators {
252
+ value: number;
253
+ }
254
+
255
+ export declare interface ILabel {
256
+ label: string;
257
+ count: number;
258
+ info?: string;
259
+ current: ICloudIndicators;
260
+ previous?: ICloudIndicators;
261
+ percentage?: number;
262
+ }
263
+
264
+ export declare interface IMedium {
265
+ type: string;
266
+ url: string;
267
+ width: number;
268
+ height: number;
269
+ }
270
+
271
+ export declare interface IMessage {
272
+ id: string;
273
+ published: string;
274
+ harvested: string;
275
+ utc: number;
276
+ expires: number;
277
+ channel: string;
278
+ type: string;
279
+ sender: ISender;
280
+ reply: string;
281
+ replyto: string;
282
+ page: string;
283
+ conversation: string;
284
+ title: string;
285
+ content: string;
286
+ sentiment: number;
287
+ link: string;
288
+ language?: string;
289
+ region?: string;
290
+ topics: ITopic[];
291
+ dynamics?: IDynamics;
292
+ geo?: IGeo;
293
+ media?: IMedium[];
294
+ }
295
+
296
+ export declare interface IMessages {
297
+ messages: IMessage[];
298
+ presentation?: string;
299
+ slide?: string;
300
+ title?: string;
301
+ dashboard?: string;
302
+ widget?: string;
303
+ topics?: string;
304
+ }
305
+
306
+ export declare interface IMetrics {
307
+ doc?: number;
308
+ previous?: number;
309
+ change?: number;
310
+ }
311
+
312
+ /**
313
+ * IModal
314
+ */
315
+ export declare interface IModal {
316
+ showComponent: string;
317
+ props?: any;
318
+ timeout?: number;
319
+ }
320
+
321
+ export declare const intToString: (num: any, digits?: number, abbreviate?: boolean, locale?: string) => string;
322
+
323
+ export declare interface IPreference {
324
+ id: string;
325
+ value?: string;
326
+ update?: number;
327
+ }
328
+
329
+ export declare interface IPreferences {
330
+ preferences: IPreference[];
331
+ }
332
+
333
+ export declare interface IPresentation {
334
+ id: string;
335
+ name: string;
336
+ link: string;
337
+ delay: number;
338
+ canModerate: boolean;
339
+ period: number;
340
+ slide_interval: number;
341
+ update: number;
342
+ }
343
+
344
+ export declare interface IPresentations {
345
+ presentations: IPresentation[];
346
+ }
347
+
348
+ /**
349
+ * Query
350
+ */
351
+ export declare interface IQuery {
352
+ [x: string]: any;
353
+ topics?: string;
354
+ presentation?: string;
355
+ dashboard: string;
356
+ widget: string;
357
+ labels?: string[];
358
+ compare?: string;
359
+ period?: number;
360
+ type?: "cloud" | "messages" | "series" | "preference" | "proxy" | "slide" | "dashboard" | "widget";
361
+ order?: "utc" | "reach" | "engagement" | "impressions";
362
+ media?: number;
363
+ dynamics?: number;
364
+ geo?: number;
365
+ delay?: string;
366
+ approved?: string;
367
+ moderation?: "realtime" | "delayed" | "approved" | "none";
368
+ hrm?: string;
369
+ before?: number;
370
+ since?: number;
371
+ hash?: string;
372
+ name?: string;
373
+ data?: any;
374
+ }
375
+
376
+ /**
377
+ * API Response
378
+ */
379
+ export declare interface IResponse {
380
+ data: IDashboards | IMessages | ISeries | ICloud | ISlides | IPresentations | IPreferences | IWidgets | null;
381
+ message: string;
382
+ success: boolean;
383
+ query?: IQuery;
384
+ }
385
+
386
+ /**
387
+ * Messages
388
+ */
389
+ export declare interface ISender {
390
+ id?: string;
391
+ channel?: string;
392
+ title?: string;
393
+ name?: string;
394
+ avatar?: string;
395
+ bio?: string;
396
+ location?: string;
397
+ verified?: number;
398
+ following?: number;
399
+ followers?: number;
400
+ listed?: number;
401
+ favourites?: number;
402
+ messages?: number;
403
+ influence?: number;
404
+ }
405
+
406
+ /**
407
+ * Series Data
408
+ */
409
+ export declare interface ISeries {
410
+ topic: string;
411
+ title: string;
412
+ series: ISeriesData[];
413
+ category: ICategory;
414
+ metrics?: IMetrics;
415
+ indicators?: IIndicators;
416
+ timestamp?: number;
417
+ }
418
+
419
+ export declare interface ISeriesData {
420
+ name?: string;
421
+ label?: string;
422
+ current?: number[];
423
+ current_total?: number;
424
+ previous_total?: number;
425
+ previous?: number[];
426
+ current_category?: number;
427
+ previous_category?: number;
428
+ }
429
+
430
+ export declare interface ISlides {
431
+ presentation: string;
432
+ slides: any;
433
+ }
434
+
435
+ /**
436
+ * Storage Options
437
+ */
438
+ export declare interface IStorageOptions {
439
+ app: string;
440
+ builder?: boolean;
441
+ domain?: string;
442
+ cdn?: string;
443
+ channel?: string;
444
+ presentation: string;
445
+ slide?: string;
446
+ slides?: string[];
447
+ display?: string;
448
+ monitor?: string;
449
+ version: string;
450
+ storage: string;
451
+ token?: string;
452
+ bearer?: string;
453
+ csrf?: string;
454
+ moderation?: string;
455
+ beforeTime?: string;
456
+ delay?: number;
457
+ period?: number;
458
+ retention?: number;
459
+ suspended?: boolean;
460
+ loglevel?: number;
461
+ }
462
+
463
+ export declare interface ITopic {
464
+ message_id: string;
465
+ dashboard_id?: string;
466
+ widget_id?: string;
467
+ topic?: string;
468
+ engagement: number;
469
+ impressions: number;
470
+ reach: number;
471
+ sentiment: number;
472
+ title?: string;
473
+ utc?: number;
474
+ expires?: number;
475
+ visible?: number;
476
+ }
477
+
478
+ export declare interface IWidget {
479
+ id: string;
480
+ title: string;
481
+ type: string;
482
+ filters?: any;
483
+ custom_filters?: any;
484
+ creation_date?: string;
485
+ period?: string;
486
+ }
487
+
488
+ export declare interface IWidgets {
489
+ widgets: IWidget[];
490
+ }
491
+
492
+ export declare const json2html: (json: any) => any;
493
+
494
+ export declare const log: (level: number | undefined, message: any[]) => void;
495
+
496
+ export declare const maxifyCss: (css: string) => string;
497
+
498
+ export declare const maxifyHtml: (html: string) => string;
499
+
500
+ export declare const minifyCss: (css: string) => void;
501
+
502
+ export declare const minifyHtml: (html: string) => string;
503
+
504
+ export declare enum MODERATION {
505
+ APPROVED = "approved",
506
+ BEFORE = "before",
507
+ DELAYED = "delayed",
508
+ NONE = "none",
509
+ REALTIME = "realtime"
510
+ }
511
+
512
+ export declare function moderation(options: IStorageOptions, query: IQuery): IQuery;
513
+
514
+ export declare function numberFormatter(num: number, digits: number): string;
515
+
516
+ /**
517
+ * Get a random item from an array
518
+ * @param array
519
+ * @returns
520
+ */
521
+ export declare function randomValue(array: string | any[]): number;
522
+
523
+ export declare function rtl(message: IMessage): {
524
+ [key: string]: string;
525
+ };
526
+
527
+ export declare function sanitize(messages: IMessage[]): IMessage[];
528
+
529
+ export declare function shuffleMessages(messages: IMessage[]): IMessage[];
530
+
531
+ export declare enum STORAGE {
532
+ KEYVAL = "keyval",
533
+ LOCAL = "local",
534
+ SESSION = "session",
535
+ DEXIE = "dexie",
536
+ WINDOW = "window"
537
+ }
538
+
539
+ /**
540
+ * Generate a unique identifier
541
+ * @returns uid
542
+ */
543
+ export declare function stringGen(): string;
544
+
545
+ export declare const typeCss: (query: IQuery | undefined) => string;
546
+
547
+ export declare const uniq: (length?: number, existing?: never[]) => string;
548
+
549
+ export declare const upDownColor: (change: number) => "text-down text-xs" | "text-up text-xs" | "text-white text-xs";
550
+
551
+ export declare function widgetParams(query: IQuery): IQuery;
552
+
553
+ export declare const wrapPromise: (promise: any, delay: number, reason: string) => Promise<any>;
554
+
555
+ export { }
@@ -0,0 +1,623 @@
1
+ var m = /* @__PURE__ */ ((e) => (e.MESSAGES = "messages", e.CLOUD = "cloud", e.SERIES = "series", e.TOPICS = "topics", e.WIDGET = "widget", e.WIDGETS = "widgets", e.DASHBOARD = "dashboard", e.DASHBOARDS = "dashboards", e.SLIDE = "slide", e.SLIDES = "slides", e.PRESENTATION = "presentation", e.PRESENTATIONS = "presentations", e.PREFERENCE = "preference", e.PREFERENCES = "preferences", e))(m || {}), h = /* @__PURE__ */ ((e) => (e.API = "color:white;background-color:grey;padding:0 4px 0 4px;border-radius:5px;", e.APP = "color:white;background-color:navy;padding:0 4px 0 4px;border-radius:5px;", e.BROADCAST = "color:navy;background-color:orange;padding:0 4px 0 4px;border-radius:5px;", e.CLOUD = "color:purple;background-color:mistyrose;padding:0 4px 0 4px;border-radius:5px;", e.DATA = "color:grey;background-color:lightskyblue;padding:0 4px 0 4px;border-radius:5px;", e.ERROR = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;", e.GET_DATA = "color:black;background-color:lime;padding:0 4px 0 4px;border-radius:5px;", e.HIDE = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;", e.KO = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;", e.MESSAGES = "color:white;background-color:darkslateblue;padding:0 4px 0 4px;border-radius:5px;", e.NO_UPDATES = "color:grey;border:1px solid grey;padding:0 4px 0 4px;border-radius:5px;", e.NONE = "color:transparent;background-color:transparent;", e.OK = "color:black;background-color:lime;padding:0 4px 0 4px;border-radius:5px;", e.PRESENTATION = "color:white;background-color:darkred;padding:0 4px 0 4px;border-radius:5px;", e.SERIES = "color:purple;background-color:thistle;padding:0 4px 0 4px;border-radius:5px;", e.SLIDE = "color:black;background-color:yellow;padding:0 4px 0 4px;border-radius:5px;", e.STORAGE = "color:black;background-color:cyan;padding:0 4px 0 4px;border-radius:5px;", e.SUBSCRIBE = "color:white;background-color:dodgerblue;padding:0 4px 0 4px;border-radius:5px;", e.WIDGET = "color:gret;background-color:lemonchiffon;padding:0 4px 0 4px;border-radius:5px;", e.WS = "color:white;background-color:green;padding:0 4px 0 4px;border-radius:5px;", e))(h || {}), k = /* @__PURE__ */ ((e) => (e.ADD_SLIDE = "addSlide", e.APP_READY = "appReady", e.API_UPDATE = "apiUpdate", e.WS_API_REQUEST = "wsApiRequest", e.WS_API_RESPONSE = "wsApiResponse", e.WS_API_UPDATE = "wsApiRUpdate", e.APPROVE_MESSAGE = "approveMessage", e.CHANNEL = "channel", e.CLEAN_MESSAGES = "cleanMessages", e.CLOSE_MODAL = "closeModal", e.CLOSE_BUILDER_MODAL = "closeBuilderModal", e.DASHBOARD_LOAD = "loadDashboard", e.DASHBOARD_STORE = "storeDashboard", e.ERROR = "error", e.HIDE_MESSAGE = "hideMessage", e.HIDE_LABELS = "hideLabels", e.MAUPPUT_UPDATE = "layoutUpdate", e.PREV_SLIDE = "prevSlide", e.RELOAD_PRESENTATION = "reloadPresentation", e.SHOW_MODAL = "showModal", e.STAR_MESSAGE = "starMessage", e.GOTO_SLIDE = "gotoSlide", e.NEXT_SLIDE = "nextSlide", e.PREFERENCE_LOAD = "loadPreference", e.PREFERENCE_STORE = "storePreference", e.PAUSE_PRESENTATION = "pausePresentation", e.PRESENTATION_READY = "presentationReady", e.PRESENTATION_LOAD = "loadPresentation", e.PRESENTATION_STORE = "storePresentation", e.SHOW_BUILDER_MODAL = "showBuilderModal", e.SLIDE_DID_LOAD = "slideDidLoad", e.SLIDE_GOTO = "slideGoto", e.SLIDE_READY = "slideReady", e.SLIDE_LOAD = "loadSlide", e.SLIDE_STORE = "storeSlide", e.SLIDE_TRANSITIONER = "slideTransitioner", e.START_TRANSITIONER = "startTransitioner", e.STORAGE_INIT = "storageInit", e.SUBSCRIBE = "subscribe", e.SUSPEND_ACCOUNT = "suspendAccount", e.SWITCH_PRESENTATION = "switchPresentation", e.REMOVE_CLOUD = "removeCloud", e.UPDATE = "update", e.VERSION = "version", e.WIDGETS_CLEAR = "widgetsClear", e.WIDGET_LOAD = "widgetLoad", e.WIDGET_STORE = "widgetStore", e.WIDGET_UPDATE = "widgetUpdate", e))(k || {}), x = /* @__PURE__ */ ((e) => (e.APPROVED = "approved", e.BEFORE = "before", e.DELAYED = "delayed", e.NONE = "none", e.REALTIME = "realtime", e))(x || {}), L = /* @__PURE__ */ ((e) => (e.KEYVAL = "keyval", e.LOCAL = "local", e.SESSION = "session", e.DEXIE = "dexie", e.WINDOW = "window", e))(L || {});
2
+ function Q(e) {
3
+ const t = e.toUpperCase().split(/[\s_-]+/);
4
+ return t.length > 0 ? (t.forEach((r, n) => {
5
+ t[n] = `${r.charAt(0)}.`;
6
+ }), t.join(" ")) : "";
7
+ }
8
+ function j(e) {
9
+ let t = "", r = "", n = {
10
+ backgroundImage: ""
11
+ };
12
+ return typeof e.media < "u" && e.media.forEach((a) => {
13
+ (a.type === "photo" || a.type === "image") && (n = {
14
+ backgroundImage: `url(${a.url})`
15
+ }, r = a.url), a.type === "video" && (t = a.url);
16
+ }), {
17
+ image: r,
18
+ background: n || null,
19
+ video: t
20
+ };
21
+ }
22
+ function J(e) {
23
+ const t = {};
24
+ for (let r = 0; r < e.length; r++) {
25
+ const n = e.item(r);
26
+ n != null && n.name && (t[n.name] = n.value);
27
+ }
28
+ return t;
29
+ }
30
+ function z(e) {
31
+ const t = {};
32
+ for (let r = 0; r < e.length; r++) {
33
+ const n = e[r];
34
+ n.name !== "class" && !n.name.includes("data") && (t[n.name] = n.value);
35
+ }
36
+ return t;
37
+ }
38
+ function N(e) {
39
+ const t = {};
40
+ for (let r = 0; r < e.length; r++) {
41
+ const n = e[r];
42
+ n.name !== "class" && (t[n.name] = $(n.value));
43
+ }
44
+ return t;
45
+ }
46
+ function q(e, t) {
47
+ switch (e) {
48
+ case "ax":
49
+ return '<div class="axa-switch-small bg-center bg-cover w-6 h-6"></div>';
50
+ case "bl":
51
+ return `<li class="text-blue fa-solid fa-rss fa-${t}"/>`;
52
+ case "co":
53
+ return `<li class="fa-solid fa-comment fa-${t}"/>`;
54
+ case "da":
55
+ return `<li class="fa-brands fa-dailymotion fa-${t}"/>`;
56
+ case "fb":
57
+ return `<li class="text-blue-900 fa-brands fa-facebook fa-${t}"/>`;
58
+ case "fo":
59
+ return `<li class="fa-solid fa-messages fa-${t}"/>`;
60
+ case "ig":
61
+ return `<li class="fa-brands fa-instagram fa-${t}"/>`;
62
+ case "lb":
63
+ return `<li class="fa-solid fa-comment fa-${t}"/>`;
64
+ case "li":
65
+ return `<li class="fa-brands fa-linkedin fa-${t}"/>`;
66
+ case "me":
67
+ return `<li class="fa-solid fa-rss fa-${t}"/>`;
68
+ case "pi":
69
+ return `<li class="fa-brands fa-pinterest fa-${t}"/>`;
70
+ case "qq":
71
+ return `<li class="fa-brands fa-weibo fa-${t}"/>`;
72
+ case "rd":
73
+ return `<li class="fa-brands fa-reddit fa-${t}"/>`;
74
+ case "re":
75
+ return `<li class="fa-solid fa-star-sharp-half-stroke fa-${t}"/>`;
76
+ case "ti":
77
+ return `<li class="fa-brands fa-tiktok fa-${t}"/>`;
78
+ case "tw":
79
+ return `<li class="fa-brands fa-x-twitter fa-${t}"/>`;
80
+ case "vk":
81
+ return `<li class="fa-brands fa-vk fa-${t}"/>`;
82
+ case "ws":
83
+ return `<li class="fa-solid fa-rss fa-${t}"/>`;
84
+ case "yt":
85
+ return `<li class="text-red fa-brands fa-youtube fa-${t}"/>`;
86
+ default:
87
+ return "";
88
+ }
89
+ }
90
+ function V(e) {
91
+ return e.replace(/^\w|[A-Z]|\b\w/g, (t, r) => r === 0 ? t.toLowerCase() : t.toUpperCase()).replace(/\s+/g, "");
92
+ }
93
+ function $(e) {
94
+ return e.toLowerCase().split("-").reduce((t, r) => t + (r.charAt(0).toUpperCase() + r.slice(1)));
95
+ }
96
+ const ee = (e) => e.charAt(0).toUpperCase() + e.slice(1);
97
+ function te(e) {
98
+ const t = document.createRange();
99
+ t.selectNodeContents(e), t.deleteContents();
100
+ }
101
+ function P(e) {
102
+ e.reduce(
103
+ (t, r) => Object.keys(r).reduce(
104
+ (n, a) => ({
105
+ ...n,
106
+ [a]: a in t && typeof t[a] == "object" && t[a] !== null && typeof r[a] == "object" && r[a] !== null ? P([t[a], r[a]]) : r[a]
107
+ }),
108
+ t
109
+ ),
110
+ {}
111
+ );
112
+ }
113
+ function re(e, t = "font-bold") {
114
+ return `${(e == null ? void 0 : e.title.length) > 0 ? `<div class="${t}">${e.title}</div>` : ""}${e != null && e.content ? e.content.replace(/\n\n/g, `
115
+ `).replace(/\n/g, "<br/>") : ""}`;
116
+ }
117
+ const ne = () => [b(2), b(1), b(1), b(1), b(3)].join("-"), b = (e) => {
118
+ let t = "";
119
+ for (let r = 0; r < e; r++)
120
+ t += ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
121
+ return t;
122
+ };
123
+ function I(e, t) {
124
+ for (; e.length < t; )
125
+ e = `0${e}`;
126
+ return e;
127
+ }
128
+ function f(e, t) {
129
+ let r, n, a;
130
+ if (t.length === 0)
131
+ return e;
132
+ for (r = 0, a = t.length; r < a; r++)
133
+ n = t.charCodeAt(r), e = (e << 5) - e + n, e |= 0;
134
+ return e < 0 ? e * -2 : e;
135
+ }
136
+ function v(e, t, r) {
137
+ return Object.keys(t).sort().reduce(n, e);
138
+ function n(a, o) {
139
+ return _(a, t[o], o, r);
140
+ }
141
+ }
142
+ function _(e, t, r, n) {
143
+ const a = f(f(f(e, r), y(t)), typeof t);
144
+ if (t === null)
145
+ return f(a, "null");
146
+ if (t === void 0)
147
+ return f(a, "undefined");
148
+ if (typeof t == "object" || typeof t == "function") {
149
+ if (n.includes(t))
150
+ return f(a, `[Circular]${r}`);
151
+ n.push(t);
152
+ const o = v(a, t, n);
153
+ if (!("valueOf" in t) || typeof t.valueOf != "function")
154
+ return o;
155
+ try {
156
+ return f(o, String(t.valueOf()));
157
+ } catch (l) {
158
+ return f(o, `[valueOf exception]${l.stack || l.message}`);
159
+ }
160
+ }
161
+ return f(a, t.toString());
162
+ }
163
+ function y(e) {
164
+ return Object.prototype.toString.call(e);
165
+ }
166
+ function ae(e) {
167
+ return I(_(0, e, "", []).toString(16), 8);
168
+ }
169
+ const oe = (e) => {
170
+ let t = "";
171
+ return D(e, {
172
+ start: function(r, n, a) {
173
+ t += "<" + r;
174
+ for (let o = 0; o < n.length; o++)
175
+ t += ` ${n[o].name}="${n[o].escaped}"`;
176
+ t += ">";
177
+ },
178
+ end: function(r) {
179
+ t += `</${r}>`;
180
+ },
181
+ chars: function(r) {
182
+ t += r;
183
+ },
184
+ comment: function(r) {
185
+ t += `<!-- ${r} -->`;
186
+ }
187
+ }), t;
188
+ }, ie = (e, t) => {
189
+ const r = g("html,head,body,title"), n = { link: "head", base: "head" };
190
+ t ? t = t.ownerDocument || t.getOwnerDocument && t.getOwnerDocument() || t : typeof t < "u" ? t = new Document() : typeof document < "u" && document.implementation && document.implementation.createDocument && (t = document.implementation.createDocument("", "", null));
191
+ const a = [];
192
+ if (!(t.documentElement || t.getDocumentElement && t.getDocumentElement()) && t.createElement && function() {
193
+ const i = t.createElement("html"), u = t.createElement("head");
194
+ u.appendChild(t.createElement("title")), i.appendChild(u), i.appendChild(t.createElement("body")), t.appendChild(i);
195
+ }(), t.getElementsByTagName)
196
+ for (let i in r) r[i] = t.getElementsByTagName(i)[0];
197
+ let l = r.body;
198
+ return D(e, {
199
+ start: function(i, u, c) {
200
+ if (r[i]) {
201
+ l = r[i], c || a.push(l);
202
+ return;
203
+ }
204
+ const s = t.createElement(i);
205
+ for (let d in u)
206
+ s.setAttribute(u[d].name, u[d].value);
207
+ n[i] && typeof r[n[i]] != "boolean" ? r[n[i]].appendChild(s) : l && l.appendChild && l.appendChild(s), c || (a.push(s), l = s);
208
+ },
209
+ end: function(i) {
210
+ a.length -= 1, l = a[a.length - 1];
211
+ },
212
+ chars: function(i) {
213
+ l.appendChild(t.createTextNode(i));
214
+ },
215
+ comment: function(i) {
216
+ }
217
+ }), t;
218
+ }, g = (e) => {
219
+ let t = {}, r = e.split(",");
220
+ for (let n = 0; n < r.length; n++) t[r[n]] = !0;
221
+ return t;
222
+ }, R = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, E = /^<\/([-A-Za-z0-9_]+)[^>]*>/, S = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g, M = g(
223
+ "area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"
224
+ ), C = g(
225
+ "a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"
226
+ ), U = g(
227
+ "abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"
228
+ ), T = g("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"), B = g(
229
+ "checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"
230
+ ), H = g("script,style");
231
+ Array.prototype.last = function() {
232
+ return this[this.length - 1];
233
+ };
234
+ const D = (e, t) => {
235
+ let r, n, a, o = [], l = e;
236
+ o.last = function() {
237
+ return this[this.length - 1];
238
+ };
239
+ const i = (c, s) => {
240
+ let d;
241
+ if (!s) d = 0;
242
+ else
243
+ for (d = o.length - 1; d >= 0 && o[d] != s; d--)
244
+ ;
245
+ if (d >= 0) {
246
+ for (let p = o.length - 1; p >= d; p--)
247
+ t.end && t.end(o[p]);
248
+ o.length = d;
249
+ }
250
+ };
251
+ for (; e; ) {
252
+ if (n = !0, !o.last() || !H[o.last()]) {
253
+ if (e.indexOf("<!--") == 0 ? (r = e.indexOf("-->"), r >= 0 && (t.comment && t.comment(e.substring(4, r)), e = e.substring(r + 3), n = !1)) : e.indexOf("</") == 0 ? (a = e.match(E), a && (e = e.substring(a[0].length), a[0].replace(E, i), n = !1)) : e.indexOf("<") == 0 && (a = e.match(R), a && (e = e.substring(a[0].length), a[0].replace(R, u), n = !1)), n) {
254
+ r = e.indexOf("<");
255
+ let c = r < 0 ? e : e.substring(0, r);
256
+ e = r < 0 ? "" : e.substring(r), t.chars && t.chars(c);
257
+ }
258
+ } else
259
+ e = e.replace(
260
+ //@ts-ignore
261
+ new RegExp("([\\s\\S]*?)</" + o.last() + "[^>]*>"),
262
+ function(c, s) {
263
+ return s = s.replace(
264
+ /<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g,
265
+ "$1$2"
266
+ ), t.chars && t.chars(s), "";
267
+ }
268
+ ), i("", o.last());
269
+ if (e == l) throw "Parse Error: " + e;
270
+ l = e;
271
+ }
272
+ i();
273
+ function u(c, s, d, p) {
274
+ if (s = s.toLowerCase(), C[s])
275
+ for (; o.last() && U[o.last()]; )
276
+ i("", o.last());
277
+ if (T[s] && o.last() == s && i("", s), p = M[s] || !!p, p || o.push(s), t.start) {
278
+ const w = [];
279
+ d.replace(S, function(X, A) {
280
+ let O = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : B[A] ? A : "";
281
+ w.push({
282
+ name: A,
283
+ value: O,
284
+ escaped: O.replace(/(^|[^\\])"/g, '$1\\"')
285
+ //"
286
+ });
287
+ }), t.start && t.start(s, w, p);
288
+ }
289
+ }
290
+ };
291
+ function G(e) {
292
+ return `"${e}"`;
293
+ }
294
+ function W(e) {
295
+ return e.replace(/<\?xml.*\?>\n/, "").replace(/<!doctype.*\>\n/, "").replace(/<!DOCTYPE.*\>\n/, "");
296
+ }
297
+ const se = (e) => {
298
+ e = W(e);
299
+ const t = [], r = {
300
+ node: "root",
301
+ child: []
302
+ };
303
+ return D(e, {
304
+ start: function(n, a, o) {
305
+ let l = {
306
+ node: "element",
307
+ tag: n
308
+ };
309
+ if (a.length !== 0 && (l.attr = a.reduce(function(i, u) {
310
+ let c = u.name, s = u.value;
311
+ return s.match(/ /) && (["title", "transform", "viewBox", "widget"].includes(u.name) || (s = s.split(" "))), i[c] ? Array.isArray(i[c]) ? i[c].push(s) : i[c] = [i[c], s] : i[c] = s, i;
312
+ }, {})), o) {
313
+ const i = t[0] || r;
314
+ i.child === void 0 && (i.child = []), i.child.push(l);
315
+ } else
316
+ t.unshift(l);
317
+ },
318
+ end: function(n) {
319
+ const a = t.shift();
320
+ if (a.tag !== n && console.error("invalid state: mismatch end tag"), t.length === 0)
321
+ r.child.push(a);
322
+ else {
323
+ const o = t[0];
324
+ o.child === void 0 && (o.child = []), o.child.push(a);
325
+ }
326
+ },
327
+ //@ts-ignore
328
+ chars: function(n) {
329
+ let a = {
330
+ node: "text",
331
+ text: n
332
+ };
333
+ if (t.length === 0)
334
+ r.child.push(a);
335
+ else {
336
+ const o = t[0];
337
+ o.child === void 0 && (o.child = []), o.child.push(a);
338
+ }
339
+ },
340
+ //@ts-ignore
341
+ comment: function(n) {
342
+ const a = {
343
+ node: "comment",
344
+ text: n
345
+ }, o = t[0];
346
+ o.child === void 0 && (o.child = []), o.child.push(a);
347
+ }
348
+ }), r;
349
+ }, F = (e) => {
350
+ const t = [
351
+ "area",
352
+ "base",
353
+ "basefont",
354
+ "br",
355
+ "col",
356
+ "frame",
357
+ "hr",
358
+ "img",
359
+ "input",
360
+ "isindex",
361
+ "link",
362
+ "meta",
363
+ "param",
364
+ "embed"
365
+ ];
366
+ let r = "";
367
+ e.child && (r = e.child.map(function(a) {
368
+ return F(a);
369
+ }).join(""));
370
+ let n = "";
371
+ if (e.attr && (n = Object.keys(e.attr).map(function(a) {
372
+ let o = e.attr[a];
373
+ return Array.isArray(o) && (o = o.join(" ")), `${a}=${G(o)}`;
374
+ }).join(" "), n !== "" && (n = ` ${n}`)), e.node === "element") {
375
+ let a = e.tag;
376
+ if (t.indexOf(a) > -1)
377
+ return `<${e.tag}${n}/>`;
378
+ const o = `<${e.tag}${n}>`, l = `</${e.tag}>`;
379
+ return `${o}${r}${l}`;
380
+ }
381
+ if (e.node === "text")
382
+ return e.text;
383
+ if (e.node === "comment")
384
+ return `<!-- ${e.text} -->`;
385
+ if (e.node === "root")
386
+ return r;
387
+ }, le = (e, t = 0, r = !0, n = "en") => {
388
+ if (typeof e == "string" || e instanceof String) return e.toString().replace(/[^0-9.]/g, "");
389
+ if (r === !1)
390
+ return e.toLocaleString(n);
391
+ if (e < 1e3)
392
+ return e = e.toString().replace(/[^0-9.]/g, "");
393
+ e = e.toString().replace(/[^0-9.]/g, "");
394
+ let a = [
395
+ { v: 1e3, s: "K" },
396
+ { v: 1e6, s: "M" },
397
+ { v: 1e9, s: "B" },
398
+ { v: 1e12, s: "T" },
399
+ { v: 1e15, s: "P" },
400
+ { v: 1e18, s: "E" }
401
+ ], o;
402
+ for (o = a.length - 1; o > 0 && !(e >= a[o].v); o--)
403
+ ;
404
+ return (e / a[o].v).toFixed(t).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, "$1") + a[o].s;
405
+ }, ce = (e = 0, t) => {
406
+ switch (!0) {
407
+ case e > 3:
408
+ console.debug(...t);
409
+ break;
410
+ case e > 2:
411
+ console.info(...t);
412
+ break;
413
+ case e > 1:
414
+ console.warn(...t);
415
+ break;
416
+ case e > 0:
417
+ console.error(...t);
418
+ break;
419
+ }
420
+ }, de = (e) => e.replace(/\<\!--\s*?[^\s?\[][\s\S]*?--\>/g, "").replace(/\>\s*\</g, "><").replace(/\t/g, ""), ue = (e) => e.replace(/\>\</g, `>
421
+ <`), fe = (e) => {
422
+ e.replace(/\/\*.*\*\/|\/\*[\s\S]*?\*\/|\n|\t|\v|\s{2,}/g, "").replace(/\s*\{\s*/g, "{").replace(/\s*\}\s*/g, "}").replace(/\s*\:\s*/g, ":").replace(/\s*\;\s*/g, ";").replace(/\s*\,\s*/g, ",").replace(/\s*\~\s*/g, "~").replace(/\s*\>\s*/g, ">").replace(/\s*\+\s*/g, "+").replace(/\s*\!\s*/g, "!");
423
+ }, pe = (e) => e.replace(/\,/g, ", ").replace(/\{/g, ` {
424
+ `).replace(/\}/g, `}
425
+ `).replace(/\;/g, `;
426
+ `);
427
+ function ge(e, t) {
428
+ const r = [
429
+ { value: 1, symbol: "" },
430
+ { value: 1e3, symbol: "K" },
431
+ { value: 1e6, symbol: "M" },
432
+ { value: 1e9, symbol: "MM" },
433
+ { value: 1e12, symbol: "T" },
434
+ { value: 1e15, symbol: "P" },
435
+ { value: 1e18, symbol: "E" }
436
+ ], n = /\.0+$|(\.\d*[1-9])0+$/;
437
+ let a;
438
+ for (a = r.length - 1; a > 0 && !(e >= r[a].value); a--)
439
+ ;
440
+ return (e / r[a].value).toFixed(t).replace(n, "$1") + r[a].symbol;
441
+ }
442
+ function be(e) {
443
+ const t = RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);
444
+ return t && decodeURIComponent(t[1].replace(/\+/g, " ")) || null;
445
+ }
446
+ const he = (e) => new Proxy(new URLSearchParams(window.location.search), {
447
+ // @ts-ignore
448
+ get: (r, n) => r.get(n)
449
+ })[e];
450
+ function me(e) {
451
+ return e[Math.floor(Math.random() * e.length)];
452
+ }
453
+ function xe(e) {
454
+ switch (e.language) {
455
+ case "ar":
456
+ return {
457
+ direction: "rtl",
458
+ textAlign: "right"
459
+ };
460
+ default:
461
+ return {};
462
+ }
463
+ }
464
+ function Ae(e) {
465
+ const t = window.BuzzCasting.getOptions().suspended ?? !1;
466
+ return e.forEach((r) => {
467
+ var n;
468
+ if (t ? r.content = "License suspended, please contact your Sales Representative to restore service" : r.content = ((n = r.content) == null ? void 0 : n.replace(
469
+ /(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)((\?.*)?)/g,
470
+ ""
471
+ )) || "", r.sender !== null)
472
+ switch (!0) {
473
+ case r.sender.title === "Unknown author":
474
+ r.sender.title = "", r.sender.name = "";
475
+ break;
476
+ case r.sender.title === r.sender.name:
477
+ r.sender.name = "";
478
+ break;
479
+ case r.channel === "tw":
480
+ r.sender.name = `@${r.sender.name}`;
481
+ break;
482
+ }
483
+ else
484
+ r.sender = {
485
+ title: "",
486
+ name: "",
487
+ id: "",
488
+ avatar: "default",
489
+ bio: "",
490
+ location: "",
491
+ following: 0,
492
+ verified: 0,
493
+ listed: 0,
494
+ followers: 0,
495
+ favourites: 0,
496
+ messages: 0,
497
+ influence: 0
498
+ };
499
+ if (r.sender.title === "" && r.link !== "") {
500
+ const a = new URL(r.link);
501
+ r.sender.title = a.hostname.replace("www.", "");
502
+ }
503
+ }), e;
504
+ }
505
+ function De(e) {
506
+ const t = [...e];
507
+ for (let r = t.length - 1; r > 0; r--) {
508
+ const n = Math.floor(Math.random() * (r + 1));
509
+ [t[r], t[n]] = [t[n], t[r]];
510
+ }
511
+ return t;
512
+ }
513
+ function we() {
514
+ let e = "";
515
+ const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
516
+ for (let r = 0; r < 7; r++) e += t.charAt(Math.floor(Math.random() * t.length));
517
+ return e;
518
+ }
519
+ const Oe = (e) => {
520
+ switch (e == null ? void 0 : e.type) {
521
+ case m.MESSAGES:
522
+ return h.MESSAGES;
523
+ case m.SERIES:
524
+ return h.SERIES;
525
+ case m.CLOUD:
526
+ return h.CLOUD;
527
+ default:
528
+ return h.NO_UPDATES;
529
+ }
530
+ }, Y = (e = 6) => Math.random().toString(36).substring(2, e + 2), K = (e, t = []) => !t.find(function(n) {
531
+ return n === e;
532
+ }), Re = (e, t = []) => {
533
+ let n = 0, a = "";
534
+ for (; a == "" && n < 100; )
535
+ a = Y(e), K(a, t) || (a = "", n++);
536
+ return a;
537
+ }, Ee = (e) => {
538
+ switch (!0) {
539
+ case e < 0:
540
+ return "text-down text-xs";
541
+ case e > 0:
542
+ return "text-up text-xs";
543
+ default:
544
+ return "text-white text-xs";
545
+ }
546
+ }, _e = (e, t, r) => Promise.race([e, Z(t, r)]), Z = (e, t) => new Promise((r, n) => setTimeout(() => t === void 0 ? r("ok") : n(t), e));
547
+ function ke(e) {
548
+ let t = `${e.type}.${e.topics}`;
549
+ return e.order && (t += `.${e.order}`), e.period && (t += `.${e.period}`), t;
550
+ }
551
+ function Le(e) {
552
+ var t;
553
+ if (e.widget === void 0) {
554
+ const r = (t = e.topics) == null ? void 0 : t.split("-");
555
+ r && r.length > 1 ? (e.dashboard = r ? r[0] : "", e.widget = r ? r[1] : "") : (e.widget = e.topics, e.dashboard = e.slide);
556
+ }
557
+ return e;
558
+ }
559
+ function $e(e, t) {
560
+ var i;
561
+ let r, n, a, o, l;
562
+ switch (e.moderation) {
563
+ case x.BEFORE:
564
+ r = /* @__PURE__ */ new Date(), n = (i = e.beforeTime) == null ? void 0 : i.split(":"), a = Number.parseInt(n ? n[0] : "00"), o = Number.parseInt(n ? n[1] : "00"), l = Number.parseInt(n ? n[2] : "00"), t.before = r.setHours(a, o, l, 0) / 1e3, t.period || (t.period = r.getDay() === 1 ? 72 : 24);
565
+ break;
566
+ case x.DELAYED:
567
+ e.delay && e.delay > 0 && (t.delay = `${e.delay}`);
568
+ break;
569
+ case x.APPROVED:
570
+ t.approved = "1";
571
+ break;
572
+ default:
573
+ e.period !== 0 && (t.period = e.period);
574
+ }
575
+ return t;
576
+ }
577
+ export {
578
+ m as API,
579
+ h as CSS,
580
+ k as EVENTS,
581
+ D as HTMLParser,
582
+ ie as HTMLtoDOM,
583
+ oe as HTMLtoXML,
584
+ x as MODERATION,
585
+ L as STORAGE,
586
+ Q as anonymize,
587
+ j as attachedMedia,
588
+ J as attrs,
589
+ q as brandLogo,
590
+ $ as camelCase,
591
+ N as camelCasedProps,
592
+ V as camelize,
593
+ ee as capitalizeFirstLetter,
594
+ te as clearContents,
595
+ P as deepMerge,
596
+ z as filterAttributes,
597
+ re as formatContent,
598
+ ne as getGuid,
599
+ ke as getKey,
600
+ be as getParameterByName,
601
+ he as getQueryParam,
602
+ ae as hashSum,
603
+ se as html2json,
604
+ le as intToString,
605
+ F as json2html,
606
+ ce as log,
607
+ pe as maxifyCss,
608
+ ue as maxifyHtml,
609
+ fe as minifyCss,
610
+ de as minifyHtml,
611
+ $e as moderation,
612
+ ge as numberFormatter,
613
+ me as randomValue,
614
+ xe as rtl,
615
+ Ae as sanitize,
616
+ De as shuffleMessages,
617
+ we as stringGen,
618
+ Oe as typeCss,
619
+ Re as uniq,
620
+ Ee as upDownColor,
621
+ Le as widgetParams,
622
+ _e as wrapPromise
623
+ };
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "buzzcasting-utils",
3
+ "type": "module",
4
+ "version": "1.1.0",
5
+ "private": false,
6
+ "author": {
7
+ "name": "Mark Tamis, TouchFlows SAS",
8
+ "email": "mark.tamis@touchflows.com"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/buzzcasting-utils.esm.js"
13
+ }
14
+ },
15
+ "module": "./dist/buzzcasting-utils.esm.js",
16
+ "types": "./dist/buzzcasting-utils.d.ts",
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "dev": "vite",
22
+ "build": "tsc && vite build",
23
+ "changelog": "changelogen --release",
24
+ "release": "npm test && npm run build && changelogen --release && npm publish && git push --follow-tags",
25
+ "lint": "eslint . --fix",
26
+ "test": "vitest --run",
27
+ "test:watch": "vitest",
28
+ "test:coverage": "vitest --coverage"
29
+ },
30
+ "dependencies": {},
31
+ "devDependencies": {
32
+ "@antfu/eslint-config": "^4.10.1",
33
+ "@commitlint/cli": "^19.8.0",
34
+ "@commitlint/config-conventional": "^19.8.0",
35
+ "@types/node": "^22.13.10",
36
+ "@typescript-eslint/eslint-plugin": "^8.26.1",
37
+ "@typescript-eslint/parser": "^8.26.1",
38
+ "@vitest/coverage-v8": "^3.0.8",
39
+ "camelcase": "^8.0.0",
40
+ "changelogen": "^0.6.1",
41
+ "eslint": "^9.22.0",
42
+ "lint-staged": "^15.5.0",
43
+ "typescript": "^5.8.2",
44
+ "vite": "^6.2.1",
45
+ "vite-plugin-dts": "^4.5.3",
46
+ "vitest": "^3.0.8"
47
+ },
48
+ "lint-staged": {
49
+ "*.ts": "npm run lint"
50
+ }
51
+ }