keycomfort 0.2.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/bundle.js +994 -966
  2. package/package.json +5 -6
package/dist/bundle.js CHANGED
@@ -1,18 +1,5 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
3
-
4
- var require$$0$1 = require('node:process');
5
- var require$$1 = require('node:child_process');
6
- var require$$3 = require('node:fs');
7
- var require$$5 = require('node:path');
8
- var require$$4$1 = require('node:readline');
9
- var require$$0 = require('node:events');
10
- var require$$2 = require('node:os');
11
- var require$$4 = require('node:fs/promises');
12
- var require$$6$1 = require('node:stream');
13
- var require$$7 = require('node:assert');
14
-
15
- function getDefaultExportFromCjs (x) {
2
+ 'use strict';var require$$0$1=require('node:process'),require$$1=require('node:child_process'),require$$3=require('node:fs'),require$$3$1=require('node:path'),require$$4$1=require('node:readline'),require$$0=require('node:events'),require$$0$2=require('node:os'),require$$2=require('node:fs/promises'),require$$4=require('node:stream'),require$$7=require('node:assert');function getDefaultExportFromCjs (x) {
16
3
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
17
4
  }
18
5
 
@@ -43,17 +30,7 @@ function getAugmentedNamespace(n) {
43
30
  });
44
31
  });
45
32
  return a;
46
- }
47
-
48
- var main$1 = {};
49
-
50
- var commander = {};
51
-
52
- var argument = {};
53
-
54
- var error = {};
55
-
56
- /**
33
+ }var main$1 = {};var commander = {};var argument = {};var error = {};/**
57
34
  * CommanderError class
58
35
  */
59
36
 
@@ -99,9 +76,7 @@ function requireError () {
99
76
  error.CommanderError = CommanderError;
100
77
  error.InvalidArgumentError = InvalidArgumentError;
101
78
  return error;
102
- }
103
-
104
- var hasRequiredArgument;
79
+ }var hasRequiredArgument;
105
80
 
106
81
  function requireArgument () {
107
82
  if (hasRequiredArgument) return argument;
@@ -257,13 +232,7 @@ function requireArgument () {
257
232
  argument.Argument = Argument;
258
233
  argument.humanReadableArgName = humanReadableArgName;
259
234
  return argument;
260
- }
261
-
262
- var command = {};
263
-
264
- var help = {};
265
-
266
- var hasRequiredHelp;
235
+ }var command = {};var help = {};var hasRequiredHelp;
267
236
 
268
237
  function requireHelp () {
269
238
  if (hasRequiredHelp) return help;
@@ -1016,11 +985,7 @@ function requireHelp () {
1016
985
  help.Help = Help;
1017
986
  help.stripColor = stripColor;
1018
987
  return help;
1019
- }
1020
-
1021
- var option = {};
1022
-
1023
- var hasRequiredOption;
988
+ }var option = {};var hasRequiredOption;
1024
989
 
1025
990
  function requireOption () {
1026
991
  if (hasRequiredOption) return option;
@@ -1406,11 +1371,7 @@ function requireOption () {
1406
1371
  option.Option = Option;
1407
1372
  option.DualOptions = DualOptions;
1408
1373
  return option;
1409
- }
1410
-
1411
- var suggestSimilar = {};
1412
-
1413
- var hasRequiredSuggestSimilar;
1374
+ }var suggestSimilar = {};var hasRequiredSuggestSimilar;
1414
1375
 
1415
1376
  function requireSuggestSimilar () {
1416
1377
  if (hasRequiredSuggestSimilar) return suggestSimilar;
@@ -1517,16 +1478,14 @@ function requireSuggestSimilar () {
1517
1478
 
1518
1479
  suggestSimilar.suggestSimilar = suggestSimilar$1;
1519
1480
  return suggestSimilar;
1520
- }
1521
-
1522
- var hasRequiredCommand;
1481
+ }var hasRequiredCommand;
1523
1482
 
1524
1483
  function requireCommand () {
1525
1484
  if (hasRequiredCommand) return command;
1526
1485
  hasRequiredCommand = 1;
1527
1486
  const EventEmitter = require$$0.EventEmitter;
1528
1487
  const childProcess = require$$1;
1529
- const path = require$$5;
1488
+ const path = require$$3$1;
1530
1489
  const fs = require$$3;
1531
1490
  const process = require$$0$1;
1532
1491
 
@@ -4300,9 +4259,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4300
4259
  command.Command = Command;
4301
4260
  command.useColor = useColor; // exporting for tests
4302
4261
  return command;
4303
- }
4304
-
4305
- var hasRequiredCommander;
4262
+ }var hasRequiredCommander;
4306
4263
 
4307
4264
  function requireCommander () {
4308
4265
  if (hasRequiredCommander) return commander;
@@ -4332,9 +4289,7 @@ function requireCommander () {
4332
4289
  commander.InvalidArgumentError = InvalidArgumentError;
4333
4290
  commander.InvalidOptionArgumentError = InvalidArgumentError; // Deprecated
4334
4291
  return commander;
4335
- }
4336
-
4337
- const ALIAS = Symbol.for('yaml.alias');
4292
+ }const ALIAS = Symbol.for('yaml.alias');
4338
4293
  const DOC = Symbol.for('yaml.document');
4339
4294
  const MAP = Symbol.for('yaml.map');
4340
4295
  const PAIR = Symbol.for('yaml.pair');
@@ -4367,9 +4322,7 @@ function isNode(node) {
4367
4322
  }
4368
4323
  return false;
4369
4324
  }
4370
- const hasAnchor = (node) => (isScalar$1(node) || isCollection$1(node)) && !!node.anchor;
4371
-
4372
- const BREAK$1 = Symbol('break visit');
4325
+ const hasAnchor = (node) => (isScalar$1(node) || isCollection$1(node)) && !!node.anchor;const BREAK$1 = Symbol('break visit');
4373
4326
  const SKIP$1 = Symbol('skip children');
4374
4327
  const REMOVE$1 = Symbol('remove node');
4375
4328
  /**
@@ -4597,9 +4550,7 @@ function replaceNode(key, path, node) {
4597
4550
  const pt = isAlias(parent) ? 'alias' : 'scalar';
4598
4551
  throw new Error(`Cannot replace node with ${pt} parent`);
4599
4552
  }
4600
- }
4601
-
4602
- const escapeChars = {
4553
+ }const escapeChars = {
4603
4554
  '!': '%21',
4604
4555
  ',': '%2C',
4605
4556
  '[': '%5B',
@@ -4769,9 +4720,7 @@ class Directives {
4769
4720
  }
4770
4721
  }
4771
4722
  Directives.defaultYaml = { explicit: false, version: '1.2' };
4772
- Directives.defaultTags = { '!!': 'tag:yaml.org,2002:' };
4773
-
4774
- /**
4723
+ Directives.defaultTags = { '!!': 'tag:yaml.org,2002:' };/**
4775
4724
  * Verify that the input string is a valid anchor.
4776
4725
  *
4777
4726
  * Will throw on errors.
@@ -4836,9 +4785,7 @@ function createNodeAnchors(doc, prefix) {
4836
4785
  },
4837
4786
  sourceObjects
4838
4787
  };
4839
- }
4840
-
4841
- /**
4788
+ }/**
4842
4789
  * Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,
4843
4790
  * in section 24.5.1.1 "Runtime Semantics: InternalizeJSONProperty" of the
4844
4791
  * 2021 edition: https://tc39.es/ecma262/#sec-json.parse
@@ -4890,9 +4837,7 @@ function applyReviver(reviver, obj, key, val) {
4890
4837
  }
4891
4838
  }
4892
4839
  return reviver.call(obj, key, val);
4893
- }
4894
-
4895
- /**
4840
+ }/**
4896
4841
  * Recursively convert any node or its contents to native JavaScript
4897
4842
  *
4898
4843
  * @param value - The input value
@@ -4924,9 +4869,7 @@ function toJS(value, arg, ctx) {
4924
4869
  if (typeof value === 'bigint' && !ctx?.keep)
4925
4870
  return Number(value);
4926
4871
  return value;
4927
- }
4928
-
4929
- class NodeBase {
4872
+ }class NodeBase {
4930
4873
  constructor(type) {
4931
4874
  Object.defineProperty(this, NODE_TYPE, { value: type });
4932
4875
  }
@@ -4957,9 +4900,7 @@ class NodeBase {
4957
4900
  ? applyReviver(reviver, { '': res }, '', res)
4958
4901
  : res;
4959
4902
  }
4960
- }
4961
-
4962
- class Alias extends NodeBase {
4903
+ }class Alias extends NodeBase {
4963
4904
  constructor(source) {
4964
4905
  super(ALIAS);
4965
4906
  this.source = source;
@@ -5014,7 +4955,7 @@ class Alias extends NodeBase {
5014
4955
  data = anchors.get(source);
5015
4956
  }
5016
4957
  /* istanbul ignore if */
5017
- if (!data || data.res === undefined) {
4958
+ if (data?.res === undefined) {
5018
4959
  const msg = 'This should not happen: Alias anchor was not resolved?';
5019
4960
  throw new ReferenceError(msg);
5020
4961
  }
@@ -5064,9 +5005,7 @@ function getAliasCount(doc, node, anchors) {
5064
5005
  return Math.max(kc, vc);
5065
5006
  }
5066
5007
  return 1;
5067
- }
5068
-
5069
- const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
5008
+ }const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
5070
5009
  class Scalar extends NodeBase {
5071
5010
  constructor(value) {
5072
5011
  super(SCALAR$1);
@@ -5083,9 +5022,7 @@ Scalar.BLOCK_FOLDED = 'BLOCK_FOLDED';
5083
5022
  Scalar.BLOCK_LITERAL = 'BLOCK_LITERAL';
5084
5023
  Scalar.PLAIN = 'PLAIN';
5085
5024
  Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
5086
- Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';
5087
-
5088
- const defaultTagPrefix = 'tag:yaml.org,2002:';
5025
+ Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';const defaultTagPrefix = 'tag:yaml.org,2002:';
5089
5026
  function findTagObject(value, tagName, tags) {
5090
5027
  if (tagName) {
5091
5028
  const match = tags.filter(t => t.tag === tagName);
@@ -5166,9 +5103,7 @@ function createNode(value, tagName, ctx) {
5166
5103
  if (ref)
5167
5104
  ref.node = node;
5168
5105
  return node;
5169
- }
5170
-
5171
- function collectionFromPath(schema, path, value) {
5106
+ }function collectionFromPath(schema, path, value) {
5172
5107
  let v = value;
5173
5108
  for (let i = path.length - 1; i >= 0; --i) {
5174
5109
  const k = path[i];
@@ -5308,9 +5243,7 @@ class Collection extends NodeBase {
5308
5243
  throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
5309
5244
  }
5310
5245
  }
5311
- }
5312
-
5313
- /**
5246
+ }/**
5314
5247
  * Stringifies a comment.
5315
5248
  *
5316
5249
  * Empty comment lines are left empty,
@@ -5327,9 +5260,7 @@ const lineComment = (str, indent, comment) => str.endsWith('\n')
5327
5260
  ? indentComment(comment, indent)
5328
5261
  : comment.includes('\n')
5329
5262
  ? '\n' + indentComment(comment, indent)
5330
- : (str.endsWith(' ') ? '' : ' ') + comment;
5331
-
5332
- const FOLD_FLOW = 'flow';
5263
+ : (str.endsWith(' ') ? '' : ' ') + comment;const FOLD_FLOW = 'flow';
5333
5264
  const FOLD_BLOCK = 'block';
5334
5265
  const FOLD_QUOTED = 'quoted';
5335
5266
  /**
@@ -5472,9 +5403,7 @@ function consumeMoreIndentedLines(text, i, indent) {
5472
5403
  }
5473
5404
  }
5474
5405
  return end;
5475
- }
5476
-
5477
- const getFoldOptions = (ctx, isBlock) => ({
5406
+ }const getFoldOptions = (ctx, isBlock) => ({
5478
5407
  indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
5479
5408
  lineWidth: ctx.options.lineWidth,
5480
5409
  minContentWidth: ctx.options.minContentWidth
@@ -5804,9 +5733,7 @@ function stringifyString(item, ctx, onComment, onChompKeep) {
5804
5733
  throw new Error(`Unsupported default string type ${t}`);
5805
5734
  }
5806
5735
  return res;
5807
- }
5808
-
5809
- function createStringifyContext(doc, options) {
5736
+ }function createStringifyContext(doc, options) {
5810
5737
  const opt = Object.assign({
5811
5738
  blockQuote: true,
5812
5739
  commentString: stringifyComment,
@@ -5926,9 +5853,7 @@ function stringify$2(item, ctx, onComment, onChompKeep) {
5926
5853
  return isScalar$1(node) || str[0] === '{' || str[0] === '['
5927
5854
  ? `${props} ${str}`
5928
5855
  : `${props}\n${ctx.indent}${str}`;
5929
- }
5930
-
5931
- function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
5856
+ }function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
5932
5857
  const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
5933
5858
  let keyComment = (isNode(key) && key.comment) || null;
5934
5859
  if (simpleKeys) {
@@ -6026,7 +5951,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
6026
5951
  ws += `\n${indentComment(cs, ctx.indent)}`;
6027
5952
  }
6028
5953
  if (valueStr === '' && !ctx.inFlow) {
6029
- if (ws === '\n')
5954
+ if (ws === '\n' && valueComment)
6030
5955
  ws = '\n\n';
6031
5956
  }
6032
5957
  else {
@@ -6070,15 +5995,11 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
6070
5995
  onChompKeep();
6071
5996
  }
6072
5997
  return str;
6073
- }
6074
-
6075
- function warn(logLevel, warning) {
5998
+ }function warn(logLevel, warning) {
6076
5999
  if (logLevel === 'debug' || logLevel === 'warn') {
6077
6000
  console.warn(warning);
6078
6001
  }
6079
- }
6080
-
6081
- // If the value associated with a merge key is a single mapping node, each of
6002
+ }// If the value associated with a merge key is a single mapping node, each of
6082
6003
  // its key/value pairs is inserted into the current mapping, unless the key
6083
6004
  // already exists in it. If the value associated with the merge key is a
6084
6005
  // sequence, then this sequence is expected to contain mapping nodes and each
@@ -6136,9 +6057,7 @@ function mergeValue(ctx, map, value) {
6136
6057
  }
6137
6058
  }
6138
6059
  return map;
6139
- }
6140
-
6141
- function addPairToJSMap(ctx, map, { key, value }) {
6060
+ }function addPairToJSMap(ctx, map, { key, value }) {
6142
6061
  if (isNode(key) && key.addToJSMap)
6143
6062
  key.addToJSMap(ctx, map, value);
6144
6063
  // TODO: Should drop this special case for bare << handling
@@ -6192,9 +6111,7 @@ function stringifyKey(key, jsKey, ctx) {
6192
6111
  return strKey;
6193
6112
  }
6194
6113
  return JSON.stringify(jsKey);
6195
- }
6196
-
6197
- function createPair(key, value, ctx) {
6114
+ }function createPair(key, value, ctx) {
6198
6115
  const k = createNode(key, undefined, ctx);
6199
6116
  const v = createNode(value, undefined, ctx);
6200
6117
  return new Pair(k, v);
@@ -6222,9 +6139,7 @@ class Pair {
6222
6139
  ? stringifyPair(this, ctx, onComment, onChompKeep)
6223
6140
  : JSON.stringify(this);
6224
6141
  }
6225
- }
6226
-
6227
- function stringifyCollection(collection, ctx, options) {
6142
+ }function stringifyCollection(collection, ctx, options) {
6228
6143
  const flow = ctx.inFlow ?? collection.flow;
6229
6144
  const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;
6230
6145
  return stringify(collection, ctx, options);
@@ -6360,9 +6275,7 @@ function addCommentBefore({ indent, options: { commentString } }, lines, comment
6360
6275
  const ic = indentComment(commentString(comment), indent);
6361
6276
  lines.push(ic.trimStart()); // Avoid double indent on first line
6362
6277
  }
6363
- }
6364
-
6365
- function findPair(items, key) {
6278
+ }function findPair(items, key) {
6366
6279
  const k = isScalar$1(key) ? key.value : key;
6367
6280
  for (const it of items) {
6368
6281
  if (isPair(it)) {
@@ -6496,9 +6409,7 @@ class YAMLMap extends Collection {
6496
6409
  onComment
6497
6410
  });
6498
6411
  }
6499
- }
6500
-
6501
- const map = {
6412
+ }const map = {
6502
6413
  collection: 'map',
6503
6414
  default: true,
6504
6415
  nodeClass: YAMLMap,
@@ -6509,9 +6420,7 @@ const map = {
6509
6420
  return map;
6510
6421
  },
6511
6422
  createNode: (schema, obj, ctx) => YAMLMap.from(schema, obj, ctx)
6512
- };
6513
-
6514
- class YAMLSeq extends Collection {
6423
+ };class YAMLSeq extends Collection {
6515
6424
  static get tagName() {
6516
6425
  return 'tag:yaml.org,2002:seq';
6517
6426
  }
@@ -6614,9 +6523,7 @@ function asItemIndex(key) {
6614
6523
  return typeof idx === 'number' && Number.isInteger(idx) && idx >= 0
6615
6524
  ? idx
6616
6525
  : null;
6617
- }
6618
-
6619
- const seq = {
6526
+ }const seq = {
6620
6527
  collection: 'seq',
6621
6528
  default: true,
6622
6529
  nodeClass: YAMLSeq,
@@ -6627,9 +6534,7 @@ const seq = {
6627
6534
  return seq;
6628
6535
  },
6629
6536
  createNode: (schema, obj, ctx) => YAMLSeq.from(schema, obj, ctx)
6630
- };
6631
-
6632
- const string = {
6537
+ };const string = {
6633
6538
  identify: value => typeof value === 'string',
6634
6539
  default: true,
6635
6540
  tag: 'tag:yaml.org,2002:str',
@@ -6638,9 +6543,7 @@ const string = {
6638
6543
  ctx = Object.assign({ actualString: true }, ctx);
6639
6544
  return stringifyString(item, ctx, onComment, onChompKeep);
6640
6545
  }
6641
- };
6642
-
6643
- const nullTag = {
6546
+ };const nullTag = {
6644
6547
  identify: value => value == null,
6645
6548
  createNode: () => new Scalar(null),
6646
6549
  default: true,
@@ -6650,9 +6553,7 @@ const nullTag = {
6650
6553
  stringify: ({ source }, ctx) => typeof source === 'string' && nullTag.test.test(source)
6651
6554
  ? source
6652
6555
  : ctx.options.nullStr
6653
- };
6654
-
6655
- const boolTag = {
6556
+ };const boolTag = {
6656
6557
  identify: value => typeof value === 'boolean',
6657
6558
  default: true,
6658
6559
  tag: 'tag:yaml.org,2002:bool',
@@ -6666,15 +6567,13 @@ const boolTag = {
6666
6567
  }
6667
6568
  return value ? ctx.options.trueStr : ctx.options.falseStr;
6668
6569
  }
6669
- };
6670
-
6671
- function stringifyNumber({ format, minFractionDigits, tag, value }) {
6570
+ };function stringifyNumber({ format, minFractionDigits, tag, value }) {
6672
6571
  if (typeof value === 'bigint')
6673
6572
  return String(value);
6674
6573
  const num = typeof value === 'number' ? value : Number(value);
6675
6574
  if (!isFinite(num))
6676
6575
  return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';
6677
- let n = JSON.stringify(value);
6576
+ let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);
6678
6577
  if (!format &&
6679
6578
  minFractionDigits &&
6680
6579
  (!tag || tag === 'tag:yaml.org,2002:float') &&
@@ -6689,9 +6588,7 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
6689
6588
  n += '0';
6690
6589
  }
6691
6590
  return n;
6692
- }
6693
-
6694
- const floatNaN$1 = {
6591
+ }const floatNaN$1 = {
6695
6592
  identify: value => typeof value === 'number',
6696
6593
  default: true,
6697
6594
  tag: 'tag:yaml.org,2002:float',
@@ -6728,9 +6625,7 @@ const float$1 = {
6728
6625
  return node;
6729
6626
  },
6730
6627
  stringify: stringifyNumber
6731
- };
6732
-
6733
- const intIdentify$2 = (value) => typeof value === 'bigint' || Number.isInteger(value);
6628
+ };const intIdentify$2 = (value) => typeof value === 'bigint' || Number.isInteger(value);
6734
6629
  const intResolve$1 = (str, offset, radix, { intAsBigInt }) => (intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix));
6735
6630
  function intStringify$1(node, radix, prefix) {
6736
6631
  const { value } = node;
@@ -6763,9 +6658,7 @@ const intHex$1 = {
6763
6658
  test: /^0x[0-9a-fA-F]+$/,
6764
6659
  resolve: (str, _onError, opt) => intResolve$1(str, 2, 16, opt),
6765
6660
  stringify: node => intStringify$1(node, 16, '0x')
6766
- };
6767
-
6768
- const schema$2 = [
6661
+ };const schema$2 = [
6769
6662
  map,
6770
6663
  seq,
6771
6664
  string,
@@ -6777,9 +6670,7 @@ const schema$2 = [
6777
6670
  floatNaN$1,
6778
6671
  floatExp$1,
6779
6672
  float$1
6780
- ];
6781
-
6782
- function intIdentify$1(value) {
6673
+ ];function intIdentify$1(value) {
6783
6674
  return typeof value === 'bigint' || Number.isInteger(value);
6784
6675
  }
6785
6676
  const stringifyJSON = ({ value }) => JSON.stringify(value);
@@ -6834,9 +6725,7 @@ const jsonError = {
6834
6725
  return str;
6835
6726
  }
6836
6727
  };
6837
- const schema$1 = [map, seq].concat(jsonScalars, jsonError);
6838
-
6839
- const binary = {
6728
+ const schema$1 = [map, seq].concat(jsonScalars, jsonError);const binary = {
6840
6729
  identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array
6841
6730
  default: false,
6842
6731
  tag: 'tag:yaml.org,2002:binary',
@@ -6888,9 +6777,7 @@ const binary = {
6888
6777
  }
6889
6778
  return stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
6890
6779
  }
6891
- };
6892
-
6893
- function resolvePairs(seq, onError) {
6780
+ };function resolvePairs(seq, onError) {
6894
6781
  if (isSeq(seq)) {
6895
6782
  for (let i = 0; i < seq.items.length; ++i) {
6896
6783
  let item = seq.items[i];
@@ -6960,9 +6847,7 @@ const pairs = {
6960
6847
  tag: 'tag:yaml.org,2002:pairs',
6961
6848
  resolve: resolvePairs,
6962
6849
  createNode: createPairs
6963
- };
6964
-
6965
- class YAMLOMap extends YAMLSeq {
6850
+ };class YAMLOMap extends YAMLSeq {
6966
6851
  constructor() {
6967
6852
  super();
6968
6853
  this.add = YAMLMap.prototype.add.bind(this);
@@ -7027,9 +6912,7 @@ const omap = {
7027
6912
  return Object.assign(new YAMLOMap(), pairs);
7028
6913
  },
7029
6914
  createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)
7030
- };
7031
-
7032
- function boolStringify({ value, source }, ctx) {
6915
+ };function boolStringify({ value, source }, ctx) {
7033
6916
  const boolObj = value ? trueTag : falseTag;
7034
6917
  if (source && boolObj.test.test(source))
7035
6918
  return source;
@@ -7050,9 +6933,7 @@ const falseTag = {
7050
6933
  test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
7051
6934
  resolve: () => new Scalar(false),
7052
6935
  stringify: boolStringify
7053
- };
7054
-
7055
- const floatNaN = {
6936
+ };const floatNaN = {
7056
6937
  identify: value => typeof value === 'number',
7057
6938
  default: true,
7058
6939
  tag: 'tag:yaml.org,2002:float',
@@ -7092,9 +6973,7 @@ const float = {
7092
6973
  return node;
7093
6974
  },
7094
6975
  stringify: stringifyNumber
7095
- };
7096
-
7097
- const intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);
6976
+ };const intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);
7098
6977
  function intResolve(str, offset, radix, { intAsBigInt }) {
7099
6978
  const sign = str[0];
7100
6979
  if (sign === '-' || sign === '+')
@@ -7160,9 +7039,7 @@ const intHex = {
7160
7039
  test: /^[-+]?0x[0-9a-fA-F_]+$/,
7161
7040
  resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
7162
7041
  stringify: node => intStringify(node, 16, '0x')
7163
- };
7164
-
7165
- class YAMLSet extends YAMLMap {
7042
+ };class YAMLSet extends YAMLMap {
7166
7043
  constructor(schema) {
7167
7044
  super(schema);
7168
7045
  this.tag = YAMLSet.tag;
@@ -7248,9 +7125,7 @@ const set = {
7248
7125
  onError('Expected a mapping for this tag');
7249
7126
  return map;
7250
7127
  }
7251
- };
7252
-
7253
- /** Internal types handle bigint as number, because TS can't figure it out. */
7128
+ };/** Internal types handle bigint as number, because TS can't figure it out. */
7254
7129
  function parseSexagesimal(str, asBigInt) {
7255
7130
  const sign = str[0];
7256
7131
  const parts = sign === '-' || sign === '+' ? str.substring(1) : str;
@@ -7346,9 +7221,7 @@ const timestamp = {
7346
7221
  return new Date(date);
7347
7222
  },
7348
7223
  stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
7349
- };
7350
-
7351
- const schema = [
7224
+ };const schema = [
7352
7225
  map,
7353
7226
  seq,
7354
7227
  string,
@@ -7370,9 +7243,7 @@ const schema = [
7370
7243
  intTime,
7371
7244
  floatTime,
7372
7245
  timestamp
7373
- ];
7374
-
7375
- const schemas = new Map([
7246
+ ];const schemas = new Map([
7376
7247
  ['core', schema$2],
7377
7248
  ['failsafe', [map, seq, string]],
7378
7249
  ['json', schema$1],
@@ -7448,9 +7319,7 @@ function getTags(customTags, schemaName, addMergeTag) {
7448
7319
  tags.push(tagObj);
7449
7320
  return tags;
7450
7321
  }, []);
7451
- }
7452
-
7453
- const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
7322
+ }const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
7454
7323
  class Schema {
7455
7324
  constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
7456
7325
  this.compat = Array.isArray(compat)
@@ -7478,9 +7347,7 @@ class Schema {
7478
7347
  copy.tags = this.tags.slice();
7479
7348
  return copy;
7480
7349
  }
7481
- }
7482
-
7483
- function stringifyDocument(doc, options) {
7350
+ }function stringifyDocument(doc, options) {
7484
7351
  const lines = [];
7485
7352
  let hasDirectives = options.directives === true;
7486
7353
  if (options.directives !== false && doc.directives) {
@@ -7558,9 +7425,7 @@ function stringifyDocument(doc, options) {
7558
7425
  }
7559
7426
  }
7560
7427
  return lines.join('\n') + '\n';
7561
- }
7562
-
7563
- class Document {
7428
+ }class Document {
7564
7429
  constructor(value, replacer, options) {
7565
7430
  /** A comment before this Document */
7566
7431
  this.commentBefore = null;
@@ -7880,9 +7745,7 @@ function assertCollection(contents) {
7880
7745
  if (isCollection$1(contents))
7881
7746
  return true;
7882
7747
  throw new Error('Expected a YAML collection as document contents');
7883
- }
7884
-
7885
- class YAMLError extends Error {
7748
+ }class YAMLError extends Error {
7886
7749
  constructor(name, pos, code, message) {
7887
7750
  super();
7888
7751
  this.name = name;
@@ -7930,15 +7793,13 @@ const prettifyError = (src, lc) => (error) => {
7930
7793
  if (/[^ ]/.test(lineStr)) {
7931
7794
  let count = 1;
7932
7795
  const end = error.linePos[1];
7933
- if (end && end.line === line && end.col > col) {
7796
+ if (end?.line === line && end.col > col) {
7934
7797
  count = Math.max(1, Math.min(end.col - col, 80 - ci));
7935
7798
  }
7936
7799
  const pointer = ' '.repeat(ci) + '^'.repeat(count);
7937
7800
  error.message += `:\n\n${lineStr}\n${pointer}\n`;
7938
7801
  }
7939
- };
7940
-
7941
- function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
7802
+ };function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
7942
7803
  let spaceBefore = false;
7943
7804
  let atNewline = startOnNewline;
7944
7805
  let hasSpace = startOnNewline;
@@ -8081,9 +7942,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
8081
7942
  end,
8082
7943
  start: start ?? end
8083
7944
  };
8084
- }
8085
-
8086
- function containsNewline(key) {
7945
+ }function containsNewline(key) {
8087
7946
  if (!key)
8088
7947
  return null;
8089
7948
  switch (key.type) {
@@ -8114,9 +7973,7 @@ function containsNewline(key) {
8114
7973
  default:
8115
7974
  return true;
8116
7975
  }
8117
- }
8118
-
8119
- function flowIndentCheck(indent, fc, onError) {
7976
+ }function flowIndentCheck(indent, fc, onError) {
8120
7977
  if (fc?.type === 'flow-collection') {
8121
7978
  const end = fc.end[0];
8122
7979
  if (end.indent === indent &&
@@ -8126,9 +7983,7 @@ function flowIndentCheck(indent, fc, onError) {
8126
7983
  onError(end, 'BAD_INDENT', msg, true);
8127
7984
  }
8128
7985
  }
8129
- }
8130
-
8131
- function mapIncludes(ctx, items, search) {
7986
+ }function mapIncludes(ctx, items, search) {
8132
7987
  const { uniqueKeys } = ctx.options;
8133
7988
  if (uniqueKeys === false)
8134
7989
  return false;
@@ -8136,9 +7991,7 @@ function mapIncludes(ctx, items, search) {
8136
7991
  ? uniqueKeys
8137
7992
  : (a, b) => a === b || (isScalar$1(a) && isScalar$1(b) && a.value === b.value);
8138
7993
  return items.some(pair => isEqual(pair.key, search));
8139
- }
8140
-
8141
- const startColMsg = 'All mapping items must start at the same column';
7994
+ }const startColMsg = 'All mapping items must start at the same column';
8142
7995
  function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
8143
7996
  const NodeClass = tag?.nodeClass ?? YAMLMap;
8144
7997
  const map = new NodeClass(ctx.schema);
@@ -8243,9 +8096,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
8243
8096
  onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');
8244
8097
  map.range = [bm.offset, offset, commentEnd ?? offset];
8245
8098
  return map;
8246
- }
8247
-
8248
- function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {
8099
+ }function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {
8249
8100
  const NodeClass = tag?.nodeClass ?? YAMLSeq;
8250
8101
  const seq = new NodeClass(ctx.schema);
8251
8102
  if (ctx.atRoot)
@@ -8265,7 +8116,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
8265
8116
  });
8266
8117
  if (!props.found) {
8267
8118
  if (props.anchor || props.tag || value) {
8268
- if (value && value.type === 'block-seq')
8119
+ if (value?.type === 'block-seq')
8269
8120
  onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
8270
8121
  else
8271
8122
  onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');
@@ -8287,9 +8138,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
8287
8138
  }
8288
8139
  seq.range = [bs.offset, offset, commentEnd ?? offset];
8289
8140
  return seq;
8290
- }
8291
-
8292
- function resolveEnd(end, offset, reqSpace, onError) {
8141
+ }function resolveEnd(end, offset, reqSpace, onError) {
8293
8142
  let comment = '';
8294
8143
  if (end) {
8295
8144
  let hasSpace = false;
@@ -8323,9 +8172,7 @@ function resolveEnd(end, offset, reqSpace, onError) {
8323
8172
  }
8324
8173
  }
8325
8174
  return { comment, offset };
8326
- }
8327
-
8328
- const blockMsg = 'Block collections are not allowed within flow collections';
8175
+ }const blockMsg = 'Block collections are not allowed within flow collections';
8329
8176
  const isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');
8330
8177
  function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
8331
8178
  const isMap = fc.start.source === '{';
@@ -8451,7 +8298,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
8451
8298
  }
8452
8299
  }
8453
8300
  else if (value) {
8454
- if ('source' in value && value.source && value.source[0] === ':')
8301
+ if ('source' in value && value.source?.[0] === ':')
8455
8302
  onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);
8456
8303
  else
8457
8304
  onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);
@@ -8495,7 +8342,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
8495
8342
  const expectedEnd = isMap ? '}' : ']';
8496
8343
  const [ce, ...ee] = fc.end;
8497
8344
  let cePos = offset;
8498
- if (ce && ce.source === expectedEnd)
8345
+ if (ce?.source === expectedEnd)
8499
8346
  cePos = ce.offset + ce.source.length;
8500
8347
  else {
8501
8348
  const name = fcName[0].toUpperCase() + fcName.substring(1);
@@ -8520,9 +8367,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
8520
8367
  coll.range = [fc.offset, cePos, cePos];
8521
8368
  }
8522
8369
  return coll;
8523
- }
8524
-
8525
- function resolveCollection(CN, ctx, token, onError, tagName, tag) {
8370
+ }function resolveCollection(CN, ctx, token, onError, tagName, tag) {
8526
8371
  const coll = token.type === 'block-map'
8527
8372
  ? resolveBlockMap(CN, ctx, token, onError, tag)
8528
8373
  : token.type === 'block-seq'
@@ -8575,7 +8420,7 @@ function composeCollection(CN, ctx, token, props, onError) {
8575
8420
  let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
8576
8421
  if (!tag) {
8577
8422
  const kt = ctx.schema.knownTags[tagName];
8578
- if (kt && kt.collection === expType) {
8423
+ if (kt?.collection === expType) {
8579
8424
  ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
8580
8425
  tag = kt;
8581
8426
  }
@@ -8599,9 +8444,7 @@ function composeCollection(CN, ctx, token, props, onError) {
8599
8444
  if (tag?.format)
8600
8445
  node.format = tag.format;
8601
8446
  return node;
8602
- }
8603
-
8604
- function resolveBlockScalar(ctx, scalar, onError) {
8447
+ }function resolveBlockScalar(ctx, scalar, onError) {
8605
8448
  const start = scalar.offset;
8606
8449
  const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
8607
8450
  if (!header)
@@ -8794,9 +8637,7 @@ function splitLines(source) {
8794
8637
  for (let i = 1; i < split.length; i += 2)
8795
8638
  lines.push([split[i], split[i + 1]]);
8796
8639
  return lines;
8797
- }
8798
-
8799
- function resolveFlowScalar(scalar, strict, onError) {
8640
+ }function resolveFlowScalar(scalar, strict, onError) {
8800
8641
  const { offset, type, source, end } = scalar;
8801
8642
  let _type;
8802
8643
  let value;
@@ -9013,9 +8854,7 @@ function parseCharCode(source, offset, length, onError) {
9013
8854
  return raw;
9014
8855
  }
9015
8856
  return String.fromCodePoint(code);
9016
- }
9017
-
9018
- function composeScalar(ctx, token, tagToken, onError) {
8857
+ }function composeScalar(ctx, token, tagToken, onError) {
9019
8858
  const { value, type, comment, range } = token.type === 'block-scalar'
9020
8859
  ? resolveBlockScalar(ctx, token, onError)
9021
8860
  : resolveFlowScalar(token, ctx.options.strict, onError);
@@ -9093,9 +8932,7 @@ function findScalarTagByTest({ atKey, directives, schema }, value, token, onErro
9093
8932
  }
9094
8933
  }
9095
8934
  return tag;
9096
- }
9097
-
9098
- function emptyScalarPosition(offset, before, pos) {
8935
+ }function emptyScalarPosition(offset, before, pos) {
9099
8936
  if (before) {
9100
8937
  pos ?? (pos = before.length);
9101
8938
  for (let i = pos - 1; i >= 0; --i) {
@@ -9118,9 +8955,7 @@ function emptyScalarPosition(offset, before, pos) {
9118
8955
  }
9119
8956
  }
9120
8957
  return offset;
9121
- }
9122
-
9123
- const CN = { composeNode, composeEmptyNode };
8958
+ }const CN = { composeNode, composeEmptyNode };
9124
8959
  function composeNode(ctx, token, props, onError) {
9125
8960
  const atKey = ctx.atKey;
9126
8961
  const { spaceBefore, comment, anchor, tag } = props;
@@ -9212,9 +9047,7 @@ function composeAlias({ options }, { offset, source, end }, onError) {
9212
9047
  if (re.comment)
9213
9048
  alias.comment = re.comment;
9214
9049
  return alias;
9215
- }
9216
-
9217
- function composeDoc(options, directives, { offset, start, value, end }, onError) {
9050
+ }function composeDoc(options, directives, { offset, start, value, end }, onError) {
9218
9051
  const opts = Object.assign({ _directives: directives }, options);
9219
9052
  const doc = new Document(undefined, opts);
9220
9053
  const ctx = {
@@ -9249,9 +9082,7 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
9249
9082
  doc.comment = re.comment;
9250
9083
  doc.range = [offset, contentEnd, re.offset];
9251
9084
  return doc;
9252
- }
9253
-
9254
- function getErrorPos(src) {
9085
+ }function getErrorPos(src) {
9255
9086
  if (typeof src === 'number')
9256
9087
  return [src, src + 1];
9257
9088
  if (Array.isArray(src))
@@ -9458,9 +9289,7 @@ class Composer {
9458
9289
  yield doc;
9459
9290
  }
9460
9291
  }
9461
- }
9462
-
9463
- function resolveAsScalar(token, strict = true, onError) {
9292
+ }function resolveAsScalar(token, strict = true, onError) {
9464
9293
  if (token) {
9465
9294
  const _onError = (pos, code, message) => {
9466
9295
  const offset = typeof pos === 'number' ? pos : Array.isArray(pos) ? pos[0] : pos.offset;
@@ -9666,9 +9495,7 @@ function setFlowScalarValue(token, source, type) {
9666
9495
  Object.assign(token, { type, indent, source, end });
9667
9496
  }
9668
9497
  }
9669
- }
9670
-
9671
- /**
9498
+ }/**
9672
9499
  * Stringify a CST document, token, or collection item
9673
9500
  *
9674
9501
  * Fair warning: This applies no validation whatsoever, and
@@ -9726,9 +9553,7 @@ function stringifyItem({ start, key, sep, value }) {
9726
9553
  if (value)
9727
9554
  res += stringifyToken(value);
9728
9555
  return res;
9729
- }
9730
-
9731
- const BREAK = Symbol('break visit');
9556
+ }const BREAK = Symbol('break visit');
9732
9557
  const SKIP = Symbol('skip children');
9733
9558
  const REMOVE = Symbol('remove item');
9734
9559
  /**
@@ -9822,9 +9647,7 @@ function _visit(path, item, visitor) {
9822
9647
  }
9823
9648
  }
9824
9649
  return typeof ctrl === 'function' ? ctrl(item, path) : ctrl;
9825
- }
9826
-
9827
- /** The byte order mark */
9650
+ }/** The byte order mark */
9828
9651
  const BOM = '\u{FEFF}';
9829
9652
  /** Start of doc-mode */
9830
9653
  const DOCUMENT = '\x02'; // C0: Start of Text
@@ -9915,26 +9738,7 @@ function tokenType(source) {
9915
9738
  return 'block-scalar-header';
9916
9739
  }
9917
9740
  return null;
9918
- }
9919
-
9920
- var cst = /*#__PURE__*/Object.freeze({
9921
- __proto__: null,
9922
- BOM: BOM,
9923
- DOCUMENT: DOCUMENT,
9924
- FLOW_END: FLOW_END,
9925
- SCALAR: SCALAR,
9926
- createScalarToken: createScalarToken,
9927
- isCollection: isCollection,
9928
- isScalar: isScalar,
9929
- prettyToken: prettyToken,
9930
- resolveAsScalar: resolveAsScalar,
9931
- setScalarValue: setScalarValue,
9932
- stringify: stringify$1,
9933
- tokenType: tokenType,
9934
- visit: visit
9935
- });
9936
-
9937
- /*
9741
+ }var cst=/*#__PURE__*/Object.freeze({__proto__:null,BOM:BOM,DOCUMENT:DOCUMENT,FLOW_END:FLOW_END,SCALAR:SCALAR,createScalarToken:createScalarToken,isCollection:isCollection,isScalar:isScalar,prettyToken:prettyToken,resolveAsScalar:resolveAsScalar,setScalarValue:setScalarValue,stringify:stringify$1,tokenType:tokenType,visit:visit});/*
9938
9742
  START -> stream
9939
9743
 
9940
9744
  stream
@@ -10646,9 +10450,7 @@ class Lexer {
10646
10450
  ch = this.buffer[++i];
10647
10451
  return yield* this.pushToIndex(i, false);
10648
10452
  }
10649
- }
10650
-
10651
- /**
10453
+ }/**
10652
10454
  * Tracks newlines during parsing in order to provide an efficient API for
10653
10455
  * determining the one-indexed `{ line, col }` position for any offset
10654
10456
  * within the input.
@@ -10684,9 +10486,7 @@ class LineCounter {
10684
10486
  return { line: low, col: offset - start + 1 };
10685
10487
  };
10686
10488
  }
10687
- }
10688
-
10689
- function includesToken(list, type) {
10489
+ }function includesToken(list, type) {
10690
10490
  for (let i = 0; i < list.length; ++i)
10691
10491
  if (list[i].type === type)
10692
10492
  return true;
@@ -10911,7 +10711,7 @@ class Parser {
10911
10711
  }
10912
10712
  *step() {
10913
10713
  const top = this.peek(1);
10914
- if (this.type === 'doc-end' && (!top || top.type !== 'doc-end')) {
10714
+ if (this.type === 'doc-end' && top?.type !== 'doc-end') {
10915
10715
  while (this.stack.length > 0)
10916
10716
  yield* this.pop();
10917
10717
  this.stack.push({
@@ -11443,7 +11243,7 @@ class Parser {
11443
11243
  do {
11444
11244
  yield* this.pop();
11445
11245
  top = this.peek(1);
11446
- } while (top && top.type === 'flow-collection');
11246
+ } while (top?.type === 'flow-collection');
11447
11247
  }
11448
11248
  else if (fc.end.length === 0) {
11449
11249
  switch (this.type) {
@@ -11647,9 +11447,7 @@ class Parser {
11647
11447
  yield* this.pop();
11648
11448
  }
11649
11449
  }
11650
- }
11651
-
11652
- function parseOptions(options) {
11450
+ }function parseOptions(options) {
11653
11451
  const prettyErrors = options.prettyErrors !== false;
11654
11452
  const lineCounter = options.lineCounter || (prettyErrors && new LineCounter()) || null;
11655
11453
  return { lineCounter, prettyErrors };
@@ -11740,92 +11538,15 @@ function stringify(value, replacer, options) {
11740
11538
  if (isDocument(value) && !_replacer)
11741
11539
  return value.toString(options);
11742
11540
  return new Document(value, _replacer, options).toString(options);
11743
- }
11744
-
11745
- var YAML = /*#__PURE__*/Object.freeze({
11746
- __proto__: null,
11747
- Alias: Alias,
11748
- CST: cst,
11749
- Composer: Composer,
11750
- Document: Document,
11751
- Lexer: Lexer,
11752
- LineCounter: LineCounter,
11753
- Pair: Pair,
11754
- Parser: Parser,
11755
- Scalar: Scalar,
11756
- Schema: Schema,
11757
- YAMLError: YAMLError,
11758
- YAMLMap: YAMLMap,
11759
- YAMLParseError: YAMLParseError,
11760
- YAMLSeq: YAMLSeq,
11761
- YAMLWarning: YAMLWarning,
11762
- isAlias: isAlias,
11763
- isCollection: isCollection$1,
11764
- isDocument: isDocument,
11765
- isMap: isMap,
11766
- isNode: isNode,
11767
- isPair: isPair,
11768
- isScalar: isScalar$1,
11769
- isSeq: isSeq,
11770
- parse: parse,
11771
- parseAllDocuments: parseAllDocuments,
11772
- parseDocument: parseDocument,
11773
- stringify: stringify,
11774
- visit: visit$1,
11775
- visitAsync: visitAsync
11776
- });
11777
-
11778
- // `export * as default from ...` fails on Webpack v4
11541
+ }var YAML=/*#__PURE__*/Object.freeze({__proto__:null,Alias:Alias,CST:cst,Composer:Composer,Document:Document,Lexer:Lexer,LineCounter:LineCounter,Pair:Pair,Parser:Parser,Scalar:Scalar,Schema:Schema,YAMLError:YAMLError,YAMLMap:YAMLMap,YAMLParseError:YAMLParseError,YAMLSeq:YAMLSeq,YAMLWarning:YAMLWarning,isAlias:isAlias,isCollection:isCollection$1,isDocument:isDocument,isMap:isMap,isNode:isNode,isPair:isPair,isScalar:isScalar$1,isSeq:isSeq,parse:parse,parseAllDocuments:parseAllDocuments,parseDocument:parseDocument,stringify:stringify,visit:visit$1,visitAsync:visitAsync});// `export * as default from ...` fails on Webpack v4
11779
11542
  // https://github.com/eemeli/yaml/issues/228
11543
+ var browser=/*#__PURE__*/Object.freeze({__proto__:null,Alias:Alias,CST:cst,Composer:Composer,Document:Document,Lexer:Lexer,LineCounter:LineCounter,Pair:Pair,Parser:Parser,Scalar:Scalar,Schema:Schema,YAMLError:YAMLError,YAMLMap:YAMLMap,YAMLParseError:YAMLParseError,YAMLSeq:YAMLSeq,YAMLWarning:YAMLWarning,default:YAML,isAlias:isAlias,isCollection:isCollection$1,isDocument:isDocument,isMap:isMap,isNode:isNode,isPair:isPair,isScalar:isScalar$1,isSeq:isSeq,parse:parse,parseAllDocuments:parseAllDocuments,parseDocument:parseDocument,stringify:stringify,visit:visit$1,visitAsync:visitAsync});var require$$6 = /*@__PURE__*/getAugmentedNamespace(browser);var amekusa_util = {};var hasRequiredAmekusa_util;
11780
11544
 
11781
- var browser = /*#__PURE__*/Object.freeze({
11782
- __proto__: null,
11783
- Alias: Alias,
11784
- CST: cst,
11785
- Composer: Composer,
11786
- Document: Document,
11787
- Lexer: Lexer,
11788
- LineCounter: LineCounter,
11789
- Pair: Pair,
11790
- Parser: Parser,
11791
- Scalar: Scalar,
11792
- Schema: Schema,
11793
- YAMLError: YAMLError,
11794
- YAMLMap: YAMLMap,
11795
- YAMLParseError: YAMLParseError,
11796
- YAMLSeq: YAMLSeq,
11797
- YAMLWarning: YAMLWarning,
11798
- default: YAML,
11799
- isAlias: isAlias,
11800
- isCollection: isCollection$1,
11801
- isDocument: isDocument,
11802
- isMap: isMap,
11803
- isNode: isNode,
11804
- isPair: isPair,
11805
- isScalar: isScalar$1,
11806
- isSeq: isSeq,
11807
- parse: parse,
11808
- parseAllDocuments: parseAllDocuments,
11809
- parseDocument: parseDocument,
11810
- stringify: stringify,
11811
- visit: visit$1,
11812
- visitAsync: visitAsync
11813
- });
11814
-
11815
- var require$$6 = /*@__PURE__*/getAugmentedNamespace(browser);
11816
-
11817
- var bundle$2 = {};
11818
-
11819
- var hasRequiredBundle$2;
11820
-
11821
- function requireBundle$2 () {
11822
- if (hasRequiredBundle$2) return bundle$2;
11823
- hasRequiredBundle$2 = 1;
11824
-
11825
- Object.defineProperty(bundle$2, '__esModule', { value: true });
11826
-
11827
- /*!
11828
- * === @amekusa/util.js/web === *
11545
+ function requireAmekusa_util () {
11546
+ if (hasRequiredAmekusa_util) return amekusa_util;
11547
+ hasRequiredAmekusa_util = 1;
11548
+ var os=require$$0$2,fs=require$$3,fsp=require$$2,path=require$$3$1,node_stream=require$$4,node_process=require$$0$1,node_child_process=require$$1,assert=require$$7;function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}});}n.default=e;return Object.freeze(n)}var fsp__namespace=/*#__PURE__*/_interopNamespaceDefault(fsp);/*!
11549
+ * === @amekusa/util.js/gen === *
11829
11550
  * MIT License
11830
11551
  *
11831
11552
  * Copyright (c) 2024 Satoshi Soma
@@ -11850,79 +11571,269 @@ function requireBundle$2 () {
11850
11571
  */
11851
11572
 
11852
11573
  /**
11853
- * Converts non-safe chars in the given string into HTML entities.
11854
- * @param {string} str
11855
- * @return {string}
11574
+ * Coerces the given value into an array.
11575
+ * @param {any} x
11576
+ * @return {any[]}
11856
11577
  */
11857
- function escHTML(str) {
11858
- return `${str}`.replace(escHTML_find, escHTML_replace);
11578
+ function arr(x) {
11579
+ return Array.isArray(x) ? x : [x];
11859
11580
  }
11860
11581
 
11861
- const escHtml = escHTML; // alias
11862
-
11863
- const escHTML_map = {
11864
- '&': 'amp',
11865
- '"': 'quot',
11866
- "'": 'apos',
11867
- '<': 'lt',
11868
- '>': 'gt'
11869
- };
11870
-
11871
- const escHTML_find = new RegExp(`["'<>]|(&(?!${Object.values(escHTML_map).join('|')};))`, 'g');
11872
- // NOTE:
11873
- // - This avoids double-escaping '&' symbols
11874
- // - Regex negative match: (?!word)
11875
-
11876
- const escHTML_replace = found => `&${escHTML_map[found]};`;
11877
-
11878
- var web = /*#__PURE__*/Object.freeze({
11879
- __proto__: null,
11880
- escHTML: escHTML,
11881
- escHtml: escHtml
11882
- });
11883
-
11884
- /*!
11885
- * === @amekusa/util.js/time === *
11886
- * MIT License
11887
- *
11888
- * Copyright (c) 2024 Satoshi Soma
11889
- *
11890
- * Permission is hereby granted, free of charge, to any person obtaining a copy
11891
- * of this software and associated documentation files (the "Software"), to deal
11892
- * in the Software without restriction, including without limitation the rights
11893
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11894
- * copies of the Software, and to permit persons to whom the Software is
11895
- * furnished to do so, subject to the following conditions:
11896
- *
11897
- * The above copyright notice and this permission notice shall be included in all
11898
- * copies or substantial portions of the Software.
11899
- *
11900
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11901
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11902
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11903
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11904
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11905
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
11906
- * SOFTWARE.
11907
- */
11908
-
11909
11582
  /**
11910
- * Coerces the given value into a `Date` object.
11911
- * @param {...any} args - A `Date` object or args to pass to `Date()`
11912
- * @return {Date}
11583
+ * Checks the type of the given value matches with one of the given types.
11584
+ * If a constructor is given to `types`, it checks if `x` is `instanceof` the constructor.
11585
+ * @param {any} x
11586
+ * @param {...string|function} types - Type or Constructor
11587
+ * @return {boolean}
11913
11588
  */
11914
- function date(...args) {
11915
- if (!args.length || !args[0]) return new Date();
11916
- if (args[0] instanceof Date) return args[0];
11917
- return new Date(...args);
11589
+ function is(x, ...types) {
11590
+ let t = typeof x;
11591
+ for (let i = 0; i < types.length; i++) {
11592
+ let v = types[i];
11593
+ if (typeof v == 'string') {
11594
+ if (v == 'array') {
11595
+ if (Array.isArray(x)) return true;
11596
+ } else if (t == v) return true;
11597
+ } else if (x instanceof v) return true;
11598
+ }
11599
+ return false;
11918
11600
  }
11919
11601
 
11920
11602
  /**
11921
- * Coerces the given value into a number of milliseconds.
11922
- * @param {...args} args - A number or args to pass to `Date()`
11923
- * @return {number} milliseconds
11603
+ * Returns whether the given value can be considered as "empty".
11604
+ * @param {any} x
11605
+ * @return {boolean}
11924
11606
  */
11925
- function ms(...args) {
11607
+ function isEmpty(x) {
11608
+ if (Array.isArray(x)) return x.length == 0;
11609
+ switch (typeof x) {
11610
+ case 'string':
11611
+ return !x;
11612
+ case 'object':
11613
+ for (let _ in x) return false;
11614
+ return true;
11615
+ case 'undefined':
11616
+ return true;
11617
+ }
11618
+ return false;
11619
+ }
11620
+
11621
+ /**
11622
+ * Returns whether the given value can be considered as "empty" or "falsy".
11623
+ * Faster than {@link isEmpty}.
11624
+ * @param {any} x
11625
+ * @return {boolean}
11626
+ */
11627
+ function isEmptyOrFalsy(x) {
11628
+ if (!x) return true;
11629
+ if (Array.isArray(x)) return x.length == 0;
11630
+ if (typeof x == 'object') {
11631
+ for (let _ in x) return false;
11632
+ }
11633
+ return false;
11634
+ }
11635
+
11636
+ /**
11637
+ * @function isEmptyOrFalsey
11638
+ * Alias of {@link isEmptyOrFalsy}.
11639
+ */
11640
+ const isEmptyOrFalsey = isEmptyOrFalsy;
11641
+
11642
+ /**
11643
+ * Removes "empty" values from the given object or array.
11644
+ * @param {object|any[]} x
11645
+ * @param {number} recurse - Recursion limit
11646
+ * @return {object|any[]} modified `x`
11647
+ */
11648
+ function clean$1(x, recurse = 8) {
11649
+ if (recurse) {
11650
+ if (Array.isArray(x)) {
11651
+ let r = [];
11652
+ for (let i = 0; i < x.length; i++) {
11653
+ let v = clean$1(x[i], recurse - 1);
11654
+ if (!isEmpty(v)) r.push(v);
11655
+ }
11656
+ return r;
11657
+ }
11658
+ if (typeof x == 'object') {
11659
+ let r = {};
11660
+ for (let k in x) {
11661
+ let v = clean$1(x[k], recurse - 1);
11662
+ if (!isEmpty(v)) r[k] = v;
11663
+ }
11664
+ return r;
11665
+ }
11666
+ }
11667
+ return x;
11668
+ }
11669
+
11670
+ /**
11671
+ * Merges the 2nd object into the 1st object recursively (deep-merge). The 1st object will be modified.
11672
+ * @param {object} x - The 1st object
11673
+ * @param {object} y - The 2nd object
11674
+ * @param {object} [opts] - Options
11675
+ * @param {number} opts.recurse=8 - Recurstion limit. Negative number means unlimited
11676
+ * @param {boolean|string} opts.mergeArrays - How to merge arrays
11677
+ * - `true`: merge x with y
11678
+ * - 'push': push y elements to x
11679
+ * - 'concat': concat x and y
11680
+ * - other: replace x with y
11681
+ * @return {object} The 1st object
11682
+ */
11683
+ function merge$1(x, y, opts = {}) {
11684
+ if (!('recurse' in opts)) opts.recurse = 8;
11685
+ switch (Array.isArray(x) + Array.isArray(y)) {
11686
+ case 0: // no array
11687
+ if (opts.recurse && x && y && typeof x == 'object' && typeof y == 'object') {
11688
+ opts.recurse--;
11689
+ for (let k in y) x[k] = merge$1(x[k], y[k], opts);
11690
+ opts.recurse++;
11691
+ return x;
11692
+ }
11693
+ case 1: // 1 array
11694
+ return y;
11695
+ }
11696
+ // 2 arrays
11697
+ switch (opts.mergeArrays) {
11698
+ case true:
11699
+ for (let i = 0; i < y.length; i++) {
11700
+ if (!x.includes(y[i])) x.push(y[i]);
11701
+ }
11702
+ return x;
11703
+ case 'push':
11704
+ x.push(...y);
11705
+ return x;
11706
+ case 'concat':
11707
+ return x.concat(y);
11708
+ }
11709
+ return y;
11710
+ }
11711
+
11712
+ /**
11713
+ * Gets a property from the given object by the given string path.
11714
+ * @param {object} obj - Object to traverse
11715
+ * @param {string} path - Property names separated with '.'
11716
+ * @return {any} value of the found property, or undefined if it's not found
11717
+ */
11718
+ function dig(obj, path) {
11719
+ path = path.split('.');
11720
+ for (let i = 0; i < path.length; i++) {
11721
+ let p = path[i];
11722
+ if (typeof obj == 'object' && p in obj) obj = obj[p];
11723
+ else return undefined;
11724
+ }
11725
+ return obj;
11726
+ }
11727
+
11728
+ /**
11729
+ * Substitutes the properties of the given data for the references in the given string.
11730
+ * @param {string} str - String that contains references to the properties
11731
+ * @param {object} data - Object that contains properties to replace the references
11732
+ * @param {object} [opts] - Options
11733
+ * @return {string} a modified `str`
11734
+ */
11735
+ function subst(str, data, opts = {}) {
11736
+ let {
11737
+ modifier = null,
11738
+ start = '{{',
11739
+ end = '}}',
11740
+ } = opts;
11741
+ let ref = new RegExp(start + '\\s*([-.\\w]+)\\s*' + end, 'g');
11742
+ return str.replaceAll(ref, modifier
11743
+ ? (_, m1) => (modifier(dig(data, m1), m1, data) || '')
11744
+ : (_, m1) => (dig(data, m1) || '')
11745
+ );
11746
+ }var gen=/*#__PURE__*/Object.freeze({__proto__:null,arr:arr,clean:clean$1,dig:dig,is:is,isEmpty:isEmpty,isEmptyOrFalsey:isEmptyOrFalsey,isEmptyOrFalsy:isEmptyOrFalsy,merge:merge$1,subst:subst});/*!
11747
+ * === @amekusa/util.js/web === *
11748
+ * MIT License
11749
+ *
11750
+ * Copyright (c) 2024 Satoshi Soma
11751
+ *
11752
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11753
+ * of this software and associated documentation files (the "Software"), to deal
11754
+ * in the Software without restriction, including without limitation the rights
11755
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11756
+ * copies of the Software, and to permit persons to whom the Software is
11757
+ * furnished to do so, subject to the following conditions:
11758
+ *
11759
+ * The above copyright notice and this permission notice shall be included in all
11760
+ * copies or substantial portions of the Software.
11761
+ *
11762
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11763
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11764
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11765
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11766
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11767
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
11768
+ * SOFTWARE.
11769
+ */
11770
+
11771
+ /**
11772
+ * Converts non-safe chars in the given string into HTML entities.
11773
+ * @param {string} str
11774
+ * @return {string}
11775
+ */
11776
+ function escHTML(str) {
11777
+ return `${str}`.replace(escHTML_find, escHTML_replace);
11778
+ }
11779
+
11780
+ const escHtml = escHTML; // alias
11781
+
11782
+ const escHTML_map = {
11783
+ '&': 'amp',
11784
+ '"': 'quot',
11785
+ "'": 'apos',
11786
+ '<': 'lt',
11787
+ '>': 'gt'
11788
+ };
11789
+
11790
+ const escHTML_find = new RegExp(`["'<>]|(&(?!${Object.values(escHTML_map).join('|')};))`, 'g');
11791
+ // NOTE:
11792
+ // - This avoids double-escaping '&' symbols
11793
+ // - Regex negative match: (?!word)
11794
+
11795
+ const escHTML_replace = found => `&${escHTML_map[found]};`;var web=/*#__PURE__*/Object.freeze({__proto__:null,escHTML:escHTML,escHtml:escHtml});/*!
11796
+ * === @amekusa/util.js/time === *
11797
+ * MIT License
11798
+ *
11799
+ * Copyright (c) 2024 Satoshi Soma
11800
+ *
11801
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11802
+ * of this software and associated documentation files (the "Software"), to deal
11803
+ * in the Software without restriction, including without limitation the rights
11804
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11805
+ * copies of the Software, and to permit persons to whom the Software is
11806
+ * furnished to do so, subject to the following conditions:
11807
+ *
11808
+ * The above copyright notice and this permission notice shall be included in all
11809
+ * copies or substantial portions of the Software.
11810
+ *
11811
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11812
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11813
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11814
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11815
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11816
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
11817
+ * SOFTWARE.
11818
+ */
11819
+
11820
+ /**
11821
+ * Coerces the given value into a `Date` object.
11822
+ * @param {...any} args - A `Date` object or args to pass to `Date()`
11823
+ * @return {Date}
11824
+ */
11825
+ function date(...args) {
11826
+ if (!args.length || !args[0]) return new Date();
11827
+ if (args[0] instanceof Date) return args[0];
11828
+ return new Date(...args);
11829
+ }
11830
+
11831
+ /**
11832
+ * Coerces the given value into a number of milliseconds.
11833
+ * @param {...args} args - A number or args to pass to `Date()`
11834
+ * @return {number} milliseconds
11835
+ */
11836
+ function ms(...args) {
11926
11837
  if (!args.length || !args[0]) return Date.now();
11927
11838
  let x = args[0];
11928
11839
  if (typeof x == 'number') return x;
@@ -12051,25 +11962,8 @@ function requireBundle$2 () {
12051
11962
  */
12052
11963
  function iso9075(d) {
12053
11964
  return ymd(d, '-') + ' ' + hms(d, ':');
12054
- }
12055
-
12056
- var time = /*#__PURE__*/Object.freeze({
12057
- __proto__: null,
12058
- addTime: addTime,
12059
- ceil: ceil,
12060
- date: date,
12061
- floor: floor,
12062
- hms: hms,
12063
- iso9075: iso9075,
12064
- localize: localize,
12065
- ms: ms,
12066
- quantize: quantize,
12067
- round: round,
12068
- ymd: ymd
12069
- });
12070
-
12071
- /*!
12072
- * === @amekusa/util.js === *
11965
+ }var time=/*#__PURE__*/Object.freeze({__proto__:null,addTime:addTime,ceil:ceil,date:date,floor:floor,hms:hms,iso9075:iso9075,localize:localize,ms:ms,quantize:quantize,round:round,ymd:ymd});/*!
11966
+ * === @amekusa/util.js/sh === *
12073
11967
  * MIT License
12074
11968
  *
12075
11969
  * Copyright (c) 2024 Satoshi Soma
@@ -12093,184 +11987,6 @@ function requireBundle$2 () {
12093
11987
  * SOFTWARE.
12094
11988
  */
12095
11989
 
12096
- /**
12097
- * Coerces the given value into an array.
12098
- * @param {any} x
12099
- * @return {any[]}
12100
- */
12101
- function arr(x) {
12102
- return Array.isArray(x) ? x : [x];
12103
- }
12104
-
12105
- /**
12106
- * Alias of `Array.isArray`.
12107
- * @return {boolean}
12108
- */
12109
- const isArray = Array.isArray;
12110
-
12111
- /**
12112
- * Returns whether the given value is a number or a string.
12113
- * @param {any} x
12114
- * @return {boolean}
12115
- */
12116
- function isNumOrStr(x) {
12117
- switch (typeof x) {
12118
- case 'number':
12119
- case 'string':
12120
- return true;
12121
- }
12122
- return false;
12123
- }
12124
-
12125
- /**
12126
- * Returns whether the given value can be considered as "empty".
12127
- * @param {any} x
12128
- * @return {boolean}
12129
- */
12130
- function isEmpty(x) {
12131
- if (Array.isArray(x)) return x.length == 0;
12132
- switch (typeof x) {
12133
- case 'string':
12134
- return !x;
12135
- case 'object':
12136
- if (x === null) return true;
12137
- for (let i in x) return false;
12138
- case 'undefined':
12139
- return true;
12140
- }
12141
- return false;
12142
- }
12143
-
12144
- /**
12145
- * Removes "empty" values from the given object or array.
12146
- * @param {object|any[]} x
12147
- * @param {number} recurse - Recursion limit
12148
- * @return {object|any[]} modified `x`
12149
- */
12150
- function clean(x, recurse = 8) {
12151
- if (recurse) {
12152
- if (Array.isArray(x)) {
12153
- let r = [];
12154
- for (let i = 0; i < x.length; i++) {
12155
- let I = clean(x[i], recurse - 1);
12156
- if (!isEmpty(I)) r.push(I);
12157
- }
12158
- return r;
12159
- }
12160
- if (typeof x == 'object') {
12161
- let r = {};
12162
- for (let k in x) {
12163
- let v = clean(x[k], recurse - 1);
12164
- if (!isEmpty(v)) r[k] = v;
12165
- }
12166
- return r;
12167
- }
12168
- }
12169
- return x;
12170
- }
12171
-
12172
- /**
12173
- * Merges the 2nd object into the 1st object recursively (deep-merge). The 1st object will be modified.
12174
- * @param {object} x - The 1st object
12175
- * @param {object} y - The 2nd object
12176
- * @param {object} [opts] - Options
12177
- * @param {number} opts.recurse=8 - Recurstion limit. Negative number means unlimited
12178
- * @param {boolean|string} opts.mergeArrays - How to merge arrays
12179
- * - `true`: merge x with y
12180
- * - 'push': push y elements to x
12181
- * - 'concat': concat x and y
12182
- * - other: replace x with y
12183
- * @return {object} The 1st object
12184
- */
12185
- function merge(x, y, opts = {}) {
12186
- if (!('recurse' in opts)) opts.recurse = 8;
12187
- switch (Array.isArray(x) + Array.isArray(y)) {
12188
- case 0: // no array
12189
- if (opts.recurse && x && y && typeof x == 'object' && typeof y == 'object') {
12190
- opts.recurse--;
12191
- for (let k in y) x[k] = merge(x[k], y[k], opts);
12192
- opts.recurse++;
12193
- return x;
12194
- }
12195
- case 1: // 1 array
12196
- return y;
12197
- }
12198
- // 2 arrays
12199
- switch (opts.mergeArrays) {
12200
- case true:
12201
- for (let i = 0; i < y.length; i++) {
12202
- if (!x.includes(y[i])) x.push(y[i]);
12203
- }
12204
- return x;
12205
- case 'push':
12206
- x.push(...y);
12207
- return x;
12208
- case 'concat':
12209
- return x.concat(y);
12210
- }
12211
- return y;
12212
- }
12213
-
12214
- var main = {
12215
- arr,
12216
- isEmpty,
12217
- clean,
12218
- merge,
12219
- };
12220
-
12221
- bundle$2.arr = arr;
12222
- bundle$2.clean = clean;
12223
- bundle$2.default = main;
12224
- bundle$2.isArray = isArray;
12225
- bundle$2.isEmpty = isEmpty;
12226
- bundle$2.isNumOrStr = isNumOrStr;
12227
- bundle$2.merge = merge;
12228
- bundle$2.time = time;
12229
- bundle$2.web = web;
12230
- return bundle$2;
12231
- }
12232
-
12233
- var bundle$1 = {};
12234
-
12235
- var hasRequiredBundle$1;
12236
-
12237
- function requireBundle$1 () {
12238
- if (hasRequiredBundle$1) return bundle$1;
12239
- hasRequiredBundle$1 = 1;
12240
-
12241
- var node_process = require$$0$1;
12242
- var node_child_process = require$$1;
12243
- var os = require$$2;
12244
- var fs = require$$3;
12245
- var fsp = require$$4;
12246
- var path = require$$5;
12247
- var node_stream = require$$6$1;
12248
- var assert = require$$7;
12249
-
12250
- function _interopNamespaceDefault(e) {
12251
- var n = Object.create(null);
12252
- if (e) {
12253
- Object.keys(e).forEach(function (k) {
12254
- if (k !== 'default') {
12255
- var d = Object.getOwnPropertyDescriptor(e, k);
12256
- Object.defineProperty(n, k, d.get ? d : {
12257
- enumerable: true,
12258
- get: function () { return e[k]; }
12259
- });
12260
- }
12261
- });
12262
- }
12263
- n.default = e;
12264
- return Object.freeze(n);
12265
- }
12266
-
12267
- var fsp__namespace = /*#__PURE__*/_interopNamespaceDefault(fsp);
12268
-
12269
- /*!
12270
- * Shell Utils
12271
- * @author amekusa
12272
- */
12273
-
12274
11990
  /**
12275
11991
  * Executes the given shell command, and returns a Promise that resolves the stdout
12276
11992
  * @param {string} cmd
@@ -12344,32 +12060,246 @@ function requireBundle$1 () {
12344
12060
  let value = 'development';
12345
12061
  if (set != undefined) node_process.env.NODE_ENV = set ? value : '';
12346
12062
  return node_process.env.NODE_ENV == value;
12347
- }
12063
+ }var sh=/*#__PURE__*/Object.freeze({__proto__:null,args:args,dev:dev,exec:exec,prod:prod});/*!
12064
+ * === @amekusa/util.js/io/AssetImporter === *
12065
+ * MIT License
12066
+ *
12067
+ * Copyright (c) 2024 Satoshi Soma
12068
+ *
12069
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12070
+ * of this software and associated documentation files (the "Software"), to deal
12071
+ * in the Software without restriction, including without limitation the rights
12072
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12073
+ * copies of the Software, and to permit persons to whom the Software is
12074
+ * furnished to do so, subject to the following conditions:
12075
+ *
12076
+ * The above copyright notice and this permission notice shall be included in all
12077
+ * copies or substantial portions of the Software.
12078
+ *
12079
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12080
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12081
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12082
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12083
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12084
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12085
+ * SOFTWARE.
12086
+ */
12087
+
12088
+ /**
12089
+ * This is for copying styles or scripts to a certain HTML directory.
12090
+ * @author Satoshi Soma (github.com/amekusa)
12091
+ */
12092
+ class AssetImporter {
12093
+ /**
12094
+ * @param {object} config
12095
+ * @param {boolean} [config.minify=false] - Prefer `*.min.*` version
12096
+ * @param {string} config.src - Source dir to search
12097
+ * @param {string} config.dst - Destination dir
12098
+ */
12099
+ constructor(config) {
12100
+ this.config = Object.assign({
12101
+ minify: false,
12102
+ src: '', // source dir to search
12103
+ dst: '', // destination dir
12104
+ }, config);
12105
+ this.queue = [];
12106
+ this.results = {
12107
+ script: [],
12108
+ style: [],
12109
+ asset: [],
12110
+ };
12111
+ }
12112
+ /**
12113
+ * Adds a new item to import.
12114
+ * @param {string|string[]|object|object[]} newImport
12115
+ */
12116
+ add(newImport) {
12117
+ if (!Array.isArray(newImport)) newImport = [newImport];
12118
+ for (let i = 0; i < newImport.length; i++) {
12119
+ let item = newImport[i];
12120
+ switch (typeof item) {
12121
+ case 'string':
12122
+ item = {src: item};
12123
+ break;
12124
+ case 'object':
12125
+ if (Array.isArray(item)) throw `invalid type: array`;
12126
+ break;
12127
+ default:
12128
+ throw `invalid type: ${typeof item}`;
12129
+ }
12130
+ if (!('src' in item)) throw `'src' property is missing`;
12131
+ this.queue.push(Object.assign({
12132
+ order: 0,
12133
+ resolve: 'local',
12134
+ private: false,
12135
+ }, item));
12136
+ }
12137
+ }
12138
+ /**
12139
+ * Resolves the location of the given file path
12140
+ * @param {string} file - File path
12141
+ * @param {string} method - Resolution method
12142
+ * @return {string} Resolved file path
12143
+ */
12144
+ resolve(file, method) {
12145
+ let find = [];
12146
+ if (this.config.minify) {
12147
+ let _ext = ext(file);
12148
+ find.push(ext(file, '.min' + _ext));
12149
+ }
12150
+ find.push(file);
12151
+ for (let i = 0; i < find.length; i++) {
12152
+ let r;
12153
+ switch (method) {
12154
+ case 'require':
12155
+ try {
12156
+ r = require.resolve(find[i]);
12157
+ } catch (e) {
12158
+ if (e.code == 'MODULE_NOT_FOUND') continue;
12159
+ throw e;
12160
+ }
12161
+ return r;
12162
+ case 'local':
12163
+ r = path.join(this.config.src, find[i]);
12164
+ if (fs.existsSync(r)) return r;
12165
+ break;
12166
+ case 'local:absolute':
12167
+ case 'local:abs':
12168
+ r = find[i];
12169
+ if (fs.existsSync(r)) return r;
12170
+ break;
12171
+ default:
12172
+ throw `invalid resolution method: ${method}`;
12173
+ }
12174
+ }
12175
+ throw `cannot resolve '${file}'`;
12176
+ }
12177
+ /**
12178
+ * Imports all items in the queue at once.
12179
+ * @return {Promise}
12180
+ */
12181
+ import() {
12182
+ let tasks = [];
12183
+ let typeMap = {
12184
+ '.css': 'style',
12185
+ '.js': 'script',
12186
+ };
12187
+ this.queue.sort((a, b) => (Number(a.order) - Number(b.order))); // sort by order
12188
+ while (this.queue.length) {
12189
+ let item = this.queue.shift();
12190
+ let {type, src} = item;
12191
+ let url;
12192
+
12193
+ if (!item.resolve) { // no resolution
12194
+ url = src;
12195
+ if (!type) type = typeMap[ext(src)] || 'asset';
12196
+ console.log('---- File Link ----');
12197
+ console.log(' type:', type);
12198
+ console.log(' src:', src);
12199
+
12200
+ } else { // needs resolution
12201
+ let {dst:dstDir, as:dstFile} = item;
12202
+ let create = item.resolve == 'create'; // needs creation?
12203
+ if (create) {
12204
+ if (!dstFile) throw `'as' property is required with {resolve: 'create'}`;
12205
+ } else {
12206
+ src = this.resolve(src, item.resolve);
12207
+ if (!dstFile) dstFile = path.basename(src);
12208
+ }
12209
+ if (!type) type = typeMap[ext(dstFile)] || 'asset';
12210
+ if (!dstDir) dstDir = type + 's';
12211
+
12212
+ // absolute destination
12213
+ url = path.join(dstDir, dstFile);
12214
+ let dst = path.join(this.config.dst, url);
12215
+ dstDir = path.dirname(dst);
12216
+ if (!fs.existsSync(dstDir)) fs.mkdirSync(dstDir, {recursive:true});
12217
+
12218
+ // create/copy file
12219
+ if (create) {
12220
+ console.log('---- File Creation ----');
12221
+ console.log(' type:', type);
12222
+ console.log(' dst:', dst);
12223
+ tasks.push(fsp.writeFile(dst, src));
12224
+ } else {
12225
+ console.log('---- File Import ----');
12226
+ console.log(' type:', type);
12227
+ console.log(' src:', src);
12228
+ console.log(' dst:', dst);
12229
+ tasks.push(fsp.copyFile(src, dst));
12230
+ }
12231
+ }
12348
12232
 
12349
- var sh = /*#__PURE__*/Object.freeze({
12350
- __proto__: null,
12351
- args: args,
12352
- dev: dev,
12353
- exec: exec,
12354
- prod: prod
12355
- });
12233
+ if (!item.private) {
12234
+ if (!(type in this.results)) this.results[type] = [];
12235
+ this.results[type].push({type, url});
12236
+ }
12237
+ }
12356
12238
 
12357
- /*!
12358
- * I/O Utils
12359
- * @author amekusa
12360
- */
12239
+ return tasks.length ? Promise.all(tasks) : Promise.resolve();
12240
+ }
12241
+ /**
12242
+ * Outputs HTML tags for imported items.
12243
+ * @param {string} [type] - Type
12244
+ * @return {string} HTML
12245
+ */
12246
+ toHTML(type = null) {
12247
+ let r;
12248
+ if (type) {
12249
+ let tmpl = templates[type];
12250
+ if (!tmpl) return '';
12251
+ if (Array.isArray(tmpl)) tmpl = tmpl.join('\n');
12252
+ let items = this.results[type];
12253
+ r = new Array(items.length);
12254
+ for (let i = 0; i < items.length; i++) {
12255
+ r[i] = tmpl.replaceAll('%s', items[i].url || '');
12256
+ }
12257
+ } else {
12258
+ let keys = Object.keys(this.results);
12259
+ r = new Array(keys.length);
12260
+ for (let i = 0; i < keys.length; i++) {
12261
+ r[i] = this.toHTML(keys[i]);
12262
+ }
12263
+ }
12264
+ return r.join('\n');
12265
+ }
12266
+ }
12361
12267
 
12362
- /**
12268
+ const templates = {
12269
+ script: [
12270
+ `<script src="%s"></script>`,
12271
+ ],
12272
+ module: [
12273
+ `<script type="module" src="%s"></script>`,
12274
+ ],
12275
+ style: [
12276
+ `<link rel="stylesheet" href="%s">`,
12277
+ ],
12278
+ };/**
12363
12279
  * Alias of `os.homedir()`.
12364
12280
  * @type {string}
12365
12281
  */
12366
12282
  const home = os.homedir();
12367
12283
 
12368
12284
  /**
12369
- * Searchs the given file path in the given directories.
12285
+ * Returns or overwrites the extension of the given file path.
12286
+ * @param {string} file - File path
12287
+ * @param {string} [set] - New extension
12288
+ * @return {string} the extension, or a modified file path with the new extension
12289
+ */
12290
+ function ext(file, set = null) {
12291
+ let dot = file.lastIndexOf('.');
12292
+ return typeof set == 'string'
12293
+ ? (dot < 0 ? (file + set) : (file.substring(0, dot) + set))
12294
+ : (dot < 0 ? '' : file.substring(dot));
12295
+ }
12296
+
12297
+ /**
12298
+ * Searches the given file path in the given directories.
12370
12299
  * @param {string} file - File to find
12371
12300
  * @param {string[]} dirs - Array of directories to search
12372
12301
  * @param {object} [opts] - Options
12302
+ * @param {boolean} [opts.allowAbsolute=true] - If true, `file` can be an absolute path
12373
12303
  * @return {string|boolean} found file path, or false if not found
12374
12304
  */
12375
12305
  function find(file, dirs = [], opts = {}) {
@@ -12396,28 +12326,43 @@ function requireBundle$1 () {
12396
12326
  }
12397
12327
 
12398
12328
  /**
12399
- * Deletes the contents of the given directory.
12400
- * @return {Promise}
12401
- */
12402
- function clean(dir, pattern, depth = 1) {
12403
- return exec(`find '${dir}' -type f -name '${pattern}' -maxdepth ${depth} -delete`);
12404
- }
12405
-
12406
- /**
12407
- * Deletes the given file or directory.
12408
- * @param {string} file
12409
- * @return {Promise}
12410
- */
12411
- function rm(file) {
12412
- return fsp__namespace.rm(file, {recursive: true, force: true});
12413
- }
12414
-
12415
- /**
12416
- * Deletes the given file or directory synchronously.
12417
- * @param {string} file
12329
+ * Deletes the files in the given directory.
12330
+ * @param {string} dir - Directory to clean
12331
+ * @param {string|RegExp} [pattern] - File pattern
12332
+ * @param {object} [opts] - Options
12333
+ * @param {boolean} [opts.recursive=false] - Searches recursively
12334
+ * @param {object} [opts.types] - File types to delete
12335
+ * @param {boolean} [opts.types.any=false] - Any type
12336
+ * @param {boolean} [opts.types.file=true] - Regular file
12337
+ * @param {boolean} [opts.types.dir=false] - Directory
12338
+ * @param {boolean} [opts.types.symlink=false] - Symbolic link
12339
+ * @return {Promise} a promise resolved with the deleted file paths
12418
12340
  */
12419
- function rmSync(file) {
12420
- return fs.rmSync(file, {recursive: true, force: true});
12341
+ function clean(dir, pattern = null, opts = {}) {
12342
+ if (pattern && typeof pattern == 'string') pattern = new RegExp(pattern);
12343
+ let {
12344
+ recursive = false,
12345
+ types = {file: true},
12346
+ } = opts;
12347
+ return fsp__namespace.readdir(dir, {recursive, withFileTypes: true}).then(files => {
12348
+ let tasks = [];
12349
+ for (let i = 0; i < files.length; i++) {
12350
+ let f = files[i];
12351
+ if (!types.any) {
12352
+ if (f.isFile()) {
12353
+ if (!types.file) continue;
12354
+ } else if (f.isDirectory()) {
12355
+ if (!types.dir) continue;
12356
+ } else if (f.isSymbolicLink()) {
12357
+ if (!types.symlink) continue;
12358
+ }
12359
+ }
12360
+ f = path.join(dir, f.name);
12361
+ if (pattern && !f.match(pattern)) continue;
12362
+ tasks.push(fsp__namespace.rm(f, {force: true, recursive: true}).then(() => f));
12363
+ }
12364
+ return tasks.length ? Promise.all(tasks) : false;
12365
+ });
12421
12366
  }
12422
12367
 
12423
12368
  /**
@@ -12451,7 +12396,7 @@ function requireBundle$1 () {
12451
12396
  *
12452
12397
  * @example
12453
12398
  * return gulp.src(src)
12454
- * .pipe(modify((data, enc) => {
12399
+ * .pipe(modifyStream((data, enc) => {
12455
12400
  * // do stuff
12456
12401
  * return newData;
12457
12402
  * }));
@@ -12477,25 +12422,31 @@ function requireBundle$1 () {
12477
12422
  }
12478
12423
  }
12479
12424
  });
12480
- }
12481
-
12482
- var io = /*#__PURE__*/Object.freeze({
12483
- __proto__: null,
12484
- clean: clean,
12485
- copy: copy,
12486
- find: find,
12487
- home: home,
12488
- modifyStream: modifyStream,
12489
- rm: rm,
12490
- rmSync: rmSync,
12491
- untilde: untilde
12492
- });
12493
-
12494
- const merge = Object.assign;
12425
+ }var io=/*#__PURE__*/Object.freeze({__proto__:null,AssetImporter:AssetImporter,clean:clean,copy:copy,ext:ext,find:find,home:home,modifyStream:modifyStream,untilde:untilde});const merge = Object.assign;
12495
12426
 
12496
12427
  /*!
12497
- * Test Utils
12498
- * @author amekusa
12428
+ * === @amekusa/util.js/test === *
12429
+ * MIT License
12430
+ *
12431
+ * Copyright (c) 2024 Satoshi Soma
12432
+ *
12433
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12434
+ * of this software and associated documentation files (the "Software"), to deal
12435
+ * in the Software without restriction, including without limitation the rights
12436
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12437
+ * copies of the Software, and to permit persons to whom the Software is
12438
+ * furnished to do so, subject to the following conditions:
12439
+ *
12440
+ * The above copyright notice and this permission notice shall be included in all
12441
+ * copies or substantial portions of the Software.
12442
+ *
12443
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12444
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12445
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12446
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12447
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12448
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12449
+ * SOFTWARE.
12499
12450
  */
12500
12451
 
12501
12452
  /**
@@ -12562,28 +12513,36 @@ function requireBundle$1 () {
12562
12513
  let testCase = (c, title) => {
12563
12514
  it(title, () => {
12564
12515
  if (typeof c != 'object') invalid(`a test case must be an object`);
12516
+
12565
12517
  // ---- call function ----
12566
- let r;
12567
12518
  let args = [];
12568
- if (c.args) { // args to pass
12519
+ if ('args' in c) { // args to pass
12569
12520
  if (!Array.isArray(c.args)) invalid(`'args' must be an array`);
12570
12521
  args = c.args;
12522
+ delete c.args;
12571
12523
  }
12572
- r = fn(...args);
12573
- // ---- check ----
12574
- if ('returnType' in c) { // check return type
12575
- assertType(r, c.returnType, `return type failed`);
12576
- }
12577
- if ('return' in c) { // check return
12578
- assertEqual(r, c.return, merge({msg: `return value failed`}, opts));
12579
- }
12580
- if (c.test) { // custom test
12581
- if (typeof c.test != 'function') invalid(`'test' must be a function`);
12582
- c.test(r, ...args);
12524
+ let r = fn(...args);
12525
+
12526
+ // ---- check the result ----
12527
+ let check = {
12528
+ returnType() {
12529
+ assertType(r, c.returnType, `return type failed`);
12530
+ },
12531
+ return() {
12532
+ assertEqual(r, c.return, merge({msg: `return value failed`}, opts));
12533
+ },
12534
+ test() {
12535
+ if (typeof c.test != 'function') invalid(`'test' must be a function`);
12536
+ c.test(r, ...args);
12537
+ }
12538
+ };
12539
+ for (let k in c) {
12540
+ if (check[k]) check[k]();
12541
+ else invalid(`invalid property: '${k}' (available properties: ${Object.keys(check).join(', ')})`);
12583
12542
  }
12584
12543
  });
12585
12544
  };
12586
- describe(fn.displayName || fn.name, () => {
12545
+ describe('function: ' + (fn.displayName || fn.name), () => {
12587
12546
  if (Array.isArray(cases)) {
12588
12547
  for (let i = 0; i < cases.length; i++) {
12589
12548
  let c = cases[i];
@@ -12610,52 +12569,68 @@ function requireBundle$1 () {
12610
12569
  let testCase = (c, title) => {
12611
12570
  it(title, () => {
12612
12571
  if (typeof c != 'object') invalid(`a test case must be an object`);
12572
+
12613
12573
  // ---- instantiate ----
12614
12574
  let obj;
12615
12575
  if (opts.static) {
12616
- if (c.initArgs) invalid(`'initArgs' is not for static method`);
12576
+ if ('initArgs' in c) invalid(`'initArgs' is not available for a static method`);
12577
+ if ('prepare' in c) invalid(`'prepare' is not available for a static method`);
12617
12578
  obj = construct;
12618
12579
  } else {
12619
12580
  let initArgs = [];
12620
- if (c.initArgs) {
12581
+ if ('initArgs' in c) {
12621
12582
  if (!Array.isArray(c.initArgs)) invalid(`'initArgs' must be an array`);
12622
12583
  initArgs = c.initArgs;
12584
+ delete c.initArgs;
12623
12585
  }
12624
12586
  try {
12625
12587
  obj = new construct(...initArgs);
12626
12588
  } catch (e) {
12627
12589
  obj = construct(...initArgs);
12628
12590
  }
12591
+ if ('prepare' in c) {
12592
+ if (typeof c.prepare != 'function') invalid(`'prepare' must be a function`);
12593
+ c.prepare(obj);
12594
+ delete c.prepare;
12595
+ }
12629
12596
  }
12597
+
12630
12598
  // ---- call method ----
12631
- if (!(method in obj)) invalid(`no such method as '${method}`);
12632
- let r;
12599
+ if (!(method in obj)) invalid(`no such method as '${method}'`);
12633
12600
  let args = [];
12634
- if (c.args) { // args to pass
12601
+ if ('args' in c) { // args to pass
12635
12602
  if (!Array.isArray(c.args)) invalid(`'args' must be an array`);
12636
12603
  args = c.args;
12604
+ delete c.args;
12637
12605
  }
12638
- r = obj[method](...args);
12639
- // ---- check ----
12640
- if (c.returnsSelf) { // check if returns itself
12641
- assert.strictEqual(r, obj);
12642
- }
12643
- if ('returnType' in c) { // check return type
12644
- assertType(r, c.returnType, `return type failed`);
12645
- }
12646
- if ('return' in c) { // check return value
12647
- assertEqual(r, c.return, merge({msg: `return failed`}, opts));
12648
- }
12649
- if (c.props) { // check properties
12650
- assertProps(obj, c.props, opts);
12651
- }
12652
- if (c.test) { // custom test
12653
- if (typeof c.test != 'function') invalid(`'test' must be a function`);
12654
- c.test(r, obj, ...args);
12606
+ let r = obj[method](...args);
12607
+
12608
+ // ---- check the result ----
12609
+ let check = {
12610
+ returnsSelf() { // check if returns itself
12611
+ assert.strictEqual(r, obj, `must return self`);
12612
+ },
12613
+ returnType() { // check return type
12614
+ assertType(r, c.returnType, `return type failed`);
12615
+ },
12616
+ return() { // check return value
12617
+ assertEqual(r, c.return, merge({msg: `return failed`}, opts));
12618
+ },
12619
+ props() { // check properties
12620
+ assertProps(obj, c.props, opts);
12621
+ },
12622
+ test() { // custom test
12623
+ if (typeof c.test != 'function') invalid(`'test' must be a function`);
12624
+ c.test(r, obj, ...args);
12625
+ }
12626
+ };
12627
+ for (let k in c) {
12628
+ if (check[k]) check[k]();
12629
+ else invalid(`invalid property: '${k}' (available properties: ${Object.keys(check).join(', ')})`);
12655
12630
  }
12656
12631
  });
12657
12632
  };
12658
- describe(construct.name + ' :: ' + method, () => {
12633
+ describe('method: ' + method, () => {
12659
12634
  if (Array.isArray(cases)) {
12660
12635
  for (let i = 0; i < cases.length; i++) {
12661
12636
  let c = cases[i];
@@ -12680,23 +12655,35 @@ function requireBundle$1 () {
12680
12655
  function testInstance(construct, cases, opts = {}) {
12681
12656
  let testCase = (c, title) => {
12682
12657
  it(title, () => {
12683
- let obj;
12658
+ if (typeof c != 'object') invalid(`a test case must be an object`);
12659
+
12660
+ // ---- instantiate ----
12684
12661
  let args = [];
12685
- if (c.args) {
12662
+ if ('args' in c) {
12686
12663
  if (!Array.isArray(c.args)) invalid(`'args' must be an array`);
12687
12664
  args = c.args;
12665
+ delete c.args;
12688
12666
  }
12667
+ let obj;
12689
12668
  try {
12690
12669
  obj = new construct(...args);
12691
12670
  } catch (e) {
12692
12671
  obj = construct(...args);
12693
12672
  }
12694
- if (c.props) { // check properties
12695
- assertProps(obj, c.props, opts);
12696
- }
12697
- if (c.test) { // custom test
12698
- if (typeof c.test != 'function') invalid(`'test' must be a function`);
12699
- c.test(obj, ...args);
12673
+
12674
+ // ---- check the result ----
12675
+ let check = {
12676
+ props() { // check properties
12677
+ assertProps(obj, c.props, opts);
12678
+ },
12679
+ test() { // custom check
12680
+ if (typeof c.test != 'function') invalid(`'test' must be a function`);
12681
+ c.test(obj, ...args);
12682
+ }
12683
+ };
12684
+ for (let k in c) {
12685
+ if (check[k]) check[k]();
12686
+ else invalid(`invalid property: '${k}' (available properties: ${Object.keys(check).join(', ')})`);
12700
12687
  }
12701
12688
  });
12702
12689
  };
@@ -12715,40 +12702,21 @@ function requireBundle$1 () {
12715
12702
  }
12716
12703
  }
12717
12704
  });
12718
- }
12719
-
12720
- var test = /*#__PURE__*/Object.freeze({
12721
- __proto__: null,
12722
- InvalidTest: InvalidTest,
12723
- assertEqual: assertEqual,
12724
- assertProps: assertProps,
12725
- assertType: assertType,
12726
- testFn: testFn,
12727
- testInstance: testInstance,
12728
- testMethod: testMethod
12729
- });
12730
-
12731
- bundle$1.io = io;
12732
- bundle$1.sh = sh;
12733
- bundle$1.test = test;
12734
- return bundle$1;
12735
- }
12736
-
12737
- var bundle = {};
12738
-
12739
- var hasRequiredBundle;
12705
+ }var test=/*#__PURE__*/Object.freeze({__proto__:null,InvalidTest:InvalidTest,assertEqual:assertEqual,assertProps:assertProps,assertType:assertType,testFn:testFn,testInstance:testInstance,testMethod:testMethod});amekusa_util.arr=arr;amekusa_util.clean=clean$1;amekusa_util.dig=dig;amekusa_util.gen=gen;amekusa_util.io=io;amekusa_util.is=is;amekusa_util.isEmpty=isEmpty;amekusa_util.isEmptyOrFalsey=isEmptyOrFalsey;amekusa_util.isEmptyOrFalsy=isEmptyOrFalsy;amekusa_util.merge=merge$1;amekusa_util.sh=sh;amekusa_util.subst=subst;amekusa_util.test=test;amekusa_util.time=time;amekusa_util.web=web;
12706
+ return amekusa_util;
12707
+ }var bundle = {};var hasRequiredBundle;
12740
12708
 
12741
12709
  function requireBundle () {
12742
12710
  if (hasRequiredBundle) return bundle;
12743
12711
  hasRequiredBundle = 1;
12744
12712
 
12745
12713
  var node_process = require$$0$1;
12746
- var fs = require$$3;
12714
+ var path = require$$3$1;
12747
12715
  var node_child_process = require$$1;
12748
- var os = require$$2;
12749
- var fsp = require$$4;
12750
- var path = require$$5;
12751
- var node_stream = require$$6$1;
12716
+ var os = require$$0$2;
12717
+ var fs = require$$3;
12718
+ var fsp = require$$2;
12719
+ var node_stream = require$$4;
12752
12720
 
12753
12721
 
12754
12722
  function _interopNamespaceDefault(e) {
@@ -12768,7 +12736,170 @@ function requireBundle () {
12768
12736
  return Object.freeze(n);
12769
12737
  }
12770
12738
 
12771
- var fsp__namespace = /*#__PURE__*/_interopNamespaceDefault(fsp);
12739
+ var fsp__namespace = /*#__PURE__*/_interopNamespaceDefault(fsp);
12740
+
12741
+ /*!
12742
+ * Shell Utils
12743
+ * @author amekusa
12744
+ */
12745
+
12746
+ /**
12747
+ * Executes the given shell command, and returns a Promise that resolves the stdout
12748
+ * @param {string} cmd
12749
+ * @param {object} [opts]
12750
+ * @return {Promise}
12751
+ */
12752
+ function exec(cmd, opts = {}) {
12753
+ opts = Object.assign({
12754
+ dryRun: false,
12755
+ }, opts);
12756
+ return new Promise((resolve, reject) => {
12757
+ if (opts.dryRun) {
12758
+ console.log(`[DRYRUN] ${cmd}`);
12759
+ return resolve();
12760
+ }
12761
+ node_child_process.exec(cmd, (err, stdout) => {
12762
+ return err ? reject(err) : resolve(stdout);
12763
+ });
12764
+ });
12765
+ }
12766
+
12767
+ /*!
12768
+ * I/O Utils
12769
+ * @author amekusa
12770
+ */
12771
+
12772
+ /**
12773
+ * Alias of `os.homedir()`.
12774
+ * @type {string}
12775
+ */
12776
+ const home = os.homedir();
12777
+
12778
+ /**
12779
+ * Searchs the given file path in the given directories.
12780
+ * @param {string} file - File to find
12781
+ * @param {string[]} dirs - Array of directories to search
12782
+ * @param {object} [opts] - Options
12783
+ * @return {string|boolean} found file path, or false if not found
12784
+ */
12785
+ function find(file, dirs = [], opts = {}) {
12786
+ let {allowAbsolute = true} = opts;
12787
+ if (allowAbsolute && path.isAbsolute(file)) return fs.existsSync(file) ? file : false;
12788
+ for (let i = 0; i < dirs.length; i++) {
12789
+ let find = path.join(dirs[i], file);
12790
+ if (fs.existsSync(find)) return find;
12791
+ }
12792
+ return false;
12793
+ }
12794
+
12795
+ /**
12796
+ * Replaces the beginning `~` character with `os.homedir()`.
12797
+ * @param {string} file - File path
12798
+ * @param {string} [replace=os.homedir()] - Replacement
12799
+ * @return {string} modified `file`
12800
+ */
12801
+ function untilde(file, replace = home) {
12802
+ if (!file.startsWith('~')) return file;
12803
+ if (file.length == 1) return replace;
12804
+ if (file.startsWith(path.sep, 1)) return replace + file.substring(1);
12805
+ return file;
12806
+ }
12807
+
12808
+ /**
12809
+ * Deletes the contents of the given directory.
12810
+ * @return {Promise}
12811
+ */
12812
+ function clean$1(dir, pattern, depth = 1) {
12813
+ return exec(`find '${dir}' -type f -name '${pattern}' -maxdepth ${depth} -delete`);
12814
+ }
12815
+
12816
+ /**
12817
+ * Deletes the given file or directory.
12818
+ * @param {string} file
12819
+ * @return {Promise}
12820
+ */
12821
+ function rm(file) {
12822
+ return fsp__namespace.rm(file, {recursive: true, force: true});
12823
+ }
12824
+
12825
+ /**
12826
+ * Deletes the given file or directory synchronously.
12827
+ * @param {string} file
12828
+ */
12829
+ function rmSync(file) {
12830
+ return fs.rmSync(file, {recursive: true, force: true});
12831
+ }
12832
+
12833
+ /**
12834
+ * Copies the given file(s) to another directory
12835
+ * @param {string|object|string[]|object[]} src
12836
+ * @param {string} dst Base destination directory
12837
+ * @return {Promise}
12838
+ */
12839
+ function copy(src, dst) {
12840
+ return Promise.all((Array.isArray(src) ? src : [src]).map(item => {
12841
+ let _src, _dst;
12842
+ switch (typeof item) {
12843
+ case 'object':
12844
+ _src = item.src;
12845
+ _dst = item.dst;
12846
+ break;
12847
+ case 'string':
12848
+ _src = item;
12849
+ break;
12850
+ default:
12851
+ throw 'invalid type';
12852
+ }
12853
+ _dst = path.join(dst, _dst || path.basename(_src));
12854
+ return fsp__namespace.mkdir(path.dirname(_dst), {recursive: true}).then(fsp__namespace.copyFile(_src, _dst));
12855
+ }));
12856
+ }
12857
+
12858
+ /**
12859
+ * Returns a Transform stream object with the given function as its transform() method.
12860
+ * `fn` must return a string which is to be the new content, or a Promise which resolves a string.
12861
+ *
12862
+ * @example
12863
+ * return gulp.src(src)
12864
+ * .pipe(modify((data, enc) => {
12865
+ * // do stuff
12866
+ * return newData;
12867
+ * }));
12868
+ *
12869
+ * @param {function} fn
12870
+ * @return {Transform}
12871
+ */
12872
+ function modifyStream(fn) {
12873
+ return new node_stream.Transform({
12874
+ objectMode: true,
12875
+ transform(file, enc, done) {
12876
+ let r = fn(file.contents.toString(enc), enc);
12877
+ if (r instanceof Promise) {
12878
+ r.then(modified => {
12879
+ file.contents = Buffer.from(modified, enc);
12880
+ this.push(file);
12881
+ done();
12882
+ });
12883
+ } else {
12884
+ file.contents = Buffer.from(r, enc);
12885
+ this.push(file);
12886
+ done();
12887
+ }
12888
+ }
12889
+ });
12890
+ }
12891
+
12892
+ var io = /*#__PURE__*/Object.freeze({
12893
+ __proto__: null,
12894
+ clean: clean$1,
12895
+ copy: copy,
12896
+ find: find,
12897
+ home: home,
12898
+ modifyStream: modifyStream,
12899
+ rm: rm,
12900
+ rmSync: rmSync,
12901
+ untilde: untilde
12902
+ });
12772
12903
 
12773
12904
  /*!
12774
12905
  * === @amekusa/util.js/web === *
@@ -13052,12 +13183,12 @@ function requireBundle () {
13052
13183
  * @param {number} recurse - Recursion limit
13053
13184
  * @return {object|any[]} modified `x`
13054
13185
  */
13055
- function clean$1(x, recurse = 8) {
13186
+ function clean(x, recurse = 8) {
13056
13187
  if (recurse) {
13057
13188
  if (Array.isArray(x)) {
13058
13189
  let r = [];
13059
13190
  for (let i = 0; i < x.length; i++) {
13060
- let I = clean$1(x[i], recurse - 1);
13191
+ let I = clean(x[i], recurse - 1);
13061
13192
  if (!isEmpty(I)) r.push(I);
13062
13193
  }
13063
13194
  return r;
@@ -13065,7 +13196,7 @@ function requireBundle () {
13065
13196
  if (typeof x == 'object') {
13066
13197
  let r = {};
13067
13198
  for (let k in x) {
13068
- let v = clean$1(x[k], recurse - 1);
13199
+ let v = clean(x[k], recurse - 1);
13069
13200
  if (!isEmpty(v)) r[k] = v;
13070
13201
  }
13071
13202
  return r;
@@ -13116,169 +13247,6 @@ function requireBundle () {
13116
13247
  return y;
13117
13248
  }
13118
13249
 
13119
- /*!
13120
- * Shell Utils
13121
- * @author amekusa
13122
- */
13123
-
13124
- /**
13125
- * Executes the given shell command, and returns a Promise that resolves the stdout
13126
- * @param {string} cmd
13127
- * @param {object} [opts]
13128
- * @return {Promise}
13129
- */
13130
- function exec(cmd, opts = {}) {
13131
- opts = Object.assign({
13132
- dryRun: false,
13133
- }, opts);
13134
- return new Promise((resolve, reject) => {
13135
- if (opts.dryRun) {
13136
- console.log(`[DRYRUN] ${cmd}`);
13137
- return resolve();
13138
- }
13139
- node_child_process.exec(cmd, (err, stdout) => {
13140
- return err ? reject(err) : resolve(stdout);
13141
- });
13142
- });
13143
- }
13144
-
13145
- /*!
13146
- * I/O Utils
13147
- * @author amekusa
13148
- */
13149
-
13150
- /**
13151
- * Alias of `os.homedir()`.
13152
- * @type {string}
13153
- */
13154
- const home = os.homedir();
13155
-
13156
- /**
13157
- * Searchs the given file path in the given directories.
13158
- * @param {string} file - File to find
13159
- * @param {string[]} dirs - Array of directories to search
13160
- * @param {object} [opts] - Options
13161
- * @return {string|boolean} found file path, or false if not found
13162
- */
13163
- function find(file, dirs = [], opts = {}) {
13164
- let {allowAbsolute = true} = opts;
13165
- if (allowAbsolute && path.isAbsolute(file)) return fs.existsSync(file) ? file : false;
13166
- for (let i = 0; i < dirs.length; i++) {
13167
- let find = path.join(dirs[i], file);
13168
- if (fs.existsSync(find)) return find;
13169
- }
13170
- return false;
13171
- }
13172
-
13173
- /**
13174
- * Replaces the beginning `~` character with `os.homedir()`.
13175
- * @param {string} file - File path
13176
- * @param {string} [replace=os.homedir()] - Replacement
13177
- * @return {string} modified `file`
13178
- */
13179
- function untilde(file, replace = home) {
13180
- if (!file.startsWith('~')) return file;
13181
- if (file.length == 1) return replace;
13182
- if (file.startsWith(path.sep, 1)) return replace + file.substring(1);
13183
- return file;
13184
- }
13185
-
13186
- /**
13187
- * Deletes the contents of the given directory.
13188
- * @return {Promise}
13189
- */
13190
- function clean(dir, pattern, depth = 1) {
13191
- return exec(`find '${dir}' -type f -name '${pattern}' -maxdepth ${depth} -delete`);
13192
- }
13193
-
13194
- /**
13195
- * Deletes the given file or directory.
13196
- * @param {string} file
13197
- * @return {Promise}
13198
- */
13199
- function rm(file) {
13200
- return fsp__namespace.rm(file, {recursive: true, force: true});
13201
- }
13202
-
13203
- /**
13204
- * Deletes the given file or directory synchronously.
13205
- * @param {string} file
13206
- */
13207
- function rmSync(file) {
13208
- return fs.rmSync(file, {recursive: true, force: true});
13209
- }
13210
-
13211
- /**
13212
- * Copies the given file(s) to another directory
13213
- * @param {string|object|string[]|object[]} src
13214
- * @param {string} dst Base destination directory
13215
- * @return {Promise}
13216
- */
13217
- function copy(src, dst) {
13218
- return Promise.all((Array.isArray(src) ? src : [src]).map(item => {
13219
- let _src, _dst;
13220
- switch (typeof item) {
13221
- case 'object':
13222
- _src = item.src;
13223
- _dst = item.dst;
13224
- break;
13225
- case 'string':
13226
- _src = item;
13227
- break;
13228
- default:
13229
- throw 'invalid type';
13230
- }
13231
- _dst = path.join(dst, _dst || path.basename(_src));
13232
- return fsp__namespace.mkdir(path.dirname(_dst), {recursive: true}).then(fsp__namespace.copyFile(_src, _dst));
13233
- }));
13234
- }
13235
-
13236
- /**
13237
- * Returns a Transform stream object with the given function as its transform() method.
13238
- * `fn` must return a string which is to be the new content, or a Promise which resolves a string.
13239
- *
13240
- * @example
13241
- * return gulp.src(src)
13242
- * .pipe(modify((data, enc) => {
13243
- * // do stuff
13244
- * return newData;
13245
- * }));
13246
- *
13247
- * @param {function} fn
13248
- * @return {Transform}
13249
- */
13250
- function modifyStream(fn) {
13251
- return new node_stream.Transform({
13252
- objectMode: true,
13253
- transform(file, enc, done) {
13254
- let r = fn(file.contents.toString(enc), enc);
13255
- if (r instanceof Promise) {
13256
- r.then(modified => {
13257
- file.contents = Buffer.from(modified, enc);
13258
- this.push(file);
13259
- done();
13260
- });
13261
- } else {
13262
- file.contents = Buffer.from(r, enc);
13263
- this.push(file);
13264
- done();
13265
- }
13266
- }
13267
- });
13268
- }
13269
-
13270
- var io = /*#__PURE__*/Object.freeze({
13271
- __proto__: null,
13272
- clean: clean,
13273
- copy: copy,
13274
- find: find,
13275
- home: home,
13276
- modifyStream: modifyStream,
13277
- rm: rm,
13278
- rmSync: rmSync,
13279
- untilde: untilde
13280
- });
13281
-
13282
13250
  /**
13283
13251
  * File I/O manager.
13284
13252
  */
@@ -13564,7 +13532,24 @@ function requireBundle () {
13564
13532
  * @return {object} an object like: `{ key_code: ... }`
13565
13533
  */
13566
13534
  function key(code, mods = null, opts = null) {
13567
- if (Array.isArray(code)) {
13535
+ switch (typeof code) {
13536
+ case 'number':
13537
+ code += '';
13538
+ break;
13539
+ case 'string':
13540
+ code = code.trim();
13541
+ if (code.includes(',')) {
13542
+ let r = [];
13543
+ let codes = code.split(',');
13544
+ for (let i = 0; i < codes.length; i++) {
13545
+ let I = codes[i].trim();
13546
+ if (I) r.push(key(I, mods, opts));
13547
+ }
13548
+ return r;
13549
+ }
13550
+ break;
13551
+ default:
13552
+ if (!Array.isArray(code)) throw `invalid argument (#1)`;
13568
13553
  let r = [];
13569
13554
  for (let i = 0; i < code.length; i++) {
13570
13555
  let I = code[i];
@@ -13586,6 +13571,9 @@ function requireBundle () {
13586
13571
  optional: []
13587
13572
  };
13588
13573
 
13574
+ /**
13575
+ * @param {string} mod - Modifier name
13576
+ */
13589
13577
  function addModifier(mod) {
13590
13578
  mod = mod.trim();
13591
13579
  let m = mod.match(/^\((.+?)\)$/); // is '(optional-key)' ?
@@ -13594,7 +13582,7 @@ function requireBundle () {
13594
13582
  }
13595
13583
 
13596
13584
  // parse 'modifier + keycode' expression
13597
- code = (code + '').split('+');
13585
+ code = code.split('+');
13598
13586
  for (let i = 0; i < code.length - 1; i++) addModifier(code[i]);
13599
13587
  code = code[code.length - 1].trim();
13600
13588
 
@@ -13752,7 +13740,7 @@ function requireBundle () {
13752
13740
  * {@link key} function returns in this format.
13753
13741
  *
13754
13742
  * #### String Format
13755
- * A special expression that is only supported by Karabinerge for user's convenience.
13743
+ * A special expression that is only supported by Karabinerge.
13756
13744
  * Here are some examples:
13757
13745
  *
13758
13746
  * | Expression | Meaning |
@@ -13829,7 +13817,7 @@ function requireBundle () {
13829
13817
  remap(map) {
13830
13818
  if (!map.type) map.type = 'basic';
13831
13819
  if (this.conds.length) map = Object.assign(map, {conditions: this.conds});
13832
- map = clean$1(remapSanitizer.sanitize(map));
13820
+ map = clean(remapSanitizer.sanitize(map));
13833
13821
  if (isEmpty(map)) console.warn(`Rule.remap: empty argument`);
13834
13822
  else this.remaps.push(map);
13835
13823
  return this;
@@ -13851,7 +13839,7 @@ function requireBundle () {
13851
13839
  * .remap( ... );
13852
13840
  */
13853
13841
  cond(cond) {
13854
- cond = clean$1(cond);
13842
+ cond = clean(cond);
13855
13843
  if (isEmpty(cond)) console.warn(`Rule.cond: empty argument`);
13856
13844
  else this.conds.push(cond);
13857
13845
  return this;
@@ -13969,13 +13957,14 @@ function requireBundle () {
13969
13957
  }
13970
13958
  /**
13971
13959
  * Setup {@link IO} object for reading/writing this ruleset from/to a file.
13972
- * Ruleset files are normally located at `~/.config/karabiner/complex_modifications/*.json`.
13973
- * @param {string} file - Ruleset file path
13960
+ * @param {string} file - Ruleset filename or path.
13961
+ * If a filename was passed, it is treated as `~/.config/karabiner/complex_modifications/*`.
13974
13962
  * @param {object} [opts] - IO options
13975
13963
  * @return {RuleSet} Itself
13976
13964
  */
13977
13965
  setIO(file, opts = {}) {
13978
- this.io = new IO(file, opts);
13966
+ if (!file) throw `invalid argument (#1)`;
13967
+ this.io = new IO(file.includes('/') ? file : path.join(io.home, '.config', 'karabiner', 'complex_modifications', file), opts);
13979
13968
  return this;
13980
13969
  }
13981
13970
  /**
@@ -14199,17 +14188,13 @@ function requireBundle () {
14199
14188
  bundle.unless_lang = unless_lang;
14200
14189
  bundle.unless_var = unless_var;
14201
14190
  return bundle;
14202
- }
14203
-
14204
- var name = "keycomfort";
14205
- var version = "0.1.0";
14191
+ }var name = "keycomfort";
14192
+ var version = "0.3.0";
14206
14193
  var description = "Comfortable keyboard remaps for Karabiner/AutoHotKey";
14207
- var require$$10 = {
14194
+ var require$$9 = {
14208
14195
  name: name,
14209
14196
  version: version,
14210
- description: description};
14211
-
14212
- var rules_1;
14197
+ description: description};var rules_1;
14213
14198
  var hasRequiredRules;
14214
14199
 
14215
14200
  function requireRules () {
@@ -14238,7 +14223,8 @@ function requireRules () {
14238
14223
  },
14239
14224
 
14240
14225
  'cancel modifier'(c, r) {
14241
- r.remap({
14226
+ r.cond(if_var('keycomfort_layer_disable', 0))
14227
+ .remap({
14242
14228
  from: key(c.key, any),
14243
14229
  to: [
14244
14230
  set_var('keycomfort_layer_disable', 1),
@@ -14248,6 +14234,23 @@ function requireRules () {
14248
14234
  });
14249
14235
  },
14250
14236
 
14237
+ 'disable modifier'(c, r) {
14238
+ r.cond(modding)
14239
+ .cond(if_var('keycomfort_layer_disable', 0))
14240
+ .remap({
14241
+ from: key(c.key),
14242
+ to: set_var('keycomfort_layer_disable', 1)
14243
+ });
14244
+ },
14245
+
14246
+ 'enable modifier'(c, r) {
14247
+ r.cond(if_var('keycomfort_layer_disable', 1))
14248
+ .remap({
14249
+ from: key(c.key),
14250
+ to: set_var('keycomfort_layer_disable', 0)
14251
+ });
14252
+ },
14253
+
14251
14254
  'arrows'(c, r) {
14252
14255
  r.cond(modding)
14253
14256
  .remap({
@@ -14385,6 +14388,14 @@ function requireRules () {
14385
14388
  });
14386
14389
  },
14387
14390
 
14391
+ 'delete word'(c, r) {
14392
+ r.cond(modding)
14393
+ .remap({
14394
+ from: key(c.key),
14395
+ to: key('delete_or_backspace', 'option')
14396
+ });
14397
+ },
14398
+
14388
14399
  'edit'(c, r) {
14389
14400
  r.cond(modding)
14390
14401
  .remap({
@@ -14656,6 +14667,14 @@ function requireRules () {
14656
14667
  });
14657
14668
  },
14658
14669
 
14670
+ 'pipe'(c, r) {
14671
+ r.cond(modding)
14672
+ .remap({
14673
+ from: key(c.from),
14674
+ to: key(c.to)
14675
+ });
14676
+ },
14677
+
14659
14678
  'equal'(c, r) {
14660
14679
  r.cond(modding)
14661
14680
  .remap({
@@ -14672,6 +14691,14 @@ function requireRules () {
14672
14691
  });
14673
14692
  },
14674
14693
 
14694
+ 'underscore'(c, r) {
14695
+ r.cond(modding)
14696
+ .remap({
14697
+ from: key(c.from),
14698
+ to: key(c.to)
14699
+ });
14700
+ },
14701
+
14675
14702
  'custom'(c, r) {
14676
14703
  if (!c.rules.length) return;
14677
14704
  r.cond(modding);
@@ -14745,9 +14772,7 @@ function requireRules () {
14745
14772
 
14746
14773
  rules_1 = rules;
14747
14774
  return rules_1;
14748
- }
14749
-
14750
- var hasRequiredMain;
14775
+ }var hasRequiredMain;
14751
14776
 
14752
14777
  function requireMain () {
14753
14778
  if (hasRequiredMain) return main$1;
@@ -14755,13 +14780,12 @@ function requireMain () {
14755
14780
  const {env, cwd, stdin, stdout} = require$$0$1;
14756
14781
  const {spawnSync: spawn} = require$$1;
14757
14782
  const fs = require$$3;
14758
- const path = require$$5;
14783
+ const path = require$$3$1;
14759
14784
  const readline = require$$4$1;
14760
14785
 
14761
14786
  const {Command, Argument} = requireCommander();
14762
14787
  const yaml = require$$6;
14763
- const {merge, isEmpty} = requireBundle$2();
14764
- const {io} = requireBundle$1();
14788
+ const {io, merge, isEmpty} = requireAmekusa_util();
14765
14789
  const {
14766
14790
  RuleSet, Config,
14767
14791
  if_app, unless_app,
@@ -14796,9 +14820,9 @@ function requireMain () {
14796
14820
  *
14797
14821
  */
14798
14822
 
14799
- const pkg = require$$10;
14823
+ const pkg = require$$9;
14800
14824
  const rules = requireRules();
14801
- const defaultsYML = "# === KEYCOMFORT CONFIG ===\n# NOTE:\n# 0 means \"No\"\n# 1 means \"Yes\"\n\npaths:\n karabiner:\n save_as: ~/.config/karabiner/assets/complex_modifications/keycomfort.json\n apply_to: ~/.config/karabiner/karabiner.json\n ahk:\n save_as: ~/Desktop/keycomfort.ahk\n apply_to:\n\nvim_like: 0 # prefer vim-like mappings?\n\nrules: # mapping rules\n\n modifier:\n desc: Use [key] as a special modifier key (Required)\n enable: 1\n key: spacebar\n alone: spacebar\n\n cancel modifier:\n desc: Cancel modifier (<modifier>) with [key]\n enable: 1\n key: left_shift\n\n arrows:\n desc: <modifier> + [up]/[right]/[down]/[left] = Up/Right/Down/Left\n enable: 1\n up: e\n right: f\n down: d\n left: s\n\n page up/down:\n desc: <modifier> + [up]/[down] = Page Up/Down\n enable: 1\n up: w\n down: r\n\n prev/next word:\n desc: <modifier> + [prev]/[next] = Prev/Next Word\n enable: 1\n prev: a\n next: g\n apps:\n sonicpi: 1\n others: 1\n\n line start/end:\n desc: <modifier> + [start]/[end] = Line Start/End\n enable: 1\n start: q\n end: t\n apps:\n terminal: 1\n sonicpi: 1\n others: 1\n\n select:\n desc: <modifier> + [up]/[right]/[down]/[left] = Select Up/Right/Down/Left\n enable: 1\n up: i\n right: l\n down: k\n left: j\n\n vim:\n left: h\n down: j\n up: k\n right: l\n\n indent/outdent:\n desc: <modifier> + [indent]/[outdent] = Indent/Outdent\n enable: 1\n indent: o\n outdent: u\n\n backspace/delete:\n desc: <modifier> + [backspace]/[delete] = Backspace/Delete\n enable: 1\n backspace: n\n delete: m\n\n edit:\n desc: <modifier> + [undo]/[cut]/[copy]/[paste] = Undo/Cut/Copy/Paste\n enable: 1\n undo: z\n cut: x\n copy: c\n paste: v\n\n delete line:\n desc: <modifier> + [key] = Delete Line\n enable: 1\n key: shift + m\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n insert line:\n desc: <modifier> + [key] = New Line Below\n enable: 1\n key: return_or_enter\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n move line:\n desc: <modifier> + [up]/[down] = Move Line Up/Down\n enable: 1\n up: comma\n down: period\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n sonicpi: 1\n\n left/right tab:\n desc: <modifier> + [left]/[right] = Left/Right Tab\n enable: 1\n left: 2\n right: 3\n apps:\n vscode: 1\n eclipse: 1\n others: 1\n\n close/open tab:\n desc: <modifier> + [close]/[open] = Close/Open Tab\n enable: 1\n close: 1\n open: 4\n\n numpad:\n desc: <modifier> + [trigger] = Numpad Mode ([num1]=1, [num5]=5, [num9]=9)\n enable: 1\n trigger: left_control\n\n num0: b\n num1: n\n num2: m\n num3: comma\n\n num4: j\n num5: k\n num6: l\n\n num7: u\n num8: i\n num9: o\n\n slash: 8\n asterisk: 9\n hyphen: 0\n plus: p\n\n enter: slash\n delete: semicolon\n backspace: h\n\n plus/minus:\n desc: <modifier> + [plus]/[minus] = Plus/Minus\n enable: 1\n plus: p\n minus: shift + p\n to:\n plus: shift + equal_sign\n minus: hyphen\n\n backslash:\n desc: <modifier> + [from] = Backslash\n enable: 1\n from: slash\n to: backslash\n\n backtick:\n desc: <modifier> + [from] = Backtick\n enable: 1\n from: quote\n to: grave_accent_and_tilde\n\n tilde:\n desc: <modifier> + [from] = Tilde\n enable: 1\n from: hyphen\n to: shift + grave_accent_and_tilde\n\n pipe:\n desc: <modifier> + [from] = Pipe\n enable: 1\n from: 7\n to: shift + backslash\n\n equal:\n desc: <modifier> + [from] = Equal Sign\n enable: 1\n from: semicolon\n to: equal_sign\n\n enter:\n desc: <modifier> + [from] = Enter\n enable: 1\n from: tab\n to: return_or_enter\n\n custom:\n desc: <modifier> + Custom Keys\n enable: 1\n rules:\n # Examples\n # - from: p\n # to: shift + equal_sign\n\n remap capslock:\n desc: Caps Lock = [to]/[alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap l-control:\n desc: Left Control = [to]/[alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap r-control:\n desc: Right Control = [to]/[alone]\n enable: 0\n to: right_control\n alone: escape\n\n remap l-command:\n desc: Left Command = [to]/[alone]\n enable: 0\n to: left_command\n alone: left_command\n\n remap r-command:\n desc: Right Command = [to]/[alone]\n enable: 0\n to: right_command\n alone: right_command\n\n remap l-shift:\n desc: Left Shift = [to]/[alone]\n enable: 0\n to: left_shift\n alone: left_shift\n\n remap r-shift:\n desc: Right Shift = [to]/[alone]\n enable: 0\n to: right_shift\n alone: right_shift\n\n\napps:\n others:\n enable: 1\n\n login:\n enable: 1\n id:\n - com.apple.loginwindow\n\n terminal:\n enable: 1\n id:\n - com.apple.Terminal\n - com.googlecode.iterm2\n - org.alacritty\n exe:\n - cmd.exe\n\n vscode:\n enable: 0\n id:\n - com.microsoft.VSCode\n - com.vscodium\n exe:\n - Code.exe\n\n atom:\n enable: 0\n id:\n - com.github.atom\n - dev.pulsar-edit.pulsar\n\n eclipse:\n enable: 0\n id:\n - org.eclipse.platform.ide\n exe:\n - eclipse.exe\n\n sonicpi:\n enable: 0\n id:\n - net.sonic-pi.app\n\n\nkey_labels: # display names for key codes\n spacebar: Space\n return_or_enter: Enter\n grave_accent_and_tilde: Backtick\n japanese_eisuu: 英数\n japanese_kana: かな\n\n";
14825
+ const defaultsYML = "# === KEYCOMFORT CONFIG ===\n# NOTE:\n# 0 means \"No\"\n# 1 means \"Yes\"\n\npaths:\n karabiner:\n save_as: ~/.config/karabiner/assets/complex_modifications/keycomfort.json\n apply_to: ~/.config/karabiner/karabiner.json\n ahk:\n save_as: ~/Desktop/keycomfort.ahk\n apply_to:\n\nvim_like: 0 # prefer vim-like mappings?\n\nrules: # mapping rules\n\n modifier:\n desc: Use [key] as a special modifier key (Required)\n enable: 1\n key: spacebar\n alone: spacebar\n\n cancel modifier:\n desc: Cancel modifier (<modifier>) with [key]\n enable: 1\n key: left_shift\n\n disable modifier:\n desc: Disable modifier (<modifier>) with <modifier> + [key]\n enable: 1\n key: right_shift + escape\n\n enable modifier:\n desc: Enable modifier (<modifier>) with [key]\n enable: 1\n key: right_shift + escape\n\n arrows:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Up / Right / Down / Left\n enable: 1\n up: e\n right: f\n down: d\n left: s\n\n page up/down:\n desc: <modifier> + { [up] / [down] } = Page Up / Down\n enable: 1\n up: w\n down: r\n\n prev/next word:\n desc: <modifier> + { [prev] / [next] } = Prev / Next Word\n enable: 1\n prev: a\n next: g\n apps:\n sonicpi: 1\n others: 1\n\n line start/end:\n desc: <modifier> + { [start] / [end] } = Line Start / End\n enable: 1\n start: q\n end: t\n apps:\n terminal: 1\n sonicpi: 1\n others: 1\n\n select:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Select Up / Right / Down / Left\n enable: 1\n up: i\n right: l\n down: k\n left: j\n vim:\n left: h\n down: j\n up: k\n right: l\n\n indent/outdent:\n desc: <modifier> + { [indent] / [outdent] } = Indent / Outdent\n enable: 1\n indent: o\n outdent: u\n\n backspace/delete:\n desc: <modifier> + { [backspace] / [delete] } = Backspace / Delete\n enable: 1\n backspace: n\n delete: m\n\n delete word:\n desc: <modifier> + [key] = Delete Word\n enable: 1\n key: b\n\n edit:\n desc: <modifier> + { [undo] / [cut] / [copy] / [paste] } = Undo / Cut / Copy / Paste\n enable: 1\n undo: z\n cut: x\n copy: c\n paste: v\n\n delete line:\n desc: <modifier> + [key] = Delete Line\n enable: 1\n key: shift + m\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n insert line:\n desc: <modifier> + [key] = New Line Below\n enable: 1\n key: return_or_enter\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n move line:\n desc: <modifier> + { [up] / [down] } = Move Line Up / Down\n enable: 1\n up: shift + i\n down: shift + k\n vim:\n up: shift + k\n down: shift + j\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n sonicpi: 1\n\n left/right tab:\n desc: <modifier> + { [left] / [right] } = Left / Right Tab\n enable: 1\n left: 2\n right: 3\n apps:\n vscode: 1\n eclipse: 1\n others: 1\n\n close/open tab:\n desc: <modifier> + { [close] / [open] } = Close / Open Tab\n enable: 1\n close: 1\n open: 4\n\n numpad:\n desc: <modifier> + [trigger] = Numpad Mode ([num1]=1, [num5]=5, [num9]=9)\n enable: 1\n trigger: left_control\n\n num0: b\n num1: n\n num2: m\n num3: comma\n\n num4: j\n num5: k\n num6: l\n\n num7: u\n num8: i\n num9: o\n\n slash: 8\n asterisk: 9\n hyphen: 0\n plus: p\n\n enter: slash\n delete: semicolon\n backspace: h\n\n plus/minus:\n desc: <modifier> + { [plus] / [minus] } = Plus / Minus\n enable: 1\n plus: p\n minus: shift + p\n to:\n plus: shift + equal_sign\n minus: hyphen\n\n backslash:\n desc: <modifier> + [from] = Backslash\n enable: 1\n from: slash\n to: backslash\n\n backtick:\n desc: <modifier> + [from] = Backtick\n enable: 1\n from: quote\n to: grave_accent_and_tilde\n\n tilde:\n desc: <modifier> + [from] = Tilde\n enable: 1\n from: hyphen\n to: shift + grave_accent_and_tilde\n\n pipe:\n desc: <modifier> + [from] = Pipe\n enable: 1\n from: 7\n to: shift + backslash\n\n equal:\n desc: <modifier> + [from] = Equal Sign\n enable: 1\n from: semicolon\n to: equal_sign\n\n enter:\n desc: <modifier> + [from] = Enter\n enable: 1\n from: tab\n to: return_or_enter\n\n underscore:\n desc: <modifier> + [from] = Underscore\n enable: 1\n from: period\n to: shift + hyphen\n\n custom:\n desc: <modifier> + Custom Keys\n enable: 1\n rules:\n # Examples\n # - from: p\n # to: shift + equal_sign\n\n remap capslock:\n desc: Caps Lock = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap l-control:\n desc: Left Control = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap r-control:\n desc: Right Control = [to] / [alone]\n enable: 0\n to: right_control\n alone: escape\n\n remap l-command:\n desc: Left Command = [to] / [alone]\n enable: 0\n to: left_command\n alone: left_command\n\n remap r-command:\n desc: Right Command = [to] / [alone]\n enable: 0\n to: right_command\n alone: right_command\n\n remap l-shift:\n desc: Left Shift = [to] / [alone]\n enable: 0\n to: left_shift\n alone: left_shift\n\n remap r-shift:\n desc: Right Shift = [to] / [alone]\n enable: 0\n to: right_shift\n alone: right_shift\n\n\napps:\n others:\n enable: 1\n\n login:\n enable: 1\n id:\n - com.apple.loginwindow\n\n terminal:\n enable: 1\n id:\n - com.apple.Terminal\n - com.googlecode.iterm2\n - org.alacritty\n exe:\n - cmd.exe\n\n vscode:\n enable: 0\n id:\n - com.microsoft.VSCode\n - com.vscodium\n exe:\n - Code.exe\n\n atom:\n enable: 0\n id:\n - com.github.atom\n - dev.pulsar-edit.pulsar\n\n eclipse:\n enable: 0\n id:\n - org.eclipse.platform.ide\n exe:\n - eclipse.exe\n\n sonicpi:\n enable: 0\n id:\n - net.sonic-pi.app\n\n\nkey_labels: # display names for key codes\n spacebar: Space\n return_or_enter: Enter\n grave_accent_and_tilde: Backtick\n japanese_eisuu: 英数\n japanese_kana: かな\n\n";
14802
14826
  const defaults = yaml.parse(defaultsYML);
14803
14827
  const defaultConfig = loc(io.home, '.config', 'keycomfort', 'config.yml');
14804
14828
 
@@ -14840,10 +14864,18 @@ function requireMain () {
14840
14864
  }
14841
14865
 
14842
14866
  function label(key, dict) {
14843
- if (Array.isArray(key)) return key.map(I => label(I, dict)).join(',');
14844
- key += '';
14867
+ if (Array.isArray(key)) return key.map(I => label(I.trim(), dict)).join(', ');
14868
+ key = `${key}`.trim();
14869
+ if (key.includes(',')) return label(key.split(','), dict);
14870
+ if (key.includes('+')) return key.split('+').map(I => label(I.trim(), dict)).join(' + ');
14845
14871
  if (key in dict) return dict[key];
14846
- return key.split('_').map(I => I.charAt(0).toUpperCase() + I.slice(1)).join(' ');
14872
+ let lr = ''; // left or right
14873
+ let m = key.match(/^(left|right)_([_a-z0-9]+)$/i);
14874
+ if (m) {
14875
+ lr = m[1] == 'left' ? 'L-' : 'R-';
14876
+ key = m[2];
14877
+ }
14878
+ return lr + key.split('_').map(I => I.charAt(0).toUpperCase() + I.slice(1)).join(' ');
14847
14879
  }
14848
14880
 
14849
14881
  const app = new Command();
@@ -14988,8 +15020,9 @@ function requireMain () {
14988
15020
  if (rc.vim && vim) rc = merge(rc, rc.vim);
14989
15021
 
14990
15022
  // format rule description
14991
- let desc = rc.desc.replaceAll('<modifier>', label(modifier, labels));
14992
- for (let i in rc) desc = desc.replaceAll(`[${i}]`, label(rc[i], labels));
15023
+ let desc = rc.desc.replaceAll(/(?:<modifier>|\[([_0-9a-z]+)\])/gi, (_, m1) => {
15024
+ return label(m1 ? rc[m1] : modifier, labels);
15025
+ });
14993
15026
 
14994
15027
  let rule = rules[i];
14995
15028
  let newRule;
@@ -15060,10 +15093,5 @@ function requireMain () {
15060
15093
 
15061
15094
  }
15062
15095
  return main$1;
15063
- }
15064
-
15065
- var mainExports = requireMain();
15066
- var main = /*@__PURE__*/getDefaultExportFromCjs(mainExports);
15067
-
15068
- module.exports = main;
15069
- //# sourceMappingURL=bundle.js.map
15096
+ }var mainExports = requireMain();
15097
+ var main = /*@__PURE__*/getDefaultExportFromCjs(mainExports);module.exports=main;