@openuverse/rdesign 0.0.0-stage → 1.1.7

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 (160) hide show
  1. package/README.md +15 -2
  2. package/dist/_plugin-vue_export-helper-BA5b-u6G.cjs +13 -0
  3. package/dist/_plugin-vue_export-helper-Dm0LCMqW.js +1320 -0
  4. package/dist/font.woff2 +0 -0
  5. package/dist/http-live-player-C_ZWcEpn.cjs +54 -0
  6. package/dist/http-live-player-DyiocXCZ.js +18278 -0
  7. package/dist/icons.cjs.js +1 -0
  8. package/dist/icons.es.js +256521 -0
  9. package/dist/rdesign.cjs.js +2275 -0
  10. package/dist/rdesign.es.js +59054 -0
  11. package/dist/style.css +1 -0
  12. package/dist/types/icons.d.ts +2 -0
  13. package/dist/types/rdesign.d.ts +6 -0
  14. package/dist/types/src/App.vue.d.ts +4 -0
  15. package/dist/types/src/components/RAffix/index.d.ts +128 -0
  16. package/dist/types/src/components/RAlert/index.d.ts +171 -0
  17. package/dist/types/src/components/RAnchor/index.d.ts +298 -0
  18. package/dist/types/src/components/RAutoComplete/index.d.ts +431 -0
  19. package/dist/types/src/components/RAvatar/index.d.ts +260 -0
  20. package/dist/types/src/components/RBackTop/index.d.ts +215 -0
  21. package/dist/types/src/components/RBadge/index.d.ts +176 -0
  22. package/dist/types/src/components/RBreadcrumb/index.d.ts +324 -0
  23. package/dist/types/src/components/RButton/index.d.ts +295 -0
  24. package/dist/types/src/components/RCalendar/index.d.ts +291 -0
  25. package/dist/types/src/components/RCard/index.d.ts +351 -0
  26. package/dist/types/src/components/RCascader/index.d.ts +1433 -0
  27. package/dist/types/src/components/RCheckbox/index.d.ts +403 -0
  28. package/dist/types/src/components/RCollapse/index.d.ts +291 -0
  29. package/dist/types/src/components/RColorPicker/index.d.ts +577 -0
  30. package/dist/types/src/components/RComment/index.d.ts +104 -0
  31. package/dist/types/src/components/RConfigProvider/index.d.ts +19 -0
  32. package/dist/types/src/components/RDatePicker/index.d.ts +1720 -0
  33. package/dist/types/src/components/RDescriptions/index.d.ts +271 -0
  34. package/dist/types/src/components/RDialog/index.d.ts +906 -0
  35. package/dist/types/src/components/RDivider/index.d.ts +112 -0
  36. package/dist/types/src/components/RDrawer/index.d.ts +398 -0
  37. package/dist/types/src/components/RDropdown/index.d.ts +621 -0
  38. package/dist/types/src/components/REmpty/index.d.ts +129 -0
  39. package/dist/types/src/components/RForm/index.d.ts +569 -0
  40. package/dist/types/src/components/RGrid/index.d.ts +659 -0
  41. package/dist/types/src/components/RGuide/index.d.ts +266 -0
  42. package/dist/types/src/components/RIcon/index.d.ts +3 -0
  43. package/dist/types/src/components/RImage/index.d.ts +270 -0
  44. package/dist/types/src/components/RImageViewer/index.d.ts +357 -0
  45. package/dist/types/src/components/RInput/index.d.ts +555 -0
  46. package/dist/types/src/components/RInputAdornment/index.d.ts +44 -0
  47. package/dist/types/src/components/RInputNumber/RInputNumber.vue.d.ts +41 -0
  48. package/dist/types/src/components/RInputNumber/index.d.ts +53 -0
  49. package/dist/types/src/components/RLayout/index.d.ts +176 -0
  50. package/dist/types/src/components/RLink/index.d.ts +228 -0
  51. package/dist/types/src/components/RList/index.d.ts +513 -0
  52. package/dist/types/src/components/RLoading/index.d.ts +220 -0
  53. package/dist/types/src/components/RMenu/index.d.ts +1423 -0
  54. package/dist/types/src/components/RMessage/index.d.ts +140 -0
  55. package/dist/types/src/components/RNotification/index.d.ts +174 -0
  56. package/dist/types/src/components/RPagination/index.d.ts +529 -0
  57. package/dist/types/src/components/RPopconfirm/index.d.ts +262 -0
  58. package/dist/types/src/components/RPopup/index.d.ts +308 -0
  59. package/dist/types/src/components/RProgress/index.d.ts +169 -0
  60. package/dist/types/src/components/RQRCode/index.d.ts +238 -0
  61. package/dist/types/src/components/RRadio/index.d.ts +605 -0
  62. package/dist/types/src/components/RRangeInput/index.d.ts +538 -0
  63. package/dist/types/src/components/RRate/index.d.ts +230 -0
  64. package/dist/types/src/components/RScpiAutoComplete/RScpiAutoComplete.vue.d.ts +13 -0
  65. package/dist/types/src/components/RScpiAutoComplete/index.d.ts +15 -0
  66. package/dist/types/src/components/RScpiAutoComplete/scpiAutoCompleteEngine.d.ts +60 -0
  67. package/dist/types/src/components/RScpiAutoComplete/scpiSegmentMatch.d.ts +15 -0
  68. package/dist/types/src/components/RScpiAutoComplete/types.d.ts +8 -0
  69. package/dist/types/src/components/RScpiAutoComplete/useScpiAutoComplete.d.ts +31 -0
  70. package/dist/types/src/components/RScpiTree/RScpiTree.vue.d.ts +14 -0
  71. package/dist/types/src/components/RScpiTree/RScpiTreeNode.vue.d.ts +9 -0
  72. package/dist/types/src/components/RScpiTree/index.d.ts +17 -0
  73. package/dist/types/src/components/RScpiTree/scpiTreeContext.d.ts +3 -0
  74. package/dist/types/src/components/RScpiTree/types.d.ts +25 -0
  75. package/dist/types/src/components/RScroller/index.d.ts +95 -0
  76. package/dist/types/src/components/RSelect/index.d.ts +887 -0
  77. package/dist/types/src/components/RSelectInput/index.d.ts +497 -0
  78. package/dist/types/src/components/RSkeleton/index.d.ts +143 -0
  79. package/dist/types/src/components/RSlider/index.d.ts +404 -0
  80. package/dist/types/src/components/RSpace/index.d.ts +107 -0
  81. package/dist/types/src/components/RSplitView/RSplitView.vue.d.ts +196 -0
  82. package/dist/types/src/components/RSplitView/composables/defaultSizes.d.ts +3 -0
  83. package/dist/types/src/components/RSplitView/composables/useSplitLayoutStrategy.d.ts +28 -0
  84. package/dist/types/src/components/RSplitView/composables/useSplitPanes.d.ts +14 -0
  85. package/dist/types/src/components/RSplitView/composables/useSplitViewState.d.ts +66 -0
  86. package/dist/types/src/components/RSplitView/index.d.ts +147 -0
  87. package/dist/types/src/components/RSplitView/layouts/RSplitComplexLayout.vue.d.ts +53 -0
  88. package/dist/types/src/components/RSplitView/layouts/RSplitDoubleLayout.vue.d.ts +33 -0
  89. package/dist/types/src/components/RSplitView/layouts/RSplitQuadLayout.vue.d.ts +43 -0
  90. package/dist/types/src/components/RSplitView/layouts/RSplitSingleLayout.vue.d.ts +27 -0
  91. package/dist/types/src/components/RSplitView/splitViewContext.d.ts +13 -0
  92. package/dist/types/src/components/RSplitView/types.d.ts +53 -0
  93. package/dist/types/src/components/RStatistic/index.d.ts +222 -0
  94. package/dist/types/src/components/RSteps/index.d.ts +340 -0
  95. package/dist/types/src/components/RStickyTool/index.d.ts +363 -0
  96. package/dist/types/src/components/RSwiper/index.d.ts +676 -0
  97. package/dist/types/src/components/RSwitch/index.d.ts +175 -0
  98. package/dist/types/src/components/RTable/index.d.ts +4634 -0
  99. package/dist/types/src/components/RTabs/index.d.ts +357 -0
  100. package/dist/types/src/components/RTag/index.d.ts +517 -0
  101. package/dist/types/src/components/RTagInput/index.d.ts +464 -0
  102. package/dist/types/src/components/RTextarea/index.d.ts +278 -0
  103. package/dist/types/src/components/RTimePicker/index.d.ts +1007 -0
  104. package/dist/types/src/components/RTimeline/index.d.ts +238 -0
  105. package/dist/types/src/components/RTooltip/index.d.ts +352 -0
  106. package/dist/types/src/components/RTransfer/index.d.ts +383 -0
  107. package/dist/types/src/components/RTree/index.d.ts +738 -0
  108. package/dist/types/src/components/RTreeSelect/index.d.ts +563 -0
  109. package/dist/types/src/components/RUpload/index.d.ts +774 -0
  110. package/dist/types/src/components/RWatermark/index.d.ts +277 -0
  111. package/dist/types/src/components/RWebControl/RWebControl.vue.d.ts +7 -0
  112. package/dist/types/src/components/RWebControl/WebControlForAndroid.vue.d.ts +21 -0
  113. package/dist/types/src/components/RWebControl/WebControlForH5.vue.d.ts +14 -0
  114. package/dist/types/src/components/RWebControl/WebControlForLinux.vue.d.ts +15 -0
  115. package/dist/types/src/components/RWebControl/WebControlForRIGOLOS.vue.d.ts +16 -0
  116. package/dist/types/src/components/RWebControl/WebControlForRIGOLQT.vue.d.ts +15 -0
  117. package/dist/types/src/components/RWebControl/WebControlOverlay.vue.d.ts +17 -0
  118. package/dist/types/src/components/RWebControl/index.d.ts +10 -0
  119. package/dist/types/src/components/RWebControl/types.d.ts +9 -0
  120. package/dist/types/src/components/RWebControl/useWebControlLocale.d.ts +2 -0
  121. package/dist/types/src/components/scpi/types.d.ts +19 -0
  122. package/dist/types/src/components/webcontrol/cbor.d.ts +21 -0
  123. package/dist/types/src/components/webcontrol/loadWSAvcPlayer.d.ts +6 -0
  124. package/dist/types/src/components/webcontrol/locale.d.ts +8 -0
  125. package/dist/types/src/components/webcontrol/logger.d.ts +5 -0
  126. package/dist/types/src/components/webcontrol/types.d.ts +71 -0
  127. package/dist/types/src/components/webcontrol/webcontrolContext.d.ts +6 -0
  128. package/dist/types/src/core/common.d.ts +5 -0
  129. package/dist/types/src/core/component-list.d.ts +17 -0
  130. package/dist/types/src/core/components.d.ts +80 -0
  131. package/dist/types/src/core/index.d.ts +9 -0
  132. package/dist/types/src/core/styles.d.ts +0 -0
  133. package/dist/types/src/icons/index.d.ts +6 -0
  134. package/dist/types/src/index.d.ts +30 -0
  135. package/dist/types/src/locale/ar_KW.d.ts +242 -0
  136. package/dist/types/src/locale/de_DE.d.ts +265 -0
  137. package/dist/types/src/locale/en_US.d.ts +266 -0
  138. package/dist/types/src/locale/es_ES.d.ts +265 -0
  139. package/dist/types/src/locale/fr_FR.d.ts +265 -0
  140. package/dist/types/src/locale/id_ID.d.ts +265 -0
  141. package/dist/types/src/locale/index.d.ts +31 -0
  142. package/dist/types/src/locale/it_IT.d.ts +266 -0
  143. package/dist/types/src/locale/ja_JP.d.ts +266 -0
  144. package/dist/types/src/locale/ko_KR.d.ts +266 -0
  145. package/dist/types/src/locale/pl_PL.d.ts +265 -0
  146. package/dist/types/src/locale/pt_BR.d.ts +265 -0
  147. package/dist/types/src/locale/ru_RU.d.ts +266 -0
  148. package/dist/types/src/locale/th_TH.d.ts +265 -0
  149. package/dist/types/src/locale/zh_CN.d.ts +266 -0
  150. package/dist/types/src/locale/zh_TW.d.ts +266 -0
  151. package/dist/types/src/main.d.ts +0 -0
  152. package/dist/types/src/types/component.d.ts +38 -0
  153. package/dist/types/src/utils/index.d.ts +2 -0
  154. package/dist/types/src/webcontrol/index.d.ts +1 -0
  155. package/dist/types/vite.config.d.ts +7 -0
  156. package/dist/types/webcontrol.d.ts +2 -0
  157. package/dist/vite.svg +1 -0
  158. package/dist/webcontrol.cjs.js +4 -0
  159. package/dist/webcontrol.es.js +4617 -0
  160. package/package.json +118 -4
@@ -0,0 +1,266 @@
1
+ declare const zhTWLocale: {
2
+ webControl: import('../components/RWebControl').WebControlLocaleTexts;
3
+ autoComplete: {
4
+ readonly empty: "\u66AB\u7121\u6578\u64DA";
5
+ };
6
+ pagination: {
7
+ readonly itemsPerPage: "{size} \u9805/\u9801";
8
+ readonly jumpTo: "\u8DF3\u81F3";
9
+ readonly page: "\u9801";
10
+ readonly total: "\u5171 {count} \u9805\u6578\u64DA";
11
+ };
12
+ cascader: {
13
+ readonly empty: "\u66AB\u7121\u6578\u64DA";
14
+ readonly loadingText: "\u8F09\u5165\u4E2D";
15
+ readonly placeholder: "\u8ACB\u9078\u64C7";
16
+ };
17
+ calendar: {
18
+ readonly yearSelection: "{year} \u5E74";
19
+ readonly monthSelection: "{month} \u6708";
20
+ readonly yearRadio: "\u5E74";
21
+ readonly monthRadio: "\u6708";
22
+ readonly hideWeekend: "\u96B1\u85CF\u9031\u672B";
23
+ readonly showWeekend: "\u986F\u793A\u9031\u672B";
24
+ readonly today: "\u4ECA\u5929";
25
+ readonly thisMonth: "\u672C\u6708";
26
+ readonly week: "\u4E00,\u4E8C,\u4E09,\u56DB,\u4E94,\u516D,\u65E5";
27
+ readonly cellMonth: "1 \u6708,2 \u6708,3 \u6708,4 \u6708,5 \u6708,6 \u6708,7 \u6708,8 \u6708,9 \u6708,10 \u6708,11 \u6708,12 \u6708";
28
+ };
29
+ transfer: {
30
+ readonly title: "{checked} / {total} \u9805";
31
+ readonly empty: "\u66AB\u7121\u6578\u64DA";
32
+ readonly placeholder: "\u8ACB\u8F38\u5165\u95DC\u9375\u8A5E\u641C\u5C0B";
33
+ };
34
+ timePicker: {
35
+ readonly dayjsLocale: "zh-tw";
36
+ readonly now: "\u6B64\u523B";
37
+ readonly confirm: "\u78BA\u8A8D";
38
+ readonly anteMeridiem: "\u4E0A\u5348";
39
+ readonly postMeridiem: "\u4E0B\u5348";
40
+ readonly placeholder: "\u9078\u64C7\u6642\u9593";
41
+ };
42
+ dialog: {
43
+ readonly confirm: "\u78BA\u8A8D";
44
+ readonly cancel: "\u53D6\u6D88";
45
+ };
46
+ drawer: {
47
+ readonly confirm: "\u78BA\u8A8D";
48
+ readonly cancel: "\u53D6\u6D88";
49
+ };
50
+ popconfirm: {
51
+ readonly confirm: {
52
+ readonly content: "\u78BA\u8A8D";
53
+ };
54
+ readonly cancel: {
55
+ readonly content: "\u53D6\u6D88";
56
+ };
57
+ };
58
+ table: {
59
+ readonly empty: "\u66AB\u7121\u6578\u64DA";
60
+ readonly loadingText: "\u6B63\u5728\u8F09\u5165\u4E2D\uFF0C\u8ACB\u7A0D\u5F8C";
61
+ readonly loadingMoreText: "\u9EDE\u64CA\u8F09\u5165\u66F4\u591A";
62
+ readonly filterInputPlaceholder: "\u8ACB\u8F38\u5165\u5185\u5BB9\uFF08\u7121\u9ED8\u8A8D\u503C\uFF09";
63
+ readonly sortAscendingOperationText: "\u9EDE\u64CA\u5347\u5E8F";
64
+ readonly sortCancelOperationText: "\u9EDE\u64CA\u53D6\u6D88\u6392\u5E8F";
65
+ readonly sortDescendingOperationText: "\u9EDE\u64CA\u964D\u5E8F";
66
+ readonly clearFilterResultButtonText: "\u6E05\u7A7A\u7BE9\u9078";
67
+ readonly columnConfigButtonText: "\u884C\u914D\u7F6E";
68
+ readonly columnConfigTitleText: "\u8868\u683C\u884C\u914D\u7F6E";
69
+ readonly columnConfigDescriptionText: "\u8ACB\u9078\u64C7\u9700\u8981\u5728\u8868\u683C\u4E2D\u986F\u793A\u7684\u6578\u64DA\u884C";
70
+ readonly confirmText: "\u78BA\u8A8D";
71
+ readonly cancelText: "\u53D6\u6D88";
72
+ readonly resetText: "\u91CD\u7F6E";
73
+ readonly selectAllText: "\u5168\u9078";
74
+ readonly searchResultText: "\u641C\u5C0B\"{result}\"\uFF0C\u627E\u5230{count}\u9805\u7D50\u679C";
75
+ };
76
+ select: {
77
+ readonly empty: "\u66AB\u7121\u6578\u64DA";
78
+ readonly loadingText: "\u8F09\u5165\u4E2D";
79
+ readonly placeholder: "\u8ACB\u9078\u64C7";
80
+ };
81
+ tree: {
82
+ readonly empty: "\u66AB\u7121\u6578\u64DA";
83
+ };
84
+ treeSelect: {
85
+ readonly empty: "\u66AB\u7121\u6578\u64DA";
86
+ readonly loadingText: "\u8F09\u5165\u4E2D";
87
+ readonly placeholder: "\u8ACB\u9078\u64C7";
88
+ };
89
+ datePicker: {
90
+ readonly dayjsLocale: "zh-tw";
91
+ readonly placeholder: {
92
+ readonly date: "\u8ACB\u9078\u64C7\u65E5\u671F";
93
+ readonly month: "\u8ACB\u9078\u64C7\u6708\u4EFD";
94
+ readonly year: "\u8ACB\u9078\u64C7\u5E74\u4EFD";
95
+ readonly quarter: "\u8ACB\u9078\u64C7\u5B63\u5EA6";
96
+ readonly week: "\u8ACB\u9078\u64C7\u5468";
97
+ };
98
+ readonly weekdays: readonly ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u65E5"];
99
+ readonly months: readonly ["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"];
100
+ readonly quarters: readonly ["\u4E00\u5B63\u5EA6", "\u4E8C\u5B63\u5EA6", "\u4E09\u5B63\u5EA6", "\u56DB\u5B63\u5EA6"];
101
+ readonly rangeSeparator: " - ";
102
+ readonly direction: "ltr";
103
+ readonly format: "YYYY-MM-DD";
104
+ readonly dayAriaLabel: "\u65E5";
105
+ readonly weekAbbreviation: "\u9031";
106
+ readonly yearAriaLabel: "\u5E74";
107
+ readonly monthAriaLabel: "\u6708";
108
+ readonly confirm: "\u78BA\u8A8D";
109
+ readonly selectTime: "\u9078\u64C7\u6642\u9593";
110
+ readonly selectDate: "\u9078\u64C7\u65E5\u671F";
111
+ readonly nextYear: "\u4E0B\u4E00\u5E74";
112
+ readonly preYear: "\u4E0A\u4E00\u5E74";
113
+ readonly nextMonth: "\u4E0B\u500B\u6708";
114
+ readonly preMonth: "\u4E0A\u500B\u6708";
115
+ readonly preDecade: "\u4E0A\u5341\u5E74";
116
+ readonly nextDecade: "\u4E0B\u5341\u5E74";
117
+ readonly now: "\u7576\u524D";
118
+ };
119
+ upload: {
120
+ readonly sizeLimitMessage: "\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u904E {sizeLimit}";
121
+ readonly cancelUploadText: "\u53D6\u6D88\u4E0A\u50B3";
122
+ readonly triggerUploadText: {
123
+ readonly fileInput: "\u9078\u64C7\u6587\u4EF6";
124
+ readonly image: "\u9EDE\u64CA\u4E0A\u50B3\u5716\u7247";
125
+ readonly normal: "\u9EDE\u64CA\u4E0A\u50B3";
126
+ readonly reupload: "\u91CD\u65B0\u9078\u64C7";
127
+ readonly continueUpload: "\u7E7C\u7E8C\u9078\u64C7";
128
+ readonly delete: "\u522A\u9664";
129
+ readonly uploading: "\u4E0A\u50B3\u4E2D";
130
+ };
131
+ readonly dragger: {
132
+ readonly dragDropText: "\u91CB\u653E\u9F20\u6A19";
133
+ readonly draggingText: "\u62D6\u62FD\u5230\u6B64\u5340\u57DF";
134
+ readonly clickAndDragText: "\u9EDE\u64CA\u4E0A\u65B9\u201C\u9078\u64C7\u6587\u4EF6\u201D\u6216\u5C07\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5340\u57DF";
135
+ };
136
+ readonly file: {
137
+ readonly fileNameText: "\u6587\u4EF6\u540D";
138
+ readonly fileSizeText: "\u6587\u4EF6\u5927\u5C0F";
139
+ readonly fileStatusText: "\u72C0\u614B";
140
+ readonly fileOperationText: "\u64CD\u4F5C";
141
+ readonly fileOperationDateText: "\u4E0A\u50B3\u65E5\u671F";
142
+ };
143
+ readonly progress: {
144
+ readonly uploadingText: "\u6B63\u5728\u4E0A\u50B3";
145
+ readonly waitingText: "\u7B49\u5F85\u4E0A\u50B3";
146
+ readonly failText: "\u4E0A\u50B3\u5931\u6557";
147
+ readonly successText: "\u4E0A\u50B3\u6210\u529F";
148
+ };
149
+ };
150
+ form: {
151
+ readonly errorMessage: {
152
+ readonly date: "\u8ACB\u8F38\u5165\u6B63\u78BA\u7684${name}";
153
+ readonly url: "\u8ACB\u8F38\u5165\u6B63\u78BA\u7684${name}";
154
+ readonly whitespace: "${name}\u4E0D\u80FD\u70BA\u7A7A";
155
+ readonly required: "${name}\u5FC5\u586B";
156
+ readonly max: "${name}\u5B57\u7B26\u9577\u5EA6\u4E0D\u80FD\u8D85\u904E ${validate} \u500B\u5B57\u7B26\uFF0C\u4E00\u500B\u4E2D\u6587\u7B49\u65BC\u5169\u500B\u5B57\u7B26";
157
+ readonly min: "${name}\u5B57\u7B26\u9577\u5EA6\u4E0D\u80FD\u5C11\u65BC ${validate} \u500B\u5B57\u7B26\uFF0C\u4E00\u500B\u4E2D\u6587\u7B49\u65BC\u5169\u500B\u5B57\u7B26";
158
+ readonly len: "${name}\u5B57\u7B26\u9577\u5EA6\u5FC5\u9808\u662F ${validate}";
159
+ readonly enum: "${name}\u53EA\u80FD\u662F${validate}\u7B49";
160
+ readonly idcard: "\u8ACB\u8F38\u5165\u6B63\u78BA\u7684${name}";
161
+ readonly telnumber: "\u8ACB\u8F38\u5165\u6B63\u78BA\u7684${name}";
162
+ readonly pattern: "\u8ACB\u8F38\u5165\u6B63\u78BA\u7684${name}";
163
+ readonly validator: "${name}\u4E0D\u7B26\u5408\u8981\u6C42";
164
+ readonly boolean: "${name}\u6578\u64DA\u985E\u578B\u5FC5\u9808\u662F\u5E03\u6797\u985E\u578B";
165
+ readonly number: "${name}\u5FC5\u9808\u662F\u6578\u5B57";
166
+ readonly email: "\u8ACB\u8F38\u5165\u6B63\u78BA\u7684${name}";
167
+ };
168
+ readonly colonText: "\uFF1A";
169
+ };
170
+ input: {
171
+ readonly placeholder: "\u8ACB\u8F38\u5165";
172
+ };
173
+ list: {
174
+ readonly loadingText: "\u6B63\u5728\u8F09\u5165\u4E2D\uFF0C\u8ACB\u7A0D\u5F8C";
175
+ readonly loadingMoreText: "\u9EDE\u64CA\u8F09\u5165\u66F4\u591A";
176
+ };
177
+ alert: {
178
+ readonly expandText: "\u5C55\u958B\u66F4\u591A";
179
+ readonly collapseText: "\u6536\u8D77";
180
+ };
181
+ anchor: {
182
+ readonly copySuccessText: "\u9023\u7D50\u8907\u88FD\u6210\u529F";
183
+ readonly copyText: "\u8907\u88FD\u9023\u7D50";
184
+ };
185
+ colorPicker: {
186
+ readonly swatchColorTitle: "\u7CFB\u7D71\u9810\u8A2D\u9854\u8272";
187
+ readonly recentColorTitle: "\u6700\u8FD1\u4F7F\u7528\u7684\u9854\u8272";
188
+ readonly clearConfirmText: "\u78BA\u5B9A\u6E05\u7A7A\u6700\u8FD1\u4F7F\u7528\u7684\u9854\u8272\u55CE\uFF1F";
189
+ readonly singleColor: "\u55AE\u8272";
190
+ readonly gradientColor: "\u6F38\u8B8A";
191
+ };
192
+ guide: {
193
+ readonly finishButtonProps: {
194
+ readonly content: "\u5B8C\u6210";
195
+ readonly theme: "primary";
196
+ };
197
+ readonly nextButtonProps: {
198
+ readonly content: "\u4E0B\u4E00\u6B65";
199
+ readonly theme: "primary";
200
+ };
201
+ readonly skipButtonProps: {
202
+ readonly content: "\u8DF3\u904E";
203
+ readonly theme: "default";
204
+ };
205
+ readonly prevButtonProps: {
206
+ readonly content: "\u4E0A\u4E00\u6B65";
207
+ readonly theme: "default";
208
+ };
209
+ };
210
+ image: {
211
+ readonly errorText: "\u5716\u7247\u7121\u6CD5\u986F\u793A";
212
+ readonly loadingText: "\u5716\u7247\u8F09\u5165\u4E2D";
213
+ };
214
+ imageViewer: {
215
+ readonly errorText: "\u5716\u7247\u8F09\u5165\u5931\u6557\uFF0C\u53EF\u5617\u8A66\u91CD\u65B0\u8F09\u5165";
216
+ readonly mirrorTipText: "\u93E1\u50CF";
217
+ readonly rotateTipText: "\u65CB\u8F49";
218
+ readonly originalSizeTipText: "\u539F\u59CB\u5927\u5C0F";
219
+ readonly previewText: "\u9810\u89BD";
220
+ };
221
+ typography: {
222
+ readonly expandText: "\u5C55\u958B";
223
+ readonly collapseText: "\u6536\u8D77";
224
+ readonly copiedText: "\u5FA9\u88FD\u6210\u529F";
225
+ };
226
+ rate: {
227
+ readonly rateText: readonly ["\u6975\u5DEE", "\u5931\u671B", "\u4E00\u822C", "\u6EFF\u610F", "\u9A5A\u559C"];
228
+ };
229
+ empty: {
230
+ readonly titleText: {
231
+ readonly maintenance: "\u5EFA\u8A2D\u4E2D";
232
+ readonly success: "\u6210\u529F";
233
+ readonly fail: "\u5931\u6557";
234
+ readonly empty: "\u66AB\u7121\u6578\u64DA";
235
+ readonly networkError: "\u7DB2\u7D61\u932F\u8AA4";
236
+ };
237
+ };
238
+ descriptions: {
239
+ readonly colonText: "\uFF1A";
240
+ };
241
+ chat: {
242
+ readonly placeholder: "\u8ACB\u8F38\u5165\u8A0A\u606F...";
243
+ readonly stopBtnText: "\u4E2D\u6B62";
244
+ readonly refreshTipText: "\u91CD\u65B0\u751F\u6210";
245
+ readonly copyTipText: "\u8907\u88FD";
246
+ readonly likeTipText: "\u8B9A";
247
+ readonly dislikeTipText: "\u8E29";
248
+ readonly copyCodeBtnText: "\u8907\u88FD\u7A0B\u5F0F\u78BC";
249
+ readonly copyCodeSuccessText: "\u5DF2\u8907\u88FD";
250
+ readonly clearHistoryBtnText: "\u6E05\u7A7A\u6B77\u53F2\u8A18\u9304";
251
+ readonly copyTextSuccess: "\u5DF2\u6210\u529F\u8907\u88FD\u5230\u526A\u8CBC\u7C3F";
252
+ readonly copyTextFail: "\u8907\u88FD\u5230\u526A\u8CBC\u7C3F\u5931\u6557";
253
+ readonly confirmClearHistory: "\u78BA\u5B9A\u8981\u6E05\u7A7A\u6240\u6709\u7684\u6D88\u606F\u55CE\uFF1F";
254
+ readonly loadingText: "\u601D\u8003\u4E2D...";
255
+ readonly loadingEndText: "\u5DF2\u6DF1\u5EA6\u601D\u8003";
256
+ readonly uploadImageText: "\u4E0A\u50B3\u5716\u7247";
257
+ readonly uploadAttachmentText: "\u4E0A\u50B3\u9644\u4EF6";
258
+ readonly shareTipText: "\u5206\u4EAB";
259
+ };
260
+ qrcode: {
261
+ readonly expiredText: "\u4E8C\u7DAD\u78BC\u904E\u671F";
262
+ readonly refreshText: "\u9EDE\u64CA\u5237\u65B0";
263
+ readonly scannedText: "\u5DF2\u6383\u63CF";
264
+ };
265
+ };
266
+ export default zhTWLocale;
File without changes
@@ -0,0 +1,38 @@
1
+ import { Plugin } from 'vue';
2
+ /**
3
+ * 带有安装方法的单文件组件类型
4
+ * 继承Vue的Plugin接口,支持通过app.use()进行安装
5
+ * @template T 组件类型
6
+ */
7
+ export type SFCWithInstall<T = any> = T & Plugin;
8
+ /**
9
+ * 为组件添加 install 方法,支持通过 app.use() 安装
10
+ * 这是Vue 3插件系统的标准实现方式
11
+ *
12
+ * @param component 要包装的组件
13
+ * @param name 组件名称,如果不提供则自动从组件中获取
14
+ * @returns 带有install方法的组件
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const MyButton = withInstall(Button, 'MyButton')
19
+ * app.use(MyButton) // 全局注册组件
20
+ * ```
21
+ */
22
+ export declare const withInstall: <T>(component: T, name?: string) => SFCWithInstall<T>;
23
+ /**
24
+ * 为函数式组件添加 install 方法
25
+ * 将函数挂载到Vue应用的全局属性上,便于在组件中通过this访问
26
+ *
27
+ * @param fn 要包装的函数
28
+ * @param name 函数在全局属性中的名称
29
+ * @returns 带有install方法的函数
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const $message = withInstallFunction(message, '$message')
34
+ * app.use($message) // 全局注册函数
35
+ * // 在组件中可以通过 this.$message 访问
36
+ * ```
37
+ */
38
+ export declare const withInstallFunction: <T>(fn: T, name: string) => SFCWithInstall<T>;
@@ -0,0 +1,2 @@
1
+ export declare const setThemeMode: (mode: "light" | "dark") => void;
2
+ export declare const handleLanguage: () => void;
@@ -0,0 +1 @@
1
+ export * from '../components/RWebControl';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Vite构建配置文件
3
+ * 支持开发模式和库构建模式两种配置
4
+ * 开发模式用于本地开发调试,库构建模式用于打包发布组件库
5
+ */
6
+ declare const _default: import('vite').UserConfigFnObject;
7
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export * from './src/webcontrol/index'
2
+ export {}
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("vue"),ve=require("./_plugin-vue_export-helper-BA5b-u6G.cjs");function He(r){if(!r)return;if(r.webControl)return r;const e=r.locale;if(e!=null&&e.webControl)return e}function Be(r){if(!(r!=null&&r.webControl))throw new Error("[RWebControl] Missing locale.webControl in global ConfigProvider locale");return r.webControl}var pe=(r=>(r.ANDROID="ANDROID",r.TINA_LINUX="TINA_LINUX",r.RIGOL_OS="RIGOL_OS",r.RAW_H5="RAW_H5",r.RIGOL_QT="RIGOL_QT",r.URL="URL",r.UNKNOWN="UNKNOWN",r))(pe||{});function Ge(r){if(!r)return{width:void 0,height:void 0};try{const e=JSON.parse(r),t=e.width!=null?Number(e.width):void 0,l=e.height!=null?Number(e.height):void 0;return{width:t!=null&&!Number.isNaN(t)?t:void 0,height:l!=null&&!Number.isNaN(l)?l:void 0}}catch{return{width:void 0,height:void 0}}}const Ue=Symbol("webControlContext");let we=null;function Ke(r){const e=r.default;if(typeof e=="function")return e;if(typeof r.WSAvcPlayer=="function")return r.WSAvcPlayer}function Ve(){return typeof window>"u"?Promise.reject(new Error("WSAvcPlayer can only be loaded in a browser environment")):window.WSAvcPlayer?Promise.resolve(window.WSAvcPlayer):(we||(we=Promise.resolve().then(()=>require("./http-live-player-C_ZWcEpn.cjs")).then(r=>{if(!window.WSAvcPlayer){const e=Ke(r);e&&(window.WSAvcPlayer=e)}if(!window.WSAvcPlayer)throw new Error("WSAvcPlayer export not found after loading decoder script");return window.WSAvcPlayer}).catch(r=>{throw we=null,r})),we)}const ke="[RWebControl]",V={info:(...r)=>console.info(ke,...r),warn:(...r)=>console.warn(ke,...r),error:(...r)=>console.error(ke,...r)};function Fe(){const r=g.inject(Ue);if(!(r!=null&&r.locale))throw new Error("[RWebControl] Missing provided webControl locale. Ensure RWebControl is wrapped by ConfigProvider with locale.webControl configured.");return r.locale}const Ye={key:0,class:"loading-overlay"},Xe={class:"loading-text"},$e={key:1,class:"error-overlay"},qe={class:"error-text"},Qe=g.defineComponent({__name:"WebControlOverlay",props:{isConnecting:{type:Boolean,default:!1},connectionError:{default:""},loadingText:{default:""},reconnectText:{default:""}},emits:["retry"],setup(r,{emit:e}){const t=r,l=e,u=Fe(),i=g.computed(()=>t.loadingText||u.loading.connectingToRemote),v=g.computed(()=>t.reconnectText||u.loading.reconnect),p=()=>{l("retry")};return(d,c)=>(g.openBlock(),g.createElementBlock(g.Fragment,null,[r.isConnecting?(g.openBlock(),g.createElementBlock("div",Ye,[c[0]||(c[0]=g.createElementVNode("div",{class:"loading-spinner"},null,-1)),g.createElementVNode("div",Xe,g.toDisplayString(i.value),1)])):g.createCommentVNode("",!0),r.connectionError?(g.openBlock(),g.createElementBlock("div",$e,[c[1]||(c[1]=g.createElementVNode("div",{class:"error-icon"},"⚠️",-1)),g.createElementVNode("div",qe,g.toDisplayString(r.connectionError),1),g.createElementVNode("button",{class:"retry-button",type:"button",onClick:p},g.toDisplayString(v.value),1)])):g.createCommentVNode("",!0)],64))}}),Se=ve._export_sfc(Qe,[["__scopeId","data-v-3e2b1bd4"]]),Re=20,je=1e3,Oe=2,Je=g.defineComponent({__name:"WebControlForAndroid",props:{baseUrl:{default:void 0},encoderSize:{default:"1024x600"},encoderRate:{default:"2000000"},deviceScreenWidth:{default:1024},deviceScreenHeight:{default:600}},setup(r){const e=Fe(),t=r;V.info("🚀 WebControlForAndroid props:",t);const l=g.ref(),u=g.ref(),i=g.ref(),v=g.ref(),p=g.ref(),d=g.ref(!0),c=g.ref(!1),F=g.ref(""),k=g.ref(0),T=g.ref(0),b=g.ref({}),M=g.ref({});let O=1,A=1,S=0,y=0;g.computed(()=>({width:b.value.width||"100%"})),g.computed(()=>d.value?e.connection.connecting:c.value?e.connection.connected:F.value?e.connection.connectionFailed:e.connection.disconnected),g.computed(()=>d.value?"connecting":c.value?"connected":F.value?"error":"disconnected");const s=g.computed(()=>t.baseUrl||`ws://${window.location.hostname}`),f=g.ref(!1);async function m(){f.value=!1;try{const B=new URL(s.value.replace(/\/+$/,""));B.protocol=B.protocol==="wss:"?"https:":"http:",B.pathname="/webcontrol/schema",B.search="",B.hash="";const Y=await fetch(B.toString(),{method:"GET"});if(!Y.ok)return;const q=await Y.json();(q==null?void 0:q.version)==="v2"&&(f.value=!0)}catch(B){V.warn("webcontrol schema request failed, using legacy ws ports:",B)}}const x=g.computed(()=>{const B=s.value.replace(/\/+$/,"");return f.value?`${B}/ws/display`:`${B}:9001`}),C=g.computed(()=>{const B=s.value.replace(/\/+$/,"");return f.value?`${B}/ws/control`:`${B}:9002`});let I=null,E=null;const P=()=>{if(I)try{const B=I.ws;B&&(B.readyState===WebSocket.OPEN||B.readyState===WebSocket.CONNECTING)&&B.close()}catch(B){V.warn("Error closing WSAvcPlayer WebSocket:",B)}finally{I=null}},a=()=>{if(E)try{(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&E.close(1e3,"Component unmounted")}catch(B){V.warn("Error closing control event WebSocket:",B)}finally{E=null}},o=g.ref(!1);let h=Re*3,_=null,N=0,L=null,D=null,R=!1,w=0;const W=()=>{h=Re},z=(B,Y)=>{V.info("📺 Video size changed:",B,"x",Y);try{k.value=B,T.value=Y,p.value&&(p.value.width=B,p.value.height=Y);const q=t.deviceScreenWidth,J=t.deviceScreenHeight;O=B/q,A=Y/J,O<A?(y=(Y-J*B/q)/2,S=0,A=O):(S=(B-q*Y/J)/2,y=0,O=A),V.info("🔧 Coordinate transform:",{videoSize:`${B}x${Y}`,deviceScreen:`${q}x${J}`,scale:{scale_w:O,scale_h:A},offset:{offset_w:S,offset_h:y}}),te()}catch(q){V.error("Error handling size change:",q)}},H=()=>{var B;if(V.info("WSAvcPlayer socket connected"),d.value=!1,c.value=!0,F.value="",R&&(N=0),((B=I==null?void 0:I.ws)==null?void 0:B.readyState)===WebSocket.OPEN){const Y={type:"SET_ENCODER",size:t.encoderSize,rate:t.encoderRate};I.ws.send(JSON.stringify(Y)),V.info("Sent encoder config:",Y)}g.nextTick(te)},U=()=>{W()},G=()=>{V.info("WSAvcPlayer socket closed"),c.value=!1,ae(e.connection.connectionError)},Q=async B=>{if(!p.value){V.error("Canvas element not found");return}try{const Y=await Ve();if(B!==w)return;V.info("Initializing WSAvcPlayer..."),I=new Y(p.value,"webgl",1,35),I.setSizeChangedCallback(z),I.setSocketConnectCallback(H),I.setSocketMessageCallback(U);const q=I;I.setSocketClosedCallback(()=>{q===I&&G()}),I.connect(x.value),V.info("WSAvcPlayer initialized and connecting to:",x.value)}catch(Y){V.error("Failed to initialize WSAvcPlayer:",Y),F.value=e.decoder.initFailed,d.value=!1}},j=()=>{try{V.info("Initializing control event socket...");const B=new WebSocket(C.value);E=B,B.onopen=()=>{V.info("Control event WebSocket connected"),R=!0,c.value&&(N=0)},B.onmessage=Y=>{V.info("Control event message:",Y.data)},B.onerror=Y=>{B===E&&(V.error("Control event WebSocket error:",Y),ae(e.control.controlDisconnected))},B.onclose=Y=>{V.info("Control event WebSocket closed:",Y.code,Y.reason),B===E&&(c.value=!1,ae(e.control.controlDisconnected))}}catch(B){V.error("Failed to initialize control event socket:",B)}},Z=()=>{h--,h<=0&&(c.value=!1,ae(e.connection.connectionTimeout))},te=()=>{var Me;if(!l.value||!p.value)return;const B=k.value||t.deviceScreenWidth,Y=T.value||t.deviceScreenHeight;if(B===0||Y===0)return;const q=l.value.parentElement;if(!q)return;const J=q.getBoundingClientRect(),ue=window.getComputedStyle(q),he=parseFloat(ue.paddingLeft)||0,ye=parseFloat(ue.paddingRight)||0,xe=parseFloat(ue.paddingTop)||0,Ee=parseFloat(ue.paddingBottom)||0,Le=((Me=u.value)==null?void 0:Me.offsetHeight)||0,Ce=J.width-he-ye,Te=J.height-xe-Ee-Le;if(Ce===0||Te===0)return;const We=Ce/B,ze=Te/Y,be=Math.min(We,ze),_e=B*be,Ie=Y*be;V.info("📐 Layout:",{parentSize:`${Ce}x${Te}`,displaySize:`${B}x${Y}`,usingFallback:k.value===0,canvasSize:`${_e}x${Ie}`,scale:be}),M.value={width:`${_e}px`,height:`${Ie+Le}px`},b.value={width:`${_e}px`,height:`${Ie}px`}},ee=(B,Y)=>{if(!p.value)return{x:0,y:0};const q=p.value.getBoundingClientRect(),J=p.value.width,ue=p.value.height,he=B/q.width*J,ye=Y/q.height*ue,xe=(he-S)/O,Ee=(ye-y)/A;return{x:Math.round(xe),y:Math.round(Ee)}},ne=(B,Y)=>{if(!p.value)return!1;const q=p.value.getBoundingClientRect(),J=p.value.width,ue=p.value.height,he=B/q.width*J,ye=Y/q.height*ue;return he>S&&he<J-S&&ye>y&&ye<ue-y},ie=B=>{if(V.info("onmousedown, button:",B.button),B.button!==0)return;B.preventDefault();const Y=B.offsetX,q=B.offsetY;if(ne(Y,q)){o.value=!0;const J=ee(Y,q);V.info("👆 Mouse down at:",{offsetX:Y,offsetY:q},"→ device:",J),K("onmousedown",J.x,J.y)}},ce=B=>{if(V.info("onmouseup, button:",B.button),B.button!==0)return;B.preventDefault(),o.value=!1;const Y=B.offsetX,q=B.offsetY;if(ne(Y,q)){const J=ee(Y,q);V.info("👆 Mouse up at:",{offsetX:Y,offsetY:q},"→ device:",J),K("onmouseup",J.x,J.y)}},ge=B=>{if(B.button!==0||!o.value)return;B.preventDefault();const Y=B.offsetX,q=B.offsetY;if(ne(Y,q)){const J=ee(Y,q);K("onmousemove",J.x,J.y)}},se=B=>{if(V.info("onmouseleave, isDown:",o.value),o.value){o.value=!1;const Y=B.offsetX,q=B.offsetY,J=ee(Y,q);V.info("👆 Mouse leave, sending mouseup at:",J),K("onmouseup",J.x,J.y)}},K=(B,Y,q)=>{if((E==null?void 0:E.readyState)===WebSocket.OPEN){const J={type:B,clientX:Y,clientY:q};E.send(JSON.stringify(J)),V.info(`📤 Sent ${B}: [${Y}, ${q}]`)}else V.warn("⚠️ Control WebSocket not connected, cannot send event")},X=async B=>(await m(),B!==w||(await Q(B),B!==w)?!1:(j(),!0)),$=()=>{oe();const B=w;X(B).then(Y=>{!Y||B!==w||(h=Re*3,_=window.setInterval(Z,100),g.nextTick(te))})},re=()=>{L&&(clearTimeout(L),L=null),D&&(clearTimeout(D),D=null)},ae=B=>{if(!L){if(oe(),N>=Oe){d.value=!1,c.value=!1,F.value=B;return}L=window.setTimeout(()=>{L=null,N++,V.info(`Auto reconnecting (${N}/${Oe})`),$()},je)}},fe=()=>{re(),N=0,F.value="",d.value=!0,oe(),D=window.setTimeout(()=>{D=null,$()},500)};let de=null;const oe=()=>{w++,_&&(clearInterval(_),_=null),R=!1,P(),a()},le=()=>{re(),oe(),de&&(de.disconnect(),de=null)};return g.onMounted(async()=>{var B;await g.nextTick(),te(),(B=l.value)!=null&&B.parentElement&&(de=new ResizeObserver(()=>{te()}),de.observe(l.value.parentElement)),window.addEventListener("resize",te),$()}),g.onUnmounted(()=>{window.removeEventListener("resize",te),le()}),(B,Y)=>(g.openBlock(),g.createElementBlock("div",{ref_key:"webControlRef",ref:l,class:"web-control-android",style:g.normalizeStyle(M.value)},[g.createCommentVNode("",!0),g.createElementVNode("div",{ref_key:"screenContainerRef",ref:i,class:"screen-container"},[g.createElementVNode("div",{ref_key:"screenRef",ref:v,class:"screen"},[g.createElementVNode("canvas",{ref_key:"canvasRef",ref:p,class:"screen-canvas",style:g.normalizeStyle(b.value),onMousedown:ie,onMouseup:ce,onMousemove:ge,onMouseleave:se},null,36),g.createVNode(Se,{"is-connecting":d.value,"connection-error":F.value,onRetry:fe},null,8,["is-connecting","connection-error"])],512)],512)],4))}}),Ze=ve._export_sfc(Je,[["__scopeId","data-v-1cb370f7"]]),et=["src"],tt=g.defineComponent({__name:"WebControlForH5",props:{src:{default:void 0},width:{default:1042},height:{default:680}},setup(r){const e=r,t=g.ref(),l=g.ref(),u=g.ref({}),i=g.ref({}),v=()=>{if(!t.value)return;const d=t.value.parentElement;if(!d)return;const c=d.getBoundingClientRect(),F=window.getComputedStyle(d),k=parseFloat(F.paddingLeft)||0,T=parseFloat(F.paddingRight)||0,b=parseFloat(F.paddingTop)||0,M=parseFloat(F.paddingBottom)||0,O=c.width-k-T,A=c.height-b-M;O===0||A===0||(u.value={width:`${O}px`,height:`${A}px`},i.value={width:`${O}px`,height:`${A}px`})};let p=null;return g.onMounted(async()=>{var d;await g.nextTick(),v(),(d=t.value)!=null&&d.parentElement&&(p=new ResizeObserver(()=>{v()}),p.observe(t.value.parentElement)),window.addEventListener("resize",v)}),g.onUnmounted(()=>{window.removeEventListener("resize",v),p&&(p.disconnect(),p=null)}),(d,c)=>(g.openBlock(),g.createElementBlock("div",{ref_key:"webControlRef",ref:t,class:"web-control-h5",style:g.normalizeStyle(u.value)},[g.createElementVNode("iframe",{ref_key:"iframeRef",ref:l,src:e.src,style:g.normalizeStyle(i.value),class:"h5-iframe",frameborder:"0"},null,12,et)],4))}}),nt=ve._export_sfc(tt,[["__scopeId","data-v-88b09ebf"]]),rt=5960464477539063e-23,Ae=4294967296,Pe=9007199254740992;function Ne(r){let e=new ArrayBuffer(256),t=new DataView(e),l=0,u=0;function i(S){let y=e.byteLength;const s=u+S;for(;y<s;)y<<=1;if(y!==e.byteLength){const f=t;e=new ArrayBuffer(y),t=new DataView(e);const m=u+3>>2;for(let x=0;x<m;++x)t.setUint32(x<<2,f.getUint32(x<<2))}return l=S,t}function v(){u+=l}function p(S){i(8).setFloat64(u,S),v()}function d(S){i(1).setUint8(u,S),v()}function c(S){const y=i(S.length);for(let s=0;s<S.length;++s)y.setUint8(u+s,S[s]);v()}function F(S){i(2).setUint16(u,S),v()}function k(S){i(4).setUint32(u,S),v()}function T(S){const y=S%Ae,s=(S-y)/Ae,f=i(8);f.setUint32(u,s),f.setUint32(u+4,y),v()}function b(S,y){y<24?d(S<<5|y):y<256?(d(S<<5|24),d(y)):y<65536?(d(S<<5|25),F(y)):y<4294967296?(d(S<<5|26),k(y)):(d(S<<5|27),T(y))}function M(S){if(S===!1){d(244);return}if(S===!0){d(245);return}if(S===null){d(246);return}if(S===void 0){d(247);return}switch(typeof S){case"number":if(Math.floor(S)===S){if(0<=S&&S<=Pe){b(0,S);return}if(-Pe<=S&&S<0){b(1,-(S+1));return}}d(251),p(S);return;case"string":{const y=[];for(let s=0;s<S.length;++s){let f=S.charCodeAt(s);f<128?y.push(f):f<2048?(y.push(192|f>>6),y.push(128|f&63)):f<55296?(y.push(224|f>>12),y.push(128|f>>6&63),y.push(128|f&63)):(f=(f&1023)<<10|S.charCodeAt(++s)&1023,f+=65536,y.push(240|f>>18),y.push(128|f>>12&63),y.push(128|f>>6&63),y.push(128|f&63))}b(3,y.length),c(y);return}default:if(Array.isArray(S)){const y=S.length;b(4,y);for(let s=0;s<y;++s)M(S[s])}else if(S instanceof Uint8Array)b(2,S.length),c(S);else{const y=Object.keys(S),s=y.length;b(5,s);for(let f=0;f<s;++f){const m=y[f];M(m),M(S[m])}}}}if(M(r),"slice"in e)return e.slice(0,u);const O=new ArrayBuffer(u),A=new DataView(O);for(let S=0;S<u;++S)A.setUint8(S,t.getUint8(S));return O}function at(r,e,t){const l=new DataView(r);let u=0;const i=e||(x=>x),v=t||(()=>{});function p(x,C){return u+=x,C}function d(x){return p(x,new Uint8Array(r,u,x))}function c(){const x=new ArrayBuffer(4),C=new DataView(x),I=b(),E=I&32768;let P=I&31744;const a=I&1023;if(P===31744)P=261120;else if(P!==0)P+=114688;else if(a!==0)return(E?-1:1)*a*rt;return C.setUint32(0,E<<16|P<<13|a<<13),C.getFloat32(0)}function F(){return p(4,l.getFloat32(u))}function k(){return p(8,l.getFloat64(u))}function T(){return p(1,l.getUint8(u))}function b(){return p(2,l.getUint16(u))}function M(){return p(4,l.getUint32(u))}function O(){return M()*Ae+M()}function A(){return l.getUint8(u)!==255?!1:(u+=1,!0)}function S(x){if(x<24)return x;if(x===24)return T();if(x===25)return b();if(x===26)return M();if(x===27)return O();if(x===31)return-1;throw new Error("Invalid length encoding")}function y(x){const C=T();if(C===255)return-1;const I=S(C&31);if(I<0||C>>5!==x)throw new Error("Invalid indefinite length element");return I}function s(x,C){for(let I=0;I<C;++I){let E=T();E&128&&(E<224?(E=(E&31)<<6|T()&63,C-=1):E<240?(E=(E&15)<<12|(T()&63)<<6|T()&63,C-=2):(E=(E&15)<<18|(T()&63)<<12|(T()&63)<<6|T()&63,C-=3)),E<65536?x.push(E):(E-=65536,x.push(55296|E>>10),x.push(56320|E&1023))}}function f(){const x=T(),C=x>>5,I=x&31;if(C===7)switch(I){case 25:return c();case 26:return F();case 27:return k()}let E=S(I);if(E<0&&(C<2||6<C))throw new Error("Invalid length");switch(C){case 0:return E;case 1:return-1-E;case 2:{if(E<0){const P=[];let a=0;for(;(E=y(C))>=0;)a+=E,P.push(d(E));const o=new Uint8Array(a);let h=0;for(let _=0;_<P.length;++_)o.set(P[_],h),h+=P[_].length;return o}return d(E)}case 3:{const P=[];if(E<0)for(;(E=y(C))>=0;)s(P,E);else s(P,E);return String.fromCharCode(...P)}case 4:{let P;if(E<0)for(P=[];!A();)P.push(f());else{P=new Array(E);for(let a=0;a<E;++a)P[a]=f()}return P}case 5:{const P={};for(let a=0;a<E||E<0&&!A();++a){const o=f();P[o]=f()}return P}case 6:return i(f(),E);case 7:switch(E){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:return v(E)}}}const m=f();if(u!==r.byteLength)throw new Error("Remaining bytes");return m}const ot=100,it=10,st=30,lt=50,ut=g.defineComponent({__name:"WebControlForLinux",props:{wsUrl:{default:void 0},canvasWidth:{default:480},canvasHeight:{default:272}},setup(r){const e=Fe(),t=r,l=g.ref(),u=g.ref(),i=g.ref(),v=g.ref(null),p=g.ref(!1),d=g.ref(!1),c=g.ref(""),F=g.ref(null),k=g.ref({}),T=g.ref({}),b=g.ref(0),M=g.ref(performance.now()),O=g.ref(0),A=g.ref(new Map),S=g.ref([]),y=g.ref(!1),s=g.ref({received:0,processed:0,dropped:0,outOfOrder:0,duplicates:0}),f=g.ref(!1),m=g.ref(!1),x=g.ref({x:0,y:0}),C=g.ref(!1),I=g.ref(null),E=g.ref(!1),P=()=>{if(!l.value||!i.value)return;const K=l.value.parentElement;if(!K)return;const X=K.getBoundingClientRect(),$=window.getComputedStyle(K),re=parseFloat($.paddingLeft)||0,ae=parseFloat($.paddingRight)||0,fe=parseFloat($.paddingTop)||0,de=parseFloat($.paddingBottom)||0,oe=X.width-re-ae,le=X.height-fe-de;if(oe===0||le===0)return;const B=le,Y=oe/t.canvasWidth,q=B/t.canvasHeight,J=Math.min(Y,q),ue=t.canvasWidth*J,he=t.canvasHeight*J;k.value={width:`${oe}px`,height:`${le}px`},T.value={width:`${ue}px`,height:`${he}px`}},a=()=>{var K;if(((K=v.value)==null?void 0:K.readyState)!==WebSocket.OPEN){p.value=!0,c.value="";try{const X=t.wsUrl||`ws://${window.location.hostname}/ws/connect`;V.info(`[WebControlLinux] Connecting to ${X}`),v.value=new WebSocket(X),v.value.onopen=()=>{V.info("[WebControlLinux] WebSocket connected"),p.value=!1,d.value=!0,j(),ce(),_()},v.value.onmessage=async $=>{await o($)},v.value.onclose=$=>{V.info("[WebControlLinux] WebSocket closed:",$.code,$.reason),d.value=!1,p.value=!1,N(),j()},v.value.onerror=$=>{V.error("[WebControlLinux] WebSocket error:",$),p.value=!1,c.value=e.connection.connectionError}}catch(X){V.error("[WebControlLinux] Failed to create WebSocket:",X),p.value=!1,c.value=e.connection.cannotCreateConnection}}},o=async K=>{if(K.data instanceof Blob)try{const X=await K.data.arrayBuffer(),$=at(X);if(!$)return;if($.type==="screen/update"){D($);return}V.info("[WebControlLinux] Received message:",$.type)}catch(X){V.error("[WebControlLinux] Failed to decode CBOR data:",X)}else V.info("[WebControlLinux] Text message:",K.data)},h=()=>{c.value="",a()},_=()=>{E.value||(E.value=!0,V.info("[WebControlLinux] Watchdog activated"),I.value=window.setInterval(()=>{L()},6e4),L())},N=()=>{E.value&&(E.value=!1,V.info("[WebControlLinux] Watchdog deactivated"),I.value&&(clearInterval(I.value),I.value=null))},L=async()=>{window.authManager&&await window.authManager.updateLastAccess()&&V.info("[WebControlLinux] Session activity updated (watchdog)")},D=K=>{const X=K.frameSeq||0;if(s.value.received++,X<O.value){s.value.duplicates++;return}if(X===O.value)w(K),O.value++,R();else{if(s.value.outOfOrder++,A.value.size>=it){const $=Math.min(...A.value.keys());A.value.delete($),s.value.dropped++}A.value.set(X,K),setTimeout(()=>{if(A.value.has(X)){const $=A.value.get(X);A.value.delete(X),w($),O.value=X+1,R()}},ot)}},R=()=>{for(;A.value.has(O.value);){const K=A.value.get(O.value);A.value.delete(O.value),w(K),O.value++}},w=K=>{S.value.length>=st&&(S.value.shift(),s.value.dropped++),S.value.push(K),W()},W=async()=>{if(!(y.value||S.value.length===0)){if(document.hidden){G();return}for(y.value=!0;S.value.length>0&&!document.hidden;){const K=S.value.shift();await z(K)}y.value=!1}},z=async K=>new Promise(X=>{requestAnimationFrame(()=>{try{H(K),s.value.processed++}catch($){V.error("[WebControlLinux] Error rendering frame:",$)}X(null)})}),H=K=>{if(!i.value||!F.value){V.warn("[WebControlLinux] Canvas not ready");return}const X=K.x1??K.x1??0,$=K.y1??K.y1??0,re=K.x2??K.x2??t.canvasWidth-1,ae=K.y2??K.y2??t.canvasHeight-1,fe=re-X+1,de=ae-$+1,oe=F.value.createImageData(fe,de),le=new Uint8Array(K.data||K.data);if(!le||le.length===0){V.warn("[WebControlLinux] No pixel data in frame");return}for(let B=0;B<le.length;B+=3){const Y=B/3*4;oe.data[Y]=le[B],oe.data[Y+1]=le[B+1],oe.data[Y+2]=le[B+2],oe.data[Y+3]=255}F.value.putImageData(oe,X,$),U()},U=()=>{const K=performance.now();K-M.value>=1e3&&(b.value=0,M.value=K),b.value++},G=()=>{const K=S.value.length;S.value=[],y.value=!1,K>0&&(s.value.dropped+=K)},Q=()=>{const K=A.value.size;A.value.clear(),O.value=0,K>0&&V.info(`[WebControlLinux] Frame sequencing reset, cleared ${K} buffered frames`)},j=()=>{A.value.clear(),S.value=[],O.value=0,y.value=!1,s.value={received:0,processed:0,dropped:0,outOfOrder:0,duplicates:0}},Z=K=>{if(!i.value||!d.value||f.value)return;f.value=!0,m.value=!1;const X=i.value.getBoundingClientRect();x.value.x=K.clientX-X.left,x.value.y=K.clientY-X.top;const $=Math.floor(x.value.x/X.width*t.canvasWidth),re=Math.floor(x.value.y/X.height*t.canvasHeight);ie("down",$,re)},te=K=>{if(!i.value||!d.value||!f.value)return;const X=i.value.getBoundingClientRect(),$=K.clientX-X.left,re=K.clientY-X.top;if(!m.value&&(Math.abs($-x.value.x)>5||Math.abs(re-x.value.y)>5)&&(m.value=!0),m.value&&!C.value){const ae=Math.floor($/X.width*t.canvasWidth),fe=Math.floor(re/X.height*t.canvasHeight);ie("drag",ae,fe),C.value=!0,setTimeout(()=>{C.value=!1},lt)}},ee=K=>{if(!i.value||!d.value||!f.value)return;f.value=!1;const X=i.value.getBoundingClientRect(),$=K.clientX-X.left,re=K.clientY-X.top,ae=Math.floor($/X.width*t.canvasWidth),fe=Math.floor(re/X.height*t.canvasHeight);ie("up",ae,fe),m.value=!1},ne=()=>{if(f.value&&d.value&&i.value){const K=i.value.getBoundingClientRect(),X=Math.floor(x.value.x/K.width*t.canvasWidth),$=Math.floor(x.value.y/K.height*t.canvasHeight);ie("up",X,$)}f.value=!1,m.value=!1},ie=(K,X,$)=>{if(!v.value||v.value.readyState!==WebSocket.OPEN)return;const re={type:`mouse/${K}`,x:X,y:$},ae=Ne(re);v.value.send(ae)},ce=()=>{if(!v.value||v.value.readyState!==WebSocket.OPEN)return;const X=Ne({type:"screen/refresh"});v.value.send(X)},ge=()=>{document.addEventListener("visibilitychange",()=>{var K;document.hidden?G():(Q(),((K=v.value)==null?void 0:K.readyState)===WebSocket.OPEN&&ce())})};let se=null;return g.onMounted(async()=>{var K;await g.nextTick(),i.value&&(i.value.width=t.canvasWidth,i.value.height=t.canvasHeight,F.value=i.value.getContext("2d"),F.value&&(F.value.fillStyle="#000000",F.value.fillRect(0,0,t.canvasWidth,t.canvasHeight))),P(),(K=l.value)!=null&&K.parentElement&&(se=new ResizeObserver(()=>{P()}),se.observe(l.value.parentElement)),window.addEventListener("resize",P),ge(),a()}),g.onUnmounted(()=>{window.removeEventListener("resize",P),se&&(se.disconnect(),se=null),N(),v.value&&(v.value.close(1e3),v.value=null)}),(K,X)=>(g.openBlock(),g.createElementBlock("div",{ref_key:"webControlRef",ref:l,class:"web-control-linux",style:g.normalizeStyle(k.value)},[g.createElementVNode("div",{ref_key:"screenContainerRef",ref:u,class:"screen-container"},[g.createElementVNode("canvas",{id:"stream-canvas",ref_key:"canvasRef",ref:i,class:"screen-canvas",style:g.normalizeStyle(T.value),onMousedown:Z,onMouseup:ee,onMousemove:te,onMouseleave:ne},null,36),g.createVNode(Se,{"is-connecting":p.value,"connection-error":c.value,onRetry:h},null,8,["is-connecting","connection-error"])],512)],4))}}),ct=ve._export_sfc(ut,[["__scopeId","data-v-0348b4f7"]]);var n=n||{};n.ArrayBufferReader=function(r){var e=this;r.onblob=function(t){for(var l=window.atob(t),u=new ArrayBuffer(l.length),i=new Uint8Array(u),v=0;v<l.length;v++)i[v]=l.charCodeAt(v);e.ondata&&e.ondata(u)},r.onend=function(){e.onend&&e.onend()},this.ondata=null,this.onend=null};var n=n||{};n.ArrayBufferWriter=function(r){var e=this;r.onack=function(l){e.onack&&e.onack(l)};function t(l){for(var u="",i=0;i<l.byteLength;i++)u+=String.fromCharCode(l[i]);r.sendBlob(window.btoa(u))}this.blobLength=n.ArrayBufferWriter.DEFAULT_BLOB_LENGTH,this.sendData=function(l){var u=new Uint8Array(l);if(u.length<=e.blobLength)t(u);else for(var i=0;i<u.length;i+=e.blobLength)t(u.subarray(i,i+e.blobLength))},this.sendEnd=function(){r.sendEnd()},this.onack=null};n.ArrayBufferWriter.DEFAULT_BLOB_LENGTH=6048;var n=n||{};n.AudioContextFactory={singleton:null,getAudioContext:function(){var e=window.AudioContext||window.webkitAudioContext;if(e)try{return n.AudioContextFactory.singleton||(n.AudioContextFactory.singleton=new e),n.AudioContextFactory.singleton}catch{}return null}};var n=n||{};n.AudioPlayer=function(){this.sync=function(){}};n.AudioPlayer.isSupportedType=function(e){return n.RawAudioPlayer.isSupportedType(e)};n.AudioPlayer.getSupportedTypes=function(){return n.RawAudioPlayer.getSupportedTypes()};n.AudioPlayer.getInstance=function(e,t){return n.RawAudioPlayer.isSupportedType(t)?new n.RawAudioPlayer(e,t):null};n.RawAudioPlayer=function(e,t){var l=n.RawAudioFormat.parse(t),u=n.AudioContextFactory.getAudioContext(),i=u.currentTime,v=new n.ArrayBufferReader(e),p=.02,d=.3,c=l.bytesPerSample===1?window.Int8Array:window.Int16Array,F=l.bytesPerSample===1?128:32768,k=[],T=function(y){if(y.length<=1)return y[0];var s=0;y.forEach(function(C){s+=C.length});var f=0,m=new c(s);return y.forEach(function(C){m.set(C,f),f+=C.length}),m},b=function(y){for(var s=Number.MAX_VALUE,f=y.length,m=Math.floor(y.length/l.channels),x=Math.floor(l.rate*p),C=Math.max(l.channels*x,l.channels*(m-x)),I=C;I<y.length;I+=l.channels){for(var E=0,P=0;P<l.channels;P++)E+=Math.abs(y[I+P]);E<=s&&(f=I+l.channels,s=E)}return f===y.length?[y]:[new c(y.buffer.slice(0,f*l.bytesPerSample)),new c(y.buffer.slice(f*l.bytesPerSample))]},M=function(y){k.push(new c(y))},O=function(){var y=T(k);return y?(k=b(y),y=k.shift(),y):null},A=function(y){var s=y.length/l.channels,f=u.currentTime;i<f&&(i=f);for(var m=u.createBuffer(l.channels,s,l.rate),x=0;x<l.channels;x++)for(var C=m.getChannelData(x),I=x,E=0;E<s;E++)C[E]=y[I]/F,I+=l.channels;return m};v.ondata=function(y){M(new c(y));var s=O();if(s){var f=u.currentTime;i<f&&(i=f);var m=u.createBufferSource();m.connect(u.destination),m.start||(m.start=m.noteOn),m.buffer=A(s),m.start(i),i+=s.length/l.channels/l.rate}},this.sync=function(){var y=u.currentTime;i=Math.min(i,y+d)}};n.RawAudioPlayer.prototype=new n.AudioPlayer;n.RawAudioPlayer.isSupportedType=function(e){return n.AudioContextFactory.getAudioContext()?n.RawAudioFormat.parse(e)!==null:!1};n.RawAudioPlayer.getSupportedTypes=function(){return n.AudioContextFactory.getAudioContext()?["audio/L8","audio/L16"]:[]};var n=n||{};n.AudioRecorder=function(){this.onclose=null,this.onerror=null};n.AudioRecorder.isSupportedType=function(e){return n.RawAudioRecorder.isSupportedType(e)};n.AudioRecorder.getSupportedTypes=function(){return n.RawAudioRecorder.getSupportedTypes()};n.AudioRecorder.getInstance=function(e,t){return n.RawAudioRecorder.isSupportedType(t)?new n.RawAudioRecorder(e,t):null};n.RawAudioRecorder=function(e,t){var l=this,u=2048,i=3,v=n.RawAudioFormat.parse(t),p=n.AudioContextFactory.getAudioContext();navigator.mediaDevices||(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia||(navigator.mediaDevices.getUserMedia=(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia).bind(navigator));var d=new n.ArrayBufferWriter(e),c=v.bytesPerSample===1?window.Int8Array:window.Int16Array,F=v.bytesPerSample===1?128:32768,k=0,T=0,b=null,M=null,O=null,A=function(E){if(E===0)return 1;var P=Math.PI*E;return Math.sin(P)/P},S=function(E,P){return-P<E&&E<P?A(E)*A(E/P):0},y=function(E,P){for(var a=(E.length-1)*P,o=Math.floor(a)-i+1,h=Math.floor(a)+i,_=0,N=o;N<=h;N++)_+=(E[N]||0)*S(a-N,i);return _},s=function(E){var P=E.length;k+=P;var a=Math.round(k*v.rate/E.sampleRate),o=a-T;T+=o;for(var h=new c(o*v.channels),_=0;_<v.channels;_++)for(var N=E.getChannelData(_),L=_,D=0;D<o;D++)h[L]=y(N,D/(o-1))*F,L+=v.channels;return h},f=function(E){O=p.createScriptProcessor(u,v.channels,v.channels),O.connect(p.destination),O.onaudioprocess=function(a){d.sendData(s(a.inputBuffer).buffer)},M=p.createMediaStreamSource(E),M.connect(O),p.state==="suspended"&&p.resume(),b=E},m=function(){d.sendEnd(),l.onerror&&l.onerror()},x=function(){var E=navigator.mediaDevices.getUserMedia({audio:!0},f,m);E&&E.then&&E.then(f,m)},C=function(){if(M&&M.disconnect(),O&&O.disconnect(),b)for(var E=b.getTracks(),P=0;P<E.length;P++)E[P].stop();O=null,M=null,b=null,d.sendEnd()};d.onack=function(E){E.code===n.Status.Code.SUCCESS&&!b?x():(C(),d.onack=null,E.code===n.Status.Code.RESOURCE_CLOSED?l.onclose&&l.onclose():l.onerror&&l.onerror())}};n.RawAudioRecorder.prototype=new n.AudioRecorder;n.RawAudioRecorder.isSupportedType=function(e){return n.AudioContextFactory.getAudioContext()?n.RawAudioFormat.parse(e)!==null:!1};n.RawAudioRecorder.getSupportedTypes=function(){return n.AudioContextFactory.getAudioContext()?["audio/L8","audio/L16"]:[]};var n=n||{};n.BlobReader=function(r,e){var t=this,l=0,u;window.BlobBuilder?u=new BlobBuilder:window.WebKitBlobBuilder?u=new WebKitBlobBuilder:window.MozBlobBuilder?u=new MozBlobBuilder:u=new function(){var i=[];this.append=function(v){i.push(new Blob([v],{type:e}))},this.getBlob=function(){return new Blob(i,{type:e})}},r.onblob=function(i){for(var v=window.atob(i),p=new ArrayBuffer(v.length),d=new Uint8Array(p),c=0;c<v.length;c++)d[c]=v.charCodeAt(c);u.append(p),l+=p.byteLength,t.onprogress&&t.onprogress(p.byteLength),r.sendAck("OK",0)},r.onend=function(){t.onend&&t.onend()},this.getLength=function(){return l},this.getBlob=function(){return u.getBlob()},this.onprogress=null,this.onend=null};var n=n||{};n.BlobWriter=function(e){var t=this,l=new n.ArrayBufferWriter(e);l.onack=function(i){t.onack&&t.onack(i)};var u=function(v,p,d){var c=(v.slice||v.webkitSlice||v.mozSlice).bind(v),F=d-p;if(F!==d){var k=c(p,F);if(k.size===F)return k}return c(p,d)};this.sendBlob=function(v){var p=0,d=new FileReader,c=function(){if(p>=v.size){t.oncomplete&&t.oncomplete(v);return}var k=u(v,p,p+l.blobLength);p+=l.blobLength,d.readAsArrayBuffer(k)};d.onload=function(){l.sendData(d.result),l.onack=function(T){t.onack&&t.onack(T),!T.isError()&&(t.onprogress&&t.onprogress(v,p-l.blobLength),c())}},d.onerror=function(){t.onerror&&t.onerror(v,p,d.error)},c()},this.sendEnd=function(){l.sendEnd()},this.onack=null,this.onerror=null,this.onprogress=null,this.oncomplete=null};var n=n||{};n.Client=function(r){var e=this,t=n.Client.State.IDLE,l=0,u=5e3,i=null,v=0,p={0:"butt",1:"round",2:"square"},d={0:"bevel",1:"miter",2:"round"},c=new n.Display,F={},k={},T=[],b=[],M=[],O=new n.IntegerPool,A=[];function S(a){a!=t&&(t=a,e.onstatechange&&e.onstatechange(t))}function y(){return t==n.Client.State.CONNECTED||t==n.Client.State.WAITING}this.exportState=function(o){var h={currentState:t,currentTimestamp:l,layers:{}},_={};for(var N in F)_[N]=F[N];c.flush(function(){for(var D in _){var R=parseInt(D),w=_[D],W=w.toCanvas(),z={width:w.width,height:w.height};w.width&&w.height&&(z.url=W.toDataURL("image/png")),R>0&&(z.x=w.x,z.y=w.y,z.z=w.z,z.alpha=w.alpha,z.matrix=w.matrix,z.parent=f(w.parent)),h.layers[D]=z}o(h)})},this.importState=function(o,h){var _,N;t=o.currentState,l=o.currentTimestamp,c.cancel();for(_ in F)N=parseInt(_),N>0&&F[_].dispose();F={};for(_ in o.layers){N=parseInt(_);var L=o.layers[_],D=s(N);if(c.resize(D,L.width,L.height),L.url&&(c.setChannelMask(D,n.Layer.SRC),c.draw(D,0,0,L.url)),N>0&&L.parent>=0){var R=s(L.parent);c.move(D,R,L.x,L.y,L.z),c.shade(D,L.alpha);var w=L.matrix;c.distort(D,w[0],w[1],w[2],w[3],w[4],w[5])}}c.flush(h)},this.getDisplay=function(){return c},this.sendSize=function(a,o){y()&&r.sendMessage("size",a,o)},this.sendKeyEvent=function(a,o){y()&&r.sendMessage("key",o,a)},this.sendMouseState=function(o,h){if(y()){var _=o.x,N=o.y;h&&(_/=c.getScale(),N/=c.getScale()),c.moveCursor(Math.floor(_),Math.floor(N));var L=0;o.left&&(L|=1),o.middle&&(L|=2),o.right&&(L|=4),o.up&&(L|=8),o.down&&(L|=16),r.sendMessage("mouse",Math.floor(_),Math.floor(N),L)}},this.sendTouchState=function(o,h){if(y()){var _=o.x,N=o.y;h&&(_/=c.getScale(),N/=c.getScale()),r.sendMessage("touch",o.id,Math.floor(_),Math.floor(N),Math.floor(o.radiusX),Math.floor(o.radiusY),o.angle,o.force)}},this.createOutputStream=function(){var o=O.next(),h=A[o]=new n.OutputStream(e,o);return h},this.createAudioStream=function(a){var o=e.createOutputStream();return r.sendMessage("audio",o.index,a),o},this.createFileStream=function(a,o){var h=e.createOutputStream();return r.sendMessage("file",h.index,a,o),h},this.createPipeStream=function(a,o){var h=e.createOutputStream();return r.sendMessage("pipe",h.index,a,o),h},this.createClipboardStream=function(a){var o=e.createOutputStream();return r.sendMessage("clipboard",o.index,a),o},this.createArgumentValueStream=function(o,h){var _=e.createOutputStream();return r.sendMessage("argv",_.index,o,h),_},this.createObjectOutputStream=function(o,h,_){var N=e.createOutputStream();return r.sendMessage("put",o,N.index,h,_),N},this.requestObjectInputStream=function(o,h){y()&&r.sendMessage("get",o,h)},this.sendAck=function(a,o,h){y()&&r.sendMessage("ack",a,o,h)},this.sendBlob=function(a,o){y()&&r.sendMessage("blob",a,o)},this.endStream=function(a){y()&&(r.sendMessage("end",a),A[a]&&(O.free(a),delete A[a]))},this.onstatechange=null,this.onname=null,this.onerror=null,this.onmsg=null,this.onjoin=null,this.onleave=null,this.onaudio=null,this.onvideo=null,this.onmultitouch=null,this.onargv=null,this.onclipboard=null,this.onfile=null,this.onfilesystem=null,this.onpipe=null,this.onrequired=null,this.onsync=null;var s=function(o){var h=F[o];return h||(o===0?h=c.getDefaultLayer():o>0?h=c.createLayer():h=c.createBuffer(),F[o]=h),h},f=function(o){if(!o)return null;for(var h in F)if(o===F[h])return parseInt(h);return null};function m(a){var o=T[a];return o==null&&(o=T[a]=new n.Parser,o.oninstruction=r.oninstruction),o}var x={"miter-limit":function(a,o){c.setMiterLimit(a,parseFloat(o))},"multi-touch":function(o,h){e.onmultitouch&&o instanceof n.Display.VisibleLayer&&e.onmultitouch(o,parseInt(h))}},C={ack:function(a){var o=parseInt(a[0]),h=a[1],_=parseInt(a[2]),N=A[o];N&&(N.onack&&N.onack(new n.Status(_,h)),_>=256&&A[o]===N&&(O.free(o),delete A[o]))},arc:function(a){var o=s(parseInt(a[0])),h=parseInt(a[1]),_=parseInt(a[2]),N=parseInt(a[3]),L=parseFloat(a[4]),D=parseFloat(a[5]),R=parseInt(a[6]);c.arc(o,h,_,N,L,D,R!=0)},argv:function(a){var o=parseInt(a[0]),h=a[1],_=a[2];if(e.onargv){var N=b[o]=new n.InputStream(e,o);e.onargv(N,h,_)}else e.sendAck(o,"Receiving argument values unsupported",256)},audio:function(a){var o=parseInt(a[0]),h=a[1],_=b[o]=new n.InputStream(e,o),N=null;e.onaudio&&(N=e.onaudio(_,h)),N||(N=n.AudioPlayer.getInstance(_,h)),N?(k[o]=N,e.sendAck(o,"OK",0)):e.sendAck(o,"BAD TYPE",783)},blob:function(a){var o=parseInt(a[0]),h=a[1],_=b[o];_&&_.onblob&&_.onblob(h)},body:function(o){var h=parseInt(o[0]),_=M[h],N=parseInt(o[1]),L=o[2],D=o[3];if(_&&_.onbody){var R=b[N]=new n.InputStream(e,N);_.onbody(R,L,D)}else e.sendAck(N,"Receipt of body unsupported",256)},cfill:function(a){var o=parseInt(a[0]),h=s(parseInt(a[1])),_=parseInt(a[2]),N=parseInt(a[3]),L=parseInt(a[4]),D=parseInt(a[5]);c.setChannelMask(h,o),c.fillColor(h,_,N,L,D)},clip:function(a){var o=s(parseInt(a[0]));c.clip(o)},clipboard:function(a){var o=parseInt(a[0]),h=a[1];if(e.onclipboard){var _=b[o]=new n.InputStream(e,o);e.onclipboard(_,h)}else e.sendAck(o,"Clipboard unsupported",256)},close:function(a){var o=s(parseInt(a[0]));c.close(o)},copy:function(a){var o=s(parseInt(a[0])),h=parseInt(a[1]),_=parseInt(a[2]),N=parseInt(a[3]),L=parseInt(a[4]),D=parseInt(a[5]),R=s(parseInt(a[6])),w=parseInt(a[7]),W=parseInt(a[8]);c.setChannelMask(R,D),c.copy(o,h,_,N,L,R,w,W)},cstroke:function(a){var o=parseInt(a[0]),h=s(parseInt(a[1])),_=p[parseInt(a[2])],N=d[parseInt(a[3])],L=parseInt(a[4]),D=parseInt(a[5]),R=parseInt(a[6]),w=parseInt(a[7]),W=parseInt(a[8]);c.setChannelMask(h,o),c.strokeColor(h,_,N,L,D,R,w,W)},cursor:function(a){var o=parseInt(a[0]),h=parseInt(a[1]),_=s(parseInt(a[2])),N=parseInt(a[3]),L=parseInt(a[4]),D=parseInt(a[5]),R=parseInt(a[6]);c.setCursor(o,h,_,N,L,D,R)},curve:function(a){var o=s(parseInt(a[0])),h=parseInt(a[1]),_=parseInt(a[2]),N=parseInt(a[3]),L=parseInt(a[4]),D=parseInt(a[5]),R=parseInt(a[6]);c.curveTo(o,h,_,N,L,D,R)},disconnect:function(o){e.disconnect()},dispose:function(a){var o=parseInt(a[0]);if(o>0){var h=s(o);c.dispose(h),delete F[o]}else o<0&&delete F[o]},distort:function(a){var o=parseInt(a[0]),h=parseFloat(a[1]),_=parseFloat(a[2]),N=parseFloat(a[3]),L=parseFloat(a[4]),D=parseFloat(a[5]),R=parseFloat(a[6]);if(o>=0){var w=s(o);c.distort(w,h,_,N,L,D,R)}},error:function(a){var o=a[0],h=parseInt(a[1]);e.onerror&&e.onerror(new n.Status(h,o)),e.disconnect()},end:function(a){var o=parseInt(a[0]),h=b[o];h&&(h.onend&&h.onend(),delete b[o])},file:function(a){var o=parseInt(a[0]),h=a[1],_=a[2];if(e.onfile){var N=b[o]=new n.InputStream(e,o);e.onfile(N,h,_)}else e.sendAck(o,"File transfer unsupported",256)},filesystem:function(o){var h=parseInt(o[0]),_=o[1];if(e.onfilesystem){var N=M[h]=new n.Object(e,h);e.onfilesystem(N,_)}},identity:function(a){var o=s(parseInt(a[0]));c.setTransform(o,1,0,0,1,0,0)},img:function(a){var o=parseInt(a[0]),h=parseInt(a[1]),_=s(parseInt(a[2])),N=a[3],L=parseInt(a[4]),D=parseInt(a[5]),R=b[o]=new n.InputStream(e,o);c.setChannelMask(_,h),c.drawStream(_,L,D,R,N)},jpeg:function(a){var o=parseInt(a[0]),h=s(parseInt(a[1])),_=parseInt(a[2]),N=parseInt(a[3]),L=a[4];c.setChannelMask(h,o),c.draw(h,_,N,"data:image/jpeg;base64,"+L)},lfill:function(a){var o=parseInt(a[0]),h=s(parseInt(a[1])),_=s(parseInt(a[2]));c.setChannelMask(h,o),c.fillLayer(h,_)},line:function(a){var o=s(parseInt(a[0])),h=parseInt(a[1]),_=parseInt(a[2]);c.lineTo(o,h,_)},lstroke:function(a){var o=parseInt(a[0]),h=s(parseInt(a[1])),_=s(parseInt(a[2]));c.setChannelMask(h,o),c.strokeLayer(h,_)},mouse:function(o){var h=parseInt(o[0]),_=parseInt(o[1]);c.showCursor(!0),c.moveCursor(h,_)},move:function(a){var o=parseInt(a[0]),h=parseInt(a[1]),_=parseInt(a[2]),N=parseInt(a[3]),L=parseInt(a[4]);if(o>0&&h>=0){var D=s(o),R=s(h);c.move(D,R,_,N,L)}},msg:function(a){var o,h,_=!0,N=parseInt(a[0]);if(e.onmsg&&(_=e.onmsg(N,a.slice(1)),_===void 0&&(_=!0)),_)switch(N){case n.Client.Message.USER_JOINED:o=a[1],h=a[2],e.onjoin&&e.onjoin(o,h);break;case n.Client.Message.USER_LEFT:o=a[1],h=a[2],e.onleave&&e.onleave(o,h);break}},name:function(a){e.onname&&e.onname(a[0])},nest:function(a){var o=m(parseInt(a[0]));o.receive(a[1])},pipe:function(a){var o=parseInt(a[0]),h=a[1],_=a[2];if(e.onpipe){var N=b[o]=new n.InputStream(e,o);e.onpipe(N,h,_)}else e.sendAck(o,"Named pipes unsupported",256)},png:function(a){var o=parseInt(a[0]),h=s(parseInt(a[1])),_=parseInt(a[2]),N=parseInt(a[3]),L=a[4];c.setChannelMask(h,o),c.draw(h,_,N,"data:image/png;base64,"+L)},pop:function(a){var o=s(parseInt(a[0]));c.pop(o)},push:function(a){var o=s(parseInt(a[0]));c.push(o)},rect:function(a){var o=s(parseInt(a[0])),h=parseInt(a[1]),_=parseInt(a[2]),N=parseInt(a[3]),L=parseInt(a[4]);c.rect(o,h,_,N,L)},required:function(o){e.onrequired&&e.onrequired(o)},reset:function(a){var o=s(parseInt(a[0]));c.reset(o)},set:function(a){var o=s(parseInt(a[0])),h=a[1],_=a[2],N=x[h];N&&N(o,_)},shade:function(a){var o=parseInt(a[0]),h=parseInt(a[1]);if(o>=0){var _=s(o);c.shade(_,h)}},size:function(a){var o=parseInt(a[0]),h=s(o),_=parseInt(a[1]),N=parseInt(a[2]);c.resize(h,_,N)},start:function(a){var o=s(parseInt(a[0])),h=parseInt(a[1]),_=parseInt(a[2]);c.moveTo(o,h,_)},sync:function(a){var o=parseInt(a[0]),h=a[1]?parseInt(a[1]):0;c.flush(function(){for(var N in k){var L=k[N];L&&L.sync()}o!==l&&(r.sendMessage("sync",o),l=o)},o,h),t===n.Client.State.WAITING&&S(n.Client.State.CONNECTED),e.onsync&&e.onsync(o,h)},transfer:function(a){var o=s(parseInt(a[0])),h=parseInt(a[1]),_=parseInt(a[2]),N=parseInt(a[3]),L=parseInt(a[4]),D=parseInt(a[5]),R=s(parseInt(a[6])),w=parseInt(a[7]),W=parseInt(a[8]);D===3?c.put(o,h,_,N,L,R,w,W):D!==5&&c.transfer(o,h,_,N,L,R,w,W,n.Client.DefaultTransferFunction[D])},transform:function(a){var o=s(parseInt(a[0])),h=parseFloat(a[1]),_=parseFloat(a[2]),N=parseFloat(a[3]),L=parseFloat(a[4]),D=parseFloat(a[5]),R=parseFloat(a[6]);c.transform(o,h,_,N,L,D,R)},undefine:function(o){var h=parseInt(o[0]),_=M[h];_&&_.onundefine&&_.onundefine()},video:function(a){var o=parseInt(a[0]),h=s(parseInt(a[1])),_=a[2],N=b[o]=new n.InputStream(e,o),L=null;e.onvideo&&(L=e.onvideo(N,h,_)),L||(L=n.VideoPlayer.getInstance(N,h,_)),L?e.sendAck(o,"OK",0):e.sendAck(o,"BAD TYPE",783)}},I=function(){r.sendMessage("nop"),v=new Date().getTime()},E=function(){window.clearTimeout(i);var o=new Date().getTime(),h=Math.max(v+u-o,0);h>0?i=window.setTimeout(I,h):I()},P=function(){window.clearTimeout(i)};r.oninstruction=function(a,o){var h=C[a];h&&h(o),E()},this.disconnect=function(){t!=n.Client.State.DISCONNECTED&&t!=n.Client.State.DISCONNECTING&&(S(n.Client.State.DISCONNECTING),P(),r.sendMessage("disconnect"),r.disconnect(),S(n.Client.State.DISCONNECTED))},this.connect=function(a){S(n.Client.State.CONNECTING);try{r.connect(a)}catch(o){throw S(n.Client.State.IDLE),o}E(),S(n.Client.State.WAITING)}};n.Client.State={IDLE:0,CONNECTING:1,WAITING:2,CONNECTED:3,DISCONNECTING:4,DISCONNECTED:5};n.Client.DefaultTransferFunction={0:function(r,e){e.red=e.green=e.blue=0},15:function(r,e){e.red=e.green=e.blue=255},3:function(r,e){e.red=r.red,e.green=r.green,e.blue=r.blue,e.alpha=r.alpha},5:function(r,e){},12:function(r,e){e.red=255&~r.red,e.green=255&~r.green,e.blue=255&~r.blue,e.alpha=r.alpha},10:function(r,e){e.red=255&~e.red,e.green=255&~e.green,e.blue=255&~e.blue},1:function(r,e){e.red=r.red&e.red,e.green=r.green&e.green,e.blue=r.blue&e.blue},14:function(r,e){e.red=255&~(r.red&e.red),e.green=255&~(r.green&e.green),e.blue=255&~(r.blue&e.blue)},7:function(r,e){e.red=r.red|e.red,e.green=r.green|e.green,e.blue=r.blue|e.blue},8:function(r,e){e.red=255&~(r.red|e.red),e.green=255&~(r.green|e.green),e.blue=255&~(r.blue|e.blue)},6:function(r,e){e.red=r.red^e.red,e.green=r.green^e.green,e.blue=r.blue^e.blue},9:function(r,e){e.red=255&~(r.red^e.red),e.green=255&~(r.green^e.green),e.blue=255&~(r.blue^e.blue)},4:function(r,e){e.red=255&(~r.red&e.red),e.green=255&(~r.green&e.green),e.blue=255&(~r.blue&e.blue)},13:function(r,e){e.red=255&(~r.red|e.red),e.green=255&(~r.green|e.green),e.blue=255&(~r.blue|e.blue)},2:function(r,e){e.red=255&(r.red&~e.red),e.green=255&(r.green&~e.green),e.blue=255&(r.blue&~e.blue)},11:function(r,e){e.red=255&(r.red|~e.red),e.green=255&(r.green|~e.green),e.blue=255&(r.blue|~e.blue)}};n.Client.Message={USER_JOINED:1,USER_LEFT:2};var n=n||{};n.DataURIReader=function(r,e){var t=this,l="data:"+e+";base64,";r.onblob=function(i){l+=i},r.onend=function(){t.onend&&t.onend()},this.getURI=function(){return l},this.onend=null};var n=n||{};n.Display=function(){var r=this,e=0,t=0,l=1,u=document.createElement("div");u.style.position="relative",u.style.width=e+"px",u.style.height=t+"px",u.style.transformOrigin=u.style.webkitTransformOrigin=u.style.MozTransformOrigin=u.style.OTransformOrigin=u.style.msTransformOrigin="0 0";var i=new n.Display.VisibleLayer(e,t),v=new n.Display.VisibleLayer(0,0);v.setChannelMask(n.Layer.SRC),u.appendChild(i.getElement()),u.appendChild(v.getElement());var p=document.createElement("div");p.style.position="relative",p.style.width=e*l+"px",p.style.height=t*l+"px",p.appendChild(u),this.cursorHotspotX=0,this.cursorHotspotY=0,this.cursorX=0,this.cursorY=0,this.statisticWindow=0,this.onresize=null,this.oncursor=null,this.onstatistics=null;var d=[],c=[],F=null,k=function(){for(var f=0,m=0,x=0,C=0;C<c.length;){var I=c[C];if(!I.isReady())break;I.flush(),f=I.localTimestamp,m=I.remoteTimestamp,x+=I.logicalFrames,C++}c.splice(0,C),C&&M(f,m,x)},T=function(){var f=function m(){if(F=null,!!c.length){if(c[0].isReady()){var x=c.shift();x.flush(),M(x.localTimestamp,x.remoteTimestamp,x.logicalFrames)}c.length&&(F=window.requestAnimationFrame(m))}};F||(F=window.requestAnimationFrame(f))},b=[],M=function(f,m,x){if(r.statisticWindow){for(var C=new Date().getTime(),I=0;I<b.length&&!(C-b[I].timestamp<=r.statisticWindow);I++);b.splice(0,I-1),b.push({localTimestamp:f,remoteTimestamp:m,timestamp:C,frames:x});var E=(b[b.length-1].timestamp-b[0].timestamp)/1e3,P=(b[b.length-1].remoteTimestamp-b[0].remoteTimestamp)/1e3,a=b.length,o=b.reduce(function(L,D){return L+D.frames},0),h=b.reduce(function(L,D){return L+Math.max(0,D.frames-1)},0),_=new n.Display.Statistics({processingLag:C-f,desktopFps:P&&o?o/P:null,clientFps:E?a/E:null,serverFps:P?a/P:null,dropRate:P?h/P:null});r.onstatistics&&r.onstatistics(_)}};window.addEventListener("blur",function(){F&&!document.hasFocus()&&(window.cancelAnimationFrame(F),F=null,k())},!0);function O(){window.requestAnimationFrame&&document.hasFocus()?T():k()}var A=function(f,m,x,C){this.localTimestamp=new Date().getTime(),this.remoteTimestamp=x||this.localTimestamp,this.logicalFrames=C||0,this.cancel=function(){f=null,m.forEach(function(P){P.cancel()}),m=[]},this.isReady=function(){for(var I=0;I<m.length;I++)if(m[I].blocked)return!1;return!0},this.flush=function(){for(var I=0;I<m.length;I++)m[I].execute();f&&f()}};function S(s,f){var m=this;this.blocked=f,this.cancel=function(){m.blocked=!1,s=null},this.unblock=function(){m.blocked&&(m.blocked=!1,O())},this.execute=function(){s&&s()}}function y(s,f){var m=new S(s,f);return d.push(m),m}this.getElement=function(){return p},this.getWidth=function(){return e},this.getHeight=function(){return t},this.getDefaultLayer=function(){return i},this.getCursorLayer=function(){return v},this.createLayer=function(){var s=new n.Display.VisibleLayer(e,t);return s.move(i,0,0,0),s},this.createBuffer=function(){var s=new n.Layer(0,0);return s.autosize=1,s},this.flush=function(s,f,m){c.push(new A(s,d,f,m)),d=[],O()},this.cancel=function(){c.forEach(function(m){m.cancel()}),c=[],d.forEach(function(m){m.cancel()}),d=[]},this.setCursor=function(s,f,m,x,C,I,E){y(function(){r.cursorHotspotX=s,r.cursorHotspotY=f,v.resize(I,E),v.copy(m,x,C,I,E,0,0),r.moveCursor(r.cursorX,r.cursorY),r.oncursor&&r.oncursor(v.toCanvas(),s,f)})},this.showCursor=function(s){var f=v.getElement(),m=f.parentNode;s===!1?m&&m.removeChild(f):m!==u&&u.appendChild(f)},this.moveCursor=function(s,f){v.translate(s-r.cursorHotspotX,f-r.cursorHotspotY),r.cursorX=s,r.cursorY=f},this.resize=function(s,f,m){y(function(){s.resize(f,m),s===i&&(e=f,t=m,u.style.width=e+"px",u.style.height=t+"px",p.style.width=e*l+"px",p.style.height=t*l+"px",r.onresize&&r.onresize(f,m))})},this.drawImage=function(s,f,m,x){y(function(){s.drawImage(f,m,x)})},this.drawBlob=function(s,f,m,x){var C;if(window.createImageBitmap){var I;C=y(function(){s.drawImage(f,m,I)},!0),window.createImageBitmap(x).then(function(o){I=o,C.unblock()})}else{var E=URL.createObjectURL(x);C=y(function(){P.width&&P.height&&s.drawImage(f,m,P),URL.revokeObjectURL(E)},!0);var P=new Image;P.onload=C.unblock,P.onerror=C.unblock,P.src=E}},this.drawStream=function(f,m,x,C,I){if(window.createImageBitmap){var E=new n.BlobReader(C,I);E.onend=function(){r.drawBlob(f,m,x,E.getBlob())}}else{var E=new n.DataURIReader(C,I);E.onend=function(){r.draw(f,m,x,E.getURI())}}},this.draw=function(s,f,m,x){var C=y(function(){I.width&&I.height&&s.drawImage(f,m,I)},!0),I=new Image;I.onload=C.unblock,I.onerror=C.unblock,I.src=x},this.play=function(s,f,m,x){var C=document.createElement("video");C.type=f,C.src=x,C.addEventListener("play",function(){function I(){s.drawImage(0,0,C),C.ended||window.setTimeout(I,20)}I()},!1),y(C.play)},this.transfer=function(s,f,m,x,C,I,E,P,a){y(function(){I.transfer(s,f,m,x,C,E,P,a)})},this.put=function(s,f,m,x,C,I,E,P){y(function(){I.put(s,f,m,x,C,E,P)})},this.copy=function(s,f,m,x,C,I,E,P){y(function(){I.copy(s,f,m,x,C,E,P)})},this.moveTo=function(s,f,m){y(function(){s.moveTo(f,m)})},this.lineTo=function(s,f,m){y(function(){s.lineTo(f,m)})},this.arc=function(s,f,m,x,C,I,E){y(function(){s.arc(f,m,x,C,I,E)})},this.curveTo=function(s,f,m,x,C,I,E){y(function(){s.curveTo(f,m,x,C,I,E)})},this.close=function(s){y(function(){s.close()})},this.rect=function(s,f,m,x,C){y(function(){s.rect(f,m,x,C)})},this.clip=function(s){y(function(){s.clip()})},this.strokeColor=function(s,f,m,x,C,I,E,P){y(function(){s.strokeColor(f,m,x,C,I,E,P)})},this.fillColor=function(s,f,m,x,C){y(function(){s.fillColor(f,m,x,C)})},this.strokeLayer=function(s,f,m,x,C){y(function(){s.strokeLayer(f,m,x,C)})},this.fillLayer=function(s,f){y(function(){s.fillLayer(f)})},this.push=function(s){y(function(){s.push()})},this.pop=function(s){y(function(){s.pop()})},this.reset=function(s){y(function(){s.reset()})},this.setTransform=function(s,f,m,x,C,I,E){y(function(){s.setTransform(f,m,x,C,I,E)})},this.transform=function(s,f,m,x,C,I,E){y(function(){s.transform(f,m,x,C,I,E)})},this.setChannelMask=function(s,f){y(function(){s.setChannelMask(f)})},this.setMiterLimit=function(s,f){y(function(){s.setMiterLimit(f)})},this.dispose=function(f){y(function(){f.dispose()})},this.distort=function(f,m,x,C,I,E,P){y(function(){f.distort(m,x,C,I,E,P)})},this.move=function(f,m,x,C,I){y(function(){f.move(m,x,C,I)})},this.shade=function(f,m){y(function(){f.shade(m)})},this.scale=function(s){u.style.transform=u.style.WebkitTransform=u.style.MozTransform=u.style.OTransform=u.style.msTransform="scale("+s+","+s+")",l=s,p.style.width=e*l+"px",p.style.height=t*l+"px"},this.getScale=function(){return l},this.flatten=function(){var s=document.createElement("canvas");s.width=i.width,s.height=i.height;var f=s.getContext("2d");function m(C){var I=[];for(var E in C.children)I.push(C.children[E]);return I.sort(function(a,o){var h=a.z-o.z;if(h!==0)return h;var _=a.getElement(),N=o.getElement(),L=N.compareDocumentPosition(_);return L&Node.DOCUMENT_POSITION_PRECEDING?-1:L&Node.DOCUMENT_POSITION_FOLLOWING?1:0}),I}function x(C,I,E){if(C.width>0&&C.height>0){var P=f.globalAlpha;f.globalAlpha*=C.alpha/255,f.drawImage(C.getCanvas(),I,E);for(var a=m(C),o=0;o<a.length;o++){var h=a[o];x(h,I+h.x,E+h.y)}f.globalAlpha=P}}return x(i,0,0),s}};n.Display.VisibleLayer=function(r,e){n.Layer.apply(this,[r,e]);var t=this;this.__unique_id=n.Display.VisibleLayer.__next_id++,this.alpha=255,this.x=0,this.y=0,this.z=0,this.matrix=[1,0,0,1,0,0],this.parent=null,this.children={};var l=t.getCanvas();l.style.position="absolute",l.style.left="0px",l.style.top="0px";var u=document.createElement("div");u.appendChild(l),u.style.width=r+"px",u.style.height=e+"px",u.style.position="absolute",u.style.left="0px",u.style.top="0px",u.style.overflow="hidden";var i=this.resize;this.resize=function(d,c){u.style.width=d+"px",u.style.height=c+"px",i(d,c)},this.getElement=function(){return u};var v="translate(0px, 0px)",p="matrix(1, 0, 0, 1, 0, 0)";this.translate=function(d,c){t.x=d,t.y=c,v="translate("+d+"px,"+c+"px)",u.style.transform=u.style.WebkitTransform=u.style.MozTransform=u.style.OTransform=u.style.msTransform=v+" "+p},this.move=function(d,c,F,k){if(t.parent!==d){t.parent&&delete t.parent.children[t.__unique_id],t.parent=d,d.children[t.__unique_id]=t;var T=d.getElement();T.appendChild(u)}t.translate(c,F),t.z=k,u.style.zIndex=k},this.shade=function(d){t.alpha=d,u.style.opacity=d/255},this.dispose=function(){t.parent&&(delete t.parent.children[t.__unique_id],t.parent=null),u.parentNode&&u.parentNode.removeChild(u)},this.distort=function(d,c,F,k,T,b){t.matrix=[d,c,F,k,T,b],p="matrix("+d+","+c+","+F+","+k+","+T+","+b+")",u.style.transform=u.style.WebkitTransform=u.style.MozTransform=u.style.OTransform=u.style.msTransform=v+" "+p}};n.Display.VisibleLayer.__next_id=0;n.Display.Statistics=function(e){e=e||{},this.processingLag=e.processingLag,this.desktopFps=e.desktopFps,this.serverFps=e.serverFps,this.clientFps=e.clientFps,this.dropRate=e.dropRate};var n=n||{};n.Event=function(e){this.type=e,this.timestamp=new Date().getTime(),this.getAge=function(){return new Date().getTime()-this.timestamp},this.invokeLegacyHandler=function(l){}};n.Event.DOMEvent=function(e,t){n.Event.call(this,e),t=t||[],Array.isArray(t)||(t=[t]),this.preventDefault=function(){t.forEach(function(i){i.preventDefault&&i.preventDefault(),i.returnValue=!1})},this.stopPropagation=function(){t.forEach(function(i){i.stopPropagation()})}};n.Event.DOMEvent.cancelEvent=function(e){e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1};n.Event.Target=function(){var e={};this.on=function(l,u){var i=e[l];i||(e[l]=i=[]),i.push(u)},this.onEach=function(l,u){l.forEach(function(v){this.on(v,u)},this)},this.dispatch=function(l){l.invokeLegacyHandler(this);var u=e[l.type];if(u)for(var i=0;i<u.length;i++)u[i](l,this)},this.off=function(l,u){var i=e[l];if(!i)return!1;for(var v=0;v<i.length;v++)if(i[v]===u)return i.splice(v,1),!0;return!1},this.offEach=function(l,u){var i=!1;return l.forEach(function(p){i|=this.off(p,u)},this),i}};var n=n||{};n.InputSink=function(){var e=this,t=document.createElement("textarea");t.style.position="fixed",t.style.outline="none",t.style.border="none",t.style.margin="0",t.style.padding="0",t.style.height="0",t.style.width="0",t.style.left="0",t.style.bottom="0",t.style.resize="none",t.style.background="transparent",t.style.color="transparent",t.addEventListener("keypress",function(u){t.value=""},!1),t.addEventListener("compositionend",function(u){u.data&&(t.value="")},!1),t.addEventListener("input",function(u){u.data&&!u.isComposing&&(t.value="")},!1),t.addEventListener("focus",function(){window.setTimeout(function(){t.click(),t.select()},0)},!0),this.focus=function(){window.setTimeout(function(){t.focus()},0)},this.getElement=function(){return t},document.addEventListener("keydown",function(u){var i=document.activeElement;if(i&&i!==document.body){var v=i.getBoundingClientRect();if(v.left+v.width>0&&v.top+v.height>0)return}e.focus()},!0)};var n=n||{};n.InputStream=function(r,e){var t=this;this.index=e,this.onblob=null,this.onend=null,this.sendAck=function(l,u){r.sendAck(t.index,l,u)}};var n=n||{};n.IntegerPool=function(){var r=this,e=[];this.next_int=0,this.next=function(){return e.length>0?e.shift():r.next_int++},this.free=function(t){e.push(t)}};var n=n||{};n.JSONReader=function(e){var t=this,l=new n.StringReader(e),u="";this.getLength=function(){return u.length},this.getJSON=function(){return JSON.parse(u)},l.ontext=function(v){u+=v,t.onprogress&&t.onprogress(v.length)},l.onend=function(){t.onend&&t.onend()},this.onprogress=null,this.onend=null};var n=n||{};n.Keyboard=function(e){var t=this,l=n.Keyboard._nextID++,u="_GUAC_KEYBOARD_HANDLED_BY_"+l;this.onkeydown=null,this.onkeyup=null;var i={keyupUnreliable:!1,altIsTypableOnly:!1,capsLockKeyupUnreliable:!1};navigator&&navigator.platform&&(navigator.platform.match(/ipad|iphone|ipod/i)?i.keyupUnreliable=!0:navigator.platform.match(/^mac/i)&&(i.altIsTypableOnly=!0,i.capsLockKeyupUnreliable=!0));var v=function(w){var W=this;this.keyCode=w?w.which||w.keyCode:0,this.keyIdentifier=w&&w.keyIdentifier,this.key=w&&w.key,this.location=w?L(w):0,this.modifiers=w?n.Keyboard.ModifierState.fromKeyboardEvent(w):new n.Keyboard.ModifierState,this.timestamp=new Date().getTime(),this.defaultPrevented=!1,this.keysym=null,this.reliable=!1,this.getAge=function(){return new Date().getTime()-W.timestamp}},p=function(w){v.call(this,w),this.keysym=m(this.key,this.location)||I(this.keyCode,this.location),this.keyupReliable=!i.keyupUnreliable,this.keysym&&!f(this.keysym)&&(this.reliable=!0),!this.keysym&&E(this.keyCode,this.keyIdentifier)&&(this.keysym=m(this.keyIdentifier,this.location,this.modifiers.shift)),this.modifiers.meta&&this.keysym!==65511&&this.keysym!==65512?this.keyupReliable=!1:this.keysym===65509&&i.capsLockKeyupUnreliable&&(this.keyupReliable=!1);var W=!this.modifiers.ctrl&&!i.altIsTypableOnly,z=!this.modifiers.alt;(z&&this.modifiers.ctrl||W&&this.modifiers.alt||this.modifiers.meta||this.modifiers.hyper)&&(this.reliable=!0),A[this.keyCode]=this.keysym};p.prototype=new v;var d=function(w){v.call(this,w),this.keysym=C(this.keyCode),this.reliable=!0};d.prototype=new v;var c=function(w){v.call(this,w),this.keysym=I(this.keyCode,this.location)||m(this.key,this.location),t.pressed[this.keysym]||(this.keysym=A[this.keyCode]||this.keysym),this.reliable=!0};c.prototype=new v;var F=[],k={8:[65288],9:[65289],12:[65291,65291,65291,65461],13:[65293],16:[65505,65505,65506],17:[65507,65507,65508],18:[65513,65513,65027],19:[65299],20:[65509],27:[65307],32:[32],33:[65365,65365,65365,65465],34:[65366,65366,65366,65459],35:[65367,65367,65367,65457],36:[65360,65360,65360,65463],37:[65361,65361,65361,65460],38:[65362,65362,65362,65464],39:[65363,65363,65363,65462],40:[65364,65364,65364,65458],45:[65379,65379,65379,65456],46:[65535,65535,65535,65454],91:[65511],92:[65512],93:[65383],96:[65456],97:[65457],98:[65458],99:[65459],100:[65460],101:[65461],102:[65462],103:[65463],104:[65464],105:[65465],106:[65450],107:[65451],109:[65453],110:[65454],111:[65455],112:[65470],113:[65471],114:[65472],115:[65473],116:[65474],117:[65475],118:[65476],119:[65477],120:[65478],121:[65479],122:[65480],123:[65481],144:[65407],145:[65300],225:[65027]},T={Again:[65382],AllCandidates:[65341],Alphanumeric:[65328],Alt:[65513,65513,65027],Attn:[64782],AltGraph:[65027],ArrowDown:[65364],ArrowLeft:[65361],ArrowRight:[65363],ArrowUp:[65362],Backspace:[65288],CapsLock:[65509],Cancel:[65385],Clear:[65291],Convert:[65313],Copy:[64789],Crsel:[64796],CrSel:[64796],CodeInput:[65335],Compose:[65312],Control:[65507,65507,65508],ContextMenu:[65383],Delete:[65535],Down:[65364],End:[65367],Enter:[65293],EraseEof:[64774],Escape:[65307],Execute:[65378],Exsel:[64797],ExSel:[64797],F1:[65470],F2:[65471],F3:[65472],F4:[65473],F5:[65474],F6:[65475],F7:[65476],F8:[65477],F9:[65478],F10:[65479],F11:[65480],F12:[65481],F13:[65482],F14:[65483],F15:[65484],F16:[65485],F17:[65486],F18:[65487],F19:[65488],F20:[65489],F21:[65490],F22:[65491],F23:[65492],F24:[65493],Find:[65384],GroupFirst:[65036],GroupLast:[65038],GroupNext:[65032],GroupPrevious:[65034],FullWidth:null,HalfWidth:null,HangulMode:[65329],Hankaku:[65321],HanjaMode:[65332],Help:[65386],Hiragana:[65317],HiraganaKatakana:[65319],Home:[65360],Hyper:[65517,65517,65518],Insert:[65379],JapaneseHiragana:[65317],JapaneseKatakana:[65318],JapaneseRomaji:[65316],JunjaMode:[65336],KanaMode:[65325],KanjiMode:[65313],Katakana:[65318],Left:[65361],Meta:[65511,65511,65512],ModeChange:[65406],NumLock:[65407],PageDown:[65366],PageUp:[65365],Pause:[65299],Play:[64790],PreviousCandidate:[65342],PrintScreen:[65377],Redo:[65382],Right:[65363],RomanCharacters:null,Scroll:[65300],Select:[65376],Separator:[65452],Shift:[65505,65505,65506],SingleCandidate:[65340],Super:[65515,65515,65516],Tab:[65289],UIKeyInputDownArrow:[65364],UIKeyInputEscape:[65307],UIKeyInputLeftArrow:[65361],UIKeyInputRightArrow:[65363],UIKeyInputUpArrow:[65362],Up:[65362],Undo:[65381],Win:[65511,65511,65512],Zenkaku:[65320],ZenkakuHankaku:[65322]},b={65027:!0,65505:!0,65506:!0,65507:!0,65508:!0,65509:!0,65511:!0,65512:!0,65513:!0,65514:!0,65515:!0,65516:!0};this.modifiers=new n.Keyboard.ModifierState,this.pressed={};var M={},O={},A={},S=null,y=null,s=function(w,W){return w?w[W]||w[0]:null},f=function(w){return w>=0&&w<=255||(w&4294901760)===16777216};function m(R,w,W){if(!R)return null;var z,H=R.indexOf("U+");if(H>=0){var U=R.substring(H+2);z=String.fromCharCode(parseInt(U,16))}else if(R.length===1&&w!==3)z=R;else return s(T[R],w);W===!0?z=z.toUpperCase():W===!1&&(z=z.toLowerCase());var G=z.charCodeAt(0);return C(G)}function x(R){return R<=31||R>=127&&R<=159}function C(R){return x(R)?65280|R:R>=0&&R<=255?R:R>=256&&R<=1114111?16777216|R:null}function I(R,w){return s(k[R],w)}var E=function(w,W){if(!W)return!1;var z=W.indexOf("U+");if(z===-1)return!0;var H=parseInt(W.substring(z+2),16);return w!==H||w>=65&&w<=90||w>=48&&w<=57};this.press=function(R){if(R!==null){if(!t.pressed[R]&&(t.pressed[R]=!0,t.onkeydown)){var w=t.onkeydown(R);return O[R]=w,window.clearTimeout(S),window.clearInterval(y),b[R]||(S=window.setTimeout(function(){y=window.setInterval(function(){t.onkeyup(R),t.onkeydown(R)},50)},500)),w}return O[R]||!1}},this.release=function(R){t.pressed[R]&&(delete t.pressed[R],delete M[R],window.clearTimeout(S),window.clearInterval(y),R!==null&&t.onkeyup&&t.onkeyup(R))},this.type=function(w){for(var W=0;W<w.length;W++){var z=w.codePointAt?w.codePointAt(W):w.charCodeAt(W),H=C(z);t.press(H),t.release(H)}},this.reset=function(){for(var R in t.pressed)t.release(parseInt(R));F=[]};var P=function(w,W,z){var H=z.modifiers[w],U=t.modifiers[w],G;if(W.indexOf(z.keysym)===-1){if(U&&H===!1)for(G=0;G<W.length;G++)t.release(W[G]);else if(!U&&H){for(G=0;G<W.length;G++)if(t.pressed[W[G]])return;var Q=W[0];z.keysym&&(M[Q]=!0),t.press(Q)}}},a=function(w){P("alt",[65513,65514,65027],w),P("shift",[65505,65506],w),P("ctrl",[65507,65508],w),P("meta",[65511,65512],w),P("hyper",[65515,65516],w),t.modifiers=w.modifiers},o=function(){for(var w in t.pressed)if(!M[w])return!1;return!0};function h(){var R=N();if(!R)return!1;var w;do w=R,R=N();while(R!==null);return o()&&t.reset(),w.defaultPrevented}var _=function(w){!t.modifiers.ctrl||!t.modifiers.alt||w>=65&&w<=90||w>=97&&w<=122||(w<=255||(w&4278190080)===16777216)&&(t.release(65507),t.release(65508),t.release(65513),t.release(65514))},N=function(){var w=F[0];if(!w)return null;if(w instanceof p){var W=null,z=[];if(w.keysym===65511||w.keysym===65512){if(F.length===1)return null;if(F[1].keysym!==w.keysym){if(!F[1].modifiers.meta)return F.shift()}else if(F[1]instanceof p)return F.shift()}if(w.reliable?(W=w.keysym,z=F.splice(0,1)):F[1]instanceof d?(W=F[1].keysym,z=F.splice(0,2)):F[1]&&(W=w.keysym,z=F.splice(0,1)),z.length>0){if(a(w),W){_(W);var H=!t.press(W);A[w.keyCode]=W,w.keyupReliable||t.release(W);for(var U=0;U<z.length;U++)z[U].defaultPrevented=H}return w}}else if(w instanceof c&&!i.keyupUnreliable){var W=w.keysym;if(W)t.release(W),delete A[w.keyCode],w.defaultPrevented=!0;else return t.reset(),w;return a(w),F.shift()}else return F.shift();return null},L=function(w){return"location"in w?w.location:"keyLocation"in w?w.keyLocation:0},D=function(w){return w[u]?!1:(w[u]=!0,!0)};this.listenTo=function(w){w.addEventListener("keydown",function(H){if(t.onkeydown&&D(H)){var U=new p(H);U.keyCode!==229&&(F.push(U),h()&&H.preventDefault())}},!0),w.addEventListener("keypress",function(H){!t.onkeydown&&!t.onkeyup||D(H)&&(F.push(new d(H)),h()&&H.preventDefault())},!0),w.addEventListener("keyup",function(H){t.onkeyup&&D(H)&&(H.preventDefault(),F.push(new c(H)),h())},!0);var W=function(U){!t.onkeydown&&!t.onkeyup||D(U)&&U.data&&!U.isComposing&&(w.removeEventListener("compositionend",z,!1),t.type(U.data))},z=function(U){!t.onkeydown&&!t.onkeyup||D(U)&&U.data&&(w.removeEventListener("input",W,!1),t.type(U.data))};w.addEventListener("input",W,!1),w.addEventListener("compositionend",z,!1)},e&&t.listenTo(e)};n.Keyboard._nextID=0;n.Keyboard.ModifierState=function(){this.shift=!1,this.ctrl=!1,this.alt=!1,this.meta=!1,this.hyper=!1};n.Keyboard.ModifierState.fromKeyboardEvent=function(r){var e=new n.Keyboard.ModifierState;return e.shift=r.shiftKey,e.ctrl=r.ctrlKey,e.alt=r.altKey,e.meta=r.metaKey,r.getModifierState&&(e.hyper=r.getModifierState("OS")||r.getModifierState("Super")||r.getModifierState("Hyper")||r.getModifierState("Win")),e};var n=n||{};n.Layer=function(r,e){var t=this,l=64,u=document.createElement("canvas"),i=u.getContext("2d");i.save();var v=!0,p=!0,d=0,c={1:"destination-in",2:"destination-out",4:"source-in",6:"source-atop",8:"source-out",9:"destination-atop",10:"xor",11:"destination-over",12:"copy",14:"source-over",15:"lighter"},F=function(b,M){b=b||0,M=M||0;var O=Math.ceil(b/l)*l,A=Math.ceil(M/l)*l;if(u.width!==O||u.height!==A){var S=null;if(!v&&u.width!==0&&u.height!==0){S=document.createElement("canvas"),S.width=Math.min(t.width,b),S.height=Math.min(t.height,M);var y=S.getContext("2d");y.drawImage(u,0,0,S.width,S.height,0,0,S.width,S.height)}var s=i.globalCompositeOperation;u.width=O,u.height=A,S&&i.drawImage(S,0,0,S.width,S.height,0,0,S.width,S.height),i.globalCompositeOperation=s,d=0,i.save()}else t.reset();t.width=b,t.height=M};function k(T,b,M,O){var A=M+T,S=O+b,y;A>t.width?y=A:y=t.width;var s;S>t.height?s=S:s=t.height,t.resize(y,s)}this.autosize=!1,this.width=r,this.height=e,this.getCanvas=function(){return u},this.toCanvas=function(){var b=document.createElement("canvas");b.width=t.width,b.height=t.height;var M=b.getContext("2d");return M.drawImage(t.getCanvas(),0,0),b},this.resize=function(T,b){(T!==t.width||b!==t.height)&&F(T,b)},this.drawImage=function(T,b,M){t.autosize&&k(T,b,M.width,M.height),i.drawImage(M,T,b),v=!1},this.transfer=function(T,b,M,O,A,S,y,s){var f=T.getCanvas();if(!(b>=f.width||M>=f.height)&&(b+O>f.width&&(O=f.width-b),M+A>f.height&&(A=f.height-M),!(O===0||A===0))){t.autosize&&k(S,y,O,A);for(var m=T.getCanvas().getContext("2d").getImageData(b,M,O,A),x=i.getImageData(S,y,O,A),C=0;C<O*A*4;C+=4){var I=new n.Layer.Pixel(m.data[C],m.data[C+1],m.data[C+2],m.data[C+3]),E=new n.Layer.Pixel(x.data[C],x.data[C+1],x.data[C+2],x.data[C+3]);s(I,E),x.data[C]=E.red,x.data[C+1]=E.green,x.data[C+2]=E.blue,x.data[C+3]=E.alpha}i.putImageData(x,S,y),v=!1}},this.put=function(T,b,M,O,A,S,y){var s=T.getCanvas();if(!(b>=s.width||M>=s.height)&&(b+O>s.width&&(O=s.width-b),M+A>s.height&&(A=s.height-M),!(O===0||A===0))){t.autosize&&k(S,y,O,A);var f=T.getCanvas().getContext("2d").getImageData(b,M,O,A);i.putImageData(f,S,y),v=!1}},this.copy=function(T,b,M,O,A,S,y){var s=T.getCanvas();b>=s.width||M>=s.height||(b+O>s.width&&(O=s.width-b),M+A>s.height&&(A=s.height-M),!(O===0||A===0)&&(t.autosize&&k(S,y,O,A),i.drawImage(s,b,M,O,A,S,y,O,A),v=!1))},this.moveTo=function(T,b){p&&(i.beginPath(),p=!1),t.autosize&&k(T,b,0,0),i.moveTo(T,b)},this.lineTo=function(T,b){p&&(i.beginPath(),p=!1),t.autosize&&k(T,b,0,0),i.lineTo(T,b)},this.arc=function(T,b,M,O,A,S){p&&(i.beginPath(),p=!1),t.autosize&&k(T,b,0,0),i.arc(T,b,M,O,A,S)},this.curveTo=function(T,b,M,O,A,S){p&&(i.beginPath(),p=!1),t.autosize&&k(A,S,0,0),i.bezierCurveTo(T,b,M,O,A,S)},this.close=function(){i.closePath(),p=!0},this.rect=function(T,b,M,O){p&&(i.beginPath(),p=!1),t.autosize&&k(T,b,M,O),i.rect(T,b,M,O)},this.clip=function(){i.clip(),p=!0},this.strokeColor=function(T,b,M,O,A,S,y){i.lineCap=T,i.lineJoin=b,i.lineWidth=M,i.strokeStyle="rgba("+O+","+A+","+S+","+y/255+")",i.stroke(),v=!1,p=!0},this.fillColor=function(T,b,M,O){i.fillStyle="rgba("+T+","+b+","+M+","+O/255+")",i.fill(),v=!1,p=!0},this.strokeLayer=function(T,b,M,O){i.lineCap=T,i.lineJoin=b,i.lineWidth=M,i.strokeStyle=i.createPattern(O.getCanvas(),"repeat"),i.stroke(),v=!1,p=!0},this.fillLayer=function(T){i.fillStyle=i.createPattern(T.getCanvas(),"repeat"),i.fill(),v=!1,p=!0},this.push=function(){i.save(),d++},this.pop=function(){d>0&&(i.restore(),d--)},this.reset=function(){for(;d>0;)i.restore(),d--;i.restore(),i.save(),i.beginPath(),p=!1},this.setTransform=function(T,b,M,O,A,S){i.setTransform(T,b,M,O,A,S)},this.transform=function(T,b,M,O,A,S){i.transform(T,b,M,O,A,S)},this.setChannelMask=function(T){i.globalCompositeOperation=c[T]},this.setMiterLimit=function(T){i.miterLimit=T},F(r,e),u.style.zIndex=-1};n.Layer.ROUT=2;n.Layer.ATOP=6;n.Layer.XOR=10;n.Layer.ROVER=11;n.Layer.OVER=14;n.Layer.PLUS=15;n.Layer.RIN=1;n.Layer.IN=4;n.Layer.OUT=8;n.Layer.RATOP=9;n.Layer.SRC=12;n.Layer.Pixel=function(r,e,t,l){this.red=r,this.green=e,this.blue=t,this.alpha=l};var n=n||{};n.Mouse=function(e){n.Mouse.Event.Target.call(this);var t=this;this.touchMouseThreshold=3,this.scrollThreshold=53,this.PIXELS_PER_LINE=18,this.PIXELS_PER_PAGE=this.PIXELS_PER_LINE*16;var l=[n.Mouse.State.Buttons.LEFT,n.Mouse.State.Buttons.MIDDLE,n.Mouse.State.Buttons.RIGHT],u=0,i=0;e.addEventListener("contextmenu",function(c){n.Event.DOMEvent.cancelEvent(c)},!1),e.addEventListener("mousemove",function(c){if(u){n.Event.DOMEvent.cancelEvent(c),u--;return}t.move(n.Position.fromClientPosition(e,c.clientX,c.clientY),c)},!1),e.addEventListener("mousedown",function(c){if(u){n.Event.DOMEvent.cancelEvent(c);return}var F=l[c.button];F&&t.press(F,c)},!1),e.addEventListener("mouseup",function(c){if(u){n.Event.DOMEvent.cancelEvent(c);return}var F=l[c.button];F&&t.release(F,c)},!1),e.addEventListener("mouseout",function(c){c||(c=window.event);for(var F=c.relatedTarget||c.toElement;F;){if(F===e)return;F=F.parentNode}t.reset(c),t.out(c)},!1),e.addEventListener("selectstart",function(c){n.Event.DOMEvent.cancelEvent(c)},!1);function v(){u=t.touchMouseThreshold}e.addEventListener("touchmove",v,!1),e.addEventListener("touchstart",v,!1),e.addEventListener("touchend",v,!1);function p(c){var F=c.deltaY||-c.wheelDeltaY||-c.wheelDelta;if(F?c.deltaMode===1?F=c.deltaY*t.PIXELS_PER_LINE:c.deltaMode===2&&(F=c.deltaY*t.PIXELS_PER_PAGE):F=c.detail*t.PIXELS_PER_LINE,i+=F,i<=-t.scrollThreshold){do t.click(n.Mouse.State.Buttons.UP),i+=t.scrollThreshold;while(i<=-t.scrollThreshold);i=0}if(i>=t.scrollThreshold){do t.click(n.Mouse.State.Buttons.DOWN),i-=t.scrollThreshold;while(i>=t.scrollThreshold);i=0}n.Event.DOMEvent.cancelEvent(c)}e.addEventListener("DOMMouseScroll",p,!1),e.addEventListener("mousewheel",p,!1),e.addEventListener("wheel",p,!1);var d=function(){var c=document.createElement("div");if(!("cursor"in c.style))return!1;try{c.style.cursor="url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEX///+nxBvIAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==) 0 0, auto"}catch{return!1}return/\burl\([^()]*\)\s+0\s+0\b/.test(c.style.cursor||"")}();this.setCursor=function(c,F,k){if(d){var T=c.toDataURL("image/png");return e.style.cursor="url("+T+") "+F+" "+k+", auto",!0}return!1}};n.Mouse.State=function(e){var t=function(u,i,v,p,d,c,F){return{x:u,y:i,left:v,middle:p,right:d,up:c,down:F}};arguments.length>1?e=t.apply(this,arguments):e=e||{},n.Position.call(this,e),this.left=e.left||!1,this.middle=e.middle||!1,this.right=e.right||!1,this.up=e.up||!1,this.down=e.down||!1};n.Mouse.State.Buttons={LEFT:"left",MIDDLE:"middle",RIGHT:"right",UP:"up",DOWN:"down"};n.Mouse.Event=function(e,t,l){n.Event.DOMEvent.call(this,e,l);var u="on"+this.type;this.state=t,this.invokeLegacyHandler=function(v){v[u]&&(this.preventDefault(),this.stopPropagation(),v[u](this.state))}};n.Mouse.Event.Target=function(){n.Event.Target.call(this),this.currentState=new n.Mouse.State,this.press=function(t,l){this.currentState[t]||(this.currentState[t]=!0,this.dispatch(new n.Mouse.Event("mousedown",this.currentState,l)))},this.release=function(t,l){this.currentState[t]&&(this.currentState[t]=!1,this.dispatch(new n.Mouse.Event("mouseup",this.currentState,l)))},this.click=function(t,l){this.press(t,l),this.release(t,l)},this.move=function(t,l){(this.currentState.x!==t.x||this.currentState.y!==t.y)&&(this.currentState.x=t.x,this.currentState.y=t.y,this.dispatch(new n.Mouse.Event("mousemove",this.currentState,l)))},this.out=function(t){this.dispatch(new n.Mouse.Event("mouseout",this.currentState,t))},this.reset=function(t){for(var l in n.Mouse.State.Buttons)this.release(n.Mouse.State.Buttons[l],t)}};n.Mouse.Touchpad=function(e){n.Mouse.Event.Target.call(this);var t=this;this.scrollThreshold=20*(window.devicePixelRatio||1),this.clickTimingThreshold=250,this.clickMoveThreshold=10*(window.devicePixelRatio||1),this.currentState=new n.Mouse.State;var l=0,u=0,i=0,v=0,p=0,d={1:"left",2:"right",3:"middle"},c=!1,F=null;e.addEventListener("touchend",function(k){if(k.preventDefault(),c&&k.touches.length===0){var T=new Date().getTime(),b=d[l];t.currentState[b]&&(t.release(b,k),F&&(window.clearTimeout(F),F=null)),T-v<=t.clickTimingThreshold&&p<t.clickMoveThreshold&&(t.press(b,k),F=window.setTimeout(function(){t.release(b,k),c=!1},t.clickTimingThreshold)),F||(c=!1)}},!1),e.addEventListener("touchstart",function(k){if(k.preventDefault(),l=Math.min(k.touches.length,3),F&&(window.clearTimeout(F),F=null),!c){c=!0;var T=k.touches[0];u=T.clientX,i=T.clientY,v=new Date().getTime(),p=0}},!1),e.addEventListener("touchmove",function(k){k.preventDefault();var T=k.touches[0],b=T.clientX-u,M=T.clientY-i;if(p+=Math.abs(b)+Math.abs(M),l===1){var O=p/(new Date().getTime()-v),A=1+O,S=new n.Position(t.currentState);S.x+=b*A,S.y+=M*A,S.x=Math.min(Math.max(0,S.x),e.offsetWidth-1),S.y=Math.min(Math.max(0,S.y),e.offsetHeight-1),t.move(S,k),u=T.clientX,i=T.clientY}else if(l===2&&Math.abs(M)>=t.scrollThreshold){var y;M>0?y="down":y="up",t.click(y,k),u=T.clientX,i=T.clientY}},!1)};n.Mouse.Touchscreen=function(e){n.Mouse.Event.Target.call(this);var t=this,l=!1,u=null,i=null,v=null,p=null;this.scrollThreshold=20*(window.devicePixelRatio||1),this.clickTimingThreshold=250,this.clickMoveThreshold=16*(window.devicePixelRatio||1),this.longPressThreshold=500;function d(k){var T=k.touches[0]||k.changedTouches[0],b=T.clientX-u,M=T.clientY-i;return Math.sqrt(b*b+M*M)>=t.clickMoveThreshold}function c(k){var T=k.touches[0];l=!0,u=T.clientX,i=T.clientY}function F(){window.clearTimeout(v),window.clearTimeout(p),l=!1}e.addEventListener("touchend",function(k){if(l){if(k.touches.length!==0||k.changedTouches.length!==1){F();return}if(window.clearTimeout(p),t.release(n.Mouse.State.Buttons.LEFT,k),!d(k)&&(k.preventDefault(),!t.currentState.left)){var T=k.changedTouches[0];t.move(n.Position.fromClientPosition(e,T.clientX,T.clientY)),t.press(n.Mouse.State.Buttons.LEFT,k),v=window.setTimeout(function(){t.release(n.Mouse.State.Buttons.LEFT,k),F()},t.clickTimingThreshold)}}},!1),e.addEventListener("touchstart",function(k){if(k.touches.length!==1){F();return}k.preventDefault(),c(k),window.clearTimeout(v),p=window.setTimeout(function(){var T=k.touches[0];t.move(n.Position.fromClientPosition(e,T.clientX,T.clientY)),t.click(n.Mouse.State.Buttons.RIGHT,k),F()},t.longPressThreshold)},!1),e.addEventListener("touchmove",function(k){if(l){if(d(k)&&window.clearTimeout(p),k.touches.length!==1){F();return}if(t.currentState.left){k.preventDefault();var T=k.touches[0];t.move(n.Position.fromClientPosition(e,T.clientX,T.clientY),k)}}},!1)};var n=n||{},n=n||{};n.Object=function(e,t){var l=this,u={},i=function(d){var c=u[d];if(!c)return null;var F=c.shift();return c.length===0&&delete u[d],F},v=function(d,c){var F=u[d];F||(F=[],u[d]=F),F.push(c)};this.index=t,this.onbody=function(d,c,F){var k=i(F);k&&k(d,c)},this.onundefine=null,this.requestInputStream=function(d,c){c&&v(d,c),e.requestObjectInputStream(l.index,d)},this.createOutputStream=function(d,c){return e.createObjectOutputStream(l.index,d,c)}};n.Object.ROOT_STREAM="/";n.Object.STREAM_INDEX_MIMETYPE="application/vnd.glyptodon.guacamole.stream-index+json";var n=n||{};n.OnScreenKeyboard=function(r){var e=this,t={},l={},u=[],i=function(s,f){s.classList?s.classList.add(f):s.className+=" "+f},v=function(s,f){s.classList?s.classList.remove(f):s.className=s.className.replace(/([^ ]+)[ ]*/g,function(x,C){return C===f?"":x})},p=0,d=function(s,f,m,x){this.width=f,this.height=m,this.scale=function(C){s.style.width=f*C+"px",s.style.height=m*C+"px",x&&(s.style.lineHeight=m*C+"px",s.style.fontSize=C+"px")}},c=function(s){for(var f=0;f<s.length;f++){var m=s[f];if(!(m in t))return!1}return!0},F=function(s){var f=e.keys[s];if(!f)return null;for(var m=f.length-1;m>=0;m--){var x=f[m];if(c(x.requires))return x}return null},k=function(s,f){if(!l[s]){i(f,"guac-keyboard-pressed");var m=F(s);if(m.modifier){var x="guac-keyboard-modifier-"+A(m.modifier),C=t[m.modifier];C===void 0?(i(b,x),t[m.modifier]=m.keysym,m.keysym&&e.onkeydown&&e.onkeydown(m.keysym)):(v(b,x),delete t[m.modifier],C&&e.onkeyup&&e.onkeyup(C))}else e.onkeydown&&e.onkeydown(m.keysym);l[s]=!0}},T=function(s,f){if(l[s]){v(f,"guac-keyboard-pressed");var m=F(s);!m.modifier&&e.onkeyup&&e.onkeyup(m.keysym),l[s]=!1}},b=document.createElement("div");b.className="guac-keyboard",b.onselectstart=b.onmousemove=b.onmouseup=b.onmousedown=function(s){return p&&p--,s.stopPropagation(),!1},this.touchMouseThreshold=3,this.onkeydown=null,this.onkeyup=null,this.layout=new n.OnScreenKeyboard.Layout(r),this.getElement=function(){return b},this.resize=function(y){for(var s=Math.floor(y*10/e.layout.width)/10,f=0;f<u.length;f++){var m=u[f];m.scale(s)}};var M=function(s,f){if(f instanceof Array){for(var m=[],x=0;x<f.length;x++)m.push(new n.OnScreenKeyboard.Key(f[x],s));return m}return typeof f=="number"?[new n.OnScreenKeyboard.Key({name:s,keysym:f})]:typeof f=="string"?[new n.OnScreenKeyboard.Key({name:s,title:f})]:[new n.OnScreenKeyboard.Key(f,s)]},O=function(s){var f={};for(var m in r.keys)f[m]=M(m,s[m]);return f};this.keys=O(r.keys);var A=function(s){var f=s.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[^A-Za-z0-9]+/g,"-").toLowerCase();return f},S=function y(s,f,m){var x,C=document.createElement("div");if(m&&i(C,"guac-keyboard-"+A(m)),f instanceof Array)for(i(C,"guac-keyboard-group"),x=0;x<f.length;x++)y(C,f[x]);else if(f instanceof Object){i(C,"guac-keyboard-group");var I=Object.keys(f).sort();for(x=0;x<I.length;x++){var m=I[x];y(C,f[m],m)}}else if(typeof f=="number")i(C,"guac-keyboard-gap"),u.push(new d(C,f,f));else if(typeof f=="string"){var E=f;E.length===1&&(E="0x"+E.charCodeAt(0).toString(16)),i(C,"guac-keyboard-key-container");var P=document.createElement("div");P.className="guac-keyboard-key guac-keyboard-key-"+A(E);var a=e.keys[f];if(a)for(x=0;x<a.length;x++){var o=a[x],h=document.createElement("div");h.className="guac-keyboard-cap",h.textContent=o.title;for(var _=0;_<o.requires.length;_++){var N=o.requires[_];i(h,"guac-keyboard-requires-"+A(N)),i(P,"guac-keyboard-uses-"+A(N))}P.appendChild(h)}C.appendChild(P),u.push(new d(C,e.layout.keyWidths[f]||1,1,!0));var L=function(z){z.preventDefault(),p=e.touchMouseThreshold,k(f,P)},D=function(z){z.preventDefault(),p=e.touchMouseThreshold,T(f,P)},R=function(z){z.preventDefault(),p===0&&k(f,P)},w=function(z){z.preventDefault(),p===0&&T(f,P)};P.addEventListener("touchstart",L,!0),P.addEventListener("touchend",D,!0),P.addEventListener("mousedown",R,!0),P.addEventListener("mouseup",w,!0),P.addEventListener("mouseout",w,!0)}s.appendChild(C)};S(b,r.layout)};n.OnScreenKeyboard.Layout=function(r){this.language=r.language,this.type=r.type,this.keys=r.keys,this.layout=r.layout,this.width=r.width,this.keyWidths=r.keyWidths||{}};n.OnScreenKeyboard.Key=function(r,e){this.name=e||r.name,this.title=r.title||this.name,this.keysym=r.keysym||function(l){if(!l||l.length!==1)return null;var u=l.charCodeAt(0);return u>=0&&u<=255?u:u>=256&&u<=1114111?16777216|u:null}(this.title),this.modifier=r.modifier,this.requires=r.requires||[]};var n=n||{};n.OutputStream=function(r,e){var t=this;this.index=e,this.onack=null,this.sendBlob=function(l){r.sendBlob(t.index,l)},this.sendEnd=function(){r.endStream(t.index)}};var n=n||{};n.Parser=function(){var r=this,e="",t=[],l=-1,u=0;this.receive=function(i){for(u>4096&&l>=u&&(e=e.substring(u),l-=u,u=0),e+=i;l<e.length;){if(l>=u){var v=e.substring(u,l),p=e.substring(l,l+1);if(t.push(v),p==";"){var d=t.shift();r.oninstruction!=null&&r.oninstruction(d,t),t.length=0}else if(p!=",")throw new Error("Illegal terminator.");u=l+1}var c=e.indexOf(".",u);if(c!=-1){var F=parseInt(e.substring(l+1,c));if(isNaN(F))throw new Error("Non-numeric character in element length.");u=c+1,l=u+F}else{u=e.length;break}}},this.oninstruction=null};var n=n||{};n.Position=function(e){e=e||{},this.x=e.x||0,this.y=e.y||0,this.fromClientPosition=function(l,u,i){this.x=u-l.offsetLeft,this.y=i-l.offsetTop;for(var v=l.offsetParent;v&&v!==document.body;)this.x-=v.offsetLeft-v.scrollLeft,this.y-=v.offsetTop-v.scrollTop,v=v.offsetParent;if(v){var p=document.body.scrollLeft||document.documentElement.scrollLeft,d=document.body.scrollTop||document.documentElement.scrollTop;this.x-=v.offsetLeft-p,this.y-=v.offsetTop-d}}};n.Position.fromClientPosition=function(e,t,l){var u=new n.Position;return u.fromClientPosition(e,t,l),u};var n=n||{};n.RawAudioFormat=function(e){this.bytesPerSample=e.bytesPerSample,this.channels=e.channels,this.rate=e.rate};n.RawAudioFormat.parse=function(e){var t,l=null,u=1;if(e.substring(0,9)==="audio/L8;")e=e.substring(9),t=1;else if(e.substring(0,10)==="audio/L16;")e=e.substring(10),t=2;else return null;for(var i=e.split(","),v=0;v<i.length;v++){var p=i[v],d=p.indexOf("=");if(d===-1)return null;var c=p.substring(0,d),F=p.substring(d+1);switch(c){case"channels":u=parseInt(F);break;case"rate":l=parseInt(F);break;default:return null}}return l===null?null:new n.RawAudioFormat({bytesPerSample:t,channels:u,rate:l})};var n=n||{};n.SessionRecording=function(e){var t=this,l,u=null,i=262144,v=16384,p=5e3,d=[],c=0,F=new n.SessionRecording._PlaybackTunnel,k=new n.Client(F),T=-1,b=null,M=null,O=null,A=0,S=0,y=!1,s=null,f=function(D,R,w){if(!(y&&D===l)){var W=new n.Parser;W.oninstruction=R;var z=0,H=new FileReader,U=function(){if(!(y&&D===l)){if(H.readyState===2)try{W.receive(H.result)}catch(j){t.onerror&&t.onerror(j.message);return}if(z>=D.size)w&&w();else{var Q=D.slice(z,z+i);z+=Q.size,H.readAsText(Q)}}};H.onload=U,U()}},m=function(D){for(var R=D.length,w=R+3;R>=10;)w++,R=Math.floor(R/10);return w};k.connect(),k.getDisplay().showCursor(!1);var x=function(D,R){S+=m(D);for(var w=0;w<R.length;w++)S+=m(R[w]);if(D==="sync"){var W=parseInt(R[0]),z=new n.SessionRecording._Frame(W,A,S);d.push(z),A=S,(d.length===1||S-d[c].start>=v&&W-d[c].timestamp>=p)&&(z.keyframe=!0,c=d.length-1),t.onprogress&&t.onprogress(t.getDuration(),S)}},C=function(){t.onload&&t.onload()};if(e instanceof Blob)f(l,x,C);else{u=e,l=new Blob;var I=!1,E="";u.oninstruction=function(D,R){E+=D.length+"."+D,R.forEach(function(W){E+=","+W.length+"."+W}),E+=";",E.length>=i&&(l=new Blob([l,E]),E=""),x(D,R)},u.onerror=function(D){I=!0,t.onerror&&t.onerror(D.message)},u.onstatechange=function(D){D===n.Tunnel.State.CLOSED&&(E.length&&(l=new Blob([l,E]),E=""),I||C())}}var P=function(D){return d.length===0?0:D-d[0].timestamp},a=function L(D,R,w){if(D===R)return D;var W=Math.floor((D+R)/2),z=P(d[W].timestamp);return w<z&&W>D?L(D,W-1,w):w>z&&W<R?L(W+1,R,w):W},o=function(D,R){var w=d[D];f(l.slice(w.start,w.end),function(z,H){F.receiveInstruction(z,H)},function(){w.keyframe&&!w.clientState&&k.exportState(function(H){w.clientState=new Blob([JSON.stringify(H)])}),T=D,R&&R()})},h=function(D,R,w){_();for(var W=O={aborted:!1},z=D,H=function Q(){t.onseek&&T>z&&t.onseek(P(d[T].timestamp),T-z,D-z),!W.aborted&&(T<D?o(T+1,Q):R())},U=function(){var j=w?Math.max(w-new Date().getTime(),0):0;j?window.setTimeout(H,j):H()};z>=0;z--){var G=d[z];if(z===T)break;if(G.clientState){G.clientState.text().then(function(j){k.importState(JSON.parse(j)),T=z,U()});return}}U()},_=function(){O&&(O.aborted=!0,O=null)},N=function L(){if(T+1<d.length){var D=d[T+1],R=D.timestamp-b+M;h(T+1,function(){L()},R)}else t.pause()};this.onload=null,this.onerror=null,this.onabort=null,this.onprogress=null,this.onplay=null,this.onpause=null,this.onseek=null,this.connect=function(D){u&&u.connect(D)},this.disconnect=function(){u&&u.disconnect()},this.abort=function(){y||(y=!0,t.onabort&&t.onabort(),u&&u.disconnect())},this.getDisplay=function(){return k.getDisplay()},this.isPlaying=function(){return!!b},this.getPosition=function(){return T===-1?0:P(d[T].timestamp)},this.getDuration=function(){return d.length===0?0:P(d[d.length-1].timestamp)},this.play=function(){if(!t.isPlaying()&&T+1<d.length){t.onplay&&t.onplay();var D=d[T+1];b=D.timestamp,M=new Date().getTime(),N()}},this.seek=function(D,R){if(d.length!==0){t.cancel();var w=t.isPlaying();t.pause(),s=function(){s=null,w&&(t.play(),w=null),R&&R()},h(a(0,d.length-1,D),s)}},this.cancel=function(){s&&(_(),s())},this.pause=function(){_(),t.isPlaying()&&(t.onpause&&t.onpause(),b=null,M=null)}};n.SessionRecording._Frame=function(e,t,l){this.keyframe=!1,this.timestamp=e,this.start=t,this.end=l,this.clientState=null};n.SessionRecording._PlaybackTunnel=function(){var e=this;this.connect=function(l){},this.sendMessage=function(l){},this.disconnect=function(){},this.receiveInstruction=function(l,u){e.oninstruction&&e.oninstruction(l,u)}};var n=n||{};n.Status=function(r,e){var t=this;this.code=r,this.message=e,this.isError=function(){return t.code<0||t.code>255}};n.Status.Code={SUCCESS:0,UNSUPPORTED:256,SERVER_ERROR:512,SERVER_BUSY:513,UPSTREAM_TIMEOUT:514,UPSTREAM_ERROR:515,RESOURCE_NOT_FOUND:516,RESOURCE_CONFLICT:517,RESOURCE_CLOSED:518,UPSTREAM_NOT_FOUND:519,UPSTREAM_UNAVAILABLE:520,SESSION_CONFLICT:521,SESSION_TIMEOUT:522,SESSION_CLOSED:523,CLIENT_BAD_REQUEST:768,CLIENT_UNAUTHORIZED:769,CLIENT_FORBIDDEN:771,CLIENT_TIMEOUT:776,CLIENT_OVERRUN:781,CLIENT_BAD_TYPE:783,CLIENT_TOO_MANY:797};n.Status.Code.fromHTTPCode=function(e){switch(e){case 400:return n.Status.Code.CLIENT_BAD_REQUEST;case 403:return n.Status.Code.CLIENT_FORBIDDEN;case 404:return n.Status.Code.RESOURCE_NOT_FOUND;case 429:return n.Status.Code.CLIENT_TOO_MANY;case 503:return n.Status.Code.SERVER_BUSY}return n.Status.Code.SERVER_ERROR};n.Status.Code.fromWebSocketCode=function(e){switch(e){case 1e3:return n.Status.Code.SUCCESS;case 1006:case 1015:return n.Status.Code.UPSTREAM_NOT_FOUND;case 1001:case 1012:case 1013:case 1014:return n.Status.Code.UPSTREAM_UNAVAILABLE}return n.Status.Code.SERVER_ERROR};var n=n||{};n.StringReader=function(r){var e=this,t=new n.UTF8Parser,l=new n.ArrayBufferReader(r);l.ondata=function(u){var i=t.decode(u);e.ontext&&e.ontext(i)},l.onend=function(){e.onend&&e.onend()},this.ontext=null,this.onend=null};var n=n||{};n.StringWriter=function(r){var e=this,t=new n.ArrayBufferWriter(r),l=new Uint8Array(8192),u=0;t.onack=function(d){e.onack&&e.onack(d)};function i(d){if(u+d>=l.length){var c=new Uint8Array((u+d)*2);c.set(l),l=c}u+=d}function v(d){var c,F;if(d<=127)c=0,F=1;else if(d<=2047)c=192,F=2;else if(d<=65535)c=224,F=3;else if(d<=2097151)c=240,F=4;else{v(65533);return}i(F);for(var k=u-1,T=1;T<F;T++)l[k--]=128|d&63,d>>=6;l[k]=c|d}function p(d){for(var c=0;c<d.length;c++){var F=d.charCodeAt(c);v(F)}if(u>0){var k=l.subarray(0,u);return u=0,k}}this.sendText=function(d){d.length&&t.sendData(p(d))},this.sendEnd=function(){t.sendEnd()},this.onack=null};var n=n||{};n.Touch=function(e){n.Event.Target.call(this);var t=this,l=Math.floor(16*window.devicePixelRatio);this.touches={},this.activeTouches=0,e.addEventListener("touchstart",function(i){for(var v=0;v<i.changedTouches.length;v++){var p=i.changedTouches[v],d=p.identifier;if(!t.touches[d]){var c=t.touches[d]=new n.Touch.State({id:d,radiusX:p.radiusX||l,radiusY:p.radiusY||l,angle:p.angle||0,force:p.force||1});t.activeTouches++,c.fromClientPosition(e,p.clientX,p.clientY),t.dispatch(new n.Touch.Event("touchmove",i,c))}}},!1),e.addEventListener("touchmove",function(i){for(var v=0;v<i.changedTouches.length;v++){var p=i.changedTouches[v],d=p.identifier,c=t.touches[d];c&&(p.force&&(c.force=p.force),c.angle=p.angle||0,c.radiusX=p.radiusX||l,c.radiusY=p.radiusY||l,c.fromClientPosition(e,p.clientX,p.clientY),t.dispatch(new n.Touch.Event("touchmove",i,c)))}},!1),e.addEventListener("touchend",function(i){for(var v=0;v<i.changedTouches.length;v++){var p=i.changedTouches[v],d=p.identifier,c=t.touches[d];c&&(delete t.touches[d],t.activeTouches--,c.force=0,c.fromClientPosition(e,p.clientX,p.clientY),t.dispatch(new n.Touch.Event("touchend",i,c)))}},!1)};n.Touch.State=function(e){e=e||{},n.Position.call(this,e),this.id=e.id||0,this.radiusX=e.radiusX||0,this.radiusY=e.radiusY||0,this.angle=e.angle||0,this.force=e.force||1};n.Touch.Event=function(e,t,l){n.Event.DOMEvent.call(this,e,[t]),this.state=l};var n=n||{};n.Tunnel=function(){this.connect=function(r){},this.disconnect=function(){},this.sendMessage=function(r){},this.setState=function(r){r!==this.state&&(this.state=r,this.onstatechange&&this.onstatechange(r))},this.setUUID=function(e){this.uuid=e,this.onuuid&&this.onuuid(e)},this.isConnected=function(){return this.state===n.Tunnel.State.OPEN||this.state===n.Tunnel.State.UNSTABLE},this.state=n.Tunnel.State.CLOSED,this.receiveTimeout=15e3,this.unstableThreshold=1500,this.uuid=null,this.onuuid=null,this.onerror=null,this.onstatechange=null,this.oninstruction=null};n.Tunnel.INTERNAL_DATA_OPCODE="";n.Tunnel.State={CONNECTING:0,OPEN:1,CLOSED:2,UNSTABLE:3};n.HTTPTunnel=function(r,e,t){var l=this,u=r+"?connect",i=r+"?read:",v=r+"?write:",p=1,d=0,c=p,F=!1,k="",T=!!e,b=null,M=null,O=null,A=500,S=t||{},y="Guacamole-Tunnel-Token",s=null;function f(o,h){for(var _ in h)o.setRequestHeader(_,h[_])}var m=function(){window.clearTimeout(b),window.clearTimeout(M),l.state===n.Tunnel.State.UNSTABLE&&l.setState(n.Tunnel.State.OPEN),b=window.setTimeout(function(){x(new n.Status(n.Status.Code.UPSTREAM_TIMEOUT,"Server timeout."))},l.receiveTimeout),M=window.setTimeout(function(){l.setState(n.Tunnel.State.UNSTABLE)},l.unstableThreshold)};function x(o){window.clearTimeout(b),window.clearTimeout(M),window.clearInterval(O),l.state!==n.Tunnel.State.CLOSED&&(o.code!==n.Status.Code.SUCCESS&&l.onerror&&(l.state===n.Tunnel.State.CONNECTING||o.code!==n.Status.Code.RESOURCE_NOT_FOUND)&&l.onerror(o),F=!1,l.setState(n.Tunnel.State.CLOSED))}this.sendMessage=function(){if(!l.isConnected()||arguments.length===0)return;function o(N){var L=new String(N);return L.length+"."+L}for(var h=o(arguments[0]),_=1;_<arguments.length;_++)h+=","+o(arguments[_]);h+=";",k+=h,F||C()};function C(){if(l.isConnected())if(k.length>0){F=!0;var o=new XMLHttpRequest;o.open("POST",v+l.uuid),o.withCredentials=T,f(o,S),o.setRequestHeader("Content-type","application/octet-stream"),o.setRequestHeader(y,s),o.onreadystatechange=function(){o.readyState===4&&(m(),o.status!==200?I(o):C())},o.send(k),k=""}else F=!1}function I(o){var h=parseInt(o.getResponseHeader("Guacamole-Status-Code"));if(h){var _=o.getResponseHeader("Guacamole-Error-Message");x(new n.Status(h,_))}else o.status?x(new n.Status(n.Status.Code.fromHTTPCode(o.status),o.statusText)):x(new n.Status(n.Status.Code.UPSTREAM_NOT_FOUND))}function E(o){var h=null,_=null,N=0,L=-1,D=0,R=new Array;function w(){if(!l.isConnected()){h!==null&&clearInterval(h);return}if(!(o.readyState<2)){var W;try{W=o.status}catch{W=200}if(!_&&W===200&&(_=a()),o.readyState===3||o.readyState===4){if(m(),c===p&&(o.readyState===3&&!h?h=setInterval(w,30):o.readyState===4&&h&&clearInterval(h)),o.status===0){l.disconnect();return}else if(o.status!==200){I(o);return}var z;try{z=o.responseText}catch{return}for(;L<z.length;){if(L>=D){var H=z.substring(D,L),U=z.substring(L,L+1);if(R.push(H),U===";"){var G=R.shift();l.oninstruction&&l.oninstruction(G,R),R.length=0}D=L+1}var Q=z.indexOf(".",D);if(Q!==-1){var j=parseInt(z.substring(L+1,Q));if(j===0){h&&clearInterval(h),o.onreadystatechange=null,o.abort(),_&&E(_);break}D=Q+1,L=D+j}else{D=z.length;break}}}}}c===p?o.onreadystatechange=function(){o.readyState===3&&(N++,N>=2&&(c=d,o.onreadystatechange=w)),w()}:o.onreadystatechange=w,w()}var P=0;function a(){var o=new XMLHttpRequest;return o.open("GET",i+l.uuid+":"+P++),o.setRequestHeader(y,s),o.withCredentials=T,f(o,S),o.send(null),o}this.connect=function(o){m(),l.setState(n.Tunnel.State.CONNECTING);var h=new XMLHttpRequest;h.onreadystatechange=function(){if(h.readyState===4){if(h.status!==200){I(h);return}if(m(),l.setUUID(h.responseText),s=h.getResponseHeader(y),!s){x(new n.Status(n.Status.Code.UPSTREAM_NOT_FOUND));return}l.setState(n.Tunnel.State.OPEN),O=setInterval(function(){l.sendMessage("nop")},A),E(a())}},h.open("POST",u,!0),h.withCredentials=T,f(h,S),h.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"),h.send(o)},this.disconnect=function(){x(new n.Status(n.Status.Code.SUCCESS,"Manually closed."))}};n.HTTPTunnel.prototype=new n.Tunnel;n.WebSocketTunnel=function(r){var e=this,t=null,l=null,u=null,i=null,v={"http:":"ws:","https:":"wss:"},p=500,d=0;if(r.substring(0,3)!=="ws:"&&r.substring(0,4)!=="wss:"){var c=v[window.location.protocol];if(r.substring(0,1)==="/")r=c+"//"+window.location.host+r;else{var F=window.location.pathname.lastIndexOf("/"),k=window.location.pathname.substring(0,F+1);r=c+"//"+window.location.host+k+r}}var T=function(){var A=new Date().getTime();e.sendMessage(n.Tunnel.INTERNAL_DATA_OPCODE,"ping",A),d=A},b=function(){window.clearTimeout(l),window.clearTimeout(u),window.clearTimeout(i),e.state===n.Tunnel.State.UNSTABLE&&e.setState(n.Tunnel.State.OPEN),l=window.setTimeout(function(){M(new n.Status(n.Status.Code.UPSTREAM_TIMEOUT,"Server timeout."))},e.receiveTimeout),u=window.setTimeout(function(){e.setState(n.Tunnel.State.UNSTABLE)},e.unstableThreshold);var A=new Date().getTime(),S=Math.max(d+p-A,0);S>0?i=window.setTimeout(T,S):T()};function M(O){window.clearTimeout(l),window.clearTimeout(u),window.clearTimeout(i),e.state!==n.Tunnel.State.CLOSED&&(O.code!==n.Status.Code.SUCCESS&&e.onerror&&e.onerror(O),e.setState(n.Tunnel.State.CLOSED),t.close())}this.sendMessage=function(O){if(!e.isConnected()||arguments.length===0)return;function A(s){var f=new String(s);return f.length+"."+f}for(var S=A(arguments[0]),y=1;y<arguments.length;y++)S+=","+A(arguments[y]);S+=";",t.send(S)},this.connect=function(O){b(),e.setState(n.Tunnel.State.CONNECTING),t=new WebSocket(r+"?"+O,"guacamole"),t.onopen=function(A){b()},t.onclose=function(A){A.reason?M(new n.Status(parseInt(A.reason),A.reason)):A.code?M(new n.Status(n.Status.Code.fromWebSocketCode(A.code))):M(new n.Status(n.Status.Code.UPSTREAM_NOT_FOUND))},t.onmessage=function(A){b();var S=A.data,y=0,s,f=[];do{var m=S.indexOf(".",y);if(m!==-1){var x=parseInt(S.substring(s+1,m));y=m+1,s=y+x}else M(new n.Status(n.Status.Code.SERVER_ERROR,"Incomplete instruction."));var C=S.substring(y,s),I=S.substring(s,s+1);if(f.push(C),I===";"){var E=f.shift();e.uuid===null&&(E===n.Tunnel.INTERNAL_DATA_OPCODE&&f.length===1&&e.setUUID(f[0]),e.setState(n.Tunnel.State.OPEN)),E!==n.Tunnel.INTERNAL_DATA_OPCODE&&e.oninstruction&&e.oninstruction(E,f),f.length=0}y=s+1}while(y<S.length)}},this.disconnect=function(){M(new n.Status(n.Status.Code.SUCCESS,"Manually closed."))}};n.WebSocketTunnel.prototype=new n.Tunnel;n.ChainedTunnel=function(r){for(var e=this,t,l=[],u=null,i=0;i<arguments.length;i++)l.push(arguments[i]);function v(p){e.disconnect=p.disconnect,e.sendMessage=p.sendMessage;var d=function(k){if(k&&k.code===n.Status.Code.UPSTREAM_TIMEOUT)return l=[],null;var T=l.shift();return T&&(p.onerror=null,p.oninstruction=null,p.onstatechange=null,v(T)),T};function c(){p.onstatechange=e.onstatechange,p.oninstruction=e.oninstruction,p.onerror=e.onerror,p.uuid&&e.setUUID(p.uuid),p.onuuid=function(k){e.setUUID(k)},u=p}p.onstatechange=function(F){switch(F){case n.Tunnel.State.OPEN:c(),e.onstatechange&&e.onstatechange(F);break;case n.Tunnel.State.CLOSED:!d()&&e.onstatechange&&e.onstatechange(F);break}},p.oninstruction=function(F,k){c(),e.oninstruction&&e.oninstruction(F,k)},p.onerror=function(F){!d(F)&&e.onerror&&e.onerror(F)},p.connect(t)}this.connect=function(p){t=p;var d=u||l.shift();d?v(d):e.onerror&&e.onerror(n.Status.Code.SERVER_ERROR,"No tunnels to try.")}};n.ChainedTunnel.prototype=new n.Tunnel;n.StaticHTTPTunnel=function(e,t,l){var u=this,i=null,v=l||{};this.size=null,this.sendMessage=function(d){},this.connect=function(d){u.disconnect(),u.setState(n.Tunnel.State.CONNECTING);var c=new n.Parser,F=new n.UTF8Parser;c.oninstruction=function(T,b){u.oninstruction&&u.oninstruction(T,b)},i=new AbortController,fetch(e,{headers:v,credentials:t?"include":"same-origin",signal:i.signal}).then(function(T){if(!T.ok){u.onerror&&u.onerror(new n.Status(n.Status.Code.fromHTTPCode(T.status),T.statusText)),u.disconnect();return}u.size=T.headers.get("Content-Length"),u.setState(n.Tunnel.State.OPEN);var b=T.body.getReader(),M=function O(A){if(A.done){u.disconnect();return}c.receive(F.decode(A.value)),b.read().then(O)};b.read().then(M)})},this.disconnect=function(){i&&(i.abort(),i=null),u.setState(n.Tunnel.State.CLOSED)}};n.StaticHTTPTunnel.prototype=new n.Tunnel;var n=n||{};n.UTF8Parser=function(){var e=0,t=0;this.decode=function(u){for(var i="",v=new Uint8Array(u),p=0;p<v.length;p++){var d=v[p];e===0?(d|127)===127?i+=String.fromCharCode(d):(d|31)===223?(t=d&31,e=1):(d|15)===239?(t=d&15,e=2):(d|7)===247?(t=d&7,e=3):i+="�":(d|63)===191?(t=t<<6|d&63,e--,e===0&&(i+=String.fromCharCode(t))):(e=0,i+="�")}return i}};var n=n||{};n.API_VERSION="1.5.0";var n=n||{};n.VideoPlayer=function(){this.sync=function(){}};n.VideoPlayer.isSupportedType=function(e){return!1};n.VideoPlayer.getSupportedTypes=function(){return[]};n.VideoPlayer.getInstance=function(e,t,l){return null};const me=n,ft={ref:"screenContainerRef",class:"screen-container"},dt={ref:"screenRef",class:"screen"},vt={key:0,class:"request-control-overlay"},ht={key:1,class:"control-denied-overlay"},pt={class:"control-denied-text"},gt=g.defineComponent({__name:"WebControlForRIGOLOS",props:{wsUrl:{default:void 0},screenWidth:{default:void 0},screenHeight:{default:void 0}},setup(r){const e=Fe(),t=r,l=g.ref(null),u=g.ref(null),i=g.ref(null),v=g.ref(!1),p=g.ref(!1),d=g.ref(""),c=g.ref(null),F=g.ref(!0),k=g.ref(!1),T=g.ref("");let b=null,M=null,O=null,A=null;const S=g.ref(t.screenWidth||1920),y=g.ref(t.screenHeight||1080),s=g.ref({}),f=g.ref({}),m=[1e3,2e3,4e3];let x=0,C=null;const I=g.computed(()=>t.wsUrl||`ws://${window.location.hostname}/ws`);function E(){if(!l.value||!u.value)return;const H=S.value,U=y.value;if(!Number.isFinite(H)||!Number.isFinite(U)||H<=0||U<=0)return;const G=l.value.parentElement;if(!G)return;const Q=G.getBoundingClientRect(),j=window.getComputedStyle(G),Z=parseFloat(j.paddingLeft)||0,te=parseFloat(j.paddingRight)||0,ee=parseFloat(j.paddingTop)||0,ne=parseFloat(j.paddingBottom)||0,ie=Q.width-Z-te,ce=Q.height-ee-ne;if(ie===0||ce===0)return;const ge=ie/H,se=ce/U,K=Math.min(ge,se),X=Math.floor(H*K),$=Math.floor(U*K);f.value={width:`${X}px`,height:`${$}px`},s.value={width:`${X}px`,height:`${$}px`},O&&O.getDisplay().scale(X/H)}function P(){A&&(A.onkeydown=null,A.onkeyup=null,A=null),O&&(O.disconnect(),O=null),u.value&&u.value.replaceChildren()}function a(){var te;if(P(),!u.value||!((te=c.value)!=null&&te.has_control))return;const H=`${I.value}/tunnel`;V.info("Starting Guacamole tunnel:",H);const U=new me.WebSocketTunnel(H),G=new me.Client(U);G.onerror=ee=>{V.error("Guacamole error:",ee),d.value=e.connection.connectionError},G.onstatechange=ee=>{ee===me.Client.State.CONNECTED&&(d.value="")};const Q=G.getDisplay();Q.onresize=(ee,ne)=>{!Number.isFinite(ee)||!Number.isFinite(ne)||ee<=0||ne<=0||(S.value=ee,y.value=ne,g.nextTick(()=>E()))},u.value.appendChild(Q.getElement()),new me.Mouse(G.getDisplay().getElement()).onEach(["mousedown","mousemove","mouseup"],ee=>{G.sendMouseState(ee.state,!0)});const Z=new me.Keyboard(u.value);Z.onkeydown=ee=>{G.sendKeyEvent(1,ee)},Z.onkeyup=ee=>{G.sendKeyEvent(0,ee)},O=G,A=Z,G.connect("")}function o(){var H;(H=u.value)==null||H.focus()}g.watch(()=>{var H;return(H=c.value)==null?void 0:H.has_control},async H=>{H?(await g.nextTick(),a(),E()):P()});function h(){var H;((H=i.value)==null?void 0:H.readyState)===WebSocket.OPEN&&i.value.send(JSON.stringify({type:"get_control_status"}))}function _(){var H;((H=i.value)==null?void 0:H.readyState)===WebSocket.OPEN&&(V.info("Requesting control..."),k.value=!0,i.value.send(JSON.stringify({type:"request_control"})))}function N(H){T.value=H,b&&clearTimeout(b),b=window.setTimeout(()=>{T.value="",b=null},3e3)}function L(H){try{const U=JSON.parse(H.data);switch(U.type){case"connected":V.info("Server connection confirmed"),h(),_();break;case"control_status":c.value={has_control:U.has_control||!1,current_controller_ip:U.current_controller_ip||null,current_controller_connection_id:U.current_controller_connection_id||null},F.value=!1,U.has_control&&(k.value=!1,M&&(clearTimeout(M),M=null));break;case"control_denied":V.warn("Control denied:",U.message),k.value=!1,M&&(clearTimeout(M),M=null),N(U.message||e.control.noPermission);break;case"server_shutdown":d.value=e.connection.serverShuttingDown;break;default:V.info("Unknown message type:",U.type)}}catch(U){V.error("Error parsing WebSocket message:",U)}}function D(H=!1){var U;if(((U=i.value)==null?void 0:U.readyState)!==WebSocket.OPEN){H||(v.value=!0,d.value="");try{i.value=new WebSocket(I.value),i.value.onopen=()=>{v.value=!1,p.value=!0,k.value=!0,x=0,M&&clearTimeout(M),M=window.setTimeout(()=>{k.value=!1},3e3)},i.value.onmessage=L,i.value.onclose=G=>{p.value=!1,v.value=!1,F.value=!0,k.value=!1,P(),G.code!==1e3&&R()},i.value.onerror=()=>{v.value=!1,P(),R()}}catch(G){V.error("Failed to create WebSocket:",G),v.value=!1,d.value=e.connection.cannotCreateConnection}}}function R(){if(C&&(clearTimeout(C),C=null),x>=m.length){d.value=e.connection.tooManyRetries;return}C=window.setTimeout(()=>{C=null,x++,V.info(`Attempting to reconnect (${x}/${m.length})`),D(!0)},m[x])}function w(){x=0,d.value="",D()}let W=null;function z(){C&&(clearTimeout(C),C=null),b&&(clearTimeout(b),b=null),M&&(clearTimeout(M),M=null),P(),i.value&&(i.value.close(1e3,"Component unmounted"),i.value=null),W&&(W.disconnect(),W=null),window.removeEventListener("resize",E)}return g.onMounted(async()=>{var H;E(),D(),await g.nextTick(),(H=l.value)!=null&&H.parentElement&&(W=new ResizeObserver(()=>{E()}),W.observe(l.value.parentElement)),window.addEventListener("resize",E)}),g.onUnmounted(()=>{z()}),(H,U)=>{var G;return g.openBlock(),g.createElementBlock("div",{ref_key:"webControlRef",ref:l,class:"web-control",style:g.normalizeStyle(f.value)},[g.createElementVNode("div",ft,[g.createElementVNode("div",dt,[g.createElementVNode("div",{ref_key:"displayHostRef",ref:u,tabindex:"0",class:g.normalizeClass(["display-host",{"has-control":(G=c.value)==null?void 0:G.has_control,"no-control":c.value&&!c.value.has_control}]),style:g.normalizeStyle(s.value),onClick:o},null,6),g.createVNode(Se,{"is-connecting":v.value,"connection-error":d.value,onRetry:w},null,8,["is-connecting","connection-error"]),p.value&&!F.value&&!k.value&&c.value&&!c.value.has_control&&!T.value?(g.openBlock(),g.createElementBlock("div",vt,[g.createElementVNode("button",{class:"request-control-btn",onClick:_},g.toDisplayString(g.unref(e).control.requestControl),1)])):g.createCommentVNode("",!0),T.value?(g.openBlock(),g.createElementBlock("div",ht,[U[0]||(U[0]=g.createElementVNode("div",{class:"control-denied-icon"},"🚫",-1)),g.createElementVNode("div",pt,g.toDisplayString(T.value),1)])):g.createCommentVNode("",!0)],512)],512)],4)}}}),yt=ve._export_sfc(gt,[["__scopeId","data-v-3c38015d"]]),mt=100,De=5,Ft=400,wt=g.defineComponent({__name:"WebControlForRIGOLQT",props:{wsUrl:{default:void 0},canvasWidth:{default:1024},canvasHeight:{default:600}},setup(r){const e=Fe(),t=r,l=g.ref(),u=g.ref(),i=g.ref(),v=g.ref(null),p=g.ref(!1),d=g.ref(!1),c=g.ref(""),F=g.ref(null),k=g.ref({}),T=g.ref({}),b=g.ref(""),M=g.ref(0),O=g.ref(0),A=g.ref(0),S=g.ref(null),y=g.ref(!1),s=g.ref(!1),f=g.ref(0),m={LEFT_DOWN:0,LEFT_UP:1,MOUSE_MOVE:2},x=g.computed(()=>{if(!t.wsUrl)return V.error("[WebControlRIGOLQT] wsUrl is required but not provided"),"";try{const U=new URL(t.wsUrl);return`${U.protocol==="wss:"?"https:":"http:"}//${U.hostname}`}catch(U){return V.error("[WebControlRIGOLQT] Failed to parse wsUrl:",t.wsUrl,U),""}}),C=()=>{if(!l.value||!i.value)return;const U=l.value.parentElement;if(!U)return;const G=U.getBoundingClientRect(),Q=window.getComputedStyle(U),j=parseFloat(Q.paddingLeft)||0,Z=parseFloat(Q.paddingRight)||0,te=parseFloat(Q.paddingTop)||0,ee=parseFloat(Q.paddingBottom)||0,ne=G.width-j-Z,ie=G.height-te-ee;if(ne===0||ie===0)return;const ce=ne/t.canvasWidth,ge=ie/t.canvasHeight,se=Math.min(ce,ge),K=t.canvasWidth*se,X=t.canvasHeight*se;k.value={width:`${ne}px`,height:`${ie}px`},T.value={width:`${K}px`,height:`${X}px`}},I=()=>{var U;if(((U=v.value)==null?void 0:U.readyState)!==WebSocket.OPEN){p.value=!0,c.value="";try{if(!t.wsUrl){V.error("[WebControlRIGOLQT] wsUrl prop is required"),c.value=e.connection.wsUrlNotConfigured,p.value=!1;return}V.info(`[WebControlRIGOLQT] Connecting to ${t.wsUrl}`),v.value=new WebSocket(t.wsUrl+"/tcp_proxy"),v.value.onopen=()=>{V.info("[WebControlRIGOLQT] WebSocket connected"),p.value=!1,d.value=!0,h(),a()},v.value.onmessage=G=>{E(G)},v.value.onclose=G=>{V.info("[WebControlRIGOLQT] WebSocket closed:",G.code,G.reason),d.value=!1,p.value=!1,o()},v.value.onerror=G=>{V.error("[WebControlRIGOLQT] WebSocket error:",G),p.value=!1,c.value=e.connection.connectionError,o()}}catch(G){V.error("[WebControlRIGOLQT] Failed to create WebSocket:",G),p.value=!1,c.value=e.connection.cannotCreateConnection}}},E=U=>{const G=U.data;A.value=0,G.indexOf("/img")===0?(b.value=x.value+G,M.value=0,O.value=0,_()):G.indexOf("ready")===0?N():G.indexOf("snaping")===0?_():(V.info("[WebControlRIGOLQT] Response:",G),h())},P=()=>{c.value="",I()},a=()=>{S.value||(S.value=window.setInterval(()=>{A.value++,A.value>=3&&A.value<10?h():A.value>=10&&(V.info("[WebControlRIGOLQT] Watchdog timeout, reconnecting..."),v.value&&(v.value.close(),v.value=null),A.value=0,I())},Ft))},o=()=>{S.value&&(clearInterval(S.value),S.value=null)},h=()=>{!v.value||v.value.readyState!==WebSocket.OPEN||(v.value.send(`:DISP:PULL? SNAP
2
+ `),M.value=0)},_=()=>{!v.value||v.value.readyState!==WebSocket.OPEN||(M.value++,M.value>=mt?h():v.value.send(`:DISP:ready?
3
+ `))},N=()=>{if(!i.value||!F.value||!b.value){V.warn("[WebControlRIGOLQT] Canvas or URL not ready"),setTimeout(()=>_(),80);return}const U=new Image;U.onload=()=>{O.value=0,F.value&&i.value&&(F.value.clearRect(0,0,i.value.width,i.value.height),F.value.drawImage(U,0,0,t.canvasWidth,t.canvasHeight)),setTimeout(()=>{h()},80)},U.onerror=G=>{O.value++,V.error(`[WebControlRIGOLQT] Failed to load image (${O.value}/${De}):`,b.value,G),O.value>=De?(V.warn("[WebControlRIGOLQT] Too many image load errors, fetching new image"),O.value=0,h()):setTimeout(()=>_(),100)},U.src=b.value},L=(U,G,Q)=>{if(!v.value||v.value.readyState!==WebSocket.OPEN)return;const j=`:syst:touch ${U},${G},${Q}
4
+ `;v.value.send(j)},D=(U,G)=>{if(!i.value)return{x:0,y:0};const Q=i.value.getBoundingClientRect(),j=t.canvasWidth/Q.width,Z=t.canvasHeight/Q.height;return{x:Math.round(U*j),y:Math.round(G*Z)}},R=U=>{if(!i.value||!d.value||U.button!==0)return;y.value=!0,s.value=!1,f.value=0;const G=i.value.getBoundingClientRect(),Q=U.clientX-G.left,j=U.clientY-G.top,Z=D(Q,j);L(m.LEFT_DOWN,Z.x,Z.y)},w=U=>{if(!i.value||!d.value||!y.value)return;const G=i.value.getBoundingClientRect(),Q=U.clientX-G.left,j=U.clientY-G.top;if(s.value||(s.value=!0),s.value&&f.value===0){const Z=D(Q,j);L(m.MOUSE_MOVE,Z.x,Z.y),f.value=1}},W=U=>{if(!i.value||!d.value||!y.value)return;y.value=!1;const G=i.value.getBoundingClientRect(),Q=U.clientX-G.left,j=U.clientY-G.top,Z=D(Q,j);f.value===1&&L(m.LEFT_DOWN,Z.x,Z.y),L(m.LEFT_UP,Z.x,Z.y),f.value=0,s.value=!1},z=()=>{y.value&&d.value&&i.value&&(y.value=!1,s.value=!1,f.value=0)};let H=null;return g.onMounted(async()=>{var U;await g.nextTick(),i.value&&(i.value.width=t.canvasWidth,i.value.height=t.canvasHeight,F.value=i.value.getContext("2d"),F.value&&(F.value.fillStyle="#000000",F.value.fillRect(0,0,t.canvasWidth,t.canvasHeight))),C(),(U=l.value)!=null&&U.parentElement&&(H=new ResizeObserver(()=>{C()}),H.observe(l.value.parentElement)),window.addEventListener("resize",C),I()}),g.onUnmounted(()=>{window.removeEventListener("resize",C),H&&(H.disconnect(),H=null),o(),v.value&&(v.value.close(1e3),v.value=null)}),(U,G)=>(g.openBlock(),g.createElementBlock("div",{ref_key:"webControlRef",ref:l,class:"web-control-rigol-qt",style:g.normalizeStyle(k.value)},[g.createElementVNode("div",{ref_key:"screenContainerRef",ref:u,class:"screen-container"},[g.createElementVNode("canvas",{id:"rigol-qt-canvas",ref_key:"canvasRef",ref:i,class:"screen-canvas",style:g.normalizeStyle(T.value),onMousedown:R,onMouseup:W,onMousemove:w,onMouseleave:z},null,36),g.createVNode(Se,{"is-connecting":p.value,"connection-error":c.value,onRetry:P},null,8,["is-connecting","connection-error"])],512)],4))}}),St=ve._export_sfc(wt,[["__scopeId","data-v-eb09f730"]]),xt={class:"r-web-control"},Et=g.defineComponent({name:"RWebControl",__name:"RWebControl",props:{version:{},connectionUrl:{default:""},screenWidth:{default:void 0},screenHeight:{default:void 0}},setup(r){const e=g.inject(ve.configProviderInjectKey,null),t=g.computed(()=>{const u=e?g.unref(e):void 0;return He(u)}),l=g.computed(()=>Be(t.value));return g.provide(Ue,{get locale(){return l.value}}),(u,i)=>(g.openBlock(),g.createElementBlock("div",xt,[r.version===g.unref(pe).RIGOL_OS?(g.openBlock(),g.createBlock(yt,{key:0,"ws-url":r.connectionUrl,"screen-width":r.screenWidth,"screen-height":r.screenHeight},null,8,["ws-url","screen-width","screen-height"])):r.version===g.unref(pe).ANDROID?(g.openBlock(),g.createBlock(Ze,{key:1,"base-url":r.connectionUrl,"device-screen-width":r.screenWidth,"device-screen-height":r.screenHeight},null,8,["base-url","device-screen-width","device-screen-height"])):r.version===g.unref(pe).RAW_H5||r.version===g.unref(pe).URL?(g.openBlock(),g.createBlock(nt,{key:2,src:r.connectionUrl},null,8,["src"])):r.version===g.unref(pe).TINA_LINUX?(g.openBlock(),g.createBlock(ct,{key:3,"ws-url":r.connectionUrl,"canvas-width":r.screenWidth,"canvas-height":r.screenHeight},null,8,["ws-url","canvas-width","canvas-height"])):r.version===g.unref(pe).RIGOL_QT?(g.openBlock(),g.createBlock(St,{key:4,"ws-url":r.connectionUrl,"canvas-width":r.screenWidth,"canvas-height":r.screenHeight},null,8,["ws-url","canvas-width","canvas-height"])):g.createCommentVNode("",!0)]))}}),Ct=ve._export_sfc(Et,[["__scopeId","data-v-f9c1f0d9"]]),Tt=ve.withInstall(Ct,"RWebControl");exports.RWebControl=Tt;exports.WebControlVersion=pe;exports.parseControlPanelResolution=Ge;exports.resolveWebControlLocaleFromGlobal=Be;