native-fn 1.0.52 → 1.0.55
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/dist/native.cjs +1 -1
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +1 -1
- package/dist/native.umd.js +1 -1
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +5 -9
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +5 -9
- package/dist/plugin/app/index.umd.js +5 -9
- package/dist/plugin/app/index.umd.min.js +1 -1
- package/dist/plugin/app/src/plugin/theme/types/theme.d.ts +2 -1
- package/dist/plugin/camera/src/plugin/theme/types/theme.d.ts +2 -1
- package/dist/plugin/clipboard/index.cjs +519 -2
- package/dist/plugin/clipboard/index.min.cjs +1 -1
- package/dist/plugin/clipboard/index.min.mjs +1 -1
- package/dist/plugin/clipboard/index.mjs +519 -2
- package/dist/plugin/clipboard/index.umd.js +519 -2
- package/dist/plugin/clipboard/index.umd.min.js +1 -1
- package/dist/plugin/clipboard/src/plugin/theme/types/theme.d.ts +2 -1
- package/dist/plugin/fullscreen/index.cjs +46 -22
- package/dist/plugin/fullscreen/index.min.cjs +1 -1
- package/dist/plugin/fullscreen/index.min.mjs +1 -1
- package/dist/plugin/fullscreen/index.mjs +46 -22
- package/dist/plugin/fullscreen/index.umd.js +46 -22
- package/dist/plugin/fullscreen/index.umd.min.js +1 -1
- package/dist/plugin/fullscreen/src/plugin/theme/types/theme.d.ts +2 -1
- package/dist/plugin/theme/index.cjs +52 -27
- package/dist/plugin/theme/index.d.ts +2 -1
- package/dist/plugin/theme/index.min.cjs +1 -1
- package/dist/plugin/theme/index.min.mjs +1 -1
- package/dist/plugin/theme/index.mjs +52 -27
- package/dist/plugin/theme/index.umd.js +52 -27
- package/dist/plugin/theme/index.umd.min.js +1 -1
- package/dist/plugin/theme/src/plugin/theme/types/theme.d.ts +2 -1
- package/dist/src/plugin/theme/types/theme.d.ts +2 -1
- package/package.json +1 -1
|
@@ -211,6 +211,483 @@
|
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
+
function compareVersion(lhs, rhs) {
|
|
215
|
+
var pa = lhs.split('.');
|
|
216
|
+
var pb = rhs.split('.');
|
|
217
|
+
var length = Math.max(pa.length, pb.length);
|
|
218
|
+
for (var i = 0; i < length; i++) {
|
|
219
|
+
var a = void 0;
|
|
220
|
+
var b = void 0;
|
|
221
|
+
if (i < pa.length)
|
|
222
|
+
a = parseInt(pa[i], 10);
|
|
223
|
+
else
|
|
224
|
+
a = 0;
|
|
225
|
+
if (i < pb.length)
|
|
226
|
+
b = parseInt(pb[i], 10);
|
|
227
|
+
else
|
|
228
|
+
b = 0;
|
|
229
|
+
if (a > b)
|
|
230
|
+
return 1;
|
|
231
|
+
if (a < b)
|
|
232
|
+
return -1;
|
|
233
|
+
}
|
|
234
|
+
return 0;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
var OS;
|
|
238
|
+
(function (OS) {
|
|
239
|
+
OS["Unknown"] = "Unknown";
|
|
240
|
+
OS["Android"] = "Android";
|
|
241
|
+
OS["iOS"] = "iOS";
|
|
242
|
+
OS["Windows"] = "Windows";
|
|
243
|
+
OS["MacOS"] = "MacOS";
|
|
244
|
+
})(OS || (OS = {}));
|
|
245
|
+
var Devices;
|
|
246
|
+
(function (Devices) {
|
|
247
|
+
Devices["Unknown"] = "Unknown";
|
|
248
|
+
Devices["Mobile"] = "Mobile";
|
|
249
|
+
Devices["Desktop"] = "Desktop";
|
|
250
|
+
})(Devices || (Devices = {}));
|
|
251
|
+
var Engines;
|
|
252
|
+
(function (Engines) {
|
|
253
|
+
Engines["Unknown"] = "Unknown";
|
|
254
|
+
Engines["EdgeHTML"] = "EdgeHTML";
|
|
255
|
+
Engines["ArkWeb"] = "ArkWeb";
|
|
256
|
+
Engines["Blink"] = "Blink";
|
|
257
|
+
Engines["Presto"] = "Presto";
|
|
258
|
+
Engines["WebKit"] = "WebKit";
|
|
259
|
+
Engines["Trident"] = "Trident";
|
|
260
|
+
Engines["NetFront"] = "NetFront";
|
|
261
|
+
Engines["KHTML"] = "KHTML";
|
|
262
|
+
Engines["Tasman"] = "Tasman";
|
|
263
|
+
Engines["Gecko"] = "Gecko";
|
|
264
|
+
})(Engines || (Engines = {}));
|
|
265
|
+
var Browsers;
|
|
266
|
+
(function (Browsers) {
|
|
267
|
+
Browsers["Unknown"] = "Unknown";
|
|
268
|
+
Browsers["Chrome"] = "Chrome";
|
|
269
|
+
Browsers["Safari"] = "Safari";
|
|
270
|
+
Browsers["Edge"] = "Edge";
|
|
271
|
+
Browsers["Firefox"] = "Firefox";
|
|
272
|
+
Browsers["Opera"] = "Opera";
|
|
273
|
+
Browsers["IE"] = "IE";
|
|
274
|
+
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
275
|
+
})(Browsers || (Browsers = {}));
|
|
276
|
+
var userAgent = typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' ? navigator.userAgent : '';
|
|
277
|
+
var Platform = {
|
|
278
|
+
device: Devices.Unknown,
|
|
279
|
+
os: OS.Unknown,
|
|
280
|
+
osVersion: '',
|
|
281
|
+
engine: Engines.Unknown,
|
|
282
|
+
engineVersion: '',
|
|
283
|
+
browser: Browsers.Unknown,
|
|
284
|
+
browserVersion: '',
|
|
285
|
+
renderer: getRenderer(),
|
|
286
|
+
userAgent: userAgent,
|
|
287
|
+
isMobile: false,
|
|
288
|
+
isDesktop: false,
|
|
289
|
+
isStandalone: false,
|
|
290
|
+
isWebview: /; ?wv|applewebkit(?!.*safari)/i.test(userAgent),
|
|
291
|
+
isNodeJS: typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined,
|
|
292
|
+
isElectron: (typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(userAgent)),
|
|
293
|
+
isReactNative: typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
|
|
294
|
+
};
|
|
295
|
+
var OS_RESOLVER_MAP = [
|
|
296
|
+
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
297
|
+
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
|
|
298
|
+
[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, OS.Windows, resolveWindowsVersion],
|
|
299
|
+
[/windows nt ?([\d.)]*)(?!.+xbox)/i, OS.Windows, resolveWindowsVersion],
|
|
300
|
+
[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i, OS.Windows, resolveWindowsVersion],
|
|
301
|
+
[/windows ce\/?([\d.]*)/i, OS.Windows, resolveWindowsVersion],
|
|
302
|
+
[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i, OS.iOS, resolveUnderscoreVersion],
|
|
303
|
+
[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i, OS.iOS, resolveUnderscoreVersion],
|
|
304
|
+
[/cfnetwork\/.+darwin/i, OS.iOS, resolveUnderscoreVersion],
|
|
305
|
+
[/mac os x ?([\w. ]*)/i, OS.MacOS, resolveUnderscoreVersion],
|
|
306
|
+
[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i, OS.MacOS, resolveUnderscoreVersion],
|
|
307
|
+
[/droid ([\w.]+)\b.+(android[- ]x86)/i, OS.Android],
|
|
308
|
+
[/android\w*[-\/.; ]?([\d.]*)/i, OS.Android],
|
|
309
|
+
];
|
|
310
|
+
var ENGINE_RESOLVER_MAP = [
|
|
311
|
+
[/windows.+ edge\/([\w.]+)/i, Engines.EdgeHTML],
|
|
312
|
+
[/arkweb\/([\w.]+)/i, Engines.ArkWeb],
|
|
313
|
+
[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i, Engines.Blink],
|
|
314
|
+
[/presto\/([\w.]+)/i, Engines.Presto],
|
|
315
|
+
[/webkit\/([\w.]+)/i, Engines.WebKit],
|
|
316
|
+
[/trident\/([\w.]+)/i, Engines.Trident],
|
|
317
|
+
[/netfront\/([\w.]+)/i, Engines.NetFront],
|
|
318
|
+
[/khtml[\/ ]\(?([\w.]+)/i, Engines.KHTML],
|
|
319
|
+
[/tasman[\/ ]\(?([\w.]+)/i, Engines.Tasman],
|
|
320
|
+
[/rv:([\w.]{1,9})\b.+gecko/i, Engines.Gecko]
|
|
321
|
+
];
|
|
322
|
+
var BROWSER_RESOLVER_MAP = [
|
|
323
|
+
[/\b(?:crmo|crios)\/([\w.]+)/i, Browsers.Chrome],
|
|
324
|
+
[/webview.+edge\/([\w.]+)/i, Browsers.Edge],
|
|
325
|
+
[/edg(?:e|ios|a)?\/([\w.]+)/i, Browsers.Edge],
|
|
326
|
+
[/opera mini\/([-\w.]+)/i, Browsers.Opera],
|
|
327
|
+
[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i, Browsers.Opera],
|
|
328
|
+
[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i, Browsers.Opera],
|
|
329
|
+
[/opios[\/ ]+([\w.]+)/i, Browsers.Opera],
|
|
330
|
+
[/\bop(?:rg)?x\/([\w.]+)/i, Browsers.Opera],
|
|
331
|
+
[/\bopr\/([\w.]+)/i, Browsers.Opera],
|
|
332
|
+
[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i, Browsers.IE],
|
|
333
|
+
[/(?:ms|\()ie ([\w.]+)/i, Browsers.IE],
|
|
334
|
+
[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i, Browsers.IE],
|
|
335
|
+
[/\bfocus\/([\w.]+)/i, Browsers.Firefox],
|
|
336
|
+
[/\bopt\/([\w.]+)/i, Browsers.Opera],
|
|
337
|
+
[/coast\/([\w.]+)/i, Browsers.Opera],
|
|
338
|
+
[/fxios\/([\w.-]+)/i, Browsers.Firefox],
|
|
339
|
+
[/samsungbrowser\/([\w.]+)/i, Browsers.SamsungInternet],
|
|
340
|
+
[/headlesschrome(?:\/([\w.]+)| )/i, Browsers.Chrome],
|
|
341
|
+
[/wv\).+chrome\/([\w.]+).+edgw\//i, Browsers.Edge],
|
|
342
|
+
[/ wv\).+(chrome)\/([\w.]+)/i, Browsers.Chrome],
|
|
343
|
+
[/chrome\/([\w.]+) mobile/i, Browsers.Chrome],
|
|
344
|
+
[/chrome\/v?([\w.]+)/i, Browsers.Chrome],
|
|
345
|
+
[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i, Browsers.Safari],
|
|
346
|
+
[/iphone .*mobile(?:\/\w+ | ?)safari/i, Browsers.Safari],
|
|
347
|
+
[/version\/([\w.,]+) .*safari/i, Browsers.Safari],
|
|
348
|
+
[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i, Browsers.Safari, '1'],
|
|
349
|
+
[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i, Browsers.Firefox],
|
|
350
|
+
[/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
|
|
351
|
+
[/firefox\/([\w.]+)/i, Browsers.Firefox],
|
|
352
|
+
];
|
|
353
|
+
function resolveWindowsVersion(string) {
|
|
354
|
+
if (string === undefined)
|
|
355
|
+
return '';
|
|
356
|
+
var mapped = {
|
|
357
|
+
'4.90': 'ME',
|
|
358
|
+
'NT3.51': 'NT 3.11',
|
|
359
|
+
'NT4.0': 'NT 4.0',
|
|
360
|
+
'NT 5.0': '2000',
|
|
361
|
+
'NT 5.1': 'XP',
|
|
362
|
+
'NT 5.2': 'XP',
|
|
363
|
+
'NT 6.0': 'Vista',
|
|
364
|
+
'NT 6.1': '7',
|
|
365
|
+
'NT 6.2': '8',
|
|
366
|
+
'NT 6.3': '8.1',
|
|
367
|
+
'NT 6.4': '10',
|
|
368
|
+
'NT 10.0': '10',
|
|
369
|
+
'ARM': 'RT'
|
|
370
|
+
}[string];
|
|
371
|
+
if (mapped !== undefined)
|
|
372
|
+
return mapped;
|
|
373
|
+
return string;
|
|
374
|
+
}
|
|
375
|
+
function resolveUnderscoreVersion(string) {
|
|
376
|
+
if (string === undefined)
|
|
377
|
+
return '';
|
|
378
|
+
return string.replace(/_/g, '.');
|
|
379
|
+
}
|
|
380
|
+
function resolveSemanticWindowsVersion(version, defaultValue) {
|
|
381
|
+
if (version.major === 10 && version.minor === 0 && version.build >= 22000)
|
|
382
|
+
return '11';
|
|
383
|
+
if (version.major === 10 && version.minor === 0 && version.build < 22000)
|
|
384
|
+
return '10';
|
|
385
|
+
if (version.major === 6 && version.minor === 3)
|
|
386
|
+
return '8.1';
|
|
387
|
+
if (version.major === 6 && version.minor === 2)
|
|
388
|
+
return '8';
|
|
389
|
+
if (version.major === 6 && version.minor === 1)
|
|
390
|
+
return '7';
|
|
391
|
+
if (version.major === 6 && version.minor === 0)
|
|
392
|
+
return 'Vista';
|
|
393
|
+
if (version.major === 5 && version.minor === 1)
|
|
394
|
+
return 'XP';
|
|
395
|
+
if (version.major === 5 && version.minor === 2)
|
|
396
|
+
return 'XP';
|
|
397
|
+
if (version.major === 5 && version.minor === 0)
|
|
398
|
+
return '2000';
|
|
399
|
+
if (version.major === 4 && version.minor === 90)
|
|
400
|
+
return 'ME';
|
|
401
|
+
if (version.major === 4 && version.minor === 0)
|
|
402
|
+
return 'NT 4.0';
|
|
403
|
+
if (version.major === 3 && version.minor === 51)
|
|
404
|
+
return 'NT 3.11';
|
|
405
|
+
return defaultValue;
|
|
406
|
+
}
|
|
407
|
+
function resolveSemanticDarwinVersion(version, defaultValue) {
|
|
408
|
+
if (version.major >= 24)
|
|
409
|
+
return '' + (version.major - 9) + '.' + version.minor + '.' + version.build;
|
|
410
|
+
if (version.major === 23)
|
|
411
|
+
return '14.' + version.minor + '.' + version.build;
|
|
412
|
+
if (version.major === 22)
|
|
413
|
+
return '13.' + version.minor + '.' + version.build;
|
|
414
|
+
if (version.major === 21)
|
|
415
|
+
return '12.' + version.minor + '.' + version.build;
|
|
416
|
+
if (version.major === 20)
|
|
417
|
+
return '11.' + version.minor + '.' + version.build;
|
|
418
|
+
if (version.major === 19)
|
|
419
|
+
return '10.15.' + version.minor;
|
|
420
|
+
if (version.major === 18)
|
|
421
|
+
return '10.14.' + version.minor;
|
|
422
|
+
if (version.major === 17)
|
|
423
|
+
return '10.13.' + version.minor;
|
|
424
|
+
if (version.major === 16)
|
|
425
|
+
return '10.12.' + version.minor;
|
|
426
|
+
if (version.major === 15)
|
|
427
|
+
return '10.11.' + version.minor;
|
|
428
|
+
if (version.major === 14)
|
|
429
|
+
return '10.10.' + version.minor;
|
|
430
|
+
if (version.major === 13)
|
|
431
|
+
return '10.9.' + version.minor;
|
|
432
|
+
if (version.major >= 5 && version.major <= 12)
|
|
433
|
+
return '10.' + (version.major - 4) + '.' + version.minor;
|
|
434
|
+
return defaultValue;
|
|
435
|
+
}
|
|
436
|
+
function resolveSemanticAndroidVersion(version, defaultValue) {
|
|
437
|
+
if (version.major >= 36)
|
|
438
|
+
return '16';
|
|
439
|
+
if (version.major === 35)
|
|
440
|
+
return '15';
|
|
441
|
+
if (version.major === 34)
|
|
442
|
+
return '14';
|
|
443
|
+
if (version.major === 33)
|
|
444
|
+
return '13';
|
|
445
|
+
if (version.major === 32)
|
|
446
|
+
return '12.1';
|
|
447
|
+
if (version.major === 31)
|
|
448
|
+
return '12';
|
|
449
|
+
if (version.major === 30)
|
|
450
|
+
return '11';
|
|
451
|
+
if (version.major === 29)
|
|
452
|
+
return '10';
|
|
453
|
+
if (version.major === 28)
|
|
454
|
+
return '9';
|
|
455
|
+
if (version.major === 27)
|
|
456
|
+
return '8.1';
|
|
457
|
+
if (version.major === 26)
|
|
458
|
+
return '8.0';
|
|
459
|
+
if (version.major === 25)
|
|
460
|
+
return '7.1';
|
|
461
|
+
if (version.major === 24)
|
|
462
|
+
return '7.0';
|
|
463
|
+
if (version.major === 23)
|
|
464
|
+
return '6.0';
|
|
465
|
+
if (version.major === 22)
|
|
466
|
+
return '5.1';
|
|
467
|
+
if (version.major === 21)
|
|
468
|
+
return '5.0';
|
|
469
|
+
if (version.major === 20)
|
|
470
|
+
return '4.4W';
|
|
471
|
+
if (version.major === 19)
|
|
472
|
+
return '4.4';
|
|
473
|
+
if (version.major === 18)
|
|
474
|
+
return '4.3';
|
|
475
|
+
if (version.major === 17)
|
|
476
|
+
return '4.2';
|
|
477
|
+
if (version.major === 16)
|
|
478
|
+
return '4.1';
|
|
479
|
+
if (version.major === 15)
|
|
480
|
+
return '4.0.3';
|
|
481
|
+
if (version.major === 14)
|
|
482
|
+
return '4.0';
|
|
483
|
+
if (version.major === 13)
|
|
484
|
+
return '3.2';
|
|
485
|
+
if (version.major === 12)
|
|
486
|
+
return '3.1';
|
|
487
|
+
if (version.major === 11)
|
|
488
|
+
return '3.0';
|
|
489
|
+
if (version.major === 10)
|
|
490
|
+
return '2.3.3';
|
|
491
|
+
if (version.major === 9)
|
|
492
|
+
return '2.3';
|
|
493
|
+
if (version.major === 8)
|
|
494
|
+
return '2.2';
|
|
495
|
+
if (version.major === 7)
|
|
496
|
+
return '2.1';
|
|
497
|
+
if (version.major === 6)
|
|
498
|
+
return '2.0.1';
|
|
499
|
+
if (version.major === 5)
|
|
500
|
+
return '2.0';
|
|
501
|
+
if (version.major === 4)
|
|
502
|
+
return '1.6';
|
|
503
|
+
if (version.major === 3)
|
|
504
|
+
return '1.5';
|
|
505
|
+
if (version.major === 2)
|
|
506
|
+
return '1.1';
|
|
507
|
+
if (version.major === 1)
|
|
508
|
+
return '1.0';
|
|
509
|
+
return defaultValue;
|
|
510
|
+
}
|
|
511
|
+
function resolveVersion(string, resolver) {
|
|
512
|
+
if (typeof resolver === 'function')
|
|
513
|
+
return resolver(string);
|
|
514
|
+
if (typeof resolver === 'string')
|
|
515
|
+
return resolver;
|
|
516
|
+
if (string === undefined)
|
|
517
|
+
return '';
|
|
518
|
+
return string;
|
|
519
|
+
}
|
|
520
|
+
function normalizeBrand(entry) {
|
|
521
|
+
if (entry === null || entry === undefined)
|
|
522
|
+
return { brand: '', version: '' };
|
|
523
|
+
if (typeof entry === 'string')
|
|
524
|
+
return { brand: entry, version: '' };
|
|
525
|
+
return { brand: entry.brand, version: entry.version };
|
|
526
|
+
}
|
|
527
|
+
function getRenderer() {
|
|
528
|
+
if (typeof globalThis.document === 'undefined')
|
|
529
|
+
return '';
|
|
530
|
+
var canvas = globalThis.document.createElement('canvas');
|
|
531
|
+
if (typeof canvas.getContext !== 'function')
|
|
532
|
+
return '';
|
|
533
|
+
var context = canvas.getContext('webgl2') || canvas.getContext('experimental-webgl') || canvas.getContext('webgl');
|
|
534
|
+
if (context === null)
|
|
535
|
+
return '';
|
|
536
|
+
if (context instanceof WebGLRenderingContext || 'getParameter' in context && typeof context.getParameter === 'function') {
|
|
537
|
+
var extension = context.getExtension('WEBGL_debug_renderer_info');
|
|
538
|
+
if (extension === null)
|
|
539
|
+
return context.getParameter(context.RENDERER);
|
|
540
|
+
else
|
|
541
|
+
return context.getParameter(extension.UNMASKED_RENDERER_WEBGL);
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
return '';
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
function getIsStandalone(os) {
|
|
548
|
+
if (!('matchMedia' in globalThis))
|
|
549
|
+
return false;
|
|
550
|
+
if (os === OS.iOS)
|
|
551
|
+
return 'standalone' in navigator && !!navigator.standalone;
|
|
552
|
+
return globalThis.matchMedia('(display-mode: standalone)').matches;
|
|
553
|
+
}
|
|
554
|
+
function getSemanticVersion(string) {
|
|
555
|
+
var parts = string.split('.');
|
|
556
|
+
return {
|
|
557
|
+
major: parseInt(parts[0] || '0'),
|
|
558
|
+
minor: parseInt(parts[1] || '0'),
|
|
559
|
+
build: parseInt(parts[2] || '0')
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
for (var i = 0; i < OS_RESOLVER_MAP.length; i++) {
|
|
563
|
+
var map = OS_RESOLVER_MAP[i];
|
|
564
|
+
var regexp = map[0];
|
|
565
|
+
var os = map[1];
|
|
566
|
+
var resolver = map[2];
|
|
567
|
+
var matched = Platform.userAgent.match(regexp);
|
|
568
|
+
if (matched !== null) {
|
|
569
|
+
Platform.os = os;
|
|
570
|
+
Platform.osVersion = resolveVersion(matched[1], resolver);
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
if (Platform.os === OS.iOS && compareVersion(Platform.osVersion, '18.6') === 0) {
|
|
575
|
+
var version = /\) Version\/([\d.]+)/.exec(Platform.userAgent);
|
|
576
|
+
if (version !== null && parseInt(version[1].substring(0, 2), 10) >= 26)
|
|
577
|
+
Platform.osVersion = version[1];
|
|
578
|
+
}
|
|
579
|
+
for (var i = 0; i < ENGINE_RESOLVER_MAP.length; i++) {
|
|
580
|
+
var map = ENGINE_RESOLVER_MAP[i];
|
|
581
|
+
var regexp = map[0];
|
|
582
|
+
var engine = map[1];
|
|
583
|
+
var resolver = map[2];
|
|
584
|
+
var matched = Platform.userAgent.match(regexp);
|
|
585
|
+
if (matched !== null) {
|
|
586
|
+
Platform.engine = engine;
|
|
587
|
+
Platform.engineVersion = resolveVersion(matched[1], resolver);
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
for (var i = 0; i < BROWSER_RESOLVER_MAP.length; i++) {
|
|
592
|
+
var map = BROWSER_RESOLVER_MAP[i];
|
|
593
|
+
var regexp = map[0];
|
|
594
|
+
var browser = map[1];
|
|
595
|
+
var resolver = map[2];
|
|
596
|
+
var matched = Platform.userAgent.match(regexp);
|
|
597
|
+
if (matched !== null) {
|
|
598
|
+
Platform.browser = browser;
|
|
599
|
+
Platform.browserVersion = resolveVersion(matched[1], resolver);
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
if (Platform.isReactNative) {
|
|
604
|
+
try {
|
|
605
|
+
var reactNative = require('react-native');
|
|
606
|
+
var platform = reactNative.Platform;
|
|
607
|
+
var os = platform.OS;
|
|
608
|
+
var release = '' + platform.Version;
|
|
609
|
+
var version = getSemanticVersion(release);
|
|
610
|
+
switch (os) {
|
|
611
|
+
case 'android':
|
|
612
|
+
Platform.os = OS.Android;
|
|
613
|
+
Platform.osVersion = resolveSemanticAndroidVersion(version, release);
|
|
614
|
+
break;
|
|
615
|
+
case 'ios':
|
|
616
|
+
Platform.os = OS.iOS;
|
|
617
|
+
Platform.osVersion = release;
|
|
618
|
+
break;
|
|
619
|
+
case 'windows':
|
|
620
|
+
Platform.os = OS.Windows;
|
|
621
|
+
Platform.osVersion = resolveSemanticWindowsVersion(version, release);
|
|
622
|
+
break;
|
|
623
|
+
case 'macos':
|
|
624
|
+
Platform.os = OS.MacOS;
|
|
625
|
+
Platform.osVersion = release;
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
catch (_) {
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (Platform.isNodeJS) {
|
|
633
|
+
try {
|
|
634
|
+
var os = require('os');
|
|
635
|
+
var platform = os.platform();
|
|
636
|
+
var release = os.release();
|
|
637
|
+
var version = getSemanticVersion(release);
|
|
638
|
+
switch (platform) {
|
|
639
|
+
case 'win32':
|
|
640
|
+
Platform.os = OS.Windows;
|
|
641
|
+
Platform.osVersion = resolveSemanticWindowsVersion(version, release);
|
|
642
|
+
break;
|
|
643
|
+
case 'darwin':
|
|
644
|
+
Platform.os = OS.MacOS;
|
|
645
|
+
Platform.osVersion = resolveSemanticDarwinVersion(version, release);
|
|
646
|
+
break;
|
|
647
|
+
case 'android':
|
|
648
|
+
Platform.os = OS.Android;
|
|
649
|
+
Platform.osVersion = release;
|
|
650
|
+
break;
|
|
651
|
+
case 'linux':
|
|
652
|
+
if (/android/i.test(release)) {
|
|
653
|
+
Platform.os = OS.Android;
|
|
654
|
+
Platform.osVersion = release;
|
|
655
|
+
}
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
catch (_) {
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
if (navigator.userAgentData !== undefined && navigator.userAgentData.getHighEntropyValues !== undefined) {
|
|
663
|
+
navigator
|
|
664
|
+
.userAgentData
|
|
665
|
+
.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
666
|
+
.then(function (result) {
|
|
667
|
+
var brands = result.fullVersionList || result.brands || [];
|
|
668
|
+
var platformVersion = result.platformVersion;
|
|
669
|
+
for (var i = 0; i < brands.length; i++) {
|
|
670
|
+
var brand = normalizeBrand(brands[i]);
|
|
671
|
+
var brandName = brand.brand;
|
|
672
|
+
var brandVersion = brand.version;
|
|
673
|
+
if (/not.a.brand/i.test(brandName))
|
|
674
|
+
continue;
|
|
675
|
+
if (brandName === "Chromium")
|
|
676
|
+
Platform.engineVersion = brandVersion;
|
|
677
|
+
}
|
|
678
|
+
if (typeof platformVersion === 'string') {
|
|
679
|
+
if (Platform.os === OS.Windows && parseInt(platformVersion.replace(/[^\d.]/g, '').split('.')[0], 10) >= 13)
|
|
680
|
+
Platform.osVersion = '11';
|
|
681
|
+
else
|
|
682
|
+
Platform.osVersion = platformVersion;
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
Platform.device = Platform.os === OS.iOS || Platform.os === OS.Android ? Devices.Mobile : Platform.os === OS.Windows || Platform.os === OS.MacOS ? Devices.Desktop : Devices.Unknown;
|
|
687
|
+
Platform.isMobile = Platform.device === Devices.Mobile;
|
|
688
|
+
Platform.isDesktop = Platform.device === Devices.Desktop;
|
|
689
|
+
Platform.isStandalone = getIsStandalone(Platform.os);
|
|
690
|
+
|
|
214
691
|
function isObject(item) {
|
|
215
692
|
return item !== null && typeof item === 'object';
|
|
216
693
|
}
|
|
@@ -251,7 +728,10 @@
|
|
|
251
728
|
}
|
|
252
729
|
function copy(item) {
|
|
253
730
|
var text = convertToString(item);
|
|
254
|
-
if (
|
|
731
|
+
if (Platform.isElectron) {
|
|
732
|
+
return copyViaElectron(text);
|
|
733
|
+
}
|
|
734
|
+
else if (supportsClipboardWriteAPI()) {
|
|
255
735
|
return copyViaClipboardAPI(text)
|
|
256
736
|
.then(function (success) {
|
|
257
737
|
if (success)
|
|
@@ -264,6 +744,24 @@
|
|
|
264
744
|
}
|
|
265
745
|
return Promise.resolve(copyViaLegacy(text));
|
|
266
746
|
}
|
|
747
|
+
function copyViaElectron(text) {
|
|
748
|
+
try {
|
|
749
|
+
var electron_1 = require('electron');
|
|
750
|
+
return new Promise(function (resolve) {
|
|
751
|
+
try {
|
|
752
|
+
electron_1.clipboard.writeText(text);
|
|
753
|
+
electron_1.clipboard.writeHTML(text);
|
|
754
|
+
resolve(true);
|
|
755
|
+
}
|
|
756
|
+
catch (_) {
|
|
757
|
+
resolve(false);
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
catch (_) {
|
|
762
|
+
return Promise.resolve(false);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
267
765
|
function copyViaClipboardAPI(text) {
|
|
268
766
|
try {
|
|
269
767
|
if ('ClipboardItem' in window && 'write' in navigator.clipboard) {
|
|
@@ -357,7 +855,10 @@
|
|
|
357
855
|
return copyViaSelection(text) || copyViaClipboardData(text);
|
|
358
856
|
}
|
|
359
857
|
function paste() {
|
|
360
|
-
if (
|
|
858
|
+
if (Platform.isElectron) {
|
|
859
|
+
return pasteViaElectron();
|
|
860
|
+
}
|
|
861
|
+
else if (supportsClipboardReadAPI()) {
|
|
361
862
|
return pasteViaClipboardAPI()
|
|
362
863
|
.then(function (text) {
|
|
363
864
|
if (text !== null)
|
|
@@ -370,6 +871,22 @@
|
|
|
370
871
|
}
|
|
371
872
|
return Promise.resolve(pasteViaLegacy());
|
|
372
873
|
}
|
|
874
|
+
function pasteViaElectron() {
|
|
875
|
+
try {
|
|
876
|
+
var electron_2 = require('electron');
|
|
877
|
+
return new Promise(function (resolve) {
|
|
878
|
+
try {
|
|
879
|
+
resolve(electron_2.clipboard.readHTML() || electron_2.clipboard.readText());
|
|
880
|
+
}
|
|
881
|
+
catch (_) {
|
|
882
|
+
resolve('');
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
catch (_) {
|
|
887
|
+
return Promise.resolve('');
|
|
888
|
+
}
|
|
889
|
+
}
|
|
373
890
|
function pasteViaClipboardAPI() {
|
|
374
891
|
try {
|
|
375
892
|
if ('ClipboardItem' in window && 'read' in navigator.clipboard) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Clipboard=t()}(this,(function(){"use strict";function e(e,t){if(void 0===t&&(t=!0),void 0!==globalThis.document){var n=globalThis.document.createElement(e);return"width"in n&&(n.width="0"),"height"in n&&(n.height="0"),"border"in n&&(n.border="0"),"frameBorder"in n&&(n.frameBorder="0"),"scrolling"in n&&(n.scrolling="no"),"cellPadding"in n&&(n.cellPadding="0"),"cellSpacing"in n&&(n.cellSpacing="0"),"frame"in n&&(n.frame="void"),"rules"in n&&(n.rules="none"),"noWrap"in n&&(n.noWrap=!0),n.tabIndex=-1,n.setAttribute("role","presentation"),t?(n.style.width="1px",n.style.height="1px"):(n.setAttribute("aria-hidden","true"),n.style.width="0",n.style.height="0",n.style.zIndex="-9999",n.style.display="none",n.style.visibility="hidden",n.style.pointerEvents="none"),n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.padding="0",n.style.margin="0",n.style.border="none",n.style.outline="none",n.style.clip="rect(1px, 1px, 1px, 1px)",n.style.clipPath="inset(50%)",n.style.overflow="hidden",n.style.whiteSpace="nowrap",n}}function t(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r="",o=0;o<t.length-2;o++){var i=t[o];void 0!==i&&(r=r+i.charAt(0).toUpperCase()+i.slice(1))}return r}function n(){this.returnValue=!1}function r(){this.cancelBubble=!0}var o=/(animation)(start|iteration|end|cancel)|(transition)(start|run|end|cancel)|(fullscreen)(change|error)|(lost|got)(pointer)(capture)|(pointer)(lock)(change|error)|(pointer)(cancel|down|enter|leave|move|out|over|up)/i,i=["","webkit","moz","ms","MS","o","O"],a={wheel:["wheel","mousewheel","DOMMouseScroll"],focus:["focus","focusin"],blur:["blur","focusout"],beforeinput:["beforeinput","textInput"]},l={useStd:void 0!==globalThis.document&&"function"==typeof globalThis.document.addEventListener,add:function(e,t){void 0===t&&(t={callback:null,options:!1});var o=t.callback;if(void 0!==e&&null!==o){var i=l.withVender(e,t.type),a=t.options;if("function"==typeof e.addEventListener)try{return e.addEventListener(i,o,a)}catch(e){}if("function"==typeof e.addListener)if("boolean"==typeof e.matches)try{return e.addListener(o)}catch(e){}else try{return e.addListener(i,o)}catch(e){}return"function"==typeof e.attachEvent?o.__ieWrapper?e.attachEvent("on"+i,o.__ieWrapper):e.attachEvent("on"+i,o.__ieWrapper=function(t){void 0===t&&(t=globalThis.event),void 0!==t&&(t.currentTarget=e,"function"!=typeof t.preventDefault&&(t.preventDefault=n),"function"!=typeof t.stopPropagation&&(t.stopPropagation=r),"function"==typeof o?o.call(e,t):o&&"function"==typeof o.handleEvent&&o.handleEvent.call(e,t))}):void 0}},remove:function(e,t){void 0===t&&(t={callback:null,options:!1});var n=t.callback;if(void 0!==e&&null!==n){var r=l.withVender(e,t.type),o=t.options;if("function"==typeof e.removeEventListener)try{return e.removeEventListener(r,n,o)}catch(e){}if("function"==typeof e.removeListener)if("boolean"==typeof e.matches)try{return e.removeListener(n)}catch(e){}else try{return e.removeListener(r,n)}catch(e){}if("function"!=typeof e.detachEvent);else{var i=n.__ieWrapper;void 0!==i&&(e.detachEvent("on"+r,i),delete n.__ieWrapper)}}},withVender:function(e,n){if(void 0===n)return"";if("webkitEnterFullscreen"in e&&["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"].indexOf(n)>-1)return n;var r;r=n in a?a[n]:o.test(n)?[n,n.replace(o,t)]:[n];for(var l=0;l<i.length;l++)for(var c=0;c<r.length;c++){var u=i[l]+r[c];if(void 0!==e["on"+u])return u}return""}};function c(e){return null!==e&&"object"==typeof e}function u(e){return c(e)||function(e){return Array.isArray(e)}(e)}function s(e){if(function(e){return c(e)&&"innerHTML"in e}(e))return e.innerHTML;if(u(e))try{return JSON.stringify(e)}catch(t){return""+e}else if("string"!=typeof e)return""+e;return e}function d(){return function(){if("isSecureContext"in window)return globalThis.isSecureContext;var e=location.protocol,t=location.hostname;return"https:"===e||"localhost"===t||"127.0.0.1"===t||"[::1]"===t}()&&"undefined"!=typeof navigator&&"clipboard"in navigator}function f(t){return function(t){if(!globalThis.getSelection||!globalThis.document.createRange)return!1;var n=e("div");if(void 0===n)return!1;n.contentEditable="true",n.innerHTML=t,n.style.whiteSpace="pre",n.style.userSelect="text",n.style.setProperty("-webkit-user-select","text"),n.style.setProperty("-moz-user-select","text"),n.style.setProperty("-ms-user-select","text"),globalThis.document.body.appendChild(n);var r=globalThis.getSelection(),o=globalThis.document.createRange(),i=function(e){try{null!==e.clipboardData&&"function"==typeof e.clipboardData.setData&&(e.preventDefault(),e.clipboardData.setData("text/html",t),e.clipboardData.setData("text/plain",t))}catch(e){}};l.add(globalThis.document,{type:"copy",callback:i,options:{once:!0,capture:!0}});try{if(null===r)return h(n,r,i),!1;r.removeAllRanges(),o.selectNodeContents(n),r.addRange(o);var a=globalThis.document.execCommand("copy");return h(n,r,i),a}catch(e){return h(n,r,i),!1}}(t)||function(e){var t=window.clipboardData;if(void 0!==t&&"function"==typeof t.setData)try{return t.setData("Text",e)}catch(e){return!1}return!1}(t)}function p(){return function(){var t=e("div");if(void 0===t)return null;t.contentEditable="true",globalThis.document.body.appendChild(t),t.focus();var n=null,r=function(e){try{null!==e.clipboardData&&"function"==typeof e.clipboardData.getData&&(e.preventDefault(),n=e.clipboardData.getData("text/html")||e.clipboardData.getData("text/plain")||null)}catch(e){}};l.add(globalThis.document,{type:"paste",callback:r,options:{once:!0,capture:!0}});try{return globalThis.document.execCommand("paste")||n||(n=t.innerHTML||t.textContent||null),v(t,r),n}catch(e){return v(t,r),null}}()||function(){var e=window.clipboardData;if(void 0!==e&&"function"==typeof e.getData)try{return e.getData("Text")||null}catch(e){return null}return null}()||""}function h(e,t,n){null!==t&&t.removeAllRanges(),globalThis.document.body.removeChild(e),l.remove(globalThis.document,{type:"copy",callback:n})}function v(e,t){globalThis.document.body.removeChild(e),l.remove(globalThis.document,{type:"paste",callback:t})}return{installed:!1,name:"Clipboard",module:{copy:function(e){var t=s(e);return d()&&("write"in navigator.clipboard||"writeText"in navigator.clipboard)?function(e){try{if("ClipboardItem"in window&&"write"in navigator.clipboard)return navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})})]).then((function(){return!0})).catch((function(){return!1}));if("writeText"in navigator.clipboard)return navigator.clipboard.writeText(e).then((function(){return!0})).catch((function(){return!1}))}catch(e){return Promise.resolve(!1)}return Promise.resolve(!1)}(t).then((function(e){return!!e||f(t)})).catch((function(){return f(t)})):Promise.resolve(f(t))},paste:function(){return d()&&("read"in navigator.clipboard||"readText"in navigator.clipboard)?function(){try{if("ClipboardItem"in window&&"read"in navigator.clipboard)return navigator.clipboard.read().then((function(e){if(0===e.length)return Promise.resolve(null);for(var t=e[0],n=t.types,r=0;r<n.length;r++)if("text/html"===n[r])return t.getType("text/html").then((function(e){return e.text()})).catch((function(){return null}));for(r=0;r<n.length;r++)if("text/plain"===n[r])return t.getType("text/plain").then((function(e){return e.text()})).catch((function(){return null}));return Promise.resolve(null)})).catch((function(){return null}));if("readText"in navigator.clipboard)return navigator.clipboard.readText().then((function(e){return e})).catch((function(){return null}))}catch(e){return Promise.resolve(null)}return Promise.resolve(null)}().then((function(e){return null!==e?e:p()})).catch((function(){return p()})):Promise.resolve(p())}},Constants:{},Errors:{}}}));
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).Clipboard=n()}(this,(function(){"use strict";function e(e,n){if(void 0===n&&(n=!0),void 0!==globalThis.document){var r=globalThis.document.createElement(e);return"width"in r&&(r.width="0"),"height"in r&&(r.height="0"),"border"in r&&(r.border="0"),"frameBorder"in r&&(r.frameBorder="0"),"scrolling"in r&&(r.scrolling="no"),"cellPadding"in r&&(r.cellPadding="0"),"cellSpacing"in r&&(r.cellSpacing="0"),"frame"in r&&(r.frame="void"),"rules"in r&&(r.rules="none"),"noWrap"in r&&(r.noWrap=!0),r.tabIndex=-1,r.setAttribute("role","presentation"),n?(r.style.width="1px",r.style.height="1px"):(r.setAttribute("aria-hidden","true"),r.style.width="0",r.style.height="0",r.style.zIndex="-9999",r.style.display="none",r.style.visibility="hidden",r.style.pointerEvents="none"),r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.padding="0",r.style.margin="0",r.style.border="none",r.style.outline="none",r.style.clip="rect(1px, 1px, 1px, 1px)",r.style.clipPath="inset(50%)",r.style.overflow="hidden",r.style.whiteSpace="nowrap",r}}function n(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];for(var t="",o=0;o<n.length-2;o++){var i=n[o];void 0!==i&&(t=t+i.charAt(0).toUpperCase()+i.slice(1))}return t}function r(){this.returnValue=!1}function t(){this.cancelBubble=!0}var o,i,a,s,l=/(animation)(start|iteration|end|cancel)|(transition)(start|run|end|cancel)|(fullscreen)(change|error)|(lost|got)(pointer)(capture)|(pointer)(lock)(change|error)|(pointer)(cancel|down|enter|leave|move|out|over|up)/i,c=["","webkit","moz","ms","MS","o","O"],u={wheel:["wheel","mousewheel","DOMMouseScroll"],focus:["focus","focusin"],blur:["blur","focusout"],beforeinput:["beforeinput","textInput"]},d={useStd:void 0!==globalThis.document&&"function"==typeof globalThis.document.addEventListener,add:function(e,n){void 0===n&&(n={callback:null,options:!1});var o=n.callback;if(void 0!==e&&null!==o){var i=d.withVender(e,n.type),a=n.options;if("function"==typeof e.addEventListener)try{return e.addEventListener(i,o,a)}catch(e){}if("function"==typeof e.addListener)if("boolean"==typeof e.matches)try{return e.addListener(o)}catch(e){}else try{return e.addListener(i,o)}catch(e){}return"function"==typeof e.attachEvent?o.__ieWrapper?e.attachEvent("on"+i,o.__ieWrapper):e.attachEvent("on"+i,o.__ieWrapper=function(n){void 0===n&&(n=globalThis.event),void 0!==n&&(n.currentTarget=e,"function"!=typeof n.preventDefault&&(n.preventDefault=r),"function"!=typeof n.stopPropagation&&(n.stopPropagation=t),"function"==typeof o?o.call(e,n):o&&"function"==typeof o.handleEvent&&o.handleEvent.call(e,n))}):void 0}},remove:function(e,n){void 0===n&&(n={callback:null,options:!1});var r=n.callback;if(void 0!==e&&null!==r){var t=d.withVender(e,n.type),o=n.options;if("function"==typeof e.removeEventListener)try{return e.removeEventListener(t,r,o)}catch(e){}if("function"==typeof e.removeListener)if("boolean"==typeof e.matches)try{return e.removeListener(r)}catch(e){}else try{return e.removeListener(t,r)}catch(e){}if("function"!=typeof e.detachEvent);else{var i=r.__ieWrapper;void 0!==i&&(e.detachEvent("on"+t,i),delete r.__ieWrapper)}}},withVender:function(e,r){if(void 0===r)return"";if("webkitEnterFullscreen"in e&&["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"].indexOf(r)>-1)return r;var t;t=r in u?u[r]:l.test(r)?[r,r.replace(l,n)]:[r];for(var o=0;o<c.length;o++)for(var i=0;i<t.length;i++){var a=c[o]+t[i];if(void 0!==e["on"+a])return a}return""}};!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(o||(o={})),function(e){e.Unknown="Unknown",e.Mobile="Mobile",e.Desktop="Desktop"}(i||(i={})),function(e){e.Unknown="Unknown",e.EdgeHTML="EdgeHTML",e.ArkWeb="ArkWeb",e.Blink="Blink",e.Presto="Presto",e.WebKit="WebKit",e.Trident="Trident",e.NetFront="NetFront",e.KHTML="KHTML",e.Tasman="Tasman",e.Gecko="Gecko"}(a||(a={})),function(e){e.Unknown="Unknown",e.Chrome="Chrome",e.Safari="Safari",e.Edge="Edge",e.Firefox="Firefox",e.Opera="Opera",e.IE="IE",e.SamsungInternet="SamsungInternet"}(s||(s={}));var f="undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"",m={device:i.Unknown,os:o.Unknown,osVersion:"",engine:a.Unknown,engineVersion:"",browser:s.Unknown,browserVersion:"",renderer:function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var n=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===n)return"";if(n instanceof WebGLRenderingContext||"getParameter"in n&&"function"==typeof n.getParameter){var r=n.getExtension("WEBGL_debug_renderer_info");return null===r?n.getParameter(n.RENDERER):n.getParameter(r.UNMASKED_RENDERER_WEBGL)}return""}(),userAgent:f,isMobile:!1,isDesktop:!1,isStandalone:!1,isWebview:/; ?wv|applewebkit(?!.*safari)/i.test(f),isNodeJS:void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.node,isElectron:void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.electron||/ electron\//i.test(f),isReactNative:"undefined"!=typeof navigator&&"ReactNative"===navigator.product},p=[[/windows nt (6\.[23]); arm/i,o.Windows,h],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,o.Windows,h],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,o.Windows,h],[/windows nt ?([\d.)]*)(?!.+xbox)/i,o.Windows,h],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,o.Windows,h],[/windows ce\/?([\d.]*)/i,o.Windows,h],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,o.iOS,g],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,o.iOS,g],[/cfnetwork\/.+darwin/i,o.iOS,g],[/mac os x ?([\w. ]*)/i,o.MacOS,g],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,o.MacOS,g],[/droid ([\w.]+)\b.+(android[- ]x86)/i,o.Android],[/android\w*[-\/.; ]?([\d.]*)/i,o.Android]],b=[[/windows.+ edge\/([\w.]+)/i,a.EdgeHTML],[/arkweb\/([\w.]+)/i,a.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,a.Blink],[/presto\/([\w.]+)/i,a.Presto],[/webkit\/([\w.]+)/i,a.WebKit],[/trident\/([\w.]+)/i,a.Trident],[/netfront\/([\w.]+)/i,a.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,a.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,a.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,a.Gecko]],v=[[/\b(?:crmo|crios)\/([\w.]+)/i,s.Chrome],[/webview.+edge\/([\w.]+)/i,s.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,s.Edge],[/opera mini\/([-\w.]+)/i,s.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,s.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,s.Opera],[/opios[\/ ]+([\w.]+)/i,s.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,s.Opera],[/\bopr\/([\w.]+)/i,s.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,s.IE],[/(?:ms|\()ie ([\w.]+)/i,s.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,s.IE],[/\bfocus\/([\w.]+)/i,s.Firefox],[/\bopt\/([\w.]+)/i,s.Opera],[/coast\/([\w.]+)/i,s.Opera],[/fxios\/([\w.-]+)/i,s.Firefox],[/samsungbrowser\/([\w.]+)/i,s.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,s.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,s.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,s.Chrome],[/chrome\/([\w.]+) mobile/i,s.Chrome],[/chrome\/v?([\w.]+)/i,s.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,s.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,s.Safari],[/version\/([\w.,]+) .*safari/i,s.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,s.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,s.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,s.Firefox],[/firefox\/([\w.]+)/i,s.Firefox]];function h(e){if(void 0===e)return"";var n={"4.90":"ME","NT3.51":"NT 3.11","NT4.0":"NT 4.0","NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"XP","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 6.4":"10","NT 10.0":"10",ARM:"RT"}[e];return void 0!==n?n:e}function g(e){return void 0===e?"":e.replace(/_/g,".")}function w(e,n){return 10===e.major&&0===e.minor&&e.build>=22e3?"11":10===e.major&&0===e.minor&&e.build<22e3?"10":6===e.major&&3===e.minor?"8.1":6===e.major&&2===e.minor?"8":6===e.major&&1===e.minor?"7":6===e.major&&0===e.minor?"Vista":5===e.major&&1===e.minor||5===e.major&&2===e.minor?"XP":5===e.major&&0===e.minor?"2000":4===e.major&&90===e.minor?"ME":4===e.major&&0===e.minor?"NT 4.0":3===e.major&&51===e.minor?"NT 3.11":n}function y(e,n){return"function"==typeof n?n(e):"string"==typeof n?n:void 0===e?"":e}function T(e){var n=e.split(".");return{major:parseInt(n[0]||"0"),minor:parseInt(n[1]||"0"),build:parseInt(n[2]||"0")}}for(var x=0;x<p.length;x++){var j=(D=p[x])[0],k=D[1],E=D[2];if(null!==(M=m.userAgent.match(j))){m.os=k,m.osVersion=y(M[1],E);break}}m.os===o.iOS&&0===function(e,n){for(var r=e.split("."),t=n.split("."),o=Math.max(r.length,t.length),i=0;i<o;i++){var a=void 0,s=void 0;if((a=i<r.length?parseInt(r[i],10):0)>(s=i<t.length?parseInt(t[i],10):0))return 1;if(a<s)return-1}return 0}(m.osVersion,"18.6")&&(null!==(O=/\) Version\/([\d.]+)/.exec(m.userAgent))&&parseInt(O[1].substring(0,2),10)>=26&&(m.osVersion=O[1]));for(x=0;x<b.length;x++){j=(D=b[x])[0];var S=D[1];E=D[2];if(null!==(M=m.userAgent.match(j))){m.engine=S,m.engineVersion=y(M[1],E);break}}for(x=0;x<v.length;x++){j=(D=v[x])[0];var D,M,V=D[1];E=D[2];if(null!==(M=m.userAgent.match(j))){m.browser=V,m.browserVersion=y(M[1],E);break}}if(m.isReactNative)try{k=(A=require("react-native").Platform).OS;var O=T(P=""+A.Version);switch(k){case"android":m.os=o.Android,m.osVersion=function(e,n){return e.major>=36?"16":35===e.major?"15":34===e.major?"14":33===e.major?"13":32===e.major?"12.1":31===e.major?"12":30===e.major?"11":29===e.major?"10":28===e.major?"9":27===e.major?"8.1":26===e.major?"8.0":25===e.major?"7.1":24===e.major?"7.0":23===e.major?"6.0":22===e.major?"5.1":21===e.major?"5.0":20===e.major?"4.4W":19===e.major?"4.4":18===e.major?"4.3":17===e.major?"4.2":16===e.major?"4.1":15===e.major?"4.0.3":14===e.major?"4.0":13===e.major?"3.2":12===e.major?"3.1":11===e.major?"3.0":10===e.major?"2.3.3":9===e.major?"2.3":8===e.major?"2.2":7===e.major?"2.1":6===e.major?"2.0.1":5===e.major?"2.0":4===e.major?"1.6":3===e.major?"1.5":2===e.major?"1.1":1===e.major?"1.0":n}(O,P);break;case"ios":m.os=o.iOS,m.osVersion=P;break;case"windows":m.os=o.Windows,m.osVersion=w(O,P);break;case"macos":m.os=o.MacOS,m.osVersion=P}}catch(e){}if(m.isNodeJS)try{var P,A=(k=require("os")).platform();O=T(P=k.release());switch(A){case"win32":m.os=o.Windows,m.osVersion=w(O,P);break;case"darwin":m.os=o.MacOS,m.osVersion=function(e,n){return e.major>=24?e.major-9+"."+e.minor+"."+e.build:23===e.major?"14."+e.minor+"."+e.build:22===e.major?"13."+e.minor+"."+e.build:21===e.major?"12."+e.minor+"."+e.build:20===e.major?"11."+e.minor+"."+e.build:19===e.major?"10.15."+e.minor:18===e.major?"10.14."+e.minor:17===e.major?"10.13."+e.minor:16===e.major?"10.12."+e.minor:15===e.major?"10.11."+e.minor:14===e.major?"10.10."+e.minor:13===e.major?"10.9."+e.minor:e.major>=5&&e.major<=12?"10."+(e.major-4)+"."+e.minor:n}(O,P);break;case"android":m.os=o.Android,m.osVersion=P;break;case"linux":/android/i.test(P)&&(m.os=o.Android,m.osVersion=P)}}catch(e){}function C(e){return null!==e&&"object"==typeof e}function W(e){return C(e)||function(e){return Array.isArray(e)}(e)}function L(e){if(function(e){return C(e)&&"innerHTML"in e}(e))return e.innerHTML;if(W(e))try{return JSON.stringify(e)}catch(n){return""+e}else if("string"!=typeof e)return""+e;return e}function N(){return function(){if("isSecureContext"in window)return globalThis.isSecureContext;var e=location.protocol,n=location.hostname;return"https:"===e||"localhost"===n||"127.0.0.1"===n||"[::1]"===n}()&&"undefined"!=typeof navigator&&"clipboard"in navigator}function I(n){return function(n){if(!globalThis.getSelection||!globalThis.document.createRange)return!1;var r=e("div");if(void 0===r)return!1;r.contentEditable="true",r.innerHTML=n,r.style.whiteSpace="pre",r.style.userSelect="text",r.style.setProperty("-webkit-user-select","text"),r.style.setProperty("-moz-user-select","text"),r.style.setProperty("-ms-user-select","text"),globalThis.document.body.appendChild(r);var t=globalThis.getSelection(),o=globalThis.document.createRange(),i=function(e){try{null!==e.clipboardData&&"function"==typeof e.clipboardData.setData&&(e.preventDefault(),e.clipboardData.setData("text/html",n),e.clipboardData.setData("text/plain",n))}catch(e){}};d.add(globalThis.document,{type:"copy",callback:i,options:{once:!0,capture:!0}});try{if(null===t)return _(r,t,i),!1;t.removeAllRanges(),o.selectNodeContents(r),t.addRange(o);var a=globalThis.document.execCommand("copy");return _(r,t,i),a}catch(e){return _(r,t,i),!1}}(n)||function(e){var n=window.clipboardData;if(void 0!==n&&"function"==typeof n.setData)try{return n.setData("Text",e)}catch(e){return!1}return!1}(n)}function R(){return function(){var n=e("div");if(void 0===n)return null;n.contentEditable="true",globalThis.document.body.appendChild(n),n.focus();var r=null,t=function(e){try{null!==e.clipboardData&&"function"==typeof e.clipboardData.getData&&(e.preventDefault(),r=e.clipboardData.getData("text/html")||e.clipboardData.getData("text/plain")||null)}catch(e){}};d.add(globalThis.document,{type:"paste",callback:t,options:{once:!0,capture:!0}});try{return globalThis.document.execCommand("paste")||r||(r=n.innerHTML||n.textContent||null),U(n,t),r}catch(e){return U(n,t),null}}()||function(){var e=window.clipboardData;if(void 0!==e&&"function"==typeof e.getData)try{return e.getData("Text")||null}catch(e){return null}return null}()||""}function _(e,n,r){null!==n&&n.removeAllRanges(),globalThis.document.body.removeChild(e),d.remove(globalThis.document,{type:"copy",callback:r})}function U(e,n){globalThis.document.body.removeChild(e),d.remove(globalThis.document,{type:"paste",callback:n})}void 0!==navigator.userAgentData&&void 0!==navigator.userAgentData.getHighEntropyValues&&navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness","uaFullVersion","wow64"]).then((function(e){for(var n,r=e.fullVersionList||e.brands||[],t=e.platformVersion,i=0;i<r.length;i++){var a=null==(n=r[i])?{brand:"",version:""}:"string"==typeof n?{brand:n,version:""}:{brand:n.brand,version:n.version},s=a.brand,l=a.version;/not.a.brand/i.test(s)||"Chromium"===s&&(m.engineVersion=l)}"string"==typeof t&&(m.os===o.Windows&&parseInt(t.replace(/[^\d.]/g,"").split(".")[0],10)>=13?m.osVersion="11":m.osVersion=t)})),m.device=m.os===o.iOS||m.os===o.Android?i.Mobile:m.os===o.Windows||m.os===o.MacOS?i.Desktop:i.Unknown,m.isMobile=m.device===i.Mobile,m.isDesktop=m.device===i.Desktop,m.isStandalone=function(e){return"matchMedia"in globalThis&&(e===o.iOS?"standalone"in navigator&&!!navigator.standalone:globalThis.matchMedia("(display-mode: standalone)").matches)}(m.os);var H={copy:function(e){var n=L(e);return m.isElectron?function(e){try{var n=require("electron");return new Promise((function(r){try{n.clipboard.writeText(e),n.clipboard.writeHTML(e),r(!0)}catch(e){r(!1)}}))}catch(e){return Promise.resolve(!1)}}(n):N()&&("write"in navigator.clipboard||"writeText"in navigator.clipboard)?function(e){try{if("ClipboardItem"in window&&"write"in navigator.clipboard)return navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})})]).then((function(){return!0})).catch((function(){return!1}));if("writeText"in navigator.clipboard)return navigator.clipboard.writeText(e).then((function(){return!0})).catch((function(){return!1}))}catch(e){return Promise.resolve(!1)}return Promise.resolve(!1)}(n).then((function(e){return!!e||I(n)})).catch((function(){return I(n)})):Promise.resolve(I(n))},paste:function(){return m.isElectron?function(){try{var e=require("electron");return new Promise((function(n){try{n(e.clipboard.readHTML()||e.clipboard.readText())}catch(e){n("")}}))}catch(e){return Promise.resolve("")}}():N()&&("read"in navigator.clipboard||"readText"in navigator.clipboard)?function(){try{if("ClipboardItem"in window&&"read"in navigator.clipboard)return navigator.clipboard.read().then((function(e){if(0===e.length)return Promise.resolve(null);for(var n=e[0],r=n.types,t=0;t<r.length;t++)if("text/html"===r[t])return n.getType("text/html").then((function(e){return e.text()})).catch((function(){return null}));for(t=0;t<r.length;t++)if("text/plain"===r[t])return n.getType("text/plain").then((function(e){return e.text()})).catch((function(){return null}));return Promise.resolve(null)})).catch((function(){return null}));if("readText"in navigator.clipboard)return navigator.clipboard.readText().then((function(e){return e})).catch((function(){return null}))}catch(e){return Promise.resolve(null)}return Promise.resolve(null)}().then((function(e){return null!==e?e:R()})).catch((function(){return R()})):Promise.resolve(R())}};return{installed:!1,name:"Clipboard",module:H,Constants:{},Errors:{}}}));
|
|
@@ -18,6 +18,7 @@ export declare interface ThemeInstance {
|
|
|
18
18
|
setThemeColor(color: Color, options?: SetThemeColorOptions): Promise<string | undefined>;
|
|
19
19
|
getThemeColor(): Color | undefined;
|
|
20
20
|
removeThemeColor(appearance?: ThemeColorMetaAppearanceKeys): void;
|
|
21
|
-
|
|
21
|
+
getAppearance(): Promise<Appearances>;
|
|
22
|
+
setAppearance(appearances?: Exclude<Appearances, Appearances.Unknown>): void;
|
|
22
23
|
onAppearanceChange(listener: (appearance?: Appearances) => any, options?: boolean | AddEventListenerOptions): () => void;
|
|
23
24
|
}
|