@teipublisher/pb-components 2.10.1 → 2.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/css/gridjs/mermaid.min.css +1 -1
  3. package/css/leaflet/leaflet.css +63 -42
  4. package/css/prismjs/prism-coy.css +4 -3
  5. package/css/prismjs/prism-coy.min.css +1 -0
  6. package/css/prismjs/prism-dark.min.css +1 -0
  7. package/css/prismjs/prism-funky.min.css +1 -0
  8. package/css/prismjs/prism-okaidia.min.css +1 -0
  9. package/css/prismjs/prism-solarizedlight.min.css +1 -0
  10. package/css/prismjs/prism-tomorrow.min.css +1 -0
  11. package/css/prismjs/prism-twilight.css +3 -33
  12. package/css/prismjs/prism-twilight.min.css +1 -0
  13. package/css/prismjs/prism.min.css +1 -0
  14. package/css/tom-select/tom-select.bootstrap4.min.css +1 -1
  15. package/css/tom-select/tom-select.bootstrap5.min.css +1 -1
  16. package/css/tom-select/tom-select.default.min.css +1 -1
  17. package/css/tom-select/tom-select.min.css +1 -1
  18. package/dist/{iron-form-9e72ac45.js → iron-form-89b60473.js} +1 -1
  19. package/dist/jinn-codemirror-da585937.js +1 -0
  20. package/dist/{paper-checkbox-102e3b43.js → paper-checkbox-56ead3d4.js} +100 -109
  21. package/dist/pb-code-editor.js +1 -1
  22. package/dist/pb-component-docs.js +94 -103
  23. package/dist/pb-components-bundle.js +171 -162
  24. package/dist/pb-edit-app.js +29 -29
  25. package/dist/{pb-i18n-f7a50012.js → pb-i18n-9000294c.js} +1 -1
  26. package/dist/pb-leaflet-map.js +1 -1
  27. package/dist/pb-odd-editor.js +1 -1
  28. package/dist/pb-tify.js +1 -1
  29. package/dist/{vaadin-element-mixin-b6179444.js → vaadin-element-mixin-67c5648d.js} +17 -18
  30. package/gh-pages.js +6 -0
  31. package/lib/leaflet-src.js +1623 -1173
  32. package/lib/paged.polyfill.js +1335 -1124
  33. package/package.json +4 -3
  34. package/src/pb-page.js +2 -1
  35. package/dist/jinn-codemirror-13c59456.js +0 -1
  36. /package/dist/{es-global-bridge-6abe3a88.js → es-global-bridge-5c039c0b.js} +0 -0
  37. /package/dist/{pb-mixin-ea2e9070.js → pb-mixin-d61c06b6.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Paged.js v0.4.0 | MIT | https://gitlab.pagedmedia.org/tools/pagedjs
2
+ * @license Paged.js v0.4.3 | MIT | https://gitlab.coko.foundation/pagedjs/pagedjs
3
3
  */
4
4
 
5
5
  (function (global, factory) {
@@ -8,9 +8,13 @@
8
8
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.PagedPolyfill = factory());
9
9
  })(this, (function () { 'use strict';
10
10
 
11
+ function getDefaultExportFromCjs (x) {
12
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
13
+ }
14
+
11
15
  var eventEmitter = {exports: {}};
12
16
 
13
- var d$3 = {exports: {}};
17
+ var d$2 = {exports: {}};
14
18
 
15
19
  var isImplemented$6 = function () {
16
20
  var assign = Object.assign, obj;
@@ -20,72 +24,108 @@
20
24
  return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy";
21
25
  };
22
26
 
23
- var isImplemented$5 = function () {
24
- try {
25
- Object.keys("primitive");
26
- return true;
27
- } catch (e) {
28
- return false;
27
+ var isImplemented$5;
28
+ var hasRequiredIsImplemented$1;
29
+
30
+ function requireIsImplemented$1 () {
31
+ if (hasRequiredIsImplemented$1) return isImplemented$5;
32
+ hasRequiredIsImplemented$1 = 1;
33
+
34
+ isImplemented$5 = function () {
35
+ try {
36
+ Object.keys("primitive");
37
+ return true;
38
+ } catch (e) {
39
+ return false;
40
+ }
41
+ };
42
+ return isImplemented$5;
29
43
  }
30
- };
31
44
 
32
45
  // eslint-disable-next-line no-empty-function
33
46
  var noop$4 = function () {};
34
47
 
35
48
  var _undefined = noop$4(); // Support ES3 engines
36
49
 
37
- var isValue$5 = function (val) {
50
+ var isValue$3 = function (val) {
38
51
  return (val !== _undefined) && (val !== null);
39
52
  };
40
53
 
41
- var isValue$4 = isValue$5;
54
+ var shim$5;
55
+ var hasRequiredShim$5;
42
56
 
43
- var keys$2 = Object.keys;
57
+ function requireShim$5 () {
58
+ if (hasRequiredShim$5) return shim$5;
59
+ hasRequiredShim$5 = 1;
44
60
 
45
- var shim$5 = function (object) {
46
- return keys$2(isValue$4(object) ? Object(object) : object);
47
- };
61
+ var isValue = isValue$3;
62
+
63
+ var keys = Object.keys;
64
+
65
+ shim$5 = function (object) {
66
+ return keys(isValue(object) ? Object(object) : object);
67
+ };
68
+ return shim$5;
69
+ }
48
70
 
49
- var keys$1 = isImplemented$5()
50
- ? Object.keys
51
- : shim$5;
71
+ var keys;
72
+ var hasRequiredKeys;
52
73
 
53
- var isValue$3 = isValue$5;
74
+ function requireKeys () {
75
+ if (hasRequiredKeys) return keys;
76
+ hasRequiredKeys = 1;
77
+
78
+ keys = requireIsImplemented$1()()
79
+ ? Object.keys
80
+ : requireShim$5();
81
+ return keys;
82
+ }
54
83
 
55
- var validValue$1 = function (value) {
56
- if (!isValue$3(value)) throw new TypeError("Cannot use null or undefined");
84
+ var isValue$2 = isValue$3;
85
+
86
+ var validValue = function (value) {
87
+ if (!isValue$2(value)) throw new TypeError("Cannot use null or undefined");
57
88
  return value;
58
89
  };
59
90
 
60
- var keys = keys$1
61
- , value$3 = validValue$1
62
- , max$1 = Math.max;
91
+ var shim$4;
92
+ var hasRequiredShim$4;
63
93
 
64
- var shim$4 = function (dest, src /*, …srcn*/) {
65
- var error, i, length = max$1(arguments.length, 2), assign;
66
- dest = Object(value$3(dest));
67
- assign = function (key) {
68
- try {
69
- dest[key] = src[key];
70
- } catch (e) {
71
- if (!error) error = e;
94
+ function requireShim$4 () {
95
+ if (hasRequiredShim$4) return shim$4;
96
+ hasRequiredShim$4 = 1;
97
+
98
+ var keys = requireKeys()
99
+ , value = validValue
100
+ , max = Math.max;
101
+
102
+ shim$4 = function (dest, src /*, …srcn*/) {
103
+ var error, i, length = max(arguments.length, 2), assign;
104
+ dest = Object(value(dest));
105
+ assign = function (key) {
106
+ try {
107
+ dest[key] = src[key];
108
+ } catch (e) {
109
+ if (!error) error = e;
110
+ }
111
+ };
112
+ for (i = 1; i < length; ++i) {
113
+ src = arguments[i];
114
+ keys(src).forEach(assign);
72
115
  }
116
+ if (error !== undefined) throw error;
117
+ return dest;
73
118
  };
74
- for (i = 1; i < length; ++i) {
75
- src = arguments[i];
76
- keys(src).forEach(assign);
77
- }
78
- if (error !== undefined) throw error;
79
- return dest;
80
- };
119
+ return shim$4;
120
+ }
81
121
 
82
122
  var assign$2 = isImplemented$6()
83
123
  ? Object.assign
84
- : shim$4;
124
+ : requireShim$4();
85
125
 
86
- var isValue$2 = isValue$5;
126
+ var isValue$1 = isValue$3;
87
127
 
88
- var forEach$1 = Array.prototype.forEach, create$6 = Object.create;
128
+ var forEach$1 = Array.prototype.forEach, create$5 = Object.create;
89
129
 
90
130
  var process = function (src, obj) {
91
131
  var key;
@@ -94,9 +134,9 @@
94
134
 
95
135
  // eslint-disable-next-line no-unused-vars
96
136
  var normalizeOptions = function (opts1 /*, …options*/) {
97
- var result = create$6(null);
137
+ var result = create$5(null);
98
138
  forEach$1.call(arguments, function (options) {
99
- if (!isValue$2(options)) return;
139
+ if (!isValue$1(options)) return;
100
140
  process(Object(options), result);
101
141
  });
102
142
  return result;
@@ -113,24 +153,33 @@
113
153
  return (str.contains("dwa") === true) && (str.contains("foo") === false);
114
154
  };
115
155
 
116
- var indexOf$3 = String.prototype.indexOf;
156
+ var shim$3;
157
+ var hasRequiredShim$3;
117
158
 
118
- var shim$3 = function (searchString/*, position*/) {
119
- return indexOf$3.call(this, searchString, arguments[1]) > -1;
120
- };
159
+ function requireShim$3 () {
160
+ if (hasRequiredShim$3) return shim$3;
161
+ hasRequiredShim$3 = 1;
162
+
163
+ var indexOf = String.prototype.indexOf;
164
+
165
+ shim$3 = function (searchString/*, position*/) {
166
+ return indexOf.call(this, searchString, arguments[1]) > -1;
167
+ };
168
+ return shim$3;
169
+ }
121
170
 
122
171
  var contains$1 = isImplemented$4()
123
172
  ? String.prototype.contains
124
- : shim$3;
173
+ : requireShim$3();
125
174
 
126
175
  var assign$1 = assign$2
127
176
  , normalizeOpts = normalizeOptions
128
177
  , isCallable = isCallable$1
129
178
  , contains = contains$1
130
179
 
131
- , d$2;
180
+ , d$1;
132
181
 
133
- d$2 = d$3.exports = function (dscr, value/*, options*/) {
182
+ d$1 = d$2.exports = function (dscr, value/*, options*/) {
134
183
  var c, e, w, options, desc;
135
184
  if ((arguments.length < 2) || (typeof dscr !== 'string')) {
136
185
  options = value;
@@ -152,7 +201,7 @@
152
201
  return !options ? desc : assign$1(normalizeOpts(options), desc);
153
202
  };
154
203
 
155
- d$2.gs = function (dscr, get, set/*, options*/) {
204
+ d$1.gs = function (dscr, get, set/*, options*/) {
156
205
  var c, e, options, desc;
157
206
  if (typeof dscr !== 'string') {
158
207
  options = set;
@@ -185,6 +234,8 @@
185
234
  return !options ? desc : assign$1(normalizeOpts(options), desc);
186
235
  };
187
236
 
237
+ var dExports = d$2.exports;
238
+
188
239
  var validCallable = function (fn) {
189
240
  if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
190
241
  return fn;
@@ -192,139 +243,140 @@
192
243
 
193
244
  (function (module, exports) {
194
245
 
195
- var d = d$3.exports
196
- , callable = validCallable
197
-
198
- , apply = Function.prototype.apply, call = Function.prototype.call
199
- , create = Object.create, defineProperty = Object.defineProperty
200
- , defineProperties = Object.defineProperties
201
- , hasOwnProperty = Object.prototype.hasOwnProperty
202
- , descriptor = { configurable: true, enumerable: false, writable: true }
246
+ var d = dExports
247
+ , callable = validCallable
203
248
 
204
- , on, once, off, emit, methods, descriptors, base;
249
+ , apply = Function.prototype.apply, call = Function.prototype.call
250
+ , create = Object.create, defineProperty = Object.defineProperty
251
+ , defineProperties = Object.defineProperties
252
+ , hasOwnProperty = Object.prototype.hasOwnProperty
253
+ , descriptor = { configurable: true, enumerable: false, writable: true }
205
254
 
206
- on = function (type, listener) {
207
- var data;
255
+ , on, once, off, emit, methods, descriptors, base;
208
256
 
209
- callable(listener);
257
+ on = function (type, listener) {
258
+ var data;
210
259
 
211
- if (!hasOwnProperty.call(this, '__ee__')) {
212
- data = descriptor.value = create(null);
213
- defineProperty(this, '__ee__', descriptor);
214
- descriptor.value = null;
215
- } else {
216
- data = this.__ee__;
217
- }
218
- if (!data[type]) data[type] = listener;
219
- else if (typeof data[type] === 'object') data[type].push(listener);
220
- else data[type] = [data[type], listener];
260
+ callable(listener);
221
261
 
222
- return this;
223
- };
262
+ if (!hasOwnProperty.call(this, '__ee__')) {
263
+ data = descriptor.value = create(null);
264
+ defineProperty(this, '__ee__', descriptor);
265
+ descriptor.value = null;
266
+ } else {
267
+ data = this.__ee__;
268
+ }
269
+ if (!data[type]) data[type] = listener;
270
+ else if (typeof data[type] === 'object') data[type].push(listener);
271
+ else data[type] = [data[type], listener];
224
272
 
225
- once = function (type, listener) {
226
- var once, self;
273
+ return this;
274
+ };
227
275
 
228
- callable(listener);
229
- self = this;
230
- on.call(this, type, once = function () {
231
- off.call(self, type, once);
232
- apply.call(listener, this, arguments);
233
- });
276
+ once = function (type, listener) {
277
+ var once, self;
234
278
 
235
- once.__eeOnceListener__ = listener;
236
- return this;
237
- };
279
+ callable(listener);
280
+ self = this;
281
+ on.call(this, type, once = function () {
282
+ off.call(self, type, once);
283
+ apply.call(listener, this, arguments);
284
+ });
238
285
 
239
- off = function (type, listener) {
240
- var data, listeners, candidate, i;
286
+ once.__eeOnceListener__ = listener;
287
+ return this;
288
+ };
241
289
 
242
- callable(listener);
290
+ off = function (type, listener) {
291
+ var data, listeners, candidate, i;
243
292
 
244
- if (!hasOwnProperty.call(this, '__ee__')) return this;
245
- data = this.__ee__;
246
- if (!data[type]) return this;
247
- listeners = data[type];
293
+ callable(listener);
248
294
 
249
- if (typeof listeners === 'object') {
250
- for (i = 0; (candidate = listeners[i]); ++i) {
251
- if ((candidate === listener) ||
252
- (candidate.__eeOnceListener__ === listener)) {
253
- if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
254
- else listeners.splice(i, 1);
295
+ if (!hasOwnProperty.call(this, '__ee__')) return this;
296
+ data = this.__ee__;
297
+ if (!data[type]) return this;
298
+ listeners = data[type];
299
+
300
+ if (typeof listeners === 'object') {
301
+ for (i = 0; (candidate = listeners[i]); ++i) {
302
+ if ((candidate === listener) ||
303
+ (candidate.__eeOnceListener__ === listener)) {
304
+ if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
305
+ else listeners.splice(i, 1);
306
+ }
307
+ }
308
+ } else {
309
+ if ((listeners === listener) ||
310
+ (listeners.__eeOnceListener__ === listener)) {
311
+ delete data[type];
255
312
  }
256
313
  }
257
- } else {
258
- if ((listeners === listener) ||
259
- (listeners.__eeOnceListener__ === listener)) {
260
- delete data[type];
261
- }
262
- }
263
-
264
- return this;
265
- };
266
314
 
267
- emit = function (type) {
268
- var i, l, listener, listeners, args;
315
+ return this;
316
+ };
269
317
 
270
- if (!hasOwnProperty.call(this, '__ee__')) return;
271
- listeners = this.__ee__[type];
272
- if (!listeners) return;
318
+ emit = function (type) {
319
+ var i, l, listener, listeners, args;
273
320
 
274
- if (typeof listeners === 'object') {
275
- l = arguments.length;
276
- args = new Array(l - 1);
277
- for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
321
+ if (!hasOwnProperty.call(this, '__ee__')) return;
322
+ listeners = this.__ee__[type];
323
+ if (!listeners) return;
278
324
 
279
- listeners = listeners.slice();
280
- for (i = 0; (listener = listeners[i]); ++i) {
281
- apply.call(listener, this, args);
282
- }
283
- } else {
284
- switch (arguments.length) {
285
- case 1:
286
- call.call(listeners, this);
287
- break;
288
- case 2:
289
- call.call(listeners, this, arguments[1]);
290
- break;
291
- case 3:
292
- call.call(listeners, this, arguments[1], arguments[2]);
293
- break;
294
- default:
325
+ if (typeof listeners === 'object') {
295
326
  l = arguments.length;
296
327
  args = new Array(l - 1);
297
- for (i = 1; i < l; ++i) {
298
- args[i - 1] = arguments[i];
328
+ for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
329
+
330
+ listeners = listeners.slice();
331
+ for (i = 0; (listener = listeners[i]); ++i) {
332
+ apply.call(listener, this, args);
333
+ }
334
+ } else {
335
+ switch (arguments.length) {
336
+ case 1:
337
+ call.call(listeners, this);
338
+ break;
339
+ case 2:
340
+ call.call(listeners, this, arguments[1]);
341
+ break;
342
+ case 3:
343
+ call.call(listeners, this, arguments[1], arguments[2]);
344
+ break;
345
+ default:
346
+ l = arguments.length;
347
+ args = new Array(l - 1);
348
+ for (i = 1; i < l; ++i) {
349
+ args[i - 1] = arguments[i];
350
+ }
351
+ apply.call(listeners, this, args);
299
352
  }
300
- apply.call(listeners, this, args);
301
353
  }
302
- }
303
- };
354
+ };
304
355
 
305
- methods = {
306
- on: on,
307
- once: once,
308
- off: off,
309
- emit: emit
310
- };
356
+ methods = {
357
+ on: on,
358
+ once: once,
359
+ off: off,
360
+ emit: emit
361
+ };
311
362
 
312
- descriptors = {
313
- on: d(on),
314
- once: d(once),
315
- off: d(off),
316
- emit: d(emit)
317
- };
363
+ descriptors = {
364
+ on: d(on),
365
+ once: d(once),
366
+ off: d(off),
367
+ emit: d(emit)
368
+ };
318
369
 
319
- base = defineProperties({}, descriptors);
370
+ base = defineProperties({}, descriptors);
320
371
 
321
- module.exports = exports = function (o) {
322
- return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
323
- };
324
- exports.methods = methods;
325
- }(eventEmitter, eventEmitter.exports));
372
+ module.exports = exports = function (o) {
373
+ return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
374
+ };
375
+ exports.methods = methods;
376
+ } (eventEmitter, eventEmitter.exports));
326
377
 
327
- var EventEmitter = eventEmitter.exports;
378
+ var eventEmitterExports = eventEmitter.exports;
379
+ var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventEmitterExports);
328
380
 
329
381
  /**
330
382
  * Hooks allow for injecting functions that must all complete in order before finishing
@@ -1366,6 +1418,7 @@
1366
1418
  this.hooks = hooks;
1367
1419
  } else {
1368
1420
  this.hooks = {};
1421
+ this.hooks.onPageLayout = new Hook();
1369
1422
  this.hooks.layout = new Hook();
1370
1423
  this.hooks.renderNode = new Hook();
1371
1424
  this.hooks.layoutNode = new Hook();
@@ -1373,6 +1426,7 @@
1373
1426
  this.hooks.onOverflow = new Hook();
1374
1427
  this.hooks.afterOverflowRemoved = new Hook();
1375
1428
  this.hooks.onBreakToken = new Hook();
1429
+ this.hooks.beforeRenderResult = new Hook();
1376
1430
  }
1377
1431
 
1378
1432
  this.settings = options || {};
@@ -1397,6 +1451,8 @@
1397
1451
 
1398
1452
  let prevBreakToken = breakToken || new BreakToken(start);
1399
1453
 
1454
+ this.hooks && this.hooks.onPageLayout.trigger(wrapper, prevBreakToken, this);
1455
+
1400
1456
  while (!done && !newBreakToken) {
1401
1457
  next = walker.next();
1402
1458
  prevNode = node;
@@ -1415,11 +1471,13 @@
1415
1471
 
1416
1472
  if (newBreakToken && newBreakToken.equals(prevBreakToken)) {
1417
1473
  console.warn("Unable to layout item: ", prevNode);
1474
+ this.hooks && this.hooks.beforeRenderResult.trigger(undefined, wrapper, this);
1418
1475
  return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [prevNode]));
1419
1476
  }
1420
1477
 
1421
1478
  this.rebuildTableFromBreakToken(newBreakToken, wrapper);
1422
1479
 
1480
+ this.hooks && this.hooks.beforeRenderResult.trigger(newBreakToken, wrapper, this);
1423
1481
  return new RenderResult(newBreakToken);
1424
1482
  }
1425
1483
 
@@ -1525,6 +1583,7 @@
1525
1583
  if (after) {
1526
1584
  newBreakToken = new BreakToken(after);
1527
1585
  } else {
1586
+ this.hooks && this.hooks.beforeRenderResult.trigger(undefined, wrapper, this);
1528
1587
  return new RenderResult(undefined, new OverflowContentError("Unable to layout item", [node]));
1529
1588
  }
1530
1589
  }
@@ -1532,6 +1591,7 @@
1532
1591
 
1533
1592
  }
1534
1593
 
1594
+ this.hooks && this.hooks.beforeRenderResult.trigger(newBreakToken, wrapper, this);
1535
1595
  return new RenderResult(newBreakToken);
1536
1596
  }
1537
1597
 
@@ -2788,12 +2848,14 @@
2788
2848
  this.hooks.filter = new Hook(this);
2789
2849
  this.hooks.afterParsed = new Hook(this);
2790
2850
  this.hooks.beforePageLayout = new Hook(this);
2851
+ this.hooks.onPageLayout = new Hook(this);
2791
2852
  this.hooks.layout = new Hook(this);
2792
2853
  this.hooks.renderNode = new Hook(this);
2793
2854
  this.hooks.layoutNode = new Hook(this);
2794
2855
  this.hooks.onOverflow = new Hook(this);
2795
2856
  this.hooks.afterOverflowRemoved = new Hook(this);
2796
2857
  this.hooks.onBreakToken = new Hook();
2858
+ this.hooks.beforeRenderResult = new Hook(this);
2797
2859
  this.hooks.afterPageLayout = new Hook(this);
2798
2860
  this.hooks.finalizePage = new Hook(this);
2799
2861
  this.hooks.afterRendered = new Hook(this);
@@ -3244,7 +3306,7 @@
3244
3306
 
3245
3307
  var syntax = {exports: {}};
3246
3308
 
3247
- var create$5 = {};
3309
+ var create$4 = {};
3248
3310
 
3249
3311
  //
3250
3312
  // list
@@ -9502,7 +9564,7 @@
9502
9564
  return parserConfig;
9503
9565
  }
9504
9566
 
9505
- var create$4 = function createParser(config) {
9567
+ var create$3 = function createParser(config) {
9506
9568
  var parser = {
9507
9569
  scanner: new TokenStream$1(),
9508
9570
  locationMap: new OffsetToLocation(),
@@ -9943,494 +10005,494 @@
9943
10005
  /* -*- Mode: js; js-indent-level: 2; -*- */
9944
10006
 
9945
10007
  (function (exports) {
9946
- /*
9947
- * Copyright 2011 Mozilla Foundation and contributors
9948
- * Licensed under the New BSD license. See LICENSE or:
9949
- * http://opensource.org/licenses/BSD-3-Clause
9950
- */
9951
-
9952
- /**
9953
- * This is a helper function for getting values from parameter/options
9954
- * objects.
9955
- *
9956
- * @param args The object we are extracting values from
9957
- * @param name The name of the property we are getting.
9958
- * @param defaultValue An optional value to return if the property is missing
9959
- * from the object. If this is not specified and the property is missing, an
9960
- * error will be thrown.
9961
- */
9962
- function getArg(aArgs, aName, aDefaultValue) {
9963
- if (aName in aArgs) {
9964
- return aArgs[aName];
9965
- } else if (arguments.length === 3) {
9966
- return aDefaultValue;
9967
- } else {
9968
- throw new Error('"' + aName + '" is a required argument.');
9969
- }
9970
- }
9971
- exports.getArg = getArg;
9972
-
9973
- var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
9974
- var dataUrlRegexp = /^data:.+\,.+$/;
9975
-
9976
- function urlParse(aUrl) {
9977
- var match = aUrl.match(urlRegexp);
9978
- if (!match) {
9979
- return null;
9980
- }
9981
- return {
9982
- scheme: match[1],
9983
- auth: match[2],
9984
- host: match[3],
9985
- port: match[4],
9986
- path: match[5]
9987
- };
9988
- }
9989
- exports.urlParse = urlParse;
9990
-
9991
- function urlGenerate(aParsedUrl) {
9992
- var url = '';
9993
- if (aParsedUrl.scheme) {
9994
- url += aParsedUrl.scheme + ':';
9995
- }
9996
- url += '//';
9997
- if (aParsedUrl.auth) {
9998
- url += aParsedUrl.auth + '@';
9999
- }
10000
- if (aParsedUrl.host) {
10001
- url += aParsedUrl.host;
10002
- }
10003
- if (aParsedUrl.port) {
10004
- url += ":" + aParsedUrl.port;
10005
- }
10006
- if (aParsedUrl.path) {
10007
- url += aParsedUrl.path;
10008
- }
10009
- return url;
10010
- }
10011
- exports.urlGenerate = urlGenerate;
10012
-
10013
- /**
10014
- * Normalizes a path, or the path portion of a URL:
10015
- *
10016
- * - Replaces consecutive slashes with one slash.
10017
- * - Removes unnecessary '.' parts.
10018
- * - Removes unnecessary '<dir>/..' parts.
10019
- *
10020
- * Based on code in the Node.js 'path' core module.
10021
- *
10022
- * @param aPath The path or url to normalize.
10023
- */
10024
- function normalize(aPath) {
10025
- var path = aPath;
10026
- var url = urlParse(aPath);
10027
- if (url) {
10028
- if (!url.path) {
10029
- return aPath;
10030
- }
10031
- path = url.path;
10032
- }
10033
- var isAbsolute = exports.isAbsolute(path);
10034
-
10035
- var parts = path.split(/\/+/);
10036
- for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
10037
- part = parts[i];
10038
- if (part === '.') {
10039
- parts.splice(i, 1);
10040
- } else if (part === '..') {
10041
- up++;
10042
- } else if (up > 0) {
10043
- if (part === '') {
10044
- // The first part is blank if the path is absolute. Trying to go
10045
- // above the root is a no-op. Therefore we can remove all '..' parts
10046
- // directly after the root.
10047
- parts.splice(i + 1, up);
10048
- up = 0;
10049
- } else {
10050
- parts.splice(i, 2);
10051
- up--;
10052
- }
10053
- }
10054
- }
10055
- path = parts.join('/');
10056
-
10057
- if (path === '') {
10058
- path = isAbsolute ? '/' : '.';
10059
- }
10060
-
10061
- if (url) {
10062
- url.path = path;
10063
- return urlGenerate(url);
10064
- }
10065
- return path;
10066
- }
10067
- exports.normalize = normalize;
10068
-
10069
- /**
10070
- * Joins two paths/URLs.
10071
- *
10072
- * @param aRoot The root path or URL.
10073
- * @param aPath The path or URL to be joined with the root.
10074
- *
10075
- * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
10076
- * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
10077
- * first.
10078
- * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
10079
- * is updated with the result and aRoot is returned. Otherwise the result
10080
- * is returned.
10081
- * - If aPath is absolute, the result is aPath.
10082
- * - Otherwise the two paths are joined with a slash.
10083
- * - Joining for example 'http://' and 'www.example.com' is also supported.
10084
- */
10085
- function join(aRoot, aPath) {
10086
- if (aRoot === "") {
10087
- aRoot = ".";
10088
- }
10089
- if (aPath === "") {
10090
- aPath = ".";
10091
- }
10092
- var aPathUrl = urlParse(aPath);
10093
- var aRootUrl = urlParse(aRoot);
10094
- if (aRootUrl) {
10095
- aRoot = aRootUrl.path || '/';
10096
- }
10097
-
10098
- // `join(foo, '//www.example.org')`
10099
- if (aPathUrl && !aPathUrl.scheme) {
10100
- if (aRootUrl) {
10101
- aPathUrl.scheme = aRootUrl.scheme;
10102
- }
10103
- return urlGenerate(aPathUrl);
10104
- }
10105
-
10106
- if (aPathUrl || aPath.match(dataUrlRegexp)) {
10107
- return aPath;
10108
- }
10109
-
10110
- // `join('http://', 'www.example.com')`
10111
- if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
10112
- aRootUrl.host = aPath;
10113
- return urlGenerate(aRootUrl);
10114
- }
10115
-
10116
- var joined = aPath.charAt(0) === '/'
10117
- ? aPath
10118
- : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
10119
-
10120
- if (aRootUrl) {
10121
- aRootUrl.path = joined;
10122
- return urlGenerate(aRootUrl);
10123
- }
10124
- return joined;
10125
- }
10126
- exports.join = join;
10008
+ /*
10009
+ * Copyright 2011 Mozilla Foundation and contributors
10010
+ * Licensed under the New BSD license. See LICENSE or:
10011
+ * http://opensource.org/licenses/BSD-3-Clause
10012
+ */
10127
10013
 
10128
- exports.isAbsolute = function (aPath) {
10129
- return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
10130
- };
10014
+ /**
10015
+ * This is a helper function for getting values from parameter/options
10016
+ * objects.
10017
+ *
10018
+ * @param args The object we are extracting values from
10019
+ * @param name The name of the property we are getting.
10020
+ * @param defaultValue An optional value to return if the property is missing
10021
+ * from the object. If this is not specified and the property is missing, an
10022
+ * error will be thrown.
10023
+ */
10024
+ function getArg(aArgs, aName, aDefaultValue) {
10025
+ if (aName in aArgs) {
10026
+ return aArgs[aName];
10027
+ } else if (arguments.length === 3) {
10028
+ return aDefaultValue;
10029
+ } else {
10030
+ throw new Error('"' + aName + '" is a required argument.');
10031
+ }
10032
+ }
10033
+ exports.getArg = getArg;
10034
+
10035
+ var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
10036
+ var dataUrlRegexp = /^data:.+\,.+$/;
10037
+
10038
+ function urlParse(aUrl) {
10039
+ var match = aUrl.match(urlRegexp);
10040
+ if (!match) {
10041
+ return null;
10042
+ }
10043
+ return {
10044
+ scheme: match[1],
10045
+ auth: match[2],
10046
+ host: match[3],
10047
+ port: match[4],
10048
+ path: match[5]
10049
+ };
10050
+ }
10051
+ exports.urlParse = urlParse;
10052
+
10053
+ function urlGenerate(aParsedUrl) {
10054
+ var url = '';
10055
+ if (aParsedUrl.scheme) {
10056
+ url += aParsedUrl.scheme + ':';
10057
+ }
10058
+ url += '//';
10059
+ if (aParsedUrl.auth) {
10060
+ url += aParsedUrl.auth + '@';
10061
+ }
10062
+ if (aParsedUrl.host) {
10063
+ url += aParsedUrl.host;
10064
+ }
10065
+ if (aParsedUrl.port) {
10066
+ url += ":" + aParsedUrl.port;
10067
+ }
10068
+ if (aParsedUrl.path) {
10069
+ url += aParsedUrl.path;
10070
+ }
10071
+ return url;
10072
+ }
10073
+ exports.urlGenerate = urlGenerate;
10131
10074
 
10132
- /**
10133
- * Make a path relative to a URL or another path.
10134
- *
10135
- * @param aRoot The root path or URL.
10136
- * @param aPath The path or URL to be made relative to aRoot.
10137
- */
10138
- function relative(aRoot, aPath) {
10139
- if (aRoot === "") {
10140
- aRoot = ".";
10141
- }
10075
+ /**
10076
+ * Normalizes a path, or the path portion of a URL:
10077
+ *
10078
+ * - Replaces consecutive slashes with one slash.
10079
+ * - Removes unnecessary '.' parts.
10080
+ * - Removes unnecessary '<dir>/..' parts.
10081
+ *
10082
+ * Based on code in the Node.js 'path' core module.
10083
+ *
10084
+ * @param aPath The path or url to normalize.
10085
+ */
10086
+ function normalize(aPath) {
10087
+ var path = aPath;
10088
+ var url = urlParse(aPath);
10089
+ if (url) {
10090
+ if (!url.path) {
10091
+ return aPath;
10092
+ }
10093
+ path = url.path;
10094
+ }
10095
+ var isAbsolute = exports.isAbsolute(path);
10096
+
10097
+ var parts = path.split(/\/+/);
10098
+ for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
10099
+ part = parts[i];
10100
+ if (part === '.') {
10101
+ parts.splice(i, 1);
10102
+ } else if (part === '..') {
10103
+ up++;
10104
+ } else if (up > 0) {
10105
+ if (part === '') {
10106
+ // The first part is blank if the path is absolute. Trying to go
10107
+ // above the root is a no-op. Therefore we can remove all '..' parts
10108
+ // directly after the root.
10109
+ parts.splice(i + 1, up);
10110
+ up = 0;
10111
+ } else {
10112
+ parts.splice(i, 2);
10113
+ up--;
10114
+ }
10115
+ }
10116
+ }
10117
+ path = parts.join('/');
10118
+
10119
+ if (path === '') {
10120
+ path = isAbsolute ? '/' : '.';
10121
+ }
10122
+
10123
+ if (url) {
10124
+ url.path = path;
10125
+ return urlGenerate(url);
10126
+ }
10127
+ return path;
10128
+ }
10129
+ exports.normalize = normalize;
10142
10130
 
10143
- aRoot = aRoot.replace(/\/$/, '');
10131
+ /**
10132
+ * Joins two paths/URLs.
10133
+ *
10134
+ * @param aRoot The root path or URL.
10135
+ * @param aPath The path or URL to be joined with the root.
10136
+ *
10137
+ * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
10138
+ * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
10139
+ * first.
10140
+ * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
10141
+ * is updated with the result and aRoot is returned. Otherwise the result
10142
+ * is returned.
10143
+ * - If aPath is absolute, the result is aPath.
10144
+ * - Otherwise the two paths are joined with a slash.
10145
+ * - Joining for example 'http://' and 'www.example.com' is also supported.
10146
+ */
10147
+ function join(aRoot, aPath) {
10148
+ if (aRoot === "") {
10149
+ aRoot = ".";
10150
+ }
10151
+ if (aPath === "") {
10152
+ aPath = ".";
10153
+ }
10154
+ var aPathUrl = urlParse(aPath);
10155
+ var aRootUrl = urlParse(aRoot);
10156
+ if (aRootUrl) {
10157
+ aRoot = aRootUrl.path || '/';
10158
+ }
10159
+
10160
+ // `join(foo, '//www.example.org')`
10161
+ if (aPathUrl && !aPathUrl.scheme) {
10162
+ if (aRootUrl) {
10163
+ aPathUrl.scheme = aRootUrl.scheme;
10164
+ }
10165
+ return urlGenerate(aPathUrl);
10166
+ }
10167
+
10168
+ if (aPathUrl || aPath.match(dataUrlRegexp)) {
10169
+ return aPath;
10170
+ }
10171
+
10172
+ // `join('http://', 'www.example.com')`
10173
+ if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
10174
+ aRootUrl.host = aPath;
10175
+ return urlGenerate(aRootUrl);
10176
+ }
10177
+
10178
+ var joined = aPath.charAt(0) === '/'
10179
+ ? aPath
10180
+ : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
10181
+
10182
+ if (aRootUrl) {
10183
+ aRootUrl.path = joined;
10184
+ return urlGenerate(aRootUrl);
10185
+ }
10186
+ return joined;
10187
+ }
10188
+ exports.join = join;
10189
+
10190
+ exports.isAbsolute = function (aPath) {
10191
+ return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
10192
+ };
10144
10193
 
10145
- // It is possible for the path to be above the root. In this case, simply
10146
- // checking whether the root is a prefix of the path won't work. Instead, we
10147
- // need to remove components from the root one by one, until either we find
10148
- // a prefix that fits, or we run out of components to remove.
10149
- var level = 0;
10150
- while (aPath.indexOf(aRoot + '/') !== 0) {
10151
- var index = aRoot.lastIndexOf("/");
10152
- if (index < 0) {
10153
- return aPath;
10154
- }
10194
+ /**
10195
+ * Make a path relative to a URL or another path.
10196
+ *
10197
+ * @param aRoot The root path or URL.
10198
+ * @param aPath The path or URL to be made relative to aRoot.
10199
+ */
10200
+ function relative(aRoot, aPath) {
10201
+ if (aRoot === "") {
10202
+ aRoot = ".";
10203
+ }
10155
10204
 
10156
- // If the only part of the root that is left is the scheme (i.e. http://,
10157
- // file:///, etc.), one or more slashes (/), or simply nothing at all, we
10158
- // have exhausted all components, so the path is not relative to the root.
10159
- aRoot = aRoot.slice(0, index);
10160
- if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
10161
- return aPath;
10162
- }
10205
+ aRoot = aRoot.replace(/\/$/, '');
10163
10206
 
10164
- ++level;
10165
- }
10207
+ // It is possible for the path to be above the root. In this case, simply
10208
+ // checking whether the root is a prefix of the path won't work. Instead, we
10209
+ // need to remove components from the root one by one, until either we find
10210
+ // a prefix that fits, or we run out of components to remove.
10211
+ var level = 0;
10212
+ while (aPath.indexOf(aRoot + '/') !== 0) {
10213
+ var index = aRoot.lastIndexOf("/");
10214
+ if (index < 0) {
10215
+ return aPath;
10216
+ }
10166
10217
 
10167
- // Make sure we add a "../" for each component we removed from the root.
10168
- return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
10169
- }
10170
- exports.relative = relative;
10218
+ // If the only part of the root that is left is the scheme (i.e. http://,
10219
+ // file:///, etc.), one or more slashes (/), or simply nothing at all, we
10220
+ // have exhausted all components, so the path is not relative to the root.
10221
+ aRoot = aRoot.slice(0, index);
10222
+ if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
10223
+ return aPath;
10224
+ }
10171
10225
 
10172
- var supportsNullProto = (function () {
10173
- var obj = Object.create(null);
10174
- return !('__proto__' in obj);
10175
- }());
10226
+ ++level;
10227
+ }
10176
10228
 
10177
- function identity (s) {
10178
- return s;
10179
- }
10229
+ // Make sure we add a "../" for each component we removed from the root.
10230
+ return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
10231
+ }
10232
+ exports.relative = relative;
10180
10233
 
10181
- /**
10182
- * Because behavior goes wacky when you set `__proto__` on objects, we
10183
- * have to prefix all the strings in our set with an arbitrary character.
10184
- *
10185
- * See https://github.com/mozilla/source-map/pull/31 and
10186
- * https://github.com/mozilla/source-map/issues/30
10187
- *
10188
- * @param String aStr
10189
- */
10190
- function toSetString(aStr) {
10191
- if (isProtoString(aStr)) {
10192
- return '$' + aStr;
10193
- }
10234
+ var supportsNullProto = (function () {
10235
+ var obj = Object.create(null);
10236
+ return !('__proto__' in obj);
10237
+ }());
10194
10238
 
10195
- return aStr;
10196
- }
10197
- exports.toSetString = supportsNullProto ? identity : toSetString;
10239
+ function identity (s) {
10240
+ return s;
10241
+ }
10198
10242
 
10199
- function fromSetString(aStr) {
10200
- if (isProtoString(aStr)) {
10201
- return aStr.slice(1);
10202
- }
10243
+ /**
10244
+ * Because behavior goes wacky when you set `__proto__` on objects, we
10245
+ * have to prefix all the strings in our set with an arbitrary character.
10246
+ *
10247
+ * See https://github.com/mozilla/source-map/pull/31 and
10248
+ * https://github.com/mozilla/source-map/issues/30
10249
+ *
10250
+ * @param String aStr
10251
+ */
10252
+ function toSetString(aStr) {
10253
+ if (isProtoString(aStr)) {
10254
+ return '$' + aStr;
10255
+ }
10203
10256
 
10204
- return aStr;
10205
- }
10206
- exports.fromSetString = supportsNullProto ? identity : fromSetString;
10257
+ return aStr;
10258
+ }
10259
+ exports.toSetString = supportsNullProto ? identity : toSetString;
10207
10260
 
10208
- function isProtoString(s) {
10209
- if (!s) {
10210
- return false;
10211
- }
10261
+ function fromSetString(aStr) {
10262
+ if (isProtoString(aStr)) {
10263
+ return aStr.slice(1);
10264
+ }
10212
10265
 
10213
- var length = s.length;
10266
+ return aStr;
10267
+ }
10268
+ exports.fromSetString = supportsNullProto ? identity : fromSetString;
10214
10269
 
10215
- if (length < 9 /* "__proto__".length */) {
10216
- return false;
10217
- }
10270
+ function isProtoString(s) {
10271
+ if (!s) {
10272
+ return false;
10273
+ }
10218
10274
 
10219
- if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
10220
- s.charCodeAt(length - 2) !== 95 /* '_' */ ||
10221
- s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
10222
- s.charCodeAt(length - 4) !== 116 /* 't' */ ||
10223
- s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
10224
- s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
10225
- s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
10226
- s.charCodeAt(length - 8) !== 95 /* '_' */ ||
10227
- s.charCodeAt(length - 9) !== 95 /* '_' */) {
10228
- return false;
10229
- }
10275
+ var length = s.length;
10230
10276
 
10231
- for (var i = length - 10; i >= 0; i--) {
10232
- if (s.charCodeAt(i) !== 36 /* '$' */) {
10233
- return false;
10234
- }
10235
- }
10277
+ if (length < 9 /* "__proto__".length */) {
10278
+ return false;
10279
+ }
10236
10280
 
10237
- return true;
10238
- }
10281
+ if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
10282
+ s.charCodeAt(length - 2) !== 95 /* '_' */ ||
10283
+ s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
10284
+ s.charCodeAt(length - 4) !== 116 /* 't' */ ||
10285
+ s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
10286
+ s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
10287
+ s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
10288
+ s.charCodeAt(length - 8) !== 95 /* '_' */ ||
10289
+ s.charCodeAt(length - 9) !== 95 /* '_' */) {
10290
+ return false;
10291
+ }
10239
10292
 
10240
- /**
10241
- * Comparator between two mappings where the original positions are compared.
10242
- *
10243
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
10244
- * mappings with the same original source/line/column, but different generated
10245
- * line and column the same. Useful when searching for a mapping with a
10246
- * stubbed out mapping.
10247
- */
10248
- function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
10249
- var cmp = strcmp(mappingA.source, mappingB.source);
10250
- if (cmp !== 0) {
10251
- return cmp;
10252
- }
10293
+ for (var i = length - 10; i >= 0; i--) {
10294
+ if (s.charCodeAt(i) !== 36 /* '$' */) {
10295
+ return false;
10296
+ }
10297
+ }
10253
10298
 
10254
- cmp = mappingA.originalLine - mappingB.originalLine;
10255
- if (cmp !== 0) {
10256
- return cmp;
10257
- }
10299
+ return true;
10300
+ }
10258
10301
 
10259
- cmp = mappingA.originalColumn - mappingB.originalColumn;
10260
- if (cmp !== 0 || onlyCompareOriginal) {
10261
- return cmp;
10262
- }
10302
+ /**
10303
+ * Comparator between two mappings where the original positions are compared.
10304
+ *
10305
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
10306
+ * mappings with the same original source/line/column, but different generated
10307
+ * line and column the same. Useful when searching for a mapping with a
10308
+ * stubbed out mapping.
10309
+ */
10310
+ function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
10311
+ var cmp = strcmp(mappingA.source, mappingB.source);
10312
+ if (cmp !== 0) {
10313
+ return cmp;
10314
+ }
10263
10315
 
10264
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
10265
- if (cmp !== 0) {
10266
- return cmp;
10267
- }
10316
+ cmp = mappingA.originalLine - mappingB.originalLine;
10317
+ if (cmp !== 0) {
10318
+ return cmp;
10319
+ }
10268
10320
 
10269
- cmp = mappingA.generatedLine - mappingB.generatedLine;
10270
- if (cmp !== 0) {
10271
- return cmp;
10272
- }
10321
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
10322
+ if (cmp !== 0 || onlyCompareOriginal) {
10323
+ return cmp;
10324
+ }
10273
10325
 
10274
- return strcmp(mappingA.name, mappingB.name);
10275
- }
10276
- exports.compareByOriginalPositions = compareByOriginalPositions;
10326
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
10327
+ if (cmp !== 0) {
10328
+ return cmp;
10329
+ }
10277
10330
 
10278
- /**
10279
- * Comparator between two mappings with deflated source and name indices where
10280
- * the generated positions are compared.
10281
- *
10282
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
10283
- * mappings with the same generated line and column, but different
10284
- * source/name/original line and column the same. Useful when searching for a
10285
- * mapping with a stubbed out mapping.
10286
- */
10287
- function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
10288
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
10289
- if (cmp !== 0) {
10290
- return cmp;
10291
- }
10331
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
10332
+ if (cmp !== 0) {
10333
+ return cmp;
10334
+ }
10292
10335
 
10293
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
10294
- if (cmp !== 0 || onlyCompareGenerated) {
10295
- return cmp;
10296
- }
10336
+ return strcmp(mappingA.name, mappingB.name);
10337
+ }
10338
+ exports.compareByOriginalPositions = compareByOriginalPositions;
10297
10339
 
10298
- cmp = strcmp(mappingA.source, mappingB.source);
10299
- if (cmp !== 0) {
10300
- return cmp;
10301
- }
10340
+ /**
10341
+ * Comparator between two mappings with deflated source and name indices where
10342
+ * the generated positions are compared.
10343
+ *
10344
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
10345
+ * mappings with the same generated line and column, but different
10346
+ * source/name/original line and column the same. Useful when searching for a
10347
+ * mapping with a stubbed out mapping.
10348
+ */
10349
+ function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
10350
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
10351
+ if (cmp !== 0) {
10352
+ return cmp;
10353
+ }
10302
10354
 
10303
- cmp = mappingA.originalLine - mappingB.originalLine;
10304
- if (cmp !== 0) {
10305
- return cmp;
10306
- }
10355
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
10356
+ if (cmp !== 0 || onlyCompareGenerated) {
10357
+ return cmp;
10358
+ }
10307
10359
 
10308
- cmp = mappingA.originalColumn - mappingB.originalColumn;
10309
- if (cmp !== 0) {
10310
- return cmp;
10311
- }
10360
+ cmp = strcmp(mappingA.source, mappingB.source);
10361
+ if (cmp !== 0) {
10362
+ return cmp;
10363
+ }
10312
10364
 
10313
- return strcmp(mappingA.name, mappingB.name);
10314
- }
10315
- exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
10365
+ cmp = mappingA.originalLine - mappingB.originalLine;
10366
+ if (cmp !== 0) {
10367
+ return cmp;
10368
+ }
10316
10369
 
10317
- function strcmp(aStr1, aStr2) {
10318
- if (aStr1 === aStr2) {
10319
- return 0;
10320
- }
10370
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
10371
+ if (cmp !== 0) {
10372
+ return cmp;
10373
+ }
10321
10374
 
10322
- if (aStr1 === null) {
10323
- return 1; // aStr2 !== null
10324
- }
10375
+ return strcmp(mappingA.name, mappingB.name);
10376
+ }
10377
+ exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
10325
10378
 
10326
- if (aStr2 === null) {
10327
- return -1; // aStr1 !== null
10328
- }
10379
+ function strcmp(aStr1, aStr2) {
10380
+ if (aStr1 === aStr2) {
10381
+ return 0;
10382
+ }
10329
10383
 
10330
- if (aStr1 > aStr2) {
10331
- return 1;
10332
- }
10384
+ if (aStr1 === null) {
10385
+ return 1; // aStr2 !== null
10386
+ }
10333
10387
 
10334
- return -1;
10335
- }
10388
+ if (aStr2 === null) {
10389
+ return -1; // aStr1 !== null
10390
+ }
10336
10391
 
10337
- /**
10338
- * Comparator between two mappings with inflated source and name strings where
10339
- * the generated positions are compared.
10340
- */
10341
- function compareByGeneratedPositionsInflated(mappingA, mappingB) {
10342
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
10343
- if (cmp !== 0) {
10344
- return cmp;
10345
- }
10392
+ if (aStr1 > aStr2) {
10393
+ return 1;
10394
+ }
10346
10395
 
10347
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
10348
- if (cmp !== 0) {
10349
- return cmp;
10350
- }
10396
+ return -1;
10397
+ }
10351
10398
 
10352
- cmp = strcmp(mappingA.source, mappingB.source);
10353
- if (cmp !== 0) {
10354
- return cmp;
10355
- }
10399
+ /**
10400
+ * Comparator between two mappings with inflated source and name strings where
10401
+ * the generated positions are compared.
10402
+ */
10403
+ function compareByGeneratedPositionsInflated(mappingA, mappingB) {
10404
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
10405
+ if (cmp !== 0) {
10406
+ return cmp;
10407
+ }
10356
10408
 
10357
- cmp = mappingA.originalLine - mappingB.originalLine;
10358
- if (cmp !== 0) {
10359
- return cmp;
10360
- }
10409
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
10410
+ if (cmp !== 0) {
10411
+ return cmp;
10412
+ }
10361
10413
 
10362
- cmp = mappingA.originalColumn - mappingB.originalColumn;
10363
- if (cmp !== 0) {
10364
- return cmp;
10365
- }
10414
+ cmp = strcmp(mappingA.source, mappingB.source);
10415
+ if (cmp !== 0) {
10416
+ return cmp;
10417
+ }
10366
10418
 
10367
- return strcmp(mappingA.name, mappingB.name);
10368
- }
10369
- exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
10419
+ cmp = mappingA.originalLine - mappingB.originalLine;
10420
+ if (cmp !== 0) {
10421
+ return cmp;
10422
+ }
10370
10423
 
10371
- /**
10372
- * Strip any JSON XSSI avoidance prefix from the string (as documented
10373
- * in the source maps specification), and then parse the string as
10374
- * JSON.
10375
- */
10376
- function parseSourceMapInput(str) {
10377
- return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
10378
- }
10379
- exports.parseSourceMapInput = parseSourceMapInput;
10424
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
10425
+ if (cmp !== 0) {
10426
+ return cmp;
10427
+ }
10380
10428
 
10381
- /**
10382
- * Compute the URL of a source given the the source root, the source's
10383
- * URL, and the source map's URL.
10384
- */
10385
- function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
10386
- sourceURL = sourceURL || '';
10387
-
10388
- if (sourceRoot) {
10389
- // This follows what Chrome does.
10390
- if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
10391
- sourceRoot += '/';
10392
- }
10393
- // The spec says:
10394
- // Line 4: An optional source root, useful for relocating source
10395
- // files on a server or removing repeated values in the
10396
- // “sources” entry. This value is prepended to the individual
10397
- // entries in the “source” field.
10398
- sourceURL = sourceRoot + sourceURL;
10399
- }
10429
+ return strcmp(mappingA.name, mappingB.name);
10430
+ }
10431
+ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
10400
10432
 
10401
- // Historically, SourceMapConsumer did not take the sourceMapURL as
10402
- // a parameter. This mode is still somewhat supported, which is why
10403
- // this code block is conditional. However, it's preferable to pass
10404
- // the source map URL to SourceMapConsumer, so that this function
10405
- // can implement the source URL resolution algorithm as outlined in
10406
- // the spec. This block is basically the equivalent of:
10407
- // new URL(sourceURL, sourceMapURL).toString()
10408
- // ... except it avoids using URL, which wasn't available in the
10409
- // older releases of node still supported by this library.
10410
- //
10411
- // The spec says:
10412
- // If the sources are not absolute URLs after prepending of the
10413
- // “sourceRoot”, the sources are resolved relative to the
10414
- // SourceMap (like resolving script src in a html document).
10415
- if (sourceMapURL) {
10416
- var parsed = urlParse(sourceMapURL);
10417
- if (!parsed) {
10418
- throw new Error("sourceMapURL could not be parsed");
10419
- }
10420
- if (parsed.path) {
10421
- // Strip the last path component, but keep the "/".
10422
- var index = parsed.path.lastIndexOf('/');
10423
- if (index >= 0) {
10424
- parsed.path = parsed.path.substring(0, index + 1);
10425
- }
10426
- }
10427
- sourceURL = join(urlGenerate(parsed), sourceURL);
10428
- }
10433
+ /**
10434
+ * Strip any JSON XSSI avoidance prefix from the string (as documented
10435
+ * in the source maps specification), and then parse the string as
10436
+ * JSON.
10437
+ */
10438
+ function parseSourceMapInput(str) {
10439
+ return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
10440
+ }
10441
+ exports.parseSourceMapInput = parseSourceMapInput;
10429
10442
 
10430
- return normalize(sourceURL);
10431
- }
10432
- exports.computeSourceURL = computeSourceURL;
10433
- }(util$3));
10443
+ /**
10444
+ * Compute the URL of a source given the the source root, the source's
10445
+ * URL, and the source map's URL.
10446
+ */
10447
+ function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
10448
+ sourceURL = sourceURL || '';
10449
+
10450
+ if (sourceRoot) {
10451
+ // This follows what Chrome does.
10452
+ if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
10453
+ sourceRoot += '/';
10454
+ }
10455
+ // The spec says:
10456
+ // Line 4: An optional source root, useful for relocating source
10457
+ // files on a server or removing repeated values in the
10458
+ // “sources” entry. This value is prepended to the individual
10459
+ // entries in the “source” field.
10460
+ sourceURL = sourceRoot + sourceURL;
10461
+ }
10462
+
10463
+ // Historically, SourceMapConsumer did not take the sourceMapURL as
10464
+ // a parameter. This mode is still somewhat supported, which is why
10465
+ // this code block is conditional. However, it's preferable to pass
10466
+ // the source map URL to SourceMapConsumer, so that this function
10467
+ // can implement the source URL resolution algorithm as outlined in
10468
+ // the spec. This block is basically the equivalent of:
10469
+ // new URL(sourceURL, sourceMapURL).toString()
10470
+ // ... except it avoids using URL, which wasn't available in the
10471
+ // older releases of node still supported by this library.
10472
+ //
10473
+ // The spec says:
10474
+ // If the sources are not absolute URLs after prepending of the
10475
+ // “sourceRoot”, the sources are resolved relative to the
10476
+ // SourceMap (like resolving script src in a html document).
10477
+ if (sourceMapURL) {
10478
+ var parsed = urlParse(sourceMapURL);
10479
+ if (!parsed) {
10480
+ throw new Error("sourceMapURL could not be parsed");
10481
+ }
10482
+ if (parsed.path) {
10483
+ // Strip the last path component, but keep the "/".
10484
+ var index = parsed.path.lastIndexOf('/');
10485
+ if (index >= 0) {
10486
+ parsed.path = parsed.path.substring(0, index + 1);
10487
+ }
10488
+ }
10489
+ sourceURL = join(urlGenerate(parsed), sourceURL);
10490
+ }
10491
+
10492
+ return normalize(sourceURL);
10493
+ }
10494
+ exports.computeSourceURL = computeSourceURL;
10495
+ } (util$3));
10434
10496
 
10435
10497
  var arraySet = {};
10436
10498
 
@@ -11184,7 +11246,7 @@
11184
11246
  }
11185
11247
  }
11186
11248
 
11187
- var create$3 = function createGenerator(config) {
11249
+ var create$2 = function createGenerator(config) {
11188
11250
  function processNode(node) {
11189
11251
  if (hasOwnProperty$4.call(types, node.type)) {
11190
11252
  types[node.type].call(this, node);
@@ -11232,7 +11294,7 @@
11232
11294
 
11233
11295
  var List$2 = List_1;
11234
11296
 
11235
- var create$2 = function createConvertors(walk) {
11297
+ var create$1 = function createConvertors(walk) {
11236
11298
  return {
11237
11299
  fromPlainObject: function(ast) {
11238
11300
  walk(ast, {
@@ -11404,7 +11466,7 @@
11404
11466
  };
11405
11467
  }
11406
11468
 
11407
- var create$1 = function createWalker(config) {
11469
+ var create = function createWalker(config) {
11408
11470
  var types = getTypesFromConfig(config);
11409
11471
  var iteratorsNatural = {};
11410
11472
  var iteratorsReverse = {};
@@ -11713,10 +11775,10 @@
11713
11775
  var Lexer = Lexer_1;
11714
11776
  var definitionSyntax = definitionSyntax$1;
11715
11777
  var tokenize = tokenizer$3;
11716
- var createParser = create$4;
11717
- var createGenerator = create$3;
11718
- var createConvertor = create$2;
11719
- var createWalker = create$1;
11778
+ var createParser = create$3;
11779
+ var createGenerator = create$2;
11780
+ var createConvertor = create$1;
11781
+ var createWalker = create;
11720
11782
  var clone = clone$1;
11721
11783
  var names = names$2;
11722
11784
  var mix = mix_1;
@@ -11780,7 +11842,7 @@
11780
11842
 
11781
11843
  return syntax;
11782
11844
  }
11783
- create$5.create = function(config) {
11845
+ create$4.create = function(config) {
11784
11846
  return createSyntax(mix({}, config));
11785
11847
  };
11786
11848
 
@@ -26353,7 +26415,7 @@
26353
26415
  return dest;
26354
26416
  }
26355
26417
 
26356
- syntax.exports = create$5.create(
26418
+ syntax.exports = create$4.create(
26357
26419
  merge(
26358
26420
  lexer,
26359
26421
  parser,
@@ -26362,7 +26424,11 @@
26362
26424
  );
26363
26425
  syntax.exports.version = require$$4.version;
26364
26426
 
26365
- var lib = syntax.exports;
26427
+ var syntaxExports = syntax.exports;
26428
+
26429
+ var lib = syntaxExports;
26430
+
26431
+ var csstree = /*@__PURE__*/getDefaultExportFromCjs(lib);
26366
26432
 
26367
26433
  class Sheet {
26368
26434
  constructor(url, hooks) {
@@ -26403,7 +26469,7 @@
26403
26469
  await this.hooks.beforeTreeParse.trigger(this.text, this);
26404
26470
 
26405
26471
  // send to csstree
26406
- this.ast = lib.parse(this._text);
26472
+ this.ast = csstree.parse(this._text);
26407
26473
 
26408
26474
  await this.hooks.beforeTreeWalk.trigger(this.ast);
26409
26475
 
@@ -26441,7 +26507,7 @@
26441
26507
  }
26442
26508
 
26443
26509
  urls(ast) {
26444
- lib.walk(ast, {
26510
+ csstree.walk(ast, {
26445
26511
  visit: "Url",
26446
26512
  enter: (node, item, list) => {
26447
26513
  this.hooks.onUrl.trigger(node, item, list);
@@ -26450,10 +26516,10 @@
26450
26516
  }
26451
26517
 
26452
26518
  atrules(ast) {
26453
- lib.walk(ast, {
26519
+ csstree.walk(ast, {
26454
26520
  visit: "Atrule",
26455
26521
  enter: (node, item, list) => {
26456
- const basename = lib.keyword(node.name).basename;
26522
+ const basename = csstree.keyword(node.name).basename;
26457
26523
 
26458
26524
  if (basename === "page") {
26459
26525
  this.hooks.onAtPage.trigger(node, item, list);
@@ -26475,7 +26541,7 @@
26475
26541
 
26476
26542
 
26477
26543
  rules(ast) {
26478
- lib.walk(ast, {
26544
+ csstree.walk(ast, {
26479
26545
  visit: "Rule",
26480
26546
  enter: (ruleNode, ruleItem, rulelist) => {
26481
26547
 
@@ -26488,14 +26554,14 @@
26488
26554
  }
26489
26555
 
26490
26556
  declarations(ruleNode, ruleItem, rulelist) {
26491
- lib.walk(ruleNode, {
26557
+ csstree.walk(ruleNode, {
26492
26558
  visit: "Declaration",
26493
26559
  enter: (declarationNode, dItem, dList) => {
26494
26560
 
26495
26561
  this.hooks.onDeclaration.trigger(declarationNode, dItem, dList, {ruleNode, ruleItem, rulelist});
26496
26562
 
26497
26563
  if (declarationNode.property === "content") {
26498
- lib.walk(declarationNode, {
26564
+ csstree.walk(declarationNode, {
26499
26565
  visit: "Function",
26500
26566
  enter: (funcNode, fItem, fList) => {
26501
26567
  this.hooks.onContent.trigger(funcNode, fItem, fList, {declarationNode, dItem, dList}, {ruleNode, ruleItem, rulelist});
@@ -26509,13 +26575,13 @@
26509
26575
 
26510
26576
  // add pseudo elements to parser
26511
26577
  onSelector(ruleNode, ruleItem, rulelist) {
26512
- lib.walk(ruleNode, {
26578
+ csstree.walk(ruleNode, {
26513
26579
  visit: "Selector",
26514
26580
  enter: (selectNode, selectItem, selectList) => {
26515
26581
  this.hooks.onSelector.trigger(selectNode, selectItem, selectList, {ruleNode, ruleItem, rulelist});
26516
26582
 
26517
26583
  if (selectNode.children.forEach(node => {if (node.type === "PseudoElementSelector") {
26518
- lib.walk(node, {
26584
+ csstree.walk(node, {
26519
26585
  visit: "PseudoElementSelector",
26520
26586
  enter: (pseudoNode, pItem, pList) => {
26521
26587
  this.hooks.onPseudoSelector.trigger(pseudoNode, pItem, pList, {selectNode, selectItem, selectList}, {ruleNode, ruleItem, rulelist});
@@ -26527,7 +26593,7 @@
26527
26593
  }
26528
26594
 
26529
26595
  replaceUrls(ast) {
26530
- lib.walk(ast, {
26596
+ csstree.walk(ast, {
26531
26597
  visit: "Url",
26532
26598
  enter: (node, item, list) => {
26533
26599
  let content = node.value.value;
@@ -26543,7 +26609,7 @@
26543
26609
  addScope(ast, id) {
26544
26610
  // Get all selector lists
26545
26611
  // add an id
26546
- lib.walk(ast, {
26612
+ csstree.walk(ast, {
26547
26613
  visit: "Selector",
26548
26614
  enter: (node, item, list) => {
26549
26615
  let children = node.children;
@@ -26563,16 +26629,16 @@
26563
26629
 
26564
26630
  getNamedPageSelectors(ast) {
26565
26631
  let namedPageSelectors = {};
26566
- lib.walk(ast, {
26632
+ csstree.walk(ast, {
26567
26633
  visit: "Rule",
26568
26634
  enter: (node, item, list) => {
26569
- lib.walk(node, {
26635
+ csstree.walk(node, {
26570
26636
  visit: "Declaration",
26571
26637
  enter: (declaration, dItem, dList) => {
26572
26638
  if (declaration.property === "page") {
26573
26639
  let value = declaration.value.children.first();
26574
26640
  let name = value.name;
26575
- let selector = lib.generate(node.prelude);
26641
+ let selector = csstree.generate(node.prelude);
26576
26642
  namedPageSelectors[name] = {
26577
26643
  name: name,
26578
26644
  selector: selector
@@ -26594,11 +26660,11 @@
26594
26660
  }
26595
26661
 
26596
26662
  replaceIds(ast) {
26597
- lib.walk(ast, {
26663
+ csstree.walk(ast, {
26598
26664
  visit: "Rule",
26599
26665
  enter: (node, item, list) => {
26600
26666
 
26601
- lib.walk(node, {
26667
+ csstree.walk(node, {
26602
26668
  visit: "IdSelector",
26603
26669
  enter: (idNode, idItem, idList) => {
26604
26670
  let name = idNode.name;
@@ -26616,10 +26682,10 @@
26616
26682
  imports(node, item, list) {
26617
26683
  // console.log("import", node, item, list);
26618
26684
  let queries = [];
26619
- lib.walk(node, {
26685
+ csstree.walk(node, {
26620
26686
  visit: "MediaQuery",
26621
26687
  enter: (mqNode, mqItem, mqList) => {
26622
- lib.walk(mqNode, {
26688
+ csstree.walk(mqNode, {
26623
26689
  visit: "Identifier",
26624
26690
  enter: (identNode, identItem, identList) => {
26625
26691
  queries.push(identNode.name);
@@ -26643,7 +26709,7 @@
26643
26709
  return;
26644
26710
  }
26645
26711
 
26646
- lib.walk(node, {
26712
+ csstree.walk(node, {
26647
26713
  visit: "String",
26648
26714
  enter: (urlNode, urlItem, urlList) => {
26649
26715
  let href = urlNode.value.replace(/["']/g, "");
@@ -26668,7 +26734,7 @@
26668
26734
 
26669
26735
  // generate string
26670
26736
  toString(ast) {
26671
- return lib.generate(ast || this.ast);
26737
+ return csstree.generate(ast || this.ast);
26672
26738
  }
26673
26739
  }
26674
26740
 
@@ -27116,13 +27182,20 @@
27116
27182
  counter-reset: unset;
27117
27183
  }
27118
27184
 
27119
- [data-footnote-marker]:not([data-split-from]) {
27120
- counter-increment: footnote-marker;
27185
+ [data-footnote-marker] {
27121
27186
  text-indent: 0;
27122
27187
  display: list-item;
27123
27188
  list-style-position: inside;
27124
27189
  }
27125
27190
 
27191
+ [data-footnote-marker][data-split-from] {
27192
+ list-style: none;
27193
+ }
27194
+
27195
+ [data-footnote-marker]:not([data-split-from]) {
27196
+ counter-increment: footnote-marker;
27197
+ }
27198
+
27126
27199
  [data-footnote-marker]::marker {
27127
27200
  content: counter(footnote-marker) ". ";
27128
27201
  }
@@ -27758,7 +27831,7 @@
27758
27831
  named = this.getTypeSelector(node);
27759
27832
  psuedo = this.getPsuedoSelector(node);
27760
27833
  nth = this.getNthSelector(node);
27761
- selector = lib.generate(node.prelude);
27834
+ selector = csstree.generate(node.prelude);
27762
27835
  } else {
27763
27836
  selector = "*";
27764
27837
  }
@@ -27935,7 +28008,7 @@
27935
28008
  // Find page name
27936
28009
  let name;
27937
28010
 
27938
- lib.walk(ast, {
28011
+ csstree.walk(ast, {
27939
28012
  visit: "TypeSelector",
27940
28013
  enter: (node, item, list) => {
27941
28014
  name = node.name;
@@ -27948,7 +28021,7 @@
27948
28021
  getPsuedoSelector(ast) {
27949
28022
  // Find if it has :left & :right & :black & :first
27950
28023
  let name;
27951
- lib.walk(ast, {
28024
+ csstree.walk(ast, {
27952
28025
  visit: "PseudoClassSelector",
27953
28026
  enter: (node, item, list) => {
27954
28027
  if (node.name !== "nth") {
@@ -27963,7 +28036,7 @@
27963
28036
  getNthSelector(ast) {
27964
28037
  // Find if it has :nth
27965
28038
  let nth;
27966
- lib.walk(ast, {
28039
+ csstree.walk(ast, {
27967
28040
  visit: "PseudoClassSelector",
27968
28041
  enter: (node, item, list) => {
27969
28042
  if (node.name === "nth" && node.children) {
@@ -27984,7 +28057,7 @@
27984
28057
  "left-top", "left-middle", "left", "left-bottom", "top-right-corner",
27985
28058
  "right-top", "right-middle", "right", "right-bottom", "right-right-corner"
27986
28059
  ];
27987
- lib.walk(ast.block, {
28060
+ csstree.walk(ast.block, {
27988
28061
  visit: "Atrule",
27989
28062
  enter: (node, item, list) => {
27990
28063
  let name = node.name;
@@ -28013,7 +28086,7 @@
28013
28086
  replaceNotes(ast) {
28014
28087
  let parsed = {};
28015
28088
 
28016
- lib.walk(ast.block, {
28089
+ csstree.walk(ast.block, {
28017
28090
  visit: "Atrule",
28018
28091
  enter: (node, item, list) => {
28019
28092
  let name = node.name;
@@ -28030,15 +28103,15 @@
28030
28103
  replaceDeclarations(ast) {
28031
28104
  let parsed = {};
28032
28105
 
28033
- lib.walk(ast.block, {
28106
+ csstree.walk(ast.block, {
28034
28107
  visit: "Declaration",
28035
28108
  enter: (declaration, dItem, dList) => {
28036
- let prop = lib.property(declaration.property).name;
28109
+ let prop = csstree.property(declaration.property).name;
28037
28110
  // let value = declaration.value;
28038
28111
 
28039
28112
  if (prop === "marks") {
28040
28113
  parsed.marks = [];
28041
- lib.walk(declaration, {
28114
+ csstree.walk(declaration, {
28042
28115
  visit: "Identifier",
28043
28116
  enter: (ident) => {
28044
28117
  parsed.marks.push(ident.name);
@@ -28089,10 +28162,10 @@
28089
28162
  bottom: {}
28090
28163
  };
28091
28164
  }
28092
- parsed.border.top = lib.generate(declaration.value);
28093
- parsed.border.right = lib.generate(declaration.value);
28094
- parsed.border.left = lib.generate(declaration.value);
28095
- parsed.border.bottom = lib.generate(declaration.value);
28165
+ parsed.border.top = csstree.generate(declaration.value);
28166
+ parsed.border.right = csstree.generate(declaration.value);
28167
+ parsed.border.left = csstree.generate(declaration.value);
28168
+ parsed.border.bottom = csstree.generate(declaration.value);
28096
28169
 
28097
28170
  dList.remove(dItem);
28098
28171
 
@@ -28109,7 +28182,7 @@
28109
28182
  }
28110
28183
  let p = prop.substring("border-".length);
28111
28184
 
28112
- parsed.border[p] = lib.generate(declaration.value);
28185
+ parsed.border[p] = csstree.generate(declaration.value);
28113
28186
  dList.remove(dItem);
28114
28187
 
28115
28188
  }
@@ -28120,7 +28193,7 @@
28120
28193
  } else if (prop === "bleed") {
28121
28194
  parsed.bleed = [];
28122
28195
 
28123
- lib.walk(declaration, {
28196
+ csstree.walk(declaration, {
28124
28197
  enter: (subNode) => {
28125
28198
  switch (subNode.type) {
28126
28199
  case "String": // bleed: "auto"
@@ -28159,7 +28232,7 @@
28159
28232
  let width, height, orientation, format;
28160
28233
 
28161
28234
  // Get size: Xmm Ymm
28162
- lib.walk(declaration, {
28235
+ csstree.walk(declaration, {
28163
28236
  visit: "Dimension",
28164
28237
  enter: (node, item, list) => {
28165
28238
  let { value, unit } = node;
@@ -28172,7 +28245,7 @@
28172
28245
  });
28173
28246
 
28174
28247
  // Get size: "A4"
28175
- lib.walk(declaration, {
28248
+ csstree.walk(declaration, {
28176
28249
  visit: "String",
28177
28250
  enter: (node, item, list) => {
28178
28251
  let name = node.value.replace(/["|']/g, "");
@@ -28185,7 +28258,7 @@
28185
28258
  });
28186
28259
 
28187
28260
  // Get Format or Landscape or Portrait
28188
- lib.walk(declaration, {
28261
+ csstree.walk(declaration, {
28189
28262
  visit: "Identifier",
28190
28263
  enter: (node, item, list) => {
28191
28264
  let name = node.name;
@@ -28219,7 +28292,7 @@
28219
28292
  bottom: {}
28220
28293
  };
28221
28294
 
28222
- lib.walk(declaration, {
28295
+ csstree.walk(declaration, {
28223
28296
  enter: (node) => {
28224
28297
  switch (node.type) {
28225
28298
  case "Dimension": // margin: 1in 2in, margin: 20px, etc...
@@ -28266,7 +28339,7 @@
28266
28339
  bottom: {}
28267
28340
  };
28268
28341
 
28269
- lib.walk(declaration, {
28342
+ csstree.walk(declaration, {
28270
28343
  enter: (node) => {
28271
28344
  switch (node.type) {
28272
28345
  case "Dimension": // padding: 1in 2in, padding: 20px, etc...
@@ -28315,25 +28388,25 @@
28315
28388
  };
28316
28389
 
28317
28390
  if (declaration.prop == "border") {
28318
- border.top = lib.generate(declaration.value);
28319
- border.right = lib.generate(declaration.value);
28320
- border.bottom = lib.generate(declaration.value);
28321
- border.left = lib.generate(declaration.value);
28391
+ border.top = csstree.generate(declaration.value);
28392
+ border.right = csstree.generate(declaration.value);
28393
+ border.bottom = csstree.generate(declaration.value);
28394
+ border.left = csstree.generate(declaration.value);
28322
28395
 
28323
28396
  }
28324
28397
  else if (declaration.prop == "border-top") {
28325
- border.top = lib.generate(declaration.value);
28398
+ border.top = csstree.generate(declaration.value);
28326
28399
  }
28327
28400
  else if (declaration.prop == "border-right") {
28328
- border.right = lib.generate(declaration.value);
28401
+ border.right = csstree.generate(declaration.value);
28329
28402
 
28330
28403
  }
28331
28404
  else if (declaration.prop == "border-bottom") {
28332
- border.bottom = lib.generate(declaration.value);
28405
+ border.bottom = csstree.generate(declaration.value);
28333
28406
 
28334
28407
  }
28335
28408
  else if (declaration.prop == "border-left") {
28336
- border.left = lib.generate(declaration.value);
28409
+ border.left = csstree.generate(declaration.value);
28337
28410
  }
28338
28411
 
28339
28412
  return border;
@@ -28509,14 +28582,14 @@
28509
28582
 
28510
28583
  addMarginaliaStyles(page, list, item, sheet) {
28511
28584
  for (let loc in page.marginalia) {
28512
- let block = lib.clone(page.marginalia[loc]);
28585
+ let block = csstree.clone(page.marginalia[loc]);
28513
28586
  let hasContent = false;
28514
28587
 
28515
28588
  if (block.children.isEmpty()) {
28516
28589
  continue;
28517
28590
  }
28518
28591
 
28519
- lib.walk(block, {
28592
+ csstree.walk(block, {
28520
28593
  visit: "Declaration",
28521
28594
  enter: (node, item, list) => {
28522
28595
  if (node.property === "content") {
@@ -28528,7 +28601,7 @@
28528
28601
  list.remove(item);
28529
28602
  }
28530
28603
  if (node.property === "vertical-align") {
28531
- lib.walk(node, {
28604
+ csstree.walk(node, {
28532
28605
  visit: "Identifier",
28533
28606
  enter: (identNode, identItem, identlist) => {
28534
28607
  let name = identNode.name;
@@ -28551,7 +28624,7 @@
28551
28624
  loc === "bottom-left" ||
28552
28625
  loc === "bottom-center" ||
28553
28626
  loc === "bottom-right")) {
28554
- let c = lib.clone(node);
28627
+ let c = csstree.clone(node);
28555
28628
  c.property = "max-width";
28556
28629
  list.appendData(c);
28557
28630
  }
@@ -28563,7 +28636,7 @@
28563
28636
  loc === "right-top" ||
28564
28637
  loc === "right-middle" ||
28565
28638
  loc === "right-bottom")) {
28566
- let c = lib.clone(node);
28639
+ let c = csstree.clone(node);
28567
28640
  c.property = "max-height";
28568
28641
  list.appendData(c);
28569
28642
  }
@@ -28575,7 +28648,7 @@
28575
28648
 
28576
28649
  list.appendData(marginRule);
28577
28650
 
28578
- let sel = lib.generate({
28651
+ let sel = csstree.generate({
28579
28652
  type: "Selector",
28580
28653
  children: marginSelectors
28581
28654
  });
@@ -28594,8 +28667,8 @@
28594
28667
  let displayNone;
28595
28668
  // Just content
28596
28669
  for (let loc in page.marginalia) {
28597
- let content = lib.clone(page.marginalia[loc]);
28598
- lib.walk(content, {
28670
+ let content = csstree.clone(page.marginalia[loc]);
28671
+ csstree.walk(content, {
28599
28672
  visit: "Declaration",
28600
28673
  enter: (node, item, list) => {
28601
28674
  if (node.property !== "content") {
@@ -28670,7 +28743,7 @@
28670
28743
 
28671
28744
  addRootVars(ast, width, height, orientation, bleed, bleedrecto, bleedverso, marks) {
28672
28745
  let rules = [];
28673
- let selectors = new lib.List();
28746
+ let selectors = new csstree.List();
28674
28747
  selectors.insertData({
28675
28748
  type: "PseudoClassSelector",
28676
28749
  name: "root",
@@ -28821,16 +28894,16 @@
28821
28894
  */
28822
28895
  addRootPage(ast, size, bleed, bleedrecto, bleedverso) {
28823
28896
  let { width, height, orientation, format } = size;
28824
- let children = new lib.List();
28825
- let childrenLeft = new lib.List();
28826
- let childrenRight = new lib.List();
28827
- let dimensions = new lib.List();
28828
- let dimensionsLeft = new lib.List();
28829
- let dimensionsRight = new lib.List();
28897
+ let children = new csstree.List();
28898
+ let childrenLeft = new csstree.List();
28899
+ let childrenRight = new csstree.List();
28900
+ let dimensions = new csstree.List();
28901
+ let dimensionsLeft = new csstree.List();
28902
+ let dimensionsRight = new csstree.List();
28830
28903
 
28831
28904
  if (bleed) {
28832
- let widthCalculations = new lib.List();
28833
- let heightCalculations = new lib.List();
28905
+ let widthCalculations = new csstree.List();
28906
+ let heightCalculations = new csstree.List();
28834
28907
 
28835
28908
  // width
28836
28909
  widthCalculations.appendData({
@@ -29049,8 +29122,8 @@
29049
29122
  ast.children.append(rule);
29050
29123
 
29051
29124
  if (bleedverso) {
29052
- let widthCalculationsLeft = new lib.List();
29053
- let heightCalculationsLeft = new lib.List();
29125
+ let widthCalculationsLeft = new csstree.List();
29126
+ let heightCalculationsLeft = new csstree.List();
29054
29127
 
29055
29128
  // width
29056
29129
  widthCalculationsLeft.appendData({
@@ -29193,8 +29266,8 @@
29193
29266
  }
29194
29267
 
29195
29268
  if (bleedrecto) {
29196
- let widthCalculationsRight = new lib.List();
29197
- let heightCalculationsRight = new lib.List();
29269
+ let widthCalculationsRight = new csstree.List();
29270
+ let heightCalculationsRight = new csstree.List();
29198
29271
 
29199
29272
  // width
29200
29273
  widthCalculationsRight.appendData({
@@ -29675,7 +29748,7 @@
29675
29748
  let nthlist;
29676
29749
  let nth;
29677
29750
 
29678
- let selectors = new lib.List();
29751
+ let selectors = new csstree.List();
29679
29752
 
29680
29753
  selectors.insertData({
29681
29754
  type: "ClassSelector",
@@ -29712,7 +29785,7 @@
29712
29785
 
29713
29786
  // Nth
29714
29787
  if (page.nth) {
29715
- nthlist = new lib.List();
29788
+ nthlist = new csstree.List();
29716
29789
  nth = this.getNth(page.nth);
29717
29790
 
29718
29791
  nthlist.insertData(nth);
@@ -29744,7 +29817,7 @@
29744
29817
  }
29745
29818
 
29746
29819
  createDeclaration(property, value, important) {
29747
- let children = new lib.List();
29820
+ let children = new csstree.List();
29748
29821
 
29749
29822
  children.insertData({
29750
29823
  type: "Identifier",
@@ -29778,8 +29851,8 @@
29778
29851
  }
29779
29852
 
29780
29853
  createCalculatedDimension(property, items, important, operator = "+") {
29781
- let children = new lib.List();
29782
- let calculations = new lib.List();
29854
+ let children = new csstree.List();
29855
+ let calculations = new csstree.List();
29783
29856
 
29784
29857
  items.forEach((item, index) => {
29785
29858
  calculations.appendData({
@@ -29827,7 +29900,7 @@
29827
29900
  }
29828
29901
 
29829
29902
  createDimension(property, cssValue, important) {
29830
- let children = new lib.List();
29903
+ let children = new csstree.List();
29831
29904
 
29832
29905
  children.insertData({
29833
29906
  type: "Dimension",
@@ -29850,7 +29923,7 @@
29850
29923
  }
29851
29924
 
29852
29925
  createBlock(declarations) {
29853
- let block = new lib.List();
29926
+ let block = new csstree.List();
29854
29927
 
29855
29928
  declarations.forEach((declaration) => {
29856
29929
  block.insertData(declaration);
@@ -29864,7 +29937,7 @@
29864
29937
  }
29865
29938
 
29866
29939
  createRule(selectors, block) {
29867
- let selectorList = new lib.List();
29940
+ let selectorList = new csstree.List();
29868
29941
  selectorList.insertData({
29869
29942
  type: "Selector",
29870
29943
  children: selectors
@@ -29899,7 +29972,7 @@
29899
29972
  if (property === "page") {
29900
29973
  let children = declaration.value.children.first();
29901
29974
  let value = children.name;
29902
- let selector = lib.generate(rule.ruleNode.prelude);
29975
+ let selector = csstree.generate(rule.ruleNode.prelude);
29903
29976
  let name = value;
29904
29977
 
29905
29978
  let breaker = {
@@ -29927,7 +30000,7 @@
29927
30000
  ) {
29928
30001
  let child = declaration.value.children.first();
29929
30002
  let value = child.name;
29930
- let selector = lib.generate(rule.ruleNode.prelude);
30003
+ let selector = csstree.generate(rule.ruleNode.prelude);
29931
30004
 
29932
30005
  if (property === "page-break-before") {
29933
30006
  property = "break-before";
@@ -30105,7 +30178,7 @@
30105
30178
  return;
30106
30179
  }
30107
30180
 
30108
- lib.walk(node.prelude, {
30181
+ csstree.walk(node.prelude, {
30109
30182
  visit: "Identifier",
30110
30183
  enter: (identNode, iItem, iList) => {
30111
30184
  media.push(identNode.name);
@@ -30247,7 +30320,7 @@
30247
30320
  value = parseInt(number.data.value);
30248
30321
  }
30249
30322
 
30250
- let selector = lib.generate(rule.ruleNode.prelude);
30323
+ let selector = csstree.generate(rule.ruleNode.prelude);
30251
30324
 
30252
30325
  let counter;
30253
30326
  if (!(name in this.counters)) {
@@ -30277,7 +30350,6 @@
30277
30350
  }
30278
30351
 
30279
30352
  handleReset(declaration, rule) {
30280
- let resets = [];
30281
30353
  let children = declaration.value.children;
30282
30354
 
30283
30355
  children.forEach((data, item) => {
@@ -30287,9 +30359,20 @@
30287
30359
  if (item.next && item.next.data.type === "WhiteSpace") {
30288
30360
  whitespace = item.next;
30289
30361
  }
30290
- if (whitespace && whitespace.next && whitespace.next.data.type === "Number") {
30291
- number = whitespace.next;
30292
- value = parseInt(number.data.value);
30362
+ if (whitespace && whitespace.next) {
30363
+ if (whitespace.next.data.type === "Number") {
30364
+ // The counter reset value is specified using a number. E.g. counter-reset: c2 5;
30365
+ number = whitespace.next;
30366
+ value = parseInt(number.data.value);
30367
+ } else if (whitespace.next.data.type === "Function" && whitespace.next.data.name === "var") {
30368
+ // The counter reset value is specified using a CSS variable (custom property).
30369
+ // E.g. counter-reset: c2 var(--my-variable);
30370
+ // See https://developer.mozilla.org/en-US/docs/Web/CSS/var
30371
+ number = whitespace.next;
30372
+ // Use the variable name (e.g. '--my-variable') as value for now. The actual value is resolved later by the
30373
+ // processCounterResets function.
30374
+ value = whitespace.next.data.children.head.data.name;
30375
+ }
30293
30376
  }
30294
30377
 
30295
30378
  let counter;
@@ -30299,7 +30382,7 @@
30299
30382
  if (rule.ruleNode.type === "Atrule" && rule.ruleNode.name === "page") {
30300
30383
  selector = ".pagedjs_page";
30301
30384
  } else {
30302
- selector = lib.generate(prelude || rule.ruleNode);
30385
+ selector = csstree.generate(prelude || rule.ruleNode);
30303
30386
  }
30304
30387
 
30305
30388
  if (name === "footnote") {
@@ -30318,7 +30401,6 @@
30318
30401
  };
30319
30402
 
30320
30403
  counter.resets[selector] = reset;
30321
- resets.push(reset);
30322
30404
 
30323
30405
  if (selector !== ".pagedjs_page") {
30324
30406
  // Remove the parsed resets
@@ -30332,8 +30414,6 @@
30332
30414
  }
30333
30415
  }
30334
30416
  });
30335
-
30336
- return resets;
30337
30417
  }
30338
30418
 
30339
30419
  processCounters(parsed, counters) {
@@ -30389,7 +30469,19 @@
30389
30469
  let resetElements = parsed.querySelectorAll(reset.selector);
30390
30470
  // Add counter data
30391
30471
  for (var i = 0; i < resetElements.length; i++) {
30392
- resetElements[i].setAttribute("data-counter-"+ counter.name +"-reset", reset.number);
30472
+ let value = reset.number;
30473
+ if (typeof value === "string" && value.startsWith("--")) {
30474
+ // The value is specified using a CSS variable (custom property).
30475
+ // FIXME: We get the variable value only from the inline style of the element because at this point the
30476
+ // element is detached and thus using:
30477
+ //
30478
+ // getComputedStyle(resetElements[i]).getPropertyValue(value)
30479
+ //
30480
+ // always returns an empty string. We could try to temporarily attach the element to get its computed style,
30481
+ // but for now using the inline style is enough for us.
30482
+ value = resetElements[i].style.getPropertyValue(value) || 0;
30483
+ }
30484
+ resetElements[i].setAttribute("data-counter-"+ counter.name +"-reset", value);
30393
30485
  if (resetElements[i].getAttribute("data-counter-reset")) {
30394
30486
  resetElements[i].setAttribute("data-counter-reset", resetElements[i].getAttribute("data-counter-reset") + " " + counter.name);
30395
30487
  } else {
@@ -30451,7 +30543,7 @@
30451
30543
 
30452
30544
  addFootnoteMarkerCounter(list) {
30453
30545
  let markers = [];
30454
- lib.walk(list, {
30546
+ csstree.walk(list, {
30455
30547
  visit: "Identifier",
30456
30548
  enter: (identNode, iItem, iList) => {
30457
30549
  markers.push(identNode.name);
@@ -30488,22 +30580,40 @@
30488
30580
  if (!element || !incrementArray || incrementArray.length === 0) return;
30489
30581
 
30490
30582
  const ref = element.dataset.ref;
30491
- const prevIncrements = Array.from(this.styleSheet.cssRules).filter((rule) => {
30583
+ const increments = Array.from(this.styleSheet.cssRules).filter((rule) => {
30492
30584
  return rule.selectorText === `[data-ref="${element.dataset.ref}"]:not([data-split-from])`
30493
30585
  && rule.style[0] === "counter-increment";
30494
- });
30586
+ }).map(rule => rule.style.counterIncrement);
30587
+
30588
+ // Merge the current increments by summing the values because we generate both a decrement and an increment when the
30589
+ // element resets and increments the counter at the same time. E.g. ['c1 -7', 'c1 1'] should lead to 'c1 -6'.
30590
+ increments.push(this.mergeIncrements(incrementArray,
30591
+ (prev, next) => (parseInt(prev) || 0) + (parseInt(next) || 0)));
30592
+
30593
+ // Keep the last value for each counter when merging with the previous increments. E.g. ['c1 -7 c2 3', 'c1 1']
30594
+ // should lead to 'c1 1 c2 3'.
30595
+ const counterIncrement = this.mergeIncrements(increments, (prev, next) => next);
30596
+ this.insertRule(`[data-ref="${ref}"]:not([data-split-from]) { counter-increment: ${counterIncrement} }`);
30597
+ }
30495
30598
 
30496
- const increments = [];
30497
- for (let styleRule of prevIncrements) {
30498
- let values = styleRule.style.counterIncrement.split(" ");
30599
+ /**
30600
+ * Merge multiple values of a counter-increment CSS rule, using the specified operator.
30601
+ *
30602
+ * @param {Array} incrementArray the values to merge, e.g. ['c1 1', 'c1 -7 c2 1']
30603
+ * @param {Function} operator the function used to merge counter values (e.g. keep the last value of a counter or sum
30604
+ * the counter values)
30605
+ * @return {string} the merged value of the counter-increment CSS rule
30606
+ */
30607
+ mergeIncrements(incrementArray, operator) {
30608
+ const increments = {};
30609
+ incrementArray.forEach(increment => {
30610
+ let values = increment.split(" ");
30499
30611
  for (let i = 0; i < values.length; i+=2) {
30500
- increments.push(values[i] + " " + values[i+1]);
30612
+ increments[values[i]] = operator(increments[values[i]], values[i + 1]);
30501
30613
  }
30502
- }
30503
-
30504
- Array.prototype.push.apply(increments, incrementArray);
30614
+ });
30505
30615
 
30506
- this.insertRule(`[data-ref="${ref}"]:not([data-split-from]) { counter-increment: ${increments.join(" ")} }`);
30616
+ return Object.entries(increments).map(([key, value]) => `${key} ${value}`).join(" ");
30507
30617
  }
30508
30618
 
30509
30619
  afterPageLayout(pageElement, page) {
@@ -30582,7 +30692,7 @@
30582
30692
 
30583
30693
  onDeclaration(declaration, dItem, dList, rule) {
30584
30694
  if (declaration.property === "position" && declaration.value.children.first().name === "fixed") {
30585
- let selector = lib.generate(rule.ruleNode.prelude);
30695
+ let selector = csstree.generate(rule.ruleNode.prelude);
30586
30696
  this.fixedElementsSelector.push(selector);
30587
30697
  dList.remove(dItem);
30588
30698
  }
@@ -30654,7 +30764,7 @@
30654
30764
  if (rule.ruleNode.name === "page" && rule.ruleNode.type === "Atrule") {
30655
30765
  return;
30656
30766
  }
30657
- const selector = lib.generate(rule.ruleNode.prelude);
30767
+ const selector = csstree.generate(rule.ruleNode.prelude);
30658
30768
  return this.pageCounter.increments[selector] = {
30659
30769
  selector: selector,
30660
30770
  number
@@ -30675,10 +30785,10 @@
30675
30785
  }
30676
30786
 
30677
30787
  onRule(ruleNode, ruleItem, rulelist) {
30678
- let selector = lib.generate(ruleNode.prelude);
30788
+ let selector = csstree.generate(ruleNode.prelude);
30679
30789
  if (selector.match(/:(first|last|nth)-of-type/)) {
30680
30790
 
30681
- let declarations = lib.generate(ruleNode.block);
30791
+ let declarations = csstree.generate(ruleNode.block);
30682
30792
  declarations = declarations.replace(/[{}]/g,"");
30683
30793
 
30684
30794
  let uuid = "nth-of-type-" + UUID();
@@ -30730,10 +30840,10 @@
30730
30840
  }
30731
30841
 
30732
30842
  onRule(ruleNode, ruleItem, rulelist) {
30733
- let selector = lib.generate(ruleNode.prelude);
30843
+ let selector = csstree.generate(ruleNode.prelude);
30734
30844
  if (selector.match(/\+/)) {
30735
30845
 
30736
- let declarations = lib.generate(ruleNode.block);
30846
+ let declarations = csstree.generate(ruleNode.block);
30737
30847
  declarations = declarations.replace(/[{}]/g,"");
30738
30848
 
30739
30849
  let uuid = "following-" + UUID();
@@ -30790,7 +30900,7 @@
30790
30900
  let identifier = declaration.value.children && declaration.value.children.first();
30791
30901
  let location = identifier && identifier.name;
30792
30902
  if (location === "footnote") {
30793
- let selector = lib.generate(rule.ruleNode.prelude);
30903
+ let selector = csstree.generate(rule.ruleNode.prelude);
30794
30904
  this.footnotes[selector] = {
30795
30905
  selector: selector,
30796
30906
  policy: "auto",
@@ -30803,7 +30913,7 @@
30803
30913
  let identifier = declaration.value.children && declaration.value.children.first();
30804
30914
  let policy = identifier && identifier.name;
30805
30915
  if (policy) {
30806
- let selector = lib.generate(rule.ruleNode.prelude);
30916
+ let selector = csstree.generate(rule.ruleNode.prelude);
30807
30917
  let note = this.footnotes[selector];
30808
30918
  if (note) {
30809
30919
  note.policy = policy;
@@ -30813,7 +30923,7 @@
30813
30923
  if (property === "footnote-display") {
30814
30924
  let identifier = declaration.value.children && declaration.value.children.first();
30815
30925
  let display = identifier && identifier.name;
30816
- let selector = lib.generate(rule.ruleNode.prelude);
30926
+ let selector = csstree.generate(rule.ruleNode.prelude);
30817
30927
  if (display && this.footnotes[selector]) {
30818
30928
  let note = this.footnotes[selector];
30819
30929
  if (note) {
@@ -30828,7 +30938,7 @@
30828
30938
  if (name === "footnote-marker") {
30829
30939
  // switch ::footnote-marker to [data-footnote-marker]::before
30830
30940
  let prelude = rule.ruleNode.prelude;
30831
- let newPrelude = new lib.List();
30941
+ let newPrelude = new csstree.List();
30832
30942
 
30833
30943
  // Can't get remove to work, so just copying everything else
30834
30944
  prelude.children.first().children.each((node) => {
@@ -30865,7 +30975,7 @@
30865
30975
  // switch ::footnote-call to [data-footnote-call]::after
30866
30976
 
30867
30977
  let prelude = rule.ruleNode.prelude;
30868
- let newPrelude = new lib.List();
30978
+ let newPrelude = new csstree.List();
30869
30979
 
30870
30980
  // Can't get remove to work, so just copying everything else
30871
30981
  prelude.children.first().children.each((node) => {
@@ -31342,12 +31452,12 @@
31342
31452
 
31343
31453
  onDeclaration(declaration, dItem, dList, rule) {
31344
31454
  if (declaration.property === "position") {
31345
- let selector = lib.generate(rule.ruleNode.prelude);
31455
+ let selector = csstree.generate(rule.ruleNode.prelude);
31346
31456
  let identifier = declaration.value.children.first().name;
31347
31457
 
31348
31458
  if (identifier === "running") {
31349
31459
  let value;
31350
- lib.walk(declaration, {
31460
+ csstree.walk(declaration, {
31351
31461
  visit: "Function",
31352
31462
  enter: (node, item, list) => {
31353
31463
  value = node.children.first().name;
@@ -31364,13 +31474,13 @@
31364
31474
 
31365
31475
  if (declaration.property === "content") {
31366
31476
 
31367
- lib.walk(declaration, {
31477
+ csstree.walk(declaration, {
31368
31478
  visit: "Function",
31369
31479
  enter: (funcNode, fItem, fList) => {
31370
31480
 
31371
31481
  if (funcNode.name.indexOf("element") > -1) {
31372
31482
 
31373
- let selector = lib.generate(rule.ruleNode.prelude);
31483
+ let selector = csstree.generate(rule.ruleNode.prelude);
31374
31484
 
31375
31485
  let func = funcNode.name;
31376
31486
 
@@ -31585,7 +31695,7 @@
31585
31695
 
31586
31696
  onDeclaration(declaration, dItem, dList, rule) {
31587
31697
  if (declaration.property === "string-set") {
31588
- let selector = lib.generate(rule.ruleNode.prelude);
31698
+ let selector = csstree.generate(rule.ruleNode.prelude);
31589
31699
 
31590
31700
  let identifiers = [];
31591
31701
  let functions = [];
@@ -31625,7 +31735,7 @@
31625
31735
  let identifier = funcNode.children && funcNode.children.first().name;
31626
31736
  this.type = funcNode.children.last().name;
31627
31737
  funcNode.name = "var";
31628
- funcNode.children = new lib.List();
31738
+ funcNode.children = new csstree.List();
31629
31739
 
31630
31740
 
31631
31741
  if(this.type === "first" || this.type === "last" || this.type === "start" || this.type === "first-except"){
@@ -31753,12 +31863,12 @@
31753
31863
 
31754
31864
  onContent(funcNode, fItem, fList, declaration, rule) {
31755
31865
  if (funcNode.name === "target-counter") {
31756
- let selector = lib.generate(rule.ruleNode.prelude);
31866
+ let selector = csstree.generate(rule.ruleNode.prelude);
31757
31867
 
31758
31868
  let first = funcNode.children.first();
31759
31869
  let func = first.name;
31760
31870
 
31761
- let value = lib.generate(funcNode);
31871
+ let value = csstree.generate(funcNode);
31762
31872
 
31763
31873
  let args = [];
31764
31874
 
@@ -31778,7 +31888,7 @@
31778
31888
  if (!counter) {
31779
31889
  counter = child.name;
31780
31890
  } else if (!style) {
31781
- styleIdentifier = lib.clone(child);
31891
+ styleIdentifier = csstree.clone(child);
31782
31892
  style = child.name;
31783
31893
  }
31784
31894
  }
@@ -31801,7 +31911,7 @@
31801
31911
 
31802
31912
  // Replace with counter
31803
31913
  funcNode.name = "counter";
31804
- funcNode.children = new lib.List();
31914
+ funcNode.children = new csstree.List();
31805
31915
  funcNode.children.appendData({
31806
31916
  type: "Identifier",
31807
31917
  loc: 0,
@@ -31895,12 +32005,12 @@
31895
32005
 
31896
32006
  onContent(funcNode, fItem, fList, declaration, rule) {
31897
32007
  if (funcNode.name === "target-text") {
31898
- this.selector = lib.generate(rule.ruleNode.prelude);
32008
+ this.selector = csstree.generate(rule.ruleNode.prelude);
31899
32009
  let first = funcNode.children.first();
31900
32010
  let last = funcNode.children.last();
31901
32011
  let func = first.name;
31902
32012
 
31903
- let value = lib.generate(funcNode);
32013
+ let value = csstree.generate(funcNode);
31904
32014
 
31905
32015
  let args = [];
31906
32016
 
@@ -31931,7 +32041,7 @@
31931
32041
 
31932
32042
  // Replace with variable
31933
32043
  funcNode.name = "var";
31934
- funcNode.children = new lib.List();
32044
+ funcNode.children = new csstree.List();
31935
32045
  funcNode.children.appendData({
31936
32046
  type: "Identifier",
31937
32047
  loc: 0,
@@ -32113,120 +32223,120 @@
32113
32223
  */
32114
32224
 
32115
32225
  (function (exports) {
32116
- // The following regular expressions assume that selectors matching the preceding regular expressions have been removed
32117
- var attributeRegex = /(\[[^\]]+\])/g;
32118
- var idRegex = /(#[^\s\+>~\.\[:]+)/g;
32119
- var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
32120
- var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/g;
32121
- var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
32122
- var elementRegex = /([^\s\+>~\.\[:]+)/g;
32123
- var notRegex = /:not\(([^\)]*)\)/g;
32124
- var ruleRegex = /\{[^]*/gm;
32125
- var separatorRegex = /[\*\s\+>~]/g;
32126
- var straysRegex = /[#\.]/g;
32127
-
32128
- // Find matches for a regular expression in a string and push their details to parts
32129
- // Type is "a" for IDs, "b" for classes, attributes and pseudo-classes and "c" for elements and pseudo-elements
32130
- var findMatch = function(regex, type, types, selector) {
32131
- var matches = selector.match(regex);
32132
- if (matches) {
32133
- for (var i = 0; i < matches.length; i++) {
32134
- types[type]++;
32135
- // Replace this simple selector with whitespace so it won't be counted in further simple selectors
32136
- selector = selector.replace(matches[i], ' ');
32137
- }
32138
- }
32139
-
32140
- return selector;
32141
- };
32142
-
32143
- // Calculate the specificity for a selector by dividing it into simple selectors and counting them
32144
- var calculate = function(selector) {
32145
- var commaIndex = selector.indexOf(',');
32146
- if (commaIndex !== -1) {
32147
- selector = selector.substring(0, commaIndex);
32148
- }
32149
-
32150
- var types = {
32151
- a: 0,
32152
- b: 0,
32153
- c: 0
32154
- };
32226
+ // The following regular expressions assume that selectors matching the preceding regular expressions have been removed
32227
+ var attributeRegex = /(\[[^\]]+\])/g;
32228
+ var idRegex = /(#[^\s\+>~\.\[:]+)/g;
32229
+ var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
32230
+ var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/g;
32231
+ var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
32232
+ var elementRegex = /([^\s\+>~\.\[:]+)/g;
32233
+ var notRegex = /:not\(([^\)]*)\)/g;
32234
+ var ruleRegex = /\{[^]*/gm;
32235
+ var separatorRegex = /[\*\s\+>~]/g;
32236
+ var straysRegex = /[#\.]/g;
32237
+
32238
+ // Find matches for a regular expression in a string and push their details to parts
32239
+ // Type is "a" for IDs, "b" for classes, attributes and pseudo-classes and "c" for elements and pseudo-elements
32240
+ var findMatch = function(regex, type, types, selector) {
32241
+ var matches = selector.match(regex);
32242
+ if (matches) {
32243
+ for (var i = 0; i < matches.length; i++) {
32244
+ types[type]++;
32245
+ // Replace this simple selector with whitespace so it won't be counted in further simple selectors
32246
+ selector = selector.replace(matches[i], ' ');
32247
+ }
32248
+ }
32249
+
32250
+ return selector;
32251
+ };
32155
32252
 
32156
- // Remove the negation psuedo-class (:not) but leave its argument because specificity is calculated on its argument
32157
- selector = selector.replace(notRegex, ' $1 ');
32253
+ // Calculate the specificity for a selector by dividing it into simple selectors and counting them
32254
+ var calculate = function(selector) {
32255
+ var commaIndex = selector.indexOf(',');
32256
+ if (commaIndex !== -1) {
32257
+ selector = selector.substring(0, commaIndex);
32258
+ }
32158
32259
 
32159
- // Remove anything after a left brace in case a user has pasted in a rule, not just a selector
32160
- selector = selector.replace(ruleRegex, ' ');
32260
+ var types = {
32261
+ a: 0,
32262
+ b: 0,
32263
+ c: 0
32264
+ };
32161
32265
 
32162
- // Add attribute selectors to parts collection (type b)
32163
- selector = findMatch(attributeRegex, 'b', types, selector);
32266
+ // Remove the negation psuedo-class (:not) but leave its argument because specificity is calculated on its argument
32267
+ selector = selector.replace(notRegex, ' $1 ');
32164
32268
 
32165
- // Add ID selectors to parts collection (type a)
32166
- selector = findMatch(idRegex, 'a', types, selector);
32269
+ // Remove anything after a left brace in case a user has pasted in a rule, not just a selector
32270
+ selector = selector.replace(ruleRegex, ' ');
32167
32271
 
32168
- // Add class selectors to parts collection (type b)
32169
- selector = findMatch(classRegex, 'b', types, selector);
32272
+ // Add attribute selectors to parts collection (type b)
32273
+ selector = findMatch(attributeRegex, 'b', types, selector);
32170
32274
 
32171
- // Add pseudo-element selectors to parts collection (type c)
32172
- selector = findMatch(pseudoElementRegex, 'c', types, selector);
32275
+ // Add ID selectors to parts collection (type a)
32276
+ selector = findMatch(idRegex, 'a', types, selector);
32173
32277
 
32174
- // Add pseudo-class selectors to parts collection (type b)
32175
- selector = findMatch(pseudoClassRegex, 'b', types, selector);
32278
+ // Add class selectors to parts collection (type b)
32279
+ selector = findMatch(classRegex, 'b', types, selector);
32176
32280
 
32177
- // Remove universal selector and separator characters
32178
- selector = selector.replace(separatorRegex, ' ');
32281
+ // Add pseudo-element selectors to parts collection (type c)
32282
+ selector = findMatch(pseudoElementRegex, 'c', types, selector);
32179
32283
 
32180
- // Remove any stray dots or hashes which aren't attached to words
32181
- // These may be present if the user is live-editing this selector
32182
- selector = selector.replace(straysRegex, ' ');
32284
+ // Add pseudo-class selectors to parts collection (type b)
32285
+ selector = findMatch(pseudoClassRegex, 'b', types, selector);
32183
32286
 
32184
- // The only things left should be element selectors (type c)
32185
- findMatch(elementRegex, 'c', types, selector);
32287
+ // Remove universal selector and separator characters
32288
+ selector = selector.replace(separatorRegex, ' ');
32186
32289
 
32187
- return (types.a * 100) + (types.b * 10) + (types.c * 1);
32188
- };
32290
+ // Remove any stray dots or hashes which aren't attached to words
32291
+ // These may be present if the user is live-editing this selector
32292
+ selector = selector.replace(straysRegex, ' ');
32189
32293
 
32190
- var specificityCache = {};
32294
+ // The only things left should be element selectors (type c)
32295
+ findMatch(elementRegex, 'c', types, selector);
32191
32296
 
32192
- exports.calculateSpecificity = function(selector) {
32193
- var specificity = specificityCache[selector];
32194
- if (specificity === undefined) {
32195
- specificity = calculate(selector);
32196
- specificityCache[selector] = specificity;
32197
- }
32198
- return specificity;
32199
- };
32297
+ return (types.a * 100) + (types.b * 10) + (types.c * 1);
32298
+ };
32200
32299
 
32201
- var validSelectorCache = {};
32202
- var testSelectorElement = null;
32300
+ var specificityCache = {};
32203
32301
 
32204
- exports.isSelectorValid = function(selector) {
32205
- var valid = validSelectorCache[selector];
32206
- if (valid === undefined) {
32207
- if (testSelectorElement == null) {
32208
- testSelectorElement = document.createElement('div');
32209
- }
32302
+ exports.calculateSpecificity = function(selector) {
32303
+ var specificity = specificityCache[selector];
32304
+ if (specificity === undefined) {
32305
+ specificity = calculate(selector);
32306
+ specificityCache[selector] = specificity;
32307
+ }
32308
+ return specificity;
32309
+ };
32210
32310
 
32211
- try {
32212
- testSelectorElement.querySelector(selector);
32213
- valid = true;
32214
- } catch (error) {
32215
- valid = false;
32216
- }
32217
- validSelectorCache[selector] = valid;
32218
- }
32219
- return valid;
32220
- };
32311
+ var validSelectorCache = {};
32312
+ var testSelectorElement = null;
32313
+
32314
+ exports.isSelectorValid = function(selector) {
32315
+ var valid = validSelectorCache[selector];
32316
+ if (valid === undefined) {
32317
+ if (testSelectorElement == null) {
32318
+ testSelectorElement = document.createElement('div');
32319
+ }
32320
+
32321
+ try {
32322
+ testSelectorElement.querySelector(selector);
32323
+ valid = true;
32324
+ } catch (error) {
32325
+ valid = false;
32326
+ }
32327
+ validSelectorCache[selector] = valid;
32328
+ }
32329
+ return valid;
32330
+ };
32221
32331
 
32222
- exports.validateSelector = function(selector) {
32223
- if (!exports.isSelectorValid(selector)) {
32224
- var error = new SyntaxError(selector + ' is not a valid selector');
32225
- error.code = 'EBADSELECTOR';
32226
- throw error;
32227
- }
32228
- };
32229
- }(clearCut));
32332
+ exports.validateSelector = function(selector) {
32333
+ if (!exports.isSelectorValid(selector)) {
32334
+ var error = new SyntaxError(selector + ' is not a valid selector');
32335
+ error.code = 'EBADSELECTOR';
32336
+ throw error;
32337
+ }
32338
+ };
32339
+ } (clearCut));
32230
32340
 
32231
32341
  class UndisplayedFilter extends Handler {
32232
32342
  constructor(chunker, polisher, caller) {
@@ -32236,7 +32346,7 @@
32236
32346
 
32237
32347
  onDeclaration(declaration, dItem, dList, rule) {
32238
32348
  if (declaration.property === "display") {
32239
- let selector = lib.generate(rule.ruleNode.prelude);
32349
+ let selector = csstree.generate(rule.ruleNode.prelude);
32240
32350
  let value = declaration.value.children.first().name;
32241
32351
 
32242
32352
  selector.split(",").forEach((s) => {
@@ -32343,170 +32453,233 @@
32343
32453
  return Boolean(result && (result !== arr) && (result[1] === "dwa"));
32344
32454
  };
32345
32455
 
32346
- var validTypes = { object: true, symbol: true };
32456
+ var isImplemented$2;
32457
+ var hasRequiredIsImplemented;
32347
32458
 
32348
- var isImplemented$2 = function () {
32349
- var symbol;
32350
- if (typeof Symbol !== 'function') return false;
32351
- symbol = Symbol('test symbol');
32352
- try { String(symbol); } catch (e) { return false; }
32459
+ function requireIsImplemented () {
32460
+ if (hasRequiredIsImplemented) return isImplemented$2;
32461
+ hasRequiredIsImplemented = 1;
32353
32462
 
32354
- // Return 'true' also for polyfills
32355
- if (!validTypes[typeof Symbol.iterator]) return false;
32356
- if (!validTypes[typeof Symbol.toPrimitive]) return false;
32357
- if (!validTypes[typeof Symbol.toStringTag]) return false;
32463
+ var validTypes = { object: true, symbol: true };
32358
32464
 
32359
- return true;
32360
- };
32465
+ isImplemented$2 = function () {
32466
+ var symbol;
32467
+ if (typeof Symbol !== 'function') return false;
32468
+ symbol = Symbol('test symbol');
32469
+ try { String(symbol); } catch (e) { return false; }
32361
32470
 
32362
- var isSymbol$1 = function (x) {
32363
- if (!x) return false;
32364
- if (typeof x === 'symbol') return true;
32365
- if (!x.constructor) return false;
32366
- if (x.constructor.name !== 'Symbol') return false;
32367
- return (x[x.constructor.toStringTag] === 'Symbol');
32368
- };
32471
+ // Return 'true' also for polyfills
32472
+ if (!validTypes[typeof Symbol.iterator]) return false;
32473
+ if (!validTypes[typeof Symbol.toPrimitive]) return false;
32474
+ if (!validTypes[typeof Symbol.toStringTag]) return false;
32475
+
32476
+ return true;
32477
+ };
32478
+ return isImplemented$2;
32479
+ }
32369
32480
 
32370
- var isSymbol = isSymbol$1;
32481
+ var isSymbol;
32482
+ var hasRequiredIsSymbol;
32371
32483
 
32372
- var validateSymbol$1 = function (value) {
32373
- if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
32374
- return value;
32375
- };
32484
+ function requireIsSymbol () {
32485
+ if (hasRequiredIsSymbol) return isSymbol;
32486
+ hasRequiredIsSymbol = 1;
32376
32487
 
32377
- var d$1 = d$3.exports
32378
- , validateSymbol = validateSymbol$1
32379
-
32380
- , create = Object.create, defineProperties = Object.defineProperties
32381
- , defineProperty$2 = Object.defineProperty, objPrototype = Object.prototype
32382
- , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null)
32383
- , isNativeSafe;
32384
-
32385
- if (typeof Symbol === 'function') {
32386
- NativeSymbol = Symbol;
32387
- try {
32388
- String(NativeSymbol());
32389
- isNativeSafe = true;
32390
- } catch (ignore) {}
32391
- }
32392
-
32393
- var generateName = (function () {
32394
- var created = create(null);
32395
- return function (desc) {
32396
- var postfix = 0, name, ie11BugWorkaround;
32397
- while (created[desc + (postfix || '')]) ++postfix;
32398
- desc += (postfix || '');
32399
- created[desc] = true;
32400
- name = '@@' + desc;
32401
- defineProperty$2(objPrototype, name, d$1.gs(null, function (value) {
32402
- // For IE11 issue see:
32403
- // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
32404
- // ie11-broken-getters-on-dom-objects
32405
- // https://github.com/medikoo/es6-symbol/issues/12
32406
- if (ie11BugWorkaround) return;
32407
- ie11BugWorkaround = true;
32408
- defineProperty$2(this, name, d$1(value));
32409
- ie11BugWorkaround = false;
32410
- }));
32411
- return name;
32488
+ isSymbol = function (x) {
32489
+ if (!x) return false;
32490
+ if (typeof x === 'symbol') return true;
32491
+ if (!x.constructor) return false;
32492
+ if (x.constructor.name !== 'Symbol') return false;
32493
+ return (x[x.constructor.toStringTag] === 'Symbol');
32494
+ };
32495
+ return isSymbol;
32496
+ }
32497
+
32498
+ var validateSymbol;
32499
+ var hasRequiredValidateSymbol;
32500
+
32501
+ function requireValidateSymbol () {
32502
+ if (hasRequiredValidateSymbol) return validateSymbol;
32503
+ hasRequiredValidateSymbol = 1;
32504
+
32505
+ var isSymbol = requireIsSymbol();
32506
+
32507
+ validateSymbol = function (value) {
32508
+ if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
32509
+ return value;
32510
+ };
32511
+ return validateSymbol;
32512
+ }
32513
+
32514
+ var polyfill;
32515
+ var hasRequiredPolyfill;
32516
+
32517
+ function requirePolyfill () {
32518
+ if (hasRequiredPolyfill) return polyfill;
32519
+ hasRequiredPolyfill = 1;
32520
+
32521
+ var d = dExports
32522
+ , validateSymbol = requireValidateSymbol()
32523
+
32524
+ , create = Object.create, defineProperties = Object.defineProperties
32525
+ , defineProperty = Object.defineProperty, objPrototype = Object.prototype
32526
+ , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null)
32527
+ , isNativeSafe;
32528
+
32529
+ if (typeof Symbol === 'function') {
32530
+ NativeSymbol = Symbol;
32531
+ try {
32532
+ String(NativeSymbol());
32533
+ isNativeSafe = true;
32534
+ } catch (ignore) {}
32535
+ }
32536
+
32537
+ var generateName = (function () {
32538
+ var created = create(null);
32539
+ return function (desc) {
32540
+ var postfix = 0, name, ie11BugWorkaround;
32541
+ while (created[desc + (postfix || '')]) ++postfix;
32542
+ desc += (postfix || '');
32543
+ created[desc] = true;
32544
+ name = '@@' + desc;
32545
+ defineProperty(objPrototype, name, d.gs(null, function (value) {
32546
+ // For IE11 issue see:
32547
+ // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
32548
+ // ie11-broken-getters-on-dom-objects
32549
+ // https://github.com/medikoo/es6-symbol/issues/12
32550
+ if (ie11BugWorkaround) return;
32551
+ ie11BugWorkaround = true;
32552
+ defineProperty(this, name, d(value));
32553
+ ie11BugWorkaround = false;
32554
+ }));
32555
+ return name;
32556
+ };
32557
+ }());
32558
+
32559
+ // Internal constructor (not one exposed) for creating Symbol instances.
32560
+ // This one is used to ensure that `someSymbol instanceof Symbol` always return false
32561
+ HiddenSymbol = function Symbol(description) {
32562
+ if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
32563
+ return SymbolPolyfill(description);
32412
32564
  };
32413
- }());
32414
-
32415
- // Internal constructor (not one exposed) for creating Symbol instances.
32416
- // This one is used to ensure that `someSymbol instanceof Symbol` always return false
32417
- HiddenSymbol = function Symbol(description) {
32418
- if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
32419
- return SymbolPolyfill(description);
32420
- };
32421
-
32422
- // Exposed `Symbol` constructor
32423
- // (returns instances of HiddenSymbol)
32424
- var polyfill = SymbolPolyfill = function Symbol(description) {
32425
- var symbol;
32426
- if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
32427
- if (isNativeSafe) return NativeSymbol(description);
32428
- symbol = create(HiddenSymbol.prototype);
32429
- description = (description === undefined ? '' : String(description));
32430
- return defineProperties(symbol, {
32431
- __description__: d$1('', description),
32432
- __name__: d$1('', generateName(description))
32565
+
32566
+ // Exposed `Symbol` constructor
32567
+ // (returns instances of HiddenSymbol)
32568
+ polyfill = SymbolPolyfill = function Symbol(description) {
32569
+ var symbol;
32570
+ if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
32571
+ if (isNativeSafe) return NativeSymbol(description);
32572
+ symbol = create(HiddenSymbol.prototype);
32573
+ description = (description === undefined ? '' : String(description));
32574
+ return defineProperties(symbol, {
32575
+ __description__: d('', description),
32576
+ __name__: d('', generateName(description))
32577
+ });
32578
+ };
32579
+ defineProperties(SymbolPolyfill, {
32580
+ for: d(function (key) {
32581
+ if (globalSymbols[key]) return globalSymbols[key];
32582
+ return (globalSymbols[key] = SymbolPolyfill(String(key)));
32583
+ }),
32584
+ keyFor: d(function (s) {
32585
+ var key;
32586
+ validateSymbol(s);
32587
+ for (key in globalSymbols) if (globalSymbols[key] === s) return key;
32588
+ }),
32589
+
32590
+ // To ensure proper interoperability with other native functions (e.g. Array.from)
32591
+ // fallback to eventual native implementation of given symbol
32592
+ hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
32593
+ isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
32594
+ SymbolPolyfill('isConcatSpreadable')),
32595
+ iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
32596
+ match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
32597
+ replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
32598
+ search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
32599
+ species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
32600
+ split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
32601
+ toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
32602
+ toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
32603
+ unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
32433
32604
  });
32434
- };
32435
- defineProperties(SymbolPolyfill, {
32436
- for: d$1(function (key) {
32437
- if (globalSymbols[key]) return globalSymbols[key];
32438
- return (globalSymbols[key] = SymbolPolyfill(String(key)));
32439
- }),
32440
- keyFor: d$1(function (s) {
32441
- var key;
32442
- validateSymbol(s);
32443
- for (key in globalSymbols) if (globalSymbols[key] === s) return key;
32444
- }),
32445
-
32446
- // To ensure proper interoperability with other native functions (e.g. Array.from)
32447
- // fallback to eventual native implementation of given symbol
32448
- hasInstance: d$1('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
32449
- isConcatSpreadable: d$1('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
32450
- SymbolPolyfill('isConcatSpreadable')),
32451
- iterator: d$1('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
32452
- match: d$1('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
32453
- replace: d$1('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
32454
- search: d$1('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
32455
- species: d$1('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
32456
- split: d$1('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
32457
- toPrimitive: d$1('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
32458
- toStringTag: d$1('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
32459
- unscopables: d$1('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
32460
- });
32461
32605
 
32462
- // Internal tweaks for real symbol producer
32463
- defineProperties(HiddenSymbol.prototype, {
32464
- constructor: d$1(SymbolPolyfill),
32465
- toString: d$1('', function () { return this.__name__; })
32466
- });
32606
+ // Internal tweaks for real symbol producer
32607
+ defineProperties(HiddenSymbol.prototype, {
32608
+ constructor: d(SymbolPolyfill),
32609
+ toString: d('', function () { return this.__name__; })
32610
+ });
32467
32611
 
32468
- // Proper implementation of methods exposed on Symbol.prototype
32469
- // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
32470
- defineProperties(SymbolPolyfill.prototype, {
32471
- toString: d$1(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
32472
- valueOf: d$1(function () { return validateSymbol(this); })
32473
- });
32474
- defineProperty$2(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d$1('', function () {
32475
- var symbol = validateSymbol(this);
32476
- if (typeof symbol === 'symbol') return symbol;
32477
- return symbol.toString();
32478
- }));
32479
- defineProperty$2(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d$1('c', 'Symbol'));
32480
-
32481
- // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
32482
- defineProperty$2(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
32483
- d$1('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
32484
-
32485
- // Note: It's important to define `toPrimitive` as last one, as some implementations
32486
- // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
32487
- // And that may invoke error in definition flow:
32488
- // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
32489
- defineProperty$2(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
32490
- d$1('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
32491
-
32492
- var es6Symbol = isImplemented$2() ? Symbol : polyfill;
32493
-
32494
- var objToString$2 = Object.prototype.toString
32495
- , id$2 = objToString$2.call(
32496
- (function () {
32497
- return arguments;
32498
- })()
32499
- );
32612
+ // Proper implementation of methods exposed on Symbol.prototype
32613
+ // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
32614
+ defineProperties(SymbolPolyfill.prototype, {
32615
+ toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
32616
+ valueOf: d(function () { return validateSymbol(this); })
32617
+ });
32618
+ defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () {
32619
+ var symbol = validateSymbol(this);
32620
+ if (typeof symbol === 'symbol') return symbol;
32621
+ return symbol.toString();
32622
+ }));
32623
+ defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));
32500
32624
 
32501
- var isArguments$1 = function (value) {
32502
- return objToString$2.call(value) === id$2;
32503
- };
32625
+ // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
32626
+ defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
32627
+ d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
32504
32628
 
32505
- var objToString$1 = Object.prototype.toString, id$1 = objToString$1.call(noop$4);
32629
+ // Note: It's important to define `toPrimitive` as last one, as some implementations
32630
+ // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
32631
+ // And that may invoke error in definition flow:
32632
+ // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
32633
+ defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
32634
+ d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
32635
+ return polyfill;
32636
+ }
32506
32637
 
32507
- var isFunction$1 = function (value) {
32508
- return typeof value === "function" && objToString$1.call(value) === id$1;
32509
- };
32638
+ var es6Symbol;
32639
+ var hasRequiredEs6Symbol;
32640
+
32641
+ function requireEs6Symbol () {
32642
+ if (hasRequiredEs6Symbol) return es6Symbol;
32643
+ hasRequiredEs6Symbol = 1;
32644
+
32645
+ es6Symbol = requireIsImplemented()() ? Symbol : requirePolyfill();
32646
+ return es6Symbol;
32647
+ }
32648
+
32649
+ var isArguments;
32650
+ var hasRequiredIsArguments;
32651
+
32652
+ function requireIsArguments () {
32653
+ if (hasRequiredIsArguments) return isArguments;
32654
+ hasRequiredIsArguments = 1;
32655
+
32656
+ var objToString = Object.prototype.toString
32657
+ , id = objToString.call(
32658
+ (function () {
32659
+ return arguments;
32660
+ })()
32661
+ );
32662
+
32663
+ isArguments = function (value) {
32664
+ return objToString.call(value) === id;
32665
+ };
32666
+ return isArguments;
32667
+ }
32668
+
32669
+ var isFunction;
32670
+ var hasRequiredIsFunction;
32671
+
32672
+ function requireIsFunction () {
32673
+ if (hasRequiredIsFunction) return isFunction;
32674
+ hasRequiredIsFunction = 1;
32675
+
32676
+ var objToString = Object.prototype.toString, id = objToString.call(noop$4);
32677
+
32678
+ isFunction = function (value) {
32679
+ return typeof value === "function" && objToString.call(value) === id;
32680
+ };
32681
+ return isFunction;
32682
+ }
32510
32683
 
32511
32684
  var isImplemented$1 = function () {
32512
32685
  var sign = Math.sign;
@@ -32514,15 +32687,24 @@
32514
32687
  return (sign(10) === 1) && (sign(-20) === -1);
32515
32688
  };
32516
32689
 
32517
- var shim$2 = function (value) {
32518
- value = Number(value);
32519
- if (isNaN(value) || (value === 0)) return value;
32520
- return value > 0 ? 1 : -1;
32521
- };
32690
+ var shim$2;
32691
+ var hasRequiredShim$2;
32692
+
32693
+ function requireShim$2 () {
32694
+ if (hasRequiredShim$2) return shim$2;
32695
+ hasRequiredShim$2 = 1;
32696
+
32697
+ shim$2 = function (value) {
32698
+ value = Number(value);
32699
+ if (isNaN(value) || (value === 0)) return value;
32700
+ return value > 0 ? 1 : -1;
32701
+ };
32702
+ return shim$2;
32703
+ }
32522
32704
 
32523
32705
  var sign$1 = isImplemented$1()
32524
32706
  ? Math.sign
32525
- : shim$2;
32707
+ : requireShim$2();
32526
32708
 
32527
32709
  var sign = sign$1
32528
32710
 
@@ -32543,139 +32725,157 @@
32543
32725
  return max(0, toInteger(value));
32544
32726
  };
32545
32727
 
32546
- var objToString = Object.prototype.toString, id = objToString.call("");
32728
+ var isString;
32729
+ var hasRequiredIsString;
32547
32730
 
32548
- var isString$1 = function (value) {
32549
- return (
32550
- typeof value === "string" ||
32551
- (value &&
32552
- typeof value === "object" &&
32553
- (value instanceof String || objToString.call(value) === id)) ||
32554
- false
32555
- );
32556
- };
32731
+ function requireIsString () {
32732
+ if (hasRequiredIsString) return isString;
32733
+ hasRequiredIsString = 1;
32557
32734
 
32558
- var iteratorSymbol = es6Symbol.iterator
32559
- , isArguments = isArguments$1
32560
- , isFunction = isFunction$1
32561
- , toPosInt$1 = toPosInteger
32562
- , callable = validCallable
32563
- , validValue = validValue$1
32564
- , isValue$1 = isValue$5
32565
- , isString = isString$1
32566
- , isArray = Array.isArray
32567
- , call = Function.prototype.call
32568
- , desc = { configurable: true, enumerable: true, writable: true, value: null }
32569
- , defineProperty$1 = Object.defineProperty;
32570
-
32571
- // eslint-disable-next-line complexity
32572
- var shim$1 = function (arrayLike /*, mapFn, thisArg*/) {
32573
- var mapFn = arguments[1]
32574
- , thisArg = arguments[2]
32575
- , Context
32576
- , i
32577
- , j
32578
- , arr
32579
- , length
32580
- , code
32581
- , iterator
32582
- , result
32583
- , getIterator
32584
- , value;
32585
-
32586
- arrayLike = Object(validValue(arrayLike));
32587
-
32588
- if (isValue$1(mapFn)) callable(mapFn);
32589
- if (!this || this === Array || !isFunction(this)) {
32590
- // Result: Plain array
32591
- if (!mapFn) {
32592
- if (isArguments(arrayLike)) {
32593
- // Source: Arguments
32594
- length = arrayLike.length;
32595
- if (length !== 1) return Array.apply(null, arrayLike);
32596
- arr = new Array(1);
32597
- arr[0] = arrayLike[0];
32598
- return arr;
32599
- }
32600
- if (isArray(arrayLike)) {
32601
- // Source: Array
32602
- arr = new Array(length = arrayLike.length);
32603
- for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
32604
- return arr;
32735
+ var objToString = Object.prototype.toString, id = objToString.call("");
32736
+
32737
+ isString = function (value) {
32738
+ return (
32739
+ typeof value === "string" ||
32740
+ (value &&
32741
+ typeof value === "object" &&
32742
+ (value instanceof String || objToString.call(value) === id)) ||
32743
+ false
32744
+ );
32745
+ };
32746
+ return isString;
32747
+ }
32748
+
32749
+ var shim$1;
32750
+ var hasRequiredShim$1;
32751
+
32752
+ function requireShim$1 () {
32753
+ if (hasRequiredShim$1) return shim$1;
32754
+ hasRequiredShim$1 = 1;
32755
+
32756
+ var iteratorSymbol = requireEs6Symbol().iterator
32757
+ , isArguments = requireIsArguments()
32758
+ , isFunction = requireIsFunction()
32759
+ , toPosInt = toPosInteger
32760
+ , callable = validCallable
32761
+ , validValue$1 = validValue
32762
+ , isValue = isValue$3
32763
+ , isString = requireIsString()
32764
+ , isArray = Array.isArray
32765
+ , call = Function.prototype.call
32766
+ , desc = { configurable: true, enumerable: true, writable: true, value: null }
32767
+ , defineProperty = Object.defineProperty;
32768
+
32769
+ // eslint-disable-next-line complexity
32770
+ shim$1 = function (arrayLike /*, mapFn, thisArg*/) {
32771
+ var mapFn = arguments[1]
32772
+ , thisArg = arguments[2]
32773
+ , Context
32774
+ , i
32775
+ , j
32776
+ , arr
32777
+ , length
32778
+ , code
32779
+ , iterator
32780
+ , result
32781
+ , getIterator
32782
+ , value;
32783
+
32784
+ arrayLike = Object(validValue$1(arrayLike));
32785
+
32786
+ if (isValue(mapFn)) callable(mapFn);
32787
+ if (!this || this === Array || !isFunction(this)) {
32788
+ // Result: Plain array
32789
+ if (!mapFn) {
32790
+ if (isArguments(arrayLike)) {
32791
+ // Source: Arguments
32792
+ length = arrayLike.length;
32793
+ if (length !== 1) return Array.apply(null, arrayLike);
32794
+ arr = new Array(1);
32795
+ arr[0] = arrayLike[0];
32796
+ return arr;
32797
+ }
32798
+ if (isArray(arrayLike)) {
32799
+ // Source: Array
32800
+ arr = new Array(length = arrayLike.length);
32801
+ for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
32802
+ return arr;
32803
+ }
32605
32804
  }
32805
+ arr = [];
32806
+ } else {
32807
+ // Result: Non plain array
32808
+ Context = this;
32606
32809
  }
32607
- arr = [];
32608
- } else {
32609
- // Result: Non plain array
32610
- Context = this;
32611
- }
32612
-
32613
- if (!isArray(arrayLike)) {
32614
- if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
32615
- // Source: Iterator
32616
- iterator = callable(getIterator).call(arrayLike);
32617
- if (Context) arr = new Context();
32618
- result = iterator.next();
32619
- i = 0;
32620
- while (!result.done) {
32621
- value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
32622
- if (Context) {
32623
- desc.value = value;
32624
- defineProperty$1(arr, i, desc);
32625
- } else {
32626
- arr[i] = value;
32627
- }
32810
+
32811
+ if (!isArray(arrayLike)) {
32812
+ if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
32813
+ // Source: Iterator
32814
+ iterator = callable(getIterator).call(arrayLike);
32815
+ if (Context) arr = new Context();
32628
32816
  result = iterator.next();
32629
- ++i;
32630
- }
32631
- length = i;
32632
- } else if (isString(arrayLike)) {
32633
- // Source: String
32634
- length = arrayLike.length;
32635
- if (Context) arr = new Context();
32636
- for (i = 0, j = 0; i < length; ++i) {
32637
- value = arrayLike[i];
32638
- if (i + 1 < length) {
32639
- code = value.charCodeAt(0);
32640
- // eslint-disable-next-line max-depth
32641
- if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
32817
+ i = 0;
32818
+ while (!result.done) {
32819
+ value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
32820
+ if (Context) {
32821
+ desc.value = value;
32822
+ defineProperty(arr, i, desc);
32823
+ } else {
32824
+ arr[i] = value;
32825
+ }
32826
+ result = iterator.next();
32827
+ ++i;
32642
32828
  }
32643
- value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
32829
+ length = i;
32830
+ } else if (isString(arrayLike)) {
32831
+ // Source: String
32832
+ length = arrayLike.length;
32833
+ if (Context) arr = new Context();
32834
+ for (i = 0, j = 0; i < length; ++i) {
32835
+ value = arrayLike[i];
32836
+ if (i + 1 < length) {
32837
+ code = value.charCodeAt(0);
32838
+ // eslint-disable-next-line max-depth
32839
+ if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
32840
+ }
32841
+ value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
32842
+ if (Context) {
32843
+ desc.value = value;
32844
+ defineProperty(arr, j, desc);
32845
+ } else {
32846
+ arr[j] = value;
32847
+ }
32848
+ ++j;
32849
+ }
32850
+ length = j;
32851
+ }
32852
+ }
32853
+ if (length === undefined) {
32854
+ // Source: array or array-like
32855
+ length = toPosInt(arrayLike.length);
32856
+ if (Context) arr = new Context(length);
32857
+ for (i = 0; i < length; ++i) {
32858
+ value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
32644
32859
  if (Context) {
32645
32860
  desc.value = value;
32646
- defineProperty$1(arr, j, desc);
32861
+ defineProperty(arr, i, desc);
32647
32862
  } else {
32648
- arr[j] = value;
32863
+ arr[i] = value;
32649
32864
  }
32650
- ++j;
32651
- }
32652
- length = j;
32653
- }
32654
- }
32655
- if (length === undefined) {
32656
- // Source: array or array-like
32657
- length = toPosInt$1(arrayLike.length);
32658
- if (Context) arr = new Context(length);
32659
- for (i = 0; i < length; ++i) {
32660
- value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
32661
- if (Context) {
32662
- desc.value = value;
32663
- defineProperty$1(arr, i, desc);
32664
- } else {
32665
- arr[i] = value;
32666
32865
  }
32667
32866
  }
32668
- }
32669
- if (Context) {
32670
- desc.value = null;
32671
- arr.length = length;
32672
- }
32673
- return arr;
32674
- };
32867
+ if (Context) {
32868
+ desc.value = null;
32869
+ arr.length = length;
32870
+ }
32871
+ return arr;
32872
+ };
32873
+ return shim$1;
32874
+ }
32675
32875
 
32676
32876
  var from = isImplemented$3()
32677
32877
  ? Array.from
32678
- : shim$1;
32878
+ : requireShim$1();
32679
32879
 
32680
32880
  var isImplemented = function () {
32681
32881
  var numberIsNaN = Number.isNaN;
@@ -32683,18 +32883,27 @@
32683
32883
  return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
32684
32884
  };
32685
32885
 
32686
- var shim = function (value) {
32687
- // eslint-disable-next-line no-self-compare
32688
- return value !== value;
32689
- };
32886
+ var shim;
32887
+ var hasRequiredShim;
32888
+
32889
+ function requireShim () {
32890
+ if (hasRequiredShim) return shim;
32891
+ hasRequiredShim = 1;
32892
+
32893
+ shim = function (value) {
32894
+ // eslint-disable-next-line no-self-compare
32895
+ return value !== value;
32896
+ };
32897
+ return shim;
32898
+ }
32690
32899
 
32691
32900
  var isNan = isImplemented()
32692
32901
  ? Number.isNaN
32693
- : shim;
32902
+ : requireShim();
32694
32903
 
32695
32904
  var numberIsNaN = isNan
32696
32905
  , toPosInt = toPosInteger
32697
- , value$1 = validValue$1
32906
+ , value$1 = validValue
32698
32907
  , indexOf$1 = Array.prototype.indexOf
32699
32908
  , objHasOwnProperty = Object.prototype.hasOwnProperty
32700
32909
  , abs = Math.abs
@@ -32735,7 +32944,7 @@
32735
32944
  );
32736
32945
  };
32737
32946
 
32738
- var isValue = isValue$5;
32947
+ var isValue = isValue$3;
32739
32948
 
32740
32949
  var map = { function: true, object: true };
32741
32950
 
@@ -32753,8 +32962,8 @@
32753
32962
  var aFrom = from
32754
32963
  , remove = remove$1
32755
32964
  , value = validObject
32756
- , d = d$3.exports
32757
- , emit = eventEmitter.exports.methods.emit
32965
+ , d = dExports
32966
+ , emit = eventEmitterExports.methods.emit
32758
32967
 
32759
32968
  , defineProperty = Object.defineProperty
32760
32969
  , hasOwnProperty$1 = Object.prototype.hasOwnProperty
@@ -32791,6 +33000,8 @@
32791
33000
  return pipe;
32792
33001
  };
32793
33002
 
33003
+ var pipe$1 = /*@__PURE__*/getDefaultExportFromCjs(pipe);
33004
+
32794
33005
  let registeredHandlers = [...pagedMediaHandlers, ...generatedContentHandlers, ...filters];
32795
33006
 
32796
33007
  class Handlers {
@@ -32798,7 +33009,7 @@
32798
33009
 
32799
33010
  registeredHandlers.forEach((Handler) => {
32800
33011
  let handler = new Handler(chunker, polisher, caller);
32801
- pipe(handler, this);
33012
+ pipe$1(handler, this);
32802
33013
  });
32803
33014
  }
32804
33015
  }
@@ -32984,12 +33195,12 @@
32984
33195
  var Paged = /*#__PURE__*/Object.freeze({
32985
33196
  __proto__: null,
32986
33197
  Chunker: Chunker,
33198
+ Handler: Handler,
32987
33199
  Polisher: Polisher,
32988
33200
  Previewer: Previewer,
32989
- Handler: Handler,
32990
- registeredHandlers: registeredHandlers,
33201
+ initializeHandlers: initializeHandlers,
32991
33202
  registerHandlers: registerHandlers,
32992
- initializeHandlers: initializeHandlers
33203
+ registeredHandlers: registeredHandlers
32993
33204
  });
32994
33205
 
32995
33206
  window.Paged = Paged;