Started work on server side Intel AMT redirection transport module.

Ylian Saint-Hilaire committed Apr 23, 2019 at 19:17 UTC 010095e2b60c18d347cd9cd02523bb0afd54f98a
6 files changed +1860 -479
MeshCentralServer.njsproj
+3
@@ -91,6 +91,9 @@
91 <Compile Include="agents\recoverycore.js" />
92 <Compile Include="agents\testsuite.js" />
93 <Compile Include="agents\tinycore.js" />
94 + <Compile Include="amt-ider-module.js" />
95 + <Compile Include="amt-ider.js" />
96 + <Compile Include="amt-redir-mesh.js" />
97 <Compile Include="amtevents.js" />
98 <Compile Include="amtscanner.js" />
99 <Compile Include="amtscript.js" />
amt-ider-module.js new
+690
@@ -0,0 +1,690 @@
1 +/**
2 +* @description IDER Handling Module
3 +* @author Ylian Saint-Hilaire
4 +* @version v0.0.2
5 +*/
6 +
7 +// Construct a Intel AMT IDER object
8 +module.exports.CreateAmtRemoteIder = function () {
9 + var obj = {};
10 + obj.debug = false;
11 + obj.protocol = 3; // IDER
12 + obj.bytesToAmt = 0;
13 + obj.bytesFromAmt = 0;
14 + obj.rx_timeout = 30000; // Default 30000
15 + obj.tx_timeout = 0; // Default 0
16 + obj.heartbeat = 20000; // Default 20000
17 + obj.version = 1;
18 + obj.acc = "";
19 + obj.inSequence = 0;
20 + obj.outSequence = 0;
21 + obj.iderinfo = null;
22 + obj.enabled = false;
23 + obj.iderStart = 0; // OnReboot = 0, Graceful = 1, Now = 2
24 + obj.floppy = null;
25 + obj.cdrom = null;
26 + obj.floppyReady = false;
27 + obj.cdromReady = false;
28 + //obj.pingTimer = null;
29 + // ###BEGIN###{IDERStats}
30 + obj.sectorStats = null;
31 + // ###END###{IDERStats}
32 +
33 + // Private method
34 + // ###BEGIN###{IDERDebug}
35 + function debug() { if (obj.debug) { console.log(...arguments); } }
36 + // ###END###{IDERDebug}
37 +
38 + // Mode Sense
39 + var IDE_ModeSence_LS120Disk_Page_Array = String.fromCharCode(0x00, 0x26, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00);
40 + var IDE_ModeSence_3F_LS120_Array = String.fromCharCode(0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31);
41 + var IDE_ModeSence_FloppyDisk_Page_Array = String.fromCharCode(0x00, 0x26, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x04, 0xB0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00);
42 + var IDE_ModeSence_3F_Floppy_Array = String.fromCharCode(0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1e, 0x04, 0xb0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xd0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31);
43 + var IDE_ModeSence_CD_1A_Array = String.fromCharCode(0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
44 + //var IDE_ModeSence_CD_1B_Array = String.fromCharCode(0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
45 + var IDE_ModeSence_CD_1D_Array = String.fromCharCode(0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
46 + var IDE_ModeSence_CD_2A_Array = String.fromCharCode(0x00, 0x20, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
47 + //var IDE_ModeSence_CD_01_Array = String.fromCharCode(0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
48 + var IDE_ModeSence_3F_CD_Array = String.fromCharCode(0x00, 0x28, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
49 +
50 + // 0x46 constant data
51 + var IDE_CD_ConfigArrayHeader = String.fromCharCode(0x00, 0x00,0x00, 0x28, 0x00, 0x00, 0x00, 0x08);
52 + var IDE_CD_ConfigArrayProfileList = String.fromCharCode(0x00, 0x00, 0x03, 0x04, 0x00, 0x08, 0x01, 0x00);
53 + var IDE_CD_ConfigArrayCore = String.fromCharCode(0x00, 0x01, 0x03, 0x04, 0x00, 0x00, 0x00, 0x02);
54 + var IDE_CD_Morphing = String.fromCharCode(0x00, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00);
55 + var IDE_CD_ConfigArrayRemovable = String.fromCharCode(0x00, 0x03, 0x03, 0x04, 0x29, 0x00, 0x00, 0x02);
56 + var IDE_CD_ConfigArrayRandom = String.fromCharCode(0x00, 0x10, 0x01, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00);
57 + var IDE_CD_Read = String.fromCharCode(0x00, 0x1E, 0x03, 0x00);
58 + var IDE_CD_PowerManagement = String.fromCharCode(0x01, 0x00, 0x03, 0x00);
59 + var IDE_CD_Timeout = String.fromCharCode(0x01, 0x05, 0x03, 0x00);
60 +
61 + // 0x01 constant data
62 + var IDE_ModeSence_FloppyError_Recovery_Array = String.fromCharCode(0x00, 0x12, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00);
63 + var IDE_ModeSence_Ls120Error_Recovery_Array = String.fromCharCode(0x00, 0x12, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00);
64 + var IDE_ModeSence_CDError_Recovery_Array = String.fromCharCode(0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00);
65 +
66 +
67 + // Private method, called by parent when it change state
68 + obj.xxStateChange = function (newstate) {
69 + // ###BEGIN###{IDERDebug}
70 + debug("IDER-StateChange", newstate);
71 + // ###END###{IDERDebug}
72 + if (newstate == 0) { obj.Stop(); }
73 + if (newstate == 3) { obj.Start(); }
74 + }
75 +
76 + obj.Start = function () {
77 + // ###BEGIN###{IDERDebug}
78 + debug("IDER-Start");
79 + debug(obj.floppy, obj.cdrom);
80 + // ###END###{IDERDebug}
81 + obj.bytesToAmt = 0;
82 + obj.bytesFromAmt = 0;
83 + obj.inSequence = 0;
84 + obj.outSequence = 0;
85 +
86 + // Send first command, OPEN_SESSION
87 + obj.SendCommand(0x40, ShortToStrX(obj.rx_timeout) + ShortToStrX(obj.tx_timeout) + ShortToStrX(obj.heartbeat) + IntToStrX(obj.version));
88 +
89 + // Send sector stats
90 + // ###BEGIN###{IDERStats}
91 + if (obj.sectorStats) {
92 + obj.sectorStats(0, 0, obj.floppy?(obj.floppy.size >> 9):0);
93 + obj.sectorStats(0, 1, obj.cdrom ? (obj.cdrom.size >> 11) : 0);
94 + }
95 + // ###END###{IDERStats}
96 +
97 + // Setup the ping timer
98 + //obj.pingTimer = setInterval(function () { obj.SendCommand(0x44); }, 5000);
99 + }
100 +
101 + obj.Stop = function () {
102 + // ###BEGIN###{IDERDebug}
103 + debug("IDER-Stop");
104 + // ###END###{IDERDebug}
105 + //if (obj.pingTimer) { clearInterval(obj.pingTimer); obj.pingTimer = null; }
106 + obj.parent.Stop();
107 + }
108 +
109 + // Private method
110 + obj.ProcessData = function (data) {
111 + obj.bytesFromAmt += data.length;
112 + obj.acc += data;
113 + // ###BEGIN###{IDERDebug}
114 + debug('IDER-ProcessData', obj.acc.length, rstr2hex(obj.acc));
115 + // ###END###{IDERDebug}
116 +
117 + // Process as many commands as possible
118 + while (true) {
119 + var len = obj.ProcessDataEx();
120 + if (len == 0) return;
121 + if (obj.inSequence != ReadIntX(obj.acc, 4)) {
122 + // ###BEGIN###{IDERDebug}
123 + debug('ERROR: Out of sequence', obj.inSequence, ReadIntX(obj.acc, 4));
124 + // ###END###{IDERDebug}
125 + obj.Stop();
126 + return;
127 + }
128 + obj.inSequence++;
129 + obj.acc = obj.acc.substring(len);
130 + }
131 + }
132 +
133 + // Private method
134 + obj.SendCommand = function (cmdid, data, completed, dma) {
135 + if (data == null) { data = ''; }
136 + var attributes = ((cmdid > 50) && (completed == true)) ? 2 : 0;
137 + if (dma) { attributes += 1; }
138 + var x = String.fromCharCode(cmdid, 0, 0, attributes) + IntToStrX(obj.outSequence++) + data;
139 + obj.parent.xxSend(x);
140 + obj.bytesToAmt += x.length;
141 + // ###BEGIN###{IDERDebug}
142 + if (cmdid != 0x4B) { debug('IDER-SendData', x.length, rstr2hex(x)); }
143 + // ###END###{IDERDebug}
144 + }
145 +
146 + // CommandEndResponse (SCSI_SENSE)
147 + obj.SendCommandEndResponse = function (error, sense, device, asc, asq) {
148 + if (error) { obj.SendCommand(0x51, String.fromCharCode(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xc5, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0), true); }
149 + else { obj.SendCommand(0x51, String.fromCharCode(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x87, (sense << 4), 3, 0, 0, 0, device, 0x51, sense, asc, asq), true); }
150 + }
151 +
152 + // DataToHost (SCSI_READ)
153 + obj.SendDataToHost = function (device, completed, data, dma) {
154 + var dmalen = (dma) ? 0 : data.length;
155 + if (completed == true) {
156 + obj.SendCommand(0x54, String.fromCharCode(0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0x85, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0, 0, 0, 0) + data, completed, dma);
157 + } else {
158 + obj.SendCommand(0x54, String.fromCharCode(0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + data, completed, dma);
159 + }
160 + }
161 +
162 + // GetDataFromHost (SCSI_CHUNK)
163 + obj.SendGetDataFromHost = function (device, chunksize) {
164 + obj.SendCommand(0x52, String.fromCharCode(0, (chunksize & 0xff), (chunksize >> 8), 0, 0xb5, 0, 0, 0, (chunksize & 0xff), (chunksize >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), false);
165 + }
166 +
167 + // DisableEnableFeatures (STATUS_DATA)
168 + // If type is REGS_TOGGLE (3), 4 bytes of data must be provided.
169 + obj.SendDisableEnableFeatures = function (type, data) { if (data == null) { data = ''; } obj.SendCommand(0x48, String.fromCharCode(type) + data); }
170 +
171 + // Private method
172 + obj.ProcessDataEx = function () {
173 + if (obj.acc.length < 8) return 0;
174 +
175 + // First 8 bytes are the header
176 + // CommandID + 0x000000 + Sequence Number
177 +
178 + switch(obj.acc.charCodeAt(0)) {
179 + case 0x41: // OPEN_SESSION
180 + if (obj.acc.length < 30) return 0;
181 + var len = obj.acc.charCodeAt(29);
182 + if (obj.acc.length < (30 + len)) return 0;
183 + obj.iderinfo = {};
184 + obj.iderinfo.major = obj.acc.charCodeAt(8);
185 + obj.iderinfo.minor = obj.acc.charCodeAt(9);
186 + obj.iderinfo.fwmajor = obj.acc.charCodeAt(10);
187 + obj.iderinfo.fwminor = obj.acc.charCodeAt(11);
188 + obj.iderinfo.readbfr = ReadShortX(obj.acc, 16);
189 + obj.iderinfo.writebfr = ReadShortX(obj.acc, 18);
190 + obj.iderinfo.proto = obj.acc.charCodeAt(21);
191 + obj.iderinfo.iana = ReadIntX(obj.acc, 25);
192 + // ###BEGIN###{IDERDebug}
193 + debug(obj.iderinfo);
194 + // ###END###{IDERDebug}
195 +
196 + if (obj.iderinfo.proto != 0) {
197 + // ###BEGIN###{IDERDebug}
198 + debug("Unknown proto", obj.iderinfo.proto);
199 + // ###END###{IDERDebug}
200 + obj.Stop();
201 + }
202 + if (obj.iderinfo.readbfr > 8192) {
203 + // ###BEGIN###{IDERDebug}
204 + debug("Illegal read buffer size", obj.iderinfo.readbfr);
205 + // ###END###{IDERDebug}
206 + obj.Stop();
207 + }
208 + if (obj.iderinfo.writebfr > 8192) {
209 + // ###BEGIN###{IDERDebug}
210 + debug("Illegal write buffer size", obj.iderinfo.writebfr);
211 + // ###END###{IDERDebug}
212 + obj.Stop();
213 + }
214 +
215 + if (obj.iderStart == 0) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x08)); } // OnReboot
216 + else if (obj.iderStart == 1) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x10)); } // Graceful
217 + else if (obj.iderStart == 2) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x18)); } // Now
218 + //obj.SendDisableEnableFeatures(1); // GetSupportedFeatures
219 + return 30 + len;
220 + case 0x43: // CLOSE
221 + // ###BEGIN###{IDERDebug}
222 + debug('CLOSE');
223 + // ###END###{IDERDebug}
224 + obj.Stop();
225 + return 8;
226 + case 0x44: // KEEPALIVEPING
227 + obj.SendCommand(0x45); // Send PONG back
228 + return 8;
229 + case 0x45: // KEEPALIVEPONG
230 + // ###BEGIN###{IDERDebug}
231 + debug('PONG');
232 + // ###END###{IDERDebug}
233 + return 8;
234 + case 0x46: // RESETOCCURED
235 + if (obj.acc.length < 9) return 0;
236 + var resetMask = obj.acc.charCodeAt(8);
237 + if (g_media === null) {
238 + // No operations are pending
239 + obj.SendCommand(0x47); // Send ResetOccuredResponse
240 + // ###BEGIN###{IDERDebug}
241 + debug('RESETOCCURED1', resetMask);
242 + // ###END###{IDERDebug}
243 + } else {
244 + // Operations are being done, sent the reset once completed.
245 + g_reset = true;
246 + // ###BEGIN###{IDERDebug}
247 + debug('RESETOCCURED2', resetMask);
248 + // ###END###{IDERDebug}
249 + }
250 + return 9;
251 + case 0x49: // STATUS_DATA - DisableEnableFeaturesReply
252 + if (obj.acc.length < 13) return 0;
253 + var type = obj.acc.charCodeAt(8);
254 + var value = ReadIntX(obj.acc, 9);
255 + // ###BEGIN###{IDERDebug}
256 + debug('STATUS_DATA', type, value);
257 + // ###END###{IDERDebug}
258 + switch (type)
259 + {
260 + case 1: // REGS_AVAIL
261 + if (value & 1) {
262 + if (obj.iderStart == 0) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x08)); } // OnReboot
263 + else if (obj.iderStart == 1) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x10)); } // Graceful
264 + else if (obj.iderStart == 2) { obj.SendDisableEnableFeatures(3, IntToStrX(0x01 + 0x18)); } // Now
265 + }
266 + break;
267 + case 2: // REGS_STATUS
268 + obj.enabled = (value & 2) ? true : false;
269 + // ###BEGIN###{IDERDebug}
270 + debug("IDER Status: " + obj.enabled);
271 + // ###END###{IDERDebug}
272 + break;
273 + case 3: // REGS_TOGGLE
274 + if (value != 1) {
275 + // ###BEGIN###{IDERDebug}
276 + debug("Register toggle failure");
277 + // ###END###{IDERDebug}
278 + } //else { obj.SendDisableEnableFeatures(2); }
279 + break;
280 + }
281 + return 13;
282 + case 0x4A: // ERROR OCCURED
283 + if (obj.acc.length < 11) return 0;
284 + // ###BEGIN###{IDERDebug}
285 + debug('IDER: ABORT', obj.acc.charCodeAt(8));
286 + // ###END###{IDERDebug}
287 + //obj.Stop();
288 + return 11;
289 + case 0x4B: // HEARTBEAT
290 + // ###BEGIN###{IDERDebug}
291 + //debug('HEARTBEAT');
292 + // ###END###{IDERDebug}
293 + return 8;
294 + case 0x50: // COMMAND WRITTEN
295 + if (obj.acc.length < 28) return 0;
296 + var device = (obj.acc.charCodeAt(14) & 0x10) ? 0xB0 : 0xA0;
297 + var deviceFlags = obj.acc.charCodeAt(14);
298 + var cdb = obj.acc.substring(16, 28);
299 + var featureRegister = obj.acc.charCodeAt(9);
300 + // ###BEGIN###{IDERDebug}
301 + debug('SCSI_CMD', device, rstr2hex(cdb), featureRegister, deviceFlags);
302 + // ###END###{IDERDebug}
303 + handleSCSI(device, cdb, featureRegister, deviceFlags);
304 + return 28;
305 + case 0x53: // DATA FROM HOST
306 + if (obj.acc.length < 14) return 0;
307 + var len = ReadShortX(obj.acc, 9);
308 + if (obj.acc.length < (14 + len)) return 0;
309 + // ###BEGIN###{IDERDebug}
310 + debug('SCSI_WRITE, len = ' + (14 + len));
311 + // ###END###{IDERDebug}
312 + obj.SendCommand(0x51, String.fromCharCode(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x70, 0x03, 0x00, 0x00, 0x00, 0xa0, 0x51, 0x07, 0x27, 0x00), true);
313 + return 14 + len;
314 + default:
315 + // ###BEGIN###{IDERDebug}
316 + debug('Unknown IDER command', obj.acc[0]);
317 + // ###END###{IDERDebug}
318 + obj.Stop();
319 + break;
320 + }
321 + return 0;
322 + }
323 +
324 + function handleSCSI(dev, cdb, featureRegister, deviceFlags)
325 + {
326 + var lba;
327 + var len;
328 +
329 + switch(cdb.charCodeAt(0))
330 + {
331 + case 0x00: // TEST_UNIT_READY:
332 + // ###BEGIN###{IDERDebug}
333 + debug("SCSI: TEST_UNIT_READY", dev);
334 + // ###END###{IDERDebug}
335 + switch (dev) {
336 + case 0xA0: // DEV_FLOPPY
337 + if (obj.floppy == null) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; }
338 + if (obj.floppyReady == false) { obj.floppyReady = true; obj.SendCommandEndResponse(1, 0x06, dev, 0x28, 0x00); return -1; } // Switch to ready
339 + break;
340 + case 0xB0: // DEV_CDDVD
341 + if (obj.cdrom == null) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; }
342 + if (obj.cdromReady == false) { obj.cdromReady = true; obj.SendCommandEndResponse(1, 0x06, dev, 0x28, 0x00); return -1; } // Switch to ready
343 + break;
344 + default:
345 + // ###BEGIN###{IDERDebug}
346 + debug("SCSI Internal error 3", dev);
347 + // ###END###{IDERDebug}
348 + return -1;
349 + }
350 + obj.SendCommandEndResponse(1, 0x00, dev, 0x00, 0x00); // Indicate ready
351 + break;
352 + case 0x08: // READ_6
353 + lba = ((cdb.charCodeAt(1) & 0x1f) << 16) + (cdb.charCodeAt(2) << 8) + cdb.charCodeAt(3);
354 + len = cdb.charCodeAt(4);
355 + if (len == 0) { len = 256; }
356 + // ###BEGIN###{IDERDebug}
357 + debug("SCSI: READ_6", dev, lba, len);
358 + // ###END###{IDERDebug}
359 + sendDiskData(dev, lba, len, featureRegister);
360 + break;
361 + case 0x0a: // WRITE_6
362 + lba = ((cdb.charCodeAt(1) & 0x1f) << 16) + (cdb.charCodeAt(2) << 8) + cdb.charCodeAt(3);
363 + len = cdb.charCodeAt(4);
364 + if (len == 0) { len = 256; }
365 + // ###BEGIN###{IDERDebug}
366 + debug("SCSI: WRITE_6", dev, lba, len);
367 + // ###END###{IDERDebug}
368 + obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); // Write is not supported, remote no medium.
369 + return -1;
370 + /*
371 + case 0x15: // MODE_SELECT_6:
372 + // ###BEGIN###{IDERDebug}
373 + debug("SCSI ERROR: MODE_SELECT_6", dev);
374 + // ###END###{IDERDebug}
375 + obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00);
376 + return -1;
377 + */
378 + case 0x1a: // MODE_SENSE_6
379 + // ###BEGIN###{IDERDebug}
380 + debug("SCSI: MODE_SENSE_6", dev);
381 + // ###END###{IDERDebug}
382 + if ((cdb.charCodeAt(2) == 0x3f) && (cdb.charCodeAt(3) == 0x00)) {
383 + var a = 0, b = 0;
384 + switch (dev) {
385 + case 0xA0: // DEV_FLOPPY
386 + if (obj.floppy == null) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; }
387 + a = 0x00;
388 + b = 0x80; // Read only = 0x80, Read write = 0x00
389 + break;
390 + case 0xB0: // DEV_CDDVD
391 + if (obj.cdrom == null) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; }
392 + a = 0x05;
393 + b = 0x80;
394 + break;
395 + default:
396 + // ###BEGIN###{IDERDebug}
397 + debug("SCSI Internal error 6", dev);
398 + // ###END###{IDERDebug}
399 + return -1;
400 + }
401 + obj.SendDataToHost(dev, true, String.fromCharCode(0, a, b, 0), featureRegister & 1);
402 + return;
403 + }
404 + obj.SendCommandEndResponse(1, 0x05, dev, 0x24, 0x00);
405 + break;
406 + case 0x1b: // START_STOP (Called when you eject the CDROM)
407 + //var immediate = cdb.charCodeAt(1) & 0x01;
408 + //var loej = cdb.charCodeAt(4) & 0x02;
409 + //var start = cdb.charCodeAt(4) & 0x01;
410 + obj.SendCommandEndResponse(1, 0, dev);
411 + break;
412 + case 0x1e: // LOCK_UNLOCK - ALLOW_MEDIUM_REMOVAL
413 + // ###BEGIN###{IDERDebug}
414 + debug("SCSI: ALLOW_MEDIUM_REMOVAL", dev);
415 + // ###END###{IDERDebug}
416 + if ((dev == 0xA0) && (obj.floppy == null)) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; }
417 + if ((dev == 0xB0) && (obj.cdrom == null)) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; }
418 + obj.SendCommandEndResponse(1, 0x00, dev, 0x00, 0x00);
419 + break;
420 + case 0x23: // READ_FORMAT_CAPACITIES (Floppy only)
421 + // ###BEGIN###{IDERDebug}
422 + debug("SCSI: READ_FORMAT_CAPACITIES", dev);
423 + // ###END###{IDERDebug}
424 + var buflen = ReadShort(cdb, 7);
425 + var mediaStatus = 0, sectors;
426 + var mcSize = buflen / 8; // Capacity descriptor size is 8
427 +
428 + switch (dev) {
429 + case 0xA0: // DEV_FLOPPY
430 + if ((obj.floppy == null) || (obj.floppy.size == 0)) { obj.SendCommandEndResponse(0, 0x05, dev, 0x24, 0x00); return -1; }
431 + sectors = (obj.floppy.size >> 9) - 1;
432 + break;
433 + case 0xB0: // DEV_CDDVD
434 + if ((obj.cdrom == null) || (obj.cdrom.size == 0)) { obj.SendCommandEndResponse(0, 0x05, dev, 0x24, 0x00); return -1; }
435 + sectors = (obj.cdrom.size >> 11) - 1; // Number 2048 byte blocks
436 + break;
437 + default:
438 + // ###BEGIN###{IDERDebug}
439 + debug("SCSI Internal error 4", dev);
440 + // ###END###{IDERDebug}
441 + return -1;
442 + }
443 +
444 + obj.SendDataToHost(dev, true, IntToStr(8) + String.fromCharCode(0x00, 0x00, 0x0b, 0x40, 0x02, 0x00, 0x02, 0x00), featureRegister & 1);
445 + break;
446 + case 0x25: // READ_CAPACITY
447 + // ###BEGIN###{IDERDebug}
448 + debug("SCSI: READ_CAPACITY", dev);
449 + // ###END###{IDERDebug}
450 + var len = 0;
451 + switch(dev)
452 + {
453 + case 0xA0: // DEV_FLOPPY
454 + if ((obj.floppy == null) || (obj.floppy.size == 0)) { obj.SendCommandEndResponse(0, 0x02, dev, 0x3a, 0x00); return -1; }
455 + if (obj.floppy != null) { len = (obj.floppy.size >> 9) - 1; }
456 + // ###BEGIN###{IDERDebug}
457 + debug('DEV_FLOPPY', len); // Number 512 byte blocks
458 + // ###END###{IDERDebug}
459 + break;
460 + case 0xB0: // DEV_CDDVD
461 + if ((obj.floppy == null) || (obj.floppy.size == 0)) { obj.SendCommandEndResponse(0, 0x02, dev, 0x3a, 0x00); return -1; }
462 + if (obj.cdrom != null) { len = (obj.cdrom.size >> 11) - 1; } // Number 2048 byte blocks
463 + // ###BEGIN###{IDERDebug}
464 + debug('DEV_CDDVD', len);
465 + // ###END###{IDERDebug}
466 + break;
467 + default:
468 + // ###BEGIN###{IDERDebug}
469 + debug("SCSI Internal error 4", dev);
470 + // ###END###{IDERDebug}
471 + return -1;
472 + }
473 + //if (dev == 0xA0) { dev = 0x00; } else { dev = 0x10; } // Weird but seems to work.
474 + // ###BEGIN###{IDERDebug}
475 + debug("SCSI: READ_CAPACITY2", dev, deviceFlags);
476 + // ###END###{IDERDebug}
477 + obj.SendDataToHost(deviceFlags, true, IntToStr(len) + String.fromCharCode(0, 0, ((dev == 0xB0) ? 0x08 : 0x02), 0), featureRegister & 1);
478 + break;
479 + case 0x28: // READ_10
480 + lba = ReadInt(cdb, 2);
481 + len = ReadShort(cdb, 7);
482 + // ###BEGIN###{IDERDebug}
483 + debug("SCSI: READ_10", dev, lba, len);
484 + // ###END###{IDERDebug}
485 + sendDiskData(dev, lba, len, featureRegister);
486 + break;
487 + case 0x2a: // WRITE_10 (Floppy only)
488 + case 0x2e: // WRITE_AND_VERIFY (Floppy only)
489 + lba = ReadInt(cdb, 2);
490 + len = ReadShort(cdb, 7);
491 + // ###BEGIN###{IDERDebug}
492 + debug("SCSI: WRITE_10", dev, lba, len);
493 + // ###END###{IDERDebug}
494 + obj.SendGetDataFromHost(dev, 512 * len); // Floppy writes only, accept sectors of 512 bytes
495 + break;
496 + case 0x43: // READ_TOC (CD Audio only)
497 + var buflen = ReadShort(cdb, 7);
498 + var msf = cdb.charCodeAt(1) & 0x02;
499 + var format = cdb.charCodeAt(2) & 0x07;
500 + if (format == 0) { format = cdb.charCodeAt(9) >> 6; }
501 + // ###BEGIN###{IDERDebug}
502 + debug("SCSI: READ_TOC, dev=" + dev + ", buflen=" + buflen + ", msf=" + msf + ", format=" + format);
503 + // ###END###{IDERDebug}
504 +
505 + switch (dev) {
506 + case 0xA0: // DEV_FLOPPY
507 + obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00); // Not implemented
508 + return -1;
509 + case 0xB0: // DEV_CDDVD
510 + // NOP
511 + break;
512 + default:
513 + // ###BEGIN###{IDERDebug}
514 + debug("SCSI Internal error 9", dev);
515 + // ###END###{IDERDebug}
516 + return -1;
517 + }
518 +
519 + if (format == 1) { obj.SendDataToHost(dev, true, String.fromCharCode(0x00, 0x0a, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00), featureRegister & 1); }
520 + else if (format == 0) {
521 + if (msf) {
522 + obj.SendDataToHost(dev, true, String.fromCharCode(0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x34, 0x13), featureRegister & 1);
523 + } else {
524 + obj.SendDataToHost(dev, true, String.fromCharCode(0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00), featureRegister & 1);
525 + }
526 + }
527 + break;
528 + case 0x46: // GET_CONFIGURATION
529 + var sendall = (cdb.charCodeAt(1) != 2);
530 + var firstcode = ReadShort(cdb, 2);
531 + var buflen = ReadShort(cdb, 7);
532 +
533 + // ###BEGIN###{IDERDebug}
534 + debug("SCSI: GET_CONFIGURATION", dev, sendall, firstcode, buflen);
535 + // ###END###{IDERDebug}
536 +
537 + if (buflen == 0) { obj.SendDataToHost(dev, true, IntToStr(0x003c) + IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct.
538 +
539 + // Set the header
540 + var r = IntToStr(0x0008);
541 +
542 + // Add the data
543 + if (firstcode == 0) { r += IDE_CD_ConfigArrayProfileList; }
544 + if ((firstcode == 0x1) || (sendall && (firstcode < 0x1))) { r += IDE_CD_ConfigArrayCore; }
545 + if ((firstcode == 0x2) || (sendall && (firstcode < 0x2))) { r += IDE_CD_Morphing; }
546 + if ((firstcode == 0x3) || (sendall && (firstcode < 0x3))) { r += IDE_CD_ConfigArrayRemovable; }
547 + if ((firstcode == 0x10) || (sendall && (firstcode < 0x10))) { r += IDE_CD_ConfigArrayRandom; }
548 + if ((firstcode == 0x1E) || (sendall && (firstcode < 0x1E))) { r += IDE_CD_Read; }
549 + if ((firstcode == 0x100) || (sendall && (firstcode < 0x100))) { r += IDE_CD_PowerManagement; }
550 + if ((firstcode == 0x105) || (sendall && (firstcode < 0x105))) { r += IDE_CD_Timeout; }
551 +
552 + // Set the length
553 + r = IntToStr(r.length) + r;
554 +
555 + // Cut the length to buflen if needed
556 + if (r.length > buflen) { r = r.substring(0, buflen); }
557 +
558 + obj.SendDataToHost(dev, true, r, featureRegister & 1);
559 + return -1;
560 + case 0x4a: // GET_EV_STATUS - GET_EVENT_STATUS_NOTIFICATION
561 + //var buflen = (cdb.charCodeAt(7) << 8) + cdb.charCodeAt(8);
562 + //if (buflen == 0) { obj.SendDataToHost(dev, true, IntToStr(0x003c) + IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct.
563 + // ###BEGIN###{IDERDebug}
564 + debug("SCSI: GET_EVENT_STATUS_NOTIFICATION", dev, cdb.charCodeAt(1), cdb.charCodeAt(4), cdb.charCodeAt(9));
565 + // ###END###{IDERDebug}
566 + if ((cdb.charCodeAt(1) != 0x01) && (cdb.charCodeAt(4) != 0x10)) {
567 + // ###BEGIN###{IDERDebug}
568 + debug('SCSI ERROR');
569 + // ###END###{IDERDebug}
570 + obj.SendCommandEndResponse(1, 0x05, dev, 0x26, 0x01);
571 + break;
572 + }
573 + var present = 0x00;
574 + if ((dev == 0xA0) && (obj.floppy != null)) { present = 0x02; }
575 + else if ((dev == 0xB0) && (obj.cdrom != null)) { present = 0x02; }
576 + obj.SendDataToHost(dev, true, String.fromCharCode(0x00, present, 0x80, 0x00), featureRegister & 1); // This is the original version, 4 bytes long
577 + break;
578 + case 0x4c:
579 + obj.SendCommand(0x51, IntToStrX(0) + IntToStrX(0) + IntToStrX(0) + String.fromCharCode(0x87, 0x50, 0x03, 0x00, 0x00, 0x00, 0xb0, 0x51, 0x05, 0x20, 0x00), true);
580 + break;
581 + case 0x51: // READ_DISC_INFO
582 + // ###BEGIN###{IDERDebug}
583 + debug("SCSI READ_DISC_INFO", dev);
584 + // ###END###{IDERDebug}
585 + obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00); // Correct
586 + return -1;
587 + case 0x55: // MODE_SELECT_10:
588 + // ###BEGIN###{IDERDebug}
589 + debug("SCSI ERROR: MODE_SELECT_10", dev);
590 + // ###END###{IDERDebug}
591 + obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00);
592 + return -1;
593 + case 0x5a: // MODE_SENSE_10
594 + // ###BEGIN###{IDERDebug}
595 + debug("SCSI: MODE_SENSE_10", dev, cdb.charCodeAt(2) & 0x3f);
596 + // ###END###{IDERDebug}
597 + var buflen = ReadShort(cdb, 7);
598 + //var pc = cdb.charCodeAt(2) & 0xc0;
599 + var r = null;
600 +
601 + if (buflen == 0) { obj.SendDataToHost(dev, true, IntToStr(0x003c) + IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct.
602 +
603 + // 1.44 mb floppy or LS120 (sectorCount == 0x3c300)
604 + var sectorCount = 0;
605 + if (dev == 0xA0) {
606 + if (obj.floppy != null) { sectorCount = (obj.floppy.size >> 9); }
607 + } else {
608 + if (obj.cdrom != null) { sectorCount = (obj.cdrom.size >> 11); }
609 + }
610 +
611 + switch (cdb.charCodeAt(2) & 0x3f) {
612 + case 0x01: if (dev == 0xA0) { r = (sectorCount <= 0xb40)?IDE_ModeSence_FloppyError_Recovery_Array:IDE_ModeSence_Ls120Error_Recovery_Array; } else { r = IDE_ModeSence_CDError_Recovery_Array; } break;
613 + case 0x05: if (dev == 0xA0) { r = (sectorCount <= 0xb40)?IDE_ModeSence_FloppyDisk_Page_Array:IDE_ModeSence_LS120Disk_Page_Array; } break;
614 + case 0x3f: if (dev == 0xA0) { r = (sectorCount <= 0xb40)?IDE_ModeSence_3F_Floppy_Array:IDE_ModeSence_3F_LS120_Array; } else { r = IDE_ModeSence_3F_CD_Array; } break;
615 + case 0x1A: if (dev == 0xB0) { r = IDE_ModeSence_CD_1A_Array; } break;
616 + case 0x1D: if (dev == 0xB0) { r = IDE_ModeSence_CD_1D_Array; } break;
617 + case 0x2A: if (dev == 0xB0) { r = IDE_ModeSence_CD_2A_Array; } break;
618 + }
619 +
620 + if (r == null) {
621 + obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00); // TODO: Send proper error!!!
622 + } else {
623 + // Set disk to read only (we don't support write).
624 + //ms_data[3] = ms_data[3] | 0x80;
625 + obj.SendDataToHost(dev, true, r, featureRegister & 1);
626 + }
627 + break;
628 + default: // UNKNOWN COMMAND
629 + // ###BEGIN###{IDERDebug}
630 + debug("IDER: Unknown SCSI command", cdb.charCodeAt(0));
631 + // ###END###{IDERDebug}
632 + obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00);
633 + return -1;
634 + }
635 + return 0;
636 + }
637 +
638 + function sendDiskData(dev, lba, len, featureRegister) {
639 + var media = null;
640 + var mediaBlocks = 0;
641 + if (dev == 0xA0) { media = obj.floppy; if (obj.floppy != null) { mediaBlocks = (obj.floppy.size >> 9); } }
642 + if (dev == 0xB0) { media = obj.cdrom; if (obj.cdrom != null) { mediaBlocks = (obj.cdrom.size >> 11); } }
643 + if ((len < 0) || (lba + len > mediaBlocks)) { obj.SendCommandEndResponse(1, 0x05, dev, 0x21, 0x00); return 0; }
644 + if (len == 0) { obj.SendCommandEndResponse(1, 0x00, dev, 0x00, 0x00); return 0; }
645 + if (media != null) {
646 + // Send sector stats
647 + // ###BEGIN###{IDERStats}
648 + if (obj.sectorStats) { obj.sectorStats(1, (dev == 0xA0) ? 0 : 1, mediaBlocks, lba, len); }
649 + // ###END###{IDERStats}
650 + if (dev == 0xA0) { lba <<= 9; len <<= 9; } else { lba <<= 11; len <<= 11; }
651 + if (g_media !== null) {
652 + console.log('IDERERROR: Read while performing read');
653 + obj.Stop();
654 + } else {
655 + // obj.iderinfo.readbfr // TODO: MaxRead
656 + g_media = media;
657 + g_dev = dev;
658 + g_lba = lba;
659 + g_len = len;
660 + sendDiskDataEx(featureRegister);
661 + }
662 + }
663 + }
664 +
665 + var g_reset = false;
666 + var g_media = null;
667 + var g_dev;
668 + var g_lba;
669 + var g_len;
670 + function sendDiskDataEx(featureRegister) {
671 + var len = g_len, lba = g_lba;
672 + if (g_len > obj.iderinfo.readbfr) { len = obj.iderinfo.readbfr; }
673 + g_len -= len;
674 + g_lba += len;
675 + var fr = new FileReader();
676 + fr.onload = function () {
677 + obj.SendDataToHost(g_dev, (g_len == 0), this.result, featureRegister & 1);
678 + if ((g_len > 0) && (g_reset == false)) {
679 + sendDiskDataEx(featureRegister);
680 + } else {
681 + g_media = null;
682 + if (g_reset) { obj.SendCommand(0x47); g_reset = false; } // Send ResetOccuredResponse
683 + }
684 + };
685 + //console.log('Read from ' + lba + ' to ' + (lba + len) + ', total of ' + len);
686 + fr.readAsBinaryString(g_media.slice(lba, lba + len));
687 + }
688 +
689 + return obj;
690 +}
amt-ider.js new
+115
@@ -0,0 +1,115 @@
1 +/**
2 +* @description MeshCentral Server IDER handler
3 +* @author Ylian Saint-Hilaire & Bryan Roe
4 +* @copyright Intel Corporation 2018-2019
5 +* @license Apache-2.0
6 +* @version v0.0.1
7 +*/
8 +
9 +/*jslint node: true */
10 +/*jshint node: true */
11 +/*jshint strict:false */
12 +/*jshint -W097 */
13 +/*jshint esversion: 6 */
14 +"use strict";
15 +
16 +// Construct a MeshAgent object, called upon connection
17 +module.exports.CreateAmtIderSession = function (parent, db, ws, req, args, domain, user) {
18 + const fs = require('fs');
19 + const path = require('path');
20 + const common = parent.common;
21 + const amtMeshRedirModule = require('./amt-redir-mesh.js');
22 + const amtMeshIderModule = require('./amt-ider-module.js');
23 +
24 + console.log('New Server IDER session from ' + user.name);
25 +
26 + var obj = {};
27 + obj.user = user;
28 + obj.domain = domain;
29 + obj.ider = null;
30 +
31 + // Send a message to the user
32 + //obj.send = function (data) { try { if (typeof data == 'string') { ws.send(Buffer.from(data, 'binary')); } else { ws.send(data); } } catch (e) { } }
33 +
34 + // Disconnect this user
35 + obj.close = function (arg) {
36 + if ((arg == 1) || (arg == null)) { try { ws.close(); parent.parent.debug(1, 'Soft disconnect'); } catch (e) { console.log(e); } } // Soft close, close the websocket
37 + if (arg == 2) { try { ws._socket._parent.end(); parent.parent.debug(1, 'Hard disconnect'); } catch (e) { console.log(e); } } // Hard close, close the TCP socket
38 + };
39 +
40 + try {
41 +
42 + // Check if the user is logged in
43 + if (user == null) { try { ws.close(); } catch (e) { } return; }
44 +
45 + // When data is received from the web socket
46 + ws.on('message', processWebSocketData);
47 +
48 + // If error, do nothing
49 + ws.on('error', function (err) { console.log(err); obj.close(0); });
50 +
51 + // If the web socket is closed
52 + ws.on('close', function (req) { obj.close(0); });
53 +
54 + // We are all set, start receiving data
55 + ws._socket.resume();
56 +
57 + } catch (e) { console.log(e); }
58 +
59 + // Process incoming web socket data from the browser
60 + function processWebSocketData(msg) {
61 + var command, i = 0, mesh = null, meshid = null, nodeid = null, meshlinks = null, change = 0;
62 + try { command = JSON.parse(msg.toString('utf8')); } catch (e) { return; }
63 + if (common.validateString(command.action, 3, 32) == false) return; // Action must be a string between 3 and 32 chars
64 +
65 + switch (command.action) {
66 + case 'ping': { try { ws.send(JSON.stringify({ action: 'pong' })); } catch (ex) { } break; }
67 + case 'selector': {
68 + var r = { action: 'selector', args: { html: 'Click ok to start IDER session.' }, buttons: 3 };
69 + // TODO: Return a list of disk images for the user to select.
70 + try { ws.send(JSON.stringify(r)); } catch (ex) { }
71 + break;
72 + }
73 + case 'selectorResponse': {
74 + console.log('selectorResponse', command.args, req.query);
75 +
76 + // TODO: Start IDER Session
77 + // req.query = { host: 'node//KV6AZh3KoEzr71IaM40KqpBXQCn0qysZrMYlCOcvivNkV2$zfP2MXBE4IizBn1Bw', port: '16994', tls: '0', serverauth: '1', tls1only: '1' }
78 +
79 + command.args = {
80 + floppyPath: '',
81 + cdromPath: '',
82 + iderStart: 1,
83 + tlsv1only: true
84 + };
85 +
86 + obj.ider = amtMeshRedirModule.CreateAmtRedirect(amtMeshIderModule.CreateAmtRemoteIder(), domain, user, parent, parent.parent);
87 + obj.ider.onStateChanged = onIderStateChange;
88 + obj.ider.m.debug = true;
89 + obj.ider.m.floppy = command.args.floppyPath;
90 + obj.ider.m.cdrom = command.args.cdromPath;
91 + obj.ider.m.iderStart = command.args.iderStart;
92 + obj.ider.m.sectorStats = iderSectorStats;
93 + obj.ider.tlsv1only = req.query.tlsv1only;
94 + obj.ider.Start(req.query.host, req.query.port, req.query.tls);
95 +
96 + break;
97 + }
98 + default: {
99 + // Unknown user action
100 + console.log('Unknown IDER action from user ' + user.name + ': ' + command.action + '.');
101 + break;
102 + }
103 + }
104 + }
105 +
106 + function onIderStateChange(sender, state) {
107 + console.log('onIderStateChange', state);
108 + }
109 +
110 + function iderSectorStats(mode, dev, total, start, len) {
111 + console.log('iderSectorStats', mode, dev, total, start, len);
112 + }
113 +
114 + return obj;
115 +};
\ No newline at end of file
amt-redir-mesh.js new
+567
@@ -0,0 +1,567 @@
1 +/**
2 +* @description Intel AMT Redirection Transport Module - using Node
3 +* @author Ylian Saint-Hilaire
4 +* @version v0.0.1f
5 +*/
6 +
7 +// Construct a MeshServer object
8 +module.exports.CreateAmtRedirect = function (module, domain, user, webserver, meshcentral) {
9 + var obj = {};
10 + obj.m = module; // This is the inner module (Terminal or Desktop)
11 + module.parent = obj;
12 + obj.State = 0;
13 + obj.net = require('net');
14 + obj.tls = require('tls');
15 + obj.crypto = require('crypto');
16 + obj.constants = require('constants');
17 + obj.socket = null;
18 + obj.host = null;
19 + obj.port = 0;
20 + obj.amtuser = null;
21 + obj.amtpass = null;
22 + obj.connectstate = 0;
23 + obj.protocol = module.protocol; // 1 = SOL, 2 = KVM, 3 = IDER
24 + obj.xtlsoptions = null;
25 + obj.redirTrace = true;
26 +
27 + obj.amtaccumulator = "";
28 + obj.amtsequence = 1;
29 + obj.amtkeepalivetimer = null;
30 + obj.authuri = "/RedirectionService";
31 +
32 + obj.onStateChanged = null;
33 + obj.forwardclient = null;
34 +
35 + // Mesh Rights
36 + const MESHRIGHT_EDITMESH = 1;
37 + const MESHRIGHT_MANAGEUSERS = 2;
38 + const MESHRIGHT_MANAGECOMPUTERS = 4;
39 + const MESHRIGHT_REMOTECONTROL = 8;
40 + const MESHRIGHT_AGENTCONSOLE = 16;
41 + const MESHRIGHT_SERVERFILES = 32;
42 + const MESHRIGHT_WAKEDEVICE = 64;
43 + const MESHRIGHT_SETNOTES = 128;
44 +
45 + // Site rights
46 + const SITERIGHT_SERVERBACKUP = 1;
47 + const SITERIGHT_MANAGEUSERS = 2;
48 + const SITERIGHT_SERVERRESTORE = 4;
49 + const SITERIGHT_FILEACCESS = 8;
50 + const SITERIGHT_SERVERUPDATE = 16;
51 + const SITERIGHT_LOCKED = 32;
52 +
53 + function Debug(lvl) {
54 + //if ((arguments.length < 2) && (lvl > meshcentral.debugLevel)) return;
55 + var a = []; for (var i = 1; i < arguments.length; i++) { a.push(arguments[i]); } console.log(...a);
56 + }
57 +
58 + obj.Start = function (host, port, tls, tlsFingerprint, tlsoptions) {
59 + console.log('Amt-Redir-Start', host, port, tls, tlsFingerprint, tlsoptions);
60 +
61 + obj.host = host;
62 + obj.port = port;
63 + obj.xtls = tls;
64 + obj.xtlsoptions = tlsoptions;
65 + obj.xtlsFingerprint = tlsFingerprint;
66 + obj.connectstate = 0;
67 +
68 + Debug(1, 'AMT redir for ' + user.name + ' to ' + host + '.');
69 +
70 + obj.xxStateChange(1);
71 +
72 + // Fetch information about the target
73 + meshcentral.db.Get(host, function (err, docs) {
74 + if (docs.length == 0) { console.log('ERR: Node not found'); obj.xxStateChange(0); return; }
75 + var node = docs[0];
76 + if (!node.intelamt) { console.log('ERR: Not AMT node'); obj.xxStateChange(0); return; }
77 +
78 + obj.amtuser = node.intelamt.user;
79 + obj.amtpass = node.intelamt.pass;
80 + console.log('amtuser', obj.amtuser, obj.amtpass);
81 +
82 + // Check if this user has permission to manage this computer
83 + var meshlinks = user.links[node.meshid];
84 + if ((!meshlinks) || (!meshlinks.rights) || ((meshlinks.rights & MESHRIGHT_REMOTECONTROL) == 0)) { console.log('ERR: Access denied (2)'); obj.xxStateChange(0); return; }
85 +
86 + // Check what connectivity is available for this node
87 + var state = meshcentral.GetConnectivityState(host);
88 + var conn = 0;
89 + if (!state || state.connectivity == 0) { Debug(1, 'ERR: No routing possible (1)'); obj.xxStateChange(0); return; } else { conn = state.connectivity; }
90 +
91 + /*
92 + // Check what server needs to handle this connection
93 + if ((meshcentral.multiServer != null) && (cookie == null)) { // If a cookie is provided, don't allow the connection to jump again to a different server
94 + var server = obj.parent.GetRoutingServerId(req.query.host, 2); // Check for Intel CIRA connection
95 + if (server != null) {
96 + if (server.serverid != obj.parent.serverId) {
97 + // Do local Intel CIRA routing using a different server
98 + Debug(1, 'Route Intel AMT CIRA connection to peer server: ' + server.serverid);
99 + obj.parent.multiServer.createPeerRelay(ws, req, server.serverid, user);
100 + return;
101 + }
102 + } else {
103 + server = obj.parent.GetRoutingServerId(req.query.host, 4); // Check for local Intel AMT connection
104 + if ((server != null) && (server.serverid != obj.parent.serverId)) {
105 + // Do local Intel AMT routing using a different server
106 + Debug(1, 'Route Intel AMT direct connection to peer server: ' + server.serverid);
107 + obj.parent.multiServer.createPeerRelay(ws, req, server.serverid, user);
108 + return;
109 + }
110 + }
111 + }
112 + */
113 +
114 + // If Intel AMT CIRA connection is available, use it
115 + if (((conn & 2) != 0) && (meshcentral.mpsserver.ciraConnections[host] != null)) {
116 + Debug(1, 'Opening Intel AMT CIRA transport connection to ' + host + '.');
117 +
118 + var ciraconn = meshcentral.mpsserver.ciraConnections[host];
119 +
120 + /*
121 + // Compute target port, look at the CIRA port mappings, if non-TLS is allowed, use that, if not use TLS
122 + var port = 16993;
123 + //if (node.intelamt.tls == 0) port = 16992; // DEBUG: Allow TLS flag to set TLS mode within CIRA
124 + if (ciraconn.tag.boundPorts.indexOf(16992) >= 0) port = 16992; // RELEASE: Always use non-TLS mode if available within CIRA
125 + if (req.query.p == 2) port += 2;
126 +
127 + // Setup a new CIRA channel
128 + if ((port == 16993) || (port == 16995)) {
129 + // Perform TLS - ( TODO: THIS IS BROKEN on Intel AMT v7 but works on v10, Not sure why. Well, could be broken TLS 1.0 in firmware )
130 + var ser = new SerialTunnel();
131 + var chnl = parent.mpsserver.SetupCiraChannel(ciraconn, port);
132 +
133 + // let's chain up the TLSSocket <-> SerialTunnel <-> CIRA APF (chnl)
134 + // Anything that needs to be forwarded by SerialTunnel will be encapsulated by chnl write
135 + ser.forwardwrite = function (msg) {
136 + // TLS ---> CIRA
137 + chnl.write(msg.toString('binary'));
138 + };
139 +
140 + // When APF tunnel return something, update SerialTunnel buffer
141 + chnl.onData = function (ciraconn, data) {
142 + // CIRA ---> TLS
143 + Debug(3, 'Relay TLS CIRA data', data.length);
144 + if (data.length > 0) { try { ser.updateBuffer(Buffer.from(data, 'binary')); } catch (e) { } }
145 + };
146 +
147 + // Handle CIRA tunnel state change
148 + chnl.onStateChange = function (ciraconn, state) {
149 + Debug(2, 'Relay TLS CIRA state change', state);
150 + if (state == 0) { try { ws.close(); } catch (e) { } }
151 + };
152 +
153 + // TLSSocket to encapsulate TLS communication, which then tunneled via SerialTunnel an then wrapped through CIRA APF
154 + const TLSSocket = require('tls').TLSSocket;
155 + const tlsoptions = { secureProtocol: ((req.query.tls1only == 1) ? 'TLSv1_method' : 'SSLv23_method'), ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false };
156 + const tlsock = new TLSSocket(ser, tlsoptions);
157 + tlsock.on('error', function (err) { Debug(1, "CIRA TLS Connection Error ", err); });
158 + tlsock.on('secureConnect', function () { Debug(2, "CIRA Secure TLS Connection"); ws._socket.resume(); });
159 +
160 + // Decrypted tunnel from TLS communcation to be forwarded to websocket
161 + tlsock.on('data', function (data) {
162 + // AMT/TLS ---> WS
163 + try {
164 + data = data.toString('binary');
165 + if (ws.interceptor) { data = ws.interceptor.processAmtData(data); } // Run data thru interceptor
166 + //ws.send(Buffer.from(data, 'binary'));
167 + ws.send(data);
168 + } catch (e) { }
169 + });
170 +
171 + // If TLS is on, forward it through TLSSocket
172 + ws.forwardclient = tlsock;
173 + ws.forwardclient.xtls = 1;
174 + } else {
175 + // Without TLS
176 + ws.forwardclient = parent.mpsserver.SetupCiraChannel(ciraconn, port);
177 + ws.forwardclient.xtls = 0;
178 + ws._socket.resume();
179 + }
180 +
181 + // When data is received from the web socket, forward the data into the associated CIRA cahnnel.
182 + // If the CIRA connection is pending, the CIRA channel has built-in buffering, so we are ok sending anyway.
183 + ws.on('message', function (msg) {
184 + // WS ---> AMT/TLS
185 + msg = msg.toString('binary');
186 + if (ws.interceptor) { msg = ws.interceptor.processBrowserData(msg); } // Run data thru interceptor
187 + if (ws.forwardclient.xtls == 1) { ws.forwardclient.write(Buffer.from(msg, 'binary')); } else { ws.forwardclient.write(msg); }
188 + });
189 +
190 + // If error, close the associated TCP connection.
191 + ws.on('error', function (err) {
192 + console.log('CIRA server websocket error from ' + ws._socket.remoteAddress + ', ' + err.toString().split('\r')[0] + '.');
193 + Debug(1, 'Websocket relay closed on error.');
194 + if (ws.forwardclient && ws.forwardclient.close) { ws.forwardclient.close(); } // TODO: If TLS is used, we need to close the socket that is wrapped by TLS
195 + });
196 +
197 + // If the web socket is closed, close the associated TCP connection.
198 + ws.on('close', function (req) {
199 + Debug(1, 'Websocket relay closed.');
200 + if (ws.forwardclient && ws.forwardclient.close) { ws.forwardclient.close(); } // TODO: If TLS is used, we need to close the socket that is wrapped by TLS
201 + });
202 +
203 + ws.forwardclient.onStateChange = function (ciraconn, state) {
204 + Debug(2, 'Relay CIRA state change', state);
205 + if (state == 0) { try { ws.close(); } catch (e) { } }
206 + };
207 +
208 + ws.forwardclient.onData = function (ciraconn, data) {
209 + Debug(4, 'Relay CIRA data', data.length);
210 + if (ws.interceptor) { data = ws.interceptor.processAmtData(data); } // Run data thru interceptor
211 + if (data.length > 0) { try { ws.send(Buffer.from(data, 'binary')); } catch (e) { } } // TODO: Add TLS support
212 + };
213 +
214 + ws.forwardclient.onSendOk = function (ciraconn) {
215 + // TODO: Flow control? (Dont' really need it with AMT, but would be nice)
216 + //console.log('onSendOk');
217 + };
218 +
219 + // Fetch Intel AMT credentials & Setup interceptor
220 + if (req.query.p == 1) {
221 + Debug(3, 'INTERCEPTOR1', { host: node.host, port: port, user: node.intelamt.user, pass: node.intelamt.pass });
222 + ws.interceptor = obj.interceptor.CreateHttpInterceptor({ host: node.host, port: port, user: node.intelamt.user, pass: node.intelamt.pass });
223 + ws.interceptor.blockAmtStorage = true;
224 + }
225 + else if (req.query.p == 2) {
226 + Debug(3, 'INTERCEPTOR2', { user: node.intelamt.user, pass: node.intelamt.pass });
227 + ws.interceptor = obj.interceptor.CreateRedirInterceptor({ user: node.intelamt.user, pass: node.intelamt.pass });
228 + ws.interceptor.blockAmtStorage = true;
229 + }
230 + */
231 +
232 + return;
233 + }
234 +
235 + // If Intel AMT direct connection is possible, option a direct socket
236 + if ((conn & 4) != 0) { // We got a new web socket connection, initiate a TCP connection to the target Intel AMT host/port.
237 + Debug(1, 'Opening Intel AMT transport connection to ' + host + '.');
238 +
239 + /*
240 + // When data is received from the web socket, forward the data into the associated TCP connection.
241 + ws.on('message', function (msg) {
242 + if (obj.parent.debugLevel >= 1) { // DEBUG
243 + Debug(1, 'TCP relay data to ' + node.host + ', ' + msg.length + ' bytes');
244 + if (obj.parent.debugLevel >= 4) { Debug(4, ' ' + msg.toString('hex')); }
245 + }
246 + msg = msg.toString('binary');
247 + if (ws.interceptor) { msg = ws.interceptor.processBrowserData(msg); } // Run data thru interceptor
248 + ws.forwardclient.write(Buffer.from(msg, 'binary')); // Forward data to the associated TCP connection.
249 + });
250 +
251 + // If error, close the associated TCP connection.
252 + ws.on('error', function (err) {
253 + console.log('Error with relay web socket connection from ' + ws._socket.remoteAddress + ', ' + err.toString().split('\r')[0] + '.');
254 + Debug(1, 'Error with relay web socket connection from ' + ws._socket.remoteAddress + '.');
255 + if (ws.forwardclient) { try { ws.forwardclient.destroy(); } catch (e) { } }
256 + });
257 +
258 + // If the web socket is closed, close the associated TCP connection.
259 + ws.on('close', function () {
260 + Debug(1, 'Closing relay web socket connection to ' + req.query.host + '.');
261 + if (ws.forwardclient) { try { ws.forwardclient.destroy(); } catch (e) { } }
262 + });
263 + */
264 +
265 + if (tls != 1) {
266 + // If this is TCP (without TLS) set a normal TCP socket
267 + obj.forwardclient = new obj.net.Socket();
268 + obj.forwardclient.setEncoding('binary');
269 + //obj.forwardclient.xstate = 0;
270 + //obj.forwardclient.forwardwsocket = ws;
271 + } else {
272 + // If TLS is going to be used, setup a TLS socket
273 + var tlsoptions = { secureProtocol: ((req.query.tls1only == 1) ? 'TLSv1_method' : 'SSLv23_method'), ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false };
274 + obj.forwardclient = obj.tls.connect(port, node.host, tlsoptions, function () {
275 + // The TLS connection method is the same as TCP, but located a bit differently.
276 + Debug(2, 'TLS Intel AMT transport connected to ' + node.host + ':' + port + '.');
277 + //ws.forwardclient.xstate = 1;
278 + //ws._socket.resume();
279 + obj.xxOnSocketConnected();
280 + });
281 + obj.forwardclient.setEncoding('binary');
282 + //obj.forwardclient.xstate = 0;
283 + //obj.forwardclient.forwardwsocket = ws;
284 + }
285 +
286 + // When we receive data on the TCP connection, forward it back into the web socket connection.
287 + obj.forwardclient.on('data', function (data) {
288 + //if (obj.parent.debugLevel >= 1) { // DEBUG
289 + Debug(1, 'Intel AMT transport data from ' + node.host + ', ' + data.length + ' bytes.');
290 + //if (obj.parent.debugLevel >= 4) { Debug(4, ' ' + Buffer.from(data, 'binary').toString('hex')); }
291 + //}
292 + obj.xxOnSocketData(data);
293 + });
294 +
295 + // If the TCP connection closes, disconnect the associated web socket.
296 + obj.forwardclient.on('close', function () {
297 + Debug(1, 'Intel AMT transport relay disconnected from ' + node.host + '.');
298 + obj.xxStateChange(0);
299 + });
300 +
301 + // If the TCP connection causes an error, disconnect the associated web socket.
302 + obj.forwardclient.on('error', function (err) {
303 + Debug(1, 'Intel AMT transport relay error from ' + node.host + ': ' + err.errno);
304 + obj.xxStateChange(0);
305 + });
306 +
307 + if (node.intelamt.tls == 0) {
308 + // A TCP connection to Intel AMT just connected, start forwarding.
309 + obj.forwardclient.connect(port, node.host, function () {
310 + Debug(1, 'Intel AMT transport connected to ' + node.host + ':' + port + '.');
311 + //obj.forwardclient.xstate = 1;
312 + //ws._socket.resume();
313 + obj.xxOnSocketConnected();
314 + });
315 + }
316 +
317 + return;
318 + }
319 +
320 + });
321 + }
322 +
323 + // Get the certificate of Intel AMT
324 + obj.getPeerCertificate = function () { if (obj.xtls == true) { return obj.socket.getPeerCertificate(); } return null; }
325 +
326 + obj.xxOnSocketConnected = function () {
327 + console.log('xxOnSocketConnected');
328 + if (!obj.xtlsoptions || !obj.xtlsoptions.meshServerConnect) {
329 + if (obj.xtls == true) {
330 + obj.xtlsCertificate = obj.socket.getPeerCertificate();
331 + if ((obj.xtlsFingerprint != 0) && (obj.xtlsCertificate.fingerprint.split(':').join('').toLowerCase() != obj.xtlsFingerprint)) { obj.Stop(); return; }
332 + }
333 + }
334 +
335 + if (obj.redirTrace) { console.log("REDIR-CONNECTED"); }
336 + //obj.Debug("Socket Connected");
337 + obj.xxStateChange(2);
338 + if (obj.protocol == 1) obj.xxSend(obj.RedirectStartSol); // TODO: Put these strings in higher level module to tighten code
339 + if (obj.protocol == 2) obj.xxSend(obj.RedirectStartKvm); // Don't need these is the feature if not compiled-in.
340 + if (obj.protocol == 3) obj.xxSend(obj.RedirectStartIder);
341 + }
342 +
343 + obj.xxOnSocketData = function (data) {
344 + if (!data || obj.connectstate == -1) return;
345 + if (obj.redirTrace) { console.log("REDIR-RECV(" + data.length + "): " + webserver.common.rstr2hex(data)); }
346 + //obj.Debug("Recv(" + data.length + "): " + webserver.common.rstr2hex(data));
347 + if (obj.protocol == 2 && obj.connectstate == 1) { return obj.m.ProcessData(data); } // KVM traffic, forward it directly.
348 + obj.amtaccumulator += data;
349 + //obj.Debug("Recv(" + obj.amtaccumulator.length + "): " + webserver.common.rstr2hex(obj.amtaccumulator));
350 + while (obj.amtaccumulator.length >= 1) {
351 + var cmdsize = 0;
352 + switch (obj.amtaccumulator.charCodeAt(0)) {
353 + case 0x11: // StartRedirectionSessionReply (17)
354 + if (obj.amtaccumulator.length < 4) return;
355 + var statuscode = obj.amtaccumulator.charCodeAt(1);
356 + switch (statuscode) {
357 + case 0: // STATUS_SUCCESS
358 + if (obj.amtaccumulator.length < 13) return;
359 + var oemlen = obj.amtaccumulator.charCodeAt(12);
360 + if (obj.amtaccumulator.length < 13 + oemlen) return;
361 + obj.xxSend(String.fromCharCode(0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)); // Query authentication support
362 + cmdsize = (13 + oemlen);
363 + break;
364 + default:
365 + obj.Stop();
366 + break;
367 + }
368 + break;
369 + case 0x14: // AuthenticateSessionReply (20)
370 + if (obj.amtaccumulator.length < 9) return;
371 + var authDataLen = webserver.common.ReadIntX(obj.amtaccumulator, 5);
372 + if (obj.amtaccumulator.length < 9 + authDataLen) return;
373 + var status = obj.amtaccumulator.charCodeAt(1);
374 + var authType = obj.amtaccumulator.charCodeAt(4);
375 + var authData = [];
376 + for (i = 0; i < authDataLen; i++) { authData.push(obj.amtaccumulator.charCodeAt(9 + i)); }
377 + var authDataBuf = obj.amtaccumulator.substring(9, 9 + authDataLen);
378 + cmdsize = 9 + authDataLen;
379 + if (authType == 0) {
380 + // ###BEGIN###{Mode-NodeWebkit}
381 + if (obj.amtuser == '*') {
382 + if (authData.indexOf(2) >= 0) {
383 + // Kerberos Auth
384 + var ticket;
385 + if (kerberos && kerberos != null) {
386 + var ticketReturn = kerberos.getTicket('HTTP' + ((obj.tls == 1)?'S':'') + '/' + ((obj.amtpass == '') ? (obj.host + ':' + obj.port) : obj.amtpass));
387 + if (ticketReturn.returnCode == 0 || ticketReturn.returnCode == 0x90312) {
388 + ticket = ticketReturn.ticket;
389 + if (process.platform.indexOf('win') >= 0) {
390 + // Clear kerberos tickets on both 32 and 64bit Windows platforms
391 + try { require('child_process').exec('%windir%\\system32\\klist purge', function (error, stdout, stderr) { if (error) { require('child_process').exec('%windir%\\sysnative\\klist purge', function (error, stdout, stderr) { if (error) { console.error('Unable to purge kerberos tickets'); } }); } }); } catch (e) { console.log(e); }
392 + }
393 + } else {
394 + console.error('Unexpected Kerberos error code: ' + ticketReturn.returnCode);
395 + }
396 + }
397 + if (ticket) {
398 + obj.xxSend(String.fromCharCode(0x13, 0x00, 0x00, 0x00, 0x02) + webserver.common.IntToStrX(ticket.length) + ticket);
399 + } else {
400 + obj.Stop();
401 + }
402 + }
403 + else obj.Stop();
404 + } else {
405 + // ###END###{Mode-NodeWebkit}
406 + // Query
407 + if (authData.indexOf(4) >= 0) {
408 + // Good Digest Auth (With cnonce and all)
409 + obj.xxSend(String.fromCharCode(0x13, 0x00, 0x00, 0x00, 0x04) + webserver.common.IntToStrX(obj.amtuser.length + obj.authuri.length + 8) + String.fromCharCode(obj.amtuser.length) + obj.amtuser + String.fromCharCode(0x00, 0x00) + String.fromCharCode(obj.authuri.length) + obj.authuri + String.fromCharCode(0x00, 0x00, 0x00, 0x00));
410 + }
411 + else if (authData.indexOf(3) >= 0) {
412 + // Bad Digest Auth (Not sure why this is supported, cnonce is not used!)
413 + obj.xxSend(String.fromCharCode(0x13, 0x00, 0x00, 0x00, 0x03) + webserver.common.IntToStrX(obj.amtuser.length + obj.authuri.length + 7) + String.fromCharCode(obj.amtuser.length) + obj.amtuser + String.fromCharCode(0x00, 0x00) + String.fromCharCode(obj.authuri.length) + obj.authuri + String.fromCharCode(0x00, 0x00, 0x00));
414 + }
415 + else if (authData.indexOf(1) >= 0) {
416 + // Basic Auth (Probably a good idea to not support this unless this is an old version of Intel AMT)
417 + obj.xxSend(String.fromCharCode(0x13, 0x00, 0x00, 0x00, 0x01) + webserver.common.IntToStrX(obj.amtuser.length + obj.amtpass.length + 2) + String.fromCharCode(obj.amtuser.length) + obj.amtuser + String.fromCharCode(obj.amtpass.length) + obj.amtpass);
418 + }
419 + else obj.Stop();
420 + // ###BEGIN###{Mode-NodeWebkit}
421 + }
422 + // ###END###{Mode-NodeWebkit}
423 + }
424 + else if ((authType == 3 || authType == 4) && status == 1) {
425 + var curptr = 0;
426 +
427 + // Realm
428 + var realmlen = authDataBuf.charCodeAt(curptr);
429 + var realm = authDataBuf.substring(curptr + 1, curptr + 1 + realmlen);
430 + curptr += (realmlen + 1);
431 +
432 + // Nonce
433 + var noncelen = authDataBuf.charCodeAt(curptr);
434 + var nonce = authDataBuf.substring(curptr + 1, curptr + 1 + noncelen);
435 + curptr += (noncelen + 1);
436 +
437 + // QOP
438 + var qoplen = 0;
439 + var qop = null;
440 + var cnonce = obj.xxRandomValueHex(32);
441 + var snc = '00000002';
442 + var extra = '';
443 + if (authType == 4) {
444 + qoplen = authDataBuf.charCodeAt(curptr);
445 + qop = authDataBuf.substring(curptr + 1, curptr + 1 + qoplen);
446 + curptr += (qoplen + 1);
447 + extra = snc + ":" + cnonce + ":" + qop + ":";
448 + }
449 + var digest = hex_md5(hex_md5(obj.amtuser + ":" + realm + ":" + obj.amtpass) + ":" + nonce + ":" + extra + hex_md5("POST:" + obj.authuri));
450 +
451 + var totallen = obj.amtuser.length + realm.length + nonce.length + obj.authuri.length + cnonce.length + snc.length + digest.length + 7;
452 + if (authType == 4) totallen += (qop.length + 1);
453 + var buf = String.fromCharCode(0x13, 0x00, 0x00, 0x00, authType) + webserver.common.IntToStrX(totallen) + String.fromCharCode(obj.amtuser.length) + obj.amtuser + String.fromCharCode(realm.length) + realm + String.fromCharCode(nonce.length) + nonce + String.fromCharCode(obj.authuri.length) + obj.authuri + String.fromCharCode(cnonce.length) + cnonce + String.fromCharCode(snc.length) + snc + String.fromCharCode(digest.length) + digest;
454 + if (authType == 4) buf += (String.fromCharCode(qop.length) + qop);
455 + obj.xxSend(buf);
456 + }
457 + else if (status == 0) { // Success
458 + if (obj.protocol == 1) {
459 + // Serial-over-LAN: Send Intel AMT serial settings...
460 + var MaxTxBuffer = 10000;
461 + var TxTimeout = 100;
462 + var TxOverflowTimeout = 0;
463 + var RxTimeout = 10000;
464 + var RxFlushTimeout = 100;
465 + var Heartbeat = 0;//5000;
466 + obj.xxSend(String.fromCharCode(0x20, 0x00, 0x00, 0x00) + ToIntStr(obj.amtsequence++) + ToShortStr(MaxTxBuffer) + ToShortStr(TxTimeout) + ToShortStr(TxOverflowTimeout) + ToShortStr(RxTimeout) + ToShortStr(RxFlushTimeout) + ToShortStr(Heartbeat) + ToIntStr(0));
467 + }
468 + if (obj.protocol == 2) {
469 + // Remote Desktop: Send traffic directly...
470 + obj.xxSend(String.fromCharCode(0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
471 + }
472 + } else obj.Stop();
473 + break;
474 + case 0x21: // Response to settings (33)
475 + if (obj.amtaccumulator.length < 23) break;
476 + cmdsize = 23;
477 + obj.xxSend(String.fromCharCode(0x27, 0x00, 0x00, 0x00) + ToIntStr(obj.amtsequence++) + String.fromCharCode(0x00, 0x00, 0x1B, 0x00, 0x00, 0x00));
478 + if (obj.protocol == 1) { obj.amtkeepalivetimer = setInterval(obj.xxSendAmtKeepAlive, 2000); }
479 + obj.connectstate = 1;
480 + obj.xxStateChange(3);
481 + break;
482 + case 0x29: // Serial Settings (41)
483 + if (obj.amtaccumulator.length < 10) break;
484 + cmdsize = 10;
485 + break;
486 + case 0x2A: // Incoming display data (42)
487 + if (obj.amtaccumulator.length < 10) break;
488 + var cs = (10 + ((obj.amtaccumulator.charCodeAt(9) & 0xFF) << 8) + (obj.amtaccumulator.charCodeAt(8) & 0xFF));
489 + if (obj.amtaccumulator.length < cs) break;
490 + obj.m.ProcessData(obj.amtaccumulator.substring(10, cs));
491 + cmdsize = cs;
492 + break;
493 + case 0x2B: // Keep alive message (43)
494 + if (obj.amtaccumulator.length < 8) break;
495 + cmdsize = 8;
496 + break;
497 + case 0x41:
498 + if (obj.amtaccumulator.length < 8) break;
499 + obj.connectstate = 1;
500 + obj.m.Start();
501 + // KVM traffic, forward rest of accumulator directly.
502 + if (obj.amtaccumulator.length > 8) { obj.m.ProcessData(obj.amtaccumulator.substring(8)); }
503 + cmdsize = obj.amtaccumulator.length;
504 + break;
505 + default:
506 + console.log("Unknown Intel AMT command: " + obj.amtaccumulator.charCodeAt(0) + " acclen=" + obj.amtaccumulator.length);
507 + obj.Stop();
508 + return;
509 + }
510 + if (cmdsize == 0) return;
511 + obj.amtaccumulator = obj.amtaccumulator.substring(cmdsize);
512 + }
513 + }
514 +
515 + obj.xxSend = function (x) {
516 + console.log("REDIR-SEND(" + x.length + ")");
517 + if (obj.redirTrace) { console.log("REDIR-SEND(" + x.length + "): " + webserver.common.rstr2hex(x)); }
518 + //obj.Debug("Send(" + x.length + "): " + webserver.common.rstr2hex(x));
519 + obj.forwardclient.write(new Buffer(x, "binary"));
520 + }
521 +
522 + obj.Send = function (x) {
523 + if (obj.forwardclient == null || obj.connectstate != 1) return;
524 + if (obj.protocol == 1) { obj.xxSend(String.fromCharCode(0x28, 0x00, 0x00, 0x00) + ToIntStr(obj.amtsequence++) + ToShortStr(x.length) + x); } else { obj.xxSend(x); }
525 + }
526 +
527 + obj.xxSendAmtKeepAlive = function () {
528 + if (obj.forwardclient == null) return;
529 + obj.xxSend(String.fromCharCode(0x2B, 0x00, 0x00, 0x00) + ToIntStr(obj.amtsequence++));
530 + }
531 +
532 + obj.xxRandomValueHex = function(len) { return obj.crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len); }
533 +
534 + obj.xxOnSocketClosed = function () {
535 + if (obj.redirTrace) { console.log("REDIR-CLOSED"); }
536 + //obj.Debug("Socket Closed");
537 + obj.Stop();
538 + }
539 +
540 + obj.xxStateChange = function(newstate) {
541 + if (obj.State == newstate) return;
542 + obj.State = newstate;
543 + obj.m.xxStateChange(obj.State);
544 + if (obj.onStateChanged != null) obj.onStateChanged(obj, obj.State);
545 + }
546 +
547 + obj.Stop = function () {
548 + if (obj.redirTrace) { console.log("REDIR-CLOSED"); }
549 + //obj.Debug("Socket Stopped");
550 + obj.xxStateChange(0);
551 + obj.connectstate = -1;
552 + obj.amtaccumulator = "";
553 + if (obj.forwardclient != null) { obj.forwardclient.destroy(); obj.forwardclient = null; }
554 + if (obj.amtkeepalivetimer != null) { clearInterval(obj.amtkeepalivetimer); obj.amtkeepalivetimer = null; }
555 + }
556 +
557 + obj.RedirectStartSol = String.fromCharCode(0x10, 0x00, 0x00, 0x00, 0x53, 0x4F, 0x4C, 0x20);
558 + obj.RedirectStartKvm = String.fromCharCode(0x10, 0x01, 0x00, 0x00, 0x4b, 0x56, 0x4d, 0x52);
559 + obj.RedirectStartIder = String.fromCharCode(0x10, 0x00, 0x00, 0x00, 0x49, 0x44, 0x45, 0x52);
560 +
561 + function hex_md5(str) { return meshcentral.certificateOperations.forge.md.md5.create().update(str).digest().toHex(); }
562 +
563 + return obj;
564 +}
565 +
566 +function ToIntStr(v) { return String.fromCharCode((v & 0xFF), ((v >> 8) & 0xFF), ((v >> 16) & 0xFF), ((v >> 24) & 0xFF)); }
567 +function ToShortStr(v) { return String.fromCharCode((v & 0xFF), ((v >> 8) & 0xFF)); }
public/commander.htm
+481 -477
@@ -1,4 +1,4 @@
1 -<!DOCTYPE html><html style=height:100%><head><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8" http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link rel="icon" type=image/png href="data:image/png;base64,iVBORw0KGgo="><style>body{height:100%;max-height:100%;overflow:hidden;font-family:arial, helvetica, sans-serif;font-size:9pt;color:black;background:white;margin-top:0;margin-left:0;margin-right:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}li{margin:0;padding:0;}label{display:block;color:windowtext;background-color:window;margin:0;padding:0;width:100%;}label:hover{background-color:highlight;color:highlighttext;}a:visited{text-decoration:none;color:#04f;}a:link{text-decoration:none;color:#04f;}a:hover{color:#a32;}h1{font-size:11pt;font-weight:bold;color:black;margin-left:5px;margin-top:10px;margin-bottom:6px;}h2{font-size:9pt;font-weight:bold;color:black;margin-left:6px;margin-top:6px;margin-bottom:0;}p{margin-left:6px;margin-top:4px;margin-bottom:0;margin-right:2px;}td{font-size:9pt;}th{font-size:9pt;}th:hover{cursor:pointer;background:#aaa;}.header{position:fixed;top:0;left:0;right:0;height:24px;background:#c0c0c0;}.progressbar{position:fixed;top:24px;left:0;right:0;height:2px;background:#ff9e30;}.in{margin-left:40px;}.log{background:#bbbab5;}.log1{background:#bbbab5;}.log tbody tr:nth-child(odd){background:#e8eefe;}.fullcell{position:fixed;top:26px;right:0;bottom:0;left:0px;overflow:hidden;}.maincell{position:fixed;top:26px;right:0;bottom:0;left:156px;overflow:auto;padding-left:2px;vertical-align:top;}.navbar{position:fixed;top:26px;left:0;bottom:0;width:156px;border-right:2px solid #ff9e30;vertical-align:top;background:#72726f;background:linear-gradient(45deg, #72726f 0%,#a6a5a0 100%);}.nav1{padding:1px 0px 1px 8px;margin:0px;font-weight:bold;color:black;white-space:nowrap;cursor:pointer;}.nav2{margin-left:32px;margin-top:0;color:black;cursor:pointer;}.r{font-size:11pt;}.r0{background:white;}.r1{border-bottom:1px solid gray;text-align:left;}.r2{text-align:left;}.r3{border-bottom:1px solid gray;text-align:left;}.r3:hover{background-color:#83827b;cursor:pointer;}.spread{height:100%;width:100%;background-color:white;}.timer{border:1px solid #abcae1;background-color:#abcae1;}.tm{font-size:7pt;}.top1{font-size:14pt;font-weight:bold;color:white;margin-top:11px;}.top2{color:white;}.warn{font-weight:bold;color:#c00000;}.icon1{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMISURBVHjadJPPb9t0GMY//rbJaEKSxoPFQQ1WxhQ7RaGoIDEpTBMqgk7iBvwNKJdJXDnssEMl7pMGfwOH9YBYh0AglYiBBNKa0cSGNpiRxs7aJE2aH7aTmkPXqTvwXt7L8z56pef5SEEQcHYMwyjWarX3rLr1tu3YOQAlpZhqVv1J1/VvNU0rn9VLpwbtdlspb5ZLNdNcuZBKF1NKmuS8DECn28axm7ScZlnP5b4vXinelmXZfmrQbreVjbsbN3r9YSmTLbA/Ps92K8FgFAbAdYcsLXRRk10af/9BPBa5vXpt9aYsy7YAKG+WS73+sJS+eJmKneZe5QWEiHHreoJb1xNEInHu/Bzw3cM45zNv0usPS+XNcglAGIZRrJnmSiZbYOtRhF93ZvHcHoPRlN3GkL4Ho5HHeOxRqbv8sHVM+uVFaqa5YhhGUVpfXw+6hwP86DJ3fgkzK44hOGZuLkH7KIQIxuw9dkk812Hqu0wmPh9djZIKG8wnogirbpFS0jy0YOqPcMcurjvh3Vc7fPHpHF9//iLLyja75p/sNWxazj73t9qklDRW3ULYjk1yXmb3Xw/P9fA9n35/AMD0yAIgGQ8zOtxnMhFM/ClG/YjkvIzt2Mye5un5Lr4HY9el5RwA2tOsY9FzCCFBICCYOdlPRigphU63jZKEwWDAweMDJt7kmXINBhOkIEAQQiLMpczzJzcpBaFmVRy7iZ4RdA/7TKcBknTymOd5APT6PiAhghlmpHO8ocdw7CZqVkXour7Ycppriwsuy7koEgKQANDy+dPCIokQkhTiciFG4aJPy2mu6bq+OKtpWlXPmZWGtc2H77yOhOD+gxE7//T45sdHzEjQ7Y0IgmPeKszxwdUwTuM39Fyuomla9bTKyY27Gx/3+sMvlYU8lXqI36sef+1UkCS4pMZZyuu89oqL09gmHot8snpt9StZljtnYUqWN8vv10yzcCGV/ux/YFrTc7lK8UrxnizLnWdoPINzvlarLVl1K2879ktPcN5Ts2pV1/UHmqZVz+r/GwBWYYCoNUz0KwAAAABJRU5ErkJggg==");}.icon2{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAIuSURBVHjalJNBTBNBFIb/2S4tlliFdLBNW0mktibaeivBm9eejFeDZw81kROXHj2SyIEDB65wI3iBI5iYmEjSREtIpI1tQdOm20KBdkuX3ZnnYUVq2Cb6kklm3vxv3vdm3oCI4DTazZ3p3HpM5NZjot3cmR6kY0QEJ9vdnNJcaoMP3xyB3vI2EunP4046xcl5WttK99olHn4URSA2AaNT5qe1rbST1pFgd3NKU93H/P6TJADg8GthIMU1gqODtZlep8QjiegfXzBuUxwdrM1cy9Z/IVIYSn4jpe1vx8jsviAABIBM/Tl9/5Sg/EZKk8JQ+mP+ImiUVjJGp8xDDycB2b1KIgSC0RCMTpk3SisZxxKkpXvqhaXs7aAfnhtukBBXKmFCHVLgj4yjXljKSkv3XDugXlyeM/QKDz24CxIWSJhXBKYJMk2MT3AYeoXXi8tzl3sqAFgXLV+zvJrxhzkUqwdxQQARZl+FbbqeXY7CGHjEj2Z5NcMnXy6o7tEzRkT4mX/7Tisuvok/joBJC5ACl8/LmAIov0EVBZIYvn35gUD89UI4mZ1lRrca2N9+lh8bPeG3RgCyTEBKgAi+1CEAoJ27B6gqGGMAY2idCbRORhvxp++TanVvviaMQ/g8XshzAxACIIn+/pLGOWAqYIoLAODzuKB1K7y6N19j+Y0U3fG3MCw6IMsCyM4Oxvob1l4ze84YQ5u8OD7jUNWhMXz4uI//tx4Syfjg3/iv9msAKbs79bi84QcAAAAASUVORK5CYII=");}.icon3{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAANGSURBVHjadJNNTBwFAIW//UFWfrbsgDuzBTvu0s6OWhHwYMhCOEAbSESC4dpL07TFg9GkxIRDjT3YhEBNPUjC0SbaJjVNQyJQaxtDpzYmlDYUOjuUrhspO0N0gQVWl/0ZD5ZmPfiSd3t5l/c+h23bFCsajR7Rdf1GPBbHtEwAJFFCDsqoqno0HA7/WJx37BUkk8k6bUYb0g2jxy8G6kQpgK9KAGB9I4llJlizEiuqokxE2iJfCIKw8qIgmUzWTU1OfZXaSve9KQep3tzA9fQJhfhvZHd3yfl85OUg26F6os9W8FaWXevq7vpIEIQVJ4A2ow2lttJ9LTU1hH64Tt1qHHv8a0rnH/LS4iPsK9/iixnUXr1Ck3cfqa10nzajDQG4o9HoEd0wet493Ij/zm18n3yMJxQivbND7Px58thUD3xI+egoBcMgd+FLlO73mTUWe5Ro9Jqrs7Nz2eUu9YbSacriT8lms5Q3NlLR3s6uaVJQFISRC1SUuFm9dInJ6WlCfpGMFPBub6eOueOxOMobb+H4+Ta/f3cZz927FPJ5hOPHqRkZgT/+xFniIjY6yveDg0gOB9l6BbHpBMbiPE7TMvFVCWSXl3DU7secnWXu9GniFy+ymctRIfhYHxvj6pkzBG2bA0Du8SN8VQKmZeLc2zOXybA2P8+mbeNpbydTWUmJ203etvGIInV+PxVA9t/pXvzALYkS6xtJqoRq/rJtqoNB/KdO8Up/P+atWxSA8t5e3vN6mT55kgOrq5TUH2J9I4kkSjjloIxlJiiEDiK2tREYHkbq7yd57x6XOzr4paMD59IS+7q7+WB8nPtuNyVN72CZCeSgjFNV1dY1K6H9fbiBDWk/uwsL5G7e5JuWFhTgVUBrbmZX11memyMgv0a64W3WrISmqmqrw7ZtJq5PfP4sYZ0Nl5ayPjJM4fECKdtGAF5+bt3pxBt+HWXwU37NZKgNiOd6ens+27uyNDU5dTa1lR44JAXwPHiA/fA++ScGTsB1UMHV1MxOQyOGmcBbWTbW1d11ThAEsxgmSZvRBnTD6PCLgcj/wKSpivJTpC0yJgiC+R8ai3CO6Lp+NB6Lt5qWqTzH2ZCD8h1VVW+Ew2GtOP/PAFZGexs+cGPjAAAAAElFTkSuQmCC");}.itemBar{padding:7px;min-height:20px;margin-top:4px;margin-right:8px;width:auto;border-radius:8px;background-color:#7e7d74;cursor:pointer;}.computeritem{cursor:pointer;width:auto;border-radius:5px;background-color:#a6a5a0;height:28px;margin:4px;padding:2px;}.computeritem:hover{background-color:#83827b;}.us{-webkit-touch-callout:initial;-webkit-user-select:auto;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}.rb{cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.fsize{float:right;text-align:right;width:180px;}</style><body onunload="cleanup()"><div id=0 class=header><table id=1 cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td id=2 class=style6><div>&nbsp;<input type=button class=connectbutton id=xconnectbutton1 value=Connect onclick="connectButtonfunction(event, false)" onkeypress="return false" onkeydown="return false">&nbsp;<span id=constatus></span></div></table><div class=progressbar><div id=3 style=height:2px;width:0%;background-color:red></div></div></div><div id=4 class=fullcell style=text-align:center;padding-top:100px;font-size:20px><span id=5>Disconnected</span></div><div id=6 style=height:100%;display:none><div id=7 class=navbar><br><p id=go1 class=nav1 onclick=go(1)><a>System Status</a><p id=go14 class=nav1 onclick=go(14)><a>Remote Desktop</a><p id=go24 class=nav1 onclick=go(24)>&nbsp;&nbsp;<a>Files</a><p id=go13 class=nav1 onclick=go(13)><a>Serial-over-LAN</a><p id=go2 class=nav1 onclick=go(2)><a>Hardware Information</a><p id=go6 class=nav1 onclick=go(6)><a>Event Log</a><p id=go15 class=nav1 onclick=go(15)><a>Audit Log</a><p id=go21 class=nav1 onclick=go(21)><a>Storage</a><p id=go8 class=nav1 onclick=go(8)><a>Network Settings</a><p id=go17 class=nav1 onclick=go(17)><a>Internet Settings</a><p id=go16 class=nav1 onclick=go(16)><a>Security Settings</a><p id=go19 class=nav1 onclick=go(19)><a>Agent Presence</a><p id=go18 class=nav1 onclick=go(18)><a>System Defense</a><p id=go11 class=nav1 onclick=go(11)><a>User Accounts</a><p id=go22 class=nav1 onclick=go(22)><a>Subscriptions</a><p id=go23 class=nav1 onclick=go(23)><a>Wake Alarms</a><p id=go20 class=nav1 onclick=go(20)><a>Script Editor</a><p id=go12 class=nav1 onclick=go(12)><a>WSMAN Browser</a></div><div id=8 class=maincell><div id=9 style=position:relative;height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=float:right><input type=button value="Disk Map" onclick=iderToggleDiskMap()><input type=button value="Stop IDE-R Session" onclick=iderStop()></div><div style=font-size:16px;padding-top:2px>&nbsp;<b>IDE-R Session</b><span id=10></span></div><div id=iderHeatmap style="z-index:1000;position:absolute;top:31px;right:8px;border:1px solid black;box-shadow:0px 0px 10px;border-radius:5px;padding:8px;width:600px;background-color:#99CC99;display:none"><div id=floppyHeatMap style=display:none><div id=floppyHeatMapText style=margin:2px>Floppy, blocks are 512 bytes.</div><canvas id=floppyHeatMapCanvas width=600 height=0></canvas></div><div id=cdromHeatMap style=display:none><div id=cdromHeatMapText style=margin:2px>CDROM, blocks are 2048 bytes.</div><canvas id=cdromHeatMapCanvas width=600 height=0></canvas></div></div></div><div id=11 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none;overflow:hidden><div style=float:right><input type=button value="Stop Script" onclick=script_Stop()></div><div style=font-size:16px;padding-top:2px;overflow:hidden>&nbsp;<b>Running Script</b><span style=overflow:hidden id=12></span></div></div><div id=13 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=font-size:16px;float:right;cursor:pointer;padding-right:5px;padding-left:5px;padding-top:2px;font-size:15px onclick="QV(13, false)">&#x2716;</div><div style=font-size:14px;padding-top:2px>&nbsp;<b>This computer's firmware should be updated,&nbsp;<a style=cursor:pointer href="https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00075&languageid=en-fr" rel="noreferrer noopener" target="_blank"><u>please check here</u></a>.</b></div></div><div id=14 style=width:100%;height:100%><iframe id=15 style=width:100%;height:100%;border:0></iframe></div><div id=16 style=padding:8px;overflow-x:hidden><div id=p0><h1>Loading...</h1></div><div id=p1 style=display:none><h1>System Status</h1><span id=17></span></div><div id=p2 style=display:none><h1 style=margin-bottom:16px>Hardware Information</h1><span id=18></span></div><div id=p6 style=display:none><h1>Event Log</h1><span id=19></span><span id=20></span></div><div id=p8 style=display:none><h1>Network Settings</h1><span id=21></span><span id=22></span></div><div id=p11 style=display:none><h1>User Accounts</h1><span id=23></span></div><div id=p12 style=display:none><h1>WSMAN Browser</h1><div><table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><div style=padding:4px><select id=24 multiple="multiple" style=width:100%;height:120px></select></div><tr><td><input id=25 type=button value=Query style=margin:4px onclick=wsmanQuery()><input type=button value=Clear style=margin:4px onclick="QH(26, '')"><input id=c0 placeholder=Filter style=margin:4px onkeyup=wsmanFilter()></table></div><br><div class=us id=26></div></div><div id=p13 style=display:none;min-width:780px><h1>Serial-over-LAN Terminal</h1><br><div id=27 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showFeaturesDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Intel&reg; AMT Redirection port or Serial-over-LAN feature is disabled<span id=28>, click here to enable it.</span></div></div><div id=29 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showPowerActionDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Remote computer is not powered on, click here to issue a power command.</div></div><table cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><input onkeyup=sendTermInputKeys(event) autocorrect=off autocapitalize=off style=opacity:0;width:0;height:0;font-size:1px onblur="keyInputBlur()"><span id=30></span>&nbsp;<input type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Power Actions..." onclick=showPowerActionDlg() style=margin-right:3px><input type=button id=c1 value=IDE-R title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart() style=margin-right:3px><input id=c2 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Start Capture" title="Toggle start/stop of terminal capture, when stopping the content of the capture buffer will be saved to a file." onclick=terminalCaptureToggle() style=margin-right:3px></div><div>&nbsp;<input type=button id=c3 value=Connect onclick=connectTerminal(event) disabled="disabled">&nbsp;<span id=31>Disconnected.</span></div><tr><td style=background:#000;text-align:center><pre id=Term></pre><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><input id=32 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value=CR+LF title="Toggle what the return key will send" onclick=termToggleCr()><input id=33 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=80x25 title="Toggle terminal size" onclick=termToggleSize()><input id=34 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick=termToggleFx()><input id=35 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Extended Ascii" title="Toggle terminal emulation type" onclick=termToggleType()>&nbsp;</div><div>&nbsp;<input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-C onclick=termSendKey(3)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-X onclick=termSendKey(24)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=ESC onclick=termSendKey(27)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Backspace onclick=termSendKey(8)><input id=36 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value=Paste disabled="disabled" onclick="setDialogMode(3,'Paste',3,termPaste)"></div></table></div><div id=p14 style=display:none;min-width:780px><div id=37><h1>Remote Desktop</h1><br></div><div id=38 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showFeaturesDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Intel&reg; AMT Redirection port or KVM feature is disabled<span id=39>, click here to enable it.</span></div></div><div id=40 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showPowerActionDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Remote computer is not powered on, click here to issue a power command.</div></div><table cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><span id=41></span>&nbsp;<div class=rb title="Rotate Left" onclick=drotate(-1)>&olarr;</div><div class=rb title="Rotate Right" onclick=drotate(1)>&orarr;</div><input id=c4 type=button title="Toggle full screen mode" onkeypress="return false" onkeydown="return false" value=Full onclick=deskToggleFull() style=margin-right:3px><input id=c5 type=button title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value=Save... onclick=deskSaveImage() style=margin-right:3px><input type=button value=Settings... title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick=showDesktopSettings() style=margin-right:3px><input type=button id=c6 value=IDE-R title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart() style=margin-right:3px><input type=button title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick=showPowerActionDlg() style=margin-right:3px></div><div><div id=c7 onclick=deskToggleFull() style=float:left;cursor:pointer;font-size:15px;display:none>&nbsp;&#x2716;</div>&nbsp;<input type=button id=c8 value=Connect onclick=connectDesktop(event) onkeypress="return false" onkeydown="return false" disabled="disabled">&nbsp;<span id=42>Disconnected.</span></div><tr><td id=43 style=background:black;text-align:center;position:relative><canvas id=Desk width=640 height=400 style=-ms-touch-action:none;margin-left:0px oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel="dmousewheel(event)" moz-opaque=""></canvas><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div id=44 style=float:right></div><div>&nbsp;<span id=deskkeysspan><select style=margin-left:6px id=deskkeys><option value=0>Win<option value=1>Win+Down<option value=2>Win+Up<option value=3>Win+L<option value=4>Win+M<option value=5>Shift+Win+M<option value=6>F1<option value=7>F2<option value=8>F3<option value=9>F4<option value=10>F5<option value=11>F6<option value=12>F7<option value=13>F8<option value=14>F9<option value=15>F10<option value=16>F11<option value=17>F12</select><input id=DeskWD type=button value=Send onkeypress="return false" onkeydown="return false" onclick=deskSendKeys()>&nbsp;</span><input id=45 type=button value=Ctrl-Alt-Del onkeypress="return false" onkeydown="return false" onclick=sendCAD()>&nbsp;<span id=46><input id=47 type=checkbox>Blank Screen&nbsp;</span><span id=48><input id=49 type=checkbox>View only&nbsp;</span></div></table></div><div id=p15 style=display:none><span id=50></span><h1>Audit Log</h1><span id=51></span></div><div id=p16 style=display:none><h1>Security Settings</h1><span id=52></span></div><div id=p17 style=display:none><h1>Internet Settings</h1><span id=53></span></div><div id=p18 style=display:none><h1>System Defense</h1><span id=54></span></div><div id=p19 style=display:none><h1>Agent Presence</h1><span id=55></span></div><div id=p20 style=display:none><h1>Script Editor</h1><div class=log1 style=padding:5px;border-radius:5px><div id=EditScriptStatus style=float:right;font-weight:bold;padding:5px>Stopped</div><div><input type=button value="View Editor" title="Switch to script line editor view" id=viewEditorButton onclick=scriptViewButton(0)><input type=button value="View Builder" title="Switch to block editor view" id=viewBuilderButton onclick=scriptViewButton(1)><input type=button value=New... title="Clear the script editor" onclick=script_newScriptDlg()><input type=button value=Load... title="Load a script from file" onclick=script_runScriptDlg()><input type=button value=Save... title="Save a script to file" onclick=script_saveScript(event)><input type=button value=Restart title="Compile the script and get ready to run it from the start" onclick=resetScriptButton()><input type=button value=Continue title="Run the script from the current execution point" onclick=runScriptButton()><input type=button value=Break title="Pause the execution of the script" onclick=breakScriptButton()><input type=button value=Step title="Execute one step of the script" onclick=stepScriptButton()></div></div><div id=scriptbuilder style=display:none><h2>Script Builder</h2><div style=padding:0;margin:0><div style=width:250px;height:400px;float:left;padding:0;margin:0;padding-right:3px><input id=blockfilter style="width:inherit;height:24px;padding:0;margin:0;border:1px solid gray;margin-bottom:1px" placeholder="Filter blocks..." onkeyup=script_fonfilterchanged()><div id=blocks style="width:inherit;height:373px;border:1px solid gray;overflow-y:scroll;padding:0;margin:0"></div></div><div id=scriptblocks style="width:auto;height:400px;padding:0;margin:0;border:1px solid gray;overflow-y:scroll" ondrop="script_fondrop(event, this)" onclick=script_fonclick(event)></div></div></div><div id=scripteditor><h2>Script</h2><textarea id=scriptarea style=width:100%;height:176px;resize:vertical;margin:0;padding:0;font-family:Arial,Helvetica,sans-serif spellcheck="false"></textarea><div style=display:none><br><h2>Compiled Script</h2><textarea id=compiledarea style=width:100%;height:16px;resize:vertical;margin:0;padding:0 spellcheck="false"></textarea><br></div><h2>Variables</h2><div id=variables style="width:100%;height:200px;resize:vertical;border:1px solid gray;overflow:scroll;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text"></div></div><h2>Console</h2><textarea id=console style=width:100%;height:80px;resize:vertical;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text readonly=""></textarea></div><div id=p21 style=display:none><h1>Storage</h1><span id=56></span></div><div id=p22 style=display:none><h1>Event Subscriptions</h1><span id=57></span></div><div id=p23 style=display:none><h1>Wake Alarms</h1><span id=58></span></div><div id=p24 style=display:none;position:absolute;top:0px;bottom:0px;left:8px;right:24px><h1>Files</h1><br><table id=p24toolbar style=width:100%;position:absolute;top:35px cellpadding=0 cellspacing=0><tr><td style=width:100%;background-color:#d3d9d6;text-align:left;padding:4px valign="bottom"><div id=p24rightOfButtons style=float:right;margin-top:3px></div><div><input type=button id=p24FolderUp disabled="disabled" onclick=p24folderup() value=Up>&nbsp;<input type=button id=p24SelectAllButton disabled="disabled" onclick=p24selectallfile() value="Select All" onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24RenameFileButton disabled="disabled" value=Rename onclick=p24renamefile() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24DeleteFileButton disabled="disabled" value=Delete onclick=p24deletefile() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24NewFolderButton disabled="disabled" value="New Folder" onclick=p24createfolder() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24UploadButton disabled="disabled" value=Upload onclick=p24uploadFile() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24CutButton disabled="disabled" value=Cut onclick=p24copyFile(1) onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24CopyButton disabled="disabled" value=Copy onclick=p24copyFile(0) onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24PasteButton disabled="disabled" value=Paste onclick=p24pasteFile() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24RefreshButton disabled="disabled" value=Refresh onclick=p24folderup(9999) onkeypress="return false" onkeydown="return false">&nbsp;</div><tr><td style=background-color:#E4E9E7;height:28px><div style=float:right;margin-right:4px><select id=p24sortdropdown onchange=p24updateFiles()><option value=1 selected="selected">Sort by name<option value=2>Sort by size<option value=3>Sort by date<option value=4>Descend by name<option value=5>Descend by size<option value=6>Descend by date</select></div><div>&nbsp;&nbsp;<span id=p24currentpath></span></div></table><div id=p24filetable style=width:100%;overflow:auto;-webkit-user-select:none;position:absolute;top:92px;bottom:30px><div id=p24bigok style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>&checkmark;</b></div><div id=p24bigfail style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>&#10007;</b></div><span id=p24files></span></div><table id=p24toolbarBottom style=width:100%;position:absolute;bottom:10px cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px;text-align:center;background-color:#D3D9D6>&nbsp;<span id=p24bottomstatus></span></table></div></div></div></div><div id=dialog style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial, Helvetica, sans-serif;border-radius:5px;position:fixed;overflow:auto;top:75px;width:400px;max-height:550px;display:none"><div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"><div id=59 style=float:right;padding:1px;margin-right:5px;cursor:pointer;font-size:15px onclick=setDialogMode()>&#x2716;</div><div id=60 style=padding:5px></div><div style=width:100%;margin:6px></div></div><div style=margin-right:16px;margin-left:8px><div id=dialog1 style=margin:auto;text-align:center;margin:3px><div id=61 style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><br><div style=height:26px><input id=d2username style=float:right;width:200px onkeyup=updateAccountDialog()><div>Username</div></div><div style=height:26px><input id=d2password1 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Password*</div></div><div style=height:26px><input id=d2password2 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Confirm Password</div></div><div id=62><div style=height:26px><select id=d2permission style=float:right;width:200px><option value=0>Local<option value=1>Network<option value=2>Any</select><div>Permission</div></div><div>Granted Permissions</div><ul id=63 style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0"></ul></div><div style=font-size:10px><br>*Minimum 8 characters with upper, lowercase, 0-9, and one of !@#$%^&amp;*()+-</div></div><div id=dialog3 style=margin:auto;text-align:center;margin:3px><textarea id=d3pastetextarea maxlength="4096" style=width:100%;height:200px;resize:none></textarea></div><div id=dialog5 style=margin:auto;margin:3px><br><div style=height:26px><select id=d5actionSelect style=float:right;width:200px></select><div>Power Action</div></div><div><span style=color:red>Warning:</span>Some power actions may result in data loss and may disconnect the desktop, terminal or disk redirection sessions.</div></div><div id=dialog6 style=margin:auto;margin:3px><br><div style=height:26px><input id=d6ConsentText style=float:right;width:200px maxlength="6" onkeyup=consentChanged() onkeypress="return numbersOnly(event)"><div>Consent Code</div></div><div style=height:26px><select id=d6Display onchange=changeConsentDisplay() style=float:right;width:200px><option value=0>Primary display<option value=1>Secondary display<option id=d6ThirdDisplay value=2 style=display:none>Third display</select><div>Consent Display</div></div></div><div id=dialog7 style=margin:auto;margin:3px><br><div style=height:26px><select id=c9 style=float:right;width:200px><option value=1>RLE8, Fastest<option value=2>RLE16, Recommended<option value=3>RAW8, Slow<option value=4>RAW16, Very Slow</select><div>Image Encoding</div></div><div style=height:80px><div style="float:right;border:1px solid #666;width:200px;height:80px;overflow-y:scroll;background-color:white"><input type=checkbox id=d7showcursor>Show Local Mouse Cursor<br><input type=checkbox id=d7showcad>Show Ctrl-Alt-Del<br><input type=checkbox id=d7limitFrameRate>Limit Frame Rate<br><input type=checkbox id=d7noMouseRotate>Don't Rotate Mouse<br></div><div>Other Settings</div></div><div id=d7softkvmsettings style=display:none><h4 style="width:100%;border-bottom:1px solid gray">Software KVM</h4><div style="margin:3px 0 3px 0"><select id=d7bitmapquality style=float:right;width:200px;height:20px dir="rtl"><option value=50>50%<option value=40>40%<option selected="selected" value=30>30%<option value=20>20%<option value=10>10%<option value=5>5%<option value=1>1%</select><div style=height:20px>Quality</div></div><div style="margin:3px 0 3px 0"><select id=d7bitmapscaling style=float:right;width:200px;height:20px dir="rtl"><option selected="selected" value=1024>100%<option value=896>87.5%<option value=768>75%<option value=640>62.5%<option value=512>50%<option value=384>37.5%<option value=256>25%<option value=128>12.5%</select><div style=height:20px>Scaling</div></div></div></div><div id=dialog8 style=display:table;margin:3px><div style="margin:3px 0 3px 0;padding-top:5px"><input id=c10 value=admin style=float:right;width:220px><div style=height:20px>Username</div></div><div style="margin:3px 0 3px 0"><input id=c11 type=password autocomplete="off" style=float:right;width:220px><div style=height:20px>Password</div></div></div><div id=dialog9 style=margin:auto;margin:3px><input type=checkbox id=c12>Redirection Port<br><div id=c13><input type=checkbox id=c14>KVM Remote Desktop<br></div><input type=checkbox id=c15>IDE-Redirection<br><input type=checkbox id=c16>Serial-over-LAN<br></div><div id=dialog10 style=margin:auto;margin:3px><input type=radio name=d10 id=c17 value=0>Not Required<br><input type=radio name=d10 id=c18 value=1>Required for KVM only<br><input type=radio name=d10 id=c19 value=4294967295>Always Required<br></div><div id=dialog11 style=margin:auto;margin:3px><div id=64></div></div><div id=dialog12 style=margin:auto;margin:3px><br><div style=height:26px><input id=c20 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">Profile Name</div></div><div style=height:26px><input id=c21 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">SSID</div></div><div style=height:26px><select id=c22 style=float:right;width:200px onclick=updateWifiDialog()></select><div>Priority</div></div><div style=height:26px><select id=c23 style=float:right;width:200px onclick=updateWifiDialog()><option value=6>WPA2 PSK<option value=4>WPA PSK</select><div>Authentication</div></div><div style=height:26px><select id=c24 style=float:right;width:200px onclick=updateWifiDialog()><option id=65 value=4>CCMP-AES<option id=66 value=3>TKIP-RC4<option id=67 value=2>WEP<option id=68 value=5>None</select><div>Encryption</div></div><div style=height:26px><input id=c25 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Password*</div></div><div style=height:26px><input id=c26 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Confirm Password</div></div></div><div id=dialog19 style=margin:auto;margin:3px>This will save the entire state of Intel&reg; AMT for this machine into file. Passwords will not be saved, but some sensitive data may be included.<br><br><input id=c27 style=width:100% value=amtstate.json></div><div id=dialog20 style=margin:auto;margin:3px><input type=radio name=d20 id=d20a value=0>Disabled<br><input type=radio name=d20 id=d20b value=1>ICMP response<br><input type=radio name=d20 id=d20c value=2>RMCP response<br><input type=radio name=d20 id=d20d value=3>ICMP & RMCP response<br><br></div><div id=dialog21 style=margin:auto;margin:3px><input type=radio name=d21 id=d21o0 onclick=updateIPSetupDlg()><span id=d21l0></span><br><input type=radio name=d21 id=d21o1 onclick=updateIPSetupDlg()><span id=d21l1></span><br><div id=69><input type=radio name=d21 id=d21o2 onclick=updateIPSetupDlg()><span id=d21l2></span><br><br><div style=margin-left:20px><div style=height:26px><input id=c28 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>IP address</div></div><div style=height:26px id=70><input id=c29 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Subnet mark</div></div><div style=height:26px><input id=c30 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Gateway</div></div><div style=height:26px><input id=c31 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Primary DNS</div></div><div style=height:26px><input id=c32 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Alternate DNS</div></div></div></div></div><div id=dialog23 style=margin:auto;margin:3px><br><div style=height:26px><select id=c33 style=float:right;width:200px onchange=showEditDnsDlgChange()><option value=0>Disabled<option value=1>Disabled, DHCP update<option value=2>Enabled</select><div>Dynamic DNS client</div></div><div style=height:26px><input id=c34 style=float:right;width:200px><div>Update Interval (minutes)</div></div><div style=height:26px><input id=c35 style=float:right;width:200px><div>TTL (seconds)</div></div><div style=font-size:10px><br>Defaut Interval is 1440 minutes, Default TTL is 900 seconds.</div></div><div id=dialog24 style=margin:auto;margin:3px><br><div style=height:26px><select id=c36 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=2>Power up<option value=5>Power cycle<option value=8>Power down<option value=10>Reset<option value=999>Set boot options</select><div>Remote Command</div></div><div style=height:80px><div id=c37 style="float:right;border:1px solid #666;width:200px;height:72px;overflow-y:scroll;background-color:white"><div id=d24dBiosPause><input type=checkbox id=d24BiosPause onchange=showAdvPowerDlgChange()>BIOS Pause<br></div><div id=d24dBiosSecureBoot><input type=checkbox id=d24BiosSecureBoot onchange=showAdvPowerDlgChange()>Enforce Secure Boot<br></div><div id=d24dBiosSetup><input type=checkbox id=d24BiosSetup onchange=showAdvPowerDlgChange()>BIOS Setup<br></div><div id=d24dForceProgressEvents><input type=checkbox id=d24ForceProgressEvents onchange=showAdvPowerDlgChange()>Force progress events<br></div><div id=d24dLockPowerButton><input type=checkbox id=d24LockPowerButton onchange=showAdvPowerDlgChange()>Lock power button<br></div><div id=d24dLockResetButton><input type=checkbox id=d24LockResetButton onchange=showAdvPowerDlgChange()>Lock reset button<br></div><div id=d24dLockSleepButton><input type=checkbox id=d24LockSleepButton onchange=showAdvPowerDlgChange()>Lock sleep button<br></div><div id=d24dLockKeyboard><input type=checkbox id=d24LockKeyboard onchange=showAdvPowerDlgChange()>Lock keyboard<br></div><div id=d24dUserPasswordBypass><input type=checkbox id=d24UserPasswordBypass onchange=showAdvPowerDlgChange()>BIOS password bypass<br></div><div id=d24dReflashBios><input type=checkbox id=d24ReflashBios onchange=showAdvPowerDlgChange()>Reflash BIOS<br></div><div id=d24dSafeMode><input type=checkbox id=d24SafeMode onchange=showAdvPowerDlgChange()>Safe mode<br></div><div id=d24dUseIDER><input type=checkbox id=d24UseIDER onchange=showAdvPowerDlgChange()>Use IDER<br></div><div id=d24dSerialOverLan><input type=checkbox id=d24SerialOverLan onchange=showAdvPowerDlgChange()>Serial-over-LAN<br></div><div id=d24dSecureErase><input type=checkbox id=d24SecureErase onchange=showAdvPowerDlgChange()>Intel&reg; Remote Secure Erase<br></div></div><div>Boot Settings</div></div><div style=height:26px><select id=c38 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Force CD/DVD Boot<option value=2>Force PXE Boot<option value=3>Force Hard Disk Boot<option value=4>Force Diagnostic Boot</select><div>Boot Source</div></div><div style=height:26px><select id=c39 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Index 1<option value=2>Index 2<option value=3>Index 3<option value=3>Index 4</select><div>Boot Media Index</div></div><div style=height:26px id=idd_d24IDERBootDevice><select id=c40 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>Boot to floppy<option value=1>Boot to CDROM</select><div>IDER Boot Device</div></div><div style=height:26px><select id=c41 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>System Default<option id=c42 value=1>Quiet<option id=c43 value=2>Verbose<option id=c44 value=3>Blank Screen</select><div>Verbocity</div></div><div style=height:26px id=idd_d24RSEPass><div style=float:right;width:200px><input type=password id=d24rsepass maxlength="32" style=float:right;width:100%></div><div>RSE Password</div></div></div><div id=dialog25 style=margin:auto;margin:3px><div style=text-align:left><div style=height:26px;margin-top:4px><input id=d25alarm_name style=float:right;width:180px maxlength="32" onkeyup=alertDialogUpdate()><div style=padding-top:4px>Alarm name</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_sdate style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Wake date (year-month-day)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_stime style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,58)"></div><div style=padding-top:4px>Wake time (hour:min:sec)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_interval style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Interval (days-hours-min)</div></div><div style=height:26px;margin-top:4px><div style=float:right;width:180px><select id=d25alarm_doc style=width:100% onchange=showAdvPowerDlgChange()><option value=0>Keep alarm<option value=1>Delete on completion</select></div><div style=padding-top:4px>After wake</div></div></div></div></div><div style=padding:10px;margin-bottom:4px><input id=c45 type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)><input id=c46 type=button value=OK style=float:right;width:80px onclick=dialogclose(1)><div style=height:25px><input id=c47 type=button value=Delete style=width:80px;display:none onclick=dialogclose(2)></div></div></div><script>var $jscomp={scope:{},getGlobal:function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global?global:b}};$jscomp.global=$jscomp.getGlobal(this);$jscomp.initSymbol=function(){$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol);$jscomp.initSymbol=function(){}};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(b){return"jscomp_symbol_"+b+$jscomp.symbolCounter_++};
1 +<!DOCTYPE html><html style=height:100%><head><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8" http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link rel="icon" type=image/png href="data:image/png;base64,iVBORw0KGgo="><style>body{height:100%;max-height:100%;overflow:hidden;font-family:arial, helvetica, sans-serif;font-size:9pt;color:black;background:white;margin-top:0;margin-left:0;margin-right:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}li{margin:0;padding:0;}label{display:block;color:windowtext;background-color:window;margin:0;padding:0;width:100%;}label:hover{background-color:highlight;color:highlighttext;}a:visited{text-decoration:none;color:#04f;}a:link{text-decoration:none;color:#04f;}a:hover{color:#a32;}h1{font-size:11pt;font-weight:bold;color:black;margin-left:5px;margin-top:10px;margin-bottom:6px;}h2{font-size:9pt;font-weight:bold;color:black;margin-left:6px;margin-top:6px;margin-bottom:0;}p{margin-left:6px;margin-top:4px;margin-bottom:0;margin-right:2px;}td{font-size:9pt;}th{font-size:9pt;}th:hover{cursor:pointer;background:#aaa;}.header{position:fixed;top:0;left:0;right:0;height:24px;background:#c0c0c0;}.progressbar{position:fixed;top:24px;left:0;right:0;height:2px;background:#ff9e30;}.in{margin-left:40px;}.log{background:#bbbab5;}.log1{background:#bbbab5;}.log tbody tr:nth-child(odd){background:#e8eefe;}.fullcell{position:fixed;top:26px;right:0;bottom:0;left:0px;overflow:hidden;}.maincell{position:fixed;top:26px;right:0;bottom:0;left:156px;overflow:auto;padding-left:2px;vertical-align:top;}.navbar{position:fixed;top:26px;left:0;bottom:0;width:156px;border-right:2px solid #ff9e30;vertical-align:top;background:#72726f;background:linear-gradient(45deg, #72726f 0%,#a6a5a0 100%);}.nav1{padding:1px 0px 1px 8px;margin:0px;font-weight:bold;color:black;white-space:nowrap;cursor:pointer;}.nav2{margin-left:32px;margin-top:0;color:black;cursor:pointer;}.r{font-size:11pt;}.r0{background:white;}.r1{border-bottom:1px solid gray;text-align:left;}.r2{text-align:left;}.r3{border-bottom:1px solid gray;text-align:left;}.r3:hover{background-color:#83827b;cursor:pointer;}.spread{height:100%;width:100%;background-color:white;}.timer{border:1px solid #abcae1;background-color:#abcae1;}.tm{font-size:7pt;}.top1{font-size:14pt;font-weight:bold;color:white;margin-top:11px;}.top2{color:white;}.warn{font-weight:bold;color:#c00000;}.icon1{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMISURBVHjadJPPb9t0GMY//rbJaEKSxoPFQQ1WxhQ7RaGoIDEpTBMqgk7iBvwNKJdJXDnssEMl7pMGfwOH9YBYh0AglYiBBNKa0cSGNpiRxs7aJE2aH7aTmkPXqTvwXt7L8z56pef5SEEQcHYMwyjWarX3rLr1tu3YOQAlpZhqVv1J1/VvNU0rn9VLpwbtdlspb5ZLNdNcuZBKF1NKmuS8DECn28axm7ScZlnP5b4vXinelmXZfmrQbreVjbsbN3r9YSmTLbA/Ps92K8FgFAbAdYcsLXRRk10af/9BPBa5vXpt9aYsy7YAKG+WS73+sJS+eJmKneZe5QWEiHHreoJb1xNEInHu/Bzw3cM45zNv0usPS+XNcglAGIZRrJnmSiZbYOtRhF93ZvHcHoPRlN3GkL4Ho5HHeOxRqbv8sHVM+uVFaqa5YhhGUVpfXw+6hwP86DJ3fgkzK44hOGZuLkH7KIQIxuw9dkk812Hqu0wmPh9djZIKG8wnogirbpFS0jy0YOqPcMcurjvh3Vc7fPHpHF9//iLLyja75p/sNWxazj73t9qklDRW3ULYjk1yXmb3Xw/P9fA9n35/AMD0yAIgGQ8zOtxnMhFM/ClG/YjkvIzt2Mye5un5Lr4HY9el5RwA2tOsY9FzCCFBICCYOdlPRigphU63jZKEwWDAweMDJt7kmXINBhOkIEAQQiLMpczzJzcpBaFmVRy7iZ4RdA/7TKcBknTymOd5APT6PiAhghlmpHO8ocdw7CZqVkXour7Ycppriwsuy7koEgKQANDy+dPCIokQkhTiciFG4aJPy2mu6bq+OKtpWlXPmZWGtc2H77yOhOD+gxE7//T45sdHzEjQ7Y0IgmPeKszxwdUwTuM39Fyuomla9bTKyY27Gx/3+sMvlYU8lXqI36sef+1UkCS4pMZZyuu89oqL09gmHot8snpt9StZljtnYUqWN8vv10yzcCGV/ux/YFrTc7lK8UrxnizLnWdoPINzvlarLVl1K2879ktPcN5Ts2pV1/UHmqZVz+r/GwBWYYCoNUz0KwAAAABJRU5ErkJggg==");}.icon2{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAIuSURBVHjalJNBTBNBFIb/2S4tlliFdLBNW0mktibaeivBm9eejFeDZw81kROXHj2SyIEDB65wI3iBI5iYmEjSREtIpI1tQdOm20KBdkuX3ZnnYUVq2Cb6kklm3vxv3vdm3oCI4DTazZ3p3HpM5NZjot3cmR6kY0QEJ9vdnNJcaoMP3xyB3vI2EunP4046xcl5WttK99olHn4URSA2AaNT5qe1rbST1pFgd3NKU93H/P6TJADg8GthIMU1gqODtZlep8QjiegfXzBuUxwdrM1cy9Z/IVIYSn4jpe1vx8jsviAABIBM/Tl9/5Sg/EZKk8JQ+mP+ImiUVjJGp8xDDycB2b1KIgSC0RCMTpk3SisZxxKkpXvqhaXs7aAfnhtukBBXKmFCHVLgj4yjXljKSkv3XDugXlyeM/QKDz24CxIWSJhXBKYJMk2MT3AYeoXXi8tzl3sqAFgXLV+zvJrxhzkUqwdxQQARZl+FbbqeXY7CGHjEj2Z5NcMnXy6o7tEzRkT4mX/7Tisuvok/joBJC5ACl8/LmAIov0EVBZIYvn35gUD89UI4mZ1lRrca2N9+lh8bPeG3RgCyTEBKgAi+1CEAoJ27B6gqGGMAY2idCbRORhvxp++TanVvviaMQ/g8XshzAxACIIn+/pLGOWAqYIoLAODzuKB1K7y6N19j+Y0U3fG3MCw6IMsCyM4Oxvob1l4ze84YQ5u8OD7jUNWhMXz4uI//tx4Syfjg3/iv9msAKbs79bi84QcAAAAASUVORK5CYII=");}.icon3{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAANGSURBVHjadJNNTBwFAIW//UFWfrbsgDuzBTvu0s6OWhHwYMhCOEAbSESC4dpL07TFg9GkxIRDjT3YhEBNPUjC0SbaJjVNQyJQaxtDpzYmlDYUOjuUrhspO0N0gQVWl/0ZD5ZmPfiSd3t5l/c+h23bFCsajR7Rdf1GPBbHtEwAJFFCDsqoqno0HA7/WJx37BUkk8k6bUYb0g2jxy8G6kQpgK9KAGB9I4llJlizEiuqokxE2iJfCIKw8qIgmUzWTU1OfZXaSve9KQep3tzA9fQJhfhvZHd3yfl85OUg26F6os9W8FaWXevq7vpIEIQVJ4A2ow2lttJ9LTU1hH64Tt1qHHv8a0rnH/LS4iPsK9/iixnUXr1Ck3cfqa10nzajDQG4o9HoEd0wet493Ij/zm18n3yMJxQivbND7Px58thUD3xI+egoBcMgd+FLlO73mTUWe5Ro9Jqrs7Nz2eUu9YbSacriT8lms5Q3NlLR3s6uaVJQFISRC1SUuFm9dInJ6WlCfpGMFPBub6eOueOxOMobb+H4+Ta/f3cZz927FPJ5hOPHqRkZgT/+xFniIjY6yveDg0gOB9l6BbHpBMbiPE7TMvFVCWSXl3DU7secnWXu9GniFy+ymctRIfhYHxvj6pkzBG2bA0Du8SN8VQKmZeLc2zOXybA2P8+mbeNpbydTWUmJ203etvGIInV+PxVA9t/pXvzALYkS6xtJqoRq/rJtqoNB/KdO8Up/P+atWxSA8t5e3vN6mT55kgOrq5TUH2J9I4kkSjjloIxlJiiEDiK2tREYHkbq7yd57x6XOzr4paMD59IS+7q7+WB8nPtuNyVN72CZCeSgjFNV1dY1K6H9fbiBDWk/uwsL5G7e5JuWFhTgVUBrbmZX11memyMgv0a64W3WrISmqmqrw7ZtJq5PfP4sYZ0Nl5ayPjJM4fECKdtGAF5+bt3pxBt+HWXwU37NZKgNiOd6ens+27uyNDU5dTa1lR44JAXwPHiA/fA++ScGTsB1UMHV1MxOQyOGmcBbWTbW1d11ThAEsxgmSZvRBnTD6PCLgcj/wKSpivJTpC0yJgiC+R8ai3CO6Lp+NB6Lt5qWqTzH2ZCD8h1VVW+Ew2GtOP/PAFZGexs+cGPjAAAAAElFTkSuQmCC");}.itemBar{padding:7px;min-height:20px;margin-top:4px;margin-right:8px;width:auto;border-radius:8px;background-color:#7e7d74;cursor:pointer;}.computeritem{cursor:pointer;width:auto;border-radius:5px;background-color:#a6a5a0;height:28px;margin:4px;padding:2px;}.computeritem:hover{background-color:#83827b;}.us{-webkit-touch-callout:initial;-webkit-user-select:auto;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}.rb{cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.fsize{float:right;text-align:right;width:180px;}</style><body onunload="cleanup()"><div id=0 class=header><table id=1 cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td id=2 class=style6><div>&nbsp;<input type=button class=connectbutton id=xconnectbutton1 value=Connect onclick="connectButtonfunction(event, false)" onkeypress="return false" onkeydown="return false">&nbsp;<span id=constatus></span></div></table><div class=progressbar><div id=3 style=height:2px;width:0%;background-color:red></div></div></div><div id=4 class=fullcell style=text-align:center;padding-top:100px;font-size:20px><span id=5>Disconnected</span></div><div id=6 style=height:100%;display:none><div id=7 class=navbar><br><p id=go1 class=nav1 onclick=go(1)><a>System Status</a><p id=go14 class=nav1 onclick=go(14)><a>Remote Desktop</a><p id=go24 class=nav1 onclick=go(24)>&nbsp;&nbsp;<a>Files</a><p id=go13 class=nav1 onclick=go(13)><a>Serial-over-LAN</a><p id=go2 class=nav1 onclick=go(2)><a>Hardware Information</a><p id=go6 class=nav1 onclick=go(6)><a>Event Log</a><p id=go15 class=nav1 onclick=go(15)><a>Audit Log</a><p id=go21 class=nav1 onclick=go(21)><a>Storage</a><p id=go8 class=nav1 onclick=go(8)><a>Network Settings</a><p id=go17 class=nav1 onclick=go(17)><a>Internet Settings</a><p id=go16 class=nav1 onclick=go(16)><a>Security Settings</a><p id=go19 class=nav1 onclick=go(19)><a>Agent Presence</a><p id=go18 class=nav1 onclick=go(18)><a>System Defense</a><p id=go11 class=nav1 onclick=go(11)><a>User Accounts</a><p id=go22 class=nav1 onclick=go(22)><a>Subscriptions</a><p id=go23 class=nav1 onclick=go(23)><a>Wake Alarms</a><p id=go20 class=nav1 onclick=go(20)><a>Script Editor</a><p id=go12 class=nav1 onclick=go(12)><a>WSMAN Browser</a></div><div id=8 class=maincell><div id=9 style=position:relative;height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=float:right><input type=button value="Disk Map" onclick=iderToggleDiskMap()><input type=button value="Stop IDE-R Session" onclick=iderStop()></div><div style=font-size:16px;padding-top:2px>&nbsp;<b>IDE-R Session</b><span id=10></span></div><div id=iderHeatmap style="z-index:1000;position:absolute;top:31px;right:8px;border:1px solid black;box-shadow:0px 0px 10px;border-radius:5px;padding:8px;width:600px;background-color:#99CC99;display:none"><div id=floppyHeatMap style=display:none><div id=floppyHeatMapText style=margin:2px>Floppy, blocks are 512 bytes.</div><canvas id=floppyHeatMapCanvas width=600 height=0></canvas></div><div id=cdromHeatMap style=display:none><div id=cdromHeatMapText style=margin:2px>CDROM, blocks are 2048 bytes.</div><canvas id=cdromHeatMapCanvas width=600 height=0></canvas></div></div></div><div id=11 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none;overflow:hidden><div style=float:right><input type=button value="Stop Script" onclick=script_Stop()></div><div style=font-size:16px;padding-top:2px;overflow:hidden>&nbsp;<b>Running Script</b><span style=overflow:hidden id=12></span></div></div><div id=13 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=font-size:16px;float:right;cursor:pointer;padding-right:5px;padding-left:5px;padding-top:2px;font-size:15px onclick="QV(13, false)">&#x2716;</div><div style=font-size:14px;padding-top:2px>&nbsp;<b>This computer's firmware should be updated,&nbsp;<a style=cursor:pointer href="https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00075&languageid=en-fr" rel="noreferrer noopener" target="_blank"><u>please check here</u></a>.</b></div></div><div id=14 style=width:100%;height:100%><iframe id=15 style=width:100%;height:100%;border:0></iframe></div><div id=16 style=padding:8px;overflow-x:hidden><div id=p0><h1>Loading...</h1></div><div id=p1 style=display:none><h1>System Status</h1><span id=17></span></div><div id=p2 style=display:none><h1 style=margin-bottom:16px>Hardware Information</h1><span id=18></span></div><div id=p6 style=display:none><h1>Event Log</h1><span id=19></span><span id=20></span></div><div id=p8 style=display:none><h1>Network Settings</h1><span id=21></span><span id=22></span></div><div id=p11 style=display:none><h1>User Accounts</h1><span id=23></span></div><div id=p12 style=display:none><h1>WSMAN Browser</h1><div><table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><div style=padding:4px><select id=24 multiple="multiple" style=width:100%;height:120px></select></div><tr><td><input id=25 type=button value=Query style=margin:4px onclick=wsmanQuery()><input type=button value=Clear style=margin:4px onclick="QH(26, '')"><input id=c0 placeholder=Filter style=margin:4px onkeyup=wsmanFilter()></table></div><br><div class=us id=26></div></div><div id=p13 style=display:none;min-width:780px><h1>Serial-over-LAN Terminal</h1><br><div id=27 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showFeaturesDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Intel&reg; AMT Redirection port or Serial-over-LAN feature is disabled<span id=28>, click here to enable it.</span></div></div><div id=29 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showPowerActionDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Remote computer is not powered on, click here to issue a power command.</div></div><table cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><input onkeyup=sendTermInputKeys(event) autocorrect=off autocapitalize=off style=opacity:0;width:0;height:0;font-size:1px onblur="keyInputBlur()"><span id=30></span>&nbsp;<input type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Power Actions..." onclick=showPowerActionDlg() style=margin-right:3px><input type=button id=c1 value="Server IDE-R" title="Start server-side remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderServerStart() style=margin-right:3px><input type=button id=c2 value=IDER title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart() style=margin-right:3px><input id=c3 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Start Capture" title="Toggle start/stop of terminal capture, when stopping the content of the capture buffer will be saved to a file." onclick=terminalCaptureToggle() style=margin-right:3px></div><div>&nbsp;<input type=button id=c4 value=Connect onclick=connectTerminal(event) disabled="disabled">&nbsp;<span id=31>Disconnected.</span></div><tr><td style=background:#000;text-align:center><pre id=Term></pre><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><input id=32 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value=CR+LF title="Toggle what the return key will send" onclick=termToggleCr()><input id=33 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=80x25 title="Toggle terminal size" onclick=termToggleSize()><input id=34 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick=termToggleFx()><input id=35 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Extended Ascii" title="Toggle terminal emulation type" onclick=termToggleType()>&nbsp;</div><div>&nbsp;<input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-C onclick=termSendKey(3)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-X onclick=termSendKey(24)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=ESC onclick=termSendKey(27)><input type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Backspace onclick=termSendKey(8)><input id=36 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value=Paste disabled="disabled" onclick="setDialogMode(3,'Paste',3,termPaste)"></div></table></div><div id=p14 style=display:none;min-width:780px><div id=37><h1>Remote Desktop</h1><br></div><div id=38 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showFeaturesDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Intel&reg; AMT Redirection port or KVM feature is disabled<span id=39>, click here to enable it.</span></div></div><div id=40 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showPowerActionDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Remote computer is not powered on, click here to issue a power command.</div></div><table cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><span id=41></span>&nbsp;<div class=rb title="Rotate Left" onclick=drotate(-1)>&olarr;</div><div class=rb title="Rotate Right" onclick=drotate(1)>&orarr;</div><input id=c5 type=button title="Toggle full screen mode" onkeypress="return false" onkeydown="return false" value=Full onclick=deskToggleFull() style=margin-right:3px><input id=c6 type=button title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value=Save... onclick=deskSaveImage() style=margin-right:3px><input type=button value=Settings... title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick=showDesktopSettings() style=margin-right:3px><input type=button id=c7 value="Server IDE-R" title="Start server-side remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderServerStart() style=margin-right:3px><input type=button id=c8 value=IDE-R title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart() style=margin-right:3px><input type=button title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick=showPowerActionDlg() style=margin-right:3px></div><div><div id=c9 onclick=deskToggleFull() style=float:left;cursor:pointer;font-size:15px;display:none>&nbsp;&#x2716;</div>&nbsp;<input type=button id=c10 value=Connect onclick=connectDesktop(event) onkeypress="return false" onkeydown="return false" disabled="disabled">&nbsp;<span id=42>Disconnected.</span></div><tr><td id=43 style=background:black;text-align:center;position:relative><canvas id=Desk width=640 height=400 style=-ms-touch-action:none;margin-left:0px oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel="dmousewheel(event)" moz-opaque=""></canvas><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div id=44 style=float:right></div><div>&nbsp;<span id=deskkeysspan><select style=margin-left:6px id=deskkeys><option value=0>Win<option value=1>Win+Down<option value=2>Win+Up<option value=3>Win+L<option value=4>Win+M<option value=5>Shift+Win+M<option value=6>F1<option value=7>F2<option value=8>F3<option value=9>F4<option value=10>F5<option value=11>F6<option value=12>F7<option value=13>F8<option value=14>F9<option value=15>F10<option value=16>F11<option value=17>F12</select><input id=DeskWD type=button value=Send onkeypress="return false" onkeydown="return false" onclick=deskSendKeys()>&nbsp;</span><input id=45 type=button value=Ctrl-Alt-Del onkeypress="return false" onkeydown="return false" onclick=sendCAD()>&nbsp;<span id=46><input id=47 type=checkbox>Blank Screen&nbsp;</span><span id=48><input id=49 type=checkbox>View only&nbsp;</span></div></table></div><div id=p15 style=display:none><span id=50></span><h1>Audit Log</h1><span id=51></span></div><div id=p16 style=display:none><h1>Security Settings</h1><span id=52></span></div><div id=p17 style=display:none><h1>Internet Settings</h1><span id=53></span></div><div id=p18 style=display:none><h1>System Defense</h1><span id=54></span></div><div id=p19 style=display:none><h1>Agent Presence</h1><span id=55></span></div><div id=p20 style=display:none><h1>Script Editor</h1><div class=log1 style=padding:5px;border-radius:5px><div id=EditScriptStatus style=float:right;font-weight:bold;padding:5px>Stopped</div><div><input type=button value="View Editor" title="Switch to script line editor view" id=viewEditorButton onclick=scriptViewButton(0)><input type=button value="View Builder" title="Switch to block editor view" id=viewBuilderButton onclick=scriptViewButton(1)><input type=button value=New... title="Clear the script editor" onclick=script_newScriptDlg()><input type=button value=Load... title="Load a script from file" onclick=script_runScriptDlg()><input type=button value=Save... title="Save a script to file" onclick=script_saveScript(event)><input type=button value=Restart title="Compile the script and get ready to run it from the start" onclick=resetScriptButton()><input type=button value=Continue title="Run the script from the current execution point" onclick=runScriptButton()><input type=button value=Break title="Pause the execution of the script" onclick=breakScriptButton()><input type=button value=Step title="Execute one step of the script" onclick=stepScriptButton()></div></div><div id=scriptbuilder style=display:none><h2>Script Builder</h2><div style=padding:0;margin:0><div style=width:250px;height:400px;float:left;padding:0;margin:0;padding-right:3px><input id=blockfilter style="width:inherit;height:24px;padding:0;margin:0;border:1px solid gray;margin-bottom:1px" placeholder="Filter blocks..." onkeyup=script_fonfilterchanged()><div id=blocks style="width:inherit;height:373px;border:1px solid gray;overflow-y:scroll;padding:0;margin:0"></div></div><div id=scriptblocks style="width:auto;height:400px;padding:0;margin:0;border:1px solid gray;overflow-y:scroll" ondrop="script_fondrop(event, this)" onclick=script_fonclick(event)></div></div></div><div id=scripteditor><h2>Script</h2><textarea id=scriptarea style=width:100%;height:176px;resize:vertical;margin:0;padding:0;font-family:Arial,Helvetica,sans-serif spellcheck="false"></textarea><div style=display:none><br><h2>Compiled Script</h2><textarea id=compiledarea style=width:100%;height:16px;resize:vertical;margin:0;padding:0 spellcheck="false"></textarea><br></div><h2>Variables</h2><div id=variables style="width:100%;height:200px;resize:vertical;border:1px solid gray;overflow:scroll;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text"></div></div><h2>Console</h2><textarea id=console style=width:100%;height:80px;resize:vertical;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text readonly=""></textarea></div><div id=p21 style=display:none><h1>Storage</h1><span id=56></span></div><div id=p22 style=display:none><h1>Event Subscriptions</h1><span id=57></span></div><div id=p23 style=display:none><h1>Wake Alarms</h1><span id=58></span></div><div id=p24 style=display:none;position:absolute;top:0px;bottom:0px;left:8px;right:24px><h1>Files</h1><br><table id=p24toolbar style=width:100%;position:absolute;top:35px cellpadding=0 cellspacing=0><tr><td style=width:100%;background-color:#d3d9d6;text-align:left;padding:4px valign="bottom"><div id=p24rightOfButtons style=float:right;margin-top:3px></div><div><input type=button id=p24FolderUp disabled="disabled" onclick=p24folderup() value=Up>&nbsp;<input type=button id=p24SelectAllButton disabled="disabled" onclick=p24selectallfile() value="Select All" onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24RenameFileButton disabled="disabled" value=Rename onclick=p24renamefile() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24DeleteFileButton disabled="disabled" value=Delete onclick=p24deletefile() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24NewFolderButton disabled="disabled" value="New Folder" onclick=p24createfolder() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24UploadButton disabled="disabled" value=Upload onclick=p24uploadFile() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24CutButton disabled="disabled" value=Cut onclick=p24copyFile(1) onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24CopyButton disabled="disabled" value=Copy onclick=p24copyFile(0) onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24PasteButton disabled="disabled" value=Paste onclick=p24pasteFile() onkeypress="return false" onkeydown="return false">&nbsp;<input type=button id=p24RefreshButton disabled="disabled" value=Refresh onclick=p24folderup(9999) onkeypress="return false" onkeydown="return false">&nbsp;</div><tr><td style=background-color:#E4E9E7;height:28px><div style=float:right;margin-right:4px><select id=p24sortdropdown onchange=p24updateFiles()><option value=1 selected="selected">Sort by name<option value=2>Sort by size<option value=3>Sort by date<option value=4>Descend by name<option value=5>Descend by size<option value=6>Descend by date</select></div><div>&nbsp;&nbsp;<span id=p24currentpath></span></div></table><div id=p24filetable style=width:100%;overflow:auto;-webkit-user-select:none;position:absolute;top:92px;bottom:30px><div id=p24bigok style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>&checkmark;</b></div><div id=p24bigfail style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>&#10007;</b></div><span id=p24files></span></div><table id=p24toolbarBottom style=width:100%;position:absolute;bottom:10px cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px;text-align:center;background-color:#D3D9D6>&nbsp;<span id=p24bottomstatus></span></table></div></div></div></div><div id=dialog style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial, Helvetica, sans-serif;border-radius:5px;position:fixed;overflow:auto;top:75px;width:400px;max-height:550px;display:none"><div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"><div id=59 style=float:right;padding:1px;margin-right:5px;cursor:pointer;font-size:15px onclick=setDialogMode()>&#x2716;</div><div id=60 style=padding:5px></div><div style=width:100%;margin:6px></div></div><div style=margin-right:16px;margin-left:8px><div id=dialog1 style=margin:auto;text-align:center;margin:3px><div id=61 style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><br><div style=height:26px><input id=d2username style=float:right;width:200px onkeyup=updateAccountDialog()><div>Username</div></div><div style=height:26px><input id=d2password1 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Password*</div></div><div style=height:26px><input id=d2password2 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Confirm Password</div></div><div id=62><div style=height:26px><select id=d2permission style=float:right;width:200px><option value=0>Local<option value=1>Network<option value=2>Any</select><div>Permission</div></div><div>Granted Permissions</div><ul id=63 style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0"></ul></div><div style=font-size:10px><br>*Minimum 8 characters with upper, lowercase, 0-9, and one of !@#$%^&amp;*()+-</div></div><div id=dialog3 style=margin:auto;text-align:center;margin:3px><textarea id=d3pastetextarea maxlength="4096" style=width:100%;height:200px;resize:none></textarea></div><div id=dialog5 style=margin:auto;margin:3px><br><div style=height:26px><select id=d5actionSelect style=float:right;width:200px></select><div>Power Action</div></div><div><span style=color:red>Warning:</span>Some power actions may result in data loss and may disconnect the desktop, terminal or disk redirection sessions.</div></div><div id=dialog6 style=margin:auto;margin:3px><br><div style=height:26px><input id=d6ConsentText style=float:right;width:200px maxlength="6" onkeyup=consentChanged() onkeypress="return numbersOnly(event)"><div>Consent Code</div></div><div style=height:26px><select id=d6Display onchange=changeConsentDisplay() style=float:right;width:200px><option value=0>Primary display<option value=1>Secondary display<option id=d6ThirdDisplay value=2 style=display:none>Third display</select><div>Consent Display</div></div></div><div id=dialog7 style=margin:auto;margin:3px><br><div style=height:26px><select id=c11 style=float:right;width:200px><option value=1>RLE8, Fastest<option value=2>RLE16, Recommended<option value=3>RAW8, Slow<option value=4>RAW16, Very Slow</select><div>Image Encoding</div></div><div style=height:80px><div style="float:right;border:1px solid #666;width:200px;height:80px;overflow-y:scroll;background-color:white"><input type=checkbox id=d7showcursor>Show Local Mouse Cursor<br><input type=checkbox id=d7showcad>Show Ctrl-Alt-Del<br><input type=checkbox id=d7limitFrameRate>Limit Frame Rate<br><input type=checkbox id=d7noMouseRotate>Don't Rotate Mouse<br></div><div>Other Settings</div></div><div id=d7softkvmsettings style=display:none><h4 style="width:100%;border-bottom:1px solid gray">Software KVM</h4><div style="margin:3px 0 3px 0"><select id=d7bitmapquality style=float:right;width:200px;height:20px dir="rtl"><option value=50>50%<option value=40>40%<option selected="selected" value=30>30%<option value=20>20%<option value=10>10%<option value=5>5%<option value=1>1%</select><div style=height:20px>Quality</div></div><div style="margin:3px 0 3px 0"><select id=d7bitmapscaling style=float:right;width:200px;height:20px dir="rtl"><option selected="selected" value=1024>100%<option value=896>87.5%<option value=768>75%<option value=640>62.5%<option value=512>50%<option value=384>37.5%<option value=256>25%<option value=128>12.5%</select><div style=height:20px>Scaling</div></div></div></div><div id=dialog8 style=display:table;margin:3px><div style="margin:3px 0 3px 0;padding-top:5px"><input id=c12 value=admin style=float:right;width:220px><div style=height:20px>Username</div></div><div style="margin:3px 0 3px 0"><input id=c13 type=password autocomplete="off" style=float:right;width:220px><div style=height:20px>Password</div></div></div><div id=dialog9 style=margin:auto;margin:3px><input type=checkbox id=c14>Redirection Port<br><div id=c15><input type=checkbox id=c16>KVM Remote Desktop<br></div><input type=checkbox id=c17>IDE-Redirection<br><input type=checkbox id=c18>Serial-over-LAN<br></div><div id=dialog10 style=margin:auto;margin:3px><input type=radio name=d10 id=c19 value=0>Not Required<br><input type=radio name=d10 id=c20 value=1>Required for KVM only<br><input type=radio name=d10 id=c21 value=4294967295>Always Required<br></div><div id=dialog11 style=margin:auto;margin:3px><div id=64></div></div><div id=dialog12 style=margin:auto;margin:3px><br><div style=height:26px><input id=c22 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">Profile Name</div></div><div style=height:26px><input id=c23 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">SSID</div></div><div style=height:26px><select id=c24 style=float:right;width:200px onclick=updateWifiDialog()></select><div>Priority</div></div><div style=height:26px><select id=c25 style=float:right;width:200px onclick=updateWifiDialog()><option value=6>WPA2 PSK<option value=4>WPA PSK</select><div>Authentication</div></div><div style=height:26px><select id=c26 style=float:right;width:200px onclick=updateWifiDialog()><option id=65 value=4>CCMP-AES<option id=66 value=3>TKIP-RC4<option id=67 value=2>WEP<option id=68 value=5>None</select><div>Encryption</div></div><div style=height:26px><input id=c27 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Password*</div></div><div style=height:26px><input id=c28 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Confirm Password</div></div></div><div id=dialog19 style=margin:auto;margin:3px>This will save the entire state of Intel&reg; AMT for this machine into file. Passwords will not be saved, but some sensitive data may be included.<br><br><input id=c29 style=width:100% value=amtstate.json></div><div id=dialog20 style=margin:auto;margin:3px><input type=radio name=d20 id=d20a value=0>Disabled<br><input type=radio name=d20 id=d20b value=1>ICMP response<br><input type=radio name=d20 id=d20c value=2>RMCP response<br><input type=radio name=d20 id=d20d value=3>ICMP & RMCP response<br><br></div><div id=dialog21 style=margin:auto;margin:3px><input type=radio name=d21 id=d21o0 onclick=updateIPSetupDlg()><span id=d21l0></span><br><input type=radio name=d21 id=d21o1 onclick=updateIPSetupDlg()><span id=d21l1></span><br><div id=69><input type=radio name=d21 id=d21o2 onclick=updateIPSetupDlg()><span id=d21l2></span><br><br><div style=margin-left:20px><div style=height:26px><input id=c30 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>IP address</div></div><div style=height:26px id=70><input id=c31 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Subnet mark</div></div><div style=height:26px><input id=c32 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Gateway</div></div><div style=height:26px><input id=c33 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Primary DNS</div></div><div style=height:26px><input id=c34 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Alternate DNS</div></div></div></div></div><div id=dialog23 style=margin:auto;margin:3px><br><div style=height:26px><select id=c35 style=float:right;width:200px onchange=showEditDnsDlgChange()><option value=0>Disabled<option value=1>Disabled, DHCP update<option value=2>Enabled</select><div>Dynamic DNS client</div></div><div style=height:26px><input id=c36 style=float:right;width:200px><div>Update Interval (minutes)</div></div><div style=height:26px><input id=c37 style=float:right;width:200px><div>TTL (seconds)</div></div><div style=font-size:10px><br>Defaut Interval is 1440 minutes, Default TTL is 900 seconds.</div></div><div id=dialog24 style=margin:auto;margin:3px><br><div style=height:26px><select id=c38 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=2>Power up<option value=5>Power cycle<option value=8>Power down<option value=10>Reset<option value=999>Set boot options</select><div>Remote Command</div></div><div style=height:80px><div id=c39 style="float:right;border:1px solid #666;width:200px;height:72px;overflow-y:scroll;background-color:white"><div id=d24dBiosPause><input type=checkbox id=d24BiosPause onchange=showAdvPowerDlgChange()>BIOS Pause<br></div><div id=d24dBiosSecureBoot><input type=checkbox id=d24BiosSecureBoot onchange=showAdvPowerDlgChange()>Enforce Secure Boot<br></div><div id=d24dBiosSetup><input type=checkbox id=d24BiosSetup onchange=showAdvPowerDlgChange()>BIOS Setup<br></div><div id=d24dForceProgressEvents><input type=checkbox id=d24ForceProgressEvents onchange=showAdvPowerDlgChange()>Force progress events<br></div><div id=d24dLockPowerButton><input type=checkbox id=d24LockPowerButton onchange=showAdvPowerDlgChange()>Lock power button<br></div><div id=d24dLockResetButton><input type=checkbox id=d24LockResetButton onchange=showAdvPowerDlgChange()>Lock reset button<br></div><div id=d24dLockSleepButton><input type=checkbox id=d24LockSleepButton onchange=showAdvPowerDlgChange()>Lock sleep button<br></div><div id=d24dLockKeyboard><input type=checkbox id=d24LockKeyboard onchange=showAdvPowerDlgChange()>Lock keyboard<br></div><div id=d24dUserPasswordBypass><input type=checkbox id=d24UserPasswordBypass onchange=showAdvPowerDlgChange()>BIOS password bypass<br></div><div id=d24dReflashBios><input type=checkbox id=d24ReflashBios onchange=showAdvPowerDlgChange()>Reflash BIOS<br></div><div id=d24dSafeMode><input type=checkbox id=d24SafeMode onchange=showAdvPowerDlgChange()>Safe mode<br></div><div id=d24dUseIDER><input type=checkbox id=d24UseIDER onchange=showAdvPowerDlgChange()>Use IDER<br></div><div id=d24dSerialOverLan><input type=checkbox id=d24SerialOverLan onchange=showAdvPowerDlgChange()>Serial-over-LAN<br></div><div id=d24dSecureErase><input type=checkbox id=d24SecureErase onchange=showAdvPowerDlgChange()>Intel&reg; Remote Secure Erase<br></div></div><div>Boot Settings</div></div><div style=height:26px><select id=c40 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Force CD/DVD Boot<option value=2>Force PXE Boot<option value=3>Force Hard Disk Boot<option value=4>Force Diagnostic Boot</select><div>Boot Source</div></div><div style=height:26px><select id=c41 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Index 1<option value=2>Index 2<option value=3>Index 3<option value=3>Index 4</select><div>Boot Media Index</div></div><div style=height:26px id=idd_d24IDERBootDevice><select id=c42 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>Boot to floppy<option value=1>Boot to CDROM</select><div>IDER Boot Device</div></div><div style=height:26px><select id=c43 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>System Default<option id=c44 value=1>Quiet<option id=c45 value=2>Verbose<option id=c46 value=3>Blank Screen</select><div>Verbocity</div></div><div style=height:26px id=idd_d24RSEPass><div style=float:right;width:200px><input type=password id=d24rsepass maxlength="32" style=float:right;width:100%></div><div>RSE Password</div></div></div><div id=dialog25 style=margin:auto;margin:3px><div style=text-align:left><div style=height:26px;margin-top:4px><input id=d25alarm_name style=float:right;width:180px maxlength="32" onkeyup=alertDialogUpdate()><div style=padding-top:4px>Alarm name</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_sdate style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Wake date (year-month-day)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_stime style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,58)"></div><div style=padding-top:4px>Wake time (hour:min:sec)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_interval style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Interval (days-hours-min)</div></div><div style=height:26px;margin-top:4px><div style=float:right;width:180px><select id=d25alarm_doc style=width:100% onchange=showAdvPowerDlgChange()><option value=0>Keep alarm<option value=1>Delete on completion</select></div><div style=padding-top:4px>After wake</div></div></div></div></div><div style=padding:10px;margin-bottom:4px><input id=c47 type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)><input id=c48 type=button value=OK style=float:right;width:80px onclick=dialogclose(1)><div style=height:25px><input id=c49 type=button value=Delete style=width:80px;display:none onclick=dialogclose(2)></div></div></div><script>var $jscomp={scope:{},getGlobal:function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global?global:b}};$jscomp.global=$jscomp.getGlobal(this);$jscomp.initSymbol=function(){$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol);$jscomp.initSymbol=function(){}};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(b){return"jscomp_symbol_"+b+$jscomp.symbolCounter_++};
2 $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();$jscomp.global.Symbol.iterator||($jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));$jscomp.initSymbolIterator=function(){}};
3 $jscomp.makeIterator=function(b){$jscomp.initSymbolIterator();if(b[$jscomp.global.Symbol.iterator])return b[$jscomp.global.Symbol.iterator]();if(!(b instanceof Array||"string"==typeof b||b instanceof String))throw new TypeError(b+" is not iterable");var c=0;return{next:function(){return c==b.length?{done:!0}:{done:!1,value:b[c++]}}}};$jscomp.arrayFromIterator=function(b){for(var c,a=[];!(c=b.next()).done;)a.push(c.value);return a};
4 $jscomp.arrayFromIterable=function(b){return b instanceof Array?b:$jscomp.arrayFromIterator($jscomp.makeIterator(b))};$jscomp.arrayFromArguments=function(b){for(var c=[],a=0;a<b.length;a++)c.push(b[a]);return c};
@@ -11,97 +11,100 @@ function ObjectToStringEx(b,c){var a="";if(0!=b&&(!b||null==b))return"(Null)";if
11 function ObjectToStringEx2(b,c){var a="";if(0!=b&&(!b||null==b))return"(Null)";if(b instanceof Array)for(var d in b)a+="\r\n"+gap2(c)+"Item #"+d+": "+ObjectToStringEx2(b[d],c+1);else if(b instanceof Object)for(d in b)a+="\r\n"+gap2(c)+d+" = "+ObjectToStringEx2(b[d],c+1);else a+=EscapeHtml(b);return a}function gap(b){for(var c="",a=0;a<4*b;a++)c+="&nbsp;";return c}function gap2(b){for(var c="",a=0;a<4*b;a++)c+=" ";return c}function ObjectToString(b){return ObjectToStringEx(b,0)}
12 function ObjectToString2(b){return ObjectToStringEx2(b,0)}function hex2rstr(b){if("string"!=typeof b||0==b.length)return"";var c="";b=(""+b).match(/../g);for(var a;a=b.shift();)c+=String.fromCharCode("0x"+a);return c}function char2hex(b){return(b+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++)c+=char2hex(b.charCodeAt(a));return c}function encode_utf8(b){return unescape(encodeURIComponent(b))}
13 function decode_utf8(b){return decodeURIComponent(escape(b))}function data2blob(b){for(var c=Array(b.length),a=0;a<b.length;a++)c[a]=b.charCodeAt(a);return new Blob([new Uint8Array(c)])}function random(b){return Math.floor(Math.random()*b)}function trademarks(b){return b.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}
14 -var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}function c(c,y,d,D){switch(y.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.floppyReady)return e.floppyReady=!0,e.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.cdromReady)return e.cdromReady=
15 -!0,e.SendCommandEndResponse(1,6,c,40,0),-1;break;default:return b("SCSI Internal error 3",c),-1}e.SendCommandEndResponse(1,0,c,0,0);break;case 8:D=((y.charCodeAt(1)&31)<<16)+(y.charCodeAt(2)<<8)+y.charCodeAt(3);y=y.charCodeAt(4);0==y&&(y=256);b("SCSI: READ_6",c,D,y);a(c,D,y,d);break;case 10:return D=((y.charCodeAt(1)&31)<<16)+(y.charCodeAt(2)<<8)+y.charCodeAt(3),y=y.charCodeAt(4),0==y&&(y=256),b("SCSI: WRITE_6",c,D,y),e.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==
16 -y.charCodeAt(2)&&0==y.charCodeAt(3)){D=y=0;switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;y=0;D=128;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;y=5;D=128;break;default:return b("SCSI Internal error 6",c),-1}e.SendDataToHost(c,!0,String.fromCharCode(0,y,D,0),d&1);return}e.SendCommandEndResponse(1,5,c,36,0);break;case 27:e.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==e.floppy||176==
17 -c&&null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;e.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);D=ReadShort(y,7);switch(c){case 160:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==e.cdrom||0==e.cdrom.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}e.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),d&1);break;
18 -case 37:b("SCSI: READ_CAPACITY",c);y=0;switch(c){case 160:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,2,c,58,0),-1;null!=e.floppy&&(y=(e.floppy.size>>9)-1);b("DEV_FLOPPY",y);break;case 176:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,2,c,58,0),-1;null!=e.cdrom&&(y=(e.cdrom.size>>11)-1);b("DEV_CDDVD",y);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,D);e.SendDataToHost(D,!0,IntToStr(y)+String.fromCharCode(0,0,176==
19 -c?8:2,0),d&1);break;case 40:D=ReadInt(y,2);y=ReadShort(y,7);b("SCSI: READ_10",c,D,y);a(c,D,y,d);break;case 42:case 46:D=ReadInt(y,2);y=ReadShort(y,7);b("SCSI: WRITE_10",c,D,y);e.SendGetDataFromHost(c,512*y);break;case 67:D=ReadShort(y,7);var A=y.charCodeAt(1)&2,G=y.charCodeAt(2)&7;0==G&&(G=y.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+D+", msf="+A+", format="+G);switch(c){case 160:return e.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),
20 --1}1==G?e.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0),d&1):0==G&&(A?e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,2,0,0,20,170,0,0,0,52,19),d&1):e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,0,0,0,20,170,0,0,0,0,0),d&1));break;case 70:var G=2!=y.charCodeAt(1),L=ReadShort(y,2);D=ReadShort(y,7);b("SCSI: GET_CONFIGURATION",c,G,L,D);if(0==D)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),d&1),-1;A=IntToStr(8);0==L&&(A+=x);if(1==L||G&&1>
21 -L)A+=k;if(2==L||G&&2>L)A+=h;if(3==L||G&&3>L)A+=K;if(16==L||G&&16>L)A+=r;if(30==L||G&&30>L)A+=C;if(256==L||G&&256>L)A+=B;if(261==L||G&&261>L)A+=z;A=IntToStr(A.length)+A;A.length>D&&(A=A.substring(0,D));e.SendDataToHost(c,!0,A,d&1);return-1;case 74:b("SCSI: GET_EVENT_STATUS_NOTIFICATION",c,y.charCodeAt(1),y.charCodeAt(4),y.charCodeAt(9));if(1!=y.charCodeAt(1)&&16!=y.charCodeAt(4)){b("SCSI ERROR");e.SendCommandEndResponse(1,5,c,38,1);break}y=0;160==c&&null!=e.floppy?y=2:176==c&&null!=e.cdrom&&(y=2);
22 -e.SendDataToHost(c,!0,String.fromCharCode(0,y,128,0),d&1);break;case 76:e.SendCommand(81,IntToStrX(0)+IntToStrX(0)+IntToStrX(0)+String.fromCharCode(135,80,3,0,0,0,176,81,5,32,0),!0);break;case 81:return b("SCSI READ_DISC_INFO",c),e.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),e.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,y.charCodeAt(2)&63);D=ReadShort(y,7);A=null;if(0==D)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),d&
23 -1),-1;D=0;160==c?null!=e.floppy&&(D=e.floppy.size>>9):null!=e.cdrom&&(D=e.cdrom.size>>11);switch(y.charCodeAt(2)&63){case 1:A=160==c?2880>=D?I:F:E;break;case 5:160==c&&(A=2880>=D?q:n);break;case 63:A=160==c?2880>=D?m:p:v;break;case 26:176==c&&(A=g);break;case 29:176==c&&(A=w);break;case 42:176==c&&(A=l)}null==A?e.SendCommandEndResponse(0,5,c,32,0):e.SendDataToHost(c,!0,A,d&1);break;default:return b("IDER: Unknown SCSI command",y.charCodeAt(0)),e.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,
24 -b,c,m){var g=null,z=0;160==a&&(g=e.floppy,null!=e.floppy&&(z=e.floppy.size>>9));176==a&&(g=e.cdrom,null!=e.cdrom&&(z=e.cdrom.size>>11));if(0>c||b+c>z)return e.SendCommandEndResponse(1,5,a,33,0),0;if(0==c)return e.SendCommandEndResponse(1,0,a,0,0),0;null!=g&&(e.sectorStats&&e.sectorStats(1,160==a?0:1,z,b,c),160==a?(b<<=9,c<<=9):(b<<=11,c<<=11),null!==D?(console.log("IDERERROR: Read while performing read"),e.Stop()):(D=g,A=a,G=b,L=c,d(m)))}function d(a){var b=L,c=G;L>e.iderinfo.readbfr&&(b=e.iderinfo.readbfr);
25 -L-=b;G+=b;var m=new FileReader;m.onload=function(){e.SendDataToHost(A,0==L,this.result,a&1);0<L&&0==y?d(a):(D=null,y&&(e.SendCommand(71),y=!1))};m.readAsBinaryString(D.slice(c,c+b))}var e={protocol:3,bytesToAmt:0,bytesFromAmt:0,rx_timeout:3E4,tx_timeout:0,heartbeat:2E4,version:1,acc:"",inSequence:0,outSequence:0,iderinfo:null,enabled:!1,iderStart:0,floppy:null,cdrom:null,floppyReady:!1,cdromReady:!1,sectorStats:null},n=String.fromCharCode(0,38,49,128,0,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,
26 -0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),p=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),q=String.fromCharCode(0,38,36,128,0,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),m=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,
14 +var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}function c(c,d,z,D){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.floppyReady)return e.floppyReady=!0,e.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.cdromReady)return e.cdromReady=
15 +!0,e.SendCommandEndResponse(1,6,c,40,0),-1;break;default:return b("SCSI Internal error 3",c),-1}e.SendCommandEndResponse(1,0,c,0,0);break;case 8:D=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3);d=d.charCodeAt(4);0==d&&(d=256);b("SCSI: READ_6",c,D,d);a(c,D,d,z);break;case 10:return D=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3),d=d.charCodeAt(4),0==d&&(d=256),b("SCSI: WRITE_6",c,D,d),e.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==
16 +d.charCodeAt(2)&&0==d.charCodeAt(3)){D=d=0;switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;d=0;D=128;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;d=5;D=128;break;default:return b("SCSI Internal error 6",c),-1}e.SendDataToHost(c,!0,String.fromCharCode(0,d,D,0),z&1);return}e.SendCommandEndResponse(1,5,c,36,0);break;case 27:e.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==e.floppy||176==
17 +c&&null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;e.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);D=ReadShort(d,7);switch(c){case 160:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==e.cdrom||0==e.cdrom.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}e.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),z&1);break;
18 +case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,2,c,58,0),-1;null!=e.floppy&&(d=(e.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,2,c,58,0),-1;null!=e.cdrom&&(d=(e.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,D);e.SendDataToHost(D,!0,IntToStr(d)+String.fromCharCode(0,0,176==
19 +c?8:2,0),z&1);break;case 40:D=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10",c,D,d);a(c,D,d,z);break;case 42:case 46:D=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,D,d);e.SendGetDataFromHost(c,512*d);break;case 67:D=ReadShort(d,7);var A=d.charCodeAt(1)&2,G=d.charCodeAt(2)&7;0==G&&(G=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+D+", msf="+A+", format="+G);switch(c){case 160:return e.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),
20 +-1}1==G?e.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0),z&1):0==G&&(A?e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,2,0,0,20,170,0,0,0,52,19),z&1):e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,0,0,0,20,170,0,0,0,0,0),z&1));break;case 70:var G=2!=d.charCodeAt(1),L=ReadShort(d,2);D=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,G,L,D);if(0==D)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),z&1),-1;A=IntToStr(8);0==L&&(A+=x);if(1==L||G&&1>
21 +L)A+=k;if(2==L||G&&2>L)A+=h;if(3==L||G&&3>L)A+=K;if(16==L||G&&16>L)A+=q;if(30==L||G&&30>L)A+=C;if(256==L||G&&256>L)A+=B;if(261==L||G&&261>L)A+=y;A=IntToStr(A.length)+A;A.length>D&&(A=A.substring(0,D));e.SendDataToHost(c,!0,A,z&1);return-1;case 74:b("SCSI: GET_EVENT_STATUS_NOTIFICATION",c,d.charCodeAt(1),d.charCodeAt(4),d.charCodeAt(9));if(1!=d.charCodeAt(1)&&16!=d.charCodeAt(4)){b("SCSI ERROR");e.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=e.floppy?d=2:176==c&&null!=e.cdrom&&(d=2);
22 +e.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),z&1);break;case 76:e.SendCommand(81,IntToStrX(0)+IntToStrX(0)+IntToStrX(0)+String.fromCharCode(135,80,3,0,0,0,176,81,5,32,0),!0);break;case 81:return b("SCSI READ_DISC_INFO",c),e.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),e.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);D=ReadShort(d,7);A=null;if(0==D)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),z&
23 +1),-1;D=0;160==c?null!=e.floppy&&(D=e.floppy.size>>9):null!=e.cdrom&&(D=e.cdrom.size>>11);switch(d.charCodeAt(2)&63){case 1:A=160==c?2880>=D?I:F:E;break;case 5:160==c&&(A=2880>=D?r:n);break;case 63:A=160==c?2880>=D?m:p:v;break;case 26:176==c&&(A=g);break;case 29:176==c&&(A=w);break;case 42:176==c&&(A=l)}null==A?e.SendCommandEndResponse(0,5,c,32,0):e.SendDataToHost(c,!0,A,z&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),e.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,
24 +b,c,m){var g=null,y=0;160==a&&(g=e.floppy,null!=e.floppy&&(y=e.floppy.size>>9));176==a&&(g=e.cdrom,null!=e.cdrom&&(y=e.cdrom.size>>11));if(0>c||b+c>y)return e.SendCommandEndResponse(1,5,a,33,0),0;if(0==c)return e.SendCommandEndResponse(1,0,a,0,0),0;null!=g&&(e.sectorStats&&e.sectorStats(1,160==a?0:1,y,b,c),160==a?(b<<=9,c<<=9):(b<<=11,c<<=11),null!==D?(console.log("IDERERROR: Read while performing read"),e.Stop()):(D=g,A=a,G=b,L=c,d(m)))}function d(a){var b=L,c=G;L>e.iderinfo.readbfr&&(b=e.iderinfo.readbfr);
25 +L-=b;G+=b;var m=new FileReader;m.onload=function(){e.SendDataToHost(A,0==L,this.result,a&1);0<L&&0==z?d(a):(D=null,z&&(e.SendCommand(71),z=!1))};m.readAsBinaryString(D.slice(c,c+b))}var e={protocol:3,bytesToAmt:0,bytesFromAmt:0,rx_timeout:3E4,tx_timeout:0,heartbeat:2E4,version:1,acc:"",inSequence:0,outSequence:0,iderinfo:null,enabled:!1,iderStart:0,floppy:null,cdrom:null,floppyReady:!1,cdromReady:!1,sectorStats:null},n=String.fromCharCode(0,38,49,128,0,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,
26 +0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),p=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),r=String.fromCharCode(0,38,36,128,0,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),m=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,
27 0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),g=String.fromCharCode(0,18,1,128,0,0,0,0,26,10,0,0,0,0,0,0,0,0,0,0),w=String.fromCharCode(0,18,1,128,0,0,0,0,29,10,0,0,0,0,0,0,0,0,0,0),l=String.fromCharCode(0,32,1,128,0,0,0,0,42,24,0,0,0,0,32,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0),v=String.fromCharCode(0,40,1,128,0,0,0,0,1,6,0,255,0,0,0,0,42,24,0,0,0,0,2,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0);String.fromCharCode(0,0,0,40,
28 -0,0,0,8);var x=String.fromCharCode(0,0,3,4,0,8,1,0),k=String.fromCharCode(0,1,3,4,0,0,0,2),h=String.fromCharCode(0,2,3,4,0,0,0,0),K=String.fromCharCode(0,3,3,4,41,0,0,2),r=String.fromCharCode(0,16,1,8,0,0,8,0,0,1,0,0),C=String.fromCharCode(0,30,3,0),B=String.fromCharCode(1,0,3,0),z=String.fromCharCode(1,5,3,0),I=String.fromCharCode(0,18,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),F=String.fromCharCode(0,18,49,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),E=String.fromCharCode(0,14,1,128,0,0,0,0,1,6,0,255,0,
28 +0,0,0,8);var x=String.fromCharCode(0,0,3,4,0,8,1,0),k=String.fromCharCode(0,1,3,4,0,0,0,2),h=String.fromCharCode(0,2,3,4,0,0,0,0),K=String.fromCharCode(0,3,3,4,41,0,0,2),q=String.fromCharCode(0,16,1,8,0,0,8,0,0,1,0,0),C=String.fromCharCode(0,30,3,0),B=String.fromCharCode(1,0,3,0),y=String.fromCharCode(1,5,3,0),I=String.fromCharCode(0,18,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),F=String.fromCharCode(0,18,49,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),E=String.fromCharCode(0,14,1,128,0,0,0,0,1,6,0,255,0,
29 0,0,0);e.xxStateChange=function(a){b("IDER-StateChange",a);0==a&&e.Stop();3==a&&e.Start()};e.Start=function(){b("IDER-Start");b(e.floppy,e.cdrom);e.bytesToAmt=0;e.bytesFromAmt=0;e.inSequence=0;e.outSequence=0;e.SendCommand(64,ShortToStrX(e.rx_timeout)+ShortToStrX(e.tx_timeout)+ShortToStrX(e.heartbeat)+IntToStrX(e.version));e.sectorStats&&(e.sectorStats(0,0,e.floppy?e.floppy.size>>9:0),e.sectorStats(0,1,e.cdrom?e.cdrom.size>>11:0))};e.Stop=function(){b("IDER-Stop");e.parent.Stop()};e.ProcessData=function(a){e.bytesFromAmt+=
30 a.length;e.acc+=a;for(b("IDER-ProcessData",e.acc.length,rstr2hex(e.acc));;){a=e.ProcessDataEx();if(0==a)break;if(e.inSequence!=ReadIntX(e.acc,4)){b("ERROR: Out of sequence",e.inSequence,ReadIntX(e.acc,4));e.Stop();break}e.inSequence++;e.acc=e.acc.substring(a)}};e.SendCommand=function(a,c,m,g){null==c&&(c="");m=50<a&&1==m?2:0;g&&(m+=1);c=String.fromCharCode(a,0,0,m)+IntToStrX(e.outSequence++)+c;e.parent.xxSend(c);e.bytesToAmt+=c.length;75!=a&&b("IDER-SendData",c.length,rstr2hex(c))};e.SendCommandEndResponse=
31 function(a,b,c,m,g){a?e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,197,0,3,0,0,0,c,80,0,0,0),!0):e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,b<<4,3,0,0,0,c,81,b,m,g),!0)};e.SendDataToHost=function(a,b,c,m){var g=m?0:c.length;1==b?e.SendCommand(84,String.fromCharCode(0,c.length&255,c.length>>8,0,m?180:181,0,2,0,g&255,g>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+c,b,m):e.SendCommand(84,String.fromCharCode(0,c.length&255,c.length>>8,0,m?180:181,0,2,0,g&255,g>>8,a,88,
32 0,0,0,0,0,0,0,0,0,0,0,0,0,0)+c,b,m)};e.SendGetDataFromHost=function(a,b){e.SendCommand(82,String.fromCharCode(0,b&255,b>>8,0,181,0,0,0,b&255,b>>8,a,88,0,0,0,0,0,0,0,0,0,0,0),!1)};e.SendDisableEnableFeatures=function(a,b){null==b&&(b="");e.SendCommand(72,String.fromCharCode(a)+b)};e.ProcessDataEx=function(){if(8>e.acc.length)return 0;switch(e.acc.charCodeAt(0)){case 65:if(30>e.acc.length)break;var a=e.acc.charCodeAt(29);if(e.acc.length<30+a)break;e.iderinfo={};e.iderinfo.major=e.acc.charCodeAt(8);
33 e.iderinfo.minor=e.acc.charCodeAt(9);e.iderinfo.fwmajor=e.acc.charCodeAt(10);e.iderinfo.fwminor=e.acc.charCodeAt(11);e.iderinfo.readbfr=ReadShortX(e.acc,16);e.iderinfo.writebfr=ReadShortX(e.acc,18);e.iderinfo.proto=e.acc.charCodeAt(21);e.iderinfo.iana=ReadIntX(e.acc,25);b(e.iderinfo);0!=e.iderinfo.proto&&(b("Unknown proto",e.iderinfo.proto),e.Stop());8192<e.iderinfo.readbfr&&(b("Illegal read buffer size",e.iderinfo.readbfr),e.Stop());8192<e.iderinfo.writebfr&&(b("Illegal write buffer size",e.iderinfo.writebfr),
34 -e.Stop());0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):2==e.iderStart&&e.SendDisableEnableFeatures(3,IntToStrX(25));return 30+a;case 67:return b("CLOSE"),e.Stop(),8;case 68:return e.SendCommand(69),8;case 69:return b("PONG"),8;case 70:if(9>e.acc.length)break;a=e.acc.charCodeAt(8);null===D?(e.SendCommand(71),b("RESETOCCURED1",a)):(y=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>e.acc.length)break;var a=e.acc.charCodeAt(8),
34 +e.Stop());0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):2==e.iderStart&&e.SendDisableEnableFeatures(3,IntToStrX(25));return 30+a;case 67:return b("CLOSE"),e.Stop(),8;case 68:return e.SendCommand(69),8;case 69:return b("PONG"),8;case 70:if(9>e.acc.length)break;a=e.acc.charCodeAt(8);null===D?(e.SendCommand(71),b("RESETOCCURED1",a)):(z=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>e.acc.length)break;var a=e.acc.charCodeAt(8),
35 m=ReadIntX(e.acc,9);b("STATUS_DATA",a,m);switch(a){case 1:m&1&&(0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):2==e.iderStart&&e.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:e.enabled=m&2?!0:!1;b("IDER Status: "+e.enabled);break;case 3:1!=m&&b("Register toggle failure")}return 13;case 74:if(11>e.acc.length)break;b("IDER: ABORT",e.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>e.acc.length)break;var a=
36 -e.acc.charCodeAt(14)&16?176:160,m=e.acc.charCodeAt(14),g=e.acc.substring(16,28),z=e.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(g),z,m);c(a,g,z,m);return 28;case 83:if(14>e.acc.length)break;a=ReadShortX(e.acc,9);if(e.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,112,3,0,0,0,160,81,7,39,0),!0);return 14+a;default:b("Unknown IDER command",e.acc[0]),e.Stop()}return 0};var y=!1,D=null,A,G,L;return e},CreateWsmanComm=function(b,c,a,
37 -d,e){function n(){g.socketState=2;g.socketParseState=0;g.socketAccumulator="";g.socketHeader=null;g.socketData="";for(i in g.pendingAjaxCall)g.sendRequest(g.pendingAjaxCall[i][0],g.pendingAjaxCall[i][3],g.pendingAjaxCall[i][4])}function p(a){if("object"==typeof a.data)if(1==l)v.push(a.data);else if(w.readAsBinaryString)l=!0,w.readAsBinaryString(new Blob([a.data]));else if(w.readAsArrayBuffer)l=!0,w.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,m=0;m<c;m++)b+=
38 -String.fromCharCode(a[m]);q(b)}else q(a.data)}function q(a){if("object"===typeof a){var b="";a=new Uint8Array(a);for(var c=a.byteLength,m=0;m<c;m++)b+=String.fromCharCode(a[m]);a=b}else if("string"!==typeof a)return;for(g.socketAccumulator+=a;;){if(0==g.socketParseState){a=g.socketAccumulator.indexOf("\r\n\r\n");if(0>a)break;g.socketHeader=g.socketAccumulator.substring(0,a).split("\r\n");if(null==g.amtVersion)for(m in g.socketHeader)0==g.socketHeader[m].indexOf("Server: Intel(R) Active Management Technology ")&&
39 -(g.amtVersion=g.socketHeader[m].substring(46));g.socketAccumulator=g.socketAccumulator.substring(a+4);g.socketParseState=1;g.socketData="";g.socketXHeader={Directive:g.socketHeader[0].split(" ")};for(m in g.socketHeader)0!=m&&(a=g.socketHeader[m].indexOf(":"),g.socketXHeader[g.socketHeader[m].substring(0,a).toLowerCase()]=g.socketHeader[m].substring(a+2))}if(1==g.socketParseState){b=-1;if(void 0==g.socketXHeader.connection||"close"!=g.socketXHeader.connection.toLowerCase()||void 0!=g.socketXHeader["transfer-encoding"]&&
40 -"chunked"==g.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=g.socketXHeader["content-length"]){b=parseInt(g.socketXHeader["content-length"]);if(g.socketAccumulator.length<b)break;a=g.socketAccumulator.substring(0,b);g.socketAccumulator=g.socketAccumulator.substring(b);g.socketData=a;b=0}else{c=g.socketAccumulator.indexOf("\r\n");if(0>c)break;b=parseInt(g.socketAccumulator.substring(0,c),16);if(isNaN(b)){g.websocket&&g.websocket.close();break}if(g.socketAccumulator.length<c+2+b+2)break;
41 -a=g.socketAccumulator.substring(c+2,c+2+b);g.socketAccumulator=g.socketAccumulator.substring(c+2+b+2);g.socketData+=a}else b=0;0==b&&(c=g.socketXHeader,a=g.socketData,b=parseInt(c.Directive[1]),isNaN(b)&&(b=602),401==b&&3>++g.authcounter?g.challengeParams=g.parseDigest(c["www-authenticate"]):(c=g.pendingAjaxCall.shift(),g.authcounter=0,g.ActiveAjaxCount--,g.gotNextMessages(a,"success",{status:b},c),g.PerformNextAjax()),g.socketParseState=0,g.socketHeader=null)}}}function m(a){0==g.inDataCount&&(g.tlsv1only=
42 -1-g.tlsv1only);g.socketState=0;null!=g.socket&&(g.socket.close(),g.socket=null);if(0<g.pendingAjaxCall.length){a=g.pendingAjaxCall.shift();var b=a[5];g.PerformAjaxExNodeJS2(a[0],a[1],a[2],a[3],a[4],--b)}}var g={PendingAjax:[],ActiveAjaxCount:0,MaxActiveAjaxCount:1,FailAllError:0,challengeParams:null,noncecounter:1,authcounter:0,socket:null,socketState:0};g.host=b;g.port=c;g.user=a;g.pass=d;g.tls=e;g.tlsv1only=0;g.cnonce=Math.random().toString(36).substring(7);g.inDataCount=0;g.amtVersion=null;g.PerformAjax=
43 -function(a,b,c,m,d,e){g.ActiveAjaxCount<g.MaxActiveAjaxCount&&0==g.PendingAjax.length?g.PerformAjaxEx(a,b,c,d,e):1==m?g.PendingAjax.unshift([a,b,c,d,e]):g.PendingAjax.push([a,b,c,d,e])};g.PerformNextAjax=function(){if(!(g.ActiveAjaxCount>=g.MaxActiveAjaxCount||0==g.PendingAjax.length)){var a=g.PendingAjax.shift();g.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);g.PerformNextAjax()}};g.PerformAjaxEx=function(a,b,c,m,d){if(0!=g.FailAllError)g.gotNextMessagesError({status:g.FailAllError},"error",null,[a,b,
44 -c,m,d]);else return a||(a=""),g.ActiveAjaxCount++,g.PerformAjaxExNodeJS(a,b,c,m,d)};g.pendingAjaxCall=[];g.PerformAjaxExNodeJS=function(a,b,c,m,d){g.PerformAjaxExNodeJS2(a,b,c,m,d,3)};g.PerformAjaxExNodeJS2=function(a,b,c,m,d,e){0>=e||0!=g.FailAllError?(g.ActiveAjaxCount--,999!=g.FailAllError&&g.gotNextMessages(null,"error",{status:0==g.FailAllError?408:g.FailAllError},[a,b,c,m,d]),g.PerformNextAjax()):(g.pendingAjaxCall.push([a,b,c,m,d,e]),0==g.socketState?g.xxConnectHttpSocket():2==g.socketState&&
45 -g.sendRequest(a,m,d))};g.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var m=c+" "+b+" HTTP/1.1\r\n";null!=g.challengeParams&&(c=hex_md5(hex_md5(g.user+":"+g.challengeParams.realm+":"+g.pass)+":"+g.challengeParams.nonce+":"+g.noncecounter+":"+g.cnonce+":"+g.challengeParams.qop+":"+hex_md5(c+":"+b)),m+="Authorization: "+g.renderDigest({username:g.user,realm:g.challengeParams.realm,nonce:g.challengeParams.nonce,uri:b,qop:g.challengeParams.qop,response:c,nc:g.noncecounter++,cnonce:g.cnonce})+
46 -"\r\n");a=m+="Host: "+g.host+":"+g.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==g.socketState&&null!=g.socket&&g.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(m=0;m<a.length;++m)b[m]=a.charCodeAt(m);try{g.socket.send(b.buffer)}catch(d){}}};g.parseDigest=function(a){a=a.substring(7).split(",");for(i in a)a[i]=a[i].trim();return a.reduce(function(a,b){var c=b.split("=");a[c[0]]=c[1].replace(/"/g,"");return a},{})};g.renderDigest=function(a){var b=[];for(i in a)b.push(i);
47 -return"Digest "+b.reduce(function(b,c){return b+","+c+'="'+a[c]+'"'},"").substring(1)};g.xxConnectHttpSocket=function(){g.inDataCount=0;g.socketState=1;g.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+g.host+"&port="+g.port+"&tls="+g.tls+"&tls1only="+g.tlsv1only+("*"==a?"&serverauth=1":"")+("undefined"===typeof d?"&serverauth=1&user="+a:""));g.socket.onopen=
48 -n;g.socket.onmessage=p;g.socket.onclose=m};var w=new FileReader,l=!1,v=[];w.readAsBinaryString?w.onload=function(a){q(a.target.result);0==v.length?l=!1:w.readAsBinaryString(new Blob([v.shift()]))}:w.readAsArrayBuffer&&(w.onloadend=function(a){q(a.target.result);0==v.length?l=!1:w.readAsArrayBuffer(v.shift())});g.gotNextMessages=function(a,b,c,m){if(999!=g.FailAllError)if(0!=g.FailAllError)m[1](null,g.FailAllError,m[2]);else if(200!=c.status)m[1](null,c.status,m[2]);else m[1](a,200,m[2])};g.gotNextMessagesError=
49 -function(a,b,c,m){if(999!=g.FailAllError)if(0!=g.FailAllError)m[1](null,g.FailAllError,m[2]);else m[1](g,null,{Header:{HttpError:a.status}},a.status,m[2])};g.CancelAllQueries=function(a){for(;0<g.PendingAjax.length;){var b=g.PendingAjax.shift();b[1](null,a,b[2])}null!=g.websocket&&(g.websocket.close(),g.websocket=null,g.socketState=0)};return g},CreateAmtRedirect=function(b){var c={};c.m=b;b.parent=c;c.State=0;c.socket=null;c.host=null;c.port=0;c.user=null;c.pass=null;c.authuri="/RedirectionService";
50 -c.tlsv1only=0;c.connectstate=0;c.protocol=b.protocol;c.amtaccumulator="";c.amtsequence=1;c.amtkeepalivetimer=null;c.onStateChanged=null;c.Start=function(a,b,d,m,g){c.host=a;c.port=b;c.user=d;c.pass=m;c.connectstate=0;c.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+g+("*"==d?"&serverauth=1":"")+("undefined"===typeof m?"&serverauth=1&user="+
51 -d:"")+"&tls1only="+c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)};c.xxOnSocketConnected=function(){urlvars&&urlvars.redirtrace&&console.log("REDIR-CONNECT");c.xxStateChange(2);1==c.protocol&&c.xxSend(c.RedirectStartSol);2==c.protocol&&c.xxSend(c.RedirectStartKvm);3==c.protocol&&c.xxSend(c.RedirectStartIder)};var a=new FileReader,d=!1,e=[];a.readAsBinaryString?a.onload=function(b){c.xxOnSocketData(b.target.result);
52 -0==e.length?d=!1:a.readAsBinaryString(new Blob([e.shift()]))}:a.readAsArrayBuffer&&(a.onloadend=function(b){c.xxOnSocketData(b.target.result);0==e.length?d=!1:a.readAsArrayBuffer(e.shift())});c.xxOnMessage=function(b){c.inDataCount++;if("object"==typeof b.data)if(1==d)e.push(b.data);else if(a.readAsBinaryString)d=!0,a.readAsBinaryString(new Blob([b.data]));else if(f.readAsArrayBuffer)d=!0,a.readAsArrayBuffer(b.data);else{var p="";b=new Uint8Array(b.data);for(var q=b.byteLength,m=0;m<q;m++)p+=String.fromCharCode(b[m]);
53 -c.xxOnSocketData(p)}else c.xxOnSocketData(b.data)};c.xxOnSocketData=function(a){if(a&&-1!=c.connectstate){if("object"===typeof a){var b="",d=new Uint8Array(a),m=d.byteLength;for(a=0;a<m;a++)b+=String.fromCharCode(d[a]);a=b}else if("string"!==typeof a)return;if((2==c.protocol||3==c.protocol)&&1==c.connectstate)return c.m.ProcessData(a);c.amtaccumulator+=a;for(urlvars&&urlvars.redirtrace&&console.log("REDIR-RECV("+c.amtaccumulator.length+"): "+rstr2hex(c.amtaccumulator));1<=c.amtaccumulator.length;){a=
54 -0;switch(c.amtaccumulator.charCodeAt(0)){case 17:if(4>c.amtaccumulator.length)return;switch(c.amtaccumulator.charCodeAt(1)){case 0:if(13>c.amtaccumulator.length)return;b=c.amtaccumulator.charCodeAt(12);if(c.amtaccumulator.length<13+b)return;c.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));a=13+b;break;default:c.Stop()}break;case 20:if(9>c.amtaccumulator.length)return;var g=ReadIntX(c.amtaccumulator,5);if(c.amtaccumulator.length<9+g)return;var m=c.amtaccumulator.charCodeAt(1),b=c.amtaccumulator.charCodeAt(4),
55 -e=[];for(a=0;a<g;a++)e.push(c.amtaccumulator.charCodeAt(9+a));d=c.amtaccumulator.substring(9,9+g);a=9+g;if(0==b)0<=e.indexOf(4)?c.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(c.user.length+c.authuri.length+8)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(0,0)+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(0,0,0,0)):0<=e.indexOf(3)?c.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(c.user.length+c.authuri.length+7)+String.fromCharCode(c.user.length)+c.user+
56 -String.fromCharCode(0,0)+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(0,0,0)):0<=e.indexOf(1)?c.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(c.user.length+c.pass.length+2)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(c.pass.length)+c.pass):c.Stop();else if(3!=b&&4!=b||1!=m)0==m?(1==c.protocol&&c.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(c.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+
57 -IntToStrX(0)),2==c.protocol&&c.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0)),3==c.protocol&&(c.connectstate=1,c.xxStateChange(3))):c.Stop();else{var g=0,e=d.charCodeAt(g),m=d.substring(g+1,g+1+e),g=g+(e+1),l=d.charCodeAt(g),e=d.substring(g+1,g+1+l),g=g+(l+1),l=0,l=null,v=c.xxRandomNonce(32),x="";4==b&&(l=d.charCodeAt(g),l=d.substring(g+1,g+1+l),x="00000002:"+v+":"+l+":");d=hex_md5(hex_md5(c.user+":"+m+":"+c.pass)+":"+e+":"+x+hex_md5("POST:"+c.authuri));g=c.user.length+m.length+e.length+c.authuri.length+
58 -v.length+8+d.length+7;4==b&&(g+=l.length+1);d=String.fromCharCode(19,0,0,0,b)+IntToStrX(g)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(m.length)+m+String.fromCharCode(e.length)+e+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(v.length)+v+String.fromCharCode(8)+"00000002"+String.fromCharCode(d.length)+d;4==b&&(d+=String.fromCharCode(l.length)+l);c.xxSend(d)}break;case 33:if(23>c.amtaccumulator.length)break;a=23;c.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(c.amtsequence++)+
59 -String.fromCharCode(0,0,27,0,0,0));1==c.protocol&&(c.amtkeepalivetimer=setInterval(c.xxSendAmtKeepAlive,2E3));c.connectstate=1;c.xxStateChange(3);break;case 41:if(10>c.amtaccumulator.length)break;a=10;break;case 42:if(10>c.amtaccumulator.length)break;b=10+((c.amtaccumulator.charCodeAt(9)&255)<<8)+(c.amtaccumulator.charCodeAt(8)&255);if(c.amtaccumulator.length<b)break;c.m.ProcessData(c.amtaccumulator.substring(10,b));a=b;break;case 43:if(8>c.amtaccumulator.length)break;a=8;break;case 65:if(8>c.amtaccumulator.length)break;
60 -c.connectstate=1;c.m.Start();8<c.amtaccumulator.length&&c.m.ProcessData(c.amtaccumulator.substring(8));a=c.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+c.amtaccumulator.charCodeAt(0)+" acclen="+c.amtaccumulator.length);c.Stop();return}if(0==a)break;c.amtaccumulator=c.amtaccumulator.substring(a)}}};c.xxSend=function(a){urlvars&&urlvars.redirtrace&&console.log("REDIR-SEND("+a.length+"): "+rstr2hex(a));if(null!=c.socket&&c.socket.readyState==WebSocket.OPEN){for(var b=
61 -new Uint8Array(a.length),d=0;d<a.length;++d)b[d]=a.charCodeAt(d);c.socket.send(b.buffer)}};c.Send=function(a){null!=c.socket&&1==c.connectstate&&(1==c.protocol?c.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(c.amtsequence++)+ShortToStrX(a.length)+a):c.xxSend(a))};c.xxSendAmtKeepAlive=function(){null!=c.socket&&c.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(c.amtsequence++))};c.xxRandomNonceX="abcdef0123456789";c.xxRandomNonce=function(a){for(var b="",d=0;d<a;d++)b+=c.xxRandomNonceX.charAt(Math.floor(Math.random()*
62 -c.xxRandomNonceX.length));return b};c.xxOnSocketClosed=function(){urlvars&&urlvars.redirtrace&&console.log("REDIR-CLOSED");c.Stop()};c.xxStateChange=function(a){if(c.State!=a&&(c.State=a,c.m.xxStateChange(c.State),null!=c.onStateChanged))c.onStateChanged(c,c.State)};c.Stop=function(){c.xxStateChange(0);c.connectstate=-1;c.amtaccumulator="";null!=c.socket&&(c.socket.close(),c.socket=null);null!=c.amtkeepalivetimer&&(clearInterval(c.amtkeepalivetimer),c.amtkeepalivetimer=null)};c.RedirectStartSol=String.fromCharCode(16,
63 -0,0,0,83,79,76,32);c.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);c.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return c},WsmanStackCreateService=function(b,c,a,d,e,n){function p(a){for(var b,c={},m=0;m<a.childNodes.length;m++){var g=a.childNodes[m];b=null==g.childElementCount||0==g.childElementCount?g.textContent:p(g);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var h=b;if(null!=g.attributes&&0<g.attributes.length)for(h={Value:b},b=0;b<g.attributes.length;b++)h["@"+
64 -g.attributes[b].name]=g.attributes[b].value;c[g.localName]instanceof Array?c[g.localName].push(h):c[g.localName]=null==c[g.localName]?h:[c[g.localName],h]}return c}function q(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function m(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";var b="<w:SelectorSet>",
65 -c;for(c in a)if(a.hasOwnProperty(c)){b+='<w:Selector Name="'+c+'">';if(a[c].ReferenceParameters){var b=b+"<a:EndpointReference>",b=b+("<a:Address>"+a[c].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+a[c].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>"),m=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(m))for(var g=0;g<m.length;g++)b+="<w:Selector"+q(m[g])+">"+m[g].Value+"</w:Selector>";else b+="<w:Selector"+q(m)+">"+m.Value+"</w:Selector>";b+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else b+=
66 -a[c];b+="</w:Selector>"}return b+"</w:SelectorSet>"}var g={NextMessageId:1,Address:"/wsman"};g.comm=CreateWsmanComm(b,c,a,d,e,n);g.PerformAjax=function(a,b,c,m,d){null==d&&(d="");g.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+
67 -d+"><Header><a:Action>"+a,function(a,c,m){200!=c?b(g,null,{Header:{HttpError:c}},c,m):(a=g.ParseWsman(a))&&null!=a?b(g,a.Header.ResourceURI,a,200,m):b(g,null,{Header:{HttpError:c}},601,m)},c,m)};g.CancelAllQueries=function(a){g.comm.CancelAllQueries(a)};g.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};g.ExecSubscribe=function(a,b,c,d,k,h,e,r,C,B){var z="",I="";r="";null!=C&&null!=B&&(z='<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>'+
68 -C+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+B+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",I='<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>');null!=r&&(r="<a:ReferenceParameters><m:arg>"+r+"</m:arg></a:ReferenceParameters>");"PushWithAck"==b?b="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==b&&(b="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push");
69 -a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+m(e)+z+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.'+b+'"><e:NotifyTo><a:Address>'+c+"</a:Address>"+r+"</e:NotifyTo>"+I+"</e:Delivery></e:Subscribe>";g.PerformAjax(a+"</Body></Envelope>",d,k,
36 +e.acc.charCodeAt(14)&16?176:160,m=e.acc.charCodeAt(14),g=e.acc.substring(16,28),y=e.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(g),y,m);c(a,g,y,m);return 28;case 83:if(14>e.acc.length)break;a=ReadShortX(e.acc,9);if(e.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,112,3,0,0,0,160,81,7,39,0),!0);return 14+a;default:b("Unknown IDER command",e.acc[0]),e.Stop()}return 0};var z=!1,D=null,A,G,L;return e},CreateAmtRemoteServerIder=function(){function b(){urlvars&&
37 +urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}var c={protocol:4,bytesToAmt:0,bytesFromAmt:0,iderStart:0,floppy:null,cdrom:null,state:0,onStateChanged:null,m:{onDialogPrompt:null,dialogPrompt:function(a){console.log("dialogPromptResponse",a);c.socket.send(JSON.stringify({action:"selectorResponse",args:a}))},Stop:function(){c.Stop()}},xxStateChange:function(a){if(c.state!=a&&(b("SIDER-StateChange",a),c.state=a,null!=c.onStateChanged))c.onStateChanged(c.state)},
38 +Start:function(a,d,e,n,p){b("SIDER-Start",a,d,e,n,p);c.host=a;c.port=d;c.user=e;c.pass=n;c.connectstate=0;c.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webider.ashx?host="+a+"&port="+d+"&tls="+p+("*"==e?"&serverauth=1":"")+("undefined"===typeof n?"&serverauth=1&user="+e:"")+"&tls1only="+c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;
39 +c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)},Stop:function(){b("SIDER-Stop");null!=c.socket&&(c.socket.close(),c.socket=null);c.xxStateChange(0)},xxOnSocketConnected:function(){c.xxStateChange(2);c.socket.send(JSON.stringify({action:"selector"}))},xxOnMessage:function(a){var b=null;try{b=JSON.parse(a.data)}catch(e){}if(null!=b&&"string"==typeof b.action)switch(b.action){case "selector":if(null!=c.m.onDialogPrompt)c.m.onDialogPrompt(c,b.args,b.buttons);break;default:console.log("Unknown Server IDER action: "+
40 +b.action),breal}},xxOnSocketClosed:function(){console.log("xxOnSocketClosed");c.Stop()}};return c},CreateWsmanComm=function(b,c,a,d,e){function n(){g.socketState=2;g.socketParseState=0;g.socketAccumulator="";g.socketHeader=null;g.socketData="";for(i in g.pendingAjaxCall)g.sendRequest(g.pendingAjaxCall[i][0],g.pendingAjaxCall[i][3],g.pendingAjaxCall[i][4])}function p(a){if("object"==typeof a.data)if(1==l)v.push(a.data);else if(w.readAsBinaryString)l=!0,w.readAsBinaryString(new Blob([a.data]));else if(w.readAsArrayBuffer)l=
41 +!0,w.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,m=0;m<c;m++)b+=String.fromCharCode(a[m]);r(b)}else r(a.data)}function r(a){if("object"===typeof a){var b="";a=new Uint8Array(a);for(var c=a.byteLength,m=0;m<c;m++)b+=String.fromCharCode(a[m]);a=b}else if("string"!==typeof a)return;for(g.socketAccumulator+=a;;){if(0==g.socketParseState){a=g.socketAccumulator.indexOf("\r\n\r\n");if(0>a)break;g.socketHeader=g.socketAccumulator.substring(0,a).split("\r\n");if(null==
42 +g.amtVersion)for(m in g.socketHeader)0==g.socketHeader[m].indexOf("Server: Intel(R) Active Management Technology ")&&(g.amtVersion=g.socketHeader[m].substring(46));g.socketAccumulator=g.socketAccumulator.substring(a+4);g.socketParseState=1;g.socketData="";g.socketXHeader={Directive:g.socketHeader[0].split(" ")};for(m in g.socketHeader)0!=m&&(a=g.socketHeader[m].indexOf(":"),g.socketXHeader[g.socketHeader[m].substring(0,a).toLowerCase()]=g.socketHeader[m].substring(a+2))}if(1==g.socketParseState){b=
43 +-1;if(void 0==g.socketXHeader.connection||"close"!=g.socketXHeader.connection.toLowerCase()||void 0!=g.socketXHeader["transfer-encoding"]&&"chunked"==g.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=g.socketXHeader["content-length"]){b=parseInt(g.socketXHeader["content-length"]);if(g.socketAccumulator.length<b)break;a=g.socketAccumulator.substring(0,b);g.socketAccumulator=g.socketAccumulator.substring(b);g.socketData=a;b=0}else{c=g.socketAccumulator.indexOf("\r\n");if(0>c)break;b=parseInt(g.socketAccumulator.substring(0,
44 +c),16);if(isNaN(b)){g.websocket&&g.websocket.close();break}if(g.socketAccumulator.length<c+2+b+2)break;a=g.socketAccumulator.substring(c+2,c+2+b);g.socketAccumulator=g.socketAccumulator.substring(c+2+b+2);g.socketData+=a}else b=0;0==b&&(c=g.socketXHeader,a=g.socketData,b=parseInt(c.Directive[1]),isNaN(b)&&(b=602),401==b&&3>++g.authcounter?g.challengeParams=g.parseDigest(c["www-authenticate"]):(c=g.pendingAjaxCall.shift(),g.authcounter=0,g.ActiveAjaxCount--,g.gotNextMessages(a,"success",{status:b},
45 +c),g.PerformNextAjax()),g.socketParseState=0,g.socketHeader=null)}}}function m(a){0==g.inDataCount&&(g.tlsv1only=1-g.tlsv1only);g.socketState=0;null!=g.socket&&(g.socket.close(),g.socket=null);if(0<g.pendingAjaxCall.length){a=g.pendingAjaxCall.shift();var b=a[5];g.PerformAjaxExNodeJS2(a[0],a[1],a[2],a[3],a[4],--b)}}var g={PendingAjax:[],ActiveAjaxCount:0,MaxActiveAjaxCount:1,FailAllError:0,challengeParams:null,noncecounter:1,authcounter:0,socket:null,socketState:0};g.host=b;g.port=c;g.user=a;g.pass=
46 +d;g.tls=e;g.tlsv1only=0;g.cnonce=Math.random().toString(36).substring(7);g.inDataCount=0;g.amtVersion=null;g.PerformAjax=function(a,b,c,m,d,e){g.ActiveAjaxCount<g.MaxActiveAjaxCount&&0==g.PendingAjax.length?g.PerformAjaxEx(a,b,c,d,e):1==m?g.PendingAjax.unshift([a,b,c,d,e]):g.PendingAjax.push([a,b,c,d,e])};g.PerformNextAjax=function(){if(!(g.ActiveAjaxCount>=g.MaxActiveAjaxCount||0==g.PendingAjax.length)){var a=g.PendingAjax.shift();g.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);g.PerformNextAjax()}};g.PerformAjaxEx=
47 +function(a,b,c,m,d){if(0!=g.FailAllError)g.gotNextMessagesError({status:g.FailAllError},"error",null,[a,b,c,m,d]);else return a||(a=""),g.ActiveAjaxCount++,g.PerformAjaxExNodeJS(a,b,c,m,d)};g.pendingAjaxCall=[];g.PerformAjaxExNodeJS=function(a,b,c,m,d){g.PerformAjaxExNodeJS2(a,b,c,m,d,3)};g.PerformAjaxExNodeJS2=function(a,b,c,m,d,e){0>=e||0!=g.FailAllError?(g.ActiveAjaxCount--,999!=g.FailAllError&&g.gotNextMessages(null,"error",{status:0==g.FailAllError?408:g.FailAllError},[a,b,c,m,d]),g.PerformNextAjax()):
48 +(g.pendingAjaxCall.push([a,b,c,m,d,e]),0==g.socketState?g.xxConnectHttpSocket():2==g.socketState&&g.sendRequest(a,m,d))};g.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var m=c+" "+b+" HTTP/1.1\r\n";null!=g.challengeParams&&(c=hex_md5(hex_md5(g.user+":"+g.challengeParams.realm+":"+g.pass)+":"+g.challengeParams.nonce+":"+g.noncecounter+":"+g.cnonce+":"+g.challengeParams.qop+":"+hex_md5(c+":"+b)),m+="Authorization: "+g.renderDigest({username:g.user,realm:g.challengeParams.realm,nonce:g.challengeParams.nonce,
49 +uri:b,qop:g.challengeParams.qop,response:c,nc:g.noncecounter++,cnonce:g.cnonce})+"\r\n");a=m+="Host: "+g.host+":"+g.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==g.socketState&&null!=g.socket&&g.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(m=0;m<a.length;++m)b[m]=a.charCodeAt(m);try{g.socket.send(b.buffer)}catch(d){}}};g.parseDigest=function(a){a=a.substring(7).split(",");for(i in a)a[i]=a[i].trim();return a.reduce(function(a,b){var c=b.split("=");a[c[0]]=c[1].replace(/"/g,
50 +"");return a},{})};g.renderDigest=function(a){var b=[];for(i in a)b.push(i);return"Digest "+b.reduce(function(b,c){return b+","+c+'="'+a[c]+'"'},"").substring(1)};g.xxConnectHttpSocket=function(){g.inDataCount=0;g.socketState=1;g.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+g.host+"&port="+g.port+"&tls="+g.tls+"&tls1only="+g.tlsv1only+("*"==a?"&serverauth=1":
51 +"")+("undefined"===typeof d?"&serverauth=1&user="+a:""));g.socket.onopen=n;g.socket.onmessage=p;g.socket.onclose=m};var w=new FileReader,l=!1,v=[];w.readAsBinaryString?w.onload=function(a){r(a.target.result);0==v.length?l=!1:w.readAsBinaryString(new Blob([v.shift()]))}:w.readAsArrayBuffer&&(w.onloadend=function(a){r(a.target.result);0==v.length?l=!1:w.readAsArrayBuffer(v.shift())});g.gotNextMessages=function(a,b,c,m){if(999!=g.FailAllError)if(0!=g.FailAllError)m[1](null,g.FailAllError,m[2]);else if(200!=
52 +c.status)m[1](null,c.status,m[2]);else m[1](a,200,m[2])};g.gotNextMessagesError=function(a,b,c,m){if(999!=g.FailAllError)if(0!=g.FailAllError)m[1](null,g.FailAllError,m[2]);else m[1](g,null,{Header:{HttpError:a.status}},a.status,m[2])};g.CancelAllQueries=function(a){for(;0<g.PendingAjax.length;){var b=g.PendingAjax.shift();b[1](null,a,b[2])}null!=g.websocket&&(g.websocket.close(),g.websocket=null,g.socketState=0)};return g},CreateAmtRedirect=function(b){var c={};c.m=b;b.parent=c;c.State=0;c.socket=
53 +null;c.host=null;c.port=0;c.user=null;c.pass=null;c.authuri="/RedirectionService";c.tlsv1only=0;c.connectstate=0;c.protocol=b.protocol;c.amtaccumulator="";c.amtsequence=1;c.amtkeepalivetimer=null;c.onStateChanged=null;c.Start=function(a,b,d,m,g){c.host=a;c.port=b;c.user=d;c.pass=m;c.connectstate=0;c.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+
54 +a+"&port="+b+"&tls="+g+("*"==d?"&serverauth=1":"")+("undefined"===typeof m?"&serverauth=1&user="+d:"")+"&tls1only="+c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)};c.xxOnSocketConnected=function(){urlvars&&urlvars.redirtrace&&console.log("REDIR-CONNECT");c.xxStateChange(2);1==c.protocol&&c.xxSend(c.RedirectStartSol);2==c.protocol&&c.xxSend(c.RedirectStartKvm);3==c.protocol&&c.xxSend(c.RedirectStartIder)};var a=
55 +new FileReader,d=!1,e=[];a.readAsBinaryString?a.onload=function(b){c.xxOnSocketData(b.target.result);0==e.length?d=!1:a.readAsBinaryString(new Blob([e.shift()]))}:a.readAsArrayBuffer&&(a.onloadend=function(b){c.xxOnSocketData(b.target.result);0==e.length?d=!1:a.readAsArrayBuffer(e.shift())});c.xxOnMessage=function(b){c.inDataCount++;if("object"==typeof b.data)if(1==d)e.push(b.data);else if(a.readAsBinaryString)d=!0,a.readAsBinaryString(new Blob([b.data]));else if(f.readAsArrayBuffer)d=!0,a.readAsArrayBuffer(b.data);
56 +else{var p="";b=new Uint8Array(b.data);for(var r=b.byteLength,m=0;m<r;m++)p+=String.fromCharCode(b[m]);c.xxOnSocketData(p)}else c.xxOnSocketData(b.data)};c.xxOnSocketData=function(a){if(a&&-1!=c.connectstate){if("object"===typeof a){var b="",d=new Uint8Array(a),m=d.byteLength;for(a=0;a<m;a++)b+=String.fromCharCode(d[a]);a=b}else if("string"!==typeof a)return;if((2==c.protocol||3==c.protocol)&&1==c.connectstate)return c.m.ProcessData(a);c.amtaccumulator+=a;for(urlvars&&urlvars.redirtrace&&console.log("REDIR-RECV("+
57 +c.amtaccumulator.length+"): "+rstr2hex(c.amtaccumulator));1<=c.amtaccumulator.length;){a=0;switch(c.amtaccumulator.charCodeAt(0)){case 17:if(4>c.amtaccumulator.length)return;switch(c.amtaccumulator.charCodeAt(1)){case 0:if(13>c.amtaccumulator.length)return;b=c.amtaccumulator.charCodeAt(12);if(c.amtaccumulator.length<13+b)return;c.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));a=13+b;break;default:c.Stop()}break;case 20:if(9>c.amtaccumulator.length)return;var g=ReadIntX(c.amtaccumulator,5);if(c.amtaccumulator.length<
58 +9+g)return;var m=c.amtaccumulator.charCodeAt(1),b=c.amtaccumulator.charCodeAt(4),e=[];for(a=0;a<g;a++)e.push(c.amtaccumulator.charCodeAt(9+a));d=c.amtaccumulator.substring(9,9+g);a=9+g;if(0==b)0<=e.indexOf(4)?c.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(c.user.length+c.authuri.length+8)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(0,0)+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(0,0,0,0)):0<=e.indexOf(3)?c.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(c.user.length+
59 +c.authuri.length+7)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(0,0)+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(0,0,0)):0<=e.indexOf(1)?c.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(c.user.length+c.pass.length+2)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(c.pass.length)+c.pass):c.Stop();else if(3!=b&&4!=b||1!=m)0==m?(1==c.protocol&&c.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(c.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+
60 +ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0)),2==c.protocol&&c.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0)),3==c.protocol&&(c.connectstate=1,c.xxStateChange(3))):c.Stop();else{var g=0,e=d.charCodeAt(g),m=d.substring(g+1,g+1+e),g=g+(e+1),l=d.charCodeAt(g),e=d.substring(g+1,g+1+l),g=g+(l+1),l=0,l=null,v=c.xxRandomNonce(32),x="";4==b&&(l=d.charCodeAt(g),l=d.substring(g+1,g+1+l),x="00000002:"+v+":"+l+":");d=hex_md5(hex_md5(c.user+":"+m+":"+c.pass)+":"+e+":"+x+hex_md5("POST:"+
61 +c.authuri));g=c.user.length+m.length+e.length+c.authuri.length+v.length+8+d.length+7;4==b&&(g+=l.length+1);d=String.fromCharCode(19,0,0,0,b)+IntToStrX(g)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(m.length)+m+String.fromCharCode(e.length)+e+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(v.length)+v+String.fromCharCode(8)+"00000002"+String.fromCharCode(d.length)+d;4==b&&(d+=String.fromCharCode(l.length)+l);c.xxSend(d)}break;case 33:if(23>c.amtaccumulator.length)break;
62 +a=23;c.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(c.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==c.protocol&&(c.amtkeepalivetimer=setInterval(c.xxSendAmtKeepAlive,2E3));c.connectstate=1;c.xxStateChange(3);break;case 41:if(10>c.amtaccumulator.length)break;a=10;break;case 42:if(10>c.amtaccumulator.length)break;b=10+((c.amtaccumulator.charCodeAt(9)&255)<<8)+(c.amtaccumulator.charCodeAt(8)&255);if(c.amtaccumulator.length<b)break;c.m.ProcessData(c.amtaccumulator.substring(10,b));a=b;break;
63 +case 43:if(8>c.amtaccumulator.length)break;a=8;break;case 65:if(8>c.amtaccumulator.length)break;c.connectstate=1;c.m.Start();8<c.amtaccumulator.length&&c.m.ProcessData(c.amtaccumulator.substring(8));a=c.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+c.amtaccumulator.charCodeAt(0)+" acclen="+c.amtaccumulator.length);c.Stop();return}if(0==a)break;c.amtaccumulator=c.amtaccumulator.substring(a)}}};c.xxSend=function(a){urlvars&&urlvars.redirtrace&&console.log("REDIR-SEND("+
64 +a.length+"): "+rstr2hex(a));if(null!=c.socket&&c.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),d=0;d<a.length;++d)b[d]=a.charCodeAt(d);c.socket.send(b.buffer)}};c.Send=function(a){null!=c.socket&&1==c.connectstate&&(1==c.protocol?c.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(c.amtsequence++)+ShortToStrX(a.length)+a):c.xxSend(a))};c.xxSendAmtKeepAlive=function(){null!=c.socket&&c.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(c.amtsequence++))};c.xxRandomNonceX="abcdef0123456789";
65 +c.xxRandomNonce=function(a){for(var b="",d=0;d<a;d++)b+=c.xxRandomNonceX.charAt(Math.floor(Math.random()*c.xxRandomNonceX.length));return b};c.xxOnSocketClosed=function(){urlvars&&urlvars.redirtrace&&console.log("REDIR-CLOSED");c.Stop()};c.xxStateChange=function(a){if(c.State!=a&&(c.State=a,c.m.xxStateChange(c.State),null!=c.onStateChanged))c.onStateChanged(c,c.State)};c.Stop=function(){c.xxStateChange(0);c.connectstate=-1;c.amtaccumulator="";null!=c.socket&&(c.socket.close(),c.socket=null);null!=
66 +c.amtkeepalivetimer&&(clearInterval(c.amtkeepalivetimer),c.amtkeepalivetimer=null)};c.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);c.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);c.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return c},WsmanStackCreateService=function(b,c,a,d,e,n){function p(a){for(var b,c={},m=0;m<a.childNodes.length;m++){var g=a.childNodes[m];b=null==g.childElementCount||0==g.childElementCount?g.textContent:p(g);"true"==b&&(b=!0);"false"==
67 +b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var h=b;if(null!=g.attributes&&0<g.attributes.length)for(h={Value:b},b=0;b<g.attributes.length;b++)h["@"+g.attributes[b].name]=g.attributes[b].value;c[g.localName]instanceof Array?c[g.localName].push(h):c[g.localName]=null==c[g.localName]?h:[c[g.localName],h]}return c}function r(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function m(a){if(!a)return"";if("string"==typeof a)return a;
68 +if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";var b="<w:SelectorSet>",c;for(c in a)if(a.hasOwnProperty(c)){b+='<w:Selector Name="'+c+'">';if(a[c].ReferenceParameters){var b=b+"<a:EndpointReference>",b=b+("<a:Address>"+a[c].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+a[c].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>"),m=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(m))for(var g=
69 +0;g<m.length;g++)b+="<w:Selector"+r(m[g])+">"+m[g].Value+"</w:Selector>";else b+="<w:Selector"+r(m)+">"+m.Value+"</w:Selector>";b+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else b+=a[c];b+="</w:Selector>"}return b+"</w:SelectorSet>"}var g={NextMessageId:1,Address:"/wsman"};g.comm=CreateWsmanComm(b,c,a,d,e,n);g.PerformAjax=function(a,b,c,m,d){null==d&&(d="");g.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+
70 +d+"><Header><a:Action>"+a,function(a,c,m){200!=c?b(g,null,{Header:{HttpError:c}},c,m):(a=g.ParseWsman(a))&&null!=a?b(g,a.Header.ResourceURI,a,200,m):b(g,null,{Header:{HttpError:c}},601,m)},c,m)};g.CancelAllQueries=function(a){g.comm.CancelAllQueries(a)};g.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};g.ExecSubscribe=function(a,b,c,d,k,h,e,q,C,B){var y="",I="";q="";null!=C&&null!=B&&(y='<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>'+
71 +C+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+B+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",I='<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>');null!=q&&(q="<a:ReferenceParameters><m:arg>"+q+"</m:arg></a:ReferenceParameters>");"PushWithAck"==b?b="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==b&&(b="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push");
72 +a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+m(e)+y+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.'+b+'"><e:NotifyTo><a:Address>'+c+"</a:Address>"+q+"</e:NotifyTo>"+I+"</e:Delivery></e:Subscribe>";g.PerformAjax(a+"</Body></Envelope>",d,k,
73 h,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};g.ExecUnSubscribe=function(a,b,c,d,k){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+m(k)+"</Header><Body><e:Unsubscribe/>";g.PerformAjax(a+"</Body></Envelope>",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};
71 -g.ExecPut=function(a,b,c,d,k,h){h="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+m(h)+"</Header><Body>";if(a&&null!=b){var e=g.GetNameFromUrl(a);a="<r:"+e+' xmlns:r="'+a+'">';for(var r in b)if(b.hasOwnProperty(r)&&
72 -0!==r.indexOf("__")&&0!==r.indexOf("@")&&null!=b[r]&&"function"!==typeof b[r])if("object"===typeof b[r]&&b[r].ReferenceParameters){a+="<r:"+r+"><a:Address>"+b[r].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+b[r].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var C=b[r].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(C))for(var B=0;B<C.length;B++)a+="<w:Selector"+q(C[B])+">"+C[B].Value+"</w:Selector>";else a+="<w:Selector"+q(C)+">"+C.Value+"</w:Selector>";
73 -a+="</w:SelectorSet></a:ReferenceParameters></r:"+r+">"}else if(Array.isArray(b[r]))for(B=0;B<b[r].length;B++)a+="<r:"+r+">"+b[r][B].toString()+"</r:"+r+">";else a+="<r:"+r+">"+b[r].toString()+"</r:"+r+">";b=a+("</r:"+e+">")}else b="";g.PerformAjax(h+b+"</Body></Envelope>",c,d,k)};g.ExecCreate=function(a,b,c,d,k,h){var e=g.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +
74 -"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+m(h)+"</Header><Body><g:"+e+' xmlns:g="'+a+'">';for(var r in b)a+="<g:"+r+">"+b[r]+"</g:"+r+">";g.PerformAjax(a+"</g:"+e+"></Body></Envelope>",c,d,k)};g.ExecDelete=function(a,b,c,d,k){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +
74 +g.ExecPut=function(a,b,c,d,k,h){h="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+m(h)+"</Header><Body>";if(a&&null!=b){var e=g.GetNameFromUrl(a);a="<r:"+e+' xmlns:r="'+a+'">';for(var q in b)if(b.hasOwnProperty(q)&&
75 +0!==q.indexOf("__")&&0!==q.indexOf("@")&&null!=b[q]&&"function"!==typeof b[q])if("object"===typeof b[q]&&b[q].ReferenceParameters){a+="<r:"+q+"><a:Address>"+b[q].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+b[q].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var C=b[q].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(C))for(var B=0;B<C.length;B++)a+="<w:Selector"+r(C[B])+">"+C[B].Value+"</w:Selector>";else a+="<w:Selector"+r(C)+">"+C.Value+"</w:Selector>";
76 +a+="</w:SelectorSet></a:ReferenceParameters></r:"+q+">"}else if(Array.isArray(b[q]))for(B=0;B<b[q].length;B++)a+="<r:"+q+">"+b[q][B].toString()+"</r:"+q+">";else a+="<r:"+q+">"+b[q].toString()+"</r:"+q+">";b=a+("</r:"+e+">")}else b="";g.PerformAjax(h+b+"</Body></Envelope>",c,d,k)};g.ExecCreate=function(a,b,c,d,k,h){var e=g.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +
77 +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+m(h)+"</Header><Body><g:"+e+' xmlns:g="'+a+'">';for(var q in b)a+="<g:"+q+">"+b[q]+"</g:"+q+">";g.PerformAjax(a+"</g:"+e+"></Body></Envelope>",c,d,k)};g.ExecDelete=function(a,b,c,d,k){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +
78 "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+m(b)+"</Header><Body /></Envelope>";g.PerformAjax(a,c,d,k)};g.ExecGet=function(a,b,c,m){g.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",
76 -b,c,m)};g.ExecMethod=function(a,b,c,m,d,h,e){var r="",C;for(C in c)if(null!=c[C])if(Array.isArray(c[C]))for(var B in c[C])r+="<r:"+C+">"+c[C][B]+"</r:"+C+">";else r+="<r:"+C+">"+c[C]+"</r:"+C+">";g.ExecMethodXml(a,b,r,m,d,h,e)};g.ExecMethodXml=function(a,b,c,d,k,h,e){g.PerformAjax(a+"/"+b+"</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+
79 +b,c,m)};g.ExecMethod=function(a,b,c,m,d,h,e){var q="",C;for(C in c)if(null!=c[C])if(Array.isArray(c[C]))for(var B in c[C])q+="<r:"+C+">"+c[C][B]+"</r:"+C+">";else q+="<r:"+C+">"+c[C]+"</r:"+C+">";g.ExecMethodXml(a,b,q,m,d,h,e)};g.ExecMethodXml=function(a,b,c,d,k,h,e){g.PerformAjax(a+"/"+b+"</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+
80 m(e)+"</Header><Body><r:"+b+'_INPUT xmlns:r="'+a+'">'+c+"</r:"+b+"_INPUT></Body></Envelope>",d,k,h)};g.ExecEnum=function(a,b,c,m){g.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',
81 b,c,m)};g.ExecPull=function(a,b,c,m,d){g.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+g.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+g.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+b+"</EnumerationContext></Pull></Body></Envelope>",
79 -c,m,d)};g.ParseWsman=function(a){try{if(!a.childNodes){var b=a;if(window.DOMParser)a=(new DOMParser).parseFromString(b,"text/xml");else{var c=new ActiveXObject("Microsoft.XMLDOM");c.async=!1;c.loadXML(b);a=c}}var b={Header:{}},m=a.getElementsByTagName("Header")[0],g;m||(m=a.getElementsByTagName("a:Header")[0]);if(!m)return null;for(c=0;c<m.childNodes.length;c++){var h=m.childNodes[c];b.Header[h.localName]=h.textContent}var d=a.getElementsByTagName("Body")[0];d||(d=a.getElementsByTagName("a:Body")[0]);
80 -if(!d)return null;0<d.childNodes.length&&(g=d.childNodes[0].localName,g.indexOf("_OUTPUT")==g.length-7&&(g=g.substring(0,g.length-7)),b.Header.Method=g,b.Body=p(d.childNodes[0]));return b}catch(e){return console.log("Unable to parse XML: "+a),null}};return g};
81 -function AmtStackCreateService(b){function c(){var a=l.GetPendingActions();v<a&&(v=a);null!=l.onProcessChanged&&x!=a&&(x=a,l.onProcessChanged(a,v));0==a&&(v=0)}function a(a,b,c,m,g,h,y){200!=g?(c(l,a,null,g,h),e(1)):null!=b&&"EnumerateResponse"==b.Header.Method&&b.Body.EnumerationContext?l.wsman.ExecPull(m,b.Body.EnumerationContext,function(b,m,g,k){d(a,g,c,m,[],k,h,y)}):(c(l,a,null,603,h),e(1))}function d(a,b,m,g,h,k,y,D){if(200!=k)m(l,a,null,k,y),e(1);else if(null==b||"PullResponse"!=b.Header.Method)m(l,
82 -a,null,604,y),e(1);else{for(var r in b.Body.Items)if(b.Body.Items[r]instanceof Array)for(var w in b.Body.Items[r])"function"!=typeof b.Body.Items[r][w]&&h.push(b.Body.Items[r][w]);else"function"!=typeof b.Body.Items[r]&&h.push(b.Body.Items[r]);b.Body.EnumerationContext?l.wsman.ExecPull(g,b.Body.EnumerationContext,function(b,c,g,k){d(a,g,m,c,h,k,y,1)}):(e(1),m(l,a,h,k,y),c())}}function e(a){l.ActiveEnumsCount-=a;l.ActiveEnumsCount>=l.MaxActiveEnumsCount||0==l.PendingEnums.length?c():(a=l.PendingEnums.shift(),
83 -l.Enum(a[0],a[1],a[2]),e(0))}function n(a,b,m,g,h,d,y){l.PendingBatchOperations-=2;var k=b.shift(),e=l.Enum;"*"==k[0]&&(e=l.Get,k=k.substring(1));e(k,function(h,k,e,r,D){D[2][k]={response:null==e?null:e.Body,responses:e,status:r};0==D[1].length||401==r||1!=d&&200!=r&&400!=r?(l.PendingBatchOperations-=2*b.length,c(),m(l,a,D[2],r,g)):(c(),n(a,b,m,g,D[2],y))},[a,b,h],y);c()}function p(a){a.names.length<=a.current?a.callback(l,a.name,a.responses,200,a.tag):(l.wsman.ExecGet(l.CompleteName(a.names[a.current]),
84 -function(b,c,m,g){null==m||200!=g?a.callback(l,a.name,null,g,a.tag):(a.responses[m.Header.Method]=m,p(a))},a.pri),a.current++);c()}function q(a,b,c,g,h){if(200!=g||"0"!=c.Body.ReturnValue)h[0](l,null,h[2]);else l.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,m,h)}function m(a,b,c,h,d){if(200!=h||"0"!=c.Body.ReturnValue)d[0](l,null,d[2]);else{var k,y,e;b=d[2];h=new Date;var r=c.Body.RecordArray;"string"===typeof r&&(c.Body.RecordArray=[c.Body.RecordArray]);for(k in r){a=null;try{a=window.atob(r[k])}catch(w){}if(null!=
85 -a&&(y=ReadIntX(a,0),0<y&&4294967295>y)){e={DeviceAddress:a.charCodeAt(4),EventSensorType:a.charCodeAt(5),EventType:a.charCodeAt(6),EventOffset:a.charCodeAt(7),EventSourceType:a.charCodeAt(8),EventSeverity:a.charCodeAt(9),SensorNumber:a.charCodeAt(10),Entity:a.charCodeAt(11),EntityInstance:a.charCodeAt(12),EventData:[],Time:new Date(1E3*(y+60*h.getTimezoneOffset()))};for(y=13;21>y;y++)e.EventData.push(a.charCodeAt(y));e.EntityStr=K[e.Entity];e.Desc=g(e.EventSensorType,e.EventOffset,e.EventData,e.Entity);
86 -e.EntityStr||(e.EntityStr="Unknown");b.push(e)}}if(1!=c.Body.NoMoreRecords)l.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,m,[d[0],b,d[2]]);else d[0](l,b,d[2])}}function g(a,b,c,m){if(15==a)return 235==c[0]?"Invalid Data":0==b?k[c[1]]:h[c[1]];if(18==a&&170==c[0])return"Agent watchdog "+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... changed to "+l.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Case intrusion";if(192==a&&0==b&&170==c[0]&&
82 +c,m,d)};g.ParseWsman=function(a){try{if(!a.childNodes){var b=a;if(window.DOMParser)a=(new DOMParser).parseFromString(b,"text/xml");else{var c=new ActiveXObject("Microsoft.XMLDOM");c.async=!1;c.loadXML(b);a=c}}var b={Header:{}},m=a.getElementsByTagName("Header")[0],g;m||(m=a.getElementsByTagName("a:Header")[0]);if(!m)return null;for(c=0;c<m.childNodes.length;c++){var d=m.childNodes[c];b.Header[d.localName]=d.textContent}var e=a.getElementsByTagName("Body")[0];e||(e=a.getElementsByTagName("a:Body")[0]);
83 +if(!e)return null;0<e.childNodes.length&&(g=e.childNodes[0].localName,g.indexOf("_OUTPUT")==g.length-7&&(g=g.substring(0,g.length-7)),b.Header.Method=g,b.Body=p(e.childNodes[0]));return b}catch(q){return console.log("Unable to parse XML: "+a),null}};return g};
84 +function AmtStackCreateService(b){function c(){var a=l.GetPendingActions();v<a&&(v=a);null!=l.onProcessChanged&&x!=a&&(x=a,l.onProcessChanged(a,v));0==a&&(v=0)}function a(a,b,c,m,g,h,k){200!=g?(c(l,a,null,g,h),e(1)):null!=b&&"EnumerateResponse"==b.Header.Method&&b.Body.EnumerationContext?l.wsman.ExecPull(m,b.Body.EnumerationContext,function(b,m,g,e){d(a,g,c,m,[],e,h,k)}):(c(l,a,null,603,h),e(1))}function d(a,b,m,g,h,k,z,D){if(200!=k)m(l,a,null,k,z),e(1);else if(null==b||"PullResponse"!=b.Header.Method)m(l,
85 +a,null,604,z),e(1);else{for(var q in b.Body.Items)if(b.Body.Items[q]instanceof Array)for(var w in b.Body.Items[q])"function"!=typeof b.Body.Items[q][w]&&h.push(b.Body.Items[q][w]);else"function"!=typeof b.Body.Items[q]&&h.push(b.Body.Items[q]);b.Body.EnumerationContext?l.wsman.ExecPull(g,b.Body.EnumerationContext,function(b,c,g,k){d(a,g,m,c,h,k,z,1)}):(e(1),m(l,a,h,k,z),c())}}function e(a){l.ActiveEnumsCount-=a;l.ActiveEnumsCount>=l.MaxActiveEnumsCount||0==l.PendingEnums.length?c():(a=l.PendingEnums.shift(),
86 +l.Enum(a[0],a[1],a[2]),e(0))}function n(a,b,m,g,d,h,k){l.PendingBatchOperations-=2;var e=b.shift(),q=l.Enum;"*"==e[0]&&(q=l.Get,e=e.substring(1));q(e,function(d,e,q,D,A){A[2][e]={response:null==q?null:q.Body,responses:q,status:D};0==A[1].length||401==D||1!=h&&200!=D&&400!=D?(l.PendingBatchOperations-=2*b.length,c(),m(l,a,A[2],D,g)):(c(),n(a,b,m,g,A[2],k))},[a,b,d],k);c()}function p(a){a.names.length<=a.current?a.callback(l,a.name,a.responses,200,a.tag):(l.wsman.ExecGet(l.CompleteName(a.names[a.current]),
87 +function(b,c,m,g){null==m||200!=g?a.callback(l,a.name,null,g,a.tag):(a.responses[m.Header.Method]=m,p(a))},a.pri),a.current++);c()}function r(a,b,c,g,d){if(200!=g||"0"!=c.Body.ReturnValue)d[0](l,null,d[2]);else l.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,m,d)}function m(a,b,c,d,h){if(200!=d||"0"!=c.Body.ReturnValue)h[0](l,null,h[2]);else{var k,e,q;b=h[2];d=new Date;var A=c.Body.RecordArray;"string"===typeof A&&(c.Body.RecordArray=[c.Body.RecordArray]);for(k in A){a=null;try{a=window.atob(A[k])}catch(w){}if(null!=
88 +a&&(e=ReadIntX(a,0),0<e&&4294967295>e)){q={DeviceAddress:a.charCodeAt(4),EventSensorType:a.charCodeAt(5),EventType:a.charCodeAt(6),EventOffset:a.charCodeAt(7),EventSourceType:a.charCodeAt(8),EventSeverity:a.charCodeAt(9),SensorNumber:a.charCodeAt(10),Entity:a.charCodeAt(11),EntityInstance:a.charCodeAt(12),EventData:[],Time:new Date(1E3*(e+60*d.getTimezoneOffset()))};for(e=13;21>e;e++)q.EventData.push(a.charCodeAt(e));q.EntityStr=K[q.Entity];q.Desc=g(q.EventSensorType,q.EventOffset,q.EventData,q.Entity);
89 +q.EntityStr||(q.EntityStr="Unknown");b.push(q)}}if(1!=c.Body.NoMoreRecords)l.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,m,[h[0],b,h[2]]);else h[0](l,b,h[2])}}function g(a,b,c,m){if(15==a)return 235==c[0]?"Invalid Data":0==b?k[c[1]]:h[c[1]];if(18==a&&170==c[0])return"Agent watchdog "+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... changed to "+l.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Case intrusion";if(192==a&&0==b&&170==c[0]&&
90 48==c[1]){if(0==c[2])return"A remote Serial Over LAN session was established.";if(1==c[2])return"Remote Serial Over LAN session finished. User control was restored.";if(2==c[2])return"A remote IDE-Redirection session was established.";if(3==c[2])return"Remote IDE-Redirection session finished. User control was restored."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="wired"),4294967293==a?"All received packet filter was matched on "+b+" interface.":4294967292==a?"All outbound packet filter was matched on "+
91 b+" interface.":4294967290==a?"Spoofed packet filter was matched on "+b+" interface.":"Filter "+a+" was matched on "+b+" interface.";if(192==a)return 0==c[2]?"Security policy invoked. Some or all network traffic (TX) was stopped.":2==c[2]?"Security policy invoked. Some or all network traffic (RX) was stopped.":"Security policy invoked.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"User request for remote connection.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"EAC error: attempt to get posture while NAC in Intel\ufffd AMT is disabled.";
89 -if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"Certificate revoked. "}return 6==a?"Authentication failed "+(c[1]+(c[2]<<8))+" times. The system may be under attack.":30==a?"No bootable media":32==a?"Operating system lockup or power interrupt":35==a?"System boot failure":37==a?"System firmware started (at least one CPU is properly executing).":"Unknown Sensor Type #"+a}function w(a,b,c,m,g){if(200!=m)g[0](l,[],m);else{var h,d,k=g[1],e=new Date,x;if(0<c.Body.RecordsReturned)for(d in c.Body.EventRecords=
90 -MakeToArray(c.Body.EventRecords),c.Body.EventRecords){a=null;try{a=window.atob(c.Body.EventRecords[d])}catch(v){console.log(v+" "+c.Body.EventRecords[d])}b={AuditAppID:ReadShort(a,0),EventID:ReadShort(a,2),InitiatorType:a.charCodeAt(4)};b.AuditApp=r[b.AuditAppID];b.Event=r[100*b.AuditAppID+b.EventID];b.Event||(b.Event="#"+b.EventID);0==b.InitiatorType&&(h=a.charCodeAt(5),b.Initiator=a.substring(6,6+h),h=6+h);1==b.InitiatorType&&(b.KerberosUserInDomain=ReadInt(a,5),h=a.charCodeAt(9),b.Initiator=GetSidString(a.substring(10,
91 -10+h)),h=10+h);2==b.InitiatorType&&(b.Initiator="<i>Local</i>",h=5);3==b.InitiatorType&&(b.Initiator="<i>KVM Default Port</i>",h=5);x=ReadInt(a,h);b.Time=new Date(1E3*(x+60*e.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);x=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+x);h+=x;x=a.charCodeAt(h++);b.Ex=a.substring(h,h+x);b.ExStr=l.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);k.push(b)}if(c.Body.TotalRecordCount>k.length)l.AMT_AuditLog_ReadRecords(k.length+1,w,[g[0],k]);
92 -else g[0](l,k,m)}}var l={};l.wsman=b;l.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];l.PendingEnums=[];l.PendingBatchOperations=0;l.ActiveEnumsCount=0;l.MaxActiveEnumsCount=1;l.onProcessChanged=null;var v=0,x=0;l.GetPendingActions=function(){return 2*l.PendingEnums.length+l.ActiveEnumsCount+l.wsman.comm.PendingAjax.length+l.wsman.comm.ActiveAjaxCount+l.PendingBatchOperations};l.Subscribe=function(a,
93 -b,m,g,h,d,y,k,e,r){l.wsman.ExecSubscribe(l.CompleteName(a),b,m,function(b,m,z,d){c();g(l,a,z,d,h)},0,d,y,k,e,r);c()};l.UnSubscribe=function(a,b,m,g,h){l.wsman.ExecUnSubscribe(l.CompleteName(a),function(g,h,d,k){c();b(l,a,d,k,m)},0,g,h);c()};l.Get=function(a,b,m,g){l.wsman.ExecGet(l.CompleteName(a),function(g,h,d,k){c();b(l,a,d,k,m)},0,g);c()};l.Put=function(a,b,m,g,h,d){l.wsman.ExecPut(l.CompleteName(a),b,function(b,h,d,k){c();m(l,a,d,k,g)},0,h,d);c()};l.Create=function(a,b,m,g,h){l.wsman.ExecCreate(l.CompleteName(a),
94 -b,function(b,h,d,k){c();m(l,a,d,k,g)},0,h);c()};l.Delete=function(a,b,m,g,h){l.wsman.ExecDelete(l.CompleteName(a),b,function(b,h,d,k){c();m(l,a,d,k,g)},0,h);c()};l.Exec=function(a,b,m,g,h,d,k){l.wsman.ExecMethod(l.CompleteName(a),b,m,function(b,m,z,d){c();g(l,a,l.CompleteExecResponse(z),d,h)},0,d,k);c()};l.ExecWithXml=function(a,b,m,g,h,d,k){l.wsman.ExecMethodXml(l.CompleteName(a),b,execArgumentsToXml(m),function(b,m,z,d){c();g(l,a,l.CompleteExecResponse(z),d,h)},0,d,k);c()};l.Enum=function(b,m,g,
95 -h){l.ActiveEnumsCount<l.MaxActiveEnumsCount?(l.ActiveEnumsCount++,l.wsman.ExecEnum(l.CompleteName(b),function(g,h,z,d,k){c();a(b,z,m,h,d,k)},g,h)):l.PendingEnums.push([b,m,g,h]);c()};l.BatchEnum=function(a,b,m,g,h,d){l.PendingBatchOperations+=2*b.length;n(a,Clone(b),m,g,{},h,d);c()};l.BatchGet=function(a,b,m,g,h){p({name:a,names:b,callback:m,current:0,responses:{},tag:g,pri:h});c()};l.CompleteName=function(a){if(0==a.indexOf("AMT_"))return l.pfx[0]+a;if(0==a.indexOf("CIM_"))return l.pfx[1]+a;if(0==
92 +if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"Certificate revoked. "}return 6==a?"Authentication failed "+(c[1]+(c[2]<<8))+" times. The system may be under attack.":30==a?"No bootable media":32==a?"Operating system lockup or power interrupt":35==a?"System boot failure":37==a?"System firmware started (at least one CPU is properly executing).":"Unknown Sensor Type #"+a}function w(a,b,c,m,g){if(200!=m)g[0](l,[],m);else{var d,h,e=g[1],k=new Date,x;if(0<c.Body.RecordsReturned)for(h in c.Body.EventRecords=
93 +MakeToArray(c.Body.EventRecords),c.Body.EventRecords){a=null;try{a=window.atob(c.Body.EventRecords[h])}catch(v){console.log(v+" "+c.Body.EventRecords[h])}b={AuditAppID:ReadShort(a,0),EventID:ReadShort(a,2),InitiatorType:a.charCodeAt(4)};b.AuditApp=q[b.AuditAppID];b.Event=q[100*b.AuditAppID+b.EventID];b.Event||(b.Event="#"+b.EventID);0==b.InitiatorType&&(d=a.charCodeAt(5),b.Initiator=a.substring(6,6+d),d=6+d);1==b.InitiatorType&&(b.KerberosUserInDomain=ReadInt(a,5),d=a.charCodeAt(9),b.Initiator=GetSidString(a.substring(10,
94 +10+d)),d=10+d);2==b.InitiatorType&&(b.Initiator="<i>Local</i>",d=5);3==b.InitiatorType&&(b.Initiator="<i>KVM Default Port</i>",d=5);x=ReadInt(a,d);b.Time=new Date(1E3*(x+60*k.getTimezoneOffset()));d+=4;b.MCLocationType=a.charCodeAt(d++);x=a.charCodeAt(d++);b.NetAddress=a.substring(d,d+x);d+=x;x=a.charCodeAt(d++);b.Ex=a.substring(d,d+x);b.ExStr=l.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);e.push(b)}if(c.Body.TotalRecordCount>e.length)l.AMT_AuditLog_ReadRecords(e.length+1,w,[g[0],e]);
95 +else g[0](l,e,m)}}var l={};l.wsman=b;l.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];l.PendingEnums=[];l.PendingBatchOperations=0;l.ActiveEnumsCount=0;l.MaxActiveEnumsCount=1;l.onProcessChanged=null;var v=0,x=0;l.GetPendingActions=function(){return 2*l.PendingEnums.length+l.ActiveEnumsCount+l.wsman.comm.PendingAjax.length+l.wsman.comm.ActiveAjaxCount+l.PendingBatchOperations};l.Subscribe=function(a,
96 +b,m,g,d,h,e,k,q,w){l.wsman.ExecSubscribe(l.CompleteName(a),b,m,function(b,m,y,h){c();g(l,a,y,h,d)},0,h,e,k,q,w);c()};l.UnSubscribe=function(a,b,m,g,d){l.wsman.ExecUnSubscribe(l.CompleteName(a),function(g,d,h,e){c();b(l,a,h,e,m)},0,g,d);c()};l.Get=function(a,b,m,g){l.wsman.ExecGet(l.CompleteName(a),function(g,d,h,e){c();b(l,a,h,e,m)},0,g);c()};l.Put=function(a,b,m,g,d,h){l.wsman.ExecPut(l.CompleteName(a),b,function(b,d,h,e){c();m(l,a,h,e,g)},0,d,h);c()};l.Create=function(a,b,m,g,d){l.wsman.ExecCreate(l.CompleteName(a),
97 +b,function(b,d,h,e){c();m(l,a,h,e,g)},0,d);c()};l.Delete=function(a,b,m,g,d){l.wsman.ExecDelete(l.CompleteName(a),b,function(b,d,h,e){c();m(l,a,h,e,g)},0,d);c()};l.Exec=function(a,b,m,g,d,h,e){l.wsman.ExecMethod(l.CompleteName(a),b,m,function(b,m,y,h){c();g(l,a,l.CompleteExecResponse(y),h,d)},0,h,e);c()};l.ExecWithXml=function(a,b,m,g,d,h,e){l.wsman.ExecMethodXml(l.CompleteName(a),b,execArgumentsToXml(m),function(b,m,h,y){c();g(l,a,l.CompleteExecResponse(h),y,d)},0,h,e);c()};l.Enum=function(b,m,g,
98 +d){l.ActiveEnumsCount<l.MaxActiveEnumsCount?(l.ActiveEnumsCount++,l.wsman.ExecEnum(l.CompleteName(b),function(g,d,h,y,e){c();a(b,h,m,d,y,e)},g,d)):l.PendingEnums.push([b,m,g,d]);c()};l.BatchEnum=function(a,b,m,g,d,h){l.PendingBatchOperations+=2*b.length;n(a,Clone(b),m,g,{},d,h);c()};l.BatchGet=function(a,b,m,g,d){p({name:a,names:b,callback:m,current:0,responses:{},tag:g,pri:d});c()};l.CompleteName=function(a){if(0==a.indexOf("AMT_"))return l.pfx[0]+a;if(0==a.indexOf("CIM_"))return l.pfx[1]+a;if(0==
99 a.indexOf("IPS_"))return l.pfx[2]+a};l.CompleteExecResponse=function(a){a&&null!=a&&a.Body&&void 0!=a.Body.ReturnValue&&(a.Body.ReturnValueStr=l.AmtStatusToStr(a.Body.ReturnValue));return a};l.RequestPowerStateChange=function(a,b){l.CIM_PowerManagementService_RequestPowerStateChange(a,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',
100 null,null,b)};l.SetBootConfigRole=function(a,b){l.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',
98 -a,b)};l.CancelAllQueries=function(a){l.wsman.CancelAllQueries(a)};l.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){l.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};l.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){l.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){l.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,m,g,h,
99 -d,k,e){l.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:m,ActionEac:g},h,d,k,e)};l.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,m){l.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,m)};l.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){l.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};l.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){l.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};l.AMT_AgentPresenceWatchdogVA_AssertPresence=
100 -function(a,b){l.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){l.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,m,g,h){l.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:m,ActionEac:g},h)};l.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){l.Exec("AMT_AgentPresenceWatchdogVA",
101 +a,b)};l.CancelAllQueries=function(a){l.wsman.CancelAllQueries(a)};l.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){l.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};l.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){l.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){l.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,m,g,d,
102 +h,e,k){l.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:m,ActionEac:g},d,h,e,k)};l.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,m){l.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,m)};l.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){l.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};l.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){l.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};l.AMT_AgentPresenceWatchdogVA_AssertPresence=
103 +function(a,b){l.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){l.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,m,g,d){l.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:m,ActionEac:g},d)};l.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){l.Exec("AMT_AgentPresenceWatchdogVA",
104 "DeleteAllActions",{_method_dummy:a},b)};l.AMT_AuditLog_ClearLog=function(a){l.Exec("AMT_AuditLog","ClearLog",{},a)};l.AMT_AuditLog_RequestStateChange=function(a,b,c){l.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_AuditLog_ReadRecords=function(a,b,c){l.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};l.AMT_AuditLog_SetAuditLock=function(a,b,c,m){l.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},m)};l.AMT_AuditLog_ExportAuditLogSignature=
105 function(a,b){l.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};l.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,m,g){l.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:m},g)};l.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,m,g){l.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:m},g)};l.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,m,g){l.Exec("AMT_AuditPolicyRule",
103 -"SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:m},g)};l.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,m,g,h){l.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:m,Realms:g},h)};l.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){l.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};l.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){l.Exec("AMT_AuthorizationService",
104 -"GetUserAclEntryEx",{Handle:a},b,c)};l.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,m,g,h,d){l.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:m,AccessPermission:g,Realms:h},d)};l.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){l.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};l.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){l.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",
106 +"SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:m},g)};l.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,m,g,d){l.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:m,Realms:g},d)};l.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){l.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};l.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){l.Exec("AMT_AuthorizationService",
107 +"GetUserAclEntryEx",{Handle:a},b,c)};l.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,m,g,d,h){l.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:m,AccessPermission:g,Realms:d},h)};l.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){l.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};l.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){l.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",
108 {Username:a,DigestPassword:b},c)};l.AMT_AuthorizationService_GetAdminAclEntry=function(a){l.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};l.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){l.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};l.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){l.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};l.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,m){l.Exec("AMT_AuthorizationService",
109 "SetAclEnabledState",{Handle:a,Enabled:b},c,m)};l.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){l.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};l.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){l.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_EndpointAccessControlService_GetPosture=function(a,b){l.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};l.AMT_EndpointAccessControlService_GetPostureHash=
110 function(a,b){l.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};l.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){l.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};l.AMT_EndpointAccessControlService_GetEacOptions=function(a){l.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};l.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){l.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a,
@@ -111,14 +114,14 @@ function(a,b,c){l.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:a,T
114 "PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},m)};l.AMT_MessageLog_PositionToFirstRecord=function(a,b){l.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};l.AMT_MessageLog_FreezeLog=function(a,b){l.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};l.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){l.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:a,SerialNumbers:b},c)};l.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){l.Exec("AMT_PublicKeyManagementService",
115 "ResetCRLList",{_method_dummy:a},b)};l.AMT_PublicKeyManagementService_AddCertificate=function(a,b){l.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};l.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){l.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};l.AMT_PublicKeyManagementService_AddKey=function(a,b){l.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};l.AMT_PublicKeyManagementService_GeneratePKCS10Request=
116 function(a,b,c,m){l.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},m)};l.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,m){l.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},m)};l.AMT_PublicKeyManagementService_GenerateKeyPair=function(a,b,c){l.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};l.AMT_RedirectionService_RequestStateChange=
114 -function(a,b){l.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};l.AMT_RedirectionService_TerminateSession=function(a,b){l.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};l.AMT_RemoteAccessService_AddMpServer=function(a,b,c,m,g,h,d,k,e){l.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b,Port:c,AuthMethod:m,Certificate:g,Username:h,Password:d,CN:k},e)};l.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,m,g,h){l.Exec("AMT_RemoteAccessService",
115 -"AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:m,InternalMpServer:g},h)};l.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){l.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};l.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){l.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:a},b)};l.AMT_SetupAndConfigurationService_Unprovision=function(a,b){l.Exec("AMT_SetupAndConfigurationService",
117 +function(a,b){l.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};l.AMT_RedirectionService_TerminateSession=function(a,b){l.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};l.AMT_RemoteAccessService_AddMpServer=function(a,b,c,m,g,d,h,e,k){l.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b,Port:c,AuthMethod:m,Certificate:g,Username:d,Password:h,CN:e},k)};l.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,m,g,d){l.Exec("AMT_RemoteAccessService",
118 +"AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:m,InternalMpServer:g},d)};l.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){l.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};l.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){l.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:a},b)};l.AMT_SetupAndConfigurationService_Unprovision=function(a,b){l.Exec("AMT_SetupAndConfigurationService",
119 "Unprovision",{ProvisioningMode:a},b)};l.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){l.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};l.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){l.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)};l.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){l.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",
120 {Duration:a},b)};l.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){l.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};l.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){l.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};l.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){l.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},a)};l.AMT_SetupAndConfigurationService_GetUuid=function(a){l.Exec("AMT_SetupAndConfigurationService",
121 "GetUuid",{},a)};l.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){l.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};l.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){l.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};l.AMT_SystemDefensePolicy_GetTimeout=function(a){l.Exec("AMT_SystemDefensePolicy","GetTimeout",{},a)};l.AMT_SystemDefensePolicy_SetTimeout=function(a,b){l.Exec("AMT_SystemDefensePolicy",
119 -"SetTimeout",{Timeout:a},b)};l.AMT_SystemDefensePolicy_UpdateStatistics=function(a,b,c,m,g,h){l.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:b},c,m,g,h)};l.AMT_SystemPowerScheme_SetPowerScheme=function(a,b,c){l.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,c,0,{InstanceID:b})};l.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(a,b){l.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,b)};l.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=
120 -function(a,b,c,m,g){l.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:a,Tm1:b,Tm2:c},m,g)};l.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,b,c){l.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_WebUIService_RequestStateChange=function(a,b,c){l.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,b,c,m,g,h){l.ExecWithXml("AMT_WiFiPortConfigurationService",
121 -"AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:m,CACredential:g},h)};l.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,b,c,m,g,h){l.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:m,CACredential:g},h)};l.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,b){l.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",
122 +"SetTimeout",{Timeout:a},b)};l.AMT_SystemDefensePolicy_UpdateStatistics=function(a,b,c,m,g,d){l.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:b},c,m,g,d)};l.AMT_SystemPowerScheme_SetPowerScheme=function(a,b,c){l.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,c,0,{InstanceID:b})};l.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(a,b){l.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,b)};l.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=
123 +function(a,b,c,m,g){l.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:a,Tm1:b,Tm2:c},m,g)};l.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,b,c){l.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_WebUIService_RequestStateChange=function(a,b,c){l.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,b,c,m,g,d){l.ExecWithXml("AMT_WiFiPortConfigurationService",
124 +"AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:m,CACredential:g},d)};l.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,b,c,m,g,d){l.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:m,CACredential:g},d)};l.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,b){l.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",
125 {_method_dummy:a},b)};l.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(a,b){l.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:a},b)};l.CIM_Account_RequestStateChange=function(a,b,c){l.Exec("CIM_Account","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.CIM_AccountManagementService_CreateAccount=function(a,b,c){l.Exec("CIM_AccountManagementService","CreateAccount",{System:a,AccountTemplate:b},c)};l.CIM_BootConfigSetting_ChangeBootOrder=function(a,
126 b){l.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:a},b)};l.CIM_BootService_SetBootConfigRole=function(a,b,c){l.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:a,Role:b},c,0,1)};l.CIM_Card_ConnectorPower=function(a,b,c){l.Exec("CIM_Card","ConnectorPower",{Connector:a,PoweredOn:b},c)};l.CIM_Card_IsCompatible=function(a,b){l.Exec("CIM_Card","IsCompatible",{ElementToCheck:a},b)};l.CIM_Chassis_IsCompatible=function(a,b){l.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:a},b)};
127 l.CIM_Fan_SetSpeed=function(a,b){l.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:a},b)};l.CIM_KVMRedirectionSAP_RequestStateChange=function(a,b,c){l.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:a},c)};l.CIM_MediaAccessDevice_LockMedia=function(a,b){l.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:a},b)};l.CIM_MediaAccessDevice_SetPowerState=function(a,b,c){l.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:a,Time:b},c)};l.CIM_MediaAccessDevice_Reset=function(a){l.Exec("CIM_MediaAccessDevice",
@@ -133,8 +136,8 @@ b,c){l.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:a,Time
136 "KeepAlive",{},a)};l.CIM_Watchdog_SetPowerState=function(a,b,c){l.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};l.CIM_Watchdog_Reset=function(a){l.Exec("CIM_Watchdog","Reset",{},a)};l.CIM_Watchdog_EnableDevice=function(a,b){l.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};l.CIM_Watchdog_OnlineDevice=function(a,b){l.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};l.CIM_Watchdog_QuiesceDevice=function(a,b){l.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};l.CIM_Watchdog_SaveProperties=
137 function(a){l.Exec("CIM_Watchdog","SaveProperties",{},a)};l.CIM_Watchdog_RestoreProperties=function(a){l.Exec("CIM_Watchdog","RestoreProperties",{},a)};l.CIM_Watchdog_RequestStateChange=function(a,b,c){l.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.CIM_WiFiPort_SetPowerState=function(a,b,c){l.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};l.CIM_WiFiPort_Reset=function(a){l.Exec("CIM_WiFiPort","Reset",{},a)};l.CIM_WiFiPort_EnableDevice=function(a,
138 b){l.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};l.CIM_WiFiPort_OnlineDevice=function(a,b){l.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};l.CIM_WiFiPort_QuiesceDevice=function(a,b){l.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};l.CIM_WiFiPort_SaveProperties=function(a){l.Exec("CIM_WiFiPort","SaveProperties",{},a)};l.CIM_WiFiPort_RestoreProperties=function(a){l.Exec("CIM_WiFiPort","RestoreProperties",{},a)};l.CIM_WiFiPort_RequestStateChange=function(a,b,c){l.Exec("CIM_WiFiPort",
136 -"RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.IPS_HostBasedSetupService_Setup=function(a,b,c,m,g,h,d){l.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,Certificate:m,SigningAlgorithm:g,DigitalSignature:h},d)};l.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,m){l.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},m)};l.IPS_HostBasedSetupService_AdminSetup=
137 -function(a,b,c,m,g,h){l.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:m,DigitalSignature:g},h)};l.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(a,b,c,m){l.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},m)};l.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){l.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},
139 +"RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.IPS_HostBasedSetupService_Setup=function(a,b,c,m,g,d,h){l.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,Certificate:m,SigningAlgorithm:g,DigitalSignature:d},h)};l.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,m){l.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},m)};l.IPS_HostBasedSetupService_AdminSetup=
140 +function(a,b,c,m,g,d){l.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:m,DigitalSignature:g},d)};l.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(a,b,c,m){l.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},m)};l.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){l.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},
141 b)};l.IPS_KVMRedirectionSettingData_TerminateSession=function(a){l.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};l.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){l.Exec("IPS_KVMRedirectionSettingData","DataChannelRead",{},a)};l.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){l.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};l.IPS_OptInService_StartOptIn=function(a){l.Exec("IPS_OptInService","StartOptIn",{},a)};l.IPS_OptInService_CancelOptIn=
142 function(a){l.Exec("IPS_OptInService","CancelOptIn",{},a)};l.IPS_OptInService_SendOptInCode=function(a,b){l.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};l.IPS_OptInService_StartService=function(a){l.Exec("IPS_OptInService","StartService",{},a)};l.IPS_OptInService_StopService=function(a){l.Exec("IPS_OptInService","StopService",{},a)};l.IPS_OptInService_RequestStateChange=function(a,b,c){l.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.IPS_ProvisioningRecordLog_RequestStateChange=
143 function(a,b,c){l.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.IPS_ProvisioningRecordLog_ClearLog=function(a,b){l.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:a},b)};l.IPS_ScreenConfigurationService_SetSessionState=function(a,b,c){l.Exec("IPS_ScreenConfigurationService","SetSessionState",{SessionState:a,ConsecutiveRebootsNum:b},c)};l.IPS_SecIOService_RequestStateChange=function(a,b,c){l.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:a,
@@ -142,11 +145,11 @@ TimeoutPeriod:b},c)};l.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,m
145 9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",
146 30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",
147 1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",
145 -2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};l.GetMessageLog=function(a,b){l.AMT_MessageLog_PositionToFirstRecord(q,
148 +2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};l.GetMessageLog=function(a,b){l.AMT_MessageLog_PositionToFirstRecord(r,
149 [a,b,[]])};var k="Unspecified.;No system memory is physically installed in the system.;No usable system memory, all installed memory has experienced an unrecoverable failure.;Unrecoverable hard-disk/ATAPI/IDE device failure.;Unrecoverable system-board failure.;Unrecoverable diskette subsystem failure.;Unrecoverable hard-disk controller failure.;Unrecoverable PS/2 or USB keyboard failure.;Removable boot media not found.;Unrecoverable video controller failure.;No video device detected.;Firmware (BIOS) ROM corruption detected.;CPU voltage mismatch (processors that share same supply have mismatched voltage requirements);CPU speed matching failure".split(";"),
150 h="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;User-initiated system setup;USB resource configuration;PCI resource configuration;Option ROM initialization;Video initialization;Cache initialization;SM Bus initialization;Keyboard controller initialization;Embedded controller/management controller initialization;Docking station attachment;Enabling docking station;Docking station ejection;Disabling docking station;Calling operating system wake-up vector;Starting operating system boot process;Baseboard or motherboard initialization;reserved;Floppy initialization;Keyboard test;Pointing device test;Primary processor initialization".split(";"),
151 K="Unspecified;Other;Unknown;Processor;Disk;Peripheral;System management module;System board;Memory module;Processor module;Power supply;Add in card;Front panel board;Back panel board;Power system board;Drive backplane;System internal expansion board;Other system board;Processor board;Power unit;Power module;Power management board;Chassis back panel board;System chassis;Sub chassis;Other chassis board;Disk drive bay;Peripheral bay;Device bay;Fan cooling;Cooling unit;Cable interconnect;Memory device;System management software;BIOS;Intel(r) ME;System bus;Group;Intel(r) ME;External environment;Battery;Processing blade;Connectivity switch;Processor/memory module;I/O module;Processor I/O module;Management controller firmware;IPMI channel;PCI bus;PCI express bus;SCSI bus;SATA/SAS bus;Processor front side bus".split(";");
149 -l.RealmNames=";;Redirection;;Hardware Asset;Remote Control;Storage;Event Manager;Storage Admin;Agent Presence Local;Agent Presence Remote;Circuit Breaker;Network Time;General Information;Firmware Update;EIT;LocalUN;Endpoint Access Control;Endpoint Access Control Admin;Event Log Reader;Audit Log;ACL Realm;;;Local System".split(";");l.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};var r={16:"Security Admin",17:"RCO",18:"Redirection Manager",19:"Firmware Update Manager",
152 +l.RealmNames=";;Redirection;;Hardware Asset;Remote Control;Storage;Event Manager;Storage Admin;Agent Presence Local;Agent Presence Remote;Circuit Breaker;Network Time;General Information;Firmware Update;EIT;LocalUN;Endpoint Access Control;Endpoint Access Control Admin;Event Log Reader;Audit Log;ACL Realm;;;Local System".split(";");l.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};var q={16:"Security Admin",17:"RCO",18:"Redirection Manager",19:"Firmware Update Manager",
153 20:"Security Audit Log",21:"Network Time",22:"Network Administration",23:"Storage Administration",24:"Event Manager",25:"Circuit Breaker Manager",26:"Agent Presence Manager",27:"Wireless Configuration",28:"EAC",29:"KVM",30:"User Opt-In Events",32:"Screen Blanking",33:"Watchdog Events",1600:"Provisioning Started",1601:"Provisioning Completed",1602:"ACL Entry Added",1603:"ACL Entry Modified",1604:"ACL Entry Removed",1605:"ACL Access with Invalid Credentials",1606:"ACL Entry State",1607:"TLS State Changed",
154 1608:"TLS Server Certificate Set",1609:"TLS Server Certificate Remove",1610:"TLS Trusted Root Certificate Added",1611:"TLS Trusted Root Certificate Removed",1612:"TLS Preshared Key Set",1613:"Kerberos Settings Modified",1614:"Kerberos Master Key Modified",1615:"Flash Wear out Counters Reset",1616:"Power Package Modified",1617:"Set Realm Authentication Mode",1618:"Upgrade Client to Admin Control Mode",1619:"Unprovisioning Started",1700:"Performed Power Up",1701:"Performed Power Down",1702:"Performed Power Cycle",
155 1703:"Performed Reset",1704:"Set Boot Options",1800:"IDER Session Opened",1801:"IDER Session Closed",1802:"IDER Enabled",1803:"IDER Disabled",1804:"SoL Session Opened",1805:"SoL Session Closed",1806:"SoL Enabled",1807:"SoL Disabled",1808:"KVM Session Started",1809:"KVM Session Ended",1810:"KVM Enabled",1811:"KVM Disabled",1812:"VNC Password Failed 3 Times",1900:"Firmware Updated",1901:"Firmware Update Failed",2E3:"Security Audit Log Cleared",2001:"Security Audit Policy Modified",2002:"Security Audit Log Disabled",
@@ -160,11 +163,11 @@ function instanceToXml(b,c){if(void 0===c||null===c)return null;var a=!!c.__name
163 function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+c.__resourceUri+"</w:ResourceURI><w:SelectorSet>",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+='<w:Selector Name="'+d+'">'+c[d].toString()+"</w:Selector>"));return a+("</w:SelectorSet></a:ReferenceParameters></r:"+b+">")}
164 function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;a<b.length/4;a++)c+="-"+ReadIntX(b,4*a);return c}
165 function GetSidByteArray(b){if(!b||null==b)return null;b=b.split("-");if(4>b.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;c<b.length;c++){var a=parseInt(b[c]);if(a!=b[c])return null;b[c]=a}a=String.fromCharCode(b[1])+String.fromCharCode(b.length-3)+ShortToStr(Math.floor(b[2]/Math.pow(2,32)))+IntToStr(b[2]&65535);for(c=3;c<b.length;c++)a+=IntToStrX(b[c]);return a}
163 -(function(b,c){"function"===typeof define&&define.amd?define([],c):b.forge=c()})(this,function(){var b,c,a;(function(d){function e(a,b){var c,m,g,h,d,k,e,z,l,w=b&&b.split("/"),x=r.map,v=x&&x["*"]||{};if(a&&"."===a.charAt(0))if(b){w=w.slice(0,w.length-1);a=a.split("/");d=a.length-1;r.nodeIdCompat&&I.test(a[d])&&(a[d]=a[d].replace(I,""));a=w.concat(a);for(d=0;d<a.length;d+=1)if(c=a[d],"."===c)a.splice(d,1),--d;else if(".."===c)if(1!==d||".."!==a[2]&&".."!==a[0])0<d&&(a.splice(d-1,2),d-=2);else break;
164 -a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((w||v)&&x){c=a.split("/");for(d=c.length;0<d;--d){m=c.slice(0,d).join("/");if(w)for(l=w.length;0<l;--l)if(g=x[w.slice(0,l).join("/")])if(g=g[m]){h=g;k=d;break}if(h)break;!e&&v&&v[m]&&(e=v[m],z=d)}!h&&e&&(h=e,k=z);h&&(c.splice(0,k,h),a=c.join("/"))}return a}function n(a,b){return function(){return v.apply(d,z.call(arguments,0).concat([a,b]))}}function p(a){return function(b){return e(b,a)}}function q(a){return function(b){h[a]=b}}function m(a){if(B.call(K,
165 -a)){var b=K[a];delete K[a];C[a]=!0;l.apply(d,b)}if(!B.call(h,a)&&!B.call(C,a))throw Error("No "+a);return h[a]}function g(a){var b,c=a?a.indexOf("!"):-1;-1<c&&(b=a.substring(0,c),a=a.substring(c+1,a.length));return[b,a]}function w(a){return function(){return r&&r.config&&r.config[a]||{}}}var l,v,x,k,h={},K={},r={},C={},B=Object.prototype.hasOwnProperty,z=[].slice,I=/\.js$/;x=function(a,b){var c,h=g(a),d=h[0];a=h[1];d&&(d=e(d,b),c=m(d));d?a=c&&c.normalize?c.normalize(a,p(b)):e(a,b):(a=e(a,b),h=g(a),
166 -d=h[0],a=h[1],d&&(c=m(d)));return{f:d?d+"!"+a:a,n:a,pr:d,p:c}};k={require:function(a){return n(a)},exports:function(a){var b=h[a];return"undefined"!==typeof b?b:h[a]={}},module:function(a){return{id:a,uri:"",exports:h[a],config:w(a)}}};l=function(a,b,c,g){var e,z,l,r,w=[];z=typeof c;var v;g=g||a;if("undefined"===z||"function"===z){b=!b.length&&c.length?["require","exports","module"]:b;for(r=0;r<b.length;r+=1)if(l=x(b[r],g),z=l.f,"require"===z)w[r]=k.require(a);else if("exports"===z)w[r]=k.exports(a),
167 -v=!0;else if("module"===z)e=w[r]=k.module(a);else if(B.call(h,z)||B.call(K,z)||B.call(C,z))w[r]=m(z);else if(l.p)l.p.load(l.n,n(g,!0),q(z),{}),w[r]=h[z];else throw Error(a+" missing "+z);b=c?c.apply(h[a],w):void 0;a&&(e&&e.exports!==d&&e.exports!==h[a]?h[a]=e.exports:b===d&&v||(h[a]=b))}else a&&(h[a]=c)};b=c=v=function(a,b,c,g,h){if("string"===typeof a)return k[a]?k[a](b):m(x(a,b).f);if(!a.splice){r=a;r.deps&&v(r.deps,r.callback);if(!b)return;b.splice?(a=b,b=c,c=null):a=d}b=b||function(){};"function"===
166 +(function(b,c){"function"===typeof define&&define.amd?define([],c):b.forge=c()})(this,function(){var b,c,a;(function(d){function e(a,b){var c,m,g,d,h,e,k,y,l,w=b&&b.split("/"),x=q.map,v=x&&x["*"]||{};if(a&&"."===a.charAt(0))if(b){w=w.slice(0,w.length-1);a=a.split("/");h=a.length-1;q.nodeIdCompat&&I.test(a[h])&&(a[h]=a[h].replace(I,""));a=w.concat(a);for(h=0;h<a.length;h+=1)if(c=a[h],"."===c)a.splice(h,1),--h;else if(".."===c)if(1!==h||".."!==a[2]&&".."!==a[0])0<h&&(a.splice(h-1,2),h-=2);else break;
167 +a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((w||v)&&x){c=a.split("/");for(h=c.length;0<h;--h){m=c.slice(0,h).join("/");if(w)for(l=w.length;0<l;--l)if(g=x[w.slice(0,l).join("/")])if(g=g[m]){d=g;e=h;break}if(d)break;!k&&v&&v[m]&&(k=v[m],y=h)}!d&&k&&(d=k,e=y);d&&(c.splice(0,e,d),a=c.join("/"))}return a}function n(a,b){return function(){return v.apply(d,y.call(arguments,0).concat([a,b]))}}function p(a){return function(b){return e(b,a)}}function r(a){return function(b){h[a]=b}}function m(a){if(B.call(K,
168 +a)){var b=K[a];delete K[a];C[a]=!0;l.apply(d,b)}if(!B.call(h,a)&&!B.call(C,a))throw Error("No "+a);return h[a]}function g(a){var b,c=a?a.indexOf("!"):-1;-1<c&&(b=a.substring(0,c),a=a.substring(c+1,a.length));return[b,a]}function w(a){return function(){return q&&q.config&&q.config[a]||{}}}var l,v,x,k,h={},K={},q={},C={},B=Object.prototype.hasOwnProperty,y=[].slice,I=/\.js$/;x=function(a,b){var c,d=g(a),h=d[0];a=d[1];h&&(h=e(h,b),c=m(h));h?a=c&&c.normalize?c.normalize(a,p(b)):e(a,b):(a=e(a,b),d=g(a),
169 +h=d[0],a=d[1],h&&(c=m(h)));return{f:h?h+"!"+a:a,n:a,pr:h,p:c}};k={require:function(a){return n(a)},exports:function(a){var b=h[a];return"undefined"!==typeof b?b:h[a]={}},module:function(a){return{id:a,uri:"",exports:h[a],config:w(a)}}};l=function(a,b,c,g){var e,y,l,q,w=[];y=typeof c;var v;g=g||a;if("undefined"===y||"function"===y){b=!b.length&&c.length?["require","exports","module"]:b;for(q=0;q<b.length;q+=1)if(l=x(b[q],g),y=l.f,"require"===y)w[q]=k.require(a);else if("exports"===y)w[q]=k.exports(a),
170 +v=!0;else if("module"===y)e=w[q]=k.module(a);else if(B.call(h,y)||B.call(K,y)||B.call(C,y))w[q]=m(y);else if(l.p)l.p.load(l.n,n(g,!0),r(y),{}),w[q]=h[y];else throw Error(a+" missing "+y);b=c?c.apply(h[a],w):void 0;a&&(e&&e.exports!==d&&e.exports!==h[a]?h[a]=e.exports:b===d&&v||(h[a]=b))}else a&&(h[a]=c)};b=c=v=function(a,b,c,g,h){if("string"===typeof a)return k[a]?k[a](b):m(x(a,b).f);if(!a.splice){q=a;q.deps&&v(q.deps,q.callback);if(!b)return;b.splice?(a=b,b=c,c=null):a=d}b=b||function(){};"function"===
171 typeof c&&(c=g,g=h);g?l(d,a,b,c):setTimeout(function(){l(d,a,b,c)},4);return v};v.config=function(a){return v(a)};b._defined=h;a=function(a,b,c){b.splice||(c=b,b=[]);B.call(h,a)||B.call(K,a)||(K[a]=[a,b,c])};a.amd={jQuery:!0}})();a("node_modules/almond/almond",function(){});(function(){function b(a){function c(a){this.data="";this.read=0;if("string"===typeof a)this.data=a;else if(d.isArrayBuffer(a)||d.isArrayBufferView(a)){a=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,a)}catch(b){for(var m=
172 0;m<a.length;++m)this.putByte(a[m])}}else if(a instanceof c||"object"===typeof a&&"string"===typeof a.data&&"number"===typeof a.read)this.data=a.data,this.read=a.read;this._constructedStringLength=0}var d=a.util=a.util||{};(function(){if("undefined"!==typeof process&&process.nextTick)d.nextTick=process.nextTick,d.setImmediate="function"===typeof setImmediate?setImmediate:d.nextTick;else if("function"===typeof setImmediate)d.setImmediate=setImmediate,d.nextTick=function(a){return setImmediate(a)};
173 else{d.setImmediate=function(a){setTimeout(a,0)};if("undefined"!==typeof window&&"function"===typeof window.postMessage){var a=[];d.setImmediate=function(b){a.push(b);1===a.length&&window.postMessage("forge.setImmediate","*")};window.addEventListener("message",function(b){b.source===window&&"forge.setImmediate"===b.data&&(b.stopPropagation(),b=a.slice(),a.length=0,b.forEach(function(a){a()}))},!0)}if("undefined"!==typeof MutationObserver){var b=Date.now(),c=!0,m=document.createElement("div"),a=[];
@@ -192,18 +195,18 @@ this.data.getInt32(this.read,!0);this.read+=4;return a};d.DataBuffer.prototype.g
195 d.DataBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};d.DataBuffer.prototype.at=function(a){return this.data.getUint8(this.read+a)};d.DataBuffer.prototype.setAt=function(a,b){this.data.setUint8(a,b);return this};d.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};d.DataBuffer.prototype.copy=function(){return new d.DataBuffer(this)};d.DataBuffer.prototype.compact=function(){if(0<this.read){var a=
196 new Uint8Array(this.data.buffer,this.read),b=new Uint8Array(a.byteLength);b.set(a);this.data=new DataView(b);this.write-=this.read;this.read=0}return this};d.DataBuffer.prototype.clear=function(){this.data=new DataView(new ArrayBuffer(0));this.read=this.write=0;return this};d.DataBuffer.prototype.truncate=function(a){this.write=Math.max(0,this.length()-a);this.read=Math.min(this.read,this.write);return this};d.DataBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.byteLength;++b){var c=
197 this.data.getUint8(b);16>c&&(a+="0");a+=c.toString(16)}return a};d.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return d.binary.raw.encode(b);if("hex"===a)return d.binary.hex.encode(b);if("base64"===a)return d.binary.base64.encode(b);if("utf8"===a)return d.text.utf8.decode(b);if("utf16"===a)return d.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};d.createBuffer=function(a,b){void 0!==a&&"utf8"===
195 -(b||"raw")&&(a=d.encodeUtf8(a));return new d.ByteBuffer(a)};d.fillString=function(a,b){for(var c="";0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);return c};d.xorBytes=function(a,b,c){for(var m="",g="",d="",h=0,k=0;0<c;--c,++h)g=a.charCodeAt(h)^b.charCodeAt(h),10<=k&&(m+=d,d="",k=0),d+=String.fromCharCode(g),++k;return m+d};d.hexToBytes=function(a){var b="",c=0;a.length&1&&(c=1,b+=String.fromCharCode(parseInt(a[0],16)));for(;c<a.length;c+=2)b+=String.fromCharCode(parseInt(a.substr(c,2),16));return b};d.bytesToHex=
196 -function(a){return d.createBuffer(a).toHex()};d.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var e=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];d.encode64=function(a,b){for(var c="",m="",g,d,h,k=0;k<a.length;)g=
197 -a.charCodeAt(k++),d=a.charCodeAt(k++),h=a.charCodeAt(k++),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((g&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(m+=c.substr(0,b)+"\r\n",c=c.substr(b));return m+
198 -c};d.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,m,g,d,h=0;h<a.length;)c=e[a.charCodeAt(h++)-43],m=e[a.charCodeAt(h++)-43],g=e[a.charCodeAt(h++)-43],d=e[a.charCodeAt(h++)-43],b+=String.fromCharCode(c<<2|m>>4),64!==g&&(b+=String.fromCharCode((m&15)<<4|g>>2),64!==d&&(b+=String.fromCharCode((g&3)<<6|d)));return b};d.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};d.decodeUtf8=function(a){return decodeURIComponent(escape(a))};d.binary={raw:{},hex:{},base64:{}};
199 -d.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};d.binary.raw.decode=function(a,b,c){var m=b;m||(m=new Uint8Array(a.length));for(var g=c=c||0,d=0;d<a.length;++d)m[g++]=a.charCodeAt(d);return b?g-c:m};d.binary.hex.encode=d.bytesToHex;d.binary.hex.decode=function(a,b,c){var m=b;m||(m=new Uint8Array(Math.ceil(a.length/2)));c=c||0;var g=0,d=c;a.length&1&&(g=1,m[d++]=parseInt(a[0],16));for(;g<a.length;g+=2)m[d++]=parseInt(a.substr(g,2),16);return b?d-c:m};d.binary.base64.encode=
200 -function(a,b){for(var c="",m="",g,d,h,k=0;k<a.byteLength;)g=a[k++],d=a[k++],h=a[k++],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((g&3)<<4|d>>4),isNaN(d)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(m+=c.substr(0,
201 -b)+"\r\n",c=c.substr(b));return m+c};d.binary.base64.decode=function(a,b,c){var m=b;m||(m=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var g,d,h,k,r=0,x=c;r<a.length;)g=e[a.charCodeAt(r++)-43],d=e[a.charCodeAt(r++)-43],h=e[a.charCodeAt(r++)-43],k=e[a.charCodeAt(r++)-43],m[x++]=g<<2|d>>4,64!==h&&(m[x++]=(d&15)<<4|h>>2,64!==k&&(m[x++]=(h&3)<<6|k));return b?x-c:m.subarray(0,x)};d.text={utf8:{},utf16:{}};d.text.utf8.encode=function(a,b,c){a=d.encodeUtf8(a);
202 -var m=b;m||(m=new Uint8Array(a.length));for(var g=c=c||0,h=0;h<a.length;++h)m[g++]=a.charCodeAt(h);return b?g-c:m};d.text.utf8.decode=function(a){return d.decodeUtf8(String.fromCharCode.apply(null,a))};d.text.utf16.encode=function(a,b,c){var m=b;m||(m=new Uint8Array(2*a.length));for(var g=new Uint16Array(m.buffer),d=c=c||0,h=c,k=0;k<a.length;++k)g[h++]=a.charCodeAt(k),d+=2;return b?d-c:m};d.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};d.deflate=function(a,
198 +(b||"raw")&&(a=d.encodeUtf8(a));return new d.ByteBuffer(a)};d.fillString=function(a,b){for(var c="";0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);return c};d.xorBytes=function(a,b,c){for(var m="",d="",g="",h=0,e=0;0<c;--c,++h)d=a.charCodeAt(h)^b.charCodeAt(h),10<=e&&(m+=g,g="",e=0),g+=String.fromCharCode(d),++e;return m+g};d.hexToBytes=function(a){var b="",c=0;a.length&1&&(c=1,b+=String.fromCharCode(parseInt(a[0],16)));for(;c<a.length;c+=2)b+=String.fromCharCode(parseInt(a.substr(c,2),16));return b};d.bytesToHex=
199 +function(a){return d.createBuffer(a).toHex()};d.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var e=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];d.encode64=function(a,b){for(var c="",m="",d,g,h,e=0;e<a.length;)d=
200 +a.charCodeAt(e++),g=a.charCodeAt(e++),h=a.charCodeAt(e++),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|g>>4),isNaN(g)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((g&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(m+=c.substr(0,b)+"\r\n",c=c.substr(b));return m+
201 +c};d.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,m,d,g,h=0;h<a.length;)c=e[a.charCodeAt(h++)-43],m=e[a.charCodeAt(h++)-43],d=e[a.charCodeAt(h++)-43],g=e[a.charCodeAt(h++)-43],b+=String.fromCharCode(c<<2|m>>4),64!==d&&(b+=String.fromCharCode((m&15)<<4|d>>2),64!==g&&(b+=String.fromCharCode((d&3)<<6|g)));return b};d.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};d.decodeUtf8=function(a){return decodeURIComponent(escape(a))};d.binary={raw:{},hex:{},base64:{}};
202 +d.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};d.binary.raw.decode=function(a,b,c){var m=b;m||(m=new Uint8Array(a.length));for(var d=c=c||0,g=0;g<a.length;++g)m[d++]=a.charCodeAt(g);return b?d-c:m};d.binary.hex.encode=d.bytesToHex;d.binary.hex.decode=function(a,b,c){var m=b;m||(m=new Uint8Array(Math.ceil(a.length/2)));c=c||0;var d=0,g=c;a.length&1&&(d=1,m[g++]=parseInt(a[0],16));for(;d<a.length;d+=2)m[g++]=parseInt(a.substr(d,2),16);return b?g-c:m};d.binary.base64.encode=
203 +function(a,b){for(var c="",m="",d,g,h,e=0;e<a.byteLength;)d=a[e++],g=a[e++],h=a[e++],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|g>>4),isNaN(g)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((g&15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(m+=c.substr(0,
204 +b)+"\r\n",c=c.substr(b));return m+c};d.binary.base64.decode=function(a,b,c){var m=b;m||(m=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var d,g,h,k,q=0,x=c;q<a.length;)d=e[a.charCodeAt(q++)-43],g=e[a.charCodeAt(q++)-43],h=e[a.charCodeAt(q++)-43],k=e[a.charCodeAt(q++)-43],m[x++]=d<<2|g>>4,64!==h&&(m[x++]=(g&15)<<4|h>>2,64!==k&&(m[x++]=(h&3)<<6|k));return b?x-c:m.subarray(0,x)};d.text={utf8:{},utf16:{}};d.text.utf8.encode=function(a,b,c){a=d.encodeUtf8(a);
205 +var m=b;m||(m=new Uint8Array(a.length));for(var g=c=c||0,h=0;h<a.length;++h)m[g++]=a.charCodeAt(h);return b?g-c:m};d.text.utf8.decode=function(a){return d.decodeUtf8(String.fromCharCode.apply(null,a))};d.text.utf16.encode=function(a,b,c){var m=b;m||(m=new Uint8Array(2*a.length));for(var d=new Uint16Array(m.buffer),g=c=c||0,h=c,e=0;e<a.length;++e)d[h++]=a.charCodeAt(e),g+=2;return b?g-c:m};d.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};d.deflate=function(a,
206 b,c){b=d.decode64(a.deflate(d.encode64(b)).rval);c&&(a=2,b.charCodeAt(1)&32&&(a=6),b=b.substring(a,b.length-4));return b};d.inflate=function(a,b,c){a=a.inflate(d.encode64(b)).rval;return null===a?null:d.decode64(a)};var v=function(a,b,c){if(!a)throw Error("WebStorage not available.");null===c?a=a.removeItem(b):(c=d.encode64(JSON.stringify(c)),a=a.setItem(b,c));if("undefined"!==typeof a&&!0!==a.rval)throw b=Error(a.error.message),b.id=a.error.id,b.name=a.error.name,b;},x=function(a,b){if(!a)throw Error("WebStorage not available.");
204 -var c=a.getItem(b);if(a.init)if(null===c.rval){if(c.error){var m=Error(c.error.message);m.id=c.error.id;m.name=c.error.name;throw m;}c=null}else c=c.rval;null!==c&&(c=JSON.parse(d.decode64(c)));return c},k=function(a,b,c,m){var g=x(a,b);null===g&&(g={});g[c]=m;v(a,b,g)},h=function(a,b,c){a=x(a,b);null!==a&&(a=c in a?a[c]:null);return a},K=function(a,b,c){var m=x(a,b);if(null!==m&&c in m){delete m[c];c=!0;for(var g in m){c=!1;break}c&&(m=null);v(a,b,m)}},r=function(a,b){v(a,b,null)},C=function(a,b,
205 -c){var m=null;"undefined"===typeof c&&(c=["web","flash"]);var g,d=!1,h=null,k;for(k in c){g=c[k];try{if("flash"===g||"both"===g){if(null===b[0])throw Error("Flash local storage not available.");m=a.apply(this,b);d="flash"===g}if("web"===g||"both"===g)b[0]=localStorage,m=a.apply(this,b),d=!0}catch(e){h=e}if(d)break}if(!d)throw h;return m};d.setItem=function(a,b,c,m,g){C(k,arguments,g)};d.getItem=function(a,b,c,m){return C(h,arguments,m)};d.removeItem=function(a,b,c,m){C(K,arguments,m)};d.clearItems=
206 -function(a,b,c){C(r,arguments,c)};d.parseUrl=function(a){var b=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;b.lastIndex=0;b=b.exec(a);if(a=null===b?null:{full:a,scheme:b[1],host:b[2],port:b[3],path:b[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var B=null;d.getQueryVariables=function(a){var b=function(a){var b=
207 +var c=a.getItem(b);if(a.init)if(null===c.rval){if(c.error){var m=Error(c.error.message);m.id=c.error.id;m.name=c.error.name;throw m;}c=null}else c=c.rval;null!==c&&(c=JSON.parse(d.decode64(c)));return c},k=function(a,b,c,m){var g=x(a,b);null===g&&(g={});g[c]=m;v(a,b,g)},h=function(a,b,c){a=x(a,b);null!==a&&(a=c in a?a[c]:null);return a},K=function(a,b,c){var m=x(a,b);if(null!==m&&c in m){delete m[c];c=!0;for(var g in m){c=!1;break}c&&(m=null);v(a,b,m)}},q=function(a,b){v(a,b,null)},C=function(a,b,
208 +c){var m=null;"undefined"===typeof c&&(c=["web","flash"]);var g,d=!1,h=null,e;for(e in c){g=c[e];try{if("flash"===g||"both"===g){if(null===b[0])throw Error("Flash local storage not available.");m=a.apply(this,b);d="flash"===g}if("web"===g||"both"===g)b[0]=localStorage,m=a.apply(this,b),d=!0}catch(k){h=k}if(d)break}if(!d)throw h;return m};d.setItem=function(a,b,c,m,g){C(k,arguments,g)};d.getItem=function(a,b,c,m){return C(h,arguments,m)};d.removeItem=function(a,b,c,m){C(K,arguments,m)};d.clearItems=
209 +function(a,b,c){C(q,arguments,c)};d.parseUrl=function(a){var b=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;b.lastIndex=0;b=b.exec(a);if(a=null===b?null:{full:a,scheme:b[1],host:b[2],port:b[3],path:b[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var B=null;d.getQueryVariables=function(a){var b=function(a){var b=
210 {};a=a.split("&");for(var c=0;c<a.length;c++){var m=a[c].indexOf("="),g;0<m?(g=a[c].substring(0,m),m=a[c].substring(m+1)):(g=a[c],m=null);g in b||(b[g]=[]);g in Object.prototype||null===m||b[g].push(unescape(m))}return b};"undefined"===typeof a?(null===B&&(B="undefined"!==typeof window&&window.location&&window.location.search?b(window.location.search.substring(1)):{}),a=B):a=b(a);return a};d.parseFragment=function(a){var b=a,c="",m=a.indexOf("?");0<m&&(b=a.substring(0,m),c=a.substring(m+1));a=b.split("/");
211 0<a.length&&""===a[0]&&a.shift();m=""===c?{}:d.getQueryVariables(c);return{pathString:b,queryString:c,path:a,query:m}};d.makeRequest=function(a){var b=d.parseFragment(a),c={path:b.pathString,query:b.queryString,getPath:function(a){return"undefined"===typeof a?b.path:b.path[a]},getQuery:function(a,c){var m;"undefined"===typeof a?m=b.query:(m=b.query[a])&&"undefined"!==typeof c&&(m=m[c]);return m},getQueryLast:function(a,b){var m=c.getQuery(a);return m?m[m.length-1]:b}};return c};d.makeLink=function(a,
212 b,c){a=jQuery.isArray(a)?a.join("/"):a;b=jQuery.param(b||{});c=c||"";return a+(0<b.length?"?"+b:"")+(0<c.length?"#"+c:"")};d.setPath=function(a,b,c){if("object"===typeof a&&null!==a)for(var m=0,g=b.length;m<g;){var d=b[m++];if(m==g)a[d]=c;else{var h=d in a;if(!h||h&&"object"!==typeof a[d]||h&&null===a[d])a[d]={};a=a[d]}}};d.getPath=function(a,b,c){for(var m=0,g=b.length,d=!0;d&&m<g&&"object"===typeof a&&null!==a;){var h=b[m++];(d=h in a)&&(a=a[h])}return d?a:c};d.deletePath=function(a,b){if("object"===
@@ -211,16 +214,16 @@ typeof a&&null!==a)for(var c=0,m=b.length;c<m;){var g=b[c++];if(c==m)delete a[g]
214 c+"?>")}d.push(a.substring(m));return d.join("")};d.formatNumber=function(a,b,c,m){var g=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;m=void 0===m?".":m;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(g),10)+"",h=3<d.length?d.length%3:0;return c+(h?d.substr(0,h)+m:"")+d.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+m)+(g?b+Math.abs(a-d).toFixed(g).slice(2):"")};d.formatSize=function(a){return a=1073741824<=a?d.formatNumber(a/1073741824,2,".","")+" GiB":1048576<=a?d.formatNumber(a/1048576,2,".","")+
215 " MiB":1024<=a?d.formatNumber(a/1024,0)+" KiB":d.formatNumber(a,0)+" bytes"};d.bytesFromIP=function(a){return-1!==a.indexOf(".")?d.bytesFromIPv4(a):-1!==a.indexOf(":")?d.bytesFromIPv6(a):null};d.bytesFromIPv4=function(a){a=a.split(".");if(4!==a.length)return null;for(var b=d.createBuffer(),c=0;c<a.length;++c){var m=parseInt(a[c],10);if(isNaN(m))return null;b.putByte(m)}return b.getBytes()};d.bytesFromIPv6=function(a){var b=0;a=a.split(":").filter(function(a){0===a.length&&++b;return!0});for(var c=
216 2*(8-a.length+b),m=d.createBuffer(),g=0;8>g;++g)if(a[g]&&0!==a[g].length){var h=d.hexToBytes(a[g]);2>h.length&&m.putByte(0);m.putBytes(h)}else m.fillWithByte(0,c),c=0;return m.getBytes()};d.bytesToIP=function(a){return 4===a.length?d.bytesToIPv4(a):16===a.length?d.bytesToIPv6(a):null};d.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b.join(".")};d.bytesToIPv6=function(a){if(16!==a.length)return null;for(var b=[],c=[],m=0,g=0;g<a.length;g+=
214 -2){for(var h=d.bytesToHex(a[g]+a[g+1]);"0"===h[0]&&"0"!==h;)h=h.substr(1);if("0"===h){var k=c[c.length-1],e=b.length;k&&e===k.end+1?(k.end=e,k.end-k.start>c[m].end-c[m].start&&(m=c.length-1)):c.push({start:e,end:e})}b.push(h)}0<c.length&&(a=c[m],0<a.end-a.start&&(b.splice(a.start,a.end-a.start+1,""),0===a.start&&b.unshift(""),7===a.end&&b.push("")));return b.join(":")};d.estimateCores=function(a,b){function c(a,k,e){if(0===k){var l=Math.floor(a.reduce(function(a,b){return a+b},0)/a.length);d.cores=
215 -Math.max(1,l);URL.revokeObjectURL(h);return b(null,d.cores)}m(e,function(b,m){a.push(g(e,m));c(a,k-1,e)})}function m(a,b){for(var c=[],g=[],d=0;d<a;++d){var k=new Worker(h);k.addEventListener("message",function(m){g.push(m.data);if(g.length===a){for(m=0;m<a;++m)c[m].terminate();b(null,g)}});c.push(k)}for(d=0;d<a;++d)c[d].postMessage(d)}function g(a,b){for(var c=[],m=0;m<a;++m)for(var d=b[m],h=c[m]=[],k=0;k<a;++k)if(m!==k){var e=b[k];(d.st>e.st&&d.st<e.et||e.st>d.st&&e.st<d.et)&&h.push(k)}return c.reduce(function(a,
217 +2){for(var h=d.bytesToHex(a[g]+a[g+1]);"0"===h[0]&&"0"!==h;)h=h.substr(1);if("0"===h){var e=c[c.length-1],k=b.length;e&&k===e.end+1?(e.end=k,e.end-e.start>c[m].end-c[m].start&&(m=c.length-1)):c.push({start:k,end:k})}b.push(h)}0<c.length&&(a=c[m],0<a.end-a.start&&(b.splice(a.start,a.end-a.start+1,""),0===a.start&&b.unshift(""),7===a.end&&b.push("")));return b.join(":")};d.estimateCores=function(a,b){function c(a,e,k){if(0===e){var q=Math.floor(a.reduce(function(a,b){return a+b},0)/a.length);d.cores=
218 +Math.max(1,q);URL.revokeObjectURL(h);return b(null,d.cores)}m(k,function(b,m){a.push(g(k,m));c(a,e-1,k)})}function m(a,b){for(var c=[],g=[],d=0;d<a;++d){var e=new Worker(h);e.addEventListener("message",function(m){g.push(m.data);if(g.length===a){for(m=0;m<a;++m)c[m].terminate();b(null,g)}});c.push(e)}for(d=0;d<a;++d)c[d].postMessage(d)}function g(a,b){for(var c=[],m=0;m<a;++m)for(var d=b[m],h=c[m]=[],e=0;e<a;++e)if(m!==e){var k=b[e];(d.st>k.st&&d.st<k.et||k.st>d.st&&k.st<d.et)&&h.push(e)}return c.reduce(function(a,
219 b){return Math.max(a,b.length)},0)}"function"===typeof a&&(b=a,a={});a=a||{};if("cores"in d&&!a.update)return b(null,d.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&0<navigator.hardwareConcurrency)return d.cores=navigator.hardwareConcurrency,b(null,d.cores);if("undefined"===typeof Worker)return d.cores=1,b(null,d.cores);if("undefined"===typeof Blob)return d.cores=2,b(null,d.cores);var h=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(a){a=
220 Date.now();for(var b=a+4;Date.now()<b;);self.postMessage({st:a,et:b})})}.toString(),")()"],{type:"application/javascript"}));c([],5,16)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.util)return c.util;c.defined.util=!0;for(var e=0;e<g.length;++e)g[e](c);
218 -return c.util}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/util",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.cipher=a.cipher||{};a.cipher.algorithms=a.cipher.algorithms||{};a.cipher.createCipher=function(b,c){var g=b;"string"===typeof g&&(g=a.cipher.getAlgorithm(g))&&
221 +return c.util}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/util",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.cipher=a.cipher||{};a.cipher.algorithms=a.cipher.algorithms||{};a.cipher.createCipher=function(b,c){var g=b;"string"===typeof g&&(g=a.cipher.getAlgorithm(g))&&
222 (g=g());if(!g)throw Error("Unsupported algorithm: "+b);return new a.cipher.BlockCipher({algorithm:g,key:c,decrypt:!1})};a.cipher.createDecipher=function(b,c){var g=b;"string"===typeof g&&(g=a.cipher.getAlgorithm(g))&&(g=g());if(!g)throw Error("Unsupported algorithm: "+b);return new a.cipher.BlockCipher({algorithm:g,key:c,decrypt:!0})};a.cipher.registerAlgorithm=function(b,c){b=b.toUpperCase();a.cipher.algorithms[b]=c};a.cipher.getAlgorithm=function(b){b=b.toUpperCase();return b in a.cipher.algorithms?
223 a.cipher.algorithms[b]:null};var c=a.cipher.BlockCipher=function(a){this.algorithm=a.algorithm;this.mode=this.algorithm.mode;this.blockSize=this.mode.blockSize;this._finish=!1;this.output=this._input=null;this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt;this._decrypt=a.decrypt;this.algorithm.initialize(a)};c.prototype.start=function(b){b=b||{};var c={},g;for(g in b)c[g]=b[g];c.decrypt=this._decrypt;this._finish=!1;this._input=a.util.createBuffer();this.output=b.output||a.util.createBuffer();
224 this.mode.start(c)};c.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};c.prototype.finish=function(a){!a||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(b){return a(this.blockSize,b,!1)},this.mode.unpad=function(b){return a(this.blockSize,b,!0)});var b={};b.decrypt=this._decrypt;b.overflow=this._input.length()%this.blockSize;if(!this._decrypt&&this.mode.pad&&
225 !this.mode.pad(this._input,b))return!1;this._finish=!0;this.update();return this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,b)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,b)?!1:!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipher)return c.cipher;
223 -c.defined.cipher=!0;for(var e=0;e<g.length;++e)g[e](c);return c.cipher}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipher",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){"string"===typeof b&&(b=a.util.createBuffer(b));if(a.util.isArray(b)&&
226 +c.defined.cipher=!0;for(var e=0;e<g.length;++e)g[e](c);return c.cipher}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipher",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){"string"===typeof b&&(b=a.util.createBuffer(b));if(a.util.isArray(b)&&
227 4<b.length){var g=b;b=a.util.createBuffer();for(var d=0;d<g.length;++d)b.putByte(g[d])}a.util.isArray(b)||(b=[b.getInt32(),b.getInt32(),b.getInt32(),b.getInt32()]);return b}function d(a){a[a.length-1]=a[a.length-1]+1&4294967295}function e(a){return[a/4294967296|0,a&4294967295]}a.cipher=a.cipher||{};var v=a.cipher.modes=a.cipher.modes||{};v.ecb=function(a){a=a||{};this.name="ECB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=
228 Array(this._ints)};v.ecb.prototype.start=function(a){};v.ecb.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};v.ecb.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,
229 this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};v.ecb.prototype.pad=function(a,b){var c=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(c,c);return!0};v.ecb.prototype.unpad=function(a,b){if(0<b.overflow)return!1;var c=a.length(),c=a.at(c-1);if(c>this.blockSize<<2)return!1;a.truncate(c);return!0};v.cbc=function(a){a=a||{};this.name="CBC";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);
@@ -241,20 +244,20 @@ this.componentBits);b=c.length();if(12===b)this._j0=[c.getInt32(),c.getInt32(),c
244 for(this._s=[0,0,0,0];0<g.length();)this._s=this.ghash(this._hashSubkey,this._s,[g.getInt32(),g.getInt32(),g.getInt32(),g.getInt32()])};v.gcm.prototype.encrypt=function(a,b,c){var m=a.length();if(0===m)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&m>=this.blockSize){for(var g=0;g<this._ints;++g)b.putInt32(this._outBlock[g]^=a.getInt32());this._cipherLength+=this.blockSize}else{var e=(this.blockSize-m)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();
245 for(g=0;g<this._ints;++g)this._partialOutput.putInt32(a.getInt32()^this._outBlock[g]);if(0===e||c){c?(g=m%this.blockSize,this._cipherLength+=g,this._partialOutput.truncate(this.blockSize-g)):this._cipherLength+=this.blockSize;for(g=0;g<this._ints;++g)this._outBlock[g]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!c)return a.read-=this.blockSize,b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),
246 this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(m-this._partialBytes));this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock);d(this._inBlock)};v.gcm.prototype.decrypt=function(a,b,c){var m=a.length();if(m<this.blockSize&&!(c&&0<m))return!0;this.cipher.encrypt(this._inBlock,this._outBlock);d(this._inBlock);this._hashBlock[0]=a.getInt32();this._hashBlock[1]=a.getInt32();this._hashBlock[2]=a.getInt32();this._hashBlock[3]=a.getInt32();this._s=this.ghash(this._hashSubkey,
244 -this._s,this._hashBlock);for(a=0;a<this._ints;++a)b.putInt32(this._outBlock[a]^this._hashBlock[a]);this._cipherLength=m<this.blockSize?this._cipherLength+m%this.blockSize:this._cipherLength+this.blockSize};v.gcm.prototype.afterFinish=function(b,c){var g=!0;c.decrypt&&c.overflow&&b.truncate(this.blockSize-c.overflow);this.tag=a.util.createBuffer();var d=this._aDataLength.concat(e(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,d);d=[];this.cipher.encrypt(this._j0,d);for(var r=0;r<
245 -this._ints;++r)this.tag.putInt32(this._s[r]^d[r]);this.tag.truncate(this.tag.length()%(this._tagLength/8));c.decrypt&&this.tag.bytes()!==this._tag&&(g=!1);return g};v.gcm.prototype.multiply=function(a,b){for(var c=[0,0,0,0],m=b.slice(0),g=0;128>g;++g)a[g/32|0]&1<<31-g%32&&(c[0]^=m[0],c[1]^=m[1],c[2]^=m[2],c[3]^=m[3]),this.pow(m,m);return c};v.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,m=3;0<m;--m)b[m]=a[m]>>>1|(a[m-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};v.gcm.prototype.tableMultiply=function(a){for(var b=
247 +this._s,this._hashBlock);for(a=0;a<this._ints;++a)b.putInt32(this._outBlock[a]^this._hashBlock[a]);this._cipherLength=m<this.blockSize?this._cipherLength+m%this.blockSize:this._cipherLength+this.blockSize};v.gcm.prototype.afterFinish=function(b,c){var g=!0;c.decrypt&&c.overflow&&b.truncate(this.blockSize-c.overflow);this.tag=a.util.createBuffer();var d=this._aDataLength.concat(e(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,d);d=[];this.cipher.encrypt(this._j0,d);for(var q=0;q<
248 +this._ints;++q)this.tag.putInt32(this._s[q]^d[q]);this.tag.truncate(this.tag.length()%(this._tagLength/8));c.decrypt&&this.tag.bytes()!==this._tag&&(g=!1);return g};v.gcm.prototype.multiply=function(a,b){for(var c=[0,0,0,0],m=b.slice(0),g=0;128>g;++g)a[g/32|0]&1<<31-g%32&&(c[0]^=m[0],c[1]^=m[1],c[2]^=m[2],c[3]^=m[3]),this.pow(m,m);return c};v.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,m=3;0<m;--m)b[m]=a[m]>>>1|(a[m-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};v.gcm.prototype.tableMultiply=function(a){for(var b=
249 [0,0,0,0],c=0;32>c;++c){var m=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=m[0];b[1]^=m[1];b[2]^=m[2];b[3]^=m[3]}return b};v.gcm.prototype.ghash=function(a,b,c){b[0]^=c[0];b[1]^=c[1];b[2]^=c[2];b[3]^=c[3];return this.tableMultiply(b)};v.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,m=4*c,c=16*c,g=Array(c),d=0;d<c;++d){var e=[0,0,0,0];e[d/m|0]=1<<b-1<<(m-1-d%m)*b;g[d]=this.generateSubHashTable(this.multiply(e,a),b)}return g};v.gcm.prototype.generateSubHashTable=function(a,b){var c=1<<b,
250 m=c>>>1,g=Array(c);g[m]=a.slice(0);for(var d=m>>>1;0<d;)this.pow(g[2*d],g[d]=[]),d>>=1;for(d=2;d<m;){for(var e=1;e<d;++e){var l=g[d],v=g[e];g[d+e]=[l[0]^v[0],l[1]^v[1],l[2]^v[2],l[3]^v[3]]}d*=2}g[0]=[0,0,0,0];for(d=m+1;d<c;++d)e=g[d^m],g[d]=[a[0]^e[0],a[1]^e[1],a[2]^e[2],a[3]^e[3]];return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=
248 -n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipherModes)return c.cipherModes;c.defined.cipherModes=!0;for(var e=0;e<g.length;++e)g[e](c);return c.cipherModes}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipherModes",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,
249 -0))})})();(function(){function b(a){function c(b,g){a.cipher.registerAlgorithm(b,function(){return new a.aes.Algorithm(b,g)})}function d(){k=!0;C=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),b=0;128>b;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;K=Array(256);r=Array(256);B=Array(4);z=Array(4);for(b=0;4>b;++b)B[b]=Array(256),z[b]=Array(256);for(var c=0,m=0,g,h,e,l,v,b=0;256>b;++b){l=m^m<<1^m<<2^m<<3^m<<4;l=l>>8^l&255^99;K[c]=l;r[l]=c;v=a[l];g=a[c];h=a[g];e=a[h];v^=v<<24^l<<16^l<<8^l;h=(g^h^e)<<24^(c^
250 -e)<<16^(c^h^e)<<8^c^g^e;for(var x=0;4>x;++x)B[x][c]=v,z[x][l]=h,v=v<<24|v>>>8,h=h<<24|h>>>8;0===c?c=m=1:(c=g^a[a[a[g^e]]],m^=a[a[m]])}}function e(a,b){for(var c=a.slice(0),m,g=1,d=c.length,k=h*(d+6+1),l=d;l<k;++l)m=c[l-1],0===l%d?(m=K[m>>>16&255]<<24^K[m>>>8&255]<<16^K[m&255]<<8^K[m>>>24]^C[g]<<24,g++):6<d&&4===l%d&&(m=K[m>>>24]<<24^K[m>>>16&255]<<16^K[m>>>8&255]<<8^K[m&255]),c[l]=c[l-d]^m;if(b){for(var g=z[0],d=z[1],r=z[2],v=z[3],x=c.slice(0),k=c.length,l=0,w=k-h;l<k;l+=h,w-=h)if(0===l||l===k-h)x[l]=
251 -c[w],x[l+1]=c[w+3],x[l+2]=c[w+2],x[l+3]=c[w+1];else for(var B=0;B<h;++B)m=c[w+B],x[l+(3&-B)]=g[K[m>>>24]]^d[K[m>>>16&255]]^r[K[m>>>8&255]]^v[K[m&255]];c=x}return c}function v(a,b,c,m){var g=a.length/4-1,d,h,e,k,l;m?(d=z[0],h=z[1],e=z[2],k=z[3],l=r):(d=B[0],h=B[1],e=B[2],k=B[3],l=K);var v,x,w,C,n,p;v=b[0]^a[0];x=b[m?3:1]^a[1];w=b[2]^a[2];b=b[m?1:3]^a[3];for(var q=3,U=1;U<g;++U)C=d[v>>>24]^h[x>>>16&255]^e[w>>>8&255]^k[b&255]^a[++q],n=d[x>>>24]^h[w>>>16&255]^e[b>>>8&255]^k[v&255]^a[++q],p=d[w>>>24]^
252 -h[b>>>16&255]^e[v>>>8&255]^k[x&255]^a[++q],b=d[b>>>24]^h[v>>>16&255]^e[x>>>8&255]^k[w&255]^a[++q],v=C,x=n,w=p;c[0]=l[v>>>24]<<24^l[x>>>16&255]<<16^l[w>>>8&255]<<8^l[b&255]^a[++q];c[m?3:1]=l[x>>>24]<<24^l[w>>>16&255]<<16^l[b>>>8&255]<<8^l[v&255]^a[++q];c[2]=l[w>>>24]<<24^l[b>>>16&255]<<16^l[v>>>8&255]<<8^l[x&255]^a[++q];c[m?1:3]=l[b>>>24]<<24^l[v>>>16&255]<<16^l[x>>>8&255]<<8^l[w&255]^a[++q]}function x(b){b=b||{};var c="AES-"+(b.mode||"CBC").toUpperCase(),g;g=b.decrypt?a.cipher.createDecipher(c,b.key):
253 -a.cipher.createCipher(c,b.key);var d=g.start;g.start=function(b,c){var h=null;c instanceof a.util.ByteBuffer&&(h=c,c={});c=c||{};c.output=h;c.iv=b;d.call(g,c)};return g}a.aes=a.aes||{};a.aes.startEncrypting=function(a,b,c,m){a=x({key:a,output:c,decrypt:!1,mode:m});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return x({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,m){a=x({key:a,output:c,decrypt:!0,mode:m});a.start(b);return a};a.aes.createDecryptionCipher=
251 +n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipherModes)return c.cipherModes;c.defined.cipherModes=!0;for(var e=0;e<g.length;++e)g[e](c);return c.cipherModes}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipherModes",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,
252 +0))})})();(function(){function b(a){function c(b,g){a.cipher.registerAlgorithm(b,function(){return new a.aes.Algorithm(b,g)})}function d(){k=!0;C=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),b=0;128>b;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;K=Array(256);q=Array(256);B=Array(4);y=Array(4);for(b=0;4>b;++b)B[b]=Array(256),y[b]=Array(256);for(var c=0,m=0,g,e,h,l,v,b=0;256>b;++b){l=m^m<<1^m<<2^m<<3^m<<4;l=l>>8^l&255^99;K[c]=l;q[l]=c;v=a[l];g=a[c];e=a[g];h=a[e];v^=v<<24^l<<16^l<<8^l;e=(g^e^h)<<24^(c^
253 +h)<<16^(c^e^h)<<8^c^g^h;for(var x=0;4>x;++x)B[x][c]=v,y[x][l]=e,v=v<<24|v>>>8,e=e<<24|e>>>8;0===c?c=m=1:(c=g^a[a[a[g^h]]],m^=a[a[m]])}}function e(a,b){for(var c=a.slice(0),m,g=1,d=c.length,k=h*(d+6+1),l=d;l<k;++l)m=c[l-1],0===l%d?(m=K[m>>>16&255]<<24^K[m>>>8&255]<<16^K[m&255]<<8^K[m>>>24]^C[g]<<24,g++):6<d&&4===l%d&&(m=K[m>>>24]<<24^K[m>>>16&255]<<16^K[m>>>8&255]<<8^K[m&255]),c[l]=c[l-d]^m;if(b){for(var g=y[0],d=y[1],q=y[2],v=y[3],x=c.slice(0),k=c.length,l=0,w=k-h;l<k;l+=h,w-=h)if(0===l||l===k-h)x[l]=
254 +c[w],x[l+1]=c[w+3],x[l+2]=c[w+2],x[l+3]=c[w+1];else for(var B=0;B<h;++B)m=c[w+B],x[l+(3&-B)]=g[K[m>>>24]]^d[K[m>>>16&255]]^q[K[m>>>8&255]]^v[K[m&255]];c=x}return c}function v(a,b,c,m){var g=a.length/4-1,d,e,h,k,l;m?(d=y[0],e=y[1],h=y[2],k=y[3],l=q):(d=B[0],e=B[1],h=B[2],k=B[3],l=K);var v,x,w,C,n,p;v=b[0]^a[0];x=b[m?3:1]^a[1];w=b[2]^a[2];b=b[m?1:3]^a[3];for(var r=3,U=1;U<g;++U)C=d[v>>>24]^e[x>>>16&255]^h[w>>>8&255]^k[b&255]^a[++r],n=d[x>>>24]^e[w>>>16&255]^h[b>>>8&255]^k[v&255]^a[++r],p=d[w>>>24]^
255 +e[b>>>16&255]^h[v>>>8&255]^k[x&255]^a[++r],b=d[b>>>24]^e[v>>>16&255]^h[x>>>8&255]^k[w&255]^a[++r],v=C,x=n,w=p;c[0]=l[v>>>24]<<24^l[x>>>16&255]<<16^l[w>>>8&255]<<8^l[b&255]^a[++r];c[m?3:1]=l[x>>>24]<<24^l[w>>>16&255]<<16^l[b>>>8&255]<<8^l[v&255]^a[++r];c[2]=l[w>>>24]<<24^l[b>>>16&255]<<16^l[v>>>8&255]<<8^l[x&255]^a[++r];c[m?1:3]=l[b>>>24]<<24^l[v>>>16&255]<<16^l[x>>>8&255]<<8^l[w&255]^a[++r]}function x(b){b=b||{};var c="AES-"+(b.mode||"CBC").toUpperCase(),g;g=b.decrypt?a.cipher.createDecipher(c,b.key):
256 +a.cipher.createCipher(c,b.key);var d=g.start;g.start=function(b,c){var e=null;c instanceof a.util.ByteBuffer&&(e=c,c={});c=c||{};c.output=e;c.iv=b;d.call(g,c)};return g}a.aes=a.aes||{};a.aes.startEncrypting=function(a,b,c,m){a=x({key:a,output:c,decrypt:!1,mode:m});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return x({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,m){a=x({key:a,output:c,decrypt:!0,mode:m});a.start(b);return a};a.aes.createDecryptionCipher=
257 function(a,b){return x({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){k||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return v(c._w,a,b,!1)},decrypt:function(a,b){return v(c._w,a,b,!0)}}});c._init=!1};a.aes.Algorithm.prototype.initialize=function(b){if(!this._init){var c=b.key,g;if("string"===typeof c&&(16===c.length||24===c.length||32===c.length))c=a.util.createBuffer(c);else if(a.util.isArray(c)&&(16===c.length||24===c.length||32===c.length)){g=
258 c;for(var c=a.util.createBuffer(),d=0;d<g.length;++d)c.putByte(g[d])}if(!a.util.isArray(c)){g=c;var c=[],h=g.length();if(16===h||24===h||32===h)for(h>>>=2,d=0;d<h;++d)c.push(g.getInt32())}if(!a.util.isArray(c)||4!==c.length&&6!==c.length&&8!==c.length)throw Error("Invalid key parameter.");g=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=e(c,b.decrypt&&!g);this._init=!0}};a.aes._expandKey=function(a,b){k||d();return e(a,b)};a.aes._updateBlock=v;c("AES-ECB",a.cipher.modes.ecb);c("AES-CBC",
256 -a.cipher.modes.cbc);c("AES-CFB",a.cipher.modes.cfb);c("AES-OFB",a.cipher.modes.ofb);c("AES-CTR",a.cipher.modes.ctr);c("AES-GCM",a.cipher.modes.gcm);var k=!1,h=4,K,r,C,B,z}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aes)return c.aes;c.defined.aes=
257 -!0;for(var e=0;e<g.length;++e)g[e](c);return c.aes}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aes",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.pki=a.pki||{};a=a.pki.oids=a.oids=a.oids||{};a["1.2.840.113549.1.1.1"]="rsaEncryption";
259 +a.cipher.modes.cbc);c("AES-CFB",a.cipher.modes.cfb);c("AES-OFB",a.cipher.modes.ofb);c("AES-CTR",a.cipher.modes.ctr);c("AES-GCM",a.cipher.modes.gcm);var k=!1,h=4,K,q,C,B,y}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aes)return c.aes;c.defined.aes=
260 +!0;for(var e=0;e<g.length;++e)g[e](c);return c.aes}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aes",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.pki=a.pki||{};a=a.pki.oids=a.oids=a.oids||{};a["1.2.840.113549.1.1.1"]="rsaEncryption";
261 a.rsaEncryption="1.2.840.113549.1.1.1";a["1.2.840.113549.1.1.4"]="md5WithRSAEncryption";a.md5WithRSAEncryption="1.2.840.113549.1.1.4";a["1.2.840.113549.1.1.5"]="sha1WithRSAEncryption";a.sha1WithRSAEncryption="1.2.840.113549.1.1.5";a["1.2.840.113549.1.1.7"]="RSAES-OAEP";a["RSAES-OAEP"]="1.2.840.113549.1.1.7";a["1.2.840.113549.1.1.8"]="mgf1";a.mgf1="1.2.840.113549.1.1.8";a["1.2.840.113549.1.1.9"]="pSpecified";a.pSpecified="1.2.840.113549.1.1.9";a["1.2.840.113549.1.1.10"]="RSASSA-PSS";a["RSASSA-PSS"]=
262 "1.2.840.113549.1.1.10";a["1.2.840.113549.1.1.11"]="sha256WithRSAEncryption";a.sha256WithRSAEncryption="1.2.840.113549.1.1.11";a["1.2.840.113549.1.1.12"]="sha384WithRSAEncryption";a.sha384WithRSAEncryption="1.2.840.113549.1.1.12";a["1.2.840.113549.1.1.13"]="sha512WithRSAEncryption";a.sha512WithRSAEncryption="1.2.840.113549.1.1.13";a["1.3.14.3.2.7"]="desCBC";a.desCBC="1.3.14.3.2.7";a["1.3.14.3.2.26"]="sha1";a.sha1="1.3.14.3.2.26";a["2.16.840.1.101.3.4.2.1"]="sha256";a.sha256="2.16.840.1.101.3.4.2.1";
263 a["2.16.840.1.101.3.4.2.2"]="sha384";a.sha384="2.16.840.1.101.3.4.2.2";a["2.16.840.1.101.3.4.2.3"]="sha512";a.sha512="2.16.840.1.101.3.4.2.3";a["1.2.840.113549.2.5"]="md5";a.md5="1.2.840.113549.2.5";a["1.2.840.113549.1.7.1"]="data";a.data="1.2.840.113549.1.7.1";a["1.2.840.113549.1.7.2"]="signedData";a.signedData="1.2.840.113549.1.7.2";a["1.2.840.113549.1.7.3"]="envelopedData";a.envelopedData="1.2.840.113549.1.7.3";a["1.2.840.113549.1.7.4"]="signedAndEnvelopedData";a.signedAndEnvelopedData="1.2.840.113549.1.7.4";
@@ -269,48 +272,48 @@ a["2.5.4.8"]="stateOrProvinceName";a.stateOrProvinceName="2.5.4.8";a["2.5.4.10"]
272 a["2.5.29.19"]="basicConstraints";a.basicConstraints="2.5.29.19";a["2.5.29.20"]="cRLNumber";a["2.5.29.21"]="cRLReason";a["2.5.29.22"]="expirationDate";a["2.5.29.23"]="instructionCode";a["2.5.29.24"]="invalidityDate";a["2.5.29.25"]="cRLDistributionPoints";a["2.5.29.26"]="issuingDistributionPoint";a["2.5.29.27"]="deltaCRLIndicator";a["2.5.29.28"]="issuingDistributionPoint";a["2.5.29.29"]="certificateIssuer";a["2.5.29.30"]="nameConstraints";a["2.5.29.31"]="cRLDistributionPoints";a["2.5.29.32"]="certificatePolicies";
273 a["2.5.29.33"]="policyMappings";a["2.5.29.34"]="policyConstraints";a["2.5.29.35"]="authorityKeyIdentifier";a["2.5.29.36"]="policyConstraints";a["2.5.29.37"]="extKeyUsage";a.extKeyUsage="2.5.29.37";a["2.5.29.46"]="freshestCRL";a["2.5.29.54"]="inhibitAnyPolicy";a["1.3.6.1.5.5.7.3.1"]="serverAuth";a.serverAuth="1.3.6.1.5.5.7.3.1";a["1.3.6.1.5.5.7.3.2"]="clientAuth";a.clientAuth="1.3.6.1.5.5.7.3.2";a["1.3.6.1.5.5.7.3.3"]="codeSigning";a.codeSigning="1.3.6.1.5.5.7.3.3";a["1.3.6.1.5.5.7.3.4"]="emailProtection";
274 a.emailProtection="1.3.6.1.5.5.7.3.4";a["1.3.6.1.5.5.7.3.8"]="timeStamping";a.timeStamping="1.3.6.1.5.5.7.3.8"}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.oids)return c.oids;c.defined.oids=!0;for(var e=0;e<g.length;++e)g[e](c);return c.oids}},
272 -q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/oids",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1=a.asn1||{};c.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};c.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,
275 +r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/oids",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1=a.asn1||{};c.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};c.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,
276 ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};c.create=function(b,c,g,d){if(a.util.isArray(d)){for(var e=[],l=0;l<d.length;++l)void 0!==d[l]&&e.push(d[l]);d=e}return{tagClass:b,type:c,constructed:g,composed:g||a.util.isArray(d),value:d}};var d=c.getBerValueLength=function(a){var b=a.getByte();if(128!==b)return b&128?a.getInt((b&127)<<3):b};c.fromDer=function(b,e){void 0===e&&(e=!0);
274 -"string"===typeof b&&(b=a.util.createBuffer(b));if(2>b.length()){var k=Error("Too few bytes to parse DER.");k.bytes=b.length();throw k;}var h=b.getByte(),k=h&192,l=h&31,r=d(b);if(b.length()<r){if(e)throw k=Error("Too few bytes to read ASN.1 value."),k.detail=b.length()+" < "+r,k;r=b.length()}var C,B=32===(h&32);C=B;if(!C&&k===c.Class.UNIVERSAL&&l===c.Type.BITSTRING&&1<r){var z=b.read;if(0===b.getByte()&&(h=b.getByte(),h&=192,h===c.Class.UNIVERSAL||h===c.Class.CONTEXT_SPECIFIC))try{if(C=d(b)===r-(b.read-
275 -z))++z,--r}catch(n){}b.read=z}if(C)if(C=[],void 0===r)for(;;){if(b.bytes(2)===String.fromCharCode(0,0)){b.getBytes(2);break}C.push(c.fromDer(b,e))}else for(z=b.length();0<r;)C.push(c.fromDer(b,e)),r-=z-b.length(),z=b.length();else{if(void 0===r){if(e)throw Error("Non-constructed ASN.1 object of indefinite length.");r=b.length()}if(l===c.Type.BMPSTRING)for(C="",z=0;z<r;z+=2)C+=String.fromCharCode(b.getInt16());else C=b.getBytes(r)}return c.create(k,l,B,C)};c.toDer=function(b){var d=a.util.createBuffer(),
277 +"string"===typeof b&&(b=a.util.createBuffer(b));if(2>b.length()){var k=Error("Too few bytes to parse DER.");k.bytes=b.length();throw k;}var h=b.getByte(),k=h&192,l=h&31,q=d(b);if(b.length()<q){if(e)throw k=Error("Too few bytes to read ASN.1 value."),k.detail=b.length()+" < "+q,k;q=b.length()}var C,B=32===(h&32);C=B;if(!C&&k===c.Class.UNIVERSAL&&l===c.Type.BITSTRING&&1<q){var y=b.read;if(0===b.getByte()&&(h=b.getByte(),h&=192,h===c.Class.UNIVERSAL||h===c.Class.CONTEXT_SPECIFIC))try{if(C=d(b)===q-(b.read-
278 +y))++y,--q}catch(n){}b.read=y}if(C)if(C=[],void 0===q)for(;;){if(b.bytes(2)===String.fromCharCode(0,0)){b.getBytes(2);break}C.push(c.fromDer(b,e))}else for(y=b.length();0<q;)C.push(c.fromDer(b,e)),q-=y-b.length(),y=b.length();else{if(void 0===q){if(e)throw Error("Non-constructed ASN.1 object of indefinite length.");q=b.length()}if(l===c.Type.BMPSTRING)for(C="",y=0;y<q;y+=2)C+=String.fromCharCode(b.getInt16());else C=b.getBytes(q)}return c.create(k,l,B,C)};c.toDer=function(b){var d=a.util.createBuffer(),
279 e=b.tagClass|b.type,h=a.util.createBuffer();if(b.composed){b.constructed?e|=32:h.putByte(0);for(var l=0;l<b.value.length;++l)void 0!==b.value[l]&&h.putBuffer(c.toDer(b.value[l]))}else if(b.type===c.Type.BMPSTRING)for(l=0;l<b.value.length;++l)h.putInt16(b.value.charCodeAt(l));else h.putBytes(b.value);d.putByte(e);if(127>=h.length())d.putByte(h.length()&127);else{l=h.length();b="";do b+=String.fromCharCode(l&255),l>>>=8;while(0<l);d.putByte(b.length|128);for(l=b.length-1;0<=l;--l)d.putByte(b.charCodeAt(l))}d.putBuffer(h);
277 -return d};c.oidToDer=function(b){b=b.split(".");var c=a.util.createBuffer();c.putByte(40*parseInt(b[0],10)+parseInt(b[1],10));for(var g,d,e,l,w=2;w<b.length;++w){g=!0;d=[];e=parseInt(b[w],10);do l=e&127,e>>>=7,g||(l|=128),d.push(l),g=!1;while(0<e);for(g=d.length-1;0<=g;--g)c.putByte(d[g])}return c};c.derToOid=function(b){var c;"string"===typeof b&&(b=a.util.createBuffer(b));var g=b.getByte();c=Math.floor(g/40)+"."+g%40;for(var d=0;0<b.length();)g=b.getByte(),d<<=7,g&128?d+=g&127:(c+="."+(d+g),d=0);
278 -return c};c.utcTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,2),10),c=50<=c?1900+c:2E3+c,g=parseInt(a.substr(2,2),10)-1,d=parseInt(a.substr(4,2),10),m=parseInt(a.substr(6,2),10),e=parseInt(a.substr(8,2),10),l=0;if(11<a.length){var w=a.charAt(10),n=10;"+"!==w&&"-"!==w&&(l=parseInt(a.substr(10,2),10),n+=2)}b.setUTCFullYear(c,g,d);b.setUTCHours(m,e,l,0);n&&(w=a.charAt(n),"+"===w||"-"===w)&&(c=parseInt(a.substr(n+1,2),10),a=parseInt(a.substr(n+4,2),10),a=6E4*(60*c+a),"+"===w?b.setTime(+b-
279 -a):b.setTime(+b+a));return b};c.generalizedTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,4),10),g=parseInt(a.substr(4,2),10)-1,d=parseInt(a.substr(6,2),10),m=parseInt(a.substr(8,2),10),e=parseInt(a.substr(10,2),10),l=parseInt(a.substr(12,2),10),w=0,n=0,F=!1;"Z"===a.charAt(a.length-1)&&(F=!0);var E=a.length-5,y=a.charAt(E);if("+"===y||"-"===y)n=parseInt(a.substr(E+1,2),10),E=parseInt(a.substr(E+4,2),10),n=6E4*(60*n+E),"+"===y&&(n*=-1),F=!0;"."===a.charAt(14)&&(w=1E3*parseFloat(a.substr(14),
280 -10));F?(b.setUTCFullYear(c,g,d),b.setUTCHours(m,e,l,w),b.setTime(+b+n)):(b.setFullYear(c,g,d),b.setHours(m,e,l,w));return b};c.dateToUtcTime=function(a){if("string"===typeof a)return a;var b="",c=[];c.push((""+a.getUTCFullYear()).substr(2));c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"===
280 +return d};c.oidToDer=function(b){b=b.split(".");var c=a.util.createBuffer();c.putByte(40*parseInt(b[0],10)+parseInt(b[1],10));for(var d,g,e,l,w=2;w<b.length;++w){d=!0;g=[];e=parseInt(b[w],10);do l=e&127,e>>>=7,d||(l|=128),g.push(l),d=!1;while(0<e);for(d=g.length-1;0<=d;--d)c.putByte(g[d])}return c};c.derToOid=function(b){var c;"string"===typeof b&&(b=a.util.createBuffer(b));var d=b.getByte();c=Math.floor(d/40)+"."+d%40;for(var g=0;0<b.length();)d=b.getByte(),g<<=7,d&128?g+=d&127:(c+="."+(g+d),g=0);
281 +return c};c.utcTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,2),10),c=50<=c?1900+c:2E3+c,d=parseInt(a.substr(2,2),10)-1,g=parseInt(a.substr(4,2),10),m=parseInt(a.substr(6,2),10),e=parseInt(a.substr(8,2),10),l=0;if(11<a.length){var w=a.charAt(10),n=10;"+"!==w&&"-"!==w&&(l=parseInt(a.substr(10,2),10),n+=2)}b.setUTCFullYear(c,d,g);b.setUTCHours(m,e,l,0);n&&(w=a.charAt(n),"+"===w||"-"===w)&&(c=parseInt(a.substr(n+1,2),10),a=parseInt(a.substr(n+4,2),10),a=6E4*(60*c+a),"+"===w?b.setTime(+b-
282 +a):b.setTime(+b+a));return b};c.generalizedTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,g=parseInt(a.substr(6,2),10),m=parseInt(a.substr(8,2),10),e=parseInt(a.substr(10,2),10),l=parseInt(a.substr(12,2),10),w=0,n=0,F=!1;"Z"===a.charAt(a.length-1)&&(F=!0);var E=a.length-5,z=a.charAt(E);if("+"===z||"-"===z)n=parseInt(a.substr(E+1,2),10),E=parseInt(a.substr(E+4,2),10),n=6E4*(60*n+E),"+"===z&&(n*=-1),F=!0;"."===a.charAt(14)&&(w=1E3*parseFloat(a.substr(14),
283 +10));F?(b.setUTCFullYear(c,d,g),b.setUTCHours(m,e,l,w),b.setTime(+b+n)):(b.setFullYear(c,d,g),b.setHours(m,e,l,w));return b};c.dateToUtcTime=function(a){if("string"===typeof a)return a;var b="",c=[];c.push((""+a.getUTCFullYear()).substr(2));c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"===
284 typeof a)return a;var b="",c=[];c.push(""+a.getUTCFullYear());c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.integerToDer=function(b){var c=a.util.createBuffer();if(-128<=b&&128>b)return c.putSignedInt(b,8);if(-32768<=b&&32768>b)return c.putSignedInt(b,16);if(-8388608<=b&&8388608>b)return c.putSignedInt(b,24);if(-2147483648<=b&&2147483648>
285 b)return c.putSignedInt(b,32);c=Error("Integer too large; max is 32-bits.");c.integer=b;throw c;};c.derToInteger=function(b){"string"===typeof b&&(b=a.util.createBuffer(b));var c=8*b.length();if(32<c)throw Error("Integer too large; max is 32-bits.");return b.getSignedInt(c)};c.validate=function(b,d,e,h){var l=!1;if(b.tagClass!==d.tagClass&&"undefined"!==typeof d.tagClass||b.type!==d.type&&"undefined"!==typeof d.type)h&&(b.tagClass!==d.tagClass&&h.push("["+d.name+'] Expected tag class "'+d.tagClass+
283 -'", got "'+b.tagClass+'"'),b.type!==d.type&&h.push("["+d.name+'] Expected type "'+d.type+'", got "'+b.type+'"'));else if(b.constructed===d.constructed||"undefined"===typeof d.constructed){l=!0;if(d.value&&a.util.isArray(d.value))for(var r=0,w=0;l&&w<d.value.length;++w)l=d.value[w].optional||!1,b.value[r]&&((l=c.validate(b.value[r],d.value[w],e,h))?++r:d.value[w].optional&&(l=!0)),!l&&h&&h.push("["+d.name+'] Tag class "'+d.tagClass+'", type "'+d.type+'" expected value length "'+d.value.length+'", got "'+
284 -b.value.length+'"');l&&e&&(d.capture&&(e[d.capture]=b.value),d.captureAsn1&&(e[d.captureAsn1]=b))}else h&&h.push("["+d.name+'] Expected constructed "'+d.constructed+'", got "'+b.constructed+'"');return l};var e=/[^\\u0000-\\u00ff]/;c.prettyPrint=function(b,d,k){var h="";d=d||0;k=k||2;0<d&&(h+="\n");for(var w="",r=0;r<d*k;++r)w+=" ";h+=w+"Tag: ";switch(b.tagClass){case c.Class.UNIVERSAL:h+="Universal:";break;case c.Class.APPLICATION:h+="Application:";break;case c.Class.CONTEXT_SPECIFIC:h+="Context-Specific:";
286 +'", got "'+b.tagClass+'"'),b.type!==d.type&&h.push("["+d.name+'] Expected type "'+d.type+'", got "'+b.type+'"'));else if(b.constructed===d.constructed||"undefined"===typeof d.constructed){l=!0;if(d.value&&a.util.isArray(d.value))for(var q=0,w=0;l&&w<d.value.length;++w)l=d.value[w].optional||!1,b.value[q]&&((l=c.validate(b.value[q],d.value[w],e,h))?++q:d.value[w].optional&&(l=!0)),!l&&h&&h.push("["+d.name+'] Tag class "'+d.tagClass+'", type "'+d.type+'" expected value length "'+d.value.length+'", got "'+
287 +b.value.length+'"');l&&e&&(d.capture&&(e[d.capture]=b.value),d.captureAsn1&&(e[d.captureAsn1]=b))}else h&&h.push("["+d.name+'] Expected constructed "'+d.constructed+'", got "'+b.constructed+'"');return l};var e=/[^\\u0000-\\u00ff]/;c.prettyPrint=function(b,d,k){var h="";d=d||0;k=k||2;0<d&&(h+="\n");for(var w="",q=0;q<d*k;++q)w+=" ";h+=w+"Tag: ";switch(b.tagClass){case c.Class.UNIVERSAL:h+="Universal:";break;case c.Class.APPLICATION:h+="Application:";break;case c.Class.CONTEXT_SPECIFIC:h+="Context-Specific:";
288 break;case c.Class.PRIVATE:h+="Private:"}if(b.tagClass===c.Class.UNIVERSAL)switch(h+=b.type,b.type){case c.Type.NONE:h+=" (None)";break;case c.Type.BOOLEAN:h+=" (Boolean)";break;case c.Type.BITSTRING:h+=" (Bit string)";break;case c.Type.INTEGER:h+=" (Integer)";break;case c.Type.OCTETSTRING:h+=" (Octet string)";break;case c.Type.NULL:h+=" (Null)";break;case c.Type.OID:h+=" (Object Identifier)";break;case c.Type.ODESC:h+=" (Object Descriptor)";break;case c.Type.EXTERNAL:h+=" (External or Instance of)";
289 break;case c.Type.REAL:h+=" (Real)";break;case c.Type.ENUMERATED:h+=" (Enumerated)";break;case c.Type.EMBEDDED:h+=" (Embedded PDV)";break;case c.Type.UTF8:h+=" (UTF8)";break;case c.Type.ROID:h+=" (Relative Object Identifier)";break;case c.Type.SEQUENCE:h+=" (Sequence)";break;case c.Type.SET:h+=" (Set)";break;case c.Type.PRINTABLESTRING:h+=" (Printable String)";break;case c.Type.IA5String:h+=" (IA5String (ASCII))";break;case c.Type.UTCTIME:h+=" (UTC time)";break;case c.Type.GENERALIZEDTIME:h+=" (Generalized time)";
287 -break;case c.Type.BMPSTRING:h+=" (BMP String)"}else h+=b.type;h=h+"\n"+(w+"Constructed: "+b.constructed+"\n");if(b.composed){for(var n=0,B="",r=0;r<b.value.length;++r)void 0!==b.value[r]&&(n+=1,B+=c.prettyPrint(b.value[r],d+1,k),r+1<b.value.length&&(B+=","));h+=w+"Sub values: "+n+B}else if(h+=w+"Value: ",b.type===c.Type.OID&&(d=c.derToOid(b.value),h+=d,a.pki&&a.pki.oids&&d in a.pki.oids&&(h+=" ("+a.pki.oids[d]+") ")),b.type===c.Type.INTEGER)try{h+=c.derToInteger(b.value)}catch(z){h+="0x"+a.util.bytesToHex(b.value)}else b.type===
290 +break;case c.Type.BMPSTRING:h+=" (BMP String)"}else h+=b.type;h=h+"\n"+(w+"Constructed: "+b.constructed+"\n");if(b.composed){for(var n=0,B="",q=0;q<b.value.length;++q)void 0!==b.value[q]&&(n+=1,B+=c.prettyPrint(b.value[q],d+1,k),q+1<b.value.length&&(B+=","));h+=w+"Sub values: "+n+B}else if(h+=w+"Value: ",b.type===c.Type.OID&&(d=c.derToOid(b.value),h+=d,a.pki&&a.pki.oids&&d in a.pki.oids&&(h+=" ("+a.pki.oids[d]+") ")),b.type===c.Type.INTEGER)try{h+=c.derToInteger(b.value)}catch(y){h+="0x"+a.util.bytesToHex(b.value)}else b.type===
291 c.Type.OCTETSTRING?(e.test(b.value)||(h+="("+b.value+") "),h+="0x"+a.util.bytesToHex(b.value)):h=b.type===c.Type.UTF8?h+a.util.decodeUtf8(b.value):b.type===c.Type.PRINTABLESTRING||b.type===c.Type.IA5String?h+b.value:e.test(b.value)?h+("0x"+a.util.bytesToHex(b.value)):0===b.value.length?h+"[null]":h+b.value;return h}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,
289 -c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.asn1)return c.asn1;c.defined.asn1=!0;for(var e=0;e<g.length;++e)g[e](c);return c.asn1}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/asn1",["require","module","./util","./oids"],function(){p.apply(null,Array.prototype.slice.call(arguments,
292 +c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.asn1)return c.asn1;c.defined.asn1=!0;for(var e=0;e<g.length;++e)g[e](c);return c.asn1}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/asn1",["require","module","./util","./oids"],function(){p.apply(null,Array.prototype.slice.call(arguments,
293 0))})})();(function(){function b(a){function c(){v=String.fromCharCode(128);v+=a.util.fillString(String.fromCharCode(0),64);x=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9];k=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];h=Array(64);for(var b=0;64>b;++b)h[b]=Math.floor(4294967296*
291 -Math.abs(Math.sin(b+1)));K=!0}function d(a,b,c){for(var g,m,e,l,y,D,A,w=c.length();64<=w;){m=a.h0;e=a.h1;l=a.h2;y=a.h3;for(A=0;16>A;++A)b[A]=c.getInt32Le(),g=y^e&(l^y),g=m+g+h[A]+b[A],D=k[A],m=y,y=l,l=e,e+=g<<D|g>>>32-D;for(;32>A;++A)g=l^y&(e^l),g=m+g+h[A]+b[x[A]],D=k[A],m=y,y=l,l=e,e+=g<<D|g>>>32-D;for(;48>A;++A)g=e^l^y,g=m+g+h[A]+b[x[A]],D=k[A],m=y,y=l,l=e,e+=g<<D|g>>>32-D;for(;64>A;++A)g=l^(e|~y),g=m+g+h[A]+b[x[A]],D=k[A],m=y,y=l,l=e,e+=g<<D|g>>>32-D;a.h0=a.h0+m|0;a.h1=a.h1+e|0;a.h2=a.h2+l|0;a.h3=
292 -a.h3+y|0;w-=64}}var e=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=e;e.create=function(){K||c();var b=null,e=a.util.createBuffer(),h=Array(16),k={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){k.messageLength=0;k.fullMessageLength=k.messageLength64=[];for(var c=k.messageLengthSize/4,g=0;g<c;++g)k.fullMessageLength.push(0);e=a.util.createBuffer();b={h0:1732584193,h1:4023233417,
293 -h2:2562383102,h3:271733878};return k}};k.start();k.update=function(c,g){"utf8"===g&&(c=a.util.encodeUtf8(c));var l=c.length;k.messageLength+=l;for(var l=[l/4294967296>>>0,l>>>0],y=k.fullMessageLength.length-1;0<=y;--y)k.fullMessageLength[y]+=l[1],l[1]=l[0]+(k.fullMessageLength[y]/4294967296>>>0),k.fullMessageLength[y]>>>=0,l[0]=l[1]/4294967296>>>0;e.putBytes(c);d(b,h,e);(2048<e.read||0===e.length())&&e.compact();return k};k.digest=function(){var c=a.util.createBuffer();c.putBytes(e.bytes());c.putBytes(v.substr(0,
294 -k.blockLength-(k.fullMessageLength[k.fullMessageLength.length-1]+k.messageLengthSize&k.blockLength-1)));for(var g,l=0,y=k.fullMessageLength.length-1;0<=y;--y)g=8*k.fullMessageLength[y]+l,l=g/4294967296>>>0,c.putInt32Le(g>>>0);g={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(g,h,c);c=a.util.createBuffer();c.putInt32Le(g.h0);c.putInt32Le(g.h1);c.putInt32Le(g.h2);c.putInt32Le(g.h3);return c};return k};var v=null,x=null,k=null,h=null,K=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=
295 -!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md5)return c.md5;c.defined.md5=!0;for(var e=0;e<g.length;++e)g[e](c);return c.md5}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,
296 -0))};a("js/md5",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,g){for(var d,m,e,l,w,v,n,E,y=g.length();64<=y;){m=a.h0;e=a.h1;l=a.h2;w=a.h3;v=a.h4;for(E=0;16>E;++E)d=g.getInt32(),b[E]=d,n=w^e&(l^w),d=(m<<5|m>>>27)+n+v+1518500249+d,v=w,w=l,l=e<<30|e>>>2,e=m,m=d;for(;20>E;++E)d=b[E-3]^b[E-8]^b[E-14]^b[E-16],d=d<<1|d>>>31,b[E]=d,n=w^e&(l^w),d=(m<<5|m>>>27)+n+v+1518500249+d,v=w,w=l,l=e<<30|e>>>2,e=m,m=d;for(;32>
297 -E;++E)d=b[E-3]^b[E-8]^b[E-14]^b[E-16],d=d<<1|d>>>31,b[E]=d,n=e^l^w,d=(m<<5|m>>>27)+n+v+1859775393+d,v=w,w=l,l=e<<30|e>>>2,e=m,m=d;for(;40>E;++E)d=b[E-6]^b[E-16]^b[E-28]^b[E-32],d=d<<2|d>>>30,b[E]=d,n=e^l^w,d=(m<<5|m>>>27)+n+v+1859775393+d,v=w,w=l,l=e<<30|e>>>2,e=m,m=d;for(;60>E;++E)d=b[E-6]^b[E-16]^b[E-28]^b[E-32],d=d<<2|d>>>30,b[E]=d,n=e&l|w&(e^l),d=(m<<5|m>>>27)+n+v+2400959708+d,v=w,w=l,l=e<<30|e>>>2,e=m,m=d;for(;80>E;++E)d=b[E-6]^b[E-16]^b[E-28]^b[E-32],d=d<<2|d>>>30,b[E]=d,n=e^l^w,d=(m<<5|m>>>
298 -27)+n+v+3395469782+d,v=w,w=l,l=e<<30|e>>>2,e=m,m=d;a.h0=a.h0+m|0;a.h1=a.h1+e|0;a.h2=a.h2+l|0;a.h3=a.h3+w|0;a.h4=a.h4+v|0;y-=64}}var d=a.sha1=a.sha1||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha1=a.md.algorithms.sha1=d;d.create=function(){v||(e=String.fromCharCode(128),e+=a.util.fillString(String.fromCharCode(0),64),v=!0);var b=null,d=a.util.createBuffer(),h=Array(80),w={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){w.messageLength=
299 -0;w.fullMessageLength=w.messageLength64=[];for(var c=w.messageLengthSize/4,g=0;g<c;++g)w.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return w}};w.start();w.update=function(e,l){"utf8"===l&&(e=a.util.encodeUtf8(e));var v=e.length;w.messageLength+=v;for(var v=[v/4294967296>>>0,v>>>0],z=w.fullMessageLength.length-1;0<=z;--z)w.fullMessageLength[z]+=v[1],v[1]=v[0]+(w.fullMessageLength[z]/4294967296>>>0),w.fullMessageLength[z]>>>=
300 -0,v[0]=v[1]/4294967296>>>0;d.putBytes(e);c(b,h,d);(2048<d.read||0===d.length())&&d.compact();return w};w.digest=function(){var r=a.util.createBuffer();r.putBytes(d.bytes());r.putBytes(e.substr(0,w.blockLength-(w.fullMessageLength[w.fullMessageLength.length-1]+w.messageLengthSize&w.blockLength-1)));a.util.createBuffer();for(var v,B,z=8*w.fullMessageLength[0],n=0;n<w.fullMessageLength.length;++n)v=8*w.fullMessageLength[n+1],B=v/4294967296>>>0,z+=B,r.putInt32(z>>>0),z=v;v={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,
301 -h4:b.h4};c(v,h,r);r=a.util.createBuffer();r.putInt32(v.h0);r.putInt32(v.h1);r.putInt32(v.h2);r.putInt32(v.h3);r.putInt32(v.h4);return r};return w};var e=null,v=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha1)return c.sha1;c.defined.sha1=
302 -!0;for(var e=0;e<g.length;++e)g[e](c);return c.sha1}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var g,m,e,l,w,v,n,y,D,A,G,p,u,q=d.length();64<=q;){for(w=0;16>w;++w)b[w]=d.getInt32();
303 -for(;64>w;++w)g=b[w-2],g=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,m=b[w-15],m=(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,b[w]=g+b[w-7]+m+b[w-16]|0;v=a.h0;n=a.h1;y=a.h2;D=a.h3;A=a.h4;G=a.h5;p=a.h6;u=a.h7;for(w=0;64>w;++w)g=(A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7),e=p^A&(G^p),m=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),l=v&n|y&(v^n),g=u+g+e+x[w]+b[w],m+=l,u=p,p=G,G=A,A=D+g|0,D=y,y=n,n=v,v=g+m|0;a.h0=a.h0+v|0;a.h1=a.h1+n|0;a.h2=a.h2+y|0;a.h3=a.h3+D|0;a.h4=a.h4+A|0;a.h5=a.h5+G|0;a.h6=a.h6+p|0;a.h7=a.h7+u|0;q-=
294 +Math.abs(Math.sin(b+1)));K=!0}function d(a,b,c){for(var g,m,e,l,z,D,A,w=c.length();64<=w;){m=a.h0;e=a.h1;l=a.h2;z=a.h3;for(A=0;16>A;++A)b[A]=c.getInt32Le(),g=z^e&(l^z),g=m+g+h[A]+b[A],D=k[A],m=z,z=l,l=e,e+=g<<D|g>>>32-D;for(;32>A;++A)g=l^z&(e^l),g=m+g+h[A]+b[x[A]],D=k[A],m=z,z=l,l=e,e+=g<<D|g>>>32-D;for(;48>A;++A)g=e^l^z,g=m+g+h[A]+b[x[A]],D=k[A],m=z,z=l,l=e,e+=g<<D|g>>>32-D;for(;64>A;++A)g=l^(e|~z),g=m+g+h[A]+b[x[A]],D=k[A],m=z,z=l,l=e,e+=g<<D|g>>>32-D;a.h0=a.h0+m|0;a.h1=a.h1+e|0;a.h2=a.h2+l|0;a.h3=
295 +a.h3+z|0;w-=64}}var e=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=e;e.create=function(){K||c();var b=null,e=a.util.createBuffer(),h=Array(16),k={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){k.messageLength=0;k.fullMessageLength=k.messageLength64=[];for(var c=k.messageLengthSize/4,d=0;d<c;++d)k.fullMessageLength.push(0);e=a.util.createBuffer();b={h0:1732584193,h1:4023233417,
296 +h2:2562383102,h3:271733878};return k}};k.start();k.update=function(c,g){"utf8"===g&&(c=a.util.encodeUtf8(c));var l=c.length;k.messageLength+=l;for(var l=[l/4294967296>>>0,l>>>0],z=k.fullMessageLength.length-1;0<=z;--z)k.fullMessageLength[z]+=l[1],l[1]=l[0]+(k.fullMessageLength[z]/4294967296>>>0),k.fullMessageLength[z]>>>=0,l[0]=l[1]/4294967296>>>0;e.putBytes(c);d(b,h,e);(2048<e.read||0===e.length())&&e.compact();return k};k.digest=function(){var c=a.util.createBuffer();c.putBytes(e.bytes());c.putBytes(v.substr(0,
297 +k.blockLength-(k.fullMessageLength[k.fullMessageLength.length-1]+k.messageLengthSize&k.blockLength-1)));for(var g,l=0,z=k.fullMessageLength.length-1;0<=z;--z)g=8*k.fullMessageLength[z]+l,l=g/4294967296>>>0,c.putInt32Le(g>>>0);g={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(g,h,c);c=a.util.createBuffer();c.putInt32Le(g.h0);c.putInt32Le(g.h1);c.putInt32Le(g.h2);c.putInt32Le(g.h3);return c};return k};var v=null,x=null,k=null,h=null,K=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=
298 +!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md5)return c.md5;c.defined.md5=!0;for(var e=0;e<g.length;++e)g[e](c);return c.md5}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,
299 +0))};a("js/md5",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var g,m,e,l,w,v,n,E,z=d.length();64<=z;){m=a.h0;e=a.h1;l=a.h2;w=a.h3;v=a.h4;for(E=0;16>E;++E)g=d.getInt32(),b[E]=g,n=w^e&(l^w),g=(m<<5|m>>>27)+n+v+1518500249+g,v=w,w=l,l=e<<30|e>>>2,e=m,m=g;for(;20>E;++E)g=b[E-3]^b[E-8]^b[E-14]^b[E-16],g=g<<1|g>>>31,b[E]=g,n=w^e&(l^w),g=(m<<5|m>>>27)+n+v+1518500249+g,v=w,w=l,l=e<<30|e>>>2,e=m,m=g;for(;32>
300 +E;++E)g=b[E-3]^b[E-8]^b[E-14]^b[E-16],g=g<<1|g>>>31,b[E]=g,n=e^l^w,g=(m<<5|m>>>27)+n+v+1859775393+g,v=w,w=l,l=e<<30|e>>>2,e=m,m=g;for(;40>E;++E)g=b[E-6]^b[E-16]^b[E-28]^b[E-32],g=g<<2|g>>>30,b[E]=g,n=e^l^w,g=(m<<5|m>>>27)+n+v+1859775393+g,v=w,w=l,l=e<<30|e>>>2,e=m,m=g;for(;60>E;++E)g=b[E-6]^b[E-16]^b[E-28]^b[E-32],g=g<<2|g>>>30,b[E]=g,n=e&l|w&(e^l),g=(m<<5|m>>>27)+n+v+2400959708+g,v=w,w=l,l=e<<30|e>>>2,e=m,m=g;for(;80>E;++E)g=b[E-6]^b[E-16]^b[E-28]^b[E-32],g=g<<2|g>>>30,b[E]=g,n=e^l^w,g=(m<<5|m>>>
301 +27)+n+v+3395469782+g,v=w,w=l,l=e<<30|e>>>2,e=m,m=g;a.h0=a.h0+m|0;a.h1=a.h1+e|0;a.h2=a.h2+l|0;a.h3=a.h3+w|0;a.h4=a.h4+v|0;z-=64}}var d=a.sha1=a.sha1||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha1=a.md.algorithms.sha1=d;d.create=function(){v||(e=String.fromCharCode(128),e+=a.util.fillString(String.fromCharCode(0),64),v=!0);var b=null,d=a.util.createBuffer(),h=Array(80),w={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){w.messageLength=
302 +0;w.fullMessageLength=w.messageLength64=[];for(var c=w.messageLengthSize/4,g=0;g<c;++g)w.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return w}};w.start();w.update=function(e,l){"utf8"===l&&(e=a.util.encodeUtf8(e));var v=e.length;w.messageLength+=v;for(var v=[v/4294967296>>>0,v>>>0],y=w.fullMessageLength.length-1;0<=y;--y)w.fullMessageLength[y]+=v[1],v[1]=v[0]+(w.fullMessageLength[y]/4294967296>>>0),w.fullMessageLength[y]>>>=
303 +0,v[0]=v[1]/4294967296>>>0;d.putBytes(e);c(b,h,d);(2048<d.read||0===d.length())&&d.compact();return w};w.digest=function(){var q=a.util.createBuffer();q.putBytes(d.bytes());q.putBytes(e.substr(0,w.blockLength-(w.fullMessageLength[w.fullMessageLength.length-1]+w.messageLengthSize&w.blockLength-1)));a.util.createBuffer();for(var v,B,y=8*w.fullMessageLength[0],n=0;n<w.fullMessageLength.length;++n)v=8*w.fullMessageLength[n+1],B=v/4294967296>>>0,y+=B,q.putInt32(y>>>0),y=v;v={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,
304 +h4:b.h4};c(v,h,q);q=a.util.createBuffer();q.putInt32(v.h0);q.putInt32(v.h1);q.putInt32(v.h2);q.putInt32(v.h3);q.putInt32(v.h4);return q};return w};var e=null,v=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha1)return c.sha1;c.defined.sha1=
305 +!0;for(var e=0;e<g.length;++e)g[e](c);return c.sha1}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,g){for(var d,m,e,l,w,v,n,z,D,A,G,p,u,r=g.length();64<=r;){for(w=0;16>w;++w)b[w]=g.getInt32();
306 +for(;64>w;++w)d=b[w-2],d=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,m=b[w-15],m=(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,b[w]=d+b[w-7]+m+b[w-16]|0;v=a.h0;n=a.h1;z=a.h2;D=a.h3;A=a.h4;G=a.h5;p=a.h6;u=a.h7;for(w=0;64>w;++w)d=(A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7),e=p^A&(G^p),m=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),l=v&n|z&(v^n),d=u+d+e+x[w]+b[w],m+=l,u=p,p=G,G=A,A=D+d|0,D=z,z=n,n=v,v=d+m|0;a.h0=a.h0+v|0;a.h1=a.h1+n|0;a.h2=a.h2+z|0;a.h3=a.h3+D|0;a.h4=a.h4+A|0;a.h5=a.h5+G|0;a.h6=a.h6+p|0;a.h7=a.h7+u|0;r-=
307 64}}var d=a.sha256=a.sha256||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha256=a.md.algorithms.sha256=d;d.create=function(){v||(e=String.fromCharCode(128),e+=a.util.fillString(String.fromCharCode(0),64),x=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,
305 -2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],v=!0);var b=null,d=a.util.createBuffer(),w=Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32,
306 -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){r.messageLength=0;r.fullMessageLength=r.messageLength64=[];for(var c=r.messageLengthSize/4,g=0;g<c;++g)r.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return r}};r.start();r.update=function(e,l){"utf8"===l&&(e=a.util.encodeUtf8(e));var v=e.length;r.messageLength+=v;for(var v=[v/4294967296>>>0,v>>>0],x=r.fullMessageLength.length-
307 -1;0<=x;--x)r.fullMessageLength[x]+=v[1],v[1]=v[0]+(r.fullMessageLength[x]/4294967296>>>0),r.fullMessageLength[x]>>>=0,v[0]=v[1]/4294967296>>>0;d.putBytes(e);c(b,w,d);(2048<d.read||0===d.length())&&d.compact();return r};r.digest=function(){var v=a.util.createBuffer();v.putBytes(d.bytes());v.putBytes(e.substr(0,r.blockLength-(r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize&r.blockLength-1)));a.util.createBuffer();for(var x,n,p=8*r.fullMessageLength[0],F=0;F<r.fullMessageLength.length;++F)x=
308 -8*r.fullMessageLength[F+1],n=x/4294967296>>>0,p+=n,v.putInt32(p>>>0),p=x;x={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,h4:b.h4,h5:b.h5,h6:b.h6,h7:b.h7};c(x,w,v);v=a.util.createBuffer();v.putInt32(x.h0);v.putInt32(x.h1);v.putInt32(x.h2);v.putInt32(x.h3);v.putInt32(x.h4);v.putInt32(x.h5);v.putInt32(x.h6);v.putInt32(x.h7);return v};return r};var e=null,v=!1,x=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge=
309 -{}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha256)return c.sha256;c.defined.sha256=!0;for(var e=0;e<g.length;++e)g[e](c);return c.sha256}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha256",["require","module","./util"],function(){p.apply(null,
310 -Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var g,m,e,h,l,y,D,A,v,w,u,x,n,P,p,N,q,T,W,U,M,V,J,H,S,Z=d.length();128<=Z;){for(S=0;16>S;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)l=b[S-2],v=l[0],l=l[1],g=((v>>>19|l<<13)^(l>>>29|v<<3)^v>>>6)>>>0,m=((v<<13|l>>>19)^(l<<3|v>>>29)^(v<<26|l>>>6))>>>0,l=b[S-15],v=l[0],l=l[1],e=((v>>>1|l<<31)^(v>>>8|l<<24)^v>>>7)>>>0,h=((v<<31|l>>>1)^(v<<24|l>>>8)^(v<<25|l>>>7))>>>0,v=b[S-7],w=b[S-16],
311 -l=m+v[1]+h+w[1],b[S][0]=g+v[0]+e+w[0]+(l/4294967296>>>0)>>>0,b[S][1]=l>>>0;v=a[0][0];w=a[0][1];u=a[1][0];x=a[1][1];n=a[2][0];P=a[2][1];p=a[3][0];N=a[3][1];q=a[4][0];T=a[4][1];W=a[5][0];U=a[5][1];M=a[6][0];V=a[6][1];J=a[7][0];H=a[7][1];for(S=0;80>S;++S)g=((q>>>14|T<<18)^(q>>>18|T<<14)^(T>>>9|q<<23))>>>0,l=((q<<18|T>>>14)^(q<<14|T>>>18)^(T<<23|q>>>9))>>>0,m=(M^q&(W^M))>>>0,y=(V^T&(U^V))>>>0,e=((v>>>28|w<<4)^(w>>>2|v<<30)^(w>>>7|v<<25))>>>0,h=((v<<4|w>>>28)^(w<<30|v>>>2)^(w<<25|v>>>7))>>>0,D=(v&u|n&
312 -(v^u))>>>0,A=(w&x|P&(w^x))>>>0,l=H+l+y+k[S][1]+b[S][1],g=J+g+m+k[S][0]+b[S][0]+(l/4294967296>>>0)>>>0,m=l>>>0,l=h+A,e=e+D+(l/4294967296>>>0)>>>0,h=l>>>0,J=M,H=V,M=W,V=U,W=q,U=T,l=N+m,q=p+g+(l/4294967296>>>0)>>>0,T=l>>>0,p=n,N=P,n=u,P=x,u=v,x=w,l=m+h,v=g+e+(l/4294967296>>>0)>>>0,w=l>>>0;l=a[0][1]+w;a[0][0]=a[0][0]+v+(l/4294967296>>>0)>>>0;a[0][1]=l>>>0;l=a[1][1]+x;a[1][0]=a[1][0]+u+(l/4294967296>>>0)>>>0;a[1][1]=l>>>0;l=a[2][1]+P;a[2][0]=a[2][0]+n+(l/4294967296>>>0)>>>0;a[2][1]=l>>>0;l=a[3][1]+N;a[3][0]=
313 -a[3][0]+p+(l/4294967296>>>0)>>>0;a[3][1]=l>>>0;l=a[4][1]+T;a[4][0]=a[4][0]+q+(l/4294967296>>>0)>>>0;a[4][1]=l>>>0;l=a[5][1]+U;a[5][0]=a[5][0]+W+(l/4294967296>>>0)>>>0;a[5][1]=l>>>0;l=a[6][1]+V;a[6][0]=a[6][0]+M+(l/4294967296>>>0)>>>0;a[6][1]=l>>>0;l=a[7][1]+H;a[7][0]=a[7][0]+J+(l/4294967296>>>0)>>>0;a[7][1]=l>>>0;Z-=128}}var d=a.sha512=a.sha512||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha512=a.md.algorithms.sha512=d;var e=a.sha384=a.sha512.sha384=a.sha512.sha384||{};e.create=function(){return d.create("SHA-384")};
308 +2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],v=!0);var b=null,d=a.util.createBuffer(),w=Array(64),q={algorithm:"sha256",blockLength:64,digestLength:32,
309 +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){q.messageLength=0;q.fullMessageLength=q.messageLength64=[];for(var c=q.messageLengthSize/4,g=0;g<c;++g)q.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return q}};q.start();q.update=function(e,l){"utf8"===l&&(e=a.util.encodeUtf8(e));var v=e.length;q.messageLength+=v;for(var v=[v/4294967296>>>0,v>>>0],x=q.fullMessageLength.length-
310 +1;0<=x;--x)q.fullMessageLength[x]+=v[1],v[1]=v[0]+(q.fullMessageLength[x]/4294967296>>>0),q.fullMessageLength[x]>>>=0,v[0]=v[1]/4294967296>>>0;d.putBytes(e);c(b,w,d);(2048<d.read||0===d.length())&&d.compact();return q};q.digest=function(){var v=a.util.createBuffer();v.putBytes(d.bytes());v.putBytes(e.substr(0,q.blockLength-(q.fullMessageLength[q.fullMessageLength.length-1]+q.messageLengthSize&q.blockLength-1)));a.util.createBuffer();for(var x,n,p=8*q.fullMessageLength[0],F=0;F<q.fullMessageLength.length;++F)x=
311 +8*q.fullMessageLength[F+1],n=x/4294967296>>>0,p+=n,v.putInt32(p>>>0),p=x;x={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,h4:b.h4,h5:b.h5,h6:b.h6,h7:b.h7};c(x,w,v);v=a.util.createBuffer();v.putInt32(x.h0);v.putInt32(x.h1);v.putInt32(x.h2);v.putInt32(x.h3);v.putInt32(x.h4);v.putInt32(x.h5);v.putInt32(x.h6);v.putInt32(x.h7);return v};return q};var e=null,v=!1,x=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge=
312 +{}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha256)return c.sha256;c.defined.sha256=!0;for(var e=0;e<g.length;++e)g[e](c);return c.sha256}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha256",["require","module","./util"],function(){p.apply(null,
313 +Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var g,m,e,h,l,z,D,A,v,w,u,x,n,P,p,N,r,T,W,U,M,V,J,H,S,Z=d.length();128<=Z;){for(S=0;16>S;++S)b[S][0]=d.getInt32()>>>0,b[S][1]=d.getInt32()>>>0;for(;80>S;++S)l=b[S-2],v=l[0],l=l[1],g=((v>>>19|l<<13)^(l>>>29|v<<3)^v>>>6)>>>0,m=((v<<13|l>>>19)^(l<<3|v>>>29)^(v<<26|l>>>6))>>>0,l=b[S-15],v=l[0],l=l[1],e=((v>>>1|l<<31)^(v>>>8|l<<24)^v>>>7)>>>0,h=((v<<31|l>>>1)^(v<<24|l>>>8)^(v<<25|l>>>7))>>>0,v=b[S-7],w=b[S-16],
314 +l=m+v[1]+h+w[1],b[S][0]=g+v[0]+e+w[0]+(l/4294967296>>>0)>>>0,b[S][1]=l>>>0;v=a[0][0];w=a[0][1];u=a[1][0];x=a[1][1];n=a[2][0];P=a[2][1];p=a[3][0];N=a[3][1];r=a[4][0];T=a[4][1];W=a[5][0];U=a[5][1];M=a[6][0];V=a[6][1];J=a[7][0];H=a[7][1];for(S=0;80>S;++S)g=((r>>>14|T<<18)^(r>>>18|T<<14)^(T>>>9|r<<23))>>>0,l=((r<<18|T>>>14)^(r<<14|T>>>18)^(T<<23|r>>>9))>>>0,m=(M^r&(W^M))>>>0,z=(V^T&(U^V))>>>0,e=((v>>>28|w<<4)^(w>>>2|v<<30)^(w>>>7|v<<25))>>>0,h=((v<<4|w>>>28)^(w<<30|v>>>2)^(w<<25|v>>>7))>>>0,D=(v&u|n&
315 +(v^u))>>>0,A=(w&x|P&(w^x))>>>0,l=H+l+z+k[S][1]+b[S][1],g=J+g+m+k[S][0]+b[S][0]+(l/4294967296>>>0)>>>0,m=l>>>0,l=h+A,e=e+D+(l/4294967296>>>0)>>>0,h=l>>>0,J=M,H=V,M=W,V=U,W=r,U=T,l=N+m,r=p+g+(l/4294967296>>>0)>>>0,T=l>>>0,p=n,N=P,n=u,P=x,u=v,x=w,l=m+h,v=g+e+(l/4294967296>>>0)>>>0,w=l>>>0;l=a[0][1]+w;a[0][0]=a[0][0]+v+(l/4294967296>>>0)>>>0;a[0][1]=l>>>0;l=a[1][1]+x;a[1][0]=a[1][0]+u+(l/4294967296>>>0)>>>0;a[1][1]=l>>>0;l=a[2][1]+P;a[2][0]=a[2][0]+n+(l/4294967296>>>0)>>>0;a[2][1]=l>>>0;l=a[3][1]+N;a[3][0]=
316 +a[3][0]+p+(l/4294967296>>>0)>>>0;a[3][1]=l>>>0;l=a[4][1]+T;a[4][0]=a[4][0]+r+(l/4294967296>>>0)>>>0;a[4][1]=l>>>0;l=a[5][1]+U;a[5][0]=a[5][0]+W+(l/4294967296>>>0)>>>0;a[5][1]=l>>>0;l=a[6][1]+V;a[6][0]=a[6][0]+M+(l/4294967296>>>0)>>>0;a[6][1]=l>>>0;l=a[7][1]+H;a[7][0]=a[7][0]+J+(l/4294967296>>>0)>>>0;a[7][1]=l>>>0;Z-=128}}var d=a.sha512=a.sha512||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha512=a.md.algorithms.sha512=d;var e=a.sha384=a.sha512.sha384=a.sha512.sha384||{};e.create=function(){return d.create("SHA-384")};
317 a.md.sha384=a.md.algorithms.sha384=e;a.sha512.sha256=a.sha512.sha256||{create:function(){return d.create("SHA-512/256")}};a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256;a.sha512.sha224=a.sha512.sha224||{create:function(){return d.create("SHA-512/224")}};a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224;d.create=function(b){x||(v=String.fromCharCode(128),v+=a.util.fillString(String.fromCharCode(0),128),k=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],
318 [3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,
319 3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],
@@ -319,146 +322,146 @@ a.md.sha384=a.md.algorithms.sha384=e;a.sha512.sha256=a.sha512.sha256||{create:fu
322 3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],"SHA-512/256":[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],"SHA-512/224":[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],
323 [2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},x=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in h))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=h[b],e=null,l=a.util.createBuffer(),w=Array(80),n=0;80>n;++n)w[n]=Array(2);var p={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){p.messageLength=0;p.fullMessageLength=p.messageLength128=[];for(var b=p.messageLengthSize/
324 4,c=0;c<b;++c)p.fullMessageLength.push(0);l=a.util.createBuffer();e=Array(d.length);for(c=0;c<d.length;++c)e[c]=d[c].slice(0);return p}};p.start();p.update=function(b,d){"utf8"===d&&(b=a.util.encodeUtf8(b));var h=b.length;p.messageLength+=h;for(var h=[h/4294967296>>>0,h>>>0],k=p.fullMessageLength.length-1;0<=k;--k)p.fullMessageLength[k]+=h[1],h[1]=h[0]+(p.fullMessageLength[k]/4294967296>>>0),p.fullMessageLength[k]>>>=0,h[0]=h[1]/4294967296>>>0;l.putBytes(b);c(e,w,l);(2048<l.read||0===l.length())&&
322 -l.compact();return p};p.digest=function(){var d=a.util.createBuffer();d.putBytes(l.bytes());d.putBytes(v.substr(0,p.blockLength-(p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1)));a.util.createBuffer();for(var h,k,r=8*p.fullMessageLength[0],x=0;x<p.fullMessageLength.length;++x)h=8*p.fullMessageLength[x+1],k=h/4294967296>>>0,r+=k,d.putInt32(r>>>0),r=h;h=Array(e.length);for(x=0;x<e.length;++x)h[x]=e[x].slice(0);c(h,w,d);d=a.util.createBuffer();k="SHA-512"===b?h.length:
325 +l.compact();return p};p.digest=function(){var d=a.util.createBuffer();d.putBytes(l.bytes());d.putBytes(v.substr(0,p.blockLength-(p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1)));a.util.createBuffer();for(var h,k,q=8*p.fullMessageLength[0],x=0;x<p.fullMessageLength.length;++x)h=8*p.fullMessageLength[x+1],k=h/4294967296>>>0,q+=k,d.putInt32(q>>>0),q=h;h=Array(e.length);for(x=0;x<e.length;++x)h[x]=e[x].slice(0);c(h,w,d);d=a.util.createBuffer();k="SHA-512"===b?h.length:
326 "SHA-384"===b?h.length-2:h.length-4;for(x=0;x<k;++x)d.putInt32(h[x][0]),x===k-1&&"SHA-512/224"===b||d.putInt32(h[x][1]);return d};return p};var v=null,x=!1,k=null,h=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha512)return c.sha512;c.defined.sha512=
324 -!0;for(var e=0;e<g.length;++e)g[e](c);return c.sha512}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha512",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.md=a.md||{};a.md.algorithms={md5:a.md5,sha1:a.sha1,sha256:a.sha256};a.md.md5=a.md5;a.md.sha1=a.sha1;
325 -a.md.sha256=a.sha256}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md)return c.md;c.defined.md=!0;for(var e=0;e<g.length;++e)g[e](c);return c.md}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,
326 -Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/md","require module ./md5 ./sha1 ./sha256 ./sha512".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.hmac=a.hmac||{}).create=function(){var b=null,c=null,d=null,e={start:function(e,k){if(null!==e)if("string"===typeof e)if(e=e.toLowerCase(),e in a.md.algorithms)b=a.md.algorithms[e].create();else throw Error('Unknown hash algorithm "'+
327 -e+'"');else b=e;if(null!==k){if("string"===typeof k)k=a.util.createBuffer(k);else if(a.util.isArray(k)){var h=k;k=a.util.createBuffer();for(var v=0;v<h.length;++v)k.putByte(h[v])}var r=k.length();r>b.blockLength&&(b.start(),b.update(k.bytes()),k=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();r=k.length();for(v=0;v<r;++v)h=k.at(v),c.putByte(54^h),d.putByte(92^h);if(r<b.blockLength)for(h=b.blockLength-r,v=0;v<h;++v)c.putByte(54),d.putByte(92);c=c.bytes();d=d.bytes()}b.start();b.update(c)},
327 +!0;for(var e=0;e<g.length;++e)g[e](c);return c.sha512}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha512",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.md=a.md||{};a.md.algorithms={md5:a.md5,sha1:a.sha1,sha256:a.sha256};a.md.md5=a.md5;a.md.sha1=a.sha1;
328 +a.md.sha256=a.sha256}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md)return c.md;c.defined.md=!0;for(var e=0;e<g.length;++e)g[e](c);return c.md}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,
329 +Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/md","require module ./md5 ./sha1 ./sha256 ./sha512".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.hmac=a.hmac||{}).create=function(){var b=null,c=null,d=null,e={start:function(e,k){if(null!==e)if("string"===typeof e)if(e=e.toLowerCase(),e in a.md.algorithms)b=a.md.algorithms[e].create();else throw Error('Unknown hash algorithm "'+
330 +e+'"');else b=e;if(null!==k){if("string"===typeof k)k=a.util.createBuffer(k);else if(a.util.isArray(k)){var h=k;k=a.util.createBuffer();for(var v=0;v<h.length;++v)k.putByte(h[v])}var q=k.length();q>b.blockLength&&(b.start(),b.update(k.bytes()),k=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();q=k.length();for(v=0;v<q;++v)h=k.at(v),c.putByte(54^h),d.putByte(92^h);if(q<b.blockLength)for(h=b.blockLength-q,v=0;v<h;++v)c.putByte(54),d.putByte(92);c=c.bytes();d=d.bytes()}b.start();b.update(c)},
331 update:function(a){b.update(a)},getMac:function(){var a=b.digest().bytes();b.start();b.update(d);b.update(a);return b.digest()}};e.digest=e.getMac;return e}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.hmac)return c.hmac;c.defined.hmac=!0;for(var e=
329 -0;e<g.length;++e)g[e](c);return c.hmac}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/hmac",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a){for(var b=a.name+": ",d=[],g=function(a,b){return" "+b},m=0;m<a.values.length;++m)d.push(a.values[m].replace(/^(\S+\r\n)/,
332 +0;e<g.length;++e)g[e](c);return c.hmac}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/hmac",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a){for(var b=a.name+": ",d=[],g=function(a,b){return" "+b},m=0;m<a.values.length;++m)d.push(a.values[m].replace(/^(\S+\r\n)/,
333 g));b+=d.join(",")+"\r\n";d=0;a=-1;for(m=0;m<b.length;++m,++d)if(65<d&&-1!==a)d=b[a],","===d?(++a,b=b.substr(0,a)+"\r\n "+b.substr(a)):b=b.substr(0,a)+"\r\n"+d+b.substr(a+1),d=m-a-1,a=-1,++m;else if(" "===b[m]||"\t"===b[m]||","===b[m])a=m;return b}var d=a.pem=a.pem||{};d.encode=function(b,d){d=d||{};var e="-----BEGIN "+b.type+"-----\r\n",k;b.procType&&(k={name:"Proc-Type",values:[String(b.procType.version),b.procType.type]},e+=c(k));b.contentDomain&&(k={name:"Content-Domain",values:[b.contentDomain]},
334 e+=c(k));b.dekInfo&&(k={name:"DEK-Info",values:[b.dekInfo.algorithm]},b.dekInfo.parameters&&k.values.push(b.dekInfo.parameters),e+=c(k));if(b.headers)for(k=0;k<b.headers.length;++k)e+=c(b.headers[k]);b.procType&&(e+="\r\n");e+=a.util.encode64(b.body,d.maxline||64)+"\r\n";return e+="-----END "+b.type+"-----\r\n"};d.decode=function(b){for(var c=[],d=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,g=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,
332 -e=/\r?\n/,w;;){w=d.exec(b);if(!w)break;var r={type:w[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(w[3])};c.push(r);if(w[2]){for(var n=w[2].split(e),B=0;w&&B<n.length;){w=n[B].replace(/\s+$/,"");for(var z=B+1;z<n.length;++z){var p=n[z];if(!/\s/.test(p[0]))break;w+=p;B=z}if(w=w.match(g)){for(var z={name:w[1],values:[]},p=w[2].split(","),F=0;F<p.length;++F)z.values.push(p[F].replace(/^\s+/,""));if(r.procType)if(r.contentDomain||"Content-Domain"!==z.name)if(r.dekInfo||
333 -"DEK-Info"!==z.name)r.headers.push(z);else{if(0===z.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');r.dekInfo={algorithm:p[0],parameters:p[1]||null}}else r.contentDomain=p[0]||"";else{if("Proc-Type"!==z.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==z.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');r.procType={version:p[0],
334 -type:p[1]}}}++B}if("ENCRYPTED"===r.procType&&!r.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===c.length)throw Error("Invalid PEM formatted message.");return c}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);
335 -c=c||{};c.defined=c.defined||{};if(c.defined.pem)return c.pem;c.defined.pem=!0;for(var e=0;e<g.length;++e)g[e](c);return c.pem}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pem",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,
336 -function(){return new a.des.Algorithm(b,d)})}function d(a,b,c,g){var m=32===a.length?3:9;g=3===m?g?[30,-2,-2]:[0,32,2]:g?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var e=b[0],l=b[1];b=(e>>>4^l)&252645135;l^=b;e^=b<<4;b=(e>>>16^l)&65535;l^=b;e^=b<<16;b=(l>>>2^e)&858993459;e^=b;l^=b<<2;b=(l>>>8^e)&16711935;e^=b;l^=b<<8;b=(e>>>1^l)&1431655765;for(var l=l^b,e=e^b<<1,e=e<<1|e>>>31,l=l<<1|l>>>31,w=0;w<m;w+=3){for(var q=g[w+1],u=g[w+2],O=g[w];O!=q;O+=u){var R=l^a[O],P=(l>>>4|l<<28)^a[O+1];b=e;
337 -e=l;l=b^(x[R>>>24&63]|h[R>>>16&63]|r[R>>>8&63]|B[R&63]|v[P>>>24&63]|k[P>>>16&63]|n[P>>>8&63]|p[P&63])}b=e;e=l;l=b}e=e>>>1|e<<31;l=l>>>1|l<<31;b=(e>>>1^l)&1431655765;l^=b;e^=b<<1;b=(l>>>8^e)&16711935;e^=b;l^=b<<8;b=(l>>>2^e)&858993459;e^=b;l^=b<<2;b=(e>>>16^l)&65535;l^=b;e^=b<<16;b=(e>>>4^l)&252645135;c[0]=e^b<<4;c[1]=l^b}function e(b){b=b||{};var c="DES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):a.cipher.createCipher(c,b.key);var g=d.start;d.start=function(b,c){var e=
335 +e=/\r?\n/,w;;){w=d.exec(b);if(!w)break;var q={type:w[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(w[3])};c.push(q);if(w[2]){for(var n=w[2].split(e),B=0;w&&B<n.length;){w=n[B].replace(/\s+$/,"");for(var y=B+1;y<n.length;++y){var p=n[y];if(!/\s/.test(p[0]))break;w+=p;B=y}if(w=w.match(g)){for(var y={name:w[1],values:[]},p=w[2].split(","),F=0;F<p.length;++F)y.values.push(p[F].replace(/^\s+/,""));if(q.procType)if(q.contentDomain||"Content-Domain"!==y.name)if(q.dekInfo||
336 +"DEK-Info"!==y.name)q.headers.push(y);else{if(0===y.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');q.dekInfo={algorithm:p[0],parameters:p[1]||null}}else q.contentDomain=p[0]||"";else{if("Proc-Type"!==y.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');q.procType={version:p[0],
337 +type:p[1]}}}++B}if("ENCRYPTED"===q.procType&&!q.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===c.length)throw Error("Invalid PEM formatted message.");return c}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);
338 +c=c||{};c.defined=c.defined||{};if(c.defined.pem)return c.pem;c.defined.pem=!0;for(var e=0;e<g.length;++e)g[e](c);return c.pem}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pem",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,
339 +function(){return new a.des.Algorithm(b,d)})}function d(a,b,c,g){var e=32===a.length?3:9;g=3===e?g?[30,-2,-2]:[0,32,2]:g?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=b[0],l=b[1];b=(m>>>4^l)&252645135;l^=b;m^=b<<4;b=(m>>>16^l)&65535;l^=b;m^=b<<16;b=(l>>>2^m)&858993459;m^=b;l^=b<<2;b=(l>>>8^m)&16711935;m^=b;l^=b<<8;b=(m>>>1^l)&1431655765;for(var l=l^b,m=m^b<<1,m=m<<1|m>>>31,l=l<<1|l>>>31,w=0;w<e;w+=3){for(var r=g[w+1],u=g[w+2],O=g[w];O!=r;O+=u){var R=l^a[O],P=(l>>>4|l<<28)^a[O+1];b=m;
340 +m=l;l=b^(x[R>>>24&63]|h[R>>>16&63]|q[R>>>8&63]|B[R&63]|v[P>>>24&63]|k[P>>>16&63]|n[P>>>8&63]|p[P&63])}b=m;m=l;l=b}m=m>>>1|m<<31;l=l>>>1|l<<31;b=(m>>>1^l)&1431655765;l^=b;m^=b<<1;b=(l>>>8^m)&16711935;m^=b;l^=b<<8;b=(l>>>2^m)&858993459;m^=b;l^=b<<2;b=(m>>>16^l)&65535;l^=b;m^=b<<16;b=(m>>>4^l)&252645135;c[0]=m^b<<4;c[1]=l^b}function e(b){b=b||{};var c="DES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):a.cipher.createCipher(c,b.key);var g=d.start;d.start=function(b,c){var e=
341 null;c instanceof a.util.ByteBuffer&&(e=c,c={});c=c||{};c.output=e;c.iv=b;g.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=e({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return e({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=e({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return e({key:a,
342 output:null,decrypt:!0,mode:b})};a.des.Algorithm=function(a,b){var c=this;c.name=a;c.mode=new b({blockSize:8,cipher:{encrypt:function(a,b){return d(c._keys,a,b,!1)},decrypt:function(a,b){return d(c._keys,a,b,!0)}}});c._init=!1};a.des.Algorithm.prototype.initialize=function(b){if(!this._init){b=a.util.createBuffer(b.key);if(0===this.name.indexOf("3DES")&&24!==b.length())throw Error("Invalid Triple-DES key size: "+8*b.length());for(var c=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,
343 516,536871424,536871428,66048,66052,536936960,536936964],d=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],g=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],e=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],h=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],
341 -l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],r=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],w=[0,268435456,8,268435464,0,268435456,
344 +l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],q=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],v=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],w=[0,268435456,8,268435464,0,268435456,
345 8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],x=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],n=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],B=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],p=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],K=8<b.length()?3:
343 -1,C=[],q=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],U=0,M,V=0;V<K;V++){var J=b.getInt32(),H=b.getInt32();M=(J>>>4^H)&252645135;H^=M;J^=M<<4;M=(H>>>-16^J)&65535;J^=M;H^=M<<-16;M=(J>>>2^H)&858993459;H^=M;J^=M<<2;M=(H>>>-16^J)&65535;J^=M;H^=M<<-16;M=(J>>>1^H)&1431655765;H^=M;J^=M<<1;M=(H>>>8^J)&16711935;J^=M;H^=M<<8;M=(J>>>1^H)&1431655765;H^=M;J^=M<<1;M=J<<8|H>>>20&240;for(var J=H<<24|H<<8&16711680|H>>>8&65280|H>>>24&240,H=M,S=0;S<q.length;++S){q[S]?(J=J<<2|J>>>26,H=H<<2|H>>>26):(J=J<<1|J>>>27,H=H<<1|H>>>27);
344 -var J=J&-15,H=H&-15,Z=c[J>>>28]|d[J>>>24&15]|g[J>>>20&15]|e[J>>>16&15]|h[J>>>12&15]|l[J>>>8&15]|k[J>>>4&15],aa=r[H>>>28]|v[H>>>24&15]|w[H>>>20&15]|x[H>>>16&15]|n[H>>>12&15]|B[H>>>8&15]|p[H>>>4&15];M=(aa>>>16^Z)&65535;C[U++]=Z^M;C[U++]=aa^M<<16}}this._keys=C;this._init=!0}};c("DES-ECB",a.cipher.modes.ecb);c("DES-CBC",a.cipher.modes.cbc);c("DES-CFB",a.cipher.modes.cfb);c("DES-OFB",a.cipher.modes.ofb);c("DES-CTR",a.cipher.modes.ctr);c("3DES-ECB",a.cipher.modes.ecb);c("3DES-CBC",a.cipher.modes.cbc);c("3DES-CFB",
346 +1,C=[],r=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],U=0,M,V=0;V<K;V++){var J=b.getInt32(),H=b.getInt32();M=(J>>>4^H)&252645135;H^=M;J^=M<<4;M=(H>>>-16^J)&65535;J^=M;H^=M<<-16;M=(J>>>2^H)&858993459;H^=M;J^=M<<2;M=(H>>>-16^J)&65535;J^=M;H^=M<<-16;M=(J>>>1^H)&1431655765;H^=M;J^=M<<1;M=(H>>>8^J)&16711935;J^=M;H^=M<<8;M=(J>>>1^H)&1431655765;H^=M;J^=M<<1;M=J<<8|H>>>20&240;for(var J=H<<24|H<<8&16711680|H>>>8&65280|H>>>24&240,H=M,S=0;S<r.length;++S){r[S]?(J=J<<2|J>>>26,H=H<<2|H>>>26):(J=J<<1|J>>>27,H=H<<1|H>>>27);
347 +var J=J&-15,H=H&-15,Z=c[J>>>28]|d[J>>>24&15]|g[J>>>20&15]|e[J>>>16&15]|h[J>>>12&15]|l[J>>>8&15]|k[J>>>4&15],aa=q[H>>>28]|v[H>>>24&15]|w[H>>>20&15]|x[H>>>16&15]|n[H>>>12&15]|B[H>>>8&15]|p[H>>>4&15];M=(aa>>>16^Z)&65535;C[U++]=Z^M;C[U++]=aa^M<<16}}this._keys=C;this._init=!0}};c("DES-ECB",a.cipher.modes.ecb);c("DES-CBC",a.cipher.modes.cbc);c("DES-CFB",a.cipher.modes.cfb);c("DES-OFB",a.cipher.modes.ofb);c("DES-CTR",a.cipher.modes.ctr);c("3DES-ECB",a.cipher.modes.ecb);c("3DES-CBC",a.cipher.modes.cbc);c("3DES-CFB",
348 a.cipher.modes.cfb);c("3DES-OFB",a.cipher.modes.ofb);c("3DES-CTR",a.cipher.modes.ctr);var v=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,
349 0,65540,66560,0,16842756],x=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,
350 -2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],k=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,
351 8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],h=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],n=[256,34078976,34078720,1107296512,
352 524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,
350 -524288,0,1074266112,34078976,1073742080],r=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,
353 +524288,0,1074266112,34078976,1073742080],q=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,
354 4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,
355 67108866,67110912,2048,2097154],B=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,
353 -268435456,268701696]}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.des)return c.des;c.defined.des=!0;for(var e=0;e<g.length;++e)g[e](c);return c.des}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,
354 -Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/des",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d=a.pkcs5=a.pkcs5||{},e="undefined"!==typeof process&&process.versions&&process.versions.node,l;e&&!a.disableNativeCode&&(l=c("crypto"));a.pbkdf2=d.pbkdf2=function(b,c,d,g,n,r){function p(){if(L>q)return r(null,y);E.start(null,
355 -null);E.update(c);E.update(a.util.int32ToBytes(L));D=G=E.digest().getBytes();u=2;B()}function B(){if(u<=d)return E.start(null,null),E.update(G),A=E.digest().getBytes(),D=a.util.xorBytes(D,A,z),G=A,++u,a.util.setImmediate(B);y+=L<q?D:D.substr(0,F);++L;p()}"function"===typeof n&&(r=n,n=null);if(e&&!a.disableNativeCode&&l.pbkdf2&&(null===n||"object"!==typeof n)&&(4<l.pbkdf2Sync.length||!n||"sha1"===n))return"string"!==typeof n&&(n="sha1"),c=new Buffer(c,"binary"),r?4===l.pbkdf2Sync.length?l.pbkdf2(b,
356 -c,d,g,function(a,b){if(a)return r(a);r(null,b.toString("binary"))}):l.pbkdf2(b,c,d,g,n,function(a,b){if(a)return r(a);r(null,b.toString("binary"))}):4===l.pbkdf2Sync.length?l.pbkdf2Sync(b,c,d,g).toString("binary"):l.pbkdf2Sync(b,c,d,g,n).toString("binary");if("undefined"===typeof n||null===n)n=a.md.sha1.create();if("string"===typeof n){if(!(n in a.md.algorithms))throw Error("Unknown hash algorithm: "+n);n=a.md[n].create()}var z=n.digestLength;if(g>4294967295*z){b=Error("Derived key is too long.");
357 -if(r)return r(b);throw b;}var q=Math.ceil(g/z),F=g-(q-1)*z,E=a.hmac.create();E.start(n,b);var y="",D,A,G;if(!r){for(var L=1;L<=q;++L){E.start(null,null);E.update(c);E.update(a.util.int32ToBytes(L));D=G=E.digest().getBytes();for(var u=2;u<=d;++u)E.start(null,null),E.update(G),A=E.digest().getBytes(),D=a.util.xorBytes(D,A,z),G=A;y+=L<q?D:D.substr(0,F)}return y}L=1;p()}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
358 -typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbkdf2)return c.pbkdf2;c.defined.pbkdf2=!0;for(var e=0;e<g.length;++e)g[e](c);return c.pbkdf2}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbkdf2",["require","module",
356 +268435456,268701696]}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.des)return c.des;c.defined.des=!0;for(var e=0;e<g.length;++e)g[e](c);return c.des}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,
357 +Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/des",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d=a.pkcs5=a.pkcs5||{},e="undefined"!==typeof process&&process.versions&&process.versions.node,l;e&&!a.disableNativeCode&&(l=c("crypto"));a.pbkdf2=d.pbkdf2=function(b,c,d,g,n,q){function p(){if(L>r)return q(null,z);E.start(null,
358 +null);E.update(c);E.update(a.util.int32ToBytes(L));D=G=E.digest().getBytes();u=2;B()}function B(){if(u<=d)return E.start(null,null),E.update(G),A=E.digest().getBytes(),D=a.util.xorBytes(D,A,y),G=A,++u,a.util.setImmediate(B);z+=L<r?D:D.substr(0,F);++L;p()}"function"===typeof n&&(q=n,n=null);if(e&&!a.disableNativeCode&&l.pbkdf2&&(null===n||"object"!==typeof n)&&(4<l.pbkdf2Sync.length||!n||"sha1"===n))return"string"!==typeof n&&(n="sha1"),c=new Buffer(c,"binary"),q?4===l.pbkdf2Sync.length?l.pbkdf2(b,
359 +c,d,g,function(a,b){if(a)return q(a);q(null,b.toString("binary"))}):l.pbkdf2(b,c,d,g,n,function(a,b){if(a)return q(a);q(null,b.toString("binary"))}):4===l.pbkdf2Sync.length?l.pbkdf2Sync(b,c,d,g).toString("binary"):l.pbkdf2Sync(b,c,d,g,n).toString("binary");if("undefined"===typeof n||null===n)n=a.md.sha1.create();if("string"===typeof n){if(!(n in a.md.algorithms))throw Error("Unknown hash algorithm: "+n);n=a.md[n].create()}var y=n.digestLength;if(g>4294967295*y){b=Error("Derived key is too long.");
360 +if(q)return q(b);throw b;}var r=Math.ceil(g/y),F=g-(r-1)*y,E=a.hmac.create();E.start(n,b);var z="",D,A,G;if(!q){for(var L=1;L<=r;++L){E.start(null,null);E.update(c);E.update(a.util.int32ToBytes(L));D=G=E.digest().getBytes();for(var u=2;u<=d;++u)E.start(null,null),E.update(G),A=E.digest().getBytes(),D=a.util.xorBytes(D,A,y),G=A;z+=L<r?D:D.substr(0,F)}return z}L=1;p()}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
361 +typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbkdf2)return c.pbkdf2;c.defined.pbkdf2=!0;for(var e=0;e<g.length;++e)g[e](c);return c.pbkdf2}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbkdf2",["require","module",
362 "./hmac","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d="undefined"!==typeof process&&process.versions&&process.versions.node,e=null;a.disableNativeCode||!d||process.versions["node-webkit"]||(e=c("crypto"));(a.prng=a.prng||{}).create=function(b){function c(a){if(32<=h.pools[0].messageLength)return d(),a();h.seedFile(32-h.pools[0].messageLength<<5,function(b,c){if(b)return a(b);h.collect(c);d();a()})}function d(){var a=h.plugin.md.create();
363 a.update(h.pools[0].digest().getBytes());h.pools[0].start();for(var b=1,c=1;32>c;++c)b=31===b?2147483648:b<<2,0===b%h.reseeds&&(a.update(h.pools[c].digest().getBytes()),h.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();h.key=h.plugin.formatKey(b);h.seed=h.plugin.formatSeed(a);h.reseeds=4294967295===h.reseeds?0:h.reseeds+1;h.generated=0}function g(b){var c=null;if("undefined"!==typeof window){var d=window.crypto||window.msCrypto;d&&d.getRandomValues&&(c=function(a){return d.getRandomValues(a)})}var e=
364 a.util.createBuffer();if(c)for(;e.length()<b;){var h=Math.max(1,Math.min(b-e.length(),65536)/4),l=new Uint32Array(Math.floor(h));try{for(c(l),h=0;h<l.length;++h)e.putInt32(l[h])}catch(k){if(!("undefined"!==typeof QuotaExceededError&&k instanceof QuotaExceededError))throw k;}}if(e.length()<b)for(c=Math.floor(65536*Math.random());e.length()<b;)for(h=16807*(c&65535),c=16807*(c>>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()),
362 -e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var h={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var n=Array(32),r=0;32>r;++r)n[r]=b.create();h.pools=n;h.pool=0;h.generate=function(b,d){function g(A){if(A)return d(A);if(r.length()>=b)return d(null,r.getBytes(b));1048575<h.generated&&(h.key=null);if(null===h.key)return a.util.nextTick(function(){c(g)});A=e(h.key,h.seed);h.generated+=A.length;r.putBytes(A);h.key=k(e(h.key,l(h.seed)));h.seed=y(e(h.key,h.seed));
363 -a.util.setImmediate(g)}if(!d)return h.generateSync(b);var e=h.plugin.cipher,l=h.plugin.increment,k=h.plugin.formatKey,y=h.plugin.formatSeed,r=a.util.createBuffer();h.key=null;g()};h.generateSync=function(b){var c=h.plugin.cipher,g=h.plugin.increment,e=h.plugin.formatKey,l=h.plugin.formatSeed;h.key=null;for(var k=a.util.createBuffer();k.length()<b;){1048575<h.generated&&(h.key=null);null===h.key&&(32<=h.pools[0].messageLength||h.collect(h.seedFileSync(32-h.pools[0].messageLength<<5)),d());var y=c(h.key,
364 -h.seed);h.generated+=y.length;k.putBytes(y);h.key=e(c(h.key,g(h.seed)));h.seed=l(c(h.key,h.seed))}return k.getBytes(b)};e?(h.seedFile=function(a,b){e.randomBytes(a,function(a,c){if(a)return b(a);b(null,c.toString())})},h.seedFileSync=function(a){return e.randomBytes(a).toString()}):(h.seedFile=function(a,b){try{b(null,g(a))}catch(c){b(c)}},h.seedFileSync=g);h.collect=function(a){for(var b=a.length,c=0;c<b;++c)h.pools[h.pool].update(a.substr(c,1)),h.pool=31===h.pool?0:h.pool+1};h.collectInt=function(a,
365 +e.putByte(String.fromCharCode(l&255));return e.getBytes(b)}var h={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var n=Array(32),q=0;32>q;++q)n[q]=b.create();h.pools=n;h.pool=0;h.generate=function(b,d){function g(A){if(A)return d(A);if(q.length()>=b)return d(null,q.getBytes(b));1048575<h.generated&&(h.key=null);if(null===h.key)return a.util.nextTick(function(){c(g)});A=e(h.key,h.seed);h.generated+=A.length;q.putBytes(A);h.key=k(e(h.key,l(h.seed)));h.seed=z(e(h.key,h.seed));
366 +a.util.setImmediate(g)}if(!d)return h.generateSync(b);var e=h.plugin.cipher,l=h.plugin.increment,k=h.plugin.formatKey,z=h.plugin.formatSeed,q=a.util.createBuffer();h.key=null;g()};h.generateSync=function(b){var c=h.plugin.cipher,g=h.plugin.increment,e=h.plugin.formatKey,l=h.plugin.formatSeed;h.key=null;for(var k=a.util.createBuffer();k.length()<b;){1048575<h.generated&&(h.key=null);null===h.key&&(32<=h.pools[0].messageLength||h.collect(h.seedFileSync(32-h.pools[0].messageLength<<5)),d());var z=c(h.key,
367 +h.seed);h.generated+=z.length;k.putBytes(z);h.key=e(c(h.key,g(h.seed)));h.seed=l(c(h.key,h.seed))}return k.getBytes(b)};e?(h.seedFile=function(a,b){e.randomBytes(a,function(a,c){if(a)return b(a);b(null,c.toString())})},h.seedFileSync=function(a){return e.randomBytes(a).toString()}):(h.seedFile=function(a,b){try{b(null,g(a))}catch(c){b(c)}},h.seedFileSync=g);h.collect=function(a){for(var b=a.length,c=0;c<b;++c)h.pools[h.pool].update(a.substr(c,1)),h.pool=31===h.pool?0:h.pool+1};h.collectInt=function(a,
368 b){for(var c="",d=0;d<b;d+=8)c+=String.fromCharCode(a>>d&255);h.collect(c)};h.registerWorker=function(a){a===self?h.seedFile=function(a,b){function c(a){a=a.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",c),b(a.forge.prng.err,a.forge.prng.bytes))}self.addEventListener("message",c);self.postMessage({forge:{prng:{needed:a}}})}:a.addEventListener("message",function(b){b=b.data;b.forge&&b.forge.prng&&h.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})};
366 -return h}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prng)return c.prng;c.defined.prng=!0;for(var e=0;e<g.length;++e)g[e](c);return c.prng}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,
367 -0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prng",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.random&&a.random.getBytes||function(b){function c(){var b=a.prng.create(d);b.getBytes=function(a,c){return b.generate(a,c)};b.getBytesSync=function(a){return b.generate(a)};return b}var d={},e=Array(4),n=a.util.createBuffer();d.formatKey=function(b){var c=a.util.createBuffer(b);b=Array(4);
369 +return h}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prng)return c.prng;c.defined.prng=!0;for(var e=0;e<g.length;++e)g[e](c);return c.prng}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,
370 +0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prng",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.random&&a.random.getBytes||function(b){function c(){var b=a.prng.create(d);b.getBytes=function(a,c){return b.generate(a,c)};b.getBytesSync=function(a){return b.generate(a)};return b}var d={},e=Array(4),n=a.util.createBuffer();d.formatKey=function(b){var c=a.util.createBuffer(b);b=Array(4);
371 b[0]=c.getInt32();b[1]=c.getInt32();b[2]=c.getInt32();b[3]=c.getInt32();return a.aes._expandKey(b,!1)};d.formatSeed=function(b){var c=a.util.createBuffer(b);b=Array(4);b[0]=c.getInt32();b[1]=c.getInt32();b[2]=c.getInt32();b[3]=c.getInt32();return b};d.cipher=function(b,c){a.aes._updateBlock(b,c,e,!1);n.putInt32(e[0]);n.putInt32(e[1]);n.putInt32(e[2]);n.putInt32(e[3]);return n.getBytes()};d.increment=function(a){++a[3];return a};d.md=a.md.sha256;var k=c(),h="undefined"!==typeof process&&process.versions&&
369 -process.versions.node,p=null;if("undefined"!==typeof window){var r=window.crypto||window.msCrypto;r&&r.getRandomValues&&(p=function(a){return r.getRandomValues(a)})}if(a.disableNativeCode||!h&&!p){k.collectInt(+new Date,32);if("undefined"!==typeof navigator){var h="",q;for(q in navigator)try{"string"==typeof navigator[q]&&(h+=navigator[q])}catch(B){}k.collect(h);h=null}b&&(b().mousemove(function(a){k.collectInt(a.clientX,16);k.collectInt(a.clientY,16)}),b().keypress(function(a){k.collectInt(a.charCode,
370 -8)}))}if(a.random)for(q in k)a.random[q]=k[q];else a.random=k;a.random.createInstance=c}("undefined"!==typeof jQuery?jQuery:null)}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.random)return c.random;c.defined.random=!0;for(var e=0;e<g.length;++e)g[e](c);
371 -return c.random}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/random","require module ./aes ./md ./prng ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,
372 +process.versions.node,p=null;if("undefined"!==typeof window){var q=window.crypto||window.msCrypto;q&&q.getRandomValues&&(p=function(a){return q.getRandomValues(a)})}if(a.disableNativeCode||!h&&!p){k.collectInt(+new Date,32);if("undefined"!==typeof navigator){var h="",r;for(r in navigator)try{"string"==typeof navigator[r]&&(h+=navigator[r])}catch(B){}k.collect(h);h=null}b&&(b().mousemove(function(a){k.collectInt(a.clientX,16);k.collectInt(a.clientY,16)}),b().keypress(function(a){k.collectInt(a.charCode,
373 +8)}))}if(a.random)for(r in k)a.random[r]=k[r];else a.random=k;a.random.createInstance=c}("undefined"!==typeof jQuery?jQuery:null)}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.random)return c.random;c.defined.random=!0;for(var e=0;e<g.length;++e)g[e](c);
374 +return c.random}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/random","require module ./aes ./md ./prng ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,
375 139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,
373 -175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],d=[1,2,3,5];a.rc2=a.rc2||{};a.rc2.expandKey=function(b,d){"string"===typeof b&&(b=a.util.createBuffer(b));d=d||128;var e=b,h=b.length(),l=d,r=Math.ceil(l/8),l=255>>(l&7),w;for(w=h;128>w;w++)e.putByte(c[e.at(w-
374 -1)+e.at(w-h)&255]);e.setAt(128-r,c[e.at(128-r)&l]);for(w=127-r;0<=w;w--)e.setAt(w,c[e.at(w+1)^e.at(w+r)]);return e};var e=function(b,c,g){var e=!1,l=null,r=null,n=null,p,z,q,F,E=[];b=a.rc2.expandKey(b,c);for(q=0;64>q;q++)E.push(b.getInt16Le());g?(p=function(a){for(q=0;4>q;q++){a[q]+=E[F]+(a[(q+3)%4]&a[(q+2)%4])+(~a[(q+3)%4]&a[(q+1)%4]);var b=a[q],c=d[q];a[q]=b<<c&65535|(b&65535)>>16-c;F++}},z=function(a){for(q=0;4>q;q++)a[q]+=E[a[(q+3)%4]&63]}):(p=function(a){for(q=3;0<=q;q--){var b=a[q],c=d[q];a[q]=
375 -(b&65535)>>c|b<<16-c&65535;a[q]-=E[F]+(a[(q+3)%4]&a[(q+2)%4])+(~a[(q+3)%4]&a[(q+1)%4]);F--}},z=function(a){for(q=3;0<=q;q--)a[q]-=E[a[(q+3)%4]&63]});var y=null;return y={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));e=!1;l=a.util.createBuffer();r=c||new a.util.createBuffer;n=b;y.output=r},update:function(a){for(e||l.putBuffer(a);8<=l.length();){a=[[5,p],[1,z],[6,p],[1,z],[5,p]];var b=[];for(q=0;4>q;q++){var c=l.getInt16Le();null!==n&&(g?c^=n.getInt16Le():n.putInt16Le(c));
376 -b.push(c&65535)}F=g?0:63;for(c=0;c<a.length;c++)for(var d=0;d<a[c][0];d++)a[c][1](b);for(q=0;4>q;q++)null!==n&&(g?n.putInt16Le(b[q]):b[q]^=n.getInt16Le()),r.putInt16Le(b[q])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,l,!g);else{var c=8===l.length()?8:8-l.length();l.fillWithByte(c,c)}b&&(e=!0,y.update());!g&&(b=0===l.length())&&(a?b=a(8,r,!g):(a=r.length(),c=r.at(a-1),c>a?b=!1:r.truncate(c)));return b}}};a.rc2.startEncrypting=function(b,c,d){b=a.rc2.createEncryptionCipher(b,128);b.start(c,d);return b};
376 +175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],d=[1,2,3,5];a.rc2=a.rc2||{};a.rc2.expandKey=function(b,d){"string"===typeof b&&(b=a.util.createBuffer(b));d=d||128;var e=b,h=b.length(),l=d,q=Math.ceil(l/8),l=255>>(l&7),w;for(w=h;128>w;w++)e.putByte(c[e.at(w-
377 +1)+e.at(w-h)&255]);e.setAt(128-q,c[e.at(128-q)&l]);for(w=127-q;0<=w;w--)e.setAt(w,c[e.at(w+1)^e.at(w+q)]);return e};var e=function(b,c,g){var e=!1,l=null,q=null,n=null,p,y,r,F,E=[];b=a.rc2.expandKey(b,c);for(r=0;64>r;r++)E.push(b.getInt16Le());g?(p=function(a){for(r=0;4>r;r++){a[r]+=E[F]+(a[(r+3)%4]&a[(r+2)%4])+(~a[(r+3)%4]&a[(r+1)%4]);var b=a[r],c=d[r];a[r]=b<<c&65535|(b&65535)>>16-c;F++}},y=function(a){for(r=0;4>r;r++)a[r]+=E[a[(r+3)%4]&63]}):(p=function(a){for(r=3;0<=r;r--){var b=a[r],c=d[r];a[r]=
378 +(b&65535)>>c|b<<16-c&65535;a[r]-=E[F]+(a[(r+3)%4]&a[(r+2)%4])+(~a[(r+3)%4]&a[(r+1)%4]);F--}},y=function(a){for(r=3;0<=r;r--)a[r]-=E[a[(r+3)%4]&63]});var z=null;return z={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));e=!1;l=a.util.createBuffer();q=c||new a.util.createBuffer;n=b;z.output=q},update:function(a){for(e||l.putBuffer(a);8<=l.length();){a=[[5,p],[1,y],[6,p],[1,y],[5,p]];var b=[];for(r=0;4>r;r++){var c=l.getInt16Le();null!==n&&(g?c^=n.getInt16Le():n.putInt16Le(c));
379 +b.push(c&65535)}F=g?0:63;for(c=0;c<a.length;c++)for(var d=0;d<a[c][0];d++)a[c][1](b);for(r=0;4>r;r++)null!==n&&(g?n.putInt16Le(b[r]):b[r]^=n.getInt16Le()),q.putInt16Le(b[r])}},finish:function(a){var b=!0;if(g)if(a)b=a(8,l,!g);else{var c=8===l.length()?8:8-l.length();l.fillWithByte(c,c)}b&&(e=!0,z.update());!g&&(b=0===l.length())&&(a?b=a(8,q,!g):(a=q.length(),c=q.at(a-1),c>a?b=!1:q.truncate(c)));return b}}};a.rc2.startEncrypting=function(b,c,d){b=a.rc2.createEncryptionCipher(b,128);b.start(c,d);return b};
380 a.rc2.createEncryptionCipher=function(a,b){return e(a,b,!0)};a.rc2.startDecrypting=function(b,c,d){b=a.rc2.createDecryptionCipher(b,128);b.start(c,d);return b};a.rc2.createDecryptionCipher=function(a,b){return e(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
378 -{};if(c.defined.rc2)return c.rc2;c.defined.rc2=!0;for(var e=0;e<g.length;++e)g[e](c);return c.rc2}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rc2",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){this.data=[];null!=a&&("number"==typeof a?
381 +{};if(c.defined.rc2)return c.rc2;c.defined.rc2=!0;for(var e=0;e<g.length;++e)g[e](c);return c.rc2}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rc2",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){this.data=[];null!=a&&("number"==typeof a?
382 this.fromNumber(a,b,d):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))}function d(){return new c(null)}function e(a,b,c,d,g,m){for(;0<=--m;){var h=b*this.data[a++]+c.data[d]+g;g=Math.floor(h/67108864);c.data[d++]=h&67108863}return g}function v(a,b,c,d,g,e){var m=b&32767;for(b>>=15;0<=--e;){var h=this.data[a]&32767,l=this.data[a++]>>15,k=b*h+l*m,h=m*h+((k&32767)<<15)+c.data[d]+(g&1073741823);g=(h>>>30)+(k>>>15)+b*l+(g>>>30);c.data[d++]=h&1073741823}return g}function n(a,b,
380 -c,d,g,e){var m=b&16383;for(b>>=14;0<=--e;){var h=this.data[a]&16383,l=this.data[a++]>>14,k=b*h+l*m,h=m*h+((k&16383)<<14)+c.data[d]+g;g=(h>>28)+(k>>14)+b*l;c.data[d++]=h&268435455}return g}function k(a,b){var c=L[a.charCodeAt(b)];return null==c?-1:c}function h(a){var b=d();b.fromInt(a);return b}function p(a){var b=1,c;0!=(c=a>>>16)&&(a=c,b+=16);0!=(c=a>>8)&&(a=c,b+=8);0!=(c=a>>4)&&(a=c,b+=4);0!=(c=a>>2)&&(a=c,b+=2);0!=a>>1&&(b+=1);return b}function r(a){this.m=a}function q(a){this.m=a;this.mp=a.invDigit();
381 -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t}function B(a,b){return a&b}function z(a,b){return a|b}function I(a,b){return a^b}function F(a,b){return a&~b}function E(){}function y(a){return a}function D(a){this.r2=d();this.q3=d();c.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function A(){return{nextBytes:function(a){for(var b=0;b<a.length;++b)a[b]=Math.floor(256*Math.random())}}}var G;"undefined"===typeof navigator?(c.prototype.am=n,G=28):"Microsoft Internet Explorer"==
382 -navigator.appName?(c.prototype.am=v,G=30):"Netscape"!=navigator.appName?(c.prototype.am=e,G=26):(c.prototype.am=n,G=28);c.prototype.DB=G;c.prototype.DM=(1<<G)-1;c.prototype.DV=1<<G;c.prototype.FV=Math.pow(2,52);c.prototype.F1=52-G;c.prototype.F2=2*G-52;var L=[],u;G=48;for(u=0;9>=u;++u)L[G++]=u;G=97;for(u=10;36>u;++u)L[G++]=u;G=65;for(u=10;36>u;++u)L[G++]=u;r.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};r.prototype.revert=function(a){return a};r.prototype.reduce=
383 -function(a){a.divRemTo(this.m,null,a)};r.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};r.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};q.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0<b.compareTo(c.ZERO)&&this.m.subTo(b,b);return b};q.prototype.revert=function(a){var b=d();a.copyTo(b);this.reduce(b);return b};q.prototype.reduce=function(a){for(;a.t<=this.mt2;)a.data[a.t++]=0;for(var b=0;b<this.m.t;++b){var c=
384 -a.data[b]&32767,d=c*this.mpl+((c*this.mph+(a.data[b]>>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a.data[c]+=this.m.am(0,d,a,b,0,this.m.t);a.data[c]>=a.DV;)a.data[c]-=a.DV,a.data[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};q.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};q.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};c.prototype.copyTo=function(a){for(var b=this.t-1;0<=b;--b)a.data[b]=this.data[b];a.t=this.t;a.s=this.s};
383 +c,d,g,e){var m=b&16383;for(b>>=14;0<=--e;){var h=this.data[a]&16383,l=this.data[a++]>>14,k=b*h+l*m,h=m*h+((k&16383)<<14)+c.data[d]+g;g=(h>>28)+(k>>14)+b*l;c.data[d++]=h&268435455}return g}function k(a,b){var c=L[a.charCodeAt(b)];return null==c?-1:c}function h(a){var b=d();b.fromInt(a);return b}function p(a){var b=1,c;0!=(c=a>>>16)&&(a=c,b+=16);0!=(c=a>>8)&&(a=c,b+=8);0!=(c=a>>4)&&(a=c,b+=4);0!=(c=a>>2)&&(a=c,b+=2);0!=a>>1&&(b+=1);return b}function q(a){this.m=a}function r(a){this.m=a;this.mp=a.invDigit();
384 +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t}function B(a,b){return a&b}function y(a,b){return a|b}function I(a,b){return a^b}function F(a,b){return a&~b}function E(){}function z(a){return a}function D(a){this.r2=d();this.q3=d();c.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function A(){return{nextBytes:function(a){for(var b=0;b<a.length;++b)a[b]=Math.floor(256*Math.random())}}}var G;"undefined"===typeof navigator?(c.prototype.am=n,G=28):"Microsoft Internet Explorer"==
385 +navigator.appName?(c.prototype.am=v,G=30):"Netscape"!=navigator.appName?(c.prototype.am=e,G=26):(c.prototype.am=n,G=28);c.prototype.DB=G;c.prototype.DM=(1<<G)-1;c.prototype.DV=1<<G;c.prototype.FV=Math.pow(2,52);c.prototype.F1=52-G;c.prototype.F2=2*G-52;var L=[],u;G=48;for(u=0;9>=u;++u)L[G++]=u;G=97;for(u=10;36>u;++u)L[G++]=u;G=65;for(u=10;36>u;++u)L[G++]=u;q.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};q.prototype.revert=function(a){return a};q.prototype.reduce=
386 +function(a){a.divRemTo(this.m,null,a)};q.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};q.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};r.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0<b.compareTo(c.ZERO)&&this.m.subTo(b,b);return b};r.prototype.revert=function(a){var b=d();a.copyTo(b);this.reduce(b);return b};r.prototype.reduce=function(a){for(;a.t<=this.mt2;)a.data[a.t++]=0;for(var b=0;b<this.m.t;++b){var c=
387 +a.data[b]&32767,d=c*this.mpl+((c*this.mph+(a.data[b]>>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a.data[c]+=this.m.am(0,d,a,b,0,this.m.t);a.data[c]>=a.DV;)a.data[c]-=a.DV,a.data[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};r.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};r.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};c.prototype.copyTo=function(a){for(var b=this.t-1;0<=b;--b)a.data[b]=this.data[b];a.t=this.t;a.s=this.s};
388 c.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a?this.data[0]=a+this.DV:this.t=0};c.prototype.fromString=function(a,b){var d;if(16==b)d=4;else if(8==b)d=3;else if(256==b)d=8;else if(2==b)d=1;else if(32==b)d=5;else if(4==b)d=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var e=a.length,m=!1,h=0;0<=--e;){var l=8==d?a[e]&255:k(a,e);0>l?"-"==a.charAt(e)&&(m=!0):(m=!1,0==h?this.data[this.t++]=l:h+d>this.DB?(this.data[this.t-1]|=(l&(1<<this.DB-h)-1)<<h,this.data[this.t++]=
389 l>>this.DB-h):this.data[this.t-1]|=l<<h,h+=d,h>=this.DB&&(h-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0<h&&(this.data[this.t-1]|=(1<<this.DB-h)-1<<h));this.clamp();m&&c.ZERO.subTo(this,this)};c.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};c.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b.data[c+a]=this.data[c];for(c=a-1;0<=c;--c)b.data[c]=0;b.t=this.t+a;b.s=this.s};c.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b.data[c-
390 a]=this.data[c];b.t=Math.max(this.t-a,0);b.s=this.s};c.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,g=(1<<d)-1,e=Math.floor(a/this.DB),m=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b.data[h+e+1]=this.data[h]>>d|m,m=(this.data[h]&g)<<c;for(h=e-1;0<=h;--h)b.data[h]=0;b.data[e]=m;b.t=this.t+e+1;b.s=this.s;b.clamp()};c.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,g=this.DB-d,e=(1<<d)-1;b.data[0]=this.data[c]>>d;for(var m=
391 c+1;m<this.t;++m)b.data[m-c-1]|=(this.data[m]&e)<<g,b.data[m-c]=this.data[m]>>d;0<d&&(b.data[this.t-c-1]|=(this.s&e)<<g);b.t=this.t-c;b.clamp()}};c.prototype.subTo=function(a,b){for(var c=0,d=0,g=Math.min(a.t,this.t);c<g;)d+=this.data[c]-a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0<d&&
392 (b.data[c++]=d);b.t=c;b.clamp()};c.prototype.multiplyTo=function(a,b){var d=this.abs(),e=a.abs(),m=d.t;for(b.t=m+e.t;0<=--m;)b.data[m]=0;for(m=0;m<e.t;++m)b.data[m+d.t]=d.am(0,e.data[m],b,m,0,d.t);b.s=0;b.clamp();this.s!=a.s&&c.ZERO.subTo(b,b)};c.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a.data[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b.data[c],a,2*c,0,1);(a.data[c+b.t]+=b.am(c+1,2*b.data[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0<a.t&&(a.data[a.t-
390 -1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,e){var m=a.abs();if(!(0>=m.t)){var h=this.abs();if(h.t<m.t)null!=b&&b.fromInt(0),null!=e&&this.copyTo(e);else{null==e&&(e=d());var l=d(),k=this.s;a=a.s;var y=this.DB-p(m.data[m.t-1]);0<y?(m.lShiftTo(y,l),h.lShiftTo(y,e)):(m.copyTo(l),h.copyTo(e));m=l.t;h=l.data[m-1];if(0!=h){var r=h*(1<<this.F1)+(1<m?l.data[m-2]>>this.F2:0),A=this.FV/r,r=(1<<this.F1)/r,u=1<<this.F2,D=e.t,v=D-m,n=null==b?d():b;l.dlShiftTo(v,n);0<=e.compareTo(n)&&
391 -(e.data[e.t++]=1,e.subTo(n,e));c.ONE.dlShiftTo(m,n);for(n.subTo(l,l);l.t<m;)l.data[l.t++]=0;for(;0<=--v;){var x=e.data[--D]==h?this.DM:Math.floor(e.data[D]*A+(e.data[D-1]+u)*r);if((e.data[D]+=l.am(0,x,e,v,0,m))<x)for(l.dlShiftTo(v,n),e.subTo(n,e);e.data[D]<--x;)e.subTo(n,e)}null!=b&&(e.drShiftTo(m,b),k!=a&&c.ZERO.subTo(b,b));e.t=m;e.clamp();0<y&&e.rShiftTo(y,e);0>k&&c.ZERO.subTo(e,e)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
393 +1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,e){var m=a.abs();if(!(0>=m.t)){var h=this.abs();if(h.t<m.t)null!=b&&b.fromInt(0),null!=e&&this.copyTo(e);else{null==e&&(e=d());var l=d(),k=this.s;a=a.s;var z=this.DB-p(m.data[m.t-1]);0<z?(m.lShiftTo(z,l),h.lShiftTo(z,e)):(m.copyTo(l),h.copyTo(e));m=l.t;h=l.data[m-1];if(0!=h){var q=h*(1<<this.F1)+(1<m?l.data[m-2]>>this.F2:0),A=this.FV/q,q=(1<<this.F1)/q,u=1<<this.F2,D=e.t,v=D-m,n=null==b?d():b;l.dlShiftTo(v,n);0<=e.compareTo(n)&&
394 +(e.data[e.t++]=1,e.subTo(n,e));c.ONE.dlShiftTo(m,n);for(n.subTo(l,l);l.t<m;)l.data[l.t++]=0;for(;0<=--v;){var x=e.data[--D]==h?this.DM:Math.floor(e.data[D]*A+(e.data[D-1]+u)*q);if((e.data[D]+=l.am(0,x,e,v,0,m))<x)for(l.dlShiftTo(v,n),e.subTo(n,e);e.data[D]<--x;)e.subTo(n,e)}null!=b&&(e.drShiftTo(m,b),k!=a&&c.ZERO.subTo(b,b));e.t=m;e.clamp();0<z&&e.rShiftTo(z,e);0>k&&c.ZERO.subTo(e,e)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
395 (a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};c.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};c.prototype.exp=function(a,b){if(4294967295<a||1>a)return c.ONE;var e=d(),m=d(),h=b.convert(this),l=p(a)-1;for(h.copyTo(e);0<=--l;)if(b.sqrTo(e,m),0<(a&1<<l))b.mulTo(m,h,e);else var k=e,e=m,m=k;return b.revert(e)};c.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
393 -4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",g=this.t,m=this.DB-g*this.DB%a;if(0<g--)for(m<this.DB&&0<(c=this.data[g]>>m)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)m<a?(c=(this.data[g]&(1<<m)-1)<<a-m,c|=this.data[--g]>>(m+=this.DB-a)):(c=this.data[g]>>(m-=a)&b,0>=m&&(m+=this.DB,--g)),0<c&&(d=!0),d&&(e+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?e:"0"};c.prototype.negate=function(){var a=
396 +4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,g="",e=this.t,m=this.DB-e*this.DB%a;if(0<e--)for(m<this.DB&&0<(c=this.data[e]>>m)&&(d=!0,g="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=e;)m<a?(c=(this.data[e]&(1<<m)-1)<<a-m,c|=this.data[--e]>>(m+=this.DB-a)):(c=this.data[e]>>(m-=a)&b,0>=m&&(m+=this.DB,--e)),0<c&&(d=!0),d&&(g+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?g:"0"};c.prototype.negate=function(){var a=
397 d();c.ZERO.subTo(this,a);return a};c.prototype.abs=function(){return 0>this.s?this.negate():this};c.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this.data[c]-a.data[c]))return b;return 0};c.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)};c.prototype.mod=function(a){var b=d();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(c.ZERO)&&a.subTo(b,
395 -b);return b};c.prototype.modPowInt=function(a,b){var c;c=256>a||b.isEven()?new r(b):new q(b);return this.exp(a,c)};c.ZERO=h(0);c.ONE=h(1);E.prototype.convert=y;E.prototype.revert=y;E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};E.prototype.sqrTo=function(a,b){a.squareTo(b)};D.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=d();a.copyTo(b);this.reduce(b);return b};D.prototype.revert=function(a){return a};D.prototype.reduce=function(a){a.drShiftTo(this.m.t-
398 +b);return b};c.prototype.modPowInt=function(a,b){var c;c=256>a||b.isEven()?new q(b):new r(b);return this.exp(a,c)};c.ZERO=h(0);c.ONE=h(1);E.prototype.convert=z;E.prototype.revert=z;E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};E.prototype.sqrTo=function(a,b){a.squareTo(b)};D.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=d();a.copyTo(b);this.reduce(b);return b};D.prototype.revert=function(a){return a};D.prototype.reduce=function(a){a.drShiftTo(this.m.t-
399 1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var O=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,
400 113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],R=67108864/O[O.length-1];c.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};c.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a),b=Math.pow(a,
398 -b),c=h(b),g=d(),e=d(),m="";for(this.divRemTo(c,g,e);0<g.signum();)m=(b+e.intValue()).toString(a).substr(1)+m,g.divRemTo(c,g,e);return e.intValue().toString(a)+m};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),e=Math.pow(b,d),m=!1,h=0,l=0,y=0;y<a.length;++y){var r=k(a,y);0>r?"-"==a.charAt(y)&&0==this.signum()&&(m=!0):(l=b*l+r,++h>=d&&(this.dMultiply(e),this.dAddOffset(l,0),l=h=0))}0<h&&(this.dMultiply(Math.pow(b,h)),this.dAddOffset(l,0));m&&c.ZERO.subTo(this,
399 -this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),z,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var e=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<e?d[0]&(1<<e)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,e,g=Math.min(a.t,this.t);for(d=
400 -0;d<g;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){e=a.s&this.DM;for(d=g;d<this.t;++d)c.data[d]=b(this.data[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=g;d<a.t;++d)c.data[d]=b(e,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};c.prototype.changeBit=function(a,b){var d=c.ONE.shiftLeft(a);this.bitwiseTo(d,b,d);return d};c.prototype.addTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=
401 +b),c=h(b),g=d(),e=d(),m="";for(this.divRemTo(c,g,e);0<g.signum();)m=(b+e.intValue()).toString(a).substr(1)+m,g.divRemTo(c,g,e);return e.intValue().toString(a)+m};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),e=Math.pow(b,d),m=!1,h=0,l=0,z=0;z<a.length;++z){var q=k(a,z);0>q?"-"==a.charAt(z)&&0==this.signum()&&(m=!0):(l=b*l+q,++h>=d&&(this.dMultiply(e),this.dAddOffset(l,0),l=h=0))}0<h&&(this.dMultiply(Math.pow(b,h)),this.dAddOffset(l,0));m&&c.ZERO.subTo(this,
402 +this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var e=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<e?d[0]&(1<<e)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,g,e=Math.min(a.t,this.t);for(d=
403 +0;d<e;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){g=a.s&this.DM;for(d=e;d<this.t;++d)c.data[d]=b(this.data[d],g);c.t=this.t}else{g=this.s&this.DM;for(d=e;d<a.t;++d)c.data[d]=b(g,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};c.prototype.changeBit=function(a,b){var d=c.ONE.shiftLeft(a);this.bitwiseTo(d,b,d);return d};c.prototype.addTo=function(a,b){for(var c=0,d=0,g=Math.min(a.t,this.t);c<g;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=
404 this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b.data[c++]=d:-1>d&&(b.data[c++]=this.DV+d);b.t=c;b.clamp()};c.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};c.prototype.dAddOffset=function(a,b){if(0!=a){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=a;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=
402 -0),++this.data[b]}};c.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c.data[--d]=0;var e;for(e=c.t-this.t;d<e;++d)c.data[d+this.t]=this.am(0,a.data[d],c,d,0,this.t);for(e=Math.min(a.t,b);d<e;++d)this.am(0,a.data[d],c,d,0,b-d);c.clamp()};c.prototype.multiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c.data[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c.data[this.t+d-b]=this.am(b-d,a.data[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,
405 +0),++this.data[b]}};c.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c.data[--d]=0;var g;for(g=c.t-this.t;d<g;++d)c.data[d+this.t]=this.am(0,a.data[d],c,d,0,this.t);for(g=Math.min(a.t,b);d<g;++d)this.am(0,a.data[d],c,d,0,b-d);c.clamp()};c.prototype.multiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c.data[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c.data[this.t+d-b]=this.am(b-d,a.data[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,
406 c)};c.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};c.prototype.millerRabin=function(a){var b=this.subtract(c.ONE),d=b.getLowestSetBit();if(0>=d)return!1;for(var e=b.shiftRight(d),m=A(),h,l=0;l<a;++l){do h=new c(this.bitLength(),m);while(0>=h.compareTo(c.ONE)||0<=h.compareTo(b));h=h.modPow(e,this);if(0!=h.compareTo(c.ONE)&&0!=h.compareTo(b)){for(var k=1;k++<d&&0!=
407 h.compareTo(b);)if(h=h.modPowInt(2,this),0==h.compareTo(c.ONE))return!1;if(0!=h.compareTo(b))return!1}}return!0};c.prototype.clone=function(){var a=d();this.copyTo(a);return a};c.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};c.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};c.prototype.shortValue=
405 -function(){return 0==this.t?this.s:this.data[0]<<16>>16};c.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};c.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,e=0;if(0<a--)for(c<this.DB&&(d=this.data[a]>>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this.data[a]&(1<<c)-1)<<8-c,d|=this.data[--a]>>(c+=this.DB-8)):(d=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==e&&
406 -(this.s&128)!=(d&128)&&++e,0<e||d!=this.s)b[e++]=d;return b};c.prototype.equals=function(a){return 0==this.compareTo(a)};c.prototype.min=function(a){return 0>this.compareTo(a)?this:a};c.prototype.max=function(a){return 0<this.compareTo(a)?this:a};c.prototype.and=function(a){var b=d();this.bitwiseTo(a,B,b);return b};c.prototype.or=function(a){var b=d();this.bitwiseTo(a,z,b);return b};c.prototype.xor=function(a){var b=d();this.bitwiseTo(a,I,b);return b};c.prototype.andNot=function(a){var b=d();this.bitwiseTo(a,
408 +function(){return 0==this.t?this.s:this.data[0]<<16>>16};c.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};c.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,g=0;if(0<a--)for(c<this.DB&&(d=this.data[a]>>c)!=(this.s&this.DM)>>c&&(b[g++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this.data[a]&(1<<c)-1)<<8-c,d|=this.data[--a]>>(c+=this.DB-8)):(d=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==g&&
409 +(this.s&128)!=(d&128)&&++g,0<g||d!=this.s)b[g++]=d;return b};c.prototype.equals=function(a){return 0==this.compareTo(a)};c.prototype.min=function(a){return 0>this.compareTo(a)?this:a};c.prototype.max=function(a){return 0<this.compareTo(a)?this:a};c.prototype.and=function(a){var b=d();this.bitwiseTo(a,B,b);return b};c.prototype.or=function(a){var b=d();this.bitwiseTo(a,y,b);return b};c.prototype.xor=function(a){var b=d();this.bitwiseTo(a,I,b);return b};c.prototype.andNot=function(a){var b=d();this.bitwiseTo(a,
410 F,b);return b};c.prototype.not=function(){for(var a=d(),b=0;b<this.t;++b)a.data[b]=this.DM&~this.data[b];a.t=this.t;a.s=~this.s;return a};c.prototype.shiftLeft=function(a){var b=d();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};c.prototype.shiftRight=function(a){var b=d();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};c.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var b=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var c=0;0==(a&65535)&&(a>>=16,c+=16);
408 -0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,e=0;0!=d;)d&=d-1,++e;a+=e}return a};c.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};c.prototype.setBit=function(a){return this.changeBit(a,z)};c.prototype.clearBit=function(a){return this.changeBit(a,
411 +0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,g=0;0!=d;)d&=d-1,++g;a+=g}return a};c.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};c.prototype.setBit=function(a){return this.changeBit(a,y)};c.prototype.clearBit=function(a){return this.changeBit(a,
412 F)};c.prototype.flipBit=function(a){return this.changeBit(a,I)};c.prototype.add=function(a){var b=d();this.addTo(a,b);return b};c.prototype.subtract=function(a){var b=d();this.subTo(a,b);return b};c.prototype.multiply=function(a){var b=d();this.multiplyTo(a,b);return b};c.prototype.divide=function(a){var b=d();this.divRemTo(a,b,null);return b};c.prototype.remainder=function(a){var b=d();this.divRemTo(a,null,b);return b};c.prototype.divideAndRemainder=function(a){var b=d(),c=d();this.divRemTo(a,b,
410 -c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),e,g=h(1),m;if(0>=c)return g;e=18>c?1:48>c?3:144>c?4:768>c?5:6;m=8>c?new r(b):b.isEven()?new D(b):new q(b);var l=[],k=3,y=e-1,A=(1<<e)-1;l[1]=m.convert(this);if(1<e)for(c=d(),m.sqrTo(l[1],c);k<=A;)l[k]=d(),m.mulTo(c,l[k-2],l[k]),k+=2;for(var u=a.t-1,v,n=!0,x=d(),c=p(a.data[u])-1;0<=u;){c>=y?v=a.data[u]>>c-y&A:(v=(a.data[u]&(1<<c+1)-1)<<y-c,0<u&&(v|=a.data[u-1]>>this.DB+c-y));for(k=e;0==(v&1);)v>>=1,--k;0>(c-=k)&&(c+=this.DB,--u);
411 -if(n)l[v].copyTo(g),n=!1;else{for(;1<k;)m.sqrTo(g,x),m.sqrTo(x,g),k-=2;0<k?m.sqrTo(g,x):(k=g,g=x,x=k);m.mulTo(x,l[v],g)}for(;0<=u&&0==(a.data[u]&1<<c);)m.sqrTo(g,x),k=g,g=x,x=k,0>--c&&(c=this.DB-1,--u)}return m.revert(g)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),e=this.clone(),m=h(1),l=h(0),k=h(0),y=h(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(m.isEven()&&l.isEven()||(m.addTo(this,m),l.subTo(a,l)),m.rShiftTo(1,
412 -m)):l.isEven()||l.subTo(a,l),l.rShiftTo(1,l);for(;e.isEven();)e.rShiftTo(1,e),b?(k.isEven()&&y.isEven()||(k.addTo(this,k),y.subTo(a,y)),k.rShiftTo(1,k)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&m.subTo(k,m),l.subTo(y,l)):(e.subTo(d,e),b&&k.subTo(m,k),y.subTo(l,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a,
413 +c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),g,e=h(1),m;if(0>=c)return e;g=18>c?1:48>c?3:144>c?4:768>c?5:6;m=8>c?new q(b):b.isEven()?new D(b):new r(b);var l=[],k=3,z=g-1,A=(1<<g)-1;l[1]=m.convert(this);if(1<g)for(c=d(),m.sqrTo(l[1],c);k<=A;)l[k]=d(),m.mulTo(c,l[k-2],l[k]),k+=2;for(var u=a.t-1,v,n=!0,x=d(),c=p(a.data[u])-1;0<=u;){c>=z?v=a.data[u]>>c-z&A:(v=(a.data[u]&(1<<c+1)-1)<<z-c,0<u&&(v|=a.data[u-1]>>this.DB+c-z));for(k=g;0==(v&1);)v>>=1,--k;0>(c-=k)&&(c+=this.DB,--u);
414 +if(n)l[v].copyTo(e),n=!1;else{for(;1<k;)m.sqrTo(e,x),m.sqrTo(x,e),k-=2;0<k?m.sqrTo(e,x):(k=e,e=x,x=k);m.mulTo(x,l[v],e)}for(;0<=u&&0==(a.data[u]&1<<c);)m.sqrTo(e,x),k=e,e=x,x=k,0>--c&&(c=this.DB-1,--u)}return m.revert(e)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),e=this.clone(),m=h(1),l=h(0),k=h(0),z=h(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(m.isEven()&&l.isEven()||(m.addTo(this,m),l.subTo(a,l)),m.rShiftTo(1,
415 +m)):l.isEven()||l.subTo(a,l),l.rShiftTo(1,l);for(;e.isEven();)e.rShiftTo(1,e),b?(k.isEven()&&z.isEven()||(k.addTo(this,k),z.subTo(a,z)),k.rShiftTo(1,k)):z.isEven()||z.subTo(a,z),z.rShiftTo(1,z);0<=d.compareTo(e)?(d.subTo(e,d),b&&m.subTo(k,m),l.subTo(z,l)):(e.subTo(d,e),b&&k.subTo(m,k),z.subTo(l,z))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=z.compareTo(a))return z.subtract(a);if(0>z.signum())z.addTo(a,z);else return z;return 0>z.signum()?z.add(a):z};c.prototype.pow=function(a){return this.exp(a,
416 new E)};c.prototype.gcd=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b,b=a;a=c}var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};c.prototype.isProbablePrime=
414 -function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=O[O.length-1]){for(b=0;b<O.length;++b)if(c.data[0]==O[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<O.length;){for(var d=O[b],e=b+1;e<O.length&&d<R;)d*=O[e++];for(d=c.modInt(d);b<e;)if(0==d%O[b++])return!1}return c.millerRabin(a)};a.jsbn=a.jsbn||{};a.jsbn.BigInteger=c}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,
415 -p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.jsbn)return c.jsbn;c.defined.jsbn=!0;for(var g=0;g<e.length;++g)e[g](c);return c.jsbn}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/jsbn",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,
416 -0))})})();(function(){function b(a){function c(b,d,e){e||(e=a.md.sha1.create());for(var g="",h=Math.ceil(d/e.digestLength),n=0;n<h;++n){var r=String.fromCharCode(n>>24&255,n>>16&255,n>>8&255,n&255);e.start();e.update(b+r);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,k,h){var n,r,w,p;"string"===typeof e?(n=e,r=k||void 0,w=h||void 0):e&&(n=e.label||void 0,r=e.seed||void 0,w=e.md||void 0,e.mgf1&&e.mgf1.md&&(p=e.mgf1.md));w?w.start():w=a.md.sha1.create();
417 -p||(p=w);b=Math.ceil(b.n.bitLength()/8);e=b-2*w.digestLength-2;if(d.length>e)throw p=Error("RSAES-OAEP input message length is too long."),p.length=d.length,p.maxLength=e,p;n||(n="");w.update(n,"raw");n=w.digest();k="";e-=d.length;for(h=0;h<e;h++)k+="\x00";d=n.getBytes()+k+"\u0001"+d;if(!r)r=a.random.getBytes(w.digestLength);else if(r.length!==w.digestLength)throw p=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),p.seedLength=r.length,p.digestLength=w.digestLength,
418 -p;b=c(r,b-w.digestLength-1,p);d=a.util.xorBytes(d,b,d.length);w=c(d,w.digestLength,p);return"\x00"+a.util.xorBytes(r,w,r.length)+d};d.decode_rsa_oaep=function(b,d,e,k){var h,n,r;"string"===typeof e?(h=e,n=k||void 0):e&&(h=e.label||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(r=e.mgf1.md));e=Math.ceil(b.n.bitLength()/8);if(d.length!==e)throw r=Error("RSAES-OAEP encoded message length is invalid."),r.length=d.length,r.expectedLength=e,r;void 0===n?n=a.md.sha1.create():n.start();r||(r=n);if(e<2*n.digestLength+
419 -2)throw Error("RSAES-OAEP key is too short for the hash function.");h||(h="");n.update(h,"raw");h=n.digest().getBytes();b=d.charAt(0);k=d.substring(1,n.digestLength+1);d=d.substring(1+n.digestLength);var w=c(d,n.digestLength,r);k=a.util.xorBytes(k,w,k.length);r=c(k,e-n.digestLength-1,r);d=a.util.xorBytes(d,r,d.length);e=d.substring(0,n.digestLength);r="\x00"!==b;for(b=0;b<n.digestLength;++b)r|=h.charAt(b)!==e.charAt(b);h=1;for(n=b=n.digestLength;n<d.length;n++)e=d.charCodeAt(n),k=e&1^1,r|=e&(h?65534:
420 -0),h&=k,b+=h;if(r||1!==d.charCodeAt(b))throw Error("Invalid RSAES-OAEP padding.");return d.substring(b+1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs1)return c.pkcs1;c.defined.pkcs1=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pkcs1}},
421 -q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs1",["require","module","./util","./random","./sha1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,g,m){return"workers"in g?e(a,b,g,m):d(a,b,g,m)}function d(b,c,e,g){var h=n(b,c),l=0,k=p(h.bitLength());"millerRabinTests"in
422 -e&&(k=e.millerRabinTests);var r=10;"maxBlockTime"in e&&(r=e.maxBlockTime);var G=+new Date;do{h.bitLength()>b&&(h=n(b,c));if(h.isProbablePrime(k))return g(null,h);h.dAddOffset(q[l++%8],0)}while(0>r||+new Date-G<r);a.util.setImmediate(function(){d(b,c,e,g)})}function e(b,c,g,l){function k(){function a(e){if(!m){--g;var k=e.data;if(k.found){for(e=0;e<d.length;++e)d[e].terminate();m=!0;return l(null,new h(k.prime,16))}y.bitLength()>b&&(y=n(b,c));k=y.toString(16);e.target.postMessage({hex:k,workLoad:A});
423 -y.dAddOffset(p,0)}}r=Math.max(1,r);for(var d=[],e=0;e<r;++e)d[e]=new Worker(x);for(var g=r,e=0;e<r;++e)d[e].addEventListener("message",a);var m=!1}if("undefined"===typeof Worker)return d(b,c,g,l);var y=n(b,c),r=g.workers,A=g.workLoad||100,p=30*A/8,x=g.workerScript||"forge/prime.worker.js";if(-1===r)return a.util.estimateCores(function(a,b){a&&(b=2);r=b-1;k()});k()}function n(a,b){var c=new h(a,b),d=a-1;c.testBit(d)||c.bitwiseTo(h.ONE.shiftLeft(d),C,c);c.dAddOffset(31-c.mod(r).byteValue(),0);return c}
424 -function p(a){return 100>=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!a.prime){var k=a.prime=a.prime||{},h=a.jsbn.BigInteger,q=[6,4,2,4,2,4,6,2],r=new h(null);r.fromInt(30);var C=function(a,b){return a|b};k.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var h=d.algorithm||"PRIMEINC";"string"===typeof h&&(h={name:h});h.options=h.options||{};var l=d.prng||a.random;d={nextBytes:function(a){for(var b=l.getBytesSync(a.length),
417 +function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=O[O.length-1]){for(b=0;b<O.length;++b)if(c.data[0]==O[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<O.length;){for(var d=O[b],g=b+1;g<O.length&&d<R;)d*=O[g++];for(d=c.modInt(d);b<g;)if(0==d%O[b++])return!1}return c.millerRabin(a)};a.jsbn=a.jsbn||{};a.jsbn.BigInteger=c}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,
418 +p=function(a,c){c.exports=function(c){var g=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.jsbn)return c.jsbn;c.defined.jsbn=!0;for(var e=0;e<g.length;++e)g[e](c);return c.jsbn}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/jsbn",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,
419 +0))})})();(function(){function b(a){function c(b,d,e){e||(e=a.md.sha1.create());for(var g="",h=Math.ceil(d/e.digestLength),n=0;n<h;++n){var q=String.fromCharCode(n>>24&255,n>>16&255,n>>8&255,n&255);e.start();e.update(b+q);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,k,h){var n,q,w,p;"string"===typeof e?(n=e,q=k||void 0,w=h||void 0):e&&(n=e.label||void 0,q=e.seed||void 0,w=e.md||void 0,e.mgf1&&e.mgf1.md&&(p=e.mgf1.md));w?w.start():w=a.md.sha1.create();
420 +p||(p=w);b=Math.ceil(b.n.bitLength()/8);e=b-2*w.digestLength-2;if(d.length>e)throw p=Error("RSAES-OAEP input message length is too long."),p.length=d.length,p.maxLength=e,p;n||(n="");w.update(n,"raw");n=w.digest();k="";e-=d.length;for(h=0;h<e;h++)k+="\x00";d=n.getBytes()+k+"\u0001"+d;if(!q)q=a.random.getBytes(w.digestLength);else if(q.length!==w.digestLength)throw p=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),p.seedLength=q.length,p.digestLength=w.digestLength,
421 +p;b=c(q,b-w.digestLength-1,p);d=a.util.xorBytes(d,b,d.length);w=c(d,w.digestLength,p);return"\x00"+a.util.xorBytes(q,w,q.length)+d};d.decode_rsa_oaep=function(b,d,e,k){var h,n,q;"string"===typeof e?(h=e,n=k||void 0):e&&(h=e.label||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(q=e.mgf1.md));e=Math.ceil(b.n.bitLength()/8);if(d.length!==e)throw q=Error("RSAES-OAEP encoded message length is invalid."),q.length=d.length,q.expectedLength=e,q;void 0===n?n=a.md.sha1.create():n.start();q||(q=n);if(e<2*n.digestLength+
422 +2)throw Error("RSAES-OAEP key is too short for the hash function.");h||(h="");n.update(h,"raw");h=n.digest().getBytes();b=d.charAt(0);k=d.substring(1,n.digestLength+1);d=d.substring(1+n.digestLength);var w=c(d,n.digestLength,q);k=a.util.xorBytes(k,w,k.length);q=c(k,e-n.digestLength-1,q);d=a.util.xorBytes(d,q,d.length);e=d.substring(0,n.digestLength);q="\x00"!==b;for(b=0;b<n.digestLength;++b)q|=h.charAt(b)!==e.charAt(b);h=1;for(n=b=n.digestLength;n<d.length;n++)e=d.charCodeAt(n),k=e&1^1,q|=e&(h?65534:
423 +0),h&=k,b+=h;if(q||1!==d.charCodeAt(b))throw Error("Invalid RSAES-OAEP padding.");return d.substring(b+1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs1)return c.pkcs1;c.defined.pkcs1=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pkcs1}},
424 +r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs1",["require","module","./util","./random","./sha1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,g,m){return"workers"in g?e(a,b,g,m):d(a,b,g,m)}function d(b,c,e,g){var h=n(b,c),l=0,k=p(h.bitLength());"millerRabinTests"in
425 +e&&(k=e.millerRabinTests);var q=10;"maxBlockTime"in e&&(q=e.maxBlockTime);var G=+new Date;do{h.bitLength()>b&&(h=n(b,c));if(h.isProbablePrime(k))return g(null,h);h.dAddOffset(r[l++%8],0)}while(0>q||+new Date-G<q);a.util.setImmediate(function(){d(b,c,e,g)})}function e(b,c,g,l){function k(){function a(e){if(!m){--g;var k=e.data;if(k.found){for(e=0;e<d.length;++e)d[e].terminate();m=!0;return l(null,new h(k.prime,16))}z.bitLength()>b&&(z=n(b,c));k=z.toString(16);e.target.postMessage({hex:k,workLoad:A});
426 +z.dAddOffset(p,0)}}q=Math.max(1,q);for(var d=[],e=0;e<q;++e)d[e]=new Worker(x);for(var g=q,e=0;e<q;++e)d[e].addEventListener("message",a);var m=!1}if("undefined"===typeof Worker)return d(b,c,g,l);var z=n(b,c),q=g.workers,A=g.workLoad||100,p=30*A/8,x=g.workerScript||"forge/prime.worker.js";if(-1===q)return a.util.estimateCores(function(a,b){a&&(b=2);q=b-1;k()});k()}function n(a,b){var c=new h(a,b),d=a-1;c.testBit(d)||c.bitwiseTo(h.ONE.shiftLeft(d),C,c);c.dAddOffset(31-c.mod(q).byteValue(),0);return c}
427 +function p(a){return 100>=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!a.prime){var k=a.prime=a.prime||{},h=a.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],q=new h(null);q.fromInt(30);var C=function(a,b){return a|b};k.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var h=d.algorithm||"PRIMEINC";"string"===typeof h&&(h={name:h});h.options=h.options||{};var l=d.prng||a.random;d={nextBytes:function(a){for(var b=l.getBytesSync(a.length),
428 c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};if("PRIMEINC"===h.name)return c(b,d,h.options,e);throw Error("Invalid prime generation algorithm: "+h.name);}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prime)return c.prime;c.defined.prime=!0;for(var g=
426 -0;g<e.length;++g)e[g](c);return c.prime}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prime",["require","module","./util","./jsbn","./random"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d,e){var g=a.util.createBuffer();d=Math.ceil(d.n.bitLength()/8);if(b.length>d-11)throw g=
429 +0;g<e.length;++g)e[g](c);return c.prime}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prime",["require","module","./util","./jsbn","./random"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d,e){var g=a.util.createBuffer();d=Math.ceil(d.n.bitLength()/8);if(b.length>d-11)throw g=
430 Error("Message is too long for PKCS#1 v1.5 padding."),g.length=b.length,g.max=d-11,g;g.putByte(0);g.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var h=0;h<d;++h)g.putByte(e)}else for(;0<d;){for(var l=0,k=a.random.getBytes(d),h=0;h<d;++h)e=k.charCodeAt(h),0===e?++l:g.putByte(e);d=l}g.putByte(0);g.putBytes(b);return g}function d(b,c,e,g){c=Math.ceil(c.n.bitLength()/8);b=a.util.createBuffer(b);var h=b.getByte(),l=b.getByte();if(0!==h||e&&0!==l&&1!==l||!e&&2!=l||e&&0===l&&"undefined"===
431 typeof g)throw Error("Encryption block is invalid.");e=0;if(0===l)for(e=c-3-g,g=0;g<e;++g){if(0!==b.getByte())throw Error("Encryption block is invalid.");}else if(1===l)for(e=0;1<b.length();){if(255!==b.getByte()){--b.read;break}++e}else if(2===l)for(e=0;1<b.length();){if(0===b.getByte()){--b.read;break}++e}if(0!==b.getByte()||e!==c-3-b.length())throw Error("Encryption block is invalid.");return b.getBytes()}function e(b,c,d){function g(){h(b.pBits,function(a,c){if(a)return d(a);b.p=c;if(null!==b.q)return l(a,
429 -b.q);h(b.qBits,l)})}function h(b,c){a.prime.generateProbablePrime(b,r,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var e=b.p;b.p=b.q;b.q=e}0!==b.p.subtract(k.ONE).gcd(b.e).compareTo(k.ONE)?(b.p=null,g()):0!==b.q.subtract(k.ONE).gcd(b.e).compareTo(k.ONE)?(b.q=null,h(b.qBits,l)):(b.p1=b.p.subtract(k.ONE),b.q1=b.q.subtract(k.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(k.ONE)?(b.p=b.q=null,g()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,h(b.qBits,l)):
430 -(e=b.e.modInverse(b.phi),b.keys={privateKey:q.rsa.setPrivateKey(b.n,b.e,e,b.p,b.q,e.mod(b.p1),e.mod(b.q1),b.q.modInverse(b.p)),publicKey:q.rsa.setPublicKey(b.n,b.e)},d(null,b.keys))))}"function"===typeof c&&(d=c,c={});c=c||{};var r={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(r.prng=c.prng);g()}function n(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function p(a){return 100>=a?27:
431 -150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if("undefined"===typeof k)var k=a.jsbn.BigInteger;var h=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var q=a.pki,r=[6,4,2,4,2,4,6,2],C={name:"PrivateKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:h.Class.UNIVERSAL,
432 +b.q);h(b.qBits,l)})}function h(b,c){a.prime.generateProbablePrime(b,q,c)}function l(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var e=b.p;b.p=b.q;b.q=e}0!==b.p.subtract(k.ONE).gcd(b.e).compareTo(k.ONE)?(b.p=null,g()):0!==b.q.subtract(k.ONE).gcd(b.e).compareTo(k.ONE)?(b.q=null,h(b.qBits,l)):(b.p1=b.p.subtract(k.ONE),b.q1=b.q.subtract(k.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(k.ONE)?(b.p=b.q=null,g()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,h(b.qBits,l)):
433 +(e=b.e.modInverse(b.phi),b.keys={privateKey:r.rsa.setPrivateKey(b.n,b.e,e,b.p,b.q,e.mod(b.p1),e.mod(b.q1),b.q.modInverse(b.p)),publicKey:r.rsa.setPublicKey(b.n,b.e)},d(null,b.keys))))}"function"===typeof c&&(d=c,c={});c=c||{};var q={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(q.prng=c.prng);g()}function n(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function p(a){return 100>=a?27:
434 +150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if("undefined"===typeof k)var k=a.jsbn.BigInteger;var h=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var r=a.pki,q=[6,4,2,4,2,4,6,2],C={name:"PrivateKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:h.Class.UNIVERSAL,
435 type:h.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},B={name:"RSAPrivateKey",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",
436 tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",
434 -tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},z={name:"RSAPublicKey",tagClass:h.Class.UNIVERSAL,
437 +tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},y={name:"RSAPublicKey",tagClass:h.Class.UNIVERSAL,
438 type:h.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},I=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,
436 -type:h.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},F=function(a){var b;if(a.algorithm in q.oids)b=q.oids[a.algorithm];
439 +type:h.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},F=function(a){var b;if(a.algorithm in r.oids)b=r.oids[a.algorithm];
440 else throw b=Error("Unknown message digest algorithm."),b.algorithm=a.algorithm,b;var c=h.oidToDer(b).getBytes();b=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);var d=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);d.value.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,c));d.value.push(h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,""));a=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return h.toDer(b).getBytes()},E=function(b,c,d){if(d)return b.modPow(c.e,
441 c.n);if(!c.p||!c.q)return b.modPow(c.d,c.n);c.dP||(c.dP=c.d.mod(c.p.subtract(k.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(k.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new k(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(k.ONE));b=b.multiply(d.modPow(c.e,c.n)).mod(c.n);var e=b.mod(c.p).modPow(c.dP,c.p);for(b=b.mod(c.q).modPow(c.dQ,c.q);0>e.compareTo(b);)e=e.add(c.p);b=e.subtract(b).multiply(c.qInv).mod(c.p).multiply(c.q).add(b);return b=
439 -b.multiply(d.modInverse(c.n)).mod(c.n)};q.rsa.encrypt=function(b,d,e){var h=e,l=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(h=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new k(e.toHex(),16);d=E(b,d,h).toString(16);h=a.util.createBuffer();for(l-=Math.ceil(d.length/2);0<l;)h.putByte(0),--l;h.putBytes(a.util.hexToBytes(d));return h.getBytes()};q.rsa.decrypt=function(b,c,e,g){var h=Math.ceil(c.n.bitLength()/8);if(b.length!==h)throw c=Error("Encrypted message length is invalid."),c.length=
440 -b.length,c.expected=h,c;b=new k(a.util.createBuffer(b).toHex(),16);if(0<=b.compareTo(c.n))throw Error("Encrypted message is invalid.");b=E(b,c,e).toString(16);for(var l=a.util.createBuffer(),h=h-Math.ceil(b.length/2);0<h;)l.putByte(0),--h;l.putBytes(a.util.hexToBytes(b));return!1!==g?d(l.getBytes(),c,e):l.getBytes()};q.rsa.createKeyPairGenerationState=function(b,c,d){"string"===typeof b&&(b=parseInt(b,10));b=b||2048;d=d||{};var e=d.prng||a.random,g={nextBytes:function(a){for(var b=e.getBytesSync(a.length),
441 -c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};d=d.algorithm||"PRIMEINC";if("PRIMEINC"===d)b={algorithm:d,state:0,bits:b,rng:g,eInt:c||65537,e:new k(null),p:null,q:null,qBits:b>>1,pBits:b-(b>>1),pqState:0,num:null,keys:null},b.e.fromInt(b.eInt);else throw Error("Invalid key generation algorithm: "+d);return b};q.rsa.stepKeyPairGenerationState=function(a,b){"algorithm"in a||(a.algorithm="PRIMEINC");var c=new k(null);c.fromInt(30);for(var d=0,e=function(a,b){return a|b},g=+new Date,m,h=0;null===a.keys&&
442 -(0>=b||h<b);){if(0===a.state){m=null===a.p?a.pBits:a.qBits;var l=m-1;0===a.pqState?(a.num=new k(m,a.rng),a.num.testBit(l)||a.num.bitwiseTo(k.ONE.shiftLeft(l),e,a.num),a.num.dAddOffset(31-a.num.mod(c).byteValue(),0),d=0,++a.pqState):1===a.pqState?a.num.bitLength()>m?a.pqState=0:a.num.isProbablePrime(p(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(r[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(k.ONE).gcd(a.e).compareTo(k.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,
443 -null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(k.ONE),a.q1=a.q.subtract(k.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(k.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(m=a.e.modInverse(a.phi),a.keys={privateKey:q.rsa.setPrivateKey(a.n,a.e,m,a.p,a.q,
444 -m.mod(a.p1),m.mod(a.q1),a.q.modInverse(a.p)),publicKey:q.rsa.setPublicKey(a.n,a.e)});m=+new Date;h+=m-g;g=m}return null!==a.keys};q.rsa.generateKeyPair=function(a,b,c,d){1===arguments.length?"object"===typeof a?(c=a,a=void 0):"function"===typeof a&&(d=a,a=void 0):2===arguments.length?"number"===typeof a?"function"===typeof b?(d=b,b=void 0):"number"!==typeof b&&(c=b,b=void 0):(c=a,d=b,b=a=void 0):3===arguments.length&&("number"===typeof b?"function"===typeof c&&(d=c,c=void 0):(d=c,c=b,b=void 0));c=
445 -c||{};void 0===a&&(a=c.bits||2048);void 0===b&&(b=c.e||65537);var g=q.rsa.createKeyPairGenerationState(a,b,c);if(!d)return q.rsa.stepKeyPairGenerationState(g,0),g.keys;e(g,c,d)};q.setRsaPublicKey=q.rsa.setPublicKey=function(b,e){var l={n:b,e:e,encrypt:function(b,d,e){"string"===typeof d?d=d.toUpperCase():void 0===d&&(d="RSAES-PKCS1-V1_5");if("RSAES-PKCS1-V1_5"===d)d={encode:function(a,b,d){return c(a,b,2).getBytes()}};else if("RSA-OAEP"===d||"RSAES-OAEP"===d)d={encode:function(b,c){return a.pkcs1.encode_rsa_oaep(c,
446 -b,e)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(d))d={encode:function(a){return a}};else if("string"===typeof d)throw Error('Unsupported encryption scheme: "'+d+'".');b=d.encode(b,l,!0);return q.rsa.encrypt(b,l,!0)},verify:function(a,b,c){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===c)c={verify:function(a,b){b=d(b,l,!0);var c=h.fromDer(b);return a===c.value[1].value}};else if("NONE"===c||"NULL"===c||null===c)c={verify:function(a,b){b=d(b,
447 -l,!0);return a===b}};b=q.rsa.decrypt(b,l,!0,!1);return c.verify(a,b,l.n.bitLength())}};return l};q.setRsaPrivateKey=q.rsa.setPrivateKey=function(b,c,e,g,h,l,k,r){var n={n:b,e:c,d:e,p:g,q:h,dP:l,dQ:k,qInv:r,decrypt:function(b,c,e){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=q.rsa.decrypt(b,n,!1,!1);if("RSAES-PKCS1-V1_5"===c)c={decode:d};else if("RSA-OAEP"===c||"RSAES-OAEP"===c)c={decode:function(b,c){return a.pkcs1.decode_rsa_oaep(c,b,e)}};else if(-1!==["RAW","NONE",
448 -"NULL",null].indexOf(c))c={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+c+'".');return c.decode(b,n,!1)},sign:function(a,b){var c=!1;"string"===typeof b&&(b=b.toUpperCase());if(void 0===b||"RSASSA-PKCS1-V1_5"===b)b={encode:F},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,n.n.bitLength());return q.rsa.encrypt(d,n,c)}};return n};q.wrapRsaPrivateKey=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,
449 -[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(0).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(q.oids.rsaEncryption).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,h.toDer(a).getBytes())])};q.privateKeyFromAsn1=function(b){var c={},d=[];h.validate(b,C,c,d)&&(b=h.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!h.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
450 -c.errors=d,c;var e,g,l,r,n,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();r=a.util.createBuffer(c.privateKeyExponent1).toHex();n=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return q.setRsaPrivateKey(new k(d,16),new k(b,
451 -16),new k(e,16),new k(g,16),new k(l,16),new k(r,16),new k(n,16),new k(c,16))};q.privateKeyToAsn1=q.privateKeyToRSAPrivateKey=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(0).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.n)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.e)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.d)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.p)),h.create(h.Class.UNIVERSAL,
452 -h.Type.INTEGER,!1,n(a.q)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.dP)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.dQ)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.qInv))])};q.publicKeyFromAsn1=function(b){var c={},d=[];if(h.validate(b,I,c,d)){d=h.derToOid(c.publicKeyOid);if(d!==q.oids.rsaEncryption)throw c=Error("Cannot read public key. Unknown OID."),c.oid=d,c;b=c.rsaPublicKey}d=[];if(!h.validate(b,z,c,d))throw c=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
453 -c.errors=d,c;d=a.util.createBuffer(c.publicKeyModulus).toHex();c=a.util.createBuffer(c.publicKeyExponent).toHex();return q.setRsaPublicKey(new k(d,16),new k(c,16))};q.publicKeyToAsn1=q.publicKeyToSubjectPublicKeyInfo=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(q.oids.rsaEncryption).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,
454 -!1,[q.publicKeyToRSAPublicKey(a)])])};q.publicKeyToRSAPublicKey=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.n)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||
455 -{};c.defined=c.defined||{};if(c.defined.rsa)return c.rsa;c.defined.rsa=!0;for(var g=0;g<e.length;++g)e[g](c);return c.rsa}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rsa","require module ./asn1 ./jsbn ./oids ./pkcs1 ./prime ./random ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,
442 +b.multiply(d.modInverse(c.n)).mod(c.n)};r.rsa.encrypt=function(b,d,e){var h=e,l=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(h=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new k(e.toHex(),16);d=E(b,d,h).toString(16);h=a.util.createBuffer();for(l-=Math.ceil(d.length/2);0<l;)h.putByte(0),--l;h.putBytes(a.util.hexToBytes(d));return h.getBytes()};r.rsa.decrypt=function(b,c,e,g){var h=Math.ceil(c.n.bitLength()/8);if(b.length!==h)throw c=Error("Encrypted message length is invalid."),c.length=
443 +b.length,c.expected=h,c;b=new k(a.util.createBuffer(b).toHex(),16);if(0<=b.compareTo(c.n))throw Error("Encrypted message is invalid.");b=E(b,c,e).toString(16);for(var l=a.util.createBuffer(),h=h-Math.ceil(b.length/2);0<h;)l.putByte(0),--h;l.putBytes(a.util.hexToBytes(b));return!1!==g?d(l.getBytes(),c,e):l.getBytes()};r.rsa.createKeyPairGenerationState=function(b,c,d){"string"===typeof b&&(b=parseInt(b,10));b=b||2048;d=d||{};var e=d.prng||a.random,g={nextBytes:function(a){for(var b=e.getBytesSync(a.length),
444 +c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};d=d.algorithm||"PRIMEINC";if("PRIMEINC"===d)b={algorithm:d,state:0,bits:b,rng:g,eInt:c||65537,e:new k(null),p:null,q:null,qBits:b>>1,pBits:b-(b>>1),pqState:0,num:null,keys:null},b.e.fromInt(b.eInt);else throw Error("Invalid key generation algorithm: "+d);return b};r.rsa.stepKeyPairGenerationState=function(a,b){"algorithm"in a||(a.algorithm="PRIMEINC");var c=new k(null);c.fromInt(30);for(var d=0,e=function(a,b){return a|b},g=+new Date,m,h=0;null===a.keys&&
445 +(0>=b||h<b);){if(0===a.state){m=null===a.p?a.pBits:a.qBits;var l=m-1;0===a.pqState?(a.num=new k(m,a.rng),a.num.testBit(l)||a.num.bitwiseTo(k.ONE.shiftLeft(l),e,a.num),a.num.dAddOffset(31-a.num.mod(c).byteValue(),0),d=0,++a.pqState):1===a.pqState?a.num.bitLength()>m?a.pqState=0:a.num.isProbablePrime(p(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(q[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(k.ONE).gcd(a.e).compareTo(k.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,
446 +null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(k.ONE),a.q1=a.q.subtract(k.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(k.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(m=a.e.modInverse(a.phi),a.keys={privateKey:r.rsa.setPrivateKey(a.n,a.e,m,a.p,a.q,
447 +m.mod(a.p1),m.mod(a.q1),a.q.modInverse(a.p)),publicKey:r.rsa.setPublicKey(a.n,a.e)});m=+new Date;h+=m-g;g=m}return null!==a.keys};r.rsa.generateKeyPair=function(a,b,c,d){1===arguments.length?"object"===typeof a?(c=a,a=void 0):"function"===typeof a&&(d=a,a=void 0):2===arguments.length?"number"===typeof a?"function"===typeof b?(d=b,b=void 0):"number"!==typeof b&&(c=b,b=void 0):(c=a,d=b,b=a=void 0):3===arguments.length&&("number"===typeof b?"function"===typeof c&&(d=c,c=void 0):(d=c,c=b,b=void 0));c=
448 +c||{};void 0===a&&(a=c.bits||2048);void 0===b&&(b=c.e||65537);var g=r.rsa.createKeyPairGenerationState(a,b,c);if(!d)return r.rsa.stepKeyPairGenerationState(g,0),g.keys;e(g,c,d)};r.setRsaPublicKey=r.rsa.setPublicKey=function(b,e){var l={n:b,e:e,encrypt:function(b,d,e){"string"===typeof d?d=d.toUpperCase():void 0===d&&(d="RSAES-PKCS1-V1_5");if("RSAES-PKCS1-V1_5"===d)d={encode:function(a,b,d){return c(a,b,2).getBytes()}};else if("RSA-OAEP"===d||"RSAES-OAEP"===d)d={encode:function(b,c){return a.pkcs1.encode_rsa_oaep(c,
449 +b,e)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(d))d={encode:function(a){return a}};else if("string"===typeof d)throw Error('Unsupported encryption scheme: "'+d+'".');b=d.encode(b,l,!0);return r.rsa.encrypt(b,l,!0)},verify:function(a,b,c){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===c)c={verify:function(a,b){b=d(b,l,!0);var c=h.fromDer(b);return a===c.value[1].value}};else if("NONE"===c||"NULL"===c||null===c)c={verify:function(a,b){b=d(b,
450 +l,!0);return a===b}};b=r.rsa.decrypt(b,l,!0,!1);return c.verify(a,b,l.n.bitLength())}};return l};r.setRsaPrivateKey=r.rsa.setPrivateKey=function(b,c,e,g,h,l,k,q){var n={n:b,e:c,d:e,p:g,q:h,dP:l,dQ:k,qInv:q,decrypt:function(b,c,e){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=r.rsa.decrypt(b,n,!1,!1);if("RSAES-PKCS1-V1_5"===c)c={decode:d};else if("RSA-OAEP"===c||"RSAES-OAEP"===c)c={decode:function(b,c){return a.pkcs1.decode_rsa_oaep(c,b,e)}};else if(-1!==["RAW","NONE",
451 +"NULL",null].indexOf(c))c={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+c+'".');return c.decode(b,n,!1)},sign:function(a,b){var c=!1;"string"===typeof b&&(b=b.toUpperCase());if(void 0===b||"RSASSA-PKCS1-V1_5"===b)b={encode:F},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,n.n.bitLength());return r.rsa.encrypt(d,n,c)}};return n};r.wrapRsaPrivateKey=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,
452 +[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(0).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(r.oids.rsaEncryption).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,h.toDer(a).getBytes())])};r.privateKeyFromAsn1=function(b){var c={},d=[];h.validate(b,C,c,d)&&(b=h.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!h.validate(b,B,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
453 +c.errors=d,c;var e,g,l,q,n,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();g=a.util.createBuffer(c.privateKeyPrime1).toHex();l=a.util.createBuffer(c.privateKeyPrime2).toHex();q=a.util.createBuffer(c.privateKeyExponent1).toHex();n=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return r.setRsaPrivateKey(new k(d,16),new k(b,
454 +16),new k(e,16),new k(g,16),new k(l,16),new k(q,16),new k(n,16),new k(c,16))};r.privateKeyToAsn1=r.privateKeyToRSAPrivateKey=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(0).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.n)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.e)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.d)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.p)),h.create(h.Class.UNIVERSAL,
455 +h.Type.INTEGER,!1,n(a.q)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.dP)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.dQ)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.qInv))])};r.publicKeyFromAsn1=function(b){var c={},d=[];if(h.validate(b,I,c,d)){d=h.derToOid(c.publicKeyOid);if(d!==r.oids.rsaEncryption)throw c=Error("Cannot read public key. Unknown OID."),c.oid=d,c;b=c.rsaPublicKey}d=[];if(!h.validate(b,y,c,d))throw c=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
456 +c.errors=d,c;d=a.util.createBuffer(c.publicKeyModulus).toHex();c=a.util.createBuffer(c.publicKeyExponent).toHex();return r.setRsaPublicKey(new k(d,16),new k(c,16))};r.publicKeyToAsn1=r.publicKeyToSubjectPublicKeyInfo=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(r.oids.rsaEncryption).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,
457 +!1,[r.publicKeyToRSAPublicKey(a)])])};r.publicKeyToRSAPublicKey=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.n)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,n(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||
458 +{};c.defined=c.defined||{};if(c.defined.rsa)return c.rsa;c.defined.rsa=!0;for(var g=0;g<e.length;++g)e[g](c);return c.rsa}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rsa","require module ./asn1 ./jsbn ./oids ./pkcs1 ./prime ./random ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,
459 b){return a.start().update(b).digest().getBytes()}if("undefined"===typeof d)var d=a.jsbn.BigInteger;var e=a.asn1,n=a.pki=a.pki||{};n.pbe=a.pbe=a.pbe||{};var p=n.oids,k={name:"EncryptedPrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encryptionOid"},
460 {name:"AlgorithmIdentifier.parameters",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},h={name:"PBES2Algorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",
461 tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,onstructed:!0,capture:"kdfIterationCount"}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:e.Class.UNIVERSAL,
459 -type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},q={name:"pkcs-12PbeParams",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"salt"},
460 -{name:"pkcs-12PbeParams.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"iterations"}]};n.encryptPrivateKeyInfo=function(b,c,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||"aes128";var g=a.random.getBytesSync(d.saltSize),h=d.count,k=e.integerToDer(h),w;if(0===d.algorithm.indexOf("aes")||"des"===d.algorithm){var y,D;switch(d.algorithm){case "aes128":y=w=16;d=p["aes128-CBC"];D=a.aes.createEncryptionCipher;break;case "aes192":w=24;
461 -y=16;d=p["aes192-CBC"];D=a.aes.createEncryptionCipher;break;case "aes256":w=32;y=16;d=p["aes256-CBC"];D=a.aes.createEncryptionCipher;break;case "des":y=w=8;d=p.desCBC;D=a.des.createEncryptionCipher;break;default:throw g=Error("Cannot encrypt private key. Unknown encryption algorithm."),g.algorithm=d.algorithm,g;}var A=a.pkcs5.pbkdf2(c,g,h,w);c=a.random.getBytesSync(y);h=D(A);h.start(c);h.update(e.toDer(b));h.finish();b=h.output.getBytes();g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,
462 +type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},r={name:"pkcs-12PbeParams",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"salt"},
463 +{name:"pkcs-12PbeParams.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"iterations"}]};n.encryptPrivateKeyInfo=function(b,c,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||"aes128";var g=a.random.getBytesSync(d.saltSize),h=d.count,k=e.integerToDer(h),w;if(0===d.algorithm.indexOf("aes")||"des"===d.algorithm){var z,D;switch(d.algorithm){case "aes128":z=w=16;d=p["aes128-CBC"];D=a.aes.createEncryptionCipher;break;case "aes192":w=24;
464 +z=16;d=p["aes192-CBC"];D=a.aes.createEncryptionCipher;break;case "aes256":w=32;z=16;d=p["aes256-CBC"];D=a.aes.createEncryptionCipher;break;case "des":z=w=8;d=p.desCBC;D=a.des.createEncryptionCipher;break;default:throw g=Error("Cannot encrypt private key. Unknown encryption algorithm."),g.algorithm=d.algorithm,g;}var A=a.pkcs5.pbkdf2(c,g,h,w);c=a.random.getBytesSync(z);h=D(A);h.start(c);h.update(e.toDer(b));h.finish();b=h.output.getBytes();g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,
465 e.Type.OID,!1,e.oidToDer(p.pkcs5PBES2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(p.pkcs5PBKDF2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,g),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,k.getBytes())])]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d).getBytes()),e.create(e.Class.UNIVERSAL,
466 e.Type.OCTETSTRING,!1,c)])])])}else if("3des"===d.algorithm)w=24,d=new a.util.ByteBuffer(g),A=n.pbe.generatePkcs12Key(c,d,1,h,w),c=n.pbe.generatePkcs12Key(c,d,2,h,w),h=a.des.createEncryptionCipher(A),h.start(c),h.update(e.toDer(b)),h.finish(),b=h.output.getBytes(),g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(p["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,
467 !1,g),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,k.getBytes())])]);else throw g=Error("Cannot encrypt private key. Unknown encryption algorithm."),g.algorithm=d.algorithm,g;return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[g,e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,b)])};n.decryptPrivateKeyInfo=function(b,c){var d=null,g={},h=[];if(!e.validate(b,k,g,h))throw d=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=h,d;h=e.derToOid(g.encryptionOid);
@@ -469,14 +472,14 @@ g.substr(0,8),h);c=k(c);c.start(g);c.update(e.toDer(n.privateKeyToAsn1(b)));c.fi
472 d.headerType=d,d;if(g.procType&&"ENCRYPTED"===g.procType.type){var h,k;switch(g.dekInfo.algorithm){case "DES-CBC":h=8;k=a.des.createDecryptionCipher;break;case "DES-EDE3-CBC":h=24;k=a.des.createDecryptionCipher;break;case "AES-128-CBC":h=16;k=a.aes.createDecryptionCipher;break;case "AES-192-CBC":h=24;k=a.aes.createDecryptionCipher;break;case "AES-256-CBC":h=32;k=a.aes.createDecryptionCipher;break;case "RC2-40-CBC":h=5;k=function(b){return a.rc2.createDecryptionCipher(b,40)};break;case "RC2-64-CBC":h=
473 8;k=function(b){return a.rc2.createDecryptionCipher(b,64)};break;case "RC2-128-CBC":h=16;k=function(b){return a.rc2.createDecryptionCipher(b,128)};break;default:throw d=Error('Could not decrypt private key; unsupported encryption algorithm "'+g.dekInfo.algorithm+'".'),d.algorithm=g.dekInfo.algorithm,d;}var w=a.util.hexToBytes(g.dekInfo.parameters);h=a.pbe.opensslDeriveBytes(c,w.substr(0,8),h);k=k(h);k.start(w);k.update(a.util.createBuffer(g.body));if(k.finish())d=k.output.getBytes();else return d}else d=
474 g.body;d="ENCRYPTED PRIVATE KEY"===g.type?n.decryptPrivateKeyInfo(e.fromDer(d),c):e.fromDer(d);null!==d&&(d=n.privateKeyFromAsn1(d));return d};n.pbe.generatePkcs12Key=function(b,c,d,e,g,h){var k,l;if("undefined"===typeof h||null===h)h=a.md.sha1.create();var n=h.digestLength,A=h.blockLength,w=new a.util.ByteBuffer,p=new a.util.ByteBuffer;if(null!==b&&void 0!==b){for(l=0;l<b.length;l++)p.putInt16(b.charCodeAt(l));p.putInt16(0)}b=p.length();var u=c.length(),v=new a.util.ByteBuffer;v.fillWithByte(d,A);
472 -var x=A*Math.ceil(u/A);d=new a.util.ByteBuffer;for(l=0;l<x;l++)d.putByte(c.at(l%u));x=A*Math.ceil(b/A);c=new a.util.ByteBuffer;for(l=0;l<x;l++)c.putByte(p.at(l%b));p=d;p.putBuffer(c);c=Math.ceil(g/n);for(d=1;d<=c;d++){x=new a.util.ByteBuffer;x.putBytes(v.bytes());x.putBytes(p.bytes());for(l=0;l<e;l++)h.start(),h.update(x.getBytes()),x=h.digest();var q=new a.util.ByteBuffer;for(l=0;l<A;l++)q.putByte(x.at(l%n));var K=Math.ceil(u/A)+Math.ceil(b/A),N=new a.util.ByteBuffer;for(k=0;k<K;k++){var X=new a.util.ByteBuffer(p.getBytes(A)),
473 -T=511;for(l=q.length()-1;0<=l;l--)T>>=8,T+=q.at(l)+X.at(l),X.setAt(l,T&255);N.putBuffer(X)}p=N;w.putBuffer(x)}w.truncate(w.length()-g);return w};n.pbe.getCipher=function(a,b,c){switch(a){case n.oids.pkcs5PBES2:return n.pbe.getCipherForPBES2(a,b,c);case n.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case n.oids["pbewithSHAAnd40BitRC2-CBC"]:return n.pbe.getCipherForPKCS12PBE(a,b,c);default:throw b=Error("Cannot read encrypted PBE data block. Unsupported OID."),b.oid=a,b.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC",
475 +var x=A*Math.ceil(u/A);d=new a.util.ByteBuffer;for(l=0;l<x;l++)d.putByte(c.at(l%u));x=A*Math.ceil(b/A);c=new a.util.ByteBuffer;for(l=0;l<x;l++)c.putByte(p.at(l%b));p=d;p.putBuffer(c);c=Math.ceil(g/n);for(d=1;d<=c;d++){x=new a.util.ByteBuffer;x.putBytes(v.bytes());x.putBytes(p.bytes());for(l=0;l<e;l++)h.start(),h.update(x.getBytes()),x=h.digest();var r=new a.util.ByteBuffer;for(l=0;l<A;l++)r.putByte(x.at(l%n));var K=Math.ceil(u/A)+Math.ceil(b/A),N=new a.util.ByteBuffer;for(k=0;k<K;k++){var X=new a.util.ByteBuffer(p.getBytes(A)),
476 +T=511;for(l=r.length()-1;0<=l;l--)T>>=8,T+=r.at(l)+X.at(l),X.setAt(l,T&255);N.putBuffer(X)}p=N;w.putBuffer(x)}w.truncate(w.length()-g);return w};n.pbe.getCipher=function(a,b,c){switch(a){case n.oids.pkcs5PBES2:return n.pbe.getCipherForPBES2(a,b,c);case n.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case n.oids["pbewithSHAAnd40BitRC2-CBC"]:return n.pbe.getCipherForPKCS12PBE(a,b,c);default:throw b=Error("Cannot read encrypted PBE data block. Unsupported OID."),b.oid=a,b.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC",
477 "pbewithSHAAnd40BitRC2-CBC"],b;}};n.pbe.getCipherForPBES2=function(b,c,d){var g={};b=[];if(!e.validate(c,h,g,b)){var k=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");k.errors=b;throw k;}b=e.derToOid(g.kdfOid);if(b!==n.oids.pkcs5PBKDF2)throw k=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),k.oid=b,k.supportedOids=["pkcs5PBKDF2"],k;b=e.derToOid(g.encOid);if(b!==n.oids["aes128-CBC"]&&
478 b!==n.oids["aes192-CBC"]&&b!==n.oids["aes256-CBC"]&&b!==n.oids["des-EDE3-CBC"]&&b!==n.oids.desCBC)throw k=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),k.oid=b,k.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],k;c=g.kdfSalt;var w=a.util.createBuffer(g.kdfIterationCount),w=w.getInt(w.length()<<3),p;switch(n.oids[b]){case "aes128-CBC":p=16;k=a.aes.createDecryptionCipher;break;case "aes192-CBC":p=24;k=a.aes.createDecryptionCipher;break;
476 -case "aes256-CBC":p=32;k=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":p=24;k=a.des.createDecryptionCipher;break;case "desCBC":p=8,k=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,w,p);g=g.encIv;k=k(b);k.start(g);return k};n.pbe.getCipherForPKCS12PBE=function(b,c,d){var g={},h=[];if(!e.validate(c,q,g,h))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=h,d;var h=a.util.createBuffer(g.salt),g=a.util.createBuffer(g.iterations),
479 +case "aes256-CBC":p=32;k=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":p=24;k=a.des.createDecryptionCipher;break;case "desCBC":p=8,k=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,w,p);g=g.encIv;k=k(b);k.start(g);return k};n.pbe.getCipherForPKCS12PBE=function(b,c,d){var g={},h=[];if(!e.validate(c,r,g,h))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=h,d;var h=a.util.createBuffer(g.salt),g=a.util.createBuffer(g.iterations),
480 g=g.getInt(g.length()<<3),k;switch(b){case n.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:k=24;c=8;b=a.des.startDecrypting;break;case n.oids["pbewithSHAAnd40BitRC2-CBC"]:k=5;c=8;b=function(b,c){var d=a.rc2.createDecryptionCipher(b,40);d.start(c,null);return d};break;default:throw d=Error("Cannot read PKCS #12 PBE data block. Unsupported OID."),d.oid=b,d;}k=n.pbe.generatePkcs12Key(d,h,1,g,k);d=n.pbe.generatePkcs12Key(d,h,2,g,c);return b(k,d)};n.pbe.opensslDeriveBytes=function(b,d,e,h){if("undefined"===
481 typeof h||null===h)h=a.md.md5.create();null===d&&(d="");for(var k=[c(h,b+d)],l=16,n=1;l<e;++n,l+=16)k.push(c(h,k[n-1]+b+d));return k.join("").substr(0,e)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbe)return c.pbe;c.defined.pbe=!0;for(var g=
479 -0;g<e.length;++g)e[g](c);return c.pbe}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbe","require module ./aes ./asn1 ./des ./md ./oids ./pem ./pbkdf2 ./random ./rc2 ./rsa ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=
482 +0;g<e.length;++g)e[g](c);return c.pbe}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbe","require module ./aes ./asn1 ./des ./md ./oids ./pem ./pbkdf2 ./random ./rc2 ./rsa ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=
483 a.pkcs7||{};a.pkcs7.asn1=d;a={name:"ContentInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};d.contentInfoValidator=a;var e={name:"EncryptedContentInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",
484 tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",
485 tagClass:c.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};d.envelopedDataValidator={name:"EnvelopedData",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:c.Class.UNIVERSAL,type:c.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(e)};d.encryptedDataValidator={name:"EncryptedData",
@@ -487,28 +490,28 @@ value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,t
490 constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:c.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]}]}]};d.recipientInfoValidator={name:"RecipientInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,
491 constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,
492 value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
490 -typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7asn1)return c.pkcs7asn1;c.defined.pkcs7asn1=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pkcs7asn1}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs7asn1",
493 +typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7asn1)return c.pkcs7asn1;c.defined.pkcs7asn1=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pkcs7asn1}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs7asn1",
494 ["require","module","./asn1","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};(a.mgf.mgf1=a.mgf1=a.mgf1||{}).create=function(b){return{generate:function(c,d){for(var e=new a.util.ByteBuffer,n=Math.ceil(d/b.digestLength),k=0;k<n;k++){var h=new a.util.ByteBuffer;h.putInt32(k);b.start();b.update(c+h.getBytes());e.putBuffer(b.digest())}e.truncate(e.length()-d);return e.getBytes()}}}}if("function"!==typeof a)if("object"===typeof module&&
492 -module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.mgf1)return c.mgf1;c.defined.mgf1=!0;for(var g=0;g<e.length;++g)e[g](c);return c.mgf1}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,
495 +module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.mgf1)return c.mgf1;c.defined.mgf1=!0;for(var g=0;g<e.length;++g)e[g](c);return c.mgf1}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,
496 Array.prototype.slice.call(arguments,0))};a("js/mgf1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};a.mgf.mgf1=a.mgf1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
494 -{};if(c.defined.mgf)return c.mgf;c.defined.mgf=!0;for(var g=0;g<e.length;++g)e[g](c);return c.mgf}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/mgf",["require","module","./mgf1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.pss=a.pss||{}).create=function(b){3===arguments.length&&
495 -(b={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var c=b.md,d=b.mgf,e=c.digestLength,n=b.salt||null;"string"===typeof n&&(n=a.util.createBuffer(n));var k;if("saltLength"in b)k=b.saltLength;else if(null!==n)k=n.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==n&&n.length()!==k)throw Error("Given salt length does not match length of given salt.");var h=b.prng||a.random;return{encode:function(b,g){var p,q=g-1,z=Math.ceil(q/8),I=b.digest().getBytes();
496 -if(z<e+k+2)throw Error("Message is too long to encrypt.");var F;F=null===n?h.getBytesSync(k):n.bytes();p=new a.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(I);p.putBytes(F);c.start();c.update(p.getBytes());I=c.digest().getBytes();p=new a.util.ByteBuffer;p.fillWithByte(0,z-k-e-2);p.putByte(1);p.putBytes(F);var E=p.getBytes(),y=z-e-1,D=d.generate(I,y);F="";for(p=0;p<y;p++)F+=String.fromCharCode(E.charCodeAt(p)^D.charCodeAt(p));q=65280>>8*z-q&255;F=String.fromCharCode(F.charCodeAt(0)&~q)+F.substr(1);
497 -return F+I+String.fromCharCode(188)},verify:function(b,g,h){var n;n=h-1;h=Math.ceil(n/8);g=g.substr(-h);if(h<e+k+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==g.charCodeAt(h-1))throw Error("Encoded message does not end in 0xBC.");var p=h-e-1,x=g.substr(0,p);g=g.substr(p,e);var q=65280>>8*h-n&255;if(0!==(x.charCodeAt(0)&q))throw Error("Bits beyond keysize not zero as expected.");var E=d.generate(g,p),y="";for(n=0;n<p;n++)y+=String.fromCharCode(x.charCodeAt(n)^E.charCodeAt(n));
498 -y=String.fromCharCode(y.charCodeAt(0)&~q)+y.substr(1);h=h-e-k-2;for(n=0;n<h;n++)if(0!==y.charCodeAt(n))throw Error("Leftmost octets not zero as expected");if(1!==y.charCodeAt(h))throw Error("Inconsistent PSS signature, 0x01 marker not found");h=y.substr(-k);p=new a.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(b);p.putBytes(h);c.start();c.update(p.getBytes());b=c.digest().getBytes();return g===b}}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,
499 -module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pss)return c.pss;c.defined.pss=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pss}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pss",
497 +{};if(c.defined.mgf)return c.mgf;c.defined.mgf=!0;for(var g=0;g<e.length;++g)e[g](c);return c.mgf}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/mgf",["require","module","./mgf1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.pss=a.pss||{}).create=function(b){3===arguments.length&&
498 +(b={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var c=b.md,d=b.mgf,e=c.digestLength,n=b.salt||null;"string"===typeof n&&(n=a.util.createBuffer(n));var k;if("saltLength"in b)k=b.saltLength;else if(null!==n)k=n.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==n&&n.length()!==k)throw Error("Given salt length does not match length of given salt.");var h=b.prng||a.random;return{encode:function(b,g){var p,r=g-1,y=Math.ceil(r/8),I=b.digest().getBytes();
499 +if(y<e+k+2)throw Error("Message is too long to encrypt.");var F;F=null===n?h.getBytesSync(k):n.bytes();p=new a.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(I);p.putBytes(F);c.start();c.update(p.getBytes());I=c.digest().getBytes();p=new a.util.ByteBuffer;p.fillWithByte(0,y-k-e-2);p.putByte(1);p.putBytes(F);var E=p.getBytes(),z=y-e-1,D=d.generate(I,z);F="";for(p=0;p<z;p++)F+=String.fromCharCode(E.charCodeAt(p)^D.charCodeAt(p));r=65280>>8*y-r&255;F=String.fromCharCode(F.charCodeAt(0)&~r)+F.substr(1);
500 +return F+I+String.fromCharCode(188)},verify:function(b,g,h){var n;n=h-1;h=Math.ceil(n/8);g=g.substr(-h);if(h<e+k+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==g.charCodeAt(h-1))throw Error("Encoded message does not end in 0xBC.");var p=h-e-1,x=g.substr(0,p);g=g.substr(p,e);var r=65280>>8*h-n&255;if(0!==(x.charCodeAt(0)&r))throw Error("Bits beyond keysize not zero as expected.");var E=d.generate(g,p),z="";for(n=0;n<p;n++)z+=String.fromCharCode(x.charCodeAt(n)^E.charCodeAt(n));
501 +z=String.fromCharCode(z.charCodeAt(0)&~r)+z.substr(1);h=h-e-k-2;for(n=0;n<h;n++)if(0!==z.charCodeAt(n))throw Error("Leftmost octets not zero as expected");if(1!==z.charCodeAt(h))throw Error("Inconsistent PSS signature, 0x01 marker not found");h=z.substr(-k);p=new a.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(b);p.putBytes(h);c.start();c.update(p.getBytes());b=c.digest().getBytes();return g===b}}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,
502 +module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pss)return c.pss;c.defined.pss=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pss}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pss",
503 ["require","module","./random","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b){"string"===typeof b&&(b={shortName:b});for(var d=null,e,g=0;null===d&&g<a.attributes.length;++g)e=a.attributes[g],b.type&&b.type===e.type?d=e:b.name&&b.name===e.name?d=e:b.shortName&&b.shortName===e.shortName&&(d=e);return d}function d(b){var c=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),e;b=b.attributes;for(var g=0;g<b.length;++g){e=b[g];
501 -var k=e.value,l=h.Type.PRINTABLESTRING;"valueTagClass"in e&&(l=e.valueTagClass,l===h.Type.UTF8&&(k=a.util.encodeUtf8(k)));e=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.UNIVERSAL,l,!1,k)])]);c.value.push(e)}return c}function e(a){for(var b,c=0;c<a.length;++c){b=a[c];"undefined"===typeof b.name&&(b.type&&b.type in q.oids?b.name=q.oids[b.type]:b.shortName&&b.shortName in
502 -C&&(b.name=q.oids[C[b.shortName]]));if("undefined"===typeof b.type)if(b.name&&b.name in q.oids)b.type=q.oids[b.name];else throw a=Error("Attribute type not specified."),a.attribute=b,a;"undefined"===typeof b.shortName&&b.name&&b.name in C&&(b.shortName=C[b.name]);if(b.type===r.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=h.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var d=0;d<b.extensions.length;++d)b.value.push(q.certificateExtensionToAsn1(n(b.extensions[d])))}if("undefined"===
503 -typeof b.value)throw a=Error("Attribute value not specified."),a.attribute=b,a;}}function n(b,c){c=c||{};"undefined"===typeof b.name&&b.id&&b.id in q.oids&&(b.name=q.oids[b.id]);if("undefined"===typeof b.id)if(b.name&&b.name in q.oids)b.id=q.oids[b.name];else{var d=Error("Extension ID not specified.");d.extension=b;throw d;}if("undefined"!==typeof b.value)return b;if("keyUsage"===b.name){var e=d=0,g=0;b.digitalSignature&&(e|=128,d=7);b.nonRepudiation&&(e|=64,d=6);b.keyEncipherment&&(e|=32,d=5);b.dataEncipherment&&
504 +var k=e.value,l=h.Type.PRINTABLESTRING;"valueTagClass"in e&&(l=e.valueTagClass,l===h.Type.UTF8&&(k=a.util.encodeUtf8(k)));e=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.UNIVERSAL,l,!1,k)])]);c.value.push(e)}return c}function e(a){for(var b,c=0;c<a.length;++c){b=a[c];"undefined"===typeof b.name&&(b.type&&b.type in r.oids?b.name=r.oids[b.type]:b.shortName&&b.shortName in
505 +C&&(b.name=r.oids[C[b.shortName]]));if("undefined"===typeof b.type)if(b.name&&b.name in r.oids)b.type=r.oids[b.name];else throw a=Error("Attribute type not specified."),a.attribute=b,a;"undefined"===typeof b.shortName&&b.name&&b.name in C&&(b.shortName=C[b.name]);if(b.type===q.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=h.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var d=0;d<b.extensions.length;++d)b.value.push(r.certificateExtensionToAsn1(n(b.extensions[d])))}if("undefined"===
506 +typeof b.value)throw a=Error("Attribute value not specified."),a.attribute=b,a;}}function n(b,c){c=c||{};"undefined"===typeof b.name&&b.id&&b.id in r.oids&&(b.name=r.oids[b.id]);if("undefined"===typeof b.id)if(b.name&&b.name in r.oids)b.id=r.oids[b.name];else{var d=Error("Extension ID not specified.");d.extension=b;throw d;}if("undefined"!==typeof b.value)return b;if("keyUsage"===b.name){var e=d=0,g=0;b.digitalSignature&&(e|=128,d=7);b.nonRepudiation&&(e|=64,d=6);b.keyEncipherment&&(e|=32,d=5);b.dataEncipherment&&
507 (e|=16,d=4);b.keyAgreement&&(e|=8,d=3);b.keyCertSign&&(e|=4,d=2);b.cRLSign&&(e|=2,d=1);b.encipherOnly&&(e|=1,d=0);b.decipherOnly&&(g|=128,d=7);d=String.fromCharCode(d);0!==g?d+=String.fromCharCode(e)+String.fromCharCode(g):0!==e&&(d+=String.fromCharCode(e));b.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,d)}else if("basicConstraints"===b.name)b.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),b.cA&&b.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,String.fromCharCode(255))),
505 -"pathLenConstraint"in b&&b.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(b.pathLenConstraint).getBytes()));else if("extKeyUsage"===b.name)for(e in b.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),d=b.value.value,b)!0===b[e]&&(e in r?d.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(r[e]).getBytes())):-1!==e.indexOf(".")&&d.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e).getBytes())));else if("nsCertType"===b.name)e=d=0,b.client&&(e|=128,
508 +"pathLenConstraint"in b&&b.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(b.pathLenConstraint).getBytes()));else if("extKeyUsage"===b.name)for(e in b.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),d=b.value.value,b)!0===b[e]&&(e in q?d.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(q[e]).getBytes())):-1!==e.indexOf(".")&&d.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e).getBytes())));else if("nsCertType"===b.name)e=d=0,b.client&&(e|=128,
509 d=7),b.server&&(e|=64,d=6),b.email&&(e|=32,d=5),b.objsign&&(e|=16,d=4),b.reserved&&(e|=8,d=3),b.sslCA&&(e|=4,d=2),b.emailCA&&(e|=2,d=1),b.objCA&&(e|=1,d=0),d=String.fromCharCode(d),0!==e&&(d+=String.fromCharCode(e)),b.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,d);else if("subjectAltName"===b.name||"issuerAltName"===b.name)for(b.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),g=0;g<b.altNames.length;++g){e=b.altNames[g];d=e.value;if(7===e.type&&e.ip){if(d=a.util.bytesFromIP(e.ip),
510 null===d)throw d=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.'),d.extension=b,d;}else 8===e.type&&(d=e.oid?h.oidToDer(h.oidToDer(e.oid)):h.oidToDer(d));b.value.value.push(h.create(h.Class.CONTEXT_SPECIFIC,e.type,!1,d))}else"subjectKeyIdentifier"===b.name&&c.cert&&(d=c.cert.generateSubjectKeyIdentifier(),b.subjectKeyIdentifier=d.toHex(),b.value=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,d.getBytes()));if("undefined"===typeof b.value)throw d=Error("Extension value not specified."),
508 -d.extension=b,d;return b}function p(a,b){switch(a){case r["RSASSA-PSS"]:var c=[];void 0!==b.hash.algorithmOid&&c.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(b.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])]));void 0!==b.mgf.algorithmOid&&c.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,
511 +d.extension=b,d;return b}function p(a,b){switch(a){case q["RSASSA-PSS"]:var c=[];void 0!==b.hash.algorithmOid&&c.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(b.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])]));void 0!==b.mgf.algorithmOid&&c.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,
512 !1,h.oidToDer(b.mgf.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(b.mgf.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])])]));void 0!==b.saltLength&&c.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(b.saltLength).getBytes())]));return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,c);default:return h.create(h.Class.UNIVERSAL,h.Type.NULL,
513 !1,"")}}function k(b){var c=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===b.attributes.length)return c;b=b.attributes;for(var d=0;d<b.length;++d){var e=b[d],g=e.value,k=h.Type.UTF8;"valueTagClass"in e&&(k=e.valueTagClass);k===h.Type.UTF8&&(g=a.util.encodeUtf8(g));var l=!1;"valueConstructed"in e&&(l=e.valueConstructed);e=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,
511 -k,l,g)])]);c.value.push(e)}return c}var h=a.asn1,q=a.pki=a.pki||{},r=q.oids,C={};C.CN=r.commonName;C.commonName="CN";C.C=r.countryName;C.countryName="C";C.L=r.localityName;C.localityName="L";C.ST=r.stateOrProvinceName;C.stateOrProvinceName="ST";C.O=r.organizationName;C.organizationName="O";C.OU=r.organizationalUnitName;C.organizationalUnitName="OU";C.E=r.emailAddress;C.emailAddress="E";var B=a.pki.rsa.publicKeyValidator,z={name:"Certificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,
514 +k,l,g)])]);c.value.push(e)}return c}var h=a.asn1,r=a.pki=a.pki||{},q=r.oids,C={};C.CN=q.commonName;C.commonName="CN";C.C=q.countryName;C.countryName="C";C.L=q.localityName;C.localityName="L";C.ST=q.stateOrProvinceName;C.stateOrProvinceName="ST";C.O=q.organizationName;C.organizationName="O";C.OU=q.organizationalUnitName;C.organizationalUnitName="OU";C.E=q.emailAddress;C.emailAddress="E";var B=a.pki.rsa.publicKeyValidator,y={name:"Certificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,
515 value:[{name:"Certificate.TBSCertificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,
516 capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,
517 constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:h.Class.UNIVERSAL,type:h.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:h.Class.UNIVERSAL,type:h.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},
@@ -521,82 +524,82 @@ type:h.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.Algori
524 tagClass:h.Class.UNIVERSAL,type:h.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},F={name:"CertificationRequest",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",
525 tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},B,{name:"CertificationRequestInfo.attributes",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
526 tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:h.Class.UNIVERSAL,
524 -type:h.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};q.RDNAttributesAsArray=function(a,b){for(var c=[],d,e,g,m=0;m<a.value.length;++m){d=a.value[m];for(var k=0;k<d.value.length;++k)g={},e=d.value[k],g.type=h.derToOid(e.value[0].value),g.value=e.value[1].value,g.valueTagClass=e.value[1].type,g.type in r&&(g.name=r[g.type],g.name in C&&(g.shortName=C[g.name])),b&&(b.update(g.type),b.update(g.value)),c.push(g)}return c};q.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=
525 -a[c],e=h.derToOid(d.value[0].value),d=d.value[1].value,g=0;g<d.length;++g){var m={};m.type=e;m.value=d[g].value;m.valueTagClass=d[g].type;m.type in r&&(m.name=r[m.type],m.name in C&&(m.shortName=C[m.name]));if(m.type===r.extensionRequest){m.extensions=[];for(var k=0;k<m.value.length;++k)m.extensions.push(q.certificateExtensionFromAsn1(m.value[k]))}b.push(m)}return b};var E=function(a,b,c){var d={};if(a!==r["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:r.sha1},mgf:{algorithmOid:r.mgf1,hash:{algorithmOid:r.sha1}},
526 -saltLength:20});c={};a=[];if(!h.validate(b,I,c,a))throw b=Error("Cannot read RSASSA-PSS parameter block."),b.errors=a,b;void 0!==c.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=h.derToOid(c.hashOid));void 0!==c.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=h.derToOid(c.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=h.derToOid(c.maskGenHashOid));void 0!==c.saltLength&&(d.saltLength=c.saltLength.charCodeAt(0));return d};q.certificateFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE"!==
527 -b.type&&"X509 CERTIFICATE"!==b.type&&"TRUSTED CERTIFICATE"!==b.type)throw c=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");d=h.fromDer(b.body,d);return q.certificateFromAsn1(d,c)};q.certificateToPem=function(b,c){var d={type:"CERTIFICATE",body:h.toDer(q.certificateToAsn1(b)).getBytes()};
528 -return a.pem.encode(d,{maxline:c})};q.publicKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PUBLIC KEY"!==b.type&&"RSA PUBLIC KEY"!==b.type){var c=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");b=h.fromDer(b.body);return q.publicKeyFromAsn1(b)};q.publicKeyToPem=function(b,c){var d={type:"PUBLIC KEY",
529 -body:h.toDer(q.publicKeyToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};q.publicKeyToRSAPublicKeyPem=function(b,c){var d={type:"RSA PUBLIC KEY",body:h.toDer(q.publicKeyToRSAPublicKey(b)).getBytes()};return a.pem.encode(d,{maxline:c})};q.getPublicKeyFingerprint=function(b,c){c=c||{};var d=c.md||a.md.sha1.create(),e;switch(c.type||"RSAPublicKey"){case "RSAPublicKey":e=h.toDer(q.publicKeyToRSAPublicKey(b)).getBytes();break;case "SubjectPublicKeyInfo":e=h.toDer(q.publicKeyToAsn1(b)).getBytes();
530 -break;default:throw Error('Unknown fingerprint type "'+c.type+'".');}d.start();d.update(e);d=d.digest();if("hex"===c.encoding)return d=d.toHex(),c.delimiter?d.match(/.{2}/g).join(c.delimiter):d;if("binary"===c.encoding)return d.getBytes();if(c.encoding)throw Error('Unknown encoding "'+c.encoding+'".');return d};q.certificationRequestFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE REQUEST"!==b.type)throw c=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".'),
531 -c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");d=h.fromDer(b.body,d);return q.certificationRequestFromAsn1(d,c)};q.certificationRequestToPem=function(b,c){var d={type:"CERTIFICATE REQUEST",body:h.toDer(q.certificationRequestToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};q.createCertificate=function(){var b={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=
527 +type:h.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};r.RDNAttributesAsArray=function(a,b){for(var c=[],d,e,g,m=0;m<a.value.length;++m){d=a.value[m];for(var k=0;k<d.value.length;++k)g={},e=d.value[k],g.type=h.derToOid(e.value[0].value),g.value=e.value[1].value,g.valueTagClass=e.value[1].type,g.type in q&&(g.name=q[g.type],g.name in C&&(g.shortName=C[g.name])),b&&(b.update(g.type),b.update(g.value)),c.push(g)}return c};r.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=
528 +a[c],e=h.derToOid(d.value[0].value),d=d.value[1].value,g=0;g<d.length;++g){var m={};m.type=e;m.value=d[g].value;m.valueTagClass=d[g].type;m.type in q&&(m.name=q[m.type],m.name in C&&(m.shortName=C[m.name]));if(m.type===q.extensionRequest){m.extensions=[];for(var k=0;k<m.value.length;++k)m.extensions.push(r.certificateExtensionFromAsn1(m.value[k]))}b.push(m)}return b};var E=function(a,b,c){var d={};if(a!==q["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:q.sha1},mgf:{algorithmOid:q.mgf1,hash:{algorithmOid:q.sha1}},
529 +saltLength:20});c={};a=[];if(!h.validate(b,I,c,a))throw b=Error("Cannot read RSASSA-PSS parameter block."),b.errors=a,b;void 0!==c.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=h.derToOid(c.hashOid));void 0!==c.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=h.derToOid(c.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=h.derToOid(c.maskGenHashOid));void 0!==c.saltLength&&(d.saltLength=c.saltLength.charCodeAt(0));return d};r.certificateFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE"!==
530 +b.type&&"X509 CERTIFICATE"!==b.type&&"TRUSTED CERTIFICATE"!==b.type)throw c=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");d=h.fromDer(b.body,d);return r.certificateFromAsn1(d,c)};r.certificateToPem=function(b,c){var d={type:"CERTIFICATE",body:h.toDer(r.certificateToAsn1(b)).getBytes()};
531 +return a.pem.encode(d,{maxline:c})};r.publicKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PUBLIC KEY"!==b.type&&"RSA PUBLIC KEY"!==b.type){var c=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");b=h.fromDer(b.body);return r.publicKeyFromAsn1(b)};r.publicKeyToPem=function(b,c){var d={type:"PUBLIC KEY",
532 +body:h.toDer(r.publicKeyToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};r.publicKeyToRSAPublicKeyPem=function(b,c){var d={type:"RSA PUBLIC KEY",body:h.toDer(r.publicKeyToRSAPublicKey(b)).getBytes()};return a.pem.encode(d,{maxline:c})};r.getPublicKeyFingerprint=function(b,c){c=c||{};var d=c.md||a.md.sha1.create(),e;switch(c.type||"RSAPublicKey"){case "RSAPublicKey":e=h.toDer(r.publicKeyToRSAPublicKey(b)).getBytes();break;case "SubjectPublicKeyInfo":e=h.toDer(r.publicKeyToAsn1(b)).getBytes();
533 +break;default:throw Error('Unknown fingerprint type "'+c.type+'".');}d.start();d.update(e);d=d.digest();if("hex"===c.encoding)return d=d.toHex(),c.delimiter?d.match(/.{2}/g).join(c.delimiter):d;if("binary"===c.encoding)return d.getBytes();if(c.encoding)throw Error('Unknown encoding "'+c.encoding+'".');return d};r.certificationRequestFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE REQUEST"!==b.type)throw c=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".'),
534 +c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");d=h.fromDer(b.body,d);return r.certificationRequestFromAsn1(d,c)};r.certificationRequestToPem=function(b,c){var d={type:"CERTIFICATE REQUEST",body:h.toDer(r.certificationRequestToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};r.createCertificate=function(){var b={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=
535 null;b.validity={};b.validity.notBefore=new Date;b.validity.notAfter=new Date;b.issuer={};b.issuer.getField=function(a){return c(b.issuer,a)};b.issuer.addField=function(a){e([a]);b.issuer.attributes.push(a)};b.issuer.attributes=[];b.issuer.hash=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){e([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.extensions=[];b.publicKey=null;b.md=null;b.setSubject=function(a,c){e(a);
536 b.subject.attributes=a;delete b.subject.uniqueId;c&&(b.subject.uniqueId=c);b.subject.hash=null};b.setIssuer=function(a,c){e(a);b.issuer.attributes=a;delete b.issuer.uniqueId;c&&(b.issuer.uniqueId=c);b.issuer.hash=null};b.setExtensions=function(a){for(var c=0;c<a.length;++c)n(a[c],{cert:b});b.extensions=a};b.getExtension=function(a){"string"===typeof a&&(a={name:a});for(var c=null,d,e=0;null===c&&e<b.extensions.length;++e)d=b.extensions[e],a.id&&d.id===a.id?c=d:a.name&&d.name===a.name&&(c=d);return c};
534 -b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=r[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certificate digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=e;b.tbsCertificate=q.getTBSCertificate(b);e=h.toDer(b.tbsCertificate);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(c){var d=!1;if(!b.issued(c)){var d=b.subject,e=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");
535 -e.expectedIssuer=c.issuer.attributes;e.actualIssuer=d.attributes;throw e;}e=c.md;if(null===e){if(c.signatureOid in r)switch(r[c.signatureOid]){case "sha1WithRSAEncryption":e=a.md.sha1.create();break;case "md5WithRSAEncryption":e=a.md.md5.create();break;case "sha256WithRSAEncryption":e=a.md.sha256.create();break;case "sha512WithRSAEncryption":e=a.md.sha512.create();break;case "RSASSA-PSS":e=a.md.sha256.create()}if(null===e)throw e=Error("Could not compute certificate digest. Unknown signature OID."),
536 -e.signatureOid=c.signatureOid,e;var g=c.tbsCertificate||q.getTBSCertificate(c),g=h.toDer(g);e.update(g.getBytes())}if(null!==e){var k;switch(c.signatureOid){case r.sha1WithRSAEncryption:k=void 0;break;case r["RSASSA-PSS"]:d=r[c.signatureParameters.mgf.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw e=Error("Unsupported MGF hash function."),e.oid=c.signatureParameters.mgf.hash.algorithmOid,e.name=d,e;k=r[c.signatureParameters.mgf.algorithmOid];if(void 0===k||void 0===a.mgf[k])throw e=Error("Unsupported MGF function."),
537 -e.oid=c.signatureParameters.mgf.algorithmOid,e.name=k,e;k=a.mgf[k].create(a.md[d].create());d=r[c.signatureParameters.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw{message:"Unsupported RSASSA-PSS hash function.",oid:c.signatureParameters.hash.algorithmOid,name:d};k=a.pss.create(a.md[d].create(),k,c.signatureParameters.saltLength)}d=b.publicKey.verify(e.digest().getBytes(),c.signature,k)}return d};b.isIssuer=function(a){var c=!1,d=b.issuer;a=a.subject;if(d.hash&&a.hash)c=d.hash===a.hash;
538 -else if(d.attributes.length===a.attributes.length)for(var c=!0,e,g,h=0;c&&h<d.attributes.length;++h)if(e=d.attributes[h],g=a.attributes[h],e.type!==g.type||e.value!==g.value)c=!1;return c};b.issued=function(a){return a.isIssuer(b)};b.generateSubjectKeyIdentifier=function(){return q.getPublicKeyFingerprint(b.publicKey,{type:"RSAPublicKey"})};b.verifySubjectKeyIdentifier=function(){for(var c=r.subjectKeyIdentifier,d=0;d<b.extensions.length;++d){var e=b.extensions[d];if(e.id===c)return c=b.generateSubjectKeyIdentifier().getBytes(),
539 -a.util.hexToBytes(e.subjectKeyIdentifier)===c}return!1};return b};q.certificateFromAsn1=function(b,d){var k={},n=[];if(!h.validate(b,z,k,n))throw k=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),k.errors=n,k;if("string"!==typeof k.certSignature){for(var n="\x00",p=0;p<k.certSignature.length;++p)n+=h.toDer(k.certSignature[p]).getBytes();k.certSignature=n}n=h.derToOid(k.publicKeyOid);if(n!==q.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");
540 -var u=q.createCertificate();u.version=k.certVersion?k.certVersion.charCodeAt(0):0;n=a.util.createBuffer(k.certSerialNumber);u.serialNumber=n.toHex();u.signatureOid=a.asn1.derToOid(k.certSignatureOid);u.signatureParameters=E(u.signatureOid,k.certSignatureParams,!0);u.siginfo.algorithmOid=a.asn1.derToOid(k.certinfoSignatureOid);u.siginfo.parameters=E(u.siginfo.algorithmOid,k.certinfoSignatureParams,!1);n=a.util.createBuffer(k.certSignature);++n.read;u.signature=n.getBytes();n=[];void 0!==k.certValidity1UTCTime&&
537 +b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=q[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certificate digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=e;b.tbsCertificate=r.getTBSCertificate(b);e=h.toDer(b.tbsCertificate);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(c){var d=!1;if(!b.issued(c)){var d=b.subject,e=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");
538 +e.expectedIssuer=c.issuer.attributes;e.actualIssuer=d.attributes;throw e;}e=c.md;if(null===e){if(c.signatureOid in q)switch(q[c.signatureOid]){case "sha1WithRSAEncryption":e=a.md.sha1.create();break;case "md5WithRSAEncryption":e=a.md.md5.create();break;case "sha256WithRSAEncryption":e=a.md.sha256.create();break;case "sha512WithRSAEncryption":e=a.md.sha512.create();break;case "RSASSA-PSS":e=a.md.sha256.create()}if(null===e)throw e=Error("Could not compute certificate digest. Unknown signature OID."),
539 +e.signatureOid=c.signatureOid,e;var g=c.tbsCertificate||r.getTBSCertificate(c),g=h.toDer(g);e.update(g.getBytes())}if(null!==e){var k;switch(c.signatureOid){case q.sha1WithRSAEncryption:k=void 0;break;case q["RSASSA-PSS"]:d=q[c.signatureParameters.mgf.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw e=Error("Unsupported MGF hash function."),e.oid=c.signatureParameters.mgf.hash.algorithmOid,e.name=d,e;k=q[c.signatureParameters.mgf.algorithmOid];if(void 0===k||void 0===a.mgf[k])throw e=Error("Unsupported MGF function."),
540 +e.oid=c.signatureParameters.mgf.algorithmOid,e.name=k,e;k=a.mgf[k].create(a.md[d].create());d=q[c.signatureParameters.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw{message:"Unsupported RSASSA-PSS hash function.",oid:c.signatureParameters.hash.algorithmOid,name:d};k=a.pss.create(a.md[d].create(),k,c.signatureParameters.saltLength)}d=b.publicKey.verify(e.digest().getBytes(),c.signature,k)}return d};b.isIssuer=function(a){var c=!1,d=b.issuer;a=a.subject;if(d.hash&&a.hash)c=d.hash===a.hash;
541 +else if(d.attributes.length===a.attributes.length)for(var c=!0,e,g,h=0;c&&h<d.attributes.length;++h)if(e=d.attributes[h],g=a.attributes[h],e.type!==g.type||e.value!==g.value)c=!1;return c};b.issued=function(a){return a.isIssuer(b)};b.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(b.publicKey,{type:"RSAPublicKey"})};b.verifySubjectKeyIdentifier=function(){for(var c=q.subjectKeyIdentifier,d=0;d<b.extensions.length;++d){var e=b.extensions[d];if(e.id===c)return c=b.generateSubjectKeyIdentifier().getBytes(),
542 +a.util.hexToBytes(e.subjectKeyIdentifier)===c}return!1};return b};r.certificateFromAsn1=function(b,d){var k={},n=[];if(!h.validate(b,y,k,n))throw k=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),k.errors=n,k;if("string"!==typeof k.certSignature){for(var n="\x00",p=0;p<k.certSignature.length;++p)n+=h.toDer(k.certSignature[p]).getBytes();k.certSignature=n}n=h.derToOid(k.publicKeyOid);if(n!==r.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");
543 +var u=r.createCertificate();u.version=k.certVersion?k.certVersion.charCodeAt(0):0;n=a.util.createBuffer(k.certSerialNumber);u.serialNumber=n.toHex();u.signatureOid=a.asn1.derToOid(k.certSignatureOid);u.signatureParameters=E(u.signatureOid,k.certSignatureParams,!0);u.siginfo.algorithmOid=a.asn1.derToOid(k.certinfoSignatureOid);u.siginfo.parameters=E(u.siginfo.algorithmOid,k.certinfoSignatureParams,!1);n=a.util.createBuffer(k.certSignature);++n.read;u.signature=n.getBytes();n=[];void 0!==k.certValidity1UTCTime&&
544 n.push(h.utcTimeToDate(k.certValidity1UTCTime));void 0!==k.certValidity2GeneralizedTime&&n.push(h.generalizedTimeToDate(k.certValidity2GeneralizedTime));void 0!==k.certValidity3UTCTime&&n.push(h.utcTimeToDate(k.certValidity3UTCTime));void 0!==k.certValidity4GeneralizedTime&&n.push(h.generalizedTimeToDate(k.certValidity4GeneralizedTime));if(2<n.length)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(2>n.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");
542 -u.validity.notBefore=n[0];u.validity.notAfter=n[1];u.tbsCertificate=k.tbsCertificate;if(d){u.md=null;if(u.signatureOid in r)switch(n=r[u.signatureOid],n){case "sha1WithRSAEncryption":u.md=a.md.sha1.create();break;case "md5WithRSAEncryption":u.md=a.md.md5.create();break;case "sha256WithRSAEncryption":u.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":u.md=a.md.sha512.create();break;case "RSASSA-PSS":u.md=a.md.sha256.create()}if(null===u.md)throw k=Error("Could not compute certificate digest. Unknown signature OID."),
543 -k.signatureOid=u.signatureOid,k;n=h.toDer(u.tbsCertificate);u.md.update(n.getBytes())}n=a.md.sha1.create();u.issuer.getField=function(a){return c(u.issuer,a)};u.issuer.addField=function(a){e([a]);u.issuer.attributes.push(a)};u.issuer.attributes=q.RDNAttributesAsArray(k.certIssuer,n);k.certIssuerUniqueId&&(u.issuer.uniqueId=k.certIssuerUniqueId);u.issuer.hash=n.digest().toHex();n=a.md.sha1.create();u.subject.getField=function(a){return c(u.subject,a)};u.subject.addField=function(a){e([a]);u.subject.attributes.push(a)};
544 -u.subject.attributes=q.RDNAttributesAsArray(k.certSubject,n);k.certSubjectUniqueId&&(u.subject.uniqueId=k.certSubjectUniqueId);u.subject.hash=n.digest().toHex();u.extensions=k.certExtensions?q.certificateExtensionsFromAsn1(k.certExtensions):[];u.publicKey=q.publicKeyFromAsn1(k.subjectPublicKeyInfo);return u};q.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;c<a.value.length;++c)for(var d=a.value[c],e=0;e<d.value.length;++e)b.push(q.certificateExtensionFromAsn1(d.value[e]));return b};q.certificateExtensionFromAsn1=
545 -function(b){var c={};c.id=h.derToOid(b.value[0].value);c.critical=!1;b.value[1].type===h.Type.BOOLEAN?(c.critical=0!==b.value[1].value.charCodeAt(0),c.value=b.value[2].value):c.value=b.value[1].value;if(c.id in r)if(c.name=r[c.id],"keyUsage"===c.name){b=h.fromDer(c.value);var d=0,e=0;1<b.value.length&&(d=b.value.charCodeAt(1),e=2<b.value.length?b.value.charCodeAt(2):0);c.digitalSignature=128===(d&128);c.nonRepudiation=64===(d&64);c.keyEncipherment=32===(d&32);c.dataEncipherment=16===(d&16);c.keyAgreement=
545 +u.validity.notBefore=n[0];u.validity.notAfter=n[1];u.tbsCertificate=k.tbsCertificate;if(d){u.md=null;if(u.signatureOid in q)switch(n=q[u.signatureOid],n){case "sha1WithRSAEncryption":u.md=a.md.sha1.create();break;case "md5WithRSAEncryption":u.md=a.md.md5.create();break;case "sha256WithRSAEncryption":u.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":u.md=a.md.sha512.create();break;case "RSASSA-PSS":u.md=a.md.sha256.create()}if(null===u.md)throw k=Error("Could not compute certificate digest. Unknown signature OID."),
546 +k.signatureOid=u.signatureOid,k;n=h.toDer(u.tbsCertificate);u.md.update(n.getBytes())}n=a.md.sha1.create();u.issuer.getField=function(a){return c(u.issuer,a)};u.issuer.addField=function(a){e([a]);u.issuer.attributes.push(a)};u.issuer.attributes=r.RDNAttributesAsArray(k.certIssuer,n);k.certIssuerUniqueId&&(u.issuer.uniqueId=k.certIssuerUniqueId);u.issuer.hash=n.digest().toHex();n=a.md.sha1.create();u.subject.getField=function(a){return c(u.subject,a)};u.subject.addField=function(a){e([a]);u.subject.attributes.push(a)};
547 +u.subject.attributes=r.RDNAttributesAsArray(k.certSubject,n);k.certSubjectUniqueId&&(u.subject.uniqueId=k.certSubjectUniqueId);u.subject.hash=n.digest().toHex();u.extensions=k.certExtensions?r.certificateExtensionsFromAsn1(k.certExtensions):[];u.publicKey=r.publicKeyFromAsn1(k.subjectPublicKeyInfo);return u};r.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;c<a.value.length;++c)for(var d=a.value[c],e=0;e<d.value.length;++e)b.push(r.certificateExtensionFromAsn1(d.value[e]));return b};r.certificateExtensionFromAsn1=
548 +function(b){var c={};c.id=h.derToOid(b.value[0].value);c.critical=!1;b.value[1].type===h.Type.BOOLEAN?(c.critical=0!==b.value[1].value.charCodeAt(0),c.value=b.value[2].value):c.value=b.value[1].value;if(c.id in q)if(c.name=q[c.id],"keyUsage"===c.name){b=h.fromDer(c.value);var d=0,e=0;1<b.value.length&&(d=b.value.charCodeAt(1),e=2<b.value.length?b.value.charCodeAt(2):0);c.digitalSignature=128===(d&128);c.nonRepudiation=64===(d&64);c.keyEncipherment=32===(d&32);c.dataEncipherment=16===(d&16);c.keyAgreement=
549 8===(d&8);c.keyCertSign=4===(d&4);c.cRLSign=2===(d&2);c.encipherOnly=1===(d&1);c.decipherOnly=128===(e&128)}else if("basicConstraints"===c.name)b=h.fromDer(c.value),c.cA=0<b.value.length&&b.value[0].type===h.Type.BOOLEAN?0!==b.value[0].value.charCodeAt(0):!1,d=null,0<b.value.length&&b.value[0].type===h.Type.INTEGER?d=b.value[0].value:1<b.value.length&&(d=b.value[1].value),null!==d&&(c.pathLenConstraint=h.derToInteger(d));else if("extKeyUsage"===c.name)for(b=h.fromDer(c.value),d=0;d<b.value.length;++d)e=
547 -h.derToOid(b.value[d].value),e in r?c[r[e]]=!0:c[e]=!0;else if("nsCertType"===c.name)b=h.fromDer(c.value),d=0,1<b.value.length&&(d=b.value.charCodeAt(1)),c.client=128===(d&128),c.server=64===(d&64),c.email=32===(d&32),c.objsign=16===(d&16),c.reserved=8===(d&8),c.sslCA=4===(d&4),c.emailCA=2===(d&2),c.objCA=1===(d&1);else if("subjectAltName"===c.name||"issuerAltName"===c.name)for(c.altNames=[],b=h.fromDer(c.value),e=0;e<b.value.length;++e){var d=b.value[e],g={type:d.type,value:d.value};c.altNames.push(g);
548 -switch(d.type){case 7:g.ip=a.util.bytesToIP(d.value);break;case 8:g.oid=h.derToOid(d.value)}}else"subjectKeyIdentifier"===c.name&&(b=h.fromDer(c.value),c.subjectKeyIdentifier=a.util.bytesToHex(b.value));return c};q.certificationRequestFromAsn1=function(b,d){var k={},n=[];if(!h.validate(b,F,k,n))throw k=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),k.errors=n,k;if("string"!==typeof k.csrSignature){for(var n="\x00",p=0;p<k.csrSignature.length;++p)n+=
549 -h.toDer(k.csrSignature[p]).getBytes();k.csrSignature=n}n=h.derToOid(k.publicKeyOid);if(n!==q.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var u=q.createCertificationRequest();u.version=k.csrVersion?k.csrVersion.charCodeAt(0):0;u.signatureOid=a.asn1.derToOid(k.csrSignatureOid);u.signatureParameters=E(u.signatureOid,k.csrSignatureParams,!0);u.siginfo.algorithmOid=a.asn1.derToOid(k.csrSignatureOid);u.siginfo.parameters=E(u.siginfo.algorithmOid,k.csrSignatureParams,!1);n=
550 -a.util.createBuffer(k.csrSignature);++n.read;u.signature=n.getBytes();u.certificationRequestInfo=k.certificationRequestInfo;if(d){u.md=null;if(u.signatureOid in r)switch(n=r[u.signatureOid],n){case "sha1WithRSAEncryption":u.md=a.md.sha1.create();break;case "md5WithRSAEncryption":u.md=a.md.md5.create();break;case "sha256WithRSAEncryption":u.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":u.md=a.md.sha512.create();break;case "RSASSA-PSS":u.md=a.md.sha256.create()}if(null===u.md)throw k=
551 -Error("Could not compute certification request digest. Unknown signature OID."),k.signatureOid=u.signatureOid,k;n=h.toDer(u.certificationRequestInfo);u.md.update(n.getBytes())}n=a.md.sha1.create();u.subject.getField=function(a){return c(u.subject,a)};u.subject.addField=function(a){e([a]);u.subject.attributes.push(a)};u.subject.attributes=q.RDNAttributesAsArray(k.certificationRequestInfoSubject,n);u.subject.hash=n.digest().toHex();u.publicKey=q.publicKeyFromAsn1(k.subjectPublicKeyInfo);u.getAttribute=
552 -function(a){return c(u,a)};u.addAttribute=function(a){e([a]);u.attributes.push(a)};u.attributes=q.CRIAttributesAsArray(k.certificationRequestInfoAttributes||[]);return u};q.createCertificationRequest=function(){var b={version:0,signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){e([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.publicKey=null;b.attributes=
553 -[];b.getAttribute=function(a){return c(b,a)};b.addAttribute=function(a){e([a]);b.attributes.push(a)};b.md=null;b.setSubject=function(a){e(a);b.subject.attributes=a;b.subject.hash=null};b.setAttributes=function(a){e(a);b.attributes=a};b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=r[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certification request digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=
554 -e;b.certificationRequestInfo=q.getCertificationRequestInfo(b);e=h.toDer(b.certificationRequestInfo);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(){var c=!1,d=b.md;if(null===d){if(b.signatureOid in r)switch(r[b.signatureOid]){case "sha1WithRSAEncryption":d=a.md.sha1.create();break;case "md5WithRSAEncryption":d=a.md.md5.create();break;case "sha256WithRSAEncryption":d=a.md.sha256.create();break;case "sha512WithRSAEncryption":d=a.md.sha512.create();break;case "RSASSA-PSS":d=a.md.sha256.create()}if(null===
555 -d)throw d=Error("Could not compute certification request digest. Unknown signature OID."),d.signatureOid=b.signatureOid,d;var e=b.certificationRequestInfo||q.getCertificationRequestInfo(b),e=h.toDer(e);d.update(e.getBytes())}if(null!==d){var g;switch(b.signatureOid){case r["RSASSA-PSS"]:c=r[b.signatureParameters.mgf.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported MGF hash function."),d.oid=b.signatureParameters.mgf.hash.algorithmOid,d.name=c,d;g=r[b.signatureParameters.mgf.algorithmOid];
556 -if(void 0===g||void 0===a.mgf[g])throw d=Error("Unsupported MGF function."),d.oid=b.signatureParameters.mgf.algorithmOid,d.name=g,d;g=a.mgf[g].create(a.md[c].create());c=r[b.signatureParameters.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported RSASSA-PSS hash function."),d.oid=b.signatureParameters.hash.algorithmOid,d.name=c,d;g=a.pss.create(a.md[c].create(),g,b.signatureParameters.saltLength)}c=b.publicKey.verify(d.digest().getBytes(),b.signature,g)}return c};return b};
557 -q.getTBSCertificate=function(b){var c=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(b.version).getBytes())]),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(b.siginfo.algorithmOid).getBytes()),p(b.siginfo.algorithmOid,b.siginfo.parameters)]),d(b.issuer),h.create(h.Class.UNIVERSAL,
558 -h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(b.validity.notBefore)),h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(b.validity.notAfter))]),d(b.subject),q.publicKeyToAsn1(b.publicKey)]);b.issuer.uniqueId&&c.value.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+b.issuer.uniqueId)]));b.subject.uniqueId&&c.value.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,
559 -!1,String.fromCharCode(0)+b.subject.uniqueId)]));0<b.extensions.length&&c.value.push(q.certificateExtensionsToAsn1(b.extensions));return c};q.getCertificationRequestInfo=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(a.version).getBytes()),d(a.subject),q.publicKeyToAsn1(a.publicKey),k(a)])};q.distinguishedNameToAsn1=function(a){return d(a)};q.certificateToAsn1=function(a){var b=a.tbsCertificate||q.getTBSCertificate(a);
560 -return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[b,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.signatureOid).getBytes()),p(a.signatureOid,a.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};q.certificateExtensionsToAsn1=function(a){var b=h.create(h.Class.CONTEXT_SPECIFIC,3,!0,[]),c=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);b.value.push(c);for(var d=0;d<a.length;++d)c.value.push(q.certificateExtensionToAsn1(a[d]));
561 -return b};q.certificateExtensionToAsn1=function(a){var b=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);b.value.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.id).getBytes()));a.critical&&b.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,String.fromCharCode(255)));var c=a.value;"string"!==typeof a.value&&(c=h.toDer(c).getBytes());b.value.push(h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,c));return b};q.certificationRequestToAsn1=function(a){var b=a.certificationRequestInfo||
562 -q.getCertificationRequestInfo(a);return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[b,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.signatureOid).getBytes()),p(a.signatureOid,a.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};q.createCaStore=function(b){function c(b){if(!b.hash){var g=a.md.sha1.create();b.attributes=q.RDNAttributesAsArray(d(b),g);b.hash=g.digest().toHex()}return e.certs[b.hash]||
563 -null}var e={certs:{},getIssuer:function(a){return c(a.issuer)},addCertificate:function(b){"string"===typeof b&&(b=a.pki.certificateFromPem(b));if(!b.subject.hash){var c=a.md.sha1.create();b.subject.attributes=q.RDNAttributesAsArray(d(b.subject),c);b.subject.hash=c.digest().toHex()}b.subject.hash in e.certs?(c=e.certs[b.subject.hash],a.util.isArray(c)||(c=[c]),c.push(b)):e.certs[b.subject.hash]=b},hasCertificate:function(b){var d=c(b.subject);if(!d)return!1;a.util.isArray(d)||(d=[d]);b=h.toDer(q.certificateToAsn1(b)).getBytes();
564 -for(var e=0;e<d.length;++e){var g=h.toDer(q.certificateToAsn1(d[e])).getBytes();if(b===g)return!0}return!1}};if(b)for(var g=0;g<b.length;++g)e.addCertificate(b[g]);return e};q.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};
565 -q.verifyCertificateChain=function(b,c,d){c=c.slice(0);var e=c.slice(0),g=new Date,h=!0,k=null,l=0;do{var n=c.shift(),r=null,p=!1;if(g<n.validity.notBefore||g>n.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:q.certificateError.certificate_expired,notBefore:n.validity.notBefore,notAfter:n.validity.notAfter,now:g};if(null===k){r=c[0]||b.getIssuer(n);null===r&&n.isIssuer(n)&&(p=!0,r=n);if(r){var v=r;a.util.isArray(v)||(v=[v]);for(var w=!1;!w&&0<v.length;){r=v.shift();
566 -try{w=r.verify(n)}catch(x){}}w||(k={message:"Certificate signature is invalid.",error:q.certificateError.bad_certificate})}null!==k||r&&!p||b.hasCertificate(n)||(k={message:"Certificate is not trusted.",error:q.certificateError.unknown_ca})}null===k&&r&&!n.isIssuer(r)&&(k={message:"Certificate issuer is invalid.",error:q.certificateError.bad_certificate});if(null===k)for(v={keyUsage:!0,basicConstraints:!0},w=0;null===k&&w<n.extensions.length;++w){var z=n.extensions[w];!z.critical||z.name in v||(k=
567 -{message:"Certificate has an unsupported critical extension.",error:q.certificateError.unsupported_certificate})}null!==k||h&&(0!==c.length||r&&!p)||(h=n.getExtension("basicConstraints"),n=n.getExtension("keyUsage"),null!==n&&(n.keyCertSign&&null!==h||(k={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:q.certificateError.bad_certificate})),
568 -null!==k||null===h||h.cA||(k={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:q.certificateError.bad_certificate}),null===k&&null!==n&&"pathLenConstraint"in h&&l-1>h.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:q.certificateError.bad_certificate}));n=null===k?!0:k.error;h=d?d(n,l,e):n;if(!0===h)k=null;else{!0===n&&(k={message:"The application rejected the certificate.",error:q.certificateError.bad_certificate});
550 +h.derToOid(b.value[d].value),e in q?c[q[e]]=!0:c[e]=!0;else if("nsCertType"===c.name)b=h.fromDer(c.value),d=0,1<b.value.length&&(d=b.value.charCodeAt(1)),c.client=128===(d&128),c.server=64===(d&64),c.email=32===(d&32),c.objsign=16===(d&16),c.reserved=8===(d&8),c.sslCA=4===(d&4),c.emailCA=2===(d&2),c.objCA=1===(d&1);else if("subjectAltName"===c.name||"issuerAltName"===c.name)for(c.altNames=[],b=h.fromDer(c.value),e=0;e<b.value.length;++e){var d=b.value[e],g={type:d.type,value:d.value};c.altNames.push(g);
551 +switch(d.type){case 7:g.ip=a.util.bytesToIP(d.value);break;case 8:g.oid=h.derToOid(d.value)}}else"subjectKeyIdentifier"===c.name&&(b=h.fromDer(c.value),c.subjectKeyIdentifier=a.util.bytesToHex(b.value));return c};r.certificationRequestFromAsn1=function(b,d){var k={},n=[];if(!h.validate(b,F,k,n))throw k=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),k.errors=n,k;if("string"!==typeof k.csrSignature){for(var n="\x00",p=0;p<k.csrSignature.length;++p)n+=
552 +h.toDer(k.csrSignature[p]).getBytes();k.csrSignature=n}n=h.derToOid(k.publicKeyOid);if(n!==r.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var u=r.createCertificationRequest();u.version=k.csrVersion?k.csrVersion.charCodeAt(0):0;u.signatureOid=a.asn1.derToOid(k.csrSignatureOid);u.signatureParameters=E(u.signatureOid,k.csrSignatureParams,!0);u.siginfo.algorithmOid=a.asn1.derToOid(k.csrSignatureOid);u.siginfo.parameters=E(u.siginfo.algorithmOid,k.csrSignatureParams,!1);n=
553 +a.util.createBuffer(k.csrSignature);++n.read;u.signature=n.getBytes();u.certificationRequestInfo=k.certificationRequestInfo;if(d){u.md=null;if(u.signatureOid in q)switch(n=q[u.signatureOid],n){case "sha1WithRSAEncryption":u.md=a.md.sha1.create();break;case "md5WithRSAEncryption":u.md=a.md.md5.create();break;case "sha256WithRSAEncryption":u.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":u.md=a.md.sha512.create();break;case "RSASSA-PSS":u.md=a.md.sha256.create()}if(null===u.md)throw k=
554 +Error("Could not compute certification request digest. Unknown signature OID."),k.signatureOid=u.signatureOid,k;n=h.toDer(u.certificationRequestInfo);u.md.update(n.getBytes())}n=a.md.sha1.create();u.subject.getField=function(a){return c(u.subject,a)};u.subject.addField=function(a){e([a]);u.subject.attributes.push(a)};u.subject.attributes=r.RDNAttributesAsArray(k.certificationRequestInfoSubject,n);u.subject.hash=n.digest().toHex();u.publicKey=r.publicKeyFromAsn1(k.subjectPublicKeyInfo);u.getAttribute=
555 +function(a){return c(u,a)};u.addAttribute=function(a){e([a]);u.attributes.push(a)};u.attributes=r.CRIAttributesAsArray(k.certificationRequestInfoAttributes||[]);return u};r.createCertificationRequest=function(){var b={version:0,signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){e([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.publicKey=null;b.attributes=
556 +[];b.getAttribute=function(a){return c(b,a)};b.addAttribute=function(a){e([a]);b.attributes.push(a)};b.md=null;b.setSubject=function(a){e(a);b.subject.attributes=a;b.subject.hash=null};b.setAttributes=function(a){e(a);b.attributes=a};b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=q[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certification request digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=
557 +e;b.certificationRequestInfo=r.getCertificationRequestInfo(b);e=h.toDer(b.certificationRequestInfo);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(){var c=!1,d=b.md;if(null===d){if(b.signatureOid in q)switch(q[b.signatureOid]){case "sha1WithRSAEncryption":d=a.md.sha1.create();break;case "md5WithRSAEncryption":d=a.md.md5.create();break;case "sha256WithRSAEncryption":d=a.md.sha256.create();break;case "sha512WithRSAEncryption":d=a.md.sha512.create();break;case "RSASSA-PSS":d=a.md.sha256.create()}if(null===
558 +d)throw d=Error("Could not compute certification request digest. Unknown signature OID."),d.signatureOid=b.signatureOid,d;var e=b.certificationRequestInfo||r.getCertificationRequestInfo(b),e=h.toDer(e);d.update(e.getBytes())}if(null!==d){var g;switch(b.signatureOid){case q["RSASSA-PSS"]:c=q[b.signatureParameters.mgf.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported MGF hash function."),d.oid=b.signatureParameters.mgf.hash.algorithmOid,d.name=c,d;g=q[b.signatureParameters.mgf.algorithmOid];
559 +if(void 0===g||void 0===a.mgf[g])throw d=Error("Unsupported MGF function."),d.oid=b.signatureParameters.mgf.algorithmOid,d.name=g,d;g=a.mgf[g].create(a.md[c].create());c=q[b.signatureParameters.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported RSASSA-PSS hash function."),d.oid=b.signatureParameters.hash.algorithmOid,d.name=c,d;g=a.pss.create(a.md[c].create(),g,b.signatureParameters.saltLength)}c=b.publicKey.verify(d.digest().getBytes(),b.signature,g)}return c};return b};
560 +r.getTBSCertificate=function(b){var c=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(b.version).getBytes())]),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(b.siginfo.algorithmOid).getBytes()),p(b.siginfo.algorithmOid,b.siginfo.parameters)]),d(b.issuer),h.create(h.Class.UNIVERSAL,
561 +h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(b.validity.notBefore)),h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(b.validity.notAfter))]),d(b.subject),r.publicKeyToAsn1(b.publicKey)]);b.issuer.uniqueId&&c.value.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+b.issuer.uniqueId)]));b.subject.uniqueId&&c.value.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,
562 +!1,String.fromCharCode(0)+b.subject.uniqueId)]));0<b.extensions.length&&c.value.push(r.certificateExtensionsToAsn1(b.extensions));return c};r.getCertificationRequestInfo=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(a.version).getBytes()),d(a.subject),r.publicKeyToAsn1(a.publicKey),k(a)])};r.distinguishedNameToAsn1=function(a){return d(a)};r.certificateToAsn1=function(a){var b=a.tbsCertificate||r.getTBSCertificate(a);
563 +return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[b,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.signatureOid).getBytes()),p(a.signatureOid,a.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};r.certificateExtensionsToAsn1=function(a){var b=h.create(h.Class.CONTEXT_SPECIFIC,3,!0,[]),c=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);b.value.push(c);for(var d=0;d<a.length;++d)c.value.push(r.certificateExtensionToAsn1(a[d]));
564 +return b};r.certificateExtensionToAsn1=function(a){var b=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);b.value.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.id).getBytes()));a.critical&&b.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,String.fromCharCode(255)));var c=a.value;"string"!==typeof a.value&&(c=h.toDer(c).getBytes());b.value.push(h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,c));return b};r.certificationRequestToAsn1=function(a){var b=a.certificationRequestInfo||
565 +r.getCertificationRequestInfo(a);return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[b,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.signatureOid).getBytes()),p(a.signatureOid,a.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};r.createCaStore=function(b){function c(b){if(!b.hash){var g=a.md.sha1.create();b.attributes=r.RDNAttributesAsArray(d(b),g);b.hash=g.digest().toHex()}return e.certs[b.hash]||
566 +null}var e={certs:{},getIssuer:function(a){return c(a.issuer)},addCertificate:function(b){"string"===typeof b&&(b=a.pki.certificateFromPem(b));if(!b.subject.hash){var c=a.md.sha1.create();b.subject.attributes=r.RDNAttributesAsArray(d(b.subject),c);b.subject.hash=c.digest().toHex()}b.subject.hash in e.certs?(c=e.certs[b.subject.hash],a.util.isArray(c)||(c=[c]),c.push(b)):e.certs[b.subject.hash]=b},hasCertificate:function(b){var d=c(b.subject);if(!d)return!1;a.util.isArray(d)||(d=[d]);b=h.toDer(r.certificateToAsn1(b)).getBytes();
567 +for(var e=0;e<d.length;++e){var g=h.toDer(r.certificateToAsn1(d[e])).getBytes();if(b===g)return!0}return!1}};if(b)for(var g=0;g<b.length;++g)e.addCertificate(b[g]);return e};r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};
568 +r.verifyCertificateChain=function(b,c,d){c=c.slice(0);var e=c.slice(0),g=new Date,h=!0,k=null,l=0;do{var n=c.shift(),q=null,p=!1;if(g<n.validity.notBefore||g>n.validity.notAfter)k={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:n.validity.notBefore,notAfter:n.validity.notAfter,now:g};if(null===k){q=c[0]||b.getIssuer(n);null===q&&n.isIssuer(n)&&(p=!0,q=n);if(q){var v=q;a.util.isArray(v)||(v=[v]);for(var w=!1;!w&&0<v.length;){q=v.shift();
569 +try{w=q.verify(n)}catch(x){}}w||(k={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==k||q&&!p||b.hasCertificate(n)||(k={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}null===k&&q&&!n.isIssuer(q)&&(k={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate});if(null===k)for(v={keyUsage:!0,basicConstraints:!0},w=0;null===k&&w<n.extensions.length;++w){var y=n.extensions[w];!y.critical||y.name in v||(k=
570 +{message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}null!==k||h&&(0!==c.length||q&&!p)||(h=n.getExtension("basicConstraints"),n=n.getExtension("keyUsage"),null!==n&&(n.keyCertSign&&null!==h||(k={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),
571 +null!==k||null===h||h.cA||(k={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===k&&null!==n&&"pathLenConstraint"in h&&l-1>h.pathLenConstraint&&(k={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate}));n=null===k?!0:k.error;h=d?d(n,l,e):n;if(!0===h)k=null;else{!0===n&&(k={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate});
572 if(h||0===h)"object"!==typeof h||a.util.isArray(h)?"string"===typeof h&&(k.error=h):(h.message&&(k.message=h.message),h.error&&(k.error=h.error));throw k;}h=!1;++l}while(0<c.length);return!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.x509)return c.x509;
570 -c.defined.x509=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pki}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/x509","require module ./aes ./asn1 ./des ./md ./mgf ./oids ./pem ./pss ./rsa ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d,e){for(var g=
571 -[],h=0;h<a.length;h++)for(var k=0;k<a[h].safeBags.length;k++){var m=a[h].safeBags[k];if(void 0===e||m.type===e)null===b?g.push(m):void 0!==m.attributes[b]&&0<=m.attributes[b].indexOf(d)&&g.push(m)}return g}function d(b){if(b.composed||b.constructed){for(var c=a.util.createBuffer(),e=0;e<b.value.length;++e)c.putBytes(b.value[e].value);b.composed=b.constructed=!1;b.value=c.getBytes()}return b}function e(b,c,g,l){c=k.fromDer(c,g);if(c.tagClass!==k.Class.UNIVERSAL||c.type!==k.Type.SEQUENCE||!0!==c.constructed)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
572 -for(var p=0;p<c.value.length;p++){var q={},x=[];if(!k.validate(c.value[p],r,q,x))throw b=Error("Cannot read ContentInfo."),b.errors=x,b;var x={encrypted:!1},u=null,u=q.content.value[0];switch(k.derToOid(q.contentType)){case h.oids.data:if(u.tagClass!==k.Class.UNIVERSAL||u.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");u=d(u).value;break;case h.oids.encryptedData:var z=l,q={},B=[];if(!k.validate(u,a.pkcs7.asn1.encryptedDataValidator,q,B))throw b=Error("Cannot read EncryptedContentInfo."),
573 -b.errors=B,b;u=k.derToOid(q.contentType);if(u!==h.oids.data)throw b=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),b.oid=u,b;u=k.derToOid(q.encAlgorithm);u=h.pbe.getCipher(u,q.encParameter,z);q=d(q.encryptedContentAsn1);q=a.util.createBuffer(q.value);u.update(q);if(!u.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");u=u.output.getBytes();x.encrypted=!0;break;default:throw b=Error("Unsupported PKCS#12 contentType."),b.contentType=k.derToOid(q.contentType),b;}x.safeBags=
574 -n(u,g,l);b.safeContents.push(x)}}function n(a,b,c){if(!b&&0===a.length)return[];a=k.fromDer(a,b);if(a.tagClass!==k.Class.UNIVERSAL||a.type!==k.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],e=0;e<a.value.length;e++){var g={},m=[];if(!k.validate(a.value[e],B,g,m))throw a=Error("Cannot read SafeBag."),a.errors=m,a;var l={type:k.derToOid(g.bagId),attributes:p(g.bagAttributes)};d.push(l);var r,q,v=g.bagValue.value[0];switch(l.type){case h.oids.pkcs8ShroudedKeyBag:if(v=
575 -h.decryptPrivateKeyInfo(v,c),null===v)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case h.oids.keyBag:try{l.key=h.privateKeyFromAsn1(v)}catch(w){l.key=null,l.asn1=v}continue;case h.oids.certBag:r=I;q=function(){if(k.derToOid(g.certId)!==h.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=k.derToOid(g.certId);throw a;}a=k.fromDer(g.cert,b);try{l.cert=h.certificateFromAsn1(a,!0)}catch(c){l.cert=null,l.asn1=a}};break;default:throw a=
576 -Error("Unsupported PKCS#12 SafeBag type."),a.oid=l.type,a;}if(void 0!==r&&!k.validate(v,r,g,m))throw a=Error("Cannot read PKCS#12 "+r.name),a.errors=m,a;q()}return d}function p(a){var b={};if(void 0!==a)for(var c=0;c<a.length;++c){var d={},e=[];if(!k.validate(a[c],z,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=k.derToOid(d.oid);if(void 0!==h.oids[e]){b[h.oids[e]]=[];for(var g=0;g<d.values.length;++g)b[h.oids[e]].push(d.values[g].value)}}return b}var k=a.asn1,h=a.pki,q=a.pkcs12=
577 -a.pkcs12||{},r={name:"ContentInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},C={name:"PFX",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"version"},
578 -r,{name:"PFX.macData",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",
573 +c.defined.x509=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pki}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/x509","require module ./aes ./asn1 ./des ./md ./mgf ./oids ./pem ./pss ./rsa ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d,e){for(var g=
574 +[],h=0;h<a.length;h++)for(var m=0;m<a[h].safeBags.length;m++){var k=a[h].safeBags[m];if(void 0===e||k.type===e)null===b?g.push(k):void 0!==k.attributes[b]&&0<=k.attributes[b].indexOf(d)&&g.push(k)}return g}function d(b){if(b.composed||b.constructed){for(var c=a.util.createBuffer(),e=0;e<b.value.length;++e)c.putBytes(b.value[e].value);b.composed=b.constructed=!1;b.value=c.getBytes()}return b}function e(b,c,g,l){c=k.fromDer(c,g);if(c.tagClass!==k.Class.UNIVERSAL||c.type!==k.Type.SEQUENCE||!0!==c.constructed)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
575 +for(var p=0;p<c.value.length;p++){var r={},x=[];if(!k.validate(c.value[p],q,r,x))throw b=Error("Cannot read ContentInfo."),b.errors=x,b;var x={encrypted:!1},u=null,u=r.content.value[0];switch(k.derToOid(r.contentType)){case h.oids.data:if(u.tagClass!==k.Class.UNIVERSAL||u.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");u=d(u).value;break;case h.oids.encryptedData:var y=l,r={},B=[];if(!k.validate(u,a.pkcs7.asn1.encryptedDataValidator,r,B))throw b=Error("Cannot read EncryptedContentInfo."),
576 +b.errors=B,b;u=k.derToOid(r.contentType);if(u!==h.oids.data)throw b=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),b.oid=u,b;u=k.derToOid(r.encAlgorithm);u=h.pbe.getCipher(u,r.encParameter,y);r=d(r.encryptedContentAsn1);r=a.util.createBuffer(r.value);u.update(r);if(!u.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");u=u.output.getBytes();x.encrypted=!0;break;default:throw b=Error("Unsupported PKCS#12 contentType."),b.contentType=k.derToOid(r.contentType),b;}x.safeBags=
577 +n(u,g,l);b.safeContents.push(x)}}function n(a,b,c){if(!b&&0===a.length)return[];a=k.fromDer(a,b);if(a.tagClass!==k.Class.UNIVERSAL||a.type!==k.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],e=0;e<a.value.length;e++){var g={},m=[];if(!k.validate(a.value[e],B,g,m))throw a=Error("Cannot read SafeBag."),a.errors=m,a;var l={type:k.derToOid(g.bagId),attributes:p(g.bagAttributes)};d.push(l);var q,r,v=g.bagValue.value[0];switch(l.type){case h.oids.pkcs8ShroudedKeyBag:if(v=
578 +h.decryptPrivateKeyInfo(v,c),null===v)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case h.oids.keyBag:try{l.key=h.privateKeyFromAsn1(v)}catch(w){l.key=null,l.asn1=v}continue;case h.oids.certBag:q=I;r=function(){if(k.derToOid(g.certId)!==h.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=k.derToOid(g.certId);throw a;}a=k.fromDer(g.cert,b);try{l.cert=h.certificateFromAsn1(a,!0)}catch(c){l.cert=null,l.asn1=a}};break;default:throw a=
579 +Error("Unsupported PKCS#12 SafeBag type."),a.oid=l.type,a;}if(void 0!==q&&!k.validate(v,q,g,m))throw a=Error("Cannot read PKCS#12 "+q.name),a.errors=m,a;r()}return d}function p(a){var b={};if(void 0!==a)for(var c=0;c<a.length;++c){var d={},e=[];if(!k.validate(a[c],y,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=k.derToOid(d.oid);if(void 0!==h.oids[e]){b[h.oids[e]]=[];for(var g=0;g<d.values.length;++g)b[h.oids[e]].push(d.values[g].value)}}return b}var k=a.asn1,h=a.pki,r=a.pkcs12=
580 +a.pkcs12||{},q={name:"ContentInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},C={name:"PFX",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"version"},
581 +q,{name:"PFX.macData",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",
582 tagClass:k.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},B={name:"SafeBag",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,
580 -value:[{name:"SafeBag.bagId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},z={name:"Attribute",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,
583 +value:[{name:"SafeBag.bagId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},y={name:"Attribute",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,
584 capture:"oid"},{name:"Attribute.attrValues",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0,capture:"values"}]},I={name:"CertBag",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:k.Class.UNIVERSAL,type:k.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};
582 -q.pkcs12FromAsn1=function(b,n,r){"string"===typeof n?(r=n,n=!0):void 0===n&&(n=!0);var p={};if(!k.validate(b,C,p,[]))throw n=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),n.errors=n,n;var v={version:p.version.charCodeAt(0),safeContents:[],getBags:function(b){var d={},e;"localKeyId"in b?e=b.localKeyId:"localKeyIdHex"in b&&(e=a.util.hexToBytes(b.localKeyIdHex));void 0===e&&!("friendlyName"in b)&&"bagType"in b&&(d[b.bagType]=c(v.safeContents,null,null,b.bagType));void 0!==e&&
585 +r.pkcs12FromAsn1=function(b,n,q){"string"===typeof n?(q=n,n=!0):void 0===n&&(n=!0);var p={};if(!k.validate(b,C,p,[]))throw n=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),n.errors=n,n;var v={version:p.version.charCodeAt(0),safeContents:[],getBags:function(b){var d={},e;"localKeyId"in b?e=b.localKeyId:"localKeyIdHex"in b&&(e=a.util.hexToBytes(b.localKeyIdHex));void 0===e&&!("friendlyName"in b)&&"bagType"in b&&(d[b.bagType]=c(v.safeContents,null,null,b.bagType));void 0!==e&&
586 (d.localKeyId=c(v.safeContents,"localKeyId",e,b.bagType));"friendlyName"in b&&(d.friendlyName=c(v.safeContents,"friendlyName",b.friendlyName,b.bagType));return d},getBagsByFriendlyName:function(a,b){return c(v.safeContents,"friendlyName",a,b)},getBagsByLocalKeyId:function(a,b){return c(v.safeContents,"localKeyId",a,b)}};if(3!==p.version.charCodeAt(0))throw n=Error("PKCS#12 PFX of version other than 3 not supported."),n.version=p.version.charCodeAt(0),n;if(k.derToOid(p.contentType)!==h.oids.data)throw n=
584 -Error("Only PKCS#12 PFX in password integrity mode supported."),n.oid=k.derToOid(p.contentType),n;b=p.content.value[0];if(b.tagClass!==k.Class.UNIVERSAL||b.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");b=d(b);if(p.mac){var x=null,z=0,u=k.derToOid(p.macAlgorithm);switch(u){case h.oids.sha1:x=a.md.sha1.create();z=20;break;case h.oids.sha256:x=a.md.sha256.create();z=32;break;case h.oids.sha384:x=a.md.sha384.create();z=48;break;case h.oids.sha512:x=a.md.sha512.create();
585 -z=64;break;case h.oids.md5:x=a.md.md5.create(),z=16}if(null===x)throw Error("PKCS#12 uses unsupported MAC algorithm: "+u);var u=new a.util.ByteBuffer(p.macSalt),B="macIterations"in p?parseInt(a.util.bytesToHex(p.macIterations),16):1,z=q.generateKey(r,u,3,B,z,x),u=a.hmac.create();u.start(x,z);u.update(b.value);if(u.getMac().getBytes()!==p.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}e(v,b.value,n,r);return v};q.toPkcs12Asn1=function(b,c,d,e){e=e||{};e.saltSize=e.saltSize||
587 +Error("Only PKCS#12 PFX in password integrity mode supported."),n.oid=k.derToOid(p.contentType),n;b=p.content.value[0];if(b.tagClass!==k.Class.UNIVERSAL||b.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");b=d(b);if(p.mac){var x=null,y=0,u=k.derToOid(p.macAlgorithm);switch(u){case h.oids.sha1:x=a.md.sha1.create();y=20;break;case h.oids.sha256:x=a.md.sha256.create();y=32;break;case h.oids.sha384:x=a.md.sha384.create();y=48;break;case h.oids.sha512:x=a.md.sha512.create();
588 +y=64;break;case h.oids.md5:x=a.md.md5.create(),y=16}if(null===x)throw Error("PKCS#12 uses unsupported MAC algorithm: "+u);var u=new a.util.ByteBuffer(p.macSalt),B="macIterations"in p?parseInt(a.util.bytesToHex(p.macIterations),16):1,y=r.generateKey(q,u,3,B,y,x),u=a.hmac.create();u.start(x,y);u.update(b.value);if(u.getMac().getBytes()!==p.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}e(v,b.value,n,q);return v};r.toPkcs12Asn1=function(b,c,d,e){e=e||{};e.saltSize=e.saltSize||
589 8;e.count=e.count||2048;e.algorithm=e.algorithm||e.encAlgorithm||"aes128";"useMac"in e||(e.useMac=!0);"localKeyId"in e||(e.localKeyId=null);"generateLocalKeyId"in e||(e.generateLocalKeyId=!0);var g=e.localKeyId,l;if(null!==g)g=a.util.hexToBytes(g);else if(e.generateLocalKeyId)if(c){var n=a.util.isArray(c)?c[0]:c;"string"===typeof n&&(n=h.certificateFromPem(n));g=a.md.sha1.create();g.update(k.toDer(h.certificateToAsn1(n)).getBytes());g=g.digest().getBytes()}else g=a.random.getBytes(20);n=[];null!==
590 g&&n.push(k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.localKeyId).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,g)])]));"friendlyName"in e&&n.push(k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.friendlyName).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.BMPSTRING,!1,e.friendlyName)])]));
588 -0<n.length&&(l=k.create(k.Class.UNIVERSAL,k.Type.SET,!0,n));g=[];n=[];null!==c&&(n=a.util.isArray(c)?c:[c]);for(var r=[],p=0;p<n.length;++p){c=n[p];"string"===typeof c&&(c=h.certificateFromPem(c));var v=0===p?l:void 0;c=h.certificateToAsn1(c);c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.certBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.x509Certificate).getBytes()),
589 -k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(c).getBytes())])])]),v]);r.push(c)}0<r.length&&(c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,r),c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(c).getBytes())])]),g.push(c));c=null;null!==b&&(b=h.wrapRsaPrivateKey(h.privateKeyToAsn1(b)),
591 +0<n.length&&(l=k.create(k.Class.UNIVERSAL,k.Type.SET,!0,n));g=[];n=[];null!==c&&(n=a.util.isArray(c)?c:[c]);for(var q=[],p=0;p<n.length;++p){c=n[p];"string"===typeof c&&(c=h.certificateFromPem(c));var v=0===p?l:void 0;c=h.certificateToAsn1(c);c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.certBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.x509Certificate).getBytes()),
592 +k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(c).getBytes())])])]),v]);q.push(c)}0<q.length&&(c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,q),c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(c).getBytes())])]),g.push(c));c=null;null!==b&&(b=h.wrapRsaPrivateKey(h.privateKeyToAsn1(b)),
593 c=null===d?k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.keyBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[b]),l]):k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.pkcs8ShroudedKeyBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[h.encryptPrivateKeyInfo(b,d,e)]),l]),b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[c]),b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,
591 -[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(b).getBytes())])]),g.push(b));l=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,g);var w;e.useMac&&(g=a.md.sha1.create(),w=new a.util.ByteBuffer(a.random.getBytes(e.saltSize)),e=e.count,b=q.generateKey(d,w,3,e,20),d=a.hmac.create(),d.start(g,b),d.update(k.toDer(l).getBytes()),d=d.getMac(),w=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,
594 +[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(b).getBytes())])]),g.push(b));l=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,g);var w;e.useMac&&(g=a.md.sha1.create(),w=new a.util.ByteBuffer(a.random.getBytes(e.saltSize)),e=e.count,b=r.generateKey(d,w,3,e,20),d=a.hmac.create(),d.start(g,b),d.update(k.toDer(l).getBytes()),d=d.getMac(),w=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,
595 !0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.sha1).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,d.getBytes())]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,w.getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(e).getBytes())]));return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,
593 -k.Type.INTEGER,!1,k.integerToDer(3).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(l).getBytes())])]),w])};q.generateKey=a.pbe.generatePkcs12Key}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,
594 -p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs12)return c.pkcs12;c.defined.pkcs12=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pkcs12}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs12","require module ./asn1 ./hmac ./oids ./pkcs7asn1 ./pbe ./random ./rsa ./sha1 ./util ./x509".split(" "),
596 +k.Type.INTEGER,!1,k.integerToDer(3).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(l).getBytes())])]),w])};r.generateKey=a.pbe.generatePkcs12Key}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,
597 +p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs12)return c.pkcs12;c.defined.pkcs12=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pkcs12}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs12","require module ./asn1 ./hmac ./oids ./pkcs7asn1 ./pbe ./random ./rsa ./sha1 ./util ./x509".split(" "),
598 function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pki=a.pki||{};d.pemToDer=function(b){b=a.pem.decode(b)[0];if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert PEM to DER; PEM is encrypted.");return a.util.createBuffer(b.body)};d.privateKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PRIVATE KEY"!==b.type&&"RSA PRIVATE KEY"!==b.type){var e=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');
599 e.headerType=b.type;throw e;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert private key from PEM; PEM is encrypted.");b=c.fromDer(b.body);return d.privateKeyFromAsn1(b)};d.privateKeyToPem=function(b,e){var n={type:"RSA PRIVATE KEY",body:c.toDer(d.privateKeyToAsn1(b)).getBytes()};return a.pem.encode(n,{maxline:e})};d.privateKeyInfoToPem=function(b,d){var e={type:"PRIVATE KEY",body:c.toDer(b).getBytes()};return a.pem.encode(e,{maxline:d})}}if("function"!==typeof a)if("object"===
597 -typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pki)return c.pki;c.defined.pki=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pki}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,
600 +typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pki)return c.pki;c.defined.pki=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pki}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,
601 Array.prototype.slice.call(arguments,0))};a("js/pki","require module ./asn1 ./oids ./pbe ./pem ./pbkdf2 ./pkcs12 ./pss ./rsa ./util ./x509".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=function(b,c,d,e){var g=a.util.createBuffer(),h=b.length>>1,k=h+(b.length&1),l=b.substr(0,k),k=b.substr(h,k);b=a.util.createBuffer();h=a.hmac.create();d=c+d;var n=Math.ceil(e/16);c=Math.ceil(e/20);h.start("MD5",l);l=a.util.createBuffer();b.putBytes(d);
599 -for(var r=0;r<n;++r)h.start(null,null),h.update(b.getBytes()),b.putBuffer(h.digest()),h.start(null,null),h.update(b.bytes()+d),l.putBuffer(h.digest());h.start("SHA1",k);k=a.util.createBuffer();b.clear();b.putBytes(d);for(r=0;r<c;++r)h.start(null,null),h.update(b.getBytes()),b.putBuffer(h.digest()),h.start(null,null),h.update(b.bytes()+d),k.putBuffer(h.digest());g.putBytes(a.util.xorBytes(l.getBytes(),k.getBytes(),e));return g},d=function(b,c,d){d=!1;try{var e=b.deflate(c.fragment.getBytes());c.fragment=
602 +for(var q=0;q<n;++q)h.start(null,null),h.update(b.getBytes()),b.putBuffer(h.digest()),h.start(null,null),h.update(b.bytes()+d),l.putBuffer(h.digest());h.start("SHA1",k);k=a.util.createBuffer();b.clear();b.putBytes(d);for(q=0;q<c;++q)h.start(null,null),h.update(b.getBytes()),b.putBuffer(h.digest()),h.start(null,null),h.update(b.bytes()+d),k.putBuffer(h.digest());g.putBytes(a.util.xorBytes(l.getBytes(),k.getBytes(),e));return g},d=function(b,c,d){d=!1;try{var e=b.deflate(c.fragment.getBytes());c.fragment=
603 a.util.createBuffer(e);c.length=e.length;d=!0}catch(g){}return d},e=function(b,c,d){d=!1;try{var e=b.inflate(c.fragment.getBytes());c.fragment=a.util.createBuffer(e);c.length=e.length;d=!0}catch(g){}return d},n=function(b,c){var d=0;switch(c){case 1:d=b.getByte();break;case 2:d=b.getInt16();break;case 3:d=b.getInt24();break;case 4:d=b.getInt32()}return a.util.createBuffer(b.getBytes(d))},p=function(a,b,c){a.putInt(c.length(),b<<3);a.putBuffer(c)},k={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,
604 minor:2},TLS_1_2:{major:3,minor:3}}};k.SupportedVersions=[k.Versions.TLS_1_1,k.Versions.TLS_1_0];k.Version=k.SupportedVersions[0];k.MaxFragment=15360;k.ConnectionEnd={server:0,client:1};k.PRFAlgorithm={tls_prf_sha256:0};k.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};k.CipherType={stream:0,block:1,aead:2};k.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};k.CompressionMethod={none:0,deflate:1};k.ContentType={change_cipher_spec:20,alert:21,handshake:22,
605 application_data:23,heartbeat:24};k.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};k.Alert={};k.Alert.Level={warning:1,fatal:2};k.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,
@@ -608,11 +611,11 @@ send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.protoco
611 b.session.compressionMethod=g?e.compression_method:k.CompressionMethod.none}return e};k.createSecurityParameters=function(a,b){var c=a.entity===k.ConnectionEnd.client,d=b.random.bytes(),e=c?a.session.sp.client_random:d,c=c?d:k.createRandom().getBytes();a.session.sp={entity:a.entity,prf_algorithm:k.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,
612 compression_algorithm:a.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:e,server_random:c}};k.handleServerHello=function(a,b,c){b=k.parseHelloMessage(a,b,c);if(!a.fail){if(b.version.minor<=a.version.minor)a.version.minor=b.version.minor;else return a.error(a,{message:"Incompatible TLS version.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.protocol_version}});a.session.version=a.version;c=b.session_id.bytes();0<c.length&&c===a.session.id?
613 (a.expect=B,a.session.resuming=!0,a.session.sp.server_random=b.random.bytes()):(a.expect=h,a.session.resuming=!1,k.createSecurityParameters(a,b));a.session.id=c;a.process()}};k.handleClientHello=function(b,c,d){c=k.parseHelloMessage(b,c,d);if(!b.fail){var e=c.session_id.bytes();d=null;if(b.sessionCache)if(d=b.sessionCache.getSession(e),null===d)e="";else if(d.version.major!==c.version.major||d.version.minor>c.version.minor)d=null,e="";0===e.length&&(e=a.random.getBytes(32));b.session.id=e;b.session.clientHelloVersion=
611 -c.version;b.session.sp={};if(d)b.version=b.session.version=d.version,b.session.sp=d.sp;else{for(var g,e=1;e<k.SupportedVersions.length&&!(g=k.SupportedVersions[e],g.minor<=c.version.minor);++e);b.version={major:g.major,minor:g.minor};b.session.version=b.version}null!==d?(b.expect=A,b.session.resuming=!0,b.session.sp.client_random=c.random.bytes()):(b.expect=!1!==b.verifyClient?E:y,b.session.resuming=!1,k.createSecurityParameters(b,c));b.open=!0;k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,
614 +c.version;b.session.sp={};if(d)b.version=b.session.version=d.version,b.session.sp=d.sp;else{for(var g,e=1;e<k.SupportedVersions.length&&!(g=k.SupportedVersions[e],g.minor<=c.version.minor);++e);b.version={major:g.major,minor:g.minor};b.session.version=b.version}null!==d?(b.expect=A,b.session.resuming=!0,b.session.sp.client_random=c.random.bytes()):(b.expect=!1!==b.verifyClient?E:z,b.session.resuming=!1,k.createSecurityParameters(b,c));b.open=!0;k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,
615 data:k.createServerHello(b)}));b.session.resuming?(k.queue(b,k.createRecord(b,{type:k.ContentType.change_cipher_spec,data:k.createChangeCipherSpec()})),b.state.pending=k.createConnectionState(b),b.state.current.write=b.state.pending.write,k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createFinished(b)}))):(k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createCertificate(b)})),b.fail||(k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createServerKeyExchange(b)})),
616 !1!==b.verifyClient&&k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createCertificateRequest(b)})),k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createServerHelloDone(b)}))));k.flush(b);b.process()}};k.handleCertificate=function(b,c,d){if(3>d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});d=n(c.fragment,3);var e,g;c=[];try{for(;0<d.length();)e=
614 -n(d,3),g=a.asn1.fromDer(e),e=a.pki.certificateFromAsn1(g,!0),c.push(e)}catch(h){return b.error(b,{message:"Could not parse certificate list.",cause:h,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}e=b.entity===k.ConnectionEnd.client;!e&&!0!==b.verifyClient||0!==c.length?0===c.length?b.expect=e?q:y:(e?b.session.serverCertificate=c[0]:b.session.clientCertificate=c[0],k.verifyCertificateChain(b,c)&&(b.expect=e?q:y)):b.error(b,{message:e?"No server certificate provided.":
615 -"No client certificate provided.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});b.process()};k.handleServerKeyExchange=function(a,b,c){if(0<c)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unsupported_certificate}});a.expect=r;a.process()};k.handleClientKeyExchange=function(b,c,d){if(48>d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.",
617 +n(d,3),g=a.asn1.fromDer(e),e=a.pki.certificateFromAsn1(g,!0),c.push(e)}catch(h){return b.error(b,{message:"Could not parse certificate list.",cause:h,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}e=b.entity===k.ConnectionEnd.client;!e&&!0!==b.verifyClient||0!==c.length?0===c.length?b.expect=e?r:z:(e?b.session.serverCertificate=c[0]:b.session.clientCertificate=c[0],k.verifyCertificateChain(b,c)&&(b.expect=e?r:z)):b.error(b,{message:e?"No server certificate provided.":
618 +"No client certificate provided.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});b.process()};k.handleServerKeyExchange=function(a,b,c){if(0<c)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unsupported_certificate}});a.expect=q;a.process()};k.handleClientKeyExchange=function(b,c,d){if(48>d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.",
619 send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unsupported_certificate}});c=n(c.fragment,2).getBytes();d=null;if(b.getPrivateKey)try{d=b.getPrivateKey(b,b.session.serverCertificate),d=a.pki.privateKeyFromPem(d)}catch(e){b.error(b,{message:"Could not get private key.",cause:e,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}});
620 try{var g=b.session.sp;g.pre_master_secret=d.decrypt(c);var h=b.session.clientHelloVersion;if(h.major!==g.pre_master_secret.charCodeAt(0)||h.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=a.random.getBytes(48)}b.expect=A;null!==b.session.clientCertificate&&(b.expect=D);b.process()};k.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,
621 description:k.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:n(b,1),certificate_authorities:n(b,2)};a.session.certificateRequest=b;a.expect=C;a.process()};k.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=n(d,2).getBytes();var e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
@@ -620,7 +623,7 @@ e.putBuffer(b.session.sha1.digest());e=e.getBytes();try{if(!b.session.clientCert
623 send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.record_overflow}});if(null===b.serverCertificate&&(c={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.insufficient_security}},d=b.verify(b,c.alert.description,0,[]),!0!==d)){if(d||0===d)"object"!==typeof d||a.util.isArray(d)?"number"===typeof d&&(c.alert.description=d):(d.message&&(c.message=d.message),d.alert&&(c.alert.description=d.alert));
624 return b.error(b,c)}null!==b.session.certificateRequest&&(c=k.createRecord(b,{type:k.ContentType.handshake,data:k.createCertificate(b)}),k.queue(b,c));c=k.createRecord(b,{type:k.ContentType.handshake,data:k.createClientKeyExchange(b)});k.queue(b,c);b.expect=F;c=function(a,b){null!==a.session.certificateRequest&&null!==a.session.clientCertificate&&k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createCertificateVerify(a,b)}));k.queue(a,k.createRecord(a,{type:k.ContentType.change_cipher_spec,
625 data:k.createChangeCipherSpec()}));a.state.pending=k.createConnectionState(a);a.state.current.write=a.state.pending.write;k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createFinished(a)}));a.expect=B;k.flush(a);a.process()};if(null===b.session.certificateRequest||null===b.session.clientCertificate)return c(b,null);k.getClientSignature(b,c)};k.handleChangeCipherSpec=function(a,b){if(1!==b.fragment.getByte())return a.error(a,{message:"Invalid ChangeCipherSpec message received.",send:!0,
623 -alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});var c=a.entity===k.ConnectionEnd.client;if(a.session.resuming&&c||!a.session.resuming&&!c)a.state.pending=k.createConnectionState(a);a.state.current.read=a.state.pending.read;if(!a.session.resuming&&c||a.session.resuming&&!c)a.state.pending=null;a.expect=c?z:G;a.process()};k.handleFinished=function(b,d,e){e=d.fragment;e.read-=4;var h=e.bytes();e.read+=4;d=d.fragment.getBytes();e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
626 +alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});var c=a.entity===k.ConnectionEnd.client;if(a.session.resuming&&c||!a.session.resuming&&!c)a.state.pending=k.createConnectionState(a);a.state.current.read=a.state.pending.read;if(!a.session.resuming&&c||a.session.resuming&&!c)a.state.pending=null;a.expect=c?y:G;a.process()};k.handleFinished=function(b,d,e){e=d.fragment;e.read-=4;var h=e.bytes();e.read+=4;d=d.fragment.getBytes();e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
627 e.putBuffer(b.session.sha1.digest());var l=b.entity===k.ConnectionEnd.client;e=c(b.session.sp.master_secret,l?"server finished":"client finished",e.getBytes(),12);if(e.getBytes()!==d)return b.error(b,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.decrypt_error}});b.session.md5.update(h);b.session.sha1.update(h);if(b.session.resuming&&l||!b.session.resuming&&!l)k.queue(b,k.createRecord(b,{type:k.ContentType.change_cipher_spec,
628 data:k.createChangeCipherSpec()})),b.state.current.write=b.state.pending.write,b.state.pending=null,k.queue(b,k.createRecord(b,{type:k.ContentType.handshake,data:k.createFinished(b)}));b.expect=l?I:L;b.handshaking=!1;++b.handshakes;b.peerCertificate=l?b.session.serverCertificate:b.session.clientCertificate;k.flush(b);b.isConnected=!0;b.connected(b);b.process()};k.handleAlert=function(a,b){var c=b.fragment,c={level:c.getByte(),description:c.getByte()},d;switch(c.description){case k.Alert.Description.close_notify:d=
629 "Connection closed.";break;case k.Alert.Description.unexpected_message:d="Unexpected message.";break;case k.Alert.Description.bad_record_mac:d="Bad record MAC.";break;case k.Alert.Description.decryption_failed:d="Decryption failed.";break;case k.Alert.Description.record_overflow:d="Record overflow.";break;case k.Alert.Description.decompression_failure:d="Decompression failed.";break;case k.Alert.Description.handshake_failure:d="Handshake failure.";break;case k.Alert.Description.bad_certificate:d=
@@ -629,7 +632,7 @@ data:k.createChangeCipherSpec()})),b.state.current.write=b.state.pending.write,b
632 break;case k.Alert.Description.no_renegotiation:d="Renegotiation not supported.";break;default:d="Unknown error."}if(c.description===k.Alert.Description.close_notify)return a.close();a.error(a,{message:d,send:!1,origin:a.entity===k.ConnectionEnd.client?"server":"client",alert:c});a.process()};k.handleHandshake=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt24();if(g>d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var h=d.bytes(g+
633 4);d.read+=4;e in W[b.entity][b.expect]?(b.entity!==k.ConnectionEnd.server||b.open||b.fail||(b.handshaking=!0,b.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),e!==k.HandshakeType.hello_request&&e!==k.HandshakeType.certificate_verify&&e!==k.HandshakeType.finished&&(b.session.md5.update(h),b.session.sha1.update(h)),W[b.entity][b.expect][e](b,c,g)):
634 k.handleUnexpected(b,c)};k.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};k.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===k.HeartbeatMessageType.heartbeat_request){if(b.handshaking||g>d.length)return b.process();k.queue(b,k.createRecord(b,{type:k.ContentType.heartbeat,data:k.createHeartbeat(k.HeartbeatMessageType.heartbeat_response,d)}));k.flush(b)}else if(e===k.HeartbeatMessageType.heartbeat_response){if(d!==
632 -b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var h=1,q=2,r=3,C=4,B=5,z=6,I=7,F=8,E=1,y=2,D=3,A=4,G=5,L=6,u=k.handleUnexpected,O=k.handleChangeCipherSpec,R=k.handleAlert,P=k.handleHandshake,Y=k.handleApplicationData,N=k.handleHeartbeat,X=[];X[k.ConnectionEnd.client]=[[u,R,P,u,N],[u,R,P,u,N],[u,R,P,u,N],[u,R,P,u,N],[u,R,P,u,N],[O,R,u,u,N],[u,R,P,u,N],[u,R,P,Y,N],[u,R,P,u,N]];X[k.ConnectionEnd.server]=[[u,R,P,u,N],[u,R,
635 +b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var h=1,r=2,q=3,C=4,B=5,y=6,I=7,F=8,E=1,z=2,D=3,A=4,G=5,L=6,u=k.handleUnexpected,O=k.handleChangeCipherSpec,R=k.handleAlert,P=k.handleHandshake,Y=k.handleApplicationData,N=k.handleHeartbeat,X=[];X[k.ConnectionEnd.client]=[[u,R,P,u,N],[u,R,P,u,N],[u,R,P,u,N],[u,R,P,u,N],[u,R,P,u,N],[O,R,u,u,N],[u,R,P,u,N],[u,R,P,Y,N],[u,R,P,u,N]];X[k.ConnectionEnd.server]=[[u,R,P,u,N],[u,R,
636 P,u,N],[u,R,P,u,N],[u,R,P,u,N],[O,R,u,u,N],[u,R,P,u,N],[u,R,P,Y,N],[u,R,P,u,N]];var O=k.handleHelloRequest,R=k.handleCertificate,P=k.handleServerKeyExchange,Y=k.handleCertificateRequest,N=k.handleServerHelloDone,T=k.handleFinished,W=[];W[k.ConnectionEnd.client]=[[u,u,k.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[O,u,u,u,u,u,u,u,u,u,u,R,P,Y,N,u,u,u,u,u,u],[O,u,u,u,u,u,u,u,u,u,u,u,P,Y,N,u,u,u,u,u,u],[O,u,u,u,u,u,u,u,u,u,u,u,u,Y,N,u,u,u,u,u,u],[O,u,u,u,u,u,u,u,u,u,u,u,u,u,N,u,u,u,u,u,u],
637 [O,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[O,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,T],[O,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[O,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];W[k.ConnectionEnd.server]=[[u,k.handleClientHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,R,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,k.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,k.handleCertificateVerify,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,
638 u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,T],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];k.generateKeys=function(a,b){var d=b.client_random+b.server_random;a.session.resuming||(b.master_secret=c(b.pre_master_secret,"master secret",d,48).bytes(),b.pre_master_secret=null);var d=b.server_random+b.client_random,e=2*b.mac_key_length+2*b.enc_key_length,h=a.version.major===k.Versions.TLS_1_0.major&&a.version.minor===k.Versions.TLS_1_0.minor;h&&(e+=2*b.fixed_iv_length);d=
@@ -638,11 +641,11 @@ cipherState:null,cipherFunction:function(a){return!0},compressionState:null,comp
641 a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_record_mac}});return!a.fail};g.write.update=function(a,b){g.write.compressFunction(a,b,g.write)?g.write.cipherFunction(b,g.write)||a.error(a,{message:"Could not encrypt record.",send:!1,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}});
642 return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=k.generateKeys(a,c),g.read.macKey=b?c.keys.server_write_MAC_key:c.keys.client_write_MAC_key,g.write.macKey=b?c.keys.client_write_MAC_key:c.keys.server_write_MAC_key,a.session.cipherSuite.initConnectionState(g,a,c),c.compression_algorithm){case k.CompressionMethod.none:break;case k.CompressionMethod.deflate:g.read.compressFunction=e;g.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm.");
643 }return g};k.createRandom=function(){var b=new Date,b=+b+6E4*b.getTimezoneOffset(),c=a.util.createBuffer();c.putInt32(b);c.putBytes(a.random.getBytes(28));return c};k.createRecord=function(a,b){return b.data?{type:b.type,version:{major:a.version.major,minor:a.version.minor},length:b.data.length(),fragment:b.data}:null};k.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return k.createRecord(b,{type:k.ContentType.alert,data:d})};k.createClientHello=
641 -function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d<b.cipherSuites.length;++d){var e=b.cipherSuites[d];c.putByte(e.id[0]);c.putByte(e.id[1])}var g=c.length(),d=a.util.createBuffer();d.putByte(k.CompressionMethod.none);var h=d.length(),e=a.util.createBuffer();if(b.virtualHost){var l=a.util.createBuffer();l.putByte(0);l.putByte(0);var n=a.util.createBuffer();n.putByte(0);p(n,2,a.util.createBuffer(b.virtualHost));var r=a.util.createBuffer();
642 -p(r,2,n);p(l,2,r);e.putBuffer(l)}l=e.length();0<l&&(l+=2);n=b.session.id;g=n.length+1+2+4+28+2+g+1+h+l;h=a.util.createBuffer();h.putByte(k.HandshakeType.client_hello);h.putInt24(g);h.putByte(b.version.major);h.putByte(b.version.minor);h.putBytes(b.session.sp.client_random);p(h,1,a.util.createBuffer(n));p(h,2,c);p(h,1,d);0<l&&p(h,2,e);return h};k.createServerHello=function(b){var c=b.session.id,d=c.length+1+2+4+28+2+1,e=a.util.createBuffer();e.putByte(k.HandshakeType.server_hello);e.putInt24(d);e.putByte(b.version.major);
644 +function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d<b.cipherSuites.length;++d){var e=b.cipherSuites[d];c.putByte(e.id[0]);c.putByte(e.id[1])}var g=c.length(),d=a.util.createBuffer();d.putByte(k.CompressionMethod.none);var h=d.length(),e=a.util.createBuffer();if(b.virtualHost){var l=a.util.createBuffer();l.putByte(0);l.putByte(0);var n=a.util.createBuffer();n.putByte(0);p(n,2,a.util.createBuffer(b.virtualHost));var q=a.util.createBuffer();
645 +p(q,2,n);p(l,2,q);e.putBuffer(l)}l=e.length();0<l&&(l+=2);n=b.session.id;g=n.length+1+2+4+28+2+g+1+h+l;h=a.util.createBuffer();h.putByte(k.HandshakeType.client_hello);h.putInt24(g);h.putByte(b.version.major);h.putByte(b.version.minor);h.putBytes(b.session.sp.client_random);p(h,1,a.util.createBuffer(n));p(h,2,c);p(h,1,d);0<l&&p(h,2,e);return h};k.createServerHello=function(b){var c=b.session.id,d=c.length+1+2+4+28+2+1,e=a.util.createBuffer();e.putByte(k.HandshakeType.server_hello);e.putInt24(d);e.putByte(b.version.major);
646 e.putByte(b.version.minor);e.putBytes(b.session.sp.server_random);p(e,1,a.util.createBuffer(c));e.putByte(b.session.cipherSuite.id[0]);e.putByte(b.session.cipherSuite.id[1]);e.putByte(b.session.compressionMethod);return e};k.createCertificate=function(b){var c=b.entity===k.ConnectionEnd.client,d=null;b.getCertificate&&(d=b.getCertificate(b,c?b.session.certificateRequest:b.session.extensions.server_name.serverNameList));var e=a.util.createBuffer();if(null!==d)try{a.util.isArray(d)||(d=[d]);for(var g=
644 -null,h=0;h<d.length;++h){var l=a.pem.decode(d[h])[0];if("CERTIFICATE"!==l.type&&"X509 CERTIFICATE"!==l.type&&"TRUSTED CERTIFICATE"!==l.type){var n=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');n.headerType=l.type;throw n;}if(l.procType&&"ENCRYPTED"===l.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");var r=a.util.createBuffer(l.body);null===g&&(g=a.asn1.fromDer(r.bytes(),!1));
645 -var q=a.util.createBuffer();p(q,3,r);e.putBuffer(q)}d=a.pki.certificateFromAsn1(g);c?b.session.clientCertificate=d:b.session.serverCertificate=d}catch(u){return b.error(b,{message:"Could not send certificate list.",cause:u,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}b=3+e.length();c=a.util.createBuffer();c.putByte(k.HandshakeType.certificate);c.putInt24(b);p(c,3,e);return c};k.createClientKeyExchange=function(b){var c=a.util.createBuffer();c.putByte(b.session.clientHelloVersion.major);
647 +null,h=0;h<d.length;++h){var l=a.pem.decode(d[h])[0];if("CERTIFICATE"!==l.type&&"X509 CERTIFICATE"!==l.type&&"TRUSTED CERTIFICATE"!==l.type){var n=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');n.headerType=l.type;throw n;}if(l.procType&&"ENCRYPTED"===l.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");var q=a.util.createBuffer(l.body);null===g&&(g=a.asn1.fromDer(q.bytes(),!1));
648 +var r=a.util.createBuffer();p(r,3,q);e.putBuffer(r)}d=a.pki.certificateFromAsn1(g);c?b.session.clientCertificate=d:b.session.serverCertificate=d}catch(u){return b.error(b,{message:"Could not send certificate list.",cause:u,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}b=3+e.length();c=a.util.createBuffer();c.putByte(k.HandshakeType.certificate);c.putInt24(b);p(c,3,e);return c};k.createClientKeyExchange=function(b){var c=a.util.createBuffer();c.putByte(b.session.clientHelloVersion.major);
649 c.putByte(b.session.clientHelloVersion.minor);c.putBytes(a.random.getBytes(46));var d=b.session.sp;d.pre_master_secret=c.getBytes();c=b.session.serverCertificate.publicKey.encrypt(d.pre_master_secret);b=c.length+2;d=a.util.createBuffer();d.putByte(k.HandshakeType.client_key_exchange);d.putInt24(b);d.putInt16(c.length);d.putBytes(c);return d};k.createServerKeyExchange=function(b){return a.util.createBuffer()};k.getClientSignature=function(b,c){var d=a.util.createBuffer();d.putBuffer(b.session.md5.digest());
650 d.putBuffer(b.session.sha1.digest());d=d.getBytes();b.getSignature=b.getSignature||function(b,c,d){var e=null;if(b.getPrivateKey)try{e=b.getPrivateKey(b,b.session.clientCertificate),e=a.pki.privateKeyFromPem(e)}catch(g){b.error(b,{message:"Could not get private key.",cause:g,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}})}null===e?b.error(b,{message:"No private key set.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}}):
651 c=e.sign(c,null);d(b,c)};b.getSignature(b,d,c)};k.createCertificateVerify=function(b,c){var d=c.length+2,e=a.util.createBuffer();e.putByte(k.HandshakeType.certificate_verify);e.putInt24(d);e.putInt16(c.length);e.putBytes(c);return e};k.createCertificateRequest=function(b){var c=a.util.createBuffer();c.putByte(1);var d=a.util.createBuffer(),e;for(e in b.caStore.certs){var g=a.pki.distinguishedNameToAsn1(b.caStore.certs[e].subject);d.putBuffer(a.asn1.toDer(g))}b=1+c.length()+2+d.length();e=a.util.createBuffer();
@@ -665,110 +668,110 @@ alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unexpected_mess
668 b.bytes());"undefined"===typeof c&&(c=b.length);h.expectedHeartbeatPayload=b;k.queue(h,k.createRecord(h,{type:k.ContentType.heartbeat,data:k.createHeartbeat(k.HeartbeatMessageType.heartbeat_request,b,c)}));return k.flush(h)};h.close=function(a){if(!h.fail&&h.sessionCache&&h.session){var b={id:h.session.id,version:h.session.version,sp:h.session.sp};b.sp.keys=null;h.sessionCache.setSession(b.id,b)}if(h.open){h.open=!1;h.input.clear();if(h.isConnected||h.handshaking)h.isConnected=h.handshaking=!1,k.queue(h,
669 k.createAlert(h,{level:k.Alert.Level.warning,description:k.Alert.Description.close_notify})),k.flush(h);h.closed(h)}h.reset(a)};return h};a.tls=a.tls||{};for(var V in k)"function"!==typeof k[V]&&(a.tls[V]=k[V]);a.tls.prf_tls1=c;a.tls.hmac_sha1=function(b,c,d){var e=a.hmac.create();e.start("SHA1",b);b=a.util.createBuffer();b.putInt32(c[0]);b.putInt32(c[1]);b.putByte(d.type);b.putByte(d.version.major);b.putByte(d.version.minor);b.putInt16(d.length);b.putBytes(d.fragment.bytes());e.update(b.getBytes());
670 return e.digest().getBytes()};a.tls.createSessionCache=k.createSessionCache;a.tls.createConnection=k.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.tls)return c.tls;c.defined.tls=!0;for(var g=0;g<e.length;++g)e[g](c);return c.tls}},
668 -q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/tls","require module ./asn1 ./hmac ./md ./pem ./pki ./random ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,e,g){e=e.entity===a.tls.ConnectionEnd.client;b.read.cipherState={init:!1,cipher:a.cipher.createDecipher("AES-CBC",
671 +r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/tls","require module ./asn1 ./hmac ./md ./pem ./pki ./random ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,e,g){e=e.entity===a.tls.ConnectionEnd.client;b.read.cipherState={init:!1,cipher:a.cipher.createDecipher("AES-CBC",
672 e?g.keys.server_write_key:g.keys.client_write_key),iv:e?g.keys.server_write_IV:g.keys.client_write_IV};b.write.cipherState={init:!1,cipher:a.cipher.createCipher("AES-CBC",e?g.keys.client_write_key:g.keys.server_write_key),iv:e?g.keys.client_write_IV:g.keys.server_write_IV};b.read.cipherFunction=p;b.write.cipherFunction=d;b.read.macLength=b.write.macLength=g.mac_length;b.read.macFunction=b.write.macFunction=k.hmac_sha1}function d(b,c){var g=!1,h=c.macFunction(c.macKey,c.sequenceNumber,b);b.fragment.putBytes(h);
673 c.updateSequenceNumber();h=b.version.minor===k.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:a.random.getBytesSync(16);c.cipherState.init=!0;var n=c.cipherState.cipher;n.start({iv:h});b.version.minor>=k.Versions.TLS_1_1.minor&&n.output.putBytes(h);n.update(b.fragment);n.finish(e)&&(b.fragment=n.output,b.length=b.fragment.length(),g=!0);return g}function e(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function n(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1-
671 -d;e<c-1;++e)a=a&&b.at(e)==d;a&&b.truncate(d+1)}return a}function p(b,c){var d=!1;++h;d=b.version.minor===k.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:b.fragment.getBytes(16);c.cipherState.init=!0;var e=c.cipherState.cipher;e.start({iv:d});e.update(b.fragment);var d=e.finish(n),g=c.macLength,l=a.random.getBytesSync(g),q=e.output.length();q>=g?(b.fragment=e.output.getBytes(q-g),l=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length=
672 -b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;q=a.hmac.create();q.start("SHA1",e);q.update(l);l=q.digest().getBytes();q.start(null,null);q.update(g);g=q.digest().getBytes();return l===g&&d}var k=a.tls;k.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=k.BulkCipherAlgorithm.aes;a.cipher_type=k.CipherType.block;a.enc_key_length=16;a.block_length=16;
674 +d;e<c-1;++e)a=a&&b.at(e)==d;a&&b.truncate(d+1)}return a}function p(b,c){var d=!1;++h;d=b.version.minor===k.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:b.fragment.getBytes(16);c.cipherState.init=!0;var e=c.cipherState.cipher;e.start({iv:d});e.update(b.fragment);var d=e.finish(n),g=c.macLength,l=a.random.getBytesSync(g),r=e.output.length();r>=g?(b.fragment=e.output.getBytes(r-g),l=e.output.getBytes(g)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length=
675 +b.fragment.length();g=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;r=a.hmac.create();r.start("SHA1",e);r.update(l);l=r.digest().getBytes();r.start(null,null);r.update(g);g=r.digest().getBytes();return l===g&&d}var k=a.tls;k.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=k.BulkCipherAlgorithm.aes;a.cipher_type=k.CipherType.block;a.enc_key_length=16;a.block_length=16;
676 a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=k.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};k.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=k.BulkCipherAlgorithm.aes;a.cipher_type=k.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=k.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=
674 -20},initConnectionState:c};var h=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aesCipherSuites)return c.aesCipherSuites;c.defined.aesCipherSuites=!0;for(var g=0;g<e.length;++g)e[g](c);return c.aesCipherSuites}},q=a;a=function(b,c){n="string"===
675 -typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aesCipherSuites",["require","module","./aes","./tls"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.debug=a.debug||{};a.debug.storage={};a.debug.get=function(b,c){var d;"undefined"===typeof b?d=a.debug.storage:b in a.debug.storage&&(d="undefined"===typeof c?a.debug.storage[b]:
677 +20},initConnectionState:c};var h=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aesCipherSuites)return c.aesCipherSuites;c.defined.aesCipherSuites=!0;for(var g=0;g<e.length;++g)e[g](c);return c.aesCipherSuites}},r=a;a=function(b,c){n="string"===
678 +typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aesCipherSuites",["require","module","./aes","./tls"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.debug=a.debug||{};a.debug.storage={};a.debug.get=function(b,c){var d;"undefined"===typeof b?d=a.debug.storage:b in a.debug.storage&&(d="undefined"===typeof c?a.debug.storage[b]:
679 a.debug.storage[b][c]);return d};a.debug.set=function(b,c,d){b in a.debug.storage||(a.debug.storage[b]={});a.debug.storage[b][c]=d};a.debug.clear=function(b,c){"undefined"===typeof b?a.debug.storage={}:b in a.debug.storage&&("undefined"===typeof c?delete a.debug.storage[b]:delete a.debug.storage[b][c])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=
677 -function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.debug)return c.debug;c.defined.debug=!0;for(var g=0;g<e.length;++g)e[g](c);return c.debug}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/debug",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();
678 -(function(){function b(a){function c(b,d,e,g){b.generate=function(b,c){for(var l=new a.util.ByteBuffer,n=Math.ceil(c/g)+e,p=new a.util.ByteBuffer,q=e;q<n;++q){p.putInt32(q);d.start();d.update(b+p.getBytes());var w=d.digest();l.putBytes(w.getBytes(g))}l.truncate(l.length()-c);return l.getBytes()}}a.kem=a.kem||{};var d=a.jsbn.BigInteger;a.kem.rsa={};a.kem.rsa.create=function(b,c){c=c||{};var e=c.prng||a.random;return{encrypt:function(c,g){var n=Math.ceil(c.n.bitLength()/8),r;do r=(new d(a.util.bytesToHex(e.getBytesSync(n)),
679 -16)).mod(c.n);while(r.equals(d.ZERO));r=a.util.hexToBytes(r.toString(16));n-=r.length;0<n&&(r=a.util.fillString(String.fromCharCode(0),n)+r);n=c.encrypt(r,"NONE");r=b.generate(r,g);return{encapsulation:n,key:r}},decrypt:function(a,c,d){a=a.decrypt(c,"NONE");return b.generate(a,d)}}};a.kem.kdf1=function(a,b){c(this,a,0,b||a.digestLength)};a.kem.kdf2=function(a,b){c(this,a,1,b||a.digestLength)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
680 -typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.kem)return c.kem;c.defined.kem=!0;for(var g=0;g<e.length;++g)e[g](c);return c.kem}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/kem",["require","module","./util","./random",
680 +function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.debug)return c.debug;c.defined.debug=!0;for(var g=0;g<e.length;++g)e[g](c);return c.debug}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/debug",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();
681 +(function(){function b(a){function c(b,d,e,g){b.generate=function(b,c){for(var l=new a.util.ByteBuffer,n=Math.ceil(c/g)+e,p=new a.util.ByteBuffer,r=e;r<n;++r){p.putInt32(r);d.start();d.update(b+p.getBytes());var w=d.digest();l.putBytes(w.getBytes(g))}l.truncate(l.length()-c);return l.getBytes()}}a.kem=a.kem||{};var d=a.jsbn.BigInteger;a.kem.rsa={};a.kem.rsa.create=function(b,c){c=c||{};var e=c.prng||a.random;return{encrypt:function(c,g){var n=Math.ceil(c.n.bitLength()/8),q;do q=(new d(a.util.bytesToHex(e.getBytesSync(n)),
682 +16)).mod(c.n);while(q.equals(d.ZERO));q=a.util.hexToBytes(q.toString(16));n-=q.length;0<n&&(q=a.util.fillString(String.fromCharCode(0),n)+q);n=c.encrypt(q,"NONE");q=b.generate(q,g);return{encapsulation:n,key:q}},decrypt:function(a,c,d){a=a.decrypt(c,"NONE");return b.generate(a,d)}}};a.kem.kdf1=function(a,b){c(this,a,0,b||a.digestLength)};a.kem.kdf2=function(a,b){c(this,a,1,b||a.digestLength)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
683 +typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.kem)return c.kem;c.defined.kem=!0;for(var g=0;g<e.length;++g)e[g](c);return c.kem}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/kem",["require","module","./util","./random",
684 "./jsbn"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.log=a.log||{};a.log.levels="none error warning info debug verbose max".split(" ");var c={},d=[],e=null;a.log.LEVEL_LOCKED=2;a.log.NO_LEVEL_CHECK=4;a.log.INTERPOLATE=8;for(var n=0;n<a.log.levels.length;++n){var p=a.log.levels[n];c[p]={index:n,name:p.toUpperCase()}}a.log.logMessage=function(b){for(var e=c[b.level].index,k=0;k<d.length;++k){var l=d[k];l.flags&a.log.NO_LEVEL_CHECK?l.f(b):e<=c[l.level].index&&
685 l.f(l,b)}};a.log.prepareStandard=function(a){"standard"in a||(a.standard=c[a.level].name+" ["+a.category+"] "+a.message)};a.log.prepareFull=function(b){if(!("full"in b)){var c=[b.message],c=c.concat([]);b.full=a.util.format.apply(this,c)}};a.log.prepareStandardFull=function(b){"standardFull"in b||(a.log.prepareStandard(b),b.standardFull=b.standard)};p=["error","warning","info","debug","verbose"];for(n=0;n<p.length;++n)(function(b){a.log[b]=function(c,d){var e=Array.prototype.slice.call(arguments).slice(2);
686 a.log.logMessage({timestamp:new Date,level:b,category:c,message:d,arguments:e})}})(p[n]);a.log.makeLogger=function(b){b={flags:0,f:b};a.log.setLevel(b,"none");return b};a.log.setLevel=function(b,c){var d=!1;if(b&&!(b.flags&a.log.LEVEL_LOCKED))for(var e=0;e<a.log.levels.length;++e)if(c==a.log.levels[e]){b.level=c;d=!0;break}return d};a.log.lock=function(b,c){b.flags="undefined"===typeof c||c?b.flags|a.log.LEVEL_LOCKED:b.flags&~a.log.LEVEL_LOCKED};a.log.addLogger=function(a){d.push(a)};if("undefined"!==
687 typeof console&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)var k={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},e=function(b,c){a.log.prepareStandard(c);var d=k[c.level],e=[c.standard],e=e.concat(c.arguments.slice());d.apply(console,e)};else e=function(b,c){a.log.prepareStandardFull(c);console.log(c.standardFull)};e=a.log.makeLogger(e);a.log.setLevel(e,"debug");a.log.addLogger(e)}else console={log:function(){}};
688 null!==e&&(n=a.util.getQueryVariables(),"console.level"in n&&a.log.setLevel(e,n["console.level"].slice(-1)[0]),"console.lock"in n&&"true"==n["console.lock"].slice(-1)[0]&&a.log.lock(e));a.log.consoleLogger=e}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.log)return c.log;
686 -c.defined.log=!0;for(var g=0;g<e.length;++g)e[g](c);return c.log}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/log",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){var d={},e=[];if(!r.validate(b,C.asn1.recipientInfoValidator,d,e))throw b=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo."),
687 -b.errors=e,b;return{version:d.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(d.issuer),serialNumber:a.util.createBuffer(d.serial).toHex(),encryptedContent:{algorithm:r.derToOid(d.encAlgorithm),parameter:d.encParameter.value,content:d.encKey}}}function d(b){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),
688 -r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.encryptedContent.algorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.encryptedContent.content)])}function e(a){for(var b=[],c=0;c<a.length;++c)b.push(d(a[c]));return b}function n(b){var c=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,
689 -r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.digestAlgorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])]);b.authenticatedAttributesAsn1&&c.value.push(b.authenticatedAttributesAsn1);c.value.push(r.create(r.Class.UNIVERSAL,
690 -r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.signatureAlgorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]));c.value.push(r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.signature));if(0<b.unauthenticatedAttributes.length){for(var d=r.create(r.Class.CONTEXT_SPECIFIC,1,!0,[]),e=0;e<b.unauthenticatedAttributes.length;++e)d.values.push(p(b.unauthenticatedAttributes[e]));c.value.push(d)}return c}function p(b){var c;if(b.type===a.pki.oids.contentType)c=
691 -r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.value).getBytes());else if(b.type===a.pki.oids.messageDigest)c=r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.value.bytes());else if(b.type===a.pki.oids.signingTime){c=new Date("Jan 1, 1950 00:00:00Z");var d=new Date("Jan 1, 2050 00:00:00Z"),e=b.value;if("string"===typeof e)var g=Date.parse(e),e=isNaN(g)?13===e.length?r.utcTimeToDate(e):r.generalizedTimeToDate(e):new Date(g);c=e>=c&&e<d?r.create(r.Class.UNIVERSAL,r.Type.UTCTIME,!1,r.dateToUtcTime(e)):
692 -r.create(r.Class.UNIVERSAL,r.Type.GENERALIZEDTIME,!1,r.dateToGeneralizedTime(e))}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.type).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[c])])}function k(b){return[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.pki.oids.data).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.algorithm).getBytes()),r.create(r.Class.UNIVERSAL,
693 -r.Type.OCTETSTRING,!1,b.parameter.getBytes())]),r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.content.getBytes())])]}function h(b,c,d){var e={};if(!r.validate(c,d,e,[]))throw b=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message."),b.errors=b,b;if(r.derToOid(e.contentType)!==a.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(e.encryptedContent){c="";if(a.util.isArray(e.encryptedContent))for(d=
694 -0;d<e.encryptedContent.length;++d){if(e.encryptedContent[d].type!==r.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");c+=e.encryptedContent[d].value}else c=e.encryptedContent;b.encryptedContent={algorithm:r.derToOid(e.encAlgorithm),parameter:a.util.createBuffer(e.encParameter.value),content:a.util.createBuffer(c)}}if(e.content){c="";if(a.util.isArray(e.content))for(d=0;d<e.content.length;++d){if(e.content[d].type!==r.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");
695 -c+=e.content[d].value}else c=e.content;b.content=a.util.createBuffer(c)}b.version=e.version.charCodeAt(0);return b.rawCapture=e}function q(b){if(void 0===b.encryptedContent.key)throw Error("Symmetric key not available.");if(void 0===b.content){var c;switch(b.encryptedContent.algorithm){case a.pki.oids["aes128-CBC"]:case a.pki.oids["aes192-CBC"]:case a.pki.oids["aes256-CBC"]:c=a.aes.createDecryptionCipher(b.encryptedContent.key);break;case a.pki.oids.desCBC:case a.pki.oids["des-EDE3-CBC"]:c=a.des.createDecryptionCipher(b.encryptedContent.key);
696 -break;default:throw Error("Unsupported symmetric cipher, OID "+b.encryptedContent.algorithm);}c.start(b.encryptedContent.parameter);c.update(b.encryptedContent.content);if(!c.finish())throw Error("Symmetric decryption failed.");b.content=c.output}}var r=a.asn1,C=a.pkcs7=a.pkcs7||{};C.messageFromPem=function(b){b=a.pem.decode(b)[0];if("PKCS7"!==b.type){var c=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===
697 -b.procType.type)throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");b=r.fromDer(b.body);return C.messageFromAsn1(b)};C.messageToPem=function(b,c){var d={type:"PKCS7",body:r.toDer(b.toAsn1()).getBytes()};return a.pem.encode(d,{maxline:c})};C.messageFromAsn1=function(b){var c={},d=[];if(!r.validate(b,C.asn1.contentInfoValidator,c,d))throw c=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo."),c.errors=d,c;d=r.derToOid(c.contentType);switch(d){case a.pki.oids.envelopedData:d=
689 +c.defined.log=!0;for(var g=0;g<e.length;++g)e[g](c);return c.log}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/log",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){var d={},e=[];if(!q.validate(b,C.asn1.recipientInfoValidator,d,e))throw b=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo."),
690 +b.errors=e,b;return{version:d.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(d.issuer),serialNumber:a.util.createBuffer(d.serial).toHex(),encryptedContent:{algorithm:q.derToOid(d.encAlgorithm),parameter:d.encParameter.value,content:d.encKey}}}function d(b){return q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.INTEGER,!1,q.integerToDer(b.version).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),
691 +q.create(q.Class.UNIVERSAL,q.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(b.encryptedContent.algorithm).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.NULL,!1,"")]),q.create(q.Class.UNIVERSAL,q.Type.OCTETSTRING,!1,b.encryptedContent.content)])}function e(a){for(var b=[],c=0;c<a.length;++c)b.push(d(a[c]));return b}function n(b){var c=q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,
692 +q.Type.INTEGER,!1,q.integerToDer(b.version).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),q.create(q.Class.UNIVERSAL,q.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(b.digestAlgorithm).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.NULL,!1,"")])]);b.authenticatedAttributesAsn1&&c.value.push(b.authenticatedAttributesAsn1);c.value.push(q.create(q.Class.UNIVERSAL,
693 +q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(b.signatureAlgorithm).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.NULL,!1,"")]));c.value.push(q.create(q.Class.UNIVERSAL,q.Type.OCTETSTRING,!1,b.signature));if(0<b.unauthenticatedAttributes.length){for(var d=q.create(q.Class.CONTEXT_SPECIFIC,1,!0,[]),e=0;e<b.unauthenticatedAttributes.length;++e)d.values.push(p(b.unauthenticatedAttributes[e]));c.value.push(d)}return c}function p(b){var c;if(b.type===a.pki.oids.contentType)c=
694 +q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(b.value).getBytes());else if(b.type===a.pki.oids.messageDigest)c=q.create(q.Class.UNIVERSAL,q.Type.OCTETSTRING,!1,b.value.bytes());else if(b.type===a.pki.oids.signingTime){c=new Date("Jan 1, 1950 00:00:00Z");var d=new Date("Jan 1, 2050 00:00:00Z"),e=b.value;if("string"===typeof e)var g=Date.parse(e),e=isNaN(g)?13===e.length?q.utcTimeToDate(e):q.generalizedTimeToDate(e):new Date(g);c=e>=c&&e<d?q.create(q.Class.UNIVERSAL,q.Type.UTCTIME,!1,q.dateToUtcTime(e)):
695 +q.create(q.Class.UNIVERSAL,q.Type.GENERALIZEDTIME,!1,q.dateToGeneralizedTime(e))}return q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(b.type).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.SET,!0,[c])])}function k(b){return[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(a.pki.oids.data).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(b.algorithm).getBytes()),q.create(q.Class.UNIVERSAL,
696 +q.Type.OCTETSTRING,!1,b.parameter.getBytes())]),q.create(q.Class.CONTEXT_SPECIFIC,0,!0,[q.create(q.Class.UNIVERSAL,q.Type.OCTETSTRING,!1,b.content.getBytes())])]}function h(b,c,d){var e={};if(!q.validate(c,d,e,[]))throw b=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message."),b.errors=b,b;if(q.derToOid(e.contentType)!==a.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(e.encryptedContent){c="";if(a.util.isArray(e.encryptedContent))for(d=
697 +0;d<e.encryptedContent.length;++d){if(e.encryptedContent[d].type!==q.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");c+=e.encryptedContent[d].value}else c=e.encryptedContent;b.encryptedContent={algorithm:q.derToOid(e.encAlgorithm),parameter:a.util.createBuffer(e.encParameter.value),content:a.util.createBuffer(c)}}if(e.content){c="";if(a.util.isArray(e.content))for(d=0;d<e.content.length;++d){if(e.content[d].type!==q.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");
698 +c+=e.content[d].value}else c=e.content;b.content=a.util.createBuffer(c)}b.version=e.version.charCodeAt(0);return b.rawCapture=e}function r(b){if(void 0===b.encryptedContent.key)throw Error("Symmetric key not available.");if(void 0===b.content){var c;switch(b.encryptedContent.algorithm){case a.pki.oids["aes128-CBC"]:case a.pki.oids["aes192-CBC"]:case a.pki.oids["aes256-CBC"]:c=a.aes.createDecryptionCipher(b.encryptedContent.key);break;case a.pki.oids.desCBC:case a.pki.oids["des-EDE3-CBC"]:c=a.des.createDecryptionCipher(b.encryptedContent.key);
699 +break;default:throw Error("Unsupported symmetric cipher, OID "+b.encryptedContent.algorithm);}c.start(b.encryptedContent.parameter);c.update(b.encryptedContent.content);if(!c.finish())throw Error("Symmetric decryption failed.");b.content=c.output}}var q=a.asn1,C=a.pkcs7=a.pkcs7||{};C.messageFromPem=function(b){b=a.pem.decode(b)[0];if("PKCS7"!==b.type){var c=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===
700 +b.procType.type)throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");b=q.fromDer(b.body);return C.messageFromAsn1(b)};C.messageToPem=function(b,c){var d={type:"PKCS7",body:q.toDer(b.toAsn1()).getBytes()};return a.pem.encode(d,{maxline:c})};C.messageFromAsn1=function(b){var c={},d=[];if(!q.validate(b,C.asn1.contentInfoValidator,c,d))throw c=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo."),c.errors=d,c;d=q.derToOid(c.contentType);switch(d){case a.pki.oids.envelopedData:d=
701 C.createEnvelopedData();break;case a.pki.oids.encryptedData:d=C.createEncryptedData();break;case a.pki.oids.signedData:d=C.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+d+" is not (yet) supported.");}d.fromAsn1(c.content.value[0]);return d};C.createSignedData=function(){var b=null;return b={type:a.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(c){h(b,
699 -c,C.asn1.signedDataValidator);b.certificates=[];b.crls=[];b.digestAlgorithmIdentifiers=[];b.contentInfo=null;b.signerInfos=[];c=b.rawCapture.certificates.value;for(var d=0;d<c.length;++d)b.certificates.push(a.pki.certificateFromAsn1(c[d]))},toAsn1:function(){b.contentInfo||b.sign();for(var c=[],d=0;d<b.certificates.length;++d)c.push(a.pki.certificateToAsn1(b.certificates[d]));var d=[],e=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,
700 -r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,b.digestAlgorithmIdentifiers),b.contentInfo])]);0<c.length&&e.value[0].value.push(r.create(r.Class.CONTEXT_SPECIFIC,0,!0,c));0<d.length&&e.value[0].value.push(r.create(r.Class.CONTEXT_SPECIFIC,1,!0,d));e.value[0].value.push(r.create(r.Class.UNIVERSAL,r.Type.SET,!0,b.signerInfos));return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.type).getBytes()),
702 +c,C.asn1.signedDataValidator);b.certificates=[];b.crls=[];b.digestAlgorithmIdentifiers=[];b.contentInfo=null;b.signerInfos=[];c=b.rawCapture.certificates.value;for(var d=0;d<c.length;++d)b.certificates.push(a.pki.certificateFromAsn1(c[d]))},toAsn1:function(){b.contentInfo||b.sign();for(var c=[],d=0;d<b.certificates.length;++d)c.push(a.pki.certificateToAsn1(b.certificates[d]));var d=[],e=q.create(q.Class.CONTEXT_SPECIFIC,0,!0,[q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,
703 +q.Type.INTEGER,!1,q.integerToDer(b.version).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.SET,!0,b.digestAlgorithmIdentifiers),b.contentInfo])]);0<c.length&&e.value[0].value.push(q.create(q.Class.CONTEXT_SPECIFIC,0,!0,c));0<d.length&&e.value[0].value.push(q.create(q.Class.CONTEXT_SPECIFIC,1,!0,d));e.value[0].value.push(q.create(q.Class.UNIVERSAL,q.Type.SET,!0,b.signerInfos));return q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(b.type).getBytes()),
704 e])},addSigner:function(c){var d=c.issuer,e=c.serialNumber;c.certificate&&(e=c.certificate,"string"===typeof e&&(e=a.pki.certificateFromPem(e)),d=e.issuer.attributes,e=e.serialNumber);var g=c.key;if(!g)throw Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof g&&(g=a.pki.privateKeyFromPem(g));var h=c.digestAlgorithm||a.pki.oids.sha1;switch(h){case a.pki.oids.sha1:case a.pki.oids.sha256:case a.pki.oids.sha384:case a.pki.oids.sha512:case a.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+
702 -h);}c=c.authenticatedAttributes||[];if(0<c.length){for(var k=!1,l=!1,n=0;n<c.length;++n){var r=c[n];if(!k&&r.type===a.pki.oids.contentType){if(k=!0,l)break}else if(!l&&r.type===a.pki.oids.messageDigest&&(l=!0,k))break}if(!k||!l)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.");}b.signers.push({key:g,version:1,issuer:d,serialNumber:e,digestAlgorithm:h,
703 -signatureAlgorithm:a.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(){if("object"!==typeof b.content||null===b.contentInfo)if(b.contentInfo=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.pki.oids.data).getBytes())]),"content"in b){var c;b.content instanceof a.util.ByteBuffer?c=b.content.bytes():"string"===typeof b.content&&(c=a.util.encodeUtf8(b.content));b.contentInfo.value.push(r.create(r.Class.CONTEXT_SPECIFIC,
704 -0,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,c)]))}if(0!==b.signers.length){c={};for(var d=0;d<b.signers.length;++d){var e=b.signers[d],g=e.digestAlgorithm;g in c||(c[g]=a.md[a.pki.oids[g]].create());e.md=0===e.authenticatedAttributes.length?c[g]:a.md[a.pki.oids[g]].create()}b.digestAlgorithmIdentifiers=[];for(g in c)b.digestAlgorithmIdentifiers.push(r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(g).getBytes()),r.create(r.Class.UNIVERSAL,
705 -r.Type.NULL,!1,"")]));if(2>b.contentInfo.value.length)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var g=r.derToOid(b.contentInfo.value[0].value),d=b.contentInfo.value[1],d=d.value[0],h=r.toDer(d);h.getByte();r.getBerValueLength(h);var h=h.getBytes(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;d<b.signers.length;++d){e=b.signers[d];if(0===e.authenticatedAttributes.length){if(g!==a.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.");
706 -}else{e.authenticatedAttributesAsn1=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[]),l=0;l<e.authenticatedAttributes.length;++l){var q=e.authenticatedAttributes[l];q.type===a.pki.oids.messageDigest?q.value=c[e.digestAlgorithm].digest():q.type!==a.pki.oids.signingTime||q.value||(q.value=k);h.value.push(p(q));e.authenticatedAttributesAsn1.value.push(p(q))}h=r.toDer(h).getBytes();e.md.start().update(h)}e.signature=e.key.sign(e.md,"RSASSA-PKCS1-V1_5")}c=
705 +h);}c=c.authenticatedAttributes||[];if(0<c.length){for(var k=!1,l=!1,n=0;n<c.length;++n){var q=c[n];if(!k&&q.type===a.pki.oids.contentType){if(k=!0,l)break}else if(!l&&q.type===a.pki.oids.messageDigest&&(l=!0,k))break}if(!k||!l)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.");}b.signers.push({key:g,version:1,issuer:d,serialNumber:e,digestAlgorithm:h,
706 +signatureAlgorithm:a.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(){if("object"!==typeof b.content||null===b.contentInfo)if(b.contentInfo=q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(a.pki.oids.data).getBytes())]),"content"in b){var c;b.content instanceof a.util.ByteBuffer?c=b.content.bytes():"string"===typeof b.content&&(c=a.util.encodeUtf8(b.content));b.contentInfo.value.push(q.create(q.Class.CONTEXT_SPECIFIC,
707 +0,!0,[q.create(q.Class.UNIVERSAL,q.Type.OCTETSTRING,!1,c)]))}if(0!==b.signers.length){c={};for(var d=0;d<b.signers.length;++d){var e=b.signers[d],g=e.digestAlgorithm;g in c||(c[g]=a.md[a.pki.oids[g]].create());e.md=0===e.authenticatedAttributes.length?c[g]:a.md[a.pki.oids[g]].create()}b.digestAlgorithmIdentifiers=[];for(g in c)b.digestAlgorithmIdentifiers.push(q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(g).getBytes()),q.create(q.Class.UNIVERSAL,
708 +q.Type.NULL,!1,"")]));if(2>b.contentInfo.value.length)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var g=q.derToOid(b.contentInfo.value[0].value),d=b.contentInfo.value[1],d=d.value[0],h=q.toDer(d);h.getByte();q.getBerValueLength(h);var h=h.getBytes(),k;for(k in c)c[k].start().update(h);k=new Date;for(d=0;d<b.signers.length;++d){e=b.signers[d];if(0===e.authenticatedAttributes.length){if(g!==a.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.");
709 +}else{e.authenticatedAttributesAsn1=q.create(q.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=q.create(q.Class.UNIVERSAL,q.Type.SET,!0,[]),l=0;l<e.authenticatedAttributes.length;++l){var r=e.authenticatedAttributes[l];r.type===a.pki.oids.messageDigest?r.value=c[e.digestAlgorithm].digest():r.type!==a.pki.oids.signingTime||r.value||(r.value=k);h.value.push(p(r));e.authenticatedAttributesAsn1.value.push(p(r))}h=q.toDer(h).getBytes();e.md.start().update(h)}e.signature=e.key.sign(e.md,"RSASSA-PKCS1-V1_5")}c=
710 b;g=b.signers;k=[];for(d=0;d<g.length;++d)k.push(n(g[d]));c.signerInfos=k}},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.");},addCertificate:function(c){"string"===typeof c&&(c=a.pki.certificateFromPem(c));b.certificates.push(c)},addCertificateRevokationList:function(a){throw Error("PKCS#7 CRL support not yet implemented.");}}};C.createEncryptedData=function(){var b=null;return b={type:a.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},
708 -fromAsn1:function(a){h(b,a,C.asn1.encryptedDataValidator)},decrypt:function(a){void 0!==a&&(b.encryptedContent.key=a);q(b)}}};C.createEnvelopedData=function(){var b=null;return b={type:a.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(a){var d=h(b,a,C.asn1.envelopedDataValidator);a=b;for(var d=d.recipientInfos.value,e=[],k=0;k<d.length;++k)e.push(c(d[k]));a.recipients=e},toAsn1:function(){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,
709 -!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.type).getBytes()),r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,e(b.recipients)),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,k(b.encryptedContent))])])])},findRecipient:function(a){for(var c=a.issuer.attributes,d=0;d<b.recipients.length;++d){var e=b.recipients[d],g=e.issuer;if(e.serialNumber===
711 +fromAsn1:function(a){h(b,a,C.asn1.encryptedDataValidator)},decrypt:function(a){void 0!==a&&(b.encryptedContent.key=a);r(b)}}};C.createEnvelopedData=function(){var b=null;return b={type:a.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(a){var d=h(b,a,C.asn1.envelopedDataValidator);a=b;for(var d=d.recipientInfos.value,e=[],k=0;k<d.length;++k)e.push(c(d[k]));a.recipients=e},toAsn1:function(){return q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,
712 +!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(b.type).getBytes()),q.create(q.Class.CONTEXT_SPECIFIC,0,!0,[q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.INTEGER,!1,q.integerToDer(b.version).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.SET,!0,e(b.recipients)),q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,k(b.encryptedContent))])])])},findRecipient:function(a){for(var c=a.issuer.attributes,d=0;d<b.recipients.length;++d){var e=b.recipients[d],g=e.issuer;if(e.serialNumber===
713 a.serialNumber&&g.length===c.length){for(var h=!0,k=0;k<c.length;++k)if(g[k].type!==c[k].type||g[k].value!==c[k].value){h=!1;break}if(h)return e}}return null},decrypt:function(c,d){if(void 0===b.encryptedContent.key&&void 0!==c&&void 0!==d)switch(c.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:case a.pki.oids.desCBC:var e=d.decrypt(c.encryptedContent.content);b.encryptedContent.key=a.util.createBuffer(e);break;default:throw Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);
711 -}q(b)},addRecipient:function(c){b.recipients.push({version:0,issuer:c.issuer.attributes,serialNumber:c.serialNumber,encryptedContent:{algorithm:a.pki.oids.rsaEncryption,key:c.publicKey}})},encrypt:function(c,d){if(void 0===b.encryptedContent.content){d=d||b.encryptedContent.algorithm;c=c||b.encryptedContent.key;var e,g,h;switch(d){case a.pki.oids["aes128-CBC"]:g=e=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes192-CBC"]:e=24;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes256-CBC"]:e=
714 +}r(b)},addRecipient:function(c){b.recipients.push({version:0,issuer:c.issuer.attributes,serialNumber:c.serialNumber,encryptedContent:{algorithm:a.pki.oids.rsaEncryption,key:c.publicKey}})},encrypt:function(c,d){if(void 0===b.encryptedContent.content){d=d||b.encryptedContent.algorithm;c=c||b.encryptedContent.key;var e,g,h;switch(d){case a.pki.oids["aes128-CBC"]:g=e=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes192-CBC"]:e=24;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes256-CBC"]:e=
715 32;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["des-EDE3-CBC"]:e=24;g=8;h=a.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+d);}if(void 0===c)c=a.util.createBuffer(a.random.getBytes(e));else if(c.length()!=e)throw Error("Symmetric key has wrong length; got "+c.length()+" bytes, expected "+e+".");b.encryptedContent.algorithm=d;b.encryptedContent.key=c;b.encryptedContent.parameter=a.util.createBuffer(a.random.getBytes(g));e=h(c);e.start(b.encryptedContent.parameter.copy());
716 e.update(b.content);if(!e.finish())throw Error("Symmetric encryption failed.");b.encryptedContent.content=e.output}for(e=0;e<b.recipients.length;++e)if(g=b.recipients[e],void 0===g.encryptedContent.content)switch(g.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:g.encryptedContent.content=g.encryptedContent.key.encrypt(b.encryptedContent.key.data);break;default:throw Error("Unsupported asymmetric cipher, OID "+g.encryptedContent.algorithm);}}}}}if("function"!==typeof a)if("object"===typeof module&&
714 -module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7)return c.pkcs7;c.defined.pkcs7=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pkcs7}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,
717 +module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7)return c.pkcs7;c.defined.pkcs7=!0;for(var g=0;g<e.length;++g)e[g](c);return c.pkcs7}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,
718 Array.prototype.slice.call(arguments,0))};a("js/pkcs7","require module ./aes ./asn1 ./des ./oids ./pem ./pkcs7asn1 ./random ./util ./x509".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){var e=d.toString(16);"8"<=e[0]&&(e="00"+e);e=a.util.hexToBytes(e);b.putInt32(e.length);b.putBytes(e)}function d(a,b){a.putInt32(b.length);a.putString(b)}function e(){for(var b=a.md.sha1.create(),c=arguments.length,d=0;d<c;++d)b.update(arguments[d]);
716 -return b.digest()}var n=a.ssh=a.ssh||{};n.privateKeyToPutty=function(b,k,h){h=h||"";k=k||"";var n=""===k?"none":"aes256-cbc",r;r="PuTTY-User-Key-File-2: ssh-rsa\r\n"+("Encryption: "+n+"\r\n")+("Comment: "+h+"\r\n");var p=a.util.createBuffer();d(p,"ssh-rsa");c(p,b.e);c(p,b.n);var q=a.util.encode64(p.bytes(),64),v=Math.floor(q.length/66)+1;r+="Public-Lines: "+v+"\r\n";r+=q;q=a.util.createBuffer();c(q,b.d);c(q,b.p);c(q,b.q);c(q,b.qInv);k?(v=q.length()+16-1,v-=v%16,b=e(q.bytes()),b.truncate(b.length()-
717 -v+q.length()),q.putBuffer(b),v=a.util.createBuffer(),v.putBuffer(e("\x00\x00\x00\x00",k)),v.putBuffer(e("\x00\x00\x00\u0001",k)),v=a.aes.createEncryptionCipher(v.truncate(8),"CBC"),v.start(a.util.createBuffer().fillWithByte(0,16)),v.update(q.copy()),v.finish(),v=v.output,v.truncate(16),b=a.util.encode64(v.bytes(),64)):b=a.util.encode64(q.bytes(),64);v=Math.floor(b.length/66)+1;r+="\r\nPrivate-Lines: "+v+"\r\n";r+=b;k=e("putty-private-key-file-mac-key",k);v=a.util.createBuffer();d(v,"ssh-rsa");d(v,
718 -n);d(v,h);v.putInt32(p.length());v.putBuffer(p);v.putInt32(q.length());v.putBuffer(q);h=a.hmac.create();h.start("sha1",k);h.update(v.bytes());return r+="\r\nPrivate-MAC: "+h.digest().toHex()+"\r\n"};n.publicKeyToOpenSSH=function(b,e){e=e||"";var h=a.util.createBuffer();d(h,"ssh-rsa");c(h,b.e);c(h,b.n);return"ssh-rsa "+a.util.encode64(h.bytes())+" "+e};n.privateKeyToOpenSSH=function(b,c){return c?a.pki.encryptRsaPrivateKey(b,c,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(b)};n.getPublicKeyFingerprint=
719 +return b.digest()}var n=a.ssh=a.ssh||{};n.privateKeyToPutty=function(b,k,h){h=h||"";k=k||"";var n=""===k?"none":"aes256-cbc",q;q="PuTTY-User-Key-File-2: ssh-rsa\r\n"+("Encryption: "+n+"\r\n")+("Comment: "+h+"\r\n");var p=a.util.createBuffer();d(p,"ssh-rsa");c(p,b.e);c(p,b.n);var r=a.util.encode64(p.bytes(),64),v=Math.floor(r.length/66)+1;q+="Public-Lines: "+v+"\r\n";q+=r;r=a.util.createBuffer();c(r,b.d);c(r,b.p);c(r,b.q);c(r,b.qInv);k?(v=r.length()+16-1,v-=v%16,b=e(r.bytes()),b.truncate(b.length()-
720 +v+r.length()),r.putBuffer(b),v=a.util.createBuffer(),v.putBuffer(e("\x00\x00\x00\x00",k)),v.putBuffer(e("\x00\x00\x00\u0001",k)),v=a.aes.createEncryptionCipher(v.truncate(8),"CBC"),v.start(a.util.createBuffer().fillWithByte(0,16)),v.update(r.copy()),v.finish(),v=v.output,v.truncate(16),b=a.util.encode64(v.bytes(),64)):b=a.util.encode64(r.bytes(),64);v=Math.floor(b.length/66)+1;q+="\r\nPrivate-Lines: "+v+"\r\n";q+=b;k=e("putty-private-key-file-mac-key",k);v=a.util.createBuffer();d(v,"ssh-rsa");d(v,
721 +n);d(v,h);v.putInt32(p.length());v.putBuffer(p);v.putInt32(r.length());v.putBuffer(r);h=a.hmac.create();h.start("sha1",k);h.update(v.bytes());return q+="\r\nPrivate-MAC: "+h.digest().toHex()+"\r\n"};n.publicKeyToOpenSSH=function(b,e){e=e||"";var h=a.util.createBuffer();d(h,"ssh-rsa");c(h,b.e);c(h,b.n);return"ssh-rsa "+a.util.encode64(h.bytes())+" "+e};n.privateKeyToOpenSSH=function(b,c){return c?a.pki.encryptRsaPrivateKey(b,c,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(b)};n.getPublicKeyFingerprint=
722 function(b,e){e=e||{};var h=e.md||a.md.md5.create(),l=a.util.createBuffer();d(l,"ssh-rsa");c(l,b.e);c(l,b.n);h.start();h.update(l.getBytes());h=h.digest();if("hex"===e.encoding)return h=h.toHex(),e.delimiter?h.match(/.{2}/g).join(e.delimiter):h;if("binary"===e.encoding)return h.getBytes();if(e.encoding)throw Error('Unknown encoding "'+e.encoding+'".');return h}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&
720 -(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.ssh)return c.ssh;c.defined.ssh=!0;for(var g=0;g<e.length;++g)e[g](c);return c.ssh}},q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/ssh","require module ./aes ./hmac ./md5 ./sha1 ./util".split(" "),
723 +(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.ssh)return c.ssh;c.defined.ssh=!0;for(var g=0;g<e.length;++g)e[g](c);return c.ssh}},r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/ssh","require module ./aes ./hmac ./md5 ./sha1 ./util".split(" "),
724 function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c={},d=0;a.debug.set("forge.task","tasks",c);var e={};a.debug.set("forge.task","queues",e);var n={ready:{}};n.ready.stop="ready";n.ready.start="running";n.ready.cancel="done";n.ready.fail="error";n.running={};n.running.stop="ready";n.running.start="running";n.running.block="blocked";n.running.unblock="running";n.running.sleep="sleeping";n.running.wakeup="running";n.running.cancel="done";n.running.fail=
725 "error";n.blocked={};n.blocked.stop="blocked";n.blocked.start="blocked";n.blocked.block="blocked";n.blocked.unblock="blocked";n.blocked.sleep="blocked";n.blocked.wakeup="blocked";n.blocked.cancel="done";n.blocked.fail="error";n.sleeping={};n.sleeping.stop="sleeping";n.sleeping.start="sleeping";n.sleeping.block="sleeping";n.sleeping.unblock="sleeping";n.sleeping.sleep="sleeping";n.sleeping.wakeup="sleeping";n.sleeping.cancel="done";n.sleeping.fail="error";n.done={};n.done.stop="done";n.done.start=
726 "done";n.done.block="done";n.done.unblock="done";n.done.sleep="done";n.done.wakeup="done";n.done.cancel="done";n.done.fail="error";n.error={};n.error.stop="error";n.error.start="error";n.error.block="error";n.error.unblock="error";n.error.sleep="error";n.error.wakeup="error";n.error.cancel="error";n.error.fail="error";var p=function(a){this.id=-1;this.name=a.name||"?";this.parent=a.parent||null;this.run=a.run;this.subtasks=[];this.error=!1;this.state="ready";this.blocks=0;this.userData=this.swapTime=
727 this.timeoutId=null;this.id=d++;c[this.id]=this};p.prototype.debug=function(b){a.log.debug("forge.task",b||"","[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",e)};p.prototype.next=function(a,b){"function"===typeof a&&(b=a,a=this.name);var c=new p({run:b,name:a,parent:this});c.state="running";c.type=this.type;c.successCallback=this.successCallback||null;c.failureCallback=this.failureCallback||null;this.subtasks.push(c);return this};p.prototype.parallel=function(b,c){a.util.isArray(b)&&
728 (c=b,b=this.name);return this.next(b,function(d){d.block(c.length);for(var e=function(b,e){a.task.start({type:b,run:function(a){c[e](a)},success:function(a){d.unblock()},failure:function(a){d.unblock()}})},g=0;g<c.length;g++)e(b+"__parallel-"+d.id+"-"+g,g)})};p.prototype.stop=function(){this.state=n[this.state].stop};p.prototype.start=function(){this.error=!1;this.state=n[this.state].start;"running"===this.state&&(this.start=new Date,this.run(this),h(this,0))};p.prototype.block=function(a){this.blocks+=
729 "undefined"===typeof a?1:a;0<this.blocks&&(this.state=n[this.state].block)};p.prototype.unblock=function(a){this.blocks-="undefined"===typeof a?1:a;0===this.blocks&&"done"!==this.state&&(this.state="running",h(this,0));return this.blocks};p.prototype.sleep=function(a){this.state=n[this.state].sleep;var b=this;this.timeoutId=setTimeout(function(){b.timeoutId=null;b.state="running";h(b,0)},"undefined"===typeof a?0:a)};p.prototype.wait=function(a){a.wait(this)};p.prototype.wakeup=function(){"sleeping"===
727 -this.state&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state="running",h(this,0))};p.prototype.cancel=function(){this.state=n[this.state].cancel;this.permitsNeeded=0;null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null);this.subtasks=[]};p.prototype.fail=function(a){this.error=!0;q(this,!0);if(a)a.error=this.error,a.swapTime=this.swapTime,a.userData=this.userData,h(a,0);else{if(null!==this.parent){for(a=this.parent;null!==a.parent;)a.error=this.error,a.swapTime=this.swapTime,
728 -a.userData=this.userData,a=a.parent;q(a,!0)}this.failureCallback&&this.failureCallback(this)}};var k=function(a){a.error=!1;a.state=n[a.state].start;setTimeout(function(){"running"===a.state&&(a.swapTime=+new Date,a.run(a),h(a,0))},0)},h=function(a,b){var c=30<b||20<+new Date-a.swapTime,d=function(b){b++;if("running"===a.state)if(c&&(a.swapTime=+new Date),0<a.subtasks.length){var d=a.subtasks.shift();d.error=a.error;d.swapTime=a.swapTime;d.userData=a.userData;d.run(d);d.error||h(d,b)}else q(a),a.error||
729 -null===a.parent||(a.parent.error=a.error,a.parent.swapTime=a.swapTime,a.parent.userData=a.userData,h(a.parent,b))};c?setTimeout(d,0):d(b)},q=function(b,d){b.state="done";delete c[b.id];null===b.parent&&(b.type in e?0===e[b.type].length?a.log.error("forge.task","[%s][%s] task queue empty [%s]",b.id,b.name,b.type):e[b.type][0]!==b?a.log.error("forge.task","[%s][%s] task not first in queue [%s]",b.id,b.name,b.type):(e[b.type].shift(),0===e[b.type].length?delete e[b.type]:e[b.type][0].start()):a.log.error("forge.task",
730 +this.state&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state="running",h(this,0))};p.prototype.cancel=function(){this.state=n[this.state].cancel;this.permitsNeeded=0;null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null);this.subtasks=[]};p.prototype.fail=function(a){this.error=!0;r(this,!0);if(a)a.error=this.error,a.swapTime=this.swapTime,a.userData=this.userData,h(a,0);else{if(null!==this.parent){for(a=this.parent;null!==a.parent;)a.error=this.error,a.swapTime=this.swapTime,
731 +a.userData=this.userData,a=a.parent;r(a,!0)}this.failureCallback&&this.failureCallback(this)}};var k=function(a){a.error=!1;a.state=n[a.state].start;setTimeout(function(){"running"===a.state&&(a.swapTime=+new Date,a.run(a),h(a,0))},0)},h=function(a,b){var c=30<b||20<+new Date-a.swapTime,d=function(b){b++;if("running"===a.state)if(c&&(a.swapTime=+new Date),0<a.subtasks.length){var d=a.subtasks.shift();d.error=a.error;d.swapTime=a.swapTime;d.userData=a.userData;d.run(d);d.error||h(d,b)}else r(a),a.error||
732 +null===a.parent||(a.parent.error=a.error,a.parent.swapTime=a.swapTime,a.parent.userData=a.userData,h(a.parent,b))};c?setTimeout(d,0):d(b)},r=function(b,d){b.state="done";delete c[b.id];null===b.parent&&(b.type in e?0===e[b.type].length?a.log.error("forge.task","[%s][%s] task queue empty [%s]",b.id,b.name,b.type):e[b.type][0]!==b?a.log.error("forge.task","[%s][%s] task not first in queue [%s]",b.id,b.name,b.type):(e[b.type].shift(),0===e[b.type].length?delete e[b.type]:e[b.type][0].start()):a.log.error("forge.task",
733 "[%s][%s] task queue missing [%s]",b.id,b.name,b.type),d||(b.error&&b.failureCallback?b.failureCallback(b):!b.error&&b.successCallback&&b.successCallback(b)))};a.task=a.task||{};a.task.start=function(a){var b=new p({run:a.run,name:a.name||"?"});b.type=a.type;b.successCallback=a.success||null;b.failureCallback=a.failure||null;b.type in e?e[a.type].push(b):(e[b.type]=[b],k(b))};a.task.cancel=function(a){a in e&&(e[a]=[e[a][0]])};a.task.createCondition=function(){var a={tasks:{},wait:function(b){b.id in
734 a.tasks||(b.block(),a.tasks[b.id]=b)},notify:function(){var b=a.tasks;a.tasks={};for(var c in b)b[c].unblock()}};return a}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var n,p=function(a,c){c.exports=function(c){var e=n.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.task)return c.task;c.defined.task=!0;for(var g=0;g<e.length;++g)e[g](c);return c.task}},
732 -q=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,q.apply(null,Array.prototype.slice.call(arguments,0));a=q;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/task",["require","module","./debug","./log","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){if("function"!==typeof a)if("object"===typeof module&&module.exports){var b=!0;a=function(a,b){b(c,module)}}else{"undefined"===typeof forge&&(forge={disableNativeCode:!1});
735 +r=a;a=function(b,c){n="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,r.apply(null,Array.prototype.slice.call(arguments,0));a=r;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/task",["require","module","./debug","./log","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){if("function"!==typeof a)if("object"===typeof module&&module.exports){var b=!0;a=function(a,b){b(c,module)}}else{"undefined"===typeof forge&&(forge={disableNativeCode:!1});
736 return}var e,n=function(a,b){b.exports=function(b){var c=e.map(function(b){return a(b)});b=b||{};b.defined=b.defined||{};if(b.defined.forge)return b.forge;b.defined.forge=!0;for(var d=0;d<c.length;++d)c[d](b);return b};b.exports.disableNativeCode=!0;b.exports(b.exports)},p=a;a=function(c,n){e="string"===typeof c?n.slice(2):c.slice(2);if(b)return delete a,p.apply(null,Array.prototype.slice.call(arguments,0));a=p;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/forge","require module ./aes ./aesCipherSuites ./asn1 ./cipher ./cipherModes ./debug ./des ./hmac ./kem ./log ./md ./mgf1 ./pbkdf2 ./pem ./pkcs7 ./pkcs1 ./pkcs12 ./pki ./prime ./prng ./pss ./random ./rc2 ./ssh ./task ./tls ./util".split(" "),
737 function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();return c("js/forge")});function amtcert_linkCertPrivateKey(b,c){for(var a in b){var d=b[a];try{if(0==xxCertPrivateKeys.length)break;for(var e=forge.pki.publicKeyToPem(forge.pki.certificateFromAsn1(forge.asn1.fromDer(d.X509Certificate)).publicKey).substring(60).replace(/(\r\n|\n|\r)/gm,""),n=0;n<c.length;n++)e===c[n].DERKey+"-----END PUBLIC KEY-----"&&(c[n].XCert=d,d.XPrivateKey=c[n])}catch(p){console.log(p)}}}
735 -function amtcert_loadP12File(b,c,a){try{var d=window.forge.util.decode64(btoa(b)),e=window.forge.asn1.fromDer(d),n=window.forge.pkcs12.pkcs12FromAsn1(e,c),p=n.getBags({bagType:window.forge.pki.oids.pkcs8ShroudedKeyBag});console.assert(p[window.forge.pki.oids.pkcs8ShroudedKeyBag]&&0<p[window.forge.pki.oids.pkcs8ShroudedKeyBag].length);var q=p[window.forge.pki.oids.pkcs8ShroudedKeyBag][0].key,m=window.forge.pki.privateKeyToAsn1(q),g=window.forge.pki.wrapRsaPrivateKey(m);window.forge.asn1.toDer(g).getBytes();
736 -var w=n.getBags({bagType:window.forge.pki.oids.certBag})[window.forge.pki.oids.certBag][0].cert.subject.attributes,l=n.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag][0].cert;a(q,w,l);return!0}catch(v){}return!1}function amtcert_signWithCaKey(b,c,a,d,e){c&&null!=c||(c=amtcert_createCertificate(d).key);return amtcert_createCertificate(a,c,b,d,e)}
737 -function amtcert_createCertificate(b,c,a,d,e){var n,p=forge.pki.createCertificate();a?p.publicKey=forge.pki.publicKeyFromPem("-----BEGIN PUBLIC KEY-----"+a+"-----END PUBLIC KEY-----"):(n=forge.pki.rsa.generateKeyPair(2048),p.publicKey=n.publicKey);p.serialNumber=""+Math.floor(1E5*Math.random()+1);p.validity.notBefore=new Date;p.validity.notBefore.setFullYear(p.validity.notBefore.getFullYear()-1);p.validity.notAfter=new Date;p.validity.notAfter.setFullYear(p.validity.notAfter.getFullYear()+30);var q=
738 -[];b.CN&&q.push({name:"commonName",value:b.CN});b.C&&q.push({name:"countryName",value:b.C});b.ST&&q.push({shortName:"ST",value:b.ST});b.O&&q.push({name:"organizationName",value:b.O});p.setSubject(q);c?(b=[],d.CN&&b.push({name:"commonName",value:d.CN}),d.C&&b.push({name:"countryName",value:d.C}),d.ST&&b.push({shortName:"ST",value:d.ST}),d.O&&b.push({name:"organizationName",value:d.O}),p.setIssuer(b)):p.setIssuer(q);void 0==c?p.setExtensions([{name:"basicConstraints",cA:!0},{name:"nsCertType",sslCA:!0,
738 +function amtcert_loadP12File(b,c,a){try{var d=window.forge.util.decode64(btoa(b)),e=window.forge.asn1.fromDer(d),n=window.forge.pkcs12.pkcs12FromAsn1(e,c),p=n.getBags({bagType:window.forge.pki.oids.pkcs8ShroudedKeyBag});console.assert(p[window.forge.pki.oids.pkcs8ShroudedKeyBag]&&0<p[window.forge.pki.oids.pkcs8ShroudedKeyBag].length);var r=p[window.forge.pki.oids.pkcs8ShroudedKeyBag][0].key,m=window.forge.pki.privateKeyToAsn1(r),g=window.forge.pki.wrapRsaPrivateKey(m);window.forge.asn1.toDer(g).getBytes();
739 +var w=n.getBags({bagType:window.forge.pki.oids.certBag})[window.forge.pki.oids.certBag][0].cert.subject.attributes,l=n.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag][0].cert;a(r,w,l);return!0}catch(v){}return!1}function amtcert_signWithCaKey(b,c,a,d,e){c&&null!=c||(c=amtcert_createCertificate(d).key);return amtcert_createCertificate(a,c,b,d,e)}
740 +function amtcert_createCertificate(b,c,a,d,e){var n,p=forge.pki.createCertificate();a?p.publicKey=forge.pki.publicKeyFromPem("-----BEGIN PUBLIC KEY-----"+a+"-----END PUBLIC KEY-----"):(n=forge.pki.rsa.generateKeyPair(2048),p.publicKey=n.publicKey);p.serialNumber=""+Math.floor(1E5*Math.random()+1);p.validity.notBefore=new Date;p.validity.notBefore.setFullYear(p.validity.notBefore.getFullYear()-1);p.validity.notAfter=new Date;p.validity.notAfter.setFullYear(p.validity.notAfter.getFullYear()+30);var r=
741 +[];b.CN&&r.push({name:"commonName",value:b.CN});b.C&&r.push({name:"countryName",value:b.C});b.ST&&r.push({shortName:"ST",value:b.ST});b.O&&r.push({name:"organizationName",value:b.O});p.setSubject(r);c?(b=[],d.CN&&b.push({name:"commonName",value:d.CN}),d.C&&b.push({name:"countryName",value:d.C}),d.ST&&b.push({shortName:"ST",value:d.ST}),d.O&&b.push({name:"organizationName",value:d.O}),p.setIssuer(b)):p.setIssuer(r);void 0==c?p.setExtensions([{name:"basicConstraints",cA:!0},{name:"nsCertType",sslCA:!0,
742 emailCA:!0,objCA:!0},{name:"subjectKeyIdentifier"}]):(null==e?e={name:"extKeyUsage",serverAuth:!0}:e.name="extKeyUsage",p.setExtensions([{name:"basicConstraints"},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},e,{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0},{name:"subjectKeyIdentifier"}]));c?p.sign(c,forge.md.sha256.create()):p.sign(n.privateKey,forge.md.sha256.create());return a?p:{cert:p,key:n.privateKey}}
743 function _stringToArrayBuffer(b){for(var c=new ArrayBuffer(b.length),a=new Uint8Array(c),d=0,e=b.length;d<e;d++)a[d]=b.charCodeAt(d);return c}function _arrayBufferToString(b){var c="";b=new Uint8Array(b);for(var a=b.byteLength,d=0;d<a;d++)c+=String.fromCharCode(b[d]);return c}script_functionTable1="nop jump set print dialog getitem substr indexof split join length jsonparse jsonstr add substract parseint wsbatchenum wsput wscreate wsdelete wsexec scriptspeed wssubscribe wsunsubscribe readchar signwithdummyca".split(" ");
744 script_functionTable2="encodeuri decodeuri passwordcheck atob btoa hex2str str2hex random md5 maketoarray readshort readshortx readint readsint readintx shorttostr shorttostrx inttostr inttostrx".split(" ");script_functionTableX2=[encodeURI,decodeURI,passwordcheck,window.atob.bind(window),window.btoa.bind(window),hex2rstr,rstr2hex,random,rstr_md5,MakeToArray,ReadShort,ReadShortX,ReadInt,ReadSInt,ReadIntX,ShortToStr,ShortToStrX,IntToStr,IntToStrX];script_functionTable3="pullsystemstatus pulleventlog pullauditlog pullcertificates pullwatchdog pullsystemdefense pullhardware pulluserinfo pullremoteaccess highlightblock disconnect getsidstring getsidbytearray pulleventsubscriptions".split(" ");
745 script_functionTableX3=[PullSystemStatus,PullEventLog,PullAuditLog,PullCertificates,PullWatchdog,PullSystemDefense,PullHardware,PullUserInfo,PullRemoteAccess,script_HighlightBlock,,function(b,c){return GetSidString(c)},function(b,c){return GetSidByteArray(c)},PullEventSubscriptions];
746 function script_setup(b,c){var a={startvars:c};if(6>b.length)return console.error("Invalid script length"),null;if(612182341!=ReadInt(b,0))return console.error("Invalid binary script"),null;if(1<ReadShort(b,4))return console.error("Unsupported script version"),null;a.script=b.substring(6);a.reset=function(b){a.stop();a.ip=0;a.variables=c;a.state=1};a.start=function(b){a.stop();a.stepspeed=b;0<b&&(a.timer=setInterval(function(){a.step()},b))};a.stop=function(){null!=a.timer&&clearInterval(a.timer);
747 a.timer=null;a.stepspeed=0};a.getVar=function(b){return void 0==b?void 0:a.getVarEx(b.split("."),a.variables)};a.getVarEx=function(b,c){try{return void 0==b?void 0:0==b.length?c:a.getVarEx(b.slice(1),c[b[0]])}catch(n){return null}};a.setVar=function(b,c){a.setVarEx(b.split("."),a.variables,c)};a.setVarEx=function(b,c,n){1==b.length?c[b[0]]=n:a.setVarEx(b.slice(1),c[b[0]],n)};a.step=function(){if(1==a.state){if(a.ip<a.script.length){var b=ReadShort(a.script,a.ip),c=ReadShort(a.script,a.ip+2),n=ReadShort(a.script,
745 -a.ip+4),p=a.ip+6,q=[],m;for(m in a.variables)m.startsWith("__")&&delete a.variables[m];for(m=0;m<n;m++){var g=ReadShort(a.script,p),w=a.script.substring(p+2,p+2+g),l=w.charCodeAt(0),w=w.substring(1);if(2>l){for(;1<w.split("{").length;)var v=w.split("{").pop().split("}").shift(),w=w.replace("{"+v+"}",a.getVar(v));1==l&&(a.variables["__"+m]=decodeURI(w),w="__"+m);q.push(w)}if(2==l||3==l)a.variables["__"+m]=ReadSInt(w,0),q.push("__"+m);p+=2+g}a.ip+=c;c=[];for(m=0;10>m;m++)c.push(a.getVar(q[m]));var x;
746 -try{if(1E4>b)switch(b){case 0:break;case 1:if(c[2]){if("<"==c[2]&&c[1]<c[3]||"<="==c[2]&&c[1]<=c[3]||"!="==c[2]&&c[1]!=c[3]||"="==c[2]&&c[1]==c[3]||">="==c[2]&&c[1]>=c[3]||">"==c[2]&&c[1]>c[3])a.ip=c[0]}else a.ip=c[0];break;case 2:void 0==q[1]?delete a.variables[q[0]]:a.setVar(q[0],c[1]);break;case 3:if(a.onConsole)a.onConsole(a.toString(c[0]),a);else console.log(a.toString(c[0]));break;case 4:a.state=2;a.dialog=!0;setDialogMode(11,c[0],c[2],a.xxStepDialogOk,c[1],a);break;case 5:for(m in c[1])c[1][m][c[2]]==
748 +a.ip+4),p=a.ip+6,r=[],m;for(m in a.variables)m.startsWith("__")&&delete a.variables[m];for(m=0;m<n;m++){var g=ReadShort(a.script,p),w=a.script.substring(p+2,p+2+g),l=w.charCodeAt(0),w=w.substring(1);if(2>l){for(;1<w.split("{").length;)var v=w.split("{").pop().split("}").shift(),w=w.replace("{"+v+"}",a.getVar(v));1==l&&(a.variables["__"+m]=decodeURI(w),w="__"+m);r.push(w)}if(2==l||3==l)a.variables["__"+m]=ReadSInt(w,0),r.push("__"+m);p+=2+g}a.ip+=c;c=[];for(m=0;10>m;m++)c.push(a.getVar(r[m]));var x;
749 +try{if(1E4>b)switch(b){case 0:break;case 1:if(c[2]){if("<"==c[2]&&c[1]<c[3]||"<="==c[2]&&c[1]<=c[3]||"!="==c[2]&&c[1]!=c[3]||"="==c[2]&&c[1]==c[3]||">="==c[2]&&c[1]>=c[3]||">"==c[2]&&c[1]>c[3])a.ip=c[0]}else a.ip=c[0];break;case 2:void 0==r[1]?delete a.variables[r[0]]:a.setVar(r[0],c[1]);break;case 3:if(a.onConsole)a.onConsole(a.toString(c[0]),a);else console.log(a.toString(c[0]));break;case 4:a.state=2;a.dialog=!0;setDialogMode(11,c[0],c[2],a.xxStepDialogOk,c[1],a);break;case 5:for(m in c[1])c[1][m][c[2]]==
750 c[3]&&(x=m);break;case 6:x=c[1].substr(c[2],c[3]);break;case 7:x=c[1].indexOf(c[2]);break;case 8:x=c[1].split(c[2]);break;case 9:x=c[1].join(c[2]);break;case 10:x=c[1].length;break;case 11:x=JSON.parse(c[1]);break;case 12:x=JSON.stringify(c[1]);break;case 13:x=c[1]+c[2];break;case 14:x=c[1]-c[2];break;case 15:x=parseInt(c[1]);break;case 16:a.state=2;a.amtstack.BatchEnum(c[0],c[1],a.xxWsmanReturn,a);break;case 17:a.state=2;a.amtstack.Put(c[0],c[1],a.xxWsmanReturn,a);break;case 18:a.state=2;a.amtstack.Create(c[0],
751 c[1],a.xxWsmanReturn,a);break;case 19:a.state=2;a.amtstack.Delete(c[0],c[1],a.xxWsmanReturn,a);break;case 20:a.state=2;a.amtstack.Exec(c[0],c[1],c[2],a.xxWsmanReturn,a,0,c[3]);break;case 21:a.stepspeed=c[0];null!=a.timer&&(clearInterval(a.timer),a.timer=setInterval(function(){a.step()},a.stepspeed));break;case 22:a.state=2;a.amtstack.Subscribe(c[0],c[1],c[2],a.xxWsmanReturn,a,0,c[3],c[4],c[5],c[6]);break;case 23:a.state=2;a.amtstack.UnSubscribe(c[0],a.xxWsmanReturn,a,0,c[1]);break;case 24:console.log(c[1],
749 -c[2],c[1].charCodeAt(c[2]));x=c[1].charCodeAt(c[2]);break;case 25:a.state=2;amtcert_signWithCaKey(c[0],null,c[1],{CN:"Untrusted Root Certificate"},a.xxSignWithDummyCaReturn);break;default:a.state=9,console.error("Script Error, unknown command: "+b)}else 2E4>b?x=script_functionTableX2[b-1E4](c[1],c[2],c[3],c[4],c[5],c[6]):script_functionTableX3&&script_functionTableX3[b-2E4]&&(x=script_functionTableX3[b-2E4](a,c[1],c[2],c[3],c[4],c[5],c[6]));void 0!=x&&a.setVar(q[0],x)}catch(k){"object"==typeof k&&
752 +c[2],c[1].charCodeAt(c[2]));x=c[1].charCodeAt(c[2]);break;case 25:a.state=2;amtcert_signWithCaKey(c[0],null,c[1],{CN:"Untrusted Root Certificate"},a.xxSignWithDummyCaReturn);break;default:a.state=9,console.error("Script Error, unknown command: "+b)}else 2E4>b?x=script_functionTableX2[b-1E4](c[1],c[2],c[3],c[4],c[5],c[6]):script_functionTableX3&&script_functionTableX3[b-2E4]&&(x=script_functionTableX3[b-2E4](a,c[1],c[2],c[3],c[4],c[5],c[6]));void 0!=x&&a.setVar(r[0],x)}catch(k){"object"==typeof k&&
753 (k=k.message),a.setVar("_exception",k)}}1==a.state&&a.ip>=a.script.length&&(a.state=0,a.stop());if(a.onStep)a.onStep(a);return a}};a.xxStepDialogOk=function(b){a.variables.DialogSelect=b;a.state=1;a.dialog=!1;if(a.onStep)a.onStep(a)};a.xxWsmanReturn=function(b,c,n,p){a.setVar(c,n);a.setVar("wsman_result",p);a.setVar("wsman_result_str",httpErrorTable[p]?httpErrorTable[p]:"Error #"+p);a.state=1;if(a.onStep)a.onStep(a)};a.xxSignWithDummyCaReturn=function(b){a.setVar("signed_cert",btoa(_arrayBufferToString(b)));
754 a.state=1;if(a.onStep)a.onStep(a)};a.toString=function(a){return"object"==typeof a?JSON.stringify(a):a};a.reset();return a}
752 -function script_compile(b,c){var a="",d=b.split("\n"),e={},n=[],p=[],q;for(q in d){var m=d[q];if(m.startsWith("##SWAP ")){var g=m.split(" ");3==g.length&&(p[g[1]]=g[2])}if("#"!=m[0]&&0!=m.length){for(g in p)m=m.split(g).join(p[g]);var w=m.match(/"[^"]*"|[^\s"]+/g);if(0!=w.length)if(":"==m[0])e[w[0].toUpperCase()]=a.length;else{m=script_functionTable1.indexOf(w[0].toLowerCase());-1==m&&(m=script_functionTable2.indexOf(w[0].toLowerCase()),0<=m&&(m+=1E4));-1==m&&(m=script_functionTable3.indexOf(w[0].toLowerCase()),
755 +function script_compile(b,c){var a="",d=b.split("\n"),e={},n=[],p=[],r;for(r in d){var m=d[r];if(m.startsWith("##SWAP ")){var g=m.split(" ");3==g.length&&(p[g[1]]=g[2])}if("#"!=m[0]&&0!=m.length){for(g in p)m=m.split(g).join(p[g]);var w=m.match(/"[^"]*"|[^\s"]+/g);if(0!=w.length)if(":"==m[0])e[w[0].toUpperCase()]=a.length;else{m=script_functionTable1.indexOf(w[0].toLowerCase());-1==m&&(m=script_functionTable2.indexOf(w[0].toLowerCase()),0<=m&&(m+=1E4));-1==m&&(m=script_functionTable3.indexOf(w[0].toLowerCase()),
756 0<=m&&(m+=2E4));if(-1==m)return c&&c("Unabled to compile, unknown command: "+w[0]),"";var l=ShortToStr(w.length-1),v;for(v in w)if(0!=v)if(":"==w[v][0])n.push([w[v],a.length+l.length+7]),l+=ShortToStr(5)+String.fromCharCode(3)+IntToStr(4294967295);else var x=parseInt(w[v]),l=x==w[v]?l+(ShortToStr(5)+String.fromCharCode(2)+IntToStr(x)):'"'==w[v][0]&&'"'==w[v][w[v].length-1]?l+(ShortToStr(w[v].length-1)+String.fromCharCode(1)+w[v].substring(1,w[v].length-1)):l+(ShortToStr(w[v].length+1)+String.fromCharCode(0)+
754 -w[v]);l=ShortToStr(m)+ShortToStr(l.length+4)+l;a+=l}}}for(q in n){d=n[q][0].toUpperCase();p=n[q][1];g=e[d];if(void 0==g)return c&&c("Unabled to compile, unknown label: "+d),"";a=a.substr(0,p)+IntToStr(g)+a.substr(p+4)}return IntToStr(612182341)+ShortToStr(1)+a}
755 -function script_decompile(b,c){var a="",d=6,e={};if(0<=c)d=c;else{if(6>b.length)return"# Invalid script length";var n=ReadInt(b,0),p=ReadShort(b,4);if(612182341!=n)return"# Invalid binary script: "+n;if(1!=p)return"# Invalid script version"}for(;d<b.length;){var n=ReadShort(b,d),p=ReadShort(b,d+2),q=ReadShort(b,d+4),m=d+6,g="";0<=c||(a+=":label"+(d-6)+"\n");for(var w=0;w<q;w++){var l=ReadShort(b,m),v=b.substring(m+2,m+2+l),x=v.charCodeAt(0);0==x?g+=" "+v.substring(1):1==x?g+=' "'+v.substring(1)+'"':
757 +w[v]);l=ShortToStr(m)+ShortToStr(l.length+4)+l;a+=l}}}for(r in n){d=n[r][0].toUpperCase();p=n[r][1];g=e[d];if(void 0==g)return c&&c("Unabled to compile, unknown label: "+d),"";a=a.substr(0,p)+IntToStr(g)+a.substr(p+4)}return IntToStr(612182341)+ShortToStr(1)+a}
758 +function script_decompile(b,c){var a="",d=6,e={};if(0<=c)d=c;else{if(6>b.length)return"# Invalid script length";var n=ReadInt(b,0),p=ReadShort(b,4);if(612182341!=n)return"# Invalid binary script: "+n;if(1!=p)return"# Invalid script version"}for(;d<b.length;){var n=ReadShort(b,d),p=ReadShort(b,d+2),r=ReadShort(b,d+4),m=d+6,g="";0<=c||(a+=":label"+(d-6)+"\n");for(var w=0;w<r;w++){var l=ReadShort(b,m),v=b.substring(m+2,m+2+l),x=v.charCodeAt(0);0==x?g+=" "+v.substring(1):1==x?g+=' "'+v.substring(1)+'"':
759 2==x?g+=" "+ReadInt(v,1):3==x&&(v=ReadInt(v,1),x=e[v],x||(x=":label"+v,e[x]=v),g+=" "+x);m+=2+l}a=1E4>n?a+(script_functionTable1[n]+g+"\n"):2E4<=n?a+(script_functionTable3[n-2E4]+g+"\n"):a+(script_functionTable2[n-1E4]+g+"\n");d+=p;if(0<=c)return a}d=a.split("\n");a="";for(w in d)n=d[w],":"!=n[0]?a+=n+"\n":e[n]&&(a+=n+"\n");return a}
760 var CreateAmtRemoteDesktop=function(b,c){function a(a,b,c){if(1!=g.holding){var d=0==g.rotation?b:1==g.rotation?g.canvas.canvas.width-g.sparew2-c:2==g.rotation?g.canvas.canvas.width-g.sparew2-b:3==g.rotation?c:0;c=0==g.rotation?c:1==g.rotation?b:2==g.rotation?g.canvas.canvas.height-g.spareh2-c:3==g.rotation?g.canvas.canvas.height-g.spareh-b:0;g.canvas.putImageData(a,d,c)}}function d(a,b){var c=4*b;if(0<g.rotation)if(1==g.rotation){var c=b%g.sparew,d=Math.floor(b/g.sparew);b=c*g.sparew2+(g.sparew2-
761 1-d);c=4*b}else 2==g.rotation?c=g.sparew*g.spareh*4-4-c:3==g.rotation&&(c=b%g.sparew,d=Math.floor(b/g.sparew),b=(g.sparew2-1-c)*g.sparew2+d,c=4*b);1==g.bpp?(g.spare.data[c++]=a&224,g.spare.data[c++]=(a&28)<<3,g.spare.data[c++]=p((a&3)<<6)):(g.spare.data[c++]=a>>8&248,g.spare.data[c++]=a>>3&252,g.spare.data[c++]=(a&31)<<3);g.spare.data[c]=255}function e(a,b){return 0==g.rotation||1==g.rotation?a:2==g.rotation?a-g.canvas.canvas.width:3==g.rotation?a-g.canvas.canvas.height:0}function n(a,b){return 0==
759 -g.rotation?b:1==g.rotation?b-g.canvas.canvas.width:2==g.rotation?b-g.canvas.canvas.height:3==g.rotation?b:0}function p(a){return 127<a?a+32:a}function q(){1!=g.holding&&g.Send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(g.rwidth)+ShortToStr(g.rheight))}function m(a,b){b||(b=window.event);if(b.code){var c;c=b;c=c.code.startsWith("Key")&&4==c.code.length?c.code.charCodeAt(3)+(0==c.shiftKey?32:0):c.code.startsWith("Digit")&&6==c.code.length?c.code.charCodeAt(5):c.code.startsWith("Numpad")&&7==c.code.length?
762 +g.rotation?b:1==g.rotation?b-g.canvas.canvas.width:2==g.rotation?b-g.canvas.canvas.height:3==g.rotation?b:0}function p(a){return 127<a?a+32:a}function r(){1!=g.holding&&g.Send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(g.rwidth)+ShortToStr(g.rheight))}function m(a,b){b||(b=window.event);if(b.code){var c;c=b;c=c.code.startsWith("Key")&&4==c.code.length?c.code.charCodeAt(3)+(0==c.shiftKey?32:0):c.code.startsWith("Digit")&&6==c.code.length?c.code.charCodeAt(5):c.code.startsWith("Numpad")&&7==c.code.length?
763 c.code.charCodeAt(6):w[c.code];null!=c&&g.sendkey(c,a)}else{c=b.keyCode;173==c&&(c=189);61==c&&(c=187);var d=c;0==b.shiftKey&&65<=c&&90>=c&&(d=c+32);112<=c&&124>=c&&(d=c+65358);8==c&&(d=65288);9==c&&(d=65289);13==c&&(d=65293);16==c&&(d=65505);17==c&&(d=65507);18==c&&(d=65513);27==c&&(d=65307);33==c&&(d=65365);34==c&&(d=65366);35==c&&(d=65367);36==c&&(d=65360);37==c&&(d=65361);38==c&&(d=65362);39==c&&(d=65363);40==c&&(d=65364);45==c&&(d=65379);46==c&&(d=65535);96<=c&&105>=c&&(d=c-48);106==c&&(d=42);
764 107==c&&(d=43);109==c&&(d=45);110==c&&(d=46);111==c&&(d=47);186==c&&(d=59);187==c&&(d=61);188==c&&(d=44);189==c&&(d=45);190==c&&(d=46);191==c&&(d=47);192==c&&(d=96);219==c&&(d=91);220==c&&(d=92);221==c&&(d=93);222==c&&(d=39);g.sendkey(d,a)}return g.haltEvent(b)}var g={};g.canvasid=b;g.scrolldiv=c;g.canvas=Q(b).getContext("2d");g.protocol=2;g.state=0;g.acc="";g.ScreenWidth=960;g.ScreenHeight=700;g.width=0;g.height=0;g.rwidth=0;g.rheight=0;g.bpp=2;g.useZRLE=!0;g.showmouse=!0;g.buttonmask=0;g.spare=
765 null;g.sparew=0;g.spareh=0;g.sparew2=0;g.spareh2=0;g.sparecache={};g.ZRLEfirst=1;g.onScreenSizeChange=null;g.frameRateDelay=0;g.noMouseRotate=!1;g.rotation=0;g.kvmDataSupported=!1;g.onKvmData=null;g.onKvmDataPending=[];g.onKvmDataAck=-1;g.holding=!1;g.lastKeepAlive=Date.now();g.Debug=function(a){console.log(a)};g.xxStateChange=function(a){0==a?(g.canvas.fillStyle="#000000",g.canvas.fillRect(0,0,g.width,g.height),g.canvas.canvas.width=g.rwidth=g.width=640,g.canvas.canvas.height=g.rheight=g.height=
766 400,QS(g.canvasid).cursor="auto"):g.showmouse||(QS(g.canvasid).cursor="none")};g.ProcessData=function(b){if(b)for(g.acc+=b;0<g.acc.length;){b=0;if(0==g.state&&12<=g.acc.length)b=12,g.state=1,g.Send("RFB 003.008\n");else if(1==g.state&&1<=g.acc.length)b=g.acc.charCodeAt(0)+1,g.Send(String.fromCharCode(1)),g.state=2;else if(2==g.state&&4<=g.acc.length){b=4;if(0!=ReadInt(g.acc,0))return g.Stop();g.Send(String.fromCharCode(1));g.state=3}else if(3==g.state&&24<=g.acc.length){g.rotation=0;b=ReadInt(g.acc,
764 -20);if(g.acc.length<24+b)break;b=24+b;g.canvas.canvas.width=g.rwidth=g.width=g.ScreenWidth=ReadShort(g.acc,0);g.canvas.canvas.height=g.rheight=g.height=g.ScreenHeight=ReadShort(g.acc,2);var c="";g.useZRLE&&(c+=IntToStr(16));c+=IntToStr(0);c+=IntToStr(1092);g.Send(String.fromCharCode(2,0)+ShortToStr(c.length/4+1)+c+IntToStr(-223));1==g.bpp&&g.Send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0));g.state=4;g.parent.xxStateChange(3);q();
767 +20);if(g.acc.length<24+b)break;b=24+b;g.canvas.canvas.width=g.rwidth=g.width=g.ScreenWidth=ReadShort(g.acc,0);g.canvas.canvas.height=g.rheight=g.height=g.ScreenHeight=ReadShort(g.acc,2);var c="";g.useZRLE&&(c+=IntToStr(16));c+=IntToStr(0);c+=IntToStr(1092);g.Send(String.fromCharCode(2,0)+ShortToStr(c.length/4+1)+c+IntToStr(-223));1==g.bpp&&g.Send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0));g.state=4;g.parent.xxStateChange(3);r();
768 if(null!=g.onScreenSizeChange)g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight)}else if(4==g.state)switch(g.acc.charCodeAt(0)){case 0:if(4>g.acc.length)return;g.state=100+ReadShort(g.acc,2);b=4;break;case 2:b=1;break;case 3:if(8>g.acc.length)return;b=ReadInt(g.acc,4)+8;if(g.acc.length<b)return;c=g.acc;if(8>c.length)b=0;else if(b=ReadInt(g.acc,4)+8,c.length<b)b=0;else if(null!=g.onKvmData&&(c=c.substring(8,b),16<=c.length&&"\x00KvmDataChannel"==c.substring(0,15))){0==g.kvmDataSupported&&(g.kvmDataSupported=
769 !0,console.log("KVM Data Channel Supported."));if(-1==g.onKvmDataAck&&16==c.length||0!=c.charCodeAt(15))g.onKvmDataAck=!0;urlvars&&urlvars.kvmdatatrace&&console.log("KVM-Recv("+(c.length-16)+"): "+c.substring(16));if(16<c.length)g.onKvmData(c.substring(16));1==g.onKvmDataAck&&0<g.onKvmDataPending.length&&g.sendKvmData(g.onKvmDataPending.shift())}}else if(100<g.state&&12<=g.acc.length){var h=ReadShort(g.acc,0),l=ReadShort(g.acc,2),m=ReadShort(g.acc,4),v=ReadShort(g.acc,6),w=m*v;b=ReadInt(g.acc,8);
770 if(17>b){if(1>m||64<m||1>v||64<v)return console.log("Invalid tile size ("+m+","+v+"), disconnecting."),g.Stop();if(g.sparew!=m||g.spareh!=v){g.sparew=g.sparew2=m;g.spareh=g.spareh2=v;if(1==g.rotation||3==g.rotation)g.sparew2=v,g.spareh2=m;c=g.sparew2+"x"+g.spareh2;g.spare=g.sparecache[c];g.spare||(g.sparecache[c]=g.spare=g.canvas.createImageData(g.sparew2,g.spareh2))}}if(4294967073==b){if(g.canvas.canvas.width=g.ScreenWidth=g.rwidth=g.width=m,g.canvas.canvas.height=g.ScreenHeight=g.rheight=g.height=
768 -v,g.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(g.width)+ShortToStr(g.height)),b=12,null!=g.onScreenSizeChange)g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight)}else if(0==b){var z=12;b=12+w*g.bpp;if(g.acc.length<b)break;for(c=0;c<w;c++)d(g.acc.charCodeAt(z++)+(2==g.bpp?g.acc.charCodeAt(z++)<<8:0),c);a(g.spare,h,l)}else if(16==b){if(16>g.acc.length)break;b=ReadInt(g.acc,12);if(g.acc.length<16+b)break;z=16;if(5<b&&0==g.acc.charCodeAt(z)&&ReadShortX(g.acc,z+1)==b-5){var c=g.acc,z=z+5,I=c.charCodeAt(z++),
769 -F=void 0,E=void 0,F=void 0,y={},D=0,A=0,A=void 0;if(0==I){for(A=0;A<w;A++)d(c.charCodeAt(z++)+(2==g.bpp?c.charCodeAt(z++)<<8:0),A);a(g.spare,h,l)}else if(1==I)E=c.charCodeAt(z++)+(2==g.bpp?c.charCodeAt(z++)<<8:0),g.canvas.fillStyle="rgb("+(1==g.bpp?(E&224)+","+((E&28)<<3)+","+p((E&3)<<6):(E>>8&248)+","+(E>>3&252)+","+((E&31)<<3))+")",c=e(h,l),l=n(h,l),h=c,g.canvas.fillRect(h,l,m,v);else if(1<I&&17>I){m=4;v=15;for(A=0;A<I;A++)y[A]=c.charCodeAt(z++)+(2==g.bpp?c.charCodeAt(z++)<<8:0);2==I?v=m=1:4>=I&&
770 -(m=2,v=3);for(;D<w&&z<c.length;)for(E=c.charCodeAt(z++),A=8-m;0<=A;A-=m)d(y[E>>A&v],D++);a(g.spare,h,l)}else if(128==I){for(;D<w&&z<c.length;){E=c.charCodeAt(z++)+(2==g.bpp?c.charCodeAt(z++)<<8:0);A=1;do A+=F=c.charCodeAt(z++);while(255==F);for(;0<=--A;)d(E,D++)}a(g.spare,h,l)}else if(129<I){for(A=0;A<I-128;A++)y[A]=c.charCodeAt(z++)+(2==g.bpp?c.charCodeAt(z++)<<8:0);for(;D<w&&z<c.length;){A=1;F=c.charCodeAt(z++);E=y[F%128];if(127<F){do A+=F=c.charCodeAt(z++);while(255==F)}for(;0<=--A;)d(E,D++)}a(g.spare,
771 -h,l)}}b=16+b}else return g.Debug("Unknown Encoding: "+b+", HEX: "+rstr2hex(g.acc)),g.Stop();100==--g.state&&(g.state=4,0==g.frameRateDelay?q():setTimeout(q,g.frameRateDelay))}if(0==b)break;g.acc=g.acc.substring(b)}};g.hold=function(a){if(g.holding!=a)if(g.holding=a,g.canvas.fillStyle="#000000",g.canvas.fillRect(0,0,g.width,g.height),0==g.holding){if(g.canvas.canvas.width!=g.width||g.canvas.canvas.height!=g.height)if(g.canvas.canvas.width=g.width,g.canvas.canvas.height=g.height,null!=g.onScreenSizeChange)g.onScreenSizeChange(g,
771 +v,g.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(g.width)+ShortToStr(g.height)),b=12,null!=g.onScreenSizeChange)g.onScreenSizeChange(g,g.ScreenWidth,g.ScreenHeight)}else if(0==b){var y=12;b=12+w*g.bpp;if(g.acc.length<b)break;for(c=0;c<w;c++)d(g.acc.charCodeAt(y++)+(2==g.bpp?g.acc.charCodeAt(y++)<<8:0),c);a(g.spare,h,l)}else if(16==b){if(16>g.acc.length)break;b=ReadInt(g.acc,12);if(g.acc.length<16+b)break;y=16;if(5<b&&0==g.acc.charCodeAt(y)&&ReadShortX(g.acc,y+1)==b-5){var c=g.acc,y=y+5,I=c.charCodeAt(y++),
772 +F=void 0,E=void 0,F=void 0,z={},D=0,A=0,A=void 0;if(0==I){for(A=0;A<w;A++)d(c.charCodeAt(y++)+(2==g.bpp?c.charCodeAt(y++)<<8:0),A);a(g.spare,h,l)}else if(1==I)E=c.charCodeAt(y++)+(2==g.bpp?c.charCodeAt(y++)<<8:0),g.canvas.fillStyle="rgb("+(1==g.bpp?(E&224)+","+((E&28)<<3)+","+p((E&3)<<6):(E>>8&248)+","+(E>>3&252)+","+((E&31)<<3))+")",c=e(h,l),l=n(h,l),h=c,g.canvas.fillRect(h,l,m,v);else if(1<I&&17>I){m=4;v=15;for(A=0;A<I;A++)z[A]=c.charCodeAt(y++)+(2==g.bpp?c.charCodeAt(y++)<<8:0);2==I?v=m=1:4>=I&&
773 +(m=2,v=3);for(;D<w&&y<c.length;)for(E=c.charCodeAt(y++),A=8-m;0<=A;A-=m)d(z[E>>A&v],D++);a(g.spare,h,l)}else if(128==I){for(;D<w&&y<c.length;){E=c.charCodeAt(y++)+(2==g.bpp?c.charCodeAt(y++)<<8:0);A=1;do A+=F=c.charCodeAt(y++);while(255==F);for(;0<=--A;)d(E,D++)}a(g.spare,h,l)}else if(129<I){for(A=0;A<I-128;A++)z[A]=c.charCodeAt(y++)+(2==g.bpp?c.charCodeAt(y++)<<8:0);for(;D<w&&y<c.length;){A=1;F=c.charCodeAt(y++);E=z[F%128];if(127<F){do A+=F=c.charCodeAt(y++);while(255==F)}for(;0<=--A;)d(E,D++)}a(g.spare,
774 +h,l)}}b=16+b}else return g.Debug("Unknown Encoding: "+b+", HEX: "+rstr2hex(g.acc)),g.Stop();100==--g.state&&(g.state=4,0==g.frameRateDelay?r():setTimeout(r,g.frameRateDelay))}if(0==b)break;g.acc=g.acc.substring(b)}};g.hold=function(a){if(g.holding!=a)if(g.holding=a,g.canvas.fillStyle="#000000",g.canvas.fillRect(0,0,g.width,g.height),0==g.holding){if(g.canvas.canvas.width!=g.width||g.canvas.canvas.height!=g.height)if(g.canvas.canvas.width=g.width,g.canvas.canvas.height=g.height,null!=g.onScreenSizeChange)g.onScreenSizeChange(g,
775 g.ScreenWidth,g.ScreenHeight);g.Send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(g.width)+ShortToStr(g.height))}else g.UnGrabMouseInput(),g.UnGrabKeyInput()};g.tcanvas=null;g.setRotation=function(a){for(;0>a;)a+=4;a%=4;if(1==g.holding)g.rotation=a;else{if(a==g.rotation)return!0;var b=g.canvas.canvas.width,c=g.canvas.canvas.height;if(1==g.rotation||3==g.rotation)b=g.canvas.canvas.height,c=g.canvas.canvas.width;null==g.tcanvas&&(g.tcanvas=document.createElement("canvas"));var d=g.tcanvas.getContext("2d");
776 d.setTransform(1,0,0,1,0,0);d.canvas.width=b;d.canvas.height=c;d.rotate(-90*g.rotation*Math.PI/180);0==g.rotation&&d.drawImage(g.canvas.canvas,0,0);1==g.rotation&&d.drawImage(g.canvas.canvas,-g.canvas.canvas.width,0);2==g.rotation&&d.drawImage(g.canvas.canvas,-g.canvas.canvas.width,-g.canvas.canvas.height);3==g.rotation&&d.drawImage(g.canvas.canvas,0,-g.canvas.canvas.height);if(0==g.rotation||2==g.rotation)g.canvas.canvas.height=b,g.canvas.canvas.width=c;if(1==g.rotation||3==g.rotation)g.canvas.canvas.height=
777 c,g.canvas.canvas.width=b;g.canvas.setTransform(1,0,0,1,0,0);g.canvas.rotate(90*a*Math.PI/180);g.rotation=a;g.canvas.drawImage(g.tcanvas,e(0,0),n(0,0));g.width=g.canvas.canvas.width;g.height=g.canvas.canvas.height;if(null!=g.onScreenResize)g.onScreenResize(g,g.width,g.height,g.CanvasId);return!0}};g.Start=function(){g.state=0;g.acc="";g.ZRLEfirst=1;g.onKvmDataPending=[];g.onKvmDataAck=-1;g.kvmDataSupported=!1;for(var a in g.sparecache)delete g.sparecache[a]};g.Stop=function(){g.UnGrabMouseInput();
@@ -780,74 +783,74 @@ v&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,v=!1)
783 g.state)return!0;var b=g.getPositionOfControl(Q(g.canvasid));g.mx=(a.pageX-b[0])*(g.canvas.canvas.height/Q(g.canvasid).offsetHeight);g.my=(a.pageY-b[1]+(c?c.scrollTop:0))*(g.canvas.canvas.width/Q(g.canvasid).offsetWidth);if(1!=g.noMouseRotate){var b=g.mx,d=g.my;g.mx2=0==g.rotation?b:1==g.rotation?d:2==g.rotation?g.canvas.canvas.width-b:3==g.rotation?g.canvas.canvas.height-d:0;b=g.mx;d=g.my;g.my=0==g.rotation?d:1==g.rotation?g.canvas.canvas.width-b:2==g.rotation?g.canvas.canvas.height-d:3==g.rotation?
784 b:0;g.mx=g.mx2}g.Send(String.fromCharCode(5,g.buttonmask)+ShortToStr(g.mx)+ShortToStr(g.my));return g.haltEvent(a)};g.getPositionOfControl=function(a){var b=Array(2);for(b[0]=b[1]=0;a;)b[0]+=a.offsetLeft,b[1]+=a.offsetTop,a=a.offsetParent;return b};return g},CreateAgentRemoteDesktop=function(b,c){var a={};a.CanvasId=b;"string"===typeof b&&(a.CanvasId=Q(b));a.Canvas=a.CanvasId.getContext("2d");a.scrolldiv=c;a.State=0;a.PendingOperations=[];a.tilesReceived=0;a.TilesDrawn=0;a.KillDraw=0;a.ipad=!1;a.tabletKeyboardVisible=
785 !1;a.LastX=0;a.LastY=0;a.touchenabled=0;a.submenuoffset=0;a.touchtimer=null;a.TouchArray={};a.connectmode=0;a.connectioncount=0;a.rotation=0;a.protocol=2;a.debugmode=0;a.firstUpKeys=[];a.stopInput=!1;a.sessionid=0;a.username;a.oldie=!1;a.CompressionLevel=50;a.ScalingLevel=1024;a.FrameRateTimer=50;a.FirstDraw=!1;a.ScreenWidth=960;a.ScreenHeight=700;a.width=960;a.height=960;a.onScreenSizeChange=null;a.onMessage=null;a.onConnectCountChanged=null;a.onDebugMessage=null;a.onTouchEnabledChanged=null;a.onDisplayinfo=
783 -null;a.Start=function(){a.State=0};a.Stop=function(){a.setRotation(0);a.UnGrabKeyInput();a.UnGrabMouseInput();a.touchenabled=0;if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);a.Canvas.clearRect(0,0,a.CanvasId.width,a.CanvasId.height)};a.xxStateChange=function(b){if(a.State!=b)switch(a.State=b,b){case 0:a.Stop()}};a.send=function(b){a.parent.send(b)};a.ProcessPictureMsg=function(b,c,d){var q=new Image;q.xcount=a.tilesReceived++;var m=a.tilesReceived;q.src=
784 -"data:image/jpeg;base64,"+btoa(b.substring(4,b.length));q.onload=function(){if(null!=a.Canvas&&a.KillDraw<m&&0!=a.State)for(a.PendingOperations.push([m,2,q,c,d]);a.DoPendingOperations(););};q.error=function(){console.log("DecodeTileError")}};a.DoPendingOperations=function(){if(0==a.PendingOperations.length)return!1;for(var b=0;b<a.PendingOperations.length;b++){var c=a.PendingOperations[b];if(c[0]==a.TilesDrawn+1)return 1==c[1]?a.ProcessCopyRectMsg(c[2]):2==c[1]&&(a.Canvas.drawImage(c[2],a.rotX(c[3],
785 -c[4]),a.rotY(c[3],c[4])),delete c[2]),a.PendingOperations.splice(b,1),delete c,a.TilesDrawn++,a.TilesDrawn==a.tilesReceived&&a.KillDraw<a.TilesDrawn&&(a.KillDraw=a.TilesDrawn=a.tilesReceived=0),!0}a.oldie&&0<a.PendingOperations.length&&a.TilesDrawn++;return!1};a.ProcessCopyRectMsg=function(b){var c=((b.charCodeAt(0)&255)<<8)+(b.charCodeAt(1)&255),d=((b.charCodeAt(2)&255)<<8)+(b.charCodeAt(3)&255),q=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255),m=((b.charCodeAt(6)&255)<<8)+(b.charCodeAt(7)&255),
786 -g=((b.charCodeAt(8)&255)<<8)+(b.charCodeAt(9)&255);b=((b.charCodeAt(10)&255)<<8)+(b.charCodeAt(11)&255);a.Canvas.drawImage(Canvas.canvas,c,d,g,b,q,m,g,b)};a.SendUnPause=function(){a.send(String.fromCharCode(0,8,0,5,0))};a.SendPause=function(){a.send(String.fromCharCode(0,8,0,5,1))};a.SendCompressionLevel=function(b,c,d,q){c&&(a.CompressionLevel=c);d&&(a.ScalingLevel=d);q&&(a.FrameRateTimer=q);a.send(String.fromCharCode(0,5,0,10,b,a.CompressionLevel)+a.shortToStr(a.ScalingLevel)+a.shortToStr(a.FrameRateTimer))};
786 +null;a.Start=function(){a.State=0};a.Stop=function(){a.setRotation(0);a.UnGrabKeyInput();a.UnGrabMouseInput();a.touchenabled=0;if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);a.Canvas.clearRect(0,0,a.CanvasId.width,a.CanvasId.height)};a.xxStateChange=function(b){if(a.State!=b)switch(a.State=b,b){case 0:a.Stop()}};a.send=function(b){a.parent.send(b)};a.ProcessPictureMsg=function(b,c,d){var r=new Image;r.xcount=a.tilesReceived++;var m=a.tilesReceived;r.src=
787 +"data:image/jpeg;base64,"+btoa(b.substring(4,b.length));r.onload=function(){if(null!=a.Canvas&&a.KillDraw<m&&0!=a.State)for(a.PendingOperations.push([m,2,r,c,d]);a.DoPendingOperations(););};r.error=function(){console.log("DecodeTileError")}};a.DoPendingOperations=function(){if(0==a.PendingOperations.length)return!1;for(var b=0;b<a.PendingOperations.length;b++){var c=a.PendingOperations[b];if(c[0]==a.TilesDrawn+1)return 1==c[1]?a.ProcessCopyRectMsg(c[2]):2==c[1]&&(a.Canvas.drawImage(c[2],a.rotX(c[3],
788 +c[4]),a.rotY(c[3],c[4])),delete c[2]),a.PendingOperations.splice(b,1),delete c,a.TilesDrawn++,a.TilesDrawn==a.tilesReceived&&a.KillDraw<a.TilesDrawn&&(a.KillDraw=a.TilesDrawn=a.tilesReceived=0),!0}a.oldie&&0<a.PendingOperations.length&&a.TilesDrawn++;return!1};a.ProcessCopyRectMsg=function(b){var c=((b.charCodeAt(0)&255)<<8)+(b.charCodeAt(1)&255),d=((b.charCodeAt(2)&255)<<8)+(b.charCodeAt(3)&255),r=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255),m=((b.charCodeAt(6)&255)<<8)+(b.charCodeAt(7)&255),
789 +g=((b.charCodeAt(8)&255)<<8)+(b.charCodeAt(9)&255);b=((b.charCodeAt(10)&255)<<8)+(b.charCodeAt(11)&255);a.Canvas.drawImage(Canvas.canvas,c,d,g,b,r,m,g,b)};a.SendUnPause=function(){a.send(String.fromCharCode(0,8,0,5,0))};a.SendPause=function(){a.send(String.fromCharCode(0,8,0,5,1))};a.SendCompressionLevel=function(b,c,d,r){c&&(a.CompressionLevel=c);d&&(a.ScalingLevel=d);r&&(a.FrameRateTimer=r);a.send(String.fromCharCode(0,5,0,10,b,a.CompressionLevel)+a.shortToStr(a.ScalingLevel)+a.shortToStr(a.FrameRateTimer))};
790 a.SendRefresh=function(){a.send(String.fromCharCode(0,6,0,4))};a.ProcessScreenMsg=function(b,c){a.Canvas.setTransform(1,0,0,1,0,0);a.rotation=0;a.FirstDraw=!0;a.ScreenWidth=a.width=b;a.ScreenHeight=a.height=c;for(a.KillDraw=a.tilesReceived;0<a.PendingOperations.length;)a.PendingOperations.shift();a.SendCompressionLevel(1);a.SendUnPause();if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId)};a.ProcessData=function(b){for(var c=0;c<b.length;)c+=a.ProcessDataEx(b.substring(c))};
788 -a.ProcessDataEx=function(b){if(!(4>b.length)){var c=null,d=0,q=0,m=ReadShort(b,0),g=ReadShort(b,2);g!=b.length&&1==a.debugmode&&console.log(g,b.length,g==b.length);if(18<=m)console.error("Invalid KVM command "+m+" of size "+g),console.log("Invalid KVM data",b.length,b,rstr2hex(b));else if(g>b.length)console.error("KVM invalid command size",g,b.length);else{if(3==m||4==m||7==m)c=b.substring(4,g),d=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),q=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255);switch(m){case 3:if(a.FirstDraw)a.onResize();
789 -a.ProcessPictureMsg(c,d,q);break;case 4:if(a.FirstDraw)a.onResize();a.TilesDrawn==a.tilesReceived?a.ProcessCopyRectMsg(c):a.PendingOperations.push([++tilesReceived,1,c]);break;case 7:a.ProcessScreenMsg(d,q);a.SendKeyMsgKC(a.KeyAction.UP,16);a.SendKeyMsgKC(a.KeyAction.UP,17);a.SendKeyMsgKC(a.KeyAction.UP,18);a.SendKeyMsgKC(a.KeyAction.UP,91);a.SendKeyMsgKC(a.KeyAction.UP,92);a.SendKeyMsgKC(a.KeyAction.UP,16);a.send(String.fromCharCode(0,14,0,4));break;case 11:c=[];d=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&
790 -255);if(0<d)for(var w=0,q=((b.charCodeAt(6+2*d)&255)<<8)+(b.charCodeAt(7+2*d)&255),m=0;m<d;m++){var l=((b.charCodeAt(6+2*m)&255)<<8)+(b.charCodeAt(7+2*m)&255);65535==l?c.push("All Displays"):c.push("Display "+l);l==q&&(w=m)}if(null!=a.onDisplayinfo)a.onDisplayinfo(a,c,w);break;case 14:a.touchenabled=1;a.TouchArray={};if(null!=a.onTouchEnabledChanged)a.onTouchEnabledChanged(a.touchenabled);break;case 15:a.TouchArray={};break;case 16:a.connectioncount=ReadInt(b,4);if(null!=a.onConnectCountChanged)a.onConnectCountChanged(a.connectioncount,
791 +a.ProcessDataEx=function(b){if(!(4>b.length)){var c=null,d=0,r=0,m=ReadShort(b,0),g=ReadShort(b,2);g!=b.length&&1==a.debugmode&&console.log(g,b.length,g==b.length);if(18<=m)console.error("Invalid KVM command "+m+" of size "+g),console.log("Invalid KVM data",b.length,b,rstr2hex(b));else if(g>b.length)console.error("KVM invalid command size",g,b.length);else{if(3==m||4==m||7==m)c=b.substring(4,g),d=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),r=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255);switch(m){case 3:if(a.FirstDraw)a.onResize();
792 +a.ProcessPictureMsg(c,d,r);break;case 4:if(a.FirstDraw)a.onResize();a.TilesDrawn==a.tilesReceived?a.ProcessCopyRectMsg(c):a.PendingOperations.push([++tilesReceived,1,c]);break;case 7:a.ProcessScreenMsg(d,r);a.SendKeyMsgKC(a.KeyAction.UP,16);a.SendKeyMsgKC(a.KeyAction.UP,17);a.SendKeyMsgKC(a.KeyAction.UP,18);a.SendKeyMsgKC(a.KeyAction.UP,91);a.SendKeyMsgKC(a.KeyAction.UP,92);a.SendKeyMsgKC(a.KeyAction.UP,16);a.send(String.fromCharCode(0,14,0,4));break;case 11:c=[];d=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&
793 +255);if(0<d)for(var w=0,r=((b.charCodeAt(6+2*d)&255)<<8)+(b.charCodeAt(7+2*d)&255),m=0;m<d;m++){var l=((b.charCodeAt(6+2*m)&255)<<8)+(b.charCodeAt(7+2*m)&255);65535==l?c.push("All Displays"):c.push("Display "+l);l==r&&(w=m)}if(null!=a.onDisplayinfo)a.onDisplayinfo(a,c,w);break;case 14:a.touchenabled=1;a.TouchArray={};if(null!=a.onTouchEnabledChanged)a.onTouchEnabledChanged(a.touchenabled);break;case 15:a.TouchArray={};break;case 16:a.connectioncount=ReadInt(b,4);if(null!=a.onConnectCountChanged)a.onConnectCountChanged(a.connectioncount,
794 a);break;case 17:if(null!=a.onMessage)a.onMessage(b.substring(4,g),a)}return g}}};a.MouseButton={NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};a.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5};a.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};a.Alternate=0;var d={Pause:19,CapsLock:20,Space:32,Quote:222,Minus:189,NumpadMultiply:106,NumpadAdd:107,PrintScreen:44,Comma:188,NumpadSubtract:109,NumpadDecimal:110,Period:190,Slash:191,NumpadDivide:111,Semicolon:186,Equal:187,OSLeft:91,BracketLeft:219,OSRight:91,
795 Backslash:220,BracketRight:221,ContextMenu:93,Backquote:192,NumLock:144,ScrollLock:145,Backspace:8,Tab:9,Enter:13,NumpadEnter:13,Escape:27,Delete:46,Home:36,PageUp:33,PageDown:34,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,End:35,Insert:45,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,VolumeMute:181};a.SendKeyMsg=function(b,c){if(null!=b)if(c||(c=
796 window.event),c.code){var p;p=c;p=p.code.startsWith("Key")&&4==p.code.length?p.code.charCodeAt(3):p.code.startsWith("Digit")&&6==p.code.length?p.code.charCodeAt(5):p.code.startsWith("Numpad")&&7==p.code.length?p.code.charCodeAt(6)+48:d[p.code];null!=p&&a.SendKeyMsgKC(b,p)}else p=c.keyCode,59==p&&(p=186),a.SendKeyMsgKC(b,p)};a.SendMessage=function(b){3==a.State&&a.send(String.fromCharCode(0,17)+a.shortToStr(4+b.length)+b)};a.SendKeyMsgKC=function(b,c){3==a.State&&a.send(String.fromCharCode(0,a.InputType.KEY,
797 0,6,b-1,c))};a.sendcad=function(){a.SendCtrlAltDelMsg()};a.SendCtrlAltDelMsg=function(){3==a.State&&a.send(String.fromCharCode(0,a.InputType.CTRLALTDEL,0,4))};a.SendEscKey=function(){3==a.State&&a.send(String.fromCharCode(0,a.InputType.KEY,0,6,0,27,0,a.InputType.KEY,0,6,1,27))};a.SendStartMsg=function(){a.SendKeyMsgKC(a.KeyAction.EXDOWN,91);a.SendKeyMsgKC(a.KeyAction.EXUP,91)};a.SendCharmsMsg=function(){a.SendKeyMsgKC(a.KeyAction.EXDOWN,91);a.SendKeyMsgKC(a.KeyAction.DOWN,67);a.SendKeyMsgKC(a.KeyAction.UP,
795 -67);a.SendKeyMsgKC(a.KeyAction.EXUP,91)};a.SendTouchMsg1=function(b,c,d,q){3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(14)+String.fromCharCode(1,b)+a.intToStr(c)+a.shortToStr(d)+a.shortToStr(q))};a.SendTouchMsg2=function(b,c){var d="",q,m;for(m in a.TouchArray)m==b?q=c:1==a.TouchArray[m].f?(q=65542,a.TouchArray[m].f=3):q=2==a.TouchArray[m].f?262144:131078,d+=String.fromCharCode(m)+a.intToStr(q)+a.shortToStr(a.TouchArray[m].x)+a.shortToStr(a.TouchArray[m].y),2==a.TouchArray[m].f&&
796 -delete a.TouchArray[m];3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(5+d.length)+String.fromCharCode(2)+d);0==Object.keys(a.TouchArray).length&&null!=a.touchtimer&&(clearInterval(a.touchtimer),a.touchtimer=null)};a.SendMouseMsg=function(b,c){if(3==a.State&&null!=b&&null!=a.Canvas){c||(c=window.event);var d=a.Canvas.canvas.height/a.CanvasId.clientHeight,q=a.Canvas.canvas.width/a.CanvasId.clientWidth,m=a.GetPositionOfControl(a.Canvas.canvas),q=(c.pageX-m[0])*q,d=(c.pageY-
797 -m[1])*d,m=0==a.rotation?q:1==a.rotation?d:2==a.rotation?a.Canvas.canvas.width-q:3==a.rotation?a.Canvas.canvas.height-d:0,d=0==a.rotation?d:1==a.rotation?a.Canvas.canvas.width-q:2==a.rotation?a.Canvas.canvas.height-d:3==a.rotation?q:0,q=m;if(0<=q&&q<=a.Canvas.canvas.width&&0<=d&&d<=a.Canvas.canvas.height){var g=m=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?m=a.MouseButton.LEFT:2==c.which?m=a.MouseButton.MIDDLE:m=a.MouseButton.RIGHT:c.button&&(0==c.button?m=a.MouseButton.LEFT:1==c.button?
798 -m=a.MouseButton.MIDDLE:m=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?g=-120*c.detail:c.wheelDelta&&(g=3*c.wheelDelta));var w="",w=b==a.KeyAction.SCROLL?String.fromCharCode(0,a.InputType.MOUSE,0,12,0,b==a.KeyAction.DOWN?m:2*m&255,q/256&255,q&255,d/256&255,d&255,g/256&255,g&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?m:2*m&255,q/256&255,q&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(w),a.Alternate=1):a.Alternate=0:a.send(w)}}};
798 +67);a.SendKeyMsgKC(a.KeyAction.EXUP,91)};a.SendTouchMsg1=function(b,c,d,r){3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(14)+String.fromCharCode(1,b)+a.intToStr(c)+a.shortToStr(d)+a.shortToStr(r))};a.SendTouchMsg2=function(b,c){var d="",r,m;for(m in a.TouchArray)m==b?r=c:1==a.TouchArray[m].f?(r=65542,a.TouchArray[m].f=3):r=2==a.TouchArray[m].f?262144:131078,d+=String.fromCharCode(m)+a.intToStr(r)+a.shortToStr(a.TouchArray[m].x)+a.shortToStr(a.TouchArray[m].y),2==a.TouchArray[m].f&&
799 +delete a.TouchArray[m];3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(5+d.length)+String.fromCharCode(2)+d);0==Object.keys(a.TouchArray).length&&null!=a.touchtimer&&(clearInterval(a.touchtimer),a.touchtimer=null)};a.SendMouseMsg=function(b,c){if(3==a.State&&null!=b&&null!=a.Canvas){c||(c=window.event);var d=a.Canvas.canvas.height/a.CanvasId.clientHeight,r=a.Canvas.canvas.width/a.CanvasId.clientWidth,m=a.GetPositionOfControl(a.Canvas.canvas),r=(c.pageX-m[0])*r,d=(c.pageY-
800 +m[1])*d,m=0==a.rotation?r:1==a.rotation?d:2==a.rotation?a.Canvas.canvas.width-r:3==a.rotation?a.Canvas.canvas.height-d:0,d=0==a.rotation?d:1==a.rotation?a.Canvas.canvas.width-r:2==a.rotation?a.Canvas.canvas.height-d:3==a.rotation?r:0,r=m;if(0<=r&&r<=a.Canvas.canvas.width&&0<=d&&d<=a.Canvas.canvas.height){var g=m=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?m=a.MouseButton.LEFT:2==c.which?m=a.MouseButton.MIDDLE:m=a.MouseButton.RIGHT:c.button&&(0==c.button?m=a.MouseButton.LEFT:1==c.button?
801 +m=a.MouseButton.MIDDLE:m=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?g=-120*c.detail:c.wheelDelta&&(g=3*c.wheelDelta));var w="",w=b==a.KeyAction.SCROLL?String.fromCharCode(0,a.InputType.MOUSE,0,12,0,b==a.KeyAction.DOWN?m:2*m&255,r/256&255,r&255,d/256&255,d&255,g/256&255,g&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?m:2*m&255,r/256&255,r&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(w),a.Alternate=1):a.Alternate=0:a.send(w)}}};
802 a.GetDisplayNumbers=function(){a.send(String.fromCharCode(0,11,0,4))};a.SetDisplay=function(b){a.send(String.fromCharCode(0,12,0,6,b>>8,b&255))};a.intToStr=function(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)};a.shortToStr=function(a){return String.fromCharCode(a>>8&255,a&255)};a.onResize=function(){if(0!=a.ScreenWidth&&0!=a.ScreenHeight&&(a.Canvas.canvas.width!=a.ScreenWidth||a.Canvas.canvas.height!=a.ScreenHeight)){if(a.FirstDraw&&(a.Canvas.canvas.width=a.ScreenWidth,a.Canvas.canvas.height=
803 a.ScreenHeight,a.Canvas.fillRect(0,0,a.ScreenWidth,a.ScreenHeight),null!=a.onScreenSizeChange))a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);a.FirstDraw=!1}};a.xxMouseInputGrab=!1;a.xxKeyInputGrab=!1;a.xxMouseMove=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.NONE,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseUp=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.UP,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&
804 b.stopPropagation();return!1};a.xxMouseDown=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.DOWN,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxDOMMouseScroll=function(b){return 3==a.State?(a.SendMouseMsg(a.KeyAction.SCROLL,b),!1):!0};a.xxMouseWheel=function(b){return 3==a.State?(a.SendMouseMsg(a.KeyAction.SCROLL,b),!1):!0};a.xxKeyUp=function(b){3==a.State&&a.SendKeyMsg(a.KeyAction.UP,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();
805 return!1};a.xxKeyDown=function(b){3==a.State&&a.SendKeyMsg(a.KeyAction.DOWN,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxKeyPress=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};a.handleKeys=function(b){return 1==a.stopInput||3!=desktop.State?!1:a.xxKeyPress(b)};a.handleKeyUp=function(b){if(1==a.stopInput||3!=desktop.State)return!1;if(5>a.firstUpKeys.length&&(a.firstUpKeys.push(b.keyCode),5==a.firstUpKeys.length)){var c=
806 a.firstUpKeys.join(",");if("16,17,91,91,16"==c||"16,17,18,91,92"==c)a.stopInput=!0}return a.xxKeyUp(b)};a.handleKeyDown=function(b){return 1==a.stopInput||3!=desktop.State?!1:a.xxKeyDown(b)};a.mousedown=function(b){return 1==a.stopInput?!1:a.xxMouseDown(b)};a.mouseup=function(b){return 1==a.stopInput?!1:a.xxMouseUp(b)};a.mousemove=function(b){return 1==a.stopInput?!1:a.xxMouseMove(b)};a.mousewheel=function(b){return 1==a.stopInput?!1:a.xxMouseWheel(b)};a.xxMsTouchEvent=function(b){if(4!=b.originalEvent.pointerType){b.preventDefault&&
804 -b.preventDefault();b.stopPropagation&&b.stopPropagation();if("MSPointerDown"==b.type||"MSPointerMove"==b.type||"MSPointerUp"==b.type){var c=0,d=b.originalEvent.pointerId%256,q=Canvas.canvas.width/a.CanvasId.clientWidth*b.offsetX,m=Canvas.canvas.height/a.CanvasId.clientHeight*b.offsetY;"MSPointerDown"==b.type?c=65542:"MSPointerMove"==b.type?c=131078:"MSPointerUp"==b.type&&(c=262144);a.TouchArray[d]||(a.TouchArray[d]={x:q,y:m});a.SendTouchMsg2(d,c);"MSPointerUp"==b.type&&delete a.TouchArray[d]}else alert(b.type);
805 -return!0}};a.xxTouchStart=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(KeyAction.DOWN,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var q=b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[q]||
806 -(a.TouchArray[q]={x:Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),y:Canvas.canvas.height/a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-c[1]),f:1})}0<Object.keys(a.TouchArray).length&&null==touchtimer&&(a.touchtimer=setInterval(function(){a.SendTouchMsg2(256,0)},50))}};a.xxTouchMove=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];
807 -b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(a.KeyAction.NONE,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var q=b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[q]&&(a.TouchArray[q].x=a.Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),a.TouchArray[q].y=a.Canvas.canvas.height/a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-
807 +b.preventDefault();b.stopPropagation&&b.stopPropagation();if("MSPointerDown"==b.type||"MSPointerMove"==b.type||"MSPointerUp"==b.type){var c=0,d=b.originalEvent.pointerId%256,r=Canvas.canvas.width/a.CanvasId.clientWidth*b.offsetX,m=Canvas.canvas.height/a.CanvasId.clientHeight*b.offsetY;"MSPointerDown"==b.type?c=65542:"MSPointerMove"==b.type?c=131078:"MSPointerUp"==b.type&&(c=262144);a.TouchArray[d]||(a.TouchArray[d]={x:r,y:m});a.SendTouchMsg2(d,c);"MSPointerUp"==b.type&&delete a.TouchArray[d]}else alert(b.type);
808 +return!0}};a.xxTouchStart=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(KeyAction.DOWN,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var r=b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[r]||
809 +(a.TouchArray[r]={x:Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),y:Canvas.canvas.height/a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-c[1]),f:1})}0<Object.keys(a.TouchArray).length&&null==touchtimer&&(a.touchtimer=setInterval(function(){a.SendTouchMsg2(256,0)},50))}};a.xxTouchMove=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];
810 +b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(a.KeyAction.NONE,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var r=b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[r]&&(a.TouchArray[r].x=a.Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),a.TouchArray[r].y=a.Canvas.canvas.height/a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-
811 c[1]))}}};a.xxTouchEnd=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled)1<b.originalEvent.touches.length||(b.which=1,b.pageX=LastX,b.pageY=LastY,a.SendMouseMsg(KeyAction.UP,b));else for(var c in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[c].identifier){var d=b.originalEvent.changedTouches[c].identifier%256;a.TouchArray[d]&&(a.TouchArray[d].f=2)}};a.GrabMouseInput=function(){if(1!=a.xxMouseInputGrab){var b=a.CanvasId;b.onmousemove=
812 a.xxMouseMove;b.onmouseup=a.xxMouseUp;b.onmousedown=a.xxMouseDown;b.touchstart=a.xxTouchStart;b.touchmove=a.xxTouchMove;b.touchend=a.xxTouchEnd;b.MSPointerDown=a.xxMsTouchEvent;b.MSPointerMove=a.xxMsTouchEvent;b.MSPointerUp=a.xxMsTouchEvent;navigator.userAgent.match(/mozilla/i)?b.DOMMouseScroll=a.xxDOMMouseScroll:b.onmousewheel=a.xxMouseWheel;a.xxMouseInputGrab=!0}};a.UnGrabMouseInput=function(){if(0!=a.xxMouseInputGrab){var b=a.CanvasId;b.onmousemove=null;b.onmouseup=null;b.onmousedown=null;b.touchstart=
813 null;b.touchmove=null;b.touchend=null;b.MSPointerDown=null;b.MSPointerMove=null;b.MSPointerUp=null;navigator.userAgent.match(/mozilla/i)?b.DOMMouseScroll=null:b.onmousewheel=null;a.xxMouseInputGrab=!1}};a.GrabKeyInput=function(){1!=a.xxKeyInputGrab&&(document.onkeyup=a.xxKeyUp,document.onkeydown=a.xxKeyDown,document.onkeypress=a.xxKeyPress,a.xxKeyInputGrab=!0)};a.UnGrabKeyInput=function(){0!=a.xxKeyInputGrab&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,a.xxKeyInputGrab=
814 !1)};a.GetPositionOfControl=function(a){var b=Array(2);for(b[0]=b[1]=0;a;)b[0]+=a.offsetLeft,b[1]+=a.offsetTop,a=a.offsetParent;return b};a.crotX=function(b,c){if(0==a.rotation)return b;if(1==a.rotation)return c;if(2==a.rotation)return a.Canvas.canvas.width-b;if(3==a.rotation)return a.Canvas.canvas.height-c};a.crotY=function(b,c){if(0==a.rotation)return c;if(1==a.rotation)return a.Canvas.canvas.width-b;if(2==a.rotation)return a.Canvas.canvas.height-c;if(3==a.rotation)return b};a.rotX=function(b,c){if(0==
815 a.rotation||1==a.rotation)return b;if(2==a.rotation)return b-a.Canvas.canvas.width;if(3==a.rotation)return b-a.Canvas.canvas.height};a.rotY=function(b,c){if(0==a.rotation||3==a.rotation)return c;if(1==a.rotation)return c-a.Canvas.canvas.width;if(2==a.rotation)return c-a.Canvas.canvas.height};a.tcanvas=null;a.setRotation=function(b){for(;0>b;)b+=4;b%=4;if(b==a.rotation)return!0;var c=a.Canvas.canvas.width,d=a.Canvas.canvas.height;if(1==a.rotation||3==a.rotation)c=a.Canvas.canvas.height,d=a.Canvas.canvas.width;
813 -null==a.tcanvas&&(a.tcanvas=document.createElement("canvas"));var q=a.tcanvas.getContext("2d");q.setTransform(1,0,0,1,0,0);q.canvas.width=c;q.canvas.height=d;q.rotate(-90*a.rotation*Math.PI/180);0==a.rotation&&q.drawImage(a.Canvas.canvas,0,0);1==a.rotation&&q.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,0);2==a.rotation&&q.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,-a.Canvas.canvas.height);3==a.rotation&&q.drawImage(a.Canvas.canvas,0,-a.Canvas.canvas.height);if(0==a.rotation||2==a.rotation)a.Canvas.canvas.height=
816 +null==a.tcanvas&&(a.tcanvas=document.createElement("canvas"));var r=a.tcanvas.getContext("2d");r.setTransform(1,0,0,1,0,0);r.canvas.width=c;r.canvas.height=d;r.rotate(-90*a.rotation*Math.PI/180);0==a.rotation&&r.drawImage(a.Canvas.canvas,0,0);1==a.rotation&&r.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,0);2==a.rotation&&r.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,-a.Canvas.canvas.height);3==a.rotation&&r.drawImage(a.Canvas.canvas,0,-a.Canvas.canvas.height);if(0==a.rotation||2==a.rotation)a.Canvas.canvas.height=
817 c,a.Canvas.canvas.width=d;if(1==a.rotation||3==a.rotation)a.Canvas.canvas.height=d,a.Canvas.canvas.width=c;a.Canvas.setTransform(1,0,0,1,0,0);a.Canvas.rotate(90*b*Math.PI/180);a.rotation=b;a.Canvas.drawImage(a.tcanvas,a.rotX(0,0),a.rotY(0,0));a.ScreenWidth=a.Canvas.canvas.width;a.ScreenHeight=a.Canvas.canvas.height;if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);return!0};a.MuchTheSame=function(a,b){return 4>Math.abs(a-b)};a.Debug=function(a){console.log(a)};
818 a.getIEVersion=function(){var a=-1;"Microsoft Internet Explorer"==navigator.appName&&null!=/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)&&(a=parseFloat(RegExp.$1));return a};a.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};return a},CreateKvmDataChannel=function(b,c,a){var d={};d.m=c;c.parent=d;d.webchannel=b;d.State=0;d.protocol=c.protocol;d.onStateChanged=null;d.onControlMsg=null;d.debugmode=0;d.keepalive=a;d.rtcKeepAlive=null;
819 d.Start=function(){1==d.debugmode&&console.log("start");d.xxStateChange(3);d.webchannel.onmessage=d.xxOnMessage;d.rtcKeepAlive=setInterval(d.xxSendRtcKeepAlive,3E4)};var e=new FileReader,n=!1,p=[];e.readAsBinaryString?e.onload=function(a){d.xxOnSocketData(a.target.result);0==p.length?n=!1:e.readAsBinaryString(new Blob([p.shift()]))}:e.readAsArrayBuffer&&(e.onloadend=function(a){d.xxOnSocketData(a.target.result);0==p.length?n=!1:e.readAsArrayBuffer(p.shift())});d.xxOnMessage=function(a){if("string"==
820 typeof a.data){if(null!=d.onControlMsg)d.onControlMsg(a.data)}else if("object"==typeof a.data)if(1==n)p.push(a.data);else if(e.readAsBinaryString)n=!0,e.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)n=!0,e.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,w=0;w<c;w++)b+=String.fromCharCode(a[w]);d.xxOnSocketData(b)}else d.xxOnSocketData(a.data)};d.xxOnSocketData=function(a){if(a){if("object"===typeof a){var b="";a=new Uint8Array(a);for(var c=
821 a.byteLength,e=0;e<c;e++)b+=String.fromCharCode(a[e]);a=b}else if("string"!==typeof a)return;return d.m.ProcessData(a)}};d.sendCtrlMsg=function(a){"string"==typeof a&&(d.webchannel.send(a),urlvars&&urlvars.webrtctrace&&console.log("WebRTC-Send("+d.State+"): ",typeof a,a),null!=d.keepalive&&d.keepalive.sendKeepAlive())};d.send=function(a){if("string"==typeof a){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);a=b}urlvars&&urlvars.webrtctrace&&console.log("WebRTC-Send("+d.State+
822 "): ",typeof a,a);d.webchannel.send(a)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(){1==d.debugmode&&console.log("stop");null!=d.rtcKeepAlive&&(clearInterval(d.rtcKeepAlive),d.rtcKeepAlive=null);d.xxStateChange(0)};d.xxSendRtcKeepAlive=function(){urlvars&&urlvars.webrtctrace&&console.log("WebRTC-SendKeepAlive()");d.sendCtrlMsg(JSON.stringify({action:"ping"}))};return d},CreateAmtRemoteTerminal=
820 -function(b){function c(b){if("\x00"!=b&&7!=b.charCodeAt()){var d=b.charCodeAt();if(0==p.terminalEmulation){b=!0;0==(d&128)?(B=d,z=0,b=!1):192==(d&224)?(B=d&31,z=1,b=!0):224==(d&240)?(B=d&15,z=2,b=!0):128==(d&192)&&(0<z?(B<<=6,B+=d&63,z--,b=0!=z):(z=B=0,b=!0));if(1==b)return;b=String.fromCharCode(B)}else 1==p.terminalEmulation?0!=(d&128)&&(b=String.fromCharCode(I[d&127])):2==p.terminalEmulation&&0!=(d&128)&&(b=String.fromCharCode(F[d&127]));switch(d){case 16:b=" ";break;case 24:b="\u2191";break;case 25:b=
821 -"\u2193"}v>p.width&&(v=p.width);x>p.height-1&&(x=p.height-1);switch(b){case "\b":0<v&&(--v,a(" "));break;case "\t":d=8-v%8;for(b=0;b<d;b++)c(" ");break;case "\n":x++;x>p.height-1&&(n(1),x=p.height-1);break;case "\r":v=0;break;default:v>=p.width&&(v=0,l&&x++,x>=p.height-1&&(n(1),x=p.height-1)),a(b),v++}}}function a(a){C[x][v]=a;r[x][v]=(g<<6)+(w<<12)+m}function d(){for(var a=w<<12,b=v;b<p.width;b++)C[x][b]=" ",r[x][b]=a}function e(a){for(var b=w<<12,c=0;c<p.width;c++)C[a][c]=" ",r[a][c]=b}function n(a){var b;
822 -for(b=0;b<p.height-a;b++)C[b]=C[b+a],r[b]=r[b+a];for(b=p.height-a;b<p.height;b++)for(C[b]=[],r[b]=[],a=0;a<p.width;a++)C[b][a]=" ",r[b][a]=448}var p={};p.DivId=b;p.DivElement=document.getElementById(b);p.protocol=1;p.terminalEmulation=1;p.fxEmulation=0;p.fxLineBreak=0;p.width=80;p.height=25;var q="000000 BB0000 00BB00 BBBB00 0000BB BB00BB 00BBBB BBBBBB 555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF".split(" "),m=0,g=7,w=0,l=!0,v=0,x=0,k=0,h=[],K=0,r=[],C=[],B=0,z=0;p.Start=function(){};p.Init=
823 -function(a,b){p.width=a?a:80;p.height=b?b:25;for(var c=0;c<p.height;c++){C[c]=[];r[c]=[];for(var d=0;d<p.width;d++)C[c][d]=" ",r[c][d]=448}p.TermInit();p.TermDraw()};p.xxStateChange=function(a){};p.ProcessData=function(a){null!=p.capture&&(p.capture+=a);for(var b=0;b<a.length;b++){var n=String.fromCharCode(a.charCodeAt(b)),q=a.charCodeAt(b);switch(k){case 0:switch(q){case 27:k=1;break;default:c(n)}break;case 1:switch(n){case "[":K=0;h=[];k=2;break;case "(":k=4;break;case ")":k=5;break;default:k=0}break;
824 -case 2:if("0"<=n&&"9">=n){h[K]=h[K]?10*h[K]+(n-0):n-0;break}else if(";"==n){K++;break}else{h[0]||(h[0]=0);var q=h,z=K+1,B=void 0;switch(n){case "c":p.TermResetScreen();break;case "A":1==z&&(x-=q[0],0>x&&(x=0));break;case "B":1==z&&(x+=q[0],x>p.height&&(x=p.height));break;case "C":1==z&&(v+=q[0],v>p.width&&(v=p.width));break;case "D":1==z&&(v-=q[0],0>v&&(v=0));break;case "d":1==z&&(x=q[0]-1,x>p.height&&(x=p.height),0>x&&(x=0));break;case "G":1==z&&(v=q[0]-1,0>v&&(v=0),79<v&&(v=79));break;case "J":if(1==
825 -z&&2==q[0])p.TermClear((w<<12)+(g<<6)),x=v=0;else if(0==z||1==z&&0==q[0])for(d(),B=x+1;B<p.height;B++)e(B);else if(1==z&&1==q[0])for(d(),B=0;B<x-1;B++)e(B);break;case "H":2==z?(1>q[0]&&(q[0]=1),1>q[1]&&(q[1]=1),q[0]>p.height&&(q[0]=p.height),q[1]>p.width&&(q[1]=p.width),x=q[0]-1,v=q[1]-1):v=x=0;break;case "m":for(B=0;B<z;B++)q[B]&&0!=q[B]?1==q[B]?8>g&&(g+=8):2==q[B]||22==q[B]?8<=g&&(g-=8):7==q[B]?m=2:27==q[B]?m=0:30<=q[B]&&37>=q[B]?(n=8<=g,g=q[B]-30,n&&8>=g&&(g+=8)):40<=q[B]&&47>=q[B]?w=q[B]-40:90<=
826 -q[B]&&99>=q[B]?g=q[B]-82:100<=q[B]&&109>=q[B]&&(w=q[B]-92):(w=0,g=7,m=0);break;case "K":if(0!=z&&(1!=z||q[0]&&0!=q[0])){if(1==z)if(1==q[0])for(n=w<<12,q=0;q<v;q++)C[x][q]=" ",r[x][q]=n;else 2==q[0]&&e(x)}else d();break;case "h":l=!0;break;case "l":l=!1}k=0}break;case 4:k=0;break;case 5:k=0}}p.TermDraw()};p.ProcessVt100String=function(a){for(var b=0;b<a.length;b++)c(String.fromCharCode(a.charCodeAt(b)))};var I=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,
823 +function(b){function c(b){if("\x00"!=b&&7!=b.charCodeAt()){var d=b.charCodeAt();if(0==p.terminalEmulation){b=!0;0==(d&128)?(B=d,y=0,b=!1):192==(d&224)?(B=d&31,y=1,b=!0):224==(d&240)?(B=d&15,y=2,b=!0):128==(d&192)&&(0<y?(B<<=6,B+=d&63,y--,b=0!=y):(y=B=0,b=!0));if(1==b)return;b=String.fromCharCode(B)}else 1==p.terminalEmulation?0!=(d&128)&&(b=String.fromCharCode(I[d&127])):2==p.terminalEmulation&&0!=(d&128)&&(b=String.fromCharCode(F[d&127]));switch(d){case 16:b=" ";break;case 24:b="\u2191";break;case 25:b=
824 +"\u2193"}v>p.width&&(v=p.width);x>p.height-1&&(x=p.height-1);switch(b){case "\b":0<v&&(--v,a(" "));break;case "\t":d=8-v%8;for(b=0;b<d;b++)c(" ");break;case "\n":x++;x>p.height-1&&(n(1),x=p.height-1);break;case "\r":v=0;break;default:v>=p.width&&(v=0,l&&x++,x>=p.height-1&&(n(1),x=p.height-1)),a(b),v++}}}function a(a){C[x][v]=a;q[x][v]=(g<<6)+(w<<12)+m}function d(){for(var a=w<<12,b=v;b<p.width;b++)C[x][b]=" ",q[x][b]=a}function e(a){for(var b=w<<12,c=0;c<p.width;c++)C[a][c]=" ",q[a][c]=b}function n(a){var b;
825 +for(b=0;b<p.height-a;b++)C[b]=C[b+a],q[b]=q[b+a];for(b=p.height-a;b<p.height;b++)for(C[b]=[],q[b]=[],a=0;a<p.width;a++)C[b][a]=" ",q[b][a]=448}var p={};p.DivId=b;p.DivElement=document.getElementById(b);p.protocol=1;p.terminalEmulation=1;p.fxEmulation=0;p.fxLineBreak=0;p.width=80;p.height=25;var r="000000 BB0000 00BB00 BBBB00 0000BB BB00BB 00BBBB BBBBBB 555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF".split(" "),m=0,g=7,w=0,l=!0,v=0,x=0,k=0,h=[],K=0,q=[],C=[],B=0,y=0;p.Start=function(){};p.Init=
826 +function(a,b){p.width=a?a:80;p.height=b?b:25;for(var c=0;c<p.height;c++){C[c]=[];q[c]=[];for(var d=0;d<p.width;d++)C[c][d]=" ",q[c][d]=448}p.TermInit();p.TermDraw()};p.xxStateChange=function(a){};p.ProcessData=function(a){null!=p.capture&&(p.capture+=a);for(var b=0;b<a.length;b++){var n=String.fromCharCode(a.charCodeAt(b)),r=a.charCodeAt(b);switch(k){case 0:switch(r){case 27:k=1;break;default:c(n)}break;case 1:switch(n){case "[":K=0;h=[];k=2;break;case "(":k=4;break;case ")":k=5;break;default:k=0}break;
827 +case 2:if("0"<=n&&"9">=n){h[K]=h[K]?10*h[K]+(n-0):n-0;break}else if(";"==n){K++;break}else{h[0]||(h[0]=0);var r=h,y=K+1,B=void 0;switch(n){case "c":p.TermResetScreen();break;case "A":1==y&&(x-=r[0],0>x&&(x=0));break;case "B":1==y&&(x+=r[0],x>p.height&&(x=p.height));break;case "C":1==y&&(v+=r[0],v>p.width&&(v=p.width));break;case "D":1==y&&(v-=r[0],0>v&&(v=0));break;case "d":1==y&&(x=r[0]-1,x>p.height&&(x=p.height),0>x&&(x=0));break;case "G":1==y&&(v=r[0]-1,0>v&&(v=0),79<v&&(v=79));break;case "J":if(1==
828 +y&&2==r[0])p.TermClear((w<<12)+(g<<6)),x=v=0;else if(0==y||1==y&&0==r[0])for(d(),B=x+1;B<p.height;B++)e(B);else if(1==y&&1==r[0])for(d(),B=0;B<x-1;B++)e(B);break;case "H":2==y?(1>r[0]&&(r[0]=1),1>r[1]&&(r[1]=1),r[0]>p.height&&(r[0]=p.height),r[1]>p.width&&(r[1]=p.width),x=r[0]-1,v=r[1]-1):v=x=0;break;case "m":for(B=0;B<y;B++)r[B]&&0!=r[B]?1==r[B]?8>g&&(g+=8):2==r[B]||22==r[B]?8<=g&&(g-=8):7==r[B]?m=2:27==r[B]?m=0:30<=r[B]&&37>=r[B]?(n=8<=g,g=r[B]-30,n&&8>=g&&(g+=8)):40<=r[B]&&47>=r[B]?w=r[B]-40:90<=
829 +r[B]&&99>=r[B]?g=r[B]-82:100<=r[B]&&109>=r[B]&&(w=r[B]-92):(w=0,g=7,m=0);break;case "K":if(0!=y&&(1!=y||r[0]&&0!=r[0])){if(1==y)if(1==r[0])for(n=w<<12,r=0;r<v;r++)C[x][r]=" ",q[x][r]=n;else 2==r[0]&&e(x)}else d();break;case "h":l=!0;break;case "l":l=!1}k=0}break;case 4:k=0;break;case 5:k=0}}p.TermDraw()};p.ProcessVt100String=function(a){for(var b=0;b<a.length;b++)c(String.fromCharCode(a.charCodeAt(b)))};var I=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,
830 251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,171,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160],F=[199,252,233,
831 226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,174,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,
829 -8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160];p.TermClear=function(a){for(var b=0;b<p.height;b++)for(var c=0;c<p.width;c++)C[b][c]=" ",r[b][c]=a};p.TermResetScreen=function(){m=0;g=7;w=0;l=!0;x=v=0;p.TermClear(448)};p.TermSendKeys=function(a){console.log(a);p.parent.Send(a)};p.TermSendKey=function(a){p.parent.Send(String.fromCharCode(a))};p.TermHandleKeys=function(a){if(!a.ctrlKey)return 127==a.which?p.TermSendKey(8):13==a.which?p.TermSendKeys(0==p.fxLineBreak?"\r\n":"\n"):0!=a.which&&
832 +8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160];p.TermClear=function(a){for(var b=0;b<p.height;b++)for(var c=0;c<p.width;c++)C[b][c]=" ",q[b][c]=a};p.TermResetScreen=function(){m=0;g=7;w=0;l=!0;x=v=0;p.TermClear(448)};p.TermSendKeys=function(a){console.log(a);p.parent.Send(a)};p.TermSendKey=function(a){p.parent.Send(String.fromCharCode(a))};p.TermHandleKeys=function(a){if(!a.ctrlKey)return 127==a.which?p.TermSendKey(8):13==a.which?p.TermSendKeys(0==p.fxLineBreak?"\r\n":"\n"):0!=a.which&&
833 p.TermSendKey(a.which),!1;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation()};p.TermHandleKeyUp=function(a){if(8!=a.which&&32!=a.which&&9!=a.which)return!0;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};p.TermHandleKeyDown=function(a){if(65<=a.which&&90>=a.which&&1==a.ctrlKey)p.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return p.TermSendKeys(String.fromCharCode(27)),
834 !0;if(37==a.which)return p.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return p.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return p.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return p.TermSendKeys(String.fromCharCode(27,91,66)),!0;if(9==a.which)return p.TermSendKeys("\t"),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),!0;var b=[80,81,119,120,116,117,113,114,112,77],c=[49,50,51,52,53,54,55,56,57,48,33,64],d=[80,81,
835 82,83,84,85,86,87,88,89,90,91];if(111<a.which&124>a.which&&0==a.repeat){if(0==p.fxEmulation&&122>a.which)return p.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==p.fxEmulation)return p.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==p.fxEmulation)return p.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;p.TermSendKey(a.which);a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};
833 -p.TermDraw=function(){for(var a,b="",c="",d=1,e,g=0;g<p.height;++g){for(var h=0;h<p.width;++h)switch(a=r[g][h],v==h&&x==g&&(a|=2),a!=d&&(b+=c,c="",d=6,e=12,a&2&&(d=12,e=6),b+='<span style="color:#'+q[a>>d&63]+";background-color:#"+q[a>>e&63],a&1&&(b+=";text-decoration:underline"),b+=';">',c="</span>"+c,d=a),a=C[g][h],a){case "&":b+="&amp;";break;case "<":b+="&lt;";break;case ">":b+="&gt;";break;case " ":b+="&nbsp;";break;default:b+=a}g!=p.height-1&&(b+="<br>")}p.DivElement.innerHTML="<font size='4'><b>"+
834 -b+c+"</b></font>"};p.TermInit=function(){p.TermResetScreen()};p.Init();return p},saveAs=saveAs||function(b){if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var c=b.document.createElementNS("http://www.w3.org/1999/xhtml","a"),a="download"in c,d=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),e=b.webkitRequestFileSystem,n=b.requestFileSystem||e||b.mozRequestFileSystem,p=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},q=0,m=function(a){var c=function(){"string"===
835 -typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()};b.chrome?c():setTimeout(c,500)},g=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"===typeof e)try{e.call(a,c||a)}catch(g){p(g)}}},w=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a},l=function(l,k,h){h||(l=w(l));var p=this;h=l.type;var r=!1,v,B,z=function(){g(p,["writestart","progress","write","writeend"])},
836 -I=function(){if(B&&d&&"undefined"!==typeof FileReader){var a=new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));p.readyState=p.DONE;z()};a.readAsDataURL(l);p.readyState=p.INIT}else{if(r||!v)v=(b.URL||b.webkitURL||b).createObjectURL(l);B?B.location.href=v:void 0==b.open(v,"_blank")&&d&&(b.location.href=v);p.readyState=p.DONE;z();m(v)}},F=function(a){return function(){if(p.readyState!==p.DONE)return a.apply(this,arguments)}},E={create:!0,
837 -exclusive:!1},y;p.readyState=p.INIT;k||(k="download");if(a)v=(b.URL||b.webkitURL||b).createObjectURL(l),c.href=v,c.download=k,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);z();m(v);p.readyState=p.DONE});else{b.chrome&&h&&"application/octet-stream"!==h&&(y=l.slice||l.webkitSlice,l=y.call(l,0,l.size,"application/octet-stream"),r=!0);e&&"download"!==k&&(k+=".download");if("application/octet-stream"===h||e)B=b;n?(q+=l.size,n(b.TEMPORARY,q,F(function(a){a.root.getDirectory("saved",
836 +p.TermDraw=function(){for(var a,b="",c="",d=1,e,g=0;g<p.height;++g){for(var h=0;h<p.width;++h)switch(a=q[g][h],v==h&&x==g&&(a|=2),a!=d&&(b+=c,c="",d=6,e=12,a&2&&(d=12,e=6),b+='<span style="color:#'+r[a>>d&63]+";background-color:#"+r[a>>e&63],a&1&&(b+=";text-decoration:underline"),b+=';">',c="</span>"+c,d=a),a=C[g][h],a){case "&":b+="&amp;";break;case "<":b+="&lt;";break;case ">":b+="&gt;";break;case " ":b+="&nbsp;";break;default:b+=a}g!=p.height-1&&(b+="<br>")}p.DivElement.innerHTML="<font size='4'><b>"+
837 +b+c+"</b></font>"};p.TermInit=function(){p.TermResetScreen()};p.Init();return p},saveAs=saveAs||function(b){if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var c=b.document.createElementNS("http://www.w3.org/1999/xhtml","a"),a="download"in c,d=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),e=b.webkitRequestFileSystem,n=b.requestFileSystem||e||b.mozRequestFileSystem,p=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},r=0,m=function(a){var c=function(){"string"===
838 +typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()};b.chrome?c():setTimeout(c,500)},g=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"===typeof e)try{e.call(a,c||a)}catch(g){p(g)}}},w=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a},l=function(l,k,h){h||(l=w(l));var p=this;h=l.type;var q=!1,v,B,y=function(){g(p,["writestart","progress","write","writeend"])},
839 +I=function(){if(B&&d&&"undefined"!==typeof FileReader){var a=new FileReader;a.onloadend=function(){var b=a.result;B.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));p.readyState=p.DONE;y()};a.readAsDataURL(l);p.readyState=p.INIT}else{if(q||!v)v=(b.URL||b.webkitURL||b).createObjectURL(l);B?B.location.href=v:void 0==b.open(v,"_blank")&&d&&(b.location.href=v);p.readyState=p.DONE;y();m(v)}},F=function(a){return function(){if(p.readyState!==p.DONE)return a.apply(this,arguments)}},E={create:!0,
840 +exclusive:!1},z;p.readyState=p.INIT;k||(k="download");if(a)v=(b.URL||b.webkitURL||b).createObjectURL(l),c.href=v,c.download=k,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);y();m(v);p.readyState=p.DONE});else{b.chrome&&h&&"application/octet-stream"!==h&&(z=l.slice||l.webkitSlice,l=z.call(l,0,l.size,"application/octet-stream"),q=!0);e&&"download"!==k&&(k+=".download");if("application/octet-stream"===h||e)B=b;n?(r+=l.size,n(b.TEMPORARY,r,F(function(a){a.root.getDirectory("saved",
841 E,F(function(a){var b=function(){a.getFile(k,E,F(function(a){a.createWriter(F(function(b){b.onwriteend=function(b){B.location.href=a.toURL();p.readyState=p.DONE;g(p,"writeend",b);m(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&I()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=p["on"+a]});b.write(l);p.abort=function(){b.abort();p.readyState=p.DONE};p.readyState=p.WRITING}),I)}),I)};a.getFile(k,{create:!1},F(function(a){a.remove();b()}),F(function(a){a.code===
842 a.NOT_FOUND_ERR?b():I()}))}),I)}),I)):I()}},v=l.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a,b,c){c||(a=w(a));return navigator.msSaveOrOpenBlob(a,b||"download")};v.abort=function(){this.readyState=this.DONE;g(this,"abort")};v.readyState=v.INIT=0;v.WRITING=1;v.DONE=2;v.error=v.onwritestart=v.onprogress=v.onwrite=v.onabort=v.onerror=v.onwriteend=null;return function(a,b,c){return new l(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&
843 window||this.content);"undefined"!==typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs});
844 var version="0.7.5",urlvars={},amtstack,wsstack=null,AllWsman="AMT_8021xCredentialContext AMT_8021XProfile AMT_ActiveFilterStatistics AMT_AgentPresenceCapabilities AMT_AgentPresenceInterfacePolicy AMT_AgentPresenceService AMT_AgentPresenceWatchdog AMT_AgentPresenceWatchdogAction AMT_AlarmClockService IPS_AlarmClockOccurrence AMT_AssetTable AMT_AssetTableService AMT_AuditLog AMT_AuditPolicyRule AMT_AuthorizationService AMT_BootCapabilities AMT_BootSettingData AMT_ComplexFilterEntryBase AMT_CRL AMT_CryptographicCapabilities AMT_EACCredentialContext AMT_EndpointAccessControlService AMT_EnvironmentDetectionInterfacePolicy AMT_EnvironmentDetectionSettingData AMT_EthernetPortSettings AMT_EventLogEntry AMT_EventManagerService AMT_EventSubscriber AMT_FilterEntryBase AMT_FilterInSystemDefensePolicy AMT_GeneralSettings AMT_GeneralSystemDefenseCapabilities AMT_Hdr8021Filter AMT_HeuristicPacketFilterInterfacePolicy AMT_HeuristicPacketFilterSettings AMT_HeuristicPacketFilterStatistics AMT_InterfacePolicy AMT_IPHeadersFilter AMT_KerberosSettingData AMT_ManagementPresenceRemoteSAP AMT_MessageLog AMT_MPSUsernamePassword AMT_NetworkFilter AMT_NetworkPortDefaultSystemDefensePolicy AMT_NetworkPortSystemDefenseCapabilities AMT_NetworkPortSystemDefensePolicy AMT_PCIDevice AMT_PETCapabilities AMT_PETFilterForTarget AMT_PETFilterSetting AMT_ProvisioningCertificateHash AMT_PublicKeyCertificate AMT_PublicKeyManagementCapabilities AMT_PublicKeyManagementService AMT_PublicPrivateKeyPair AMT_RedirectionService AMT_RemoteAccessCapabilities AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule AMT_RemoteAccessService AMT_SetupAndConfigurationService AMT_SNMPEventSubscriber AMT_StateTransitionCondition AMT_SystemDefensePolicy AMT_SystemDefensePolicyInService AMT_SystemDefenseService AMT_SystemPowerScheme AMT_ThirdPartyDataStorageAdministrationService AMT_ThirdPartyDataStorageService AMT_TimeSynchronizationService AMT_TLSCredentialContext AMT_TLSProtocolEndpoint AMT_TLSProtocolEndpointCollection AMT_TLSSettingData AMT_TrapTargetForService AMT_UserInitiatedConnectionService AMT_WebUIService AMT_WiFiPortConfigurationService CIM_AbstractIndicationSubscription CIM_Account CIM_AccountManagementCapabilities CIM_AccountManagementService CIM_AccountOnSystem CIM_AdminDomain CIM_AlertIndication CIM_AssignedIdentity CIM_AssociatedPowerManagementService CIM_AuthenticationService CIM_AuthorizationService CIM_BIOSElement CIM_BIOSFeature CIM_BIOSFeatureBIOSElements CIM_BootConfigSetting CIM_BootService CIM_BootSettingData CIM_BootSourceSetting CIM_Capabilities CIM_Card CIM_Chassis CIM_Chip CIM_Collection CIM_Component CIM_ComputerSystem CIM_ComputerSystemPackage CIM_ConcreteComponent CIM_ConcreteDependency CIM_Controller CIM_CoolingDevice CIM_Credential CIM_CredentialContext CIM_CredentialManagementService CIM_Dependency CIM_DeviceSAPImplementation CIM_ElementCapabilities CIM_ElementConformsToProfile CIM_ElementLocation CIM_ElementSettingData CIM_ElementSoftwareIdentity CIM_ElementStatisticalData CIM_EnabledLogicalElement CIM_EnabledLogicalElementCapabilities CIM_EthernetPort CIM_Fan CIM_FilterCollection CIM_FilterCollectionSubscription CIM_HostedAccessPoint CIM_HostedDependency CIM_HostedService CIM_Identity CIM_IEEE8021xCapabilities CIM_IEEE8021xSettings CIM_Indication CIM_IndicationService CIM_InstalledSoftwareIdentity CIM_KVMRedirectionSAP CIM_LANEndpoint CIM_ListenerDestination CIM_ListenerDestinationWSManagement CIM_Location CIM_Log CIM_LogEntry CIM_LogicalDevice CIM_LogicalElement CIM_LogicalPort CIM_LogicalPortCapabilities CIM_LogManagesRecord CIM_ManagedCredential CIM_ManagedElement CIM_ManagedSystemElement CIM_MediaAccessDevice CIM_MemberOfCollection CIM_Memory CIM_MessageLog CIM_NetworkPort CIM_NetworkPortCapabilities CIM_NetworkPortConfigurationService CIM_OrderedComponent CIM_OwningCollectionElement CIM_OwningJobElement CIM_PCIController CIM_PhysicalComponent CIM_PhysicalElement CIM_PhysicalElementLocation CIM_PhysicalFrame CIM_PhysicalMemory CIM_PhysicalPackage CIM_Policy CIM_PolicyAction CIM_PolicyCondition CIM_PolicyInSystem CIM_PolicyRule CIM_PolicyRuleInSystem CIM_PolicySet CIM_PolicySetAppliesToElement CIM_PolicySetInSystem CIM_PowerManagementCapabilities CIM_PowerManagementService CIM_PowerSupply CIM_Privilege CIM_PrivilegeManagementCapabilities CIM_PrivilegeManagementService CIM_ProcessIndication CIM_Processor CIM_ProtocolEndpoint CIM_ProvidesServiceToElement CIM_Realizes CIM_RecordForLog CIM_RecordLog CIM_RedirectionService CIM_ReferencedProfile CIM_RegisteredProfile CIM_RemoteAccessAvailableToElement CIM_RemoteIdentity CIM_RemotePort CIM_RemoteServiceAccessPoint CIM_Role CIM_RoleBasedAuthorizationService CIM_RoleBasedManagementCapabilities CIM_RoleLimitedToTarget CIM_SAPAvailableForElement CIM_SecurityService CIM_Sensor CIM_Service CIM_ServiceAccessBySAP CIM_ServiceAccessPoint CIM_ServiceAffectsElement CIM_ServiceAvailableToElement CIM_ServiceSAPDependency CIM_ServiceServiceDependency CIM_SettingData CIM_SharedCredential CIM_SoftwareElement CIM_SoftwareFeature CIM_SoftwareFeatureSoftwareElements CIM_SoftwareIdentity CIM_StatisticalData CIM_StorageExtent CIM_System CIM_SystemBIOS CIM_SystemComponent CIM_SystemDevice CIM_SystemPackaging CIM_UseOfLog CIM_Watchdog CIM_WiFiEndpoint CIM_WiFiEndpointCapabilities CIM_WiFiEndpointSettings CIM_WiFiPort CIM_WiFiPortCapabilities IPS_AdminProvisioningRecord IPS_ClientProvisioningRecord IPS_HostBasedSetupService IPS_HostIPSettings IPS_HTTPProxyService IPS_HTTPProxyAccessPoint IPS_IderSessionUsingPort IPS_IPv6PortSettings IPS_KVMRedirectionSettingData IPS_KvmSessionUsingPort IPS_ManualProvisioningRecord IPS_OptInService IPS_ProvisioningAuditRecord IPS_ProvisioningRecordLog IPS_RasSessionUsingPort IPS_ScreenConfigurationService IPS_ScreenSettingData IPS_SecIOService IPS_SessionUsingPort IPS_SolSessionUsingPort IPS_TLSProvisioningRecord IPS_WatchDogAction".split(" "),disconnecturl=
845 null,terminal,currentView=0,LoadingHtml="<div style=text-align:center;padding-top:20px>Loading...<div>",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encoding:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1},currentMeshNode=null,webcompilerfeatures="AgentPresence Alarms AuditLog Certificates ComputerSelectorToolbar Desktop DesktopInband DesktopInbandFiles Desktop-Multi DesktopRotation Desktop-Settings EventLog EventSubscriptions FileSaver HardwareInfo IDER IDERDebug IDERStats Look-MeshCentral Mode-MeshCentral2 NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Scripting Scripting-Editor Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "),
846 StatusStrs=["Disconnected","Connecting...","Setup...","Connected"],scriptstate,t,t2,rsepass=null;
844 -function startup(){var b=document.getElementsByTagName("input");for(t=0;t<b.length;t++)b[t].id&&(window[b[t].id]=b[t]);urlvars=getUrlVars();for(var c in AllWsman)b=document.createElement("option"),b.text=AllWsman[c],b.id="WSB-"+AllWsman[c],Q(24).add(b);desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk",Q(8)));desktop.onStateChanged=onDesktopStateChange;QE("c8",!0);(t=localStorage.getItem("desktopsettings"))&&(desktopsettings=JSON.parse(t));applyDesktopSettings();
845 -terminal=CreateAmtRedirect(CreateAmtRemoteTerminal("Term"));terminal.onStateChanged=onTerminalStateChange;Q(35).value=terminalEmulations[terminal.m.terminalEmulation];Q(32).value=["CR+LF","LF"][terminal.m.fxLineBreak];QE("c3",!0);Q("p13").addEventListener("dragover",haltEvent,!1);Q("p13").addEventListener("dragleave",haltEvent,!1);Q("p13").addEventListener("drop",terminal_FileSelectHandler,!1);document.addEventListener("dragover",haltEvent,!1);document.addEventListener("dragleave",
846 -haltEvent,!1);document.addEventListener("drop",documentFileSelectHandler,!1);Q("p16").addEventListener("dragover",haltEvent,!1);Q("p16").addEventListener("dragleave",haltEvent,!1);Q("p16").addEventListener("drop",cert_FileSelectHandler,!1);Q("Desk").toBlob||QV("c5",!1);document.onkeyup=handleKeyUp;document.onkeydown=handleKeyDown;document.onkeypress=handleKeyPress;window.onresize=center;center();scriptLoadStartingBlocks();Q("p24filetable").addEventListener("drop",p24fileDragDrop,!1);
847 +function startup(){var b=document.getElementsByTagName("input");for(t=0;t<b.length;t++)b[t].id&&(window[b[t].id]=b[t]);urlvars=getUrlVars();for(var c in AllWsman)b=document.createElement("option"),b.text=AllWsman[c],b.id="WSB-"+AllWsman[c],Q(24).add(b);desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk",Q(8)));desktop.onStateChanged=onDesktopStateChange;QE("c10",!0);(t=localStorage.getItem("desktopsettings"))&&(desktopsettings=JSON.parse(t));applyDesktopSettings();
848 +terminal=CreateAmtRedirect(CreateAmtRemoteTerminal("Term"));terminal.onStateChanged=onTerminalStateChange;Q(35).value=terminalEmulations[terminal.m.terminalEmulation];Q(32).value=["CR+LF","LF"][terminal.m.fxLineBreak];QE("c4",!0);Q("p13").addEventListener("dragover",haltEvent,!1);Q("p13").addEventListener("dragleave",haltEvent,!1);Q("p13").addEventListener("drop",terminal_FileSelectHandler,!1);document.addEventListener("dragover",haltEvent,!1);document.addEventListener("dragleave",
849 +haltEvent,!1);document.addEventListener("drop",documentFileSelectHandler,!1);Q("p16").addEventListener("dragover",haltEvent,!1);Q("p16").addEventListener("dragleave",haltEvent,!1);Q("p16").addEventListener("drop",cert_FileSelectHandler,!1);Q("Desk").toBlob||QV("c6",!1);document.onkeyup=handleKeyUp;document.onkeydown=handleKeyDown;document.onkeypress=handleKeyPress;window.onresize=center;center();scriptLoadStartingBlocks();Q("p24filetable").addEventListener("drop",p24fileDragDrop,!1);
850 Q("p24filetable").addEventListener("dragover",p24fileDragOver,!1);Q("p24filetable").addEventListener("dragleave",p24fileDragLeave,!1)}
851 function documentFileSelectHandler(b){haltEvent(b);if(null!=b.dataTransfer&&1==b.dataTransfer.files.length){var c=null,a=b.dataTransfer.files[0].name.toLowerCase();21==currentView?UploadToStorage(b.dataTransfer.files[0],a):(null!=wsstack&&(a.endsWith(".mescript")||a.endsWith(".meblocks"))&&(c=script_onScriptRead),null!=c&&(a=new FileReader,a.onload=c,a.readAsBinaryString(b.dataTransfer.files[0])))}}
852 function connectButtonfunction(){wsstack&&0!=wsstack.socketState?disconnect():meshcentral2credCallback()}function connectButtonfunctionEx(){currentMeshNode=parent.getCurrentNode();connect(currentMeshNode._id,16992,null,null,0);Q("xconnectbutton1").value="Disconnect"}function getCurrentMeshNode(){return currentMeshNode}function setConnectionState(b){QE("xconnectbutton1",b);0==b&&disconnect()}function setFrameHeight(b){}function setAuthCallback(b){meshcentral2credCallback=b}
850 -function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c2.value="Start Capture";terminal.m.capture&&delete terminal.m.capture;terminal.Stop();desktop.Stop()}
853 +function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3.value="Start Capture";terminal.m.capture&&delete terminal.m.capture;terminal.Stop();desktop.Stop()}
854 function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(49).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeyUp(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeyUp(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeyUp(b)}}
855 function handleKeyDown(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(49).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeyDown(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeyDown(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeyDown(b)}}
856 function handleKeyPress(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(49).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeys(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeys(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeys(b)}}var connectFunc=null,connectFuncTag=null;
@@ -867,8 +870,8 @@ b&&PullWireless()}function processSystemTime(b,c,a,d){errcheck(d,b)||200!=d||(b=
870 function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationService||400==a.IPS_ScreenConfigurationService.status)a.IPS_ScreenConfigurationService=null;if(void 0==a.IPS_KVMRedirectionSettingData||400==a.IPS_KVMRedirectionSettingData.status)a.IPS_KVMRedirectionSettingData=null;if(void 0==a.CIM_KVMRedirectionSAP||400==a.CIM_KVMRedirectionSAP.status)a.CIM_KVMRedirectionSAP=null;if(void 0==a.IPS_OptInService||400==a.IPS_OptInService.status)a.IPS_OptInService=null;void 0!=a.AMT_RedirectionService&&
871 200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var e in a)null!=a[e]&&a[e].status>d&&(d=a[e].status);400!=d&&errcheck(d,b)||(amtsysstate=a,updateSystemStatus())}var DMTFPowerStates=";;Power on;Light sleep;Deep sleep;Power cycle (Soft off);Off - Hard;Hibernate (Off soft);Soft off;Power cycle (Off-hard);Master bus reset;Diagnostic interrupt (NMI);Not applicable;Off - Soft graceful;Off - Hard graceful;Master bus reset graceful;Power cycle (Off - Soft graceful);Power cycle (Off - Hard graceful);Diagnostic interrupt (INIT)".split(";");
872 function updateSystemStatus(){if(amtsysstate&&!(99<currentView)){var b=0,c,a,d=TableStart(),e="",n=amtsysstate.AMT_GeneralSettings.response;t="Unknown";null!=amtsysstate.CIM_ServiceAvailableToElement&&(t=DMTFPowerStates[amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState]);QH(30,t);0!=desktop.State&&0<Q(41).innerHTML.length&&Q(41).innerHTML!=t&&(desktop.Stop(),setTimeout(connectDesktop,50));QH(41,t);n.PowerSource&&(t+=[", Plugged-in",", On Battery"][n.PowerSource]);
870 -d+=TableEntry("Power",addLink(t,"showPowerActionDlg()"));c=n.HostName;a=n.DomainName;null!=a&&0<a.length&&(c+="."+a);c=0==c.length?"<i>None</i>":EscapeHtml(c);d+=TableEntry("Name & Domain",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));HardwareInventory&&(d+=TableEntry("System ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var p="",q=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");
871 -2==q.ProvisioningState&&5<amtversion&&(p=" activated in Admin Control Mode (ACM)",4==q.ProvisioningMode&&(p=" activated in Client Control Mode (CCM)",b=9));d+=TableEntry("Intel&reg; ME","v"+getItem(amtlogicalelements,"InstanceID","AMT").VersionString+p)}QV(29,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState);QV(40,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState);if(200==amtsysstate.AMT_RedirectionService.status){var m=amtfeatures[0]=
873 +d+=TableEntry("Power",addLink(t,"showPowerActionDlg()"));c=n.HostName;a=n.DomainName;null!=a&&0<a.length&&(c+="."+a);c=0==c.length?"<i>None</i>":EscapeHtml(c);d+=TableEntry("Name & Domain",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));HardwareInventory&&(d+=TableEntry("System ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var p="",r=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");
874 +2==r.ProvisioningState&&5<amtversion&&(p=" activated in Admin Control Mode (ACM)",4==r.ProvisioningMode&&(p=" activated in Client Control Mode (CCM)",b=9));d+=TableEntry("Intel&reg; ME","v"+getItem(amtlogicalelements,"InstanceID","AMT").VersionString+p)}QV(29,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState);QV(40,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState);if(200==amtsysstate.AMT_RedirectionService.status){var m=amtfeatures[0]=
875 1==amtsysstate.AMT_RedirectionService.response.ListenerEnabled,g=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),p=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),w=amtfeatures[3]=void 0;5<amtversion&&null!=amtsysstate.CIM_KVMRedirectionSAP&&(QV("go14",!0),w=amtfeatures[3]=6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState&&2==amtsysstate.CIM_KVMRedirectionSAP.response.RequestedState||2==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState||
876 6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState);m&&(e+=", Redirection Port");g&&(e+=", Serial-over-LAN");p&&(e+=", IDE-Redirect");w&&(e+=", KVM");""==e&&(e=" None");d+=TableEntry("Active Features",addLinkConditional(e.substring(2),"showFeaturesDlg()",xxAccountAdminName))}null!=amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response&&(p=amtsysstate.IPS_KVMRedirectionSettingData.response,e="Primary display",7<amtversion&&void 0!==p.DefaultScreen&&255>
877 p.DefaultScreen&&(e=["Primary display","Secondary display","3rd display"][p.DefaultScreen]),e='<span title="The default remote display is the '+e.toLowerCase()+'">'+e+"</span>",1==p.Is5900PortEnabled&&(e+=", Port 5900 enabled"),1==p.OptInPolicy&&(e+=", "+p.OptInPolicyTimeout+" second"+(0<p.OptInPolicyTimeout?"s":"")+" opt-in"),e+=", "+p.SessionTimeout+" minute"+(0<p.SessionTimeout?"s":"")+" session timeout",9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService?((p=0!=(amtsysstate.IPS_ScreenConfigurationService.response.EnabledState&
@@ -884,14 +887,14 @@ for(var g="Disabled",l,e=amtsysstate.CIM_ElementSettingData.responses,m=0;m<e.le
887 if(1==l){if(c.CurrentAddressInfo&&0<c.CurrentAddressInfo.length){c.CurrentAddressInfo=MakeToArray(c.CurrentAddressInfo);ipv6addr="";for(m=0;m<c.CurrentAddressInfo.length;m++)0<ipv6addr.length&&(ipv6addr+=", "),ipv6addr+=c.CurrentAddressInfo[m].split(",")[0];d+=TableEntry("IPv6 address",addLink(ipv6addr,"showIPv6AddrDlg("+a+',"'+c.CurrentAddressInfo+'")'))}else d+=TableEntry("IPv6 address","None");isIpAddress(c.CurrentDefaultRouter)&&(d+=TableEntry("IPv6 default router",c.CurrentDefaultRouter));isIpAddress(c.CurrentPrimaryDNS)&&
888 (e=c.CurrentPrimaryDNS,isIpAddress(c.CurrentSecondaryDNS)&&(e+=" / "+c.CurrentSecondaryDNS),d+=TableEntry("IPv6 domain name server",e))}}d+=TableEnd()}}1!=urlvars.kvmonly&&0==fullscreenonly&&(-1!=amtwirelessif&&0==(amtFirstPull&2)&&PullWireless(),QH(21,d),1==b&&0==(amtFirstPull&4)&&PullSystemDefense(),0==(amtFirstPull&8)&&(11<amtversion||11==amtversion&&5<amtversionmin)&&PullStorage());0==currentView&&go(1,1)}}
889 function isIpAddress(b,c){return b&&null!=b&&0<b.length&&"::"!=b&&"::0"!=b?b:c}var IntelAmtEntireState,IntelAmtEntireStateCalls;
887 -function saveEntireAmtState(){if(!xxdialogMode){var b="",c=new Date;amtsysstate&&(b="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);c27.value="amtstate"+b+".json";setDialogMode(19,"Save Entire Intel&reg; AMT State",3,saveEntireAmtStateOk)}}
890 +function saveEntireAmtState(){if(!xxdialogMode){var b="",c=new Date;amtsysstate&&(b="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);c29.value="amtstate"+b+".json";setDialogMode(19,"Save Entire Intel&reg; AMT State",3,saveEntireAmtStateOk)}}
891 function saveEntireAmtStateOk(){IntelAmtEntireState={webappversion:version,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()};QH(61,"Fetching entire state, please wait...");setDialogMode(1,"Save Entire Intel&reg; AMT State",0,null);IntelAmtEntireStateCalls=3;amtstack.BatchEnum(null,AllWsman,saveEntireAmtStateOk2,null,!0);amtstack.GetAuditLog(saveEntireAmtStateOk3);amtstack.GetMessageLog(saveEntireAmtStateOk4)}
889 -function saveEntireAmtStateOk2(b,c,a,d){IntelAmtEntireState.wsmanenums=a;saveEntireAmtStateDone()}function saveEntireAmtStateOk3(b,c){IntelAmtEntireState.auditlog=c;saveEntireAmtStateDone()}function saveEntireAmtStateOk4(b,c){IntelAmtEntireState.eventlog=c;saveEntireAmtStateDone()}function saveEntireAmtStateDone(){0==--IntelAmtEntireStateCalls&&(setDialogMode(),saveAs(data2blob(JSON.stringify(IntelAmtEntireState,null," ").replace(/\n/g,"\r\n")),c27.value))}
892 +function saveEntireAmtStateOk2(b,c,a,d){IntelAmtEntireState.wsmanenums=a;saveEntireAmtStateDone()}function saveEntireAmtStateOk3(b,c){IntelAmtEntireState.auditlog=c;saveEntireAmtStateDone()}function saveEntireAmtStateOk4(b,c){IntelAmtEntireState.eventlog=c;saveEntireAmtStateDone()}function saveEntireAmtStateDone(){0==--IntelAmtEntireStateCalls&&(setDialogMode(),saveAs(data2blob(JSON.stringify(IntelAmtEntireState,null," ").replace(/\n/g,"\r\n")),c29.value))}
893 function showDesktopSettingsDlg(){if(!xxdialogMode){var b=amtsysstate.IPS_KVMRedirectionSettingData.response,c;c="<div style=text-align:left><div style=height:26px;margin-top:4px><select id=subddisplay style=float:right;width:200px><option value=0>Primary display</option><option value=1>Secondary display</option>";9<amtversion&&(c+="<option value=2>3rd display</option>");c+="</select><div style=padding-top:4px>Default display</div></div><div style=height:26px;margin-top:4px><input id=subsessiontimeout style=float:right;width:200px maxlength=5 onkeypress='return numbersOnly(event)'><div style=padding-top:4px>Session timeout (Minutes)</div></div>";
894 1==b.OptInPolicy&&(c+="<div style=height:26px;margin-top:4px><input id=suboptintimeout style=float:right;width:200px maxlength=5 onkeypress='return numbersOnly(event)'><div style=padding-top:4px>Opt-in timeout (Seconds)</div></div>");c+="<div style=height:26px;margin-top:4px><select id=subdlegacy style=float:right;width:200px onchange=showDesktopSettingsDlgUpdate()><option value=0>Disabled, Recommended</option><option value=1>Enabled, Legacy KVM viewers</option></select><div style=padding-top:4px>Port 5900</div></div>";
895 c+="<div style=height:26px;margin-top:4px id=subspassx><input id=subspass type=password autocomplete=off style=float:right;width:200px maxlength=8 onkeyup=showDesktopSettingsDlgUpdate()><div style=padding-top:4px>5900 password (8 chars)</div></div>";9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService&&(c+="<div style=height:26px;margin-top:4px><select id=subsb style=float:right;width:200px onchange=showDesktopSettingsDlgUpdate()><option value=0>Disabled</option><option value=1>Enabled</option></select><div style=padding-top:4px title='This feature is not often supported'>Screen Blanking</div></div>");
896 c+="</div>";setDialogMode(11,"Remote Desktop Settings",3,showDesktopSettingsDlgOk,c);Q("subddisplay").value=b.DefaultScreen;Q("subsessiontimeout").value=b.SessionTimeout;1==b.OptInPolicy&&(Q("suboptintimeout").value=b.OptInPolicyTimeout);Q("subdlegacy").value=1==b.Is5900PortEnabled?1:0;9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService&&(Q("subsb").value=amtsysstate.IPS_ScreenConfigurationService.response.EnabledState);showDesktopSettingsDlgUpdate()}}
894 -function showDesktopSettingsDlgUpdate(){QV("subspassx",1==Q("subdlegacy").value);var b=(0==Q("subdlegacy").value||8==Q("subspass").value.length||0==Q("subspass").value.length)&&0<Q("subsessiontimeout").value.length;1==amtsysstate.IPS_KVMRedirectionSettingData.response.OptInPolicy&&0==Q("suboptintimeout").value.length&&(b=!1);QE("c46",b)}
897 +function showDesktopSettingsDlgUpdate(){QV("subspassx",1==Q("subdlegacy").value);var b=(0==Q("subdlegacy").value||8==Q("subspass").value.length||0==Q("subspass").value.length)&&0<Q("subsessiontimeout").value.length;1==amtsysstate.IPS_KVMRedirectionSettingData.response.OptInPolicy&&0==Q("suboptintimeout").value.length&&(b=!1);QE("c48",b)}
898 function showDesktopSettingsDlgOk(){var b=Clone(amtsysstate.IPS_KVMRedirectionSettingData.response);b.DefaultScreen=Q("subddisplay").value;b.SessionTimeout=Q("subsessiontimeout").value;b.Is5900PortEnabled=1==Q("subdlegacy").value;1==b.OptInPolicy&&(b.OptInPolicyTimeout=Q("suboptintimeout").value);1==b.Is5900PortEnabled&&(b.RFBPassword=Q("subspass").value);amtstack.Put("IPS_KVMRedirectionSettingData",b,showDesktopSettingsDlgOk2);b=Clone(amtsysstate.IPS_ScreenConfigurationService.response);b.EnabledState=
899 parseInt(Q("subsb").value);amtstack.Put("IPS_ScreenConfigurationService",b,showDesktopSettingsDlgOk3)}function showDesktopSettingsDlgOk2(b,c,a,d){200==d?PullSystemStatus():messagebox("Remote Desktop Settings","Error "+d+", unable to set values.")}
900 function showDesktopSettingsDlgOk3(b,c,a,d){200!=d?messagebox("Error","Screen Blanking could not be set, blanking may not be supported on this system ("+d+")."):amtstack.Get("IPS_ScreenConfigurationService",function(a,b,c,d){200==d&&(amtsysstate.IPS_ScreenConfigurationService.response=c.Body,updateSystemStatus())},0,1)}function PullEventLog(b){1==b&&xxdialogMode||(amtFirstPull|=16,amtstack.Enum("AMT_MessageLog",processMessageLog0),amtstack.GetMessageLog(processMessageLog1))}
@@ -915,13 +918,13 @@ Handler:'<a:EndpointReference><a:Address>http://schemas.xmlsoap.org/ws/2004/08/a
918 function newSubscriptionButton(){if(!xxdialogMode&&null!=subscriptionsFilters){var b;b="<div style=height:26px;margin-top:4px><select id=subtype style=float:right;width:260px><option value=Push>Push</option><option value=PushWithAck>Push with ACK</option></select><div style=padding-top:4px>Type</div></div><div style=height:26px;margin-top:4px><select id=subfilter style=float:right;width:260px>";for(var c in subscriptionsFilters)b+="<option value='"+subscriptionsFilters[c].InstanceID+"'>"+subscriptionsFilters[c].CollectionName.substring(13)+
919 "</option>";b+="</select><div style=padding-top:4px>Filter</div></div>";b+="<div style=height:26px;margin-top:4px><input id=suburl style=float:right;width:260px maxlength=253 onkeyup=newSubscriptionUpdate() value='http://'><div style=padding-top:4px>URL</div></div>";b+="<div style=height:26px;margin-top:4px><select id=subauth style=float:right;width:260px onchange=newSubscriptionUpdate()><option value=0>None</option><option value=1>Digest</option></select><div style=padding-top:4px>Authentication</div></div>";
920 b+="<div style=height:26px;margin-top:4px id=subxuser><input id=subuser style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>Username</div></div>";b+="<div style=height:26px;margin-top:4px id=subxpass><input id=subpass style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>Password</div></div>";b+="<div style=height:26px;margin-top:4px><input id=subargs style=float:right;width:260px maxlength=128><div style=padding-top:4px>Arguments</div></div>";
918 -setDialogMode(11,"Add Event Subscription",3,newSubscriptionButtonOk,b);newSubscriptionUpdate()}}function newSubscriptionUpdate(){QE("c46",0<Q("suburl").value.length&&Q("suburl").value.startsWith("http://")&&(0==Q("subauth").value||0<Q("subuser").value.length&&0<Q("subpass").value.length));QV("subxuser",1==Q("subauth").value);QV("subxpass",1==Q("subauth").value)}
921 +setDialogMode(11,"Add Event Subscription",3,newSubscriptionButtonOk,b);newSubscriptionUpdate()}}function newSubscriptionUpdate(){QE("c48",0<Q("suburl").value.length&&Q("suburl").value.startsWith("http://")&&(0==Q("subauth").value||0<Q("subuser").value.length&&0<Q("subpass").value.length));QV("subxuser",1==Q("subauth").value);QV("subxpass",1==Q("subauth").value)}
922 function newSubscriptionButtonOk(){var b=0==Q("subuser").value.length?void 0:Q("subuser").value,c=0==Q("subpass").value.length?void 0:Q("subpass").value;amtstack.Subscribe("CIM_FilterCollection",Q("subtype").value,Q("suburl").value,newSubscriptionButtonOk2,null,1,{InstanceID:Q("subfilter").value},0<Q("subargs").value.length?Q("subargs").value:null,b,c)}function newSubscriptionButtonOk2(b,c,a,d){200==d&&PullEventSubscriptions()}
923 function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AMT_AuditLog",processAuditLog0))}var auditLog=null,auditLogEnabledStates="Unknown;Other;Enabled;Disabled;Shutting Down;Not Applicable;Enabled but Offline;In Test;Deferred;Quiesce;Starting".split(";");
924 function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"Disabled":"Enabled",c&2&&(b+=", Locked"),c&4&&(b+=", Almost Full"),c&8&&(b+=", Full"),c&16&&(b+=", NoKey"),c="<h1>Audit Log Settings</h1>"+TableStart(),c+=TableEntry("State",b),c+=TableEntry("Storage",a[0].CurrentNumberOfRecords+" record(s), "+a[0].PercentageFree+"% free"),c+=TableEntry("Overwrite policy",2==a[0].OverwritePolicy?"Wraps when full":"Never overwrites"),c+=TableEnd(),QH(50,c),amtstack.GetAuditLog(processAuditLog1))}
925 function processAuditLog1(b,c){auditLog=c;var a,d;d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+(TableEnd("<div style=float:right><input id=auditFilter placeholder=Filter style=margin:4px onkeyup=auditFilter()>&nbsp;</div><div> "+AddRefreshButton("PullAuditLog(1)")+AddButton("Save...","SaveAuditLog()")+AddButton("Clear Log","ClearAuditLog()"))+"<br>");if(0==c.length)d="No audit log events found.";else{var e=0;d+="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:110px>&nbsp;&nbsp;<b>Time</b><td class=r1 style=width:260px><b>Initiator</b><td class=r1><b>Action</b>";
923 -for(a in c){var n=c[a],p=n.AuditApp,q=n.Initiator;e++;var m="";0<n.NetAddress.length&&(m=n.NetAddress.replace("0000:0000:0000:0000:0000:0000:0000:0001","::1"));n.Event&&(p+=", "+n.Event);null!=n.ExStr&&(p+=", "+n.ExStr);""!=q&&""!=m&&(q+=", ");d+="<tr id=xamtaudit"+a+" class=r3 onclick=showAuditDetails("+a+")><td class=r1 title='"+n.Time.toLocaleString()+"'>&nbsp;&nbsp;"+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br>&nbsp;&nbsp;"+n.Time.toLocaleTimeString("en",
924 -{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+q+m+"<td class=r1>"+p}d+=TableEnd(0==e?"&nbsp;":"")+"<br>"}QH(51,d)}function auditFilter(){var b=Q("auditFilter").value.toLowerCase(),c;for(c in auditLog)QV("xamtaudit"+c,""==b||0<=JSON.stringify(auditLog[c]).toLowerCase().indexOf(b))}function SaveAuditLog(){xxdialogMode||null==auditLog||SaveJsonFile("IntelAmtAuditlog","auditevents","Intel AMT Audit Log",auditLog)}
926 +for(a in c){var n=c[a],p=n.AuditApp,r=n.Initiator;e++;var m="";0<n.NetAddress.length&&(m=n.NetAddress.replace("0000:0000:0000:0000:0000:0000:0000:0001","::1"));n.Event&&(p+=", "+n.Event);null!=n.ExStr&&(p+=", "+n.ExStr);""!=r&&""!=m&&(r+=", ");d+="<tr id=xamtaudit"+a+" class=r3 onclick=showAuditDetails("+a+")><td class=r1 title='"+n.Time.toLocaleString()+"'>&nbsp;&nbsp;"+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br>&nbsp;&nbsp;"+n.Time.toLocaleTimeString("en",
927 +{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+r+m+"<td class=r1>"+p}d+=TableEnd(0==e?"&nbsp;":"")+"<br>"}QH(51,d)}function auditFilter(){var b=Q("auditFilter").value.toLowerCase(),c;for(c in auditLog)QV("xamtaudit"+c,""==b||0<=JSON.stringify(auditLog[c]).toLowerCase().indexOf(b))}function SaveAuditLog(){xxdialogMode||null==auditLog||SaveJsonFile("IntelAmtAuditlog","auditevents","Intel AMT Audit Log",auditLog)}
928 function ClearAuditLog(b){QH(61,"Clear audit log?");setDialogMode(1,"Audit Log",3,ClearAuditLogEx)}function ClearAuditLogEx(){var b=amtstack.AMT_AuditLog_SetAuditLock(1,0,b,function(){amtstack.AMT_AuditLog_ClearLog(function(){amtstack.AMT_AuditLog_SetAuditLock(0,2,b,function(){setTimeout(PullAuditLog,1E3)})})})}function ShowAuditLogSettings(){xxdialogMode||amtstack.AMT_AuditLog_RequestStateChange(2,0,AuditLogSettingsCompleted)}
929 function AuditLogSettingsCompleted(b,c,a,d){200==d?PullAuditLog():messagebox("Audit Log","Error: "+d)}
930 function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="<div style=text-align:left>"+addHtmlValue("Time",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Initiator",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Address",a.NetAddress));d+=addHtmlValue("Application",a.AuditApp);d+=addHtmlValue("Event",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Extended Data",a.ExStr);else if(0<a.Ex.length){var e="";for(c in a.Ex)0<e.length&&(e+=","),e+=a.Ex.charCodeAt(c);""!=e&&(d+=addHtmlValue("Data Values",
@@ -938,13 +941,13 @@ function showCertDetails(b){if(!xxdialogMode){var c=xxCertificates[b],a;a="<br>"
941 addHtmlValue(xxCertSubjectNames[d]?xxCertSubjectNames[d]:d,EscapeHtml(c.XSubject[d])));a+='<br><div style="border-bottom:1px solid gray"><i>Issuer Certificate</i></div><br>';for(d in c.XIssuer)c.XIssuer[d]&&(a+=addHtmlValue(xxCertSubjectNames[d]?xxCertSubjectNames[d]:d,EscapeHtml(c.XIssuer[d])));setDialogMode(11,"Certificate - "+EscapeHtml(c.XSubject.CN),5,function(a){2==a&&(xxCertificates[b].XPrivateKey&&amtstack.Delete("AMT_PublicPrivateKeyPair",{InstanceID:xxCertificates[b].XPrivateKey.InstanceID},
942 function(){},0,1),amtstack.Delete("AMT_PublicKeyCertificate",xxCertificates[b],certificateRemoved,0,1))},a)}}function downloadCert(b){saveAs(data2blob(xxCertificates[b].X509Certificate),xxCertificates[b].XSubject.CN+".cer")}function cert_FileSelectHandler(b){haltEvent(b);1==b.dataTransfer.files.length&&(b.dataTransfer.files[0].name.toLowerCase().endsWith(".p12")?issueCertButton(b.dataTransfer.files):addCertButton(b.dataTransfer.files))}var xxDragDropCertFiles=null;
943 function addCertButton(b){!xxdialogMode&&xxAccountAdminName&&(xxDragDropCertFiles=b,b="<input id=certopen onchange=addCertButtonUpdate() type=file style=float:right;width:260px accept='.cer,.pem'>",xxDragDropCertFiles&&(b='<input style=float:right;width:260px readonly disabled value="'+xxDragDropCertFiles[0].name+'">'),b="<div style=height:10px></div>"+("<div style=height:26px;margin-top:4px>"+b+"<div style=padding-top:4px>Certificate file</div></div>")+"<div style=height:26px;margin-top:4px><select id=certtype style=float:right;width:260px><option value=0>Chain Certificate</option><option value=1>Trusted Root Certificate</option></select><div style=padding-top:4px>Certificate type</div></div>",
941 -setDialogMode(11,"Add Certificate",3,addCertButtonOk,b),addCertButtonUpdate())}function addCertButtonUpdate(){var b=getInputElement("certopen");QE("c46",!b||1==b.files.length)}function addCertButtonOk(){var b=getInputElement("certopen"),c=xxDragDropCertFiles;b&&(c=b.files);c&&1==c.length&&(b=new FileReader,b.onload=addCertButtonOk2,b.readAsBinaryString(c[0]))}
944 +setDialogMode(11,"Add Certificate",3,addCertButtonOk,b),addCertButtonUpdate())}function addCertButtonUpdate(){var b=getInputElement("certopen");QE("c48",!b||1==b.files.length)}function addCertButtonOk(){var b=getInputElement("certopen"),c=xxDragDropCertFiles;b&&(c=b.files);c&&1==c.length&&(b=new FileReader,b.onload=addCertButtonOk2,b.readAsBinaryString(c[0]))}
945 function addCertButtonOk2(b){b=b.target.result;var c=b.indexOf("-----BEGIN CERTIFICATE-----");0<c?(b=b.substring(c+27),c=b.indexOf("-----END CERTIFICATE-----"),0<c&&(b=b.substring(0,c)),b=b.replace(/\r\n/g,"")):b=btoa(b);1==getSelectElement("certtype").value?amtstack.AMT_PublicKeyManagementService_AddTrustedRootCertificate(b,certificateAdded):amtstack.AMT_PublicKeyManagementService_AddCertificate(b,certificateAdded)}
946 function issueCertButton(b){!xxdialogMode&&xxAccountAdminName&&(xxDragDropCertFiles=b,b="<input id=certopen type=file style=float:right;width:230px onchange=issueCertButtonUpdate() accept='.p12'>",xxDragDropCertFiles&&(b='<input style=float:right;width:230px readonly disabled value="'+xxDragDropCertFiles[0].name+'">'),b=""+("<div styleheight:26px;margin-top:14px>"+b+"<div style=padding-top:4px>Certificate file</div></div>")+"<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certopenpass type=password autocomplete=off style=float:right;width:230px><div style=padding-top:4px>Certificate password</div></div>",
947 b+='<br><div style="border-bottom:1px solid gray"><i>Intel&reg; AMT Certificate</i></div>',b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certcn style=float:right;width:230px><div style=padding-top:4px>Common Name</div></div>",b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certo style=float:right;width:230px><div style=padding-top:4px>Organization</div></div>",b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certst style=float:right;width:230px><div style=padding-top:4px>State/Province</div></div>",
948 b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certc style=float:right;width:230px><div style=padding-top:4px>Country</div></div>",b+='<div>Certificate Usages</div><ul style="list-style-type:none;height:100px;overflow:auto;width:100%;border: 1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0">',b+="<li><label><input type=checkbox id=d11_cu4 checked>TLS Server (HTTPS)</label></li>",b+="<li><label><input type=checkbox id=d11_cu5>TLS Client (HTTPS)</label></li>",
949 b+="<li><label><input type=checkbox id=d11_cu6>Email Protection</label></li>",b+="<li><label><input type=checkbox id=d11_cu7>Code Signing</label></li>",b+="<li><label><input type=checkbox id=d11_cu8>Time Stamp</label></li>",b+="</ul>",setDialogMode(11,"Issue Certificate",3,issueCertButtonOk,b),issueCertButtonUpdate())}
947 -function issueCertButtonUpdate(){var b=getInputElement("certopen");QE("certopenpass",!b||b&&1==b.files.length);var c=!b||2>b.files.length;1==(!b||b&&b.files.length)&&""==Q("certopenpass").value&&(c=!1);if(""==getInputElement("certcn").value||""==getInputElement("certo").value||""==getInputElement("certst").value||""==getInputElement("certc").value)c=!1;QE("c46",c)}
950 +function issueCertButtonUpdate(){var b=getInputElement("certopen");QE("certopenpass",!b||b&&1==b.files.length);var c=!b||2>b.files.length;1==(!b||b&&b.files.length)&&""==Q("certopenpass").value&&(c=!1);if(""==getInputElement("certcn").value||""==getInputElement("certo").value||""==getInputElement("certst").value||""==getInputElement("certc").value)c=!1;QE("c48",c)}
951 function issueCertButtonOk(){var b=getInputElement("certopen"),c=xxDragDropCertFiles;b&&(c=b.files);c&&1==c.length?(b=new FileReader,b.onload=issueCertButtonOk2,b.readAsBinaryString(c[0])):issueCertButtonOk3(null)}function issueCertButtonOk2(b){0==amtcert_loadP12File(b.target.result,Q("certopenpass").value,issueCertButtonOk3)&&messagebox("Issue Certificate","Unable to decrypt/decode certificate.")}
952 function issueCertButtonOk3(b,c,a){xxCaPrivateKey=b;xxCaSubjectAttributes=c;amtstack.AMT_PublicKeyManagementService_GenerateKeyPair(0,2048,GenerateKeyPairResponse)}
953 function GenerateKeyPairResponse(b,c,a,d){200!=d?messagebox("Issue Certificate","Failed to generate key pair. Status: "+d):0!=a.Body.ReturnValue?messagebox("Issue Certificate","Failed to generate key pair, "+a.Body.ReturnValueStr):amtstack.Enum("AMT_PublicPrivateKeyPair",GenerateKeyPairResponse2,a.Body.KeyPair.ReferenceParameters.SelectorSet.Selector.Value)}
@@ -955,7 +958,7 @@ function getInputElement(b){var c=document.getElementsByTagName("input");for(t=0
958 function showSetTlsSecurityDlg(b){if(!xxdialogMode){b="<div style=height:26px;margin-top:4px><select onchange=showSetTlsSecurityDlgUpdate() id=tlscert style=float:right;width:260px><option value=-1>No Certificate, TLS Disabled</option>";for(var c in xxCertificates)0!=xxCertificates[c].TrustedRootCertficate||!xxCertificates[c].XPrivateKey||null!=xxTlsCurrentCert&&xxTlsCurrentCert!=c||(b+="<option value="+c+">"+xxCertificates[c].XSubject.CN+"</option>");b+="</select><div style=padding-top:4px>Certificate</div></div><div style=height:26px;margin-top:4px><select id=tlsremote style=float:right;width:260px onchange=showSetTlsSecurityDlgUpdate()><option value=0>Server-auth TLS only</option><option value=1>Server-auth, non-TLS allowed</option>";
959 8>amtversion&&(b+="<option value=2>Mutual-auth TLS only</option><option value=3>Mutual-auth, non-TLS allowed</option>");b+="</select><div style=padding-top:4px>Security</div></div><div style=height:26px id=d11rcn title='Comma seperated list of certificate common names that will be allowed to connect remotely.'><input id=d11_rcn style=float:right;width:260px onkeyup=showSetTlsSecurityDlgUpdate() placeholder='name1, name2'><div style=padding-top:4px>Remote CN's</div></div>";setDialogMode(11,"TLS Settings",
960 3,showSetTlsSecurityDlgOk,b);if(0==xxTLSCredentialContext.length||0==xxTlsSettings[0].Enabled||0==xxTlsSettings[1].Enabled)getSelectElement("tlscert").value=-1;else for(c in b=xxTLSCredentialContext[0].ElementInContext.ReferenceParameters.SelectorSet.Selector.Value,xxCertificates)xxCertificates[c].InstanceID==b&&(getSelectElement("tlscert").value=c);c=1-("Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1);getSelectElement("tlsremote").value=(1==xxTlsSettings[c].MutualAuthentication?
958 -2:0)+(1==xxTlsSettings[c].AcceptNonSecureConnections?1:0);xxTlsSettings[c].TrustedCN&&(Q("d11_rcn").value=MakeToArray(xxTlsSettings[c].TrustedCN).join(", "));showSetTlsSecurityDlgUpdate()}}function showSetTlsSecurityDlgUpdate(){var b=getSelectElement("tlscert").value;QE("tlsremote",-1!=b);QV("d11rcn",-1!=b&&1<getSelectElement("tlsremote").value);b=!0;1<getSelectElement("tlsremote").value&&!splitDomains(Q("d11_rcn").value)&&(b=!1);QE("c46",b)}var setTlsSecurityPendingCalls,setTlsSecurityDeleteCredentialContext;
961 +2:0)+(1==xxTlsSettings[c].AcceptNonSecureConnections?1:0);xxTlsSettings[c].TrustedCN&&(Q("d11_rcn").value=MakeToArray(xxTlsSettings[c].TrustedCN).join(", "));showSetTlsSecurityDlgUpdate()}}function showSetTlsSecurityDlgUpdate(){var b=getSelectElement("tlscert").value;QE("tlsremote",-1!=b);QV("d11rcn",-1!=b&&1<getSelectElement("tlsremote").value);b=!0;1<getSelectElement("tlsremote").value&&!splitDomains(Q("d11_rcn").value)&&(b=!1);QE("c48",b)}var setTlsSecurityPendingCalls,setTlsSecurityDeleteCredentialContext;
962 function showSetTlsSecurityDlgOk(){var b=getSelectElement("tlscert").value,c=getSelectElement("tlsremote").value,a=Clone(xxTlsSettings);setTlsSecurityPendingCalls=0;setTlsSecurityDeleteCredentialContext=null;if(-1!=b){if(0<xxTLSCredentialContext.length){var d=Clone(xxTLSCredentialContext[0]);d.ElementInContext.ReferenceParameters.SelectorSet.Selector.Value=xxCertificates[b].InstanceID;amtstack.Put("AMT_TLSCredentialContext",d,setTlsSecurityResponse,0,1)}else amtstack.Create("AMT_TLSCredentialContext",
963 {ElementInContext:"<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+amtstack.CompleteName("AMT_PublicKeyCertificate")+'</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+xxCertificates[b].InstanceID+"</w:Selector></w:SelectorSet></a:ReferenceParameters>",ElementProvidingContext:"<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+amtstack.CompleteName("AMT_TLSProtocolEndpointCollection")+'</w:ResourceURI><w:SelectorSet><w:Selector Name="ElementName">TLSProtocolEndpointInstances Collection</w:Selector></w:SelectorSet></a:ReferenceParameters>'},
964 setTlsSecurityResponse);setTlsSecurityPendingCalls++}else 0<xxTLSCredentialContext.length&&(setTlsSecurityDeleteCredentialContext=Clone(xxTLSCredentialContext[0]));var d="Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1,e=1-d;a[e].Enabled=-1!=b;a[e].MutualAuthentication=2<=c;a[e].AcceptNonSecureConnections=1==c%2;a[e].TrustedCN=splitDomains(Q("d11_rcn").value);a[d].Enabled=-1!=b;amtstack.Put("AMT_TLSSettingData",a[0],setTlsSecurityResponse,0,1,a[0]);amtstack.Put("AMT_TLSSettingData",
@@ -1006,16 +1009,16 @@ b+="<div style=height:26px;margin-top:4px id=filterdatadiv><input id=filterdata
1009 3,AddDefenseFilterOk,b);AddDefenseFilterUpdate()}}
1010 function AddDefenseFilterOk(){if(1>=Q("filtertype").value){var b=0==Q("filtertype").value?2048:2054,c={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrProtocolID8021:b,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value};2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_Hdr8021Filter",c,AddDefenseFilterOk2)}else{var b=2==Q("filtertype").value?
1011 4:6,c={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrIPVersion:b,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value},a=Q("ipfilter").value.split(","),d;for(d in a){var e=a[d].indexOf("="),n=a[d].substring(0,e),e=a[d].substring(e+1),p=xxSystemDefenceFilters[n];p||(n="Hdr"+n,p=xxSystemDefenceFilters[n]);p&&(2==p&&4==b?(e=e.split("."),4==e.length&&(c[n]=rstr2hex(String.fromCharCode(parseInt(e[0]),
1009 -parseInt(e[1]),parseInt(e[2]),parseInt(e[3]))))):c[n]=e)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0<Q("filtername").value.length;b&&2==Q("filterprofile").value&&(b=parseInt(Q("filterdata").value),b=0<b&&4294967295>b);QE("c46",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)}
1012 +parseInt(e[1]),parseInt(e[2]),parseInt(e[3]))))):c[n]=e)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0<Q("filtername").value.length;b&&2==Q("filterprofile").value&&(b=parseInt(Q("filterdata").value),b=0<b&&4294967295>b);QE("c48",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)}
1013 function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Add System Defense Filter","Unable to add filter, error #"+d):PullSystemDefense()}
1014 function showFilterDetails(b,c){if(!xxdialogMode){var a,d,e,n;0==b?(n="AMT_Hdr8021Filter",e="Ethernet Traffic",d=xxSystemDefense[n].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="All Ethernet Protocol "+d.HdrProtocolID8021)):(n="AMT_IPHeadersFilter",e="IP Traffic",d=xxSystemDefense[n].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="All IP Protocol "+d.HdrIPVersion));var p;p=""+addHtmlValue("Name",EscapeHtml(d.Name));p+=addHtmlValue("Type",e);p+=addHtmlValue("Matching Traffic",
1012 -a);p+=addHtmlValue("Direction",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var q in xxSystemDefenceFilters)d[q]&&(a=q,e=d[q],b=xxSystemDefenceFilters[q],2==b&&4==e.length&&(e=hex2rstr(e),e=e.charCodeAt(0)+"."+e.charCodeAt(1)+"."+e.charCodeAt(2)+"."+e.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),p+=addHtmlValue("Filter "+a,e));p+=addHtmlValue("Event on match",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet Filter #"+d.InstanceID,5,showFilterDetailsOk,
1015 +a);p+=addHtmlValue("Direction",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var r in xxSystemDefenceFilters)d[r]&&(a=r,e=d[r],b=xxSystemDefenceFilters[r],2==b&&4==e.length&&(e=hex2rstr(e),e=e.charCodeAt(0)+"."+e.charCodeAt(1)+"."+e.charCodeAt(2)+"."+e.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),p+=addHtmlValue("Filter "+a,e));p+=addHtmlValue("Event on match",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet Filter #"+d.InstanceID,5,showFilterDetailsOk,
1016 p,[n,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Remove Filter","Unable to remove filter, make sure it's not in use."):PullSystemDefense()}var xxAddDefensePolicyFilters;
1017 function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b="<div style=height:26px;margin-top:4px><input id=policyname title='<policy name>:<policy precedence number>' style=float:right;width:260px maxlength=16 onkeyup=AddDefensePolicyUpdate()><div style=padding-top:4px>Name</div></div><div style=height:26px;margin-top:4px><select id=policytx title='Default action to take for outbound traffic' style=float:right;width:133px><option value=0>Allow<option value=1>Drop<option value=2>Allow,Count<option value=3>Drop,Count<option value=4>Allow,Count,Event<option value=5>Drop,Count,Event</select><select id=policyrx style=float:right;width:133px title='Default action to take for inbound traffic'><option value=0>Allow<option value=1>Drop<option value=2>Allow,Count<option value=3>Drop,Count<option value=4>Allow,Count,Event<option value=5>Drop,Count,Event</select><div style=padding-top:4px>Default TX / RX</div></div>";b+=
1018 "<div id=policyFilters></div>";if(0<xxSystemDefense.AMT_Hdr8021Filter.responses.length||0<xxSystemDefense.AMT_IPHeadersFilter.responses.length){b+="<div style=height:26px;margin-top:4px><div style=float:right><select id=xfilter style=width:186px>";for(var c in xxSystemDefense.AMT_Hdr8021Filter.responses){var a=xxSystemDefense.AMT_Hdr8021Filter.responses[c];b+="<option value="+a.InstanceID+">"+a.Name}for(c in xxSystemDefense.AMT_IPHeadersFilter.responses)a=xxSystemDefense.AMT_IPHeadersFilter.responses[c],
1019 b+="<option value="+a.InstanceID+">"+a.Name;b+="</select><input id=addFilterButton type=button value=Add style=width:80px onclick=addFilterButton()></div><div style=padding-top:4px>Add Filter</div></div>"}setDialogMode(11,"Add System Defense Policy",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())}
1020 function removeFilterButton(b){xxAddDefensePolicyFilters.splice(b,1);AddDefensePolicyUpdate()}
1018 -function AddDefensePolicyUpdate(){var b=0<Q("policyname").value.split(":")[0].length;QE("c46",b);if(0==xxAddDefensePolicyFilters.length)QH("policyFilters","<br><i>This policy contains no filters.</i><br><br>");else{var b="",c;for(c in xxAddDefensePolicyFilters)b+="<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Remove","removeFilterButton("+c+")")+"</div><div style=padding-top:3px;max-width:260px;overflow:hidden><b>"+GetFilterById(xxAddDefensePolicyFilters[c]).Name+
1021 +function AddDefensePolicyUpdate(){var b=0<Q("policyname").value.split(":")[0].length;QE("c48",b);if(0==xxAddDefensePolicyFilters.length)QH("policyFilters","<br><i>This policy contains no filters.</i><br><br>");else{var b="",c;for(c in xxAddDefensePolicyFilters)b+="<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Remove","removeFilterButton("+c+")")+"</div><div style=padding-top:3px;max-width:260px;overflow:hidden><b>"+GetFilterById(xxAddDefensePolicyFilters[c]).Name+
1022 "</b></div></div>";QH("policyFilters",b)}}function GetFilterById(b){for(var c in xxSystemDefense.AMT_Hdr8021Filter.responses){var a=xxSystemDefense.AMT_Hdr8021Filter.responses[c];if(a.InstanceID==b)return a}for(c in xxSystemDefense.AMT_IPHeadersFilter.responses)if(a=xxSystemDefense.AMT_IPHeadersFilter.responses[c],a.InstanceID==b)return a}
1023 function AddDefensePolicyOk(){var b=Q("policytx").value,c=Q("policyrx").value,a=0,d=Q("policyname").value.split(":");2==d.length&&(a=parseInt(d[1]));b={"InstanceID ":0,PolicyName:d[0],PolicyPrecedence:a,TxDefaultCount:1<b,TxDefaultDrop:1==b%2,TxDefaultMatchEvent:3<b,RxDefaultCount:1<c,RxDefaultDrop:1==c%2,RxDefaultMatchEvent:3<c};0<xxAddDefensePolicyFilters.length&&(b.FilterCreationHandles=xxAddDefensePolicyFilters);amtstack.Create("AMT_SystemDefensePolicy",b,AddDefensePolicyOk2)}
1024 function AddDefensePolicyOk2(b,c,a,d){200!=d?messagebox("Add System Defense Policy","Unable to add policy, error #"+d):PullSystemDefense()}
@@ -1030,11 +1033,11 @@ function wifiStateDlg(){amtstack.CIM_WiFiPort_RequestStateChange(document.queryS
1033 function showWifiDetails(b){if(!xxdialogMode){b=xxWireless.CIM_WiFiEndpointSettings.responses[b];var c;c="<div style=text-align:left>"+addHtmlValue("Profile Name",EscapeHtml(b.ElementName));c+=addHtmlValue("SSID",b.SSID);c+=addHtmlValue("Authentication",xxWifiAuthenticationMethod[b.AuthenticationMethod]);c+=addHtmlValue("Encryption",xxWifiEncryptionMethod[b.EncryptionMethod]);c+=addHtmlValue("Priority",b.Priority);messagebox("Wireless Profile",c+"</div>")}}
1034 function wifiRemoveButton(b){xxdialogMode||(QH(61,'Remove wireless profile "'+xxWireless.CIM_WiFiEndpointSettings.responses[b].ElementName+'"?'),setDialogMode(1,"Wireless Profile",3,function(){removeWifiButtonEx(b)}))}function removeWifiButtonEx(b){amtstack.Delete("CIM_WiFiEndpointSettings",{InstanceID:xxWireless.CIM_WiFiEndpointSettings.responses[b].InstanceID},removeWifiEntryResponse,0,1)}
1035 function removeWifiEntryResponse(b,c,a,d,e){methodcheck(a)||amtstack.Enum("CIM_WiFiEndpointSettings",function(a,b,c,d){200==d&&(xxWireless.CIM_WiFiEndpointSettings.responses=c,showWirelessInfo())})}
1033 -function showWifiNewProfile(){if(!xxdialogMode){var b="";for(i=1;256>i;i++){var c=1;for(j in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[j].Priority==i&&(c=0);c&&(b+="<option value="+i+">"+i)}QH("c22",b);c23.value=6;c24.value=4;c20.value=c21.value=c25.value=c26.value="";setDialogMode(12,"Add Wireless Profile",3,function(){addWifiProfile()});updateWifiDialog()}}
1034 -function addWifiProfile(){amtstack.AMT_WiFiPortConfigurationService_AddWiFiSettings({__parameterType:"reference",__resourceUri:amtstack.CompleteName("CIM_WiFiEndpoint"),Name:"WiFi Endpoint 0"},{__parameterType:"instance",__namespace:amtstack.CompleteName("CIM_WiFiEndpointSettings"),ElementName:c20.value,InstanceID:"Intel(r) AMT:WiFi Endpoint Settings "+c20.value,AuthenticationMethod:c23.value,EncryptionMethod:c24.value,SSID:c21.value,Priority:c22.value,
1035 -PSKPassPhrase:c25.value},null,null,null,removeWifiEntryResponse)}
1036 -function updateWifiDialog(){var b=!0,c=c23.value,a=c24.value;QV(67,4>c);QV(66,3<c);QV(65,3<c);QV(68,4>c);4>c&&(3==a||4==a)&&(c24.value=2);3<c&&(2==a||5==a)&&(c24.value=3);for(var d in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[d].ElementName==c20.value&&(b=!1);QE("c46",1==b&&0<c20.value.length&&0<c21.value.length&&7<c25.value.length&&c25.value==
1037 -c26.value)}function PullHardware(){amtstack.BatchEnum("","*CIM_ComputerSystemPackage CIM_SystemPackaging *CIM_Chassis CIM_Chip *CIM_Card *CIM_BIOSElement CIM_Processor CIM_PhysicalMemory CIM_MediaAccessDevice CIM_PhysicalPackage".split(" "),processHardware);amtFirstPull|=1}
1036 +function showWifiNewProfile(){if(!xxdialogMode){var b="";for(i=1;256>i;i++){var c=1;for(j in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[j].Priority==i&&(c=0);c&&(b+="<option value="+i+">"+i)}QH("c24",b);c25.value=6;c26.value=4;c22.value=c23.value=c27.value=c28.value="";setDialogMode(12,"Add Wireless Profile",3,function(){addWifiProfile()});updateWifiDialog()}}
1037 +function addWifiProfile(){amtstack.AMT_WiFiPortConfigurationService_AddWiFiSettings({__parameterType:"reference",__resourceUri:amtstack.CompleteName("CIM_WiFiEndpoint"),Name:"WiFi Endpoint 0"},{__parameterType:"instance",__namespace:amtstack.CompleteName("CIM_WiFiEndpointSettings"),ElementName:c22.value,InstanceID:"Intel(r) AMT:WiFi Endpoint Settings "+c22.value,AuthenticationMethod:c25.value,EncryptionMethod:c26.value,SSID:c23.value,Priority:c24.value,
1038 +PSKPassPhrase:c27.value},null,null,null,removeWifiEntryResponse)}
1039 +function updateWifiDialog(){var b=!0,c=c25.value,a=c26.value;QV(67,4>c);QV(66,3<c);QV(65,3<c);QV(68,4>c);4>c&&(3==a||4==a)&&(c26.value=2);3<c&&(2==a||5==a)&&(c26.value=3);for(var d in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[d].ElementName==c22.value&&(b=!1);QE("c48",1==b&&0<c22.value.length&&0<c23.value.length&&7<c27.value.length&&c27.value==
1040 +c28.value)}function PullHardware(){amtstack.BatchEnum("","*CIM_ComputerSystemPackage CIM_SystemPackaging *CIM_Chassis CIM_Chip *CIM_Card *CIM_BIOSElement CIM_Processor CIM_PhysicalMemory CIM_MediaAccessDevice CIM_PhysicalPackage".split(" "),processHardware);amtFirstPull|=1}
1041 var DMTFCPUStatus="Unknown;Enabled;Disabled by User;Disabled By BIOS (POST Error);Idle;Other".split(";"),DMTFMemType="Unknown;Other;DRAM;Synchronous DRAM;Cache DRAM;EDO;EDRAM;VRAM;SRAM;RAM;ROM;Flash;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";Other;Unknown;SIMM;SIP;Chip;DIP;ZIP;Proprietary Card;DIMM;TSOP;Row of chips;RIMM;SODIMM;SRIMM;FB-DIM".split(";"),DMTFProcFamilly={191:"Intel&reg; Core&trade; 2 Duo Processor",
1042 192:"Intel&reg; Core&trade; 2 Solo processor",193:"Intel&reg; Core&trade; 2 Extreme processor",194:"Intel&reg; Core&trade; 2 Quad processor",195:"Intel&reg; Core&trade; 2 Extreme mobile processor",196:"Intel&reg; Core&trade; 2 Duo mobile processor",197:"Intel&reg; Core&trade; 2 Solo mobile processor",198:"Intel&reg; Core&trade; i7 processor",199:"Dual-Core Intel&reg; Celeron&reg; processor"},HardwareInventory;
1043 function processHardware(b,c,a,d){if(200==d){var e;b="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>";HardwareInventory=a;QV("go2",!0);b+=TableEnd("<div>&nbsp;"+AddRefreshButton("PullHardware(1)")+AddButton("Save...","SaveHardwareLog()")+" Hardware information is gathered at system boot time.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var n=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"<br><h2>Platform</h2>"+FullTable({"Computer model":c.Model,Manufacturer:c.Manufacturer,
@@ -1048,25 +1051,25 @@ function PullUserInfo(){xxAccountFetch=1;delete xxAccountAdminName;xxAccountReal
1051 function enumerateUserAclEntriesResponse(b,c,a,d){if(200==d){methodcheck(a);QV("go11",!0);xxAccountFetch=a.Body.Handles.length;for(var e in a.Body.Handles)b=a.Body.Handles[e],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}}
1052 function getUserAclEntryExResponse(b,c,a,d,e){xxAccountFetch--;200==d&&(a.Body.Handle=e,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[e]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,e){200==d&&(xxAccountEnabledInfo[e]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,e){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(e,getAclEnabledStateResponse,e))}
1053 function updateAccounts(){if(!(0<xxAccountFetch)){var b=TableStart2(),b=b+"<tr><td class=r1 style=padding-left:15px><br>Manage the Intel&reg; AMT user accounts for this computer.<br><br>",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,e=!1,n=0;a.DigestUsername?(d=a.DigestUsername,e="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(n=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!e){var p="";if(999!=a.AccessPermission){2==
1051 -n&&(p+="Disabled, ");var q=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&q++;0<=a.Realms.indexOf(20)&&(p+="Auditor, ");p=0<=a.Realms.indexOf(3)?p+"Administrator":1==q?p+"1 realm":p+(q+" realms")}else p+="Administrator",a.Handle=-1;b+="<div class=itemBar onclick=showUserDetails("+a.Handle+")><div style=float:right>";0<n&&xxAccountAdminName&&(b+=" "+AddButton2(1==n?"Disable":"Enable","changeAccountStateButton(event,"+a.Handle+","+n+")"));!e&&xxAccountAdminName&&(b+=" "+AddButton2("Edit...",
1054 +n&&(p+="Disabled, ");var r=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&r++;0<=a.Realms.indexOf(20)&&(p+="Auditor, ");p=0<=a.Realms.indexOf(3)?p+"Administrator":1==r?p+"1 realm":p+(r+" realms")}else p+="Administrator",a.Handle=-1;b+="<div class=itemBar onclick=showUserDetails("+a.Handle+")><div style=float:right>";0<n&&xxAccountAdminName&&(b+=" "+AddButton2(1==n?"Disable":"Enable","changeAccountStateButton(event,"+a.Handle+","+n+")"));!e&&xxAccountAdminName&&(b+=" "+AddButton2("Edit...",
1055 "changeAccountButton(event,"+a.Handle+")"));b+="</div><div style=padding-top:3px;width:330px;float:left;overflow-x:hidden title='"+d+"'><b>"+d+"</b></div><div style=padding-top:3px>"+p+"</div></div>"}}c="<div style=float:right;margin-right:8px><a title='Toggle hidden accounts' style=color:gray;cursor:pointer onclick=toggleAccountButton()>"+(showHiddenAccounts?"&#x25B2;":"&#x25BC;")+"</a></div><div>&nbsp;"+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("New Account",
1056 "newAccountButton()"));b+="<br><td class=r1>"+TableEnd(c+"</div>");QH(23,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,e){methodcheck(a)||PullUserInfo()}function changeAccountStateButton(b,c,a){haltEvent(b);xxdialogMode||amtstack.AMT_AuthorizationService_SetAclEnabledState(c,1==a?!1:!0,setAclEnabledStateResponse,c)}
1057 function changeAccountButton(b,c){haltEvent(b);xxdialogMode||(updateRealms(xxAccountRealmInfo[c].Realms),d2username.value=xxAccountRealmInfo[c].DigestUsername?xxAccountRealmInfo[c].DigestUsername:GetSidString(atob(xxAccountRealmInfo[c].KerberosUserSid)),d2password1.value=d2password2.value="",d2permission.value=xxAccountRealmInfo[c].AccessPermission,setDialogMode(2,"Edit Account",-1==c?3:7,function(a){changeAccountButtonEx(c,a)}),updateAccountDialog())}
1058 function newAccountButton(){xxdialogMode||(updateRealms([]),d2username.value=d2password1.value=d2password2.value="",d2permission.value=2,setDialogMode(2,"New Account",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())}
1056 -function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,e=d2permission.value,n=d2password1.value,p=GetSidByteArray(Q("d2username").value),q=null;if(0==d.length||n!=d2password2.value){messagebox("Account Error","Invalid Parameters");return}null==p?q=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+n)):(d=null,p=btoa(p));if(-1!=b)for(var m in amtstack.RealmNames)(amtstack.RealmNames[m]||3==m)&&Q("rx"+m).checked&&a.push(m);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,
1057 -q,p,e,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,q,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,q,p,e,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,e){methodcheck(a)||PullUserInfo()}
1059 +function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,e=d2permission.value,n=d2password1.value,p=GetSidByteArray(Q("d2username").value),r=null;if(0==d.length||n!=d2password2.value){messagebox("Account Error","Invalid Parameters");return}null==p?r=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+n)):(d=null,p=btoa(p));if(-1!=b)for(var m in amtstack.RealmNames)(amtstack.RealmNames[m]||3==m)&&Q("rx"+m).checked&&a.push(m);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,
1060 +r,p,e,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,r,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,r,p,e,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,e){methodcheck(a)||PullUserInfo()}
1061 function updateRealms(b){QV(62,null!=b);if(null!=b){var c="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx3"+(0<=b.indexOf(3)?" checked":"")+">Administrator</label></li><hr />",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx"+a+d+">"+amtstack.RealmNames[a]+"</label></li>")}QH(63,c)}}
1059 -function updateAccountDialog(){var b=!1,c;for(c in amtstack.RealmNames)(amtstack.RealmNames[c]||3==c)&&Q("rx"+c).checked&&(b=!0);b&=0<d2username.value.length&&passwordcheck(d2password1.value)&&d2password1.value==d2password2.value;QE("c46",b)}var xxUserPermissions=["Local only","Network only","All (Local & Network)"];
1062 +function updateAccountDialog(){var b=!1,c;for(c in amtstack.RealmNames)(amtstack.RealmNames[c]||3==c)&&Q("rx"+c).checked&&(b=!0);b&=0<d2username.value.length&&passwordcheck(d2password1.value)&&d2password1.value==d2password2.value;QE("c48",b)}var xxUserPermissions=["Local only","Network only","All (Local & Network)"];
1063 function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="<div style=text-align:left>",d,e=c.DigestUsername;e||(e=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Name",e);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("State",1==xxAccountEnabledInfo[b].Enabled?"Enabled":"Disabled"));if(e==xxAccountAdminName)a+=addHtmlValue("Permission","Administrator");else{var a=a+addHtmlValue("Permission",xxUserPermissions[c.AccessPermission]),n="";if(0<=c.Realms.indexOf(3))n="Administrator",
1064 0<=c.Realms.indexOf(20)&&(n+=", Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0<n.length&&(n+=", "),n+=amtstack.RealmNames[c.Realms[d]]);0==n.length&&(n="None");a+=addHtmlValue("Realms","")+"<b>"+n+"</b>"}messagebox("Account "+e,a+"</div>")}}
1065 function wsmanQuery(){QH(26,"");var b=getSelectedOptions(Q(24)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(25,!1),c&&0<c.length&&amtstack.BatchEnum("Browser",c,browserResponse,null,!0))}
1066 function browserResponse(b,c,a,d){QE(25,!0);b="";for(var e in a)c=a[e],b+="<h2>"+e+"</h2><div style=margin-left:20px>",b=200==c.status?0==c.responses.length?b+"<br>(Empty)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel&reg"):b+("<br><div style=color:red>Error #"+c.status+"</div>"),b+="</div><br>";QH(26,b)}
1067 function wsmanFilter(){var b=c0.value.toLowerCase(),c;for(c in AllWsman)QV("WSB-"+AllWsman[c],""==b||0<=AllWsman[c].toLowerCase().indexOf(b))}function connectTerminal(){terminal&&(0==terminal.State?(terminal.tlsv1only=amtstack.wsman.comm.tlsv1only,terminal.Start(currentMeshNode._id,16994,"*","*",0)):terminal.Stop())}
1065 -function onTerminalStateChange(b,c){c3.value=0==c?"Connect":"Disconnect";Q(31).textContent=StatusStrs[c];QE(36,3==c);switch(c){case 0:b.m.TermResetScreen(),b.m.TermDraw(),3==xxdialogMode&&setDialogMode()}}function termPaste(){terminal.m.TermSendKeys(d3pastetextarea.value)}function termSendKey(b){terminal.m.TermSendKey(b)}
1068 +function onTerminalStateChange(b,c){c4.value=0==c?"Connect":"Disconnect";Q(31).textContent=StatusStrs[c];QE(36,3==c);switch(c){case 0:b.m.TermResetScreen(),b.m.TermDraw(),3==xxdialogMode&&setDialogMode()}}function termPaste(){terminal.m.TermSendKeys(d3pastetextarea.value)}function termSendKey(b){terminal.m.TermSendKey(b)}
1069 function termToggleSize(){80==terminal.m.width?(Q(33).value="100x30",terminal.m.Init(100,30)):(Q(33).value="80x25",terminal.m.Init(80,25))}var terminalEmulations=["UTF8 Terminal","Extended ASCII","Intel ASCII"];function termToggleType(){terminal.m.terminalEmulation=(terminal.m.terminalEmulation+1)%3;Q(35).value=terminalEmulations[terminal.m.terminalEmulation]}
1070 function termToggleFx(){Q(34).value=["Intel (F10 = ESC+[OM)","Alternate (F10 = ESC+0)","VT100+ (F10 = ESC+[OY)"][terminal.m.fxEmulation=(terminal.m.fxEmulation+1)%3]}function termToggleCr(){Q(32).value=["CR+LF","LF"][terminal.m.fxLineBreak=(terminal.m.fxLineBreak+1)%2]}
1068 -function terminalCaptureToggle(){if(void 0==terminal.m.capture)terminal.m.capture="",c2.value="Stop Capture";else{if(0<terminal.m.capture.length){var b="TerminalCapture",c=new Date;amtsysstate&&(b+="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);saveAs(data2blob(terminal.m.capture),b+".txt")}delete terminal.m.capture;
1069 -c2.value="Start Capture"}}function terminal_FileSelectHandler(b){haltEvent(b);if(3==terminal.State&&null!=b.dataTransfer&&1==b.dataTransfer.files.length){var c=new FileReader;c.onload=terminal_onSetupBinRead;c.readAsText(b.dataTransfer.files[0])}}function terminal_onSetupBinRead(b){d3pastetextarea.value=b.target.result;setDialogMode(3,"Paste",3,termPaste)}var desktopScreenInfo=null,desktopPollTimer=null,webRtcDesktop=null;
1071 +function terminalCaptureToggle(){if(void 0==terminal.m.capture)terminal.m.capture="",c3.value="Stop Capture";else{if(0<terminal.m.capture.length){var b="TerminalCapture",c=new Date;amtsysstate&&(b+="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);saveAs(data2blob(terminal.m.capture),b+".txt")}delete terminal.m.capture;
1072 +c3.value="Start Capture"}}function terminal_FileSelectHandler(b){haltEvent(b);if(3==terminal.State&&null!=b.dataTransfer&&1==b.dataTransfer.files.length){var c=new FileReader;c.onload=terminal_onSetupBinRead;c.readAsText(b.dataTransfer.files[0])}}function terminal_onSetupBinRead(b){d3pastetextarea.value=b.target.result;setDialogMode(3,"Paste",3,termPaste)}var desktopScreenInfo=null,desktopPollTimer=null,webRtcDesktop=null;
1073 function webRtcDesktopReset(){if(null!=webRtcDesktop){null!=webRtcDesktop.softdesktop&&(webRtcDesktop.softdesktop.Stop(),webRtcDesktop.softdesktop=null);if(null!=webRtcDesktop.webchannel){try{webRtcDesktop.webchannel.close()}catch(b){}webRtcDesktop.webchannel=null}if(null!=webRtcDesktop.webrtc){try{webRtcDesktop.webrtc.close()}catch(b){}webRtcDesktop.webrtc=null}webRtcDesktop=null;desktop.m.hold(!1);Q(42).textContent=StatusStrs[desktop.State];p24files=null;p24downloadFileCancel();p24uploadFileCancel();
1074 QV("go24",!1);24==currentView&&go(14)}}
1075 function connectDesktop(){desktop&&(0==desktop.State?(desktop.m.bpp=1==desktopsettings.encoding||3==desktopsettings.encoding?1:2,desktop.m.useZRLE=3>desktopsettings.encoding,desktop.m.showmouse=desktopsettings.showmouse,desktop.m.onScreenSizeChange=center,desktop.m.onKvmData=function(b){var c=null;try{c=JSON.parse(b)}catch(a){}null!=c&&null!=c.action&&("restart"==c.action?(webRtcDesktopReset(),desktop.m.sendKvmData(JSON.stringify({action:"present",ver:1}))):"present"==c.action&&null==webRtcDesktop?
@@ -1079,12 +1082,12 @@ desktopPollTimer=null,PullDesktopDisplayInfo(),webRtcDesktopReset()))}function P
1082 function ProcessDesktopDisplayInfo(b,c,a,d){200!=d?desktopScreenInfo=null:(desktopScreenInfo=a.IPS_ScreenSettingData.responses.Body,desktopScreenInfo.KVMRSD=a.IPS_KVMRedirectionSettingData.responses.Body,UpdateDesktopDisplayInfo())}
1083 function UpdateDesktopDisplayInfo(){for(var b="",c=0,a=0;3>a;a++)1==desktopScreenInfo.IsActive[a]&&(c++,b+='<input type="button" '+(a==desktopScreenInfo.KVMRSD.DefaultScreen?'style="background-color:DodgerBlue"':"")+' value="'+(a+1)+'" title="Switch to screen '+(a+1)+'" onkeypress="return false" onkeydown="return false" onclick="desktopSwitchScreen('+a+')">&nbsp;');1<c?Q(44).innerHTML=b+"&nbsp;":Q(44).innerHTML=""}
1084 function desktopSwitchScreen(b){var c=Clone(desktopScreenInfo.KVMRSD);c.DefaultScreen=b;amtstack.Put("IPS_KVMRedirectionSettingData",c,desktopSwitchScreenEx)}function desktopSwitchScreenEx(b,c,a,d){200==d&&(desktopScreenInfo.KVMRSD=a.Body,UpdateDesktopDisplayInfo())}
1082 -function onDesktopStateChange(b,c){c8.value=0==c?"Connect":"Disconnect";Q(42).textContent=StatusStrs[c];var a=3==c&&!urlvars.kvmviewonly;QE(45,a);QE("deskkeys",a);QE("DeskWD",a);switch(c){case 0:webRtcDesktopReset();break;case 3:12<=amtversion&&b.m.sendKvmData(JSON.stringify({action:"present",ver:1}))}center()}function showDesktopSettings(){applyDesktopSettings();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}
1083 -function showDesktopSettingsChanged(){desktopsettings.encoding=c9.value;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.showcad=d7showcad.checked;desktopsettings.limitFrameRate=d7limitFrameRate.checked;desktopsettings.noMouseRotate=d7noMouseRotate.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();desktop.m.frameRateDelay=1==
1085 +function onDesktopStateChange(b,c){c10.value=0==c?"Connect":"Disconnect";Q(42).textContent=StatusStrs[c];var a=3==c&&!urlvars.kvmviewonly;QE(45,a);QE("deskkeys",a);QE("DeskWD",a);switch(c){case 0:webRtcDesktopReset();break;case 3:12<=amtversion&&b.m.sendKvmData(JSON.stringify({action:"present",ver:1}))}center()}function showDesktopSettings(){applyDesktopSettings();setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged)}
1086 +function showDesktopSettingsChanged(){desktopsettings.encoding=c11.value;desktopsettings.showmouse=d7showcursor.checked;desktopsettings.showcad=d7showcad.checked;desktopsettings.limitFrameRate=d7limitFrameRate.checked;desktopsettings.noMouseRotate=d7noMouseRotate.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings));applyDesktopSettings();desktop.m.frameRateDelay=1==
1087 desktopsettings.limitFrameRate?200:0;0!=desktop.State&&(desktop.Stop(),setTimeout(connectDesktop,50))}
1085 -function applyDesktopSettings(){c9.value=desktopsettings.encoding;d7showcursor.checked=desktopsettings.showmouse;d7showcad.checked=desktopsettings.showcad;d7limitFrameRate.checked=desktopsettings.limitFrameRate;d7noMouseRotate.checked=desktopsettings.noMouseRotate;desktopsettings.quality&&(d7bitmapquality.value=desktopsettings.quality);desktopsettings.scaling&&(d7bitmapscaling.value=desktopsettings.scaling);QV("d7softkvmsettings",12<=amtversion);QV(45,desktopsettings.showcad)}
1088 +function applyDesktopSettings(){c11.value=desktopsettings.encoding;d7showcursor.checked=desktopsettings.showmouse;d7showcad.checked=desktopsettings.showcad;d7limitFrameRate.checked=desktopsettings.limitFrameRate;d7noMouseRotate.checked=desktopsettings.noMouseRotate;desktopsettings.quality&&(d7bitmapquality.value=desktopsettings.quality);desktopsettings.scaling&&(d7bitmapscaling.value=desktopsettings.scaling);QV("d7softkvmsettings",12<=amtversion);QV(45,desktopsettings.showcad)}
1089 var fullscreen=!1,fullscreenonly=!1;
1087 -function deskToggleFull(b){1==fullscreenonly?(console.log("deskToggleFull1",fullscreenonly,urlvars.kvmonly),fullscreenonly=!1,1==urlvars.kvmonly?console.log("deskToggleFull2"):disconnect()):(fullscreenonly=b,fullscreen=!fullscreen,QV(7,!fullscreen),QV(37,!fullscreen),QV("c4",!fullscreen),QV("c7",fullscreen),fullscreen?(QS(8).left=0,QS(16).padding=0):(QS(8).left="156px",QS(16).padding="8px"),center())}
1090 +function deskToggleFull(b){1==fullscreenonly?(console.log("deskToggleFull1",fullscreenonly,urlvars.kvmonly),fullscreenonly=!1,1==urlvars.kvmonly?console.log("deskToggleFull2"):disconnect()):(fullscreenonly=b,fullscreen=!fullscreen,QV(7,!fullscreen),QV(37,!fullscreen),QV("c5",!fullscreen),QV("c9",fullscreen),fullscreen?(QS(8).left=0,QS(16).padding=0):(QS(8).left="156px",QS(16).padding="8px"),center())}
1091 function sendCAD(){Q(49).checked||desktop.m.sendcad()}
1092 var deskkeysset={0:[[65511,1],[65511,0]],1:[[65511,1],[65364,1],[65364,0],[65511,0]],2:[[65511,1],[65362,1],[65362,0],[65511,0]],3:[[65511,1],[108,1],[108,0],[65511,0]],4:[[65511,1],[109,1],[109,0],[65511,0]],5:[[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]],6:[[65470,1],[65470,0]],7:[[65471,1],[65471,0]],8:[[65472,1],[65472,0]],9:[[65473,1],[65473,0]],10:[[65474,1],[65474,0]],11:[[65475,1],[65475,0]],12:[[65476,1],[65476,0]],13:[[65477,1],[65477,0]],14:[[65478,1],[65478,0]],15:[[65479,
1093 1],[65479,0]],16:[[65480,1],[65480,0]],17:[[65481,1],[65481,0]]};function deskSendKeys(){if(!Q(49).checked){var b=Q("deskkeys").value;if(null!=b&&null!=deskkeysset[b]&&0!=desktop.State)for(var c=0;c<deskkeysset[b].length;c++)desktop.m.sendkey(deskkeysset[b][c][0],deskkeysset[b][c][1])}}
@@ -1094,10 +1097,10 @@ function dmousemove(b){xxdialogMode||Q(49).checked||(null!=webRtcDesktop&&null!=
1097 function drotate(b){b=desktop.m.rotation+b;desktop.m.setRotation(b);null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop&&null!=webRtcDesktop.softdesktop.m&&webRtcDesktop.softdesktop.m.setRotation(b);center()}var p24files=null,p24filetree=null,p24targetpath=null,p24filetreelocation=[];
1098 function onFilesControlData(b){if(0<b.length&&123!=b.charCodeAt(0))p24gotDownloadBinaryData(b);else if(b=JSON.parse(b),"download"==b.action)p24gotDownloadCommand(b);else if("upload"==b.action)p24gotUploadData(b);else if("pong"!=b.action)if(b.path=b.path.replace(/\//g,"\\"),null!=p24filetree&&b.path==p24filetree.path){var c=p24getCheckedNames();p24filetree=b;p24updateFiles(c)}else{for(var c=b.path.split("/").join("\\"),a=p24targetpath.split("/").join("\\");0<c.length&&"\\"==c[0];)c=c.substring(1);
1099 for(;0<a.length&&"\\"==a[0];)a=a.substring(1);if(c==a||"\\"==b.path&&""==p24targetpath)p24filetree=b,p24updateFiles()}}function p24getCheckedNames(){for(var b=[],c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&b.push(p24filetree.dir[c[a].value].n);return b}
1097 -function p24updateFiles(b){var c="",a="",d="<a style=cursor:pointer onclick=p24folderup(0)>Root</a>",e=p24filetree.path.split("\\");p24filetreelocation=[];for(var n in e)""!=e[n]&&p24filetreelocation.push(e[n]);for(n in p24filetreelocation)d+=" / <a style=cursor:pointer onclick=p24folderup("+(parseInt(n)+1)+")>"+p24filetreelocation[n]+"</a>";var e=p24filetreelocation.join("/"),p=p24sort_files(p24filetree.dir);for(n in p){var q=p[n],m=q.n,g;g=70<m.length?'<span title="'+EscapeHtml(m)+'">'+EscapeHtml(m.substring(0,
1098 -70))+"...</span>":EscapeHtml(m);var m=EscapeHtml(m),w="";null!=q.d&&(w=new Date(q.d),w=w.getMonth()+1+"/"+w.getDate()+"/"+w.getFullYear()+" "+w.toLocaleTimeString()+"&nbsp;");var l="";null!=q.s&&(l=getFileSizeStr(q.s));var v="";3>q.t?v="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value='"+q.nx+'\'>&nbsp;<span style=float:right title=""></span><span><div class=fileIcon'+q.t+'></div><a style=cursor:pointer onclick=p24folderset("'+
1099 -encodeURIComponent(q.nx)+'")>'+g+"</a></span></div>":(v=g,0<q.s&&(v='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p24downloadfile(\''+encodeURIComponent(e+"/"+m)+"','"+encodeURIComponent(m)+"',"+q.s+')">'+g+"</a>"),v="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value='"+q.nx+"'>&nbsp;<span class=fsize>"+w+"</span><span style=float:right>"+l+"</span><span><div class=fileIcon"+q.t+"></div>"+v+"</span></div>");
1100 -3>q.t?c+=v:a+=v}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),n=0;n<c.length;n++)0<=b.indexOf(p24filetree.dir[c[n].value].n)&&(c[n].checked=!0);p24setActions()}function p24folderset(b){p24targetpath=joinPaths(p24filetree.path,p24filetree.dir[b].n).split("\\").join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}
1100 +function p24updateFiles(b){var c="",a="",d="<a style=cursor:pointer onclick=p24folderup(0)>Root</a>",e=p24filetree.path.split("\\");p24filetreelocation=[];for(var n in e)""!=e[n]&&p24filetreelocation.push(e[n]);for(n in p24filetreelocation)d+=" / <a style=cursor:pointer onclick=p24folderup("+(parseInt(n)+1)+")>"+p24filetreelocation[n]+"</a>";var e=p24filetreelocation.join("/"),p=p24sort_files(p24filetree.dir);for(n in p){var r=p[n],m=r.n,g;g=70<m.length?'<span title="'+EscapeHtml(m)+'">'+EscapeHtml(m.substring(0,
1101 +70))+"...</span>":EscapeHtml(m);var m=EscapeHtml(m),w="";null!=r.d&&(w=new Date(r.d),w=w.getMonth()+1+"/"+w.getDate()+"/"+w.getFullYear()+" "+w.toLocaleTimeString()+"&nbsp;");var l="";null!=r.s&&(l=getFileSizeStr(r.s));var v="";3>r.t?v="<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value='"+r.nx+'\'>&nbsp;<span style=float:right title=""></span><span><div class=fileIcon'+r.t+'></div><a style=cursor:pointer onclick=p24folderset("'+
1102 +encodeURIComponent(r.nx)+'")>'+g+"</a></span></div>":(v=g,0<r.s&&(v='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick="p24downloadfile(\''+encodeURIComponent(e+"/"+m)+"','"+encodeURIComponent(m)+"',"+r.s+')">'+g+"</a>"),v="<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value='"+r.nx+"'>&nbsp;<span class=fsize>"+w+"</span><span style=float:right>"+l+"</span><span><div class=fileIcon"+r.t+"></div>"+v+"</span></div>");
1103 +3>r.t?c+=v:a+=v}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),n=0;n<c.length;n++)0<=b.indexOf(p24filetree.dir[c[n].value].n)&&(c[n].checked=!0);p24setActions()}function p24folderset(b){p24targetpath=joinPaths(p24filetree.path,p24filetree.dir[b].n).split("\\").join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}
1104 function p24folderup(b){if(null==b)p24filetreelocation.pop();else for(;p24filetreelocation.length>b;)p24filetreelocation.pop();p24targetpath=p24filetreelocation.join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}var p24sortorder;function p24sort_filename(b,c){return b.ln>c.ln?1*p24sortorder:b.ln<c.ln?-1*p24sortorder:0}function p24sort_timestamp(b,c){return b.d>c.d?1*p24sortorder:b.d<c.d?-1*p24sortorder:0}
1105 function p24sort_bysize(b,c){return b.s==c.s?p24sort_filename(b,c):(b.s-c.s)*p24sortorder}function p24sort_files(b){var c=[],a=Q("p24sortdropdown").value,d;for(d in b)b[d].nx=d,null==b[d].s&&(b[d].s=0),null==b[d].n&&(b[d].n=d),b[d].ln=b[d].n.toLowerCase(),c.push(b[d]);p24sortorder=1;3<a&&(p24sortorder=-1,a-=3);1==a?c.sort(p24sort_filename):2==a?c.sort(p24sort_bysize):3==a&&c.sort(p24sort_timestamp);return c}
1106 function p24setActions(){if(null==p24filetree)QE("p24DeleteFileButton",!1),QE("p24NewFolderButton",!1),QE("p24UploadButton",!1),QE("p24RenameFileButton",!1),QE("p24SelectAllButton",!1),Q("p24SelectAllButton").value="Select All",QE("p24RefreshButton",!1),QE("p24CutButton",!1),QE("p24CopyButton",!1),QE("p24PasteButton",!1);else{var b=p24getFileSelCount(),c=p24getFileCount(),a=p24getFileSelCount(!1),d="win32"==webRtcDesktop.platform;QE("p24DeleteFileButton",0<b&&(0<p24filetreelocation.length||0==d));
@@ -1106,8 +1109,8 @@ p24clipboard&&0<p24clipboard.length)}}function p24getFileSelCount(b){for(var c=0
1109 function p24createfolder(){setDialogMode(11,"New Folder",3,p24createfolderEx,"<input type=text id=p24renameinput maxlength=64 onkeyup=p24fileNameCheck(event) style=width:100% />");focusTextBox("p24renameinput");p24fileNameCheck()}function p24createfolderEx(){p24files.sendCtrlMsg(JSON.stringify({action:"mkdir",reqid:1,path:p24filetreelocation.join("/")+"/"+Q("p24renameinput").value}));p24folderup(999)}
1110 function p24deletefile(){var b=p24getFileSelCount();setDialogMode(11,"Delete",3,p24deletefileEx,1<b?"Delete "+b+" selected items?":"Delete selected item?")}function p24deletefileEx(){for(var b=[],c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&b.push(p24filetree.dir[c[a].value].n);p24files.sendCtrlMsg(JSON.stringify({action:"rm",reqid:1,path:p24filetreelocation.join("/"),delfiles:b}));p24folderup(999)}
1111 function p24renamefile(){for(var b,c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&(b=p24filetree.dir[c[a].value].n);setDialogMode(11,"Rename",3,p24renamefileEx,'<input type=text id=p24renameinput maxlength=64 onkeyup=p24fileNameCheck(event) style=width:100% value="'+b+'" />',{action:"rename",path:p24filetreelocation.join("/"),oldname:b});focusTextBox("p24renameinput");p24fileNameCheck()}
1109 -function p24renamefileEx(b,c){c.newname=Q("p24renameinput").value;p24files.sendCtrlMsg(JSON.stringify(c));p24folderup(999)}function p24fileNameCheck(b){var c=isFilenameValid(Q("p24renameinput").value);QE("c46",c);1==c&&null!=b&&24==b.keyCode&&dialogclose(1)}
1110 -function p24uploadFile(){setDialogMode(11,"Upload File",3,p24uploadFileEx,"<input type=file name=files id=p24uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p24uploadinput')\" />");updateUploadDialogOk("p24uploadinput")}function p24uploadFileEx(){p24doUploadFiles(Q("p24uploadinput").files)}function updateUploadDialogOk(b){QE("c46",""!=Q(b).value)}var p24clipboard=null,p24clipboardFolder=null,p24clipboardCut=0;
1112 +function p24renamefileEx(b,c){c.newname=Q("p24renameinput").value;p24files.sendCtrlMsg(JSON.stringify(c));p24folderup(999)}function p24fileNameCheck(b){var c=isFilenameValid(Q("p24renameinput").value);QE("c48",c);1==c&&null!=b&&24==b.keyCode&&dialogclose(1)}
1113 +function p24uploadFile(){setDialogMode(11,"Upload File",3,p24uploadFileEx,"<input type=file name=files id=p24uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p24uploadinput')\" />");updateUploadDialogOk("p24uploadinput")}function p24uploadFileEx(){p24doUploadFiles(Q("p24uploadinput").files)}function updateUploadDialogOk(b){QE("c48",""!=Q(b).value)}var p24clipboard=null,p24clipboardFolder=null,p24clipboardCut=0;
1114 function p24copyFile(b){var c=document.getElementsByName("fd");p24clipboard=[];p24clipboardCut=b;p24clipboardFolder=p24targetpath;for(b=0;b<c.length;b++)c[b].checked&&"3"==c[b].attributes.file.value&&p24clipboard.push(p24filetree.dir[c[b].value].n);p24updateClipview()}
1115 function p24pasteFile(){var b="";null!=p24clipboard&&0<p24clipboard.length&&(b="Confim "+(0==p24clipboardCut?"copy":"move")+" of "+p24clipboard.length+" entrie"+(1<p24clipboard.length?"s":"")+" to this location?");setDialogMode(11,"Paste",3,p24pasteFileEx,b)}
1116 function p24pasteFileEx(){p24files.sendCtrlMsg(JSON.stringify({action:0==p24clipboardCut?"copy":"move",reqid:1,scpath:p24clipboardFolder,dspath:p24targetpath,names:p24clipboard}));p24folderup(999);1==p24clipboardCut&&(p24clipboardFolder=p24clipboard=null,p24clipboardCut=0,p24updateClipview())}
@@ -1128,12 +1131,13 @@ function iderStart(){var b;b='<div>Mount disk images on a Intel&reg; AMT compute
1131 setDialogMode(11,"Storage Redirection",3,iderStart2,b);if(b=localStorage.getItem("iderurl"))Q("storageserverurl").value=b.substring(1,b.length-1)}
1132 function iderStart2(){if(1!=Q("floppyImageInput").files.length&&1!=Q("cdromImageInput").files.length)messagebox("Storage Redirection Error","At least one disk image file must be selected.");else if(1==Q("floppyImageInput").files.length&&0!=Q("floppyImageInput").files[0].size%512)messagebox("Storage Redirection Error","Invalid .img file.");else if(1==Q("cdromImageInput").files.length&&0!=Q("cdromImageInput").files[0].size%2048)messagebox("Storage Redirection Error","Invalid .iso file.");else{var b=
1133 null,c=null;1==Q("floppyImageInput").files.length&&(b=Q("floppyImageInput").files[0]);1==Q("cdromImageInput").files.length&&(c=Q("cdromImageInput").files[0]);iderStop();ider=CreateAmtRedirect(CreateAmtRemoteIder());ider.onStateChanged=onIderStateChange;ider.m.floppy=b;ider.m.cdrom=c;ider.m.iderStart=Q("iderStartType").value;ider.m.sectorStats=iderSectorStats;ider.tlsv1only=amtstack.wsman.comm.tlsv1only;ider.Start(currentMeshNode._id,16994,"*","*",0)}}
1131 -function iderStop(){ider&&(ider.m.Stop(),ider.onStateChanged=null,ider.m.onDialogPrompt=null,delete ider);iderTimer&&(clearInterval(iderTimer),delete iderTimer);iderToggleDiskMap(!1)}function onIderStateChange(b,c){QE("c1",3!=c);QE("c6",3!=c);QV(9,3==c);center();3==c?(urlvars.norefresh||(iderTimer=setInterval(onIderTimer,500)),onIderTimer()):iderTimer&&(clearInterval(iderTimer),delete iderTimer)}
1134 +function iderStop(){ider&&(ider.m.Stop(),ider.onStateChanged=null,ider.m.onDialogPrompt=null,delete ider);iderTimer&&(clearInterval(iderTimer),delete iderTimer);iderToggleDiskMap(!1)}function onIderStateChange(b,c){QE("c2",3!=c);QE("c8",3!=c);QV(9,3==c);center();3==c?(urlvars.norefresh||(iderTimer=setInterval(onIderTimer,500)),onIderTimer()):iderTimer&&(clearInterval(iderTimer),delete iderTimer)}
1135 function onIderTimer(){ider.m.Update&&ider.m.Update();-1==ider.m.bytesFromAmt?iderStop():QH(10,", Connected, "+ider.m.bytesFromAmt+" in, "+ider.m.bytesToAmt+" out.")}var heatMapWidth=600,heatMapDividor={};
1136 function iderSectorStats(b,c,a,d,e){var n=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),p=n.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0<a)for(;8E3<a/heatMapDividor[c];)heatMapDividor[c]*=2;c?(QV("cdromHeatMap",a),QH("cdromHeatMapText","<b>CDROM</b>, blocks are "+2048*heatMapDividor[c]+" bytes.")):(QV("floppyHeatMap",a),QH("floppyHeatMapText","<b>Floppy</b>, blocks are "+512*heatMapDividor[c]+" bytes."))}c=heatMapDividor[c];a/=c;d/=c;e/=c;if(0==b)n.height=6*(Math.floor(a/(heatMapWidth/
1137 6))+(a%heatMapWidth?1:0)),p.fillStyle="rgba(225,250,225,1)",p.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&p.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),p.fillStyle="rgba(0,0,0,0.3)";else for(b=d;b<d+e;b++)sectorHeat(p,b,6,c)}function sectorHeat(b,c,a,d){b.fillRect(c%(heatMapWidth/a)*a,Math.floor(c/(heatMapWidth/a))*a,a,a)}
1138 function iderToggleDiskMap(b){var c="none"!=QS("iderHeatmap").display;null==b&&(b=!c);xxdialogMode&&(b=!1);QS("iderHeatmap").display=b?"":"none"}function onIderDialogPrompt(b,c,a){iderCodeBlock&&(document.body.removeChild(iderCodeBlock),delete iderCodeBlock);c.js&&(b=document.createElement("script"),b.text=c.js,iderCodeBlock=document.body.appendChild(b));setDialogMode(11,"Storage Redirection",a?a:3,onIderDialogPromptOk,c.html)}
1136 -function onIderDialogPromptOk(b){1==b?window.iderServerCall?ider.m.dialogPrompt(window.iderServerCall()):ider.m.dialogPrompt():iderStop()}var xxRemoteAccess=null,xxEnvironementDetection=null,xxCiraServers=null,xxUserInitiatedCira=null,xxUserInitiatedEnabledState={32768:"Disabled",32769:"BIOS enabled",32770:"OS enable",32771:"BIOS & OS enabled"},xxRemoteAccessCredentiaLinks=null,xxMPSUserPass=null,xxPolicies=null;
1139 +function onIderDialogPromptOk(b){1==b?window.iderServerCall?ider.m.dialogPrompt(window.iderServerCall()):ider.m.dialogPrompt():iderStop()}function iderServerStart(){iderStop();ider=CreateAmtRemoteServerIder();null!=ider&&(ider.onStateChanged=onIderStateChange,ider.m.onDialogPrompt=onIderDialogPrompt,ider.tlsv1only=amtstack.wsman.comm.tlsv1only,ider.Start(currentMeshNode._id,16994,"*","*",0))}
1140 +var xxRemoteAccess=null,xxEnvironementDetection=null,xxCiraServers=null,xxUserInitiatedCira=null,xxUserInitiatedEnabledState={32768:"Disabled",32769:"BIOS enabled",32770:"OS enable",32771:"BIOS & OS enabled"},xxRemoteAccessCredentiaLinks=null,xxMPSUserPass=null,xxPolicies=null;
1141 function PullRemoteAccess(){var b="*AMT_EnvironmentDetectionSettingData AMT_ManagementPresenceRemoteSAP AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule *AMT_UserInitiatedConnectionService AMT_MPSUsernamePassword".split(" ");11<amtversion&&b.push("*IPS_HTTPProxyService","IPS_HTTPProxyAccessPoint");amtstack.BatchEnum(null,b,processRemote1)}
1142 function processRemote1(b,c,a,d){if(400!=d&&!errcheck(d,b)&&void 0!=a.AMT_UserInitiatedConnectionService&&void 0!=a.AMT_UserInitiatedConnectionService.response){QV("go17",!0);xxRemoteAccess=a;xxEnvironementDetection=a.AMT_EnvironmentDetectionSettingData.response;xxEnvironementDetection.DetectionStrings=MakeToArray(xxEnvironementDetection.DetectionStrings);xxCiraServers=a.AMT_ManagementPresenceRemoteSAP.responses;xxUserInitiatedCira=a.AMT_UserInitiatedConnectionService.response;xxRemoteAccessCredentiaLinks=
1143 a.AMT_RemoteAccessCredentialContext.responses;xxMPSUserPass=a.AMT_MPSUsernamePassword.responses;xxPolicies={User:[],Alert:[],Periodic:[]};for(var e in a.AMT_RemoteAccessPolicyAppliesToMPS.responses)c=a.AMT_RemoteAccessPolicyAppliesToMPS.responses[e],b=Clone(getItem(xxCiraServers,"Name",getItem(c.ManagedElement.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value)),b.MpsType=c.MpsType,c=getItem(c.PolicySet.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyRuleName").Value.split(" ")[0],
@@ -1149,7 +1153,7 @@ c+="</select><div>Primary server</div></div>";a&&(c+="<div style=height:26px><se
1153 for(e in xxCiraServers)c+="<option value="+e+""+(xxPolicies[b][1]&&xxPolicies[b][1].Name==xxCiraServers[e].Name?" selected":"")+">"+xxCiraServers[e].AccessInfo;c+="</select><div>Secondary server</div></div>";a&&(c+="<div style=height:26px><select id=d2server2cira style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=0>CIRA - External<option value=1"+(xxPolicies[b][1]&&1==xxPolicies[b][1].MpsType?" selected":"")+">CILA - Internal</select><div>Secondary MPS Type</div></div>")}e=
1154 0;d&&(e=d.TunnelLifeTime);c+="<div style=height:26px><input id=d2lifetime style=float:right;width:200px onchange=editMpsPolicyUpdate() value="+e+">";c+="<div>Tunnel lifetime (Seconds)</div></div>";"Periodic"==b&&(a=0,e=3600,d&&(d=atob(d.ExtendedData),a=ReadInt(d,0),e=ReadInt(d,4),1==a&&(d=ReadInt(d,8),10>d&&(d="0"+d),e+=":"+d)),c+="<div style=height:26px><select id=d2ttype style=float:right;width:206px onchange=editMpsPolicyUpdate()>",c+="<option value=0"+(0==a?" selected":"")+">Periodic, time interval<option value=1"+
1155 (1==a?" selected":"")+">Time of day, once a day",c+="</select><div>Trigger type</div></div><div style=height:26px><input id=d2timer style=float:right;width:200px onkeyup=editMpsPolicyUpdate() value="+e+"><div id=ttypelabel></div></div>");setDialogMode(11,b+" Connection",3,editMpsPolicyOk,c);editMpsPolicyUpdate()}
1152 -function editMpsPolicyUpdate(){var b=11<amtversion||11==amtversion&&6<=amtversion,c=1>=xxCiraServers.length||-1==Q("d2server1").value||Q("d2server1").value!=Q("d2server2").value;if(1==c&&"Periodic"==xxEditMpsPolicyType&&1==Q("d2ttype").value){var a=Q("d2timer").value.split(":");if(2!=a.length)c=!1;else{var d=parseInt(a[0]),a=parseInt(a[1]);if(0>d||23<d||0>a||59<a)c=!1}}QE("c46",c);1<xxCiraServers.length&&QE("d2server2",-1!=Q("d2server1").value);"Periodic"==xxEditMpsPolicyType&&(QE("d2timer",
1156 +function editMpsPolicyUpdate(){var b=11<amtversion||11==amtversion&&6<=amtversion,c=1>=xxCiraServers.length||-1==Q("d2server1").value||Q("d2server1").value!=Q("d2server2").value;if(1==c&&"Periodic"==xxEditMpsPolicyType&&1==Q("d2ttype").value){var a=Q("d2timer").value.split(":");if(2!=a.length)c=!1;else{var d=parseInt(a[0]),a=parseInt(a[1]);if(0>d||23<d||0>a||59<a)c=!1}}QE("c48",c);1<xxCiraServers.length&&QE("d2server2",-1!=Q("d2server1").value);"Periodic"==xxEditMpsPolicyType&&(QE("d2timer",
1157 -1!=Q("d2server1").value),QH("ttypelabel",0==Q("d2ttype").value?"Trigger interval (Seconds)":"Time of day (HH:MM)"),QE("d2ttype",-1!=Q("d2server1").value));QE("d2lifetime",-1!=Q("d2server1").value);b&&(QE("d2server1cira",-1<Q("d2server1").value),1<xxCiraServers.length&&QE("d2server2cira",-1<Q("d2server1").value&&-1<Q("d2server2").value))}
1158 function editMpsPolicyOk(){var b=xxEditMpsPolicyType;"User"==b&&(b="User Initiated");getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",b)?amtstack.Delete("AMT_RemoteAccessPolicyRule",{PolicyRuleName:b},editMpsPolicyOk2):editMpsPolicyOk2()}
1159 function editMpsPolicyOk2(b,c,a,d){b=11<amtversion||11==amtversion&&6<=amtversion;if(-1==Q("d2server1").value)PullRemoteAccess();else{c=0;"Alert"==xxEditMpsPolicyType&&(c=1);"Periodic"==xxEditMpsPolicyType&&(c=2);a=null;2==c&&(a=Q("d2ttype").value,d=IntToStr(Q("d2timer").value),1==a&&(d=Q("d2timer").value.split(":"),d=IntToStr(parseInt(d[0]))+IntToStr(parseInt(d[1]))),a=btoa(IntToStr(a)+d));var e,n;0<=Q("d2server1").value&&(e='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
@@ -1169,7 +1173,7 @@ function showProxyDetails(b){var c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.respo
1173 function showProxyDetailsOk(b,c){var a=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses[c];2==b&&amtstack.Delete("IPS_HTTPProxyAccessPoint",{Name:a.Name},showProxyDetailsOk2)}function showProxyDetailsOk2(b,c,a,d){408==d?messagebox("HTTP Proxy Removal","Unable to remove HTTP proxy, access denied."):PullRemoteAccess()}
1174 function AddRemoteAccessProxy(){var b;b='<div style=height:26px><select id=d2type style=float:right;width:206px onchange=AddRemoteAccessProxyUpdate()><option value=2>Hostname FQDN<option value=3>IPv4 address<option value=4>IPv6 address</select><div>Connection type</div></div><div style=height:26px><input id=d2host style=float:right;width:200px maxlength=255 onkeyup=AddRemoteAccessProxyUpdate()><div id=d2typespan></div></div><div style=height:26px><input id=d2port onkeypress="return (event.charCode == 0 || (event.charCode >= 48 && event.charCode <= 57))" style=float:right;width:200px onkeyup=AddRemoteAccessProxyUpdate()><div>Port</div></div>';b+=
1175 "<div style=height:26px><input id=d2domain style=float:right;width:200px maxlength=191 onkeyup=AddRemoteAccessProxyUpdate()><div>DNS suffix</div></div>";setDialogMode(11,"Add HTTP Proxy",3,AddRemoteAccessProxyOk,b);AddRemoteAccessProxyUpdate()}
1172 -function AddRemoteAccessProxyUpdate(){var b=0!=Q("d2host").value.length&&0!=Q("d2domain").value.length;if(0==Q("d2port").value.length||65535<parseInt(Q("d2port").value))b=!1;QE("c46",b);QH("d2typespan",["","","FQDN / hostname","IPv4 address","IPv6 address"][Q("d2type").value])}function AddRemoteAccessProxyOk(){amtstack.IPS_HTTPProxyService_AddProxyAccessPoint(Q("d2host").value,Q("d2type").value,parseInt(Q("d2port").value),Q("d2domain").value,AddRemoteAccessProxyOk2)}
1176 +function AddRemoteAccessProxyUpdate(){var b=0!=Q("d2host").value.length&&0!=Q("d2domain").value.length;if(0==Q("d2port").value.length||65535<parseInt(Q("d2port").value))b=!1;QE("c48",b);QH("d2typespan",["","","FQDN / hostname","IPv4 address","IPv6 address"][Q("d2type").value])}function AddRemoteAccessProxyOk(){amtstack.IPS_HTTPProxyService_AddProxyAccessPoint(Q("d2host").value,Q("d2type").value,parseInt(Q("d2port").value),Q("d2domain").value,AddRemoteAccessProxyOk2)}
1177 function AddRemoteAccessProxyOk2(b,c,a,d){200!=d?messagebox("Add Proxy Server","Failed to add proxy, status "+d):0!=a.Body.ReturnValue?messagebox("Add Proxy Server",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}
1178 function AddRemoteAccessServer(){var b=[],c;for(c in xxCertificates)xxCertificates[c].XPrivateKey&&b.push(xxCertificates[c]);var a;a="<div style=height:26px><select id=d2type style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()><option value=201>Hostname FQDN<option value=3>IPv4 address</select><div>Connection type</div></div><div style=height:26px><input id=d2name style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div id=d2lname></div></div>";a+='<div style=height:26px><input id=d2port onkeypress="return (event.charCode == 0 || (event.charCode >= 48 && event.charCode <= 57))" style=float:right;width:200px value=4433 onkeyup=AddRemoteAccessServerUpdate()><div>Server port</div></div>';
1179 a+="<div style=height:26px id=d2ucn><input id=d2cn style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Server Common Name</div></div>";a+="<div style=height:26px><select id=d2auth style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()>";0<b.length&&(a+="<option value=1>Certificate");a+="<option value=2>Username/Password</select><div>Authentication type</div></div>";a+="<span id=d2utype>";a+="<div style=height:26px><input id=d2user style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Username</div></div>";
@@ -1179,26 +1183,26 @@ function AddRemoteAccessServerOk(){var b,c,a,d;1==Q("d2auth").value?b='<Address
1183 "</Selector></SelectorSet></ReferenceParameters>":(c=Q("d2user").value,a=Q("d2pass").value);0<Q("d2cn").value.length&&(d=Q("d2cn").value);amtstack.AMT_RemoteAccessService_AddMpServer(Q("d2name").value,Q("d2type").value,Q("d2port").value,Q("d2auth").value,b,c,a,d,AddRemoteAccessServerOk2)}
1184 function AddRemoteAccessServerOk2(b,c,a,d){200!=d?messagebox("Add Internet Server","Failed to add server, status "+d):0!=a.Body.ReturnValue?messagebox("Add Internet Server",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}
1185 function AddRemoteAccessServerUpdate(){var b=0!=Q("d2name").value.length;3==Q("d2type").value&&1==b&&(b=0!=Q("d2cn").value.length);2==Q("d2auth").value&&1==b&&(b=0!=Q("d2user").value.length&&passwordcheck(Q("d2pass").value));if(0==Q("d2port").value.length||65535<parseInt(Q("d2port").value))b=!1;if(-1!=Q("d2name").value.indexOf(":")||3==Q("d2type").value&&-1!=Q("d2cn").value.indexOf(":"))b=!1;QH("d2lname",201==Q("d2type").value?"Hostname":"IPv4 Address");QV("d2utype",2==Q("d2auth").value);QV("d2ucn",
1182 -3==Q("d2type").value);QV("d2ctype",1==Q("d2auth").value);QE("c46",b)}
1186 +3==Q("d2type").value);QV("d2ctype",1==Q("d2auth").value);QE("c48",b)}
1187 function showEditNameDlg(b){if(!xxdialogMode){var c=amtsysstate.AMT_GeneralSettings.response.HostName,a=amtsysstate.AMT_GeneralSettings.response.DomainName;null!=a&&0<a.length&&(c+="."+a);c='<br><div style=height:26px><input id=d11name value="'+c+'" style=float:right;width:200px><div>Name & Domain</div></div>';1==b&&(b=1==amtsysstate.AMT_GeneralSettings.response.SharedFQDN,c+="<div style=height:26px><select id=d11fqdn style=float:right;width:200px><option value=true "+(b?"selected":"")+'>Shared, same as OS<option value="false" '+
1188 (b?"":"selected")+">Dedicated, different from OS</select><div>Name Sharing</div></div>");setDialogMode(11,"Computer Name",3,editNameDlgOk,c)}}function editNameDlgOk(){var b=Q("d11name").value,c=b.indexOf("."),a="";0<=c&&(a=b.substring(c+1),b=b.substring(0,c));c=Clone(amtsysstate.AMT_GeneralSettings.response);c.HostName=b;c.DomainName=a;Q("d11fqdn")&&(c.SharedFQDN=d11fqdn.value);amtstack.Put("AMT_GeneralSettings",c,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
1185 -function computerNameGet(b,c,a,d){200==d&&(amtsysstate.AMT_GeneralSettings.response=a.Body,updateSystemStatus())}function showEditDnsDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_GeneralSettings.response,c=0;1==b.DDNSUpdateByDHCPServerEnabled&&(c=1);1==b.DDNSUpdateEnabled&&(c=2);c33.value=c;c34.value=b.DDNSPeriodicUpdateInterval;c35.value=b.DDNSTTL;showEditDnsDlgChange();setDialogMode(23,"Dynamic DNS client",3,showEditDnsDlgOk)}}
1186 -function showEditDnsDlgOk(){var b=Clone(amtsysstate.AMT_GeneralSettings.response);b.DDNSUpdateEnabled=2==c33.value?!0:!1;b.DDNSUpdateByDHCPServerEnabled=1==c33.value?!0:!1;2==c33.value&&(b.DDNSPeriodicUpdateInterval=c34.value,b.DDNSTTL=c35.value);amtstack.Put("AMT_GeneralSettings",b,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
1187 -function showEditDnsDlgChange(){QE("c34",2==c33.value);QE("c35",2==c33.value)}function showFeaturesDlg(){!xxdialogMode&&xxAccountAdminName&&(c12.checked=amtfeatures[0],c14.checked=amtfeatures[3],c15.checked=amtfeatures[2],c16.checked=amtfeatures[1],QV("c13",void 0!=amtfeatures[3]),setDialogMode(9,"Intel&reg; AMT Features",3,featuresDlgOk))}
1188 -function featuresDlgOk(){var b=amtsysstate.AMT_RedirectionService.response;b.ListenerEnabled=c12.checked;b.EnabledState=32768+((c15.checked?1:0)+(c16.checked?2:0));amtstack.AMT_RedirectionService_RequestStateChange(b.EnabledState,function(c,a,d,e){200!=e?messagebox("Error","RedirectionService, RequestStateChange Error "+e):amtstack.CIM_KVMRedirectionSAP_RequestStateChange(c14.checked?2:3,0,function(a,c,d,e){200!=e?messagebox("Error","KVMRedirectionSAP, RequestStateChange Error "+
1189 +function computerNameGet(b,c,a,d){200==d&&(amtsysstate.AMT_GeneralSettings.response=a.Body,updateSystemStatus())}function showEditDnsDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_GeneralSettings.response,c=0;1==b.DDNSUpdateByDHCPServerEnabled&&(c=1);1==b.DDNSUpdateEnabled&&(c=2);c35.value=c;c36.value=b.DDNSPeriodicUpdateInterval;c37.value=b.DDNSTTL;showEditDnsDlgChange();setDialogMode(23,"Dynamic DNS client",3,showEditDnsDlgOk)}}
1190 +function showEditDnsDlgOk(){var b=Clone(amtsysstate.AMT_GeneralSettings.response);b.DDNSUpdateEnabled=2==c35.value?!0:!1;b.DDNSUpdateByDHCPServerEnabled=1==c35.value?!0:!1;2==c35.value&&(b.DDNSPeriodicUpdateInterval=c36.value,b.DDNSTTL=c37.value);amtstack.Put("AMT_GeneralSettings",b,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
1191 +function showEditDnsDlgChange(){QE("c36",2==c35.value);QE("c37",2==c35.value)}function showFeaturesDlg(){!xxdialogMode&&xxAccountAdminName&&(c14.checked=amtfeatures[0],c16.checked=amtfeatures[3],c17.checked=amtfeatures[2],c18.checked=amtfeatures[1],QV("c15",void 0!=amtfeatures[3]),setDialogMode(9,"Intel&reg; AMT Features",3,featuresDlgOk))}
1192 +function featuresDlgOk(){var b=amtsysstate.AMT_RedirectionService.response;b.ListenerEnabled=c14.checked;b.EnabledState=32768+((c17.checked?1:0)+(c18.checked?2:0));amtstack.AMT_RedirectionService_RequestStateChange(b.EnabledState,function(c,a,d,e){200!=e?messagebox("Error","RedirectionService, RequestStateChange Error "+e):amtstack.CIM_KVMRedirectionSAP_RequestStateChange(c16.checked?2:3,0,function(a,c,d,e){200!=e?messagebox("Error","KVMRedirectionSAP, RequestStateChange Error "+
1193 e):amtstack.Put("AMT_RedirectionService",b,function(a,b,c,d){200!=d?messagebox("Error","RedirectionService PUT Error "+d):(amtstack.Get("AMT_RedirectionService",featuresDlgGet1,0,1),amtstack.Get("CIM_KVMRedirectionSAP",featuresDlgGet2,0,1))},0,1)})})}function featuresDlgGet1(b,c,a,d){200==d&&(amtsysstate.AMT_RedirectionService.response=a.Body,updateSystemStatus())}function featuresDlgGet2(b,c,a,d){200==d&&(amtsysstate.CIM_KVMRedirectionSAP.response=a.Body,updateSystemStatus())}
1190 -function showConsentDlg(){if(!xxdialogMode){var b=amtsysstate.IPS_OptInService.response.OptInRequired;c17.checked=0==b;c18.checked=1==b;c19.checked=4294967295==b;setDialogMode(10,"User Consent",3,consentDlgOk)}}function consentDlgOk(){amtsysstate.IPS_OptInService.response.OptInRequired=document.querySelector("input[name=d10]:checked").value;amtstack.Put("IPS_OptInService",amtsysstate.IPS_OptInService.response,function(){amtstack.Get("IPS_OptInService",consentGet,0,1)},0,1)}
1194 +function showConsentDlg(){if(!xxdialogMode){var b=amtsysstate.IPS_OptInService.response.OptInRequired;c19.checked=0==b;c20.checked=1==b;c21.checked=4294967295==b;setDialogMode(10,"User Consent",3,consentDlgOk)}}function consentDlgOk(){amtsysstate.IPS_OptInService.response.OptInRequired=document.querySelector("input[name=d10]:checked").value;amtstack.Put("IPS_OptInService",amtsysstate.IPS_OptInService.response,function(){amtstack.Get("IPS_OptInService",consentGet,0,1)},0,1)}
1195 function consentGet(b,c,a,d){200==d&&PullSystemStatus()}var ipv6addrtype="Link local address;Network local address;Global address;User configured;Not allowed;DAD in progress;valid;deprecated;preferred/deprecated;expired;collision;not allowed".split(";");
1196 function showIPv6AddrDlg(b,c){if(!xxdialogMode){var a=TableStart();t=c.split(",");for(var d=0;d<t.length;d+=3)a+=TableEntry("<b>"+t[d]+"</b><br><span style=font-size:10px>"+ipv6addrtype[t[d+1]]+", "+ipv6addrtype[+t[d+2]+5]+"</span>","");setDialogMode(11,"IPv6 addresses for "+(0==b?"wired":"wireless")+" interface",1,null,a+TableEnd())}}
1197 function showIPv6StateDlg(b,c){if(!xxdialogMode&&amtsysstate){var a=amtsysstate.IPS_IPv6PortSettings.responses[b];ipv6manual=0==b&&(isIpAddress(a.IPv6Address)||isIpAddress(a.DefaultRouter)||isIpAddress(a.PrimaryDNS)||isIpAddress(a.SecondaryDNS));QV(69,0==b);QV(70,!1);QV("d21o0",!0);QV("d21l0",!0);QH("d21l0","IPv6 disabled");QH("d21l1","IPv6 enabled, automatic");QH("d21l2","IPv6 enabled, automatic + manual addresse");d21o0.checked=!c;d21o1.checked=c&&!ipv6manual;d21o2.checked=
1194 -c&&ipv6manual;c28.value=isIpAddress(a.IPv6Address,"");c30.value=isIpAddress(a.DefaultRouter,"");c31.value=isIpAddress(a.PrimaryDNS,"");c32.value=isIpAddress(a.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,"IPv6 support for "+(0==b?"wired":"wireless")+" interface",3,function(){showIPv6StateDlgOk(b)})}}
1195 -function showIPv6StateDlgOk(b){var c=amtsysstate.IPS_IPv6PortSettings.responses[b];0==b&&(d21o1.checked&&(c.IPv6Address=c.DefaultRouter=c.PrimaryDNS=c.SecondaryDNS="::",amtstack.Put("IPS_IPv6PortSettings",c,showIPv6StateDlgDone)),d21o2.checked&&(c.IPv6Address=c28.value,c.DefaultRouter=c30.value,c.PrimaryDNS=c31.value,c.SecondaryDNS=c32.value,amtstack.Put("IPS_IPv6PortSettings",c,showIPv6StateDlgDone)));for(var c=amtsysstate.CIM_ElementSettingData.responses,a=
1198 +c&&ipv6manual;c30.value=isIpAddress(a.IPv6Address,"");c32.value=isIpAddress(a.DefaultRouter,"");c33.value=isIpAddress(a.PrimaryDNS,"");c34.value=isIpAddress(a.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,"IPv6 support for "+(0==b?"wired":"wireless")+" interface",3,function(){showIPv6StateDlgOk(b)})}}
1199 +function showIPv6StateDlgOk(b){var c=amtsysstate.IPS_IPv6PortSettings.responses[b];0==b&&(d21o1.checked&&(c.IPv6Address=c.DefaultRouter=c.PrimaryDNS=c.SecondaryDNS="::",amtstack.Put("IPS_IPv6PortSettings",c,showIPv6StateDlgDone)),d21o2.checked&&(c.IPv6Address=c30.value,c.DefaultRouter=c32.value,c.PrimaryDNS=c33.value,c.SecondaryDNS=c34.value,amtstack.Put("IPS_IPv6PortSettings",c,showIPv6StateDlgDone)));for(var c=amtsysstate.CIM_ElementSettingData.responses,a=
1200 0;a<c.length;a++)if(c[a].SettingData&&c[a].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r) IPS IPv6 Settings "+b){var d=Clone(c[a]);d.IsCurrent=d21o0.checked?2:1;amtstack.Put("CIM_ElementSettingData",d,showIPv6StateDlgDone)}}function showIPv6StateDlgDone(b,c,a,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("IPv6 support","Unable to set IPv6 state, error "+d)}
1201 function showPingActionDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_GeneralSettings.response,b=(1==b.PingResponseEnabled)+((1==b.RmcpPingResponseEnabled)<<1);d20a.checked=0==b;d20b.checked=1==b;d20c.checked=2==b;d20d.checked=3==b;setDialogMode(20,"Intel&reg; AMT Ping Response",3,showPingActionDlgOk)}}
1202 function showPingActionDlgOk(){var b=Clone(amtsysstate.AMT_GeneralSettings.response),c=document.querySelector("input[name=d20]:checked").value;b.PingResponseEnabled=0!=(c&1);b.RmcpPingResponseEnabled=0!=(c&2);amtstack.Put("AMT_GeneralSettings",b,PullSystemStatus,0,1)}
1199 -function showIPSetupDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_EthernetPortSettings.responses[0];QV(69,!0);QV(70,!0);QV("d21o0",!1);QV("d21l0",!1);QH("d21l1","Automatic configuration using DHCP server");QH("d21l2","Static configuration using IPv4 settings below");d21o1.checked=1==b.DHCPEnabled;d21o2.checked=!d21o1.checked;c28.value=isIpAddress(b.IPAddress,"");c29.value=isIpAddress(b.SubnetMask,"");c30.value=isIpAddress(b.DefaultGateway,
1200 -"");c31.value=isIpAddress(b.PrimaryDNS,"");c32.value=isIpAddress(b.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,"IPv4 Settings",3,showIPSetupDlgOk)}}function updateIPSetupDlg(){c28.disabled=c29.disabled=c30.disabled=c31.disabled=c32.disabled=!d21o2.checked}
1201 -function showIPSetupDlgOk(){var b=Clone(amtsysstate.AMT_EthernetPortSettings.responses[0]);b.DHCPEnabled=d21o1.checked;delete b.IPAddress;delete b.SubnetMask;delete b.DefaultGateway;delete b.PrimaryDNS;delete b.SecondaryDNS;0==d21o1.checked&&(b.IPAddress=c28.value,b.SubnetMask=c29.value,b.DefaultGateway=c30.value,""!=c31.value&&(b.PrimaryDNS=c31.value),""!=c32.value&&(b.SecondaryDNS=c32.value));amtstack.Put("AMT_EthernetPortSettings",
1203 +function showIPSetupDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_EthernetPortSettings.responses[0];QV(69,!0);QV(70,!0);QV("d21o0",!1);QV("d21l0",!1);QH("d21l1","Automatic configuration using DHCP server");QH("d21l2","Static configuration using IPv4 settings below");d21o1.checked=1==b.DHCPEnabled;d21o2.checked=!d21o1.checked;c30.value=isIpAddress(b.IPAddress,"");c31.value=isIpAddress(b.SubnetMask,"");c32.value=isIpAddress(b.DefaultGateway,
1204 +"");c33.value=isIpAddress(b.PrimaryDNS,"");c34.value=isIpAddress(b.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,"IPv4 Settings",3,showIPSetupDlgOk)}}function updateIPSetupDlg(){c30.disabled=c31.disabled=c32.disabled=c33.disabled=c34.disabled=!d21o2.checked}
1205 +function showIPSetupDlgOk(){var b=Clone(amtsysstate.AMT_EthernetPortSettings.responses[0]);b.DHCPEnabled=d21o1.checked;delete b.IPAddress;delete b.SubnetMask;delete b.DefaultGateway;delete b.PrimaryDNS;delete b.SecondaryDNS;0==d21o1.checked&&(b.IPAddress=c30.value,b.SubnetMask=c31.value,b.DefaultGateway=c32.value,""!=c33.value&&(b.PrimaryDNS=c33.value),""!=c34.value&&(b.SecondaryDNS=c34.value));amtstack.Put("AMT_EthernetPortSettings",
1206 b,showIPSetupDlgDone,0,1)}function showIPSetupDlgDone(b,c,a,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("IPv4 Settings","Unable to set network parameters, error "+d)}amtPowerBootCapabilities=null;function showPowerActionDlg(){xxdialogMode||(statusbox("Power Actions","Checking capabilities..."),amtstack.Get("AMT_BootCapabilities",powerActionResponse00,0,1))}
1207 function powerActionResponse00(b,c,a,d){200==d?(amtPowerBootCapabilities=a.Body,QH("d5actionSelect",""),addOption("d5actionSelect","Power up",2),addOption("d5actionSelect","Power cycle",5),addOption("d5actionSelect","Power down",8),addOption("d5actionSelect","Reset",10),1==amtPowerBootCapabilities.ForceDiagnosticBoot&&(addOption("d5actionSelect","Power on to diagnostic",300),addOption("d5actionSelect","Reset to diagnostic",301)),9<amtversion&&(addOption("d5actionSelect","Soft-off",12),addOption("d5actionSelect",
1208 "Soft-reset",14),addOption("d5actionSelect","Sleep",4),addOption("d5actionSelect","Hibernate",7)),1==amtPowerBootCapabilities.BIOSSetup&&(addOption("d5actionSelect","Power up to BIOS",100),addOption("d5actionSelect","Reset to BIOS",101)),1==amtPowerBootCapabilities.SecureErase&&(addOption("d5actionSelect","Power up to Secure Erase",104),addOption("d5actionSelect","Reset to Secure Erase",105)),addOption("d5actionSelect","Reset to IDE-R Floppy",200),addOption("d5actionSelect","Power on to IDE-R Floppy",
@@ -1207,10 +1211,10 @@ function powerActionDlgCheck(){var b=d5actionSelect.value;104==b||105==b?(b="Con
1211 function powerActionDlg(){var b=d5actionSelect.value;if(999==b)showAdvPowerDlg();else if(998==b)amtstack.Get("IPS_OptInService",powerActionResponse0,0,1);else{10>b&&2<b&&(3==desktop.State&&connectDesktop(),3==terminal.State&&connectTerminal(),void 0!=ider&&3==ider.state&&iderStop());statusbox("Power Action","Checking state...");null!=rsepass&&1===rsepass&&(rsepass=Q("rsepass").value);var c=!0;6>amtversion&&(c=!1);13==currentView&&8==b&&(c=!1);13!=currentView&&10>=b&&(c=!1);c?amtstack.Get("IPS_OptInService",
1212 powerActionResponse0,0,1):amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1)}}var AvdPowerDlg;
1213 function showAdvPowerDlg(){QV("d24dBiosPause",1==amtPowerBootCapabilities.BIOSPause);QV("d24dBiosSecureBoot",1==amtPowerBootCapabilities.BIOSSecureBoot);QV("d24dReflashBios",1==amtPowerBootCapabilities.BIOSReflash);QV("d24dBiosSetup",1==amtPowerBootCapabilities.BIOSSetup);QV("d24dForceProgressEvents",1==amtPowerBootCapabilities.ForcedProgressEvents);QV("d24dUseIDER",1==amtPowerBootCapabilities.IDER);QV("d24dLockKeyboard",1==amtPowerBootCapabilities.KeyboardLock);QV("d24dLockPowerButton",1==amtPowerBootCapabilities.PowerButtonLock);
1210 -QV("d24dLockResetButton",1==amtPowerBootCapabilities.ResetButtonLock);QV("d24dSerialOverLan",1==amtPowerBootCapabilities.SOL);QV("d24dSecureErase",1==amtPowerBootCapabilities.SecureErase);QV("d24dLockSleepButton",1==amtPowerBootCapabilities.SleepButtonLock);QV("d24dUserPasswordBypass",1==amtPowerBootCapabilities.UserPasswordBypass);QV("c42",1==amtPowerBootCapabilities.VerbosityQuiet);QV("c43",1==amtPowerBootCapabilities.VerbosityVerbose);QV("c44",1==amtPowerBootCapabilities.VerbosityScreenBlank);
1214 +QV("d24dLockResetButton",1==amtPowerBootCapabilities.ResetButtonLock);QV("d24dSerialOverLan",1==amtPowerBootCapabilities.SOL);QV("d24dSecureErase",1==amtPowerBootCapabilities.SecureErase);QV("d24dLockSleepButton",1==amtPowerBootCapabilities.SleepButtonLock);QV("d24dUserPasswordBypass",1==amtPowerBootCapabilities.UserPasswordBypass);QV("c44",1==amtPowerBootCapabilities.VerbosityQuiet);QV("c45",1==amtPowerBootCapabilities.VerbosityVerbose);QV("c46",1==amtPowerBootCapabilities.VerbosityScreenBlank);
1215 setDialogMode(24,"Custom Power Action",3,showAdvPowerDlgOk);showAdvPowerDlgChange()}
1212 -function showAdvPowerDlgChange(){QV("idd_d24IDERBootDevice",Q("d24UseIDER").checked);QV("idd_d24RSEPass",Q("d24SecureErase")?Q("d24SecureErase").checked:!1);var b="d24BiosPause d24BiosSecureBoot d24BiosSetup d24ForceProgressEvents d24LockPowerButton d24LockResetButton d24LockSleepButton d24LockKeyboard d24UserPasswordBypass d24ReflashBios d24SafeMode d24UseIDER d24SerialOverLan d24SecureErase".split(" ");if(0<c38.value)for(var c in b)Q(b[c]).checked=!1;for(c in b)QE(b[c],0==c38.value)}
1213 -function showAdvPowerDlgOk(){AvdPowerDlg={};AvdPowerDlg.Action=Q("c36").value;AvdPowerDlg.BIOSPause=Q("d24BiosPause").checked;AvdPowerDlg.BIOSSecureBoot=Q("d24BiosSecureBoot").checked;AvdPowerDlg.BIOSSetup=Q("d24BiosSetup").checked;AvdPowerDlg.BootMediaIndex=Q("c39").value;AvdPowerDlg.FirmwareVerbosity=Q("c41").value;AvdPowerDlg.ForcedProgressEvents=Q("d24ForceProgressEvents").checked;AvdPowerDlg.IDERBootDevice=Q("c40").value;AvdPowerDlg.LockKeyboard=
1216 +function showAdvPowerDlgChange(){QV("idd_d24IDERBootDevice",Q("d24UseIDER").checked);QV("idd_d24RSEPass",Q("d24SecureErase")?Q("d24SecureErase").checked:!1);var b="d24BiosPause d24BiosSecureBoot d24BiosSetup d24ForceProgressEvents d24LockPowerButton d24LockResetButton d24LockSleepButton d24LockKeyboard d24UserPasswordBypass d24ReflashBios d24SafeMode d24UseIDER d24SerialOverLan d24SecureErase".split(" ");if(0<c40.value)for(var c in b)Q(b[c]).checked=!1;for(c in b)QE(b[c],0==c40.value)}
1217 +function showAdvPowerDlgOk(){AvdPowerDlg={};AvdPowerDlg.Action=Q("c38").value;AvdPowerDlg.BIOSPause=Q("d24BiosPause").checked;AvdPowerDlg.BIOSSecureBoot=Q("d24BiosSecureBoot").checked;AvdPowerDlg.BIOSSetup=Q("d24BiosSetup").checked;AvdPowerDlg.BootMediaIndex=Q("c41").value;AvdPowerDlg.FirmwareVerbosity=Q("c43").value;AvdPowerDlg.ForcedProgressEvents=Q("d24ForceProgressEvents").checked;AvdPowerDlg.IDERBootDevice=Q("c42").value;AvdPowerDlg.LockKeyboard=
1218 Q("d24LockKeyboard").checked;AvdPowerDlg.LockPowerButton=Q("d24LockPowerButton").checked;AvdPowerDlg.LockResetButton=Q("d24LockResetButton").checked;AvdPowerDlg.LockSleepButton=Q("d24LockSleepButton").checked;AvdPowerDlg.ReflashBIOS=Q("d24ReflashBios").checked;AvdPowerDlg.UseIDER=Q("d24UseIDER").checked;AvdPowerDlg.UseSOL=Q("d24SerialOverLan").checked;AvdPowerDlg.UseSafeMode=Q("d24SafeMode").checked;AvdPowerDlg.UserPasswordBypass=Q("d24UserPasswordBypass").checked;AvdPowerDlg.SecureErase=Q("d24SecureErase").checked;
1219 !0===AvdPowerDlg.SecureErase&&0<Q("d24rsepass").value.length&&(AvdPowerDlg.RSEPassword=Q("d24rsepass").value);statusbox("Power Action","Checking state...");amtstack.Get("IPS_OptInService",powerActionResponse0,0,1)}
1220 function powerActionResponse0(b,c,a,d){200!=d?messagebox("Power Action","Error #"+d):4294967295==a.Body.OptInRequired&&3!=a.Body.OptInState&&4!=a.Body.OptInState?2==a.Body.OptInState?(d6ConsentText.value="",setDialogMode(6,"User Consent",11,powerActionSendConsent),checkConsentDisplay(),consentChanged()):(statusbox("Power Action","Starting opt-in..."),amtstack.IPS_OptInService_StartOptIn(powerActionResponseC1,0,1)):998==d5actionSelect.value?messagebox("User Consent","User consent not needed."):(statusbox("Power Action",
@@ -1222,17 +1226,17 @@ function powerActionResponse1(b,c,a,d){200!=d?messagebox("Power Action","Error #
1226 a.LockPowerButton=AvdPowerDlg.LockPowerButton,a.LockResetButton=AvdPowerDlg.LockResetButton,a.LockSleepButton=AvdPowerDlg.LockSleepButton,a.ReflashBIOS=AvdPowerDlg.ReflashBIOS,a.UseIDER=AvdPowerDlg.UseIDER,a.UseSOL=AvdPowerDlg.UseSOL,a.UseSafeMode=AvdPowerDlg.UseSafeMode,a.UserPasswordBypass=AvdPowerDlg.UserPasswordBypass,null!=a.SecureErase&&(a.SecureErase=AvdPowerDlg.SecureErase&&1==amtPowerBootCapabilities.SecureErase,1==a.SecureErase&&AvdPowerDlg.RSEPassword&&(a.RSEPassword=AvdPowerDlg.RSEPassword))):
1227 (a.BIOSPause=!1,a.EnforceSecureBoot=!1,a.BIOSSetup=99<b&&104>b,a.BootMediaIndex=0,a.FirmwareVerbosity=0,a.ForcedProgressEvents=!1,a.IDERBootDevice=202==b||203==b?1:0,a.LockKeyboard=!1,a.LockPowerButton=!1,a.LockResetButton=!1,a.LockSleepButton=!1,a.ReflashBIOS=!1,a.UseIDER=199<b&&300>b,a.UseSOL=13==currentView&&8!=b&&300>b,a.UseSafeMode=!1,a.UserPasswordBypass=!1,null!=a.SecureErase&&(a.SecureErase=(104==b||105==b)&&1==amtPowerBootCapabilities.SecureErase,!0===a.SecureErase&&0<rsepass.length&&(a.RSEPassword=
1228 rsepass)),rsepass=null),console.log("Boot Action: "+b),console.log("Setting Boot Settings: "+ObjectToString2(a)),statusbox("Power Action","Setting boot settings..."),amtstack.Put("AMT_BootSettingData",a,powerActionResponse2,a,1))}function powerActionResponse2(b,c,a,d,e){200!=d?(messagebox("Power Action","PUT AMT_BootSettingData, Error #"+d),console.log(e)):(statusbox("Power Action","Setting next boot..."),amtstack.SetBootConfigRole(1,powerActionResponse3x,0,1))}
1225 -function powerActionResponse3x(b,c,a,d){b=d5actionSelect.value;c=null;if(999==b)0<c38.value&&(c=["Force CD/DVD Boot","Force PXE Boot","Force Hard-drive Boot","Force Diagnostic Boot"][c38.value-1]);else{if(300==b||301==b)c="Force Diagnostic Boot";if(400==b||401==b)c="Force PXE Boot"}console.log("ChangeBootOrder: "+c);amtstack.CIM_BootConfigSetting_ChangeBootOrder(null==c?c:'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: '+
1229 +function powerActionResponse3x(b,c,a,d){b=d5actionSelect.value;c=null;if(999==b)0<c40.value&&(c=["Force CD/DVD Boot","Force PXE Boot","Force Hard-drive Boot","Force Diagnostic Boot"][c40.value-1]);else{if(300==b||301==b)c="Force Diagnostic Boot";if(400==b||401==b)c="Force PXE Boot"}console.log("ChangeBootOrder: "+c);amtstack.CIM_BootConfigSetting_ChangeBootOrder(null==c?c:'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: '+
1230 c+"</Selector></SelectorSet></ReferenceParameters>",powerActionResponse3)}var targetPowerAction=0;
1231 function powerActionResponse3(b,c,a,d){console.log("powerActionResponse3("+c+","+a+","+d+")");if(!errcheck(d,b)){statusbox("Power Action","Performing power action...");b=d5actionSelect.value;if(100==b||201==b||203==b||300==b||401==b)b=2;if(101==b||200==b||202==b||301==b||400==b)b=10;104==b&&(b=2);105==b&&(b=10);999==b&&(b=AvdPowerDlg.Action);targetPowerAction=b;11==b&&(b=10);999>b?(console.log("RequestPowerStateChange("+b+")"),amtstack.RequestPowerStateChange(b,powerActionResponse4)):messagebox("Power Action",
1228 -"Next boot action set.")}}function powerActionResponse4(b,c,a,d){200==d&&(QH(61,"Power action completed."),setDialogMode(1,"Power Action",0),setTimeout(function(){setDialogMode(0)},1300));amtstack.Get("CIM_AssociatedPowerManagementService",powerActionResponse5,0,1)}function powerActionResponse5(b,c,a,d){}function consentChanged(){QE("c46",6==d6ConsentText.value.length)}function changeConsentDisplay(){xxchangeConsentDisplay=!0;checkConsentDisplay()}
1232 +"Next boot action set.")}}function powerActionResponse4(b,c,a,d){200==d&&(QH(61,"Power action completed."),setDialogMode(1,"Power Action",0),setTimeout(function(){setDialogMode(0)},1300));amtstack.Get("CIM_AssociatedPowerManagementService",powerActionResponse5,0,1)}function powerActionResponse5(b,c,a,d){}function consentChanged(){QE("c48",6==d6ConsentText.value.length)}function changeConsentDisplay(){xxchangeConsentDisplay=!0;checkConsentDisplay()}
1233 function checkConsentDisplay(){amtstack.Get("IPS_SecIOService",checkConsentDisplayResponse1)}var xxchangeConsentDisplay=!1;
1234 function checkConsentDisplayResponse1(b,c,a,d){200==d&&(a.Body.DefaultScreen&&(a.Body.DefaultScreen=parseInt(a.Body.DefaultScreen)),a.Body.NumberOfScreens&&(a.Body.NumberOfScreens=parseInt(a.Body.NumberOfScreens)),1==xxchangeConsentDisplay?(xxchangeConsentDisplay=!1,a.Body.DefaultScreen=d6Display.value,amtstack.Put("IPS_SecIOService",a.Body,checkConsentDisplayResponse1)):(d6Display.value=a.Body.DefaultScreen,QV("d6ThirdDisplay",2<a.Body.NumberOfScreens)))}
1235 var xxStorage=null,xxStorageVendors=[],xxStorageApplications=[];function PullStorage(){amtFirstPull|=8;wsstack.comm.PerformAjax("",PullStorageResponse,null,0,"/amt-storage/","GET")}
1236 function PullStorageResponse(b,c,a){0==amtstack.PendingBatchOperations&&refreshButtons(!0);if(200==c){QV("go21",!0);for(c=0;32>c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(v){return}xxStorageVendors=[];xxStorageApplications=[];b=xxStorage.content;if(Array.isArray(b)){a={};for(c in b){var d=b[c].vendor?b[c].vendor:"";a[d]||(a[d]={});var e=b[c].app?b[c].app:"";a[d][e]||(a[d][e]={});b[c].name&&(a[d][e][b[c].name]=b[c])}xxStorage.content=
1233 -b=a}else{if(b["index.htm"]||b["logon.htm"])b[""]={"":{}};b["index.htm"]&&(b[""][""]["index.htm"]=b["index.htm"],delete b["index.htm"]);b["logon.htm"]&&(b[""][""]["logon.htm"]=b["logon.htm"],delete b["logon.htm"])}a=0;var d=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage Intel&reg; AMT storage for this computer.<br><br>",n,p,e="";for(c in b){var q=0,m;for(m in b[c]){q++;var g=0,w;for(w in b[c][m]){g++;if(c!=n||m!=p)""!=e&&(d+=e,e="<br>"),n=c,p=m,e=""!=c?e+EscapeHtml(c+" / "+m):e+
1237 +b=a}else{if(b["index.htm"]||b["logon.htm"])b[""]={"":{}};b["index.htm"]&&(b[""][""]["index.htm"]=b["index.htm"],delete b["index.htm"]);b["logon.htm"]&&(b[""][""]["logon.htm"]=b["logon.htm"],delete b["logon.htm"])}a=0;var d=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage Intel&reg; AMT storage for this computer.<br><br>",n,p,e="";for(c in b){var r=0,m;for(m in b[c]){r++;var g=0,w;for(w in b[c][m]){g++;if(c!=n||m!=p)""!=e&&(d+=e,e="<br>"),n=c,p=m,e=""!=c?e+EscapeHtml(c+" / "+m):e+
1238 "Root";var l='"'+c+(""!=c?"/":"")+m+(""!=m?"/":"")+w+'"',e=e+('<div class=itemBar onclick=showStorageDetails("'+c+'","'+m+'","'+w+'",'+l+")><div style=float:right>"),e=e+(" "+AddButton2("Download","DownloadFromStorage("+l+',"'+w+'",event)')),e=e+("</div><div style=padding-top:3px><b>"+EscapeHtml(w)+"</b>, <i>"+b[c][m][w].size+" bytes</i></div></div>");a++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(m)&&xxStorageApplications.push(m)}0==g&&(wsstack.comm.PerformAjax("",
1235 -function(){},null,0,"/amt-storage/"+c+"/"+m,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==q&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=e&&(d+=e);0==a&&(d+="<div style=padding-left:15px><br><i>No files found.</i></div><br>");d+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullStorage()")+AddButton("Upload...","UploadToStorage()"));QH(56,d)}else QH(56,"Unable to load storage data...<br/>"+
1239 +function(){},null,0,"/amt-storage/"+c+"/"+m,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==r&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=e&&(d+=e);0==a&&(d+="<div style=padding-left:15px><br><i>No files found.</i></div><br>");d+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullStorage()")+AddButton("Upload...","UploadToStorage()"));QH(56,d)}else QH(56,"Unable to load storage data...<br/>"+
1240 AddButton("Refresh","PullStorage()"))}function showStorageDetails(b,c,a,d){if(!xxdialogMode){var e="",n=xxStorage.content[b][c][a];""!=b&&(e+=addHtmlValue("Vendor",b));""!=c&&(e+=addHtmlValue("Application",c));e+=addHtmlValue("Name",a);e+=addHtmlValue("Size",n.size+" bytes");n.link&&(e+=addHtmlValue("Link",n.link));setDialogMode(11,"Storage Item",5,showStorageDetailsEx,e,d)}}
1241 function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")}function storageDeleteResponse(b,c){200!=c?messagebox("Storage","Unable to delete file (ERR"+c+"), check that the computer is powered on."):PullStorage()}function DownloadFromStorage(b,c,a){xxdialogMode||(haltEvent(a),wsstack.comm.PerformAjax("",DownloadFromStorageEx,c,0,"/amt-storage/"+b,"GET"))}
1242 function DownloadFromStorageEx(b,c,a){200!=c||null==b?console.log(c,"Data = null"):saveAs(data2blob(b),a)}function OpenFromStorage(b,c){if(!xxdialogMode){haltEvent(c);var a=window.open("http://"+wsstack.comm.host+":"+wsstack.comm.port+"/amt-storage/"+b,"_blank");a.opener=null;a.focus()}}function PushToStorage(b,c,a){var d=null;7E3<c.length&&(d=[b,c.substring(7E3)],c=c.substring(0,7E3));wsstack.comm.PerformAjax(c,PushToStorageResponse,d,0,"/amt-storage/"+b+(1==a?"?append=":""),"PUT")}
@@ -1253,7 +1257,7 @@ function prepareAlarmOccurenceTemplate(b,c,a,d,e){return'<d:AlarmTemplate xmlns:
1257 "</s:DeleteOnCompletion></d:AlarmTemplate>"}function RemoveAllAlarms(){setDialogMode(1,"Remove all wake alarms",3,RemoveAllAlarmsEx,"Confirm removal of all wake alarms?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,e,n){0==--b&&PullAlarms()})}
1258 function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=new Date(c.StartTime.Datetime);Q("d25alarm_name").value=c.ElementName;Q("d25alarm_sdate").value=a.getFullYear()+"-"+_fmttimepad(a.getMonth()+1)+"-"+_fmttimepad(a.getDate());Q("d25alarm_stime").value=a.getHours()+":"+_fmttimepad(a.getMinutes())+":"+_fmttimepad(a.getSeconds());if(c.Interval){var a=c.Interval.Interval.replace("P","").replace("T","").replace("D","D,").replace("H","H,").replace("M","M,").split(","),
1259 d=[0,0,0],e;for(e in a){var n=a[e].length-1;"D"==a[e][n]&&(d[0]=parseInt(a[e].substring(0,n)));"H"==a[e][n]&&(d[1]=parseInt(a[e].substring(0,n)));"M"==a[e][n]&&(d[2]=parseInt(a[e].substring(0,n)))}Q("d25alarm_interval").value=d.join("-")}else Q("d25alarm_interval").value="";Q("d25alarm_doc").value=1==c.DeleteOnCompletion?1:0}else c=new Date,c.setDate((new Date).getDate()+1),Q("d25alarm_name").value="",Q("d25alarm_sdate").value=c.getFullYear()+"-"+_fmttimepad(c.getMonth()+1)+"-"+_fmttimepad(c.getDate()),
1256 -Q("d25alarm_stime").value=c.getHours()+":"+_fmttimepad(c.getMinutes())+":00",Q("d25alarm_interval").value="",Q("d25alarm_doc").value=0;setDialogMode(25,"Add new alarm",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0<Q("d25alarm_name").value.length&&3==Q("d25alarm_sdate").value.split("-").length&&3==Q("d25alarm_stime").value.split(":").length&&(1==b||3==b);QE("c46",b)}
1260 +Q("d25alarm_stime").value=c.getHours()+":"+_fmttimepad(c.getMinutes())+":00",Q("d25alarm_interval").value="",Q("d25alarm_doc").value=0;setDialogMode(25,"Add new alarm",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0<Q("d25alarm_name").value.length&&3==Q("d25alarm_sdate").value.split("-").length&&3==Q("d25alarm_stime").value.split(":").length&&(1==b||3==b);QE("c48",b)}
1261 function showAddAlarmOk(b,c){if(2==b)showAlertDetailsDelete(b,c);else{var a=Q("d25alarm_name").value,d=Q("d25alarm_sdate").value.split("-"),e=Q("d25alarm_stime").value.split(":"),d=new Date(d[0],d[1]-1,d[2],e[0],e[1],e[2],0),d=_fmttimepad(d.getUTCFullYear())+"-"+_fmttimepad(d.getUTCMonth()+1)+"-"+_fmttimepad(d.getUTCDate())+"T"+_fmttimepad(d.getUTCHours())+":"+_fmttimepad(d.getUTCMinutes())+":"+_fmttimepad(d.getUTCSeconds())+"Z",e=Q("d25alarm_interval").value.split("-");3!=e.length&&(e=[0,0,0]);var e=
1262 "P"+e[0]+"DT"+e[1]+"H"+e[2]+"M",n=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,e,n);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Add alarm","Failed to add alarm. Status: "+d+".<br/>Verify the alarm is for a future time."):0!=c.Body.ReturnValue?messagebox("Add alarm","Failed to add alarm, "+c.Body.ReturnValueStr+".<br/>Verify the alarm is for a future time."):PullAlarms()}):(a=Clone(xxAlarms[c]),
1263 a.StartTime='<p:Datetime xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+d+"</p:Datetime>",a.Interval='<p:Interval xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+e+"</p:Interval>",a.DeleteOnCompletion=n,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Edit alarm","Failed to change alarm. Status: "+d+".<br/>Verify the alarm for at a future time."):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}}
@@ -1269,7 +1273,7 @@ function script_setBuildBlocks(b){script_BuildingBlocks=b;var c="";if(b)for(var
1273 function script_faddblock(b){var c=Clone(script_BuildingBlocks[b]);c.id=Math.random();c.xname=b;script_BlockScript.push(c);script_BlockScriptSelectedId=script_BlockScript.length-1;fupdatescript()}function script_feditblock(b){xxdialogMode||setDialogMode(11,"Edit "+script_BuildingBlocks[b].name,3,script_feditblockEx,"Edit this block? This operation will reset the block editor and load the block code into the code editor.",b)}
1274 function script_feditblockEx(b,c){script_newScriptDlgOk();scriptViewButton(0);var a,d=script_BuildingBlocks[c];a=""+("##!BLOCK!##\r\n#id="+c+"\r\n#name="+d.name+"\r\n#desc="+d.desc+"\r\n##!BLOCK!##\r\n");for(var e in d.vars){var n=d.vars[e];a+="##!VAR!##\r\n#id="+e+"\r\n#name="+n.name+"\r\n#desc="+n.desc+"\r\n#type="+n.type+"\r\n";n.maxlength&&(a+="#maxlength="+n.maxlength+"\r\n");if(n.values)for(var p in n.values)a+="#values-"+p+"="+n.values[p]+"\r\n";a+="#value="+n.value+"\r\n##SWAP %%%"+e+"%%% "+
1275 n.value+"\r\n"}a+="##!VAR!##\r\n##SWAP %%%~%%% 0\r\n\r\n##!BLOCK!##\r\n"+d.code+"\r\n##!BLOCK!##\r\n";Q("scriptarea").value=a}
1272 -function script_fConvertScriptToJsonBlock(b){var c={};b=b.split("##!BLOCK!##\n");var a=b[1].split("\n"),d;for(d in a){var e=a[d].split("=");2==e.length&&(c[e[0].substring(1)]=e[1])}c.vars={};scriptvariables=b[2].split("##!VAR!##\n");for(d in scriptvariables){var a=scriptvariables[d].split("\n"),n={},p={},q=0,m;for(m in a)e=a[m].split("="),2==e.length&&e[1]&&e[0]&&0<e[0].length&&("#values-"==e[0].substring(0,8)?(p[e[0].substring(8)]=e[1],q++):n[e[0].substring(1)]=e[1]);n.id&&(0<q&&(n.values=p),a=n.id,
1276 +function script_fConvertScriptToJsonBlock(b){var c={};b=b.split("##!BLOCK!##\n");var a=b[1].split("\n"),d;for(d in a){var e=a[d].split("=");2==e.length&&(c[e[0].substring(1)]=e[1])}c.vars={};scriptvariables=b[2].split("##!VAR!##\n");for(d in scriptvariables){var a=scriptvariables[d].split("\n"),n={},p={},r=0,m;for(m in a)e=a[m].split("="),2==e.length&&e[1]&&e[0]&&0<e[0].length&&("#values-"==e[0].substring(0,8)?(p[e[0].substring(8)]=e[1],r++):n[e[0].substring(1)]=e[1]);n.id&&(0<r&&(n.values=p),a=n.id,
1277 delete n.id,c.vars[a]=n)}c.code=b[3];a=c.id;delete c.id;d={};d[a]=c;return JSON.stringify(d,null," ")}function script_fonfilterchanged(){var b=Q("blockfilter").value.toLowerCase(),c;for(c in script_BuildingBlocks)95!=c.charCodeAt(0)&&QV("sblock_"+c,0<=script_BuildingBlocks[c].name.toLowerCase().indexOf(b)||0<=script_BuildingBlocks[c].desc.toLowerCase().indexOf(b))}var script_fonclickDblClickDetectIndex=null,script_fonclickDblClickDetectTime=null;
1278 function script_fonclick(b,c){if(!xxdialogMode){script_BlockScriptSelectedId=null;c&&(c=fgetParentWithId(c),c.id.startsWith("xblock_")&&(script_BlockScriptSelectedId=c.id.substring(7)));fupdatescript();haltEvent(b);if(script_fonclickDblClickDetectIndex==script_BlockScriptSelectedId&&250>(new Date).getTime()-script_fonclickDblClickDetectTime)return script_foneditclick(script_BlockScriptSelectedId);script_fonclickDblClickDetectIndex=script_BlockScriptSelectedId;script_fonclickDblClickDetectTime=(new Date).getTime()}}
1279 function script_fondragstart(b,c){xxdialogMode||(c=fgetParentWithId(c),c.style.opacity="0.4",b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("scriptbuilder/block",c.id))}function script_fondragend(b,c){xxdialogMode||(c=fgetParentWithId(c),c.style.opacity="1.0")}function script_fondragenter(b,c){xxdialogMode||(fgetParentWithId(c).style["border-top"]="solid 2px black")}
@@ -1277,7 +1281,7 @@ function script_fondragleave(b,c){if(!xxdialogMode){b=b.originalEvent||b;var a=d
1281 function script_fondrop(b,c){if(!xxdialogMode){c=fgetParentWithId(c);var a,d=b.dataTransfer.getData("scriptbuilder/block"),e=parseInt(c.id.substring(7));""==d?documentFileSelectHandler(b):(d.startsWith("sblock_")?(a=Clone(script_BuildingBlocks[d.substring(7)]),a.id=Math.random(),a.xname=d.substring(7)):(d=parseInt(d.substring(7)),a=script_BlockScript[d],script_BlockScript.splice(d,1),e>d&&e--),"scriptblocks"==c.id?(a&&script_BlockScript.push(a),script_BlockScriptSelectedId=script_BlockScript.length-
1282 1):(script_BlockScript.splice(e,0,a),script_BlockScriptSelectedId=e),fupdatescript(),haltEvent(b))}}
1283 function script_foneditclick(b){if(!xxdialogMode){var c=script_BlockScript[b];script_BlockScriptSelectedId=b;fupdatescript();if(null!=c){var a=c.vars?7:5,d=c.desc+"<br><br>";if(c.vars)for(var e in c.vars){var n=c.vars[e].value,p="";c.vars[e].maxlength&&(p+=" maxlength="+c.vars[e].maxlength);2==c.vars[e].type&&(p+=" onkeypress='return numbersOnly(event)'");if(1==c.vars[e].type||2==c.vars[e].type)n="<input title='"+c.vars[e].desc+"' id=scriptXvalue_"+e+" value='"+c.vars[e].value+"' "+p+" style=width:100%></input>";
1280 -if(3==c.vars[e].type){var n="<select title='"+c.vars[e].desc+"' id=scriptXvalue_"+e+" style=width:100%;padding:0;margin:0>",q;for(q in c.vars[e].values)n+="<option value="+q+(q==c.vars[e].value?" selected":"")+">"+c.vars[e].values[q]+"</option>";n+="</select>"}4==c.vars[e].type&&(n="<input type=password autocomplete=off title='"+c.vars[e].desc+"' id=scriptXvalue_"+e+" value='"+c.vars[e].value+"' "+p+" style=width:100%></input>");5==c.vars[e].type&&(n="");6==c.vars[e].type&&(n="<input type=file title='"+
1284 +if(3==c.vars[e].type){var n="<select title='"+c.vars[e].desc+"' id=scriptXvalue_"+e+" style=width:100%;padding:0;margin:0>",r;for(r in c.vars[e].values)n+="<option value="+r+(r==c.vars[e].value?" selected":"")+">"+c.vars[e].values[r]+"</option>";n+="</select>"}4==c.vars[e].type&&(n="<input type=password autocomplete=off title='"+c.vars[e].desc+"' id=scriptXvalue_"+e+" value='"+c.vars[e].value+"' "+p+" style=width:100%></input>");5==c.vars[e].type&&(n="");6==c.vars[e].type&&(n="<input type=file title='"+
1285 c.vars[e].desc+"' id=scriptXvalue_"+e+" "+p+" style=width:100%></input>");d+='<table style=width:100% title="'+c.vars[e].desc+'"><td style=width:120px>'+c.vars[e].name+"<td><b>"+n+"</b></table>";if(5==c.vars[e].type){var d=d+("<ul id=scriptXvalue_"+e+' style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0">'),m;for(m in c.vars[e].values)n="",0<=c.vars[e].value.indexOf(m)&&(n=" checked"),d+="<li><label><input type=checkbox id=scriptXvaluex_"+
1286 e+"-"+m+""+n+">"+c.vars[e].values[m]+"</label></li>";d+="</ul>"}}}setDialogMode(11,c.name,a,script_foneditclickEx,d,b)}}
1287 function script_foneditclickEx(b,c){if(!xxdialogMode){if(2==b)script_BlockScript.splice(c,1),script_BlockScriptSelectedId==c&&(script_BlockScriptSelectedId=null);else{var a=script_BlockScript[c];if(a.vars)for(var d in a.vars)if(5==a.vars[d].type){a.vars[d].value=[];for(var e in a.vars[d].values)Q("scriptXvaluex_"+d+"-"+e).checked&&a.vars[d].value.push(e)}else if(6==a.vars[d].type){var n=Q("scriptXvalue_"+d);if(1==n.files.length){var p=new FileReader;p.onload=function(b){a.vars[d].value=btoa(b.target.result);
@@ -1296,7 +1300,7 @@ function editscript_updateScriptState(b){var c="";if(b&&null!=b){var a=[],d;for(
1300 50)+"...");QH("EditScriptStatus",c)}function script_toString(b){return"object"==typeof b?JSON.stringify(b):b}
1301 function script_saveScript(b){xxdialogMode||scriptstate||(b&&1==b.shiftKey?(setDialogMode(11,"Script Block",1,null,"<br><textarea id=scriptSaveScriptJsonBlock style=width:100%;height:200px;resize:vertical />"),QH("scriptSaveScriptJsonBlock",script_fConvertScriptToJsonBlock(Q("scriptarea").value))):setDialogMode(11,"Save Script",3,script_saveScriptOk,"<br><input id=scriptsavename style=width:100% value=test.mescript >"))}
1302 function script_saveScriptOk(){if(!xxdialogMode){var b=JSON.stringify({scriptText:Q("scriptarea").value,mescript:btoa(script_compile(Q("scriptarea").value)),blocks:script_StartingBuildingBlocks,scriptBlocks:script_BlockScript},null," ");saveAs(data2blob(b),Q("scriptsavename").value)}}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag;
1299 -function setDialogMode(b,c,a,d,e,n){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=n;QE("c46",!0);QV("c46",a&1);QV("c45",a&2);QV(59,a&2);QV("c47",a&4);c&&QH(60,c);for(c=1;26>c;c++)QV("dialog"+c,c==b);QV("dialog",b);e&&(11==b?QH(64,e):QH(61,e));0!=xxdialogMode&&iderToggleDiskMap(!1)}
1303 +function setDialogMode(b,c,a,d,e,n){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=n;QE("c48",!0);QV("c48",a&1);QV("c47",a&2);QV(59,a&2);QV("c49",a&4);c&&QH(60,c);for(c=1;26>c;c++)QV("dialog"+c,c==b);QV("dialog",b);e&&(11==b?QH(64,e):QH(61,e));0!=xxdialogMode&&iderToggleDiskMap(!1)}
1304 function dialogclose(b){var c=xxdialogFunc,a=xxdialogButtons,d=xxdialogTag;setDialogMode();(a&8||b)&&c&&c(b,d)}
1305 function center(){QS("dialog").left=(getDocWidth()-400)/2+"px";var b=0,c=Q(8).offsetHeight-(0==fullscreen?126:53);""==QS(11).display&&(b+=32);""==QS(9).display&&(b+=32);QS(16).height=Q(8).offsetHeight-b-(0==fullscreen?16:0)+"px";QS("Desk")["max-height"]=c-b+"px";QS("Desk")["max-width"]=Q(8).offsetWidth-(0==fullscreen?32:0)+"px";0!=Q(43).offsetWidth&&(QS("Desk")["max-width"]=Q(43).offsetWidth);
1306 fullscreen?(QS(16)["overflow-y"]="hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(16)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(61,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(61,c);setDialogMode(1,b)}
webserver.js
+4 -2
@@ -57,6 +57,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
57 obj.express = require('express');
58 obj.meshAgentHandler = require('./meshagent.js');
59 obj.meshRelayHandler = require('./meshrelay.js');
60 + obj.meshIderHandler = require('./amt-ider.js');
61 obj.meshUserHandler = require('./meshuser.js');
62 obj.interceptor = require('./interceptor');
63 const constants = (obj.crypto.constants ? obj.crypto.constants : require('constants')); // require('constants') is deprecated in Node 11.10, use require('crypto').constants instead.
@@ -1963,7 +1964,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1964 // When data is received from the web socket, forward the data into the associated TCP connection.
1965 ws.on('message', function (msg) {
1966 if (obj.parent.debugLevel >= 1) { // DEBUG
1966 - Debug(1, 'TCP relay data to ' + node.host + ', ' + msg.length + ' bytes');
1967 + Debug(2, 'TCP relay data to ' + node.host + ', ' + msg.length + ' bytes');
1968 if (obj.parent.debugLevel >= 4) { Debug(4, ' ' + msg.toString('hex')); }
1969 }
1970 msg = msg.toString('binary');
@@ -2013,7 +2014,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
2014 // When we receive data on the TCP connection, forward it back into the web socket connection.
2015 ws.forwardclient.on('data', function (data) {
2016 if (obj.parent.debugLevel >= 1) { // DEBUG
2016 - Debug(1, 'TCP relay data from ' + node.host + ', ' + data.length + ' bytes.');
2017 + Debug(2, 'TCP relay data from ' + node.host + ', ' + data.length + ' bytes.');
2018 if (obj.parent.debugLevel >= 4) { Debug(4, ' ' + Buffer.from(data, 'binary').toString('hex')); }
2019 }
2020 if (ws.interceptor) { data = ws.interceptor.processAmtData(data); } // Run data thru interceptor
@@ -2631,6 +2632,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
2632 obj.app.ws(url + 'meshrelay.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, true, function (ws1, req1, domain, user, cookie) { obj.meshRelayHandler.CreateMeshRelay(obj, ws1, req1, domain, user, cookie); }); });
2633 obj.app.get(url + 'webrelay.ashx', function (req, res) { res.send('Websocket connection expected'); });
2634 obj.app.ws(url + 'webrelay.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, false, handleRelayWebSocket); });
2635 + obj.app.ws(url + 'webider.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, false, function (ws1, req1, domain, user, cookie) { obj.meshIderHandler.CreateAmtIderSession(obj, obj.db, ws1, req1, obj.args, domain, user); }); });
2636 obj.app.ws(url + 'control.ashx', function (ws, req) { PerformWSSessionAuth(ws, req, false, function (ws1, req1, domain, user, cookie) { obj.meshUserHandler.CreateMeshUser(obj, obj.db, ws1, req1, obj.args, domain, user); }); });
2637 obj.app.get(url + 'logo.png', handleLogoRequest);
2638 obj.app.get(url + 'welcome.jpg', handleWelcomeImageRequest);