textbrowser 0.49.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index-es.js CHANGED
@@ -1,80 +1,3 @@
1
- function ownKeys$1(e, r) {
2
- var t = Object.keys(e);
3
- if (Object.getOwnPropertySymbols) {
4
- var o = Object.getOwnPropertySymbols(e);
5
- r && (o = o.filter(function (r) {
6
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
7
- })), t.push.apply(t, o);
8
- }
9
- return t;
10
- }
11
- function _objectSpread2$1(e) {
12
- for (var r = 1; r < arguments.length; r++) {
13
- var t = null != arguments[r] ? arguments[r] : {};
14
- r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) {
15
- _defineProperty$1(e, r, t[r]);
16
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) {
17
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
18
- });
19
- }
20
- return e;
21
- }
22
- function _defineProperty$1(obj, key, value) {
23
- key = _toPropertyKey$1(key);
24
- if (key in obj) {
25
- Object.defineProperty(obj, key, {
26
- value: value,
27
- enumerable: true,
28
- configurable: true,
29
- writable: true
30
- });
31
- } else {
32
- obj[key] = value;
33
- }
34
- return obj;
35
- }
36
- function _objectWithoutPropertiesLoose(source, excluded) {
37
- if (source == null) return {};
38
- var target = {};
39
- var sourceKeys = Object.keys(source);
40
- var key, i;
41
- for (i = 0; i < sourceKeys.length; i++) {
42
- key = sourceKeys[i];
43
- if (excluded.indexOf(key) >= 0) continue;
44
- target[key] = source[key];
45
- }
46
- return target;
47
- }
48
- function _objectWithoutProperties(source, excluded) {
49
- if (source == null) return {};
50
- var target = _objectWithoutPropertiesLoose(source, excluded);
51
- var key, i;
52
- if (Object.getOwnPropertySymbols) {
53
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
54
- for (i = 0; i < sourceSymbolKeys.length; i++) {
55
- key = sourceSymbolKeys[i];
56
- if (excluded.indexOf(key) >= 0) continue;
57
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
58
- target[key] = source[key];
59
- }
60
- }
61
- return target;
62
- }
63
- function _toPrimitive$1(input, hint) {
64
- if (typeof input !== "object" || input === null) return input;
65
- var prim = input[Symbol.toPrimitive];
66
- if (prim !== undefined) {
67
- var res = prim.call(input, hint || "default");
68
- if (typeof res !== "object") return res;
69
- throw new TypeError("@@toPrimitive must return a primitive value.");
70
- }
71
- return (hint === "string" ? String : Number)(input);
72
- }
73
- function _toPropertyKey$1(arg) {
74
- var key = _toPrimitive$1(arg, "string");
75
- return typeof key === "symbol" ? key : String(key);
76
- }
77
-
78
1
  /* eslint-disable node/no-unsupported-features/es-syntax */
79
2
 
80
3
  /**
@@ -91,9 +14,6 @@ function _toPropertyKey$1(arg) {
91
14
  * @returns {getJSONCallback}
92
15
  */
93
16
  function _await$2$1(value, then, direct) {
94
- if (direct) {
95
- return then ? then(value) : value;
96
- }
97
17
  if (!value || !value.then) {
98
18
  value = Promise.resolve(value);
99
19
  }
@@ -180,9 +100,6 @@ function buildGetJSONWithFetch({
180
100
  };
181
101
  }
182
102
  function _await$1$1(value, then, direct) {
183
- if (direct) {
184
- return then ? then(value) : value;
185
- }
186
103
  if (!value || !value.then) {
187
104
  value = Promise.resolve(value);
188
105
  }
@@ -258,9 +175,6 @@ function getDirectoryForURL(url) {
258
175
  /* eslint-disable node/no-unsupported-features/es-syntax */
259
176
 
260
177
  function _await$3(value, then, direct) {
261
- if (direct) {
262
- return then ? then(value) : value;
263
- }
264
178
  if (!value || !value.then) {
265
179
  value = Promise.resolve(value);
266
180
  }
@@ -282,9 +196,6 @@ function _invoke$2(body, then) {
282
196
  return then(result);
283
197
  }
284
198
  function _call(body, then, direct) {
285
- if (direct) {
286
- return then ? then(body()) : body();
287
- }
288
199
  try {
289
200
  var result = Promise.resolve(body());
290
201
  return then ? result.then(then) : result;
@@ -373,7 +284,6 @@ function buildGetJSON({
373
284
  });
374
285
  });
375
286
  });
376
-
377
287
  const ret = buildGetJSONWithFetch({
378
288
  fetch: _fetch
379
289
  });
@@ -790,7 +700,6 @@ function generateUUID() {
790
700
  if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
791
701
  d += performance.now(); // use high-precision timer if available
792
702
  }
793
-
794
703
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
795
704
  /* eslint-disable no-bitwise */
796
705
  var r = Math.trunc((d + Math.random() * 16) % 16);
@@ -1052,7 +961,7 @@ var defaultAllSubstitutions = function defaultAllSubstitutions(_ref2) {
1052
961
  type: 'DATERANGE',
1053
962
  options: extraOpts
1054
963
  }));
1055
- return dtf.formatRange.apply(dtf, _toConsumableArray$1( /** @type {[Date, Date]} */
964
+ return dtf.formatRange.apply(dtf, _toConsumableArray$1(/** @type {[Date, Date]} */
1056
965
  [/** @type {number|Date} */
1057
966
  value, /** @type {Date} */
1058
967
  opts].map(function (val) {
@@ -1063,12 +972,11 @@ var defaultAllSubstitutions = function defaultAllSubstitutions(_ref2) {
1063
972
  case 'language':
1064
973
  case 'script':
1065
974
  case 'currency':
1066
- return (/** @type {string} */new Intl.DisplayNames(locale, _objectSpread2(_objectSpread2({}, applyArgs({
1067
- type: singleKey.toUpperCase()
1068
- })), {}, {
1069
- type: singleKey
1070
- })).of( /** @type {string} */value)
1071
- );
975
+ return /** @type {string} */new Intl.DisplayNames(locale, _objectSpread2(_objectSpread2({}, applyArgs({
976
+ type: singleKey.toUpperCase()
977
+ })), {}, {
978
+ type: singleKey
979
+ })).of(/** @type {string} */value);
1072
980
  case 'relative':
1073
981
  // The second argument actually contains the primary options, so swap
1074
982
  // eslint-disable-next-line max-len -- Long
@@ -1078,12 +986,12 @@ var defaultAllSubstitutions = function defaultAllSubstitutions(_ref2) {
1078
986
  opts = _ref4[1];
1079
987
  return new Intl.RelativeTimeFormat(locale, applyArgs({
1080
988
  type: 'RELATIVE'
1081
- })).format( /** @type {number} */value, extraOpts);
989
+ })).format(/** @type {number} */value, extraOpts);
1082
990
 
1083
991
  // ListFormat (with Collator)
1084
992
  case 'list':
1085
993
  if (callback) {
1086
- return sortList( /** @type {string} */locale, /** @type {string[]} */
994
+ return sortList(/** @type {string} */locale, /** @type {string[]} */
1087
995
  value, callback, applyArgs({
1088
996
  type: 'LIST'
1089
997
  }), applyArgs({
@@ -1092,7 +1000,7 @@ var defaultAllSubstitutions = function defaultAllSubstitutions(_ref2) {
1092
1000
  checkArgOptions: true
1093
1001
  }));
1094
1002
  }
1095
- return sortList( /** @type {string} */locale, /** @type {string[]} */
1003
+ return sortList(/** @type {string} */locale, /** @type {string[]} */
1096
1004
  value, applyArgs({
1097
1005
  type: 'LIST'
1098
1006
  }), applyArgs({
@@ -1106,7 +1014,7 @@ var defaultAllSubstitutions = function defaultAllSubstitutions(_ref2) {
1106
1014
 
1107
1015
  // Dates
1108
1016
  if (value) {
1109
- if (typeof value === 'number' && (expectsDatetime || /^DATE(?:TIME)(?:\||$)/.test( /** @type {string} */arg))) {
1017
+ if (typeof value === 'number' && (expectsDatetime || /^DATE(?:TIME)(?:\||$)/.test(/** @type {string} */arg))) {
1110
1018
  value = new Date(value);
1111
1019
  }
1112
1020
  if (_typeof$1(value) === 'object' && 'getTime' in value && typeof value.getTime === 'function') {
@@ -1124,7 +1032,7 @@ var defaultAllSubstitutions = function defaultAllSubstitutions(_ref2) {
1124
1032
  return (_Intl$DateTimeFormat = new Intl.DateTimeFormat(locale, applyArgs({
1125
1033
  type: 'DATERANGE',
1126
1034
  options: _extraOpts2
1127
- }))).formatRange.apply(_Intl$DateTimeFormat, _toConsumableArray$1( /** @type {[Date, Date]} */
1035
+ }))).formatRange.apply(_Intl$DateTimeFormat, _toConsumableArray$1(/** @type {[Date, Date]} */
1128
1036
  value.slice(0, 2).map(function (val) {
1129
1037
  return typeof val === 'number' ? new Date(val) : val;
1130
1038
  })));
@@ -1217,28 +1125,27 @@ var LocalFormatter = /*#__PURE__*/function (_Formatter) {
1217
1125
  var components = key.slice(1).split('.');
1218
1126
  /** @type {import('./getMessageForKeyByStyle.js').LocaleBody} */
1219
1127
  var parent = this.locals;
1220
- return (/** @type {typeof LocalFormatter} */this.constructor.isMatchingKey(key) && components.every(function (cmpt) {
1221
- var result = (cmpt in parent);
1222
- parent =
1223
- /**
1224
- * @type {import('./defaultLocaleResolver.js').
1225
- * RichNestedLocaleStringBodyObject|
1226
- * import('./defaultLocaleResolver.js').
1227
- * PlainNestedLocaleStringBodyObject|
1228
- * import('./defaultLocaleResolver.js').RichLocaleStringSubObject
1229
- * }
1230
- */
1231
- /**
1232
- * @type {import('./defaultLocaleResolver.js').
1233
- * RichNestedLocaleStringBodyObject|
1234
- * import('./defaultLocaleResolver.js').
1235
- * PlainNestedLocaleStringBodyObject
1236
- * }
1237
- */
1238
- parent[cmpt];
1239
- return result;
1240
- })
1241
- );
1128
+ return /** @type {typeof LocalFormatter} */this.constructor.isMatchingKey(key) && components.every(function (cmpt) {
1129
+ var result = cmpt in parent;
1130
+ parent =
1131
+ /**
1132
+ * @type {import('./defaultLocaleResolver.js').
1133
+ * RichNestedLocaleStringBodyObject|
1134
+ * import('./defaultLocaleResolver.js').
1135
+ * PlainNestedLocaleStringBodyObject|
1136
+ * import('./defaultLocaleResolver.js').RichLocaleStringSubObject
1137
+ * }
1138
+ */
1139
+ /**
1140
+ * @type {import('./defaultLocaleResolver.js').
1141
+ * RichNestedLocaleStringBodyObject|
1142
+ * import('./defaultLocaleResolver.js').
1143
+ * PlainNestedLocaleStringBodyObject
1144
+ * }
1145
+ */
1146
+ parent[cmpt];
1147
+ return result;
1148
+ });
1242
1149
  }
1243
1150
  /**
1244
1151
  * @param {string} key
@@ -1277,8 +1184,7 @@ var RegularFormatter = /*#__PURE__*/function (_Formatter2) {
1277
1184
  _createClass(RegularFormatter, [{
1278
1185
  key: "isMatch",
1279
1186
  value: function isMatch(key) {
1280
- return (/** @type {typeof RegularFormatter} */this.constructor.isMatchingKey(key) && key in this.substitutions
1281
- );
1187
+ return /** @type {typeof RegularFormatter} */this.constructor.isMatchingKey(key) && key in this.substitutions;
1282
1188
  }
1283
1189
  /**
1284
1190
  * @param {string} key
@@ -1422,11 +1328,11 @@ var SwitchFormatter = /*#__PURE__*/function (_Formatter3) {
1422
1328
  // eslint-disable-next-line default-case
1423
1329
  switch (type) {
1424
1330
  case 'NUMBER':
1425
- match = getNumberFormat( /** @type {number} */value, /** @type {Intl.NumberFormatOptions} */
1331
+ match = getNumberFormat(/** @type {number} */value, /** @type {Intl.NumberFormatOptions} */
1426
1332
  options);
1427
1333
  break;
1428
1334
  case 'PLURAL':
1429
- match = getPluralFormat( /** @type {number} */value, /** @type {Intl.PluralRulesOptions} */
1335
+ match = getPluralFormat(/** @type {number} */value, /** @type {Intl.PluralRulesOptions} */
1430
1336
  options);
1431
1337
  break;
1432
1338
  }
@@ -1447,7 +1353,7 @@ var SwitchFormatter = /*#__PURE__*/function (_Formatter3) {
1447
1353
  try {
1448
1354
  return _getSubstitution({
1449
1355
  messageStyle: messageStyle,
1450
- key: match ? preventNesting( /** @type {string} */match) : arg,
1356
+ key: match ? preventNesting(/** @type {string} */match) : arg,
1451
1357
  body: body,
1452
1358
  type: 'switch'
1453
1359
  });
@@ -1455,7 +1361,7 @@ var SwitchFormatter = /*#__PURE__*/function (_Formatter3) {
1455
1361
  try {
1456
1362
  return _getSubstitution({
1457
1363
  messageStyle: messageStyle,
1458
- key: '*' + preventNesting( /** @type {string} */match),
1364
+ key: '*' + preventNesting(/** @type {string} */match),
1459
1365
  body: body,
1460
1366
  type: 'switch'
1461
1367
  });
@@ -1535,8 +1441,7 @@ var SwitchFormatter = /*#__PURE__*/function (_Formatter3) {
1535
1441
  });
1536
1442
  return ret ? [].concat(_toConsumableArray$1(ret), [k]) : [];
1537
1443
  }, this.switches);
1538
- return (/** @type {SwitchMatch} */returnValue
1539
- );
1444
+ return /** @type {SwitchMatch} */returnValue;
1540
1445
  }
1541
1446
 
1542
1447
  /**
@@ -1556,8 +1461,7 @@ var SwitchFormatter = /*#__PURE__*/function (_Formatter3) {
1556
1461
  key: "getKey",
1557
1462
  value: function getKey(key) {
1558
1463
  var match = key.match(/^(?:[\0-\{\}-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*/);
1559
- return (/** @type {string} */match && match[0]
1560
- );
1464
+ return /** @type {string} */match && match[0];
1561
1465
  }
1562
1466
  }]);
1563
1467
  return SwitchFormatter;
@@ -1597,9 +1501,6 @@ promiseChainForValues(['a', 'b', 'c'], (val) => {
1597
1501
  */
1598
1502
 
1599
1503
  function _await$2(value, then, direct) {
1600
- if (direct) {
1601
- return then ? then(value) : value;
1602
- }
1603
1504
  if (!value || !value.then) {
1604
1505
  value = Promise.resolve(value);
1605
1506
  }
@@ -1703,13 +1604,7 @@ function _for(test, update, body) {
1703
1604
  break;
1704
1605
  }
1705
1606
  }
1706
- if (update) {
1707
- var updateValue = update();
1708
- if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
1709
- stage = 2;
1710
- break;
1711
- }
1712
- }
1607
+ var updateValue;
1713
1608
  }
1714
1609
  var pact = new _Pact();
1715
1610
  var reject = _settle.bind(null, pact, 2);
@@ -1718,13 +1613,6 @@ function _for(test, update, body) {
1718
1613
  function _resumeAfterBody(value) {
1719
1614
  result = value;
1720
1615
  do {
1721
- if (update) {
1722
- updateValue = update();
1723
- if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
1724
- updateValue.then(_resumeAfterUpdate).then(void 0, reject);
1725
- return;
1726
- }
1727
- }
1728
1616
  shouldContinue = test();
1729
1617
  if (!shouldContinue || _isSettledPact(shouldContinue) && !shouldContinue.v) {
1730
1618
  _settle(pact, 1, result);
@@ -2135,9 +2023,9 @@ var defaultInsertNodes = function defaultInsertNodes(_ref) {
2135
2023
  });
2136
2024
  };
2137
2025
  addFunctionKeys();
2138
- var localFormatter = new LocalFormatter( /** @type {import('./getMessageForKeyByStyle.js').LocalObject} */locals);
2026
+ var localFormatter = new LocalFormatter(/** @type {import('./getMessageForKeyByStyle.js').LocalObject} */locals);
2139
2027
  var regularFormatter = new RegularFormatter(substitutions);
2140
- var switchFormatter = new SwitchFormatter( /** @type {import('./defaultLocaleResolver.js').Switches} */
2028
+ var switchFormatter = new SwitchFormatter(/** @type {import('./defaultLocaleResolver.js').Switches} */
2141
2029
  switches, {
2142
2030
  substitutions: substitutions
2143
2031
  });
@@ -2227,8 +2115,7 @@ var defaultInsertNodes = function defaultInsertNodes(_ref) {
2227
2115
  }
2228
2116
 
2229
2117
  // Change this and return type if other substitutions possible
2230
- return (/** @type {string|Node} */substitution
2231
- );
2118
+ return /** @type {string|Node} */substitution;
2232
2119
  };
2233
2120
  var recursiveLocalCount = 1;
2234
2121
  /**
@@ -2251,7 +2138,7 @@ var defaultInsertNodes = function defaultInsertNodes(_ref) {
2251
2138
  if (recursiveLocalCount++ > maximumLocalNestingDepth) {
2252
2139
  throw new TypeError('Too much recursion in local variables.');
2253
2140
  }
2254
- if ( /** @type {typeof import('./Formatter.js').LocalFormatter} */localFormatter.constructor.isMatchingKey(ky)) {
2141
+ if (/** @type {typeof import('./Formatter.js').LocalFormatter} */localFormatter.constructor.isMatchingKey(ky)) {
2255
2142
  var extraSubsts = substitutions;
2256
2143
  var localFormatters;
2257
2144
  if (arg) {
@@ -2268,7 +2155,7 @@ var defaultInsertNodes = function defaultInsertNodes(_ref) {
2268
2155
  substitutions: localFormatters
2269
2156
  });
2270
2157
  }
2271
- } else if ( /** @type {typeof import('./Formatter.js').SwitchFormatter} */
2158
+ } else if (/** @type {typeof import('./Formatter.js').SwitchFormatter} */
2272
2159
  switchFormatter.constructor.isMatchingKey(ky)) {
2273
2160
  subst = processSubsts({
2274
2161
  str: substitution
@@ -2397,7 +2284,7 @@ var defaultInsertNodes = function defaultInsertNodes(_ref) {
2397
2284
  push(substitution.cloneNode(true));
2398
2285
  } else {
2399
2286
  // Why no number here?
2400
- push( /** @type {string} */substitution);
2287
+ push(/** @type {string} */substitution);
2401
2288
  }
2402
2289
  }
2403
2290
  usedKeys.push(ky);
@@ -2440,7 +2327,7 @@ function defaultKeyCheckerConverter(key, messageStyle) {
2440
2327
  return typeof k === 'string';
2441
2328
  }) && typeof messageStyle === 'string' && messageStyle.endsWith('Nested')) {
2442
2329
  return key.map(function (k) {
2443
- return k.replace( /*#__PURE__*/_wrapRegExp(/(\\+)/g, {
2330
+ return k.replace(/*#__PURE__*/_wrapRegExp(/(\\+)/g, {
2444
2331
  backslashes: 1
2445
2332
  }), '\\$<backslashes>').replace(/\./g, '\\.');
2446
2333
  }).join('.');
@@ -2753,7 +2640,6 @@ var getDOMForLocaleString = function getDOMForLocaleString(_ref) {
2753
2640
  locale = _ref.locale,
2754
2641
  locals = _ref.locals,
2755
2642
  switches = _ref.switches;
2756
- _ref.maximumLocalNestingDepth;
2757
2643
  var _ref$allSubstitutions = _ref.allSubstitutions,
2758
2644
  allSubstitutions = _ref$allSubstitutions === void 0 ? [defaultAllSubstitutions] : _ref$allSubstitutions,
2759
2645
  _ref$insertNodes = _ref.insertNodes,
@@ -2846,9 +2732,6 @@ var getDOMForLocaleString = function getDOMForLocaleString(_ref) {
2846
2732
  return container;
2847
2733
  };
2848
2734
  function _await$1(value, then, direct) {
2849
- if (direct) {
2850
- return then ? then(value) : value;
2851
- }
2852
2735
  if (!value || !value.then) {
2853
2736
  value = Promise.resolve(value);
2854
2737
  }
@@ -2936,14 +2819,13 @@ var findLocaleStrings = function findLocaleStrings() {
2936
2819
  localeResolver = _ref2.localeResolver,
2937
2820
  localesBasePath = _ref2.localesBasePath,
2938
2821
  localeMatcher = _ref2.localeMatcher;
2939
- return (/** @type {Promise<LocaleObjectInfo>} */_findLocale({
2940
- locales: locales,
2941
- defaultLocales: defaultLocales,
2942
- localeResolver: localeResolver,
2943
- localesBasePath: localesBasePath,
2944
- localeMatcher: localeMatcher
2945
- })
2946
- );
2822
+ return /** @type {Promise<LocaleObjectInfo>} */_findLocale({
2823
+ locales: locales,
2824
+ defaultLocales: defaultLocales,
2825
+ localeResolver: localeResolver,
2826
+ localesBasePath: localesBasePath,
2827
+ localeMatcher: localeMatcher
2828
+ });
2947
2829
  };
2948
2830
 
2949
2831
  /**
@@ -2989,10 +2871,10 @@ var _findLocale = _async(function (_ref4) {
2989
2871
  });
2990
2872
  });
2991
2873
  }, function (err) {
2992
- if ( /** @type {Error} */err.name === 'SyntaxError') {
2874
+ if (/** @type {Error} */err.name === 'SyntaxError') {
2993
2875
  throw err;
2994
2876
  }
2995
- return _await$1( /** @type {LocaleMatcher} */localeMatcher(locale), getLocale);
2877
+ return _await$1(/** @type {LocaleMatcher} */localeMatcher(locale), getLocale);
2996
2878
  });
2997
2879
  });
2998
2880
  var _ref4$locales = _ref4.locales,
@@ -3056,9 +2938,6 @@ var _findLocale = _async(function (_ref4) {
3056
2938
  */
3057
2939
 
3058
2940
  function _await(value, then, direct) {
3059
- if (direct) {
3060
- return then ? then(value) : value;
3061
- }
3062
2941
  if (!value || !value.then) {
3063
2942
  value = Promise.resolve(value);
3064
2943
  }
@@ -3266,6 +3145,24 @@ var i18n = function i18n() {
3266
3145
  }
3267
3146
  };
3268
3147
 
3148
+ /**
3149
+ * @param {string|string[]} stylesheets
3150
+ * @param {{
3151
+ * before?: HTMLElement,
3152
+ * after?: HTMLElement,
3153
+ * favicon?: boolean,
3154
+ * image?: boolean,
3155
+ * canvas?: boolean,
3156
+ * acceptErrors?: boolean|((info: {
3157
+ * error: ErrorEvent,
3158
+ * stylesheetURL: string,
3159
+ * options: {},
3160
+ * resolve: (value: any) => void,
3161
+ * reject: (reason?: any) => void
3162
+ * }) => (reason?: any) => void)
3163
+ * }} cfg
3164
+ * @returns {Promise<HTMLLinkElement[]>}
3165
+ */
3269
3166
  function loadStylesheets(stylesheets, {
3270
3167
  before: beforeDefault,
3271
3168
  after: afterDefault,
@@ -3275,10 +3172,31 @@ function loadStylesheets(stylesheets, {
3275
3172
  acceptErrors
3276
3173
  } = {}) {
3277
3174
  stylesheets = Array.isArray(stylesheets) ? stylesheets : [stylesheets];
3278
- function setupLink(stylesheetURL) {
3175
+
3176
+ /**
3177
+ * @typedef {{
3178
+ * before?: HTMLElement,
3179
+ * after?: HTMLElement,
3180
+ * favicon?: boolean,
3181
+ * image?: boolean,
3182
+ * canvas?: boolean,
3183
+ * }} Options
3184
+ */
3185
+
3186
+ /**
3187
+ * @param {string|[stylesheetURL: string, options: Options]} stylesheetURLInfo
3188
+ * @returns {Promise<HTMLLinkElement>}
3189
+ */
3190
+ function setupLink(stylesheetURLInfo) {
3191
+ /** @type {Options} */
3279
3192
  let options = {};
3280
- if (Array.isArray(stylesheetURL)) {
3281
- [stylesheetURL, options = {}] = stylesheetURL;
3193
+
3194
+ /** @type {string} */
3195
+ let stylesheetURL;
3196
+ if (Array.isArray(stylesheetURLInfo)) {
3197
+ [stylesheetURL, options = {}] = stylesheetURLInfo;
3198
+ } else {
3199
+ stylesheetURL = stylesheetURLInfo;
3282
3200
  }
3283
3201
  let {
3284
3202
  favicon = faviconDefault
@@ -3295,7 +3213,7 @@ function loadStylesheets(stylesheets, {
3295
3213
  } else if (after) {
3296
3214
  after.after(link);
3297
3215
  } else {
3298
- document.head.appendChild(link);
3216
+ document.head.append(link);
3299
3217
  }
3300
3218
  }
3301
3219
  const link = document.createElement('link');
@@ -3338,6 +3256,9 @@ function loadStylesheets(stylesheets, {
3338
3256
  reject(error);
3339
3257
  });
3340
3258
  img.addEventListener('load', () => {
3259
+ if (!context) {
3260
+ throw new Error('Canvas context could not be found');
3261
+ }
3341
3262
  context.drawImage(img, 0, 0);
3342
3263
  link.href = canvas ? cnv.toDataURL('image/x-icon') : stylesheetURL;
3343
3264
  addLink();
@@ -3789,14 +3710,15 @@ function deserialize(form, hash) {
3789
3710
  /**
3790
3711
  * @file Note that this should be kept as a polyglot client-server file.
3791
3712
  */
3792
- async function getLocaleFallbackResults({
3793
- $p,
3794
- lang,
3795
- langs,
3796
- langData,
3797
- fallbackLanguages,
3798
- basePath = ''
3799
- }) {
3713
+ async function getLocaleFallbackResults(_ref) {
3714
+ let {
3715
+ $p,
3716
+ lang,
3717
+ langs,
3718
+ langData,
3719
+ fallbackLanguages,
3720
+ basePath = ''
3721
+ } = _ref;
3800
3722
  const l = await i18n({
3801
3723
  messageStyle: 'plainNested',
3802
3724
  locales: lang,
@@ -3817,7 +3739,6 @@ async function getLocaleFallbackResults({
3817
3739
  return l;
3818
3740
  }
3819
3741
 
3820
- var _win;
3821
3742
  /*
3822
3743
  Possible todos:
3823
3744
  0. Add XSLT to JML-string stylesheet (or even vice versa)
@@ -3885,7 +3806,7 @@ if (typeof window !== 'undefined' && window) {
3885
3806
  }
3886
3807
 
3887
3808
  /* c8 ignore next */
3888
- let doc = typeof document !== 'undefined' && document || ((_win = win) === null || _win === void 0 ? void 0 : _win.document);
3809
+ let doc = typeof document !== 'undefined' && document || win?.document;
3889
3810
 
3890
3811
  // STATIC PROPERTIES
3891
3812
 
@@ -3894,7 +3815,6 @@ const possibleOptions = ['$plugins',
3894
3815
  // '$state', // Used internally
3895
3816
  '$map' // Add any other options here
3896
3817
  ];
3897
-
3898
3818
  const NS_HTML = 'http://www.w3.org/1999/xhtml',
3899
3819
  hyphenForCamelCase = /-([a-z])/gu;
3900
3820
  const ATTR_MAP = new Map([['maxlength', 'maxLength'], ['minlength', 'minLength'], ['readonly', 'readOnly']]);
@@ -4556,7 +4476,7 @@ function _DOMfromJMLOrString (childNodeJML) {
4556
4476
  * @returns {Promise<void>|string|null}
4557
4477
  */
4558
4478
  function checkPluginValue(elem, att, attVal, opts, state) {
4559
- opts.$state = state !== null && state !== void 0 ? state : 'attributeValue';
4479
+ opts.$state = state ?? 'attributeValue';
4560
4480
  if (attVal && typeof attVal === 'object') {
4561
4481
  const matchingPlugin = getMatchingPlugin(opts, Object.keys(attVal)[0]);
4562
4482
  if (matchingPlugin) {
@@ -4570,8 +4490,7 @@ function checkPluginValue(elem, att, attVal, opts, state) {
4570
4490
  });
4571
4491
  }
4572
4492
  }
4573
- return (/** @type {string} */attVal
4574
- );
4493
+ return /** @type {string} */attVal;
4575
4494
  }
4576
4495
 
4577
4496
  /**
@@ -4585,15 +4504,27 @@ function getMatchingPlugin(opts, pluginName) {
4585
4504
  });
4586
4505
  }
4587
4506
 
4507
+ /* eslint-disable jsdoc/valid-types -- pratt parser bug */
4508
+ /**
4509
+ * @template T
4510
+ * @typedef {T[keyof T]} ValueOf
4511
+ */
4512
+ /* eslint-enable jsdoc/valid-types -- pratt parser bug */
4513
+
4514
+ /* eslint-disable jsdoc/valid-types -- pratt parser bug */
4588
4515
  /**
4589
4516
  * Creates an XHTML or HTML element (XHTML is preferred, but only in browsers
4590
4517
  * that support); any element after element can be omitted, and any subsequent
4591
4518
  * type or types added afterwards.
4592
- * @param {JamilihArray} args
4593
- * @returns {JamilihReturn} The newly created (and possibly already appended)
4519
+ * @template {JamilihArray} T
4520
+ * @param {T} args
4521
+ * @returns {T extends [keyof HTMLElementTagNameMap, any?, any?, any?]
4522
+ * ? HTMLElementTagNameMap[T[0]] : JamilihReturn}
4523
+ * The newly created (and possibly already appended)
4594
4524
  * element or array of elements
4595
4525
  */
4596
4526
  const jml = function jml(...args) {
4527
+ /* eslint-enable jsdoc/valid-types -- pratt parser bug */
4597
4528
  if (!win) {
4598
4529
  throw new Error('No window object');
4599
4530
  }
@@ -4615,8 +4546,7 @@ const jml = function jml(...args) {
4615
4546
  throw new Error('No document object');
4616
4547
  }
4617
4548
  for (let [att, attVal] of Object.entries(atts)) {
4618
- var _ATTR_MAP$get;
4619
- att = (_ATTR_MAP$get = ATTR_MAP.get(att)) !== null && _ATTR_MAP$get !== void 0 ? _ATTR_MAP$get : att;
4549
+ att = ATTR_MAP.get(att) ?? att;
4620
4550
 
4621
4551
  /**
4622
4552
  * @typedef {any} ElementExpando
@@ -4682,7 +4612,7 @@ const jml = function jml(...args) {
4682
4612
  } else if (typeof template === 'string') {
4683
4613
  template = /** @type {HTMLTemplateElement} */$$1(template);
4684
4614
  }
4685
- jml( /** @type {HTMLTemplateElement} */
4615
+ jml(/** @type {HTMLTemplateElement} */
4686
4616
  /** @type {HTMLTemplateElement} */template.content.cloneNode(true), shadowRoot);
4687
4617
  } else {
4688
4618
  if (!content) {
@@ -4815,7 +4745,7 @@ const jml = function jml(...args) {
4815
4745
  cnstrctr = getConstructor();
4816
4746
  }
4817
4747
  if (!cnstrctr.toString().startsWith('class')) {
4818
- cnstrctr = getConstructor( /** @type {DefineUserConstructor} */cnstrctr);
4748
+ cnstrctr = getConstructor(/** @type {DefineUserConstructor} */cnstrctr);
4819
4749
  }
4820
4750
  if (!options && customizedBuiltIn) {
4821
4751
  options = {
@@ -4835,7 +4765,7 @@ const jml = function jml(...args) {
4835
4765
  {
4836
4766
  const [symbol, func] = /** @type {SymbolArray} */attVal;
4837
4767
  if (typeof func === 'function') {
4838
- const funcBound = func.bind( /** @type {HTMLElement} */elem);
4768
+ const funcBound = func.bind(/** @type {HTMLElement} */elem);
4839
4769
  if (typeof symbol === 'string') {
4840
4770
  // @ts-expect-error
4841
4771
  elem[Symbol.for(symbol)] = funcBound;
@@ -4858,7 +4788,7 @@ const jml = function jml(...args) {
4858
4788
  }
4859
4789
  case '$data':
4860
4790
  {
4861
- setMap( /** @type {true|string[]|Map<any, any>|WeakMap<any, any>|DataAttributeObject} */
4791
+ setMap(/** @type {true|string[]|Map<any, any>|WeakMap<any, any>|DataAttributeObject} */
4862
4792
  attVal);
4863
4793
  break;
4864
4794
  }
@@ -4866,7 +4796,7 @@ const jml = function jml(...args) {
4866
4796
  {
4867
4797
  // Attribute node
4868
4798
  const attr = /** @type {JamilihAttributeNodeValue} */attVal;
4869
- const node = attr.length === 3 ? doc.createAttributeNS(attr[0], attr[1]) : doc.createAttribute( /** @type {string} */attr[0]);
4799
+ const node = attr.length === 3 ? doc.createAttributeNS(attr[0], attr[1]) : doc.createAttribute(/** @type {string} */attr[0]);
4870
4800
  node.value = /** @type {string} */attr[attr.length - 1];
4871
4801
  nodes[nodes.length] = node;
4872
4802
  break;
@@ -4874,7 +4804,7 @@ const jml = function jml(...args) {
4874
4804
  case '$text':
4875
4805
  {
4876
4806
  // Todo: Also allow as jml(['a text node']) (or should that become a fragment)?
4877
- const node = doc.createTextNode( /** @type {string} */attVal);
4807
+ const node = doc.createTextNode(/** @type {string} */attVal);
4878
4808
  nodes[nodes.length] = node;
4879
4809
  break;
4880
4810
  }
@@ -4894,29 +4824,26 @@ const jml = function jml(...args) {
4894
4824
  cn.remove();
4895
4825
  // `j` should stay the same as removing will cause node to be present
4896
4826
  }
4897
-
4898
4827
  jamlihDoc.childNodes.forEach(_childrenToJML(docNode));
4899
4828
  } else {
4900
4829
  if (jamlihDoc.$DOCTYPE) {
4901
- var _docNode$firstChild;
4902
4830
  const dt = {
4903
4831
  $DOCTYPE: jamlihDoc.$DOCTYPE
4904
4832
  };
4905
4833
  const doctype = jml(dt);
4906
- (_docNode$firstChild = docNode.firstChild) === null || _docNode$firstChild === void 0 ? void 0 : _docNode$firstChild.replaceWith(doctype);
4834
+ docNode.firstChild?.replaceWith(doctype);
4907
4835
  }
4908
4836
  const html = docNode.querySelector('html');
4909
- const head = html === null || html === void 0 ? void 0 : html.querySelector('head');
4910
- const body = html === null || html === void 0 ? void 0 : html.querySelector('body');
4837
+ const head = html?.querySelector('head');
4838
+ const body = html?.querySelector('body');
4911
4839
  if (jamlihDoc.title || jamlihDoc.head) {
4912
4840
  const meta = doc.createElement('meta');
4913
4841
  // eslint-disable-next-line unicorn/text-encoding-identifier-case -- HTML
4914
4842
  meta.setAttribute('charset', 'utf-8');
4915
- head === null || head === void 0 ? void 0 : head.append(meta);
4843
+ head?.append(meta);
4916
4844
  if (jamlihDoc.title) {
4917
4845
  docNode.title = jamlihDoc.title; // Appends after meta
4918
4846
  }
4919
-
4920
4847
  if (jamlihDoc.head && head) {
4921
4848
  // each child of `head` is:
4922
4849
  // (JamilihArray|TextNodeString|HTMLElement|Comment|ProcessingInstruction|
@@ -4949,16 +4876,15 @@ const jml = function jml(...args) {
4949
4876
  {
4950
4877
  // Events
4951
4878
  // Allow for no-op by defaulting to `{}`
4952
- for (let [p2, val] of Object.entries( /** @type {OnAttributeObject} */attVal || {})) {
4879
+ for (let [p2, val] of Object.entries(/** @type {OnAttributeObject} */attVal || {})) {
4953
4880
  if (typeof val === 'function') {
4954
4881
  val = [val, false];
4955
4882
  }
4956
4883
  if (typeof val[0] !== 'function') {
4957
4884
  throw new TypeError(`Expect a function for \`$on\`; args: ${JSON.stringify(args)}`);
4958
4885
  }
4959
- _addEvent( /** @type {HTMLElement} */elem, p2, val[0], val[1]); // element, event name, handler, capturing
4886
+ _addEvent(/** @type {HTMLElement} */elem, p2, val[0], val[1]); // element, event name, handler, capturing
4960
4887
  }
4961
-
4962
4888
  break;
4963
4889
  }
4964
4890
  case 'className':
@@ -4992,7 +4918,7 @@ const jml = function jml(...args) {
4992
4918
  recurse(value, prop);
4993
4919
  });
4994
4920
  };
4995
- recurse( /** @type {DatasetAttributeObject} */attVal, '');
4921
+ recurse(/** @type {DatasetAttributeObject} */attVal, '');
4996
4922
  break;
4997
4923
  // Todo: Disable this by default unless configuration explicitly allows (for security)
4998
4924
  }
@@ -5144,12 +5070,11 @@ const jml = function jml(...args) {
5144
5070
  // Array of strings mapping to default
5145
5071
  if (typeof dataVal[0] === 'string') {
5146
5072
  dataVal.forEach(dVal => {
5147
- setMap( /** @type {MapWithRoot} */opts.$map[dVal]);
5073
+ setMap(/** @type {MapWithRoot} */opts.$map[dVal]);
5148
5074
  });
5149
5075
  return;
5150
5076
  // Array of Map and non-map data object
5151
5077
  }
5152
-
5153
5078
  map = dataVal[0] || defMap[0];
5154
5079
  obj = dataVal[1] || defMap[1];
5155
5080
  // Map
@@ -5162,7 +5087,7 @@ const jml = function jml(...args) {
5162
5087
  obj = dataVal;
5163
5088
  }
5164
5089
  /** @type {Map<HTMLElement, any> | WeakMap<HTMLElement, any>} */
5165
- map.set( /** @type {HTMLElement} */
5090
+ map.set(/** @type {HTMLElement} */
5166
5091
  elem, obj);
5167
5092
  };
5168
5093
  for (let i = argStart; i < argc; i++) {
@@ -5172,17 +5097,17 @@ const jml = function jml(...args) {
5172
5097
  case 'null':
5173
5098
  // null always indicates a place-holder (only needed for last argument if want array returned)
5174
5099
  if (i === argc - 1) {
5175
- return nodes.length <= 1 ? nodes[0]
5100
+ // Casting needing unless changing `jml()` signature with overloads
5101
+ return /** @type {ArbitraryValue} */nodes.length <= 1 ? nodes[0]
5176
5102
  // eslint-disable-next-line unicorn/no-array-callback-reference
5177
5103
  : nodes.reduce(_fragReducer, doc.createDocumentFragment()); // nodes;
5178
5104
  }
5179
-
5180
5105
  throw new TypeError(`\`null\` values not allowed except as final Jamilih argument; index ${i} on args: ${JSON.stringify(args)}`);
5181
5106
  case 'string':
5182
5107
  // Strings normally indicate elements
5183
5108
  switch (arg) {
5184
5109
  case '!':
5185
- nodes[nodes.length] = doc.createComment( /** @type {string} */args[++i]);
5110
+ nodes[nodes.length] = doc.createComment(/** @type {string} */args[++i]);
5186
5111
  break;
5187
5112
  case '?':
5188
5113
  {
@@ -5213,7 +5138,6 @@ const jml = function jml(...args) {
5213
5138
  break;
5214
5139
  // Browsers don't support doc.createEntityReference, so we just use this as a convenience
5215
5140
  }
5216
-
5217
5141
  case '&':
5218
5142
  nodes[nodes.length] = _createSafeReference('entity', '', /** @type {string} */
5219
5143
  args[++i]);
@@ -5232,12 +5156,11 @@ const jml = function jml(...args) {
5232
5156
  // CDATA valid in XML only, so we'll just treat as text for mutual compatibility
5233
5157
  // Todo: config (or detection via some kind of doc.documentType property?) of whether in XML
5234
5158
  try {
5235
- nodes[nodes.length] = doc.createCDATASection( /** @type {string} */args[++i]);
5159
+ nodes[nodes.length] = doc.createCDATASection(/** @type {string} */args[++i]);
5236
5160
  } catch (e2) {
5237
- nodes[nodes.length] = doc.createTextNode( /** @type {string} */
5161
+ nodes[nodes.length] = doc.createTextNode(/** @type {string} */
5238
5162
  args[i]); // i already incremented
5239
5163
  }
5240
-
5241
5164
  break;
5242
5165
  case '':
5243
5166
  nodes[nodes.length] = elem = doc.createDocumentFragment();
@@ -5305,8 +5228,7 @@ const jml = function jml(...args) {
5305
5228
  opts.$state = 'element';
5306
5229
  // }catch(e) {alert(elem.outerHTML);throw e;}
5307
5230
  }
5308
-
5309
- _checkAtts( /** @type {JamilihAttributes} */atts);
5231
+ _checkAtts(/** @type {JamilihAttributes} */atts);
5310
5232
  break;
5311
5233
  }
5312
5234
  case 'document':
@@ -5326,7 +5248,7 @@ const jml = function jml(...args) {
5326
5248
  // parent
5327
5249
  const elsl = nodes.length;
5328
5250
  for (let k = 0; k < elsl; k++) {
5329
- _appendNode( /** @type {Document|DocumentFragment|HTMLElement} */arg, nodes[k]);
5251
+ _appendNode(/** @type {Document|DocumentFragment|HTMLElement} */arg, nodes[k]);
5330
5252
  }
5331
5253
  } else {
5332
5254
  nodes[nodes.length] = /** @type {Document|DocumentFragment|HTMLElement} */arg;
@@ -5387,7 +5309,9 @@ const jml = function jml(...args) {
5387
5309
  if (isRoot && opts.$map && /** @type {MapWithRoot} */opts.$map.root) {
5388
5310
  setMap(true);
5389
5311
  }
5390
- return ret;
5312
+
5313
+ // Casting needing unless changing `jml()` signature with overloads
5314
+ return /** @type {ArbitraryValue} */ret;
5391
5315
  };
5392
5316
 
5393
5317
  /**
@@ -5485,7 +5409,6 @@ jml.toJML = function (nde, {
5485
5409
  if (typeof nde === 'string') {
5486
5410
  nde = new /** @type {import('jsdom').DOMWindow} */win.DOMParser().parseFromString(nde, 'text/html'); // todo: Give option for XML once implemented and change JSDoc to allow for Element
5487
5411
  }
5488
-
5489
5412
  const dom = /** @type {HTMLElement|Node|Entity} */nde;
5490
5413
 
5491
5414
  /**
@@ -5597,7 +5520,7 @@ jml.toJML = function (nde, {
5597
5520
  ...namespaces
5598
5521
  };
5599
5522
  const xmlChars = /^([\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD]|[\uD800-\uDBFF][\uDC00-\uDFFF])*$/u; // eslint-disable-line no-control-regex
5600
- if ([2, 3, 4, 7, 8].includes(type) && /** @type {Node} */nodeOrEntity.nodeValue && !xmlChars.test( /** @type {Node} */nodeOrEntity.nodeValue)) {
5523
+ if ([2, 3, 4, 7, 8].includes(type) && /** @type {Node} */nodeOrEntity.nodeValue && !xmlChars.test(/** @type {Node} */nodeOrEntity.nodeValue)) {
5601
5524
  invalidStateError('Node has bad XML character value');
5602
5525
  }
5603
5526
 
@@ -5626,7 +5549,6 @@ jml.toJML = function (nde, {
5626
5549
  parentIdx = tmpParentIdx;
5627
5550
  parentIdx++; // Increment index in parent container of this element
5628
5551
  }
5629
-
5630
5552
  switch (type) {
5631
5553
  case 1:
5632
5554
  {
@@ -5700,10 +5622,9 @@ jml.toJML = function (nde, {
5700
5622
  }
5701
5623
  case 4:
5702
5624
  {
5703
- var _node$nodeValue;
5704
5625
  // CDATA
5705
5626
  const node = /** @type {CDATASection} */nodeOrEntity;
5706
- if ((_node$nodeValue = node.nodeValue) !== null && _node$nodeValue !== void 0 && _node$nodeValue.includes(']]' + '>')) {
5627
+ if (node.nodeValue?.includes(']]' + '>')) {
5707
5628
  invalidStateError('CDATA cannot end with closing ]]>');
5708
5629
  }
5709
5630
  set(['![', node.nodeValue]);
@@ -5787,7 +5708,7 @@ jml.toJML = function (nde, {
5787
5708
  }
5788
5709
  };
5789
5710
  const pubIdChar = /^(\u0020|\u000D|\u000A|[a-zA-Z0-9]|[-'()+,./:=?;!*#@$_%])*$/u; // eslint-disable-line no-control-regex
5790
- if (!pubIdChar.test( /** @type {DocumentType} */node.publicId)) {
5711
+ if (!pubIdChar.test(/** @type {DocumentType} */node.publicId)) {
5791
5712
  invalidStateError('A publicId must have valid characters.');
5792
5713
  }
5793
5714
  addExternalID(start.$DOCTYPE, node);
@@ -5835,7 +5756,7 @@ jml.toJML = function (nde, {
5835
5756
  * @returns {string}
5836
5757
  */
5837
5758
  jml.toJMLString = function (dom, config) {
5838
- return (/** @type {string} */
5759
+ return /** @type {string} */(
5839
5760
  jml.toJML(dom, Object.assign(config || {}, {
5840
5761
  stringOutput: true
5841
5762
  }))
@@ -5867,15 +5788,12 @@ jml.toHTML = function (...args) {
5867
5788
  // Todo: deal with serialization of properties like 'selected',
5868
5789
  // 'checked', 'value', 'defaultValue', 'for', 'dataset', 'on*',
5869
5790
  // 'style'! (i.e., need to build a string ourselves)
5870
- return (/** @type {HTMLElement} */ret.outerHTML
5871
- );
5791
+ return /** @type {HTMLElement} */ret.outerHTML;
5872
5792
  }
5873
5793
  case 2:
5874
5794
  {
5875
5795
  // ATTR
5876
- return `${
5877
- /** @type {Attr} */ret.name}="${
5878
- /** @type {Attr} */ret.value.replace(/"/gu, '&quot;')}"`;
5796
+ return `${/** @type {Attr} */ret.name}="${/** @type {Attr} */ret.value.replace(/"/gu, '&quot;')}"`;
5879
5797
  }
5880
5798
  case 3:
5881
5799
  {
@@ -5886,8 +5804,7 @@ jml.toHTML = function (...args) {
5886
5804
  if (!ret.nodeValue) {
5887
5805
  throw new TypeError('Unexpected null Text node');
5888
5806
  }
5889
- return (/** @type {Text|CDATASection} */ret.nodeValue
5890
- );
5807
+ return /** @type {Text|CDATASection} */ret.nodeValue;
5891
5808
  // case 5: // Entity Reference Node
5892
5809
  // No 6: Entity Node
5893
5810
  // No 12: Notation Node
@@ -5897,14 +5814,13 @@ jml.toHTML = function (...args) {
5897
5814
  // } case 8: { // Comment
5898
5815
  // return `<!--${ret.nodeValue}-->`;
5899
5816
  }
5900
-
5901
5817
  case 9:
5902
5818
  case 11:
5903
5819
  {
5904
5820
  // DOCUMENT FRAGMENT
5905
5821
  const node = /** @type {DocumentFragment} */ret;
5906
5822
  return [...node.childNodes].map(childNode => {
5907
- return jml.toHTML( /** @type {JamilihFirstArgument} */childNode);
5823
+ return jml.toHTML(/** @type {JamilihFirstArgument} */childNode);
5908
5824
  }).join('');
5909
5825
  }
5910
5826
  case 10:
@@ -5914,7 +5830,6 @@ jml.toHTML = function (...args) {
5914
5830
  return `<!DOCTYPE ${node.name}${node.publicId ? ` PUBLIC "${node.publicId}" "${node.systemId}"` : node.systemId ? ` SYSTEM "${node.systemId}"` : ``}>`;
5915
5831
  /* c8 ignore next 3 */
5916
5832
  }
5917
-
5918
5833
  default:
5919
5834
  throw new Error('Unexpected node type');
5920
5835
  }
@@ -6096,7 +6011,6 @@ jml.command = function (elem, symOrMap, methodName, ...args) {
6096
6011
  if (typeof func === 'function') {
6097
6012
  return func(methodName, ...args); // Already has `this` bound to `elem`
6098
6013
  }
6099
-
6100
6014
  return func[methodName](...args);
6101
6015
  }
6102
6016
  func = /** @type {Map<HTMLElement, MapCommand>|WeakMap<HTMLElement, MapCommand>} */symOrMap.get(elem);
@@ -6117,9 +6031,8 @@ jml.command = function (elem, symOrMap, methodName, ...args) {
6117
6031
  * @returns {void}
6118
6032
  */
6119
6033
  jml.setWindow = wind => {
6120
- var _win2;
6121
6034
  win = wind;
6122
- doc = (_win2 = win) === null || _win2 === void 0 ? void 0 : _win2.document;
6035
+ doc = win?.document;
6123
6036
  if (doc && doc.body) {
6124
6037
  // eslint-disable-next-line prefer-destructuring -- Needed for typing
6125
6038
  body = /** @type {HTMLBodyElement} */doc.body;
@@ -6154,9 +6067,6 @@ const $e = (el, descendentsSel) => {
6154
6067
  return el.querySelector(descendentsSel);
6155
6068
  };
6156
6069
 
6157
- const _excluded$1 = ["submit", "submitClass"],
6158
- _excluded2 = ["submit", "cancel", "cancelClass", "submitClass"],
6159
- _excluded3 = ["message", "submit"];
6160
6070
  const defaultLocale = 'en';
6161
6071
  const localeStrings = {
6162
6072
  en: {
@@ -6166,29 +6076,36 @@ const localeStrings = {
6166
6076
  }
6167
6077
  };
6168
6078
  class Dialog {
6169
- constructor({
6170
- locale,
6171
- localeObject
6172
- } = {}) {
6079
+ constructor() {
6080
+ let {
6081
+ locale,
6082
+ localeObject
6083
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6173
6084
  this.setLocale({
6174
6085
  locale,
6175
6086
  localeObject
6176
6087
  });
6177
6088
  }
6178
- setLocale({
6179
- locale = {},
6180
- localeObject = {}
6181
- }) {
6182
- this.localeStrings = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, localeStrings[defaultLocale]), localeStrings[locale]), localeObject);
6089
+ setLocale(_ref) {
6090
+ let {
6091
+ locale = {},
6092
+ localeObject = {}
6093
+ } = _ref;
6094
+ this.localeStrings = {
6095
+ ...localeStrings[defaultLocale],
6096
+ ...localeStrings[locale],
6097
+ ...localeObject
6098
+ };
6183
6099
  }
6184
- makeDialog({
6185
- atts = {
6186
- $on: null
6187
- },
6188
- children = [],
6189
- close,
6190
- remove = true
6191
- }) {
6100
+ makeDialog(_ref2) {
6101
+ let {
6102
+ atts = {
6103
+ $on: null
6104
+ },
6105
+ children = [],
6106
+ close,
6107
+ remove = true
6108
+ } = _ref2;
6192
6109
  if (close) {
6193
6110
  if (!atts.$on) {
6194
6111
  atts.$on = {};
@@ -6206,13 +6123,13 @@ class Dialog {
6206
6123
  }
6207
6124
  return dialog;
6208
6125
  }
6209
- makeSubmitDialog(_ref) {
6126
+ makeSubmitDialog(_ref3) {
6210
6127
  let {
6211
- submit,
6212
- // Don't pass this on to `args` if present
6213
- submitClass = 'submit'
6214
- } = _ref,
6215
- args = _objectWithoutProperties(_ref, _excluded$1);
6128
+ submit,
6129
+ // Don't pass this on to `args` if present
6130
+ submitClass = 'submit',
6131
+ ...args
6132
+ } = _ref3;
6216
6133
  const dialog = this.makeCancelDialog(args);
6217
6134
  $e(dialog, `button.${args.cancelClass || 'cancel'}`).before(jml('button', {
6218
6135
  class: submitClass,
@@ -6229,16 +6146,16 @@ class Dialog {
6229
6146
  }, [this.localeStrings.submit]), nbsp.repeat(2));
6230
6147
  return dialog;
6231
6148
  }
6232
- makeCancelDialog(_ref2) {
6149
+ makeCancelDialog(_ref4) {
6233
6150
  let {
6234
- // eslint-disable-next-line no-unused-vars -- Discarding
6235
- submit,
6236
- // Don't pass this on to `args` if present
6237
- cancel,
6238
- cancelClass = 'cancel',
6239
- submitClass = 'submit'
6240
- } = _ref2,
6241
- args = _objectWithoutProperties(_ref2, _excluded2);
6151
+ // eslint-disable-next-line no-unused-vars -- Discarding
6152
+ submit,
6153
+ // Don't pass this on to `args` if present
6154
+ cancel,
6155
+ cancelClass = 'cancel',
6156
+ submitClass = 'submit',
6157
+ ...args
6158
+ } = _ref4;
6242
6159
  const dialog = this.makeDialog(args);
6243
6160
  jml('div', {
6244
6161
  class: submitClass
@@ -6289,15 +6206,16 @@ class Dialog {
6289
6206
  message
6290
6207
  } : message;
6291
6208
  const {
6292
- message: msg,
6293
- submit: userSubmit
6294
- } = message,
6295
- submitArgs = _objectWithoutProperties(message, _excluded3);
6209
+ message: msg,
6210
+ submit: userSubmit,
6211
+ ...submitArgs
6212
+ } = message;
6296
6213
  return new Promise((resolve, reject) => {
6297
- const submit = function ({
6298
- e,
6299
- dialog
6300
- }) {
6214
+ const submit = function (_ref5) {
6215
+ let {
6216
+ e,
6217
+ dialog
6218
+ } = _ref5;
6301
6219
  if (userSubmit) {
6302
6220
  userSubmit.call(this, {
6303
6221
  e,
@@ -6308,13 +6226,14 @@ class Dialog {
6308
6226
  resolve($e(dialog, 'input').value);
6309
6227
  };
6310
6228
  /* const dialog = */
6311
- this.makeSubmitDialog(_objectSpread2$1(_objectSpread2$1({}, submitArgs), {}, {
6229
+ this.makeSubmitDialog({
6230
+ ...submitArgs,
6312
6231
  submit,
6313
6232
  cancel() {
6314
6233
  reject(new Error('cancelled'));
6315
6234
  },
6316
6235
  children: [['label', [msg, nbsp.repeat(3), ['input']]]]
6317
- }));
6236
+ });
6318
6237
  });
6319
6238
  }
6320
6239
  confirm(message) {
@@ -6349,12 +6268,12 @@ class Dialog {
6349
6268
  }
6350
6269
  const dialogs = new Dialog();
6351
6270
 
6352
- /* eslint-env browser */
6353
6271
  // Todo: remember this locales choice by cookie?
6354
- const getPreferredLanguages = ({
6355
- namespace,
6356
- preferredLocale
6357
- }) => {
6272
+ const getPreferredLanguages = _ref => {
6273
+ let {
6274
+ namespace,
6275
+ preferredLocale
6276
+ } = _ref;
6358
6277
  // Todo: Add to this optionally with one-off tag input box
6359
6278
  // Todo: Switch to fallbackLanguages so can default to
6360
6279
  // navigator.languages?
@@ -6378,9 +6297,10 @@ const getPreferredLanguages = ({
6378
6297
  * @classdesc Note that this should be kept as a polyglot client-server class.
6379
6298
  */
6380
6299
  class Languages {
6381
- constructor({
6382
- langData
6383
- }) {
6300
+ constructor(_ref2) {
6301
+ let {
6302
+ langData
6303
+ } = _ref2;
6384
6304
  this.langData = langData;
6385
6305
  }
6386
6306
  localeFromLangData(langCode) {
@@ -6391,32 +6311,38 @@ class Languages {
6391
6311
  // Could add something like this in place or as fallback, though need to pass in locale
6392
6312
  // || new Intl.DisplayNames([locale], {type: 'language'}).of(code);
6393
6313
  }
6394
-
6395
- getFieldNameFromPluginNameAndLocales({
6396
- pluginName,
6397
- // locales,
6398
- workI18n,
6399
- targetLanguage,
6400
- applicableFieldI18N,
6401
- meta,
6402
- metaApplicableField
6403
- }) {
6404
- return workI18n(['plugins', pluginName, 'fieldname'], _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, meta), metaApplicableField), {}, {
6314
+ getFieldNameFromPluginNameAndLocales(_ref3) {
6315
+ let {
6316
+ pluginName,
6317
+ // locales,
6318
+ workI18n,
6319
+ targetLanguage,
6320
+ applicableFieldI18N,
6321
+ meta,
6322
+ metaApplicableField
6323
+ } = _ref3;
6324
+ return workI18n(['plugins', pluginName, 'fieldname'], {
6325
+ ...meta,
6326
+ ...metaApplicableField,
6405
6327
  applicableField: applicableFieldI18N,
6406
6328
  targetLanguage: targetLanguage ? this.getLanguageFromCode(targetLanguage) : ''
6407
- }), {
6329
+ }, {
6408
6330
  // We provide more than may be desired by the plugin
6409
6331
  throwOnExtraSuppliedFormatters: false
6410
6332
  });
6411
6333
  }
6412
- getLanguageInfo({
6413
- $p
6414
- }) {
6334
+ getLanguageInfo(_ref4) {
6335
+ let {
6336
+ $p
6337
+ } = _ref4;
6415
6338
  const langs = this.langData.languages;
6416
6339
  const localePass = lcl => {
6417
- return langs.some(({
6418
- code
6419
- }) => code === lcl) ? lcl : false;
6340
+ return langs.some(_ref5 => {
6341
+ let {
6342
+ code
6343
+ } = _ref5;
6344
+ return code === lcl;
6345
+ }) ? lcl : false;
6420
6346
  };
6421
6347
  const languageParam = $p.get('lang', true);
6422
6348
  // Todo: We could (unless overridden by another button) assume the
@@ -14356,8 +14282,6 @@ var JsonRefs = function (t) {
14356
14282
  }, "object" === c(n) && void 0 !== t ? u(n) : (o = [n], void 0 === (i = "function" == typeof (e = u) ? e.apply(n, o) : e) || (t.exports = i));
14357
14283
  }]);
14358
14284
 
14359
- /* eslint-env browser */
14360
-
14361
14285
  const getCurrDir = () => {
14362
14286
  return window.location.href.replace(/(index\.html)?#.*$/, '');
14363
14287
  };
@@ -14401,13 +14325,14 @@ const getMetadata = async (file, property, basePath) => {
14401
14325
  }
14402
14326
  })).resolved;
14403
14327
  };
14404
- const getFieldNameAndValueAliases = function ({
14405
- field,
14406
- schemaItems,
14407
- metadataObj,
14408
- getFieldAliasOrName,
14409
- lang
14410
- }) {
14328
+ const getFieldNameAndValueAliases = function (_ref) {
14329
+ let {
14330
+ field,
14331
+ schemaItems,
14332
+ metadataObj,
14333
+ getFieldAliasOrName,
14334
+ lang
14335
+ } = _ref;
14411
14336
  const fieldSchemaIndex = schemaItems.findIndex(item => {
14412
14337
  return item.title === field;
14413
14338
  });
@@ -14429,6 +14354,7 @@ const getFieldNameAndValueAliases = function ({
14429
14354
  if (fieldValueAliasMap.localeKey) {
14430
14355
  fieldValueAliasMap = getMetaProp(lang, metadataObj, fieldValueAliasMap.localeKey.split('/'), true);
14431
14356
  }
14357
+ // eslint-disable-next-line unicorn/prefer-structured-clone -- Expecting JSON
14432
14358
  ret.rawFieldValueAliasMap = JSON.parse(JSON.stringify(fieldValueAliasMap));
14433
14359
  ret.aliases = [];
14434
14360
  // Todo: We could use `prefer_alias` but algorithm below may cover
@@ -14447,7 +14373,8 @@ const getFieldNameAndValueAliases = function ({
14447
14373
  // Todo: We might iterate over all values (in case some not
14448
14374
  // included in fv map)
14449
14375
  // Todo: Check `fieldSchema` for integer or string type
14450
- Object.entries(fieldValueAliasMap).forEach(([key, aliases]) => {
14376
+ Object.entries(fieldValueAliasMap).forEach(_ref2 => {
14377
+ let [key, aliases] = _ref2;
14451
14378
  // We'll preserve the numbers since probably more useful if
14452
14379
  // stored with data (as opposed to enums)
14453
14380
  if (!Array.isArray(aliases)) {
@@ -14462,20 +14389,20 @@ const getFieldNameAndValueAliases = function ({
14462
14389
  );
14463
14390
  });
14464
14391
  }
14465
-
14392
+ // eslint-disable-next-line unicorn/prefer-structured-clone -- Expecting JSON
14466
14393
  ret.fieldValueAliasMap = JSON.parse(JSON.stringify(fieldValueAliasMap));
14467
14394
  // ret.aliases.sort();
14468
14395
  }
14469
-
14470
14396
  return ret;
14471
14397
  };
14472
- const getBrowseFieldData = function ({
14473
- metadataObj,
14474
- schemaItems,
14475
- getFieldAliasOrName,
14476
- lang,
14477
- callback
14478
- }) {
14398
+ const getBrowseFieldData = function (_ref3) {
14399
+ let {
14400
+ metadataObj,
14401
+ schemaItems,
14402
+ getFieldAliasOrName,
14403
+ lang,
14404
+ callback
14405
+ } = _ref3;
14479
14406
  metadataObj.table.browse_fields.forEach((browseFieldSetObject, i) => {
14480
14407
  if (typeof browseFieldSetObject === 'string') {
14481
14408
  browseFieldSetObject = {
@@ -14507,15 +14434,16 @@ const getBrowseFieldData = function ({
14507
14434
  browseFields,
14508
14435
  i,
14509
14436
  presort
14510
- }); // eslint-disable-line n/no-callback-literal
14437
+ });
14511
14438
  });
14512
14439
  };
14513
14440
 
14514
14441
  // Todo: Incorporate other methods into this class
14515
14442
  class Metadata {
14516
- constructor({
14517
- metadataObj
14518
- }) {
14443
+ constructor(_ref4) {
14444
+ let {
14445
+ metadataObj
14446
+ } = _ref4;
14519
14447
  this.metadataObj = metadataObj;
14520
14448
  }
14521
14449
  getFieldLang(field) {
@@ -14525,12 +14453,13 @@ class Metadata {
14525
14453
  const fields = metadataObj && metadataObj.fields;
14526
14454
  return fields && fields[field] && fields[field].lang;
14527
14455
  }
14528
- getFieldMatchesLocale({
14529
- namespace,
14530
- preferredLocale,
14531
- schemaItems,
14532
- pluginsForWork
14533
- }) {
14456
+ getFieldMatchesLocale(_ref5) {
14457
+ let {
14458
+ namespace,
14459
+ preferredLocale,
14460
+ schemaItems,
14461
+ pluginsForWork
14462
+ } = _ref5;
14534
14463
  const {
14535
14464
  metadataObj
14536
14465
  } = this;
@@ -14581,41 +14510,45 @@ const unescapePluginComponent = pluginName => {
14581
14510
  return esc.length % 2 ? esc.slice(1) + '-' : n0;
14582
14511
  }).replaceAll('^^', '^');
14583
14512
  };
14584
- const escapePlugin = ({
14585
- pluginName,
14586
- applicableField,
14587
- targetLanguage
14588
- }) => {
14513
+ const escapePlugin = _ref => {
14514
+ let {
14515
+ pluginName,
14516
+ applicableField,
14517
+ targetLanguage
14518
+ } = _ref;
14589
14519
  return escapePluginComponent(pluginName) + (applicableField ? '-' + escapePluginComponent(applicableField) : '-') + (targetLanguage ? '-' + escapePluginComponent(targetLanguage) : '');
14590
14520
  };
14591
14521
  class PluginsForWork {
14592
- constructor({
14593
- pluginsInWork,
14594
- pluginFieldMappings,
14595
- pluginObjects
14596
- }) {
14522
+ constructor(_ref2) {
14523
+ let {
14524
+ pluginsInWork,
14525
+ pluginFieldMappings,
14526
+ pluginObjects
14527
+ } = _ref2;
14597
14528
  this.pluginsInWork = pluginsInWork;
14598
14529
  this.pluginFieldMappings = pluginFieldMappings;
14599
14530
  this.pluginObjects = pluginObjects;
14600
14531
  }
14601
14532
  getPluginObject(pluginName) {
14602
- const idx = this.pluginsInWork.findIndex(([name]) => {
14533
+ const idx = this.pluginsInWork.findIndex(_ref3 => {
14534
+ let [name] = _ref3;
14603
14535
  return name === pluginName;
14604
14536
  });
14605
14537
  const plugin = this.pluginObjects[idx];
14606
14538
  return plugin;
14607
14539
  }
14608
14540
  iterateMappings(cb) {
14609
- this.pluginFieldMappings.forEach(({
14610
- placement,
14611
- /*
14612
- {fieldXYZ: {
14613
- targetLanguage: "en"|["en"], // E.g., translating from Persian to English
14614
- onByDefault: true // Overrides plugin default
14615
- }}
14616
- */
14617
- 'applicable-fields': applicableFields
14618
- }, i) => {
14541
+ this.pluginFieldMappings.forEach((_ref4, i) => {
14542
+ let {
14543
+ placement,
14544
+ /*
14545
+ {fieldXYZ: {
14546
+ targetLanguage: "en"|["en"], // E.g., translating from Persian to English
14547
+ onByDefault: true // Overrides plugin default
14548
+ }}
14549
+ */
14550
+ 'applicable-fields': applicableFields
14551
+ } = _ref4;
14619
14552
  const [pluginName, {
14620
14553
  onByDefault: onByDefaultDefault,
14621
14554
  lang: pluginLang,
@@ -14623,7 +14556,6 @@ class PluginsForWork {
14623
14556
  }] = this.pluginsInWork[i];
14624
14557
  const plugin = this.getPluginObject(pluginName);
14625
14558
  cb({
14626
- // eslint-disable-line n/no-callback-literal
14627
14559
  plugin,
14628
14560
  placement,
14629
14561
  applicableFields,
@@ -14638,11 +14570,12 @@ class PluginsForWork {
14638
14570
  if (!applicableFields) {
14639
14571
  return false;
14640
14572
  }
14641
- Object.entries(applicableFields).forEach(([applicableField, {
14642
- targetLanguage,
14643
- onByDefault,
14644
- meta: metaApplicableField
14645
- }]) => {
14573
+ Object.entries(applicableFields).forEach(_ref5 => {
14574
+ let [applicableField, {
14575
+ targetLanguage,
14576
+ onByDefault,
14577
+ meta: metaApplicableField
14578
+ }] = _ref5;
14646
14579
  if (Array.isArray(targetLanguage)) {
14647
14580
  targetLanguage.forEach(targetLanguage => {
14648
14581
  cb({
@@ -14650,31 +14583,31 @@ class PluginsForWork {
14650
14583
  targetLanguage,
14651
14584
  onByDefault,
14652
14585
  metaApplicableField
14653
- }); // eslint-disable-line n/no-callback-literal
14586
+ });
14654
14587
  });
14655
14588
  } else {
14656
- // eslint-disable-next-line n/callback-return
14657
14589
  cb({
14658
14590
  applicableField,
14659
14591
  targetLanguage,
14660
14592
  onByDefault,
14661
14593
  metaApplicableField
14662
- }); // eslint-disable-line n/no-callback-literal
14594
+ });
14663
14595
  }
14664
14596
  });
14665
-
14666
14597
  return true;
14667
14598
  }
14668
- isPluginField({
14669
- namespace,
14670
- field
14671
- }) {
14599
+ isPluginField(_ref6) {
14600
+ let {
14601
+ namespace,
14602
+ field
14603
+ } = _ref6;
14672
14604
  return field.startsWith(`${namespace}-plugin-`);
14673
14605
  }
14674
- getPluginFieldParts({
14675
- namespace,
14676
- field
14677
- }) {
14606
+ getPluginFieldParts(_ref7) {
14607
+ let {
14608
+ namespace,
14609
+ field
14610
+ } = _ref7;
14678
14611
  field = field.replace(`${namespace}-plugin-`, '');
14679
14612
  let pluginName, applicableField, targetLanguage;
14680
14613
  if (field.includes('-')) {
@@ -14686,6 +14619,7 @@ class PluginsForWork {
14686
14619
  }
14687
14620
  }
14688
14621
 
14622
+ /* globals process -- Node polyglot */
14689
14623
  const getFilePaths = function getFilePaths(filesObj, fileGroup, fileData) {
14690
14624
  const baseDir = (filesObj.baseDirectory || '') + (fileGroup.baseDirectory || '') + '/';
14691
14625
  const schemaBaseDir = (filesObj.schemaBaseDirectory || '') + (fileGroup.schemaBaseDirectory || '') + '/';
@@ -14699,16 +14633,17 @@ const getFilePaths = function getFilePaths(filesObj, fileGroup, fileData) {
14699
14633
  metadataFile
14700
14634
  };
14701
14635
  };
14702
- const getWorkData = async function ({
14703
- lang,
14704
- fallbackLanguages,
14705
- work,
14706
- files,
14707
- allowPlugins,
14708
- basePath,
14709
- languages,
14710
- preferredLocale
14711
- }) {
14636
+ const getWorkData = async function (_ref) {
14637
+ let {
14638
+ lang,
14639
+ fallbackLanguages,
14640
+ work,
14641
+ files,
14642
+ allowPlugins,
14643
+ basePath,
14644
+ languages,
14645
+ preferredLocale
14646
+ } = _ref;
14712
14647
  const filesObj = await getJSON(files);
14713
14648
  const localizationStrings = filesObj['localization-strings'];
14714
14649
  const workI18n = await i18n({
@@ -14716,10 +14651,11 @@ const getWorkData = async function ({
14716
14651
  locales: lang,
14717
14652
  defaultLocales: fallbackLanguages,
14718
14653
  // Todo: Could at least share this with `index.js`
14719
- localeStringFinder({
14720
- locales,
14721
- defaultLocales
14722
- }) {
14654
+ localeStringFinder(_ref2) {
14655
+ let {
14656
+ locales,
14657
+ defaultLocales
14658
+ } = _ref2;
14723
14659
  const locale = [...locales, ...defaultLocales].find(language => {
14724
14660
  return language in localizationStrings;
14725
14661
  });
@@ -14778,13 +14714,18 @@ const getWorkData = async function ({
14778
14714
  const possiblePluginFieldMappingForWork = pluginFieldMappingID[fileData.name];
14779
14715
  if (possiblePluginFieldMappingForWork) {
14780
14716
  pluginFieldsForWork = Object.keys(possiblePluginFieldMappingForWork);
14781
- pluginsInWork = Object.entries(filesObj.plugins).filter(([p]) => {
14717
+ pluginsInWork = Object.entries(filesObj.plugins).filter(_ref3 => {
14718
+ let [p] = _ref3;
14782
14719
  return pluginFieldsForWork.includes(p);
14783
14720
  });
14784
- pluginFieldMappingForWork = pluginsInWork.map(([p]) => {
14721
+ pluginFieldMappingForWork = pluginsInWork.map(_ref4 => {
14722
+ let [p] = _ref4;
14785
14723
  return possiblePluginFieldMappingForWork[p];
14786
14724
  });
14787
- pluginPaths = pluginsInWork.map(([, pluginObj]) => pluginObj.path);
14725
+ pluginPaths = pluginsInWork.map(_ref5 => {
14726
+ let [, pluginObj] = _ref5;
14727
+ return pluginObj.path;
14728
+ });
14788
14729
  getPlugins = pluginsInWork;
14789
14730
  }
14790
14731
  }
@@ -14816,7 +14757,7 @@ const getWorkData = async function ({
14816
14757
  const pluginFieldMappings = pluginFieldMappingForWork;
14817
14758
  const cwd = typeof process === 'undefined' ? location.href.slice(0, location.href.lastIndexOf('/') + 1) : process.cwd() + '/';
14818
14759
  const [schemaObj, pluginObjects] = await Promise.all([getMetadata(schemaFile, schemaProperty, basePath), getPlugins ? Promise.all(pluginPaths.map(pluginPath => {
14819
- // eslint-disable-next-line no-unsanitized/method
14760
+ // // eslint-disable-next-line no-unsanitized/method
14820
14761
  return import(cwd + pluginPath);
14821
14762
  })) : null]);
14822
14763
  const pluginsForWork = new PluginsForWork({
@@ -14825,9 +14766,10 @@ const getWorkData = async function ({
14825
14766
  pluginObjects
14826
14767
  });
14827
14768
  const schemaItems = schemaObj.items.items;
14828
- const fieldInfo = schemaItems.map(({
14829
- title: field
14830
- }) => {
14769
+ const fieldInfo = schemaItems.map(_ref6 => {
14770
+ let {
14771
+ title: field
14772
+ } = _ref6;
14831
14773
  return {
14832
14774
  field,
14833
14775
  fieldAliasOrName: getFieldAliasOrName(field) || field
@@ -14844,21 +14786,23 @@ const getWorkData = async function ({
14844
14786
  lang,
14845
14787
  namespace
14846
14788
  } = this; // array with first item as preferred
14847
- pluginsForWork.iterateMappings(({
14848
- // plugin,
14849
- pluginName,
14850
- pluginLang,
14851
- onByDefaultDefault,
14852
- placement,
14853
- applicableFields,
14854
- meta
14855
- }) => {
14856
- const processField = ({
14857
- applicableField,
14858
- targetLanguage,
14859
- onByDefault,
14860
- metaApplicableField
14861
- } = {}) => {
14789
+ pluginsForWork.iterateMappings(_ref7 => {
14790
+ let {
14791
+ // plugin,
14792
+ pluginName,
14793
+ pluginLang,
14794
+ onByDefaultDefault,
14795
+ placement,
14796
+ applicableFields,
14797
+ meta
14798
+ } = _ref7;
14799
+ const processField = function () {
14800
+ let {
14801
+ applicableField,
14802
+ targetLanguage,
14803
+ onByDefault,
14804
+ metaApplicableField
14805
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14862
14806
  const plugin = pluginsForWork.getPluginObject(pluginName) || {};
14863
14807
  const applicableFieldLang = metadata.getFieldLang(applicableField);
14864
14808
  if (plugin.getTargetLanguage) {
@@ -14954,7 +14898,7 @@ const getWorkData = async function ({
14954
14898
  */
14955
14899
  const setServiceWorkerDefaults = (target, source) => {
14956
14900
  target.userJSON = source.userJSON || 'resources/user.json';
14957
- target.languages = source.languages || new URL(new URL('assets/languages-1sAACTKG.json', import.meta.url).href, import.meta.url).href;
14901
+ target.languages = source.languages || new URL(new URL('assets/languages-DWwAAJMo.json', import.meta.url).href, import.meta.url).href;
14958
14902
  target.serviceWorkerPath = source.serviceWorkerPath || `sw.js?pathToUserJSON=${encodeURIComponent(target.userJSON)}&stylesheets=${encodeURIComponent(JSON.stringify(target.stylesheets || []))}`;
14959
14903
  target.files = source.files || 'files.json';
14960
14904
  target.namespace = source.namespace || 'textbrowser';
@@ -14965,10 +14909,11 @@ const setServiceWorkerDefaults = (target, source) => {
14965
14909
  // of new and activation of new or existing if still
14966
14910
  // some tabs open)
14967
14911
 
14968
- const listenForWorkerUpdate = ({
14969
- r
14970
- // logger
14971
- }) => {
14912
+ const listenForWorkerUpdate = _ref => {
14913
+ let {
14914
+ r
14915
+ // logger
14916
+ } = _ref;
14972
14917
  r.addEventListener('updatefound', e => {
14973
14918
  // New service worker has appeared
14974
14919
  // r.installing now available (though r.active is also,
@@ -15030,18 +14975,20 @@ for offline installation.
15030
14975
  });
15031
14976
  });
15032
14977
  };
15033
- const respondToState = async ({
15034
- r,
15035
- logger
15036
- }) => {
14978
+ const respondToState = async _ref2 => {
14979
+ let {
14980
+ r,
14981
+ logger
14982
+ } = _ref2;
15037
14983
  // We use this promise for rejecting (inside a listener)
15038
14984
  // to a common catch and to prevent continuation by
15039
14985
  // failing to return
15040
14986
  return new Promise(async () => {
15041
- // eslint-disable-line no-async-promise-executor
15042
- navigator.serviceWorker.addEventListener('message', ({
15043
- data
15044
- }) => {
14987
+ // eslint-disable-line no-async-promise-executor, sonarjs/no-misused-promises -- See above
14988
+ navigator.serviceWorker.addEventListener('message', _ref3 => {
14989
+ let {
14990
+ data
14991
+ } = _ref3;
15045
14992
  const {
15046
14993
  message,
15047
14994
  type,
@@ -15162,10 +15109,11 @@ any indication it is installing.
15162
15109
 
15163
15110
  // Keep in this file as may wish to avoid using for server (while still
15164
15111
  // doing other service worker work)
15165
- const registerServiceWorker = async ({
15166
- serviceWorkerPath,
15167
- logger
15168
- }) => {
15112
+ const registerServiceWorker = async _ref4 => {
15113
+ let {
15114
+ serviceWorkerPath,
15115
+ logger
15116
+ } = _ref4;
15169
15117
  // Todo: We might wish to allow avoiding the other locale files
15170
15118
  // and if only one chosen, switch to the work selection page
15171
15119
  // in that language
@@ -15199,6 +15147,7 @@ const registerServiceWorker = async ({
15199
15147
  r = await navigator.serviceWorker.register(serviceWorkerPath, {
15200
15148
  type: 'module'
15201
15149
  });
15150
+ // eslint-disable-next-line no-unused-vars -- Ok
15202
15151
  } catch (err) {
15203
15152
  console.log('serviceWorkerPath', serviceWorkerPath);
15204
15153
  await dialogs.alert(`
@@ -15222,14 +15171,14 @@ const escapeHTML = s => {
15222
15171
  return !s ? '' : s.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
15223
15172
  };
15224
15173
 
15225
- /* eslint-env browser */
15226
15174
  var languageSelect = {
15227
- main({
15228
- langs,
15229
- languages,
15230
- followParams,
15231
- $p
15232
- }) {
15175
+ main(_ref) {
15176
+ let {
15177
+ langs,
15178
+ languages,
15179
+ followParams,
15180
+ $p
15181
+ } = _ref;
15233
15182
  jml('form', {
15234
15183
  class: 'focus',
15235
15184
  id: 'languageSelectionContainer',
@@ -15242,21 +15191,23 @@ var languageSelect = {
15242
15191
  name: 'lang',
15243
15192
  size: langs.length,
15244
15193
  $on: {
15245
- click({
15246
- target: {
15247
- parentNode: {
15248
- selectedOptions
15194
+ click(_ref2) {
15195
+ let {
15196
+ target: {
15197
+ parentNode: {
15198
+ selectedOptions
15199
+ }
15249
15200
  }
15250
- }
15251
- }) {
15201
+ } = _ref2;
15252
15202
  followParams('#languageSelectionContainer', () => {
15253
15203
  $p.set('lang', selectedOptions[0].value, true);
15254
15204
  });
15255
15205
  }
15256
15206
  }
15257
- }, langs.map(({
15258
- code
15259
- }) => {
15207
+ }, langs.map(_ref3 => {
15208
+ let {
15209
+ code
15210
+ } = _ref3;
15260
15211
  return ['option', {
15261
15212
  value: code
15262
15213
  }, [languages.getLanguageFromCode(code)]];
@@ -15277,14 +15228,14 @@ var languageSelect = {
15277
15228
  */
15278
15229
  };
15279
15230
 
15280
- /* eslint-env browser */
15281
- var workSelect$1 = (({
15282
- groups,
15283
- workI18n,
15284
- getNextAlias,
15285
- $p,
15286
- followParams
15287
- }) => {
15231
+ const workSelect$1 = function (_ref) {
15232
+ let {
15233
+ groups,
15234
+ workI18n,
15235
+ getNextAlias,
15236
+ $p,
15237
+ followParams
15238
+ } = _ref;
15288
15239
  const form = jml('form', {
15289
15240
  id: 'workSelect',
15290
15241
  class: 'focus',
@@ -15301,11 +15252,12 @@ var workSelect$1 = (({
15301
15252
  name: group.name.localeKey
15302
15253
  },
15303
15254
  $on: {
15304
- change({
15305
- target: {
15306
- value
15307
- }
15308
- }) {
15255
+ change(_ref2) {
15256
+ let {
15257
+ target: {
15258
+ value
15259
+ }
15260
+ } = _ref2;
15309
15261
  /*
15310
15262
  // If using click, but click doesn't always fire
15311
15263
  if (e.target.nodeName.toLowerCase() === 'select') {
@@ -15319,9 +15271,10 @@ var workSelect$1 = (({
15319
15271
  }
15320
15272
  }, [['option', {
15321
15273
  value: ''
15322
- }, ['--']], ...group.files.map(({
15323
- name: fileName
15324
- }) => {
15274
+ }, ['--']], ...group.files.map(_ref3 => {
15275
+ let {
15276
+ name: fileName
15277
+ } = _ref3;
15325
15278
  return ['option', {
15326
15279
  value: workI18n(['workNames', group.id, fileName])
15327
15280
  }, [getNextAlias()]];
@@ -15334,7 +15287,7 @@ var workSelect$1 = (({
15334
15287
  deserialize(document.querySelector('#workSelect'), history.state);
15335
15288
  }
15336
15289
  return form;
15337
- });
15290
+ };
15338
15291
 
15339
15292
  const colors = ['aqua', 'black', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red', 'silver', 'teal', 'white', 'yellow'];
15340
15293
  const fonts = ['Helvetica, sans-serif', 'Verdana, sans-serif', 'Gill Sans, sans-serif', 'Avantgarde, sans-serif', 'Helvetica Narrow, sans-serif', 'sans-serif', 'Times, serif', 'Times New Roman, serif', 'Palatino, serif', 'Bookman, serif', 'New Century Schoolbook, serif', 'serif', 'Andale Mono, monospace', 'Courier New, monospace', 'Courier, monospace', 'Lucidatypewriter, monospace', 'Fixed, monospace', 'monospace', 'Comic Sans, Comic Sans MS, cursive', 'Zapf Chancery, cursive', 'Coronetscript, cursive', 'Florence, cursive', 'Parkavenue, cursive', 'cursive', 'Impact, fantasy', 'Arnoldboecklin, fantasy', 'Oldtown, fantasy', 'Blippo, fantasy', 'Brushstroke, fantasy', 'fantasy'];
@@ -15349,366 +15302,378 @@ const getDataForSerializingParamsAsURL = () => ({
15349
15302
  checkboxes: $$('input[type=checkbox]')
15350
15303
  });
15351
15304
  var workDisplay$1 = {
15352
- bdo({
15353
- fallbackDirection,
15354
- message
15355
- }) {
15356
- // Displaying as div with inline display instead of span since
15357
- // Firefox puts punctuation at left otherwise (bdo dir
15305
+ bdo(_ref) {
15306
+ let {
15307
+ fallbackDirection,
15308
+ message
15309
+ } = _ref;
15310
+ // Displaying as div with inline display instead of span since
15311
+ // Firefox puts punctuation at left otherwise (bdo dir
15358
15312
  // seemed to have issues in Firefox)
15359
15313
  return ['div', {
15360
15314
  style: 'display: inline; direction: ' + fallbackDirection
15361
15315
  }, [message]];
15362
15316
  },
15363
- columnsTable: ({
15364
- lDirectional,
15365
- fieldInfo,
15366
- $p,
15367
- lElement,
15368
- lIndexedParam,
15369
- l,
15370
- // metadataObj, preferredLocale, schemaItems,
15371
- fieldMatchesLocale
15372
- }) => ['table', {
15373
- border: '1',
15374
- cellpadding: '5',
15375
- align: 'center'
15376
- }, [['tr', [['th', [lDirectional('fieldno')]], ['th', {
15377
- align: 'left',
15378
- width: '20'
15379
- }, [lDirectional('field_enabled')]], ['th', [lDirectional('field_title')]], ['th', [lDirectional('fieldinterlin')]], ['th', [lDirectional('fieldcss')]]
15380
- /*
15381
- Todo: Support search?
15382
- ,
15383
- ['th', [
15384
- lDirectional('fieldsearch')
15385
- ]]
15386
- */]], ...fieldInfo.map((fieldInfoItem, i) => {
15387
- const idx = i + 1;
15388
- const checkedIndex = 'checked' + idx;
15389
- const fieldIndex = 'field' + idx;
15390
- const fieldParam = $p.get(fieldIndex);
15391
- return ['tr', [
15392
- // Todo: Get Jamilih to accept numbers and
15393
- // booleans (`toString` is too dangerous)
15394
- ['td', [String(idx)]], lElement('check-columns-to-browse', 'td', 'title', {}, [lElement('yes', 'input', 'value', {
15395
- class: 'fieldSelector',
15396
- id: checkedIndex,
15397
- name: lIndexedParam('checked') + idx,
15398
- checked: $p.get(checkedIndex) !== l('no') && ($p.has(checkedIndex) || fieldInfoItem.onByDefault !== false),
15399
- type: 'checkbox'
15400
- })]), lElement('check-sequence', 'td', 'title', {}, [['select', {
15401
- name: lIndexedParam('field') + idx,
15402
- id: fieldIndex,
15403
- size: '1'
15404
- }, fieldInfo.map(({
15405
- field,
15406
- fieldAliasOrName
15407
- }, j) => {
15408
- const matchedFieldParam = fieldParam && fieldParam === fieldAliasOrName;
15409
- return ['option', {
15410
- dataset: {
15411
- name: field
15412
- },
15413
- value: fieldAliasOrName,
15414
- selected: matchedFieldParam || j === i && !$p.has(fieldIndex)
15415
- }, [fieldAliasOrName]];
15416
- })]]), ['td', [
15417
- // Todo: Make as tag selector with fields as options
15418
- lElement('interlinear-tips', 'input', 'title', {
15419
- name: lIndexedParam('interlin') + idx,
15420
- value: $p.get('interlin' + idx)
15421
- }) // Todo: Could allow i18n of numbers here
15422
- ]], ['td', [
15423
- // Todo: Make as CodeMirror-highlighted CSS
15424
- ['input', {
15425
- name: lIndexedParam('css') + idx,
15426
- value: $p.get('css' + idx)
15427
- }]]]
15317
+ columnsTable: _ref2 => {
15318
+ let {
15319
+ lDirectional,
15320
+ fieldInfo,
15321
+ $p,
15322
+ lElement,
15323
+ lIndexedParam,
15324
+ l,
15325
+ // metadataObj, preferredLocale, schemaItems,
15326
+ fieldMatchesLocale
15327
+ } = _ref2;
15328
+ return ['table', {
15329
+ border: '1',
15330
+ cellpadding: '5',
15331
+ align: 'center'
15332
+ }, [['tr', [['th', [lDirectional('fieldno')]], ['th', {
15333
+ align: 'left',
15334
+ width: '20'
15335
+ }, [lDirectional('field_enabled')]], ['th', [lDirectional('field_title')]], ['th', [lDirectional('fieldinterlin')]], ['th', [lDirectional('fieldcss')]]
15428
15336
  /*
15429
- ,
15430
- ['td', [ // Todo: Allow plain or regexp searching
15431
- ['input', {name: lIndexedParam('search') + idx, value: $p.get('search' + idx)}]
15432
- ]]
15433
- */]];
15434
- }), ['tr', [['td', {
15435
- colspan: 3
15436
- }, [lElement('check_all', 'input', 'value', {
15437
- type: 'button',
15438
- $on: {
15439
- click() {
15440
- $$('.fieldSelector').forEach(checkbox => {
15441
- checkbox.checked = true;
15442
- });
15337
+ Todo: Support search?
15338
+ ,
15339
+ ['th', [
15340
+ lDirectional('fieldsearch')
15341
+ ]]
15342
+ */]], ...fieldInfo.map((fieldInfoItem, i) => {
15343
+ const idx = i + 1;
15344
+ const checkedIndex = 'checked' + idx;
15345
+ const fieldIndex = 'field' + idx;
15346
+ const fieldParam = $p.get(fieldIndex);
15347
+ return ['tr', [
15348
+ // Todo: Get Jamilih to accept numbers and
15349
+ // booleans (`toString` is too dangerous)
15350
+ ['td', [String(idx)]], lElement('check-columns-to-browse', 'td', 'title', {}, [lElement('yes', 'input', 'value', {
15351
+ class: 'fieldSelector',
15352
+ id: checkedIndex,
15353
+ name: lIndexedParam('checked') + idx,
15354
+ checked: $p.get(checkedIndex) !== l('no') && ($p.has(checkedIndex) || fieldInfoItem.onByDefault !== false),
15355
+ type: 'checkbox'
15356
+ })]), lElement('check-sequence', 'td', 'title', {}, [['select', {
15357
+ name: lIndexedParam('field') + idx,
15358
+ id: fieldIndex,
15359
+ size: '1'
15360
+ }, fieldInfo.map((_ref3, j) => {
15361
+ let {
15362
+ field,
15363
+ fieldAliasOrName
15364
+ } = _ref3;
15365
+ const matchedFieldParam = fieldParam && fieldParam === fieldAliasOrName;
15366
+ return ['option', {
15367
+ dataset: {
15368
+ name: field
15369
+ },
15370
+ value: fieldAliasOrName,
15371
+ selected: matchedFieldParam || j === i && !$p.has(fieldIndex)
15372
+ }, [fieldAliasOrName]];
15373
+ })]]), ['td', [
15374
+ // Todo: Make as tag selector with fields as options
15375
+ lElement('interlinear-tips', 'input', 'title', {
15376
+ name: lIndexedParam('interlin') + idx,
15377
+ value: $p.get('interlin' + idx)
15378
+ }) // Todo: Could allow i18n of numbers here
15379
+ ]], ['td', [
15380
+ // Todo: Make as CodeMirror-highlighted CSS
15381
+ ['input', {
15382
+ name: lIndexedParam('css') + idx,
15383
+ value: $p.get('css' + idx)
15384
+ }]]]
15385
+ /*
15386
+ ,
15387
+ ['td', [ // Todo: Allow plain or regexp searching
15388
+ ['input', {name: lIndexedParam('search') + idx, value: $p.get('search' + idx)}]
15389
+ ]]
15390
+ */]];
15391
+ }), ['tr', [['td', {
15392
+ colspan: 3
15393
+ }, [lElement('check_all', 'input', 'value', {
15394
+ type: 'button',
15395
+ $on: {
15396
+ click() {
15397
+ $$('.fieldSelector').forEach(checkbox => {
15398
+ checkbox.checked = true;
15399
+ });
15400
+ }
15443
15401
  }
15444
- }
15445
- }), lElement('uncheck_all', 'input', 'value', {
15446
- type: 'button',
15447
- $on: {
15448
- click() {
15449
- $$('.fieldSelector').forEach(checkbox => {
15450
- checkbox.checked = false;
15451
- });
15402
+ }), lElement('uncheck_all', 'input', 'value', {
15403
+ type: 'button',
15404
+ $on: {
15405
+ click() {
15406
+ $$('.fieldSelector').forEach(checkbox => {
15407
+ checkbox.checked = false;
15408
+ });
15409
+ }
15452
15410
  }
15453
- }
15454
- }), lElement('checkmark_locale_fields_only', 'input', 'value', {
15455
- type: 'button',
15456
- $on: {
15457
- click() {
15458
- fieldInfo.forEach(( /* {field} */_, i) => {
15459
- const idx = i + 1;
15460
- // The following is redundant with 'field' but may need to
15461
- // retrieve later out of order?
15462
- const fld = $$1('#field' + idx).selectedOptions[0].dataset.name;
15463
- $$1('#checked' + idx).checked = fieldMatchesLocale(fld);
15464
- });
15411
+ }), lElement('checkmark_locale_fields_only', 'input', 'value', {
15412
+ type: 'button',
15413
+ $on: {
15414
+ click() {
15415
+ fieldInfo.forEach((/* {field} */_, i) => {
15416
+ const idx = i + 1;
15417
+ // The following is redundant with 'field' but may need to
15418
+ // retrieve later out of order?
15419
+ const fld = $$1('#field' + idx).selectedOptions[0].dataset.name;
15420
+ $$1('#checked' + idx).checked = fieldMatchesLocale(fld);
15421
+ });
15422
+ }
15465
15423
  }
15466
- }
15467
- })]]]]]],
15468
- advancedFormatting: ({
15469
- lDirectional,
15470
- lParam,
15471
- l,
15472
- lOption,
15473
- lElement,
15474
- $p,
15475
- hideFormattingSection
15476
- }) => ['td', {
15477
- id: 'advancedformatting',
15478
- style: {
15479
- display: hideFormattingSection ? 'none' : 'block'
15480
- }
15481
- }, [['h3', [lDirectional('advancedformatting')]], ['label', [lDirectional('textcolor'), nbsp2, ['select', {
15482
- name: lParam('colorName')
15483
- }, colors.map((color, i) => {
15484
- const atts = {
15485
- value: l(['param_values', 'colors', color]),
15486
- selected: null
15487
- };
15488
- if ($p.get('colorName') === l(['param_values', 'colors', color]) || i === 1 && !$p.has('colorName')) {
15489
- atts.selected = 'selected';
15490
- }
15491
- return lOption(['param_values', 'colors', color], atts);
15492
- })]]], ['label', [nbsp, lDirectional('or_entercolor'), nbsp2, ['input', {
15493
- name: lParam('color'),
15494
- type: 'text',
15495
- value: $p.get('color') || '#',
15496
- size: '7',
15497
- maxlength: '7'
15498
- }]]], ['br'], ['br'], ['label', [lDirectional('backgroundcolor'), nbsp2, ['select', {
15499
- name: lParam('bgcolorName')
15500
- }, colors.map((color, i) => {
15501
- const atts = {
15502
- value: l(['param_values', 'colors', color]),
15503
- selected: null
15504
- };
15505
- if ($p.get('bgcolorName') === l(['param_values', 'colors', color]) || i === 14 && !$p.has('bgcolorName')) {
15506
- atts.selected = 'selected';
15507
- }
15508
- return lOption(['param_values', 'colors', color], atts);
15509
- })]]], ['label', [nbsp, lDirectional('or_entercolor'), nbsp2, ['input', {
15510
- name: lParam('bgcolor'),
15511
- type: 'text',
15512
- value: $p.get('bgcolor') || '#',
15513
- size: '7',
15514
- maxlength: '7'
15515
- }]]], ['br'], ['br'], ['label', [lDirectional('text_font'), nbsp2,
15516
- // Todo: remove hard-coded direction if i81nizing; also i18nize fontSeq param
15517
- ['select', {
15518
- name: lParam('fontSeq'),
15519
- dir: 'ltr'
15520
- }, fonts.map((fontSeq, i) => {
15521
- const atts = {
15522
- value: fontSeq,
15523
- selected: null
15524
- };
15525
- if ($p.get('fontSeq') === fontSeq || i === 7 && !$p.has('fontSeq')) {
15526
- atts.selected = 'selected';
15527
- }
15528
- return ['option', atts, [fontSeq]];
15529
- })]]], ['br'], ['br'], ['label', [lDirectional('font_style'), nbsp2, ['select', {
15530
- name: lParam('fontstyle')
15531
- }, ['italic', 'normal', 'oblique'].map((fontstyle, i) => {
15532
- const atts = {
15533
- value: l(['param_values', 'fontstyle', fontstyle]),
15534
- selected: null
15535
- };
15536
- if ($p.get('fontstyle') === l(['param_values', 'fontstyle', fontstyle]) || i === 1 && !$p.has('fontstyle')) {
15537
- atts.selected = 'selected';
15538
- }
15539
- return lOption(['param_values', 'fontstyle', fontstyle], atts);
15540
- })]]], ['br'], ['div', [lDirectional('font_variant'), nbsp3, ['label', [['input', {
15541
- name: lParam('fontvariant'),
15542
- type: 'radio',
15543
- value: l(['param_values', 'fontvariant', 'normal']),
15544
- checked: $p.get('fontvariant') !== lDirectional(['param_values', 'fontvariant', 'small-caps'])
15545
- }], lDirectional(['param_values', 'fontvariant', 'normal']), nbsp]], ['label', [['input', {
15546
- name: lParam('fontvariant'),
15547
- type: 'radio',
15548
- value: l(['param_values', 'fontvariant', 'small-caps']),
15549
- checked: $p.get('fontvariant') === lDirectional(['param_values', 'fontvariant', 'small-caps'])
15550
- }], lDirectional(['param_values', 'fontvariant', 'small-caps']), nbsp]]]], ['br'], ['label', [
15551
- // Todo: i18n and allow for normal/bold pulldown and float input?
15552
- lDirectional('font_weight'), ' (normal, bold, 100-900, etc.):', nbsp2, ['input', {
15553
- name: lParam('fontweight'),
15554
- type: 'text',
15555
- value: $p.has('fontweight') ? $p.get('fontweight') : 'normal',
15556
- size: '7',
15557
- maxlength: '12'
15558
- }]]], ['br'], ['label', [lDirectional('font_size'), ' (14pt, 14px, small, 75%, etc.):', nbsp2, ['input', {
15559
- name: lParam('fontsize'),
15560
- type: 'text',
15561
- value: $p.get('fontsize'),
15562
- size: '7',
15563
- maxlength: '12'
15564
- }]]], ['br'],
15565
- // Todo: i18nize title and values?
15566
- // Todo: remove hard-coded direction if i18nizing
15567
- ['label', {
15568
- dir: 'ltr'
15569
- }, [lDirectional('font_stretch'), nbsp, ['select', {
15570
- name: lParam('fontstretch')
15571
- }, ['ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'].map(stretch => {
15572
- const atts = {
15573
- value: lDirectional(['param_values', 'font-stretch', stretch]),
15574
- selected: null
15575
- };
15576
- if ($p.get('fontstretch') === stretch || !$p.has('fontstretch') && stretch === 'normal') {
15577
- atts.selected = 'selected';
15578
- }
15579
- return ['option', atts, [lDirectional(['param_values', 'font-stretch', stretch])]];
15580
- })]]], /**/
15581
- ['br'], ['br'], ['label', [lDirectional('letter_spacing'), ' (normal, .9em, -.05cm): ', ['input', {
15582
- name: lParam('letterspacing'),
15583
- type: 'text',
15584
- value: $p.has('letterspacing') ? $p.get('letterspacing') : 'normal',
15585
- size: '7',
15586
- maxlength: '12'
15587
- }]]], ['br'], ['label', [lDirectional('line_height'), ' (normal, 1.5, 22px, 150%): ', ['input', {
15588
- name: lParam('lineheight'),
15589
- type: 'text',
15590
- value: $p.has('lineheight') ? $p.get('lineheight') : 'normal',
15591
- size: '7',
15592
- maxlength: '12'
15593
- }]]], ['br'], ['br'], lElement('tableformatting_tips', 'h3', 'title', {}, [lDirectional('tableformatting')]), ['div', [lDirectional('header_wstyles'), nbsp2, ...[['yes', lDirectional(['param_values', 'y'])], ['no', lDirectional(['param_values', 'n'])], ['none', lDirectional(['param_values', '0'])]].map(([key, val], i, arr) => {
15594
- return ['label', [['input', {
15595
- name: lParam('header'),
15424
+ })]]]]]];
15425
+ },
15426
+ advancedFormatting: _ref4 => {
15427
+ let {
15428
+ lDirectional,
15429
+ lParam,
15430
+ l,
15431
+ lOption,
15432
+ lElement,
15433
+ $p,
15434
+ hideFormattingSection
15435
+ } = _ref4;
15436
+ return ['td', {
15437
+ id: 'advancedformatting',
15438
+ style: {
15439
+ display: hideFormattingSection ? 'none' : 'block'
15440
+ }
15441
+ }, [['h3', [lDirectional('advancedformatting')]], ['label', [lDirectional('textcolor'), nbsp2, ['select', {
15442
+ name: lParam('colorName')
15443
+ }, colors.map((color, i) => {
15444
+ const atts = {
15445
+ value: l(['param_values', 'colors', color]),
15446
+ selected: null
15447
+ };
15448
+ if ($p.get('colorName') === l(['param_values', 'colors', color]) || i === 1 && !$p.has('colorName')) {
15449
+ atts.selected = 'selected';
15450
+ }
15451
+ return lOption(['param_values', 'colors', color], atts);
15452
+ })]]], ['label', [nbsp, lDirectional('or_entercolor'), nbsp2, ['input', {
15453
+ name: lParam('color'),
15454
+ type: 'text',
15455
+ value: $p.get('color') || '#',
15456
+ size: '7',
15457
+ maxlength: '7'
15458
+ }]]], ['br'], ['br'], ['label', [lDirectional('backgroundcolor'), nbsp2, ['select', {
15459
+ name: lParam('bgcolorName')
15460
+ }, colors.map((color, i) => {
15461
+ const atts = {
15462
+ value: l(['param_values', 'colors', color]),
15463
+ selected: null
15464
+ };
15465
+ if ($p.get('bgcolorName') === l(['param_values', 'colors', color]) || i === 14 && !$p.has('bgcolorName')) {
15466
+ atts.selected = 'selected';
15467
+ }
15468
+ return lOption(['param_values', 'colors', color], atts);
15469
+ })]]], ['label', [nbsp, lDirectional('or_entercolor'), nbsp2, ['input', {
15470
+ name: lParam('bgcolor'),
15471
+ type: 'text',
15472
+ value: $p.get('bgcolor') || '#',
15473
+ size: '7',
15474
+ maxlength: '7'
15475
+ }]]], ['br'], ['br'], ['label', [lDirectional('text_font'), nbsp2,
15476
+ // Todo: remove hard-coded direction if i81nizing; also i18nize fontSeq param
15477
+ ['select', {
15478
+ name: lParam('fontSeq'),
15479
+ dir: 'ltr'
15480
+ }, fonts.map((fontSeq, i) => {
15481
+ const atts = {
15482
+ value: fontSeq,
15483
+ selected: null
15484
+ };
15485
+ if ($p.get('fontSeq') === fontSeq || i === 7 && !$p.has('fontSeq')) {
15486
+ atts.selected = 'selected';
15487
+ }
15488
+ return ['option', atts, [fontSeq]];
15489
+ })]]], ['br'], ['br'], ['label', [lDirectional('font_style'), nbsp2, ['select', {
15490
+ name: lParam('fontstyle')
15491
+ }, ['italic', 'normal', 'oblique'].map((fontstyle, i) => {
15492
+ const atts = {
15493
+ value: l(['param_values', 'fontstyle', fontstyle]),
15494
+ selected: null
15495
+ };
15496
+ if ($p.get('fontstyle') === l(['param_values', 'fontstyle', fontstyle]) || i === 1 && !$p.has('fontstyle')) {
15497
+ atts.selected = 'selected';
15498
+ }
15499
+ return lOption(['param_values', 'fontstyle', fontstyle], atts);
15500
+ })]]], ['br'], ['div', [lDirectional('font_variant'), nbsp3, ['label', [['input', {
15501
+ name: lParam('fontvariant'),
15596
15502
  type: 'radio',
15597
- value: val,
15598
- checked: $p.get('header') === val || !$p.has('header') && i === 1
15599
- }], lDirectional(key), i === arr.length - 1 ? '' : nbsp3]];
15600
- })]], ['div', [lDirectional('footer_wstyles'), nbsp2, ...[['yes', lDirectional(['param_values', 'y'])], ['no', lDirectional(['param_values', 'n'])], ['none', lDirectional(['param_values', '0'])]].map(([key, val], i, arr) => {
15601
- return ['label', [['input', {
15602
- name: lParam('footer'),
15503
+ value: l(['param_values', 'fontvariant', 'normal']),
15504
+ checked: $p.get('fontvariant') !== lDirectional(['param_values', 'fontvariant', 'small-caps'])
15505
+ }], lDirectional(['param_values', 'fontvariant', 'normal']), nbsp]], ['label', [['input', {
15506
+ name: lParam('fontvariant'),
15603
15507
  type: 'radio',
15604
- value: val,
15605
- checked: $p.get('footer') === val || !$p.has('footer') && i === 2
15606
- }], lDirectional(key), i === arr.length - 1 ? '' : nbsp3]];
15607
- })]], ['label', [['input', {
15608
- name: lParam('headerfooterfixed'),
15609
- type: 'checkbox',
15610
- value: l('yes'),
15611
- checked: $p.get('headerfooterfixed') === l('yes')
15612
- }], nbsp2, lDirectional('headerfooterfixed-wishtoscroll')]], ['br'], ['div', [lDirectional('caption_wstyles'), nbsp2, ...[['yes', lDirectional(['param_values', 'y'])], ['no', lDirectional(['param_values', 'n'])], ['none', lDirectional(['param_values', '0'])]].map(([key, val], i, arr) => {
15613
- return ['label', [['input', {
15614
- name: lParam('caption'),
15508
+ value: l(['param_values', 'fontvariant', 'small-caps']),
15509
+ checked: $p.get('fontvariant') === lDirectional(['param_values', 'fontvariant', 'small-caps'])
15510
+ }], lDirectional(['param_values', 'fontvariant', 'small-caps']), nbsp]]]], ['br'], ['label', [
15511
+ // Todo: i18n and allow for normal/bold pulldown and float input?
15512
+ lDirectional('font_weight'), ' (normal, bold, 100-900, etc.):', nbsp2, ['input', {
15513
+ name: lParam('fontweight'),
15514
+ type: 'text',
15515
+ value: $p.has('fontweight') ? $p.get('fontweight') : 'normal',
15516
+ size: '7',
15517
+ maxlength: '12'
15518
+ }]]], ['br'], ['label', [lDirectional('font_size'), ' (14pt, 14px, small, 75%, etc.):', nbsp2, ['input', {
15519
+ name: lParam('fontsize'),
15520
+ type: 'text',
15521
+ value: $p.get('fontsize'),
15522
+ size: '7',
15523
+ maxlength: '12'
15524
+ }]]], ['br'],
15525
+ // Todo: i18nize title and values?
15526
+ // Todo: remove hard-coded direction if i18nizing
15527
+ ['label', {
15528
+ dir: 'ltr'
15529
+ }, [lDirectional('font_stretch'), nbsp, ['select', {
15530
+ name: lParam('fontstretch')
15531
+ }, ['ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'].map(stretch => {
15532
+ const atts = {
15533
+ value: lDirectional(['param_values', 'font-stretch', stretch]),
15534
+ selected: null
15535
+ };
15536
+ if ($p.get('fontstretch') === stretch || !$p.has('fontstretch') && stretch === 'normal') {
15537
+ atts.selected = 'selected';
15538
+ }
15539
+ return ['option', atts, [lDirectional(['param_values', 'font-stretch', stretch])]];
15540
+ })]]], /**/
15541
+ ['br'], ['br'], ['label', [lDirectional('letter_spacing'), ' (normal, .9em, -.05cm): ', ['input', {
15542
+ name: lParam('letterspacing'),
15543
+ type: 'text',
15544
+ value: $p.has('letterspacing') ? $p.get('letterspacing') : 'normal',
15545
+ size: '7',
15546
+ maxlength: '12'
15547
+ }]]], ['br'], ['label', [lDirectional('line_height'), ' (normal, 1.5, 22px, 150%): ', ['input', {
15548
+ name: lParam('lineheight'),
15549
+ type: 'text',
15550
+ value: $p.has('lineheight') ? $p.get('lineheight') : 'normal',
15551
+ size: '7',
15552
+ maxlength: '12'
15553
+ }]]], ['br'], ['br'], lElement('tableformatting_tips', 'h3', 'title', {}, [lDirectional('tableformatting')]), ['div', [lDirectional('header_wstyles'), nbsp2, ...[['yes', lDirectional(['param_values', 'y'])], ['no', lDirectional(['param_values', 'n'])], ['none', lDirectional(['param_values', '0'])]].map((_ref5, i, arr) => {
15554
+ let [key, val] = _ref5;
15555
+ return ['label', [['input', {
15556
+ name: lParam('header'),
15557
+ type: 'radio',
15558
+ value: val,
15559
+ checked: $p.get('header') === val || !$p.has('header') && i === 1
15560
+ }], lDirectional(key), i === arr.length - 1 ? '' : nbsp3]];
15561
+ })]], ['div', [lDirectional('footer_wstyles'), nbsp2, ...[['yes', lDirectional(['param_values', 'y'])], ['no', lDirectional(['param_values', 'n'])], ['none', lDirectional(['param_values', '0'])]].map((_ref6, i, arr) => {
15562
+ let [key, val] = _ref6;
15563
+ return ['label', [['input', {
15564
+ name: lParam('footer'),
15565
+ type: 'radio',
15566
+ value: val,
15567
+ checked: $p.get('footer') === val || !$p.has('footer') && i === 2
15568
+ }], lDirectional(key), i === arr.length - 1 ? '' : nbsp3]];
15569
+ })]], ['label', [['input', {
15570
+ name: lParam('headerfooterfixed'),
15571
+ type: 'checkbox',
15572
+ value: l('yes'),
15573
+ checked: $p.get('headerfooterfixed') === l('yes')
15574
+ }], nbsp2, lDirectional('headerfooterfixed-wishtoscroll')]], ['br'], ['div', [lDirectional('caption_wstyles'), nbsp2, ...[['yes', lDirectional(['param_values', 'y'])], ['no', lDirectional(['param_values', 'n'])], ['none', lDirectional(['param_values', '0'])]].map((_ref7, i, arr) => {
15575
+ let [key, val] = _ref7;
15576
+ return ['label', [['input', {
15577
+ name: lParam('caption'),
15578
+ type: 'radio',
15579
+ value: val,
15580
+ checked: $p.get('caption') === val || !$p.has('caption') && i === 2
15581
+ }], lDirectional(key), i === arr.length - 1 ? '' : nbsp3]];
15582
+ })]], ['br'], ['div', [lDirectional('table_wborder'), nbsp2, ['label', [['input', {
15583
+ name: lParam('border'),
15615
15584
  type: 'radio',
15616
- value: val,
15617
- checked: $p.get('caption') === val || !$p.has('caption') && i === 2
15618
- }], lDirectional(key), i === arr.length - 1 ? '' : nbsp3]];
15619
- })]], ['br'], ['div', [lDirectional('table_wborder'), nbsp2, ['label', [['input', {
15620
- name: lParam('border'),
15621
- type: 'radio',
15622
- value: '1',
15623
- checked: $p.get('border') !== '0'
15624
- }], lDirectional('yes'), nbsp3]], ['label', [['input', {
15625
- name: lParam('border'),
15626
- type: 'radio',
15627
- value: '0',
15628
- checked: $p.get('border') === '0'
15629
- }], lDirectional('no')]]]], ['div', [lDirectional('interlin_repeat_field_names'), nbsp2, ['label', [['input', {
15630
- name: lParam('interlintitle'),
15631
- type: 'radio',
15632
- value: '1',
15633
- checked: $p.get('interlintitle') !== '0'
15634
- }], lDirectional('yes'), nbsp3]], ['label', [['input', {
15635
- name: lParam('interlintitle'),
15636
- type: 'radio',
15637
- value: '0',
15638
- checked: $p.get('interlintitle') === '0'
15639
- }], lDirectional('no')]]]], ['label', [lDirectional('interlintitle_css'), nbsp2, ['input', {
15640
- name: lParam('interlintitle_css'),
15641
- type: 'text',
15642
- value: $p.get('interlintitle_css') || '',
15643
- size: '12'
15644
- }]]], ['br'],
15645
- /*
15646
- ['br'],
15647
- ['label', [
15648
- ['input', {
15649
- name: lParam('transpose'),
15650
- type: 'checkbox',
15651
- value: l('yes'),
15652
- checked: $p.get('transpose') === l('yes')
15653
- }],
15654
- nbsp2, lDirectional('transpose')
15655
- ]],
15656
- */
15657
- ['br'], lElement('pageformatting_tips', 'h3', 'title', {}, [lDirectional('pageformatting')]),
15658
- /*
15659
- ['label', [
15660
- lDirectional('speech_controls'), nbsp2,
15661
- ['label', [
15662
- ['input', {
15663
- name: lParam('speech'),
15664
- type: 'radio',
15665
- value: '1',
15666
- checked: $p.get('speech') === '1'
15667
- }],
15668
- lDirectional('yes'), nbsp3
15669
- ]],
15670
- ['label', [
15671
- ['input', {
15672
- name: lParam('speech'),
15673
- type: 'radio',
15674
- value: '0',
15675
- checked: $p.get('speech') !== '1'
15676
- }],
15677
- lDirectional('no')
15678
- ]]
15679
- ]],
15680
- ['br'],
15681
- */
15682
- ['label', [lDirectional('page_css'), nbsp2, ['textarea', {
15683
- name: lParam('pagecss'),
15684
- title: l('page_css_tips'),
15685
- value: $p.get('pagecss')
15686
- }]]], ['br'], lElement('outputmode_tips', 'label', 'title', {}, [lDirectional('outputmode'), nbsp2,
15687
- // Todo: Could i18nize, but would need smaller values
15688
- ['select', {
15689
- name: lParam('outputmode')
15690
- }, ['table', 'div'
15691
- // , 'json-array',
15692
- // 'json-object'
15693
- ].map(mode => {
15694
- const atts = {
15695
- value: mode,
15696
- selected: null
15697
- };
15698
- if ($p.get('outputmode') === mode) {
15699
- atts.selected = 'selected';
15700
- }
15701
- return lOption(['param_values', 'outputmode', mode], atts);
15702
- })]])]],
15703
- addRandomFormFields({
15704
- lParam,
15705
- lDirectional,
15706
- l,
15707
- lElement,
15708
- $p,
15709
- serializeParamsAsURL,
15710
- content
15711
- }) {
15585
+ value: '1',
15586
+ checked: $p.get('border') !== '0'
15587
+ }], lDirectional('yes'), nbsp3]], ['label', [['input', {
15588
+ name: lParam('border'),
15589
+ type: 'radio',
15590
+ value: '0',
15591
+ checked: $p.get('border') === '0'
15592
+ }], lDirectional('no')]]]], ['div', [lDirectional('interlin_repeat_field_names'), nbsp2, ['label', [['input', {
15593
+ name: lParam('interlintitle'),
15594
+ type: 'radio',
15595
+ value: '1',
15596
+ checked: $p.get('interlintitle') !== '0'
15597
+ }], lDirectional('yes'), nbsp3]], ['label', [['input', {
15598
+ name: lParam('interlintitle'),
15599
+ type: 'radio',
15600
+ value: '0',
15601
+ checked: $p.get('interlintitle') === '0'
15602
+ }], lDirectional('no')]]]], ['label', [lDirectional('interlintitle_css'), nbsp2, ['input', {
15603
+ name: lParam('interlintitle_css'),
15604
+ type: 'text',
15605
+ value: $p.get('interlintitle_css') || '',
15606
+ size: '12'
15607
+ }]]], ['br'],
15608
+ /*
15609
+ ['br'],
15610
+ ['label', [
15611
+ ['input', {
15612
+ name: lParam('transpose'),
15613
+ type: 'checkbox',
15614
+ value: l('yes'),
15615
+ checked: $p.get('transpose') === l('yes')
15616
+ }],
15617
+ nbsp2, lDirectional('transpose')
15618
+ ]],
15619
+ */
15620
+ ['br'], lElement('pageformatting_tips', 'h3', 'title', {}, [lDirectional('pageformatting')]),
15621
+ /*
15622
+ ['label', [
15623
+ lDirectional('speech_controls'), nbsp2,
15624
+ ['label', [
15625
+ ['input', {
15626
+ name: lParam('speech'),
15627
+ type: 'radio',
15628
+ value: '1',
15629
+ checked: $p.get('speech') === '1'
15630
+ }],
15631
+ lDirectional('yes'), nbsp3
15632
+ ]],
15633
+ ['label', [
15634
+ ['input', {
15635
+ name: lParam('speech'),
15636
+ type: 'radio',
15637
+ value: '0',
15638
+ checked: $p.get('speech') !== '1'
15639
+ }],
15640
+ lDirectional('no')
15641
+ ]]
15642
+ ]],
15643
+ ['br'],
15644
+ */
15645
+ ['label', [lDirectional('page_css'), nbsp2, ['textarea', {
15646
+ name: lParam('pagecss'),
15647
+ title: l('page_css_tips'),
15648
+ value: $p.get('pagecss')
15649
+ }]]], ['br'], lElement('outputmode_tips', 'label', 'title', {}, [lDirectional('outputmode'), nbsp2,
15650
+ // Todo: Could i18nize, but would need smaller values
15651
+ ['select', {
15652
+ name: lParam('outputmode')
15653
+ }, ['table', 'div'
15654
+ // , 'json-array',
15655
+ // 'json-object'
15656
+ ].map(mode => {
15657
+ const atts = {
15658
+ value: mode,
15659
+ selected: null
15660
+ };
15661
+ if ($p.get('outputmode') === mode) {
15662
+ atts.selected = 'selected';
15663
+ }
15664
+ return lOption(['param_values', 'outputmode', mode], atts);
15665
+ })]])]];
15666
+ },
15667
+ addRandomFormFields(_ref8) {
15668
+ let {
15669
+ lParam,
15670
+ lDirectional,
15671
+ l,
15672
+ lElement,
15673
+ $p,
15674
+ serializeParamsAsURL,
15675
+ content
15676
+ } = _ref8;
15712
15677
  const addRowContent = rowContent => {
15713
15678
  if (!rowContent || !rowContent.length) {
15714
15679
  return;
@@ -15739,9 +15704,10 @@ var workDisplay$1 = {
15739
15704
  type: 'button',
15740
15705
  $on: {
15741
15706
  click() {
15742
- const url = serializeParamsAsURL(_objectSpread2$1(_objectSpread2$1({}, getDataForSerializingParamsAsURL()), {}, {
15707
+ const url = serializeParamsAsURL({
15708
+ ...getDataForSerializingParamsAsURL(),
15743
15709
  type: 'randomResult'
15744
- }));
15710
+ });
15745
15711
  $$1('#randomURL').value = url;
15746
15712
  }
15747
15713
  }
@@ -15750,102 +15716,109 @@ var workDisplay$1 = {
15750
15716
  type: 'text'
15751
15717
  }]]]]].forEach(addRowContent);
15752
15718
  },
15753
- getPreferences: ({
15754
- // languageParam, workI18n, groups,
15755
- paramsSetter,
15756
- replaceHash,
15757
- getFieldAliasOrNames,
15758
- work,
15759
- langs,
15760
- languageI18n,
15761
- l,
15762
- localizeParamNames,
15763
- namespace,
15764
- hideFormattingSection,
15765
- preferencesPlugin
15766
- }) => ['div', {
15767
- style: {
15768
- textAlign: 'left'
15769
- },
15770
- id: 'preferences',
15771
- hidden: 'true'
15772
- }, [['div', {
15773
- style: 'margin-top: 10px;'
15774
- }, [['label', [l('localizeParamNames'), ['input', {
15775
- id: 'localizeParamNames',
15776
- type: 'checkbox',
15777
- checked: localizeParamNames,
15778
- $on: {
15779
- change({
15780
- target: {
15781
- checked
15719
+ getPreferences: _ref9 => {
15720
+ let {
15721
+ // languageParam, workI18n, groups,
15722
+ paramsSetter,
15723
+ replaceHash,
15724
+ getFieldAliasOrNames,
15725
+ work,
15726
+ langs,
15727
+ languageI18n,
15728
+ l,
15729
+ localizeParamNames,
15730
+ namespace,
15731
+ hideFormattingSection,
15732
+ preferencesPlugin
15733
+ } = _ref9;
15734
+ return ['div', {
15735
+ style: {
15736
+ textAlign: 'left'
15737
+ },
15738
+ id: 'preferences',
15739
+ hidden: 'true'
15740
+ }, [['div', {
15741
+ style: 'margin-top: 10px;'
15742
+ }, [['label', [l('localizeParamNames'), ['input', {
15743
+ id: 'localizeParamNames',
15744
+ type: 'checkbox',
15745
+ checked: localizeParamNames,
15746
+ $on: {
15747
+ change(_ref10) {
15748
+ let {
15749
+ target: {
15750
+ checked
15751
+ }
15752
+ } = _ref10;
15753
+ localStorage.setItem(namespace + '-localizeParamNames', checked);
15782
15754
  }
15783
- }) {
15784
- localStorage.setItem(namespace + '-localizeParamNames', checked);
15785
15755
  }
15786
- }
15787
- }]]]]], ['div', [['label', [l('Hide formatting section'), ['input', {
15788
- id: 'hideFormattingSection',
15789
- type: 'checkbox',
15790
- checked: hideFormattingSection,
15791
- $on: {
15792
- change({
15793
- target: {
15794
- checked
15756
+ }]]]]], ['div', [['label', [l('Hide formatting section'), ['input', {
15757
+ id: 'hideFormattingSection',
15758
+ type: 'checkbox',
15759
+ checked: hideFormattingSection,
15760
+ $on: {
15761
+ change(_ref11) {
15762
+ let {
15763
+ target: {
15764
+ checked
15765
+ }
15766
+ } = _ref11;
15767
+ $$1('#advancedformatting').style.display = checked ? 'none' : 'block';
15768
+ localStorage.setItem(namespace + '-hideFormattingSection', checked);
15795
15769
  }
15796
- }) {
15797
- $$1('#advancedformatting').style.display = checked ? 'none' : 'block';
15798
- localStorage.setItem(namespace + '-hideFormattingSection', checked);
15799
15770
  }
15800
- }
15801
- }]]]]], ['div', [['label', {
15802
- for: 'prefLangs'
15803
- }, [l('Preferred language(s)')]], ['br'], ['select', {
15804
- id: 'prefLangs',
15805
- multiple: 'multiple',
15806
- size: langs.length,
15807
- $on: {
15808
- change({
15809
- target: {
15810
- selectedOptions
15811
- }
15812
- }) {
15813
- // Todo: EU disclaimer re: storage?
15814
- localStorage.setItem(namespace + '-langCodes', JSON.stringify([...selectedOptions].map(opt => {
15815
- return opt.value;
15816
- })));
15771
+ }]]]]], ['div', [['label', {
15772
+ for: 'prefLangs'
15773
+ }, [l('Preferred language(s)')]], ['br'], ['select', {
15774
+ id: 'prefLangs',
15775
+ multiple: 'multiple',
15776
+ size: langs.length,
15777
+ $on: {
15778
+ change(_ref12) {
15779
+ let {
15780
+ target: {
15781
+ selectedOptions
15782
+ }
15783
+ } = _ref12;
15784
+ // Todo: EU disclaimer re: storage?
15785
+ localStorage.setItem(namespace + '-langCodes', JSON.stringify([...selectedOptions].map(opt => {
15786
+ return opt.value;
15787
+ })));
15788
+ }
15817
15789
  }
15818
- }
15819
- }, langs.map(lan => {
15820
- let langCodes = localStorage.getItem(namespace + '-langCodes');
15821
- langCodes = langCodes && JSON.parse(langCodes);
15822
- const atts = {
15823
- value: lan.code,
15824
- selected: null
15825
- };
15826
- if (langCodes && langCodes.includes(lan.code)) {
15827
- atts.selected = 'selected';
15828
- }
15829
- return ['option', atts, [languageI18n(lan.code)]];
15830
- })]]], preferencesPlugin ? preferencesPlugin({
15831
- $: $$1,
15832
- l,
15833
- jml,
15834
- paramsSetter,
15835
- getDataForSerializingParamsAsURL,
15836
- work,
15837
- replaceHash,
15838
- getFieldAliasOrNames
15839
- }) : '']],
15840
- addBrowseFields({
15841
- browseFields,
15842
- fieldInfo,
15843
- lDirectional,
15844
- i,
15845
- lIndexedParam,
15846
- $p,
15847
- content
15848
- }) {
15790
+ }, langs.map(lan => {
15791
+ let langCodes = localStorage.getItem(namespace + '-langCodes');
15792
+ langCodes = langCodes && JSON.parse(langCodes);
15793
+ const atts = {
15794
+ value: lan.code,
15795
+ selected: null
15796
+ };
15797
+ if (langCodes && langCodes.includes(lan.code)) {
15798
+ atts.selected = 'selected';
15799
+ }
15800
+ return ['option', atts, [languageI18n(lan.code)]];
15801
+ })]]], preferencesPlugin ? preferencesPlugin({
15802
+ $: $$1,
15803
+ l,
15804
+ jml,
15805
+ paramsSetter,
15806
+ getDataForSerializingParamsAsURL,
15807
+ work,
15808
+ replaceHash,
15809
+ getFieldAliasOrNames
15810
+ }) : '']];
15811
+ },
15812
+ addBrowseFields(_ref13) {
15813
+ let {
15814
+ browseFields,
15815
+ fieldInfo,
15816
+ lDirectional,
15817
+ i,
15818
+ lIndexedParam,
15819
+ $p,
15820
+ content
15821
+ } = _ref13;
15849
15822
  const work = $p.get('work');
15850
15823
  const addRowContent = rowContent => {
15851
15824
  if (!rowContent || !rowContent.length) {
@@ -15860,14 +15833,15 @@ var workDisplay$1 = {
15860
15833
  align: 'center'
15861
15834
  }, [['br'], lDirectional('or'), ['br'], ['br']]]] : '', [...(() => {
15862
15835
  const addBrowseFieldSet = setType => {
15863
- return browseFields.reduce((rowContent, {
15864
- fieldName,
15865
- aliases,
15866
- fieldSchema: {
15867
- minimum,
15868
- maximum
15869
- }
15870
- }, j) => {
15836
+ return browseFields.reduce((rowContent, _ref14, j) => {
15837
+ let {
15838
+ fieldName,
15839
+ aliases,
15840
+ fieldSchema: {
15841
+ minimum,
15842
+ maximum
15843
+ }
15844
+ } = _ref14;
15871
15845
  // Namespace by work for sake of browser auto-complete caching
15872
15846
  const name = work + '-' + lIndexedParam(setType) + (i + 1) + '-' + (j + 1);
15873
15847
  const id = name;
@@ -15907,14 +15881,15 @@ var workDisplay$1 = {
15907
15881
  })(), ['td', [browseFields.length > 1 ? lDirectional('versesendingdataoptional') : '']]], [['td', {
15908
15882
  colspan: 4 * browseFields.length + 2 + 1,
15909
15883
  align: 'center'
15910
- }, [['table', [['tr', [browseFields.reduce((rowContent, {
15911
- fieldName,
15912
- aliases,
15913
- fieldSchema: {
15914
- minimum,
15915
- maximum
15916
- }
15917
- }, j) => {
15884
+ }, [['table', [['tr', [browseFields.reduce((rowContent, _ref15, j) => {
15885
+ let {
15886
+ fieldName,
15887
+ aliases,
15888
+ fieldSchema: {
15889
+ minimum,
15890
+ maximum
15891
+ }
15892
+ } = _ref15;
15918
15893
  // Namespace by work for sake of browser auto-complete caching
15919
15894
  const name = work + '-' + lIndexedParam('anchor') + (i + 1) + '-' + (j + 1);
15920
15895
  const id = name;
@@ -15944,9 +15919,10 @@ var workDisplay$1 = {
15944
15919
  }), ['td', [['label', [lDirectional('field') + nbsp2, ['select', {
15945
15920
  name: lIndexedParam('anchorfield') + (i + 1),
15946
15921
  size: '1'
15947
- }, fieldInfo.map(({
15948
- fieldAliasOrName
15949
- }) => {
15922
+ }, fieldInfo.map(_ref16 => {
15923
+ let {
15924
+ fieldAliasOrName
15925
+ } = _ref16;
15950
15926
  const val = $p.get(lIndexedParam('anchorfield') + (i + 1), true);
15951
15927
  if (val === fieldAliasOrName) {
15952
15928
  return ['option', {
@@ -15956,42 +15932,45 @@ var workDisplay$1 = {
15956
15932
  return ['option', [fieldAliasOrName]];
15957
15933
  })]]]]]]]]]]]]].forEach(addRowContent);
15958
15934
  },
15959
- main({
15960
- workI18n,
15961
- languageParam,
15962
- l,
15963
- namespace,
15964
- heading,
15965
- // fallbackDirection,
15966
- languageI18n,
15967
- langs,
15968
- fieldInfo,
15969
- localizeParamNames,
15970
- serializeParamsAsURL,
15971
- paramsSetter,
15972
- replaceHash,
15973
- getFieldAliasOrNames,
15974
- hideFormattingSection,
15975
- $p,
15976
- metadataObj,
15977
- lParam,
15978
- lElement,
15979
- lDirectional,
15980
- lIndexedParam,
15981
- fieldMatchesLocale,
15982
- preferredLocale,
15983
- schemaItems,
15984
- content,
15985
- groups,
15986
- preferencesPlugin
15987
- }) {
15935
+ main(_ref17) {
15936
+ let {
15937
+ workI18n,
15938
+ languageParam,
15939
+ l,
15940
+ namespace,
15941
+ heading,
15942
+ // fallbackDirection,
15943
+ languageI18n,
15944
+ langs,
15945
+ fieldInfo,
15946
+ localizeParamNames,
15947
+ serializeParamsAsURL,
15948
+ paramsSetter,
15949
+ replaceHash,
15950
+ getFieldAliasOrNames,
15951
+ hideFormattingSection,
15952
+ $p,
15953
+ metadataObj,
15954
+ lParam,
15955
+ lElement,
15956
+ lDirectional,
15957
+ lIndexedParam,
15958
+ fieldMatchesLocale,
15959
+ preferredLocale,
15960
+ schemaItems,
15961
+ content,
15962
+ groups,
15963
+ preferencesPlugin
15964
+ } = _ref17;
15988
15965
  const work = $p.get('work');
15989
- const serializeParamsAsURLWithData = ({
15990
- type
15991
- }) => {
15992
- return serializeParamsAsURL(_objectSpread2$1(_objectSpread2$1({}, getDataForSerializingParamsAsURL()), {}, {
15966
+ const serializeParamsAsURLWithData = _ref18 => {
15967
+ let {
15993
15968
  type
15994
- }));
15969
+ } = _ref18;
15970
+ return serializeParamsAsURL({
15971
+ ...getDataForSerializingParamsAsURL(),
15972
+ type
15973
+ });
15995
15974
  };
15996
15975
  const lOption = (key, atts) => {
15997
15976
  return ['option', atts, [l(key
@@ -16047,10 +16026,11 @@ var workDisplay$1 = {
16047
16026
  }
16048
16027
  },
16049
16028
  $on: {
16050
- keydown({
16051
- key,
16052
- target
16053
- }) {
16029
+ keydown(_ref19) {
16030
+ let {
16031
+ key,
16032
+ target
16033
+ } = _ref19;
16054
16034
  // Chrome is not having submit event triggered now with enter key
16055
16035
  // presses on inputs, despite having a `type=submit` input in the
16056
16036
  // form, and despite not using `preventDefault`
@@ -16101,14 +16081,16 @@ var workDisplay$1 = {
16101
16081
  $on: {
16102
16082
  async click(e) {
16103
16083
  e.preventDefault();
16104
- const paramsCopy = paramsSetter(_objectSpread2$1(_objectSpread2$1({}, getDataForSerializingParamsAsURL()), {}, {
16084
+ const paramsCopy = paramsSetter({
16085
+ ...getDataForSerializingParamsAsURL(),
16105
16086
  workName: work,
16106
16087
  // Delete work of current page
16107
16088
  type: 'startEndResult'
16108
- }));
16089
+ });
16109
16090
  const url = replaceHash(paramsCopy) + `&work=${work}&${work}-startEnd1=%s`; // %s will be escaped if set as param; also add changeable workName here
16110
16091
  try {
16111
16092
  await navigator.clipboard.writeText(url);
16093
+ // eslint-disable-next-line no-unused-vars -- Okay to ignore
16112
16094
  } catch (err) {
16113
16095
  // User rejected
16114
16096
  }
@@ -16158,65 +16140,73 @@ var workDisplay$1 = {
16158
16140
  };
16159
16141
 
16160
16142
  var resultsDisplayServerOrClient$1 = {
16161
- caption({
16162
- heading,
16163
- ranges
16164
- }) {
16143
+ caption(_ref) {
16144
+ let {
16145
+ heading,
16146
+ ranges
16147
+ } = _ref;
16165
16148
  return heading + ' ' + ranges;
16166
16149
  },
16167
- startSeparator({
16168
- l
16169
- }) {
16150
+ startSeparator(_ref2) {
16151
+ let {
16152
+ l
16153
+ } = _ref2;
16170
16154
  return l('colon');
16171
16155
  },
16172
- innerBrowseFieldSeparator({
16173
- l
16174
- }) {
16156
+ innerBrowseFieldSeparator(_ref3) {
16157
+ let {
16158
+ l
16159
+ } = _ref3;
16175
16160
  return l('comma-space');
16176
16161
  },
16177
- ranges({
16178
- l,
16179
- startRange,
16180
- endVals,
16181
- rangeNames
16182
- }) {
16162
+ ranges(_ref4) {
16163
+ let {
16164
+ l,
16165
+ startRange,
16166
+ endVals,
16167
+ rangeNames
16168
+ } = _ref4;
16183
16169
  return startRange +
16184
16170
  // l('to').toLowerCase() + ' ' +
16185
16171
  '-' + endVals.join(Templates.resultsDisplayServerOrClient.startSeparator({
16186
16172
  l
16187
16173
  })) + ' (' + rangeNames + ')';
16188
16174
  },
16189
- fieldValueAlias({
16190
- key,
16191
- value
16192
- }) {
16175
+ fieldValueAlias(_ref5) {
16176
+ let {
16177
+ key,
16178
+ value
16179
+ } = _ref5;
16193
16180
  return value + ' (' + key + ')';
16194
16181
  },
16195
- interlinearSegment({
16196
- lang,
16197
- dir,
16198
- html
16199
- }) {
16182
+ interlinearSegment(_ref6) {
16183
+ let {
16184
+ lang,
16185
+ dir,
16186
+ html
16187
+ } = _ref6;
16200
16188
  return `<span${lang ? ` lang="${lang}"` : ''}${dir ? ` dir="${dir}"` : ''}>${html}</span>`;
16201
16189
  },
16202
- interlinearTitle({
16203
- l,
16204
- val
16205
- }) {
16190
+ interlinearTitle(_ref7) {
16191
+ let {
16192
+ l,
16193
+ val
16194
+ } = _ref7;
16206
16195
  const colonSpace = l('colon-space');
16207
16196
  return `<span class="interlintitle">${val}</span>${colonSpace}`;
16208
16197
  },
16209
- styles({
16210
- $p,
16211
- $pRaw,
16212
- $pRawEsc,
16213
- $pEscArbitrary,
16214
- // escapeQuotedCSS,
16215
- escapeCSS,
16216
- tableWithFixedHeaderAndFooter,
16217
- checkedFieldIndexes,
16218
- hasCaption
16219
- }) {
16198
+ styles(_ref8) {
16199
+ let {
16200
+ $p,
16201
+ $pRaw,
16202
+ $pRawEsc,
16203
+ $pEscArbitrary,
16204
+ // escapeQuotedCSS,
16205
+ escapeCSS,
16206
+ tableWithFixedHeaderAndFooter,
16207
+ checkedFieldIndexes,
16208
+ hasCaption
16209
+ } = _ref8;
16220
16210
  const colorEsc = !$p.has('color', true) || $p.get('color', true) === '#' ? $pRawEsc('colorName') : $pEscArbitrary('color');
16221
16211
  const bgcolorEsc = !$p.has('bgcolor', true) || $p.get('bgcolor', true) === '#' ? $pRawEsc('bgcolorName') : $pEscArbitrary('bgcolor');
16222
16212
  const tableHeight = '100%';
@@ -16309,30 +16299,31 @@ body {
16309
16299
  }
16310
16300
  ` : '')]];
16311
16301
  },
16312
- main({
16313
- tableData,
16314
- $p,
16315
- $pRaw,
16316
- $pRawEsc,
16317
- $pEscArbitrary,
16318
- // Todo: escaping should be done in business logic!
16319
- escapeQuotedCSS,
16320
- escapeCSS,
16321
- escapeHTML,
16322
- l,
16323
- localizedFieldNames,
16324
- fieldLangs,
16325
- fieldDirs,
16326
- caption,
16327
- hasCaption,
16328
- showInterlinTitles,
16329
- determineEnd,
16330
- getCanonicalID,
16331
- canonicalBrowseFieldSetName,
16332
- getCellValue,
16333
- checkedAndInterlinearFieldInfo,
16334
- interlinearSeparator = '<br /><br />'
16335
- }) {
16302
+ main(_ref9) {
16303
+ let {
16304
+ tableData,
16305
+ $p,
16306
+ $pRaw,
16307
+ $pRawEsc,
16308
+ $pEscArbitrary,
16309
+ // Todo: escaping should be done in business logic!
16310
+ escapeQuotedCSS,
16311
+ escapeCSS,
16312
+ escapeHTML,
16313
+ l,
16314
+ localizedFieldNames,
16315
+ fieldLangs,
16316
+ fieldDirs,
16317
+ caption,
16318
+ hasCaption,
16319
+ showInterlinTitles,
16320
+ determineEnd,
16321
+ getCanonicalID,
16322
+ canonicalBrowseFieldSetName,
16323
+ getCellValue,
16324
+ checkedAndInterlinearFieldInfo,
16325
+ interlinearSeparator = '<br /><br />'
16326
+ } = _ref9;
16336
16327
  const tableOptions = {
16337
16328
  table: [['table', {
16338
16329
  class: 'table',
@@ -16355,7 +16346,6 @@ body {
16355
16346
  // ['colgroup', {class: 'colgroup'}],
16356
16347
  // ['col', {class: 'col'}]
16357
16348
  ],
16358
-
16359
16349
  div: [['div', {
16360
16350
  class: 'table',
16361
16351
  style: 'display: table;'
@@ -16384,7 +16374,6 @@ body {
16384
16374
  // ['div', {class: 'colgroup', style: 'display: table-column-group;'}],
16385
16375
  // ['div', {class: 'col', style: 'display: table-column;'}]
16386
16376
  ],
16387
-
16388
16377
  'json-array': 'json',
16389
16378
  'json-object': 'json'
16390
16379
  };
@@ -16399,7 +16388,6 @@ body {
16399
16388
  }
16400
16389
  const tableElems = tableOptions[Object.prototype.hasOwnProperty.call(tableOptions, outputmode) ? outputmode : 'table' // Default
16401
16390
  ];
16402
-
16403
16391
  const [tableElem, trElem, tdElem, thElem, captionElem, theadElem, tbodyElem, tfootElem] = tableElems; // colgroupElem, colElem
16404
16392
 
16405
16393
  const [checkedFields, checkedFieldIndexes, allInterlinearColIndexes] = checkedAndInterlinearFieldInfo;
@@ -16414,11 +16402,18 @@ body {
16414
16402
  }, children];
16415
16403
  };
16416
16404
  const addChildren = (el, children) => {
16405
+ // eslint-disable-next-line unicorn/prefer-structured-clone -- Need JSON
16417
16406
  el = JSON.parse(JSON.stringify(el));
16418
16407
  el.push(children);
16419
16408
  return el;
16420
16409
  };
16421
- const addAtts = ([el, atts], newAtts) => [el, _objectSpread2$1(_objectSpread2$1({}, atts), newAtts)];
16410
+ const addAtts = (_ref10, newAtts) => {
16411
+ let [el, atts] = _ref10;
16412
+ return [el, {
16413
+ ...atts,
16414
+ ...newAtts
16415
+ }];
16416
+ };
16422
16417
  const foundState = {
16423
16418
  start: false,
16424
16419
  end: false
@@ -16527,7 +16522,7 @@ body {
16527
16522
  class: 'zupa1'
16528
16523
  }, [['div', {
16529
16524
  class: 'inner-caption'
16530
- }, [['span', [caption]]]]]] : '']) : '',
16525
+ }, [['span', [caption]]]]]] : '']) : '', (
16531
16526
  /*
16532
16527
  // Works but quirky, e.g., `color` doesn't work (as also
16533
16528
  // confirmed per https://quirksmode.org/css/css2/columns.html)
@@ -16547,7 +16542,7 @@ body {
16547
16542
  }, [['div', {
16548
16543
  class: 'th-inner'
16549
16544
  }, [['span', [cf]]]]]] : '']);
16550
- }))]) : '', $pRaw('footer') && $pRaw('footer') !== '0' ? addChildren(tfootElem, [addChildren(trElem, checkedFields.map((cf, i) => {
16545
+ }))]) : ''), $pRaw('footer') && $pRaw('footer') !== '0' ? addChildren(tfootElem, [addChildren(trElem, checkedFields.map((cf, i) => {
16551
16546
  const interlinearColIndexes = allInterlinearColIndexes[i];
16552
16547
  cf = escapeHTML(cf) + (interlinearColIndexes ? l('comma-space') + interlinearColIndexes.map(idx => {
16553
16548
  return localizedFieldNames[idx];
@@ -16562,22 +16557,24 @@ body {
16562
16557
  };
16563
16558
 
16564
16559
  var resultsDisplayClient$1 = {
16565
- anchorRowCol({
16566
- anchorRowCol
16567
- }) {
16560
+ anchorRowCol(_ref) {
16561
+ let {
16562
+ anchorRowCol
16563
+ } = _ref;
16568
16564
  return $$1('#' + anchorRowCol);
16569
16565
  },
16570
- anchors({
16571
- escapedRow,
16572
- escapedCol
16573
- }) {
16566
+ anchors(_ref2) {
16567
+ let {
16568
+ escapedRow,
16569
+ escapedCol
16570
+ } = _ref2;
16574
16571
  const sel = 'tr[data-row="' + escapedRow + '"]' + (escapedCol ? '> td[data-col="' + escapedCol + '"]' : '');
16575
16572
  return $$1(sel);
16576
16573
  },
16577
- main(...args) {
16574
+ main() {
16578
16575
  let html;
16579
16576
  try {
16580
- html = Templates.resultsDisplayServerOrClient.main(...args);
16577
+ html = Templates.resultsDisplayServerOrClient.main(...arguments);
16581
16578
  } catch (err) {
16582
16579
  if (err.message === 'JSON support is currently not available') {
16583
16580
  dialogs.alert(err.message);
@@ -16589,7 +16586,6 @@ var resultsDisplayClient$1 = {
16589
16586
  }
16590
16587
  };
16591
16588
 
16592
- /* eslint-env browser */
16593
16589
  const Templates = {
16594
16590
  languageSelect,
16595
16591
  workSelect: workSelect$1,
@@ -16611,14 +16607,16 @@ const Templates = {
16611
16607
  versionChange() {
16612
16608
  $$1('#versionChange').showModal();
16613
16609
  },
16614
- addLogEntry({
16615
- text
16616
- }) {
16610
+ addLogEntry(_ref) {
16611
+ let {
16612
+ text
16613
+ } = _ref;
16617
16614
  const installationDialog = $$1('#installationLogContainer');
16618
16615
  try {
16619
16616
  installationDialog.showModal();
16620
16617
  const container = $$1('#dialogContainer');
16621
16618
  container.hidden = false;
16619
+ // eslint-disable-next-line no-unused-vars -- Ok
16622
16620
  } catch (err) {
16623
16621
  // May already be open
16624
16622
  }
@@ -16630,10 +16628,11 @@ const Templates = {
16630
16628
  container.hidden = true;
16631
16629
  }
16632
16630
  },
16633
- dbError({
16634
- type,
16635
- escapedErrorMessage
16636
- }) {
16631
+ dbError(_ref2) {
16632
+ let {
16633
+ type,
16634
+ escapedErrorMessage
16635
+ } = _ref2;
16637
16636
  if (type) {
16638
16637
  jml('span', [type, ' ', escapedErrorMessage], $$1('#dbError'));
16639
16638
  }
@@ -16660,13 +16659,14 @@ const Templates = {
16660
16659
  * HTMLDialogElement, HTMLDialogElement, HTMLDialogElement
16661
16660
  * ]}
16662
16661
  */
16663
- main({
16664
- siteI18n,
16665
- ok,
16666
- refuse,
16667
- close,
16668
- closeBrowserNotGranting
16669
- }) {
16662
+ main(_ref3) {
16663
+ let {
16664
+ siteI18n,
16665
+ ok,
16666
+ refuse,
16667
+ close,
16668
+ closeBrowserNotGranting
16669
+ } = _ref3;
16670
16670
  const installationDialog = jml('dialog', {
16671
16671
  style: 'text-align: center; height: 100%',
16672
16672
  id: 'installationLogContainer',
@@ -16678,7 +16678,6 @@ const Templates = {
16678
16678
  }, []]]]
16679
16679
  // ['textarea', {readonly: true, style: 'width: 80%; height: 80%;'}]
16680
16680
  ]);
16681
-
16682
16681
  let requestPermissionsDialog = '';
16683
16682
  if (ok) {
16684
16683
  requestPermissionsDialog = jml('dialog', {
@@ -16754,10 +16753,11 @@ function _prepareParam(param, skip) {
16754
16753
  return this.l10n(['params', param]);
16755
16754
  }
16756
16755
  class IntlURLSearchParams {
16757
- constructor({
16758
- l10n,
16759
- params
16760
- } = {}) {
16756
+ constructor() {
16757
+ let {
16758
+ l10n,
16759
+ params
16760
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16761
16761
  this.l10n = l10n;
16762
16762
  if (!params) {
16763
16763
  params = location.hash.slice(1);
@@ -16790,15 +16790,15 @@ class IntlURLSearchParams {
16790
16790
  }
16791
16791
  }
16792
16792
 
16793
- /* eslint-env browser */
16794
- async function workSelect({
16795
- files,
16796
- lang,
16797
- fallbackLanguages,
16798
- $p,
16799
- followParams
16800
- /* , l, defineFormatter */
16801
- }) {
16793
+ async function workSelect(_ref) {
16794
+ let {
16795
+ files,
16796
+ lang,
16797
+ fallbackLanguages,
16798
+ $p,
16799
+ followParams
16800
+ /* , l, defineFormatter */
16801
+ } = _ref;
16802
16802
  // We use getJSON instead of JsonRefs as we do not necessarily need to
16803
16803
  // resolve the file contents here
16804
16804
  try {
@@ -16813,10 +16813,11 @@ async function workSelect({
16813
16813
  locales: lang,
16814
16814
  defaultLocales: fallbackLanguages,
16815
16815
  // Todo: Could at least share this with `index.js`
16816
- localeStringFinder({
16817
- locales,
16818
- defaultLocales
16819
- }) {
16816
+ localeStringFinder(_ref2) {
16817
+ let {
16818
+ locales,
16819
+ defaultLocales
16820
+ } = _ref2;
16820
16821
  const locale = [...locales, ...defaultLocales].find(language => {
16821
16822
  return language in localizationStrings;
16822
16823
  });
@@ -16864,33 +16865,34 @@ async function workSelect({
16864
16865
  }
16865
16866
  }
16866
16867
 
16867
- /* eslint-env browser */
16868
16868
  // Todo: Reimplement this with `formSerialize.deserialize` as possible
16869
16869
  const replaceHash = paramsCopy => {
16870
16870
  return location.href.replace(/#.*$/, '') + '#' + paramsCopy.toString();
16871
16871
  };
16872
- const getSerializeParamsAsURL = function (...args) {
16873
- const setter = getParamsSetter(...args);
16874
- return function (...innerArgs) {
16875
- const paramsCopy = setter(...innerArgs);
16872
+ const getSerializeParamsAsURL = function () {
16873
+ const setter = getParamsSetter(...arguments);
16874
+ return function () {
16875
+ const paramsCopy = setter(...arguments);
16876
16876
  return replaceHash(paramsCopy);
16877
16877
  };
16878
16878
  };
16879
- const getParamsSetter = function ({
16880
- l,
16881
- lParam,
16882
- $p
16883
- }) {
16884
- return function ({
16885
- form,
16886
- random = {
16887
- checked: false
16888
- },
16889
- checkboxes,
16890
- type,
16891
- fieldAliasOrNames = [],
16892
- workName
16893
- }) {
16879
+ const getParamsSetter = function (_ref) {
16880
+ let {
16881
+ l,
16882
+ lParam,
16883
+ $p
16884
+ } = _ref;
16885
+ return function (_ref2) {
16886
+ let {
16887
+ form,
16888
+ random = {
16889
+ checked: false
16890
+ },
16891
+ checkboxes,
16892
+ type,
16893
+ fieldAliasOrNames = [],
16894
+ workName
16895
+ } = _ref2;
16894
16896
  const paramsCopy = new URLSearchParams($p.params);
16895
16897
  const formParamsHash = serialize(form, {
16896
16898
  hash: true,
@@ -16994,16 +16996,16 @@ const getParamsSetter = function ({
16994
16996
  };
16995
16997
  };
16996
16998
 
16997
- const _excluded = ["workI18n", "fileData", "metadataObj"];
16998
- async function workDisplay({
16999
- l,
17000
- languageParam,
17001
- lang,
17002
- preferredLocale,
17003
- languages,
17004
- fallbackLanguages,
17005
- $p
17006
- }) {
16999
+ async function workDisplay(_ref) {
17000
+ let {
17001
+ l,
17002
+ languageParam,
17003
+ lang,
17004
+ preferredLocale,
17005
+ languages,
17006
+ fallbackLanguages,
17007
+ $p
17008
+ } = _ref;
17007
17009
  const {
17008
17010
  preferencesPlugin
17009
17011
  } = this;
@@ -17013,23 +17015,25 @@ async function workDisplay({
17013
17015
  const localizeParamNames = $p.localizeParamNames = $p.has('i18n', true) ? $p.get('i18n', true) === '1' : prefI18n === 'true' || prefI18n !== 'false' && this.localizeParamNames;
17014
17016
  const prefFormatting = localStorage.getItem(this.namespace + '-hideFormattingSection');
17015
17017
  const hideFormattingSection = $p.has('formatting', true) ? $p.get('formatting', true) === '0' : prefFormatting === 'true' || prefFormatting !== 'false' && this.hideFormattingSection;
17016
- async function _displayWork({
17017
- workI18n,
17018
- metadataObj,
17019
- getFieldAliasOrName,
17020
- schemaItems,
17021
- // schemaObj,
17022
- fieldInfo,
17023
- metadata,
17024
- pluginsForWork,
17025
- groupsToWorks
17026
- }) {
17018
+ async function _displayWork(_ref2) {
17019
+ let {
17020
+ workI18n,
17021
+ metadataObj,
17022
+ getFieldAliasOrName,
17023
+ schemaItems,
17024
+ // schemaObj,
17025
+ fieldInfo,
17026
+ metadata,
17027
+ pluginsForWork,
17028
+ groupsToWorks
17029
+ } = _ref2;
17027
17030
  const lParam = localizeParamNames ? key => l(['params', key]) : key => key;
17028
17031
  const lIndexedParam = localizeParamNames ? key => l(['params', 'indexed', key]) : key => key;
17029
17032
 
17030
17033
  // Returns element with localized option text (as Jamilih), with
17031
17034
  // optional fallback direction
17032
- const lElement = (key, el, attToLocalize, atts, children = []) => {
17035
+ const lElement = function (key, el, attToLocalize, atts) {
17036
+ let children = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
17033
17037
  atts[attToLocalize] = l(key
17034
17038
  // Restore this if `intl-dom` supports
17035
17039
  // fallback ({message}) {
@@ -17037,7 +17041,6 @@ async function workDisplay({
17037
17041
  // return message;
17038
17042
  // }
17039
17043
  );
17040
-
17041
17044
  return [el, atts, children];
17042
17045
  };
17043
17046
 
@@ -17048,7 +17051,6 @@ async function workDisplay({
17048
17051
  // fallback: ({message}) =>
17049
17052
  // Templates.workDisplay.bdo({fallbackDirection, message})
17050
17053
  );
17051
-
17052
17054
  const fieldMatchesLocale = metadata.getFieldMatchesLocale({
17053
17055
  namespace: this.namespace,
17054
17056
  preferredLocale,
@@ -17060,10 +17062,11 @@ async function workDisplay({
17060
17062
  metadataObj,
17061
17063
  schemaItems,
17062
17064
  getFieldAliasOrName,
17063
- callback({
17064
- browseFields,
17065
- i
17066
- }) {
17065
+ callback(_ref3) {
17066
+ let {
17067
+ browseFields,
17068
+ i
17069
+ } = _ref3;
17067
17070
  Templates.workDisplay.addBrowseFields({
17068
17071
  browseFields,
17069
17072
  fieldInfo,
@@ -17100,11 +17103,12 @@ async function workDisplay({
17100
17103
  const getFieldAliasOrNames = (() => {
17101
17104
  // Avoid blocking but start now
17102
17105
  // Let this run in the background to avoid blocking
17103
- const all = Promise.all(groupsToWorks.map(async ({
17104
- name,
17105
- workNames,
17106
- shortcuts
17107
- }) => {
17106
+ const all = Promise.all(groupsToWorks.map(async _ref4 => {
17107
+ let {
17108
+ name,
17109
+ workNames,
17110
+ shortcuts
17111
+ } = _ref4;
17108
17112
  const worksToFields = await Promise.all(workNames.map(async (workName, i) => {
17109
17113
  return {
17110
17114
  workName,
@@ -17115,9 +17119,12 @@ async function workDisplay({
17115
17119
  preferredLocale,
17116
17120
  languages,
17117
17121
  work: workName
17118
- })).fieldInfo.map(({
17119
- fieldAliasOrName
17120
- }) => fieldAliasOrName)
17122
+ })).fieldInfo.map(_ref5 => {
17123
+ let {
17124
+ fieldAliasOrName
17125
+ } = _ref5;
17126
+ return fieldAliasOrName;
17127
+ })
17121
17128
  };
17122
17129
  }));
17123
17130
  return {
@@ -17129,14 +17136,12 @@ async function workDisplay({
17129
17136
  return all; // May not be finished by now
17130
17137
  };
17131
17138
  })();
17132
-
17133
17139
  const displayNames = new Intl.DisplayNames([...lang, ...fallbackLanguages], {
17134
17140
  type: 'language',
17135
17141
  // Dialect: "American English"
17136
17142
  // Standard: "English (United States)"
17137
17143
  languageDisplay: 'standard' // 'dialect'
17138
17144
  });
17139
-
17140
17145
  const languageI18n = code => {
17141
17146
  return displayNames.of(code);
17142
17147
  };
@@ -17172,26 +17177,26 @@ async function workDisplay({
17172
17177
  });
17173
17178
  }
17174
17179
  try {
17175
- const _await$this$getWorkDa = await this.getWorkData({
17176
- lang,
17177
- fallbackLanguages,
17178
- preferredLocale,
17179
- languages,
17180
- work: $p.get('work')
17181
- }),
17182
- {
17183
- workI18n,
17184
- fileData,
17185
- metadataObj
17186
- } = _await$this$getWorkDa,
17187
- args = _objectWithoutProperties(_await$this$getWorkDa, _excluded);
17180
+ const {
17181
+ workI18n,
17182
+ fileData,
17183
+ metadataObj,
17184
+ ...args
17185
+ } = await this.getWorkData({
17186
+ lang,
17187
+ fallbackLanguages,
17188
+ preferredLocale,
17189
+ languages,
17190
+ work: $p.get('work')
17191
+ });
17188
17192
  document.title = workI18n('browserfile-workdisplay', {
17189
17193
  work: fileData ? getMetaProp(lang, metadataObj, 'alias') : ''
17190
17194
  });
17191
- await _displayWork.call(this, _objectSpread2$1({
17195
+ await _displayWork.call(this, {
17192
17196
  workI18n,
17193
- metadataObj
17194
- }, args));
17197
+ metadataObj,
17198
+ ...args
17199
+ });
17195
17200
  } catch (err) {
17196
17201
  console.log('err', err);
17197
17202
  dialogs.alert(err);
@@ -17395,7 +17400,6 @@ class Locale {
17395
17400
 
17396
17401
  // Public functions - End
17397
17402
  }
17398
-
17399
17403
  Locale._RTL_SCRIPTS = ['adlm', 'arab', 'armi', 'avst', 'chrs', 'cprt', 'elym', 'hatr', 'hebr', 'hung', 'khar', 'lydi', 'mand', 'mani', 'mend', 'merc', 'mero', 'narb', 'nbat', 'nkoo', 'orkh', 'ougr', 'palm', 'phli', 'phlp', 'phnx', 'prti', 'rohg', 'samr', 'sarb', 'sogd', 'sogo', 'syrc', 'thaa', 'yezi'];
17400
17404
 
17401
17405
  // Why not working as static property
@@ -17640,14 +17644,15 @@ const fieldValueAliasRegex = /^.* \((.*?)\)$/;
17640
17644
  const getRawFieldValue = v => {
17641
17645
  return typeof v === 'string' ? v.replace(fieldValueAliasRegex, '$1') : v;
17642
17646
  };
17643
- const setAnchor = ({
17644
- applicableBrowseFieldSet,
17645
- fieldValueAliasMapPreferred,
17646
- lParamRaw,
17647
- lIndexedParam,
17648
- max,
17649
- $p
17650
- }) => {
17647
+ const setAnchor = _ref => {
17648
+ let {
17649
+ applicableBrowseFieldSet,
17650
+ fieldValueAliasMapPreferred,
17651
+ lParamRaw,
17652
+ lIndexedParam,
17653
+ max,
17654
+ $p
17655
+ } = _ref;
17651
17656
  const applicableBrowseFieldSchemaIndexes = applicableBrowseFieldSet.map(abfs => {
17652
17657
  return abfs.fieldSchemaIndex;
17653
17658
  });
@@ -17664,6 +17669,7 @@ const setAnchor = ({
17664
17669
  if (!anchor) {
17665
17670
  const anchors = [];
17666
17671
  let anchorField = '';
17672
+ // eslint-disable-next-line sonarjs/misplaced-loop-counter -- Ok
17667
17673
  for (let i = 1, breakout; !breakout && !anchors.length; i++) {
17668
17674
  for (let j = 1;; j++) {
17669
17675
  const anchorText = work + '-' + 'anchor' + i + '-' + j;
@@ -17685,9 +17691,8 @@ const setAnchor = ({
17685
17691
  // anchors.push({anchorText, anchor});
17686
17692
  }
17687
17693
  }
17688
-
17689
17694
  if (anchors.length) {
17690
- const escapeSelectorAttValue = str => (str || '').replaceAll(/["\\]/g, '\\$&');
17695
+ const escapeSelectorAttValue = str => (str || '').replaceAll(/["\\]/g, String.raw`\$&`);
17691
17696
  const escapedRow = escapeSelectorAttValue(anchors.join('-'));
17692
17697
  const escapedCol = anchorField ? escapeSelectorAttValue(anchorField) : undefined;
17693
17698
  anchor = Templates.resultsDisplayClient.anchors({
@@ -17717,10 +17722,11 @@ const resultsDisplayClient = async function resultsDisplayClient(args) {
17717
17722
  lIndexedParam,
17718
17723
  lParamRaw,
17719
17724
  templateArgs
17720
- } = await resultsDisplayServerOrClient.call(this, _objectSpread2$1(_objectSpread2$1({}, args), {}, {
17725
+ } = await resultsDisplayServerOrClient.call(this, {
17726
+ ...args,
17721
17727
  skipIndexedDB,
17722
17728
  prefI18n
17723
- }));
17729
+ });
17724
17730
  document.title = workI18n('browserfile-resultsdisplay', {
17725
17731
  work: fileData ? getMetaProp(lang, metadataObj, 'alias') : ''
17726
17732
  });
@@ -17733,12 +17739,13 @@ const resultsDisplayClient = async function resultsDisplayClient(args) {
17733
17739
  $p: args.$p,
17734
17740
  max: browseFieldSets.length
17735
17741
  });
17736
- fieldInfo.forEach(({
17737
- plugin,
17738
- applicableField,
17739
- meta,
17740
- j
17741
- }) => {
17742
+ fieldInfo.forEach(_ref2 => {
17743
+ let {
17744
+ plugin,
17745
+ applicableField,
17746
+ meta,
17747
+ j
17748
+ } = _ref2;
17742
17749
  if (!plugin) {
17743
17750
  return;
17744
17751
  }
@@ -17753,131 +17760,143 @@ const resultsDisplayClient = async function resultsDisplayClient(args) {
17753
17760
  }
17754
17761
  });
17755
17762
  };
17756
- const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient({
17757
- l,
17758
- lang,
17759
- fallbackLanguages,
17760
- locales,
17761
- $p,
17762
- skipIndexedDB,
17763
- noIndexedDB,
17764
- prefI18n,
17765
- files,
17766
- allowPlugins,
17767
- langData,
17768
- basePath = '',
17769
- dynamicBasePath = ''
17770
- }) {
17763
+ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient(_ref3) {
17764
+ let {
17765
+ l,
17766
+ lang,
17767
+ fallbackLanguages,
17768
+ locales,
17769
+ $p,
17770
+ skipIndexedDB,
17771
+ noIndexedDB,
17772
+ prefI18n,
17773
+ files,
17774
+ allowPlugins,
17775
+ langData,
17776
+ basePath = '',
17777
+ dynamicBasePath = ''
17778
+ } = _ref3;
17771
17779
  const languages = new Languages({
17772
17780
  langData
17773
17781
  });
17774
- const getCellValue = ({
17775
- fieldValueAliasMapPreferred,
17776
- escapeColumnIndexes
17777
- }) => ({
17778
- tr,
17779
- idx
17780
- }) => {
17781
- let tdVal = fieldValueAliasMapPreferred[idx] !== undefined ? fieldValueAliasMapPreferred[idx][tr[idx]] : tr[idx];
17782
- if (tdVal && typeof tdVal === 'object') {
17783
- tdVal = Object.values(tdVal);
17784
- }
17785
- if (Array.isArray(tdVal)) {
17786
- tdVal = tdVal.join(l('comma-space'));
17787
- }
17788
- return (escapeColumnIndexes[idx] || !this.trustFormatHTML) && typeof tdVal === 'string' ? {
17789
- tdVal: escapeHTML(tdVal),
17790
- htmlEscaped: true
17791
- } : {
17792
- tdVal
17782
+ const getCellValue = _ref4 => {
17783
+ let {
17784
+ fieldValueAliasMapPreferred,
17785
+ escapeColumnIndexes
17786
+ } = _ref4;
17787
+ return _ref5 => {
17788
+ let {
17789
+ tr,
17790
+ idx
17791
+ } = _ref5;
17792
+ let tdVal = fieldValueAliasMapPreferred[idx] !== undefined ? fieldValueAliasMapPreferred[idx][tr[idx]] : tr[idx];
17793
+ if (tdVal && typeof tdVal === 'object') {
17794
+ tdVal = Object.values(tdVal);
17795
+ }
17796
+ if (Array.isArray(tdVal)) {
17797
+ tdVal = tdVal.join(l('comma-space'));
17798
+ }
17799
+ return (escapeColumnIndexes[idx] || !this.trustFormatHTML) && typeof tdVal === 'string' ? {
17800
+ tdVal: escapeHTML(tdVal),
17801
+ htmlEscaped: true
17802
+ } : {
17803
+ tdVal
17804
+ };
17793
17805
  };
17794
17806
  };
17795
- const getCanonicalID = ({
17796
- fieldValueAliasMap,
17797
- fieldValueAliasMapPreferred,
17798
- localizedFieldNames,
17799
- canonicalBrowseFieldNames
17800
- }) => ({
17801
- tr // , foundState
17802
- }) => {
17803
- return canonicalBrowseFieldNames.map(fieldName => {
17804
- const idx = localizedFieldNames.indexOf(fieldName);
17805
- // This works to put alias in anchor but this includes
17806
- // our ending parenthetical, the alias may be harder
17807
- // to remember and/or automated than original (e.g.,
17808
- // for a number representing a book); we may wish to
17809
- // switch this (and also for other browse field-based
17810
- // items).
17811
- if (fieldValueAliasMap[idx] !== undefined &&
17812
- // Added this condition after imf->intl-dom conversion; concealing a
17813
- // bug?
17814
- fieldValueAliasMap[idx] !== null) {
17815
- return fieldValueAliasMapPreferred[idx][tr[idx]];
17816
- }
17817
- return tr[idx];
17818
- }).join('-'); // rowID;
17807
+ const getCanonicalID = _ref6 => {
17808
+ let {
17809
+ fieldValueAliasMap,
17810
+ fieldValueAliasMapPreferred,
17811
+ localizedFieldNames,
17812
+ canonicalBrowseFieldNames
17813
+ } = _ref6;
17814
+ return _ref7 => {
17815
+ let {
17816
+ tr // , foundState
17817
+ } = _ref7;
17818
+ return canonicalBrowseFieldNames.map(fieldName => {
17819
+ const idx = localizedFieldNames.indexOf(fieldName);
17820
+ // This works to put alias in anchor but this includes
17821
+ // our ending parenthetical, the alias may be harder
17822
+ // to remember and/or automated than original (e.g.,
17823
+ // for a number representing a book); we may wish to
17824
+ // switch this (and also for other browse field-based
17825
+ // items).
17826
+ if (fieldValueAliasMap[idx] !== undefined &&
17827
+ // Added this condition after imf->intl-dom conversion; concealing a
17828
+ // bug?
17829
+ fieldValueAliasMap[idx] !== null) {
17830
+ return fieldValueAliasMapPreferred[idx][tr[idx]];
17831
+ }
17832
+ return tr[idx];
17833
+ }).join('-'); // rowID;
17834
+ };
17819
17835
  };
17836
+ const determineEnd = _ref8 => {
17837
+ let {
17838
+ fieldValueAliasMap,
17839
+ fieldValueAliasMapPreferred,
17840
+ localizedFieldNames,
17841
+ applicableBrowseFieldNames,
17842
+ startsRaw,
17843
+ endsRaw
17844
+ } = _ref8;
17845
+ return _ref9 => {
17846
+ let {
17847
+ tr,
17848
+ foundState
17849
+ } = _ref9;
17850
+ const rowIDPartsPreferred = [];
17851
+ const rowIDParts = applicableBrowseFieldNames.map(fieldName => {
17852
+ const idx = localizedFieldNames.indexOf(fieldName);
17853
+ // This works to put alias in anchor but this includes
17854
+ // our ending parenthetical, the alias may be harder
17855
+ // to remember and/or automated than original (e.g.,
17856
+ // for a number representing a book), and there could
17857
+ // be multiple aliases for a value; we may wish to
17858
+ // switch this (and also for other browse field-based
17859
+ // items).
17860
+ if (fieldValueAliasMap[idx] !== undefined &&
17861
+ // Added this condition after imf->intl-dom conversion; concealing a
17862
+ // bug?
17863
+ fieldValueAliasMap[idx] !== null) {
17864
+ rowIDPartsPreferred.push(fieldValueAliasMapPreferred[idx][tr[idx]]);
17865
+ } else {
17866
+ rowIDPartsPreferred.push(tr[idx]);
17867
+ }
17868
+ return tr[idx];
17869
+ });
17820
17870
 
17821
- const determineEnd = ({
17822
- fieldValueAliasMap,
17823
- fieldValueAliasMapPreferred,
17824
- localizedFieldNames,
17825
- applicableBrowseFieldNames,
17826
- startsRaw,
17827
- endsRaw
17828
- }) => ({
17829
- tr,
17830
- foundState
17831
- }) => {
17832
- const rowIDPartsPreferred = [];
17833
- const rowIDParts = applicableBrowseFieldNames.map(fieldName => {
17834
- const idx = localizedFieldNames.indexOf(fieldName);
17835
- // This works to put alias in anchor but this includes
17836
- // our ending parenthetical, the alias may be harder
17837
- // to remember and/or automated than original (e.g.,
17838
- // for a number representing a book), and there could
17839
- // be multiple aliases for a value; we may wish to
17840
- // switch this (and also for other browse field-based
17841
- // items).
17842
- if (fieldValueAliasMap[idx] !== undefined &&
17843
- // Added this condition after imf->intl-dom conversion; concealing a
17844
- // bug?
17845
- fieldValueAliasMap[idx] !== null) {
17846
- rowIDPartsPreferred.push(fieldValueAliasMapPreferred[idx][tr[idx]]);
17847
- } else {
17848
- rowIDPartsPreferred.push(tr[idx]);
17871
+ // Todo: Use schema to determine field type and use `Number.parseInt`
17872
+ // on other value instead of `String` conversions
17873
+ if (!foundState.start) {
17874
+ if (startsRaw.some((part, i) => {
17875
+ const rowIDPart = rowIDParts[i];
17876
+ return part !== rowIDPart;
17877
+ })) {
17878
+ // Trigger skip of this row
17879
+ return false;
17880
+ }
17881
+ foundState.start = true;
17849
17882
  }
17850
- return tr[idx];
17851
- });
17852
-
17853
- // Todo: Use schema to determine field type and use `Number.parseInt`
17854
- // on other value instead of `String` conversions
17855
- if (!foundState.start) {
17856
- if (startsRaw.some((part, i) => {
17883
+ // This doesn't go in an `else` for the above in case the start is the end
17884
+ if (endsRaw.every((part, i) => {
17857
17885
  const rowIDPart = rowIDParts[i];
17858
- return part !== rowIDPart;
17886
+ return part === rowIDPart;
17859
17887
  })) {
17860
- // Trigger skip of this row
17861
- return false;
17888
+ foundState.end = true;
17889
+ } else if (foundState.end) {
17890
+ // If no longer matching, trigger end of the table
17891
+ return true;
17862
17892
  }
17863
- foundState.start = true;
17864
- }
17865
- // This doesn't go in an `else` for the above in case the start is the end
17866
- if (endsRaw.every((part, i) => {
17867
- const rowIDPart = rowIDParts[i];
17868
- return part === rowIDPart;
17869
- })) {
17870
- foundState.end = true;
17871
- } else if (foundState.end) {
17872
- // If no longer matching, trigger end of the table
17873
- return true;
17874
- }
17875
- return rowIDPartsPreferred.join('-'); // rowID;
17893
+ return rowIDPartsPreferred.join('-'); // rowID;
17894
+ };
17876
17895
  };
17877
-
17878
- const getCheckedAndInterlinearFieldInfo = ({
17879
- localizedFieldNames
17880
- }) => {
17896
+ const getCheckedAndInterlinearFieldInfo = _ref10 => {
17897
+ let {
17898
+ localizedFieldNames
17899
+ } = _ref10;
17881
17900
  let i = 1;
17882
17901
  let field, checked;
17883
17902
  let checkedFields = [];
@@ -17902,12 +17921,13 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
17902
17921
  });
17903
17922
  return [checkedFields, checkedFieldIndexes, allInterlinearColIndexes];
17904
17923
  };
17905
- const getCaption = ({
17906
- starts,
17907
- ends,
17908
- applicableBrowseFieldNames,
17909
- heading
17910
- }) => {
17924
+ const getCaption = _ref11 => {
17925
+ let {
17926
+ starts,
17927
+ ends,
17928
+ applicableBrowseFieldNames,
17929
+ heading
17930
+ } = _ref11;
17911
17931
  let caption;
17912
17932
  const hasCaption = $pRaw('caption') !== '0';
17913
17933
  if (hasCaption) {
@@ -17947,7 +17967,6 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
17947
17967
  : ' ' // e.g., for 2nd space in "Surah 2 5-8"
17948
17968
  );
17949
17969
  }
17950
-
17951
17970
  endVals.push(ends[i]);
17952
17971
  return ret + startSep;
17953
17972
  }, '').slice(0, -startSep.length);
@@ -17967,12 +17986,13 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
17967
17986
  }
17968
17987
  return [hasCaption, caption];
17969
17988
  };
17970
- const runPresort = ({
17971
- presort,
17972
- tableData,
17973
- applicableBrowseFieldNames,
17974
- localizedFieldNames
17975
- }) => {
17989
+ const runPresort = _ref12 => {
17990
+ let {
17991
+ presort,
17992
+ tableData,
17993
+ applicableBrowseFieldNames,
17994
+ localizedFieldNames
17995
+ } = _ref12;
17976
17996
  // Todo: Ought to be checking against an aliased table
17977
17997
  if (presort) {
17978
17998
  tableData.sort((rowA, rowB) => {
@@ -17984,22 +18004,23 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
17984
18004
  precedence = rowBFirst ? 1 : -1;
17985
18005
  return rowAFirst || rowBFirst; // Keep going if 0
17986
18006
  });
17987
-
17988
18007
  return precedence;
17989
18008
  });
17990
18009
  }
17991
18010
  };
17992
- const getFieldValueAliasMap = ({
17993
- schemaItems,
17994
- fieldInfo,
17995
- metadataObj,
17996
- getFieldAliasOrName,
17997
- usePreferAlias
17998
- }) => {
17999
- return fieldInfo.map(({
18000
- field,
18001
- plugin
18002
- }) => {
18011
+ const getFieldValueAliasMap = _ref13 => {
18012
+ let {
18013
+ schemaItems,
18014
+ fieldInfo,
18015
+ metadataObj,
18016
+ getFieldAliasOrName,
18017
+ usePreferAlias
18018
+ } = _ref13;
18019
+ return fieldInfo.map(_ref14 => {
18020
+ let {
18021
+ field,
18022
+ plugin
18023
+ } = _ref14;
18003
18024
  if (plugin) {
18004
18025
  return undefined;
18005
18026
  }
@@ -18017,7 +18038,8 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18017
18038
  return preferAlias !== false ? fieldValueAliasMap : undefined;
18018
18039
  }
18019
18040
  if (fieldValueAliasMap) {
18020
- Object.entries(fieldValueAliasMap).forEach(([key, val]) => {
18041
+ Object.entries(fieldValueAliasMap).forEach(_ref15 => {
18042
+ let [key, val] = _ref15;
18021
18043
  if (Array.isArray(val)) {
18022
18044
  fieldValueAliasMap[key] = val.map(value => {
18023
18045
  return Templates.resultsDisplayServerOrClient.fieldValueAlias({
@@ -18034,7 +18056,8 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18034
18056
  value: val[preferAlias]
18035
18057
  });
18036
18058
  } else {
18037
- Object.entries(val).forEach(([k, value]) => {
18059
+ Object.entries(val).forEach(_ref16 => {
18060
+ let [k, value] = _ref16;
18038
18061
  fieldValueAliasMap[key][k] = Templates.resultsDisplayServerOrClient.fieldValueAlias({
18039
18062
  key,
18040
18063
  value
@@ -18084,13 +18107,12 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18084
18107
  }
18085
18108
  return key; // || p; // $p.get(param, true);
18086
18109
  };
18087
-
18088
18110
  const escapeCSS = escapeHTML;
18089
18111
  const $pRawEsc = param => escapeHTML($pRaw(param));
18090
18112
  const $pEscArbitrary = param => escapeHTML($p.get(param, true));
18091
18113
 
18092
18114
  // Not currently in use
18093
- const escapeQuotedCSS = s => s.replaceAll('\\', '\\\\').replaceAll('"', '\\"');
18115
+ const escapeQuotedCSS = s => s.replaceAll('\\', '\\\\').replaceAll('"', String.raw`\"`);
18094
18116
  const {
18095
18117
  fileData,
18096
18118
  workI18n,
@@ -18117,20 +18139,22 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18117
18139
  schemaItems,
18118
18140
  getFieldAliasOrName,
18119
18141
  lang,
18120
- callback({
18121
- setName,
18122
- browseFields,
18123
- presort
18124
- }) {
18142
+ callback(_ref17) {
18143
+ let {
18144
+ setName,
18145
+ browseFields,
18146
+ presort
18147
+ } = _ref17;
18125
18148
  setNames.push(setName);
18126
18149
  presorts.push(presort);
18127
18150
  browseFieldSets.push(browseFields);
18128
18151
  }
18129
18152
  });
18130
- const fieldInfo = schemaItems.map(({
18131
- title: field,
18132
- format
18133
- }) => {
18153
+ const fieldInfo = schemaItems.map(_ref18 => {
18154
+ let {
18155
+ title: field,
18156
+ format
18157
+ } = _ref18;
18134
18158
  return {
18135
18159
  field,
18136
18160
  fieldAliasOrName: getFieldAliasOrName(field) || field,
@@ -18147,23 +18171,25 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18147
18171
  const {
18148
18172
  lang
18149
18173
  } = this; // array with first item as preferred
18150
- pluginsForWork.iterateMappings(({
18151
- // plugin,
18152
- pluginName,
18153
- pluginLang,
18154
- onByDefaultDefault,
18155
- placement,
18156
- applicableFields,
18157
- meta
18158
- }) => {
18174
+ pluginsForWork.iterateMappings(_ref19 => {
18175
+ let {
18176
+ // plugin,
18177
+ pluginName,
18178
+ pluginLang,
18179
+ onByDefaultDefault,
18180
+ placement,
18181
+ applicableFields,
18182
+ meta
18183
+ } = _ref19;
18159
18184
  placement = placement === 'end' ? Number.POSITIVE_INFINITY // push
18160
18185
  : placement;
18161
- const processField = ({
18162
- applicableField,
18163
- targetLanguage,
18164
- onByDefault,
18165
- metaApplicableField
18166
- } = {}) => {
18186
+ const processField = function () {
18187
+ let {
18188
+ applicableField,
18189
+ targetLanguage,
18190
+ onByDefault,
18191
+ metaApplicableField
18192
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18167
18193
  const plugin = pluginsForWork.getPluginObject(pluginName) || {};
18168
18194
  const applicableFieldLang = metadata.getFieldLang(applicableField);
18169
18195
  if (plugin.getTargetLanguage) {
@@ -18229,9 +18255,10 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18229
18255
  }
18230
18256
  const localizedFieldNames = fieldInfo.map(fi => fi.fieldAliasOrName);
18231
18257
  const escapeColumnIndexes = fieldInfo.map(fi => fi.escapeColumn);
18232
- const fieldLangs = fieldInfo.map(({
18233
- fieldLang
18234
- }) => {
18258
+ const fieldLangs = fieldInfo.map(_ref20 => {
18259
+ let {
18260
+ fieldLang
18261
+ } = _ref20;
18235
18262
  return fieldLang !== preferredLocale ? fieldLang : null;
18236
18263
  });
18237
18264
  const fieldValueAliasMap = getFieldValueAliasMap({
@@ -18254,8 +18281,20 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18254
18281
  const localizeParamNames = $p.localizeParamNames = $p.has('i18n', true) ? $p.get('i18n', true) === '1' : prefI18n === 'true' || prefI18n !== 'false' && this.localizeParamNames;
18255
18282
  const lParam = localizeParamNames ? key => l(['params', key]) : key => key;
18256
18283
  const lIndexedParam = localizeParamNames ? key => l(['params', 'indexed', key]) : key => key;
18257
- const lParamRaw = localizeParamNames ? (key, suffix = '') => $p.get(lParam(key) + suffix, true) : (key, suffix = '') => $p.get(key + suffix, true);
18258
- const lIndexedParamRaw = localizeParamNames ? (key, suffix = '') => $p.get($p.get('work') + '-' + lIndexedParam(key) + suffix, true) : (key, suffix = '') => $p.get($p.get('work') + '-' + key + suffix, true);
18284
+ const lParamRaw = localizeParamNames ? function (key) {
18285
+ let suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
18286
+ return $p.get(lParam(key) + suffix, true);
18287
+ } : function (key) {
18288
+ let suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
18289
+ return $p.get(key + suffix, true);
18290
+ };
18291
+ const lIndexedParamRaw = localizeParamNames ? function (key) {
18292
+ let suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
18293
+ return $p.get($p.get('work') + '-' + lIndexedParam(key) + suffix, true);
18294
+ } : function (key) {
18295
+ let suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
18296
+ return $p.get($p.get('work') + '-' + key + suffix, true);
18297
+ };
18259
18298
 
18260
18299
  // Now that we know `browseFieldSets`, we can parse `startEnd`
18261
18300
  const browseFieldSetStartEndIdx = browseFieldSets.findIndex((item, i) => {
@@ -18340,7 +18379,8 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18340
18379
  // Look to dealias
18341
18380
  const fvEntries = Object.entries(rawFieldValueAliasMap);
18342
18381
  if (Array.isArray(fvEntries[0][1])) {
18343
- fvEntries.some(([key, arr]) => {
18382
+ fvEntries.some(_ref21 => {
18383
+ let [key, arr] = _ref21;
18344
18384
  if (arr.includes(v)) {
18345
18385
  dealiased = key;
18346
18386
  return true;
@@ -18348,7 +18388,8 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18348
18388
  return false;
18349
18389
  });
18350
18390
  } else {
18351
- fvEntries.some(([key, obj]) => {
18391
+ fvEntries.some(_ref22 => {
18392
+ let [key, obj] = _ref22;
18352
18393
  const arr = Object.values(obj);
18353
18394
  if (arr.includes(v)) {
18354
18395
  dealiased = key;
@@ -18379,11 +18420,12 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18379
18420
  // Todo: Fetch the work in code based on the non-localized `datafileName`
18380
18421
  const dbName = this.namespace + '-textbrowser-cache-data';
18381
18422
  const req = indexedDB.open(dbName);
18382
- req.onsuccess = ({
18383
- target: {
18384
- result: db
18385
- }
18386
- }) => {
18423
+ req.onsuccess = _ref23 => {
18424
+ let {
18425
+ target: {
18426
+ result: db
18427
+ }
18428
+ } = _ref23;
18387
18429
  const storeName = 'files-to-cache-' + unlocalizedWorkName;
18388
18430
  const trans = db.transaction(storeName);
18389
18431
  const store = trans.objectStore(storeName);
@@ -18395,11 +18437,12 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18395
18437
  // console.log('applicableBrowseFieldSetName', 'browseFields-' + applicableBrowseFieldSetName);
18396
18438
 
18397
18439
  const r = index.getAll(IDBKeyRange.bound(startsRaw, endsRaw));
18398
- r.onsuccess = ({
18399
- target: {
18400
- result
18401
- }
18402
- }) => {
18440
+ r.onsuccess = _ref24 => {
18441
+ let {
18442
+ target: {
18443
+ result
18444
+ }
18445
+ } = _ref24;
18403
18446
  const converted = result.map(r => r.value);
18404
18447
  resolve(converted);
18405
18448
  };
@@ -18439,10 +18482,11 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18439
18482
  }
18440
18483
  }
18441
18484
  if (!usingServerData && pluginsForWork) {
18442
- fieldInfo.forEach(({
18443
- plugin,
18444
- placement
18445
- }) => {
18485
+ fieldInfo.forEach(_ref25 => {
18486
+ let {
18487
+ plugin,
18488
+ placement
18489
+ } = _ref25;
18446
18490
  if (!plugin) {
18447
18491
  return;
18448
18492
  }
@@ -18452,20 +18496,21 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18452
18496
  );
18453
18497
  });
18454
18498
  });
18455
-
18456
- fieldInfo.forEach(({
18457
- plugin,
18458
- applicableField,
18459
- fieldLang,
18460
- meta,
18461
- metaApplicableField
18462
- }, j) => {
18499
+ fieldInfo.forEach((_ref26, j) => {
18500
+ let {
18501
+ plugin,
18502
+ applicableField,
18503
+ fieldLang,
18504
+ meta,
18505
+ metaApplicableField
18506
+ } = _ref26;
18463
18507
  if (!plugin) {
18464
18508
  return;
18465
18509
  }
18466
- const applicableFieldIdx = fieldInfo.findIndex(({
18467
- field
18468
- }) => {
18510
+ const applicableFieldIdx = fieldInfo.findIndex(_ref27 => {
18511
+ let {
18512
+ field
18513
+ } = _ref27;
18469
18514
  return field === applicableField;
18470
18515
  });
18471
18516
  // Now safe to pass (and set) `j` value as tr array expanded
@@ -18556,8 +18601,6 @@ const resultsDisplayServerOrClient = async function resultsDisplayServerOrClient
18556
18601
  };
18557
18602
  };
18558
18603
 
18559
- /* eslint-enable no-unused-vars, @stylistic/brace-style */
18560
-
18561
18604
  /**
18562
18605
  *
18563
18606
  * @returns {Promise<void>}
@@ -18660,7 +18703,7 @@ async function requestPermissions(langs, l) {
18660
18703
  // rememberRefusal();
18661
18704
  resolve();
18662
18705
  return;
18663
- // eslint-disable-next-line sonarjs/no-duplicated-branches
18706
+ // eslint-disable-next-line sonarjs/no-duplicated-branches -- Ease of maintenance
18664
18707
  case 'default':
18665
18708
  resolve();
18666
18709
  return;
@@ -18695,7 +18738,7 @@ class TextBrowser {
18695
18738
  const stylesheets = options.stylesheets || ['@builtin'];
18696
18739
  const builtinIndex = stylesheets.indexOf('@builtin');
18697
18740
  if (builtinIndex !== -1) {
18698
- stylesheets.splice(builtinIndex, 1, new URL(new URL('assets/index-_11XnUty.css', import.meta.url).href, import.meta.url).href);
18741
+ stylesheets.splice(builtinIndex, 1, new URL(new URL('assets/index-D_XVedS3.css', import.meta.url).href, import.meta.url).href);
18699
18742
  }
18700
18743
  this.stylesheets = stylesheets;
18701
18744
  setServiceWorkerDefaults(this, options);
@@ -18735,10 +18778,11 @@ class TextBrowser {
18735
18778
  }
18736
18779
  getWorkData(opts) {
18737
18780
  try {
18738
- return getWorkData.call(this, _objectSpread2$1(_objectSpread2$1({}, opts), {}, {
18781
+ return getWorkData.call(this, {
18782
+ ...opts,
18739
18783
  files: this.files,
18740
18784
  allowPlugins: this.allowPlugins
18741
- }));
18785
+ });
18742
18786
  } catch (err) {
18743
18787
  console.log('err', err);
18744
18788
  dialogs.alert('catch:' + err);
@@ -18758,14 +18802,16 @@ class TextBrowser {
18758
18802
  });
18759
18803
  }
18760
18804
  getFieldNameAndValueAliases(args) {
18761
- return getFieldNameAndValueAliases(_objectSpread2$1(_objectSpread2$1({}, args), {}, {
18805
+ return getFieldNameAndValueAliases({
18806
+ ...args,
18762
18807
  lang: this.lang
18763
- }));
18808
+ });
18764
18809
  }
18765
18810
  getBrowseFieldData(args) {
18766
- return getBrowseFieldData(_objectSpread2$1(_objectSpread2$1({}, args), {}, {
18811
+ return getBrowseFieldData({
18812
+ ...args,
18767
18813
  lang: this.lang
18768
- }));
18814
+ });
18769
18815
  }
18770
18816
  async paramChange() {
18771
18817
  Templates.defaultBody();
@@ -18784,7 +18830,6 @@ class TextBrowser {
18784
18830
  empty: true
18785
18831
  }), document.title, url);
18786
18832
  // Get and set new state within URL
18787
- // eslint-disable-next-line n/callback-return
18788
18833
  cb();
18789
18834
  location.hash = '#' + $p.toString();
18790
18835
  };
@@ -18809,10 +18854,11 @@ class TextBrowser {
18809
18854
  messageStyle: 'plainNested',
18810
18855
  locales: lang,
18811
18856
  defaultLocales: fallbackLanguages,
18812
- localeStringFinder({
18813
- locales,
18814
- defaultLocales
18815
- }) {
18857
+ localeStringFinder(_ref) {
18858
+ let {
18859
+ locales,
18860
+ defaultLocales
18861
+ } = _ref;
18816
18862
  const locale = [...locales, ...defaultLocales].find(language => {
18817
18863
  return language in localizationStrings;
18818
18864
  });