-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruntime-debug.js
More file actions
2760 lines (2731 loc) · 349 KB
/
runtime-debug.js
File metadata and controls
2760 lines (2731 loc) · 349 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
// desktop/@wailsio/runtime/src/index.ts
var index_exports = {};
__export(index_exports, {
Application: () => application_exports,
Browser: () => browser_exports,
Call: () => calls_exports,
CancelError: () => CancelError,
CancellablePromise: () => CancellablePromise,
CancelledRejectionError: () => CancelledRejectionError,
Clipboard: () => clipboard_exports,
Create: () => create_exports,
Dialogs: () => dialogs_exports,
Events: () => events_exports,
Flags: () => flags_exports,
IOS: () => ios_exports,
Screens: () => screens_exports,
System: () => system_exports,
WML: () => wml_exports,
Window: () => window_default,
clientId: () => clientId,
getTransport: () => getTransport,
objectNames: () => objectNames,
setTransport: () => setTransport
});
// desktop/@wailsio/runtime/src/wml.ts
var wml_exports = {};
__export(wml_exports, {
Enable: () => Enable,
Reload: () => Reload
});
// desktop/@wailsio/runtime/src/browser.ts
var browser_exports = {};
__export(browser_exports, {
OpenURL: () => OpenURL
});
// desktop/@wailsio/runtime/src/nanoid.ts
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
function nanoid(size = 21) {
let id = "";
let i = size | 0;
while (i--) {
id += urlAlphabet[Math.random() * 64 | 0];
}
return id;
}
// desktop/@wailsio/runtime/src/runtime.ts
var runtimeURL = window.location.origin + "/wails/runtime";
var objectNames = Object.freeze({
Call: 0,
Clipboard: 1,
Application: 2,
Events: 3,
ContextMenu: 4,
Dialog: 5,
Window: 6,
Screens: 7,
System: 8,
Browser: 9,
CancelCall: 10,
IOS: 11
});
var clientId = nanoid();
var customTransport = null;
function setTransport(transport) {
customTransport = transport;
}
function getTransport() {
return customTransport;
}
function newRuntimeCaller(object, windowName = "") {
return function(method, args = null) {
return runtimeCallWithID(object, method, windowName, args);
};
}
async function runtimeCallWithID(objectID, method, windowName, args) {
var _a2, _b;
if (customTransport) {
return customTransport.call(objectID, method, windowName, args);
}
let url = new URL(runtimeURL);
let body = {
object: objectID,
method
};
if (args !== null && args !== void 0) {
body.args = args;
}
let headers = {
["x-wails-client-id"]: clientId,
["Content-Type"]: "application/json"
};
if (windowName) {
headers["x-wails-window-name"] = windowName;
}
let response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body)
});
if (!response.ok) {
throw new Error(await response.text());
}
if (((_b = (_a2 = response.headers.get("Content-Type")) == null ? void 0 : _a2.indexOf("application/json")) != null ? _b : -1) !== -1) {
return response.json();
} else {
return response.text();
}
}
// desktop/@wailsio/runtime/src/browser.ts
var call = newRuntimeCaller(objectNames.Browser);
var BrowserOpenURL = 0;
function OpenURL(url) {
return call(BrowserOpenURL, { url: url.toString() });
}
// desktop/@wailsio/runtime/src/dialogs.ts
var dialogs_exports = {};
__export(dialogs_exports, {
Error: () => Error2,
Info: () => Info,
OpenFile: () => OpenFile,
Question: () => Question,
SaveFile: () => SaveFile,
Warning: () => Warning
});
window._wails = window._wails || {};
var call2 = newRuntimeCaller(objectNames.Dialog);
var DialogInfo = 0;
var DialogWarning = 1;
var DialogError = 2;
var DialogQuestion = 3;
var DialogOpenFile = 4;
var DialogSaveFile = 5;
function dialog(type, options = {}) {
return call2(type, options);
}
function Info(options) {
return dialog(DialogInfo, options);
}
function Warning(options) {
return dialog(DialogWarning, options);
}
function Error2(options) {
return dialog(DialogError, options);
}
function Question(options) {
return dialog(DialogQuestion, options);
}
function OpenFile(options) {
var _a2;
return (_a2 = dialog(DialogOpenFile, options)) != null ? _a2 : [];
}
function SaveFile(options) {
return dialog(DialogSaveFile, options);
}
// desktop/@wailsio/runtime/src/events.ts
var events_exports = {};
__export(events_exports, {
Emit: () => Emit,
Off: () => Off,
OffAll: () => OffAll,
On: () => On,
OnMultiple: () => OnMultiple,
Once: () => Once,
Types: () => Types,
WailsEvent: () => WailsEvent
});
// desktop/@wailsio/runtime/src/listener.ts
var eventListeners = /* @__PURE__ */ new Map();
var Listener = class {
constructor(eventName, callback, maxCallbacks) {
this.eventName = eventName;
this.callback = callback;
this.maxCallbacks = maxCallbacks || -1;
}
dispatch(data) {
try {
this.callback(data);
} catch (err) {
console.error(err);
}
if (this.maxCallbacks === -1) return false;
this.maxCallbacks -= 1;
return this.maxCallbacks === 0;
}
};
function listenerOff(listener) {
let listeners = eventListeners.get(listener.eventName);
if (!listeners) {
return;
}
listeners = listeners.filter((l) => l !== listener);
if (listeners.length === 0) {
eventListeners.delete(listener.eventName);
} else {
eventListeners.set(listener.eventName, listeners);
}
}
// desktop/@wailsio/runtime/src/create.ts
var create_exports = {};
__export(create_exports, {
Any: () => Any,
Array: () => Array2,
ByteSlice: () => ByteSlice,
Events: () => Events,
Map: () => Map2,
Nullable: () => Nullable,
Struct: () => Struct
});
function Any(source) {
return source;
}
function ByteSlice(source) {
return source == null ? "" : source;
}
function Array2(element) {
if (element === Any) {
return (source) => source === null ? [] : source;
}
return (source) => {
if (source === null) {
return [];
}
for (let i = 0; i < source.length; i++) {
source[i] = element(source[i]);
}
return source;
};
}
function Map2(key, value) {
if (value === Any) {
return (source) => source === null ? {} : source;
}
return (source) => {
if (source === null) {
return {};
}
for (const key2 in source) {
source[key2] = value(source[key2]);
}
return source;
};
}
function Nullable(element) {
if (element === Any) {
return Any;
}
return (source) => source === null ? null : element(source);
}
function Struct(createField) {
let allAny = true;
for (const name in createField) {
if (createField[name] !== Any) {
allAny = false;
break;
}
}
if (allAny) {
return Any;
}
return (source) => {
for (const name in createField) {
if (name in source) {
source[name] = createField[name](source[name]);
}
}
return source;
};
}
var Events = {};
// desktop/@wailsio/runtime/src/event_types.ts
var Types = Object.freeze({
Windows: Object.freeze({
APMPowerSettingChange: "windows:APMPowerSettingChange",
APMPowerStatusChange: "windows:APMPowerStatusChange",
APMResumeAutomatic: "windows:APMResumeAutomatic",
APMResumeSuspend: "windows:APMResumeSuspend",
APMSuspend: "windows:APMSuspend",
ApplicationStarted: "windows:ApplicationStarted",
SystemThemeChanged: "windows:SystemThemeChanged",
WebViewNavigationCompleted: "windows:WebViewNavigationCompleted",
WindowActive: "windows:WindowActive",
WindowBackgroundErase: "windows:WindowBackgroundErase",
WindowClickActive: "windows:WindowClickActive",
WindowClosing: "windows:WindowClosing",
WindowDidMove: "windows:WindowDidMove",
WindowDidResize: "windows:WindowDidResize",
WindowDPIChanged: "windows:WindowDPIChanged",
WindowDragDrop: "windows:WindowDragDrop",
WindowDragEnter: "windows:WindowDragEnter",
WindowDragLeave: "windows:WindowDragLeave",
WindowDragOver: "windows:WindowDragOver",
WindowEndMove: "windows:WindowEndMove",
WindowEndResize: "windows:WindowEndResize",
WindowFullscreen: "windows:WindowFullscreen",
WindowHide: "windows:WindowHide",
WindowInactive: "windows:WindowInactive",
WindowKeyDown: "windows:WindowKeyDown",
WindowKeyUp: "windows:WindowKeyUp",
WindowKillFocus: "windows:WindowKillFocus",
WindowNonClientHit: "windows:WindowNonClientHit",
WindowNonClientMouseDown: "windows:WindowNonClientMouseDown",
WindowNonClientMouseLeave: "windows:WindowNonClientMouseLeave",
WindowNonClientMouseMove: "windows:WindowNonClientMouseMove",
WindowNonClientMouseUp: "windows:WindowNonClientMouseUp",
WindowPaint: "windows:WindowPaint",
WindowRestore: "windows:WindowRestore",
WindowSetFocus: "windows:WindowSetFocus",
WindowShow: "windows:WindowShow",
WindowStartMove: "windows:WindowStartMove",
WindowStartResize: "windows:WindowStartResize",
WindowUnFullscreen: "windows:WindowUnFullscreen",
WindowZOrderChanged: "windows:WindowZOrderChanged",
WindowMinimise: "windows:WindowMinimise",
WindowUnMinimise: "windows:WindowUnMinimise",
WindowMaximise: "windows:WindowMaximise",
WindowUnMaximise: "windows:WindowUnMaximise"
}),
Mac: Object.freeze({
ApplicationDidBecomeActive: "mac:ApplicationDidBecomeActive",
ApplicationDidChangeBackingProperties: "mac:ApplicationDidChangeBackingProperties",
ApplicationDidChangeEffectiveAppearance: "mac:ApplicationDidChangeEffectiveAppearance",
ApplicationDidChangeIcon: "mac:ApplicationDidChangeIcon",
ApplicationDidChangeOcclusionState: "mac:ApplicationDidChangeOcclusionState",
ApplicationDidChangeScreenParameters: "mac:ApplicationDidChangeScreenParameters",
ApplicationDidChangeStatusBarFrame: "mac:ApplicationDidChangeStatusBarFrame",
ApplicationDidChangeStatusBarOrientation: "mac:ApplicationDidChangeStatusBarOrientation",
ApplicationDidChangeTheme: "mac:ApplicationDidChangeTheme",
ApplicationDidFinishLaunching: "mac:ApplicationDidFinishLaunching",
ApplicationDidHide: "mac:ApplicationDidHide",
ApplicationDidResignActive: "mac:ApplicationDidResignActive",
ApplicationDidUnhide: "mac:ApplicationDidUnhide",
ApplicationDidUpdate: "mac:ApplicationDidUpdate",
ApplicationShouldHandleReopen: "mac:ApplicationShouldHandleReopen",
ApplicationWillBecomeActive: "mac:ApplicationWillBecomeActive",
ApplicationWillFinishLaunching: "mac:ApplicationWillFinishLaunching",
ApplicationWillHide: "mac:ApplicationWillHide",
ApplicationWillResignActive: "mac:ApplicationWillResignActive",
ApplicationWillTerminate: "mac:ApplicationWillTerminate",
ApplicationWillUnhide: "mac:ApplicationWillUnhide",
ApplicationWillUpdate: "mac:ApplicationWillUpdate",
MenuDidAddItem: "mac:MenuDidAddItem",
MenuDidBeginTracking: "mac:MenuDidBeginTracking",
MenuDidClose: "mac:MenuDidClose",
MenuDidDisplayItem: "mac:MenuDidDisplayItem",
MenuDidEndTracking: "mac:MenuDidEndTracking",
MenuDidHighlightItem: "mac:MenuDidHighlightItem",
MenuDidOpen: "mac:MenuDidOpen",
MenuDidPopUp: "mac:MenuDidPopUp",
MenuDidRemoveItem: "mac:MenuDidRemoveItem",
MenuDidSendAction: "mac:MenuDidSendAction",
MenuDidSendActionToItem: "mac:MenuDidSendActionToItem",
MenuDidUpdate: "mac:MenuDidUpdate",
MenuWillAddItem: "mac:MenuWillAddItem",
MenuWillBeginTracking: "mac:MenuWillBeginTracking",
MenuWillDisplayItem: "mac:MenuWillDisplayItem",
MenuWillEndTracking: "mac:MenuWillEndTracking",
MenuWillHighlightItem: "mac:MenuWillHighlightItem",
MenuWillOpen: "mac:MenuWillOpen",
MenuWillPopUp: "mac:MenuWillPopUp",
MenuWillRemoveItem: "mac:MenuWillRemoveItem",
MenuWillSendAction: "mac:MenuWillSendAction",
MenuWillSendActionToItem: "mac:MenuWillSendActionToItem",
MenuWillUpdate: "mac:MenuWillUpdate",
WebViewDidCommitNavigation: "mac:WebViewDidCommitNavigation",
WebViewDidFinishNavigation: "mac:WebViewDidFinishNavigation",
WebViewDidReceiveServerRedirectForProvisionalNavigation: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",
WebViewDidStartProvisionalNavigation: "mac:WebViewDidStartProvisionalNavigation",
WindowDidBecomeKey: "mac:WindowDidBecomeKey",
WindowDidBecomeMain: "mac:WindowDidBecomeMain",
WindowDidBeginSheet: "mac:WindowDidBeginSheet",
WindowDidChangeAlpha: "mac:WindowDidChangeAlpha",
WindowDidChangeBackingLocation: "mac:WindowDidChangeBackingLocation",
WindowDidChangeBackingProperties: "mac:WindowDidChangeBackingProperties",
WindowDidChangeCollectionBehavior: "mac:WindowDidChangeCollectionBehavior",
WindowDidChangeEffectiveAppearance: "mac:WindowDidChangeEffectiveAppearance",
WindowDidChangeOcclusionState: "mac:WindowDidChangeOcclusionState",
WindowDidChangeOrderingMode: "mac:WindowDidChangeOrderingMode",
WindowDidChangeScreen: "mac:WindowDidChangeScreen",
WindowDidChangeScreenParameters: "mac:WindowDidChangeScreenParameters",
WindowDidChangeScreenProfile: "mac:WindowDidChangeScreenProfile",
WindowDidChangeScreenSpace: "mac:WindowDidChangeScreenSpace",
WindowDidChangeScreenSpaceProperties: "mac:WindowDidChangeScreenSpaceProperties",
WindowDidChangeSharingType: "mac:WindowDidChangeSharingType",
WindowDidChangeSpace: "mac:WindowDidChangeSpace",
WindowDidChangeSpaceOrderingMode: "mac:WindowDidChangeSpaceOrderingMode",
WindowDidChangeTitle: "mac:WindowDidChangeTitle",
WindowDidChangeToolbar: "mac:WindowDidChangeToolbar",
WindowDidDeminiaturize: "mac:WindowDidDeminiaturize",
WindowDidEndSheet: "mac:WindowDidEndSheet",
WindowDidEnterFullScreen: "mac:WindowDidEnterFullScreen",
WindowDidEnterVersionBrowser: "mac:WindowDidEnterVersionBrowser",
WindowDidExitFullScreen: "mac:WindowDidExitFullScreen",
WindowDidExitVersionBrowser: "mac:WindowDidExitVersionBrowser",
WindowDidExpose: "mac:WindowDidExpose",
WindowDidFocus: "mac:WindowDidFocus",
WindowDidMiniaturize: "mac:WindowDidMiniaturize",
WindowDidMove: "mac:WindowDidMove",
WindowDidOrderOffScreen: "mac:WindowDidOrderOffScreen",
WindowDidOrderOnScreen: "mac:WindowDidOrderOnScreen",
WindowDidResignKey: "mac:WindowDidResignKey",
WindowDidResignMain: "mac:WindowDidResignMain",
WindowDidResize: "mac:WindowDidResize",
WindowDidUpdate: "mac:WindowDidUpdate",
WindowDidUpdateAlpha: "mac:WindowDidUpdateAlpha",
WindowDidUpdateCollectionBehavior: "mac:WindowDidUpdateCollectionBehavior",
WindowDidUpdateCollectionProperties: "mac:WindowDidUpdateCollectionProperties",
WindowDidUpdateShadow: "mac:WindowDidUpdateShadow",
WindowDidUpdateTitle: "mac:WindowDidUpdateTitle",
WindowDidUpdateToolbar: "mac:WindowDidUpdateToolbar",
WindowDidZoom: "mac:WindowDidZoom",
WindowFileDraggingEntered: "mac:WindowFileDraggingEntered",
WindowFileDraggingExited: "mac:WindowFileDraggingExited",
WindowFileDraggingPerformed: "mac:WindowFileDraggingPerformed",
WindowHide: "mac:WindowHide",
WindowMaximise: "mac:WindowMaximise",
WindowUnMaximise: "mac:WindowUnMaximise",
WindowMinimise: "mac:WindowMinimise",
WindowUnMinimise: "mac:WindowUnMinimise",
WindowShouldClose: "mac:WindowShouldClose",
WindowShow: "mac:WindowShow",
WindowWillBecomeKey: "mac:WindowWillBecomeKey",
WindowWillBecomeMain: "mac:WindowWillBecomeMain",
WindowWillBeginSheet: "mac:WindowWillBeginSheet",
WindowWillChangeOrderingMode: "mac:WindowWillChangeOrderingMode",
WindowWillClose: "mac:WindowWillClose",
WindowWillDeminiaturize: "mac:WindowWillDeminiaturize",
WindowWillEnterFullScreen: "mac:WindowWillEnterFullScreen",
WindowWillEnterVersionBrowser: "mac:WindowWillEnterVersionBrowser",
WindowWillExitFullScreen: "mac:WindowWillExitFullScreen",
WindowWillExitVersionBrowser: "mac:WindowWillExitVersionBrowser",
WindowWillFocus: "mac:WindowWillFocus",
WindowWillMiniaturize: "mac:WindowWillMiniaturize",
WindowWillMove: "mac:WindowWillMove",
WindowWillOrderOffScreen: "mac:WindowWillOrderOffScreen",
WindowWillOrderOnScreen: "mac:WindowWillOrderOnScreen",
WindowWillResignMain: "mac:WindowWillResignMain",
WindowWillResize: "mac:WindowWillResize",
WindowWillUnfocus: "mac:WindowWillUnfocus",
WindowWillUpdate: "mac:WindowWillUpdate",
WindowWillUpdateAlpha: "mac:WindowWillUpdateAlpha",
WindowWillUpdateCollectionBehavior: "mac:WindowWillUpdateCollectionBehavior",
WindowWillUpdateCollectionProperties: "mac:WindowWillUpdateCollectionProperties",
WindowWillUpdateShadow: "mac:WindowWillUpdateShadow",
WindowWillUpdateTitle: "mac:WindowWillUpdateTitle",
WindowWillUpdateToolbar: "mac:WindowWillUpdateToolbar",
WindowWillUpdateVisibility: "mac:WindowWillUpdateVisibility",
WindowWillUseStandardFrame: "mac:WindowWillUseStandardFrame",
WindowZoomIn: "mac:WindowZoomIn",
WindowZoomOut: "mac:WindowZoomOut",
WindowZoomReset: "mac:WindowZoomReset"
}),
Linux: Object.freeze({
ApplicationStartup: "linux:ApplicationStartup",
SystemThemeChanged: "linux:SystemThemeChanged",
WindowDeleteEvent: "linux:WindowDeleteEvent",
WindowDidMove: "linux:WindowDidMove",
WindowDidResize: "linux:WindowDidResize",
WindowFocusIn: "linux:WindowFocusIn",
WindowFocusOut: "linux:WindowFocusOut",
WindowLoadStarted: "linux:WindowLoadStarted",
WindowLoadRedirected: "linux:WindowLoadRedirected",
WindowLoadCommitted: "linux:WindowLoadCommitted",
WindowLoadFinished: "linux:WindowLoadFinished"
}),
iOS: Object.freeze({
ApplicationDidBecomeActive: "ios:ApplicationDidBecomeActive",
ApplicationDidEnterBackground: "ios:ApplicationDidEnterBackground",
ApplicationDidFinishLaunching: "ios:ApplicationDidFinishLaunching",
ApplicationDidReceiveMemoryWarning: "ios:ApplicationDidReceiveMemoryWarning",
ApplicationWillEnterForeground: "ios:ApplicationWillEnterForeground",
ApplicationWillResignActive: "ios:ApplicationWillResignActive",
ApplicationWillTerminate: "ios:ApplicationWillTerminate",
WindowDidLoad: "ios:WindowDidLoad",
WindowWillAppear: "ios:WindowWillAppear",
WindowDidAppear: "ios:WindowDidAppear",
WindowWillDisappear: "ios:WindowWillDisappear",
WindowDidDisappear: "ios:WindowDidDisappear",
WindowSafeAreaInsetsChanged: "ios:WindowSafeAreaInsetsChanged",
WindowOrientationChanged: "ios:WindowOrientationChanged",
WindowTouchBegan: "ios:WindowTouchBegan",
WindowTouchMoved: "ios:WindowTouchMoved",
WindowTouchEnded: "ios:WindowTouchEnded",
WindowTouchCancelled: "ios:WindowTouchCancelled",
WebViewDidStartNavigation: "ios:WebViewDidStartNavigation",
WebViewDidFinishNavigation: "ios:WebViewDidFinishNavigation",
WebViewDidFailNavigation: "ios:WebViewDidFailNavigation",
WebViewDecidePolicyForNavigationAction: "ios:WebViewDecidePolicyForNavigationAction"
}),
Common: Object.freeze({
ApplicationOpenedWithFile: "common:ApplicationOpenedWithFile",
ApplicationStarted: "common:ApplicationStarted",
ApplicationLaunchedWithUrl: "common:ApplicationLaunchedWithUrl",
ThemeChanged: "common:ThemeChanged",
WindowClosing: "common:WindowClosing",
WindowDidMove: "common:WindowDidMove",
WindowDidResize: "common:WindowDidResize",
WindowDPIChanged: "common:WindowDPIChanged",
WindowFilesDropped: "common:WindowFilesDropped",
WindowFocus: "common:WindowFocus",
WindowFullscreen: "common:WindowFullscreen",
WindowHide: "common:WindowHide",
WindowLostFocus: "common:WindowLostFocus",
WindowMaximise: "common:WindowMaximise",
WindowMinimise: "common:WindowMinimise",
WindowToggleFrameless: "common:WindowToggleFrameless",
WindowRestore: "common:WindowRestore",
WindowRuntimeReady: "common:WindowRuntimeReady",
WindowShow: "common:WindowShow",
WindowUnFullscreen: "common:WindowUnFullscreen",
WindowUnMaximise: "common:WindowUnMaximise",
WindowUnMinimise: "common:WindowUnMinimise",
WindowZoom: "common:WindowZoom",
WindowZoomIn: "common:WindowZoomIn",
WindowZoomOut: "common:WindowZoomOut",
WindowZoomReset: "common:WindowZoomReset"
})
});
// desktop/@wailsio/runtime/src/events.ts
window._wails = window._wails || {};
window._wails.dispatchWailsEvent = dispatchWailsEvent;
var call3 = newRuntimeCaller(objectNames.Events);
var EmitMethod = 0;
var WailsEvent = class {
constructor(name, data) {
this.name = name;
this.data = data != null ? data : null;
}
};
function dispatchWailsEvent(event) {
let listeners = eventListeners.get(event.name);
if (!listeners) {
return;
}
let wailsEvent = new WailsEvent(
event.name,
event.name in Events ? Events[event.name](event.data) : event.data
);
if ("sender" in event) {
wailsEvent.sender = event.sender;
}
listeners = listeners.filter((listener) => !listener.dispatch(wailsEvent));
if (listeners.length === 0) {
eventListeners.delete(event.name);
} else {
eventListeners.set(event.name, listeners);
}
}
function OnMultiple(eventName, callback, maxCallbacks) {
let listeners = eventListeners.get(eventName) || [];
const thisListener = new Listener(eventName, callback, maxCallbacks);
listeners.push(thisListener);
eventListeners.set(eventName, listeners);
return () => listenerOff(thisListener);
}
function On(eventName, callback) {
return OnMultiple(eventName, callback, -1);
}
function Once(eventName, callback) {
return OnMultiple(eventName, callback, 1);
}
function Off(...eventNames) {
eventNames.forEach((eventName) => eventListeners.delete(eventName));
}
function OffAll() {
eventListeners.clear();
}
function Emit(name, data) {
return call3(EmitMethod, new WailsEvent(name, data));
}
// desktop/@wailsio/runtime/src/utils.ts
function debugLog(message) {
console.log(
"%c wails3 %c " + message + " ",
"background: #aa0000; color: #fff; border-radius: 3px 0px 0px 3px; padding: 1px; font-size: 0.7rem",
"background: #009900; color: #fff; border-radius: 0px 3px 3px 0px; padding: 1px; font-size: 0.7rem"
);
}
function canTrackButtons() {
return new MouseEvent("mousedown").buttons === 0;
}
function canAbortListeners() {
if (!EventTarget || !AbortSignal || !AbortController)
return false;
let result = true;
const target = new EventTarget();
const controller = new AbortController();
target.addEventListener("test", () => {
result = false;
}, { signal: controller.signal });
controller.abort();
target.dispatchEvent(new CustomEvent("test"));
return result;
}
function eventTarget(event) {
var _a2;
if (event.target instanceof HTMLElement) {
return event.target;
} else if (!(event.target instanceof HTMLElement) && event.target instanceof Node) {
return (_a2 = event.target.parentElement) != null ? _a2 : document.body;
} else {
return document.body;
}
}
var isReady = false;
document.addEventListener("DOMContentLoaded", () => {
isReady = true;
});
function whenReady(callback) {
if (isReady || document.readyState === "complete") {
callback();
} else {
document.addEventListener("DOMContentLoaded", callback);
}
}
// desktop/@wailsio/runtime/src/window.ts
var DROP_TARGET_ATTRIBUTE = "data-file-drop-target";
var DROP_TARGET_ACTIVE_CLASS = "file-drop-target-active";
var currentDropTarget = null;
var PositionMethod = 0;
var CenterMethod = 1;
var CloseMethod = 2;
var DisableSizeConstraintsMethod = 3;
var EnableSizeConstraintsMethod = 4;
var FocusMethod = 5;
var ForceReloadMethod = 6;
var FullscreenMethod = 7;
var GetScreenMethod = 8;
var GetZoomMethod = 9;
var HeightMethod = 10;
var HideMethod = 11;
var IsFocusedMethod = 12;
var IsFullscreenMethod = 13;
var IsMaximisedMethod = 14;
var IsMinimisedMethod = 15;
var MaximiseMethod = 16;
var MinimiseMethod = 17;
var NameMethod = 18;
var OpenDevToolsMethod = 19;
var RelativePositionMethod = 20;
var ReloadMethod = 21;
var ResizableMethod = 22;
var RestoreMethod = 23;
var SetPositionMethod = 24;
var SetAlwaysOnTopMethod = 25;
var SetBackgroundColourMethod = 26;
var SetFramelessMethod = 27;
var SetFullscreenButtonEnabledMethod = 28;
var SetMaxSizeMethod = 29;
var SetMinSizeMethod = 30;
var SetRelativePositionMethod = 31;
var SetResizableMethod = 32;
var SetSizeMethod = 33;
var SetTitleMethod = 34;
var SetZoomMethod = 35;
var ShowMethod = 36;
var SizeMethod = 37;
var ToggleFullscreenMethod = 38;
var ToggleMaximiseMethod = 39;
var ToggleFramelessMethod = 40;
var UnFullscreenMethod = 41;
var UnMaximiseMethod = 42;
var UnMinimiseMethod = 43;
var WidthMethod = 44;
var ZoomMethod = 45;
var ZoomInMethod = 46;
var ZoomOutMethod = 47;
var ZoomResetMethod = 48;
var SnapAssistMethod = 49;
var FilesDropped = 50;
var PrintMethod = 51;
function getDropTargetElement(element) {
if (!element) {
return null;
}
return element.closest("[".concat(DROP_TARGET_ATTRIBUTE, "]"));
}
function canResolveFilePaths() {
var _a2, _b, _c, _d;
if (((_b = (_a2 = window.chrome) == null ? void 0 : _a2.webview) == null ? void 0 : _b.postMessageWithAdditionalObjects) == null) {
return false;
}
return ((_d = (_c = window._wails) == null ? void 0 : _c.flags) == null ? void 0 : _d.enableFileDrop) === true;
}
function resolveFilePaths(x, y, files) {
var _a2, _b;
if ((_b = (_a2 = window.chrome) == null ? void 0 : _a2.webview) == null ? void 0 : _b.postMessageWithAdditionalObjects) {
window.chrome.webview.postMessageWithAdditionalObjects("file:drop:".concat(x, ":").concat(y), files);
}
}
var nativeDragActive = false;
function cleanupNativeDrag() {
nativeDragActive = false;
if (currentDropTarget) {
currentDropTarget.classList.remove(DROP_TARGET_ACTIVE_CLASS);
currentDropTarget = null;
}
}
function handleDragEnter() {
var _a2, _b;
if (((_b = (_a2 = window._wails) == null ? void 0 : _a2.flags) == null ? void 0 : _b.enableFileDrop) === false) {
return;
}
nativeDragActive = true;
}
function handleDragLeave() {
cleanupNativeDrag();
}
function handleDragOver(x, y) {
var _a2, _b;
if (!nativeDragActive) return;
if (((_b = (_a2 = window._wails) == null ? void 0 : _a2.flags) == null ? void 0 : _b.enableFileDrop) === false) {
return;
}
const targetElement = document.elementFromPoint(x, y);
const dropTarget = getDropTargetElement(targetElement);
if (currentDropTarget && currentDropTarget !== dropTarget) {
currentDropTarget.classList.remove(DROP_TARGET_ACTIVE_CLASS);
}
if (dropTarget) {
dropTarget.classList.add(DROP_TARGET_ACTIVE_CLASS);
currentDropTarget = dropTarget;
} else {
currentDropTarget = null;
}
}
var callerSym = /* @__PURE__ */ Symbol("caller");
callerSym;
var _Window = class _Window {
/**
* Initialises a window object with the specified name.
*
* @private
* @param name - The name of the target window.
*/
constructor(name = "") {
this[callerSym] = newRuntimeCaller(objectNames.Window, name);
for (const method of Object.getOwnPropertyNames(_Window.prototype)) {
if (method !== "constructor" && typeof this[method] === "function") {
this[method] = this[method].bind(this);
}
}
}
/**
* Gets the specified window.
*
* @param name - The name of the window to get.
* @returns The corresponding window object.
*/
Get(name) {
return new _Window(name);
}
/**
* Returns the absolute position of the window.
*
* @returns The current absolute position of the window.
*/
Position() {
return this[callerSym](PositionMethod);
}
/**
* Centers the window on the screen.
*/
Center() {
return this[callerSym](CenterMethod);
}
/**
* Closes the window.
*/
Close() {
return this[callerSym](CloseMethod);
}
/**
* Disables min/max size constraints.
*/
DisableSizeConstraints() {
return this[callerSym](DisableSizeConstraintsMethod);
}
/**
* Enables min/max size constraints.
*/
EnableSizeConstraints() {
return this[callerSym](EnableSizeConstraintsMethod);
}
/**
* Focuses the window.
*/
Focus() {
return this[callerSym](FocusMethod);
}
/**
* Forces the window to reload the page assets.
*/
ForceReload() {
return this[callerSym](ForceReloadMethod);
}
/**
* Switches the window to fullscreen mode.
*/
Fullscreen() {
return this[callerSym](FullscreenMethod);
}
/**
* Returns the screen that the window is on.
*
* @returns The screen the window is currently on.
*/
GetScreen() {
return this[callerSym](GetScreenMethod);
}
/**
* Returns the current zoom level of the window.
*
* @returns The current zoom level.
*/
GetZoom() {
return this[callerSym](GetZoomMethod);
}
/**
* Returns the height of the window.
*
* @returns The current height of the window.
*/
Height() {
return this[callerSym](HeightMethod);
}
/**
* Hides the window.
*/
Hide() {
return this[callerSym](HideMethod);
}
/**
* Returns true if the window is focused.
*
* @returns Whether the window is currently focused.
*/
IsFocused() {
return this[callerSym](IsFocusedMethod);
}
/**
* Returns true if the window is fullscreen.
*
* @returns Whether the window is currently fullscreen.
*/
IsFullscreen() {
return this[callerSym](IsFullscreenMethod);
}
/**
* Returns true if the window is maximised.
*
* @returns Whether the window is currently maximised.
*/
IsMaximised() {
return this[callerSym](IsMaximisedMethod);
}
/**
* Returns true if the window is minimised.
*
* @returns Whether the window is currently minimised.
*/
IsMinimised() {
return this[callerSym](IsMinimisedMethod);
}
/**
* Maximises the window.
*/
Maximise() {
return this[callerSym](MaximiseMethod);
}
/**
* Minimises the window.
*/
Minimise() {
return this[callerSym](MinimiseMethod);
}
/**
* Returns the name of the window.
*
* @returns The name of the window.
*/
Name() {
return this[callerSym](NameMethod);
}
/**
* Opens the development tools pane.
*/
OpenDevTools() {
return this[callerSym](OpenDevToolsMethod);
}
/**
* Returns the relative position of the window to the screen.
*
* @returns The current relative position of the window.
*/
RelativePosition() {
return this[callerSym](RelativePositionMethod);
}
/**
* Reloads the page assets.
*/
Reload() {
return this[callerSym](ReloadMethod);
}
/**
* Returns true if the window is resizable.
*
* @returns Whether the window is currently resizable.
*/
Resizable() {
return this[callerSym](ResizableMethod);
}
/**
* Restores the window to its previous state if it was previously minimised, maximised or fullscreen.
*/
Restore() {
return this[callerSym](RestoreMethod);
}
/**
* Sets the absolute position of the window.
*
* @param x - The desired horizontal absolute position of the window.
* @param y - The desired vertical absolute position of the window.
*/
SetPosition(x, y) {
return this[callerSym](SetPositionMethod, { x, y });
}
/**
* Sets the window to be always on top.
*
* @param alwaysOnTop - Whether the window should stay on top.
*/
SetAlwaysOnTop(alwaysOnTop) {
return this[callerSym](SetAlwaysOnTopMethod, { alwaysOnTop });
}
/**
* Sets the background colour of the window.
*
* @param r - The desired red component of the window background.
* @param g - The desired green component of the window background.
* @param b - The desired blue component of the window background.
* @param a - The desired alpha component of the window background.
*/
SetBackgroundColour(r, g, b, a) {
return this[callerSym](SetBackgroundColourMethod, { r, g, b, a });
}
/**
* Removes the window frame and title bar.
*
* @param frameless - Whether the window should be frameless.
*/
SetFrameless(frameless) {
return this[callerSym](SetFramelessMethod, { frameless });
}
/**
* Disables the system fullscreen button.
*
* @param enabled - Whether the fullscreen button should be enabled.
*/
SetFullscreenButtonEnabled(enabled) {
return this[callerSym](SetFullscreenButtonEnabledMethod, { enabled });
}
/**
* Sets the maximum size of the window.