web-launch-kit 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ko.md +294 -0
- package/README.md +63 -17
- package/dist/index.d.ts +0 -57
- package/dist/launch-kit.cjs +1295 -304
- package/dist/launch-kit.cjs.map +1 -1
- package/dist/launch-kit.min.cjs +1 -1
- package/dist/launch-kit.min.cjs.map +1 -1
- package/dist/launch-kit.min.mjs +1 -1
- package/dist/launch-kit.min.mjs.map +1 -1
- package/dist/launch-kit.mjs +1295 -304
- package/dist/launch-kit.mjs.map +1 -1
- package/dist/launch-kit.umd.js +1295 -304
- package/dist/launch-kit.umd.js.map +1 -1
- package/dist/launch-kit.umd.min.js +1 -1
- package/dist/launch-kit.umd.min.js.map +1 -1
- package/dist/utils/get-global.d.ts +37 -0
- package/dist/utils/get-id.d.ts +0 -12
- package/package.json +8 -4
- package/dist/utils/event-listener-utils.d.ts +0 -8
package/dist/launch-kit.mjs
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
var version$
|
|
2
|
-
var packageJSON$
|
|
3
|
-
version: version$
|
|
1
|
+
var version$3 = "0.0.4";
|
|
2
|
+
var packageJSON$3 = {
|
|
3
|
+
version: version$3};
|
|
4
4
|
|
|
5
|
-
var version = "0.0.
|
|
6
|
-
var packageJSON = {
|
|
7
|
-
version: version};
|
|
5
|
+
var version$2 = "0.0.5";
|
|
6
|
+
var packageJSON$2 = {
|
|
7
|
+
version: version$2};
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
function getGlobal$3() {
|
|
10
|
+
if (typeof globalThis !== 'undefined')
|
|
11
|
+
return globalThis;
|
|
12
|
+
if (typeof self !== 'undefined')
|
|
13
|
+
return self;
|
|
14
|
+
if (typeof window !== 'undefined')
|
|
15
|
+
return window;
|
|
16
|
+
if (typeof global !== 'undefined')
|
|
17
|
+
return global;
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
var GLOBAL$5 = getGlobal$3();
|
|
21
|
+
var NAVIGATOR$1 = GLOBAL$5.navigator;
|
|
22
|
+
var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.userAgent === 'string' ? NAVIGATOR$1.userAgent : '';
|
|
23
|
+
var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null ? NAVIGATOR$1.userAgentData : undefined;
|
|
12
24
|
var OS_RESOLVER_MAP = [
|
|
13
|
-
[/windows nt (6\.[23]); arm/i, 'windows',
|
|
14
|
-
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows'
|
|
15
|
-
[/
|
|
25
|
+
[/windows nt (6\.[23]); arm/i, 'windows', 'RT'],
|
|
26
|
+
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows'],
|
|
27
|
+
[/win 9x 4\.90/i, 'windows', 'ME'],
|
|
28
|
+
[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, 'windows'],
|
|
16
29
|
[/windows nt ?([\d.)]*)(?!.+xbox)/i, 'windows', resolveWindowsVersion],
|
|
17
30
|
[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i, 'windows', resolveWindowsVersion],
|
|
18
|
-
[/windows ce\/?([\d.]*)/i, 'windows'
|
|
31
|
+
[/windows ce\/?([\d.]*)/i, 'windows'],
|
|
19
32
|
[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i, 'ios', resolveUnderscoreVersion],
|
|
20
33
|
[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i, 'ios', resolveUnderscoreVersion],
|
|
21
34
|
[/cfnetwork\/.+darwin/i, 'ios', resolveUnderscoreVersion],
|
|
@@ -44,13 +57,14 @@ var BROWSER_RESOLVER_MAP = [
|
|
|
44
57
|
[/samsungbrowser\/([\w.]+)/i, 'samsung'],
|
|
45
58
|
[/headlesschrome(?:\/([\w.]+)| )/i, 'chrome'],
|
|
46
59
|
[/wv\).+chrome\/([\w.]+).+edgw\//i, 'edge'],
|
|
47
|
-
[/ wv\).+
|
|
60
|
+
[/ wv\).+chrome\/([\w.]+)/i, 'chrome'],
|
|
48
61
|
[/chrome\/([\w.]+) mobile/i, 'chrome'],
|
|
49
62
|
[/chrome\/v?([\w.]+)/i, 'chrome'],
|
|
50
63
|
[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
|
|
51
64
|
[/iphone .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
|
|
52
65
|
[/version\/([\w.,]+) .*safari/i, 'safari'],
|
|
53
66
|
[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i, 'safari', '1'],
|
|
67
|
+
[/(?:iphone|ipad|ipod).+applewebkit(?!.*safari)/i, 'safari'],
|
|
54
68
|
[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i, 'firefox'],
|
|
55
69
|
[/mobile vr; rv:([\w.]+)\).+firefox/i, 'firefox'],
|
|
56
70
|
[/firefox\/([\w.]+)/i, 'firefox'],
|
|
@@ -67,6 +81,18 @@ var ENGINE_RESOLVER_MAP = [
|
|
|
67
81
|
[/tasman[\/ ]\(?([\w.]+)/i, 'tasman'],
|
|
68
82
|
[/rv:([\w.]{1,9})\b.+gecko/i, 'gecko']
|
|
69
83
|
];
|
|
84
|
+
var IN_APP_BROWSER_RESOLVER_MAP = [
|
|
85
|
+
[/kakaotalk/i, 'kakaotalk'],
|
|
86
|
+
[/\bline\/[\d.]/i, 'line'],
|
|
87
|
+
[/instagram/i, 'instagram'],
|
|
88
|
+
[/\bfban\/|\bfbav\/|fb_iab/i, 'facebook'],
|
|
89
|
+
[/naver\(inapp/i, 'naver'],
|
|
90
|
+
[/daumapps/i, 'daum'],
|
|
91
|
+
[/\bband\/[\d.]/i, 'band'],
|
|
92
|
+
[/micromessenger/i, 'wechat'],
|
|
93
|
+
[/twitter for|twitterandroid/i, 'twitter'],
|
|
94
|
+
[/musical_ly|bytedancewebview|\btiktok/i, 'tiktok'],
|
|
95
|
+
];
|
|
70
96
|
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
71
97
|
'Google Chrome': 'Chrome',
|
|
72
98
|
'Microsoft Edge': 'Edge',
|
|
@@ -89,19 +115,18 @@ function resolveWindowsVersion(string) {
|
|
|
89
115
|
return '';
|
|
90
116
|
var mapped = {
|
|
91
117
|
'4.90': 'ME',
|
|
92
|
-
'
|
|
93
|
-
'
|
|
94
|
-
'
|
|
95
|
-
'
|
|
96
|
-
'
|
|
97
|
-
'
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
'
|
|
101
|
-
'
|
|
102
|
-
'
|
|
103
|
-
|
|
104
|
-
}[string];
|
|
118
|
+
'3.51': 'NT 3.51',
|
|
119
|
+
'4.0': 'NT 4.0',
|
|
120
|
+
'5.0': '2000',
|
|
121
|
+
'5.1': 'XP',
|
|
122
|
+
'5.2': 'XP',
|
|
123
|
+
'6.0': 'Vista',
|
|
124
|
+
'6.1': '7',
|
|
125
|
+
'6.2': '8',
|
|
126
|
+
'6.3': '8.1',
|
|
127
|
+
'6.4': '10',
|
|
128
|
+
'10.0': '10'
|
|
129
|
+
}[string.replace(/[^\d.]/g, '')];
|
|
105
130
|
if (typeof mapped !== 'undefined')
|
|
106
131
|
return mapped;
|
|
107
132
|
return string;
|
|
@@ -120,6 +145,28 @@ function resolveVersion(string, resolver) {
|
|
|
120
145
|
return '';
|
|
121
146
|
return string;
|
|
122
147
|
}
|
|
148
|
+
function compareVersion(lhs, rhs) {
|
|
149
|
+
var pa = lhs.split('.');
|
|
150
|
+
var pb = rhs.split('.');
|
|
151
|
+
var length = Math.max(pa.length, pb.length);
|
|
152
|
+
for (var i = 0; i < length; i++) {
|
|
153
|
+
var a = void 0;
|
|
154
|
+
var b = void 0;
|
|
155
|
+
if (i < pa.length)
|
|
156
|
+
a = parseInt(pa[i], 10);
|
|
157
|
+
else
|
|
158
|
+
a = 0;
|
|
159
|
+
if (i < pb.length)
|
|
160
|
+
b = parseInt(pb[i], 10);
|
|
161
|
+
else
|
|
162
|
+
b = 0;
|
|
163
|
+
if (a > b)
|
|
164
|
+
return 1;
|
|
165
|
+
if (a < b)
|
|
166
|
+
return -1;
|
|
167
|
+
}
|
|
168
|
+
return 0;
|
|
169
|
+
}
|
|
123
170
|
function parseOS() {
|
|
124
171
|
var name = 'unknown';
|
|
125
172
|
var version = '';
|
|
@@ -132,7 +179,7 @@ function parseOS() {
|
|
|
132
179
|
break;
|
|
133
180
|
}
|
|
134
181
|
}
|
|
135
|
-
if (name === 'ios' &&
|
|
182
|
+
if (name === 'ios' && compareVersion(version, '18.6') === 0) {
|
|
136
183
|
var execs = /\) Version\/([\d.]+)/.exec(currentUserAgent);
|
|
137
184
|
if (execs !== null) {
|
|
138
185
|
var major = parseInt(execs[1].split('.')[0], 10);
|
|
@@ -145,7 +192,7 @@ function parseOS() {
|
|
|
145
192
|
name = parsedFromHighEntropyValuesOSName;
|
|
146
193
|
if (typeof parsedFromHighEntropyValuesOSVersion !== 'undefined')
|
|
147
194
|
version = parsedFromHighEntropyValuesOSVersion;
|
|
148
|
-
if (name === 'macos' && typeof
|
|
195
|
+
if (name === 'macos' && typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.standalone !== 'undefined' && typeof NAVIGATOR$1.maxTouchPoints === 'number' && NAVIGATOR$1.maxTouchPoints > 2)
|
|
149
196
|
name = 'ios';
|
|
150
197
|
}
|
|
151
198
|
return {
|
|
@@ -197,6 +244,39 @@ function parseEngine() {
|
|
|
197
244
|
version: version
|
|
198
245
|
};
|
|
199
246
|
}
|
|
247
|
+
function parseInAppBrowser() {
|
|
248
|
+
for (var i = 0; i < IN_APP_BROWSER_RESOLVER_MAP.length; i++) {
|
|
249
|
+
if (IN_APP_BROWSER_RESOLVER_MAP[i][0].test(currentUserAgent))
|
|
250
|
+
return IN_APP_BROWSER_RESOLVER_MAP[i][1];
|
|
251
|
+
}
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
function parseWebview() {
|
|
255
|
+
if (/; ?wv\)/i.test(currentUserAgent))
|
|
256
|
+
return true;
|
|
257
|
+
if (/\bversion\/[\d.]+ chrome\//i.test(currentUserAgent))
|
|
258
|
+
return true;
|
|
259
|
+
if (/\belectron\//i.test(currentUserAgent))
|
|
260
|
+
return true;
|
|
261
|
+
if (/(?:iphone|ipad|ipod)/i.test(currentUserAgent) && /applewebkit/i.test(currentUserAgent) && /safari/i.test(currentUserAgent) === false)
|
|
262
|
+
return true;
|
|
263
|
+
return parseInAppBrowser() !== null;
|
|
264
|
+
}
|
|
265
|
+
function parseDevice() {
|
|
266
|
+
if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
|
|
267
|
+
return parsedFromHighEntropyValuesDevice;
|
|
268
|
+
var osName = getParsedCache().os.name;
|
|
269
|
+
if (osName === 'ios') {
|
|
270
|
+
if (/ipad/i.test(currentUserAgent) || /macintosh/i.test(currentUserAgent))
|
|
271
|
+
return 'tablet';
|
|
272
|
+
return 'mobile';
|
|
273
|
+
}
|
|
274
|
+
if (osName === 'android')
|
|
275
|
+
return /\bmobile\b/i.test(currentUserAgent) ? 'mobile' : 'tablet';
|
|
276
|
+
if (osName === 'windows' || osName === 'macos')
|
|
277
|
+
return 'desktop';
|
|
278
|
+
return 'unknown';
|
|
279
|
+
}
|
|
200
280
|
function getParsedCache() {
|
|
201
281
|
if (parsedCache !== null && parsedCache.userAgent === currentUserAgent)
|
|
202
282
|
return parsedCache;
|
|
@@ -224,11 +304,31 @@ function normalizeBrand(entry) {
|
|
|
224
304
|
return { brand: entry, version: '' };
|
|
225
305
|
return { brand: entry.brand, version: entry.version };
|
|
226
306
|
}
|
|
307
|
+
function resolvedThenable() {
|
|
308
|
+
if (typeof Promise === 'function')
|
|
309
|
+
return Promise.resolve();
|
|
310
|
+
var thenable = {
|
|
311
|
+
then: function (onFulfilled) {
|
|
312
|
+
if (typeof onFulfilled === 'function')
|
|
313
|
+
onFulfilled(undefined);
|
|
314
|
+
return thenable;
|
|
315
|
+
},
|
|
316
|
+
catch: function () {
|
|
317
|
+
return thenable;
|
|
318
|
+
},
|
|
319
|
+
finally: function (onFinally) {
|
|
320
|
+
if (typeof onFinally === 'function')
|
|
321
|
+
onFinally();
|
|
322
|
+
return thenable;
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
return thenable;
|
|
326
|
+
}
|
|
227
327
|
function parseFromHighEntropyValues() {
|
|
228
328
|
if (typeof USER_AGENT_DATA === 'undefined' || typeof USER_AGENT_DATA.getHighEntropyValues === 'undefined')
|
|
229
|
-
return
|
|
329
|
+
return resolvedThenable();
|
|
230
330
|
return USER_AGENT_DATA
|
|
231
|
-
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', '
|
|
331
|
+
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'platform', 'platformVersion', 'formFactors'])
|
|
232
332
|
.then(function (result) {
|
|
233
333
|
try {
|
|
234
334
|
var brands = result.fullVersionList || result.brands || [];
|
|
@@ -281,12 +381,26 @@ function parseFromHighEntropyValues() {
|
|
|
281
381
|
else if (/macos|macintel/i.test(platform))
|
|
282
382
|
parsedFromHighEntropyValuesOSName = 'macos';
|
|
283
383
|
}
|
|
284
|
-
|
|
384
|
+
var formFactors = result.formFactors;
|
|
385
|
+
if (typeof formFactors !== 'undefined' && formFactors !== null && typeof formFactors.length === 'number') {
|
|
386
|
+
for (var i = 0; i < formFactors.length; i++) {
|
|
387
|
+
var formFactor = String(formFactors[i]).toLowerCase();
|
|
388
|
+
if (formFactor === 'tablet')
|
|
389
|
+
parsedFromHighEntropyValuesDevice = 'tablet';
|
|
390
|
+
else if (formFactor === 'mobile')
|
|
391
|
+
parsedFromHighEntropyValuesDevice = 'mobile';
|
|
392
|
+
else if (formFactor === 'desktop')
|
|
393
|
+
parsedFromHighEntropyValuesDevice = 'desktop';
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (parsedFromHighEntropyValuesDevice === null && result.mobile === true)
|
|
285
397
|
parsedFromHighEntropyValuesDevice = 'mobile';
|
|
286
|
-
parsedCache = null;
|
|
287
398
|
}
|
|
288
399
|
catch (_) {
|
|
289
400
|
}
|
|
401
|
+
finally {
|
|
402
|
+
parsedCache = null;
|
|
403
|
+
}
|
|
290
404
|
})
|
|
291
405
|
.catch(function () {
|
|
292
406
|
parsedCache = null;
|
|
@@ -294,15 +408,29 @@ function parseFromHighEntropyValues() {
|
|
|
294
408
|
}
|
|
295
409
|
ready = parseFromHighEntropyValues();
|
|
296
410
|
var PlatformKit = {
|
|
297
|
-
version: packageJSON.version,
|
|
411
|
+
version: packageJSON$2.version,
|
|
298
412
|
get ready() {
|
|
299
413
|
return ready;
|
|
300
414
|
},
|
|
415
|
+
whenReady: function (callback) {
|
|
416
|
+
if (typeof callback !== 'function')
|
|
417
|
+
return;
|
|
418
|
+
ready.then(function () {
|
|
419
|
+
callback();
|
|
420
|
+
});
|
|
421
|
+
},
|
|
301
422
|
set userAgent(userAgent) {
|
|
302
423
|
if (currentUserAgent === userAgent)
|
|
303
424
|
return;
|
|
304
425
|
currentUserAgent = userAgent;
|
|
305
426
|
invalidateCache();
|
|
427
|
+
ready = userAgent === USER_AGENT ? parseFromHighEntropyValues() : resolvedThenable();
|
|
428
|
+
},
|
|
429
|
+
reset: function () {
|
|
430
|
+
if (currentUserAgent === USER_AGENT)
|
|
431
|
+
return;
|
|
432
|
+
currentUserAgent = USER_AGENT;
|
|
433
|
+
invalidateCache();
|
|
306
434
|
ready = parseFromHighEntropyValues();
|
|
307
435
|
},
|
|
308
436
|
get userAgent() {
|
|
@@ -318,56 +446,799 @@ var PlatformKit = {
|
|
|
318
446
|
return getParsedCache().engine;
|
|
319
447
|
},
|
|
320
448
|
get device() {
|
|
321
|
-
|
|
322
|
-
return parsedFromHighEntropyValuesDevice;
|
|
323
|
-
var osName = getParsedCache().os.name;
|
|
324
|
-
if (osName === 'ios' || osName === 'android')
|
|
325
|
-
return 'mobile';
|
|
326
|
-
if (osName === 'windows' || osName === 'macos')
|
|
327
|
-
return 'desktop';
|
|
328
|
-
return 'unknown';
|
|
449
|
+
return parseDevice();
|
|
329
450
|
},
|
|
330
451
|
get webview() {
|
|
331
|
-
return
|
|
452
|
+
return parseWebview();
|
|
453
|
+
},
|
|
454
|
+
get inAppBrowser() {
|
|
455
|
+
return parseInAppBrowser();
|
|
332
456
|
},
|
|
333
457
|
get node() {
|
|
334
|
-
|
|
458
|
+
var nodeProcess = GLOBAL$5.process;
|
|
459
|
+
return typeof nodeProcess !== 'undefined' && nodeProcess !== null && typeof nodeProcess.versions !== 'undefined' && nodeProcess.versions !== null && typeof nodeProcess.versions.node !== 'undefined';
|
|
335
460
|
},
|
|
336
461
|
get standalone() {
|
|
337
462
|
var osName = getParsedCache().os.name;
|
|
338
463
|
if (osName === 'ios')
|
|
339
|
-
return
|
|
340
|
-
if (typeof
|
|
464
|
+
return typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && NAVIGATOR$1.standalone === true;
|
|
465
|
+
if (typeof GLOBAL$5.matchMedia !== 'function')
|
|
341
466
|
return false;
|
|
342
|
-
|
|
467
|
+
try {
|
|
468
|
+
return GLOBAL$5.matchMedia('(display-mode: standalone)').matches === true;
|
|
469
|
+
}
|
|
470
|
+
catch (_) {
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
343
473
|
},
|
|
344
474
|
compareVersion: function (lhs, rhs) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
475
|
+
return compareVersion(lhs, rhs);
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
function getGlobal$2() {
|
|
480
|
+
if (typeof globalThis !== 'undefined')
|
|
481
|
+
return globalThis;
|
|
482
|
+
if (typeof self !== 'undefined')
|
|
483
|
+
return self;
|
|
484
|
+
if (typeof window !== 'undefined')
|
|
485
|
+
return window;
|
|
486
|
+
if (typeof global !== 'undefined')
|
|
487
|
+
return global;
|
|
488
|
+
return {};
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
var version$1 = "0.0.1";
|
|
492
|
+
var packageJSON$1 = {
|
|
493
|
+
version: version$1};
|
|
494
|
+
|
|
495
|
+
var GLOBAL$3 = getGlobal$2();
|
|
496
|
+
var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
|
|
497
|
+
// https://cordova.apache.org/docs/en/latest/cordova/events/events.html
|
|
498
|
+
var CORDOVA_DOCUMENT_EVENTS = ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'];
|
|
499
|
+
// iOS `<video>` fullscreen events have no `on` attribute but are valid on any element exposing `webkitEnterFullscreen` — they must pass through untouched.
|
|
500
|
+
var IOS_VIDEO_FULLSCREEN_EVENTS = ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'];
|
|
501
|
+
var TYPE_ALIAS_MAP = {
|
|
502
|
+
'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
|
|
503
|
+
'fullscreenchange': ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange', 'msfullscreenchange'],
|
|
504
|
+
'fullscreenerror': ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError', 'msfullscreenerror'],
|
|
505
|
+
'pointerdown': ['pointerdown', 'MSPointerDown'],
|
|
506
|
+
'pointermove': ['pointermove', 'MSPointerMove'],
|
|
507
|
+
'pointerup': ['pointerup', 'MSPointerUp'],
|
|
508
|
+
'pointercancel': ['pointercancel', 'MSPointerCancel'],
|
|
509
|
+
'pointerover': ['pointerover', 'MSPointerOver'],
|
|
510
|
+
'pointerout': ['pointerout', 'MSPointerOut'],
|
|
511
|
+
'pointerenter': ['pointerenter', 'MSPointerEnter', 'mouseenter'],
|
|
512
|
+
'pointerleave': ['pointerleave', 'MSPointerLeave', 'mouseleave'],
|
|
513
|
+
'gotpointercapture': ['gotpointercapture', 'MSGotPointerCapture'],
|
|
514
|
+
'lostpointercapture': ['lostpointercapture', 'MSLostPointerCapture'],
|
|
515
|
+
'pointerlockchange': ['pointerlockchange', 'webkitpointerlockchange', 'mozpointerlockchange', 'mspointerlockchange'],
|
|
516
|
+
'pointerlockerror': ['pointerlockerror', 'webkitpointerlockerror', 'mozpointerlockerror', 'mspointerlockerror'],
|
|
517
|
+
'touchstart': ['touchstart', 'pointerdown', 'MSPointerDown'],
|
|
518
|
+
'touchmove': ['touchmove', 'pointermove', 'MSPointerMove'],
|
|
519
|
+
'touchend': ['touchend', 'pointerup', 'MSPointerUp'],
|
|
520
|
+
'touchcancel': ['touchcancel', 'pointercancel', 'MSPointerCancel'],
|
|
521
|
+
'transitionrun': ['transitionrun', 'webkitTransitionRun'],
|
|
522
|
+
'transitionstart': ['transitionstart', 'webkitTransitionStart'],
|
|
523
|
+
'transitionend': ['transitionend', 'webkitTransitionEnd', 'oTransitionEnd', 'otransitionend', 'MSTransitionEnd'],
|
|
524
|
+
'animationstart': ['animationstart', 'webkitAnimationStart', 'oanimationstart', 'MSAnimationStart'],
|
|
525
|
+
'animationiteration': ['animationiteration', 'webkitAnimationIteration', 'oanimationiteration', 'MSAnimationIteration'],
|
|
526
|
+
'animationend': ['animationend', 'webkitAnimationEnd', 'oanimationend', 'MSAnimationEnd'],
|
|
527
|
+
'visibilitychange': ['visibilitychange', 'webkitvisibilitychange', 'mozvisibilitychange', 'msvisibilitychange'],
|
|
528
|
+
};
|
|
529
|
+
var FULLSCREEN_REQUEST_MAP = {
|
|
530
|
+
'': ['requestFullscreen'],
|
|
531
|
+
'webkit': ['webkitRequestFullscreen', 'webkitRequestFullScreen'],
|
|
532
|
+
'moz': ['mozRequestFullScreen', 'mozRequestFullscreen'],
|
|
533
|
+
'ms': ['msRequestFullscreen'],
|
|
534
|
+
'MS': ['msRequestFullscreen'],
|
|
535
|
+
};
|
|
536
|
+
function asRecord(value) {
|
|
537
|
+
return value;
|
|
538
|
+
}
|
|
539
|
+
function hasOnProperty(host, name) {
|
|
540
|
+
if (typeof host === 'undefined' || host === null)
|
|
541
|
+
return false;
|
|
542
|
+
if (typeof asRecord(host)['on' + name] !== 'undefined')
|
|
543
|
+
return true;
|
|
544
|
+
var lower = name.toLowerCase();
|
|
545
|
+
return lower !== name && typeof asRecord(host)['on' + lower] !== 'undefined';
|
|
546
|
+
}
|
|
547
|
+
function probeHosts(target) {
|
|
548
|
+
var hosts = [target];
|
|
549
|
+
if (typeof GLOBAL$3.document !== 'undefined' && target !== GLOBAL$3.document)
|
|
550
|
+
hosts.push(GLOBAL$3.document);
|
|
551
|
+
if (target !== GLOBAL$3)
|
|
552
|
+
hosts.push(GLOBAL$3);
|
|
553
|
+
return hosts;
|
|
554
|
+
}
|
|
555
|
+
function extractVendorPrefix(name) {
|
|
556
|
+
for (var i = 1; i < VENDORS.length; i++) {
|
|
557
|
+
if (name.indexOf(VENDORS[i]) === 0)
|
|
558
|
+
return VENDORS[i];
|
|
559
|
+
}
|
|
560
|
+
return '';
|
|
561
|
+
}
|
|
562
|
+
function testStyleSupport(name, styleProperty) {
|
|
563
|
+
if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
|
|
564
|
+
return false;
|
|
565
|
+
var style = GLOBAL$3.document.documentElement.style;
|
|
566
|
+
if (typeof style === 'undefined' || style === null)
|
|
567
|
+
return false;
|
|
568
|
+
var prefix = extractVendorPrefix(name);
|
|
569
|
+
var property;
|
|
570
|
+
if (prefix === '')
|
|
571
|
+
property = styleProperty;
|
|
572
|
+
else
|
|
573
|
+
property = prefix + styleProperty.charAt(0).toUpperCase() + styleProperty.slice(1);
|
|
574
|
+
return typeof asRecord(style)[property] !== 'undefined';
|
|
575
|
+
}
|
|
576
|
+
function testFullscreenSupport(name) {
|
|
577
|
+
if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
|
|
578
|
+
return false;
|
|
579
|
+
var element = GLOBAL$3.document.documentElement;
|
|
580
|
+
var methods = FULLSCREEN_REQUEST_MAP[extractVendorPrefix(name)];
|
|
581
|
+
if (typeof methods === 'undefined')
|
|
582
|
+
return false;
|
|
583
|
+
for (var i = 0; i < methods.length; i++) {
|
|
584
|
+
if (typeof asRecord(element)[methods[i]] === 'function')
|
|
585
|
+
return true;
|
|
586
|
+
}
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
function isEventTypeSupported(target, name) {
|
|
590
|
+
var hosts = probeHosts(target);
|
|
591
|
+
for (var i = 0; i < hosts.length; i++) {
|
|
592
|
+
if (hasOnProperty(hosts[i], name))
|
|
593
|
+
return true;
|
|
594
|
+
}
|
|
595
|
+
var lower = name.toLowerCase();
|
|
596
|
+
if (lower.indexOf('transition') > -1)
|
|
597
|
+
return testStyleSupport(name, 'transition');
|
|
598
|
+
if (lower.indexOf('animation') > -1)
|
|
599
|
+
return testStyleSupport(name, 'animation');
|
|
600
|
+
if (lower.indexOf('fullscreen') > -1)
|
|
601
|
+
return testFullscreenSupport(name);
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
function resolveEventType(target, type) {
|
|
605
|
+
if (target === GLOBAL$3.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
|
|
606
|
+
return type;
|
|
607
|
+
if (typeof asRecord(target)['webkitEnterFullscreen'] === 'function' && IOS_VIDEO_FULLSCREEN_EVENTS.indexOf(type) > -1)
|
|
608
|
+
return type;
|
|
609
|
+
var candidates = typeof TYPE_ALIAS_MAP[type] !== 'undefined' ? TYPE_ALIAS_MAP[type] : [type];
|
|
610
|
+
for (var i = 0; i < candidates.length; i++) {
|
|
611
|
+
if (isEventTypeSupported(target, candidates[i]))
|
|
612
|
+
return candidates[i];
|
|
613
|
+
}
|
|
614
|
+
var hosts = probeHosts(target);
|
|
615
|
+
for (var i = 1; i < VENDORS.length; i++) {
|
|
616
|
+
for (var j = 0; j < candidates.length; j++) {
|
|
617
|
+
var name_1 = VENDORS[i] + candidates[j];
|
|
618
|
+
for (var k = 0; k < hosts.length; k++) {
|
|
619
|
+
if (hasOnProperty(hosts[k], name_1))
|
|
620
|
+
return name_1;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
return type;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
var GLOBAL$2 = getGlobal$2();
|
|
628
|
+
var SUPPORTED = {
|
|
629
|
+
once: false,
|
|
630
|
+
passive: false,
|
|
631
|
+
capture: false,
|
|
632
|
+
some: false,
|
|
633
|
+
all: false,
|
|
634
|
+
};
|
|
635
|
+
var NOOP$1 = function () {
|
|
636
|
+
};
|
|
637
|
+
function resolveProbeTarget() {
|
|
638
|
+
if (typeof GLOBAL$2.document !== 'undefined' && typeof GLOBAL$2.document.createDocumentFragment === 'function') {
|
|
639
|
+
try {
|
|
640
|
+
return GLOBAL$2.document.createDocumentFragment();
|
|
641
|
+
}
|
|
642
|
+
catch (_) {
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if (typeof GLOBAL$2.EventTarget === 'function') {
|
|
646
|
+
try {
|
|
647
|
+
return new GLOBAL$2.EventTarget();
|
|
648
|
+
}
|
|
649
|
+
catch (_) {
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return undefined;
|
|
653
|
+
}
|
|
654
|
+
(function detectSupportedListenerOptions() {
|
|
655
|
+
var probe = resolveProbeTarget();
|
|
656
|
+
if (typeof probe === 'undefined' || typeof probe.addEventListener !== 'function')
|
|
657
|
+
return;
|
|
658
|
+
var options = {};
|
|
659
|
+
try {
|
|
660
|
+
Object.defineProperty(options, 'once', {
|
|
661
|
+
get: function () {
|
|
662
|
+
SUPPORTED.once = true;
|
|
663
|
+
return false;
|
|
664
|
+
},
|
|
665
|
+
});
|
|
666
|
+
Object.defineProperty(options, 'passive', {
|
|
667
|
+
get: function () {
|
|
668
|
+
SUPPORTED.passive = true;
|
|
669
|
+
return false;
|
|
670
|
+
},
|
|
671
|
+
});
|
|
672
|
+
Object.defineProperty(options, 'capture', {
|
|
673
|
+
get: function () {
|
|
674
|
+
SUPPORTED.capture = true;
|
|
675
|
+
return false;
|
|
676
|
+
},
|
|
677
|
+
});
|
|
678
|
+
probe.addEventListener('test', NOOP$1, options);
|
|
679
|
+
probe.removeEventListener('test', NOOP$1, options);
|
|
680
|
+
}
|
|
681
|
+
catch (_) {
|
|
682
|
+
}
|
|
683
|
+
SUPPORTED.some = SUPPORTED.once || SUPPORTED.passive || SUPPORTED.capture;
|
|
684
|
+
SUPPORTED.all = SUPPORTED.once && SUPPORTED.passive && SUPPORTED.capture;
|
|
685
|
+
})();
|
|
686
|
+
var SUPPORTED_LISTENER_OPTIONS = SUPPORTED;
|
|
687
|
+
function normalizeListenerOptions(options) {
|
|
688
|
+
if (typeof options === 'boolean')
|
|
689
|
+
return { capture: options, once: false, passive: false, signal: undefined };
|
|
690
|
+
if (typeof options === 'object' && options !== null) {
|
|
691
|
+
return {
|
|
692
|
+
capture: options.capture === true,
|
|
693
|
+
once: options.once === true,
|
|
694
|
+
passive: options.passive === true,
|
|
695
|
+
signal: options.signal,
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
return {
|
|
699
|
+
capture: Boolean(options),
|
|
700
|
+
once: false,
|
|
701
|
+
passive: false,
|
|
702
|
+
signal: undefined
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function toNativeListenerOptions(normalized) {
|
|
706
|
+
if (SUPPORTED.passive)
|
|
707
|
+
return {
|
|
708
|
+
capture: normalized.capture,
|
|
709
|
+
passive: normalized.passive
|
|
710
|
+
};
|
|
711
|
+
if (SUPPORTED.capture)
|
|
712
|
+
return {
|
|
713
|
+
capture: normalized.capture
|
|
714
|
+
};
|
|
715
|
+
return normalized.capture;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
var GLOBAL$1$1 = getGlobal$2();
|
|
719
|
+
var TOUCH_TYPES = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
|
|
720
|
+
var POINTER_PHASE_MAP = {
|
|
721
|
+
'pointerdown': 'start',
|
|
722
|
+
'MSPointerDown': 'start',
|
|
723
|
+
'pointermove': 'move',
|
|
724
|
+
'MSPointerMove': 'move',
|
|
725
|
+
'pointerup': 'end',
|
|
726
|
+
'MSPointerUp': 'end',
|
|
727
|
+
'pointercancel': 'cancel',
|
|
728
|
+
'MSPointerCancel': 'cancel',
|
|
729
|
+
};
|
|
730
|
+
var ACTIVE_TOUCHES = [];
|
|
731
|
+
function isTouchEventType(type) {
|
|
732
|
+
return TOUCH_TYPES.indexOf(type) > -1;
|
|
733
|
+
}
|
|
734
|
+
function isPointerEventType(type) {
|
|
735
|
+
return typeof POINTER_PHASE_MAP[type] !== 'undefined';
|
|
736
|
+
}
|
|
737
|
+
function createTouchList(touches) {
|
|
738
|
+
var list = touches.slice();
|
|
739
|
+
list.item = function (index) {
|
|
740
|
+
if (index >= 0 && index < list.length)
|
|
741
|
+
return list[index];
|
|
742
|
+
return null;
|
|
743
|
+
};
|
|
744
|
+
return list;
|
|
745
|
+
}
|
|
746
|
+
function findTouchIndex(identifier) {
|
|
747
|
+
for (var i = 0; i < ACTIVE_TOUCHES.length; i++) {
|
|
748
|
+
if (ACTIVE_TOUCHES[i].identifier === identifier)
|
|
749
|
+
return i;
|
|
750
|
+
}
|
|
751
|
+
return -1;
|
|
752
|
+
}
|
|
753
|
+
function scrollOffsetX() {
|
|
754
|
+
if (typeof GLOBAL$1$1.pageXOffset === 'number')
|
|
755
|
+
return GLOBAL$1$1.pageXOffset;
|
|
756
|
+
if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
|
|
757
|
+
return GLOBAL$1$1.document.documentElement.scrollLeft;
|
|
758
|
+
return 0;
|
|
759
|
+
}
|
|
760
|
+
function scrollOffsetY() {
|
|
761
|
+
if (typeof GLOBAL$1$1.pageYOffset === 'number')
|
|
762
|
+
return GLOBAL$1$1.pageYOffset;
|
|
763
|
+
if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
|
|
764
|
+
return GLOBAL$1$1.document.documentElement.scrollTop;
|
|
765
|
+
return 0;
|
|
766
|
+
}
|
|
767
|
+
function createSyntheticTouch(event, target) {
|
|
768
|
+
var clientX = typeof event.clientX === 'number' ? event.clientX : 0;
|
|
769
|
+
var clientY = typeof event.clientY === 'number' ? event.clientY : 0;
|
|
770
|
+
return {
|
|
771
|
+
identifier: typeof event.pointerId === 'number' ? event.pointerId : 0,
|
|
772
|
+
target: target,
|
|
773
|
+
screenX: typeof event.screenX === 'number' ? event.screenX : 0,
|
|
774
|
+
screenY: typeof event.screenY === 'number' ? event.screenY : 0,
|
|
775
|
+
clientX: clientX,
|
|
776
|
+
clientY: clientY,
|
|
777
|
+
pageX: typeof event.pageX === 'number' ? event.pageX : clientX + scrollOffsetX(),
|
|
778
|
+
pageY: typeof event.pageY === 'number' ? event.pageY : clientY + scrollOffsetY(),
|
|
779
|
+
radiusX: typeof event.width === 'number' ? event.width / 2 : 0,
|
|
780
|
+
radiusY: typeof event.height === 'number' ? event.height / 2 : 0,
|
|
781
|
+
rotationAngle: typeof event.rotation === 'number' ? event.rotation : 0,
|
|
782
|
+
force: typeof event.pressure === 'number' ? event.pressure : 0,
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
function defineTouchList(event, property, list, patches) {
|
|
786
|
+
var holder = event;
|
|
787
|
+
var had = false;
|
|
788
|
+
try {
|
|
789
|
+
had = Object.prototype.hasOwnProperty.call(event, property);
|
|
790
|
+
}
|
|
791
|
+
catch (_) {
|
|
792
|
+
}
|
|
793
|
+
patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
|
|
794
|
+
try {
|
|
795
|
+
Object.defineProperty(event, property, { value: list, configurable: true });
|
|
796
|
+
}
|
|
797
|
+
catch (_) {
|
|
798
|
+
holder[property] = list;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
function filterByTarget(touches, target) {
|
|
802
|
+
var filtered = [];
|
|
803
|
+
for (var i = 0; i < touches.length; i++) {
|
|
804
|
+
if (touches[i].target === target)
|
|
805
|
+
filtered.push(touches[i]);
|
|
806
|
+
}
|
|
807
|
+
return filtered;
|
|
808
|
+
}
|
|
809
|
+
function synthesizeTouchEvent(event, resolvedType, patches) {
|
|
810
|
+
var phase = POINTER_PHASE_MAP[resolvedType];
|
|
811
|
+
if (typeof phase === 'undefined')
|
|
812
|
+
return;
|
|
813
|
+
var pointerEvent = event;
|
|
814
|
+
var eventTarget = event.target;
|
|
815
|
+
var index = findTouchIndex(typeof pointerEvent.pointerId === 'number' ? pointerEvent.pointerId : 0);
|
|
816
|
+
var originTarget = index > -1 ? ACTIVE_TOUCHES[index].target : eventTarget;
|
|
817
|
+
var touch = createSyntheticTouch(pointerEvent, originTarget);
|
|
818
|
+
if (phase === 'start' || phase === 'move') {
|
|
819
|
+
if (index > -1)
|
|
820
|
+
ACTIVE_TOUCHES[index] = touch;
|
|
821
|
+
else
|
|
822
|
+
ACTIVE_TOUCHES.push(touch);
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
if (index > -1)
|
|
826
|
+
ACTIVE_TOUCHES.splice(index, 1);
|
|
827
|
+
}
|
|
828
|
+
defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES), patches);
|
|
829
|
+
defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)), patches);
|
|
830
|
+
defineTouchList(event, 'changedTouches', createTouchList([touch]), patches);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
var KEY_CODE_MAP = {
|
|
834
|
+
8: 'Backspace',
|
|
835
|
+
9: 'Tab',
|
|
836
|
+
12: 'Numpad5',
|
|
837
|
+
13: 'Enter',
|
|
838
|
+
16: 'ShiftLeft',
|
|
839
|
+
17: 'ControlLeft',
|
|
840
|
+
18: 'AltLeft',
|
|
841
|
+
19: 'Pause',
|
|
842
|
+
20: 'CapsLock',
|
|
843
|
+
27: 'Escape',
|
|
844
|
+
32: 'Space',
|
|
845
|
+
33: 'PageUp',
|
|
846
|
+
34: 'PageDown',
|
|
847
|
+
35: 'End',
|
|
848
|
+
36: 'Home',
|
|
849
|
+
37: 'ArrowLeft',
|
|
850
|
+
38: 'ArrowUp',
|
|
851
|
+
39: 'ArrowRight',
|
|
852
|
+
40: 'ArrowDown',
|
|
853
|
+
45: 'Insert',
|
|
854
|
+
46: 'Delete',
|
|
855
|
+
48: 'Digit0',
|
|
856
|
+
49: 'Digit1',
|
|
857
|
+
50: 'Digit2',
|
|
858
|
+
51: 'Digit3',
|
|
859
|
+
52: 'Digit4',
|
|
860
|
+
53: 'Digit5',
|
|
861
|
+
54: 'Digit6',
|
|
862
|
+
55: 'Digit7',
|
|
863
|
+
56: 'Digit8',
|
|
864
|
+
57: 'Digit9',
|
|
865
|
+
65: 'KeyA',
|
|
866
|
+
66: 'KeyB',
|
|
867
|
+
67: 'KeyC',
|
|
868
|
+
68: 'KeyD',
|
|
869
|
+
69: 'KeyE',
|
|
870
|
+
70: 'KeyF',
|
|
871
|
+
71: 'KeyG',
|
|
872
|
+
72: 'KeyH',
|
|
873
|
+
73: 'KeyI',
|
|
874
|
+
74: 'KeyJ',
|
|
875
|
+
75: 'KeyK',
|
|
876
|
+
76: 'KeyL',
|
|
877
|
+
77: 'KeyM',
|
|
878
|
+
78: 'KeyN',
|
|
879
|
+
79: 'KeyO',
|
|
880
|
+
80: 'KeyP',
|
|
881
|
+
81: 'KeyQ',
|
|
882
|
+
82: 'KeyR',
|
|
883
|
+
83: 'KeyS',
|
|
884
|
+
84: 'KeyT',
|
|
885
|
+
85: 'KeyU',
|
|
886
|
+
86: 'KeyV',
|
|
887
|
+
87: 'KeyW',
|
|
888
|
+
88: 'KeyX',
|
|
889
|
+
89: 'KeyY',
|
|
890
|
+
90: 'KeyZ',
|
|
891
|
+
91: 'MetaLeft',
|
|
892
|
+
92: 'MetaRight',
|
|
893
|
+
93: 'ContextMenu',
|
|
894
|
+
96: 'Numpad0',
|
|
895
|
+
97: 'Numpad1',
|
|
896
|
+
98: 'Numpad2',
|
|
897
|
+
99: 'Numpad3',
|
|
898
|
+
100: 'Numpad4',
|
|
899
|
+
101: 'Numpad5',
|
|
900
|
+
102: 'Numpad6',
|
|
901
|
+
103: 'Numpad7',
|
|
902
|
+
104: 'Numpad8',
|
|
903
|
+
105: 'Numpad9',
|
|
904
|
+
106: 'NumpadMultiply',
|
|
905
|
+
107: 'NumpadAdd',
|
|
906
|
+
109: 'NumpadSubtract',
|
|
907
|
+
110: 'NumpadDecimal',
|
|
908
|
+
111: 'NumpadDivide',
|
|
909
|
+
112: 'F1',
|
|
910
|
+
113: 'F2',
|
|
911
|
+
114: 'F3',
|
|
912
|
+
115: 'F4',
|
|
913
|
+
116: 'F5',
|
|
914
|
+
117: 'F6',
|
|
915
|
+
118: 'F7',
|
|
916
|
+
119: 'F8',
|
|
917
|
+
120: 'F9',
|
|
918
|
+
121: 'F10',
|
|
919
|
+
122: 'F11',
|
|
920
|
+
123: 'F12',
|
|
921
|
+
144: 'NumLock',
|
|
922
|
+
145: 'ScrollLock',
|
|
923
|
+
186: 'Semicolon',
|
|
924
|
+
187: 'Equal',
|
|
925
|
+
188: 'Comma',
|
|
926
|
+
189: 'Minus',
|
|
927
|
+
190: 'Period',
|
|
928
|
+
191: 'Slash',
|
|
929
|
+
192: 'Backquote',
|
|
930
|
+
219: 'BracketLeft',
|
|
931
|
+
220: 'Backslash',
|
|
932
|
+
221: 'BracketRight',
|
|
933
|
+
222: 'Quote',
|
|
934
|
+
226: 'IntlBackslash',
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
var GLOBAL$4 = getGlobal$2();
|
|
938
|
+
var LISTENER_STORE = [];
|
|
939
|
+
var NOOP = function () {
|
|
940
|
+
};
|
|
941
|
+
// Records live on the target itself, so they are collected with it and lookups only scan
|
|
942
|
+
// that target's own listeners. Targets that reject the expando fall back to LISTENER_STORE.
|
|
943
|
+
var STORE_KEY = '__webEventKitListeners__';
|
|
944
|
+
function resolveBucket(target, create) {
|
|
945
|
+
var holder = target;
|
|
946
|
+
try {
|
|
947
|
+
var existing = holder[STORE_KEY];
|
|
948
|
+
if (typeof existing !== 'undefined' && existing !== null)
|
|
949
|
+
return existing;
|
|
950
|
+
if (!create)
|
|
951
|
+
return LISTENER_STORE;
|
|
952
|
+
var bucket = [];
|
|
953
|
+
try {
|
|
954
|
+
Object.defineProperty(target, STORE_KEY, { value: bucket, configurable: true, enumerable: false, writable: true });
|
|
955
|
+
}
|
|
956
|
+
catch (_) {
|
|
957
|
+
holder[STORE_KEY] = bucket;
|
|
958
|
+
}
|
|
959
|
+
if (holder[STORE_KEY] !== bucket)
|
|
960
|
+
return LISTENER_STORE;
|
|
961
|
+
return bucket;
|
|
962
|
+
}
|
|
963
|
+
catch (_) {
|
|
964
|
+
return LISTENER_STORE;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
function findListenerRecord(target, type, callback, capture) {
|
|
968
|
+
var bucket = resolveBucket(target, false);
|
|
969
|
+
for (var i = 0; i < bucket.length; i++) {
|
|
970
|
+
var record = bucket[i];
|
|
971
|
+
if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
|
|
972
|
+
return record;
|
|
973
|
+
}
|
|
974
|
+
return undefined;
|
|
975
|
+
}
|
|
976
|
+
function removeListenerRecord(record) {
|
|
977
|
+
var bucket = record.bucket;
|
|
978
|
+
for (var i = 0; i < bucket.length; i++) {
|
|
979
|
+
if (bucket[i] === record) {
|
|
980
|
+
bucket.splice(i, 1);
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
function preventDefaultPolyfill() {
|
|
986
|
+
this.returnValue = false;
|
|
987
|
+
}
|
|
988
|
+
function stopPropagationPolyfill() {
|
|
989
|
+
this.cancelBubble = true;
|
|
990
|
+
}
|
|
991
|
+
function passivePreventDefault() {
|
|
992
|
+
// Per spec, preventDefault() inside a passive listener does nothing.
|
|
993
|
+
}
|
|
994
|
+
function invokeCallback(callback, target, event) {
|
|
995
|
+
if (typeof callback === 'function')
|
|
996
|
+
return callback.call(target, event);
|
|
997
|
+
if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
|
|
998
|
+
return callback.handleEvent(event);
|
|
999
|
+
}
|
|
1000
|
+
// The same Event object is handed to every listener, so any property this kit overrides has
|
|
1001
|
+
// to be put back before the next one runs — otherwise a `pointerdown` listener would observe
|
|
1002
|
+
// the `touchstart` type and synthetic touches written by a listener registered before it.
|
|
1003
|
+
function patchEventProperty(event, property, value, patches) {
|
|
1004
|
+
var holder = event;
|
|
1005
|
+
var had = false;
|
|
1006
|
+
try {
|
|
1007
|
+
had = Object.prototype.hasOwnProperty.call(event, property);
|
|
1008
|
+
}
|
|
1009
|
+
catch (_) {
|
|
1010
|
+
}
|
|
1011
|
+
patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
|
|
1012
|
+
defineEventProperty(event, property, value);
|
|
1013
|
+
}
|
|
1014
|
+
function restoreEventProperties(event, patches) {
|
|
1015
|
+
var holder = event;
|
|
1016
|
+
for (var i = patches.length - 1; i >= 0; i--) {
|
|
1017
|
+
var patch = patches[i];
|
|
1018
|
+
try {
|
|
1019
|
+
if (patch.had)
|
|
1020
|
+
defineEventProperty(event, patch.property, patch.previous);
|
|
357
1021
|
else
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
if (a < b)
|
|
362
|
-
return -1;
|
|
1022
|
+
delete holder[patch.property];
|
|
1023
|
+
}
|
|
1024
|
+
catch (_) {
|
|
363
1025
|
}
|
|
364
|
-
return 0;
|
|
365
1026
|
}
|
|
1027
|
+
patches.length = 0;
|
|
1028
|
+
}
|
|
1029
|
+
function defineEventProperty(event, property, value) {
|
|
1030
|
+
try {
|
|
1031
|
+
Object.defineProperty(event, property, { value: value, configurable: true });
|
|
1032
|
+
}
|
|
1033
|
+
catch (_) {
|
|
1034
|
+
try {
|
|
1035
|
+
event[property] = value;
|
|
1036
|
+
}
|
|
1037
|
+
catch (__) {
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
function fixLegacyEvent(event, target) {
|
|
1042
|
+
if (typeof event.currentTarget === 'undefined' || event.currentTarget === null)
|
|
1043
|
+
defineEventProperty(event, 'currentTarget', target);
|
|
1044
|
+
if ((typeof event.target === 'undefined' || event.target === null) && typeof event.srcElement !== 'undefined')
|
|
1045
|
+
defineEventProperty(event, 'target', event.srcElement);
|
|
1046
|
+
if (typeof event.preventDefault !== 'function')
|
|
1047
|
+
event.preventDefault = preventDefaultPolyfill.bind(event);
|
|
1048
|
+
if (typeof event.stopPropagation !== 'function')
|
|
1049
|
+
event.stopPropagation = stopPropagationPolyfill.bind(event);
|
|
1050
|
+
}
|
|
1051
|
+
function fixKeyboardEvent(event) {
|
|
1052
|
+
if (typeof event.keyCode === 'number' && typeof event.code === 'undefined') {
|
|
1053
|
+
var code = KEY_CODE_MAP[event.keyCode];
|
|
1054
|
+
if (typeof code === 'string')
|
|
1055
|
+
defineEventProperty(event, 'code', code);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function createDispatcher(record) {
|
|
1059
|
+
return function (event) {
|
|
1060
|
+
if (typeof event === 'undefined')
|
|
1061
|
+
event = GLOBAL$4.event; // IE: implicit global event object
|
|
1062
|
+
if (typeof event === 'undefined' || event === null)
|
|
1063
|
+
return;
|
|
1064
|
+
if (record.released)
|
|
1065
|
+
return;
|
|
1066
|
+
fixLegacyEvent(event, record.target);
|
|
1067
|
+
if (record.once)
|
|
1068
|
+
releaseListenerRecord(record);
|
|
1069
|
+
var patches = [];
|
|
1070
|
+
if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
|
|
1071
|
+
patchEventProperty(event, 'preventDefault', passivePreventDefault.bind(event), patches);
|
|
1072
|
+
if (record.resolvedType !== record.type)
|
|
1073
|
+
patchEventProperty(event, 'type', record.type, patches);
|
|
1074
|
+
if (record.touch)
|
|
1075
|
+
synthesizeTouchEvent(event, record.resolvedType, patches);
|
|
1076
|
+
fixKeyboardEvent(event);
|
|
1077
|
+
try {
|
|
1078
|
+
invokeCallback(record.callback, record.target, event);
|
|
1079
|
+
}
|
|
1080
|
+
finally {
|
|
1081
|
+
restoreEventProperties(event, patches);
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
function attachNativeListener(record) {
|
|
1086
|
+
var target = record.target;
|
|
1087
|
+
if (typeof target.addEventListener === 'function') {
|
|
1088
|
+
target.addEventListener(record.resolvedType, record.wrapper, toNativeListenerOptions(record));
|
|
1089
|
+
return true;
|
|
1090
|
+
}
|
|
1091
|
+
if (typeof target.attachEvent === 'function') {
|
|
1092
|
+
target.attachEvent('on' + record.resolvedType, record.wrapper);
|
|
1093
|
+
return true;
|
|
1094
|
+
}
|
|
1095
|
+
return false;
|
|
1096
|
+
}
|
|
1097
|
+
function detachNativeListener(record) {
|
|
1098
|
+
var target = record.target;
|
|
1099
|
+
if (typeof target.removeEventListener === 'function')
|
|
1100
|
+
return target.removeEventListener(record.resolvedType, record.wrapper, toNativeListenerOptions(record));
|
|
1101
|
+
if (typeof target.detachEvent === 'function')
|
|
1102
|
+
return target.detachEvent('on' + record.resolvedType, record.wrapper);
|
|
1103
|
+
}
|
|
1104
|
+
function releaseListenerRecord(record) {
|
|
1105
|
+
if (record.released)
|
|
1106
|
+
return;
|
|
1107
|
+
record.released = true;
|
|
1108
|
+
removeListenerRecord(record);
|
|
1109
|
+
try {
|
|
1110
|
+
detachNativeListener(record);
|
|
1111
|
+
}
|
|
1112
|
+
catch (_) {
|
|
1113
|
+
}
|
|
1114
|
+
if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
|
|
1115
|
+
try {
|
|
1116
|
+
record.signal.removeEventListener('abort', record.onAbort, false);
|
|
1117
|
+
}
|
|
1118
|
+
catch (_) {
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
record.onAbort = undefined;
|
|
1122
|
+
}
|
|
1123
|
+
function createEventPolyfill(type, init) {
|
|
1124
|
+
try {
|
|
1125
|
+
return new Event(type, init);
|
|
1126
|
+
}
|
|
1127
|
+
catch (_) {
|
|
1128
|
+
}
|
|
1129
|
+
var event = GLOBAL$4.document.createEvent('Event');
|
|
1130
|
+
event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
|
|
1131
|
+
return event;
|
|
1132
|
+
}
|
|
1133
|
+
function createCustomEventPolyfill(type, init) {
|
|
1134
|
+
try {
|
|
1135
|
+
return new CustomEvent(type, init);
|
|
1136
|
+
}
|
|
1137
|
+
catch (_) {
|
|
1138
|
+
}
|
|
1139
|
+
var event = GLOBAL$4.document.createEvent('CustomEvent');
|
|
1140
|
+
event.initCustomEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true, typeof init !== 'undefined' && typeof init.detail !== 'undefined' ? init.detail : null);
|
|
1141
|
+
return event;
|
|
1142
|
+
}
|
|
1143
|
+
var EventKit = {
|
|
1144
|
+
version: packageJSON$1.version,
|
|
1145
|
+
utils: {
|
|
1146
|
+
get supportedOptions() {
|
|
1147
|
+
return {
|
|
1148
|
+
once: SUPPORTED_LISTENER_OPTIONS.once,
|
|
1149
|
+
passive: SUPPORTED_LISTENER_OPTIONS.passive,
|
|
1150
|
+
capture: SUPPORTED_LISTENER_OPTIONS.capture,
|
|
1151
|
+
some: SUPPORTED_LISTENER_OPTIONS.some,
|
|
1152
|
+
all: SUPPORTED_LISTENER_OPTIONS.all,
|
|
1153
|
+
};
|
|
1154
|
+
},
|
|
1155
|
+
resolveType: resolveEventType,
|
|
1156
|
+
createEvent: createEventPolyfill,
|
|
1157
|
+
createCustomEvent: createCustomEventPolyfill,
|
|
1158
|
+
},
|
|
1159
|
+
add: function (target, type, callback, options) {
|
|
1160
|
+
if (typeof target === 'undefined' || target === null)
|
|
1161
|
+
return NOOP;
|
|
1162
|
+
if (typeof type !== 'string' || type.length === 0)
|
|
1163
|
+
return NOOP;
|
|
1164
|
+
if (typeof callback !== 'function' && (typeof callback !== 'object' || callback === null))
|
|
1165
|
+
return NOOP;
|
|
1166
|
+
var normalized = normalizeListenerOptions(options);
|
|
1167
|
+
var existing = findListenerRecord(target, type, callback, normalized.capture);
|
|
1168
|
+
// Native `addEventListener` ignores a duplicate registration, so hand back a releaser
|
|
1169
|
+
// that does nothing rather than one that would detach the first caller's listener.
|
|
1170
|
+
if (typeof existing !== 'undefined')
|
|
1171
|
+
return NOOP;
|
|
1172
|
+
if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
|
|
1173
|
+
return NOOP;
|
|
1174
|
+
var resolvedType = resolveEventType(target, type);
|
|
1175
|
+
var bucket = resolveBucket(target, true);
|
|
1176
|
+
var record = {
|
|
1177
|
+
bucket: bucket,
|
|
1178
|
+
target: target,
|
|
1179
|
+
type: type,
|
|
1180
|
+
callback: callback,
|
|
1181
|
+
wrapper: NOOP,
|
|
1182
|
+
resolvedType: resolvedType,
|
|
1183
|
+
capture: normalized.capture,
|
|
1184
|
+
once: normalized.once,
|
|
1185
|
+
passive: normalized.passive,
|
|
1186
|
+
signal: normalized.signal,
|
|
1187
|
+
onAbort: undefined,
|
|
1188
|
+
touch: isTouchEventType(type) && isPointerEventType(resolvedType),
|
|
1189
|
+
released: false,
|
|
1190
|
+
};
|
|
1191
|
+
record.wrapper = createDispatcher(record);
|
|
1192
|
+
if (!attachNativeListener(record))
|
|
1193
|
+
return NOOP;
|
|
1194
|
+
bucket.push(record);
|
|
1195
|
+
if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
|
|
1196
|
+
record.onAbort = function () {
|
|
1197
|
+
releaseListenerRecord(record);
|
|
1198
|
+
};
|
|
1199
|
+
// Engines without listener-options coerce `{once: true}` to capture, which would then
|
|
1200
|
+
// fail to match on removal; releaseListenerRecord detaches this anyway.
|
|
1201
|
+
record.signal.addEventListener('abort', record.onAbort, false);
|
|
1202
|
+
}
|
|
1203
|
+
return function () {
|
|
1204
|
+
releaseListenerRecord(record);
|
|
1205
|
+
};
|
|
1206
|
+
},
|
|
1207
|
+
remove: function (target, type, callback, options) {
|
|
1208
|
+
if (typeof target === 'undefined' || target === null)
|
|
1209
|
+
return;
|
|
1210
|
+
if (typeof type !== 'string' || type.length === 0)
|
|
1211
|
+
return;
|
|
1212
|
+
if (typeof callback !== 'function' && (typeof callback !== 'object' || callback === null))
|
|
1213
|
+
return;
|
|
1214
|
+
var normalized = normalizeListenerOptions(options);
|
|
1215
|
+
var record = findListenerRecord(target, type, callback, normalized.capture);
|
|
1216
|
+
if (typeof record !== 'undefined')
|
|
1217
|
+
return releaseListenerRecord(record);
|
|
1218
|
+
var resolvedType = resolveEventType(target, type);
|
|
1219
|
+
if (typeof target.removeEventListener === 'function')
|
|
1220
|
+
return target.removeEventListener(resolvedType, callback, toNativeListenerOptions(normalized));
|
|
1221
|
+
if (typeof target.detachEvent === 'function' && typeof callback === 'function')
|
|
1222
|
+
return target.detachEvent('on' + resolvedType, callback);
|
|
1223
|
+
},
|
|
366
1224
|
};
|
|
367
1225
|
|
|
1226
|
+
function getGlobal$1() {
|
|
1227
|
+
if (typeof globalThis !== 'undefined')
|
|
1228
|
+
return globalThis;
|
|
1229
|
+
if (typeof self !== 'undefined')
|
|
1230
|
+
return self;
|
|
1231
|
+
if (typeof window !== 'undefined')
|
|
1232
|
+
return window;
|
|
1233
|
+
if (typeof global !== 'undefined')
|
|
1234
|
+
return global;
|
|
1235
|
+
return {};
|
|
1236
|
+
}
|
|
1237
|
+
|
|
368
1238
|
function createHiddenElement(tagName, focusable) {
|
|
369
1239
|
if (focusable === void 0) { focusable = true; }
|
|
370
|
-
var
|
|
1240
|
+
var document = getGlobal$1().document;
|
|
1241
|
+
var element = document.createElement(tagName);
|
|
371
1242
|
if (typeof element.width !== 'undefined')
|
|
372
1243
|
element.width = '0';
|
|
373
1244
|
if (typeof element.height !== 'undefined')
|
|
@@ -418,116 +1289,301 @@ function createHiddenElement(tagName, focusable) {
|
|
|
418
1289
|
return element;
|
|
419
1290
|
}
|
|
420
1291
|
|
|
421
|
-
var
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
1292
|
+
var version = "0.0.5";
|
|
1293
|
+
var packageJSON = {
|
|
1294
|
+
version: version};
|
|
1295
|
+
|
|
1296
|
+
var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ji', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
|
|
1297
|
+
var RTL_SCRIPTS = ['Adlm', 'Arab', 'Aran', 'Hebr', 'Mand', 'Mend', 'Nkoo', 'Rohg', 'Samr', 'Syrc', 'Thaa', 'Yezi'];
|
|
1298
|
+
var LANGUAGE_PATTERN = /^[A-Za-z]{2,8}$/;
|
|
1299
|
+
var SCRIPT_PATTERN = /^[A-Za-z]{4}$/;
|
|
1300
|
+
var REGION_PATTERN = /^(?:[A-Za-z]{2}|[0-9]{3})$/;
|
|
1301
|
+
var VARIANT_PATTERN = /^(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3})$/;
|
|
1302
|
+
var SINGLETON_PATTERN = /^[A-Za-z0-9]$/;
|
|
1303
|
+
var EXTENSION_PATTERN = /^[A-Za-z0-9]{1,8}$/;
|
|
1304
|
+
function getGlobal() {
|
|
1305
|
+
if (typeof globalThis !== 'undefined')
|
|
1306
|
+
return globalThis;
|
|
1307
|
+
if (typeof self !== 'undefined')
|
|
1308
|
+
return self;
|
|
1309
|
+
if (typeof window !== 'undefined')
|
|
1310
|
+
return window;
|
|
1311
|
+
if (typeof global !== 'undefined')
|
|
1312
|
+
return global;
|
|
1313
|
+
return {};
|
|
1314
|
+
}
|
|
1315
|
+
function freeze(values) {
|
|
1316
|
+
return typeof Object.freeze === 'function' ? Object.freeze(values) : values;
|
|
1317
|
+
}
|
|
1318
|
+
function contains(values, value) {
|
|
1319
|
+
for (var i = 0; i < values.length; i++) {
|
|
1320
|
+
if (values[i] === value)
|
|
1321
|
+
return true;
|
|
1322
|
+
}
|
|
1323
|
+
return false;
|
|
1324
|
+
}
|
|
1325
|
+
function getIntlLocaleConstructor() {
|
|
1326
|
+
if (typeof Intl === 'undefined')
|
|
1327
|
+
return undefined;
|
|
1328
|
+
var constructor = Intl.Locale;
|
|
1329
|
+
return typeof constructor === 'function' ? constructor : undefined;
|
|
1330
|
+
}
|
|
1331
|
+
function parseTag(raw) {
|
|
1332
|
+
if (raw === null || typeof raw !== 'string')
|
|
1333
|
+
return null;
|
|
1334
|
+
var value = raw.replace(/_/g, '-');
|
|
1335
|
+
if (value.length === 0)
|
|
426
1336
|
return null;
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
if (
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
if (
|
|
1337
|
+
if (value === 'C' || value.toLowerCase() === 'posix')
|
|
1338
|
+
value = 'en-US';
|
|
1339
|
+
var dot = value.indexOf('.');
|
|
1340
|
+
if (dot !== -1)
|
|
1341
|
+
value = value.slice(0, dot);
|
|
1342
|
+
var at = value.indexOf('@');
|
|
1343
|
+
if (at !== -1)
|
|
1344
|
+
value = value.slice(0, at);
|
|
1345
|
+
if (value.length === 0)
|
|
436
1346
|
return null;
|
|
437
|
-
|
|
438
|
-
if (
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
1347
|
+
var segments = value.split('-');
|
|
1348
|
+
if (LANGUAGE_PATTERN.test(segments[0]) === false)
|
|
1349
|
+
return null;
|
|
1350
|
+
var language = segments[0].toLowerCase();
|
|
1351
|
+
var index = 1;
|
|
1352
|
+
var script = null;
|
|
1353
|
+
if (index < segments.length && SCRIPT_PATTERN.test(segments[index])) {
|
|
1354
|
+
script = segments[index].charAt(0).toUpperCase() + segments[index].slice(1).toLowerCase();
|
|
1355
|
+
index++;
|
|
1356
|
+
}
|
|
1357
|
+
var region = null;
|
|
1358
|
+
if (index < segments.length && REGION_PATTERN.test(segments[index])) {
|
|
1359
|
+
region = segments[index].toUpperCase();
|
|
1360
|
+
index++;
|
|
1361
|
+
}
|
|
1362
|
+
var variants = [];
|
|
1363
|
+
while (index < segments.length && VARIANT_PATTERN.test(segments[index])) {
|
|
1364
|
+
variants.push(segments[index].toLowerCase());
|
|
1365
|
+
index++;
|
|
1366
|
+
}
|
|
1367
|
+
var extensions = [];
|
|
1368
|
+
while (index < segments.length) {
|
|
1369
|
+
var singleton = segments[index];
|
|
1370
|
+
if (SINGLETON_PATTERN.test(singleton) === false)
|
|
1371
|
+
return null;
|
|
1372
|
+
var isPrivateUse = singleton.toLowerCase() === 'x';
|
|
1373
|
+
var parts = [singleton.toLowerCase()];
|
|
1374
|
+
index++;
|
|
1375
|
+
while (index < segments.length) {
|
|
1376
|
+
var segment = segments[index];
|
|
1377
|
+
if (EXTENSION_PATTERN.test(segment) === false)
|
|
1378
|
+
return null;
|
|
1379
|
+
if (segment.length === 1 && isPrivateUse === false)
|
|
1380
|
+
break;
|
|
1381
|
+
parts.push(segment.toLowerCase());
|
|
1382
|
+
index++;
|
|
1383
|
+
}
|
|
1384
|
+
if (parts.length < 2)
|
|
1385
|
+
return null;
|
|
1386
|
+
extensions.push(parts.join('-'));
|
|
1387
|
+
}
|
|
1388
|
+
var base = [language];
|
|
1389
|
+
if (script !== null)
|
|
1390
|
+
base.push(script);
|
|
1391
|
+
if (region !== null)
|
|
1392
|
+
base.push(region);
|
|
1393
|
+
for (var i = 0; i < variants.length; i++)
|
|
1394
|
+
base.push(variants[i]);
|
|
1395
|
+
var baseName = base.join('-');
|
|
1396
|
+
return {
|
|
1397
|
+
tag: extensions.length === 0 ? baseName : baseName + '-' + extensions.join('-'),
|
|
1398
|
+
baseName: baseName,
|
|
1399
|
+
language: language,
|
|
1400
|
+
script: script,
|
|
1401
|
+
region: region,
|
|
1402
|
+
variants: freeze(variants),
|
|
1403
|
+
extensions: freeze(extensions),
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
function isRTL(subtags) {
|
|
1407
|
+
if (subtags.script !== null)
|
|
1408
|
+
return contains(RTL_SCRIPTS, subtags.script);
|
|
1409
|
+
return contains(RTL_LANGUAGES, subtags.language);
|
|
1410
|
+
}
|
|
1411
|
+
function expandTag(tag) {
|
|
1412
|
+
var parsed = parseTag(tag);
|
|
1413
|
+
if (parsed === null)
|
|
1414
|
+
return freeze([]);
|
|
1415
|
+
var segments = parsed.baseName.split('-');
|
|
1416
|
+
var chain = [];
|
|
1417
|
+
for (var i = segments.length; i > 0; i--)
|
|
1418
|
+
chain.push(segments.slice(0, i).join('-'));
|
|
1419
|
+
return freeze(chain);
|
|
1420
|
+
}
|
|
1421
|
+
function toLookupKey(tag) {
|
|
1422
|
+
var parsed = parseTag(tag);
|
|
1423
|
+
return (parsed === null ? tag : parsed.baseName).toLowerCase();
|
|
1424
|
+
}
|
|
1425
|
+
function lookupTag(supported, preferred, fallback) {
|
|
1426
|
+
if (supported === null || typeof supported === 'undefined' || typeof supported.length !== 'number')
|
|
1427
|
+
return fallback;
|
|
1428
|
+
var keys = [];
|
|
1429
|
+
for (var i = 0; i < supported.length; i++)
|
|
1430
|
+
keys.push(toLookupKey(supported[i]));
|
|
1431
|
+
for (var i = 0; i < preferred.length; i++) {
|
|
1432
|
+
var chain = expandTag(preferred[i]);
|
|
1433
|
+
for (var j = 0; j < chain.length; j++) {
|
|
1434
|
+
var candidate = chain[j].toLowerCase();
|
|
1435
|
+
var prefix = candidate + '-';
|
|
1436
|
+
for (var k = 0; k < keys.length; k++) {
|
|
1437
|
+
if (keys[k] === candidate)
|
|
1438
|
+
return supported[k];
|
|
1439
|
+
}
|
|
1440
|
+
for (var k = 0; k < keys.length; k++) {
|
|
1441
|
+
if (keys[k].indexOf(prefix) === 0)
|
|
1442
|
+
return supported[k];
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
return fallback;
|
|
1447
|
+
}
|
|
1448
|
+
function resolveDirection(primary) {
|
|
1449
|
+
if (primary === null)
|
|
1450
|
+
return false;
|
|
1451
|
+
var IntlLocale = getIntlLocaleConstructor();
|
|
1452
|
+
if (typeof IntlLocale !== 'undefined') {
|
|
1453
|
+
try {
|
|
1454
|
+
var intlLocale = new IntlLocale(primary.tag);
|
|
1455
|
+
if (typeof intlLocale.getTextInfo === 'function')
|
|
1456
|
+
return intlLocale.getTextInfo().direction === 'rtl';
|
|
1457
|
+
if (typeof intlLocale.textInfo !== 'undefined')
|
|
1458
|
+
return intlLocale.textInfo.direction === 'rtl';
|
|
1459
|
+
}
|
|
1460
|
+
catch (_) {
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
return isRTL(primary);
|
|
443
1464
|
}
|
|
1465
|
+
var subtags = null;
|
|
444
1466
|
var language = null;
|
|
445
|
-
var languages = [];
|
|
1467
|
+
var languages = freeze([]);
|
|
1468
|
+
var fallbacks = freeze([]);
|
|
446
1469
|
var timezone = null;
|
|
447
1470
|
var offset = 0;
|
|
448
|
-
var
|
|
449
|
-
function
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
if (
|
|
457
|
-
|
|
458
|
-
|
|
1471
|
+
var rtl = false;
|
|
1472
|
+
function resolveLanguages(candidates) {
|
|
1473
|
+
var resolved = [];
|
|
1474
|
+
var primary = null;
|
|
1475
|
+
for (var i = 0; i < candidates.length; i++) {
|
|
1476
|
+
var parsed = parseTag(candidates[i]);
|
|
1477
|
+
if (parsed === null)
|
|
1478
|
+
continue;
|
|
1479
|
+
if (contains(resolved, parsed.baseName))
|
|
1480
|
+
continue;
|
|
1481
|
+
if (primary === null)
|
|
1482
|
+
primary = parsed;
|
|
1483
|
+
resolved.push(parsed.baseName);
|
|
1484
|
+
}
|
|
1485
|
+
subtags = primary;
|
|
1486
|
+
language = primary === null ? null : primary.baseName;
|
|
1487
|
+
languages = freeze(resolved);
|
|
1488
|
+
fallbacks = primary === null ? freeze([]) : expandTag(primary.baseName);
|
|
1489
|
+
rtl = resolveDirection(primary);
|
|
1490
|
+
}
|
|
1491
|
+
function collectEnvironmentLanguages() {
|
|
1492
|
+
var candidates = [];
|
|
1493
|
+
var navigatorLike = getGlobal().navigator;
|
|
1494
|
+
if (typeof navigatorLike !== 'undefined' && navigatorLike !== null) {
|
|
1495
|
+
if (typeof navigatorLike.languages !== 'undefined' && navigatorLike.languages !== null) {
|
|
1496
|
+
for (var i = 0; i < navigatorLike.languages.length; i++)
|
|
1497
|
+
candidates.push(navigatorLike.languages[i]);
|
|
1498
|
+
}
|
|
1499
|
+
candidates.push(navigatorLike.language);
|
|
1500
|
+
candidates.push(navigatorLike.userLanguage);
|
|
1501
|
+
candidates.push(navigatorLike.browserLanguage);
|
|
1502
|
+
candidates.push(navigatorLike.systemLanguage);
|
|
1503
|
+
}
|
|
1504
|
+
if (typeof Intl !== 'undefined') {
|
|
1505
|
+
try {
|
|
1506
|
+
candidates.push(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
1507
|
+
}
|
|
1508
|
+
catch (_) {
|
|
1509
|
+
}
|
|
459
1510
|
}
|
|
1511
|
+
return candidates;
|
|
460
1512
|
}
|
|
1513
|
+
var ENVIRONMENT_LANGUAGES = collectEnvironmentLanguages();
|
|
1514
|
+
resolveLanguages(ENVIRONMENT_LANGUAGES);
|
|
461
1515
|
if (typeof Intl !== 'undefined') {
|
|
462
|
-
try {
|
|
463
|
-
addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
464
|
-
}
|
|
465
|
-
catch (_) {
|
|
466
|
-
}
|
|
467
1516
|
try {
|
|
468
1517
|
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
469
1518
|
}
|
|
470
1519
|
catch (_) {
|
|
471
1520
|
}
|
|
472
1521
|
}
|
|
473
|
-
if (typeof globalThis.navigator !== 'undefined') {
|
|
474
|
-
if (typeof globalThis.navigator.languages !== 'undefined')
|
|
475
|
-
addLanguages(globalThis.navigator.languages);
|
|
476
|
-
if (typeof globalThis.navigator.language !== 'undefined')
|
|
477
|
-
addLanguage(globalThis.navigator.language);
|
|
478
|
-
if (typeof globalThis.navigator.userLanguage !== 'undefined')
|
|
479
|
-
addLanguage(globalThis.navigator.userLanguage);
|
|
480
|
-
if (typeof globalThis.navigator.browserLanguage !== 'undefined')
|
|
481
|
-
addLanguage(globalThis.navigator.browserLanguage);
|
|
482
|
-
if (typeof globalThis.navigator.systemLanguage !== 'undefined')
|
|
483
|
-
addLanguage(globalThis.navigator.systemLanguage);
|
|
484
|
-
}
|
|
485
1522
|
try {
|
|
486
1523
|
offset = new Date().getTimezoneOffset() * -1;
|
|
487
1524
|
}
|
|
488
1525
|
catch (_) {
|
|
489
1526
|
}
|
|
490
|
-
if (typeof language === 'string') {
|
|
491
|
-
if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
|
|
492
|
-
try {
|
|
493
|
-
var intlLocale = new Intl.Locale(language);
|
|
494
|
-
if (typeof intlLocale.getTextInfo === 'function')
|
|
495
|
-
isRTLResolved = intlLocale.getTextInfo().direction === 'rtl';
|
|
496
|
-
else if (typeof intlLocale.textInfo !== 'undefined')
|
|
497
|
-
isRTLResolved = intlLocale.textInfo.direction === 'rtl';
|
|
498
|
-
}
|
|
499
|
-
catch (_) {
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
if (typeof isRTLResolved !== 'boolean') {
|
|
503
|
-
var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(language);
|
|
504
|
-
if (matched !== null) {
|
|
505
|
-
var lang = matched[1].toLowerCase();
|
|
506
|
-
for (var i = 0; i < RTL_LANGUAGES.length; i++) {
|
|
507
|
-
if (RTL_LANGUAGES[i] === lang) {
|
|
508
|
-
isRTLResolved = true;
|
|
509
|
-
break;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
1527
|
var LocaleKit = {
|
|
516
|
-
|
|
1528
|
+
version: packageJSON.version,
|
|
1529
|
+
get language() {
|
|
1530
|
+
return language;
|
|
1531
|
+
},
|
|
1532
|
+
get languages() {
|
|
1533
|
+
return languages;
|
|
1534
|
+
},
|
|
1535
|
+
set languages(value) {
|
|
1536
|
+
resolveLanguages(typeof value === 'string' ? [value] : value);
|
|
1537
|
+
},
|
|
1538
|
+
get subtags() {
|
|
1539
|
+
return subtags;
|
|
1540
|
+
},
|
|
1541
|
+
get fallbacks() {
|
|
1542
|
+
return fallbacks;
|
|
1543
|
+
},
|
|
1544
|
+
get timezone() {
|
|
1545
|
+
return timezone;
|
|
1546
|
+
},
|
|
1547
|
+
get offset() {
|
|
1548
|
+
return offset;
|
|
1549
|
+
},
|
|
1550
|
+
get rtl() {
|
|
1551
|
+
return rtl;
|
|
1552
|
+
},
|
|
1553
|
+
reset: function () {
|
|
1554
|
+
resolveLanguages(ENVIRONMENT_LANGUAGES);
|
|
1555
|
+
},
|
|
1556
|
+
parse: function (tag) {
|
|
1557
|
+
return parseTag(tag);
|
|
1558
|
+
},
|
|
1559
|
+
expand: function (tag) {
|
|
1560
|
+
return expandTag(tag);
|
|
1561
|
+
},
|
|
1562
|
+
lookup: function (supported, fallback) {
|
|
1563
|
+
return lookupTag(supported, languages, typeof fallback === 'undefined' ? null : fallback);
|
|
1564
|
+
},
|
|
1565
|
+
};
|
|
1566
|
+
if (typeof Object.freeze === 'function')
|
|
1567
|
+
Object.freeze(LocaleKit);
|
|
517
1568
|
|
|
1569
|
+
var GLOBAL$1 = getGlobal$1();
|
|
1570
|
+
var CACHE_PREFIX = 'web-launch-kit:';
|
|
518
1571
|
var TRACK_ID = 'track-id';
|
|
519
|
-
var
|
|
1572
|
+
var PRODUCT_ID = 'product-id';
|
|
520
1573
|
var TRACK_ID_CACHE_TTL = 1000 * 60 * 60;
|
|
1574
|
+
function toCacheKey(mode, query) {
|
|
1575
|
+
return CACHE_PREFIX + mode + ':' + query;
|
|
1576
|
+
}
|
|
521
1577
|
var idCache = (function () {
|
|
522
1578
|
var supportsLocalStorage;
|
|
523
1579
|
try {
|
|
524
|
-
if (typeof
|
|
1580
|
+
if (typeof GLOBAL$1.localStorage === 'undefined' || GLOBAL$1.localStorage === null) {
|
|
525
1581
|
supportsLocalStorage = false;
|
|
526
1582
|
}
|
|
527
1583
|
else {
|
|
528
1584
|
var key = '__id_cache_test__';
|
|
529
|
-
|
|
530
|
-
|
|
1585
|
+
GLOBAL$1.localStorage.setItem(key, '');
|
|
1586
|
+
GLOBAL$1.localStorage.removeItem(key);
|
|
531
1587
|
supportsLocalStorage = true;
|
|
532
1588
|
}
|
|
533
1589
|
}
|
|
@@ -538,7 +1594,7 @@ var idCache = (function () {
|
|
|
538
1594
|
return {
|
|
539
1595
|
get: function (mode, query) {
|
|
540
1596
|
try {
|
|
541
|
-
var item =
|
|
1597
|
+
var item = GLOBAL$1.localStorage.getItem(toCacheKey(mode, query));
|
|
542
1598
|
if (item == null)
|
|
543
1599
|
return undefined;
|
|
544
1600
|
var split = item.split('|');
|
|
@@ -546,7 +1602,7 @@ var idCache = (function () {
|
|
|
546
1602
|
return undefined;
|
|
547
1603
|
var expiry = +split[0];
|
|
548
1604
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
549
|
-
|
|
1605
|
+
GLOBAL$1.localStorage.removeItem(toCacheKey(mode, query));
|
|
550
1606
|
return undefined;
|
|
551
1607
|
}
|
|
552
1608
|
return split[1];
|
|
@@ -557,7 +1613,7 @@ var idCache = (function () {
|
|
|
557
1613
|
},
|
|
558
1614
|
set: function (mode, query, id) {
|
|
559
1615
|
try {
|
|
560
|
-
|
|
1616
|
+
GLOBAL$1.localStorage.setItem(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
|
|
561
1617
|
}
|
|
562
1618
|
catch (_) {
|
|
563
1619
|
return;
|
|
@@ -565,11 +1621,11 @@ var idCache = (function () {
|
|
|
565
1621
|
}
|
|
566
1622
|
};
|
|
567
1623
|
}
|
|
568
|
-
if (typeof
|
|
569
|
-
var cache_1 = new Map();
|
|
1624
|
+
if (typeof GLOBAL$1.Map !== 'undefined') {
|
|
1625
|
+
var cache_1 = new GLOBAL$1.Map();
|
|
570
1626
|
return {
|
|
571
1627
|
get: function (mode, query) {
|
|
572
|
-
var item = cache_1.get(mode
|
|
1628
|
+
var item = cache_1.get(toCacheKey(mode, query));
|
|
573
1629
|
if (typeof item === 'undefined')
|
|
574
1630
|
return undefined;
|
|
575
1631
|
var split = item.split('|');
|
|
@@ -577,20 +1633,20 @@ var idCache = (function () {
|
|
|
577
1633
|
return undefined;
|
|
578
1634
|
var expiry = +split[0];
|
|
579
1635
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
580
|
-
cache_1.delete(mode
|
|
1636
|
+
cache_1.delete(toCacheKey(mode, query));
|
|
581
1637
|
return undefined;
|
|
582
1638
|
}
|
|
583
1639
|
return split[1];
|
|
584
1640
|
},
|
|
585
1641
|
set: function (mode, query, id) {
|
|
586
|
-
cache_1.set(mode
|
|
1642
|
+
cache_1.set(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
|
|
587
1643
|
},
|
|
588
1644
|
};
|
|
589
1645
|
}
|
|
590
1646
|
var cache = Object.create(null);
|
|
591
1647
|
return {
|
|
592
1648
|
get: function (mode, query) {
|
|
593
|
-
var item = cache[mode
|
|
1649
|
+
var item = cache[toCacheKey(mode, query)];
|
|
594
1650
|
if (typeof item === 'undefined')
|
|
595
1651
|
return undefined;
|
|
596
1652
|
var split = item.split('|');
|
|
@@ -599,17 +1655,17 @@ var idCache = (function () {
|
|
|
599
1655
|
var expiry = +split[0];
|
|
600
1656
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
601
1657
|
try {
|
|
602
|
-
delete cache[mode
|
|
1658
|
+
delete cache[toCacheKey(mode, query)];
|
|
603
1659
|
}
|
|
604
1660
|
catch (_) {
|
|
605
|
-
cache[mode
|
|
1661
|
+
cache[toCacheKey(mode, query)] = undefined;
|
|
606
1662
|
}
|
|
607
1663
|
return undefined;
|
|
608
1664
|
}
|
|
609
1665
|
return split[1];
|
|
610
1666
|
},
|
|
611
1667
|
set: function (mode, query, id) {
|
|
612
|
-
cache[mode
|
|
1668
|
+
cache[toCacheKey(mode, query)] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
|
|
613
1669
|
}
|
|
614
1670
|
};
|
|
615
1671
|
})();
|
|
@@ -623,8 +1679,8 @@ function getNow() {
|
|
|
623
1679
|
}
|
|
624
1680
|
function requestGet(url, async) {
|
|
625
1681
|
if (async === void 0) { async = false; }
|
|
626
|
-
if (typeof
|
|
627
|
-
return
|
|
1682
|
+
if (typeof GLOBAL$1.fetch === 'function' && async) {
|
|
1683
|
+
return GLOBAL$1.fetch(url)
|
|
628
1684
|
.then(function (response) {
|
|
629
1685
|
return response.json();
|
|
630
1686
|
})
|
|
@@ -667,10 +1723,10 @@ function resolveGetProductIdURL(packageFamilyName) {
|
|
|
667
1723
|
if (locale === candidate)
|
|
668
1724
|
break;
|
|
669
1725
|
}
|
|
670
|
-
return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' +
|
|
1726
|
+
return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + encodeURIComponent(packageFamilyName) + '&market=' + encodeURIComponent(country) + '&languages=' + encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
|
|
671
1727
|
}
|
|
672
1728
|
function resolveGetTrackIdURL(bundleId) {
|
|
673
|
-
return 'https://itunes.apple.com/lookup?bundleId=' +
|
|
1729
|
+
return 'https://itunes.apple.com/lookup?bundleId=' + encodeURIComponent(bundleId);
|
|
674
1730
|
}
|
|
675
1731
|
function parseGetProductIdResponse(response) {
|
|
676
1732
|
if (typeof response === 'undefined')
|
|
@@ -696,14 +1752,14 @@ function parseGetTrackIdResponse(response) {
|
|
|
696
1752
|
return '' + result.trackId;
|
|
697
1753
|
}
|
|
698
1754
|
function getProductId(packageFamilyName) {
|
|
699
|
-
var cache = idCache.get(
|
|
1755
|
+
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
700
1756
|
if (typeof cache !== 'undefined')
|
|
701
1757
|
return cache;
|
|
702
1758
|
try {
|
|
703
1759
|
var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName)));
|
|
704
1760
|
if (typeof productId === 'undefined')
|
|
705
1761
|
return undefined;
|
|
706
|
-
idCache.set(
|
|
1762
|
+
idCache.set(PRODUCT_ID, packageFamilyName, productId);
|
|
707
1763
|
return productId;
|
|
708
1764
|
}
|
|
709
1765
|
catch (_) {
|
|
@@ -726,7 +1782,7 @@ function getTrackId(bundleId) {
|
|
|
726
1782
|
}
|
|
727
1783
|
}
|
|
728
1784
|
function getProductIdAsync(packageFamilyName) {
|
|
729
|
-
var cache = idCache.get(
|
|
1785
|
+
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
730
1786
|
if (typeof cache !== 'undefined')
|
|
731
1787
|
return Promise.resolve(cache);
|
|
732
1788
|
try {
|
|
@@ -735,7 +1791,7 @@ function getProductIdAsync(packageFamilyName) {
|
|
|
735
1791
|
.then(function (productId) {
|
|
736
1792
|
if (typeof productId === 'undefined')
|
|
737
1793
|
return undefined;
|
|
738
|
-
idCache.set(
|
|
1794
|
+
idCache.set(PRODUCT_ID, packageFamilyName, productId);
|
|
739
1795
|
return productId;
|
|
740
1796
|
});
|
|
741
1797
|
}
|
|
@@ -763,110 +1819,16 @@ function getTrackIdAsync(bundleId) {
|
|
|
763
1819
|
}
|
|
764
1820
|
|
|
765
1821
|
function getTopmostWindow() {
|
|
1822
|
+
var globalLike = getGlobal$1();
|
|
766
1823
|
try {
|
|
767
|
-
if (
|
|
768
|
-
void
|
|
769
|
-
return
|
|
1824
|
+
if (typeof globalLike.top !== 'undefined' && globalLike.top !== null && globalLike.top !== globalLike.window) {
|
|
1825
|
+
void globalLike.top.location.href;
|
|
1826
|
+
return globalLike.top;
|
|
770
1827
|
}
|
|
771
1828
|
}
|
|
772
1829
|
catch (_) {
|
|
773
1830
|
}
|
|
774
|
-
return
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
var IE_WRAPPER_STORE = [];
|
|
778
|
-
var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
|
|
779
|
-
var LEGACY_TYPE_MAP = {
|
|
780
|
-
'focus': ['focus', 'focusin'],
|
|
781
|
-
'blur': ['blur', 'focusout'],
|
|
782
|
-
};
|
|
783
|
-
function resolveVendor(target, type) {
|
|
784
|
-
var types;
|
|
785
|
-
var legacy = LEGACY_TYPE_MAP[type];
|
|
786
|
-
if (typeof legacy !== 'undefined')
|
|
787
|
-
types = legacy;
|
|
788
|
-
else
|
|
789
|
-
types = [type];
|
|
790
|
-
for (var i = 0; i < VENDORS.length; i++) {
|
|
791
|
-
for (var j = 0; j < types.length; j++) {
|
|
792
|
-
var name_1 = VENDORS[i] + types[j];
|
|
793
|
-
if (typeof target['on' + name_1] !== 'undefined')
|
|
794
|
-
return name_1;
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
return type;
|
|
798
|
-
}
|
|
799
|
-
function findIEWrapper(target, type, callback) {
|
|
800
|
-
for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
|
|
801
|
-
var wrapper = IE_WRAPPER_STORE[i];
|
|
802
|
-
if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback)
|
|
803
|
-
return wrapper.wrapper;
|
|
804
|
-
}
|
|
805
|
-
return undefined;
|
|
806
|
-
}
|
|
807
|
-
function setIEWrapper(target, type, callback, wrapper) {
|
|
808
|
-
IE_WRAPPER_STORE.push({ target: target, type: type, callback: callback, wrapper: wrapper });
|
|
809
|
-
}
|
|
810
|
-
function removeIEWrapper(target, type, callback) {
|
|
811
|
-
for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
|
|
812
|
-
var wrapper = IE_WRAPPER_STORE[i];
|
|
813
|
-
if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback) {
|
|
814
|
-
IE_WRAPPER_STORE.splice(i, 1);
|
|
815
|
-
return wrapper.wrapper;
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
return undefined;
|
|
819
|
-
}
|
|
820
|
-
function preventDefaultPolyfill() {
|
|
821
|
-
this.returnValue = false;
|
|
822
|
-
}
|
|
823
|
-
function stopPropagationPolyfill() {
|
|
824
|
-
this.cancelBubble = true;
|
|
825
|
-
}
|
|
826
|
-
function addEvent(target, type, callback) {
|
|
827
|
-
if (typeof target === 'undefined' || typeof type === 'undefined')
|
|
828
|
-
return;
|
|
829
|
-
type = resolveVendor(target, type);
|
|
830
|
-
if (typeof target.addEventListener === 'function') {
|
|
831
|
-
return target.addEventListener(type, callback);
|
|
832
|
-
}
|
|
833
|
-
if (typeof target.attachEvent === 'function') {
|
|
834
|
-
var existing = findIEWrapper(target, type, callback);
|
|
835
|
-
if (typeof existing === 'function')
|
|
836
|
-
return;
|
|
837
|
-
var wrapper = function (event) {
|
|
838
|
-
if (typeof event === 'undefined')
|
|
839
|
-
event = globalThis.event;
|
|
840
|
-
if (typeof event === 'undefined')
|
|
841
|
-
return;
|
|
842
|
-
try {
|
|
843
|
-
Object.defineProperty(event, 'currentTarget', { value: target, configurable: true });
|
|
844
|
-
}
|
|
845
|
-
catch (_) {
|
|
846
|
-
}
|
|
847
|
-
if (typeof event.preventDefault !== 'function')
|
|
848
|
-
event.preventDefault = preventDefaultPolyfill.bind(event);
|
|
849
|
-
if (typeof event.stopPropagation !== 'function')
|
|
850
|
-
event.stopPropagation = stopPropagationPolyfill.bind(event);
|
|
851
|
-
callback.call(target, event);
|
|
852
|
-
};
|
|
853
|
-
setIEWrapper(target, type, callback, wrapper);
|
|
854
|
-
return target.attachEvent('on' + type, wrapper);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
function removeEvent(target, type, callback) {
|
|
858
|
-
if (typeof target === 'undefined' || typeof type === 'undefined')
|
|
859
|
-
return;
|
|
860
|
-
type = resolveVendor(target, type);
|
|
861
|
-
if (typeof target.removeEventListener === 'function') {
|
|
862
|
-
return target.removeEventListener(type, callback);
|
|
863
|
-
}
|
|
864
|
-
if (typeof target.detachEvent === 'function') {
|
|
865
|
-
var wrapper = removeIEWrapper(target, type, callback);
|
|
866
|
-
if (typeof wrapper === 'function')
|
|
867
|
-
target.detachEvent('on' + type, wrapper);
|
|
868
|
-
return;
|
|
869
|
-
}
|
|
1831
|
+
return globalLike;
|
|
870
1832
|
}
|
|
871
1833
|
|
|
872
1834
|
var SettingType;
|
|
@@ -937,7 +1899,8 @@ var IOS_DEFAULT_TIMEOUT = 2000;
|
|
|
937
1899
|
var WINDOWS_DEFAULT_TIMEOUT = 750;
|
|
938
1900
|
var MACOS_DEFAULT_TIMEOUT = 750;
|
|
939
1901
|
var DEFAULT_TIMEOUT = 750;
|
|
940
|
-
var
|
|
1902
|
+
var GLOBAL = getGlobal$1();
|
|
1903
|
+
var NAVIGATOR = GLOBAL.navigator;
|
|
941
1904
|
var CLEANUP_INPUT_ELEMENT = null;
|
|
942
1905
|
function createTypeGuard(tag) {
|
|
943
1906
|
return function (value) {
|
|
@@ -997,7 +1960,7 @@ function isDocumentHidden() {
|
|
|
997
1960
|
return true;
|
|
998
1961
|
}
|
|
999
1962
|
function dispatchClickEvent(element, view) {
|
|
1000
|
-
if (view === void 0) { view =
|
|
1963
|
+
if (view === void 0) { view = GLOBAL; }
|
|
1001
1964
|
var fake;
|
|
1002
1965
|
try {
|
|
1003
1966
|
fake = new MouseEvent('click', {
|
|
@@ -1007,7 +1970,7 @@ function dispatchClickEvent(element, view) {
|
|
|
1007
1970
|
});
|
|
1008
1971
|
}
|
|
1009
1972
|
catch (_) {
|
|
1010
|
-
fake =
|
|
1973
|
+
fake = GLOBAL.document.createEvent('MouseEvents');
|
|
1011
1974
|
fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
1012
1975
|
}
|
|
1013
1976
|
element.dispatchEvent(fake);
|
|
@@ -1035,11 +1998,14 @@ function restoreFocus() {
|
|
|
1035
1998
|
focus(top);
|
|
1036
1999
|
if (hasFocus(topDocument))
|
|
1037
2000
|
return true;
|
|
1038
|
-
|
|
1039
|
-
|
|
2001
|
+
var hadBodyTabIndex = topDocument.body.hasAttribute('tabindex');
|
|
2002
|
+
if (!hadBodyTabIndex)
|
|
2003
|
+
topDocument.body.setAttribute('tabindex', '-1');
|
|
1040
2004
|
focus(topDocument.body);
|
|
1041
2005
|
if (hasFocus(topDocument))
|
|
1042
2006
|
return true;
|
|
2007
|
+
if (!hadBodyTabIndex)
|
|
2008
|
+
topDocument.body.removeAttribute('tabindex');
|
|
1043
2009
|
var input = undefined;
|
|
1044
2010
|
try {
|
|
1045
2011
|
input = createHiddenElement('input');
|
|
@@ -1081,7 +2047,7 @@ function stripURL(value) {
|
|
|
1081
2047
|
function resolveFocusEventConfig() {
|
|
1082
2048
|
var top = getTopmostWindow();
|
|
1083
2049
|
var topDocument = top.document;
|
|
1084
|
-
if (typeof
|
|
2050
|
+
if (typeof GLOBAL.cordova !== 'undefined') {
|
|
1085
2051
|
return {
|
|
1086
2052
|
focus: {
|
|
1087
2053
|
target: topDocument,
|
|
@@ -1119,7 +2085,7 @@ function resolveFocusEventConfig() {
|
|
|
1119
2085
|
};
|
|
1120
2086
|
}
|
|
1121
2087
|
}
|
|
1122
|
-
else if (typeof
|
|
2088
|
+
else if (typeof GLOBAL.document.addEventListener === 'function') {
|
|
1123
2089
|
return {
|
|
1124
2090
|
focus: {
|
|
1125
2091
|
target: top,
|
|
@@ -1159,12 +2125,12 @@ function openURL(tried, url, timeout) {
|
|
|
1159
2125
|
var anchor = undefined;
|
|
1160
2126
|
var iframe = undefined;
|
|
1161
2127
|
function open() {
|
|
1162
|
-
if (typeof
|
|
1163
|
-
if (typeof
|
|
1164
|
-
|
|
2128
|
+
if (typeof GLOBAL.cordova !== 'undefined' && GLOBAL.cordova !== null) {
|
|
2129
|
+
if (typeof GLOBAL.cordova.InAppBrowser !== 'undefined') {
|
|
2130
|
+
GLOBAL.cordova.InAppBrowser.open(url, '_system');
|
|
1165
2131
|
}
|
|
1166
|
-
else {
|
|
1167
|
-
|
|
2132
|
+
else if (typeof GLOBAL.open === 'function') {
|
|
2133
|
+
GLOBAL.open(url, '_system');
|
|
1168
2134
|
}
|
|
1169
2135
|
return;
|
|
1170
2136
|
}
|
|
@@ -1194,7 +2160,7 @@ function openURL(tried, url, timeout) {
|
|
|
1194
2160
|
iframe = createHiddenElement('iframe');
|
|
1195
2161
|
iframe.src = url;
|
|
1196
2162
|
topDocument.body.appendChild(iframe);
|
|
1197
|
-
|
|
2163
|
+
setTimeout(function () {
|
|
1198
2164
|
if (typeof iframe !== 'undefined') {
|
|
1199
2165
|
try {
|
|
1200
2166
|
topDocument.body.removeChild(iframe);
|
|
@@ -1218,9 +2184,12 @@ function openURL(tried, url, timeout) {
|
|
|
1218
2184
|
timeoutId = undefined;
|
|
1219
2185
|
}
|
|
1220
2186
|
try {
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
2187
|
+
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
2188
|
+
EventKit.remove(config.blur.target, config.blur.type, onblur);
|
|
2189
|
+
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
2190
|
+
EventKit.remove(config.focus.target, config.focus.type, onfocus);
|
|
2191
|
+
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2192
|
+
EventKit.remove(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
1224
2193
|
}
|
|
1225
2194
|
catch (_) {
|
|
1226
2195
|
}
|
|
@@ -1254,8 +2223,10 @@ function openURL(tried, url, timeout) {
|
|
|
1254
2223
|
clearTimeout(timeoutId);
|
|
1255
2224
|
timeoutId = undefined;
|
|
1256
2225
|
}
|
|
1257
|
-
|
|
1258
|
-
|
|
2226
|
+
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
2227
|
+
EventKit.remove(config.blur.target, config.blur.type, onblur);
|
|
2228
|
+
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
2229
|
+
EventKit.add(config.focus.target, config.focus.type, onfocus);
|
|
1259
2230
|
}
|
|
1260
2231
|
function onfocus() {
|
|
1261
2232
|
done(true);
|
|
@@ -1266,11 +2237,13 @@ function openURL(tried, url, timeout) {
|
|
|
1266
2237
|
else
|
|
1267
2238
|
onfocus();
|
|
1268
2239
|
}
|
|
1269
|
-
timeoutId =
|
|
2240
|
+
timeoutId = setTimeout(function () {
|
|
1270
2241
|
done(false);
|
|
1271
2242
|
}, timeout);
|
|
1272
|
-
|
|
1273
|
-
|
|
2243
|
+
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
2244
|
+
EventKit.add(config.blur.target, config.blur.type, onblur);
|
|
2245
|
+
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2246
|
+
EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
1274
2247
|
if (!hasFocus(topDocument))
|
|
1275
2248
|
restoreFocus();
|
|
1276
2249
|
try {
|
|
@@ -1472,13 +2445,22 @@ function isFullyBlockedInAppBrowser() {
|
|
|
1472
2445
|
function isPartnerAppOnly() {
|
|
1473
2446
|
return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
|
|
1474
2447
|
}
|
|
2448
|
+
function canOpenWindowsSetting(version) {
|
|
2449
|
+
if (version.length === 0)
|
|
2450
|
+
return false;
|
|
2451
|
+
if (/^\d/.test(version) === false)
|
|
2452
|
+
return false;
|
|
2453
|
+
if (version === '95' || version === '98' || version === '2000')
|
|
2454
|
+
return false;
|
|
2455
|
+
return PlatformKit.compareVersion(version, '10') >= 0;
|
|
2456
|
+
}
|
|
1475
2457
|
function canOpenSetting() {
|
|
1476
2458
|
var os = PlatformKit.os.name;
|
|
1477
2459
|
var version = PlatformKit.os.version;
|
|
1478
2460
|
return !(os === 'unknown'
|
|
1479
2461
|
|| (os === 'android' && !canOpenIntent())
|
|
1480
2462
|
|| os === 'ios'
|
|
1481
|
-
|| (os === 'windows' && (version
|
|
2463
|
+
|| (os === 'windows' && !canOpenWindowsSetting(version))
|
|
1482
2464
|
|| (os === 'macos' && PlatformKit.compareVersion(version, '10.10') < 0));
|
|
1483
2465
|
}
|
|
1484
2466
|
function parseIntentURL(intent) {
|
|
@@ -1507,7 +2489,7 @@ function parseIntentURL(intent) {
|
|
|
1507
2489
|
if (typeof extras['S.browser_fallback_url'] !== 'undefined') {
|
|
1508
2490
|
var fallback = extras['S.browser_fallback_url'];
|
|
1509
2491
|
try {
|
|
1510
|
-
fallback =
|
|
2492
|
+
fallback = decodeURIComponent(fallback);
|
|
1511
2493
|
}
|
|
1512
2494
|
catch (_) {
|
|
1513
2495
|
}
|
|
@@ -1527,9 +2509,9 @@ function createIntentURL(scheme, packageName, fallback) {
|
|
|
1527
2509
|
if (typeof packageName !== 'undefined')
|
|
1528
2510
|
intent += 'package=' + packageName + ';';
|
|
1529
2511
|
if (typeof fallback !== 'undefined' && typeof fallback === 'string')
|
|
1530
|
-
intent += 'S.browser_fallback_url=' +
|
|
2512
|
+
intent += 'S.browser_fallback_url=' + encodeURIComponent(fallback) + ';';
|
|
1531
2513
|
else if (typeof packageName !== 'undefined')
|
|
1532
|
-
intent += 'S.browser_fallback_url=' +
|
|
2514
|
+
intent += 'S.browser_fallback_url=' + encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
|
|
1533
2515
|
return intent + 'end';
|
|
1534
2516
|
}
|
|
1535
2517
|
function createAppStoreURL(id, os) {
|
|
@@ -1561,7 +2543,7 @@ function createWebStoreURL(id, os) {
|
|
|
1561
2543
|
}
|
|
1562
2544
|
}
|
|
1563
2545
|
function escapeURIComponentString(value) {
|
|
1564
|
-
return
|
|
2546
|
+
return encodeURIComponent(value)
|
|
1565
2547
|
.replace(/[!'()*]/g, function (char) {
|
|
1566
2548
|
return '%' + char.charCodeAt(0).toString(16);
|
|
1567
2549
|
});
|
|
@@ -1630,10 +2612,10 @@ function isUserActivationActive() {
|
|
|
1630
2612
|
return typeof NAVIGATOR !== 'undefined' && typeof NAVIGATOR.userActivation !== 'undefined' && NAVIGATOR.userActivation.isActive;
|
|
1631
2613
|
}
|
|
1632
2614
|
function canShowDirectoryPicker() {
|
|
1633
|
-
return typeof
|
|
2615
|
+
return typeof GLOBAL.showDirectoryPicker === 'function';
|
|
1634
2616
|
}
|
|
1635
2617
|
function canShowOpenFilePicker() {
|
|
1636
|
-
return typeof
|
|
2618
|
+
return typeof GLOBAL.showOpenFilePicker === 'function';
|
|
1637
2619
|
}
|
|
1638
2620
|
function isFileSystemFileHandle(handle) {
|
|
1639
2621
|
return handle.kind === 'file';
|
|
@@ -1701,7 +2683,7 @@ function resolveFile(module) {
|
|
|
1701
2683
|
resolve(fileListToArray(module.files));
|
|
1702
2684
|
}
|
|
1703
2685
|
function onfocus() {
|
|
1704
|
-
|
|
2686
|
+
setTimeout(function () {
|
|
1705
2687
|
if (module.value.length > 0)
|
|
1706
2688
|
done(true);
|
|
1707
2689
|
else
|
|
@@ -1727,10 +2709,12 @@ function resolveFile(module) {
|
|
|
1727
2709
|
}
|
|
1728
2710
|
else {
|
|
1729
2711
|
module.onclick = function () {
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
2712
|
+
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
2713
|
+
EventKit.add(config.focus.target, config.focus.type, onfocus);
|
|
2714
|
+
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2715
|
+
EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
2716
|
+
setTimeout(function () {
|
|
2717
|
+
EventKit.add(topDocument, 'click', onclick);
|
|
1734
2718
|
}, 100);
|
|
1735
2719
|
CLEANUP_INPUT_ELEMENT = function () {
|
|
1736
2720
|
done(false);
|
|
@@ -1740,9 +2724,11 @@ function resolveFile(module) {
|
|
|
1740
2724
|
function cleanup() {
|
|
1741
2725
|
CLEANUP_INPUT_ELEMENT = null;
|
|
1742
2726
|
try {
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
2727
|
+
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
2728
|
+
EventKit.remove(config.focus.target, config.focus.type, onfocus);
|
|
2729
|
+
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2730
|
+
EventKit.remove(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
2731
|
+
EventKit.remove(topDocument, 'click', onclick);
|
|
1746
2732
|
}
|
|
1747
2733
|
catch (_) {
|
|
1748
2734
|
}
|
|
@@ -1812,7 +2798,7 @@ function walk(directory, basePath) {
|
|
|
1812
2798
|
}
|
|
1813
2799
|
var LaunchKit = {
|
|
1814
2800
|
SettingType: SettingType,
|
|
1815
|
-
version: packageJSON$
|
|
2801
|
+
version: packageJSON$3.version,
|
|
1816
2802
|
utils: {
|
|
1817
2803
|
get canOpenIntent() {
|
|
1818
2804
|
return canOpenIntent();
|
|
@@ -1860,7 +2846,12 @@ var LaunchKit = {
|
|
|
1860
2846
|
}
|
|
1861
2847
|
else {
|
|
1862
2848
|
tried[index] = '[function fallback]';
|
|
1863
|
-
|
|
2849
|
+
try {
|
|
2850
|
+
url();
|
|
2851
|
+
}
|
|
2852
|
+
catch (_) {
|
|
2853
|
+
return openURLSequential(index + 1);
|
|
2854
|
+
}
|
|
1864
2855
|
resolve(by);
|
|
1865
2856
|
}
|
|
1866
2857
|
}
|
|
@@ -2033,7 +3024,7 @@ var LaunchKit = {
|
|
|
2033
3024
|
option.id = options.id;
|
|
2034
3025
|
if (typeof options.startIn !== 'undefined')
|
|
2035
3026
|
option.startIn = options.startIn;
|
|
2036
|
-
module =
|
|
3027
|
+
module = GLOBAL.showDirectoryPicker(option);
|
|
2037
3028
|
}
|
|
2038
3029
|
else {
|
|
2039
3030
|
var input = createHiddenElement('input');
|
|
@@ -2071,7 +3062,7 @@ var LaunchKit = {
|
|
|
2071
3062
|
}
|
|
2072
3063
|
}
|
|
2073
3064
|
}
|
|
2074
|
-
module =
|
|
3065
|
+
module = GLOBAL.showOpenFilePicker(option);
|
|
2075
3066
|
}
|
|
2076
3067
|
else {
|
|
2077
3068
|
var input = createHiddenElement('input');
|