jscrewit 3.0.0 → 3.2.0
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/Features.md +5 -4
- package/README.md +2 -0
- package/api-doc/interfaces/FeatureAll.md +20 -12
- package/api-doc/interfaces/FeatureConstructor.md +29 -17
- package/api-doc/type-aliases/ElementaryFeatureName.md +1 -1
- package/api-doc/type-aliases/PredefinedFeatureName.md +1 -1
- package/lib/feature-all.d.ts +14 -10
- package/lib/feature.d.ts +1 -1
- package/lib/jscrewit.js +637 -475
- package/lib/jscrewit.min.js +2 -2
- package/package.json +5 -2
- package/tools/cli.js +48 -106
- package/ui/ui.js +1 -1
package/lib/jscrewit.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// JScrewIt 3.
|
|
1
|
+
// JScrewIt 3.2.0 – https://jscrew.it
|
|
2
2
|
|
|
3
3
|
(function () {
|
|
4
4
|
'use strict';
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
function esToString$1(arg)
|
|
62
62
|
{
|
|
63
63
|
if (typeof arg === 'symbol')
|
|
64
|
-
throw
|
|
64
|
+
throw _TypeError$1('Cannot convert a symbol to a string');
|
|
65
65
|
var str = _String$1(arg);
|
|
66
66
|
return str;
|
|
67
67
|
}
|
|
@@ -576,7 +576,7 @@
|
|
|
576
576
|
}
|
|
577
577
|
function validateMask(mask) {
|
|
578
578
|
if (!isMaskCompatible(mask))
|
|
579
|
-
throw
|
|
579
|
+
throw _Error('Incompatible features');
|
|
580
580
|
}
|
|
581
581
|
var utilInspect;
|
|
582
582
|
try {
|
|
@@ -828,7 +828,7 @@
|
|
|
828
828
|
var createMap = function () { return _Object_create(null); };
|
|
829
829
|
function esToString(name) {
|
|
830
830
|
if (typeof name === 'symbol')
|
|
831
|
-
throw
|
|
831
|
+
throw _TypeError('Cannot convert a symbol to a string');
|
|
832
832
|
var str = _String(name);
|
|
833
833
|
return str;
|
|
834
834
|
}
|
|
@@ -865,7 +865,7 @@
|
|
|
865
865
|
return str;
|
|
866
866
|
}
|
|
867
867
|
function throwUnknownFeatureError(name) {
|
|
868
|
-
throw
|
|
868
|
+
throw _Error("Unknown feature ".concat(_JSON_stringify(name)));
|
|
869
869
|
}
|
|
870
870
|
function wrapCheck(check) {
|
|
871
871
|
var wrappedCheck = function () { return !!check(); };
|
|
@@ -1076,16 +1076,6 @@
|
|
|
1076
1076
|
includes: ['NO_IE_SRC', 'NO_V8_SRC'],
|
|
1077
1077
|
excludes: ['NO_FF_SRC'],
|
|
1078
1078
|
},
|
|
1079
|
-
FILL:
|
|
1080
|
-
{
|
|
1081
|
-
description: 'Existence of the native function Array.prototype.fill.',
|
|
1082
|
-
check:
|
|
1083
|
-
function ()
|
|
1084
|
-
{
|
|
1085
|
-
var available = Array.prototype.fill;
|
|
1086
|
-
return available;
|
|
1087
|
-
},
|
|
1088
|
-
},
|
|
1089
1079
|
FLAT:
|
|
1090
1080
|
{
|
|
1091
1081
|
description: 'Existence of the native function Array.prototype.flat.',
|
|
@@ -1298,6 +1288,16 @@
|
|
|
1298
1288
|
return available;
|
|
1299
1289
|
},
|
|
1300
1290
|
},
|
|
1291
|
+
RUSSIAN_INFINITY:
|
|
1292
|
+
{
|
|
1293
|
+
description: 'Russian string representation of Infinity as "∞".',
|
|
1294
|
+
check:
|
|
1295
|
+
function ()
|
|
1296
|
+
{
|
|
1297
|
+
var available = Infinity.toLocaleString('ru') === '∞';
|
|
1298
|
+
return available;
|
|
1299
|
+
},
|
|
1300
|
+
},
|
|
1301
1301
|
SELF:
|
|
1302
1302
|
{
|
|
1303
1303
|
description:
|
|
@@ -1381,7 +1381,6 @@
|
|
|
1381
1381
|
'BARPROP',
|
|
1382
1382
|
'DOCUMENT',
|
|
1383
1383
|
'ESC_HTML_QUOT',
|
|
1384
|
-
'FILL',
|
|
1385
1384
|
'FLAT',
|
|
1386
1385
|
'FROM_CODE_POINT',
|
|
1387
1386
|
'FUNCTION_19_LF',
|
|
@@ -1392,6 +1391,7 @@
|
|
|
1392
1391
|
'NAME',
|
|
1393
1392
|
'NO_IE_SRC',
|
|
1394
1393
|
'REGEXP_STRING_ITERATOR',
|
|
1394
|
+
'RUSSIAN_INFINITY',
|
|
1395
1395
|
'STATUS',
|
|
1396
1396
|
'WINDOW',
|
|
1397
1397
|
],
|
|
@@ -1424,7 +1424,6 @@
|
|
|
1424
1424
|
'BARPROP',
|
|
1425
1425
|
'DOCUMENT',
|
|
1426
1426
|
'ESC_HTML_QUOT',
|
|
1427
|
-
'FILL',
|
|
1428
1427
|
'FLAT',
|
|
1429
1428
|
'FROM_CODE_POINT',
|
|
1430
1429
|
'FUNCTION_19_LF',
|
|
@@ -1435,6 +1434,7 @@
|
|
|
1435
1434
|
'LOCALE_NUMERALS_EXT',
|
|
1436
1435
|
'NAME',
|
|
1437
1436
|
'REGEXP_STRING_ITERATOR',
|
|
1437
|
+
'RUSSIAN_INFINITY',
|
|
1438
1438
|
'STATUS',
|
|
1439
1439
|
'V8_SRC',
|
|
1440
1440
|
'WINDOW',
|
|
@@ -1475,7 +1475,6 @@
|
|
|
1475
1475
|
'DOCUMENT',
|
|
1476
1476
|
'ESC_HTML_QUOT',
|
|
1477
1477
|
'FF_SRC',
|
|
1478
|
-
'FILL',
|
|
1479
1478
|
'FLAT',
|
|
1480
1479
|
'FROM_CODE_POINT',
|
|
1481
1480
|
'FUNCTION_19_LF',
|
|
@@ -1486,6 +1485,7 @@
|
|
|
1486
1485
|
'NAME',
|
|
1487
1486
|
'OBJECT_ARRAY_ENTRIES_CTOR',
|
|
1488
1487
|
'REGEXP_STRING_ITERATOR',
|
|
1488
|
+
'RUSSIAN_INFINITY',
|
|
1489
1489
|
'SHORT_LOCALES',
|
|
1490
1490
|
'STATUS',
|
|
1491
1491
|
'WINDOW',
|
|
@@ -1529,6 +1529,14 @@
|
|
|
1529
1529
|
],
|
|
1530
1530
|
attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null },
|
|
1531
1531
|
},
|
|
1532
|
+
IE_11_WIN_8:
|
|
1533
|
+
{
|
|
1534
|
+
inherits: 'IE_11',
|
|
1535
|
+
versions: ['11'],
|
|
1536
|
+
compatibilityTag: 'on Windows 8',
|
|
1537
|
+
compatibilityShortTag: 'W8',
|
|
1538
|
+
includes: { RUSSIAN_INFINITY: true },
|
|
1539
|
+
},
|
|
1532
1540
|
IE_11_WIN_10:
|
|
1533
1541
|
{
|
|
1534
1542
|
inherits: 'IE_11',
|
|
@@ -1540,6 +1548,7 @@
|
|
|
1540
1548
|
LOCALE_INFINITY: true,
|
|
1541
1549
|
LOCALE_NUMERALS_BN: true,
|
|
1542
1550
|
LOCALE_NUMERALS_EXT: true,
|
|
1551
|
+
RUSSIAN_INFINITY: true,
|
|
1543
1552
|
},
|
|
1544
1553
|
},
|
|
1545
1554
|
NODE_20:
|
|
@@ -1552,7 +1561,6 @@
|
|
|
1552
1561
|
'ARROW',
|
|
1553
1562
|
'AT',
|
|
1554
1563
|
'ESC_HTML_QUOT',
|
|
1555
|
-
'FILL',
|
|
1556
1564
|
'FLAT',
|
|
1557
1565
|
'FROM_CODE_POINT',
|
|
1558
1566
|
'FUNCTION_19_LF',
|
|
@@ -1563,6 +1571,7 @@
|
|
|
1563
1571
|
'NAME',
|
|
1564
1572
|
'OBJECT_ARRAY_ENTRIES_CTOR',
|
|
1565
1573
|
'REGEXP_STRING_ITERATOR',
|
|
1574
|
+
'RUSSIAN_INFINITY',
|
|
1566
1575
|
'SHORT_LOCALES',
|
|
1567
1576
|
'V8_SRC',
|
|
1568
1577
|
],
|
|
@@ -1598,7 +1607,6 @@
|
|
|
1598
1607
|
'DOCUMENT',
|
|
1599
1608
|
'ESC_HTML_QUOT',
|
|
1600
1609
|
'FF_SRC',
|
|
1601
|
-
'FILL',
|
|
1602
1610
|
'FLAT',
|
|
1603
1611
|
'FROM_CODE_POINT',
|
|
1604
1612
|
'FUNCTION_19_LF',
|
|
@@ -1609,6 +1617,7 @@
|
|
|
1609
1617
|
'NAME',
|
|
1610
1618
|
'OBJECT_ARRAY_ENTRIES_CTOR',
|
|
1611
1619
|
'REGEXP_STRING_ITERATOR',
|
|
1620
|
+
'RUSSIAN_INFINITY',
|
|
1612
1621
|
'SHORT_LOCALES',
|
|
1613
1622
|
'STATUS',
|
|
1614
1623
|
'WINDOW',
|
|
@@ -2249,10 +2258,10 @@
|
|
|
2249
2258
|
|
|
2250
2259
|
var SIMPLE = createEmpty();
|
|
2251
2260
|
|
|
2261
|
+
var FORMAT_MAPPER_LONG;
|
|
2262
|
+
var FORMAT_MAPPER_SHORT;
|
|
2252
2263
|
var FROM_CHAR_CODE;
|
|
2253
2264
|
var FROM_CHAR_CODE_CALLBACK_FORMATTER;
|
|
2254
|
-
var MAPPER_FORMATTER;
|
|
2255
|
-
var OPTIMAL_ARG_NAME;
|
|
2256
2265
|
var OPTIMAL_B;
|
|
2257
2266
|
var OPTIMAL_RETURN_STRING;
|
|
2258
2267
|
|
|
@@ -2274,12 +2283,6 @@
|
|
|
2274
2283
|
var FB_R_PADDING_SHIFTS;
|
|
2275
2284
|
var FH_R_PADDING_SHIFTS;
|
|
2276
2285
|
|
|
2277
|
-
function chooseOtherArgName(argName)
|
|
2278
|
-
{
|
|
2279
|
-
var otherArgName = argName !== 'undefined' ? 'undefined' : 'falsefalse';
|
|
2280
|
-
return otherArgName;
|
|
2281
|
-
}
|
|
2282
|
-
|
|
2283
2286
|
function createCharDefinitionInFn(expr, index, paddingEntries)
|
|
2284
2287
|
{
|
|
2285
2288
|
function charDefinitionInFn(char)
|
|
@@ -2570,7 +2573,6 @@
|
|
|
2570
2573
|
var DOCUMENT = Feature.DOCUMENT;
|
|
2571
2574
|
var ESC_HTML_QUOT = Feature.ESC_HTML_QUOT;
|
|
2572
2575
|
var FF_SRC = Feature.FF_SRC;
|
|
2573
|
-
var FILL = Feature.FILL;
|
|
2574
2576
|
var FLAT = Feature.FLAT;
|
|
2575
2577
|
var FROM_CODE_POINT = Feature.FROM_CODE_POINT;
|
|
2576
2578
|
var FUNCTION_19_LF = Feature.FUNCTION_19_LF;
|
|
@@ -2589,6 +2591,7 @@
|
|
|
2589
2591
|
var OBJECT_W_SELF = Feature.OBJECT_W_SELF;
|
|
2590
2592
|
var PLAIN_INTL = Feature.PLAIN_INTL;
|
|
2591
2593
|
var REGEXP_STRING_ITERATOR = Feature.REGEXP_STRING_ITERATOR;
|
|
2594
|
+
var RUSSIAN_INFINITY = Feature.RUSSIAN_INFINITY;
|
|
2592
2595
|
var SELF = Feature.SELF;
|
|
2593
2596
|
var SHORT_LOCALES = Feature.SHORT_LOCALES;
|
|
2594
2597
|
var STATUS = Feature.STATUS;
|
|
@@ -2889,9 +2892,6 @@
|
|
|
2889
2892
|
define('(RP_1_WA + FILTER)[20]', V8_SRC),
|
|
2890
2893
|
define('(RP_1_WA + AT)[20]', AT, NO_V8_SRC),
|
|
2891
2894
|
define('(RP_5_A + AT)[20]', AT, V8_SRC),
|
|
2892
|
-
define('(+(RP_0_S + FILL)[0] + FILL)[20]', FILL, NO_FF_SRC),
|
|
2893
|
-
define('(RP_5_A + FILL)[20]', FILL, NO_IE_SRC),
|
|
2894
|
-
define('(RP_0_S + FILL)[20]', FILL, NO_V8_SRC),
|
|
2895
2895
|
define('(+(RP_0_S + FLAT)[0] + FLAT)[20]', FLAT, NO_FF_SRC),
|
|
2896
2896
|
define('(RP_5_A + FLAT)[20]', FLAT, NO_IE_SRC),
|
|
2897
2897
|
define('(RP_0_S + FLAT)[20]', FLAT, NO_V8_SRC),
|
|
@@ -2910,7 +2910,6 @@
|
|
|
2910
2910
|
[
|
|
2911
2911
|
define('escape(FILTER)[20]'),
|
|
2912
2912
|
define('escape(0 + AT)[20]', AT),
|
|
2913
|
-
define('escape(FILL)[21]', FILL),
|
|
2914
2913
|
define('escape(FLAT)[21]', FLAT),
|
|
2915
2914
|
define('escape(ANY_FUNCTION)[0]', IE_SRC),
|
|
2916
2915
|
defineCharDefault(),
|
|
@@ -2934,7 +2933,7 @@
|
|
|
2934
2933
|
',':
|
|
2935
2934
|
[
|
|
2936
2935
|
define('(RP_0_S + F_A_L_S_E)[1]'),
|
|
2937
|
-
define({ expr: '[[]]
|
|
2936
|
+
define({ expr: '[[]][CONCAT]([[]])', solutionType: SolutionType.OBJECT }),
|
|
2938
2937
|
],
|
|
2939
2938
|
'-': '(.0000001 + [])[2]',
|
|
2940
2939
|
'.': '(11e20 + [])[1]',
|
|
@@ -2996,12 +2995,9 @@
|
|
|
2996
2995
|
define('escape("}")[2]'),
|
|
2997
2996
|
define('escape((RP_4_A + [+("1000" + (AT + 0)[31] + 0)] + AT)[40])[2]', AT), // *
|
|
2998
2997
|
define // *
|
|
2999
|
-
('escape((NaN + [+("10" + [(RP_6_S + FILL)[40]] + "000")] + FILL)[40])[2]', FILL),
|
|
3000
|
-
define // *
|
|
3001
2998
|
('escape((NaN + [+("10" + [(RP_6_S + FLAT)[40]] + "000")] + FLAT)[40])[2]', FLAT),
|
|
3002
2999
|
define('escape(FILTER)[50]', V8_SRC),
|
|
3003
3000
|
define('escape([[]][+(RP_0_S + AT)[0]] + AT)[61]', AT, NO_FF_SRC), // *
|
|
3004
|
-
define('escape(FILL)[60]', FF_SRC, FILL),
|
|
3005
3001
|
],
|
|
3006
3002
|
'E':
|
|
3007
3003
|
[
|
|
@@ -3305,6 +3301,7 @@
|
|
|
3305
3301
|
define('Infinity[TO_LOCALE_STRING]("ja")[SLICE_OR_SUBSTR]("-1")'),
|
|
3306
3302
|
define('Infinity[TO_LOCALE_STRING]("ja").at("-1")', AT),
|
|
3307
3303
|
define('Infinity[TO_LOCALE_STRING]()', LOCALE_INFINITY),
|
|
3304
|
+
define('Infinity[TO_LOCALE_STRING]("ru")', RUSSIAN_INFINITY),
|
|
3308
3305
|
defineCharDefault(),
|
|
3309
3306
|
],
|
|
3310
3307
|
});
|
|
@@ -3317,7 +3314,7 @@
|
|
|
3317
3314
|
RegExp: define({ expr: 'RegExp.name', optimize: { complexOpt: false } }, NAME),
|
|
3318
3315
|
String: define('String.name', NAME),
|
|
3319
3316
|
fromCharCo:
|
|
3320
|
-
define({ expr: '"from3har3o"
|
|
3317
|
+
define({ expr: '"from3har3o"[SPLIT](3)[JOIN]("C")', optimize: { complexOpt: false } }),
|
|
3321
3318
|
mCh: define('atob("bUNo")'),
|
|
3322
3319
|
});
|
|
3323
3320
|
|
|
@@ -3397,7 +3394,6 @@
|
|
|
3397
3394
|
[
|
|
3398
3395
|
define('FILTER'),
|
|
3399
3396
|
define('AT', AT),
|
|
3400
|
-
define('FILL', FILL),
|
|
3401
3397
|
define('FLAT', FLAT),
|
|
3402
3398
|
],
|
|
3403
3399
|
ARRAY_ITERATOR:
|
|
@@ -3408,14 +3404,11 @@
|
|
|
3408
3404
|
[
|
|
3409
3405
|
define('[].at', AT),
|
|
3410
3406
|
],
|
|
3411
|
-
|
|
3412
|
-
[
|
|
3413
|
-
define('[].fill', FILL),
|
|
3414
|
-
],
|
|
3415
|
-
FILTER:
|
|
3407
|
+
CONCAT:
|
|
3416
3408
|
[
|
|
3417
|
-
define('
|
|
3409
|
+
define({ expr: '"concat"', solutionType: SolutionType.COMBINED_STRING }),
|
|
3418
3410
|
],
|
|
3411
|
+
FILTER: '[].filter',
|
|
3419
3412
|
FLAT:
|
|
3420
3413
|
[
|
|
3421
3414
|
define('[].flat', FLAT),
|
|
@@ -3424,11 +3417,19 @@
|
|
|
3424
3417
|
[
|
|
3425
3418
|
define('[][SLICE_OR_FLAT].call("false")'),
|
|
3426
3419
|
],
|
|
3420
|
+
JOIN:
|
|
3421
|
+
[
|
|
3422
|
+
define({ expr: '"join"', solutionType: SolutionType.COMBINED_STRING }),
|
|
3423
|
+
],
|
|
3427
3424
|
LOCALE_AR:
|
|
3428
3425
|
[
|
|
3429
3426
|
define({ expr: '"ar-td"', solutionType: SolutionType.COMBINED_STRING }),
|
|
3430
3427
|
define({ expr: '"ar"', solutionType: SolutionType.COMBINED_STRING }, SHORT_LOCALES),
|
|
3431
3428
|
],
|
|
3429
|
+
MAP:
|
|
3430
|
+
[
|
|
3431
|
+
define({ expr: '"map"', optimize: true, solutionType: SolutionType.COMBINED_STRING }),
|
|
3432
|
+
],
|
|
3432
3433
|
PLAIN_OBJECT:
|
|
3433
3434
|
[
|
|
3434
3435
|
define('Function("return{}")()'),
|
|
@@ -3447,6 +3448,10 @@
|
|
|
3447
3448
|
define({ expr: '"slice"', solutionType: SolutionType.COMBINED_STRING }),
|
|
3448
3449
|
define({ expr: '"substr"', solutionType: SolutionType.COMBINED_STRING }),
|
|
3449
3450
|
],
|
|
3451
|
+
SPLIT:
|
|
3452
|
+
[
|
|
3453
|
+
define({ expr: '"split"', optimize: true, solutionType: SolutionType.COMBINED_STRING }),
|
|
3454
|
+
],
|
|
3450
3455
|
TO_LOCALE_STRING:
|
|
3451
3456
|
[
|
|
3452
3457
|
define
|
|
@@ -3485,11 +3490,9 @@
|
|
|
3485
3490
|
[
|
|
3486
3491
|
define('[[true][+(RP_3_WA + FILTER)[30]]]'),
|
|
3487
3492
|
define('[[true][+(RP_1_WA + AT)[30]]]', AT),
|
|
3488
|
-
define('[[true][+(RP_5_A + FILL)[30]]]', FILL),
|
|
3489
3493
|
define('[[true][+(RP_5_A + FLAT)[30]]]', FLAT),
|
|
3490
3494
|
define('[[true][+!!++(RP_0_S + FILTER)[20]]]', INCR_CHAR),
|
|
3491
3495
|
define('[[true][+!!++(RP_1_WA + AT)[20]]]', AT, INCR_CHAR),
|
|
3492
|
-
define('[[true][+!!++(RP_0_S + FILL)[20]]]', FILL, INCR_CHAR),
|
|
3493
3496
|
define('[[true][+!!++(RP_0_S + FLAT)[20]]]', FLAT, INCR_CHAR),
|
|
3494
3497
|
],
|
|
3495
3498
|
FBEP_9_U:
|
|
@@ -3499,8 +3502,6 @@
|
|
|
3499
3502
|
define
|
|
3500
3503
|
({ expr: '[false][+(RP_1_WA + AT)[20]]', solutionType: SolutionType.UNDEFINED }, AT),
|
|
3501
3504
|
define
|
|
3502
|
-
({ expr: '[false][+(RP_0_S + FILL)[20]]', solutionType: SolutionType.UNDEFINED }, FILL),
|
|
3503
|
-
define
|
|
3504
3505
|
({ expr: '[false][+(RP_0_S + FLAT)[20]]', solutionType: SolutionType.UNDEFINED }, FLAT),
|
|
3505
3506
|
],
|
|
3506
3507
|
FBEP_10_S:
|
|
@@ -3536,14 +3537,6 @@
|
|
|
3536
3537
|
AT
|
|
3537
3538
|
),
|
|
3538
3539
|
define
|
|
3539
|
-
(
|
|
3540
|
-
{
|
|
3541
|
-
expr: '+("10" + [(RP_6_S + FILL)[40]] + "00000")',
|
|
3542
|
-
solutionType: SolutionType.WEAK_ALGEBRAIC,
|
|
3543
|
-
},
|
|
3544
|
-
FILL
|
|
3545
|
-
),
|
|
3546
|
-
define
|
|
3547
3540
|
(
|
|
3548
3541
|
{
|
|
3549
3542
|
expr: '+("10" + [(RP_6_S + FLAT)[40]] + "00000")',
|
|
@@ -3570,14 +3563,6 @@
|
|
|
3570
3563
|
AT
|
|
3571
3564
|
),
|
|
3572
3565
|
define
|
|
3573
|
-
(
|
|
3574
|
-
{
|
|
3575
|
-
expr: '+("1000" + (FILL + 0)[33] + "000")',
|
|
3576
|
-
solutionType: SolutionType.WEAK_ALGEBRAIC,
|
|
3577
|
-
},
|
|
3578
|
-
FILL
|
|
3579
|
-
),
|
|
3580
|
-
define
|
|
3581
3566
|
(
|
|
3582
3567
|
{
|
|
3583
3568
|
expr: '+("1000" + (FLAT + 0)[33] + "000")',
|
|
@@ -3692,6 +3677,108 @@
|
|
|
3692
3677
|
|
|
3693
3678
|
FH_R_PADDING_SHIFTS = [define(1, IE_SRC), define(0, NO_IE_SRC)];
|
|
3694
3679
|
|
|
3680
|
+
FORMAT_MAPPER_LONG =
|
|
3681
|
+
defineList
|
|
3682
|
+
(
|
|
3683
|
+
[
|
|
3684
|
+
define
|
|
3685
|
+
(
|
|
3686
|
+
(function () {
|
|
3687
|
+
var formatMapper =
|
|
3688
|
+
function (accessor)
|
|
3689
|
+
{
|
|
3690
|
+
var mapper =
|
|
3691
|
+
'Function("return function(falsefalse){return function(undefined){return ' +
|
|
3692
|
+
'falsefalse' + accessor + '}}")()';
|
|
3693
|
+
return mapper;
|
|
3694
|
+
};
|
|
3695
|
+
formatMapper.argName = 'undefined';
|
|
3696
|
+
return formatMapper;
|
|
3697
|
+
})()
|
|
3698
|
+
),
|
|
3699
|
+
define
|
|
3700
|
+
(
|
|
3701
|
+
(function () {
|
|
3702
|
+
var formatMapper =
|
|
3703
|
+
function (accessor)
|
|
3704
|
+
{
|
|
3705
|
+
var mapper =
|
|
3706
|
+
'Function("return function(f){return this' + accessor + '}")().bind';
|
|
3707
|
+
return mapper;
|
|
3708
|
+
};
|
|
3709
|
+
formatMapper.argName = 'f';
|
|
3710
|
+
return formatMapper;
|
|
3711
|
+
})()
|
|
3712
|
+
),
|
|
3713
|
+
define
|
|
3714
|
+
(
|
|
3715
|
+
(function () {
|
|
3716
|
+
var formatMapper =
|
|
3717
|
+
function (accessor)
|
|
3718
|
+
{
|
|
3719
|
+
var mapper =
|
|
3720
|
+
'Function("return falsefalse=>undefined=>falsefalse' + accessor + '")()';
|
|
3721
|
+
return mapper;
|
|
3722
|
+
};
|
|
3723
|
+
formatMapper.argName = 'undefined';
|
|
3724
|
+
return formatMapper;
|
|
3725
|
+
})(),
|
|
3726
|
+
ARROW
|
|
3727
|
+
),
|
|
3728
|
+
],
|
|
3729
|
+
[
|
|
3730
|
+
define(0),
|
|
3731
|
+
define(1, ARRAY_ITERATOR),
|
|
3732
|
+
define(0, NO_FF_SRC),
|
|
3733
|
+
define(0, NO_V8_SRC),
|
|
3734
|
+
define(1, ARRAY_ITERATOR, CAPITAL_HTML),
|
|
3735
|
+
define(0, ARRAY_ITERATOR, AT),
|
|
3736
|
+
define(0, ARRAY_ITERATOR, FLAT),
|
|
3737
|
+
define(0, ARRAY_ITERATOR, NO_IE_SRC),
|
|
3738
|
+
define(0, ARRAY_ITERATOR, CAPITAL_HTML, IE_SRC),
|
|
3739
|
+
define(2),
|
|
3740
|
+
]
|
|
3741
|
+
);
|
|
3742
|
+
|
|
3743
|
+
FORMAT_MAPPER_SHORT =
|
|
3744
|
+
defineList
|
|
3745
|
+
(
|
|
3746
|
+
[
|
|
3747
|
+
define
|
|
3748
|
+
(
|
|
3749
|
+
(function () {
|
|
3750
|
+
var formatMapper =
|
|
3751
|
+
function (accessor)
|
|
3752
|
+
{
|
|
3753
|
+
var mapper =
|
|
3754
|
+
'Function("return function(undefined){return function(falsefalse){return ' +
|
|
3755
|
+
'undefined[1][undefined[0]' + accessor + ']}}")()';
|
|
3756
|
+
return mapper;
|
|
3757
|
+
};
|
|
3758
|
+
formatMapper.argName = 'falsefalse';
|
|
3759
|
+
return formatMapper;
|
|
3760
|
+
})()
|
|
3761
|
+
),
|
|
3762
|
+
define
|
|
3763
|
+
(
|
|
3764
|
+
(function () {
|
|
3765
|
+
var formatMapper =
|
|
3766
|
+
function (accessor)
|
|
3767
|
+
{
|
|
3768
|
+
var mapper =
|
|
3769
|
+
'Function("return undefined=>falsefalse=>undefined[1][undefined[0]' +
|
|
3770
|
+
accessor + ']")()';
|
|
3771
|
+
return mapper;
|
|
3772
|
+
};
|
|
3773
|
+
formatMapper.argName = 'falsefalse';
|
|
3774
|
+
return formatMapper;
|
|
3775
|
+
})(),
|
|
3776
|
+
ARROW
|
|
3777
|
+
),
|
|
3778
|
+
],
|
|
3779
|
+
[define(0), define(1)]
|
|
3780
|
+
);
|
|
3781
|
+
|
|
3695
3782
|
FROM_CHAR_CODE =
|
|
3696
3783
|
defineList
|
|
3697
3784
|
(
|
|
@@ -3700,30 +3787,37 @@
|
|
|
3700
3787
|
define(0),
|
|
3701
3788
|
define(1),
|
|
3702
3789
|
define(0, ITERATOR_HELPER),
|
|
3703
|
-
define(
|
|
3704
|
-
define(0, ARRAY_ITERATOR, CAPITAL_HTML, FROM_CODE_POINT),
|
|
3705
|
-
define(1, FLAT, ITERATOR_HELPER),
|
|
3706
|
-
define(0, FILL, FROM_CODE_POINT, ITERATOR_HELPER, NAME),
|
|
3790
|
+
define(0, ARRAY_ITERATOR, CAPITAL_HTML),
|
|
3707
3791
|
define(1, ARRAY_ITERATOR, ITERATOR_HELPER),
|
|
3792
|
+
define(1, AT, ITERATOR_HELPER),
|
|
3793
|
+
define(1, BARPROP, ITERATOR_HELPER),
|
|
3794
|
+
define(1, CAPITAL_HTML, ITERATOR_HELPER),
|
|
3795
|
+
define(1, FLAT, ITERATOR_HELPER),
|
|
3708
3796
|
define(1, IE_SRC, ITERATOR_HELPER),
|
|
3709
3797
|
define(1, ITERATOR_HELPER, NO_IE_SRC),
|
|
3710
|
-
define(1, FILL, FLAT, ITERATOR_HELPER, NAME),
|
|
3711
|
-
define(0, ARRAY_ITERATOR, FILL, FROM_CODE_POINT, ITERATOR_HELPER),
|
|
3712
3798
|
define(0, ARRAY_ITERATOR, FLAT, FROM_CODE_POINT, ITERATOR_HELPER),
|
|
3713
3799
|
define(0, ARRAY_ITERATOR, FROM_CODE_POINT, IE_SRC, ITERATOR_HELPER),
|
|
3800
|
+
define(1, ARRAY_ITERATOR, BARPROP, IE_SRC, ITERATOR_HELPER),
|
|
3801
|
+
define(1, ARRAY_ITERATOR, CAPITAL_HTML, IE_SRC, ITERATOR_HELPER),
|
|
3714
3802
|
define(0, ARRAY_ITERATOR, FROM_CODE_POINT, ITERATOR_HELPER, NO_IE_SRC),
|
|
3715
|
-
define(1, ARRAY_ITERATOR,
|
|
3716
|
-
define(1, ARRAY_ITERATOR,
|
|
3717
|
-
define(1, ARRAY_ITERATOR,
|
|
3718
|
-
define(1, ARRAY_ITERATOR, FLAT, ITERATOR_HELPER
|
|
3803
|
+
define(1, ARRAY_ITERATOR, AT, FLAT, ITERATOR_HELPER),
|
|
3804
|
+
define(1, ARRAY_ITERATOR, AT, IE_SRC, ITERATOR_HELPER),
|
|
3805
|
+
define(1, ARRAY_ITERATOR, AT, ITERATOR_HELPER, NO_IE_SRC),
|
|
3806
|
+
define(1, ARRAY_ITERATOR, BARPROP, FLAT, ITERATOR_HELPER),
|
|
3807
|
+
define(1, ARRAY_ITERATOR, BARPROP, ITERATOR_HELPER, NO_IE_SRC),
|
|
3808
|
+
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, ITERATOR_HELPER),
|
|
3809
|
+
define(1, ARRAY_ITERATOR, CAPITAL_HTML, ITERATOR_HELPER, NO_IE_SRC),
|
|
3719
3810
|
define(0, ARRAY_ITERATOR, FROM_CODE_POINT, ITERATOR_HELPER, NAME),
|
|
3720
|
-
define(1, AT, ITERATOR_HELPER),
|
|
3721
|
-
define(1, BARPROP, ITERATOR_HELPER),
|
|
3722
|
-
define(1, CAPITAL_HTML, ITERATOR_HELPER),
|
|
3723
|
-
define(1, ARRAY_ITERATOR,
|
|
3724
|
-
define(
|
|
3725
|
-
define(1, ARRAY_ITERATOR, FLAT, IE_SRC, ITERATOR_HELPER
|
|
3726
|
-
define(1, ARRAY_ITERATOR, FLAT, ITERATOR_HELPER,
|
|
3811
|
+
define(1, ARRAY_ITERATOR, AT, ITERATOR_HELPER, NAME),
|
|
3812
|
+
define(1, ARRAY_ITERATOR, BARPROP, ITERATOR_HELPER, NAME),
|
|
3813
|
+
define(1, ARRAY_ITERATOR, CAPITAL_HTML, ITERATOR_HELPER, NAME),
|
|
3814
|
+
define(1, ARRAY_ITERATOR, FLAT, ITERATOR_HELPER, NO_V8_SRC),
|
|
3815
|
+
define(0, ARRAY_ITERATOR, FLAT, FROM_CODE_POINT, ITERATOR_HELPER, NAME, NO_V8_SRC),
|
|
3816
|
+
define(1, ARRAY_ITERATOR, FLAT, IE_SRC, ITERATOR_HELPER),
|
|
3817
|
+
define(1, ARRAY_ITERATOR, FLAT, ITERATOR_HELPER, NO_IE_SRC),
|
|
3818
|
+
define(1, ARRAY_ITERATOR, AT, FLAT, ITERATOR_HELPER, NO_V8_SRC),
|
|
3819
|
+
define(1, ARRAY_ITERATOR, BARPROP, FLAT, ITERATOR_HELPER, NO_V8_SRC),
|
|
3820
|
+
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, ITERATOR_HELPER, NO_V8_SRC),
|
|
3727
3821
|
]
|
|
3728
3822
|
);
|
|
3729
3823
|
|
|
@@ -3799,8 +3893,6 @@
|
|
|
3799
3893
|
define(0, ARRAY_ITERATOR, CAPITAL_HTML, NO_V8_SRC),
|
|
3800
3894
|
define(1, ARRAY_ITERATOR, AT, CAPITAL_HTML),
|
|
3801
3895
|
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FF_SRC, FLAT),
|
|
3802
|
-
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, IE_SRC),
|
|
3803
|
-
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, NO_IE_SRC),
|
|
3804
3896
|
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, IE_SRC),
|
|
3805
3897
|
define(2, ARRAY_ITERATOR, CAPITAL_HTML),
|
|
3806
3898
|
define(3, ARRAY_ITERATOR, AT, CAPITAL_HTML, IE_SRC),
|
|
@@ -3810,82 +3902,13 @@
|
|
|
3810
3902
|
]
|
|
3811
3903
|
);
|
|
3812
3904
|
|
|
3813
|
-
MAPPER_FORMATTER =
|
|
3814
|
-
defineList
|
|
3815
|
-
(
|
|
3816
|
-
[
|
|
3817
|
-
define
|
|
3818
|
-
(
|
|
3819
|
-
function (argName, accessor)
|
|
3820
|
-
{
|
|
3821
|
-
var otherArgName = chooseOtherArgName(argName);
|
|
3822
|
-
var mapper =
|
|
3823
|
-
'Function("return function(' + otherArgName + '){return function(' + argName +
|
|
3824
|
-
'){return ' + otherArgName + accessor + '}}")()';
|
|
3825
|
-
return mapper;
|
|
3826
|
-
}
|
|
3827
|
-
),
|
|
3828
|
-
define
|
|
3829
|
-
(
|
|
3830
|
-
function (argName, accessor)
|
|
3831
|
-
{
|
|
3832
|
-
var mapper =
|
|
3833
|
-
'Function("return function(' + argName + '){return this' + accessor +
|
|
3834
|
-
'}")().bind';
|
|
3835
|
-
return mapper;
|
|
3836
|
-
}
|
|
3837
|
-
),
|
|
3838
|
-
define
|
|
3839
|
-
(
|
|
3840
|
-
function (argName, accessor)
|
|
3841
|
-
{
|
|
3842
|
-
var otherArgName = chooseOtherArgName(argName);
|
|
3843
|
-
var mapper =
|
|
3844
|
-
'Function("return ' + otherArgName + '=>' + argName + '=>' + otherArgName +
|
|
3845
|
-
accessor + '")()';
|
|
3846
|
-
return mapper;
|
|
3847
|
-
},
|
|
3848
|
-
ARROW
|
|
3849
|
-
),
|
|
3850
|
-
],
|
|
3851
|
-
[
|
|
3852
|
-
define(0),
|
|
3853
|
-
define(1, ARRAY_ITERATOR),
|
|
3854
|
-
define(0, NO_FF_SRC),
|
|
3855
|
-
define(0, NO_V8_SRC),
|
|
3856
|
-
define(1, ARRAY_ITERATOR, CAPITAL_HTML),
|
|
3857
|
-
define(0, ARRAY_ITERATOR, AT),
|
|
3858
|
-
define(0, ARRAY_ITERATOR, FILL),
|
|
3859
|
-
define(0, ARRAY_ITERATOR, FLAT),
|
|
3860
|
-
define(0, ARRAY_ITERATOR, NO_IE_SRC),
|
|
3861
|
-
define(0, ARRAY_ITERATOR, CAPITAL_HTML, IE_SRC),
|
|
3862
|
-
define(2),
|
|
3863
|
-
]
|
|
3864
|
-
);
|
|
3865
|
-
|
|
3866
3905
|
NATIVE_FUNCTION_INFOS =
|
|
3867
3906
|
[
|
|
3868
3907
|
define({ expr: 'FILTER', shift: 6 }),
|
|
3869
|
-
define({ expr: 'FILL', shift: 4 }, FILL),
|
|
3870
3908
|
define({ expr: 'FLAT', shift: 4 }, FLAT),
|
|
3871
3909
|
define({ expr: 'AT', shift: 2 }, AT),
|
|
3872
3910
|
];
|
|
3873
3911
|
|
|
3874
|
-
OPTIMAL_ARG_NAME =
|
|
3875
|
-
defineList
|
|
3876
|
-
(
|
|
3877
|
-
[define('f'), define('undefined')],
|
|
3878
|
-
[
|
|
3879
|
-
define(0),
|
|
3880
|
-
define(1, AT),
|
|
3881
|
-
define(0, FLAT),
|
|
3882
|
-
define(1, FILL, IE_SRC),
|
|
3883
|
-
define(1, FILL, NO_IE_SRC),
|
|
3884
|
-
define(0, FILL, FLAT, IE_SRC),
|
|
3885
|
-
define(0, FILL, FLAT, NO_IE_SRC),
|
|
3886
|
-
]
|
|
3887
|
-
);
|
|
3888
|
-
|
|
3889
3912
|
OPTIMAL_B = defineList([define('B'), define('b')], [define(0), define(1, ARRAY_ITERATOR)]);
|
|
3890
3913
|
|
|
3891
3914
|
OPTIMAL_RETURN_STRING =
|
|
@@ -3903,8 +3926,6 @@
|
|
|
3903
3926
|
define(0, ARRAY_ITERATOR, CAPITAL_HTML, NO_V8_SRC),
|
|
3904
3927
|
define(1, ARRAY_ITERATOR, AT, CAPITAL_HTML),
|
|
3905
3928
|
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FF_SRC, FLAT),
|
|
3906
|
-
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, IE_SRC),
|
|
3907
|
-
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, NO_IE_SRC),
|
|
3908
3929
|
define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, IE_SRC),
|
|
3909
3930
|
define(2),
|
|
3910
3931
|
]
|
|
@@ -4454,7 +4475,7 @@
|
|
|
4454
4475
|
|
|
4455
4476
|
var tokenCache = createEmpty();
|
|
4456
4477
|
|
|
4457
|
-
// Reserved words
|
|
4478
|
+
// Reserved words that cannot be written with escape sequences.
|
|
4458
4479
|
var INESCAPABLE_WORDS = ['false', 'null', 'true'];
|
|
4459
4480
|
|
|
4460
4481
|
// This list includes reserved words and identifiers that would cause a change in a script's
|
|
@@ -4970,7 +4991,7 @@
|
|
|
4970
4991
|
var chain = stack.slice(stackIndex);
|
|
4971
4992
|
var feature = featureFromMask(encoder.mask);
|
|
4972
4993
|
var message = 'Circular reference detected: ' + chain.join(' < ') + ' – ' + feature;
|
|
4973
|
-
var error =
|
|
4994
|
+
var error = _SyntaxError(message);
|
|
4974
4995
|
assignNoEnum$1(error, { chain: chain, feature: feature });
|
|
4975
4996
|
throw error;
|
|
4976
4997
|
}
|
|
@@ -5189,7 +5210,7 @@
|
|
|
5189
5210
|
var stackLength = stack.length;
|
|
5190
5211
|
if (stackLength)
|
|
5191
5212
|
message += ' in the definition of ' + stack[stackLength - 1];
|
|
5192
|
-
throw
|
|
5213
|
+
throw _SyntaxError(message);
|
|
5193
5214
|
}
|
|
5194
5215
|
|
|
5195
5216
|
var matchSimpleAt =
|
|
@@ -5284,6 +5305,8 @@
|
|
|
5284
5305
|
throwSyntaxError(this, 'Undefined regular padding block with length ' + length);
|
|
5285
5306
|
},
|
|
5286
5307
|
|
|
5308
|
+
_guardResolution: noop,
|
|
5309
|
+
|
|
5287
5310
|
_replaceCharByAtob: replaceCharByAtob,
|
|
5288
5311
|
|
|
5289
5312
|
_replaceCharByCharCode: replaceCharByCharCode,
|
|
@@ -5492,11 +5515,9 @@
|
|
|
5492
5515
|
var firstSolution = options.firstSolution;
|
|
5493
5516
|
var maxLength = options.maxLength;
|
|
5494
5517
|
if (firstSolution)
|
|
5495
|
-
{
|
|
5496
5518
|
buffer.append(firstSolution);
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
}
|
|
5519
|
+
if (buffer.length > maxLength)
|
|
5520
|
+
return;
|
|
5500
5521
|
var length = str.length;
|
|
5501
5522
|
for (var index = 0; index < length;)
|
|
5502
5523
|
{
|
|
@@ -5559,15 +5580,17 @@
|
|
|
5559
5580
|
var solution = charCache[char];
|
|
5560
5581
|
if (solution === undefined)
|
|
5561
5582
|
{
|
|
5583
|
+
var charName = _JSON_stringify$1(char);
|
|
5562
5584
|
callResolver
|
|
5563
5585
|
(
|
|
5564
5586
|
this,
|
|
5565
|
-
|
|
5587
|
+
charName,
|
|
5566
5588
|
function ()
|
|
5567
5589
|
{
|
|
5568
5590
|
var entries = CHARACTERS[char];
|
|
5569
5591
|
if (!entries || _Array_isArray$1(entries))
|
|
5570
5592
|
{
|
|
5593
|
+
this._guardResolution(charName);
|
|
5571
5594
|
if (entries)
|
|
5572
5595
|
solution = findOptimalSolution(this, char, entries);
|
|
5573
5596
|
if (!solution)
|
|
@@ -5602,6 +5625,7 @@
|
|
|
5602
5625
|
var entries = this.constantDefinitions[constant];
|
|
5603
5626
|
if (_Array_isArray$1(entries))
|
|
5604
5627
|
{
|
|
5628
|
+
this._guardResolution(constant);
|
|
5605
5629
|
solution =
|
|
5606
5630
|
findOptimalSolution(this, constant, entries, SolutionType.OBJECT);
|
|
5607
5631
|
}
|
|
@@ -5620,6 +5644,12 @@
|
|
|
5620
5644
|
}
|
|
5621
5645
|
);
|
|
5622
5646
|
|
|
5647
|
+
STATIC_ENCODER._guardResolution =
|
|
5648
|
+
function (name)
|
|
5649
|
+
{
|
|
5650
|
+
throw _Error$1('Unable to resolve ' + name + ' statically');
|
|
5651
|
+
};
|
|
5652
|
+
|
|
5623
5653
|
initStaticEncoder(STATIC_ENCODER);
|
|
5624
5654
|
|
|
5625
5655
|
function createFigurator(startValues, joiner)
|
|
@@ -5743,6 +5773,268 @@
|
|
|
5743
5773
|
return figurator;
|
|
5744
5774
|
}
|
|
5745
5775
|
|
|
5776
|
+
function joinWithMaxLength(maxLength)
|
|
5777
|
+
{
|
|
5778
|
+
for (var index = arguments.length; ;)
|
|
5779
|
+
{
|
|
5780
|
+
if (maxLength < 0)
|
|
5781
|
+
return;
|
|
5782
|
+
if (--index < 1)
|
|
5783
|
+
break;
|
|
5784
|
+
var str = arguments[index];
|
|
5785
|
+
maxLength -= str.length;
|
|
5786
|
+
}
|
|
5787
|
+
var array = _Array_prototype_slice_call(arguments, 1);
|
|
5788
|
+
var result = array.join('');
|
|
5789
|
+
return result;
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5792
|
+
// Length of the shortest possible concat head replacement "[]".
|
|
5793
|
+
var CONCAT_HEAD_MIN_LENGTH = 2;
|
|
5794
|
+
|
|
5795
|
+
// The overhead of "[" + "]" plus the minimum concat head replacement length.
|
|
5796
|
+
var CONCAT_HEAD_MIN_OVERHEAD = 2 + CONCAT_HEAD_MIN_LENGTH;
|
|
5797
|
+
|
|
5798
|
+
// Length of the shortest possible concat part replacements "+[] and "![]".
|
|
5799
|
+
var CONCAT_PART_MIN_LENGTH = 3;
|
|
5800
|
+
|
|
5801
|
+
// The overhead of "[" + "](" + ")" plus the minimum concat part replacement length.
|
|
5802
|
+
var CONCAT_PART_MIN_OVERHEAD = 4 + CONCAT_PART_MIN_LENGTH;
|
|
5803
|
+
|
|
5804
|
+
// Length of the shortest possible joiner replacement "[]".
|
|
5805
|
+
var JOINER_MIN_LENGTH = 2;
|
|
5806
|
+
|
|
5807
|
+
// The overhead of "[" + "](" + ")" plus the minimum joiner replacement length.
|
|
5808
|
+
var JOINING_MIN_OVERHEAD = 4 + JOINER_MIN_LENGTH;
|
|
5809
|
+
|
|
5810
|
+
// Length of the shortest possible separator replacement "[]".
|
|
5811
|
+
var SEPARATOR_MIN_LENGTH = 2;
|
|
5812
|
+
|
|
5813
|
+
// The overhead of "[" + "](" + ")" plus the minimum separator replacement length.
|
|
5814
|
+
var SEPARATION_MIN_OVERHEAD = 4 + SEPARATOR_MIN_LENGTH;
|
|
5815
|
+
|
|
5816
|
+
// Length of the shortest possible sequence replacement "([]+[])".
|
|
5817
|
+
var SEQUENCE_MIN_LENGTH = 7;
|
|
5818
|
+
|
|
5819
|
+
/**
|
|
5820
|
+
* An object that exposes properties used to split a string into an array of strings or to join
|
|
5821
|
+
* array elements into a string.
|
|
5822
|
+
*
|
|
5823
|
+
* @typedef Delimiter
|
|
5824
|
+
*
|
|
5825
|
+
* @property {string} separator
|
|
5826
|
+
* An express-parsable expression used as an argument for `String.prototype.split` to split a string
|
|
5827
|
+
* into an array of strings.
|
|
5828
|
+
*
|
|
5829
|
+
* @property {string} joiner
|
|
5830
|
+
* The joiner can be any string. A joiner is inserted between adjacent strings in an array in order
|
|
5831
|
+
* to join them into a single string.
|
|
5832
|
+
*/
|
|
5833
|
+
|
|
5834
|
+
function createConcatenationReplacement
|
|
5835
|
+
(encoder, array, allowZeroForEmptyElements, forceString, maxLength)
|
|
5836
|
+
{
|
|
5837
|
+
var concatReplacement = encoder.resolveConstant('CONCAT').replacement;
|
|
5838
|
+
var concatCount = array.length - 1;
|
|
5839
|
+
maxLength -=
|
|
5840
|
+
CONCAT_HEAD_MIN_OVERHEAD + concatCount * (concatReplacement.length + CONCAT_PART_MIN_OVERHEAD);
|
|
5841
|
+
if (maxLength < 0)
|
|
5842
|
+
return;
|
|
5843
|
+
var options = { screwMode: forceString ? SCREW_AS_STRING : SCREW_NORMAL };
|
|
5844
|
+
var replacements = [];
|
|
5845
|
+
for (var index = 0; index <= concatCount; ++index)
|
|
5846
|
+
{
|
|
5847
|
+
var element = array[index];
|
|
5848
|
+
var elementReplacement = undefinedAsString(replaceStaticString(element, options));
|
|
5849
|
+
var minLength = index ? CONCAT_PART_MIN_LENGTH : CONCAT_HEAD_MIN_LENGTH;
|
|
5850
|
+
if (index)
|
|
5851
|
+
{
|
|
5852
|
+
if (elementReplacement === '[]')
|
|
5853
|
+
elementReplacement = allowZeroForEmptyElements ? '+[]' : '[[]]';
|
|
5854
|
+
replacements.push('[', concatReplacement, '](', elementReplacement, ')');
|
|
5855
|
+
}
|
|
5856
|
+
else
|
|
5857
|
+
replacements.push('[', elementReplacement, ']');
|
|
5858
|
+
maxLength -= elementReplacement.length - minLength;
|
|
5859
|
+
if (maxLength < 0)
|
|
5860
|
+
return;
|
|
5861
|
+
}
|
|
5862
|
+
var concatenationReplacement = replacements.join('');
|
|
5863
|
+
return concatenationReplacement;
|
|
5864
|
+
}
|
|
5865
|
+
|
|
5866
|
+
function createSubstitutionsReplacement(encoder, substitutions, maxLength)
|
|
5867
|
+
{
|
|
5868
|
+
var substitutionCount = substitutions ? substitutions.length : 0;
|
|
5869
|
+
if (!substitutionCount)
|
|
5870
|
+
return '';
|
|
5871
|
+
var splitReplacement = encoder.resolveConstant('SPLIT').replacement;
|
|
5872
|
+
var joinReplacement = encoder.resolveConstant('JOIN').replacement;
|
|
5873
|
+
maxLength -=
|
|
5874
|
+
substitutionCount *
|
|
5875
|
+
(
|
|
5876
|
+
splitReplacement.length + SEPARATION_MIN_OVERHEAD +
|
|
5877
|
+
joinReplacement.length + JOINING_MIN_OVERHEAD
|
|
5878
|
+
);
|
|
5879
|
+
if (maxLength < 0)
|
|
5880
|
+
return;
|
|
5881
|
+
var replacements = [];
|
|
5882
|
+
for (var index = 0; index < substitutionCount; ++index)
|
|
5883
|
+
{
|
|
5884
|
+
var substitution = substitutions[index];
|
|
5885
|
+
var separatorReplacement = undefinedAsString(encoder.replaceExpr(substitution.separator));
|
|
5886
|
+
var joinerReplacement = undefinedAsString(encoder.replaceString(substitution.joiner));
|
|
5887
|
+
maxLength -=
|
|
5888
|
+
separatorReplacement.length - SEPARATOR_MIN_LENGTH +
|
|
5889
|
+
joinerReplacement.length - JOINER_MIN_LENGTH;
|
|
5890
|
+
if (maxLength < 0)
|
|
5891
|
+
return;
|
|
5892
|
+
replacements.push
|
|
5893
|
+
(
|
|
5894
|
+
'[',
|
|
5895
|
+
splitReplacement,
|
|
5896
|
+
'](',
|
|
5897
|
+
separatorReplacement,
|
|
5898
|
+
')[',
|
|
5899
|
+
joinReplacement,
|
|
5900
|
+
'](',
|
|
5901
|
+
joinerReplacement,
|
|
5902
|
+
')'
|
|
5903
|
+
);
|
|
5904
|
+
}
|
|
5905
|
+
var substitutionsReplacement = replacements.join('');
|
|
5906
|
+
return substitutionsReplacement;
|
|
5907
|
+
}
|
|
5908
|
+
|
|
5909
|
+
function replaceJoinedArrayString(array, joiner, maxLength)
|
|
5910
|
+
{
|
|
5911
|
+
var str = array.join(joiner);
|
|
5912
|
+
var options = { maxLength: maxLength, screwMode: SCREW_AS_BONDED_STRING };
|
|
5913
|
+
var replacement = replaceStaticString(str, options);
|
|
5914
|
+
return replacement;
|
|
5915
|
+
}
|
|
5916
|
+
|
|
5917
|
+
/**
|
|
5918
|
+
* Replaces a given array of statically replaceable strings with equivalent JSFuck code.
|
|
5919
|
+
*
|
|
5920
|
+
* @function Encoder#replaceStringArray
|
|
5921
|
+
*
|
|
5922
|
+
* @param {string[]} array
|
|
5923
|
+
* The string array to replace. Empty arrays are not supported.
|
|
5924
|
+
*
|
|
5925
|
+
* @param {Delimiter[]} insertions
|
|
5926
|
+
* An array of delimiters of which at most one will be used to compose a joined string and split it
|
|
5927
|
+
* into an array of strings. Every joiner in the insertions must be a statically replaceable string.
|
|
5928
|
+
*
|
|
5929
|
+
* The encoder can pick an insertion and insert a joiner between any two adjacent elements to mark
|
|
5930
|
+
* the boundary between them. The separator is then used to split the concatenated string back into
|
|
5931
|
+
* its elements.
|
|
5932
|
+
*
|
|
5933
|
+
* @param {Delimiter[]|null} [substitutions]
|
|
5934
|
+
* An array of delimiters, specifying substitutions to be applied to the input elements.
|
|
5935
|
+
*
|
|
5936
|
+
* All substitutions are applied on each element of the input array, in the order they are
|
|
5937
|
+
* specified.
|
|
5938
|
+
*
|
|
5939
|
+
* Substitutions are expensive in two ways: they create additional overhead and prevent certain
|
|
5940
|
+
* optimizations for short arrays to be made. To allow all optimizations to be performed, omit this
|
|
5941
|
+
* argument or set it to null instead of specifying an empty array.
|
|
5942
|
+
*
|
|
5943
|
+
* @param {boolean} [allowZeroForEmptyElements=false]
|
|
5944
|
+
* Indicates whether empty string elements in the input array may be replaced with zeros.
|
|
5945
|
+
*
|
|
5946
|
+
* @param {boolean} [forceString=false]
|
|
5947
|
+
* Indicates whether the elements in the replacement expression should evaluate to strings.
|
|
5948
|
+
*
|
|
5949
|
+
* If this argument is falsy, the elements in the replacement expression may not be equal to those
|
|
5950
|
+
* in the input array, but will have the same string representation.
|
|
5951
|
+
*
|
|
5952
|
+
* Regardless of this argument, the string representation of the value of the whole replacement
|
|
5953
|
+
* expression will be always the same as the string representation of the input array after applying
|
|
5954
|
+
* substitutions (including optional empty string to zero replacements) to its elements.
|
|
5955
|
+
*
|
|
5956
|
+
* @param {number} [maxLength=(NaN)]
|
|
5957
|
+
* The maximum length of the replacement expression.
|
|
5958
|
+
*
|
|
5959
|
+
* If the replacement expression exceeds the specified length, the return value is `undefined`.
|
|
5960
|
+
*
|
|
5961
|
+
* If this parameter is `NaN`, then no length limit is imposed.
|
|
5962
|
+
*
|
|
5963
|
+
* @returns {string|undefined}
|
|
5964
|
+
* The replacement string or `undefined`.
|
|
5965
|
+
*/
|
|
5966
|
+
function replaceStringArray
|
|
5967
|
+
(array, insertions, substitutions, allowZeroForEmptyElements, forceString, maxLength)
|
|
5968
|
+
{
|
|
5969
|
+
var replacement;
|
|
5970
|
+
var count = array.length;
|
|
5971
|
+
// Don't even try the split approach for two or less elements if the concat approach can be
|
|
5972
|
+
// applied.
|
|
5973
|
+
if (substitutions || count > 2)
|
|
5974
|
+
{
|
|
5975
|
+
var splitReplacement = this.resolveConstant('SPLIT').replacement;
|
|
5976
|
+
var minSubstitutionsReplacementLength =
|
|
5977
|
+
maxLength -
|
|
5978
|
+
SEQUENCE_MIN_LENGTH -
|
|
5979
|
+
splitReplacement.length -
|
|
5980
|
+
SEPARATION_MIN_OVERHEAD;
|
|
5981
|
+
var substitutionsReplacement =
|
|
5982
|
+
createSubstitutionsReplacement(this, substitutions, minSubstitutionsReplacementLength);
|
|
5983
|
+
}
|
|
5984
|
+
if (substitutionsReplacement != null)
|
|
5985
|
+
// Approach 1: (array[0] + joiner + array[1] + joiner + array[2]...).split(separator)
|
|
5986
|
+
{
|
|
5987
|
+
var maxBulkLength =
|
|
5988
|
+
maxLength - substitutionsReplacement.length - splitReplacement.length -
|
|
5989
|
+
SEPARATION_MIN_OVERHEAD + SEPARATOR_MIN_LENGTH;
|
|
5990
|
+
var optimalSeqReplacement;
|
|
5991
|
+
var optimalSeparatorReplacement;
|
|
5992
|
+
insertions.forEach
|
|
5993
|
+
(
|
|
5994
|
+
function (insertion)
|
|
5995
|
+
{
|
|
5996
|
+
var seqReplacement =
|
|
5997
|
+
replaceJoinedArrayString(array, insertion.joiner, maxBulkLength);
|
|
5998
|
+
if (!seqReplacement)
|
|
5999
|
+
return;
|
|
6000
|
+
var separatorReplacement = undefinedAsString(this.replaceExpr(insertion.separator));
|
|
6001
|
+
var bulkLength = seqReplacement.length + separatorReplacement.length;
|
|
6002
|
+
if (!(bulkLength > maxBulkLength))
|
|
6003
|
+
{
|
|
6004
|
+
maxBulkLength = bulkLength;
|
|
6005
|
+
optimalSeqReplacement = seqReplacement;
|
|
6006
|
+
optimalSeparatorReplacement = separatorReplacement;
|
|
6007
|
+
}
|
|
6008
|
+
},
|
|
6009
|
+
this
|
|
6010
|
+
);
|
|
6011
|
+
if (optimalSeqReplacement)
|
|
6012
|
+
{
|
|
6013
|
+
replacement =
|
|
6014
|
+
optimalSeqReplacement + substitutionsReplacement + '[' + splitReplacement + '](' +
|
|
6015
|
+
optimalSeparatorReplacement + ')';
|
|
6016
|
+
maxLength = replacement.length - 1;
|
|
6017
|
+
}
|
|
6018
|
+
}
|
|
6019
|
+
if (!substitutions)
|
|
6020
|
+
// Approach 2: [array[0]].concat(array[1]).concat(array[2])...
|
|
6021
|
+
{
|
|
6022
|
+
var arrayReplacement =
|
|
6023
|
+
createConcatenationReplacement
|
|
6024
|
+
(this, array, allowZeroForEmptyElements, forceString, maxLength);
|
|
6025
|
+
if (arrayReplacement)
|
|
6026
|
+
replacement = arrayReplacement;
|
|
6027
|
+
}
|
|
6028
|
+
return replacement;
|
|
6029
|
+
}
|
|
6030
|
+
|
|
6031
|
+
function undefinedAsString(replacement)
|
|
6032
|
+
{
|
|
6033
|
+
if (replacement === '[][[]]')
|
|
6034
|
+
replacement += '+[]';
|
|
6035
|
+
return replacement;
|
|
6036
|
+
}
|
|
6037
|
+
|
|
5746
6038
|
var ENCODING_TYPE_COMBINED = 'combined';
|
|
5747
6039
|
var ENCODING_TYPE_EXPRESSION = 'expression';
|
|
5748
6040
|
var ENCODING_TYPE_TEXT = 'text';
|
|
@@ -5750,6 +6042,12 @@
|
|
|
5750
6042
|
var FALSE_FREE_DELIMITER = { joiner: 'false', separator: 'false' };
|
|
5751
6043
|
var FALSE_TRUE_DELIMITER = { joiner: '', separator: 'Function("return/(?=false|true)/")()' };
|
|
5752
6044
|
|
|
6045
|
+
// Underestimated minimum length of the joining: "[" + joinReplacement + "]([])".
|
|
6046
|
+
var JOINING_MIN_LENGTH = 8;
|
|
6047
|
+
|
|
6048
|
+
// Underestimated minimum overhead of the mapping: "[" + "](" + mapperReplacement + ")".
|
|
6049
|
+
var MAPPING_MIN_OVERHEAD = 12;
|
|
6050
|
+
|
|
5753
6051
|
var REPLACERS =
|
|
5754
6052
|
{
|
|
5755
6053
|
identifier:
|
|
@@ -5829,7 +6127,7 @@
|
|
|
5829
6127
|
}
|
|
5830
6128
|
|
|
5831
6129
|
function createCharKeyArrayString
|
|
5832
|
-
(encoder, input, charMap, insertions, substitutions,
|
|
6130
|
+
(encoder, input, charMap, insertions, substitutions, areKeysFigures, maxLength)
|
|
5833
6131
|
{
|
|
5834
6132
|
var charKeyArray =
|
|
5835
6133
|
_Array_prototype_map_call
|
|
@@ -5842,27 +6140,67 @@
|
|
|
5842
6140
|
}
|
|
5843
6141
|
);
|
|
5844
6142
|
var charKeyArrayStr =
|
|
5845
|
-
encoder.replaceStringArray
|
|
6143
|
+
encoder.replaceStringArray
|
|
6144
|
+
(charKeyArray, insertions, substitutions, !areKeysFigures, areKeysFigures, maxLength);
|
|
5846
6145
|
return charKeyArrayStr;
|
|
5847
6146
|
}
|
|
5848
6147
|
|
|
5849
|
-
function
|
|
6148
|
+
function createLongStrCodesOutput(encoder, arrayReplacement, fromCharCode, arg, maxLength)
|
|
5850
6149
|
{
|
|
5851
|
-
var
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
6150
|
+
var mapReplacement = encoder.resolveConstant('MAP').replacement;
|
|
6151
|
+
var maxCharArrayLength = maxLength - JOINING_MIN_LENGTH;
|
|
6152
|
+
var maxMapReplacementLength =
|
|
6153
|
+
maxCharArrayLength - arrayReplacement.length - MAPPING_MIN_OVERHEAD;
|
|
6154
|
+
if (mapReplacement.length > maxMapReplacementLength)
|
|
6155
|
+
return;
|
|
6156
|
+
var formatter = encoder.findDefinition(FROM_CHAR_CODE_CALLBACK_FORMATTER);
|
|
6157
|
+
var formatterExpr = formatter(fromCharCode, arg);
|
|
6158
|
+
var mapper = 'Function("return ' + formatterExpr + '")()';
|
|
6159
|
+
var mapperReplacement = encoder._replaceMapper(mapper);
|
|
6160
|
+
var charArrayReplacement =
|
|
6161
|
+
joinWithMaxLength
|
|
6162
|
+
(
|
|
6163
|
+
maxCharArrayLength,
|
|
6164
|
+
arrayReplacement,
|
|
6165
|
+
'[',
|
|
6166
|
+
mapReplacement,
|
|
6167
|
+
'](',
|
|
6168
|
+
mapperReplacement,
|
|
6169
|
+
')'
|
|
6170
|
+
);
|
|
6171
|
+
if (!charArrayReplacement)
|
|
6172
|
+
return;
|
|
6173
|
+
var replacement = encoder._joinCharArray(charArrayReplacement, maxLength);
|
|
6174
|
+
return replacement;
|
|
5855
6175
|
}
|
|
5856
6176
|
|
|
5857
|
-
function
|
|
6177
|
+
function createMappedArrayEncoding(encoder, arrayReplacement, mapper, legend, maxLength)
|
|
5858
6178
|
{
|
|
5859
|
-
var
|
|
5860
|
-
var
|
|
5861
|
-
var
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
6179
|
+
var mapReplacement = encoder.resolveConstant('MAP').replacement;
|
|
6180
|
+
var maxCharArrayLength = maxLength - JOINING_MIN_LENGTH;
|
|
6181
|
+
var maxMapReplacementLength =
|
|
6182
|
+
// 2 is for the calling parentheses around the legend replacement.
|
|
6183
|
+
maxCharArrayLength - arrayReplacement.length - MAPPING_MIN_OVERHEAD - legend.length - 2;
|
|
6184
|
+
if (mapReplacement.length > maxMapReplacementLength)
|
|
6185
|
+
return;
|
|
6186
|
+
var mapperReplacement = encoder._replaceMapper(mapper);
|
|
6187
|
+
var charArrayReplacement =
|
|
6188
|
+
joinWithMaxLength
|
|
6189
|
+
(
|
|
6190
|
+
maxCharArrayLength,
|
|
6191
|
+
arrayReplacement,
|
|
6192
|
+
'[',
|
|
6193
|
+
mapReplacement,
|
|
6194
|
+
'](',
|
|
6195
|
+
mapperReplacement,
|
|
6196
|
+
'(',
|
|
6197
|
+
legend,
|
|
6198
|
+
'))'
|
|
6199
|
+
);
|
|
6200
|
+
if (!charArrayReplacement)
|
|
6201
|
+
return;
|
|
6202
|
+
var replacement = encoder._joinCharArray(charArrayReplacement, maxLength);
|
|
6203
|
+
return replacement;
|
|
5866
6204
|
}
|
|
5867
6205
|
|
|
5868
6206
|
function createReindexMap(count, radix, amendingCount, coerceToInt)
|
|
@@ -5930,41 +6268,58 @@
|
|
|
5930
6268
|
var strCodeCacheKey = 'strCodeCache' + (radix ? 'Radix' + radix : '');
|
|
5931
6269
|
var cache = inputData[strCodeCacheKey] || (inputData[strCodeCacheKey] = createEmpty());
|
|
5932
6270
|
var strCodeArray = splitter(input, radix, cache);
|
|
5933
|
-
var strCodeArrayStr =
|
|
6271
|
+
var strCodeArrayStr =
|
|
6272
|
+
encoder.replaceStringArray(strCodeArray, [FALSE_FREE_DELIMITER], null, false, false, maxLength);
|
|
5934
6273
|
if (strCodeArrayStr)
|
|
5935
6274
|
{
|
|
5936
|
-
var
|
|
6275
|
+
var replacement;
|
|
5937
6276
|
if (radix)
|
|
5938
6277
|
{
|
|
5939
|
-
|
|
6278
|
+
replacement =
|
|
5940
6279
|
createLongStrCodesOutput
|
|
5941
|
-
(
|
|
6280
|
+
(
|
|
6281
|
+
encoder,
|
|
6282
|
+
strCodeArrayStr,
|
|
6283
|
+
fromCharCode,
|
|
6284
|
+
'parseInt(undefined,' + radix + ')',
|
|
6285
|
+
maxLength
|
|
6286
|
+
);
|
|
5942
6287
|
}
|
|
5943
6288
|
else
|
|
5944
6289
|
{
|
|
5945
6290
|
var long = strCodeArray.length > encoder._maxDecodableArgs;
|
|
5946
6291
|
if (long)
|
|
5947
6292
|
{
|
|
5948
|
-
|
|
5949
|
-
createLongStrCodesOutput
|
|
6293
|
+
replacement =
|
|
6294
|
+
createLongStrCodesOutput
|
|
6295
|
+
(
|
|
6296
|
+
encoder,
|
|
6297
|
+
strCodeArrayStr,
|
|
6298
|
+
fromCharCode,
|
|
6299
|
+
'undefined',
|
|
6300
|
+
maxLength
|
|
6301
|
+
);
|
|
5950
6302
|
}
|
|
5951
6303
|
else
|
|
5952
6304
|
{
|
|
5953
6305
|
var returnString = encoder.findDefinition(OPTIMAL_RETURN_STRING);
|
|
5954
6306
|
var str = returnString + '.' + fromCharCode + '(';
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
6307
|
+
replacement =
|
|
6308
|
+
joinWithMaxLength
|
|
6309
|
+
(
|
|
6310
|
+
maxLength,
|
|
6311
|
+
encoder.resolveConstant('Function').replacement,
|
|
6312
|
+
'(',
|
|
6313
|
+
encoder.replaceString(str, { optimize: true }),
|
|
6314
|
+
'+',
|
|
6315
|
+
strCodeArrayStr,
|
|
6316
|
+
'+',
|
|
6317
|
+
encoder.resolveCharacter(')').replacement,
|
|
6318
|
+
')()'
|
|
6319
|
+
);
|
|
5964
6320
|
}
|
|
5965
6321
|
}
|
|
5966
|
-
|
|
5967
|
-
return output;
|
|
6322
|
+
return replacement;
|
|
5968
6323
|
}
|
|
5969
6324
|
}
|
|
5970
6325
|
|
|
@@ -6023,15 +6378,21 @@
|
|
|
6023
6378
|
var legend = encodeDictLegend(encoder, dictChars, maxLength - minCharIndexArrayStrLength);
|
|
6024
6379
|
if (!legend)
|
|
6025
6380
|
return;
|
|
6026
|
-
var figureLegendInsertions =
|
|
6027
|
-
encoder._callGetFigureLegendInsertions(getFigureLegendInsertions, figurator, figures);
|
|
6381
|
+
var figureLegendInsertions = getFigureLegendInsertions(figurator, figures);
|
|
6028
6382
|
var figureMaxLength = maxLength - legend.length;
|
|
6029
6383
|
var figureLegend =
|
|
6030
6384
|
encoder.replaceStringArray
|
|
6031
|
-
(
|
|
6385
|
+
(
|
|
6386
|
+
figures,
|
|
6387
|
+
figureLegendInsertions,
|
|
6388
|
+
null,
|
|
6389
|
+
false,
|
|
6390
|
+
true,
|
|
6391
|
+
figureMaxLength - minCharIndexArrayStrLength
|
|
6392
|
+
);
|
|
6032
6393
|
if (!figureLegend)
|
|
6033
6394
|
return;
|
|
6034
|
-
var
|
|
6395
|
+
var charIndexFigureArrayStr =
|
|
6035
6396
|
createCharKeyArrayString
|
|
6036
6397
|
(
|
|
6037
6398
|
encoder,
|
|
@@ -6042,15 +6403,12 @@
|
|
|
6042
6403
|
true,
|
|
6043
6404
|
figureMaxLength - figureLegend.length
|
|
6044
6405
|
);
|
|
6045
|
-
if (!
|
|
6406
|
+
if (!charIndexFigureArrayStr)
|
|
6046
6407
|
return;
|
|
6047
|
-
var
|
|
6048
|
-
var
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
var charIndexArrayStr =
|
|
6052
|
-
createJSFuckArrayMapping(encoder, keyFigureArrayStr, mapper, figureLegend);
|
|
6053
|
-
var output = encoder.createDictEncoding(legend, charIndexArrayStr, maxLength);
|
|
6408
|
+
var formatMapper = encoder._findFormatMapperShort();
|
|
6409
|
+
var output =
|
|
6410
|
+
encoder._createDblDictEncoding
|
|
6411
|
+
(formatMapper, charIndexFigureArrayStr, figureLegend, legend, maxLength);
|
|
6054
6412
|
return output;
|
|
6055
6413
|
}
|
|
6056
6414
|
|
|
@@ -6186,13 +6544,6 @@
|
|
|
6186
6544
|
return strCodes;
|
|
6187
6545
|
}
|
|
6188
6546
|
|
|
6189
|
-
function undefinedAsString(replacement)
|
|
6190
|
-
{
|
|
6191
|
-
if (replacement === '[][[]]')
|
|
6192
|
-
replacement += '+[]';
|
|
6193
|
-
return replacement;
|
|
6194
|
-
}
|
|
6195
|
-
|
|
6196
6547
|
function wrapWithCall(str)
|
|
6197
6548
|
{
|
|
6198
6549
|
var output = this.resolveConstant('Function').replacement + '(' + str + ')()';
|
|
@@ -6342,15 +6693,15 @@
|
|
|
6342
6693
|
|
|
6343
6694
|
/* -------------------------------------------------------------------------------------- *\
|
|
6344
6695
|
|
|
6345
|
-
Encodes "
|
|
6696
|
+
Encodes "FIFTY" as:
|
|
6346
6697
|
|
|
6347
|
-
"
|
|
6698
|
+
"false1falsefalse2false3".split(false).map("".charAt.bind("FITY")).join([])
|
|
6348
6699
|
|
|
6349
6700
|
(split strategy)
|
|
6350
6701
|
|
|
6351
6702
|
Or:
|
|
6352
6703
|
|
|
6353
|
-
[
|
|
6704
|
+
[[]].concat(1).concat(0).concat(2).concat(3).map("".charAt.bind("FITY")).join([])
|
|
6354
6705
|
|
|
6355
6706
|
(concat strategy)
|
|
6356
6707
|
|
|
@@ -6565,7 +6916,7 @@
|
|
|
6565
6916
|
return output;
|
|
6566
6917
|
},
|
|
6567
6918
|
ENCODING_TYPE_TEXT,
|
|
6568
|
-
|
|
6919
|
+
194
|
|
6569
6920
|
),
|
|
6570
6921
|
|
|
6571
6922
|
/* -------------------------------------------------------------------------------------- *\
|
|
@@ -6620,7 +6971,7 @@
|
|
|
6620
6971
|
return output;
|
|
6621
6972
|
},
|
|
6622
6973
|
ENCODING_TYPE_TEXT,
|
|
6623
|
-
|
|
6974
|
+
173
|
|
6624
6975
|
),
|
|
6625
6976
|
|
|
6626
6977
|
/* -------------------------------------------------------------------------------------- *\
|
|
@@ -6710,11 +7061,51 @@
|
|
|
6710
7061
|
(
|
|
6711
7062
|
Encoder.prototype,
|
|
6712
7063
|
{
|
|
6713
|
-
|
|
6714
|
-
function (
|
|
7064
|
+
_createDblDictEncoding:
|
|
7065
|
+
function (formatMapper, charIndexFigureArrayStr, figureLegend, legend, maxLength)
|
|
6715
7066
|
{
|
|
6716
|
-
var
|
|
6717
|
-
|
|
7067
|
+
var argName = formatMapper.argName;
|
|
7068
|
+
var accessor = '.indexOf(' + argName + ')';
|
|
7069
|
+
var mapper = formatMapper(accessor);
|
|
7070
|
+
var concatReplacement = this.resolveConstant('CONCAT').replacement;
|
|
7071
|
+
var maxCombinedLegendLength = maxLength - charIndexFigureArrayStr.length - 10;
|
|
7072
|
+
var combinedLegend =
|
|
7073
|
+
joinWithMaxLength
|
|
7074
|
+
(
|
|
7075
|
+
maxCombinedLegendLength,
|
|
7076
|
+
'[',
|
|
7077
|
+
figureLegend,
|
|
7078
|
+
'][',
|
|
7079
|
+
concatReplacement,
|
|
7080
|
+
'](',
|
|
7081
|
+
legend,
|
|
7082
|
+
')'
|
|
7083
|
+
);
|
|
7084
|
+
if (!combinedLegend)
|
|
7085
|
+
return;
|
|
7086
|
+
var replacement =
|
|
7087
|
+
createMappedArrayEncoding
|
|
7088
|
+
(this, charIndexFigureArrayStr, mapper, combinedLegend, maxLength);
|
|
7089
|
+
return replacement;
|
|
7090
|
+
},
|
|
7091
|
+
|
|
7092
|
+
_createDictEncoding:
|
|
7093
|
+
function (charIndexArrayStr, legend, radix, coerceToInt, maxLength)
|
|
7094
|
+
{
|
|
7095
|
+
var mapper;
|
|
7096
|
+
if (radix)
|
|
7097
|
+
{
|
|
7098
|
+
var formatMapper = this.findDefinition(FORMAT_MAPPER_LONG);
|
|
7099
|
+
var argName = formatMapper.argName;
|
|
7100
|
+
var parseIntArg = (coerceToInt ? '+' : '') + argName;
|
|
7101
|
+
var accessor = '[parseInt(' + parseIntArg + ',' + radix + ')]';
|
|
7102
|
+
mapper = formatMapper(accessor);
|
|
7103
|
+
}
|
|
7104
|
+
else
|
|
7105
|
+
mapper = '"".charAt.bind';
|
|
7106
|
+
var replacement =
|
|
7107
|
+
createMappedArrayEncoding(this, charIndexArrayStr, mapper, legend, maxLength);
|
|
7108
|
+
return replacement;
|
|
6718
7109
|
},
|
|
6719
7110
|
|
|
6720
7111
|
_encodeByCharCodes:
|
|
@@ -6811,7 +7202,7 @@
|
|
|
6811
7202
|
if (!charIndexArrayStr)
|
|
6812
7203
|
return;
|
|
6813
7204
|
var output =
|
|
6814
|
-
this.
|
|
7205
|
+
this._createDictEncoding(charIndexArrayStr, legend, radix, coerceToInt, maxLength);
|
|
6815
7206
|
return output;
|
|
6816
7207
|
},
|
|
6817
7208
|
|
|
@@ -6859,265 +7250,36 @@
|
|
|
6859
7250
|
perfInfo.perfLog = perfLog;
|
|
6860
7251
|
delete this.perfLog;
|
|
6861
7252
|
if (output == null)
|
|
6862
|
-
throw
|
|
7253
|
+
throw _Error$1('Encoding failed');
|
|
6863
7254
|
return output;
|
|
6864
7255
|
},
|
|
6865
7256
|
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
createDictEncoding:
|
|
6869
|
-
function (legend, charIndexArrayStr, maxLength, radix, coerceToInt)
|
|
6870
|
-
{
|
|
6871
|
-
var mapper;
|
|
6872
|
-
if (radix)
|
|
6873
|
-
{
|
|
6874
|
-
var formatter = this.findDefinition(MAPPER_FORMATTER);
|
|
6875
|
-
var argName = this.findDefinition(OPTIMAL_ARG_NAME);
|
|
6876
|
-
var parseIntArg = (coerceToInt ? '+' : '') + argName;
|
|
6877
|
-
var accessor = '[parseInt(' + parseIntArg + ',' + radix + ')]';
|
|
6878
|
-
mapper = formatter(argName, accessor);
|
|
6879
|
-
}
|
|
6880
|
-
else
|
|
6881
|
-
mapper = '"".charAt.bind';
|
|
6882
|
-
var output =
|
|
6883
|
-
createJSFuckArrayMapping(this, charIndexArrayStr, mapper, legend) + '[' +
|
|
6884
|
-
this.replaceString('join') + ']([])';
|
|
6885
|
-
if (!(output.length > maxLength))
|
|
6886
|
-
return output;
|
|
6887
|
-
},
|
|
6888
|
-
|
|
6889
|
-
// Array elements may not contain the substring "false", because the value false could be
|
|
6890
|
-
// used as a separator in the encoding.
|
|
6891
|
-
replaceFalseFreeArray:
|
|
6892
|
-
function (array, maxLength)
|
|
7257
|
+
_findFormatMapperShort:
|
|
7258
|
+
function ()
|
|
6893
7259
|
{
|
|
6894
|
-
var
|
|
6895
|
-
|
|
6896
|
-
return result;
|
|
7260
|
+
var formatMapper = this.findDefinition(FORMAT_MAPPER_SHORT);
|
|
7261
|
+
return formatMapper;
|
|
6897
7262
|
},
|
|
6898
7263
|
|
|
6899
|
-
|
|
6900
|
-
function (
|
|
7264
|
+
_joinCharArray:
|
|
7265
|
+
function (charArrayReplacement, maxLength)
|
|
6901
7266
|
{
|
|
6902
|
-
var
|
|
6903
|
-
var replacement =
|
|
7267
|
+
var joinReplacement = this.resolveConstant('JOIN').replacement;
|
|
7268
|
+
var replacement =
|
|
7269
|
+
joinWithMaxLength(maxLength, charArrayReplacement, '[', joinReplacement, ']([])');
|
|
6904
7270
|
return replacement;
|
|
6905
7271
|
},
|
|
6906
7272
|
|
|
6907
|
-
|
|
6908
|
-
* An object that exposes properties used to split a string into an array of strings or to
|
|
6909
|
-
* join array elements into a string.
|
|
6910
|
-
*
|
|
6911
|
-
* @typedef Delimiter
|
|
6912
|
-
*
|
|
6913
|
-
* @property {string} separator
|
|
6914
|
-
* An express-parsable expression used as an argument for `String.prototype.split` to split
|
|
6915
|
-
* a string into an array of strings.
|
|
6916
|
-
*
|
|
6917
|
-
* @property {number} joiner
|
|
6918
|
-
* The joiner can be any string. A joiner is inserted between adjacent strings in an array
|
|
6919
|
-
* in order to join them into a single string.
|
|
6920
|
-
*/
|
|
7273
|
+
_maxDecodableArgs: 65533, // Limit imposed by Internet Explorer.
|
|
6921
7274
|
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
*
|
|
6928
|
-
* @function Encoder#replaceStringArray
|
|
6929
|
-
*
|
|
6930
|
-
* @param {string[]} array
|
|
6931
|
-
* The string array to replace. Empty arrays are not supported.
|
|
6932
|
-
*
|
|
6933
|
-
* @param {Delimiter[]} insertions
|
|
6934
|
-
* An array of delimiters of which at most one will be used to compose a joined string and
|
|
6935
|
-
* split it into an array of strings.
|
|
6936
|
-
*
|
|
6937
|
-
* The encoder can pick an insertion and insert a joiner between any two adjacent elements
|
|
6938
|
-
* to mark the boundary between them. The separator is then used to split the concatenated
|
|
6939
|
-
* string back into its elements.
|
|
6940
|
-
*
|
|
6941
|
-
* @param {Delimiter[]|null} [substitutions]
|
|
6942
|
-
* An array of delimiters, specifying substitutions to be applied to the input elements.
|
|
6943
|
-
*
|
|
6944
|
-
* All substitutions are applied on each element of the input array, in the order they are
|
|
6945
|
-
* specified.
|
|
6946
|
-
*
|
|
6947
|
-
* Substitutions are expensive in two ways: they create additional overhead and prevent
|
|
6948
|
-
* certain optimizations for short arrays to be made. To allow all optimizations to be
|
|
6949
|
-
* performed, omit this argument or set it to null instead of specifying an empty array.
|
|
6950
|
-
*
|
|
6951
|
-
* @param {boolean} [forceString=false]
|
|
6952
|
-
* Indicates whether the elements in the replacement expression should evaluate to strings.
|
|
6953
|
-
*
|
|
6954
|
-
* If this argument is falsy, the elements in the replacement expression may not be equal to
|
|
6955
|
-
* those in the input array, but will have the same string representation.
|
|
6956
|
-
*
|
|
6957
|
-
* Regardless of this argument, the string representation of the value of the whole
|
|
6958
|
-
* replacement expression will be always the same as the string representation of the input
|
|
6959
|
-
* array.
|
|
6960
|
-
*
|
|
6961
|
-
* @param {number} [maxLength=(NaN)]
|
|
6962
|
-
* The maximum length of the replacement expression.
|
|
6963
|
-
*
|
|
6964
|
-
* If the replacement expression exceeds the specified length, the return value is
|
|
6965
|
-
* `undefined`.
|
|
6966
|
-
*
|
|
6967
|
-
* If this parameter is `NaN`, then no length limit is imposed.
|
|
6968
|
-
*
|
|
6969
|
-
* @returns {string|undefined}
|
|
6970
|
-
* The replacement string or `undefined`.
|
|
6971
|
-
*/
|
|
6972
|
-
replaceStringArray:
|
|
6973
|
-
function (array, insertions, substitutions, forceString, maxLength)
|
|
6974
|
-
{
|
|
6975
|
-
var replacement;
|
|
6976
|
-
var count = array.length;
|
|
6977
|
-
// Don't even try the split approach for 3 or less elements if the concat approach can
|
|
6978
|
-
// be applied.
|
|
6979
|
-
if (substitutions || count > 3)
|
|
6980
|
-
{
|
|
6981
|
-
var preReplacement =
|
|
6982
|
-
function ()
|
|
6983
|
-
{
|
|
6984
|
-
// Length of the shortest string replacement "([]+[])".
|
|
6985
|
-
var STRING_REPLACEMENT_MIN_LENGTH = 7;
|
|
6986
|
-
|
|
6987
|
-
// This is for the overhead of "[" + "](" + ")" plus the length of the shortest
|
|
6988
|
-
// separator replacement "[]".
|
|
6989
|
-
var SEPARATOR_MIN_OVERHEAD = 6;
|
|
6990
|
-
|
|
6991
|
-
// This is for the overhead of "[" + "](" + ")" plus the length of the shortest
|
|
6992
|
-
// joiner replacement "[]".
|
|
6993
|
-
var JOINER_MIN_OVERHEAD = 6;
|
|
6994
|
-
|
|
6995
|
-
var joinCount = substitutions ? substitutions.length : 0;
|
|
6996
|
-
var splitCount = joinCount + 1;
|
|
6997
|
-
var maxSplitReplacementLength =
|
|
6998
|
-
(maxLength - STRING_REPLACEMENT_MIN_LENGTH) / splitCount -
|
|
6999
|
-
SEPARATOR_MIN_OVERHEAD;
|
|
7000
|
-
var splitReplacement =
|
|
7001
|
-
this.replaceString
|
|
7002
|
-
('split', { maxLength: maxSplitReplacementLength, optimize: true });
|
|
7003
|
-
if (!splitReplacement)
|
|
7004
|
-
return;
|
|
7005
|
-
var preReplacement = '';
|
|
7006
|
-
if (joinCount)
|
|
7007
|
-
{
|
|
7008
|
-
var maxJoinReplacementLength =
|
|
7009
|
-
(
|
|
7010
|
-
maxLength - STRING_REPLACEMENT_MIN_LENGTH -
|
|
7011
|
-
splitCount * (splitReplacement.length + SEPARATOR_MIN_OVERHEAD)
|
|
7012
|
-
) /
|
|
7013
|
-
joinCount -
|
|
7014
|
-
JOINER_MIN_OVERHEAD;
|
|
7015
|
-
var joinReplacement =
|
|
7016
|
-
this.replaceString('join', { maxLength: maxJoinReplacementLength });
|
|
7017
|
-
if (!joinReplacement)
|
|
7018
|
-
return;
|
|
7019
|
-
substitutions.forEach
|
|
7020
|
-
(
|
|
7021
|
-
function (substitution)
|
|
7022
|
-
{
|
|
7023
|
-
var separatorReplacement =
|
|
7024
|
-
undefinedAsString(this.replaceExpr(substitution.separator));
|
|
7025
|
-
var joinerReplacement =
|
|
7026
|
-
undefinedAsString(this.replaceString(substitution.joiner));
|
|
7027
|
-
preReplacement +=
|
|
7028
|
-
'[' + splitReplacement + '](' + separatorReplacement + ')[' +
|
|
7029
|
-
joinReplacement + '](' + joinerReplacement + ')';
|
|
7030
|
-
},
|
|
7031
|
-
this
|
|
7032
|
-
);
|
|
7033
|
-
}
|
|
7034
|
-
preReplacement += '[' + splitReplacement + ']';
|
|
7035
|
-
return preReplacement;
|
|
7036
|
-
}
|
|
7037
|
-
.call(this);
|
|
7038
|
-
}
|
|
7039
|
-
if (!substitutions && count > 1)
|
|
7040
|
-
{
|
|
7041
|
-
var concatReplacement =
|
|
7042
|
-
this.replaceString('concat', { maxLength: maxLength, optimize: true });
|
|
7043
|
-
}
|
|
7044
|
-
if (preReplacement)
|
|
7045
|
-
// Approach 1: (array[0] + joiner + array[1] + joiner + array[2]...).split(separator)
|
|
7046
|
-
{
|
|
7047
|
-
// 2 is for the additional overhead of "(" + ")".
|
|
7048
|
-
var maxBulkLength = maxLength - (preReplacement.length + 2);
|
|
7049
|
-
var optimalStrReplacement;
|
|
7050
|
-
var optimalSeparatorReplacement;
|
|
7051
|
-
insertions.forEach
|
|
7052
|
-
(
|
|
7053
|
-
function (insertion)
|
|
7054
|
-
{
|
|
7055
|
-
var str = array.join(insertion.joiner);
|
|
7056
|
-
var strReplacement = this.replaceJoinedArrayString(str, maxBulkLength);
|
|
7057
|
-
if (!strReplacement)
|
|
7058
|
-
return;
|
|
7059
|
-
var separatorReplacement =
|
|
7060
|
-
undefinedAsString(this.replaceExpr(insertion.separator));
|
|
7061
|
-
var bulkLength = strReplacement.length + separatorReplacement.length;
|
|
7062
|
-
if (!(bulkLength > maxBulkLength))
|
|
7063
|
-
{
|
|
7064
|
-
maxBulkLength = bulkLength;
|
|
7065
|
-
optimalStrReplacement = strReplacement;
|
|
7066
|
-
optimalSeparatorReplacement = separatorReplacement;
|
|
7067
|
-
}
|
|
7068
|
-
},
|
|
7069
|
-
this
|
|
7070
|
-
);
|
|
7071
|
-
if (optimalStrReplacement)
|
|
7072
|
-
{
|
|
7073
|
-
replacement =
|
|
7074
|
-
optimalStrReplacement + preReplacement + '(' + optimalSeparatorReplacement +
|
|
7075
|
-
')';
|
|
7076
|
-
maxLength = replacement.length - 1;
|
|
7077
|
-
}
|
|
7078
|
-
}
|
|
7079
|
-
if
|
|
7080
|
-
(
|
|
7081
|
-
!substitutions &&
|
|
7082
|
-
(
|
|
7083
|
-
count <= 1 ||
|
|
7084
|
-
concatReplacement &&
|
|
7085
|
-
// 4 is the length of the shortest possible replacement "[[]]".
|
|
7086
|
-
// 7 is the length of the shortest possible additional overhead for each
|
|
7087
|
-
// following array element, as in "[" + "](+[])" or "[" + "](![])".
|
|
7088
|
-
!(4 + (concatReplacement.length + 7) * (count - 1) > maxLength)
|
|
7089
|
-
)
|
|
7090
|
-
)
|
|
7091
|
-
// Approach 2: [array[0]].concat(array[1]).concat(array[2])...
|
|
7092
|
-
{
|
|
7093
|
-
var arrayReplacement;
|
|
7094
|
-
var options = { screwMode: forceString ? SCREW_AS_STRING : SCREW_NORMAL };
|
|
7095
|
-
if
|
|
7096
|
-
(
|
|
7097
|
-
!array.some
|
|
7098
|
-
(
|
|
7099
|
-
function (element)
|
|
7100
|
-
{
|
|
7101
|
-
var elementReplacement =
|
|
7102
|
-
undefinedAsString(replaceStaticString(element, options));
|
|
7103
|
-
if (arrayReplacement)
|
|
7104
|
-
{
|
|
7105
|
-
if (elementReplacement === '[]')
|
|
7106
|
-
elementReplacement = '[[]]';
|
|
7107
|
-
arrayReplacement +=
|
|
7108
|
-
'[' + concatReplacement + '](' + elementReplacement + ')';
|
|
7109
|
-
}
|
|
7110
|
-
else
|
|
7111
|
-
arrayReplacement = '[' + elementReplacement + ']';
|
|
7112
|
-
var result = arrayReplacement.length > maxLength;
|
|
7113
|
-
return result;
|
|
7114
|
-
}
|
|
7115
|
-
)
|
|
7116
|
-
)
|
|
7117
|
-
replacement = arrayReplacement;
|
|
7118
|
-
}
|
|
7119
|
-
return replacement;
|
|
7275
|
+
_replaceMapper:
|
|
7276
|
+
function (mapper)
|
|
7277
|
+
{
|
|
7278
|
+
var mapperReplacement = this.replaceExpr(mapper, true);
|
|
7279
|
+
return mapperReplacement;
|
|
7120
7280
|
},
|
|
7281
|
+
|
|
7282
|
+
replaceStringArray: replaceStringArray,
|
|
7121
7283
|
}
|
|
7122
7284
|
);
|
|
7123
7285
|
|
|
@@ -7860,7 +8022,7 @@
|
|
|
7860
8022
|
case 'none':
|
|
7861
8023
|
return [, STRATEGY_NAMES_TEXT];
|
|
7862
8024
|
}
|
|
7863
|
-
throw
|
|
8025
|
+
throw _Error$1('Invalid value for option ' + name);
|
|
7864
8026
|
}
|
|
7865
8027
|
|
|
7866
8028
|
function flushEncoderCache()
|
|
@@ -8011,7 +8173,7 @@
|
|
|
8011
8173
|
{
|
|
8012
8174
|
constant = _String$1(constant);
|
|
8013
8175
|
if (!/^[$A-Z_a-z][$\w]*$/.test(constant))
|
|
8014
|
-
throw
|
|
8176
|
+
throw _SyntaxError('Invalid identifier ' + _JSON_stringify$1(constant));
|
|
8015
8177
|
if (!encoder.hasOwnProperty('constantDefinitions'))
|
|
8016
8178
|
encoder.constantDefinitions = _Object_create$1(CONSTANTS);
|
|
8017
8179
|
var entries = [define(esToString$1(definition))];
|
|
@@ -8087,10 +8249,10 @@
|
|
|
8087
8249
|
ENTRIES[name + ':available'] = entries.available;
|
|
8088
8250
|
}
|
|
8089
8251
|
|
|
8252
|
+
exposeEntries('FORMAT_MAPPER_LONG', FORMAT_MAPPER_LONG);
|
|
8253
|
+
exposeEntries('FORMAT_MAPPER_SHORT', FORMAT_MAPPER_SHORT);
|
|
8090
8254
|
exposeEntries('FROM_CHAR_CODE', FROM_CHAR_CODE);
|
|
8091
8255
|
exposeEntries('FROM_CHAR_CODE_CALLBACK_FORMATTER', FROM_CHAR_CODE_CALLBACK_FORMATTER);
|
|
8092
|
-
exposeEntries('MAPPER_FORMATTER', MAPPER_FORMATTER);
|
|
8093
|
-
exposeEntries('OPTIMAL_ARG_NAME', OPTIMAL_ARG_NAME);
|
|
8094
8256
|
exposeEntries('OPTIMAL_B', OPTIMAL_B);
|
|
8095
8257
|
exposeEntries('OPTIMAL_RETURN_STRING', OPTIMAL_RETURN_STRING);
|
|
8096
8258
|
}
|