securemark 0.223.0 → 0.225.1

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.
@@ -1,4 +1,4 @@
1
- /*! securemark v0.223.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.225.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
2
2
  require = function () {
3
3
  function r(e, n, t) {
4
4
  function o(i, f) {
@@ -215,21 +215,52 @@ require = function () {
215
215
  function (_dereq_, module, exports) {
216
216
  'use strict';
217
217
  Object.defineProperty(exports, '__esModule', { value: true });
218
- exports.aggregate = exports.bundle = void 0;
219
- function bundle(...as) {
218
+ exports.compile = exports.aggregate = exports.bundle = void 0;
219
+ const function_1 = _dereq_('./function');
220
+ function bundle(...fs) {
220
221
  return function (...bs) {
221
- return as.map((f, i) => f.call(this, bs[i]));
222
+ return fs.map((f, i) => f.call(this, bs[i]));
222
223
  };
223
224
  }
224
225
  exports.bundle = bundle;
225
- function aggregate(...as) {
226
- return function (b) {
227
- return as.map(f => f.call(this, b));
226
+ function aggregate(...fs) {
227
+ return function (a) {
228
+ return fs.map(f => f.call(this, a));
228
229
  };
229
230
  }
230
231
  exports.aggregate = aggregate;
232
+ function compile(...fs) {
233
+ return function (a) {
234
+ var _a;
235
+ const gs = [];
236
+ try {
237
+ for (let i = 0; i < fs.length; ++i) {
238
+ gs.push(fs[i].call(this, a));
239
+ }
240
+ return (0, function_1.singleton)(() => cancel(gs));
241
+ } catch (reason) {
242
+ cancel(gs);
243
+ throw new Error(`Spica: Arrow: ${ (_a = reason === null || reason === void 0 ? void 0 : reason.toString()) !== null && _a !== void 0 ? _a : reason }`);
244
+ }
245
+ };
246
+ }
247
+ exports.compile = compile;
248
+ function cancel(cancellers) {
249
+ const reasons = [];
250
+ for (let i = 0; i < cancellers.length; ++i) {
251
+ try {
252
+ cancellers[i]();
253
+ } catch (reason) {
254
+ reasons.push(reason);
255
+ }
256
+ }
257
+ if (reasons.length > 0) {
258
+ throw new AggregateError(reasons);
259
+ }
260
+ return;
261
+ }
231
262
  },
232
- {}
263
+ { './function': 16 }
233
264
  ],
234
265
  8: [
235
266
  function (_dereq_, module, exports) {
@@ -835,7 +866,7 @@ require = function () {
835
866
  exports.uncurry = uncurry;
836
867
  function uncurry_(f) {
837
868
  const arity = f.length;
838
- return (...xs) => arity === 0 || xs.length < 2 || xs.length <= arity ? f(...xs) : uncurry_(f(...(0, array_1.shift)(xs, arity)[0]))(...xs);
869
+ return (...xs) => arity === 0 || xs.length <= arity ? f(...xs) : uncurry_(f(...(0, array_1.shift)(xs, arity)[0]))(...xs);
839
870
  }
840
871
  },
841
872
  { './array': 6 }
@@ -869,9 +900,7 @@ require = function () {
869
900
  function (_dereq_, module, exports) {
870
901
  'use strict';
871
902
  Object.defineProperty(exports, '__esModule', { value: true });
872
- exports.run = exports.clear = exports.mapReturn = exports.mapParameters = exports.singleton = void 0;
873
- const global_1 = _dereq_('./global');
874
- const exception_1 = _dereq_('./exception');
903
+ exports.clear = exports.singleton = void 0;
875
904
  const noop_1 = _dereq_('./noop');
876
905
  function singleton(f) {
877
906
  let result;
@@ -884,55 +913,12 @@ require = function () {
884
913
  };
885
914
  }
886
915
  exports.singleton = singleton;
887
- function mapParameters(f, g) {
888
- return (...as) => f(...g(...as));
889
- }
890
- exports.mapParameters = mapParameters;
891
- function mapReturn(f, g) {
892
- return (...as) => g(f(...as));
893
- }
894
- exports.mapReturn = mapReturn;
895
916
  function clear(f) {
896
917
  return (...as) => void f(...as);
897
918
  }
898
919
  exports.clear = clear;
899
- function run(fs) {
900
- const gs = (0, global_1.Array)(fs.length);
901
- try {
902
- for (let i = 0; i < fs.length; ++i) {
903
- gs[i] = fs[i]();
904
- }
905
- } catch (reason) {
906
- for (let i = 0; gs[i]; ++i) {
907
- try {
908
- gs[i]();
909
- } catch (reason) {
910
- (0, exception_1.causeAsyncException)(reason);
911
- }
912
- }
913
- throw reason;
914
- }
915
- return singleton(() => {
916
- const rs = [];
917
- for (let i = 0; gs[i]; ++i) {
918
- try {
919
- gs[i]();
920
- } catch (reason) {
921
- rs.push(reason);
922
- }
923
- }
924
- if (rs.length > 0) {
925
- throw new AggregateError(rs);
926
- }
927
- });
928
- }
929
- exports.run = run;
930
920
  },
931
- {
932
- './exception': 14,
933
- './global': 17,
934
- './noop': 22
935
- }
921
+ { './noop': 22 }
936
922
  ],
937
923
  17: [
938
924
  function (_dereq_, module, exports) {
@@ -2165,7 +2151,7 @@ require = function () {
2165
2151
  }
2166
2152
  exports.join = join;
2167
2153
  },
2168
- { './global': 9 }
2154
+ { './global': 8 }
2169
2155
  ],
2170
2156
  6: [
2171
2157
  function (_dereq_, module, exports) {
@@ -2183,21 +2169,7 @@ require = function () {
2183
2169
  function (_dereq_, module, exports) {
2184
2170
  'use strict';
2185
2171
  Object.defineProperty(exports, '__esModule', { value: true });
2186
- exports.causeAsyncException = void 0;
2187
- function causeAsyncException(reason) {
2188
- void Promise.reject(reason);
2189
- }
2190
- exports.causeAsyncException = causeAsyncException;
2191
- },
2192
- {}
2193
- ],
2194
- 8: [
2195
- function (_dereq_, module, exports) {
2196
- 'use strict';
2197
- Object.defineProperty(exports, '__esModule', { value: true });
2198
- exports.run = exports.clear = exports.mapReturn = exports.mapParameters = exports.singleton = void 0;
2199
- const global_1 = _dereq_('./global');
2200
- const exception_1 = _dereq_('./exception');
2172
+ exports.clear = exports.singleton = void 0;
2201
2173
  const noop_1 = _dereq_('./noop');
2202
2174
  function singleton(f) {
2203
2175
  let result;
@@ -2210,57 +2182,14 @@ require = function () {
2210
2182
  };
2211
2183
  }
2212
2184
  exports.singleton = singleton;
2213
- function mapParameters(f, g) {
2214
- return (...as) => f(...g(...as));
2215
- }
2216
- exports.mapParameters = mapParameters;
2217
- function mapReturn(f, g) {
2218
- return (...as) => g(f(...as));
2219
- }
2220
- exports.mapReturn = mapReturn;
2221
2185
  function clear(f) {
2222
2186
  return (...as) => void f(...as);
2223
2187
  }
2224
2188
  exports.clear = clear;
2225
- function run(fs) {
2226
- const gs = (0, global_1.Array)(fs.length);
2227
- try {
2228
- for (let i = 0; i < fs.length; ++i) {
2229
- gs[i] = fs[i]();
2230
- }
2231
- } catch (reason) {
2232
- for (let i = 0; gs[i]; ++i) {
2233
- try {
2234
- gs[i]();
2235
- } catch (reason) {
2236
- (0, exception_1.causeAsyncException)(reason);
2237
- }
2238
- }
2239
- throw reason;
2240
- }
2241
- return singleton(() => {
2242
- const rs = [];
2243
- for (let i = 0; gs[i]; ++i) {
2244
- try {
2245
- gs[i]();
2246
- } catch (reason) {
2247
- rs.push(reason);
2248
- }
2249
- }
2250
- if (rs.length > 0) {
2251
- throw new AggregateError(rs);
2252
- }
2253
- });
2254
- }
2255
- exports.run = run;
2256
2189
  },
2257
- {
2258
- './exception': 7,
2259
- './global': 9,
2260
- './noop': 11
2261
- }
2190
+ { './noop': 10 }
2262
2191
  ],
2263
- 9: [
2192
+ 8: [
2264
2193
  function (_dereq_, module, exports) {
2265
2194
  'use strict';
2266
2195
  const global = void 0 || typeof globalThis !== 'undefined' && globalThis || typeof self !== 'undefined' && self || Function('return this')();
@@ -2269,7 +2198,7 @@ require = function () {
2269
2198
  },
2270
2199
  {}
2271
2200
  ],
2272
- 10: [
2201
+ 9: [
2273
2202
  function (_dereq_, module, exports) {
2274
2203
  'use strict';
2275
2204
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -2310,10 +2239,10 @@ require = function () {
2310
2239
  },
2311
2240
  {
2312
2241
  './compare': 6,
2313
- './global': 9
2242
+ './global': 8
2314
2243
  }
2315
2244
  ],
2316
- 11: [
2245
+ 10: [
2317
2246
  function (_dereq_, module, exports) {
2318
2247
  'use strict';
2319
2248
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -2324,7 +2253,7 @@ require = function () {
2324
2253
  },
2325
2254
  {}
2326
2255
  ],
2327
- 12: [
2256
+ 11: [
2328
2257
  function (_dereq_, module, exports) {
2329
2258
  'use strict';
2330
2259
  var _a, _b;
@@ -2671,11 +2600,11 @@ require = function () {
2671
2600
  },
2672
2601
  {
2673
2602
  './alias': 4,
2674
- './global': 9,
2675
- './noop': 11
2603
+ './global': 8,
2604
+ './noop': 10
2676
2605
  }
2677
2606
  ],
2678
- 13: [
2607
+ 12: [
2679
2608
  function (_dereq_, module, exports) {
2680
2609
  'use strict';
2681
2610
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -2757,9 +2686,9 @@ require = function () {
2757
2686
  }
2758
2687
  }
2759
2688
  },
2760
- { './global': 9 }
2689
+ { './global': 8 }
2761
2690
  ],
2762
- 14: [
2691
+ 13: [
2763
2692
  function (_dereq_, module, exports) {
2764
2693
  'use strict';
2765
2694
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -2812,12 +2741,12 @@ require = function () {
2812
2741
  }
2813
2742
  },
2814
2743
  {
2815
- './proxy': 15,
2816
- './util/dom': 16,
2744
+ './proxy': 14,
2745
+ './util/dom': 15,
2817
2746
  'spica/alias': 4
2818
2747
  }
2819
2748
  ],
2820
- 15: [
2749
+ 14: [
2821
2750
  function (_dereq_, module, exports) {
2822
2751
  'use strict';
2823
2752
  var _a, _b, _c, _d;
@@ -3121,14 +3050,14 @@ require = function () {
3121
3050
  }
3122
3051
  },
3123
3052
  {
3124
- './util/dom': 16,
3125
- './util/identity': 17,
3053
+ './util/dom': 15,
3054
+ './util/identity': 16,
3126
3055
  'spica/alias': 4,
3127
3056
  'spica/array': 5,
3128
- 'spica/global': 9
3057
+ 'spica/global': 8
3129
3058
  }
3130
3059
  ],
3131
- 16: [
3060
+ 15: [
3132
3061
  function (_dereq_, module, exports) {
3133
3062
  'use strict';
3134
3063
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -3196,18 +3125,22 @@ require = function () {
3196
3125
  case 'function':
3197
3126
  if (name.length < 3)
3198
3127
  throw new Error(`TypedDOM: Attribute names for event listeners must have an event name but got "${ name }".`);
3199
- if (name.slice(0, 2) !== 'on')
3200
- throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${ name }".`);
3201
- el.addEventListener(name.slice(2), value, {
3202
- passive: [
3203
- 'wheel',
3204
- 'mousewheel',
3205
- 'touchstart',
3206
- 'touchmove',
3207
- 'touchend',
3208
- 'touchcancel'
3209
- ].includes(name.slice(2))
3210
- });
3128
+ const names = name.split(/\s+/);
3129
+ for (let i = 0; i < names.length; ++i) {
3130
+ const name = names[i];
3131
+ if (name.slice(0, 2) !== 'on')
3132
+ throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${ name }".`);
3133
+ el.addEventListener(name.slice(2), value, {
3134
+ passive: [
3135
+ 'wheel',
3136
+ 'mousewheel',
3137
+ 'touchstart',
3138
+ 'touchmove',
3139
+ 'touchend',
3140
+ 'touchcancel'
3141
+ ].includes(name.slice(2))
3142
+ });
3143
+ }
3211
3144
  continue;
3212
3145
  case 'object':
3213
3146
  el.removeAttribute(name);
@@ -3242,11 +3175,11 @@ require = function () {
3242
3175
  },
3243
3176
  {
3244
3177
  'spica/alias': 4,
3245
- 'spica/global': 9,
3246
- 'spica/memoize': 10
3178
+ 'spica/global': 8,
3179
+ 'spica/memoize': 9
3247
3180
  }
3248
3181
  ],
3249
- 17: [
3182
+ 16: [
3250
3183
  function (_dereq_, module, exports) {
3251
3184
  'use strict';
3252
3185
  var _a;
@@ -3258,11 +3191,11 @@ require = function () {
3258
3191
  exports.identity = (0, random_1.unique)(random_1.rnd0Z, 2, (_a = global_1.global[ids]) !== null && _a !== void 0 ? _a : global_1.global[ids] = new global_1.Set());
3259
3192
  },
3260
3193
  {
3261
- 'spica/global': 9,
3262
- 'spica/random': 13
3194
+ 'spica/global': 8,
3195
+ 'spica/random': 12
3263
3196
  }
3264
3197
  ],
3265
- 18: [
3198
+ 17: [
3266
3199
  function (_dereq_, module, exports) {
3267
3200
  'use strict';
3268
3201
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -3313,12 +3246,12 @@ require = function () {
3313
3246
  exports.bind = bind;
3314
3247
  },
3315
3248
  {
3316
- 'spica/function': 8,
3317
- 'spica/noop': 11,
3318
- 'spica/promise': 12
3249
+ 'spica/function': 7,
3250
+ 'spica/noop': 10,
3251
+ 'spica/promise': 11
3319
3252
  }
3320
3253
  ],
3321
- 19: [
3254
+ 18: [
3322
3255
  function (_dereq_, module, exports) {
3323
3256
  'use strict';
3324
3257
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -3333,7 +3266,7 @@ require = function () {
3333
3266
  }
3334
3267
  exports.apply = apply;
3335
3268
  },
3336
- { './dom': 16 }
3269
+ { './dom': 15 }
3337
3270
  ],
3338
3271
  'typed-dom': [
3339
3272
  function (_dereq_, module, exports) {
@@ -3475,13 +3408,13 @@ require = function () {
3475
3408
  });
3476
3409
  },
3477
3410
  {
3478
- './src/builder': 14,
3479
- './src/proxy': 15,
3480
- './src/util/dom': 16,
3481
- './src/util/identity': 17,
3482
- './src/util/listener': 18,
3483
- './src/util/query': 19,
3484
- 'spica/global': 9
3411
+ './src/builder': 13,
3412
+ './src/proxy': 14,
3413
+ './src/util/dom': 15,
3414
+ './src/util/identity': 16,
3415
+ './src/util/listener': 17,
3416
+ './src/util/query': 18,
3417
+ 'spica/global': 8
3485
3418
  }
3486
3419
  ]
3487
3420
  }, {}, [
@@ -6625,7 +6558,7 @@ require = function () {
6625
6558
  exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('((', '))', '\n', (0, combinator_1.fmap)((0, combinator_1.surround)('((', (0, combinator_1.guard)(context => {
6626
6559
  var _a, _b, _c;
6627
6560
  return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.annotation) !== null && _c !== void 0 ? _c : true;
6628
- }, (0, util_1.startLoose)((0, util_1.visible)((0, combinator_1.context)({
6561
+ }, (0, util_1.startLoose)((0, combinator_1.context)({
6629
6562
  syntax: {
6630
6563
  inline: {
6631
6564
  annotation: false,
@@ -6633,7 +6566,7 @@ require = function () {
6633
6566
  }
6634
6567
  },
6635
6568
  state: global_1.undefined
6636
- }, (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, ')', /^\\?\n/)]))))), '))'), ns => [(0, typed_dom_1.html)('sup', { class: 'annotation' }, (0, util_1.trimNode)((0, typed_dom_1.defrag)(ns)))]))));
6569
+ }, (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, ')', /^\\?\n/)])), '))')), '))'), ns => [(0, typed_dom_1.html)('sup', { class: 'annotation' }, (0, util_1.trimNode)((0, typed_dom_1.defrag)(ns)))]))));
6637
6570
  },
6638
6571
  {
6639
6572
  '../../combinator': 30,
@@ -7033,7 +6966,7 @@ require = function () {
7033
6966
  const typed_dom_1 = _dereq_('typed-dom');
7034
6967
  const array_1 = _dereq_('spica/array');
7035
6968
  exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '~~')]), (0, source_1.str)('~~'), false, ([, bs], rest) => [
7036
- [(0, typed_dom_1.html)('del', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
6969
+ [(0, typed_dom_1.html)('del', (0, typed_dom_1.defrag)((0, util_1.trimNodeEndBR)(bs)))],
7037
6970
  rest
7038
6971
  ], ([as, bs], rest) => [
7039
6972
  (0, array_1.unshift)(as, bs),
@@ -7065,7 +6998,7 @@ require = function () {
7065
6998
  strong_1.strong,
7066
6999
  (0, combinator_1.some)(inline_1.inline, '*')
7067
7000
  ]))), (0, source_1.str)('*'), false, ([as, bs, cs], rest) => (0, util_1.isEndTightNodes)(bs) ? [
7068
- [(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
7001
+ [(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))],
7069
7002
  rest
7070
7003
  ] : [
7071
7004
  (0, array_1.unshift)(as, bs),
@@ -7106,41 +7039,41 @@ require = function () {
7106
7039
  switch (cs[0]) {
7107
7040
  case '*':
7108
7041
  return (_a = (0, combinator_1.bind)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '**')]), (ds, rest) => rest.slice(0, 2) === '**' && (0, util_1.isEndTightNodes)(ds) ? [
7109
- [(0, typed_dom_1.html)('strong', (0, array_1.unshift)([(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))], (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(ds))))],
7042
+ [(0, typed_dom_1.html)('strong', (0, array_1.unshift)([(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))], (0, typed_dom_1.defrag)(ds)))],
7110
7043
  rest.slice(2)
7111
7044
  ] : [
7112
7045
  (0, array_1.unshift)([
7113
7046
  '**',
7114
- (0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))
7047
+ (0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))
7115
7048
  ], ds),
7116
7049
  rest
7117
7050
  ])(rest, context)) !== null && _a !== void 0 ? _a : [
7118
7051
  [
7119
7052
  '**',
7120
- (0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))
7053
+ (0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))
7121
7054
  ],
7122
7055
  rest
7123
7056
  ];
7124
7057
  case '**':
7125
7058
  return (_b = (0, combinator_1.bind)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*')]), (ds, rest) => rest.slice(0, 1) === '*' && (0, util_1.isEndTightNodes)(ds) ? [
7126
- [(0, typed_dom_1.html)('em', (0, array_1.unshift)([(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))], (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(ds))))],
7059
+ [(0, typed_dom_1.html)('em', (0, array_1.unshift)([(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))], (0, typed_dom_1.defrag)(ds)))],
7127
7060
  rest.slice(1)
7128
7061
  ] : [
7129
7062
  (0, array_1.unshift)([
7130
7063
  '*',
7131
- (0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))
7064
+ (0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))
7132
7065
  ], ds),
7133
7066
  rest
7134
7067
  ])(rest, context)) !== null && _b !== void 0 ? _b : [
7135
7068
  [
7136
7069
  '*',
7137
- (0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))
7070
+ (0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))
7138
7071
  ],
7139
7072
  rest
7140
7073
  ];
7141
7074
  case '***':
7142
7075
  return [
7143
- [(0, typed_dom_1.html)('em', [(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))])],
7076
+ [(0, typed_dom_1.html)('em', [(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))])],
7144
7077
  rest
7145
7078
  ];
7146
7079
  }
@@ -7485,7 +7418,7 @@ require = function () {
7485
7418
  [(0, typed_dom_1.html)(tag, attributes('html', [], attrspec[tag], as))],
7486
7419
  rest
7487
7420
  ]), ([, tag]) => tag)),
7488
- (0, combinator_1.match)(/^(?=<(sup|sub|small|bdo|bdi)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)('>'), true), (0, util_1.startLoose)((0, util_1.visible)((0, combinator_1.context)((() => {
7421
+ (0, combinator_1.match)(/^(?=<(sup|sub|small|bdo|bdi)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)('>'), true), (0, util_1.startLoose)((0, combinator_1.context)((() => {
7489
7422
  switch (tag) {
7490
7423
  case 'sup':
7491
7424
  case 'sub':
@@ -7507,12 +7440,12 @@ require = function () {
7507
7440
  default:
7508
7441
  return {};
7509
7442
  }
7510
- })(), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), `</${ tag }>`)))), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest, context) => [
7511
- [elem(tag, as, (0, util_1.trimEndBR)((0, typed_dom_1.defrag)(bs)), cs, context)],
7443
+ })(), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), `</${ tag }>`)), `</${ tag }>`), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest, context) => [
7444
+ [elem(tag, as, (0, util_1.trimNodeEndBR)((0, typed_dom_1.defrag)(bs)), cs, context)],
7512
7445
  rest
7513
7446
  ])), ([, tag]) => tag)),
7514
- (0, combinator_1.match)(/^(?=<([a-z]+)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)('>'), true), (0, util_1.startLoose)((0, util_1.visible)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), `</${ tag }>`))), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest) => [
7515
- [elem(tag, as, (0, util_1.trimEndBR)((0, typed_dom_1.defrag)(bs)), cs, {})],
7447
+ (0, combinator_1.match)(/^(?=<([a-z]+)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)('>'), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), `</${ tag }>`), `</${ tag }>`), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest) => [
7448
+ [elem(tag, as, (0, util_1.trimNodeEndBR)((0, typed_dom_1.defrag)(bs)), cs, {})],
7516
7449
  rest
7517
7450
  ], ([as, bs], rest) => as.length === 1 ? [
7518
7451
  (0, array_1.unshift)(as, bs),
@@ -7529,14 +7462,14 @@ require = function () {
7529
7462
  case 'sub':
7530
7463
  switch (true) {
7531
7464
  case (_b = (_a = context.state) === null || _a === void 0 ? void 0 : _a.in) === null || _b === void 0 ? void 0 : _b.supsub:
7532
- return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup>/<sub> HTML tags.`, as, bs, cs);
7465
+ return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup> or <sub> HTML tag.`, as, bs, cs);
7533
7466
  }
7534
7467
  break;
7535
7468
  case 'small':
7536
7469
  switch (true) {
7537
7470
  case (_d = (_c = context.state) === null || _c === void 0 ? void 0 : _c.in) === null || _d === void 0 ? void 0 : _d.supsub:
7538
7471
  case (_f = (_e = context.state) === null || _e === void 0 ? void 0 : _e.in) === null || _f === void 0 ? void 0 : _f.small:
7539
- return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup>/<sub>/<small> HTML tags.`, as, bs, cs);
7472
+ return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup>, <sub>, or <small> HTML tag.`, as, bs, cs);
7540
7473
  }
7541
7474
  break;
7542
7475
  }
@@ -7628,7 +7561,7 @@ require = function () {
7628
7561
  const typed_dom_1 = _dereq_('typed-dom');
7629
7562
  const array_1 = _dereq_('spica/array');
7630
7563
  exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '++')]), (0, source_1.str)('++'), false, ([, bs], rest) => [
7631
- [(0, typed_dom_1.html)('ins', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
7564
+ [(0, typed_dom_1.html)('ins', (0, typed_dom_1.defrag)((0, util_1.trimNodeEndBR)(bs)))],
7632
7565
  rest
7633
7566
  ], ([as, bs], rest) => [
7634
7567
  (0, array_1.unshift)(as, bs),
@@ -7672,7 +7605,7 @@ require = function () {
7672
7605
  (0, combinator_1.context)({ syntax: { inline: { link: false } } }, (0, combinator_1.dup)((0, combinator_1.union)([
7673
7606
  (0, combinator_1.surround)('[', inline_1.media, ']'),
7674
7607
  (0, combinator_1.surround)('[', inline_1.shortmedia, ']'),
7675
- (0, combinator_1.surround)('[', (0, util_1.startLoose)((0, util_1.visible)((0, combinator_1.context)({
7608
+ (0, combinator_1.surround)('[', (0, util_1.startLoose)((0, combinator_1.context)({
7676
7609
  syntax: {
7677
7610
  inline: {
7678
7611
  annotation: false,
@@ -7683,18 +7616,18 @@ require = function () {
7683
7616
  autolink: false
7684
7617
  }
7685
7618
  }
7686
- }, (0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)))), ']', true)
7619
+ }, (0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)), ']'), ']', true)
7687
7620
  ]))),
7688
7621
  (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([
7689
7622
  exports.uri,
7690
7623
  (0, combinator_1.some)(exports.option)
7691
7624
  ]), /^[^\S\n]?}/))
7692
7625
  ])))), ([params, content = []], rest, context) => {
7693
- var _a, _b;
7626
+ var _a, _b, _c, _d, _e;
7694
7627
  if ((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context), []).some(node => typeof node === 'object'))
7695
7628
  return;
7696
7629
  const INSECURE_URI = params.shift();
7697
- const el = create(INSECURE_URI, (0, util_1.trimNode)((0, typed_dom_1.defrag)(content)), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host || global_1.location, context.url || global_1.location), ((_a = context.host) === null || _a === void 0 ? void 0 : _a.href) || global_1.location.href), ((_b = context.host) === null || _b === void 0 ? void 0 : _b.origin) || global_1.location.origin);
7630
+ const el = create(INSECURE_URI, (0, util_1.trimNode)((0, typed_dom_1.defrag)(content)), new url_1.ReadonlyURL(resolve(INSECURE_URI, (_a = context.host) !== null && _a !== void 0 ? _a : global_1.location, (_c = (_b = context.url) !== null && _b !== void 0 ? _b : context.host) !== null && _c !== void 0 ? _c : global_1.location), ((_d = context.host) === null || _d === void 0 ? void 0 : _d.href) || global_1.location.href), ((_e = context.host) === null || _e === void 0 ? void 0 : _e.origin) || global_1.location.origin);
7698
7631
  if (el.classList.contains('invalid'))
7699
7632
  return [
7700
7633
  [el],
@@ -7716,40 +7649,41 @@ require = function () {
7716
7649
  (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\n{}]+/), opt => [` \\${ opt.slice(1) }`])
7717
7650
  ]);
7718
7651
  function resolve(uri, host, source) {
7719
- var _a;
7720
7652
  switch (true) {
7721
7653
  case uri.slice(0, 2) === '^/':
7722
- const file = host.pathname.slice(host.pathname.lastIndexOf('/') + 1);
7723
- return file.includes('.') ? `${ host.pathname.slice(0, -file.length) }${ uri.slice(2) }` : `${ fillTrailingSlash(host.pathname) }${ uri.slice(2) }`;
7654
+ const last = host.pathname.slice(host.pathname.lastIndexOf('/') + 1);
7655
+ return last.includes('.') && /^[0-9]*[a-z][0-9a-z]*$/i.test(last.slice(last.lastIndexOf('.') + 1)) ? `${ host.pathname.slice(0, -last.length) }${ uri.slice(2) }` : `${ host.pathname.replace(/\/?$/, '/') }${ uri.slice(2) }`;
7724
7656
  case host.origin === source.origin && host.pathname === source.pathname:
7725
7657
  case uri.slice(0, 2) === '//':
7726
7658
  return uri;
7727
7659
  default:
7728
7660
  const target = new url_1.ReadonlyURL(uri, source.href);
7729
- return target.origin === ((_a = uri.match(/^[A-Za-z][0-9A-Za-z.+-]*:\/\/[^/?#]*/)) === null || _a === void 0 ? void 0 : _a[0]) ? uri : target.origin === host.origin ? target.href.slice(target.origin.length) : target.href;
7661
+ return target.origin === host.origin ? target.href.slice(target.origin.length) : target.href;
7730
7662
  }
7731
7663
  }
7732
7664
  exports.resolve = resolve;
7733
- function fillTrailingSlash(pathname) {
7734
- return pathname[pathname.length - 1] === '/' ? pathname : pathname + '/';
7735
- }
7736
- function create(address, content, uri, origin) {
7665
+ function create(INSECURE_URI, content, uri, origin) {
7737
7666
  let type;
7738
7667
  let description;
7739
7668
  switch (uri.protocol) {
7740
7669
  case 'http:':
7741
7670
  case 'https:':
7671
+ if (INSECURE_URI.slice(0, 2) === '^/' && /\/\.\.?(?:\/|$)/.test(INSECURE_URI.slice(0, INSECURE_URI.search(/[?#]|$/)))) {
7672
+ type = 'argument';
7673
+ description = 'Dot-segments cannot be used in subresource paths.';
7674
+ break;
7675
+ }
7742
7676
  return (0, typed_dom_1.html)('a', {
7743
7677
  href: uri.source,
7744
7678
  target: undefined || uri.origin !== origin || typeof content[0] === 'object' && content[0].classList.contains('media') ? '_blank' : undefined
7745
- }, content.length === 0 ? decode(address) : content);
7679
+ }, content.length === 0 ? decode(INSECURE_URI) : content);
7746
7680
  case 'tel:':
7747
7681
  if (content.length === 0) {
7748
- content = [address];
7682
+ content = [INSECURE_URI];
7749
7683
  }
7750
7684
  const pattern = /^(?:tel:)?(?:\+(?!0))?\d+(?:-\d+)*$/i;
7751
7685
  switch (true) {
7752
- case content.length === 1 && typeof content[0] === 'string' && pattern.test(address) && pattern.test(content[0]) && address.replace(/[^+\d]/g, '') === content[0].replace(/[^+\d]/g, ''):
7686
+ case content.length === 1 && typeof content[0] === 'string' && pattern.test(INSECURE_URI) && pattern.test(content[0]) && INSECURE_URI.replace(/[^+\d]/g, '') === content[0].replace(/[^+\d]/g, ''):
7753
7687
  return (0, typed_dom_1.html)('a', { href: uri.source }, content);
7754
7688
  }
7755
7689
  type = 'content';
@@ -7761,7 +7695,7 @@ require = function () {
7761
7695
  'data-invalid-syntax': 'link',
7762
7696
  'data-invalid-type': type !== null && type !== void 0 ? type : type = 'argument',
7763
7697
  'data-invalid-description': description !== null && description !== void 0 ? description : description = 'Invalid protocol.'
7764
- }, content.length === 0 ? address : content);
7698
+ }, content.length === 0 ? INSECURE_URI : content);
7765
7699
  }
7766
7700
  function decode(uri) {
7767
7701
  if (uri.indexOf('%') === -1)
@@ -7799,7 +7733,7 @@ require = function () {
7799
7733
  const typed_dom_1 = _dereq_('typed-dom');
7800
7734
  const array_1 = _dereq_('spica/array');
7801
7735
  exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '==')])), (0, source_1.str)('=='), false, ([as, bs, cs], rest) => (0, util_1.isEndTightNodes)(bs) ? [
7802
- [(0, typed_dom_1.html)('mark', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
7736
+ [(0, typed_dom_1.html)('mark', (0, typed_dom_1.defrag)(bs))],
7803
7737
  rest
7804
7738
  ] : [
7805
7739
  (0, array_1.unshift)(as, bs),
@@ -7907,24 +7841,23 @@ require = function () {
7907
7841
  [''],
7908
7842
  as
7909
7843
  ]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
7910
- var _a, _b, _c, _d;
7844
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
7911
7845
  const INSECURE_URI = params.shift();
7912
- const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host || global_1.location, context.url || global_1.location), ((_a = context.host) === null || _a === void 0 ? void 0 : _a.href) || global_1.location.href);
7913
- const cache = (_b = context.caches) === null || _b === void 0 ? void 0 : _b.media;
7914
- const cached = cache === null || cache === void 0 ? void 0 : cache.has(url.href);
7915
- const el = cache && cached ? cache.get(url.href).cloneNode(true) : (0, typed_dom_1.html)('img', {
7846
+ const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, (_a = context.host) !== null && _a !== void 0 ? _a : global_1.location, (_c = (_b = context.url) !== null && _b !== void 0 ? _b : context.host) !== null && _c !== void 0 ? _c : global_1.location), ((_d = context.host) === null || _d === void 0 ? void 0 : _d.href) || global_1.location.href);
7847
+ let cache;
7848
+ const el = global_1.undefined || (cache = (_g = (_f = (_e = context.caches) === null || _e === void 0 ? void 0 : _e.media) === null || _f === void 0 ? void 0 : _f.get(url.href)) === null || _g === void 0 ? void 0 : _g.cloneNode(true)) || (0, typed_dom_1.html)('img', {
7916
7849
  class: 'media',
7917
7850
  'data-src': url.source,
7918
7851
  alt: text
7919
7852
  });
7920
- if (!cached && !sanitize(url, el))
7853
+ if (!cache && !sanitize(url, el))
7921
7854
  return [
7922
7855
  [el],
7923
7856
  rest
7924
7857
  ];
7925
- cached && el.hasAttribute('alt') && el.setAttribute('alt', text);
7858
+ (cache === null || cache === void 0 ? void 0 : cache.hasAttribute('alt')) && (cache === null || cache === void 0 ? void 0 : cache.setAttribute('alt', text));
7926
7859
  (0, typed_dom_1.define)(el, (0, html_1.attributes)('media', (0, array_1.push)([], el.classList), optspec, params));
7927
- if (((_d = (_c = context.syntax) === null || _c === void 0 ? void 0 : _c.inline) === null || _d === void 0 ? void 0 : _d.link) === false || cached && el.tagName !== 'IMG')
7860
+ if (((_j = (_h = context.syntax) === null || _h === void 0 ? void 0 : _h.inline) === null || _j === void 0 ? void 0 : _j.link) === false || cache && cache.tagName !== 'IMG')
7928
7861
  return [
7929
7862
  [el],
7930
7863
  rest
@@ -7970,18 +7903,29 @@ require = function () {
7970
7903
  link_1.option
7971
7904
  ]);
7972
7905
  function sanitize(uri, target) {
7906
+ if (/\/\.\.?(?:\/|$)/.test('/' + uri.source.slice(0, uri.source.search(/[?#]|$/)))) {
7907
+ (0, typed_dom_1.define)(target, {
7908
+ class: void target.classList.add('invalid'),
7909
+ 'data-invalid-syntax': 'media',
7910
+ 'data-invalid-type': 'argument',
7911
+ 'data-invalid-description': 'Dot-segments cannot be used in media paths; use subresource paths instead.'
7912
+ });
7913
+ return false;
7914
+ }
7973
7915
  switch (uri.protocol) {
7974
7916
  case 'http:':
7975
7917
  case 'https:':
7976
- return true;
7918
+ break;
7919
+ default:
7920
+ (0, typed_dom_1.define)(target, {
7921
+ class: void target.classList.add('invalid'),
7922
+ 'data-invalid-syntax': 'media',
7923
+ 'data-invalid-type': 'argument',
7924
+ 'data-invalid-description': 'Invalid protocol.'
7925
+ });
7926
+ return false;
7977
7927
  }
7978
- (0, typed_dom_1.define)(target, {
7979
- class: void target.classList.add('invalid'),
7980
- 'data-invalid-syntax': 'media',
7981
- 'data-invalid-type': 'argument',
7982
- 'data-invalid-description': 'Invalid protocol.'
7983
- });
7984
- return false;
7928
+ return true;
7985
7929
  }
7986
7930
  },
7987
7931
  {
@@ -8011,7 +7955,7 @@ require = function () {
8011
7955
  exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[[', ']]', '\n', (0, combinator_1.fmap)((0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => {
8012
7956
  var _a, _b, _c;
8013
7957
  return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.reference) !== null && _c !== void 0 ? _c : true;
8014
- }, (0, util_1.startLoose)((0, util_1.visible)((0, combinator_1.context)({
7958
+ }, (0, util_1.startLoose)((0, combinator_1.context)({
8015
7959
  syntax: {
8016
7960
  inline: {
8017
7961
  annotation: false,
@@ -8030,8 +7974,8 @@ require = function () {
8030
7974
  ''
8031
7975
  ]),
8032
7976
  (0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)
8033
- ]))))), ']]'), ns => [(0, typed_dom_1.html)('sup', attributes(ns), (0, util_1.trimNode)((0, typed_dom_1.defrag)(ns)))]))));
8034
- const abbr = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]+/), (_, rest, context) => (0, util_1.isStartTight)(rest, context)), ([source]) => [(0, typed_dom_1.html)('abbr', source)]));
7977
+ ])), ']]')), ']]'), ns => [(0, typed_dom_1.html)('sup', attributes(ns), (0, util_1.trimNode)((0, typed_dom_1.defrag)(ns)))]))));
7978
+ const abbr = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]/), (_, rest, context) => (0, util_1.isStartLoose)(rest, context)), ([source]) => [(0, typed_dom_1.html)('abbr', source)]));
8035
7979
  function attributes(ns) {
8036
7980
  return typeof ns[0] === 'object' && ns[0].tagName === 'ABBR' ? {
8037
7981
  class: 'reference',
@@ -8179,7 +8123,7 @@ require = function () {
8179
8123
  (0, combinator_1.some)(inline_1.inline, '*'),
8180
8124
  (0, source_1.str)('*')
8181
8125
  ]), '**')), (0, source_1.str)('**'), false, ([as, bs, cs], rest) => (0, util_1.isEndTightNodes)(bs) ? [
8182
- [(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)((0, util_1.trimEndBR)(bs)))],
8126
+ [(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))],
8183
8127
  rest
8184
8128
  ] : [
8185
8129
  (0, array_1.unshift)(as, bs),
@@ -8942,7 +8886,7 @@ require = function () {
8942
8886
  function (_dereq_, module, exports) {
8943
8887
  'use strict';
8944
8888
  Object.defineProperty(exports, '__esModule', { value: true });
8945
- exports.stringify = exports.trimEndBR = exports.trimNodeEnd = exports.trimNode = exports.visible = exports.isEndTightNodes = exports.isStartTightNodes = exports.isStartTight = exports.startTight = exports.startLoose = exports.visualize = void 0;
8889
+ exports.stringify = exports.trimNodeEndBR = exports.trimNodeEnd = exports.trimNode = exports.isEndTightNodes = exports.isStartTightNodes = exports.startTight = exports.isStartLoose = exports.startLoose = exports.visualize = void 0;
8946
8890
  const global_1 = _dereq_('spica/global');
8947
8891
  const parser_1 = _dereq_('../combinator/data/parser');
8948
8892
  const combinator_1 = _dereq_('../combinator');
@@ -9017,15 +8961,18 @@ require = function () {
9017
8961
  }
9018
8962
  return false;
9019
8963
  }
9020
- function startLoose(parser) {
9021
- return (source, context) => isStartLoose(source, context) ? parser(source, context) : global_1.undefined;
8964
+ function startLoose(parser, except) {
8965
+ return (source, context) => isStartLoose(source, context, except) ? parser(source, context) : global_1.undefined;
9022
8966
  }
9023
8967
  exports.startLoose = startLoose;
9024
- function isStartLoose(source, context) {
8968
+ function isStartLoose(source, context, except) {
8969
+ var _a;
8970
+ source && (source = source.replace(/^[^\S\n]+/, ''));
9025
8971
  if (source === '')
9026
8972
  return true;
9027
- return isStartTight(source.replace(/^[^\S\n]+/, ''), context);
8973
+ return source.slice(0, (_a = except === null || except === void 0 ? void 0 : except.length) !== null && _a !== void 0 ? _a : 0) !== except && isStartTight(source, context);
9028
8974
  }
8975
+ exports.isStartLoose = isStartLoose;
9029
8976
  function startTight(parser) {
9030
8977
  return (source, context) => isStartTight(source, context) ? parser(source, context) : global_1.undefined;
9031
8978
  }
@@ -9064,7 +9011,6 @@ require = function () {
9064
9011
  return source[0].trimStart() !== '';
9065
9012
  }
9066
9013
  }
9067
- exports.isStartTight = isStartTight;
9068
9014
  function isStartTightNodes(nodes) {
9069
9015
  if (nodes.length === 0)
9070
9016
  return true;
@@ -9074,22 +9020,9 @@ require = function () {
9074
9020
  function isEndTightNodes(nodes) {
9075
9021
  if (nodes.length === 0)
9076
9022
  return true;
9077
- const last = nodes.length - 1;
9078
- return typeof nodes[last] === 'string' && nodes[last].length > 1 ? isVisible(nodes[last], -1) || isVisible(nodes[last], -2) : isVisible(nodes[last], -1) || last === 0 || isVisible(nodes[last - 1], -1);
9023
+ return isVisible(nodes[nodes.length - 1], -1);
9079
9024
  }
9080
9025
  exports.isEndTightNodes = isEndTightNodes;
9081
- function visible(parser) {
9082
- return (0, combinator_1.verify)(parser, nodes => {
9083
- if (nodes.length === 0)
9084
- return true;
9085
- for (let i = 0; i < nodes.length; ++i) {
9086
- if (isVisible(nodes[i]))
9087
- return true;
9088
- }
9089
- return false;
9090
- });
9091
- }
9092
- exports.visible = visible;
9093
9026
  function isVisible(node, position) {
9094
9027
  if (!node)
9095
9028
  return false;
@@ -9123,26 +9056,31 @@ require = function () {
9123
9056
  }
9124
9057
  exports.trimNode = trimNode;
9125
9058
  function trimNodeStart(nodes) {
9126
- const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];
9127
- for (let first = nodes[0]; nodes.length > 0 && !isVisible(first, 0) && !(typeof first === 'object' && first.className === 'comment');) {
9128
- if (typeof first === 'string') {
9129
- const pos = first.length - first.trimStart().length;
9059
+ for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
9060
+ if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer')
9061
+ break;
9062
+ if (typeof node === 'object' && node.className === 'comment')
9063
+ break;
9064
+ if (typeof node === 'string') {
9065
+ const pos = node.length - node.trimStart().length;
9130
9066
  if (pos > 0) {
9131
- nodes[0] = first.slice(pos);
9067
+ nodes[0] = node.slice(pos);
9132
9068
  break;
9133
9069
  }
9134
9070
  }
9135
- nodes.pop();
9071
+ nodes.shift();
9136
9072
  }
9137
- return (0, array_1.push)(nodes, skip);
9073
+ return nodes;
9138
9074
  }
9139
9075
  function trimNodeEnd(nodes) {
9140
9076
  const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];
9141
- for (let last = nodes[0]; nodes.length > 0 && !isVisible(last = nodes[nodes.length - 1], -1) && !(typeof last === 'object' && last.className === 'comment');) {
9142
- if (typeof last === 'string') {
9143
- const pos = last.trimEnd().length;
9077
+ for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[nodes.length - 1], -1);) {
9078
+ if (typeof node === 'object' && node.className === 'comment')
9079
+ break;
9080
+ if (typeof node === 'string') {
9081
+ const pos = node.trimEnd().length;
9144
9082
  if (pos > 0) {
9145
- nodes[nodes.length - 1] = last.slice(0, pos);
9083
+ nodes[nodes.length - 1] = node.slice(0, pos);
9146
9084
  break;
9147
9085
  }
9148
9086
  }
@@ -9151,13 +9089,13 @@ require = function () {
9151
9089
  return (0, array_1.push)(nodes, skip);
9152
9090
  }
9153
9091
  exports.trimNodeEnd = trimNodeEnd;
9154
- function trimEndBR(nodes) {
9092
+ function trimNodeEndBR(nodes) {
9155
9093
  if (nodes.length === 0)
9156
9094
  return nodes;
9157
9095
  const node = nodes[nodes.length - 1];
9158
9096
  return typeof node === 'object' && node.tagName === 'BR' ? (0, array_1.pop)(nodes)[0] : nodes;
9159
9097
  }
9160
- exports.trimEndBR = trimEndBR;
9098
+ exports.trimNodeEndBR = trimNodeEndBR;
9161
9099
  function stringify(nodes) {
9162
9100
  let acc = '';
9163
9101
  for (let i = 0; i < nodes.length; ++i) {
@@ -9216,8 +9154,6 @@ require = function () {
9216
9154
  }));
9217
9155
  function render(source, opts = {}) {
9218
9156
  opts = extend(opts);
9219
- if (source.classList.contains('invalid'))
9220
- return;
9221
9157
  const base = global_1.location.href;
9222
9158
  if (source.matches(selector))
9223
9159
  return void render_(base, source, opts);
@@ -9228,6 +9164,8 @@ require = function () {
9228
9164
  exports.render = render;
9229
9165
  function render_(base, source, opts) {
9230
9166
  var _a, _b, _c;
9167
+ if (source.classList.contains('invalid'))
9168
+ return;
9231
9169
  try {
9232
9170
  switch (true) {
9233
9171
  case !!opts.code && !source.firstElementChild && source.matches('pre.code'):