vscode-behavior3 2.1.3 → 2.3.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/dist/extension.js CHANGED
@@ -5,7 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
8
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
9
9
  var __typeError = (msg) => {
10
10
  throw TypeError(msg);
11
11
  };
@@ -1186,2272 +1186,6 @@ var require_lib = __commonJS({
1186
1186
  }
1187
1187
  });
1188
1188
 
1189
- // node_modules/source-map/lib/base64.js
1190
- var require_base64 = __commonJS({
1191
- "node_modules/source-map/lib/base64.js"(exports2) {
1192
- var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
1193
- exports2.encode = function(number) {
1194
- if (0 <= number && number < intToCharMap.length) {
1195
- return intToCharMap[number];
1196
- }
1197
- throw new TypeError("Must be between 0 and 63: " + number);
1198
- };
1199
- exports2.decode = function(charCode) {
1200
- var bigA = 65;
1201
- var bigZ = 90;
1202
- var littleA = 97;
1203
- var littleZ = 122;
1204
- var zero = 48;
1205
- var nine = 57;
1206
- var plus = 43;
1207
- var slash = 47;
1208
- var littleOffset = 26;
1209
- var numberOffset = 52;
1210
- if (bigA <= charCode && charCode <= bigZ) {
1211
- return charCode - bigA;
1212
- }
1213
- if (littleA <= charCode && charCode <= littleZ) {
1214
- return charCode - littleA + littleOffset;
1215
- }
1216
- if (zero <= charCode && charCode <= nine) {
1217
- return charCode - zero + numberOffset;
1218
- }
1219
- if (charCode == plus) {
1220
- return 62;
1221
- }
1222
- if (charCode == slash) {
1223
- return 63;
1224
- }
1225
- return -1;
1226
- };
1227
- }
1228
- });
1229
-
1230
- // node_modules/source-map/lib/base64-vlq.js
1231
- var require_base64_vlq = __commonJS({
1232
- "node_modules/source-map/lib/base64-vlq.js"(exports2) {
1233
- var base64 = require_base64();
1234
- var VLQ_BASE_SHIFT = 5;
1235
- var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
1236
- var VLQ_BASE_MASK = VLQ_BASE - 1;
1237
- var VLQ_CONTINUATION_BIT = VLQ_BASE;
1238
- function toVLQSigned(aValue) {
1239
- return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
1240
- }
1241
- function fromVLQSigned(aValue) {
1242
- var isNegative = (aValue & 1) === 1;
1243
- var shifted = aValue >> 1;
1244
- return isNegative ? -shifted : shifted;
1245
- }
1246
- exports2.encode = function base64VLQ_encode(aValue) {
1247
- var encoded = "";
1248
- var digit;
1249
- var vlq = toVLQSigned(aValue);
1250
- do {
1251
- digit = vlq & VLQ_BASE_MASK;
1252
- vlq >>>= VLQ_BASE_SHIFT;
1253
- if (vlq > 0) {
1254
- digit |= VLQ_CONTINUATION_BIT;
1255
- }
1256
- encoded += base64.encode(digit);
1257
- } while (vlq > 0);
1258
- return encoded;
1259
- };
1260
- exports2.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
1261
- var strLen = aStr.length;
1262
- var result = 0;
1263
- var shift = 0;
1264
- var continuation, digit;
1265
- do {
1266
- if (aIndex >= strLen) {
1267
- throw new Error("Expected more digits in base 64 VLQ value.");
1268
- }
1269
- digit = base64.decode(aStr.charCodeAt(aIndex++));
1270
- if (digit === -1) {
1271
- throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
1272
- }
1273
- continuation = !!(digit & VLQ_CONTINUATION_BIT);
1274
- digit &= VLQ_BASE_MASK;
1275
- result = result + (digit << shift);
1276
- shift += VLQ_BASE_SHIFT;
1277
- } while (continuation);
1278
- aOutParam.value = fromVLQSigned(result);
1279
- aOutParam.rest = aIndex;
1280
- };
1281
- }
1282
- });
1283
-
1284
- // node_modules/source-map/lib/util.js
1285
- var require_util2 = __commonJS({
1286
- "node_modules/source-map/lib/util.js"(exports2) {
1287
- function getArg(aArgs, aName, aDefaultValue) {
1288
- if (aName in aArgs) {
1289
- return aArgs[aName];
1290
- } else if (arguments.length === 3) {
1291
- return aDefaultValue;
1292
- } else {
1293
- throw new Error('"' + aName + '" is a required argument.');
1294
- }
1295
- }
1296
- exports2.getArg = getArg;
1297
- var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
1298
- var dataUrlRegexp = /^data:.+\,.+$/;
1299
- function urlParse(aUrl) {
1300
- var match = aUrl.match(urlRegexp);
1301
- if (!match) {
1302
- return null;
1303
- }
1304
- return {
1305
- scheme: match[1],
1306
- auth: match[2],
1307
- host: match[3],
1308
- port: match[4],
1309
- path: match[5]
1310
- };
1311
- }
1312
- exports2.urlParse = urlParse;
1313
- function urlGenerate(aParsedUrl) {
1314
- var url = "";
1315
- if (aParsedUrl.scheme) {
1316
- url += aParsedUrl.scheme + ":";
1317
- }
1318
- url += "//";
1319
- if (aParsedUrl.auth) {
1320
- url += aParsedUrl.auth + "@";
1321
- }
1322
- if (aParsedUrl.host) {
1323
- url += aParsedUrl.host;
1324
- }
1325
- if (aParsedUrl.port) {
1326
- url += ":" + aParsedUrl.port;
1327
- }
1328
- if (aParsedUrl.path) {
1329
- url += aParsedUrl.path;
1330
- }
1331
- return url;
1332
- }
1333
- exports2.urlGenerate = urlGenerate;
1334
- function normalize3(aPath) {
1335
- var path14 = aPath;
1336
- var url = urlParse(aPath);
1337
- if (url) {
1338
- if (!url.path) {
1339
- return aPath;
1340
- }
1341
- path14 = url.path;
1342
- }
1343
- var isAbsolute7 = exports2.isAbsolute(path14);
1344
- var parts = path14.split(/\/+/);
1345
- for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
1346
- part = parts[i];
1347
- if (part === ".") {
1348
- parts.splice(i, 1);
1349
- } else if (part === "..") {
1350
- up++;
1351
- } else if (up > 0) {
1352
- if (part === "") {
1353
- parts.splice(i + 1, up);
1354
- up = 0;
1355
- } else {
1356
- parts.splice(i, 2);
1357
- up--;
1358
- }
1359
- }
1360
- }
1361
- path14 = parts.join("/");
1362
- if (path14 === "") {
1363
- path14 = isAbsolute7 ? "/" : ".";
1364
- }
1365
- if (url) {
1366
- url.path = path14;
1367
- return urlGenerate(url);
1368
- }
1369
- return path14;
1370
- }
1371
- exports2.normalize = normalize3;
1372
- function join10(aRoot, aPath) {
1373
- if (aRoot === "") {
1374
- aRoot = ".";
1375
- }
1376
- if (aPath === "") {
1377
- aPath = ".";
1378
- }
1379
- var aPathUrl = urlParse(aPath);
1380
- var aRootUrl = urlParse(aRoot);
1381
- if (aRootUrl) {
1382
- aRoot = aRootUrl.path || "/";
1383
- }
1384
- if (aPathUrl && !aPathUrl.scheme) {
1385
- if (aRootUrl) {
1386
- aPathUrl.scheme = aRootUrl.scheme;
1387
- }
1388
- return urlGenerate(aPathUrl);
1389
- }
1390
- if (aPathUrl || aPath.match(dataUrlRegexp)) {
1391
- return aPath;
1392
- }
1393
- if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
1394
- aRootUrl.host = aPath;
1395
- return urlGenerate(aRootUrl);
1396
- }
1397
- var joined = aPath.charAt(0) === "/" ? aPath : normalize3(aRoot.replace(/\/+$/, "") + "/" + aPath);
1398
- if (aRootUrl) {
1399
- aRootUrl.path = joined;
1400
- return urlGenerate(aRootUrl);
1401
- }
1402
- return joined;
1403
- }
1404
- exports2.join = join10;
1405
- exports2.isAbsolute = function(aPath) {
1406
- return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
1407
- };
1408
- function relative7(aRoot, aPath) {
1409
- if (aRoot === "") {
1410
- aRoot = ".";
1411
- }
1412
- aRoot = aRoot.replace(/\/$/, "");
1413
- var level = 0;
1414
- while (aPath.indexOf(aRoot + "/") !== 0) {
1415
- var index = aRoot.lastIndexOf("/");
1416
- if (index < 0) {
1417
- return aPath;
1418
- }
1419
- aRoot = aRoot.slice(0, index);
1420
- if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
1421
- return aPath;
1422
- }
1423
- ++level;
1424
- }
1425
- return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
1426
- }
1427
- exports2.relative = relative7;
1428
- var supportsNullProto = function() {
1429
- var obj = /* @__PURE__ */ Object.create(null);
1430
- return !("__proto__" in obj);
1431
- }();
1432
- function identity(s) {
1433
- return s;
1434
- }
1435
- function toSetString(aStr) {
1436
- if (isProtoString(aStr)) {
1437
- return "$" + aStr;
1438
- }
1439
- return aStr;
1440
- }
1441
- exports2.toSetString = supportsNullProto ? identity : toSetString;
1442
- function fromSetString(aStr) {
1443
- if (isProtoString(aStr)) {
1444
- return aStr.slice(1);
1445
- }
1446
- return aStr;
1447
- }
1448
- exports2.fromSetString = supportsNullProto ? identity : fromSetString;
1449
- function isProtoString(s) {
1450
- if (!s) {
1451
- return false;
1452
- }
1453
- var length = s.length;
1454
- if (length < 9) {
1455
- return false;
1456
- }
1457
- if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
1458
- return false;
1459
- }
1460
- for (var i = length - 10; i >= 0; i--) {
1461
- if (s.charCodeAt(i) !== 36) {
1462
- return false;
1463
- }
1464
- }
1465
- return true;
1466
- }
1467
- function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
1468
- var cmp = strcmp(mappingA.source, mappingB.source);
1469
- if (cmp !== 0) {
1470
- return cmp;
1471
- }
1472
- cmp = mappingA.originalLine - mappingB.originalLine;
1473
- if (cmp !== 0) {
1474
- return cmp;
1475
- }
1476
- cmp = mappingA.originalColumn - mappingB.originalColumn;
1477
- if (cmp !== 0 || onlyCompareOriginal) {
1478
- return cmp;
1479
- }
1480
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
1481
- if (cmp !== 0) {
1482
- return cmp;
1483
- }
1484
- cmp = mappingA.generatedLine - mappingB.generatedLine;
1485
- if (cmp !== 0) {
1486
- return cmp;
1487
- }
1488
- return strcmp(mappingA.name, mappingB.name);
1489
- }
1490
- exports2.compareByOriginalPositions = compareByOriginalPositions;
1491
- function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
1492
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
1493
- if (cmp !== 0) {
1494
- return cmp;
1495
- }
1496
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
1497
- if (cmp !== 0 || onlyCompareGenerated) {
1498
- return cmp;
1499
- }
1500
- cmp = strcmp(mappingA.source, mappingB.source);
1501
- if (cmp !== 0) {
1502
- return cmp;
1503
- }
1504
- cmp = mappingA.originalLine - mappingB.originalLine;
1505
- if (cmp !== 0) {
1506
- return cmp;
1507
- }
1508
- cmp = mappingA.originalColumn - mappingB.originalColumn;
1509
- if (cmp !== 0) {
1510
- return cmp;
1511
- }
1512
- return strcmp(mappingA.name, mappingB.name);
1513
- }
1514
- exports2.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
1515
- function strcmp(aStr1, aStr2) {
1516
- if (aStr1 === aStr2) {
1517
- return 0;
1518
- }
1519
- if (aStr1 === null) {
1520
- return 1;
1521
- }
1522
- if (aStr2 === null) {
1523
- return -1;
1524
- }
1525
- if (aStr1 > aStr2) {
1526
- return 1;
1527
- }
1528
- return -1;
1529
- }
1530
- function compareByGeneratedPositionsInflated(mappingA, mappingB) {
1531
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
1532
- if (cmp !== 0) {
1533
- return cmp;
1534
- }
1535
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
1536
- if (cmp !== 0) {
1537
- return cmp;
1538
- }
1539
- cmp = strcmp(mappingA.source, mappingB.source);
1540
- if (cmp !== 0) {
1541
- return cmp;
1542
- }
1543
- cmp = mappingA.originalLine - mappingB.originalLine;
1544
- if (cmp !== 0) {
1545
- return cmp;
1546
- }
1547
- cmp = mappingA.originalColumn - mappingB.originalColumn;
1548
- if (cmp !== 0) {
1549
- return cmp;
1550
- }
1551
- return strcmp(mappingA.name, mappingB.name);
1552
- }
1553
- exports2.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
1554
- function parseSourceMapInput(str) {
1555
- return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
1556
- }
1557
- exports2.parseSourceMapInput = parseSourceMapInput;
1558
- function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
1559
- sourceURL = sourceURL || "";
1560
- if (sourceRoot) {
1561
- if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") {
1562
- sourceRoot += "/";
1563
- }
1564
- sourceURL = sourceRoot + sourceURL;
1565
- }
1566
- if (sourceMapURL) {
1567
- var parsed = urlParse(sourceMapURL);
1568
- if (!parsed) {
1569
- throw new Error("sourceMapURL could not be parsed");
1570
- }
1571
- if (parsed.path) {
1572
- var index = parsed.path.lastIndexOf("/");
1573
- if (index >= 0) {
1574
- parsed.path = parsed.path.substring(0, index + 1);
1575
- }
1576
- }
1577
- sourceURL = join10(urlGenerate(parsed), sourceURL);
1578
- }
1579
- return normalize3(sourceURL);
1580
- }
1581
- exports2.computeSourceURL = computeSourceURL;
1582
- }
1583
- });
1584
-
1585
- // node_modules/source-map/lib/array-set.js
1586
- var require_array_set = __commonJS({
1587
- "node_modules/source-map/lib/array-set.js"(exports2) {
1588
- var util = require_util2();
1589
- var has = Object.prototype.hasOwnProperty;
1590
- var hasNativeMap = typeof Map !== "undefined";
1591
- function ArraySet() {
1592
- this._array = [];
1593
- this._set = hasNativeMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
1594
- }
1595
- ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
1596
- var set = new ArraySet();
1597
- for (var i = 0, len = aArray.length; i < len; i++) {
1598
- set.add(aArray[i], aAllowDuplicates);
1599
- }
1600
- return set;
1601
- };
1602
- ArraySet.prototype.size = function ArraySet_size() {
1603
- return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
1604
- };
1605
- ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
1606
- var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
1607
- var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
1608
- var idx = this._array.length;
1609
- if (!isDuplicate || aAllowDuplicates) {
1610
- this._array.push(aStr);
1611
- }
1612
- if (!isDuplicate) {
1613
- if (hasNativeMap) {
1614
- this._set.set(aStr, idx);
1615
- } else {
1616
- this._set[sStr] = idx;
1617
- }
1618
- }
1619
- };
1620
- ArraySet.prototype.has = function ArraySet_has(aStr) {
1621
- if (hasNativeMap) {
1622
- return this._set.has(aStr);
1623
- } else {
1624
- var sStr = util.toSetString(aStr);
1625
- return has.call(this._set, sStr);
1626
- }
1627
- };
1628
- ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
1629
- if (hasNativeMap) {
1630
- var idx = this._set.get(aStr);
1631
- if (idx >= 0) {
1632
- return idx;
1633
- }
1634
- } else {
1635
- var sStr = util.toSetString(aStr);
1636
- if (has.call(this._set, sStr)) {
1637
- return this._set[sStr];
1638
- }
1639
- }
1640
- throw new Error('"' + aStr + '" is not in the set.');
1641
- };
1642
- ArraySet.prototype.at = function ArraySet_at(aIdx) {
1643
- if (aIdx >= 0 && aIdx < this._array.length) {
1644
- return this._array[aIdx];
1645
- }
1646
- throw new Error("No element indexed by " + aIdx);
1647
- };
1648
- ArraySet.prototype.toArray = function ArraySet_toArray() {
1649
- return this._array.slice();
1650
- };
1651
- exports2.ArraySet = ArraySet;
1652
- }
1653
- });
1654
-
1655
- // node_modules/source-map/lib/mapping-list.js
1656
- var require_mapping_list = __commonJS({
1657
- "node_modules/source-map/lib/mapping-list.js"(exports2) {
1658
- var util = require_util2();
1659
- function generatedPositionAfter(mappingA, mappingB) {
1660
- var lineA = mappingA.generatedLine;
1661
- var lineB = mappingB.generatedLine;
1662
- var columnA = mappingA.generatedColumn;
1663
- var columnB = mappingB.generatedColumn;
1664
- return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
1665
- }
1666
- function MappingList() {
1667
- this._array = [];
1668
- this._sorted = true;
1669
- this._last = { generatedLine: -1, generatedColumn: 0 };
1670
- }
1671
- MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
1672
- this._array.forEach(aCallback, aThisArg);
1673
- };
1674
- MappingList.prototype.add = function MappingList_add(aMapping) {
1675
- if (generatedPositionAfter(this._last, aMapping)) {
1676
- this._last = aMapping;
1677
- this._array.push(aMapping);
1678
- } else {
1679
- this._sorted = false;
1680
- this._array.push(aMapping);
1681
- }
1682
- };
1683
- MappingList.prototype.toArray = function MappingList_toArray() {
1684
- if (!this._sorted) {
1685
- this._array.sort(util.compareByGeneratedPositionsInflated);
1686
- this._sorted = true;
1687
- }
1688
- return this._array;
1689
- };
1690
- exports2.MappingList = MappingList;
1691
- }
1692
- });
1693
-
1694
- // node_modules/source-map/lib/source-map-generator.js
1695
- var require_source_map_generator = __commonJS({
1696
- "node_modules/source-map/lib/source-map-generator.js"(exports2) {
1697
- var base64VLQ = require_base64_vlq();
1698
- var util = require_util2();
1699
- var ArraySet = require_array_set().ArraySet;
1700
- var MappingList = require_mapping_list().MappingList;
1701
- function SourceMapGenerator(aArgs) {
1702
- if (!aArgs) {
1703
- aArgs = {};
1704
- }
1705
- this._file = util.getArg(aArgs, "file", null);
1706
- this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
1707
- this._skipValidation = util.getArg(aArgs, "skipValidation", false);
1708
- this._sources = new ArraySet();
1709
- this._names = new ArraySet();
1710
- this._mappings = new MappingList();
1711
- this._sourcesContents = null;
1712
- }
1713
- SourceMapGenerator.prototype._version = 3;
1714
- SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
1715
- var sourceRoot = aSourceMapConsumer.sourceRoot;
1716
- var generator = new SourceMapGenerator({
1717
- file: aSourceMapConsumer.file,
1718
- sourceRoot
1719
- });
1720
- aSourceMapConsumer.eachMapping(function(mapping) {
1721
- var newMapping = {
1722
- generated: {
1723
- line: mapping.generatedLine,
1724
- column: mapping.generatedColumn
1725
- }
1726
- };
1727
- if (mapping.source != null) {
1728
- newMapping.source = mapping.source;
1729
- if (sourceRoot != null) {
1730
- newMapping.source = util.relative(sourceRoot, newMapping.source);
1731
- }
1732
- newMapping.original = {
1733
- line: mapping.originalLine,
1734
- column: mapping.originalColumn
1735
- };
1736
- if (mapping.name != null) {
1737
- newMapping.name = mapping.name;
1738
- }
1739
- }
1740
- generator.addMapping(newMapping);
1741
- });
1742
- aSourceMapConsumer.sources.forEach(function(sourceFile) {
1743
- var sourceRelative = sourceFile;
1744
- if (sourceRoot !== null) {
1745
- sourceRelative = util.relative(sourceRoot, sourceFile);
1746
- }
1747
- if (!generator._sources.has(sourceRelative)) {
1748
- generator._sources.add(sourceRelative);
1749
- }
1750
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
1751
- if (content != null) {
1752
- generator.setSourceContent(sourceFile, content);
1753
- }
1754
- });
1755
- return generator;
1756
- };
1757
- SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
1758
- var generated = util.getArg(aArgs, "generated");
1759
- var original = util.getArg(aArgs, "original", null);
1760
- var source = util.getArg(aArgs, "source", null);
1761
- var name = util.getArg(aArgs, "name", null);
1762
- if (!this._skipValidation) {
1763
- this._validateMapping(generated, original, source, name);
1764
- }
1765
- if (source != null) {
1766
- source = String(source);
1767
- if (!this._sources.has(source)) {
1768
- this._sources.add(source);
1769
- }
1770
- }
1771
- if (name != null) {
1772
- name = String(name);
1773
- if (!this._names.has(name)) {
1774
- this._names.add(name);
1775
- }
1776
- }
1777
- this._mappings.add({
1778
- generatedLine: generated.line,
1779
- generatedColumn: generated.column,
1780
- originalLine: original != null && original.line,
1781
- originalColumn: original != null && original.column,
1782
- source,
1783
- name
1784
- });
1785
- };
1786
- SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
1787
- var source = aSourceFile;
1788
- if (this._sourceRoot != null) {
1789
- source = util.relative(this._sourceRoot, source);
1790
- }
1791
- if (aSourceContent != null) {
1792
- if (!this._sourcesContents) {
1793
- this._sourcesContents = /* @__PURE__ */ Object.create(null);
1794
- }
1795
- this._sourcesContents[util.toSetString(source)] = aSourceContent;
1796
- } else if (this._sourcesContents) {
1797
- delete this._sourcesContents[util.toSetString(source)];
1798
- if (Object.keys(this._sourcesContents).length === 0) {
1799
- this._sourcesContents = null;
1800
- }
1801
- }
1802
- };
1803
- SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
1804
- var sourceFile = aSourceFile;
1805
- if (aSourceFile == null) {
1806
- if (aSourceMapConsumer.file == null) {
1807
- throw new Error(
1808
- `SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`
1809
- );
1810
- }
1811
- sourceFile = aSourceMapConsumer.file;
1812
- }
1813
- var sourceRoot = this._sourceRoot;
1814
- if (sourceRoot != null) {
1815
- sourceFile = util.relative(sourceRoot, sourceFile);
1816
- }
1817
- var newSources = new ArraySet();
1818
- var newNames = new ArraySet();
1819
- this._mappings.unsortedForEach(function(mapping) {
1820
- if (mapping.source === sourceFile && mapping.originalLine != null) {
1821
- var original = aSourceMapConsumer.originalPositionFor({
1822
- line: mapping.originalLine,
1823
- column: mapping.originalColumn
1824
- });
1825
- if (original.source != null) {
1826
- mapping.source = original.source;
1827
- if (aSourceMapPath != null) {
1828
- mapping.source = util.join(aSourceMapPath, mapping.source);
1829
- }
1830
- if (sourceRoot != null) {
1831
- mapping.source = util.relative(sourceRoot, mapping.source);
1832
- }
1833
- mapping.originalLine = original.line;
1834
- mapping.originalColumn = original.column;
1835
- if (original.name != null) {
1836
- mapping.name = original.name;
1837
- }
1838
- }
1839
- }
1840
- var source = mapping.source;
1841
- if (source != null && !newSources.has(source)) {
1842
- newSources.add(source);
1843
- }
1844
- var name = mapping.name;
1845
- if (name != null && !newNames.has(name)) {
1846
- newNames.add(name);
1847
- }
1848
- }, this);
1849
- this._sources = newSources;
1850
- this._names = newNames;
1851
- aSourceMapConsumer.sources.forEach(function(sourceFile2) {
1852
- var content = aSourceMapConsumer.sourceContentFor(sourceFile2);
1853
- if (content != null) {
1854
- if (aSourceMapPath != null) {
1855
- sourceFile2 = util.join(aSourceMapPath, sourceFile2);
1856
- }
1857
- if (sourceRoot != null) {
1858
- sourceFile2 = util.relative(sourceRoot, sourceFile2);
1859
- }
1860
- this.setSourceContent(sourceFile2, content);
1861
- }
1862
- }, this);
1863
- };
1864
- SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
1865
- if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
1866
- throw new Error(
1867
- "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."
1868
- );
1869
- }
1870
- if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
1871
- return;
1872
- } else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
1873
- return;
1874
- } else {
1875
- throw new Error("Invalid mapping: " + JSON.stringify({
1876
- generated: aGenerated,
1877
- source: aSource,
1878
- original: aOriginal,
1879
- name: aName
1880
- }));
1881
- }
1882
- };
1883
- SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
1884
- var previousGeneratedColumn = 0;
1885
- var previousGeneratedLine = 1;
1886
- var previousOriginalColumn = 0;
1887
- var previousOriginalLine = 0;
1888
- var previousName = 0;
1889
- var previousSource = 0;
1890
- var result = "";
1891
- var next;
1892
- var mapping;
1893
- var nameIdx;
1894
- var sourceIdx;
1895
- var mappings = this._mappings.toArray();
1896
- for (var i = 0, len = mappings.length; i < len; i++) {
1897
- mapping = mappings[i];
1898
- next = "";
1899
- if (mapping.generatedLine !== previousGeneratedLine) {
1900
- previousGeneratedColumn = 0;
1901
- while (mapping.generatedLine !== previousGeneratedLine) {
1902
- next += ";";
1903
- previousGeneratedLine++;
1904
- }
1905
- } else {
1906
- if (i > 0) {
1907
- if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
1908
- continue;
1909
- }
1910
- next += ",";
1911
- }
1912
- }
1913
- next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
1914
- previousGeneratedColumn = mapping.generatedColumn;
1915
- if (mapping.source != null) {
1916
- sourceIdx = this._sources.indexOf(mapping.source);
1917
- next += base64VLQ.encode(sourceIdx - previousSource);
1918
- previousSource = sourceIdx;
1919
- next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
1920
- previousOriginalLine = mapping.originalLine - 1;
1921
- next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
1922
- previousOriginalColumn = mapping.originalColumn;
1923
- if (mapping.name != null) {
1924
- nameIdx = this._names.indexOf(mapping.name);
1925
- next += base64VLQ.encode(nameIdx - previousName);
1926
- previousName = nameIdx;
1927
- }
1928
- }
1929
- result += next;
1930
- }
1931
- return result;
1932
- };
1933
- SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
1934
- return aSources.map(function(source) {
1935
- if (!this._sourcesContents) {
1936
- return null;
1937
- }
1938
- if (aSourceRoot != null) {
1939
- source = util.relative(aSourceRoot, source);
1940
- }
1941
- var key = util.toSetString(source);
1942
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
1943
- }, this);
1944
- };
1945
- SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
1946
- var map = {
1947
- version: this._version,
1948
- sources: this._sources.toArray(),
1949
- names: this._names.toArray(),
1950
- mappings: this._serializeMappings()
1951
- };
1952
- if (this._file != null) {
1953
- map.file = this._file;
1954
- }
1955
- if (this._sourceRoot != null) {
1956
- map.sourceRoot = this._sourceRoot;
1957
- }
1958
- if (this._sourcesContents) {
1959
- map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
1960
- }
1961
- return map;
1962
- };
1963
- SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
1964
- return JSON.stringify(this.toJSON());
1965
- };
1966
- exports2.SourceMapGenerator = SourceMapGenerator;
1967
- }
1968
- });
1969
-
1970
- // node_modules/source-map/lib/binary-search.js
1971
- var require_binary_search = __commonJS({
1972
- "node_modules/source-map/lib/binary-search.js"(exports2) {
1973
- exports2.GREATEST_LOWER_BOUND = 1;
1974
- exports2.LEAST_UPPER_BOUND = 2;
1975
- function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
1976
- var mid = Math.floor((aHigh - aLow) / 2) + aLow;
1977
- var cmp = aCompare(aNeedle, aHaystack[mid], true);
1978
- if (cmp === 0) {
1979
- return mid;
1980
- } else if (cmp > 0) {
1981
- if (aHigh - mid > 1) {
1982
- return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
1983
- }
1984
- if (aBias == exports2.LEAST_UPPER_BOUND) {
1985
- return aHigh < aHaystack.length ? aHigh : -1;
1986
- } else {
1987
- return mid;
1988
- }
1989
- } else {
1990
- if (mid - aLow > 1) {
1991
- return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
1992
- }
1993
- if (aBias == exports2.LEAST_UPPER_BOUND) {
1994
- return mid;
1995
- } else {
1996
- return aLow < 0 ? -1 : aLow;
1997
- }
1998
- }
1999
- }
2000
- exports2.search = function search(aNeedle, aHaystack, aCompare, aBias) {
2001
- if (aHaystack.length === 0) {
2002
- return -1;
2003
- }
2004
- var index = recursiveSearch(
2005
- -1,
2006
- aHaystack.length,
2007
- aNeedle,
2008
- aHaystack,
2009
- aCompare,
2010
- aBias || exports2.GREATEST_LOWER_BOUND
2011
- );
2012
- if (index < 0) {
2013
- return -1;
2014
- }
2015
- while (index - 1 >= 0) {
2016
- if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
2017
- break;
2018
- }
2019
- --index;
2020
- }
2021
- return index;
2022
- };
2023
- }
2024
- });
2025
-
2026
- // node_modules/source-map/lib/quick-sort.js
2027
- var require_quick_sort = __commonJS({
2028
- "node_modules/source-map/lib/quick-sort.js"(exports2) {
2029
- function swap(ary, x, y) {
2030
- var temp = ary[x];
2031
- ary[x] = ary[y];
2032
- ary[y] = temp;
2033
- }
2034
- function randomIntInRange(low, high) {
2035
- return Math.round(low + Math.random() * (high - low));
2036
- }
2037
- function doQuickSort(ary, comparator, p, r) {
2038
- if (p < r) {
2039
- var pivotIndex = randomIntInRange(p, r);
2040
- var i = p - 1;
2041
- swap(ary, pivotIndex, r);
2042
- var pivot = ary[r];
2043
- for (var j = p; j < r; j++) {
2044
- if (comparator(ary[j], pivot) <= 0) {
2045
- i += 1;
2046
- swap(ary, i, j);
2047
- }
2048
- }
2049
- swap(ary, i + 1, j);
2050
- var q = i + 1;
2051
- doQuickSort(ary, comparator, p, q - 1);
2052
- doQuickSort(ary, comparator, q + 1, r);
2053
- }
2054
- }
2055
- exports2.quickSort = function(ary, comparator) {
2056
- doQuickSort(ary, comparator, 0, ary.length - 1);
2057
- };
2058
- }
2059
- });
2060
-
2061
- // node_modules/source-map/lib/source-map-consumer.js
2062
- var require_source_map_consumer = __commonJS({
2063
- "node_modules/source-map/lib/source-map-consumer.js"(exports2) {
2064
- var util = require_util2();
2065
- var binarySearch = require_binary_search();
2066
- var ArraySet = require_array_set().ArraySet;
2067
- var base64VLQ = require_base64_vlq();
2068
- var quickSort = require_quick_sort().quickSort;
2069
- function SourceMapConsumer(aSourceMap, aSourceMapURL) {
2070
- var sourceMap = aSourceMap;
2071
- if (typeof aSourceMap === "string") {
2072
- sourceMap = util.parseSourceMapInput(aSourceMap);
2073
- }
2074
- return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
2075
- }
2076
- SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
2077
- return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
2078
- };
2079
- SourceMapConsumer.prototype._version = 3;
2080
- SourceMapConsumer.prototype.__generatedMappings = null;
2081
- Object.defineProperty(SourceMapConsumer.prototype, "_generatedMappings", {
2082
- configurable: true,
2083
- enumerable: true,
2084
- get: function() {
2085
- if (!this.__generatedMappings) {
2086
- this._parseMappings(this._mappings, this.sourceRoot);
2087
- }
2088
- return this.__generatedMappings;
2089
- }
2090
- });
2091
- SourceMapConsumer.prototype.__originalMappings = null;
2092
- Object.defineProperty(SourceMapConsumer.prototype, "_originalMappings", {
2093
- configurable: true,
2094
- enumerable: true,
2095
- get: function() {
2096
- if (!this.__originalMappings) {
2097
- this._parseMappings(this._mappings, this.sourceRoot);
2098
- }
2099
- return this.__originalMappings;
2100
- }
2101
- });
2102
- SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
2103
- var c = aStr.charAt(index);
2104
- return c === ";" || c === ",";
2105
- };
2106
- SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
2107
- throw new Error("Subclasses must implement _parseMappings");
2108
- };
2109
- SourceMapConsumer.GENERATED_ORDER = 1;
2110
- SourceMapConsumer.ORIGINAL_ORDER = 2;
2111
- SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
2112
- SourceMapConsumer.LEAST_UPPER_BOUND = 2;
2113
- SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
2114
- var context = aContext || null;
2115
- var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
2116
- var mappings;
2117
- switch (order) {
2118
- case SourceMapConsumer.GENERATED_ORDER:
2119
- mappings = this._generatedMappings;
2120
- break;
2121
- case SourceMapConsumer.ORIGINAL_ORDER:
2122
- mappings = this._originalMappings;
2123
- break;
2124
- default:
2125
- throw new Error("Unknown order of iteration.");
2126
- }
2127
- var sourceRoot = this.sourceRoot;
2128
- mappings.map(function(mapping) {
2129
- var source = mapping.source === null ? null : this._sources.at(mapping.source);
2130
- source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
2131
- return {
2132
- source,
2133
- generatedLine: mapping.generatedLine,
2134
- generatedColumn: mapping.generatedColumn,
2135
- originalLine: mapping.originalLine,
2136
- originalColumn: mapping.originalColumn,
2137
- name: mapping.name === null ? null : this._names.at(mapping.name)
2138
- };
2139
- }, this).forEach(aCallback, context);
2140
- };
2141
- SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
2142
- var line = util.getArg(aArgs, "line");
2143
- var needle = {
2144
- source: util.getArg(aArgs, "source"),
2145
- originalLine: line,
2146
- originalColumn: util.getArg(aArgs, "column", 0)
2147
- };
2148
- needle.source = this._findSourceIndex(needle.source);
2149
- if (needle.source < 0) {
2150
- return [];
2151
- }
2152
- var mappings = [];
2153
- var index = this._findMapping(
2154
- needle,
2155
- this._originalMappings,
2156
- "originalLine",
2157
- "originalColumn",
2158
- util.compareByOriginalPositions,
2159
- binarySearch.LEAST_UPPER_BOUND
2160
- );
2161
- if (index >= 0) {
2162
- var mapping = this._originalMappings[index];
2163
- if (aArgs.column === void 0) {
2164
- var originalLine = mapping.originalLine;
2165
- while (mapping && mapping.originalLine === originalLine) {
2166
- mappings.push({
2167
- line: util.getArg(mapping, "generatedLine", null),
2168
- column: util.getArg(mapping, "generatedColumn", null),
2169
- lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
2170
- });
2171
- mapping = this._originalMappings[++index];
2172
- }
2173
- } else {
2174
- var originalColumn = mapping.originalColumn;
2175
- while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
2176
- mappings.push({
2177
- line: util.getArg(mapping, "generatedLine", null),
2178
- column: util.getArg(mapping, "generatedColumn", null),
2179
- lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
2180
- });
2181
- mapping = this._originalMappings[++index];
2182
- }
2183
- }
2184
- }
2185
- return mappings;
2186
- };
2187
- exports2.SourceMapConsumer = SourceMapConsumer;
2188
- function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
2189
- var sourceMap = aSourceMap;
2190
- if (typeof aSourceMap === "string") {
2191
- sourceMap = util.parseSourceMapInput(aSourceMap);
2192
- }
2193
- var version = util.getArg(sourceMap, "version");
2194
- var sources = util.getArg(sourceMap, "sources");
2195
- var names = util.getArg(sourceMap, "names", []);
2196
- var sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
2197
- var sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
2198
- var mappings = util.getArg(sourceMap, "mappings");
2199
- var file = util.getArg(sourceMap, "file", null);
2200
- if (version != this._version) {
2201
- throw new Error("Unsupported version: " + version);
2202
- }
2203
- if (sourceRoot) {
2204
- sourceRoot = util.normalize(sourceRoot);
2205
- }
2206
- sources = sources.map(String).map(util.normalize).map(function(source) {
2207
- return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
2208
- });
2209
- this._names = ArraySet.fromArray(names.map(String), true);
2210
- this._sources = ArraySet.fromArray(sources, true);
2211
- this._absoluteSources = this._sources.toArray().map(function(s) {
2212
- return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
2213
- });
2214
- this.sourceRoot = sourceRoot;
2215
- this.sourcesContent = sourcesContent;
2216
- this._mappings = mappings;
2217
- this._sourceMapURL = aSourceMapURL;
2218
- this.file = file;
2219
- }
2220
- BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
2221
- BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
2222
- BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
2223
- var relativeSource = aSource;
2224
- if (this.sourceRoot != null) {
2225
- relativeSource = util.relative(this.sourceRoot, relativeSource);
2226
- }
2227
- if (this._sources.has(relativeSource)) {
2228
- return this._sources.indexOf(relativeSource);
2229
- }
2230
- var i;
2231
- for (i = 0; i < this._absoluteSources.length; ++i) {
2232
- if (this._absoluteSources[i] == aSource) {
2233
- return i;
2234
- }
2235
- }
2236
- return -1;
2237
- };
2238
- BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
2239
- var smc = Object.create(BasicSourceMapConsumer.prototype);
2240
- var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
2241
- var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
2242
- smc.sourceRoot = aSourceMap._sourceRoot;
2243
- smc.sourcesContent = aSourceMap._generateSourcesContent(
2244
- smc._sources.toArray(),
2245
- smc.sourceRoot
2246
- );
2247
- smc.file = aSourceMap._file;
2248
- smc._sourceMapURL = aSourceMapURL;
2249
- smc._absoluteSources = smc._sources.toArray().map(function(s) {
2250
- return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
2251
- });
2252
- var generatedMappings = aSourceMap._mappings.toArray().slice();
2253
- var destGeneratedMappings = smc.__generatedMappings = [];
2254
- var destOriginalMappings = smc.__originalMappings = [];
2255
- for (var i = 0, length = generatedMappings.length; i < length; i++) {
2256
- var srcMapping = generatedMappings[i];
2257
- var destMapping = new Mapping();
2258
- destMapping.generatedLine = srcMapping.generatedLine;
2259
- destMapping.generatedColumn = srcMapping.generatedColumn;
2260
- if (srcMapping.source) {
2261
- destMapping.source = sources.indexOf(srcMapping.source);
2262
- destMapping.originalLine = srcMapping.originalLine;
2263
- destMapping.originalColumn = srcMapping.originalColumn;
2264
- if (srcMapping.name) {
2265
- destMapping.name = names.indexOf(srcMapping.name);
2266
- }
2267
- destOriginalMappings.push(destMapping);
2268
- }
2269
- destGeneratedMappings.push(destMapping);
2270
- }
2271
- quickSort(smc.__originalMappings, util.compareByOriginalPositions);
2272
- return smc;
2273
- };
2274
- BasicSourceMapConsumer.prototype._version = 3;
2275
- Object.defineProperty(BasicSourceMapConsumer.prototype, "sources", {
2276
- get: function() {
2277
- return this._absoluteSources.slice();
2278
- }
2279
- });
2280
- function Mapping() {
2281
- this.generatedLine = 0;
2282
- this.generatedColumn = 0;
2283
- this.source = null;
2284
- this.originalLine = null;
2285
- this.originalColumn = null;
2286
- this.name = null;
2287
- }
2288
- BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
2289
- var generatedLine = 1;
2290
- var previousGeneratedColumn = 0;
2291
- var previousOriginalLine = 0;
2292
- var previousOriginalColumn = 0;
2293
- var previousSource = 0;
2294
- var previousName = 0;
2295
- var length = aStr.length;
2296
- var index = 0;
2297
- var cachedSegments = {};
2298
- var temp = {};
2299
- var originalMappings = [];
2300
- var generatedMappings = [];
2301
- var mapping, str, segment, end, value;
2302
- while (index < length) {
2303
- if (aStr.charAt(index) === ";") {
2304
- generatedLine++;
2305
- index++;
2306
- previousGeneratedColumn = 0;
2307
- } else if (aStr.charAt(index) === ",") {
2308
- index++;
2309
- } else {
2310
- mapping = new Mapping();
2311
- mapping.generatedLine = generatedLine;
2312
- for (end = index; end < length; end++) {
2313
- if (this._charIsMappingSeparator(aStr, end)) {
2314
- break;
2315
- }
2316
- }
2317
- str = aStr.slice(index, end);
2318
- segment = cachedSegments[str];
2319
- if (segment) {
2320
- index += str.length;
2321
- } else {
2322
- segment = [];
2323
- while (index < end) {
2324
- base64VLQ.decode(aStr, index, temp);
2325
- value = temp.value;
2326
- index = temp.rest;
2327
- segment.push(value);
2328
- }
2329
- if (segment.length === 2) {
2330
- throw new Error("Found a source, but no line and column");
2331
- }
2332
- if (segment.length === 3) {
2333
- throw new Error("Found a source and line, but no column");
2334
- }
2335
- cachedSegments[str] = segment;
2336
- }
2337
- mapping.generatedColumn = previousGeneratedColumn + segment[0];
2338
- previousGeneratedColumn = mapping.generatedColumn;
2339
- if (segment.length > 1) {
2340
- mapping.source = previousSource + segment[1];
2341
- previousSource += segment[1];
2342
- mapping.originalLine = previousOriginalLine + segment[2];
2343
- previousOriginalLine = mapping.originalLine;
2344
- mapping.originalLine += 1;
2345
- mapping.originalColumn = previousOriginalColumn + segment[3];
2346
- previousOriginalColumn = mapping.originalColumn;
2347
- if (segment.length > 4) {
2348
- mapping.name = previousName + segment[4];
2349
- previousName += segment[4];
2350
- }
2351
- }
2352
- generatedMappings.push(mapping);
2353
- if (typeof mapping.originalLine === "number") {
2354
- originalMappings.push(mapping);
2355
- }
2356
- }
2357
- }
2358
- quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
2359
- this.__generatedMappings = generatedMappings;
2360
- quickSort(originalMappings, util.compareByOriginalPositions);
2361
- this.__originalMappings = originalMappings;
2362
- };
2363
- BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
2364
- if (aNeedle[aLineName] <= 0) {
2365
- throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]);
2366
- }
2367
- if (aNeedle[aColumnName] < 0) {
2368
- throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]);
2369
- }
2370
- return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
2371
- };
2372
- BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() {
2373
- for (var index = 0; index < this._generatedMappings.length; ++index) {
2374
- var mapping = this._generatedMappings[index];
2375
- if (index + 1 < this._generatedMappings.length) {
2376
- var nextMapping = this._generatedMappings[index + 1];
2377
- if (mapping.generatedLine === nextMapping.generatedLine) {
2378
- mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
2379
- continue;
2380
- }
2381
- }
2382
- mapping.lastGeneratedColumn = Infinity;
2383
- }
2384
- };
2385
- BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) {
2386
- var needle = {
2387
- generatedLine: util.getArg(aArgs, "line"),
2388
- generatedColumn: util.getArg(aArgs, "column")
2389
- };
2390
- var index = this._findMapping(
2391
- needle,
2392
- this._generatedMappings,
2393
- "generatedLine",
2394
- "generatedColumn",
2395
- util.compareByGeneratedPositionsDeflated,
2396
- util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND)
2397
- );
2398
- if (index >= 0) {
2399
- var mapping = this._generatedMappings[index];
2400
- if (mapping.generatedLine === needle.generatedLine) {
2401
- var source = util.getArg(mapping, "source", null);
2402
- if (source !== null) {
2403
- source = this._sources.at(source);
2404
- source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
2405
- }
2406
- var name = util.getArg(mapping, "name", null);
2407
- if (name !== null) {
2408
- name = this._names.at(name);
2409
- }
2410
- return {
2411
- source,
2412
- line: util.getArg(mapping, "originalLine", null),
2413
- column: util.getArg(mapping, "originalColumn", null),
2414
- name
2415
- };
2416
- }
2417
- }
2418
- return {
2419
- source: null,
2420
- line: null,
2421
- column: null,
2422
- name: null
2423
- };
2424
- };
2425
- BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() {
2426
- if (!this.sourcesContent) {
2427
- return false;
2428
- }
2429
- return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
2430
- return sc == null;
2431
- });
2432
- };
2433
- BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
2434
- if (!this.sourcesContent) {
2435
- return null;
2436
- }
2437
- var index = this._findSourceIndex(aSource);
2438
- if (index >= 0) {
2439
- return this.sourcesContent[index];
2440
- }
2441
- var relativeSource = aSource;
2442
- if (this.sourceRoot != null) {
2443
- relativeSource = util.relative(this.sourceRoot, relativeSource);
2444
- }
2445
- var url;
2446
- if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
2447
- var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
2448
- if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
2449
- return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
2450
- }
2451
- if ((!url.path || url.path == "/") && this._sources.has("/" + relativeSource)) {
2452
- return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
2453
- }
2454
- }
2455
- if (nullOnMissing) {
2456
- return null;
2457
- } else {
2458
- throw new Error('"' + relativeSource + '" is not in the SourceMap.');
2459
- }
2460
- };
2461
- BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) {
2462
- var source = util.getArg(aArgs, "source");
2463
- source = this._findSourceIndex(source);
2464
- if (source < 0) {
2465
- return {
2466
- line: null,
2467
- column: null,
2468
- lastColumn: null
2469
- };
2470
- }
2471
- var needle = {
2472
- source,
2473
- originalLine: util.getArg(aArgs, "line"),
2474
- originalColumn: util.getArg(aArgs, "column")
2475
- };
2476
- var index = this._findMapping(
2477
- needle,
2478
- this._originalMappings,
2479
- "originalLine",
2480
- "originalColumn",
2481
- util.compareByOriginalPositions,
2482
- util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND)
2483
- );
2484
- if (index >= 0) {
2485
- var mapping = this._originalMappings[index];
2486
- if (mapping.source === needle.source) {
2487
- return {
2488
- line: util.getArg(mapping, "generatedLine", null),
2489
- column: util.getArg(mapping, "generatedColumn", null),
2490
- lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
2491
- };
2492
- }
2493
- }
2494
- return {
2495
- line: null,
2496
- column: null,
2497
- lastColumn: null
2498
- };
2499
- };
2500
- exports2.BasicSourceMapConsumer = BasicSourceMapConsumer;
2501
- function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
2502
- var sourceMap = aSourceMap;
2503
- if (typeof aSourceMap === "string") {
2504
- sourceMap = util.parseSourceMapInput(aSourceMap);
2505
- }
2506
- var version = util.getArg(sourceMap, "version");
2507
- var sections = util.getArg(sourceMap, "sections");
2508
- if (version != this._version) {
2509
- throw new Error("Unsupported version: " + version);
2510
- }
2511
- this._sources = new ArraySet();
2512
- this._names = new ArraySet();
2513
- var lastOffset = {
2514
- line: -1,
2515
- column: 0
2516
- };
2517
- this._sections = sections.map(function(s) {
2518
- if (s.url) {
2519
- throw new Error("Support for url field in sections not implemented.");
2520
- }
2521
- var offset = util.getArg(s, "offset");
2522
- var offsetLine = util.getArg(offset, "line");
2523
- var offsetColumn = util.getArg(offset, "column");
2524
- if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
2525
- throw new Error("Section offsets must be ordered and non-overlapping.");
2526
- }
2527
- lastOffset = offset;
2528
- return {
2529
- generatedOffset: {
2530
- // The offset fields are 0-based, but we use 1-based indices when
2531
- // encoding/decoding from VLQ.
2532
- generatedLine: offsetLine + 1,
2533
- generatedColumn: offsetColumn + 1
2534
- },
2535
- consumer: new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL)
2536
- };
2537
- });
2538
- }
2539
- IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
2540
- IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
2541
- IndexedSourceMapConsumer.prototype._version = 3;
2542
- Object.defineProperty(IndexedSourceMapConsumer.prototype, "sources", {
2543
- get: function() {
2544
- var sources = [];
2545
- for (var i = 0; i < this._sections.length; i++) {
2546
- for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
2547
- sources.push(this._sections[i].consumer.sources[j]);
2548
- }
2549
- }
2550
- return sources;
2551
- }
2552
- });
2553
- IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
2554
- var needle = {
2555
- generatedLine: util.getArg(aArgs, "line"),
2556
- generatedColumn: util.getArg(aArgs, "column")
2557
- };
2558
- var sectionIndex = binarySearch.search(
2559
- needle,
2560
- this._sections,
2561
- function(needle2, section2) {
2562
- var cmp = needle2.generatedLine - section2.generatedOffset.generatedLine;
2563
- if (cmp) {
2564
- return cmp;
2565
- }
2566
- return needle2.generatedColumn - section2.generatedOffset.generatedColumn;
2567
- }
2568
- );
2569
- var section = this._sections[sectionIndex];
2570
- if (!section) {
2571
- return {
2572
- source: null,
2573
- line: null,
2574
- column: null,
2575
- name: null
2576
- };
2577
- }
2578
- return section.consumer.originalPositionFor({
2579
- line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
2580
- column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
2581
- bias: aArgs.bias
2582
- });
2583
- };
2584
- IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() {
2585
- return this._sections.every(function(s) {
2586
- return s.consumer.hasContentsOfAllSources();
2587
- });
2588
- };
2589
- IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
2590
- for (var i = 0; i < this._sections.length; i++) {
2591
- var section = this._sections[i];
2592
- var content = section.consumer.sourceContentFor(aSource, true);
2593
- if (content) {
2594
- return content;
2595
- }
2596
- }
2597
- if (nullOnMissing) {
2598
- return null;
2599
- } else {
2600
- throw new Error('"' + aSource + '" is not in the SourceMap.');
2601
- }
2602
- };
2603
- IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
2604
- for (var i = 0; i < this._sections.length; i++) {
2605
- var section = this._sections[i];
2606
- if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) === -1) {
2607
- continue;
2608
- }
2609
- var generatedPosition = section.consumer.generatedPositionFor(aArgs);
2610
- if (generatedPosition) {
2611
- var ret = {
2612
- line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
2613
- column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
2614
- };
2615
- return ret;
2616
- }
2617
- }
2618
- return {
2619
- line: null,
2620
- column: null
2621
- };
2622
- };
2623
- IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
2624
- this.__generatedMappings = [];
2625
- this.__originalMappings = [];
2626
- for (var i = 0; i < this._sections.length; i++) {
2627
- var section = this._sections[i];
2628
- var sectionMappings = section.consumer._generatedMappings;
2629
- for (var j = 0; j < sectionMappings.length; j++) {
2630
- var mapping = sectionMappings[j];
2631
- var source = section.consumer._sources.at(mapping.source);
2632
- source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
2633
- this._sources.add(source);
2634
- source = this._sources.indexOf(source);
2635
- var name = null;
2636
- if (mapping.name) {
2637
- name = section.consumer._names.at(mapping.name);
2638
- this._names.add(name);
2639
- name = this._names.indexOf(name);
2640
- }
2641
- var adjustedMapping = {
2642
- source,
2643
- generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
2644
- generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
2645
- originalLine: mapping.originalLine,
2646
- originalColumn: mapping.originalColumn,
2647
- name
2648
- };
2649
- this.__generatedMappings.push(adjustedMapping);
2650
- if (typeof adjustedMapping.originalLine === "number") {
2651
- this.__originalMappings.push(adjustedMapping);
2652
- }
2653
- }
2654
- }
2655
- quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
2656
- quickSort(this.__originalMappings, util.compareByOriginalPositions);
2657
- };
2658
- exports2.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
2659
- }
2660
- });
2661
-
2662
- // node_modules/source-map/lib/source-node.js
2663
- var require_source_node = __commonJS({
2664
- "node_modules/source-map/lib/source-node.js"(exports2) {
2665
- var SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
2666
- var util = require_util2();
2667
- var REGEX_NEWLINE = /(\r?\n)/;
2668
- var NEWLINE_CODE = 10;
2669
- var isSourceNode = "$$$isSourceNode$$$";
2670
- function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
2671
- this.children = [];
2672
- this.sourceContents = {};
2673
- this.line = aLine == null ? null : aLine;
2674
- this.column = aColumn == null ? null : aColumn;
2675
- this.source = aSource == null ? null : aSource;
2676
- this.name = aName == null ? null : aName;
2677
- this[isSourceNode] = true;
2678
- if (aChunks != null) this.add(aChunks);
2679
- }
2680
- SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
2681
- var node = new SourceNode();
2682
- var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
2683
- var remainingLinesIndex = 0;
2684
- var shiftNextLine = function() {
2685
- var lineContents = getNextLine();
2686
- var newLine = getNextLine() || "";
2687
- return lineContents + newLine;
2688
- function getNextLine() {
2689
- return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
2690
- }
2691
- };
2692
- var lastGeneratedLine = 1, lastGeneratedColumn = 0;
2693
- var lastMapping = null;
2694
- aSourceMapConsumer.eachMapping(function(mapping) {
2695
- if (lastMapping !== null) {
2696
- if (lastGeneratedLine < mapping.generatedLine) {
2697
- addMappingWithCode(lastMapping, shiftNextLine());
2698
- lastGeneratedLine++;
2699
- lastGeneratedColumn = 0;
2700
- } else {
2701
- var nextLine = remainingLines[remainingLinesIndex] || "";
2702
- var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
2703
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
2704
- lastGeneratedColumn = mapping.generatedColumn;
2705
- addMappingWithCode(lastMapping, code);
2706
- lastMapping = mapping;
2707
- return;
2708
- }
2709
- }
2710
- while (lastGeneratedLine < mapping.generatedLine) {
2711
- node.add(shiftNextLine());
2712
- lastGeneratedLine++;
2713
- }
2714
- if (lastGeneratedColumn < mapping.generatedColumn) {
2715
- var nextLine = remainingLines[remainingLinesIndex] || "";
2716
- node.add(nextLine.substr(0, mapping.generatedColumn));
2717
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
2718
- lastGeneratedColumn = mapping.generatedColumn;
2719
- }
2720
- lastMapping = mapping;
2721
- }, this);
2722
- if (remainingLinesIndex < remainingLines.length) {
2723
- if (lastMapping) {
2724
- addMappingWithCode(lastMapping, shiftNextLine());
2725
- }
2726
- node.add(remainingLines.splice(remainingLinesIndex).join(""));
2727
- }
2728
- aSourceMapConsumer.sources.forEach(function(sourceFile) {
2729
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
2730
- if (content != null) {
2731
- if (aRelativePath != null) {
2732
- sourceFile = util.join(aRelativePath, sourceFile);
2733
- }
2734
- node.setSourceContent(sourceFile, content);
2735
- }
2736
- });
2737
- return node;
2738
- function addMappingWithCode(mapping, code) {
2739
- if (mapping === null || mapping.source === void 0) {
2740
- node.add(code);
2741
- } else {
2742
- var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
2743
- node.add(new SourceNode(
2744
- mapping.originalLine,
2745
- mapping.originalColumn,
2746
- source,
2747
- code,
2748
- mapping.name
2749
- ));
2750
- }
2751
- }
2752
- };
2753
- SourceNode.prototype.add = function SourceNode_add(aChunk) {
2754
- if (Array.isArray(aChunk)) {
2755
- aChunk.forEach(function(chunk) {
2756
- this.add(chunk);
2757
- }, this);
2758
- } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
2759
- if (aChunk) {
2760
- this.children.push(aChunk);
2761
- }
2762
- } else {
2763
- throw new TypeError(
2764
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
2765
- );
2766
- }
2767
- return this;
2768
- };
2769
- SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
2770
- if (Array.isArray(aChunk)) {
2771
- for (var i = aChunk.length - 1; i >= 0; i--) {
2772
- this.prepend(aChunk[i]);
2773
- }
2774
- } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
2775
- this.children.unshift(aChunk);
2776
- } else {
2777
- throw new TypeError(
2778
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
2779
- );
2780
- }
2781
- return this;
2782
- };
2783
- SourceNode.prototype.walk = function SourceNode_walk(aFn) {
2784
- var chunk;
2785
- for (var i = 0, len = this.children.length; i < len; i++) {
2786
- chunk = this.children[i];
2787
- if (chunk[isSourceNode]) {
2788
- chunk.walk(aFn);
2789
- } else {
2790
- if (chunk !== "") {
2791
- aFn(chunk, {
2792
- source: this.source,
2793
- line: this.line,
2794
- column: this.column,
2795
- name: this.name
2796
- });
2797
- }
2798
- }
2799
- }
2800
- };
2801
- SourceNode.prototype.join = function SourceNode_join(aSep) {
2802
- var newChildren;
2803
- var i;
2804
- var len = this.children.length;
2805
- if (len > 0) {
2806
- newChildren = [];
2807
- for (i = 0; i < len - 1; i++) {
2808
- newChildren.push(this.children[i]);
2809
- newChildren.push(aSep);
2810
- }
2811
- newChildren.push(this.children[i]);
2812
- this.children = newChildren;
2813
- }
2814
- return this;
2815
- };
2816
- SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
2817
- var lastChild = this.children[this.children.length - 1];
2818
- if (lastChild[isSourceNode]) {
2819
- lastChild.replaceRight(aPattern, aReplacement);
2820
- } else if (typeof lastChild === "string") {
2821
- this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
2822
- } else {
2823
- this.children.push("".replace(aPattern, aReplacement));
2824
- }
2825
- return this;
2826
- };
2827
- SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
2828
- this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
2829
- };
2830
- SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
2831
- for (var i = 0, len = this.children.length; i < len; i++) {
2832
- if (this.children[i][isSourceNode]) {
2833
- this.children[i].walkSourceContents(aFn);
2834
- }
2835
- }
2836
- var sources = Object.keys(this.sourceContents);
2837
- for (var i = 0, len = sources.length; i < len; i++) {
2838
- aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
2839
- }
2840
- };
2841
- SourceNode.prototype.toString = function SourceNode_toString() {
2842
- var str = "";
2843
- this.walk(function(chunk) {
2844
- str += chunk;
2845
- });
2846
- return str;
2847
- };
2848
- SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
2849
- var generated = {
2850
- code: "",
2851
- line: 1,
2852
- column: 0
2853
- };
2854
- var map = new SourceMapGenerator(aArgs);
2855
- var sourceMappingActive = false;
2856
- var lastOriginalSource = null;
2857
- var lastOriginalLine = null;
2858
- var lastOriginalColumn = null;
2859
- var lastOriginalName = null;
2860
- this.walk(function(chunk, original) {
2861
- generated.code += chunk;
2862
- if (original.source !== null && original.line !== null && original.column !== null) {
2863
- if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
2864
- map.addMapping({
2865
- source: original.source,
2866
- original: {
2867
- line: original.line,
2868
- column: original.column
2869
- },
2870
- generated: {
2871
- line: generated.line,
2872
- column: generated.column
2873
- },
2874
- name: original.name
2875
- });
2876
- }
2877
- lastOriginalSource = original.source;
2878
- lastOriginalLine = original.line;
2879
- lastOriginalColumn = original.column;
2880
- lastOriginalName = original.name;
2881
- sourceMappingActive = true;
2882
- } else if (sourceMappingActive) {
2883
- map.addMapping({
2884
- generated: {
2885
- line: generated.line,
2886
- column: generated.column
2887
- }
2888
- });
2889
- lastOriginalSource = null;
2890
- sourceMappingActive = false;
2891
- }
2892
- for (var idx = 0, length = chunk.length; idx < length; idx++) {
2893
- if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
2894
- generated.line++;
2895
- generated.column = 0;
2896
- if (idx + 1 === length) {
2897
- lastOriginalSource = null;
2898
- sourceMappingActive = false;
2899
- } else if (sourceMappingActive) {
2900
- map.addMapping({
2901
- source: original.source,
2902
- original: {
2903
- line: original.line,
2904
- column: original.column
2905
- },
2906
- generated: {
2907
- line: generated.line,
2908
- column: generated.column
2909
- },
2910
- name: original.name
2911
- });
2912
- }
2913
- } else {
2914
- generated.column++;
2915
- }
2916
- }
2917
- });
2918
- this.walkSourceContents(function(sourceFile, sourceContent) {
2919
- map.setSourceContent(sourceFile, sourceContent);
2920
- });
2921
- return { code: generated.code, map };
2922
- };
2923
- exports2.SourceNode = SourceNode;
2924
- }
2925
- });
2926
-
2927
- // node_modules/source-map/source-map.js
2928
- var require_source_map = __commonJS({
2929
- "node_modules/source-map/source-map.js"(exports2) {
2930
- exports2.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
2931
- exports2.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
2932
- exports2.SourceNode = require_source_node().SourceNode;
2933
- }
2934
- });
2935
-
2936
- // node_modules/buffer-from/index.js
2937
- var require_buffer_from = __commonJS({
2938
- "node_modules/buffer-from/index.js"(exports2, module2) {
2939
- var toString = Object.prototype.toString;
2940
- var isModern = typeof Buffer !== "undefined" && typeof Buffer.alloc === "function" && typeof Buffer.allocUnsafe === "function" && typeof Buffer.from === "function";
2941
- function isArrayBuffer(input) {
2942
- return toString.call(input).slice(8, -1) === "ArrayBuffer";
2943
- }
2944
- function fromArrayBuffer(obj, byteOffset, length) {
2945
- byteOffset >>>= 0;
2946
- var maxLength = obj.byteLength - byteOffset;
2947
- if (maxLength < 0) {
2948
- throw new RangeError("'offset' is out of bounds");
2949
- }
2950
- if (length === void 0) {
2951
- length = maxLength;
2952
- } else {
2953
- length >>>= 0;
2954
- if (length > maxLength) {
2955
- throw new RangeError("'length' is out of bounds");
2956
- }
2957
- }
2958
- return isModern ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length)));
2959
- }
2960
- function fromString(string, encoding) {
2961
- if (typeof encoding !== "string" || encoding === "") {
2962
- encoding = "utf8";
2963
- }
2964
- if (!Buffer.isEncoding(encoding)) {
2965
- throw new TypeError('"encoding" must be a valid string encoding');
2966
- }
2967
- return isModern ? Buffer.from(string, encoding) : new Buffer(string, encoding);
2968
- }
2969
- function bufferFrom(value, encodingOrOffset, length) {
2970
- if (typeof value === "number") {
2971
- throw new TypeError('"value" argument must not be a number');
2972
- }
2973
- if (isArrayBuffer(value)) {
2974
- return fromArrayBuffer(value, encodingOrOffset, length);
2975
- }
2976
- if (typeof value === "string") {
2977
- return fromString(value, encodingOrOffset);
2978
- }
2979
- return isModern ? Buffer.from(value) : new Buffer(value);
2980
- }
2981
- module2.exports = bufferFrom;
2982
- }
2983
- });
2984
-
2985
- // node_modules/source-map-support/source-map-support.js
2986
- var require_source_map_support = __commonJS({
2987
- "node_modules/source-map-support/source-map-support.js"(exports2, module2) {
2988
- var SourceMapConsumer = require_source_map().SourceMapConsumer;
2989
- var path14 = require("path");
2990
- var fs9;
2991
- try {
2992
- fs9 = require("fs");
2993
- if (!fs9.existsSync || !fs9.readFileSync) {
2994
- fs9 = null;
2995
- }
2996
- } catch (err) {
2997
- }
2998
- var bufferFrom = require_buffer_from();
2999
- function dynamicRequire(mod, request) {
3000
- return mod.require(request);
3001
- }
3002
- var errorFormatterInstalled = false;
3003
- var uncaughtShimInstalled = false;
3004
- var emptyCacheBetweenOperations = false;
3005
- var environment = "auto";
3006
- var fileContentsCache = {};
3007
- var sourceMapCache = {};
3008
- var reSourceMap = /^data:application\/json[^,]+base64,/;
3009
- var retrieveFileHandlers = [];
3010
- var retrieveMapHandlers = [];
3011
- function isInBrowser() {
3012
- if (environment === "browser")
3013
- return true;
3014
- if (environment === "node")
3015
- return false;
3016
- return typeof window !== "undefined" && typeof XMLHttpRequest === "function" && !(window.require && window.module && window.process && window.process.type === "renderer");
3017
- }
3018
- function hasGlobalProcessEventEmitter() {
3019
- return typeof process === "object" && process !== null && typeof process.on === "function";
3020
- }
3021
- function globalProcessVersion() {
3022
- if (typeof process === "object" && process !== null) {
3023
- return process.version;
3024
- } else {
3025
- return "";
3026
- }
3027
- }
3028
- function globalProcessStderr() {
3029
- if (typeof process === "object" && process !== null) {
3030
- return process.stderr;
3031
- }
3032
- }
3033
- function globalProcessExit(code) {
3034
- if (typeof process === "object" && process !== null && typeof process.exit === "function") {
3035
- return process.exit(code);
3036
- }
3037
- }
3038
- function handlerExec(list) {
3039
- return function(arg) {
3040
- for (var i = 0; i < list.length; i++) {
3041
- var ret = list[i](arg);
3042
- if (ret) {
3043
- return ret;
3044
- }
3045
- }
3046
- return null;
3047
- };
3048
- }
3049
- var retrieveFile = handlerExec(retrieveFileHandlers);
3050
- retrieveFileHandlers.push(function(path15) {
3051
- path15 = path15.trim();
3052
- if (/^file:/.test(path15)) {
3053
- path15 = path15.replace(/file:\/\/\/(\w:)?/, function(protocol, drive) {
3054
- return drive ? "" : (
3055
- // file:///C:/dir/file -> C:/dir/file
3056
- "/"
3057
- );
3058
- });
3059
- }
3060
- if (path15 in fileContentsCache) {
3061
- return fileContentsCache[path15];
3062
- }
3063
- var contents = "";
3064
- try {
3065
- if (!fs9) {
3066
- var xhr = new XMLHttpRequest();
3067
- xhr.open(
3068
- "GET",
3069
- path15,
3070
- /** async */
3071
- false
3072
- );
3073
- xhr.send(null);
3074
- if (xhr.readyState === 4 && xhr.status === 200) {
3075
- contents = xhr.responseText;
3076
- }
3077
- } else if (fs9.existsSync(path15)) {
3078
- contents = fs9.readFileSync(path15, "utf8");
3079
- }
3080
- } catch (er) {
3081
- }
3082
- return fileContentsCache[path15] = contents;
3083
- });
3084
- function supportRelativeURL(file, url) {
3085
- if (!file) return url;
3086
- var dir = path14.dirname(file);
3087
- var match = /^\w+:\/\/[^\/]*/.exec(dir);
3088
- var protocol = match ? match[0] : "";
3089
- var startPath = dir.slice(protocol.length);
3090
- if (protocol && /^\/\w\:/.test(startPath)) {
3091
- protocol += "/";
3092
- return protocol + path14.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
3093
- }
3094
- return protocol + path14.resolve(dir.slice(protocol.length), url);
3095
- }
3096
- function retrieveSourceMapURL(source) {
3097
- var fileData;
3098
- if (isInBrowser()) {
3099
- try {
3100
- var xhr = new XMLHttpRequest();
3101
- xhr.open("GET", source, false);
3102
- xhr.send(null);
3103
- fileData = xhr.readyState === 4 ? xhr.responseText : null;
3104
- var sourceMapHeader = xhr.getResponseHeader("SourceMap") || xhr.getResponseHeader("X-SourceMap");
3105
- if (sourceMapHeader) {
3106
- return sourceMapHeader;
3107
- }
3108
- } catch (e) {
3109
- }
3110
- }
3111
- fileData = retrieveFile(source);
3112
- var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
3113
- var lastMatch, match;
3114
- while (match = re.exec(fileData)) lastMatch = match;
3115
- if (!lastMatch) return null;
3116
- return lastMatch[1];
3117
- }
3118
- var retrieveSourceMap = handlerExec(retrieveMapHandlers);
3119
- retrieveMapHandlers.push(function(source) {
3120
- var sourceMappingURL = retrieveSourceMapURL(source);
3121
- if (!sourceMappingURL) return null;
3122
- var sourceMapData;
3123
- if (reSourceMap.test(sourceMappingURL)) {
3124
- var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(",") + 1);
3125
- sourceMapData = bufferFrom(rawData, "base64").toString();
3126
- sourceMappingURL = source;
3127
- } else {
3128
- sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
3129
- sourceMapData = retrieveFile(sourceMappingURL);
3130
- }
3131
- if (!sourceMapData) {
3132
- return null;
3133
- }
3134
- return {
3135
- url: sourceMappingURL,
3136
- map: sourceMapData
3137
- };
3138
- });
3139
- function mapSourcePosition(position) {
3140
- var sourceMap = sourceMapCache[position.source];
3141
- if (!sourceMap) {
3142
- var urlAndMap = retrieveSourceMap(position.source);
3143
- if (urlAndMap) {
3144
- sourceMap = sourceMapCache[position.source] = {
3145
- url: urlAndMap.url,
3146
- map: new SourceMapConsumer(urlAndMap.map)
3147
- };
3148
- if (sourceMap.map.sourcesContent) {
3149
- sourceMap.map.sources.forEach(function(source, i) {
3150
- var contents = sourceMap.map.sourcesContent[i];
3151
- if (contents) {
3152
- var url = supportRelativeURL(sourceMap.url, source);
3153
- fileContentsCache[url] = contents;
3154
- }
3155
- });
3156
- }
3157
- } else {
3158
- sourceMap = sourceMapCache[position.source] = {
3159
- url: null,
3160
- map: null
3161
- };
3162
- }
3163
- }
3164
- if (sourceMap && sourceMap.map && typeof sourceMap.map.originalPositionFor === "function") {
3165
- var originalPosition = sourceMap.map.originalPositionFor(position);
3166
- if (originalPosition.source !== null) {
3167
- originalPosition.source = supportRelativeURL(
3168
- sourceMap.url,
3169
- originalPosition.source
3170
- );
3171
- return originalPosition;
3172
- }
3173
- }
3174
- return position;
3175
- }
3176
- function mapEvalOrigin(origin) {
3177
- var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
3178
- if (match) {
3179
- var position = mapSourcePosition({
3180
- source: match[2],
3181
- line: +match[3],
3182
- column: match[4] - 1
3183
- });
3184
- return "eval at " + match[1] + " (" + position.source + ":" + position.line + ":" + (position.column + 1) + ")";
3185
- }
3186
- match = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
3187
- if (match) {
3188
- return "eval at " + match[1] + " (" + mapEvalOrigin(match[2]) + ")";
3189
- }
3190
- return origin;
3191
- }
3192
- function CallSiteToString() {
3193
- var fileName;
3194
- var fileLocation = "";
3195
- if (this.isNative()) {
3196
- fileLocation = "native";
3197
- } else {
3198
- fileName = this.getScriptNameOrSourceURL();
3199
- if (!fileName && this.isEval()) {
3200
- fileLocation = this.getEvalOrigin();
3201
- fileLocation += ", ";
3202
- }
3203
- if (fileName) {
3204
- fileLocation += fileName;
3205
- } else {
3206
- fileLocation += "<anonymous>";
3207
- }
3208
- var lineNumber = this.getLineNumber();
3209
- if (lineNumber != null) {
3210
- fileLocation += ":" + lineNumber;
3211
- var columnNumber = this.getColumnNumber();
3212
- if (columnNumber) {
3213
- fileLocation += ":" + columnNumber;
3214
- }
3215
- }
3216
- }
3217
- var line = "";
3218
- var functionName = this.getFunctionName();
3219
- var addSuffix = true;
3220
- var isConstructor = this.isConstructor();
3221
- var isMethodCall = !(this.isToplevel() || isConstructor);
3222
- if (isMethodCall) {
3223
- var typeName = this.getTypeName();
3224
- if (typeName === "[object Object]") {
3225
- typeName = "null";
3226
- }
3227
- var methodName = this.getMethodName();
3228
- if (functionName) {
3229
- if (typeName && functionName.indexOf(typeName) != 0) {
3230
- line += typeName + ".";
3231
- }
3232
- line += functionName;
3233
- if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) {
3234
- line += " [as " + methodName + "]";
3235
- }
3236
- } else {
3237
- line += typeName + "." + (methodName || "<anonymous>");
3238
- }
3239
- } else if (isConstructor) {
3240
- line += "new " + (functionName || "<anonymous>");
3241
- } else if (functionName) {
3242
- line += functionName;
3243
- } else {
3244
- line += fileLocation;
3245
- addSuffix = false;
3246
- }
3247
- if (addSuffix) {
3248
- line += " (" + fileLocation + ")";
3249
- }
3250
- return line;
3251
- }
3252
- function cloneCallSite(frame) {
3253
- var object = {};
3254
- Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) {
3255
- object[name] = /^(?:is|get)/.test(name) ? function() {
3256
- return frame[name].call(frame);
3257
- } : frame[name];
3258
- });
3259
- object.toString = CallSiteToString;
3260
- return object;
3261
- }
3262
- function wrapCallSite(frame, state) {
3263
- if (state === void 0) {
3264
- state = { nextPosition: null, curPosition: null };
3265
- }
3266
- if (frame.isNative()) {
3267
- state.curPosition = null;
3268
- return frame;
3269
- }
3270
- var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
3271
- if (source) {
3272
- var line = frame.getLineNumber();
3273
- var column = frame.getColumnNumber() - 1;
3274
- var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
3275
- var headerLength = noHeader.test(globalProcessVersion()) ? 0 : 62;
3276
- if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
3277
- column -= headerLength;
3278
- }
3279
- var position = mapSourcePosition({
3280
- source,
3281
- line,
3282
- column
3283
- });
3284
- state.curPosition = position;
3285
- frame = cloneCallSite(frame);
3286
- var originalFunctionName = frame.getFunctionName;
3287
- frame.getFunctionName = function() {
3288
- if (state.nextPosition == null) {
3289
- return originalFunctionName();
3290
- }
3291
- return state.nextPosition.name || originalFunctionName();
3292
- };
3293
- frame.getFileName = function() {
3294
- return position.source;
3295
- };
3296
- frame.getLineNumber = function() {
3297
- return position.line;
3298
- };
3299
- frame.getColumnNumber = function() {
3300
- return position.column + 1;
3301
- };
3302
- frame.getScriptNameOrSourceURL = function() {
3303
- return position.source;
3304
- };
3305
- return frame;
3306
- }
3307
- var origin = frame.isEval() && frame.getEvalOrigin();
3308
- if (origin) {
3309
- origin = mapEvalOrigin(origin);
3310
- frame = cloneCallSite(frame);
3311
- frame.getEvalOrigin = function() {
3312
- return origin;
3313
- };
3314
- return frame;
3315
- }
3316
- return frame;
3317
- }
3318
- function prepareStackTrace(error, stack) {
3319
- if (emptyCacheBetweenOperations) {
3320
- fileContentsCache = {};
3321
- sourceMapCache = {};
3322
- }
3323
- var name = error.name || "Error";
3324
- var message = error.message || "";
3325
- var errorString = name + ": " + message;
3326
- var state = { nextPosition: null, curPosition: null };
3327
- var processedStack = [];
3328
- for (var i = stack.length - 1; i >= 0; i--) {
3329
- processedStack.push("\n at " + wrapCallSite(stack[i], state));
3330
- state.nextPosition = state.curPosition;
3331
- }
3332
- state.curPosition = state.nextPosition = null;
3333
- return errorString + processedStack.reverse().join("");
3334
- }
3335
- function getErrorSource(error) {
3336
- var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
3337
- if (match) {
3338
- var source = match[1];
3339
- var line = +match[2];
3340
- var column = +match[3];
3341
- var contents = fileContentsCache[source];
3342
- if (!contents && fs9 && fs9.existsSync(source)) {
3343
- try {
3344
- contents = fs9.readFileSync(source, "utf8");
3345
- } catch (er) {
3346
- contents = "";
3347
- }
3348
- }
3349
- if (contents) {
3350
- var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1];
3351
- if (code) {
3352
- return source + ":" + line + "\n" + code + "\n" + new Array(column).join(" ") + "^";
3353
- }
3354
- }
3355
- }
3356
- return null;
3357
- }
3358
- function printErrorAndExit(error) {
3359
- var source = getErrorSource(error);
3360
- var stderr = globalProcessStderr();
3361
- if (stderr && stderr._handle && stderr._handle.setBlocking) {
3362
- stderr._handle.setBlocking(true);
3363
- }
3364
- if (source) {
3365
- console.error();
3366
- console.error(source);
3367
- }
3368
- console.error(error.stack);
3369
- globalProcessExit(1);
3370
- }
3371
- function shimEmitUncaughtException() {
3372
- var origEmit = process.emit;
3373
- process.emit = function(type) {
3374
- if (type === "uncaughtException") {
3375
- var hasStack = arguments[1] && arguments[1].stack;
3376
- var hasListeners = this.listeners(type).length > 0;
3377
- if (hasStack && !hasListeners) {
3378
- return printErrorAndExit(arguments[1]);
3379
- }
3380
- }
3381
- return origEmit.apply(this, arguments);
3382
- };
3383
- }
3384
- var originalRetrieveFileHandlers = retrieveFileHandlers.slice(0);
3385
- var originalRetrieveMapHandlers = retrieveMapHandlers.slice(0);
3386
- exports2.wrapCallSite = wrapCallSite;
3387
- exports2.getErrorSource = getErrorSource;
3388
- exports2.mapSourcePosition = mapSourcePosition;
3389
- exports2.retrieveSourceMap = retrieveSourceMap;
3390
- exports2.install = function(options) {
3391
- options = options || {};
3392
- if (options.environment) {
3393
- environment = options.environment;
3394
- if (["node", "browser", "auto"].indexOf(environment) === -1) {
3395
- throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}");
3396
- }
3397
- }
3398
- if (options.retrieveFile) {
3399
- if (options.overrideRetrieveFile) {
3400
- retrieveFileHandlers.length = 0;
3401
- }
3402
- retrieveFileHandlers.unshift(options.retrieveFile);
3403
- }
3404
- if (options.retrieveSourceMap) {
3405
- if (options.overrideRetrieveSourceMap) {
3406
- retrieveMapHandlers.length = 0;
3407
- }
3408
- retrieveMapHandlers.unshift(options.retrieveSourceMap);
3409
- }
3410
- if (options.hookRequire && !isInBrowser()) {
3411
- var Module = dynamicRequire(module2, "module");
3412
- var $compile = Module.prototype._compile;
3413
- if (!$compile.__sourceMapSupport) {
3414
- Module.prototype._compile = function(content, filename) {
3415
- fileContentsCache[filename] = content;
3416
- sourceMapCache[filename] = void 0;
3417
- return $compile.call(this, content, filename);
3418
- };
3419
- Module.prototype._compile.__sourceMapSupport = true;
3420
- }
3421
- }
3422
- if (!emptyCacheBetweenOperations) {
3423
- emptyCacheBetweenOperations = "emptyCacheBetweenOperations" in options ? options.emptyCacheBetweenOperations : false;
3424
- }
3425
- if (!errorFormatterInstalled) {
3426
- errorFormatterInstalled = true;
3427
- Error.prepareStackTrace = prepareStackTrace;
3428
- }
3429
- if (!uncaughtShimInstalled) {
3430
- var installHandler = "handleUncaughtExceptions" in options ? options.handleUncaughtExceptions : true;
3431
- try {
3432
- var worker_threads = dynamicRequire(module2, "worker_threads");
3433
- if (worker_threads.isMainThread === false) {
3434
- installHandler = false;
3435
- }
3436
- } catch (e) {
3437
- }
3438
- if (installHandler && hasGlobalProcessEventEmitter()) {
3439
- uncaughtShimInstalled = true;
3440
- shimEmitUncaughtException();
3441
- }
3442
- }
3443
- };
3444
- exports2.resetRetrieveHandlers = function() {
3445
- retrieveFileHandlers.length = 0;
3446
- retrieveMapHandlers.length = 0;
3447
- retrieveFileHandlers = originalRetrieveFileHandlers.slice(0);
3448
- retrieveMapHandlers = originalRetrieveMapHandlers.slice(0);
3449
- retrieveSourceMap = handlerExec(retrieveMapHandlers);
3450
- retrieveFile = handlerExec(retrieveFileHandlers);
3451
- };
3452
- }
3453
- });
3454
-
3455
1189
  // node_modules/typescript/lib/typescript.js
3456
1190
  var require_typescript = __commonJS({
3457
1191
  "node_modules/typescript/lib/typescript.js"(exports2, module2) {
@@ -12107,7 +9841,7 @@ ${lanes.join("\n")}
12107
9841
  debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(?:inspect|debug)(?:-brk)?(?:=\d+)?$/i.test(arg)) || !!process.recordreplay,
12108
9842
  tryEnableSourceMapsForHost() {
12109
9843
  try {
12110
- require_source_map_support().install();
9844
+ require("source-map-support").install();
12111
9845
  } catch {
12112
9846
  }
12113
9847
  },
@@ -77183,9 +74917,9 @@ ${lanes.join("\n")}
77183
74917
  const elem = getElaborationElementForJsxChild(child, childrenNameType, getInvalidTextualChildDiagnostic);
77184
74918
  if (elem) {
77185
74919
  result = elaborateElementwise(
77186
- function* () {
74920
+ (function* () {
77187
74921
  yield elem;
77188
- }(),
74922
+ })(),
77189
74923
  source,
77190
74924
  target,
77191
74925
  relation,
@@ -183117,7 +180851,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
183117
180851
  return !!(symbol2.flags & 1920) && !((_a42 = symbol2.declarations) == null ? void 0 : _a42.every((d) => d.parent === node.parent));
183118
180852
  } : isRhsOfImportDeclaration ? (
183119
180853
  // Any kind is allowed when dotting off namespace in internal import equals declaration
183120
- (symbol2) => isValidTypeAccess(symbol2) || isValidValueAccess(symbol2)
180854
+ ((symbol2) => isValidTypeAccess(symbol2) || isValidValueAccess(symbol2))
183121
180855
  ) : isTypeLocation || insideJsDocTagTypeExpression ? isValidTypeAccess : isValidValueAccess;
183122
180856
  for (const exportedSymbol of exportedSymbols) {
183123
180857
  if (isValidAccess(exportedSymbol)) {
@@ -217344,8 +215078,7 @@ var stringifyJson = (data, option) => {
217344
215078
  };
217345
215079
 
217346
215080
  // webview/shared/b3type.ts
217347
- var DOCUMENT_VERSION = "2.1.0";
217348
- var VERSION = DOCUMENT_VERSION;
215081
+ var DOCUMENT_VERSION = "2.2.0";
217349
215082
  var keyWords = ["true", "false", "null", "undefined", "NaN", "Infinity"];
217350
215083
  var isIntType = (type) => type.startsWith("int");
217351
215084
  var isFloatType = (type) => type.startsWith("float");
@@ -218071,7 +215804,7 @@ var clonePersistedTree = (tree) => cloneJsonValue(tree);
218071
215804
  var clonePersistedNode = (node) => cloneJsonValue(node);
218072
215805
  var treeDataForPersistence = (data, name) => {
218073
215806
  return {
218074
- version: VERSION,
215807
+ version: DOCUMENT_VERSION,
218075
215808
  name,
218076
215809
  desc: data.desc?.trim() || void 0,
218077
215810
  prefix: data.prefix ?? "",
@@ -218731,14 +216464,15 @@ var readWorkspaceSettings = (path14) => {
218731
216464
  const content = getFs().readFileSync(path14, "utf-8");
218732
216465
  return parseWorkspaceModelContent(content).settings;
218733
216466
  };
218734
- var hasBatchHookMethod = (obj) => {
216467
+ var hasBuildHookMethod = (obj) => {
218735
216468
  if (!obj || typeof obj !== "object") {
218736
216469
  return false;
218737
216470
  }
218738
216471
  const candidate = obj;
218739
- return typeof candidate.shouldUpgradeTree === "function" || typeof candidate.onProcessTree === "function" || typeof candidate.onProcessNode === "function" || typeof candidate.onWriteFile === "function" || typeof candidate.onComplete === "function";
216472
+ return typeof candidate.onProcessTree === "function" || typeof candidate.onProcessNode === "function" || typeof candidate.onWriteFile === "function" || typeof candidate.onComplete === "function";
218740
216473
  };
218741
216474
  var BUILD_HOOK_MARKER = "__behavior3BuildHook";
216475
+ var BATCH_HOOK_MARKER = "__behavior3BatchHook";
218742
216476
  var CHECK_HOOK_MARKER = "__behavior3CheckHook";
218743
216477
  var CHECK_HOOK_NAME = "__behavior3CheckName";
218744
216478
  var markBuildHook = (ctor) => {
@@ -218748,6 +216482,13 @@ var markBuildHook = (ctor) => {
218748
216482
  });
218749
216483
  return ctor;
218750
216484
  };
216485
+ var markBatchHook = (ctor) => {
216486
+ Object.defineProperty(ctor, BATCH_HOOK_MARKER, {
216487
+ value: true,
216488
+ configurable: false
216489
+ });
216490
+ return ctor;
216491
+ };
218751
216492
  var markCheckCtor = (ctor, explicitName) => {
218752
216493
  const name = explicitName?.trim() || ctor.name;
218753
216494
  Object.defineProperty(ctor, CHECK_HOOK_MARKER, {
@@ -218766,28 +216507,51 @@ var markCheckHook = (nameOrCtor, _context) => {
218766
216507
  }
218767
216508
  return (ctor) => markCheckCtor(ctor, nameOrCtor);
218768
216509
  };
218769
- var isDecoratedHookCtor = (value) => typeof value === "function" && value[BUILD_HOOK_MARKER] === true;
216510
+ var isDecoratedBuildHookCtor = (value) => typeof value === "function" && value[BUILD_HOOK_MARKER] === true;
216511
+ var isDecoratedBatchHookCtor = (value) => typeof value === "function" && value[BATCH_HOOK_MARKER] === true;
218770
216512
  var isDecoratedCheckCtor = (value) => typeof value === "function" && value[CHECK_HOOK_MARKER] === true;
218771
- var findDecoratedHookCtor = (moduleRecord) => {
218772
- const decorated = Array.from(new Set(Object.values(moduleRecord))).filter(isDecoratedHookCtor);
216513
+ var findDecoratedBuildHookCtor = (moduleRecord) => {
216514
+ const decorated = Array.from(new Set(Object.values(moduleRecord))).filter(
216515
+ isDecoratedBuildHookCtor
216516
+ );
218773
216517
  if (decorated.length > 1) {
218774
216518
  logger.error("build script must decorate exactly one exported class with @behavior3.build");
218775
216519
  return void 0;
218776
216520
  }
218777
216521
  return decorated[0];
218778
216522
  };
216523
+ var findDecoratedBatchHookCtor = (moduleRecord) => {
216524
+ const decorated = Array.from(new Set(Object.values(moduleRecord))).filter(
216525
+ isDecoratedBatchHookCtor
216526
+ );
216527
+ if (decorated.length > 1) {
216528
+ logger.error("batch script must decorate exactly one exported class with @behavior3.batch");
216529
+ return void 0;
216530
+ }
216531
+ if (decorated.length === 1) {
216532
+ return decorated[0];
216533
+ }
216534
+ const legacyDecorated = Array.from(new Set(Object.values(moduleRecord))).filter(
216535
+ isDecoratedBuildHookCtor
216536
+ );
216537
+ if (legacyDecorated.length > 1) {
216538
+ logger.error("batch script must decorate exactly one exported class with @behavior3.batch");
216539
+ return void 0;
216540
+ }
216541
+ return legacyDecorated[0];
216542
+ };
218779
216543
  var findDecoratedCheckCtors = (moduleRecord) => Array.from(new Set(Object.values(moduleRecord))).filter(isDecoratedCheckCtor);
218780
- var createBatchHooks = (moduleExports, env2, reportMissing = true) => {
216544
+ var createBuildHooks = (moduleExports, env2, reportMissing = true) => {
218781
216545
  if (!moduleExports || typeof moduleExports !== "object") {
218782
216546
  return void 0;
218783
216547
  }
218784
216548
  const moduleRecord = moduleExports;
218785
- const defaultExport = isDecoratedCheckCtor(moduleRecord.default) ? void 0 : moduleRecord.default;
218786
- const ctor = moduleRecord.Hook ?? findDecoratedHookCtor(moduleRecord) ?? defaultExport;
216549
+ const defaultExport = isDecoratedCheckCtor(moduleRecord.default) || isDecoratedBatchHookCtor(moduleRecord.default) ? void 0 : moduleRecord.default;
216550
+ const ctor = moduleRecord.BuildHook ?? moduleRecord.Hook ?? findDecoratedBuildHookCtor(moduleRecord) ?? defaultExport;
218787
216551
  if (typeof ctor === "function") {
218788
216552
  try {
218789
216553
  const instance = new ctor(env2);
218790
- if (hasBatchHookMethod(instance)) {
216554
+ if (hasBuildHookMethod(instance)) {
218791
216555
  return instance;
218792
216556
  }
218793
216557
  logger.error("build hook class instance has no supported hook methods");
@@ -218797,7 +216561,32 @@ var createBatchHooks = (moduleExports, env2, reportMissing = true) => {
218797
216561
  }
218798
216562
  if (reportMissing) {
218799
216563
  logger.error(
218800
- "build script must export a Hook class, default class, or one @behavior3.build-decorated class"
216564
+ "build script must export a BuildHook class, Hook class, default class, or one @behavior3.build-decorated class"
216565
+ );
216566
+ }
216567
+ return void 0;
216568
+ };
216569
+ var createBatchHooks = (moduleExports, env2, reportMissing = true) => {
216570
+ if (!moduleExports || typeof moduleExports !== "object") {
216571
+ return void 0;
216572
+ }
216573
+ const moduleRecord = moduleExports;
216574
+ const defaultExport = isDecoratedCheckCtor(moduleRecord.default) || isDecoratedBuildHookCtor(moduleRecord.default) || isDecoratedBatchHookCtor(moduleRecord.default) ? void 0 : moduleRecord.default;
216575
+ const ctor = moduleRecord.BatchHook ?? findDecoratedBatchHookCtor(moduleRecord) ?? moduleRecord.Hook ?? defaultExport;
216576
+ if (typeof ctor === "function") {
216577
+ try {
216578
+ const instance = new ctor(env2);
216579
+ if (hasBuildHookMethod(instance) || typeof instance.shouldUpgradeTree === "function") {
216580
+ return instance;
216581
+ }
216582
+ logger.error("batch hook class instance has no supported hook methods");
216583
+ } catch (error) {
216584
+ logger.error("failed to instantiate batch hook class", error);
216585
+ }
216586
+ }
216587
+ if (reportMissing) {
216588
+ logger.error(
216589
+ "batch script must export a BatchHook class, default class, or one @behavior3.batch-decorated class"
218801
216590
  );
218802
216591
  }
218803
216592
  return void 0;
@@ -218846,13 +216635,13 @@ var createBuildScriptRuntime = (moduleExports, env2) => {
218846
216635
  };
218847
216636
  }
218848
216637
  const moduleRecord = moduleExports;
218849
- const hasBuildHookCandidate = typeof moduleRecord.Hook === "function" || Object.values(moduleRecord).some(isDecoratedHookCtor) || typeof moduleRecord.default === "function" && !isDecoratedCheckCtor(moduleRecord.default);
218850
- const buildScript = createBatchHooks(moduleExports, env2, false);
216638
+ const hasBuildHookCandidate = typeof moduleRecord.BuildHook === "function" || typeof moduleRecord.Hook === "function" || Object.values(moduleRecord).some(isDecoratedBuildHookCtor) || typeof moduleRecord.default === "function" && !isDecoratedCheckCtor(moduleRecord.default) && !isDecoratedBatchHookCtor(moduleRecord.default);
216639
+ const buildScript = createBuildHooks(moduleExports, env2, false);
218851
216640
  const checkerResult = createNodeArgCheckers(moduleExports, env2);
218852
216641
  const hasEntries = Boolean(buildScript) || checkerResult.hasCheckers;
218853
216642
  if (!hasEntries) {
218854
216643
  logger.error(
218855
- "build script must export a Hook class, default build class, @behavior3.build class, or @behavior3.check class"
216644
+ "build script must export a BuildHook class, Hook class, default build class, @behavior3.build class, or @behavior3.check class"
218856
216645
  );
218857
216646
  }
218858
216647
  return {
@@ -219273,6 +217062,7 @@ var applyBehavior3DecoratorGlobal = () => {
219273
217062
  runtimeGlobal.behavior3 = {
219274
217063
  ...decoratorGlobalState.previousBehavior3 && typeof decoratorGlobalState.previousBehavior3 === "object" ? decoratorGlobalState.previousBehavior3 : {},
219275
217064
  build: markBuildHook,
217065
+ batch: markBatchHook,
219276
217066
  check: markCheckHook
219277
217067
  };
219278
217068
  };
@@ -219293,7 +217083,7 @@ var restoreBehavior3DecoratorGlobal = () => {
219293
217083
  decoratorGlobalState.hadBehavior3 = false;
219294
217084
  decoratorGlobalState.previousBehavior3 = void 0;
219295
217085
  };
219296
- var withBehavior3BuildDecoratorGlobal = async (loader) => {
217086
+ var withBehavior3ScriptDecoratorGlobal = async (loader) => {
219297
217087
  applyBehavior3DecoratorGlobal();
219298
217088
  try {
219299
217089
  return await loader();
@@ -219432,7 +217222,7 @@ var loadRuntimeModule = async (modulePath, options) => {
219432
217222
  }
219433
217223
  }
219434
217224
  if (getRuntimeProcess()?.type === "renderer") {
219435
- return await withBehavior3BuildDecoratorGlobal(
217225
+ return await withBehavior3ScriptDecoratorGlobal(
219436
217226
  () => import(
219437
217227
  /* @vite-ignore */
219438
217228
  `${modulePath}?t=${Date.now()}`
@@ -219460,7 +217250,7 @@ var loadRuntimeModule = async (modulePath, options) => {
219460
217250
  return null;
219461
217251
  }
219462
217252
  const normalizedModulePath = b3path_default.posixPath(tempModulePath);
219463
- const result = await withBehavior3BuildDecoratorGlobal(
217253
+ const result = await withBehavior3ScriptDecoratorGlobal(
219464
217254
  () => import(
219465
217255
  /* @vite-ignore */
219466
217256
  `file:///${normalizedModulePath}?t=${Date.now()}`
@@ -220791,15 +218581,14 @@ async function runBatchProcess(context, resourceUri) {
220791
218581
  await runBatchProcessWithScript(context, workspaceFile, settingPath, projectRoot, picked[0].fsPath);
220792
218582
  }
220793
218583
  async function runBatchProcessScript(context, resourceUri) {
220794
- const scriptUri = resourceUri?.scheme === "file" ? resourceUri : getActiveFileUri();
218584
+ const resourceIsFile = resourceUri?.scheme === "file";
218585
+ const resourcePath = resourceIsFile ? resourceUri.fsPath : void 0;
218586
+ const explicitScriptUri = resourcePath && isSupportedBatchScriptPath(resourcePath) ? resourceUri : void 0;
218587
+ const activeFileUri = getActiveFileUri();
218588
+ const activeScriptUri = activeFileUri && isSupportedBatchScriptPath(activeFileUri.fsPath) ? activeFileUri : void 0;
218589
+ const scriptUri = explicitScriptUri ?? (!resourceUri ? activeScriptUri : void 0);
220795
218590
  if (!scriptUri) {
220796
- void vscode2.window.showErrorMessage("Select a batch script file first.");
220797
- return;
220798
- }
220799
- if (!isSupportedBatchScriptPath(scriptUri.fsPath)) {
220800
- void vscode2.window.showErrorMessage(
220801
- "Batch script must be a .ts, .mts, .js, or .mjs file."
220802
- );
218591
+ await runBatchProcess(context, resourceUri);
220803
218592
  return;
220804
218593
  }
220805
218594
  const folder = vscode2.workspace.getWorkspaceFolder(scriptUri) ?? vscode2.workspace.workspaceFolders?.[0];
@@ -221123,6 +218912,7 @@ var flattenMaterializedTree = (root, prefix) => {
221123
218912
  args: node.data.args,
221124
218913
  input: node.data.input,
221125
218914
  output: node.data.output,
218915
+ children: node.data.children,
221126
218916
  debug: node.data.debug,
221127
218917
  disabled: node.data.disabled,
221128
218918
  path: node.data.path,
@@ -222194,6 +219984,15 @@ function buildInitMessage(params) {
222194
219984
  };
222195
219985
  }
222196
219986
 
219987
+ // webview/shared/node-overrides.ts
219988
+ var hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
219989
+ var getNodeArgOverrideCompareValue = (args, arg) => {
219990
+ if (args && hasOwn(args, arg.name)) {
219991
+ return args[arg.name];
219992
+ }
219993
+ return arg.default;
219994
+ };
219995
+
222197
219996
  // media/locales/en.json
222198
219997
  var en_default = {
222199
219998
  about: "About Behavior3",
@@ -222243,6 +220042,7 @@ var en_default = {
222243
220042
  reload: "Reload",
222244
220043
  reset: "Reset",
222245
220044
  "reset.confirm": "Reset to original value?",
220045
+ "reset.defaultConfirm": "Reset to default value?",
222246
220046
  rename: "Rename...",
222247
220047
  replace: "Replace",
222248
220048
  reportIssue: "Report Issue",
@@ -222360,6 +220160,11 @@ var en_default = {
222360
220160
  "editor.newerVersionEditDenied": "This file is created by a newer version of Behavior3({{version}}). Please upgrade to the latest version.",
222361
220161
  "inspector.noActiveDocument": "Open a Behavior3 editor to inspect and edit the active tree.",
222362
220162
  "inspector.embeddedModeNotice": "Inspector is configured to appear inside the Behavior3 editor.",
220163
+ "inspector.embeddedToolbar.build": "Build Behavior Tree",
220164
+ "inspector.embeddedToolbar.toggleEditorMode": "Toggle Editor Mode",
220165
+ "inspector.embeddedToolbar.toggleInspectorNodeJson": "Toggle Raw Node JSON",
220166
+ "inspector.embeddedToolbar.createProject": "Create Project",
220167
+ "inspector.embeddedToolbar.createTree": "Create Behavior Tree",
222363
220168
  "mutation.invalidJsonPath": "Invalid JSON path: {{path}}",
222364
220169
  "mutation.missingSelectedNode": "No selected node is available for this mutation.",
222365
220170
  "mutation.selectedNodeMismatch": "The selected node changed before the mutation was applied.",
@@ -222445,6 +220250,7 @@ var zh_default = {
222445
220250
  reload: "\u91CD\u65B0\u52A0\u8F7D",
222446
220251
  reset: "\u91CD\u7F6E",
222447
220252
  "reset.confirm": "\u91CD\u7F6E\u4E3A\u539F\u59CB\u503C\uFF1F",
220253
+ "reset.defaultConfirm": "\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u503C\uFF1F",
222448
220254
  rename: "\u91CD\u547D\u540D...",
222449
220255
  replace: "\u66FF\u6362",
222450
220256
  reportIssue: "\u95EE\u9898\u53CD\u9988",
@@ -222562,6 +220368,11 @@ var zh_default = {
222562
220368
  "editor.newerVersionEditDenied": "\u6B64\u6587\u4EF6\u7531\u65B0\u7248\u672C Behavior3({{version}}) \u521B\u5EFA\uFF0C\u8BF7\u5347\u7EA7\u5230\u6700\u65B0\u7248\u672C\u540E\u518D\u7F16\u8F91\u3002",
222563
220369
  "inspector.noActiveDocument": "\u6253\u5F00\u4E00\u4E2A Behavior3 \u7F16\u8F91\u5668\u540E\uFF0C\u8FD9\u91CC\u4F1A\u663E\u793A\u5F53\u524D\u884C\u4E3A\u6811\u7684 Inspector\uFF0C\u5E76\u652F\u6301\u76F4\u63A5\u7F16\u8F91\u3002",
222564
220370
  "inspector.embeddedModeNotice": "Inspector \u5F53\u524D\u914D\u7F6E\u4E3A\u5728 Behavior3 \u7F16\u8F91\u5668\u5185\u90E8\u663E\u793A\u3002",
220371
+ "inspector.embeddedToolbar.build": "\u6784\u5EFA\u884C\u4E3A\u6811",
220372
+ "inspector.embeddedToolbar.toggleEditorMode": "\u5207\u6362\u7F16\u8F91\u5668\u6A21\u5F0F",
220373
+ "inspector.embeddedToolbar.toggleInspectorNodeJson": "\u5207\u6362\u539F\u59CB\u8282\u70B9 JSON",
220374
+ "inspector.embeddedToolbar.createProject": "\u65B0\u5EFA\u9879\u76EE",
220375
+ "inspector.embeddedToolbar.createTree": "\u65B0\u5EFA\u884C\u4E3A\u6811",
222565
220376
  "mutation.invalidJsonPath": "\u65E0\u6548\u7684 JSON \u8DEF\u5F84: {{path}}",
222566
220377
  "mutation.missingSelectedNode": "\u5F53\u524D\u6CA1\u6709\u53EF\u7528\u4E8E\u63D0\u4EA4\u6B64\u4FEE\u6539\u7684\u9009\u4E2D\u8282\u70B9\u3002",
222567
220378
  "mutation.selectedNodeMismatch": "\u5F53\u524D\u9009\u4E2D\u8282\u70B9\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u8BD5\u3002",
@@ -222712,8 +220523,8 @@ var computeNodeOverride = (original, edited, def) => {
222712
220523
  if (def?.args?.length) {
222713
220524
  const diffArgs = {};
222714
220525
  for (const arg of def.args) {
222715
- const originalValue = original.args?.[arg.name];
222716
- const editedValue = edited.args?.[arg.name];
220526
+ const originalValue = getNodeArgOverrideCompareValue(original.args, arg);
220527
+ const editedValue = getNodeArgOverrideCompareValue(edited.args, arg);
222717
220528
  if (!isJsonEqual(originalValue, editedValue)) {
222718
220529
  diffArgs[arg.name] = editedValue;
222719
220530
  }
@@ -223141,10 +220952,7 @@ var pruneReachableSubtreeOverrides = (deps, tree) => normalizeReachableSubtreeOv
223141
220952
  readWorkspaceFileContent
223142
220953
  });
223143
220954
  function applyContentFromWebview(deps, content) {
223144
- const normalizedContent = normalizeTreeContentForWrite(
223145
- content,
223146
- deps.document.uri.fsPath
223147
- );
220955
+ const normalizedContent = normalizeTreeContentForWrite(content, deps.document.uri.fsPath);
223148
220956
  if (deps.document.content === normalizedContent) {
223149
220957
  return false;
223150
220958
  }
@@ -223164,10 +220972,7 @@ async function handleSaveSelectedAsSubtreeMutation(deps, msg) {
223164
220972
  if (msg.mutation.type !== "saveSelectedAsSubtree") {
223165
220973
  return { kind: "skip" };
223166
220974
  }
223167
- const currentTree = parsePersistedTreeContent(
223168
- deps.document.content,
223169
- deps.document.uri.fsPath
223170
- );
220975
+ const currentTree = parsePersistedTreeContent(deps.document.content, deps.document.uri.fsPath);
223171
220976
  if (currentTree.root.uuid === msg.mutation.payload.target.structuralStableId) {
223172
220977
  return {
223173
220978
  kind: "handled",
@@ -223201,7 +221006,7 @@ async function handleSaveSelectedAsSubtreeMutation(deps, msg) {
223201
221006
  };
223202
221007
  }
223203
221008
  const subtreeModel = {
223204
- version: VERSION,
221009
+ version: DOCUMENT_VERSION,
223205
221010
  name: "subtree",
223206
221011
  prefix: "",
223207
221012
  desc: msg.mutation.payload.subtreeRoot.desc,
@@ -223513,6 +221318,9 @@ function createSessionDispatcher({
223513
221318
  buildScriptDebug: msg.buildScriptDebug
223514
221319
  }).then(void 0, logAsyncRuntimeError("command:behavior3.build"));
223515
221320
  return;
221321
+ case "runInspectorCommand":
221322
+ void vscode14.commands.executeCommand(msg.command).then(void 0, logAsyncRuntimeError(`command:${msg.command}`));
221323
+ return;
223516
221324
  case "validateNodeChecks":
223517
221325
  await handleValidateNodeChecksMessage(msg, reply);
223518
221326
  return;
@@ -224880,6 +222688,9 @@ var buildReloadDocumentSnapshot = (content, documentSession, selection) => ({
224880
222688
  });
224881
222689
  var stripSnapshotTransportFields = (initMessage) => {
224882
222690
  const { content, documentSession, selection, ...rest } = initMessage;
222691
+ void content;
222692
+ void documentSession;
222693
+ void selection;
224883
222694
  return rest;
224884
222695
  };
224885
222696
  var buildEmbeddedModeSettingsMessage = (snapshot) => ({
@@ -224918,6 +222729,16 @@ var InspectorSidebarCoordinator = class {
224918
222729
  this.view = null;
224919
222730
  this.viewReady = false;
224920
222731
  }
222732
+ toggleNodeJsonView() {
222733
+ if (this.inspectorMode !== "sidebar") {
222734
+ return;
222735
+ }
222736
+ const snapshot = (this.activeDocumentUri && this.sessionSnapshots.get(this.activeDocumentUri)) ?? null;
222737
+ if (!snapshot || snapshot.documentSnapshot.selection.kind !== "node") {
222738
+ return;
222739
+ }
222740
+ void this.postMessage({ type: "toggleInspectorNodeJson" });
222741
+ }
224921
222742
  setInspectorMode(mode) {
224922
222743
  this.inspectorMode = mode;
224923
222744
  if (!this.viewReady) {
@@ -225211,13 +223032,157 @@ function createLogOutputChannelLogger(out) {
225211
223032
  };
225212
223033
  }
225213
223034
 
223035
+ // src/script-scaffold.ts
223036
+ var SCRIPT_FILE_EXTENSION_RE = /\.(ts|mts|js|mjs)$/i;
223037
+ var INVALID_FILE_NAME_RE = /[\/\\:*?"<>|]/;
223038
+ var DEFAULT_BASE_NAMES = {
223039
+ build: "build",
223040
+ batch: "batch",
223041
+ checker: "checker"
223042
+ };
223043
+ function getScriptScaffoldDefaultBaseName(kind) {
223044
+ return DEFAULT_BASE_NAMES[kind];
223045
+ }
223046
+ function normalizeScriptScaffoldBaseName(value) {
223047
+ return value.trim();
223048
+ }
223049
+ function validateScriptScaffoldBaseName(value) {
223050
+ const normalized = normalizeScriptScaffoldBaseName(value);
223051
+ if (!normalized) {
223052
+ return "Name cannot be empty";
223053
+ }
223054
+ if (INVALID_FILE_NAME_RE.test(normalized)) {
223055
+ return "Name contains invalid characters";
223056
+ }
223057
+ if (SCRIPT_FILE_EXTENSION_RE.test(normalized)) {
223058
+ return "Enter the name without an extension";
223059
+ }
223060
+ return null;
223061
+ }
223062
+ function createScriptScaffoldFileName(baseName) {
223063
+ return `${normalizeScriptScaffoldBaseName(baseName)}.ts`;
223064
+ }
223065
+ function createScriptScaffoldContent(kind, baseName) {
223066
+ switch (kind) {
223067
+ case "build":
223068
+ return createBuildScriptContent(baseName);
223069
+ case "batch":
223070
+ return createBatchScriptContent(baseName);
223071
+ case "checker":
223072
+ return createCheckerScriptContent(baseName);
223073
+ }
223074
+ }
223075
+ function createBuildScriptContent(baseName) {
223076
+ const className = ensureSuffix(toPascalIdentifier(baseName), "Script");
223077
+ return [
223078
+ 'import type { BuildEnv, BuildScript, NodeData, TreeData } from "vscode-behavior3/build";',
223079
+ "",
223080
+ "@behavior3.build",
223081
+ `export class ${className} implements BuildScript {`,
223082
+ " constructor(private readonly env: BuildEnv) {}",
223083
+ "",
223084
+ " onProcessTree(tree: TreeData, _path: string, _errors: string[]) {",
223085
+ " return tree;",
223086
+ " }",
223087
+ "",
223088
+ " onProcessNode(node: NodeData, _errors: string[]) {",
223089
+ " return node;",
223090
+ " }",
223091
+ "",
223092
+ ' onComplete(status: "success" | "failure") {',
223093
+ " this.env.logger.info(`build ${status}`);",
223094
+ " }",
223095
+ "}",
223096
+ ""
223097
+ ].join("\n");
223098
+ }
223099
+ function createBatchScriptContent(baseName) {
223100
+ const className = ensureSuffix(toPascalIdentifier(baseName), "Script");
223101
+ return [
223102
+ 'import type { BatchScript, BuildEnv, NodeData, TreeData } from "vscode-behavior3/build";',
223103
+ "",
223104
+ "@behavior3.batch",
223105
+ `export class ${className} implements BatchScript {`,
223106
+ " constructor(private readonly env: BuildEnv) {}",
223107
+ "",
223108
+ " shouldUpgradeTree(_path: string, _tree: TreeData) {",
223109
+ " return false;",
223110
+ " }",
223111
+ "",
223112
+ " onProcessTree(tree: TreeData, _path: string, _errors: string[]) {",
223113
+ " return tree;",
223114
+ " }",
223115
+ "",
223116
+ " onProcessNode(node: NodeData, _errors: string[]) {",
223117
+ " return node;",
223118
+ " }",
223119
+ "",
223120
+ ' onComplete(status: "success" | "failure") {',
223121
+ " this.env.logger.info(`batch ${status}`);",
223122
+ " }",
223123
+ "}",
223124
+ ""
223125
+ ].join("\n");
223126
+ }
223127
+ function createCheckerScriptContent(baseName) {
223128
+ const className = ensureSuffix(toPascalIdentifier(baseName), "Checker");
223129
+ const checkerName = toCheckerRegistrationName(baseName);
223130
+ return [
223131
+ 'import type { NodeArgCheckContext } from "vscode-behavior3/build";',
223132
+ "",
223133
+ `@behavior3.check("${checkerName}")`,
223134
+ `export class ${className} {`,
223135
+ " validate(value: unknown, ctx: NodeArgCheckContext) {",
223136
+ ' if (value === undefined || value === null || value === "") {',
223137
+ " return;",
223138
+ " }",
223139
+ ' if (typeof value !== "number") {',
223140
+ " return `${ctx.argName} must be a number`;",
223141
+ " }",
223142
+ " if (value <= 0) {",
223143
+ " return `${ctx.argName} must be greater than 0`;",
223144
+ " }",
223145
+ " }",
223146
+ "}",
223147
+ ""
223148
+ ].join("\n");
223149
+ }
223150
+ function toPascalIdentifier(value) {
223151
+ const source = normalizeScriptScaffoldBaseName(value).replace(SCRIPT_FILE_EXTENSION_RE, "");
223152
+ const tokens = source.match(/[A-Za-z0-9]+/g) ?? [];
223153
+ const joined = tokens.map((token) => token.charAt(0).toUpperCase() + token.slice(1)).join("");
223154
+ if (!joined) {
223155
+ return "Generated";
223156
+ }
223157
+ if (/^[A-Za-z_$]/.test(joined)) {
223158
+ return joined;
223159
+ }
223160
+ return `Generated${joined}`;
223161
+ }
223162
+ function ensureSuffix(value, suffix) {
223163
+ return value.toLowerCase().endsWith(suffix.toLowerCase()) ? value : `${value}${suffix}`;
223164
+ }
223165
+ function toCheckerRegistrationName(value) {
223166
+ const normalized = normalizeScriptScaffoldBaseName(value).replace(SCRIPT_FILE_EXTENSION_RE, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
223167
+ return normalized || "checker";
223168
+ }
223169
+
225214
223170
  // src/extension.ts
225215
223171
  var getVSCodeTheme2 = () => {
225216
223172
  const kind = vscode23.window.activeColorTheme.kind;
225217
223173
  return kind === vscode23.ColorThemeKind.Light || kind === vscode23.ColorThemeKind.HighContrastLight ? "light" : "dark";
225218
223174
  };
223175
+ var getActiveBehaviorTreeEditorUri = () => {
223176
+ const tab = vscode23.window.tabGroups.activeTabGroup.activeTab;
223177
+ const input = tab?.input;
223178
+ if (!(input instanceof vscode23.TabInputCustom) || input.viewType !== TreeEditorProvider.viewType) {
223179
+ return null;
223180
+ }
223181
+ return input.uri;
223182
+ };
225219
223183
  function activate(context) {
225220
223184
  const config = vscode23.workspace.getConfiguration("behavior3");
223185
+ const inspectorMode = config.get("inspectorMode", "sidebar");
225221
223186
  const out = getBehavior3OutputChannel();
225222
223187
  context.subscriptions.push(out);
225223
223188
  setLogger(composeLoggers(createConsoleLogger(), createLogOutputChannelLogger(out)));
@@ -225227,8 +223192,11 @@ function activate(context) {
225227
223192
  context.extensionUri,
225228
223193
  inspectorCoordinator
225229
223194
  );
225230
- inspectorCoordinator.setInspectorMode(
225231
- config.get("inspectorMode", "sidebar")
223195
+ inspectorCoordinator.setInspectorMode(inspectorMode);
223196
+ void vscode23.commands.executeCommand(
223197
+ "setContext",
223198
+ "behavior3.inspectorSidebarMode",
223199
+ inspectorMode === "sidebar"
225232
223200
  );
225233
223201
  inspectorCoordinator.setMessageDispatcher(
225234
223202
  (documentUri, message, reply) => TreeEditorProvider.dispatchMessageToDocument(documentUri, message, reply)
@@ -225259,23 +223227,35 @@ function activate(context) {
225259
223227
  inspectorCoordinator.setActiveDocument(documentUri);
225260
223228
  };
225261
223229
  syncActiveInspectorDocument();
225262
- context.subscriptions.push(vscode23.window.tabGroups.onDidChangeTabs(() => {
225263
- syncActiveInspectorDocument();
225264
- }));
225265
- context.subscriptions.push(vscode23.window.tabGroups.onDidChangeTabGroups(() => {
225266
- syncActiveInspectorDocument();
225267
- }));
225268
- context.subscriptions.push(vscode23.window.onDidChangeActiveColorTheme(() => {
225269
- inspectorCoordinator.setTheme(getVSCodeTheme2());
225270
- }));
225271
- context.subscriptions.push(vscode23.workspace.onDidChangeConfiguration((event) => {
225272
- if (!event.affectsConfiguration("behavior3.inspectorMode")) {
225273
- return;
225274
- }
225275
- inspectorCoordinator.setInspectorMode(
225276
- vscode23.workspace.getConfiguration("behavior3").get("inspectorMode", "sidebar")
225277
- );
225278
- }));
223230
+ context.subscriptions.push(
223231
+ vscode23.window.tabGroups.onDidChangeTabs(() => {
223232
+ syncActiveInspectorDocument();
223233
+ })
223234
+ );
223235
+ context.subscriptions.push(
223236
+ vscode23.window.tabGroups.onDidChangeTabGroups(() => {
223237
+ syncActiveInspectorDocument();
223238
+ })
223239
+ );
223240
+ context.subscriptions.push(
223241
+ vscode23.window.onDidChangeActiveColorTheme(() => {
223242
+ inspectorCoordinator.setTheme(getVSCodeTheme2());
223243
+ })
223244
+ );
223245
+ context.subscriptions.push(
223246
+ vscode23.workspace.onDidChangeConfiguration((event) => {
223247
+ if (!event.affectsConfiguration("behavior3.inspectorMode")) {
223248
+ return;
223249
+ }
223250
+ const nextInspectorMode = vscode23.workspace.getConfiguration("behavior3").get("inspectorMode", "sidebar");
223251
+ inspectorCoordinator.setInspectorMode(nextInspectorMode);
223252
+ void vscode23.commands.executeCommand(
223253
+ "setContext",
223254
+ "behavior3.inspectorSidebarMode",
223255
+ nextInspectorMode === "sidebar"
223256
+ );
223257
+ })
223258
+ );
225279
223259
  const autoCheckedJsonWhileOpen = /* @__PURE__ */ new Set();
225280
223260
  const autoOpeningJsonUris = /* @__PURE__ */ new Set();
225281
223261
  const skipNextAutoOpenUris = /* @__PURE__ */ new Set();
@@ -225318,10 +223298,36 @@ function activate(context) {
225318
223298
  })
225319
223299
  );
225320
223300
  context.subscriptions.push(
225321
- vscode23.commands.registerCommand("behavior3.batchProcess", async (uri) => {
225322
- await runBatchProcess(context, uri);
223301
+ vscode23.commands.registerCommand("behavior3.toggleInspectorNodeJson", async () => {
223302
+ const activeEditorUri = getActiveBehaviorTreeEditorUri();
223303
+ const activeInspectorMode = vscode23.workspace.getConfiguration("behavior3").get("inspectorMode", "sidebar");
223304
+ if (activeInspectorMode === "embedded" && activeEditorUri) {
223305
+ TreeEditorProvider.postMessageToDocument(activeEditorUri.toString(), {
223306
+ type: "toggleInspectorNodeJson"
223307
+ });
223308
+ return;
223309
+ }
223310
+ inspectorCoordinator.toggleNodeJsonView();
223311
+ })
223312
+ );
223313
+ context.subscriptions.push(
223314
+ vscode23.commands.registerCommand("behavior3.createBuildScript", async (uri) => {
223315
+ await createBehavior3Script("build", uri);
223316
+ })
223317
+ );
223318
+ context.subscriptions.push(
223319
+ vscode23.commands.registerCommand("behavior3.createBatchScript", async (uri) => {
223320
+ await createBehavior3Script("batch", uri);
225323
223321
  })
225324
223322
  );
223323
+ context.subscriptions.push(
223324
+ vscode23.commands.registerCommand(
223325
+ "behavior3.createCheckerScript",
223326
+ async (uri) => {
223327
+ await createBehavior3Script("checker", uri);
223328
+ }
223329
+ )
223330
+ );
225325
223331
  context.subscriptions.push(
225326
223332
  vscode23.commands.registerCommand(
225327
223333
  "behavior3.runBatchProcessScript",
@@ -225536,6 +223542,62 @@ function activate(context) {
225536
223542
  }
225537
223543
  function deactivate() {
225538
223544
  }
223545
+ async function createBehavior3Script(kind, uri) {
223546
+ const folderUri = await resolveFolderTargetUri(uri);
223547
+ if (!folderUri) {
223548
+ void vscode23.window.showErrorMessage("Please open a workspace folder first.");
223549
+ return;
223550
+ }
223551
+ const baseName = await vscode23.window.showInputBox({
223552
+ prompt: `Enter ${getScriptScaffoldPromptLabel(kind)} file name (without extension)`,
223553
+ placeHolder: getScriptScaffoldDefaultBaseName(kind),
223554
+ value: getScriptScaffoldDefaultBaseName(kind),
223555
+ validateInput: validateScriptScaffoldBaseName
223556
+ });
223557
+ if (!baseName) {
223558
+ return;
223559
+ }
223560
+ const normalizedBaseName = normalizeScriptScaffoldBaseName(baseName);
223561
+ const fileName = createScriptScaffoldFileName(normalizedBaseName);
223562
+ const fileUri = vscode23.Uri.file(path13.join(folderUri.fsPath, fileName));
223563
+ if (fs8.existsSync(fileUri.fsPath)) {
223564
+ void vscode23.window.showErrorMessage(`File already exists: ${fileName}`);
223565
+ return;
223566
+ }
223567
+ try {
223568
+ await fs8.promises.writeFile(
223569
+ fileUri.fsPath,
223570
+ createScriptScaffoldContent(kind, normalizedBaseName),
223571
+ "utf-8"
223572
+ );
223573
+ await vscode23.window.showTextDocument(fileUri);
223574
+ } catch (e) {
223575
+ void vscode23.window.showErrorMessage(
223576
+ `Failed to create file: ${e instanceof Error ? e.message : e}`
223577
+ );
223578
+ }
223579
+ }
223580
+ async function resolveFolderTargetUri(uri) {
223581
+ if (uri?.scheme === "file") {
223582
+ try {
223583
+ const stat = await vscode23.workspace.fs.stat(uri);
223584
+ return stat.type === vscode23.FileType.Directory ? uri : vscode23.Uri.file(path13.dirname(uri.fsPath));
223585
+ } catch {
223586
+ return void 0;
223587
+ }
223588
+ }
223589
+ return vscode23.workspace.workspaceFolders?.[0]?.uri;
223590
+ }
223591
+ function getScriptScaffoldPromptLabel(kind) {
223592
+ switch (kind) {
223593
+ case "build":
223594
+ return "build script";
223595
+ case "batch":
223596
+ return "batch script";
223597
+ case "checker":
223598
+ return "checker script";
223599
+ }
223600
+ }
225539
223601
  async function tryAutoOpenBehaviorEditor(uri, autoCheckedJsonWhileOpen, autoOpeningJsonUris, skipNextAutoOpenUris) {
225540
223602
  if (uri.scheme !== "file") {
225541
223603
  return;