web-launch-kit 0.0.3 → 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 +668 -252
- 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 +668 -252
- package/dist/launch-kit.mjs.map +1 -1
- package/dist/launch-kit.umd.js +668 -252
- 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 +7 -4
package/dist/launch-kit.mjs
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
var version$
|
|
1
|
+
var version$3 = "0.0.4";
|
|
2
|
+
var packageJSON$3 = {
|
|
3
|
+
version: version$3};
|
|
4
|
+
|
|
5
|
+
var version$2 = "0.0.5";
|
|
2
6
|
var packageJSON$2 = {
|
|
3
7
|
version: version$2};
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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$
|
|
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,65 +446,59 @@ 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
|
-
var pb = rhs.split('.');
|
|
347
|
-
var length = Math.max(pa.length, pb.length);
|
|
348
|
-
for (var i = 0; i < length; i++) {
|
|
349
|
-
var a = void 0;
|
|
350
|
-
var b = void 0;
|
|
351
|
-
if (i < pa.length)
|
|
352
|
-
a = parseInt(pa[i], 10);
|
|
353
|
-
else
|
|
354
|
-
a = 0;
|
|
355
|
-
if (i < pb.length)
|
|
356
|
-
b = parseInt(pb[i], 10);
|
|
357
|
-
else
|
|
358
|
-
b = 0;
|
|
359
|
-
if (a > b)
|
|
360
|
-
return 1;
|
|
361
|
-
if (a < b)
|
|
362
|
-
return -1;
|
|
363
|
-
}
|
|
364
|
-
return 0;
|
|
475
|
+
return compareVersion(lhs, rhs);
|
|
365
476
|
}
|
|
366
477
|
};
|
|
367
478
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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};
|
|
371
494
|
|
|
495
|
+
var GLOBAL$3 = getGlobal$2();
|
|
372
496
|
var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
|
|
373
497
|
// https://cordova.apache.org/docs/en/latest/cordova/events/events.html
|
|
374
498
|
var CORDOVA_DOCUMENT_EVENTS = ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'];
|
|
375
499
|
// iOS `<video>` fullscreen events have no `on` attribute but are valid on any element exposing `webkitEnterFullscreen` — they must pass through untouched.
|
|
376
500
|
var IOS_VIDEO_FULLSCREEN_EVENTS = ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'];
|
|
377
501
|
var TYPE_ALIAS_MAP = {
|
|
378
|
-
'focus': ['focus', 'focusin'],
|
|
379
|
-
'blur': ['blur', 'focusout'],
|
|
380
502
|
'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
|
|
381
503
|
'fullscreenchange': ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange', 'msfullscreenchange'],
|
|
382
504
|
'fullscreenerror': ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError', 'msfullscreenerror'],
|
|
@@ -424,10 +546,10 @@ function hasOnProperty(host, name) {
|
|
|
424
546
|
}
|
|
425
547
|
function probeHosts(target) {
|
|
426
548
|
var hosts = [target];
|
|
427
|
-
if (typeof
|
|
428
|
-
hosts.push(
|
|
429
|
-
if (target !==
|
|
430
|
-
hosts.push(
|
|
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);
|
|
431
553
|
return hosts;
|
|
432
554
|
}
|
|
433
555
|
function extractVendorPrefix(name) {
|
|
@@ -438,9 +560,9 @@ function extractVendorPrefix(name) {
|
|
|
438
560
|
return '';
|
|
439
561
|
}
|
|
440
562
|
function testStyleSupport(name, styleProperty) {
|
|
441
|
-
if (typeof
|
|
563
|
+
if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
|
|
442
564
|
return false;
|
|
443
|
-
var style =
|
|
565
|
+
var style = GLOBAL$3.document.documentElement.style;
|
|
444
566
|
if (typeof style === 'undefined' || style === null)
|
|
445
567
|
return false;
|
|
446
568
|
var prefix = extractVendorPrefix(name);
|
|
@@ -452,9 +574,9 @@ function testStyleSupport(name, styleProperty) {
|
|
|
452
574
|
return typeof asRecord(style)[property] !== 'undefined';
|
|
453
575
|
}
|
|
454
576
|
function testFullscreenSupport(name) {
|
|
455
|
-
if (typeof
|
|
577
|
+
if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
|
|
456
578
|
return false;
|
|
457
|
-
var element =
|
|
579
|
+
var element = GLOBAL$3.document.documentElement;
|
|
458
580
|
var methods = FULLSCREEN_REQUEST_MAP[extractVendorPrefix(name)];
|
|
459
581
|
if (typeof methods === 'undefined')
|
|
460
582
|
return false;
|
|
@@ -480,7 +602,7 @@ function isEventTypeSupported(target, name) {
|
|
|
480
602
|
return false;
|
|
481
603
|
}
|
|
482
604
|
function resolveEventType(target, type) {
|
|
483
|
-
if (target ===
|
|
605
|
+
if (target === GLOBAL$3.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
|
|
484
606
|
return type;
|
|
485
607
|
if (typeof asRecord(target)['webkitEnterFullscreen'] === 'function' && IOS_VIDEO_FULLSCREEN_EVENTS.indexOf(type) > -1)
|
|
486
608
|
return type;
|
|
@@ -489,10 +611,10 @@ function resolveEventType(target, type) {
|
|
|
489
611
|
if (isEventTypeSupported(target, candidates[i]))
|
|
490
612
|
return candidates[i];
|
|
491
613
|
}
|
|
614
|
+
var hosts = probeHosts(target);
|
|
492
615
|
for (var i = 1; i < VENDORS.length; i++) {
|
|
493
616
|
for (var j = 0; j < candidates.length; j++) {
|
|
494
617
|
var name_1 = VENDORS[i] + candidates[j];
|
|
495
|
-
var hosts = probeHosts(target);
|
|
496
618
|
for (var k = 0; k < hosts.length; k++) {
|
|
497
619
|
if (hasOnProperty(hosts[k], name_1))
|
|
498
620
|
return name_1;
|
|
@@ -502,6 +624,7 @@ function resolveEventType(target, type) {
|
|
|
502
624
|
return type;
|
|
503
625
|
}
|
|
504
626
|
|
|
627
|
+
var GLOBAL$2 = getGlobal$2();
|
|
505
628
|
var SUPPORTED = {
|
|
506
629
|
once: false,
|
|
507
630
|
passive: false,
|
|
@@ -512,16 +635,16 @@ var SUPPORTED = {
|
|
|
512
635
|
var NOOP$1 = function () {
|
|
513
636
|
};
|
|
514
637
|
function resolveProbeTarget() {
|
|
515
|
-
if (typeof
|
|
638
|
+
if (typeof GLOBAL$2.document !== 'undefined' && typeof GLOBAL$2.document.createDocumentFragment === 'function') {
|
|
516
639
|
try {
|
|
517
|
-
return
|
|
640
|
+
return GLOBAL$2.document.createDocumentFragment();
|
|
518
641
|
}
|
|
519
642
|
catch (_) {
|
|
520
643
|
}
|
|
521
644
|
}
|
|
522
|
-
if (typeof
|
|
645
|
+
if (typeof GLOBAL$2.EventTarget === 'function') {
|
|
523
646
|
try {
|
|
524
|
-
return new
|
|
647
|
+
return new GLOBAL$2.EventTarget();
|
|
525
648
|
}
|
|
526
649
|
catch (_) {
|
|
527
650
|
}
|
|
@@ -592,6 +715,7 @@ function toNativeListenerOptions(normalized) {
|
|
|
592
715
|
return normalized.capture;
|
|
593
716
|
}
|
|
594
717
|
|
|
718
|
+
var GLOBAL$1$1 = getGlobal$2();
|
|
595
719
|
var TOUCH_TYPES = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
|
|
596
720
|
var POINTER_PHASE_MAP = {
|
|
597
721
|
'pointerdown': 'start',
|
|
@@ -627,17 +751,17 @@ function findTouchIndex(identifier) {
|
|
|
627
751
|
return -1;
|
|
628
752
|
}
|
|
629
753
|
function scrollOffsetX() {
|
|
630
|
-
if (typeof
|
|
631
|
-
return
|
|
632
|
-
if (typeof
|
|
633
|
-
return
|
|
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;
|
|
634
758
|
return 0;
|
|
635
759
|
}
|
|
636
760
|
function scrollOffsetY() {
|
|
637
|
-
if (typeof
|
|
638
|
-
return
|
|
639
|
-
if (typeof
|
|
640
|
-
return
|
|
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;
|
|
641
765
|
return 0;
|
|
642
766
|
}
|
|
643
767
|
function createSyntheticTouch(event, target) {
|
|
@@ -658,12 +782,20 @@ function createSyntheticTouch(event, target) {
|
|
|
658
782
|
force: typeof event.pressure === 'number' ? event.pressure : 0,
|
|
659
783
|
};
|
|
660
784
|
}
|
|
661
|
-
function defineTouchList(event, property, list) {
|
|
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 });
|
|
662
794
|
try {
|
|
663
795
|
Object.defineProperty(event, property, { value: list, configurable: true });
|
|
664
796
|
}
|
|
665
797
|
catch (_) {
|
|
666
|
-
|
|
798
|
+
holder[property] = list;
|
|
667
799
|
}
|
|
668
800
|
}
|
|
669
801
|
function filterByTarget(touches, target) {
|
|
@@ -674,7 +806,7 @@ function filterByTarget(touches, target) {
|
|
|
674
806
|
}
|
|
675
807
|
return filtered;
|
|
676
808
|
}
|
|
677
|
-
function synthesizeTouchEvent(event, resolvedType) {
|
|
809
|
+
function synthesizeTouchEvent(event, resolvedType, patches) {
|
|
678
810
|
var phase = POINTER_PHASE_MAP[resolvedType];
|
|
679
811
|
if (typeof phase === 'undefined')
|
|
680
812
|
return;
|
|
@@ -693,9 +825,9 @@ function synthesizeTouchEvent(event, resolvedType) {
|
|
|
693
825
|
if (index > -1)
|
|
694
826
|
ACTIVE_TOUCHES.splice(index, 1);
|
|
695
827
|
}
|
|
696
|
-
defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES));
|
|
697
|
-
defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)));
|
|
698
|
-
defineTouchList(event, 'changedTouches', createTouchList([touch]));
|
|
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);
|
|
699
831
|
}
|
|
700
832
|
|
|
701
833
|
var KEY_CODE_MAP = {
|
|
@@ -802,21 +934,50 @@ var KEY_CODE_MAP = {
|
|
|
802
934
|
226: 'IntlBackslash',
|
|
803
935
|
};
|
|
804
936
|
|
|
937
|
+
var GLOBAL$4 = getGlobal$2();
|
|
805
938
|
var LISTENER_STORE = [];
|
|
806
939
|
var NOOP = function () {
|
|
807
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
|
+
}
|
|
808
967
|
function findListenerRecord(target, type, callback, capture) {
|
|
809
|
-
|
|
810
|
-
|
|
968
|
+
var bucket = resolveBucket(target, false);
|
|
969
|
+
for (var i = 0; i < bucket.length; i++) {
|
|
970
|
+
var record = bucket[i];
|
|
811
971
|
if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
|
|
812
972
|
return record;
|
|
813
973
|
}
|
|
814
974
|
return undefined;
|
|
815
975
|
}
|
|
816
976
|
function removeListenerRecord(record) {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
977
|
+
var bucket = record.bucket;
|
|
978
|
+
for (var i = 0; i < bucket.length; i++) {
|
|
979
|
+
if (bucket[i] === record) {
|
|
980
|
+
bucket.splice(i, 1);
|
|
820
981
|
return;
|
|
821
982
|
}
|
|
822
983
|
}
|
|
@@ -836,6 +997,35 @@ function invokeCallback(callback, target, event) {
|
|
|
836
997
|
if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
|
|
837
998
|
return callback.handleEvent(event);
|
|
838
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);
|
|
1021
|
+
else
|
|
1022
|
+
delete holder[patch.property];
|
|
1023
|
+
}
|
|
1024
|
+
catch (_) {
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
patches.length = 0;
|
|
1028
|
+
}
|
|
839
1029
|
function defineEventProperty(event, property, value) {
|
|
840
1030
|
try {
|
|
841
1031
|
Object.defineProperty(event, property, { value: value, configurable: true });
|
|
@@ -868,7 +1058,7 @@ function fixKeyboardEvent(event) {
|
|
|
868
1058
|
function createDispatcher(record) {
|
|
869
1059
|
return function (event) {
|
|
870
1060
|
if (typeof event === 'undefined')
|
|
871
|
-
event =
|
|
1061
|
+
event = GLOBAL$4.event; // IE: implicit global event object
|
|
872
1062
|
if (typeof event === 'undefined' || event === null)
|
|
873
1063
|
return;
|
|
874
1064
|
if (record.released)
|
|
@@ -876,14 +1066,20 @@ function createDispatcher(record) {
|
|
|
876
1066
|
fixLegacyEvent(event, record.target);
|
|
877
1067
|
if (record.once)
|
|
878
1068
|
releaseListenerRecord(record);
|
|
1069
|
+
var patches = [];
|
|
879
1070
|
if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
|
|
880
|
-
event
|
|
1071
|
+
patchEventProperty(event, 'preventDefault', passivePreventDefault.bind(event), patches);
|
|
881
1072
|
if (record.resolvedType !== record.type)
|
|
882
|
-
|
|
1073
|
+
patchEventProperty(event, 'type', record.type, patches);
|
|
883
1074
|
if (record.touch)
|
|
884
|
-
synthesizeTouchEvent(event, record.resolvedType);
|
|
1075
|
+
synthesizeTouchEvent(event, record.resolvedType, patches);
|
|
885
1076
|
fixKeyboardEvent(event);
|
|
886
|
-
|
|
1077
|
+
try {
|
|
1078
|
+
invokeCallback(record.callback, record.target, event);
|
|
1079
|
+
}
|
|
1080
|
+
finally {
|
|
1081
|
+
restoreEventProperties(event, patches);
|
|
1082
|
+
}
|
|
887
1083
|
};
|
|
888
1084
|
}
|
|
889
1085
|
function attachNativeListener(record) {
|
|
@@ -917,7 +1113,7 @@ function releaseListenerRecord(record) {
|
|
|
917
1113
|
}
|
|
918
1114
|
if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
|
|
919
1115
|
try {
|
|
920
|
-
record.signal.removeEventListener('abort', record.onAbort);
|
|
1116
|
+
record.signal.removeEventListener('abort', record.onAbort, false);
|
|
921
1117
|
}
|
|
922
1118
|
catch (_) {
|
|
923
1119
|
}
|
|
@@ -930,7 +1126,7 @@ function createEventPolyfill(type, init) {
|
|
|
930
1126
|
}
|
|
931
1127
|
catch (_) {
|
|
932
1128
|
}
|
|
933
|
-
var event =
|
|
1129
|
+
var event = GLOBAL$4.document.createEvent('Event');
|
|
934
1130
|
event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
|
|
935
1131
|
return event;
|
|
936
1132
|
}
|
|
@@ -940,12 +1136,12 @@ function createCustomEventPolyfill(type, init) {
|
|
|
940
1136
|
}
|
|
941
1137
|
catch (_) {
|
|
942
1138
|
}
|
|
943
|
-
var event =
|
|
1139
|
+
var event = GLOBAL$4.document.createEvent('CustomEvent');
|
|
944
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);
|
|
945
1141
|
return event;
|
|
946
1142
|
}
|
|
947
1143
|
var EventKit = {
|
|
948
|
-
version: packageJSON.version,
|
|
1144
|
+
version: packageJSON$1.version,
|
|
949
1145
|
utils: {
|
|
950
1146
|
get supportedOptions() {
|
|
951
1147
|
return {
|
|
@@ -969,15 +1165,16 @@ var EventKit = {
|
|
|
969
1165
|
return NOOP;
|
|
970
1166
|
var normalized = normalizeListenerOptions(options);
|
|
971
1167
|
var existing = findListenerRecord(target, type, callback, normalized.capture);
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
}
|
|
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;
|
|
977
1172
|
if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
|
|
978
1173
|
return NOOP;
|
|
979
1174
|
var resolvedType = resolveEventType(target, type);
|
|
1175
|
+
var bucket = resolveBucket(target, true);
|
|
980
1176
|
var record = {
|
|
1177
|
+
bucket: bucket,
|
|
981
1178
|
target: target,
|
|
982
1179
|
type: type,
|
|
983
1180
|
callback: callback,
|
|
@@ -994,12 +1191,14 @@ var EventKit = {
|
|
|
994
1191
|
record.wrapper = createDispatcher(record);
|
|
995
1192
|
if (!attachNativeListener(record))
|
|
996
1193
|
return NOOP;
|
|
997
|
-
|
|
1194
|
+
bucket.push(record);
|
|
998
1195
|
if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
|
|
999
1196
|
record.onAbort = function () {
|
|
1000
1197
|
releaseListenerRecord(record);
|
|
1001
1198
|
};
|
|
1002
|
-
|
|
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);
|
|
1003
1202
|
}
|
|
1004
1203
|
return function () {
|
|
1005
1204
|
releaseListenerRecord(record);
|
|
@@ -1024,9 +1223,22 @@ var EventKit = {
|
|
|
1024
1223
|
},
|
|
1025
1224
|
};
|
|
1026
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
|
+
|
|
1027
1238
|
function createHiddenElement(tagName, focusable) {
|
|
1028
1239
|
if (focusable === void 0) { focusable = true; }
|
|
1029
|
-
var
|
|
1240
|
+
var document = getGlobal$1().document;
|
|
1241
|
+
var element = document.createElement(tagName);
|
|
1030
1242
|
if (typeof element.width !== 'undefined')
|
|
1031
1243
|
element.width = '0';
|
|
1032
1244
|
if (typeof element.height !== 'undefined')
|
|
@@ -1077,116 +1289,301 @@ function createHiddenElement(tagName, focusable) {
|
|
|
1077
1289
|
return element;
|
|
1078
1290
|
}
|
|
1079
1291
|
|
|
1080
|
-
var
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
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')
|
|
1085
1333
|
return null;
|
|
1086
|
-
|
|
1087
|
-
if (
|
|
1088
|
-
return 'en-US';
|
|
1089
|
-
if (locale.indexOf('.') !== -1)
|
|
1090
|
-
return normalizeLocale(locale.split('.')[0]);
|
|
1091
|
-
if (locale.indexOf('@') !== -1)
|
|
1092
|
-
return normalizeLocale(locale.split('@')[0]);
|
|
1093
|
-
var parts = locale.split('-');
|
|
1094
|
-
if (parts.length === 0)
|
|
1334
|
+
var value = raw.replace(/_/g, '-');
|
|
1335
|
+
if (value.length === 0)
|
|
1095
1336
|
return null;
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
if (
|
|
1100
|
-
|
|
1101
|
-
|
|
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)
|
|
1346
|
+
return null;
|
|
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
|
+
};
|
|
1102
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);
|
|
1464
|
+
}
|
|
1465
|
+
var subtags = null;
|
|
1103
1466
|
var language = null;
|
|
1104
|
-
var languages = [];
|
|
1467
|
+
var languages = freeze([]);
|
|
1468
|
+
var fallbacks = freeze([]);
|
|
1105
1469
|
var timezone = null;
|
|
1106
1470
|
var offset = 0;
|
|
1107
|
-
var
|
|
1108
|
-
function
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
if (
|
|
1116
|
-
|
|
1117
|
-
|
|
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
|
+
}
|
|
1118
1510
|
}
|
|
1511
|
+
return candidates;
|
|
1119
1512
|
}
|
|
1513
|
+
var ENVIRONMENT_LANGUAGES = collectEnvironmentLanguages();
|
|
1514
|
+
resolveLanguages(ENVIRONMENT_LANGUAGES);
|
|
1120
1515
|
if (typeof Intl !== 'undefined') {
|
|
1121
|
-
try {
|
|
1122
|
-
addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
1123
|
-
}
|
|
1124
|
-
catch (_) {
|
|
1125
|
-
}
|
|
1126
1516
|
try {
|
|
1127
1517
|
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1128
1518
|
}
|
|
1129
1519
|
catch (_) {
|
|
1130
1520
|
}
|
|
1131
1521
|
}
|
|
1132
|
-
if (typeof globalThis.navigator !== 'undefined') {
|
|
1133
|
-
if (typeof globalThis.navigator.languages !== 'undefined')
|
|
1134
|
-
addLanguages(globalThis.navigator.languages);
|
|
1135
|
-
if (typeof globalThis.navigator.language !== 'undefined')
|
|
1136
|
-
addLanguage(globalThis.navigator.language);
|
|
1137
|
-
if (typeof globalThis.navigator.userLanguage !== 'undefined')
|
|
1138
|
-
addLanguage(globalThis.navigator.userLanguage);
|
|
1139
|
-
if (typeof globalThis.navigator.browserLanguage !== 'undefined')
|
|
1140
|
-
addLanguage(globalThis.navigator.browserLanguage);
|
|
1141
|
-
if (typeof globalThis.navigator.systemLanguage !== 'undefined')
|
|
1142
|
-
addLanguage(globalThis.navigator.systemLanguage);
|
|
1143
|
-
}
|
|
1144
1522
|
try {
|
|
1145
1523
|
offset = new Date().getTimezoneOffset() * -1;
|
|
1146
1524
|
}
|
|
1147
1525
|
catch (_) {
|
|
1148
1526
|
}
|
|
1149
|
-
if (typeof language === 'string') {
|
|
1150
|
-
if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
|
|
1151
|
-
try {
|
|
1152
|
-
var intlLocale = new Intl.Locale(language);
|
|
1153
|
-
if (typeof intlLocale.getTextInfo === 'function')
|
|
1154
|
-
isRTLResolved = intlLocale.getTextInfo().direction === 'rtl';
|
|
1155
|
-
else if (typeof intlLocale.textInfo !== 'undefined')
|
|
1156
|
-
isRTLResolved = intlLocale.textInfo.direction === 'rtl';
|
|
1157
|
-
}
|
|
1158
|
-
catch (_) {
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
if (typeof isRTLResolved !== 'boolean') {
|
|
1162
|
-
var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(language);
|
|
1163
|
-
if (matched !== null) {
|
|
1164
|
-
var lang = matched[1].toLowerCase();
|
|
1165
|
-
for (var i = 0; i < RTL_LANGUAGES.length; i++) {
|
|
1166
|
-
if (RTL_LANGUAGES[i] === lang) {
|
|
1167
|
-
isRTLResolved = true;
|
|
1168
|
-
break;
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
1527
|
var LocaleKit = {
|
|
1175
|
-
|
|
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);
|
|
1176
1568
|
|
|
1569
|
+
var GLOBAL$1 = getGlobal$1();
|
|
1570
|
+
var CACHE_PREFIX = 'web-launch-kit:';
|
|
1177
1571
|
var TRACK_ID = 'track-id';
|
|
1178
|
-
var
|
|
1572
|
+
var PRODUCT_ID = 'product-id';
|
|
1179
1573
|
var TRACK_ID_CACHE_TTL = 1000 * 60 * 60;
|
|
1574
|
+
function toCacheKey(mode, query) {
|
|
1575
|
+
return CACHE_PREFIX + mode + ':' + query;
|
|
1576
|
+
}
|
|
1180
1577
|
var idCache = (function () {
|
|
1181
1578
|
var supportsLocalStorage;
|
|
1182
1579
|
try {
|
|
1183
|
-
if (typeof
|
|
1580
|
+
if (typeof GLOBAL$1.localStorage === 'undefined' || GLOBAL$1.localStorage === null) {
|
|
1184
1581
|
supportsLocalStorage = false;
|
|
1185
1582
|
}
|
|
1186
1583
|
else {
|
|
1187
1584
|
var key = '__id_cache_test__';
|
|
1188
|
-
|
|
1189
|
-
|
|
1585
|
+
GLOBAL$1.localStorage.setItem(key, '');
|
|
1586
|
+
GLOBAL$1.localStorage.removeItem(key);
|
|
1190
1587
|
supportsLocalStorage = true;
|
|
1191
1588
|
}
|
|
1192
1589
|
}
|
|
@@ -1197,7 +1594,7 @@ var idCache = (function () {
|
|
|
1197
1594
|
return {
|
|
1198
1595
|
get: function (mode, query) {
|
|
1199
1596
|
try {
|
|
1200
|
-
var item =
|
|
1597
|
+
var item = GLOBAL$1.localStorage.getItem(toCacheKey(mode, query));
|
|
1201
1598
|
if (item == null)
|
|
1202
1599
|
return undefined;
|
|
1203
1600
|
var split = item.split('|');
|
|
@@ -1205,7 +1602,7 @@ var idCache = (function () {
|
|
|
1205
1602
|
return undefined;
|
|
1206
1603
|
var expiry = +split[0];
|
|
1207
1604
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
1208
|
-
|
|
1605
|
+
GLOBAL$1.localStorage.removeItem(toCacheKey(mode, query));
|
|
1209
1606
|
return undefined;
|
|
1210
1607
|
}
|
|
1211
1608
|
return split[1];
|
|
@@ -1216,7 +1613,7 @@ var idCache = (function () {
|
|
|
1216
1613
|
},
|
|
1217
1614
|
set: function (mode, query, id) {
|
|
1218
1615
|
try {
|
|
1219
|
-
|
|
1616
|
+
GLOBAL$1.localStorage.setItem(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
|
|
1220
1617
|
}
|
|
1221
1618
|
catch (_) {
|
|
1222
1619
|
return;
|
|
@@ -1224,11 +1621,11 @@ var idCache = (function () {
|
|
|
1224
1621
|
}
|
|
1225
1622
|
};
|
|
1226
1623
|
}
|
|
1227
|
-
if (typeof
|
|
1228
|
-
var cache_1 = new Map();
|
|
1624
|
+
if (typeof GLOBAL$1.Map !== 'undefined') {
|
|
1625
|
+
var cache_1 = new GLOBAL$1.Map();
|
|
1229
1626
|
return {
|
|
1230
1627
|
get: function (mode, query) {
|
|
1231
|
-
var item = cache_1.get(mode
|
|
1628
|
+
var item = cache_1.get(toCacheKey(mode, query));
|
|
1232
1629
|
if (typeof item === 'undefined')
|
|
1233
1630
|
return undefined;
|
|
1234
1631
|
var split = item.split('|');
|
|
@@ -1236,20 +1633,20 @@ var idCache = (function () {
|
|
|
1236
1633
|
return undefined;
|
|
1237
1634
|
var expiry = +split[0];
|
|
1238
1635
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
1239
|
-
cache_1.delete(mode
|
|
1636
|
+
cache_1.delete(toCacheKey(mode, query));
|
|
1240
1637
|
return undefined;
|
|
1241
1638
|
}
|
|
1242
1639
|
return split[1];
|
|
1243
1640
|
},
|
|
1244
1641
|
set: function (mode, query, id) {
|
|
1245
|
-
cache_1.set(mode
|
|
1642
|
+
cache_1.set(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
|
|
1246
1643
|
},
|
|
1247
1644
|
};
|
|
1248
1645
|
}
|
|
1249
1646
|
var cache = Object.create(null);
|
|
1250
1647
|
return {
|
|
1251
1648
|
get: function (mode, query) {
|
|
1252
|
-
var item = cache[mode
|
|
1649
|
+
var item = cache[toCacheKey(mode, query)];
|
|
1253
1650
|
if (typeof item === 'undefined')
|
|
1254
1651
|
return undefined;
|
|
1255
1652
|
var split = item.split('|');
|
|
@@ -1258,17 +1655,17 @@ var idCache = (function () {
|
|
|
1258
1655
|
var expiry = +split[0];
|
|
1259
1656
|
if (isNotANumber(expiry) || expiry < getNow()) {
|
|
1260
1657
|
try {
|
|
1261
|
-
delete cache[mode
|
|
1658
|
+
delete cache[toCacheKey(mode, query)];
|
|
1262
1659
|
}
|
|
1263
1660
|
catch (_) {
|
|
1264
|
-
cache[mode
|
|
1661
|
+
cache[toCacheKey(mode, query)] = undefined;
|
|
1265
1662
|
}
|
|
1266
1663
|
return undefined;
|
|
1267
1664
|
}
|
|
1268
1665
|
return split[1];
|
|
1269
1666
|
},
|
|
1270
1667
|
set: function (mode, query, id) {
|
|
1271
|
-
cache[mode
|
|
1668
|
+
cache[toCacheKey(mode, query)] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
|
|
1272
1669
|
}
|
|
1273
1670
|
};
|
|
1274
1671
|
})();
|
|
@@ -1282,8 +1679,8 @@ function getNow() {
|
|
|
1282
1679
|
}
|
|
1283
1680
|
function requestGet(url, async) {
|
|
1284
1681
|
if (async === void 0) { async = false; }
|
|
1285
|
-
if (typeof
|
|
1286
|
-
return
|
|
1682
|
+
if (typeof GLOBAL$1.fetch === 'function' && async) {
|
|
1683
|
+
return GLOBAL$1.fetch(url)
|
|
1287
1684
|
.then(function (response) {
|
|
1288
1685
|
return response.json();
|
|
1289
1686
|
})
|
|
@@ -1326,10 +1723,10 @@ function resolveGetProductIdURL(packageFamilyName) {
|
|
|
1326
1723
|
if (locale === candidate)
|
|
1327
1724
|
break;
|
|
1328
1725
|
}
|
|
1329
|
-
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';
|
|
1330
1727
|
}
|
|
1331
1728
|
function resolveGetTrackIdURL(bundleId) {
|
|
1332
|
-
return 'https://itunes.apple.com/lookup?bundleId=' +
|
|
1729
|
+
return 'https://itunes.apple.com/lookup?bundleId=' + encodeURIComponent(bundleId);
|
|
1333
1730
|
}
|
|
1334
1731
|
function parseGetProductIdResponse(response) {
|
|
1335
1732
|
if (typeof response === 'undefined')
|
|
@@ -1355,14 +1752,14 @@ function parseGetTrackIdResponse(response) {
|
|
|
1355
1752
|
return '' + result.trackId;
|
|
1356
1753
|
}
|
|
1357
1754
|
function getProductId(packageFamilyName) {
|
|
1358
|
-
var cache = idCache.get(
|
|
1755
|
+
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
1359
1756
|
if (typeof cache !== 'undefined')
|
|
1360
1757
|
return cache;
|
|
1361
1758
|
try {
|
|
1362
1759
|
var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName)));
|
|
1363
1760
|
if (typeof productId === 'undefined')
|
|
1364
1761
|
return undefined;
|
|
1365
|
-
idCache.set(
|
|
1762
|
+
idCache.set(PRODUCT_ID, packageFamilyName, productId);
|
|
1366
1763
|
return productId;
|
|
1367
1764
|
}
|
|
1368
1765
|
catch (_) {
|
|
@@ -1385,7 +1782,7 @@ function getTrackId(bundleId) {
|
|
|
1385
1782
|
}
|
|
1386
1783
|
}
|
|
1387
1784
|
function getProductIdAsync(packageFamilyName) {
|
|
1388
|
-
var cache = idCache.get(
|
|
1785
|
+
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
1389
1786
|
if (typeof cache !== 'undefined')
|
|
1390
1787
|
return Promise.resolve(cache);
|
|
1391
1788
|
try {
|
|
@@ -1394,7 +1791,7 @@ function getProductIdAsync(packageFamilyName) {
|
|
|
1394
1791
|
.then(function (productId) {
|
|
1395
1792
|
if (typeof productId === 'undefined')
|
|
1396
1793
|
return undefined;
|
|
1397
|
-
idCache.set(
|
|
1794
|
+
idCache.set(PRODUCT_ID, packageFamilyName, productId);
|
|
1398
1795
|
return productId;
|
|
1399
1796
|
});
|
|
1400
1797
|
}
|
|
@@ -1422,15 +1819,16 @@ function getTrackIdAsync(bundleId) {
|
|
|
1422
1819
|
}
|
|
1423
1820
|
|
|
1424
1821
|
function getTopmostWindow() {
|
|
1822
|
+
var globalLike = getGlobal$1();
|
|
1425
1823
|
try {
|
|
1426
|
-
if (
|
|
1427
|
-
void
|
|
1428
|
-
return
|
|
1824
|
+
if (typeof globalLike.top !== 'undefined' && globalLike.top !== null && globalLike.top !== globalLike.window) {
|
|
1825
|
+
void globalLike.top.location.href;
|
|
1826
|
+
return globalLike.top;
|
|
1429
1827
|
}
|
|
1430
1828
|
}
|
|
1431
1829
|
catch (_) {
|
|
1432
1830
|
}
|
|
1433
|
-
return
|
|
1831
|
+
return globalLike;
|
|
1434
1832
|
}
|
|
1435
1833
|
|
|
1436
1834
|
var SettingType;
|
|
@@ -1501,7 +1899,8 @@ var IOS_DEFAULT_TIMEOUT = 2000;
|
|
|
1501
1899
|
var WINDOWS_DEFAULT_TIMEOUT = 750;
|
|
1502
1900
|
var MACOS_DEFAULT_TIMEOUT = 750;
|
|
1503
1901
|
var DEFAULT_TIMEOUT = 750;
|
|
1504
|
-
var
|
|
1902
|
+
var GLOBAL = getGlobal$1();
|
|
1903
|
+
var NAVIGATOR = GLOBAL.navigator;
|
|
1505
1904
|
var CLEANUP_INPUT_ELEMENT = null;
|
|
1506
1905
|
function createTypeGuard(tag) {
|
|
1507
1906
|
return function (value) {
|
|
@@ -1561,7 +1960,7 @@ function isDocumentHidden() {
|
|
|
1561
1960
|
return true;
|
|
1562
1961
|
}
|
|
1563
1962
|
function dispatchClickEvent(element, view) {
|
|
1564
|
-
if (view === void 0) { view =
|
|
1963
|
+
if (view === void 0) { view = GLOBAL; }
|
|
1565
1964
|
var fake;
|
|
1566
1965
|
try {
|
|
1567
1966
|
fake = new MouseEvent('click', {
|
|
@@ -1571,7 +1970,7 @@ function dispatchClickEvent(element, view) {
|
|
|
1571
1970
|
});
|
|
1572
1971
|
}
|
|
1573
1972
|
catch (_) {
|
|
1574
|
-
fake =
|
|
1973
|
+
fake = GLOBAL.document.createEvent('MouseEvents');
|
|
1575
1974
|
fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
1576
1975
|
}
|
|
1577
1976
|
element.dispatchEvent(fake);
|
|
@@ -1599,11 +1998,14 @@ function restoreFocus() {
|
|
|
1599
1998
|
focus(top);
|
|
1600
1999
|
if (hasFocus(topDocument))
|
|
1601
2000
|
return true;
|
|
1602
|
-
|
|
1603
|
-
|
|
2001
|
+
var hadBodyTabIndex = topDocument.body.hasAttribute('tabindex');
|
|
2002
|
+
if (!hadBodyTabIndex)
|
|
2003
|
+
topDocument.body.setAttribute('tabindex', '-1');
|
|
1604
2004
|
focus(topDocument.body);
|
|
1605
2005
|
if (hasFocus(topDocument))
|
|
1606
2006
|
return true;
|
|
2007
|
+
if (!hadBodyTabIndex)
|
|
2008
|
+
topDocument.body.removeAttribute('tabindex');
|
|
1607
2009
|
var input = undefined;
|
|
1608
2010
|
try {
|
|
1609
2011
|
input = createHiddenElement('input');
|
|
@@ -1645,7 +2047,7 @@ function stripURL(value) {
|
|
|
1645
2047
|
function resolveFocusEventConfig() {
|
|
1646
2048
|
var top = getTopmostWindow();
|
|
1647
2049
|
var topDocument = top.document;
|
|
1648
|
-
if (typeof
|
|
2050
|
+
if (typeof GLOBAL.cordova !== 'undefined') {
|
|
1649
2051
|
return {
|
|
1650
2052
|
focus: {
|
|
1651
2053
|
target: topDocument,
|
|
@@ -1683,7 +2085,7 @@ function resolveFocusEventConfig() {
|
|
|
1683
2085
|
};
|
|
1684
2086
|
}
|
|
1685
2087
|
}
|
|
1686
|
-
else if (typeof
|
|
2088
|
+
else if (typeof GLOBAL.document.addEventListener === 'function') {
|
|
1687
2089
|
return {
|
|
1688
2090
|
focus: {
|
|
1689
2091
|
target: top,
|
|
@@ -1723,12 +2125,12 @@ function openURL(tried, url, timeout) {
|
|
|
1723
2125
|
var anchor = undefined;
|
|
1724
2126
|
var iframe = undefined;
|
|
1725
2127
|
function open() {
|
|
1726
|
-
if (typeof
|
|
1727
|
-
if (typeof
|
|
1728
|
-
|
|
2128
|
+
if (typeof GLOBAL.cordova !== 'undefined' && GLOBAL.cordova !== null) {
|
|
2129
|
+
if (typeof GLOBAL.cordova.InAppBrowser !== 'undefined') {
|
|
2130
|
+
GLOBAL.cordova.InAppBrowser.open(url, '_system');
|
|
1729
2131
|
}
|
|
1730
|
-
else {
|
|
1731
|
-
|
|
2132
|
+
else if (typeof GLOBAL.open === 'function') {
|
|
2133
|
+
GLOBAL.open(url, '_system');
|
|
1732
2134
|
}
|
|
1733
2135
|
return;
|
|
1734
2136
|
}
|
|
@@ -1758,7 +2160,7 @@ function openURL(tried, url, timeout) {
|
|
|
1758
2160
|
iframe = createHiddenElement('iframe');
|
|
1759
2161
|
iframe.src = url;
|
|
1760
2162
|
topDocument.body.appendChild(iframe);
|
|
1761
|
-
|
|
2163
|
+
setTimeout(function () {
|
|
1762
2164
|
if (typeof iframe !== 'undefined') {
|
|
1763
2165
|
try {
|
|
1764
2166
|
topDocument.body.removeChild(iframe);
|
|
@@ -1822,7 +2224,7 @@ function openURL(tried, url, timeout) {
|
|
|
1822
2224
|
timeoutId = undefined;
|
|
1823
2225
|
}
|
|
1824
2226
|
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
1825
|
-
EventKit.remove(config.blur.target, config.blur.type,
|
|
2227
|
+
EventKit.remove(config.blur.target, config.blur.type, onblur);
|
|
1826
2228
|
if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
|
|
1827
2229
|
EventKit.add(config.focus.target, config.focus.type, onfocus);
|
|
1828
2230
|
}
|
|
@@ -1835,7 +2237,7 @@ function openURL(tried, url, timeout) {
|
|
|
1835
2237
|
else
|
|
1836
2238
|
onfocus();
|
|
1837
2239
|
}
|
|
1838
|
-
timeoutId =
|
|
2240
|
+
timeoutId = setTimeout(function () {
|
|
1839
2241
|
done(false);
|
|
1840
2242
|
}, timeout);
|
|
1841
2243
|
if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
|
|
@@ -2043,13 +2445,22 @@ function isFullyBlockedInAppBrowser() {
|
|
|
2043
2445
|
function isPartnerAppOnly() {
|
|
2044
2446
|
return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
|
|
2045
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
|
+
}
|
|
2046
2457
|
function canOpenSetting() {
|
|
2047
2458
|
var os = PlatformKit.os.name;
|
|
2048
2459
|
var version = PlatformKit.os.version;
|
|
2049
2460
|
return !(os === 'unknown'
|
|
2050
2461
|
|| (os === 'android' && !canOpenIntent())
|
|
2051
2462
|
|| os === 'ios'
|
|
2052
|
-
|| (os === 'windows' && (version
|
|
2463
|
+
|| (os === 'windows' && !canOpenWindowsSetting(version))
|
|
2053
2464
|
|| (os === 'macos' && PlatformKit.compareVersion(version, '10.10') < 0));
|
|
2054
2465
|
}
|
|
2055
2466
|
function parseIntentURL(intent) {
|
|
@@ -2078,7 +2489,7 @@ function parseIntentURL(intent) {
|
|
|
2078
2489
|
if (typeof extras['S.browser_fallback_url'] !== 'undefined') {
|
|
2079
2490
|
var fallback = extras['S.browser_fallback_url'];
|
|
2080
2491
|
try {
|
|
2081
|
-
fallback =
|
|
2492
|
+
fallback = decodeURIComponent(fallback);
|
|
2082
2493
|
}
|
|
2083
2494
|
catch (_) {
|
|
2084
2495
|
}
|
|
@@ -2098,9 +2509,9 @@ function createIntentURL(scheme, packageName, fallback) {
|
|
|
2098
2509
|
if (typeof packageName !== 'undefined')
|
|
2099
2510
|
intent += 'package=' + packageName + ';';
|
|
2100
2511
|
if (typeof fallback !== 'undefined' && typeof fallback === 'string')
|
|
2101
|
-
intent += 'S.browser_fallback_url=' +
|
|
2512
|
+
intent += 'S.browser_fallback_url=' + encodeURIComponent(fallback) + ';';
|
|
2102
2513
|
else if (typeof packageName !== 'undefined')
|
|
2103
|
-
intent += 'S.browser_fallback_url=' +
|
|
2514
|
+
intent += 'S.browser_fallback_url=' + encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
|
|
2104
2515
|
return intent + 'end';
|
|
2105
2516
|
}
|
|
2106
2517
|
function createAppStoreURL(id, os) {
|
|
@@ -2132,7 +2543,7 @@ function createWebStoreURL(id, os) {
|
|
|
2132
2543
|
}
|
|
2133
2544
|
}
|
|
2134
2545
|
function escapeURIComponentString(value) {
|
|
2135
|
-
return
|
|
2546
|
+
return encodeURIComponent(value)
|
|
2136
2547
|
.replace(/[!'()*]/g, function (char) {
|
|
2137
2548
|
return '%' + char.charCodeAt(0).toString(16);
|
|
2138
2549
|
});
|
|
@@ -2201,10 +2612,10 @@ function isUserActivationActive() {
|
|
|
2201
2612
|
return typeof NAVIGATOR !== 'undefined' && typeof NAVIGATOR.userActivation !== 'undefined' && NAVIGATOR.userActivation.isActive;
|
|
2202
2613
|
}
|
|
2203
2614
|
function canShowDirectoryPicker() {
|
|
2204
|
-
return typeof
|
|
2615
|
+
return typeof GLOBAL.showDirectoryPicker === 'function';
|
|
2205
2616
|
}
|
|
2206
2617
|
function canShowOpenFilePicker() {
|
|
2207
|
-
return typeof
|
|
2618
|
+
return typeof GLOBAL.showOpenFilePicker === 'function';
|
|
2208
2619
|
}
|
|
2209
2620
|
function isFileSystemFileHandle(handle) {
|
|
2210
2621
|
return handle.kind === 'file';
|
|
@@ -2272,7 +2683,7 @@ function resolveFile(module) {
|
|
|
2272
2683
|
resolve(fileListToArray(module.files));
|
|
2273
2684
|
}
|
|
2274
2685
|
function onfocus() {
|
|
2275
|
-
|
|
2686
|
+
setTimeout(function () {
|
|
2276
2687
|
if (module.value.length > 0)
|
|
2277
2688
|
done(true);
|
|
2278
2689
|
else
|
|
@@ -2302,7 +2713,7 @@ function resolveFile(module) {
|
|
|
2302
2713
|
EventKit.add(config.focus.target, config.focus.type, onfocus);
|
|
2303
2714
|
if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
|
|
2304
2715
|
EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
|
|
2305
|
-
|
|
2716
|
+
setTimeout(function () {
|
|
2306
2717
|
EventKit.add(topDocument, 'click', onclick);
|
|
2307
2718
|
}, 100);
|
|
2308
2719
|
CLEANUP_INPUT_ELEMENT = function () {
|
|
@@ -2387,7 +2798,7 @@ function walk(directory, basePath) {
|
|
|
2387
2798
|
}
|
|
2388
2799
|
var LaunchKit = {
|
|
2389
2800
|
SettingType: SettingType,
|
|
2390
|
-
version: packageJSON$
|
|
2801
|
+
version: packageJSON$3.version,
|
|
2391
2802
|
utils: {
|
|
2392
2803
|
get canOpenIntent() {
|
|
2393
2804
|
return canOpenIntent();
|
|
@@ -2435,7 +2846,12 @@ var LaunchKit = {
|
|
|
2435
2846
|
}
|
|
2436
2847
|
else {
|
|
2437
2848
|
tried[index] = '[function fallback]';
|
|
2438
|
-
|
|
2849
|
+
try {
|
|
2850
|
+
url();
|
|
2851
|
+
}
|
|
2852
|
+
catch (_) {
|
|
2853
|
+
return openURLSequential(index + 1);
|
|
2854
|
+
}
|
|
2439
2855
|
resolve(by);
|
|
2440
2856
|
}
|
|
2441
2857
|
}
|
|
@@ -2608,7 +3024,7 @@ var LaunchKit = {
|
|
|
2608
3024
|
option.id = options.id;
|
|
2609
3025
|
if (typeof options.startIn !== 'undefined')
|
|
2610
3026
|
option.startIn = options.startIn;
|
|
2611
|
-
module =
|
|
3027
|
+
module = GLOBAL.showDirectoryPicker(option);
|
|
2612
3028
|
}
|
|
2613
3029
|
else {
|
|
2614
3030
|
var input = createHiddenElement('input');
|
|
@@ -2646,7 +3062,7 @@ var LaunchKit = {
|
|
|
2646
3062
|
}
|
|
2647
3063
|
}
|
|
2648
3064
|
}
|
|
2649
|
-
module =
|
|
3065
|
+
module = GLOBAL.showOpenFilePicker(option);
|
|
2650
3066
|
}
|
|
2651
3067
|
else {
|
|
2652
3068
|
var input = createHiddenElement('input');
|