UNPKG

846 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3 typeof define === 'function' && define.amd ? define(factory) :
4 (global.Paged = factory());
5}(this, (function () { 'use strict';
6
7 function unwrapExports (x) {
8 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
9 }
10
11 function createCommonjsModule(fn, module) {
12 return module = { exports: {} }, fn(module, module.exports), module.exports;
13 }
14
15 var interopRequireDefault = createCommonjsModule(function (module) {
16 function _interopRequireDefault(obj) {
17 return obj && obj.__esModule ? obj : {
18 default: obj
19 };
20 }
21
22 module.exports = _interopRequireDefault;
23 });
24
25 unwrapExports(interopRequireDefault);
26
27 var runtime = createCommonjsModule(function (module) {
28 /**
29 * Copyright (c) 2014-present, Facebook, Inc.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */
34
35 !(function(global) {
36
37 var Op = Object.prototype;
38 var hasOwn = Op.hasOwnProperty;
39 var undefined; // More compressible than void 0.
40 var $Symbol = typeof Symbol === "function" ? Symbol : {};
41 var iteratorSymbol = $Symbol.iterator || "@@iterator";
42 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
43 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
44 var runtime = global.regeneratorRuntime;
45 if (runtime) {
46 {
47 // If regeneratorRuntime is defined globally and we're in a module,
48 // make the exports object identical to regeneratorRuntime.
49 module.exports = runtime;
50 }
51 // Don't bother evaluating the rest of this file if the runtime was
52 // already defined globally.
53 return;
54 }
55
56 // Define the runtime globally (as expected by generated code) as either
57 // module.exports (if we're in a module) or a new, empty object.
58 runtime = global.regeneratorRuntime = module.exports;
59
60 function wrap(innerFn, outerFn, self, tryLocsList) {
61 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
62 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
63 var generator = Object.create(protoGenerator.prototype);
64 var context = new Context(tryLocsList || []);
65
66 // The ._invoke method unifies the implementations of the .next,
67 // .throw, and .return methods.
68 generator._invoke = makeInvokeMethod(innerFn, self, context);
69
70 return generator;
71 }
72 runtime.wrap = wrap;
73
74 // Try/catch helper to minimize deoptimizations. Returns a completion
75 // record like context.tryEntries[i].completion. This interface could
76 // have been (and was previously) designed to take a closure to be
77 // invoked without arguments, but in all the cases we care about we
78 // already have an existing method we want to call, so there's no need
79 // to create a new function object. We can even get away with assuming
80 // the method takes exactly one argument, since that happens to be true
81 // in every case, so we don't have to touch the arguments object. The
82 // only additional allocation required is the completion record, which
83 // has a stable shape and so hopefully should be cheap to allocate.
84 function tryCatch(fn, obj, arg) {
85 try {
86 return { type: "normal", arg: fn.call(obj, arg) };
87 } catch (err) {
88 return { type: "throw", arg: err };
89 }
90 }
91
92 var GenStateSuspendedStart = "suspendedStart";
93 var GenStateSuspendedYield = "suspendedYield";
94 var GenStateExecuting = "executing";
95 var GenStateCompleted = "completed";
96
97 // Returning this object from the innerFn has the same effect as
98 // breaking out of the dispatch switch statement.
99 var ContinueSentinel = {};
100
101 // Dummy constructor functions that we use as the .constructor and
102 // .constructor.prototype properties for functions that return Generator
103 // objects. For full spec compliance, you may wish to configure your
104 // minifier not to mangle the names of these two functions.
105 function Generator() {}
106 function GeneratorFunction() {}
107 function GeneratorFunctionPrototype() {}
108
109 // This is a polyfill for %IteratorPrototype% for environments that
110 // don't natively support it.
111 var IteratorPrototype = {};
112 IteratorPrototype[iteratorSymbol] = function () {
113 return this;
114 };
115
116 var getProto = Object.getPrototypeOf;
117 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
118 if (NativeIteratorPrototype &&
119 NativeIteratorPrototype !== Op &&
120 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
121 // This environment has a native %IteratorPrototype%; use it instead
122 // of the polyfill.
123 IteratorPrototype = NativeIteratorPrototype;
124 }
125
126 var Gp = GeneratorFunctionPrototype.prototype =
127 Generator.prototype = Object.create(IteratorPrototype);
128 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
129 GeneratorFunctionPrototype.constructor = GeneratorFunction;
130 GeneratorFunctionPrototype[toStringTagSymbol] =
131 GeneratorFunction.displayName = "GeneratorFunction";
132
133 // Helper for defining the .next, .throw, and .return methods of the
134 // Iterator interface in terms of a single ._invoke method.
135 function defineIteratorMethods(prototype) {
136 ["next", "throw", "return"].forEach(function(method) {
137 prototype[method] = function(arg) {
138 return this._invoke(method, arg);
139 };
140 });
141 }
142
143 runtime.isGeneratorFunction = function(genFun) {
144 var ctor = typeof genFun === "function" && genFun.constructor;
145 return ctor
146 ? ctor === GeneratorFunction ||
147 // For the native GeneratorFunction constructor, the best we can
148 // do is to check its .name property.
149 (ctor.displayName || ctor.name) === "GeneratorFunction"
150 : false;
151 };
152
153 runtime.mark = function(genFun) {
154 if (Object.setPrototypeOf) {
155 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
156 } else {
157 genFun.__proto__ = GeneratorFunctionPrototype;
158 if (!(toStringTagSymbol in genFun)) {
159 genFun[toStringTagSymbol] = "GeneratorFunction";
160 }
161 }
162 genFun.prototype = Object.create(Gp);
163 return genFun;
164 };
165
166 // Within the body of any async function, `await x` is transformed to
167 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
168 // `hasOwn.call(value, "__await")` to determine if the yielded value is
169 // meant to be awaited.
170 runtime.awrap = function(arg) {
171 return { __await: arg };
172 };
173
174 function AsyncIterator(generator) {
175 function invoke(method, arg, resolve, reject) {
176 var record = tryCatch(generator[method], generator, arg);
177 if (record.type === "throw") {
178 reject(record.arg);
179 } else {
180 var result = record.arg;
181 var value = result.value;
182 if (value &&
183 typeof value === "object" &&
184 hasOwn.call(value, "__await")) {
185 return Promise.resolve(value.__await).then(function(value) {
186 invoke("next", value, resolve, reject);
187 }, function(err) {
188 invoke("throw", err, resolve, reject);
189 });
190 }
191
192 return Promise.resolve(value).then(function(unwrapped) {
193 // When a yielded Promise is resolved, its final value becomes
194 // the .value of the Promise<{value,done}> result for the
195 // current iteration.
196 result.value = unwrapped;
197 resolve(result);
198 }, function(error) {
199 // If a rejected Promise was yielded, throw the rejection back
200 // into the async generator function so it can be handled there.
201 return invoke("throw", error, resolve, reject);
202 });
203 }
204 }
205
206 var previousPromise;
207
208 function enqueue(method, arg) {
209 function callInvokeWithMethodAndArg() {
210 return new Promise(function(resolve, reject) {
211 invoke(method, arg, resolve, reject);
212 });
213 }
214
215 return previousPromise =
216 // If enqueue has been called before, then we want to wait until
217 // all previous Promises have been resolved before calling invoke,
218 // so that results are always delivered in the correct order. If
219 // enqueue has not been called before, then it is important to
220 // call invoke immediately, without waiting on a callback to fire,
221 // so that the async generator function has the opportunity to do
222 // any necessary setup in a predictable way. This predictability
223 // is why the Promise constructor synchronously invokes its
224 // executor callback, and why async functions synchronously
225 // execute code before the first await. Since we implement simple
226 // async functions in terms of async generators, it is especially
227 // important to get this right, even though it requires care.
228 previousPromise ? previousPromise.then(
229 callInvokeWithMethodAndArg,
230 // Avoid propagating failures to Promises returned by later
231 // invocations of the iterator.
232 callInvokeWithMethodAndArg
233 ) : callInvokeWithMethodAndArg();
234 }
235
236 // Define the unified helper method that is used to implement .next,
237 // .throw, and .return (see defineIteratorMethods).
238 this._invoke = enqueue;
239 }
240
241 defineIteratorMethods(AsyncIterator.prototype);
242 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
243 return this;
244 };
245 runtime.AsyncIterator = AsyncIterator;
246
247 // Note that simple async functions are implemented on top of
248 // AsyncIterator objects; they just return a Promise for the value of
249 // the final result produced by the iterator.
250 runtime.async = function(innerFn, outerFn, self, tryLocsList) {
251 var iter = new AsyncIterator(
252 wrap(innerFn, outerFn, self, tryLocsList)
253 );
254
255 return runtime.isGeneratorFunction(outerFn)
256 ? iter // If outerFn is a generator, return the full iterator.
257 : iter.next().then(function(result) {
258 return result.done ? result.value : iter.next();
259 });
260 };
261
262 function makeInvokeMethod(innerFn, self, context) {
263 var state = GenStateSuspendedStart;
264
265 return function invoke(method, arg) {
266 if (state === GenStateExecuting) {
267 throw new Error("Generator is already running");
268 }
269
270 if (state === GenStateCompleted) {
271 if (method === "throw") {
272 throw arg;
273 }
274
275 // Be forgiving, per 25.3.3.3.3 of the spec:
276 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
277 return doneResult();
278 }
279
280 context.method = method;
281 context.arg = arg;
282
283 while (true) {
284 var delegate = context.delegate;
285 if (delegate) {
286 var delegateResult = maybeInvokeDelegate(delegate, context);
287 if (delegateResult) {
288 if (delegateResult === ContinueSentinel) continue;
289 return delegateResult;
290 }
291 }
292
293 if (context.method === "next") {
294 // Setting context._sent for legacy support of Babel's
295 // function.sent implementation.
296 context.sent = context._sent = context.arg;
297
298 } else if (context.method === "throw") {
299 if (state === GenStateSuspendedStart) {
300 state = GenStateCompleted;
301 throw context.arg;
302 }
303
304 context.dispatchException(context.arg);
305
306 } else if (context.method === "return") {
307 context.abrupt("return", context.arg);
308 }
309
310 state = GenStateExecuting;
311
312 var record = tryCatch(innerFn, self, context);
313 if (record.type === "normal") {
314 // If an exception is thrown from innerFn, we leave state ===
315 // GenStateExecuting and loop back for another invocation.
316 state = context.done
317 ? GenStateCompleted
318 : GenStateSuspendedYield;
319
320 if (record.arg === ContinueSentinel) {
321 continue;
322 }
323
324 return {
325 value: record.arg,
326 done: context.done
327 };
328
329 } else if (record.type === "throw") {
330 state = GenStateCompleted;
331 // Dispatch the exception by looping back around to the
332 // context.dispatchException(context.arg) call above.
333 context.method = "throw";
334 context.arg = record.arg;
335 }
336 }
337 };
338 }
339
340 // Call delegate.iterator[context.method](context.arg) and handle the
341 // result, either by returning a { value, done } result from the
342 // delegate iterator, or by modifying context.method and context.arg,
343 // setting context.delegate to null, and returning the ContinueSentinel.
344 function maybeInvokeDelegate(delegate, context) {
345 var method = delegate.iterator[context.method];
346 if (method === undefined) {
347 // A .throw or .return when the delegate iterator has no .throw
348 // method always terminates the yield* loop.
349 context.delegate = null;
350
351 if (context.method === "throw") {
352 if (delegate.iterator.return) {
353 // If the delegate iterator has a return method, give it a
354 // chance to clean up.
355 context.method = "return";
356 context.arg = undefined;
357 maybeInvokeDelegate(delegate, context);
358
359 if (context.method === "throw") {
360 // If maybeInvokeDelegate(context) changed context.method from
361 // "return" to "throw", let that override the TypeError below.
362 return ContinueSentinel;
363 }
364 }
365
366 context.method = "throw";
367 context.arg = new TypeError(
368 "The iterator does not provide a 'throw' method");
369 }
370
371 return ContinueSentinel;
372 }
373
374 var record = tryCatch(method, delegate.iterator, context.arg);
375
376 if (record.type === "throw") {
377 context.method = "throw";
378 context.arg = record.arg;
379 context.delegate = null;
380 return ContinueSentinel;
381 }
382
383 var info = record.arg;
384
385 if (! info) {
386 context.method = "throw";
387 context.arg = new TypeError("iterator result is not an object");
388 context.delegate = null;
389 return ContinueSentinel;
390 }
391
392 if (info.done) {
393 // Assign the result of the finished delegate to the temporary
394 // variable specified by delegate.resultName (see delegateYield).
395 context[delegate.resultName] = info.value;
396
397 // Resume execution at the desired location (see delegateYield).
398 context.next = delegate.nextLoc;
399
400 // If context.method was "throw" but the delegate handled the
401 // exception, let the outer generator proceed normally. If
402 // context.method was "next", forget context.arg since it has been
403 // "consumed" by the delegate iterator. If context.method was
404 // "return", allow the original .return call to continue in the
405 // outer generator.
406 if (context.method !== "return") {
407 context.method = "next";
408 context.arg = undefined;
409 }
410
411 } else {
412 // Re-yield the result returned by the delegate method.
413 return info;
414 }
415
416 // The delegate iterator is finished, so forget it and continue with
417 // the outer generator.
418 context.delegate = null;
419 return ContinueSentinel;
420 }
421
422 // Define Generator.prototype.{next,throw,return} in terms of the
423 // unified ._invoke helper method.
424 defineIteratorMethods(Gp);
425
426 Gp[toStringTagSymbol] = "Generator";
427
428 // A Generator should always return itself as the iterator object when the
429 // @@iterator function is called on it. Some browsers' implementations of the
430 // iterator prototype chain incorrectly implement this, causing the Generator
431 // object to not be returned from this call. This ensures that doesn't happen.
432 // See https://github.com/facebook/regenerator/issues/274 for more details.
433 Gp[iteratorSymbol] = function() {
434 return this;
435 };
436
437 Gp.toString = function() {
438 return "[object Generator]";
439 };
440
441 function pushTryEntry(locs) {
442 var entry = { tryLoc: locs[0] };
443
444 if (1 in locs) {
445 entry.catchLoc = locs[1];
446 }
447
448 if (2 in locs) {
449 entry.finallyLoc = locs[2];
450 entry.afterLoc = locs[3];
451 }
452
453 this.tryEntries.push(entry);
454 }
455
456 function resetTryEntry(entry) {
457 var record = entry.completion || {};
458 record.type = "normal";
459 delete record.arg;
460 entry.completion = record;
461 }
462
463 function Context(tryLocsList) {
464 // The root entry object (effectively a try statement without a catch
465 // or a finally block) gives us a place to store values thrown from
466 // locations where there is no enclosing try statement.
467 this.tryEntries = [{ tryLoc: "root" }];
468 tryLocsList.forEach(pushTryEntry, this);
469 this.reset(true);
470 }
471
472 runtime.keys = function(object) {
473 var keys = [];
474 for (var key in object) {
475 keys.push(key);
476 }
477 keys.reverse();
478
479 // Rather than returning an object with a next method, we keep
480 // things simple and return the next function itself.
481 return function next() {
482 while (keys.length) {
483 var key = keys.pop();
484 if (key in object) {
485 next.value = key;
486 next.done = false;
487 return next;
488 }
489 }
490
491 // To avoid creating an additional object, we just hang the .value
492 // and .done properties off the next function object itself. This
493 // also ensures that the minifier will not anonymize the function.
494 next.done = true;
495 return next;
496 };
497 };
498
499 function values(iterable) {
500 if (iterable) {
501 var iteratorMethod = iterable[iteratorSymbol];
502 if (iteratorMethod) {
503 return iteratorMethod.call(iterable);
504 }
505
506 if (typeof iterable.next === "function") {
507 return iterable;
508 }
509
510 if (!isNaN(iterable.length)) {
511 var i = -1, next = function next() {
512 while (++i < iterable.length) {
513 if (hasOwn.call(iterable, i)) {
514 next.value = iterable[i];
515 next.done = false;
516 return next;
517 }
518 }
519
520 next.value = undefined;
521 next.done = true;
522
523 return next;
524 };
525
526 return next.next = next;
527 }
528 }
529
530 // Return an iterator with no values.
531 return { next: doneResult };
532 }
533 runtime.values = values;
534
535 function doneResult() {
536 return { value: undefined, done: true };
537 }
538
539 Context.prototype = {
540 constructor: Context,
541
542 reset: function(skipTempReset) {
543 this.prev = 0;
544 this.next = 0;
545 // Resetting context._sent for legacy support of Babel's
546 // function.sent implementation.
547 this.sent = this._sent = undefined;
548 this.done = false;
549 this.delegate = null;
550
551 this.method = "next";
552 this.arg = undefined;
553
554 this.tryEntries.forEach(resetTryEntry);
555
556 if (!skipTempReset) {
557 for (var name in this) {
558 // Not sure about the optimal order of these conditions:
559 if (name.charAt(0) === "t" &&
560 hasOwn.call(this, name) &&
561 !isNaN(+name.slice(1))) {
562 this[name] = undefined;
563 }
564 }
565 }
566 },
567
568 stop: function() {
569 this.done = true;
570
571 var rootEntry = this.tryEntries[0];
572 var rootRecord = rootEntry.completion;
573 if (rootRecord.type === "throw") {
574 throw rootRecord.arg;
575 }
576
577 return this.rval;
578 },
579
580 dispatchException: function(exception) {
581 if (this.done) {
582 throw exception;
583 }
584
585 var context = this;
586 function handle(loc, caught) {
587 record.type = "throw";
588 record.arg = exception;
589 context.next = loc;
590
591 if (caught) {
592 // If the dispatched exception was caught by a catch block,
593 // then let that catch block handle the exception normally.
594 context.method = "next";
595 context.arg = undefined;
596 }
597
598 return !! caught;
599 }
600
601 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
602 var entry = this.tryEntries[i];
603 var record = entry.completion;
604
605 if (entry.tryLoc === "root") {
606 // Exception thrown outside of any try block that could handle
607 // it, so set the completion value of the entire function to
608 // throw the exception.
609 return handle("end");
610 }
611
612 if (entry.tryLoc <= this.prev) {
613 var hasCatch = hasOwn.call(entry, "catchLoc");
614 var hasFinally = hasOwn.call(entry, "finallyLoc");
615
616 if (hasCatch && hasFinally) {
617 if (this.prev < entry.catchLoc) {
618 return handle(entry.catchLoc, true);
619 } else if (this.prev < entry.finallyLoc) {
620 return handle(entry.finallyLoc);
621 }
622
623 } else if (hasCatch) {
624 if (this.prev < entry.catchLoc) {
625 return handle(entry.catchLoc, true);
626 }
627
628 } else if (hasFinally) {
629 if (this.prev < entry.finallyLoc) {
630 return handle(entry.finallyLoc);
631 }
632
633 } else {
634 throw new Error("try statement without catch or finally");
635 }
636 }
637 }
638 },
639
640 abrupt: function(type, arg) {
641 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
642 var entry = this.tryEntries[i];
643 if (entry.tryLoc <= this.prev &&
644 hasOwn.call(entry, "finallyLoc") &&
645 this.prev < entry.finallyLoc) {
646 var finallyEntry = entry;
647 break;
648 }
649 }
650
651 if (finallyEntry &&
652 (type === "break" ||
653 type === "continue") &&
654 finallyEntry.tryLoc <= arg &&
655 arg <= finallyEntry.finallyLoc) {
656 // Ignore the finally entry if control is not jumping to a
657 // location outside the try/catch block.
658 finallyEntry = null;
659 }
660
661 var record = finallyEntry ? finallyEntry.completion : {};
662 record.type = type;
663 record.arg = arg;
664
665 if (finallyEntry) {
666 this.method = "next";
667 this.next = finallyEntry.finallyLoc;
668 return ContinueSentinel;
669 }
670
671 return this.complete(record);
672 },
673
674 complete: function(record, afterLoc) {
675 if (record.type === "throw") {
676 throw record.arg;
677 }
678
679 if (record.type === "break" ||
680 record.type === "continue") {
681 this.next = record.arg;
682 } else if (record.type === "return") {
683 this.rval = this.arg = record.arg;
684 this.method = "return";
685 this.next = "end";
686 } else if (record.type === "normal" && afterLoc) {
687 this.next = afterLoc;
688 }
689
690 return ContinueSentinel;
691 },
692
693 finish: function(finallyLoc) {
694 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
695 var entry = this.tryEntries[i];
696 if (entry.finallyLoc === finallyLoc) {
697 this.complete(entry.completion, entry.afterLoc);
698 resetTryEntry(entry);
699 return ContinueSentinel;
700 }
701 }
702 },
703
704 "catch": function(tryLoc) {
705 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
706 var entry = this.tryEntries[i];
707 if (entry.tryLoc === tryLoc) {
708 var record = entry.completion;
709 if (record.type === "throw") {
710 var thrown = record.arg;
711 resetTryEntry(entry);
712 }
713 return thrown;
714 }
715 }
716
717 // The context.catch method must only be called with a location
718 // argument that corresponds to a known catch block.
719 throw new Error("illegal catch attempt");
720 },
721
722 delegateYield: function(iterable, resultName, nextLoc) {
723 this.delegate = {
724 iterator: values(iterable),
725 resultName: resultName,
726 nextLoc: nextLoc
727 };
728
729 if (this.method === "next") {
730 // Deliberately forget the last sent value so that we don't
731 // accidentally pass it on to the delegate.
732 this.arg = undefined;
733 }
734
735 return ContinueSentinel;
736 }
737 };
738 })(
739 // In sloppy mode, unbound `this` refers to the global object, fallback to
740 // Function constructor if we're in global strict mode. That is sadly a form
741 // of indirect eval which violates Content Security Policy.
742 (function() {
743 return this || (typeof self === "object" && self);
744 })() || Function("return this")()
745 );
746 });
747
748 /**
749 * Copyright (c) 2014-present, Facebook, Inc.
750 *
751 * This source code is licensed under the MIT license found in the
752 * LICENSE file in the root directory of this source tree.
753 */
754
755 // This method of obtaining a reference to the global object needs to be
756 // kept identical to the way it is obtained in runtime.js
757 var g = (function() {
758 return this || (typeof self === "object" && self);
759 })() || Function("return this")();
760
761 // Use `getOwnPropertyNames` because not all browsers support calling
762 // `hasOwnProperty` on the global `self` object in a worker. See #183.
763 var hadRuntime = g.regeneratorRuntime &&
764 Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
765
766 // Save the old regeneratorRuntime in case it needs to be restored later.
767 var oldRuntime = hadRuntime && g.regeneratorRuntime;
768
769 // Force reevalutation of runtime.js.
770 g.regeneratorRuntime = undefined;
771
772 var runtimeModule = runtime;
773
774 if (hadRuntime) {
775 // Restore the original runtime.
776 g.regeneratorRuntime = oldRuntime;
777 } else {
778 // Remove the global property added by runtime.js.
779 try {
780 delete g.regeneratorRuntime;
781 } catch(e) {
782 g.regeneratorRuntime = undefined;
783 }
784 }
785
786 var regenerator = runtimeModule;
787
788 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
789 try {
790 var info = gen[key](arg);
791 var value = info.value;
792 } catch (error) {
793 reject(error);
794 return;
795 }
796
797 if (info.done) {
798 resolve(value);
799 } else {
800 Promise.resolve(value).then(_next, _throw);
801 }
802 }
803
804 function _asyncToGenerator(fn) {
805 return function () {
806 var self = this,
807 args = arguments;
808 return new Promise(function (resolve, reject) {
809 var gen = fn.apply(self, args);
810
811 function _next(value) {
812 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
813 }
814
815 function _throw(err) {
816 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
817 }
818
819 _next(undefined);
820 });
821 };
822 }
823
824 var asyncToGenerator = _asyncToGenerator;
825
826 function _classCallCheck(instance, Constructor) {
827 if (!(instance instanceof Constructor)) {
828 throw new TypeError("Cannot call a class as a function");
829 }
830 }
831
832 var classCallCheck = _classCallCheck;
833
834 function _defineProperties(target, props) {
835 for (var i = 0; i < props.length; i++) {
836 var descriptor = props[i];
837 descriptor.enumerable = descriptor.enumerable || false;
838 descriptor.configurable = true;
839 if ("value" in descriptor) descriptor.writable = true;
840 Object.defineProperty(target, descriptor.key, descriptor);
841 }
842 }
843
844 function _createClass(Constructor, protoProps, staticProps) {
845 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
846 if (staticProps) _defineProperties(Constructor, staticProps);
847 return Constructor;
848 }
849
850 var createClass = _createClass;
851
852 function _AwaitValue(value) {
853 this.wrapped = value;
854 }
855
856 var AwaitValue = _AwaitValue;
857
858 function _awaitAsyncGenerator(value) {
859 return new AwaitValue(value);
860 }
861
862 var awaitAsyncGenerator = _awaitAsyncGenerator;
863
864 function AsyncGenerator(gen) {
865 var front, back;
866
867 function send(key, arg) {
868 return new Promise(function (resolve, reject) {
869 var request = {
870 key: key,
871 arg: arg,
872 resolve: resolve,
873 reject: reject,
874 next: null
875 };
876
877 if (back) {
878 back = back.next = request;
879 } else {
880 front = back = request;
881 resume(key, arg);
882 }
883 });
884 }
885
886 function resume(key, arg) {
887 try {
888 var result = gen[key](arg);
889 var value = result.value;
890 var wrappedAwait = value instanceof AwaitValue;
891 Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) {
892 if (wrappedAwait) {
893 resume("next", arg);
894 return;
895 }
896
897 settle(result.done ? "return" : "normal", arg);
898 }, function (err) {
899 resume("throw", err);
900 });
901 } catch (err) {
902 settle("throw", err);
903 }
904 }
905
906 function settle(type, value) {
907 switch (type) {
908 case "return":
909 front.resolve({
910 value: value,
911 done: true
912 });
913 break;
914
915 case "throw":
916 front.reject(value);
917 break;
918
919 default:
920 front.resolve({
921 value: value,
922 done: false
923 });
924 break;
925 }
926
927 front = front.next;
928
929 if (front) {
930 resume(front.key, front.arg);
931 } else {
932 back = null;
933 }
934 }
935
936 this._invoke = send;
937
938 if (typeof gen.return !== "function") {
939 this.return = undefined;
940 }
941 }
942
943 if (typeof Symbol === "function" && Symbol.asyncIterator) {
944 AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
945 return this;
946 };
947 }
948
949 AsyncGenerator.prototype.next = function (arg) {
950 return this._invoke("next", arg);
951 };
952
953 AsyncGenerator.prototype.throw = function (arg) {
954 return this._invoke("throw", arg);
955 };
956
957 AsyncGenerator.prototype.return = function (arg) {
958 return this._invoke("return", arg);
959 };
960
961 var AsyncGenerator_1 = AsyncGenerator;
962
963 function _wrapAsyncGenerator(fn) {
964 return function () {
965 return new AsyncGenerator_1(fn.apply(this, arguments));
966 };
967 }
968
969 var wrapAsyncGenerator = _wrapAsyncGenerator;
970
971 var utils = createCommonjsModule(function (module, exports) {
972
973 Object.defineProperty(exports, "__esModule", {
974 value: true
975 });
976 exports.getBoundingClientRect = getBoundingClientRect;
977 exports.getClientRects = getClientRects;
978 exports.UUID = UUID;
979 exports.positionInNodeList = positionInNodeList;
980 exports.findCssSelector = findCssSelector;
981 exports.attr = attr;
982 exports.querySelectorEscape = querySelectorEscape;
983 exports.defer = defer;
984 exports.requestIdleCallback = void 0;
985
986 function getBoundingClientRect(element) {
987 if (!element) {
988 return;
989 }
990
991 var rect;
992
993 if (typeof element.getBoundingClientRect !== "undefined") {
994 rect = element.getBoundingClientRect();
995 } else {
996 var range = document.createRange();
997 range.selectNode(element);
998 rect = range.getBoundingClientRect();
999 }
1000
1001 return rect;
1002 }
1003
1004 function getClientRects(element) {
1005 if (!element) {
1006 return;
1007 }
1008
1009 var rect;
1010
1011 if (typeof element.getClientRects !== "undefined") {
1012 rect = element.getClientRects();
1013 } else {
1014 var range = document.createRange();
1015 range.selectNode(element);
1016 rect = range.getClientRects();
1017 }
1018
1019 return rect;
1020 }
1021 /**
1022 * Generates a UUID
1023 * based on: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
1024 * @returns {string} uuid
1025 */
1026
1027
1028 function UUID() {
1029 var d = new Date().getTime();
1030
1031 if (typeof performance !== "undefined" && typeof performance.now === "function") {
1032 d += performance.now(); //use high-precision timer if available
1033 }
1034
1035 return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
1036 var r = (d + Math.random() * 16) % 16 | 0;
1037 d = Math.floor(d / 16);
1038 return (c === "x" ? r : r & 0x3 | 0x8).toString(16);
1039 });
1040 } // From: https://hg.mozilla.org/mozilla-central/file/tip/toolkit/modules/css-selector.js#l52
1041
1042 /**
1043 * Find the position of [element] in [nodeList].
1044 * @param {Element} element to check
1045 * @param {NodeList} nodeList to find in
1046 * @returns {int} an index of the match, or -1 if there is no match
1047 */
1048
1049
1050 function positionInNodeList(element, nodeList) {
1051 for (var i = 0; i < nodeList.length; i++) {
1052 if (element === nodeList[i]) {
1053 return i;
1054 }
1055 }
1056
1057 return -1;
1058 }
1059 /**
1060 * Find a unique CSS selector for a given element
1061 * @param {Element} ele to check
1062 * @returns {string} a string such that ele.ownerDocument.querySelector(reply) === ele
1063 * and ele.ownerDocument.querySelectorAll(reply).length === 1
1064 */
1065
1066
1067 function findCssSelector(ele) {
1068 var document = ele.ownerDocument; // Fred: commented out to allow for parsing in fragments
1069 // if (!document || !document.contains(ele)) {
1070 // throw new Error("findCssSelector received element not inside document");
1071 // }
1072
1073 var cssEscape = window.CSS.escape; // document.querySelectorAll("#id") returns multiple if elements share an ID
1074
1075 if (ele.id && document.querySelectorAll("#" + cssEscape(ele.id)).length === 1) {
1076 return "#" + cssEscape(ele.id);
1077 } // Inherently unique by tag name
1078
1079
1080 var tagName = ele.localName;
1081
1082 if (tagName === "html") {
1083 return "html";
1084 }
1085
1086 if (tagName === "head") {
1087 return "head";
1088 }
1089
1090 if (tagName === "body") {
1091 return "body";
1092 } // We might be able to find a unique class name
1093
1094
1095 var selector, index, matches;
1096
1097 if (ele.classList.length > 0) {
1098 for (var i = 0; i < ele.classList.length; i++) {
1099 // Is this className unique by itself?
1100 selector = "." + cssEscape(ele.classList.item(i));
1101 matches = document.querySelectorAll(selector);
1102
1103 if (matches.length === 1) {
1104 return selector;
1105 } // Maybe it's unique with a tag name?
1106
1107
1108 selector = cssEscape(tagName) + selector;
1109 matches = document.querySelectorAll(selector);
1110
1111 if (matches.length === 1) {
1112 return selector;
1113 } // Maybe it's unique using a tag name and nth-child
1114
1115
1116 index = positionInNodeList(ele, ele.parentNode.children) + 1;
1117 selector = selector + ":nth-child(" + index + ")";
1118 matches = document.querySelectorAll(selector);
1119
1120 if (matches.length === 1) {
1121 return selector;
1122 }
1123 }
1124 } // Not unique enough yet. As long as it's not a child of the document,
1125 // continue recursing up until it is unique enough.
1126
1127
1128 if (ele.parentNode !== document && ele.parentNode.nodeType === 1) {
1129 index = positionInNodeList(ele, ele.parentNode.children) + 1;
1130 selector = findCssSelector(ele.parentNode) + " > " + cssEscape(tagName) + ":nth-child(" + index + ")";
1131 }
1132
1133 return selector;
1134 }
1135
1136 function attr(element, attributes) {
1137 for (var i = 0; i < attributes.length; i++) {
1138 if (element.hasAttribute(attributes[i])) {
1139 return element.getAttribute(attributes[i]);
1140 }
1141 }
1142 }
1143 /* Based on by https://mths.be/cssescape v1.5.1 by @mathias | MIT license
1144 * Allows # and .
1145 */
1146
1147
1148 function querySelectorEscape(value) {
1149 if (arguments.length == 0) {
1150 throw new TypeError("`CSS.escape` requires an argument.");
1151 }
1152
1153 var string = String(value);
1154 var length = string.length;
1155 var index = -1;
1156 var codeUnit;
1157 var result = "";
1158 var firstCodeUnit = string.charCodeAt(0);
1159
1160 while (++index < length) {
1161 codeUnit = string.charCodeAt(index); // Note: there’s no need to special-case astral symbols, surrogate
1162 // pairs, or lone surrogates.
1163 // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
1164 // (U+FFFD).
1165
1166 if (codeUnit == 0x0000) {
1167 result += "\uFFFD";
1168 continue;
1169 }
1170
1171 if ( // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
1172 // U+007F, […]
1173 codeUnit >= 0x0001 && codeUnit <= 0x001F || codeUnit == 0x007F || // If the character is the first character and is in the range [0-9]
1174 // (U+0030 to U+0039), […]
1175 index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039 || // If the character is the second character and is in the range [0-9]
1176 // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
1177 index == 1 && codeUnit >= 0x0030 && codeUnit <= 0x0039 && firstCodeUnit == 0x002D) {
1178 // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
1179 result += "\\" + codeUnit.toString(16) + " ";
1180 continue;
1181 }
1182
1183 if ( // If the character is the first character and is a `-` (U+002D), and
1184 // there is no second character, […]
1185 index == 0 && length == 1 && codeUnit == 0x002D) {
1186 result += "\\" + string.charAt(index);
1187 continue;
1188 } // If the character is not handled by one of the above rules and is
1189 // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
1190 // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
1191 // U+005A), or [a-z] (U+0061 to U+007A), […]
1192
1193
1194 if (codeUnit >= 0x0080 || codeUnit == 0x002D || codeUnit == 0x005F || codeUnit == 35 || // Allow #
1195 codeUnit == 46 || // Allow .
1196 codeUnit >= 0x0030 && codeUnit <= 0x0039 || codeUnit >= 0x0041 && codeUnit <= 0x005A || codeUnit >= 0x0061 && codeUnit <= 0x007A) {
1197 // the character itself
1198 result += string.charAt(index);
1199 continue;
1200 } // Otherwise, the escaped character.
1201 // https://drafts.csswg.org/cssom/#escape-a-character
1202
1203
1204 result += "\\" + string.charAt(index);
1205 }
1206
1207 return result;
1208 }
1209 /**
1210 * Creates a new pending promise and provides methods to resolve or reject it.
1211 * From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible
1212 * @returns {object} defered
1213 */
1214
1215
1216 function defer() {
1217 var _this = this;
1218
1219 this.resolve = null;
1220 this.reject = null;
1221 this.id = UUID();
1222 this.promise = new Promise(function (resolve, reject) {
1223 _this.resolve = resolve;
1224 _this.reject = reject;
1225 });
1226 Object.freeze(this);
1227 }
1228
1229 var requestIdleCallback = typeof window !== "undefined" && ("requestIdleCallback" in window ? window.requestIdleCallback : window.requestAnimationFrame);
1230 exports.requestIdleCallback = requestIdleCallback;
1231 });
1232
1233 unwrapExports(utils);
1234 var utils_1 = utils.getBoundingClientRect;
1235 var utils_2 = utils.getClientRects;
1236 var utils_3 = utils.UUID;
1237 var utils_4 = utils.positionInNodeList;
1238 var utils_5 = utils.findCssSelector;
1239 var utils_6 = utils.attr;
1240 var utils_7 = utils.querySelectorEscape;
1241 var utils_8 = utils.defer;
1242 var utils_9 = utils.requestIdleCallback;
1243
1244 var dom = createCommonjsModule(function (module, exports) {
1245
1246
1247
1248 Object.defineProperty(exports, "__esModule", {
1249 value: true
1250 });
1251 exports.isElement = isElement;
1252 exports.isText = isText;
1253 exports.walk = walk;
1254 exports.nodeAfter = nodeAfter;
1255 exports.nodeBefore = nodeBefore;
1256 exports.elementAfter = elementAfter;
1257 exports.elementBefore = elementBefore;
1258 exports.stackChildren = stackChildren;
1259 exports.rebuildAncestors = rebuildAncestors;
1260 exports.needsBreakBefore = needsBreakBefore;
1261 exports.needsBreakAfter = needsBreakAfter;
1262 exports.needsPreviousBreakAfter = needsPreviousBreakAfter;
1263 exports.needsPageBreak = needsPageBreak;
1264 exports.words = words;
1265 exports.letters = letters;
1266 exports.isContainer = isContainer;
1267 exports.cloneNode = cloneNode;
1268 exports.findElement = findElement;
1269 exports.findRef = findRef;
1270 exports.validNode = validNode;
1271 exports.prevValidNode = prevValidNode;
1272 exports.nextValidNode = nextValidNode;
1273 exports.indexOf = indexOf;
1274 exports.child = child;
1275 exports.isVisible = isVisible;
1276 exports.hasContent = hasContent;
1277 exports.hasTextContent = hasTextContent;
1278 exports.indexOfTextNode = indexOfTextNode;
1279
1280 var _regenerator = interopRequireDefault(regenerator);
1281
1282 var _marked =
1283 /*#__PURE__*/
1284 _regenerator.default.mark(walk),
1285 _marked2 =
1286 /*#__PURE__*/
1287 _regenerator.default.mark(words),
1288 _marked3 =
1289 /*#__PURE__*/
1290 _regenerator.default.mark(letters);
1291
1292 function isElement(node) {
1293 return node && node.nodeType === 1;
1294 }
1295
1296 function isText(node) {
1297 return node && node.nodeType === 3;
1298 }
1299
1300 function walk(start, limiter) {
1301 var node;
1302 return _regenerator.default.wrap(function walk$(_context) {
1303 while (1) {
1304 switch (_context.prev = _context.next) {
1305 case 0:
1306 node = start;
1307
1308 case 1:
1309 if (!node) {
1310 _context.next = 27;
1311 break;
1312 }
1313
1314 _context.next = 4;
1315 return node;
1316
1317 case 4:
1318 if (!node.childNodes.length) {
1319 _context.next = 8;
1320 break;
1321 }
1322
1323 node = node.firstChild;
1324 _context.next = 25;
1325 break;
1326
1327 case 8:
1328 if (!node.nextSibling) {
1329 _context.next = 15;
1330 break;
1331 }
1332
1333 if (!(limiter && node === limiter)) {
1334 _context.next = 12;
1335 break;
1336 }
1337
1338 node = undefined;
1339 return _context.abrupt("break", 27);
1340
1341 case 12:
1342 node = node.nextSibling;
1343 _context.next = 25;
1344 break;
1345
1346 case 15:
1347 if (!node) {
1348 _context.next = 25;
1349 break;
1350 }
1351
1352 node = node.parentNode;
1353
1354 if (!(limiter && node === limiter)) {
1355 _context.next = 20;
1356 break;
1357 }
1358
1359 node = undefined;
1360 return _context.abrupt("break", 25);
1361
1362 case 20:
1363 if (!(node && node.nextSibling)) {
1364 _context.next = 23;
1365 break;
1366 }
1367
1368 node = node.nextSibling;
1369 return _context.abrupt("break", 25);
1370
1371 case 23:
1372 _context.next = 15;
1373 break;
1374
1375 case 25:
1376 _context.next = 1;
1377 break;
1378
1379 case 27:
1380 case "end":
1381 return _context.stop();
1382 }
1383 }
1384 }, _marked, this);
1385 }
1386
1387 function nodeAfter(node, limiter) {
1388 var after = node;
1389
1390 if (after.nextSibling) {
1391 if (limiter && node === limiter) {
1392 return;
1393 }
1394
1395 after = after.nextSibling;
1396 } else {
1397 while (after) {
1398 after = after.parentNode;
1399
1400 if (limiter && after === limiter) {
1401 after = undefined;
1402 break;
1403 }
1404
1405 if (after && after.nextSibling) {
1406 after = after.nextSibling;
1407 break;
1408 }
1409 }
1410 }
1411
1412 return after;
1413 }
1414
1415 function nodeBefore(node, limiter) {
1416 var before = node;
1417
1418 if (before.previousSibling) {
1419 if (limiter && node === limiter) {
1420 return;
1421 }
1422
1423 before = before.previousSibling;
1424 } else {
1425 while (before) {
1426 before = before.parentNode;
1427
1428 if (limiter && before === limiter) {
1429 before = undefined;
1430 break;
1431 }
1432
1433 if (before && before.previousSibling) {
1434 before = before.previousSibling;
1435 break;
1436 }
1437 }
1438 }
1439
1440 return before;
1441 }
1442
1443 function elementAfter(node, limiter) {
1444 var after = nodeAfter(node);
1445
1446 while (after && after.nodeType !== 1) {
1447 after = nodeAfter(after);
1448 }
1449
1450 return after;
1451 }
1452
1453 function elementBefore(node, limiter) {
1454 var before = nodeAfter(node);
1455
1456 while (before && before.nodeType !== 1) {
1457 before = nodeAfter(before);
1458 }
1459
1460 return before;
1461 }
1462
1463 function stackChildren(currentNode, stacked) {
1464 var stack = stacked || [];
1465 stack.unshift(currentNode);
1466 var children = currentNode.children;
1467
1468 for (var i = 0, length = children.length; i < length; i++) {
1469 stackChildren(children[i], stack);
1470 }
1471
1472 return stack;
1473 }
1474
1475 function rebuildAncestors(node) {
1476 var parent, ancestor;
1477 var ancestors = [];
1478 var added = [];
1479 var fragment = document.createDocumentFragment(); // Gather all ancestors
1480
1481 var element = node;
1482
1483 while (element.parentNode && element.parentNode.nodeType === 1) {
1484 ancestors.unshift(element.parentNode);
1485 element = element.parentNode;
1486 }
1487
1488 for (var i = 0; i < ancestors.length; i++) {
1489 ancestor = ancestors[i];
1490 parent = ancestor.cloneNode(false);
1491 parent.setAttribute("data-split-from", parent.getAttribute("data-ref")); // ancestor.setAttribute("data-split-to", parent.getAttribute("data-ref"));
1492
1493 if (parent.hasAttribute("id")) {
1494 var dataID = parent.getAttribute("id");
1495 parent.setAttribute("data-id", dataID);
1496 parent.removeAttribute("id");
1497 } // This is handled by css :not, but also tidied up here
1498
1499
1500 if (parent.hasAttribute("data-break-before")) {
1501 parent.removeAttribute("data-break-before");
1502 }
1503
1504 if (parent.hasAttribute("data-previous-break-after")) {
1505 parent.removeAttribute("data-previous-break-after");
1506 }
1507
1508 if (added.length) {
1509 var container = added[added.length - 1];
1510 container.appendChild(parent);
1511 } else {
1512 fragment.appendChild(parent);
1513 }
1514
1515 added.push(parent);
1516 }
1517
1518 added = undefined;
1519 return fragment;
1520 }
1521 /*
1522 export function split(bound, cutElement, breakAfter) {
1523 let needsRemoval = [];
1524 let index = indexOf(cutElement);
1525
1526 if (!breakAfter && index === 0) {
1527 return;
1528 }
1529
1530 if (breakAfter && index === (cutElement.parentNode.children.length - 1)) {
1531 return;
1532 }
1533
1534 // Create a fragment with rebuilt ancestors
1535 let fragment = rebuildAncestors(cutElement);
1536
1537 // Clone cut
1538 if (!breakAfter) {
1539 let clone = cutElement.cloneNode(true);
1540 let ref = cutElement.parentNode.getAttribute('data-ref');
1541 let parent = fragment.querySelector("[data-ref='" + ref + "']");
1542 parent.appendChild(clone);
1543 needsRemoval.push(cutElement);
1544 }
1545
1546 // Remove all after cut
1547 let next = nodeAfter(cutElement, bound);
1548 while (next) {
1549 let clone = next.cloneNode(true);
1550 let ref = next.parentNode.getAttribute('data-ref');
1551 let parent = fragment.querySelector("[data-ref='" + ref + "']");
1552 parent.appendChild(clone);
1553 needsRemoval.push(next);
1554 next = nodeAfter(next, bound);
1555 }
1556
1557 // Remove originals
1558 needsRemoval.forEach((node) => {
1559 if (node) {
1560 node.remove();
1561 }
1562 });
1563
1564 // Insert after bounds
1565 bound.parentNode.insertBefore(fragment, bound.nextSibling);
1566 return [bound, bound.nextSibling];
1567 }
1568 */
1569
1570
1571 function needsBreakBefore(node) {
1572 if (typeof node !== "undefined" && typeof node.dataset !== "undefined" && typeof node.dataset.breakBefore !== "undefined" && (node.dataset.breakBefore === "always" || node.dataset.breakBefore === "page" || node.dataset.breakBefore === "left" || node.dataset.breakBefore === "right" || node.dataset.breakBefore === "recto" || node.dataset.breakBefore === "verso")) {
1573 return true;
1574 }
1575
1576 return false;
1577 }
1578
1579 function needsBreakAfter(node) {
1580 if (typeof node !== "undefined" && typeof node.dataset !== "undefined" && typeof node.dataset.breakAfter !== "undefined" && (node.dataset.breakAfter === "always" || node.dataset.breakAfter === "page" || node.dataset.breakAfter === "left" || node.dataset.breakAfter === "right" || node.dataset.breakAfter === "recto" || node.dataset.breakAfter === "verso")) {
1581 return true;
1582 }
1583
1584 return false;
1585 }
1586
1587 function needsPreviousBreakAfter(node) {
1588 if (typeof node !== "undefined" && typeof node.dataset !== "undefined" && typeof node.dataset.previousBreakAfter !== "undefined" && (node.dataset.previousBreakAfter === "always" || node.dataset.previousBreakAfter === "page" || node.dataset.previousBreakAfter === "left" || node.dataset.previousBreakAfter === "right" || node.dataset.previousBreakAfter === "recto" || node.dataset.previousBreakAfter === "verso")) {
1589 return true;
1590 }
1591
1592 return false;
1593 }
1594
1595 function needsPageBreak(node) {
1596 if (typeof node !== "undefined" && typeof node.dataset !== "undefined" && (node.dataset.page || node.dataset.afterPage)) {
1597 return true;
1598 }
1599
1600 return false;
1601 }
1602
1603 function words(node) {
1604 var currentText, max, currentOffset, currentLetter, range;
1605 return _regenerator.default.wrap(function words$(_context2) {
1606 while (1) {
1607 switch (_context2.prev = _context2.next) {
1608 case 0:
1609 currentText = node.nodeValue;
1610 max = currentText.length;
1611 currentOffset = 0;
1612
1613 case 3:
1614 if (!(currentOffset < max)) {
1615 _context2.next = 17;
1616 break;
1617 }
1618
1619 currentLetter = currentText[currentOffset];
1620
1621 if (!/^[\S\u202F\u00A0]$/.test(currentLetter)) {
1622 _context2.next = 9;
1623 break;
1624 }
1625
1626 if (!range) {
1627 range = document.createRange();
1628 range.setStart(node, currentOffset);
1629 }
1630
1631 _context2.next = 14;
1632 break;
1633
1634 case 9:
1635 if (!range) {
1636 _context2.next = 14;
1637 break;
1638 }
1639
1640 range.setEnd(node, currentOffset);
1641 _context2.next = 13;
1642 return range;
1643
1644 case 13:
1645 range = undefined;
1646
1647 case 14:
1648 currentOffset += 1;
1649 _context2.next = 3;
1650 break;
1651
1652 case 17:
1653 if (!range) {
1654 _context2.next = 22;
1655 break;
1656 }
1657
1658 range.setEnd(node, currentOffset);
1659 _context2.next = 21;
1660 return range;
1661
1662 case 21:
1663 range = undefined;
1664
1665 case 22:
1666 case "end":
1667 return _context2.stop();
1668 }
1669 }
1670 }, _marked2, this);
1671 }
1672
1673 function letters(wordRange) {
1674 var currentText, max, currentOffset, range;
1675 return _regenerator.default.wrap(function letters$(_context3) {
1676 while (1) {
1677 switch (_context3.prev = _context3.next) {
1678 case 0:
1679 currentText = wordRange.startContainer;
1680 max = currentText.length;
1681 currentOffset = wordRange.startOffset; // let currentLetter;
1682
1683 case 3:
1684 if (!(currentOffset < max)) {
1685 _context3.next = 12;
1686 break;
1687 }
1688
1689 // currentLetter = currentText[currentOffset];
1690 range = document.createRange();
1691 range.setStart(currentText, currentOffset);
1692 range.setEnd(currentText, currentOffset + 1);
1693 _context3.next = 9;
1694 return range;
1695
1696 case 9:
1697 currentOffset += 1;
1698 _context3.next = 3;
1699 break;
1700
1701 case 12:
1702 case "end":
1703 return _context3.stop();
1704 }
1705 }
1706 }, _marked3, this);
1707 }
1708
1709 function isContainer(node) {
1710 var container;
1711
1712 if (typeof node.tagName === "undefined") {
1713 return true;
1714 }
1715
1716 if (node.style.display === "none") {
1717 return false;
1718 }
1719
1720 switch (node.tagName) {
1721 // Inline
1722 case "A":
1723 case "ABBR":
1724 case "ACRONYM":
1725 case "B":
1726 case "BDO":
1727 case "BIG":
1728 case "BR":
1729 case "BUTTON":
1730 case "CITE":
1731 case "CODE":
1732 case "DFN":
1733 case "EM":
1734 case "I":
1735 case "IMG":
1736 case "INPUT":
1737 case "KBD":
1738 case "LABEL":
1739 case "MAP":
1740 case "OBJECT":
1741 case "Q":
1742 case "SAMP":
1743 case "SCRIPT":
1744 case "SELECT":
1745 case "SMALL":
1746 case "SPAN":
1747 case "STRONG":
1748 case "SUB":
1749 case "SUP":
1750 case "TEXTAREA":
1751 case "TIME":
1752 case "TT":
1753 case "VAR":
1754 case "P":
1755 case "H1":
1756 case "H2":
1757 case "H3":
1758 case "H4":
1759 case "H5":
1760 case "H6":
1761 case "FIGCAPTION":
1762 case "BLOCKQUOTE":
1763 case "PRE":
1764 case "LI":
1765 case "TR":
1766 case "DT":
1767 case "DD":
1768 case "VIDEO":
1769 case "CANVAS":
1770 container = false;
1771 break;
1772
1773 default:
1774 container = true;
1775 }
1776
1777 return container;
1778 }
1779
1780 function cloneNode(n) {
1781 var deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1782 return n.cloneNode(deep);
1783 }
1784
1785 function findElement(node, doc) {
1786 var ref = node.getAttribute("data-ref");
1787 return findRef(ref, doc);
1788 }
1789
1790 function findRef(ref, doc) {
1791 return doc.querySelector("[data-ref='".concat(ref, "']"));
1792 }
1793
1794 function validNode(node) {
1795 if (isText(node)) {
1796 return true;
1797 }
1798
1799 if (isElement(node) && node.dataset.ref) {
1800 return true;
1801 }
1802
1803 return false;
1804 }
1805
1806 function prevValidNode(node) {
1807 while (!validNode(node)) {
1808 if (node.previousSibling) {
1809 node = node.previousSibling;
1810 } else {
1811 node = node.parentNode;
1812 }
1813
1814 if (!node) {
1815 break;
1816 }
1817 }
1818
1819 return node;
1820 }
1821
1822 function nextValidNode(node) {
1823 while (!validNode(node)) {
1824 if (node.nextSibling) {
1825 node = node.nextSibling;
1826 } else {
1827 node = node.parentNode.nextSibling;
1828 }
1829
1830 if (!node) {
1831 break;
1832 }
1833 }
1834
1835 return node;
1836 }
1837
1838 function indexOf(node) {
1839 var parent = node.parentNode;
1840
1841 if (!parent) {
1842 return 0;
1843 }
1844
1845 return Array.prototype.indexOf.call(parent.childNodes, node);
1846 }
1847
1848 function child(node, index) {
1849 return node.childNodes[index];
1850 }
1851
1852 function isVisible(node) {
1853 if (isElement(node) && window.getComputedStyle(node).display !== "none") {
1854 return true;
1855 } else if (isText(node) && hasTextContent(node) && window.getComputedStyle(node.parentNode).display !== "none") {
1856 return true;
1857 }
1858
1859 return false;
1860 }
1861
1862 function hasContent(node) {
1863 if (isElement(node)) {
1864 return true;
1865 } else if (isText(node) && node.textContent.trim().length) {
1866 return true;
1867 }
1868
1869 return false;
1870 }
1871
1872 function hasTextContent(node) {
1873 if (isElement(node)) {
1874 var _child;
1875
1876 for (var i = 0; i < node.childNodes.length; i++) {
1877 _child = node.childNodes[i];
1878
1879 if (_child && isText(_child) && _child.textContent.trim().length) {
1880 return true;
1881 }
1882 }
1883 } else if (isText(node) && node.textContent.trim().length) {
1884 return true;
1885 }
1886
1887 return false;
1888 }
1889
1890 function indexOfTextNode(node, parent) {
1891 if (!isText(node)) {
1892 return -1;
1893 }
1894
1895 var nodeTextContent = node.textContent;
1896 var child;
1897 var index = -1;
1898
1899 for (var i = 0; i < parent.childNodes.length; i++) {
1900 child = parent.childNodes[i];
1901
1902 if (child.nodeType === 3) {
1903 var text = parent.childNodes[i].textContent;
1904
1905 if (text.includes(nodeTextContent)) {
1906 index = i;
1907 break;
1908 }
1909 }
1910 }
1911
1912 return index;
1913 }
1914 });
1915
1916 unwrapExports(dom);
1917 var dom_1 = dom.isElement;
1918 var dom_2 = dom.isText;
1919 var dom_3 = dom.walk;
1920 var dom_4 = dom.nodeAfter;
1921 var dom_5 = dom.nodeBefore;
1922 var dom_6 = dom.elementAfter;
1923 var dom_7 = dom.elementBefore;
1924 var dom_8 = dom.stackChildren;
1925 var dom_9 = dom.rebuildAncestors;
1926 var dom_10 = dom.needsBreakBefore;
1927 var dom_11 = dom.needsBreakAfter;
1928 var dom_12 = dom.needsPreviousBreakAfter;
1929 var dom_13 = dom.needsPageBreak;
1930 var dom_14 = dom.words;
1931 var dom_15 = dom.letters;
1932 var dom_16 = dom.isContainer;
1933 var dom_17 = dom.cloneNode;
1934 var dom_18 = dom.findElement;
1935 var dom_19 = dom.findRef;
1936 var dom_20 = dom.validNode;
1937 var dom_21 = dom.prevValidNode;
1938 var dom_22 = dom.nextValidNode;
1939 var dom_23 = dom.indexOf;
1940 var dom_24 = dom.child;
1941 var dom_25 = dom.isVisible;
1942 var dom_26 = dom.hasContent;
1943 var dom_27 = dom.hasTextContent;
1944 var dom_28 = dom.indexOfTextNode;
1945
1946 var isImplemented = function () {
1947 var assign = Object.assign, obj;
1948 if (typeof assign !== "function") return false;
1949 obj = { foo: "raz" };
1950 assign(obj, { bar: "dwa" }, { trzy: "trzy" });
1951 return (obj.foo + obj.bar + obj.trzy) === "razdwatrzy";
1952 };
1953
1954 var isImplemented$1 = function () {
1955 try {
1956 return true;
1957 } catch (e) {
1958 return false;
1959 }
1960 };
1961
1962 // eslint-disable-next-line no-empty-function
1963 var noop = function () {};
1964
1965 var _undefined = noop(); // Support ES3 engines
1966
1967 var isValue = function (val) {
1968 return (val !== _undefined) && (val !== null);
1969 };
1970
1971 var keys = Object.keys;
1972
1973 var shim = function (object) {
1974 return keys(isValue(object) ? Object(object) : object);
1975 };
1976
1977 var keys$1 = isImplemented$1()
1978 ? Object.keys
1979 : shim;
1980
1981 var validValue = function (value) {
1982 if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
1983 return value;
1984 };
1985
1986 var max = Math.max;
1987
1988 var shim$1 = function (dest, src /*, …srcn*/) {
1989 var error, i, length = max(arguments.length, 2), assign;
1990 dest = Object(validValue(dest));
1991 assign = function (key) {
1992 try {
1993 dest[key] = src[key];
1994 } catch (e) {
1995 if (!error) error = e;
1996 }
1997 };
1998 for (i = 1; i < length; ++i) {
1999 src = arguments[i];
2000 keys$1(src).forEach(assign);
2001 }
2002 if (error !== undefined) throw error;
2003 return dest;
2004 };
2005
2006 var assign = isImplemented()
2007 ? Object.assign
2008 : shim$1;
2009
2010 var forEach = Array.prototype.forEach, create = Object.create;
2011
2012 var process = function (src, obj) {
2013 var key;
2014 for (key in src) obj[key] = src[key];
2015 };
2016
2017 // eslint-disable-next-line no-unused-vars
2018 var normalizeOptions = function (opts1 /*, …options*/) {
2019 var result = create(null);
2020 forEach.call(arguments, function (options) {
2021 if (!isValue(options)) return;
2022 process(Object(options), result);
2023 });
2024 return result;
2025 };
2026
2027 // Deprecated
2028
2029 var isCallable = function (obj) {
2030 return typeof obj === "function";
2031 };
2032
2033 var str = "razdwatrzy";
2034
2035 var isImplemented$2 = function () {
2036 if (typeof str.contains !== "function") return false;
2037 return (str.contains("dwa") === true) && (str.contains("foo") === false);
2038 };
2039
2040 var indexOf = String.prototype.indexOf;
2041
2042 var shim$2 = function (searchString/*, position*/) {
2043 return indexOf.call(this, searchString, arguments[1]) > -1;
2044 };
2045
2046 var contains = isImplemented$2()
2047 ? String.prototype.contains
2048 : shim$2;
2049
2050 var d_1 = createCommonjsModule(function (module) {
2051
2052 var d;
2053
2054 d = module.exports = function (dscr, value/*, options*/) {
2055 var c, e, w, options, desc;
2056 if ((arguments.length < 2) || (typeof dscr !== 'string')) {
2057 options = value;
2058 value = dscr;
2059 dscr = null;
2060 } else {
2061 options = arguments[2];
2062 }
2063 if (dscr == null) {
2064 c = w = true;
2065 e = false;
2066 } else {
2067 c = contains.call(dscr, 'c');
2068 e = contains.call(dscr, 'e');
2069 w = contains.call(dscr, 'w');
2070 }
2071
2072 desc = { value: value, configurable: c, enumerable: e, writable: w };
2073 return !options ? desc : assign(normalizeOptions(options), desc);
2074 };
2075
2076 d.gs = function (dscr, get, set/*, options*/) {
2077 var c, e, options, desc;
2078 if (typeof dscr !== 'string') {
2079 options = set;
2080 set = get;
2081 get = dscr;
2082 dscr = null;
2083 } else {
2084 options = arguments[3];
2085 }
2086 if (get == null) {
2087 get = undefined;
2088 } else if (!isCallable(get)) {
2089 options = get;
2090 get = set = undefined;
2091 } else if (set == null) {
2092 set = undefined;
2093 } else if (!isCallable(set)) {
2094 options = set;
2095 set = undefined;
2096 }
2097 if (dscr == null) {
2098 c = true;
2099 e = false;
2100 } else {
2101 c = contains.call(dscr, 'c');
2102 e = contains.call(dscr, 'e');
2103 }
2104
2105 desc = { get: get, set: set, configurable: c, enumerable: e };
2106 return !options ? desc : assign(normalizeOptions(options), desc);
2107 };
2108 });
2109
2110 var validCallable = function (fn) {
2111 if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
2112 return fn;
2113 };
2114
2115 var eventEmitter = createCommonjsModule(function (module, exports) {
2116
2117 var apply = Function.prototype.apply, call = Function.prototype.call
2118 , create = Object.create, defineProperty = Object.defineProperty
2119 , defineProperties = Object.defineProperties
2120 , hasOwnProperty = Object.prototype.hasOwnProperty
2121 , descriptor = { configurable: true, enumerable: false, writable: true }
2122
2123 , on, once, off, emit, methods, descriptors, base;
2124
2125 on = function (type, listener) {
2126 var data;
2127
2128 validCallable(listener);
2129
2130 if (!hasOwnProperty.call(this, '__ee__')) {
2131 data = descriptor.value = create(null);
2132 defineProperty(this, '__ee__', descriptor);
2133 descriptor.value = null;
2134 } else {
2135 data = this.__ee__;
2136 }
2137 if (!data[type]) data[type] = listener;
2138 else if (typeof data[type] === 'object') data[type].push(listener);
2139 else data[type] = [data[type], listener];
2140
2141 return this;
2142 };
2143
2144 once = function (type, listener) {
2145 var once, self;
2146
2147 validCallable(listener);
2148 self = this;
2149 on.call(this, type, once = function () {
2150 off.call(self, type, once);
2151 apply.call(listener, this, arguments);
2152 });
2153
2154 once.__eeOnceListener__ = listener;
2155 return this;
2156 };
2157
2158 off = function (type, listener) {
2159 var data, listeners, candidate, i;
2160
2161 validCallable(listener);
2162
2163 if (!hasOwnProperty.call(this, '__ee__')) return this;
2164 data = this.__ee__;
2165 if (!data[type]) return this;
2166 listeners = data[type];
2167
2168 if (typeof listeners === 'object') {
2169 for (i = 0; (candidate = listeners[i]); ++i) {
2170 if ((candidate === listener) ||
2171 (candidate.__eeOnceListener__ === listener)) {
2172 if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
2173 else listeners.splice(i, 1);
2174 }
2175 }
2176 } else {
2177 if ((listeners === listener) ||
2178 (listeners.__eeOnceListener__ === listener)) {
2179 delete data[type];
2180 }
2181 }
2182
2183 return this;
2184 };
2185
2186 emit = function (type) {
2187 var i, l, listener, listeners, args;
2188
2189 if (!hasOwnProperty.call(this, '__ee__')) return;
2190 listeners = this.__ee__[type];
2191 if (!listeners) return;
2192
2193 if (typeof listeners === 'object') {
2194 l = arguments.length;
2195 args = new Array(l - 1);
2196 for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
2197
2198 listeners = listeners.slice();
2199 for (i = 0; (listener = listeners[i]); ++i) {
2200 apply.call(listener, this, args);
2201 }
2202 } else {
2203 switch (arguments.length) {
2204 case 1:
2205 call.call(listeners, this);
2206 break;
2207 case 2:
2208 call.call(listeners, this, arguments[1]);
2209 break;
2210 case 3:
2211 call.call(listeners, this, arguments[1], arguments[2]);
2212 break;
2213 default:
2214 l = arguments.length;
2215 args = new Array(l - 1);
2216 for (i = 1; i < l; ++i) {
2217 args[i - 1] = arguments[i];
2218 }
2219 apply.call(listeners, this, args);
2220 }
2221 }
2222 };
2223
2224 methods = {
2225 on: on,
2226 once: once,
2227 off: off,
2228 emit: emit
2229 };
2230
2231 descriptors = {
2232 on: d_1(on),
2233 once: d_1(once),
2234 off: d_1(off),
2235 emit: d_1(emit)
2236 };
2237
2238 base = defineProperties({}, descriptors);
2239
2240 module.exports = exports = function (o) {
2241 return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
2242 };
2243 exports.methods = methods;
2244 });
2245 var eventEmitter_1 = eventEmitter.methods;
2246
2247 var hook = createCommonjsModule(function (module, exports) {
2248
2249
2250
2251 Object.defineProperty(exports, "__esModule", {
2252 value: true
2253 });
2254 exports.default = void 0;
2255
2256 var _classCallCheck2 = interopRequireDefault(classCallCheck);
2257
2258 var _createClass2 = interopRequireDefault(createClass);
2259
2260 /**
2261 * Hooks allow for injecting functions that must all complete in order before finishing
2262 * They will execute in parallel but all must finish before continuing
2263 * Functions may return a promise if they are asycn.
2264 * From epubjs/src/utils/hooks
2265 * @param {any} context scope of this
2266 * @example this.content = new Hook(this);
2267 */
2268 var Hook =
2269 /*#__PURE__*/
2270 function () {
2271 function Hook(context) {
2272 (0, _classCallCheck2.default)(this, Hook);
2273 this.context = context || this;
2274 this.hooks = [];
2275 }
2276 /**
2277 * Adds a function to be run before a hook completes
2278 * @example this.content.register(function(){...});
2279 * @return {undefined} void
2280 */
2281
2282
2283 (0, _createClass2.default)(Hook, [{
2284 key: "register",
2285 value: function register() {
2286 for (var i = 0; i < arguments.length; ++i) {
2287 if (typeof arguments[i] === "function") {
2288 this.hooks.push(arguments[i]);
2289 } else {
2290 // unpack array
2291 for (var j = 0; j < arguments[i].length; ++j) {
2292 this.hooks.push(arguments[i][j]);
2293 }
2294 }
2295 }
2296 }
2297 /**
2298 * Triggers a hook to run all functions
2299 * @example this.content.trigger(args).then(function(){...});
2300 * @return {undefined} void
2301 */
2302
2303 }, {
2304 key: "trigger",
2305 value: function trigger() {
2306 var args = arguments;
2307 var context = this.context;
2308 var promises = [];
2309 this.hooks.forEach(function (task) {
2310 var executing = task.apply(context, args);
2311
2312 if (executing && typeof executing["then"] === "function") {
2313 // Task is a function that returns a promise
2314 promises.push(executing);
2315 } // Otherwise Task resolves immediately, continue
2316
2317 });
2318 return Promise.all(promises);
2319 } // Adds a function to be run before a hook completes
2320
2321 }, {
2322 key: "list",
2323 value: function list() {
2324 return this.hooks;
2325 }
2326 }, {
2327 key: "clear",
2328 value: function clear() {
2329 return this.hooks = [];
2330 }
2331 }]);
2332 return Hook;
2333 }();
2334
2335 var _default = Hook;
2336 exports.default = _default;
2337 });
2338
2339 unwrapExports(hook);
2340
2341 var layout = createCommonjsModule(function (module, exports) {
2342
2343
2344
2345 Object.defineProperty(exports, "__esModule", {
2346 value: true
2347 });
2348 exports.default = void 0;
2349
2350 var _regenerator = interopRequireDefault(regenerator);
2351
2352 var _asyncToGenerator2 = interopRequireDefault(asyncToGenerator);
2353
2354 var _classCallCheck2 = interopRequireDefault(classCallCheck);
2355
2356 var _createClass2 = interopRequireDefault(createClass);
2357
2358
2359
2360
2361
2362 var _eventEmitter = interopRequireDefault(eventEmitter);
2363
2364 var _hook = interopRequireDefault(hook);
2365
2366 var MAX_CHARS_PER_BREAK = 1500;
2367 /**
2368 * Layout
2369 * @class
2370 */
2371
2372 var Layout =
2373 /*#__PURE__*/
2374 function () {
2375 function Layout(element, hooks, maxChars) {
2376 (0, _classCallCheck2.default)(this, Layout);
2377 this.element = element;
2378 this.bounds = this.element.getBoundingClientRect();
2379
2380 if (hooks) {
2381 this.hooks = hooks;
2382 } else {
2383 this.hooks = {};
2384 this.hooks.layout = new _hook.default();
2385 this.hooks.renderNode = new _hook.default();
2386 this.hooks.layoutNode = new _hook.default();
2387 this.hooks.overflow = new _hook.default();
2388 }
2389
2390 this.maxChars = maxChars || MAX_CHARS_PER_BREAK;
2391 }
2392
2393 (0, _createClass2.default)(Layout, [{
2394 key: "renderTo",
2395 value: function () {
2396 var _renderTo = (0, _asyncToGenerator2.default)(
2397 /*#__PURE__*/
2398 _regenerator.default.mark(function _callee(wrapper, source, breakToken) {
2399 var bounds,
2400 start,
2401 walker,
2402 node,
2403 done,
2404 next,
2405 hasRenderedContent,
2406 newBreakToken,
2407 length,
2408 imgs,
2409 _imgs,
2410 shallow,
2411 rendered,
2412 _imgs2,
2413 _args = arguments;
2414
2415 return _regenerator.default.wrap(function _callee$(_context) {
2416 while (1) {
2417 switch (_context.prev = _context.next) {
2418 case 0:
2419 bounds = _args.length > 3 && _args[3] !== undefined ? _args[3] : this.bounds;
2420 start = this.getStart(source, breakToken);
2421 walker = (0, dom.walk)(start, source);
2422 hasRenderedContent = false;
2423 length = 0;
2424
2425 case 5:
2426 if (!(!done && !newBreakToken)) {
2427 _context.next = 43;
2428 break;
2429 }
2430
2431 next = walker.next();
2432 node = next.value;
2433 done = next.done;
2434
2435 if (node) {
2436 _context.next = 17;
2437 break;
2438 }
2439
2440 this.hooks && this.hooks.layout.trigger(wrapper, this);
2441 imgs = wrapper.querySelectorAll("img");
2442
2443 if (!imgs.length) {
2444 _context.next = 15;
2445 break;
2446 }
2447
2448 _context.next = 15;
2449 return this.waitForImages(imgs);
2450
2451 case 15:
2452 newBreakToken = this.findBreakToken(wrapper, source, bounds);
2453 return _context.abrupt("return", newBreakToken);
2454
2455 case 17:
2456 this.hooks && this.hooks.layoutNode.trigger(node); // Check if the rendered element has a break set
2457
2458 if (!(hasRenderedContent && this.shouldBreak(node))) {
2459 _context.next = 28;
2460 break;
2461 }
2462
2463 this.hooks && this.hooks.layout.trigger(wrapper, this);
2464 _imgs = wrapper.querySelectorAll("img");
2465
2466 if (!_imgs.length) {
2467 _context.next = 24;
2468 break;
2469 }
2470
2471 _context.next = 24;
2472 return this.waitForImages(_imgs);
2473
2474 case 24:
2475 newBreakToken = this.findBreakToken(wrapper, source, bounds);
2476
2477 if (!newBreakToken) {
2478 newBreakToken = this.breakAt(node);
2479 }
2480
2481 length = 0;
2482 return _context.abrupt("break", 43);
2483
2484 case 28:
2485 // Should the Node be a shallow or deep clone
2486 shallow = (0, dom.isContainer)(node);
2487 rendered = this.append(node, wrapper, breakToken, shallow);
2488 length += rendered.textContent.length; // Check if layout has content yet
2489
2490 if (!hasRenderedContent) {
2491 hasRenderedContent = (0, dom.hasContent)(node);
2492 } // Skip to the next node if a deep clone was rendered
2493
2494
2495 if (!shallow) {
2496 walker = (0, dom.walk)((0, dom.nodeAfter)(node, source), source);
2497 } // Only check x characters
2498
2499
2500 if (!(length >= this.maxChars)) {
2501 _context.next = 41;
2502 break;
2503 }
2504
2505 this.hooks && this.hooks.layout.trigger(wrapper, this);
2506 _imgs2 = wrapper.querySelectorAll("img");
2507
2508 if (!_imgs2.length) {
2509 _context.next = 39;
2510 break;
2511 }
2512
2513 _context.next = 39;
2514 return this.waitForImages(_imgs2);
2515
2516 case 39:
2517 newBreakToken = this.findBreakToken(wrapper, source, bounds);
2518
2519 if (newBreakToken) {
2520 length = 0;
2521 }
2522
2523 case 41:
2524 _context.next = 5;
2525 break;
2526
2527 case 43:
2528 return _context.abrupt("return", newBreakToken);
2529
2530 case 44:
2531 case "end":
2532 return _context.stop();
2533 }
2534 }
2535 }, _callee, this);
2536 }));
2537
2538 return function renderTo(_x, _x2, _x3) {
2539 return _renderTo.apply(this, arguments);
2540 };
2541 }()
2542 }, {
2543 key: "breakAt",
2544 value: function breakAt(node) {
2545 var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2546 return {
2547 node: node,
2548 offset: offset
2549 };
2550 }
2551 }, {
2552 key: "shouldBreak",
2553 value: function shouldBreak(node) {
2554 var previousSibling = node.previousSibling;
2555 var parentNode = node.parentNode;
2556 var parentBreakBefore = (0, dom.needsBreakBefore)(node) && parentNode && !previousSibling && (0, dom.needsBreakBefore)(parentNode);
2557 var doubleBreakBefore;
2558
2559 if (parentBreakBefore) {
2560 doubleBreakBefore = node.dataset.breakBefore === parentNode.dataset.breakBefore;
2561 }
2562
2563 return !doubleBreakBefore && (0, dom.needsBreakBefore)(node) || (0, dom.needsPreviousBreakAfter)(node) || (0, dom.needsPageBreak)(node);
2564 }
2565 }, {
2566 key: "getStart",
2567 value: function getStart(source, breakToken) {
2568 var start;
2569 var node = breakToken && breakToken.node;
2570
2571 if (node) {
2572 start = node;
2573 } else {
2574 start = source.firstChild;
2575 }
2576
2577 return start;
2578 }
2579 }, {
2580 key: "append",
2581 value: function append(node, dest, breakToken) {
2582 var shallow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
2583 var rebuild = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
2584 var clone = (0, dom.cloneNode)(node, !shallow);
2585
2586 if (node.parentNode && (0, dom.isElement)(node.parentNode)) {
2587 var parent = (0, dom.findElement)(node.parentNode, dest); // Rebuild chain
2588
2589 if (parent) {
2590 parent.appendChild(clone);
2591 } else if (rebuild) {
2592 var fragment = (0, dom.rebuildAncestors)(node);
2593 parent = (0, dom.findElement)(node.parentNode, fragment);
2594
2595 if (!parent) {
2596 dest.appendChild(clone);
2597 } else if (breakToken && (0, dom.isText)(breakToken.node) && breakToken.offset > 0) {
2598 clone.textContent = clone.textContent.substring(breakToken.offset);
2599 parent.appendChild(clone);
2600 } else {
2601 parent.appendChild(clone);
2602 }
2603
2604 dest.appendChild(fragment);
2605 } else {
2606 dest.appendChild(clone);
2607 }
2608 } else {
2609 dest.appendChild(clone);
2610 }
2611
2612 this.hooks && this.hooks.renderNode.trigger(clone);
2613 return clone;
2614 }
2615 }, {
2616 key: "waitForImages",
2617 value: function () {
2618 var _waitForImages = (0, _asyncToGenerator2.default)(
2619 /*#__PURE__*/
2620 _regenerator.default.mark(function _callee3(imgs) {
2621 var _this = this;
2622
2623 var results;
2624 return _regenerator.default.wrap(function _callee3$(_context3) {
2625 while (1) {
2626 switch (_context3.prev = _context3.next) {
2627 case 0:
2628 results = Array.from(imgs).map(
2629 /*#__PURE__*/
2630 function () {
2631 var _ref = (0, _asyncToGenerator2.default)(
2632 /*#__PURE__*/
2633 _regenerator.default.mark(function _callee2(img) {
2634 return _regenerator.default.wrap(function _callee2$(_context2) {
2635 while (1) {
2636 switch (_context2.prev = _context2.next) {
2637 case 0:
2638 return _context2.abrupt("return", _this.awaitImageLoaded(img));
2639
2640 case 1:
2641 case "end":
2642 return _context2.stop();
2643 }
2644 }
2645 }, _callee2, this);
2646 }));
2647
2648 return function (_x5) {
2649 return _ref.apply(this, arguments);
2650 };
2651 }());
2652 _context3.next = 3;
2653 return Promise.all(results);
2654
2655 case 3:
2656 case "end":
2657 return _context3.stop();
2658 }
2659 }
2660 }, _callee3, this);
2661 }));
2662
2663 return function waitForImages(_x4) {
2664 return _waitForImages.apply(this, arguments);
2665 };
2666 }()
2667 }, {
2668 key: "awaitImageLoaded",
2669 value: function () {
2670 var _awaitImageLoaded = (0, _asyncToGenerator2.default)(
2671 /*#__PURE__*/
2672 _regenerator.default.mark(function _callee4(image) {
2673 return _regenerator.default.wrap(function _callee4$(_context4) {
2674 while (1) {
2675 switch (_context4.prev = _context4.next) {
2676 case 0:
2677 return _context4.abrupt("return", new Promise(function (resolve) {
2678 if (image.complete !== true) {
2679 image.onload = function () {
2680 var _window$getComputedSt = window.getComputedStyle(image),
2681 width = _window$getComputedSt.width,
2682 height = _window$getComputedSt.height;
2683
2684 resolve(width, height);
2685 };
2686
2687 image.onerror = function (e) {
2688 var _window$getComputedSt2 = window.getComputedStyle(image),
2689 width = _window$getComputedSt2.width,
2690 height = _window$getComputedSt2.height;
2691
2692 resolve(width, height, e);
2693 };
2694 } else {
2695 var _window$getComputedSt3 = window.getComputedStyle(image),
2696 width = _window$getComputedSt3.width,
2697 height = _window$getComputedSt3.height;
2698
2699 resolve(width, height);
2700 }
2701 }));
2702
2703 case 1:
2704 case "end":
2705 return _context4.stop();
2706 }
2707 }
2708 }, _callee4, this);
2709 }));
2710
2711 return function awaitImageLoaded(_x6) {
2712 return _awaitImageLoaded.apply(this, arguments);
2713 };
2714 }()
2715 }, {
2716 key: "avoidBreakInside",
2717 value: function avoidBreakInside(node, limiter) {
2718 var breakNode;
2719
2720 if (node === limiter) {
2721 return;
2722 }
2723
2724 while (node.parentNode) {
2725 node = node.parentNode;
2726
2727 if (node === limiter) {
2728 break;
2729 }
2730
2731 if (window.getComputedStyle(node)["break-inside"] === "avoid") {
2732 breakNode = node;
2733 break;
2734 }
2735 }
2736
2737 return breakNode;
2738 }
2739 }, {
2740 key: "createBreakToken",
2741 value: function createBreakToken(overflow, rendered, source) {
2742 var container = overflow.startContainer;
2743 var offset = overflow.startOffset;
2744 var node, renderedNode, parent, index, temp;
2745
2746 if ((0, dom.isElement)(container)) {
2747 temp = (0, dom.child)(container, offset);
2748
2749 if ((0, dom.isElement)(temp)) {
2750 renderedNode = (0, dom.findElement)(temp, rendered);
2751
2752 if (!renderedNode) {
2753 // Find closest element with data-ref
2754 renderedNode = (0, dom.findElement)((0, dom.prevValidNode)(temp), rendered);
2755 return;
2756 }
2757
2758 node = (0, dom.findElement)(renderedNode, source);
2759 offset = 0;
2760 } else {
2761 renderedNode = (0, dom.findElement)(container, rendered);
2762
2763 if (!renderedNode) {
2764 renderedNode = (0, dom.findElement)((0, dom.prevValidNode)(container), rendered);
2765 }
2766
2767 parent = (0, dom.findElement)(renderedNode, source);
2768 index = (0, dom.indexOfTextNode)(temp, parent);
2769 node = (0, dom.child)(parent, index);
2770 offset = 0;
2771 }
2772 } else {
2773 renderedNode = (0, dom.findElement)(container.parentNode, rendered);
2774
2775 if (!renderedNode) {
2776 renderedNode = (0, dom.findElement)((0, dom.prevValidNode)(container.parentNode), rendered);
2777 }
2778
2779 parent = (0, dom.findElement)(renderedNode, source);
2780 index = (0, dom.indexOfTextNode)(container, parent);
2781
2782 if (index === -1) {
2783 return;
2784 }
2785
2786 node = (0, dom.child)(parent, index);
2787 offset += node.textContent.indexOf(container.textContent);
2788 }
2789
2790 if (!node) {
2791 return;
2792 }
2793
2794 return {
2795 node: node,
2796 offset: offset
2797 };
2798 }
2799 }, {
2800 key: "findBreakToken",
2801 value: function findBreakToken(rendered, source) {
2802 var bounds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.bounds;
2803 var extract = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
2804 var overflow = this.findOverflow(rendered, bounds);
2805 var breakToken;
2806
2807 if (overflow) {
2808 breakToken = this.createBreakToken(overflow, rendered, source);
2809
2810 if (breakToken && breakToken.node && extract) {
2811 this.removeOverflow(overflow);
2812 }
2813 }
2814
2815 return breakToken;
2816 }
2817 }, {
2818 key: "hasOverflow",
2819 value: function hasOverflow(element) {
2820 var bounds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.bounds;
2821 var constrainingElement = element && element.parentNode; // this gets the element, instead of the wrapper for the width workaround
2822
2823 var _element$getBoundingC = element.getBoundingClientRect(),
2824 width = _element$getBoundingC.width;
2825
2826 var scrollWidth = constrainingElement ? constrainingElement.scrollWidth : 0;
2827 return Math.max(Math.floor(width), scrollWidth) > Math.round(bounds.width);
2828 }
2829 }, {
2830 key: "findOverflow",
2831 value: function findOverflow(rendered) {
2832 var bounds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.bounds;
2833 if (!this.hasOverflow(rendered, bounds)) return;
2834 var start = Math.round(bounds.left);
2835 var end = Math.round(bounds.right);
2836 var range;
2837 var walker = (0, dom.walk)(rendered.firstChild, rendered); // Find Start
2838
2839 var next, done, node, offset, skip, breakAvoid, prev, br;
2840
2841 while (!done) {
2842 next = walker.next();
2843 done = next.done;
2844 node = next.value;
2845 skip = false;
2846 breakAvoid = false;
2847 prev = undefined;
2848 br = undefined;
2849
2850 if (node) {
2851 var pos = (0, utils.getBoundingClientRect)(node);
2852 var left = Math.floor(pos.left);
2853 var right = Math.floor(pos.right);
2854
2855 if (!range && left >= end) {
2856 // Check if it is a float
2857 var isFloat = false;
2858
2859 if ((0, dom.isElement)(node)) {
2860 var styles = window.getComputedStyle(node);
2861 isFloat = styles.getPropertyValue("float") !== "none";
2862 skip = styles.getPropertyValue("break-inside") === "avoid";
2863 breakAvoid = node.dataset.breakBefore === "avoid" || node.dataset.previousBreakAfter === "avoid";
2864 prev = breakAvoid && (0, dom.nodeBefore)(node, rendered);
2865 br = node.tagName === "BR" || node.tagName === "WBR";
2866 }
2867
2868 if (prev) {
2869 range = document.createRange();
2870 range.setStartBefore(prev);
2871 break;
2872 }
2873
2874 if (!br && !isFloat && (0, dom.isElement)(node)) {
2875 range = document.createRange();
2876 range.setStartBefore(node);
2877 break;
2878 }
2879
2880 if ((0, dom.isText)(node) && node.textContent.trim().length) {
2881 range = document.createRange();
2882 range.setStartBefore(node);
2883 break;
2884 }
2885 }
2886
2887 if (!range && (0, dom.isText)(node) && node.textContent.trim().length && window.getComputedStyle(node.parentNode)["break-inside"] !== "avoid") {
2888 var rects = (0, utils.getClientRects)(node);
2889 var rect = void 0;
2890 left = 0;
2891
2892 for (var i = 0; i != rects.length; i++) {
2893 rect = rects[i];
2894
2895 if (rect.width > 0 && (!left || rect.left > left)) {
2896 left = rect.left;
2897 }
2898 }
2899
2900 if (left >= end) {
2901 range = document.createRange();
2902 offset = this.textBreak(node, start, end);
2903
2904 if (!offset) {
2905 range = undefined;
2906 } else {
2907 range.setStart(node, offset);
2908 }
2909
2910 break;
2911 }
2912 } // Skip children
2913
2914
2915 if (skip || right < end) {
2916 next = (0, dom.nodeAfter)(node, rendered);
2917
2918 if (next) {
2919 walker = (0, dom.walk)(next, rendered);
2920 }
2921 }
2922 }
2923 } // Find End
2924
2925
2926 if (range) {
2927 range.setEndAfter(rendered.lastChild);
2928 return range;
2929 }
2930 }
2931 }, {
2932 key: "findEndToken",
2933 value: function findEndToken(rendered, source) {
2934 var bounds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.bounds;
2935
2936 if (rendered.childNodes.length === 0) {
2937 return;
2938 }
2939
2940 var lastChild = rendered.lastChild;
2941 var lastNodeIndex;
2942
2943 while (lastChild && lastChild.lastChild) {
2944 if (!(0, dom.validNode)(lastChild)) {
2945 // Only get elements with refs
2946 lastChild = lastChild.previousSibling;
2947 } else if (!(0, dom.validNode)(lastChild.lastChild)) {
2948 // Deal with invalid dom items
2949 lastChild = (0, dom.prevValidNode)(lastChild.lastChild);
2950 break;
2951 } else {
2952 lastChild = lastChild.lastChild;
2953 }
2954 }
2955
2956 if ((0, dom.isText)(lastChild)) {
2957 if (lastChild.parentNode.dataset.ref) {
2958 lastNodeIndex = (0, dom.indexOf)(lastChild);
2959 lastChild = lastChild.parentNode;
2960 } else {
2961 lastChild = lastChild.previousSibling;
2962 }
2963 }
2964
2965 var original = (0, dom.findElement)(lastChild, source);
2966
2967 if (lastNodeIndex) {
2968 original = original.childNodes[lastNodeIndex];
2969 }
2970
2971 var after = (0, dom.nodeAfter)(original);
2972 return this.breakAt(after);
2973 }
2974 }, {
2975 key: "textBreak",
2976 value: function textBreak(node, start, end) {
2977 var wordwalker = (0, dom.words)(node);
2978 var left = 0;
2979 var right = 0;
2980 var word, next, done, pos;
2981 var offset;
2982
2983 while (!done) {
2984 next = wordwalker.next();
2985 word = next.value;
2986 done = next.done;
2987
2988 if (!word) {
2989 break;
2990 }
2991
2992 pos = (0, utils.getBoundingClientRect)(word);
2993 left = Math.floor(pos.left);
2994 right = Math.floor(pos.right);
2995
2996 if (left >= end) {
2997 offset = word.startOffset;
2998 break;
2999 }
3000
3001 if (right > end) {
3002 var letterwalker = (0, dom.letters)(word);
3003 var letter = void 0,
3004 nextLetter = void 0,
3005 doneLetter = void 0;
3006
3007 while (!doneLetter) {
3008 nextLetter = letterwalker.next();
3009 letter = nextLetter.value;
3010 doneLetter = nextLetter.done;
3011
3012 if (!letter) {
3013 break;
3014 }
3015
3016 pos = (0, utils.getBoundingClientRect)(letter);
3017 left = Math.floor(pos.left);
3018
3019 if (left >= end) {
3020 offset = letter.startOffset;
3021 done = true;
3022 break;
3023 }
3024 }
3025 }
3026 }
3027
3028 return offset;
3029 }
3030 }, {
3031 key: "removeOverflow",
3032 value: function removeOverflow(overflow) {
3033 var startContainer = overflow.startContainer;
3034 var extracted = overflow.extractContents();
3035 this.hyphenateAtBreak(startContainer);
3036 return extracted;
3037 }
3038 }, {
3039 key: "hyphenateAtBreak",
3040 value: function hyphenateAtBreak(startContainer) {
3041 if ((0, dom.isText)(startContainer)) {
3042 var startText = startContainer.textContent;
3043 var prevLetter = startText[startText.length - 1]; // Add a hyphen if previous character is a letter or soft hyphen
3044
3045 if (/^\w|\u00AD$/.test(prevLetter)) {
3046 startContainer.parentNode.classList.add("pagedjs_hyphen");
3047 startContainer.textContent += "\u2011";
3048 }
3049 }
3050 }
3051 }]);
3052 return Layout;
3053 }();
3054
3055 (0, _eventEmitter.default)(Layout.prototype);
3056 var _default = Layout;
3057 exports.default = _default;
3058 });
3059
3060 unwrapExports(layout);
3061
3062 var page = createCommonjsModule(function (module, exports) {
3063
3064
3065
3066 Object.defineProperty(exports, "__esModule", {
3067 value: true
3068 });
3069 exports.default = void 0;
3070
3071 var _regenerator = interopRequireDefault(regenerator);
3072
3073 var _asyncToGenerator2 = interopRequireDefault(asyncToGenerator);
3074
3075 var _classCallCheck2 = interopRequireDefault(classCallCheck);
3076
3077 var _createClass2 = interopRequireDefault(createClass);
3078
3079 var _layout2 = interopRequireDefault(layout);
3080
3081 var _eventEmitter = interopRequireDefault(eventEmitter);
3082
3083 /**
3084 * Render a page
3085 * @class
3086 */
3087 var Page =
3088 /*#__PURE__*/
3089 function () {
3090 function Page(pagesArea, pageTemplate, blank, hooks) {
3091 (0, _classCallCheck2.default)(this, Page);
3092 this.pagesArea = pagesArea;
3093 this.pageTemplate = pageTemplate;
3094 this.blank = blank;
3095 this.width = undefined;
3096 this.height = undefined;
3097 this.hooks = hooks; // this.element = this.create(this.pageTemplate);
3098 }
3099
3100 (0, _createClass2.default)(Page, [{
3101 key: "create",
3102 value: function create(template, after) {
3103 //let documentFragment = document.createRange().createContextualFragment( TEMPLATE );
3104 //let page = documentFragment.children[0];
3105 var clone = document.importNode(this.pageTemplate.content, true);
3106 var page;
3107
3108 if (after) {
3109 this.pagesArea.insertBefore(clone, after.nextSibling);
3110 var index = Array.prototype.indexOf.call(this.pagesArea.children, after.nextSibling);
3111 page = this.pagesArea.children[index];
3112 } else {
3113 this.pagesArea.appendChild(clone);
3114 page = this.pagesArea.lastChild;
3115 }
3116
3117 var area = page.querySelector(".pagedjs_page_content");
3118 var size = area.getBoundingClientRect();
3119 area.style.columnWidth = Math.round(size.width) + "px";
3120 area.style.columnGap = "calc(var(--margin-right) + var(--margin-left))"; // area.style.overflow = "scroll";
3121
3122 this.width = Math.round(size.width);
3123 this.height = Math.round(size.height);
3124 this.element = page;
3125 this.area = area;
3126 return page;
3127 }
3128 }, {
3129 key: "createWrapper",
3130 value: function createWrapper() {
3131 var wrapper = document.createElement("div");
3132 this.area.appendChild(wrapper);
3133 this.wrapper = wrapper;
3134 return wrapper;
3135 }
3136 }, {
3137 key: "index",
3138 value: function index(pgnum) {
3139 this.position = pgnum;
3140 var page = this.element;
3141 var id = "page-".concat(pgnum + 1);
3142 this.id = id;
3143 page.dataset.pageNumber = pgnum + 1;
3144
3145 if (this.name) {
3146 page.classList.add("pagedjs_" + this.name + "_page");
3147 }
3148
3149 if (this.blank) {
3150 page.classList.add("pagedjs_blank_page");
3151 }
3152
3153 if (pgnum === 0) {
3154 page.classList.add("pagedjs_first_page");
3155 }
3156
3157 if (pgnum % 2 !== 1) {
3158 page.classList.remove("pagedjs_left_page");
3159 page.classList.add("pagedjs_right_page");
3160 } else {
3161 page.classList.remove("pagedjs_right_page");
3162 page.classList.add("pagedjs_left_page");
3163 }
3164 }
3165 /*
3166 size(width, height) {
3167 if (width === this.width && height === this.height) {
3168 return;
3169 }
3170 this.width = width;
3171 this.height = height;
3172 this.element.style.width = Math.round(width) + "px";
3173 this.element.style.height = Math.round(height) + "px";
3174 this.element.style.columnWidth = Math.round(width) + "px";
3175 }
3176 */
3177
3178 }, {
3179 key: "layout",
3180 value: function () {
3181 var _layout = (0, _asyncToGenerator2.default)(
3182 /*#__PURE__*/
3183 _regenerator.default.mark(function _callee(contents, breakToken, maxChars) {
3184 var newBreakToken;
3185 return _regenerator.default.wrap(function _callee$(_context) {
3186 while (1) {
3187 switch (_context.prev = _context.next) {
3188 case 0:
3189 this.clear();
3190 this.startToken = breakToken;
3191 this.layoutMethod = new _layout2.default(this.area, this.hooks, maxChars);
3192 _context.next = 5;
3193 return this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
3194
3195 case 5:
3196 newBreakToken = _context.sent;
3197 this.addListeners(contents);
3198 this.endToken = newBreakToken;
3199 return _context.abrupt("return", newBreakToken);
3200
3201 case 9:
3202 case "end":
3203 return _context.stop();
3204 }
3205 }
3206 }, _callee, this);
3207 }));
3208
3209 return function layout$$1(_x, _x2, _x3) {
3210 return _layout.apply(this, arguments);
3211 };
3212 }()
3213 }, {
3214 key: "append",
3215 value: function () {
3216 var _append = (0, _asyncToGenerator2.default)(
3217 /*#__PURE__*/
3218 _regenerator.default.mark(function _callee2(contents, breakToken) {
3219 var newBreakToken;
3220 return _regenerator.default.wrap(function _callee2$(_context2) {
3221 while (1) {
3222 switch (_context2.prev = _context2.next) {
3223 case 0:
3224 if (this.layoutMethod) {
3225 _context2.next = 2;
3226 break;
3227 }
3228
3229 return _context2.abrupt("return", this.layout(contents, breakToken));
3230
3231 case 2:
3232 _context2.next = 4;
3233 return this.layoutMethod.renderTo(this.wrapper, contents, breakToken);
3234
3235 case 4:
3236 newBreakToken = _context2.sent;
3237 this.endToken = newBreakToken;
3238 return _context2.abrupt("return", newBreakToken);
3239
3240 case 7:
3241 case "end":
3242 return _context2.stop();
3243 }
3244 }
3245 }, _callee2, this);
3246 }));
3247
3248 return function append(_x4, _x5) {
3249 return _append.apply(this, arguments);
3250 };
3251 }()
3252 }, {
3253 key: "getByParent",
3254 value: function getByParent(ref, entries) {
3255 var e;
3256
3257 for (var i = 0; i < entries.length; i++) {
3258 e = entries[i];
3259
3260 if (e.dataset.ref === ref) {
3261 return e;
3262 }
3263 }
3264 }
3265 }, {
3266 key: "onOverflow",
3267 value: function onOverflow(func) {
3268 this._onOverflow = func;
3269 }
3270 }, {
3271 key: "onUnderflow",
3272 value: function onUnderflow(func) {
3273 this._onUnderflow = func;
3274 }
3275 }, {
3276 key: "clear",
3277 value: function clear() {
3278 this.removeListeners();
3279 this.wrapper && this.wrapper.remove();
3280 this.createWrapper();
3281 }
3282 }, {
3283 key: "addListeners",
3284 value: function addListeners(contents) {
3285 if (typeof ResizeObserver !== "undefined") {
3286 this.addResizeObserver(contents);
3287 } else {
3288 this._checkOverflowAfterResize = this.checkOverflowAfterResize.bind(this, contents);
3289 this.element.addEventListener("overflow", this._checkOverflowAfterResize, false);
3290 this.element.addEventListener("underflow", this._checkOverflowAfterResize, false);
3291 } // TODO: fall back to mutation observer?
3292
3293
3294 this._onScroll = function () {
3295 if (this.listening) {
3296 this.element.scrollLeft = 0;
3297 }
3298 }.bind(this); // Keep scroll left from changing
3299
3300
3301 this.element.addEventListener("scroll", this._onScroll);
3302 this.listening = true;
3303 return true;
3304 }
3305 }, {
3306 key: "removeListeners",
3307 value: function removeListeners() {
3308 this.listening = false;
3309
3310 if (typeof ResizeObserver !== "undefined" && this.ro) {
3311 this.ro.disconnect();
3312 } else if (this.element) {
3313 this.element.removeEventListener("overflow", this._checkOverflowAfterResize, false);
3314 this.element.removeEventListener("underflow", this._checkOverflowAfterResize, false);
3315 }
3316
3317 this.element && this.element.removeEventListener("scroll", this._onScroll);
3318 }
3319 }, {
3320 key: "addResizeObserver",
3321 value: function addResizeObserver(contents) {
3322 var _this = this;
3323
3324 var wrapper = this.wrapper;
3325 var prevHeight = wrapper.getBoundingClientRect().height;
3326 this.ro = new ResizeObserver(function (entries) {
3327 if (!_this.listening) {
3328 return;
3329 }
3330
3331 var _iteratorNormalCompletion = true;
3332 var _didIteratorError = false;
3333 var _iteratorError = undefined;
3334
3335 try {
3336 for (var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
3337 var entry = _step.value;
3338 var cr = entry.contentRect;
3339
3340 if (cr.height > prevHeight) {
3341 _this.checkOverflowAfterResize(contents);
3342
3343 prevHeight = wrapper.getBoundingClientRect().height;
3344 } else if (cr.height < prevHeight) {
3345 // TODO: calc line height && (prevHeight - cr.height) >= 22
3346 _this.checkUnderflowAfterResize(contents);
3347
3348 prevHeight = cr.height;
3349 }
3350 }
3351 } catch (err) {
3352 _didIteratorError = true;
3353 _iteratorError = err;
3354 } finally {
3355 try {
3356 if (!_iteratorNormalCompletion && _iterator.return != null) {
3357 _iterator.return();
3358 }
3359 } finally {
3360 if (_didIteratorError) {
3361 throw _iteratorError;
3362 }
3363 }
3364 }
3365 });
3366 this.ro.observe(wrapper);
3367 }
3368 }, {
3369 key: "checkOverflowAfterResize",
3370 value: function checkOverflowAfterResize(contents) {
3371 if (!this.listening || !this.layoutMethod) {
3372 return;
3373 }
3374
3375 var newBreakToken = this.layoutMethod.findBreakToken(this.wrapper, contents);
3376
3377 if (newBreakToken) {
3378 this.endToken = newBreakToken;
3379 this._onOverflow && this._onOverflow(newBreakToken);
3380 }
3381 }
3382 }, {
3383 key: "checkUnderflowAfterResize",
3384 value: function checkUnderflowAfterResize(contents) {
3385 if (!this.listening || !this.layoutMethod) {
3386 return;
3387 }
3388
3389 var endToken = this.layoutMethod.findEndToken(this.wrapper, contents); // let newBreakToken = this.layoutMethod.findBreakToken(this.wrapper, contents);
3390
3391 if (endToken) {
3392 this._onUnderflow && this._onUnderflow(endToken);
3393 }
3394 }
3395 }, {
3396 key: "destroy",
3397 value: function destroy() {
3398 this.removeListeners();
3399 this.element.remove();
3400 this.element = undefined;
3401 this.wrapper = undefined;
3402 }
3403 }]);
3404 return Page;
3405 }();
3406
3407 (0, _eventEmitter.default)(Page.prototype);
3408 var _default = Page;
3409 exports.default = _default;
3410 });
3411
3412 unwrapExports(page);
3413
3414 var parser = createCommonjsModule(function (module, exports) {
3415
3416
3417
3418 Object.defineProperty(exports, "__esModule", {
3419 value: true
3420 });
3421 exports.default = void 0;
3422
3423 var _classCallCheck2 = interopRequireDefault(classCallCheck);
3424
3425 var _createClass2 = interopRequireDefault(createClass);
3426
3427
3428
3429
3430
3431 /**
3432 * Render a flow of text offscreen
3433 * @class
3434 */
3435 var ContentParser =
3436 /*#__PURE__*/
3437 function () {
3438 function ContentParser(content, cb) {
3439 (0, _classCallCheck2.default)(this, ContentParser);
3440
3441 if (content && content.nodeType) {
3442 // handle dom
3443 this.dom = this.add(content);
3444 } else if (typeof content === "string") {
3445 this.dom = this.parse(content);
3446 }
3447
3448 return this.dom;
3449 }
3450
3451 (0, _createClass2.default)(ContentParser, [{
3452 key: "parse",
3453 value: function parse(markup, mime) {
3454 var range = document.createRange();
3455 var fragment = range.createContextualFragment(markup);
3456 this.addRefs(fragment);
3457 this.removeEmpty(fragment);
3458 return fragment;
3459 }
3460 }, {
3461 key: "add",
3462 value: function add(contents) {
3463 // let fragment = document.createDocumentFragment();
3464 //
3465 // let children = [...contents.childNodes];
3466 // for (let child of children) {
3467 // let clone = child.cloneNode(true);
3468 // fragment.appendChild(clone);
3469 // }
3470 this.addRefs(contents);
3471 this.removeEmpty(contents);
3472 return contents;
3473 }
3474 }, {
3475 key: "addRefs",
3476 value: function addRefs(content) {
3477 var treeWalker = document.createTreeWalker(content, NodeFilter.SHOW_ELEMENT, {
3478 acceptNode: function acceptNode(node) {
3479 return NodeFilter.FILTER_ACCEPT;
3480 }
3481 }, false);
3482 var node = treeWalker.nextNode();
3483
3484 while (node) {
3485 if (!node.hasAttribute("data-ref")) {
3486 var uuid = (0, utils.UUID)();
3487 node.setAttribute("data-ref", uuid);
3488 }
3489
3490 if (node.id) {
3491 node.setAttribute("data-id", node.id);
3492 } // node.setAttribute("data-children", node.childNodes.length);
3493 // node.setAttribute("data-text", node.textContent.trim().length);
3494
3495
3496 node = treeWalker.nextNode();
3497 }
3498 }
3499 }, {
3500 key: "removeEmpty",
3501 value: function removeEmpty(content) {
3502 var treeWalker = document.createTreeWalker(content, NodeFilter.SHOW_TEXT, {
3503 acceptNode: function acceptNode(node) {
3504 // Only remove more than a single space
3505 if (node.textContent.length > 1 && !node.textContent.trim()) {
3506 // Don't touch whitespace if text is preformated
3507 var parent = node.parentNode;
3508 var pre = (0, dom.isElement)(parent) && parent.closest("pre");
3509
3510 if (pre) {
3511 return NodeFilter.FILTER_REJECT;
3512 }
3513
3514 return NodeFilter.FILTER_ACCEPT;
3515 } else {
3516 return NodeFilter.FILTER_REJECT;
3517 }
3518 }
3519 }, false);
3520 var node;
3521 var current;
3522 node = treeWalker.nextNode();
3523
3524 while (node) {
3525 current = node;
3526 node = treeWalker.nextNode(); // if (!current.nextSibling || (current.nextSibling && current.nextSibling.nodeType === 1)) {
3527
3528 current.parentNode.removeChild(current); // }
3529 }
3530 }
3531 }, {
3532 key: "find",
3533 value: function find(ref) {
3534 return this.refs[ref];
3535 } // isWrapper(element) {
3536 // return wrappersRegex.test(element.nodeName);
3537 // }
3538
3539 }, {
3540 key: "isText",
3541 value: function isText(node) {
3542 return node.tagName === "TAG";
3543 }
3544 }, {
3545 key: "isElement",
3546 value: function isElement(node) {
3547 return node.nodeType === 1;
3548 }
3549 }, {
3550 key: "hasChildren",
3551 value: function hasChildren(node) {
3552 return node.childNodes && node.childNodes.length;
3553 }
3554 }, {
3555 key: "destroy",
3556 value: function destroy() {
3557 this.refs = undefined;
3558 this.dom = undefined;
3559 }
3560 }]);
3561 return ContentParser;
3562 }();
3563
3564 var _default = ContentParser;
3565 exports.default = _default;
3566 });
3567
3568 unwrapExports(parser);
3569
3570 var queue = createCommonjsModule(function (module, exports) {
3571
3572
3573
3574 Object.defineProperty(exports, "__esModule", {
3575 value: true
3576 });
3577 exports.Task = exports.default = void 0;
3578
3579 var _classCallCheck2 = interopRequireDefault(classCallCheck);
3580
3581 var _createClass2 = interopRequireDefault(createClass);
3582
3583
3584
3585 /**
3586 * Queue for handling tasks one at a time
3587 * @class
3588 * @param {scope} context what this will resolve to in the tasks
3589 */
3590 var Queue =
3591 /*#__PURE__*/
3592 function () {
3593 function Queue(context) {
3594 (0, _classCallCheck2.default)(this, Queue);
3595 this._q = [];
3596 this.context = context;
3597 this.tick = requestAnimationFrame;
3598 this.running = false;
3599 this.paused = false;
3600 }
3601 /**
3602 * Add an item to the queue
3603 * @return {Promise} enqueued
3604 */
3605
3606
3607 (0, _createClass2.default)(Queue, [{
3608 key: "enqueue",
3609 value: function enqueue() {
3610 var deferred, promise;
3611 var queued;
3612 var task = [].shift.call(arguments);
3613 var args = arguments; // Handle single args without context
3614 // if(args && !Array.isArray(args)) {
3615 // args = [args];
3616 // }
3617
3618 if (!task) {
3619 throw new Error("No Task Provided");
3620 }
3621
3622 if (typeof task === "function") {
3623 deferred = new utils.defer();
3624 promise = deferred.promise;
3625 queued = {
3626 "task": task,
3627 "args": args,
3628 //"context" : context,
3629 "deferred": deferred,
3630 "promise": promise
3631 };
3632 } else {
3633 // Task is a promise
3634 queued = {
3635 "promise": task
3636 };
3637 }
3638
3639 this._q.push(queued); // Wait to start queue flush
3640
3641
3642 if (this.paused == false && !this.running) {
3643 this.run();
3644 }
3645
3646 return queued.promise;
3647 }
3648 /**
3649 * Run one item
3650 * @return {Promise} dequeued
3651 */
3652
3653 }, {
3654 key: "dequeue",
3655 value: function dequeue() {
3656 var inwait, task, result;
3657
3658 if (this._q.length && !this.paused) {
3659 inwait = this._q.shift();
3660 task = inwait.task;
3661
3662 if (task) {
3663 // console.log(task)
3664 result = task.apply(this.context, inwait.args);
3665
3666 if (result && typeof result["then"] === "function") {
3667 // Task is a function that returns a promise
3668 return result.then(function () {
3669 inwait.deferred.resolve.apply(this.context, arguments);
3670 }.bind(this), function () {
3671 inwait.deferred.reject.apply(this.context, arguments);
3672 }.bind(this));
3673 } else {
3674 // Task resolves immediately
3675 inwait.deferred.resolve.apply(this.context, result);
3676 return inwait.promise;
3677 }
3678 } else if (inwait.promise) {
3679 // Task is a promise
3680 return inwait.promise;
3681 }
3682 } else {
3683 inwait = new utils.defer();
3684 inwait.deferred.resolve();
3685 return inwait.promise;
3686 }
3687 } // Run All Immediately
3688
3689 }, {
3690 key: "dump",
3691 value: function dump() {
3692 while (this._q.length) {
3693 this.dequeue();
3694 }
3695 }
3696 /**
3697 * Run all tasks sequentially, at convince
3698 * @return {Promise} all run
3699 */
3700
3701 }, {
3702 key: "run",
3703 value: function run() {
3704 var _this = this;
3705
3706 if (!this.running) {
3707 this.running = true;
3708 this.defered = new utils.defer();
3709 }
3710
3711 this.tick.call(window, function () {
3712 if (_this._q.length) {
3713 _this.dequeue().then(function () {
3714 this.run();
3715 }.bind(_this));
3716 } else {
3717 _this.defered.resolve();
3718
3719 _this.running = undefined;
3720 }
3721 }); // Unpause
3722
3723 if (this.paused == true) {
3724 this.paused = false;
3725 }
3726
3727 return this.defered.promise;
3728 }
3729 /**
3730 * Flush all, as quickly as possible
3731 * @return {Promise} ran
3732 */
3733
3734 }, {
3735 key: "flush",
3736 value: function flush() {
3737 if (this.running) {
3738 return this.running;
3739 }
3740
3741 if (this._q.length) {
3742 this.running = this.dequeue().then(function () {
3743 this.running = undefined;
3744 return this.flush();
3745 }.bind(this));
3746 return this.running;
3747 }
3748 }
3749 /**
3750 * Clear all items in wait
3751 * @return {void}
3752 */
3753
3754 }, {
3755 key: "clear",
3756 value: function clear() {
3757 this._q = [];
3758 }
3759 /**
3760 * Get the number of tasks in the queue
3761 * @return {number} tasks
3762 */
3763
3764 }, {
3765 key: "length",
3766 value: function length() {
3767 return this._q.length;
3768 }
3769 /**
3770 * Pause a running queue
3771 * @return {void}
3772 */
3773
3774 }, {
3775 key: "pause",
3776 value: function pause() {
3777 this.paused = true;
3778 }
3779 /**
3780 * End the queue
3781 * @return {void}
3782 */
3783
3784 }, {
3785 key: "stop",
3786 value: function stop() {
3787 this._q = [];
3788 this.running = false;
3789 this.paused = true;
3790 }
3791 }]);
3792 return Queue;
3793 }();
3794 /**
3795 * Create a new task from a callback
3796 * @class
3797 * @private
3798 * @param {function} task task to complete
3799 * @param {array} args arguments for the task
3800 * @param {scope} context scope of the task
3801 * @return {function} task
3802 */
3803
3804
3805 var Task = function Task(task, args, context) {
3806 (0, _classCallCheck2.default)(this, Task);
3807 return function () {
3808 var _this2 = this;
3809
3810 var toApply = arguments || [];
3811 return new Promise(function (resolve, reject) {
3812 var callback = function callback(value, err) {
3813 if (!value && err) {
3814 reject(err);
3815 } else {
3816 resolve(value);
3817 }
3818 }; // Add the callback to the arguments list
3819
3820
3821 toApply.push(callback); // Apply all arguments to the functions
3822
3823 task.apply(context || _this2, toApply);
3824 });
3825 };
3826 };
3827
3828 exports.Task = Task;
3829 var _default = Queue;
3830 exports.default = _default;
3831 });
3832
3833 unwrapExports(queue);
3834 var queue_1 = queue.Task;
3835
3836 var chunker = createCommonjsModule(function (module, exports) {
3837
3838
3839
3840 Object.defineProperty(exports, "__esModule", {
3841 value: true
3842 });
3843 exports.default = void 0;
3844
3845 var _regenerator = interopRequireDefault(regenerator);
3846
3847 var _asyncToGenerator2 = interopRequireDefault(asyncToGenerator);
3848
3849 var _classCallCheck2 = interopRequireDefault(classCallCheck);
3850
3851 var _createClass2 = interopRequireDefault(createClass);
3852
3853 var _awaitAsyncGenerator2 = interopRequireDefault(awaitAsyncGenerator);
3854
3855 var _wrapAsyncGenerator2 = interopRequireDefault(wrapAsyncGenerator);
3856
3857 var _page = interopRequireDefault(page);
3858
3859 var _parser = interopRequireDefault(parser);
3860
3861 var _eventEmitter = interopRequireDefault(eventEmitter);
3862
3863 var _hook = interopRequireDefault(hook);
3864
3865 var _queue = interopRequireDefault(queue);
3866 var TEMPLATE = "<div class=\"pagedjs_page\">\n\t<div class=\"pagedjs_margin-top-left-corner-holder\">\n\t\t<div class=\"pagedjs_margin pagedjs_margin-top-left-corner\"><div class=\"pagedjs_margin-content\"></div></div>\n\t</div>\n\t<div class=\"pagedjs_margin-top\">\n\t\t<div class=\"pagedjs_margin pagedjs_margin-top-left\"><div class=\"pagedjs_margin-content\"></div></div>\n\t\t<div class=\"pagedjs_margin pagedjs_margin-top-center\"><div class=\"pagedjs_margin-content\"></div></div>\n\t\t<div class=\"pagedjs_margin pagedjs_margin-top-right\"><div class=\"pagedjs_margin-content\"></div></div>\n\t</div>\n\t<div class=\"pagedjs_margin-top-right-corner-holder\">\n\t\t<div class=\"pagedjs_margin pagedjs_margin-top-right-corner\"><div class=\"pagedjs_margin-content\"></div></div>\n\t</div>\n\t<div class=\"pagedjs_margin-right\">\n\t\t<div class=\"pagedjs_margin pagedjs_margin-right-top\"><div class=\"pagedjs_margin-content\"></div></div>\n\t\t<div class=\"pagedjs_margin pagedjs_margin-right-middle\"><div class=\"pagedjs_margin-content\"></div></div>\n\t\t<div class=\"pagedjs_margin pagedjs_margin-right-bottom\"><div class=\"pagedjs_margin-content\"></div></div>\n\t</div>\n\t<div class=\"pagedjs_margin-left\">\n\t\t<div class=\"pagedjs_margin pagedjs_margin-left-top\"><div class=\"pagedjs_margin-content\"></div></div>\n\t\t<div class=\"pagedjs_margin pagedjs_margin-left-middle\"><div class=\"pagedjs_margin-content\"></div></div>\n\t\t<div class=\"pagedjs_margin pagedjs_margin-left-bottom\"><div class=\"pagedjs_margin-content\"></div></div>\n\t</div>\n\t<div class=\"pagedjs_margin-bottom-left-corner-holder\">\n\t\t<div class=\"pagedjs_margin pagedjs_margin-bottom-left-corner\"><div class=\"pagedjs_margin-content\"></div></div>\n\t</div>\n\t<div class=\"pagedjs_margin-bottom\">\n\t\t<div class=\"pagedjs_margin pagedjs_margin-bottom-left\"><div class=\"pagedjs_margin-content\"></div></div>\n\t\t<div class=\"pagedjs_margin pagedjs_margin-bottom-center\"><div class=\"pagedjs_margin-content\"></div></div>\n\t\t<div class=\"pagedjs_margin pagedjs_margin-bottom-right\"><div class=\"pagedjs_margin-content\"></div></div>\n\t</div>\n\t<div class=\"pagedjs_margin-bottom-right-corner-holder\">\n\t\t<div class=\"pagedjs_margin pagedjs_margin-bottom-right-corner\"><div class=\"pagedjs_margin-content\"></div></div>\n\t</div>\n\t<div class=\"pagedjs_area\">\n\t\t<div class=\"pagedjs_page_content\">\n\n\t\t</div>\n\t</div>\n</div>";
3867 /**
3868 * Chop up text into flows
3869 * @class
3870 */
3871
3872 var Chunker =
3873 /*#__PURE__*/
3874 function () {
3875 function Chunker(content, renderTo) {
3876 (0, _classCallCheck2.default)(this, Chunker);
3877 // this.preview = preview;
3878 this.hooks = {};
3879 this.hooks.beforeParsed = new _hook.default(this);
3880 this.hooks.afterParsed = new _hook.default(this);
3881 this.hooks.beforePageLayout = new _hook.default(this);
3882 this.hooks.layout = new _hook.default(this);
3883 this.hooks.renderNode = new _hook.default(this);
3884 this.hooks.layoutNode = new _hook.default(this);
3885 this.hooks.overflow = new _hook.default(this);
3886 this.hooks.afterPageLayout = new _hook.default(this);
3887 this.hooks.afterRendered = new _hook.default(this);
3888 this.pages = [];
3889 this._total = 0;
3890 this.q = new _queue.default(this);
3891 this.stopped = false;
3892 this.rendered = false;
3893 this.content = content;
3894 this.charsPerBreak = [];
3895 this.maxChars;
3896
3897 if (content) {
3898 this.flow(content, renderTo);
3899 }
3900 }
3901
3902 (0, _createClass2.default)(Chunker, [{
3903 key: "setup",
3904 value: function setup(renderTo) {
3905 this.pagesArea = document.createElement("div");
3906 this.pagesArea.classList.add("pagedjs_pages");
3907
3908 if (renderTo) {
3909 renderTo.appendChild(this.pagesArea);
3910 } else {
3911 document.querySelector("body").appendChild(this.pagesArea);
3912 }
3913
3914 this.pageTemplate = document.createElement("template");
3915 this.pageTemplate.innerHTML = TEMPLATE;
3916 }
3917 }, {
3918 key: "flow",
3919 value: function () {
3920 var _flow = (0, _asyncToGenerator2.default)(
3921 /*#__PURE__*/
3922 _regenerator.default.mark(function _callee(content, renderTo) {
3923 var parsed, rendered;
3924 return _regenerator.default.wrap(function _callee$(_context) {
3925 while (1) {
3926 switch (_context.prev = _context.next) {
3927 case 0:
3928 _context.next = 2;
3929 return this.hooks.beforeParsed.trigger(content, this);
3930
3931 case 2:
3932 parsed = new _parser.default(content);
3933 this.source = parsed;
3934 this.breakToken = undefined;
3935
3936 if (this.pagesArea && this.pageTemplate) {
3937 this.q.clear();
3938 this.removePages();
3939 } else {
3940 this.setup(renderTo);
3941 }
3942
3943 this.emit("rendering", content);
3944 _context.next = 9;
3945 return this.hooks.afterParsed.trigger(parsed, this);
3946
3947 case 9:
3948 _context.next = 11;
3949 return this.loadFonts();
3950
3951 case 11:
3952 _context.next = 13;
3953 return this.render(parsed, this.breakToken);
3954
3955 case 13:
3956 rendered = _context.sent;
3957
3958 case 14:
3959 if (!rendered.canceled) {
3960 _context.next = 21;
3961 break;
3962 }
3963
3964 this.start();
3965 _context.next = 18;
3966 return this.render(parsed, this.breakToken);
3967
3968 case 18:
3969 rendered = _context.sent;
3970 _context.next = 14;
3971 break;
3972
3973 case 21:
3974 this.rendered = true;
3975 _context.next = 24;
3976 return this.hooks.afterRendered.trigger(this.pages, this);
3977
3978 case 24:
3979 this.emit("rendered", this.pages);
3980 return _context.abrupt("return", this);
3981
3982 case 26:
3983 case "end":
3984 return _context.stop();
3985 }
3986 }
3987 }, _callee, this);
3988 }));
3989
3990 return function flow(_x, _x2) {
3991 return _flow.apply(this, arguments);
3992 };
3993 }() // oversetPages() {
3994 // let overset = [];
3995 // for (let i = 0; i < this.pages.length; i++) {
3996 // let page = this.pages[i];
3997 // if (page.overset) {
3998 // overset.push(page);
3999 // // page.overset = false;
4000 // }
4001 // }
4002 // return overset;
4003 // }
4004 //
4005 // async handleOverset(parsed) {
4006 // let overset = this.oversetPages();
4007 // if (overset.length) {
4008 // console.log("overset", overset);
4009 // let index = this.pages.indexOf(overset[0]) + 1;
4010 // console.log("INDEX", index);
4011 //
4012 // // Remove pages
4013 // // this.removePages(index);
4014 //
4015 // // await this.render(parsed, overset[0].overset);
4016 //
4017 // // return this.handleOverset(parsed);
4018 // }
4019 // }
4020
4021 }, {
4022 key: "render",
4023 value: function () {
4024 var _render = (0, _asyncToGenerator2.default)(
4025 /*#__PURE__*/
4026 _regenerator.default.mark(function _callee2(parsed, startAt) {
4027 var _this2 = this;
4028
4029 var renderer, done, result;
4030 return _regenerator.default.wrap(function _callee2$(_context2) {
4031 while (1) {
4032 switch (_context2.prev = _context2.next) {
4033 case 0:
4034 renderer = this.layout(parsed, startAt);
4035 done = false;
4036
4037 case 2:
4038 if (done) {
4039 _context2.next = 9;
4040 break;
4041 }
4042
4043 _context2.next = 5;
4044 return this.q.enqueue(function () {
4045 return _this2.renderAsync(renderer);
4046 });
4047
4048 case 5:
4049 result = _context2.sent;
4050 done = result.done;
4051 _context2.next = 2;
4052 break;
4053
4054 case 9:
4055 return _context2.abrupt("return", result);
4056
4057 case 10:
4058 case "end":
4059 return _context2.stop();
4060 }
4061 }
4062 }, _callee2, this);
4063 }));
4064
4065 return function render(_x3, _x4) {
4066 return _render.apply(this, arguments);
4067 };
4068 }()
4069 }, {
4070 key: "start",
4071 value: function start() {
4072 this.rendered = false;
4073 this.stopped = false;
4074 }
4075 }, {
4076 key: "stop",
4077 value: function stop() {
4078 this.stopped = true; // this.q.clear();
4079 }
4080 }, {
4081 key: "renderOnIdle",
4082 value: function renderOnIdle(renderer) {
4083 var _this3 = this;
4084
4085 return new Promise(function (resolve) {
4086 (0, utils.requestIdleCallback)(
4087 /*#__PURE__*/
4088 (0, _asyncToGenerator2.default)(
4089 /*#__PURE__*/
4090 _regenerator.default.mark(function _callee3() {
4091 var result;
4092 return _regenerator.default.wrap(function _callee3$(_context3) {
4093 while (1) {
4094 switch (_context3.prev = _context3.next) {
4095 case 0:
4096 if (!_this3.stopped) {
4097 _context3.next = 2;
4098 break;
4099 }
4100
4101 return _context3.abrupt("return", resolve({
4102 done: true,
4103 canceled: true
4104 }));
4105
4106 case 2:
4107 _context3.next = 4;
4108 return renderer.next();
4109
4110 case 4:
4111 result = _context3.sent;
4112
4113 if (_this3.stopped) {
4114 resolve({
4115 done: true,
4116 canceled: true
4117 });
4118 } else {
4119 resolve(result);
4120 }
4121
4122 case 6:
4123 case "end":
4124 return _context3.stop();
4125 }
4126 }
4127 }, _callee3, this);
4128 })));
4129 });
4130 }
4131 }, {
4132 key: "renderAsync",
4133 value: function () {
4134 var _renderAsync = (0, _asyncToGenerator2.default)(
4135 /*#__PURE__*/
4136 _regenerator.default.mark(function _callee4(renderer) {
4137 var result;
4138 return _regenerator.default.wrap(function _callee4$(_context4) {
4139 while (1) {
4140 switch (_context4.prev = _context4.next) {
4141 case 0:
4142 if (!this.stopped) {
4143 _context4.next = 2;
4144 break;
4145 }
4146
4147 return _context4.abrupt("return", {
4148 done: true,
4149 canceled: true
4150 });
4151
4152 case 2:
4153 _context4.next = 4;
4154 return renderer.next();
4155
4156 case 4:
4157 result = _context4.sent;
4158
4159 if (!this.stopped) {
4160 _context4.next = 9;
4161 break;
4162 }
4163
4164 return _context4.abrupt("return", {
4165 done: true,
4166 canceled: true
4167 });
4168
4169 case 9:
4170 return _context4.abrupt("return", result);
4171
4172 case 10:
4173 case "end":
4174 return _context4.stop();
4175 }
4176 }
4177 }, _callee4, this);
4178 }));
4179
4180 return function renderAsync(_x5) {
4181 return _renderAsync.apply(this, arguments);
4182 };
4183 }()
4184 }, {
4185 key: "handleBreaks",
4186 value: function () {
4187 var _handleBreaks = (0, _asyncToGenerator2.default)(
4188 /*#__PURE__*/
4189 _regenerator.default.mark(function _callee5(node) {
4190 var currentPage, currentPosition, currentSide, previousBreakAfter, breakBefore, page$$1;
4191 return _regenerator.default.wrap(function _callee5$(_context5) {
4192 while (1) {
4193 switch (_context5.prev = _context5.next) {
4194 case 0:
4195 currentPage = this.total + 1;
4196 currentPosition = currentPage % 2 === 0 ? "left" : "right"; // TODO: Recto and Verso should reverse for rtl languages
4197
4198 currentSide = currentPage % 2 === 0 ? "verso" : "recto";
4199
4200 if (!(currentPage === 1)) {
4201 _context5.next = 5;
4202 break;
4203 }
4204
4205 return _context5.abrupt("return");
4206
4207 case 5:
4208 if (node && typeof node.dataset !== "undefined" && typeof node.dataset.previousBreakAfter !== "undefined") {
4209 previousBreakAfter = node.dataset.previousBreakAfter;
4210 }
4211
4212 if (node && typeof node.dataset !== "undefined" && typeof node.dataset.breakBefore !== "undefined") {
4213 breakBefore = node.dataset.breakBefore;
4214 }
4215
4216 if (previousBreakAfter && (previousBreakAfter === "left" || previousBreakAfter === "right") && previousBreakAfter !== currentPosition) {
4217 page$$1 = this.addPage(true);
4218 } else if (previousBreakAfter && (previousBreakAfter === "verso" || previousBreakAfter === "recto") && previousBreakAfter !== currentSide) {
4219 page$$1 = this.addPage(true);
4220 } else if (breakBefore && (breakBefore === "left" || breakBefore === "right") && breakBefore !== currentPosition) {
4221 page$$1 = this.addPage(true);
4222 } else if (breakBefore && (breakBefore === "verso" || breakBefore === "recto") && breakBefore !== currentSide) {
4223 page$$1 = this.addPage(true);
4224 }
4225
4226 if (!page$$1) {
4227 _context5.next = 15;
4228 break;
4229 }
4230
4231 _context5.next = 11;
4232 return this.hooks.beforePageLayout.trigger(page$$1, undefined, undefined, this);
4233
4234 case 11:
4235 this.emit("page", page$$1); // await this.hooks.layout.trigger(page.element, page, undefined, this);
4236
4237 _context5.next = 14;
4238 return this.hooks.afterPageLayout.trigger(page$$1.element, page$$1, undefined, this);
4239
4240 case 14:
4241 this.emit("renderedPage", page$$1);
4242
4243 case 15:
4244 case "end":
4245 return _context5.stop();
4246 }
4247 }
4248 }, _callee5, this);
4249 }));
4250
4251 return function handleBreaks(_x6) {
4252 return _handleBreaks.apply(this, arguments);
4253 };
4254 }()
4255 }, {
4256 key: "layout",
4257 value: function layout(content, startAt) {
4258 var _this = this;
4259
4260 return (0, _wrapAsyncGenerator2.default)(
4261 /*#__PURE__*/
4262 _regenerator.default.mark(function _callee6() {
4263 var breakToken, page$$1;
4264 return _regenerator.default.wrap(function _callee6$(_context6) {
4265 while (1) {
4266 switch (_context6.prev = _context6.next) {
4267 case 0:
4268 breakToken = startAt || false;
4269
4270 case 1:
4271 if (!(breakToken !== undefined && (true))) {
4272 _context6.next = 24;
4273 break;
4274 }
4275
4276 if (!(breakToken && breakToken.node)) {
4277 _context6.next = 7;
4278 break;
4279 }
4280
4281 _context6.next = 5;
4282 return (0, _awaitAsyncGenerator2.default)(_this.handleBreaks(breakToken.node));
4283
4284 case 5:
4285 _context6.next = 9;
4286 break;
4287
4288 case 7:
4289 _context6.next = 9;
4290 return (0, _awaitAsyncGenerator2.default)(_this.handleBreaks(content.firstChild));
4291
4292 case 9:
4293 page$$1 = _this.addPage();
4294 _context6.next = 12;
4295 return (0, _awaitAsyncGenerator2.default)(_this.hooks.beforePageLayout.trigger(page$$1, content, breakToken, _this));
4296
4297 case 12:
4298 _this.emit("page", page$$1); // Layout content in the page, starting from the breakToken
4299
4300
4301 _context6.next = 15;
4302 return (0, _awaitAsyncGenerator2.default)(page$$1.layout(content, breakToken, _this.maxChars));
4303
4304 case 15:
4305 breakToken = _context6.sent;
4306 _context6.next = 18;
4307 return (0, _awaitAsyncGenerator2.default)(_this.hooks.afterPageLayout.trigger(page$$1.element, page$$1, breakToken, _this));
4308
4309 case 18:
4310 _this.emit("renderedPage", page$$1);
4311
4312 _this.recoredCharLength(page$$1.wrapper.textContent.length);
4313
4314 _context6.next = 22;
4315 return breakToken;
4316
4317 case 22:
4318 _context6.next = 1;
4319 break;
4320
4321 case 24:
4322 case "end":
4323 return _context6.stop();
4324 }
4325 }
4326 }, _callee6, this);
4327 }))();
4328 }
4329 }, {
4330 key: "recoredCharLength",
4331 value: function recoredCharLength(length) {
4332 if (length === 0) {
4333 return;
4334 }
4335
4336 this.charsPerBreak.push(length); // Keep the length of the last few breaks
4337
4338 if (this.charsPerBreak.length > 4) {
4339 this.charsPerBreak.shift();
4340 }
4341
4342 this.maxChars = this.charsPerBreak.reduce(function (a, b) {
4343 return a + b;
4344 }, 0) / this.charsPerBreak.length;
4345 }
4346 }, {
4347 key: "removePages",
4348 value: function removePages() {
4349 var fromIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
4350
4351 if (fromIndex >= this.pages.length) {
4352 return;
4353 } // Remove pages
4354
4355
4356 for (var i = fromIndex; i < this.pages.length; i++) {
4357 this.pages[i].destroy();
4358 }
4359
4360 if (fromIndex > 0) {
4361 this.pages.splice(fromIndex);
4362 } else {
4363 this.pages = [];
4364 }
4365 }
4366 }, {
4367 key: "addPage",
4368 value: function addPage(blank) {
4369 var _this4 = this;
4370
4371 var lastPage = this.pages[this.pages.length - 1]; // Create a new page from the template
4372
4373 var page$$1 = new _page.default(this.pagesArea, this.pageTemplate, blank, this.hooks);
4374 this.pages.push(page$$1); // Create the pages
4375
4376 page$$1.create(undefined, lastPage && lastPage.element);
4377 page$$1.index(this.total);
4378
4379 if (!blank) {
4380 // Listen for page overflow
4381 page$$1.onOverflow(function (overflowToken) {
4382 console.warn("overflow on", page$$1.id, overflowToken); // Only reflow while rendering
4383
4384 if (_this4.rendered) {
4385 return;
4386 }
4387
4388 var index = _this4.pages.indexOf(page$$1) + 1; // Stop the rendering
4389
4390 _this4.stop(); // Set the breakToken to resume at
4391
4392
4393 _this4.breakToken = overflowToken; // Remove pages
4394
4395 _this4.removePages(index);
4396
4397 if (_this4.rendered === true) {
4398 _this4.rendered = false;
4399
4400 _this4.q.enqueue(
4401 /*#__PURE__*/
4402 (0, _asyncToGenerator2.default)(
4403 /*#__PURE__*/
4404 _regenerator.default.mark(function _callee7() {
4405 return _regenerator.default.wrap(function _callee7$(_context7) {
4406 while (1) {
4407 switch (_context7.prev = _context7.next) {
4408 case 0:
4409 _this4.start();
4410
4411 _context7.next = 3;
4412 return _this4.render(_this4.source, _this4.breakToken);
4413
4414 case 3:
4415 _this4.rendered = true;
4416
4417 case 4:
4418 case "end":
4419 return _context7.stop();
4420 }
4421 }
4422 }, _callee7, this);
4423 })));
4424 }
4425 });
4426 page$$1.onUnderflow(function (overflowToken) {// console.log("underflow on", page.id, overflowToken);
4427 // page.append(this.source, overflowToken);
4428 });
4429 }
4430
4431 this.total = this.pages.length;
4432 return page$$1;
4433 }
4434 /*
4435 insertPage(index, blank) {
4436 let lastPage = this.pages[index];
4437 // Create a new page from the template
4438 let page = new Page(this.pagesArea, this.pageTemplate, blank, this.hooks);
4439 let total = this.pages.splice(index, 0, page);
4440 // Create the pages
4441 page.create(undefined, lastPage && lastPage.element);
4442 page.index(index + 1);
4443 for (let i = index + 2; i < this.pages.length; i++) {
4444 this.pages[i].index(i);
4445 }
4446 if (!blank) {
4447 // Listen for page overflow
4448 page.onOverflow((overflowToken) => {
4449 if (total < this.pages.length) {
4450 this.pages[total].layout(this.source, overflowToken);
4451 } else {
4452 let newPage = this.addPage();
4453 newPage.layout(this.source, overflowToken);
4454 }
4455 });
4456 page.onUnderflow(() => {
4457 // console.log("underflow on", page.id);
4458 });
4459 }
4460 this.total += 1;
4461 return page;
4462 }
4463 */
4464
4465 }, {
4466 key: "loadFonts",
4467 value: function loadFonts() {
4468 var fontPromises = [];
4469 document.fonts.forEach(function (fontFace) {
4470 if (fontFace.status !== "loaded") {
4471 var fontLoaded = fontFace.load().then(function (r) {
4472 return fontFace.family;
4473 }, function (r) {
4474 console.warn("Failed to preload font-family:", fontFace.family);
4475 return fontFace.family;
4476 });
4477 fontPromises.push(fontLoaded);
4478 }
4479 });
4480 return Promise.all(fontPromises).catch(function (err) {
4481 console.warn(err);
4482 });
4483 }
4484 }, {
4485 key: "destroy",
4486 value: function destroy() {
4487 this.pagesArea.remove();
4488 this.pageTemplate.remove();
4489 }
4490 }, {
4491 key: "total",
4492 get: function get() {
4493 return this._total;
4494 },
4495 set: function set(num) {
4496 this.pagesArea.style.setProperty("--page-count", num);
4497 this._total = num;
4498 }
4499 }]);
4500 return Chunker;
4501 }();
4502
4503 (0, _eventEmitter.default)(Chunker.prototype);
4504 var _default = Chunker;
4505 exports.default = _default;
4506 });
4507
4508 unwrapExports(chunker);
4509
4510 var _typeof_1 = createCommonjsModule(function (module) {
4511 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
4512
4513 function _typeof(obj) {
4514 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
4515 module.exports = _typeof = function _typeof(obj) {
4516 return _typeof2(obj);
4517 };
4518 } else {
4519 module.exports = _typeof = function _typeof(obj) {
4520 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
4521 };
4522 }
4523
4524 return _typeof(obj);
4525 }
4526
4527 module.exports = _typeof;
4528 });
4529
4530 //
4531 // item item item item
4532 // /------\ /------\ /------\ /------\
4533 // | data | | data | | data | | data |
4534 // null <--+-prev |<---+-prev |<---+-prev |<---+-prev |
4535 // | next-+--->| next-+--->| next-+--->| next-+--> null
4536 // \------/ \------/ \------/ \------/
4537 // ^ ^
4538 // | list |
4539 // | /------\ |
4540 // \--------------+-head | |
4541 // | tail-+--------------/
4542 // \------/
4543 //
4544
4545 function createItem(data) {
4546 return {
4547 prev: null,
4548 next: null,
4549 data: data
4550 };
4551 }
4552
4553 function allocateCursor(node, prev, next) {
4554 var cursor;
4555
4556 if (cursors !== null) {
4557 cursor = cursors;
4558 cursors = cursors.cursor;
4559 cursor.prev = prev;
4560 cursor.next = next;
4561 cursor.cursor = node.cursor;
4562 } else {
4563 cursor = {
4564 prev: prev,
4565 next: next,
4566 cursor: node.cursor
4567 };
4568 }
4569
4570 node.cursor = cursor;
4571
4572 return cursor;
4573 }
4574
4575 function releaseCursor(node) {
4576 var cursor = node.cursor;
4577
4578 node.cursor = cursor.cursor;
4579 cursor.prev = null;
4580 cursor.next = null;
4581 cursor.cursor = cursors;
4582 cursors = cursor;
4583 }
4584
4585 var cursors = null;
4586 var List = function() {
4587 this.cursor = null;
4588 this.head = null;
4589 this.tail = null;
4590 };
4591
4592 List.createItem = createItem;
4593 List.prototype.createItem = createItem;
4594
4595 List.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) {
4596 var cursor = this.cursor;
4597
4598 while (cursor !== null) {
4599 if (cursor.prev === prevOld) {
4600 cursor.prev = prevNew;
4601 }
4602
4603 if (cursor.next === nextOld) {
4604 cursor.next = nextNew;
4605 }
4606
4607 cursor = cursor.cursor;
4608 }
4609 };
4610
4611 List.prototype.getSize = function() {
4612 var size = 0;
4613 var cursor = this.head;
4614
4615 while (cursor) {
4616 size++;
4617 cursor = cursor.next;
4618 }
4619
4620 return size;
4621 };
4622
4623 List.prototype.fromArray = function(array) {
4624 var cursor = null;
4625
4626 this.head = null;
4627
4628 for (var i = 0; i < array.length; i++) {
4629 var item = createItem(array[i]);
4630
4631 if (cursor !== null) {
4632 cursor.next = item;
4633 } else {
4634 this.head = item;
4635 }
4636
4637 item.prev = cursor;
4638 cursor = item;
4639 }
4640
4641 this.tail = cursor;
4642
4643 return this;
4644 };
4645
4646 List.prototype.toArray = function() {
4647 var cursor = this.head;
4648 var result = [];
4649
4650 while (cursor) {
4651 result.push(cursor.data);
4652 cursor = cursor.next;
4653 }
4654
4655 return result;
4656 };
4657
4658 List.prototype.toJSON = List.prototype.toArray;
4659
4660 List.prototype.isEmpty = function() {
4661 return this.head === null;
4662 };
4663
4664 List.prototype.first = function() {
4665 return this.head && this.head.data;
4666 };
4667
4668 List.prototype.last = function() {
4669 return this.tail && this.tail.data;
4670 };
4671
4672 List.prototype.each = function(fn, context) {
4673 var item;
4674
4675 if (context === undefined) {
4676 context = this;
4677 }
4678
4679 // push cursor
4680 var cursor = allocateCursor(this, null, this.head);
4681
4682 while (cursor.next !== null) {
4683 item = cursor.next;
4684 cursor.next = item.next;
4685
4686 fn.call(context, item.data, item, this);
4687 }
4688
4689 // pop cursor
4690 releaseCursor(this);
4691 };
4692
4693 List.prototype.forEach = List.prototype.each;
4694
4695 List.prototype.eachRight = function(fn, context) {
4696 var item;
4697
4698 if (context === undefined) {
4699 context = this;
4700 }
4701
4702 // push cursor
4703 var cursor = allocateCursor(this, this.tail, null);
4704
4705 while (cursor.prev !== null) {
4706 item = cursor.prev;
4707 cursor.prev = item.prev;
4708
4709 fn.call(context, item.data, item, this);
4710 }
4711
4712 // pop cursor
4713 releaseCursor(this);
4714 };
4715
4716 List.prototype.forEachRight = List.prototype.eachRight;
4717
4718 List.prototype.nextUntil = function(start, fn, context) {
4719 if (start === null) {
4720 return;
4721 }
4722
4723 var item;
4724
4725 if (context === undefined) {
4726 context = this;
4727 }
4728
4729 // push cursor
4730 var cursor = allocateCursor(this, null, start);
4731
4732 while (cursor.next !== null) {
4733 item = cursor.next;
4734 cursor.next = item.next;
4735
4736 if (fn.call(context, item.data, item, this)) {
4737 break;
4738 }
4739 }
4740
4741 // pop cursor
4742 releaseCursor(this);
4743 };
4744
4745 List.prototype.prevUntil = function(start, fn, context) {
4746 if (start === null) {
4747 return;
4748 }
4749
4750 var item;
4751
4752 if (context === undefined) {
4753 context = this;
4754 }
4755
4756 // push cursor
4757 var cursor = allocateCursor(this, start, null);
4758
4759 while (cursor.prev !== null) {
4760 item = cursor.prev;
4761 cursor.prev = item.prev;
4762
4763 if (fn.call(context, item.data, item, this)) {
4764 break;
4765 }
4766 }
4767
4768 // pop cursor
4769 releaseCursor(this);
4770 };
4771
4772 List.prototype.some = function(fn, context) {
4773 var cursor = this.head;
4774
4775 if (context === undefined) {
4776 context = this;
4777 }
4778
4779 while (cursor !== null) {
4780 if (fn.call(context, cursor.data, cursor, this)) {
4781 return true;
4782 }
4783
4784 cursor = cursor.next;
4785 }
4786
4787 return false;
4788 };
4789
4790 List.prototype.map = function(fn, context) {
4791 var result = new List();
4792 var cursor = this.head;
4793
4794 if (context === undefined) {
4795 context = this;
4796 }
4797
4798 while (cursor !== null) {
4799 result.appendData(fn.call(context, cursor.data, cursor, this));
4800 cursor = cursor.next;
4801 }
4802
4803 return result;
4804 };
4805
4806 List.prototype.filter = function(fn, context) {
4807 var result = new List();
4808 var cursor = this.head;
4809
4810 if (context === undefined) {
4811 context = this;
4812 }
4813
4814 while (cursor !== null) {
4815 if (fn.call(context, cursor.data, cursor, this)) {
4816 result.appendData(cursor.data);
4817 }
4818 cursor = cursor.next;
4819 }
4820
4821 return result;
4822 };
4823
4824 List.prototype.clear = function() {
4825 this.head = null;
4826 this.tail = null;
4827 };
4828
4829 List.prototype.copy = function() {
4830 var result = new List();
4831 var cursor = this.head;
4832
4833 while (cursor !== null) {
4834 result.insert(createItem(cursor.data));
4835 cursor = cursor.next;
4836 }
4837
4838 return result;
4839 };
4840
4841 List.prototype.prepend = function(item) {
4842 // head
4843 // ^
4844 // item
4845 this.updateCursors(null, item, this.head, item);
4846
4847 // insert to the beginning of the list
4848 if (this.head !== null) {
4849 // new item <- first item
4850 this.head.prev = item;
4851
4852 // new item -> first item
4853 item.next = this.head;
4854 } else {
4855 // if list has no head, then it also has no tail
4856 // in this case tail points to the new item
4857 this.tail = item;
4858 }
4859
4860 // head always points to new item
4861 this.head = item;
4862
4863 return this;
4864 };
4865
4866 List.prototype.prependData = function(data) {
4867 return this.prepend(createItem(data));
4868 };
4869
4870 List.prototype.append = function(item) {
4871 return this.insert(item);
4872 };
4873
4874 List.prototype.appendData = function(data) {
4875 return this.insert(createItem(data));
4876 };
4877
4878 List.prototype.insert = function(item, before) {
4879 if (before !== undefined && before !== null) {
4880 // prev before
4881 // ^
4882 // item
4883 this.updateCursors(before.prev, item, before, item);
4884
4885 if (before.prev === null) {
4886 // insert to the beginning of list
4887 if (this.head !== before) {
4888 throw new Error('before doesn\'t belong to list');
4889 }
4890
4891 // since head points to before therefore list doesn't empty
4892 // no need to check tail
4893 this.head = item;
4894 before.prev = item;
4895 item.next = before;
4896
4897 this.updateCursors(null, item);
4898 } else {
4899
4900 // insert between two items
4901 before.prev.next = item;
4902 item.prev = before.prev;
4903
4904 before.prev = item;
4905 item.next = before;
4906 }
4907 } else {
4908 // tail
4909 // ^
4910 // item
4911 this.updateCursors(this.tail, item, null, item);
4912
4913 // insert to the ending of the list
4914 if (this.tail !== null) {
4915 // last item -> new item
4916 this.tail.next = item;
4917
4918 // last item <- new item
4919 item.prev = this.tail;
4920 } else {
4921 // if list has no tail, then it also has no head
4922 // in this case head points to new item
4923 this.head = item;
4924 }
4925
4926 // tail always points to new item
4927 this.tail = item;
4928 }
4929
4930 return this;
4931 };
4932
4933 List.prototype.insertData = function(data, before) {
4934 return this.insert(createItem(data), before);
4935 };
4936
4937 List.prototype.remove = function(item) {
4938 // item
4939 // ^
4940 // prev next
4941 this.updateCursors(item, item.prev, item, item.next);
4942
4943 if (item.prev !== null) {
4944 item.prev.next = item.next;
4945 } else {
4946 if (this.head !== item) {
4947 throw new Error('item doesn\'t belong to list');
4948 }
4949
4950 this.head = item.next;
4951 }
4952
4953 if (item.next !== null) {
4954 item.next.prev = item.prev;
4955 } else {
4956 if (this.tail !== item) {
4957 throw new Error('item doesn\'t belong to list');
4958 }
4959
4960 this.tail = item.prev;
4961 }
4962
4963 item.prev = null;
4964 item.next = null;
4965
4966 return item;
4967 };
4968
4969 List.prototype.push = function(data) {
4970 this.insert(createItem(data));
4971 };
4972
4973 List.prototype.pop = function() {
4974 if (this.tail !== null) {
4975 return this.remove(this.tail);
4976 }
4977 };
4978
4979 List.prototype.unshift = function(data) {
4980 this.prepend(createItem(data));
4981 };
4982
4983 List.prototype.shift = function() {
4984 if (this.head !== null) {
4985 return this.remove(this.head);
4986 }
4987 };
4988
4989 List.prototype.prependList = function(list) {
4990 return this.insertList(list, this.head);
4991 };
4992
4993 List.prototype.appendList = function(list) {
4994 return this.insertList(list);
4995 };
4996
4997 List.prototype.insertList = function(list, before) {
4998 // ignore empty lists
4999 if (list.head === null) {
5000 return this;
5001 }
5002
5003 if (before !== undefined && before !== null) {
5004 this.updateCursors(before.prev, list.tail, before, list.head);
5005
5006 // insert in the middle of dist list
5007 if (before.prev !== null) {
5008 // before.prev <-> list.head
5009 before.prev.next = list.head;
5010 list.head.prev = before.prev;
5011 } else {
5012 this.head = list.head;
5013 }
5014
5015 before.prev = list.tail;
5016 list.tail.next = before;
5017 } else {
5018 this.updateCursors(this.tail, list.tail, null, list.head);
5019
5020 // insert to end of the list
5021 if (this.tail !== null) {
5022 // if destination list has a tail, then it also has a head,
5023 // but head doesn't change
5024
5025 // dest tail -> source head
5026 this.tail.next = list.head;
5027
5028 // dest tail <- source head
5029 list.head.prev = this.tail;
5030 } else {
5031 // if list has no a tail, then it also has no a head
5032 // in this case points head to new item
5033 this.head = list.head;
5034 }
5035
5036 // tail always start point to new item
5037 this.tail = list.tail;
5038 }
5039
5040 list.head = null;
5041 list.tail = null;
5042
5043 return this;
5044 };
5045
5046 List.prototype.replace = function(oldItem, newItemOrList) {
5047 if ('head' in newItemOrList) {
5048 this.insertList(newItemOrList, oldItem);
5049 } else {
5050 this.insert(newItemOrList, oldItem);
5051 }
5052
5053 this.remove(oldItem);
5054 };
5055
5056 var list = List;
5057
5058 var createCustomError = function createCustomError(name, message) {
5059 // use Object.create(), because some VMs prevent setting line/column otherwise
5060 // (iOS Safari 10 even throws an exception)
5061 var error = Object.create(SyntaxError.prototype);
5062 var errorStack = new Error();
5063
5064 error.name = name;
5065 error.message = message;
5066
5067 Object.defineProperty(error, 'stack', {
5068 get: function() {
5069 return (errorStack.stack || '').replace(/^(.+\n){1,3}/, name + ': ' + message + '\n');
5070 }
5071 });
5072
5073 return error;
5074 };
5075
5076 var MAX_LINE_LENGTH = 100;
5077 var OFFSET_CORRECTION = 60;
5078 var TAB_REPLACEMENT = ' ';
5079
5080 function sourceFragment(error, extraLines) {
5081 function processLines(start, end) {
5082 return lines.slice(start, end).map(function(line, idx) {
5083 var num = String(start + idx + 1);
5084
5085 while (num.length < maxNumLength) {
5086 num = ' ' + num;
5087 }
5088
5089 return num + ' |' + line;
5090 }).join('\n');
5091 }
5092
5093 var lines = error.source.split(/\r\n?|\n|\f/);
5094 var line = error.line;
5095 var column = error.column;
5096 var startLine = Math.max(1, line - extraLines) - 1;
5097 var endLine = Math.min(line + extraLines, lines.length + 1);
5098 var maxNumLength = Math.max(4, String(endLine).length) + 1;
5099 var cutLeft = 0;
5100
5101 // column correction according to replaced tab before column
5102 column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\t/g) || []).length;
5103
5104 if (column > MAX_LINE_LENGTH) {
5105 cutLeft = column - OFFSET_CORRECTION + 3;
5106 column = OFFSET_CORRECTION - 2;
5107 }
5108
5109 for (var i = startLine; i <= endLine; i++) {
5110 if (i >= 0 && i < lines.length) {
5111 lines[i] = lines[i].replace(/\t/g, TAB_REPLACEMENT);
5112 lines[i] =
5113 (cutLeft > 0 && lines[i].length > cutLeft ? '\u2026' : '') +
5114 lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) +
5115 (lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\u2026' : '');
5116 }
5117 }
5118
5119 return [
5120 processLines(startLine, line),
5121 new Array(column + maxNumLength + 2).join('-') + '^',
5122 processLines(line, endLine)
5123 ].filter(Boolean).join('\n');
5124 }
5125
5126 var CssSyntaxError = function(message, source, offset, line, column) {
5127 var error = createCustomError('CssSyntaxError', message);
5128
5129 error.source = source;
5130 error.offset = offset;
5131 error.line = line;
5132 error.column = column;
5133
5134 error.sourceFragment = function(extraLines) {
5135 return sourceFragment(error, isNaN(extraLines) ? 0 : extraLines);
5136 };
5137 Object.defineProperty(error, 'formattedMessage', {
5138 get: function() {
5139 return (
5140 'Parse error: ' + error.message + '\n' +
5141 sourceFragment(error, 2)
5142 );
5143 }
5144 });
5145
5146 // for backward capability
5147 error.parseError = {
5148 offset: offset,
5149 line: line,
5150 column: column
5151 };
5152
5153 return error;
5154 };
5155
5156 var error = CssSyntaxError;
5157
5158 // token types (note: value shouldn't intersect with used char codes)
5159 var WHITESPACE = 1;
5160 var IDENTIFIER = 2;
5161 var NUMBER = 3;
5162 var STRING = 4;
5163 var COMMENT = 5;
5164 var PUNCTUATOR = 6;
5165 var CDO = 7;
5166 var CDC = 8;
5167 var ATKEYWORD = 14;
5168 var FUNCTION = 15;
5169 var URL$1 = 16;
5170 var RAW = 17;
5171
5172 var TAB = 9;
5173 var N = 10;
5174 var F = 12;
5175 var R = 13;
5176 var SPACE = 32;
5177
5178 var TYPE = {
5179 WhiteSpace: WHITESPACE,
5180 Identifier: IDENTIFIER,
5181 Number: NUMBER,
5182 String: STRING,
5183 Comment: COMMENT,
5184 Punctuator: PUNCTUATOR,
5185 CDO: CDO,
5186 CDC: CDC,
5187 AtKeyword: ATKEYWORD,
5188 Function: FUNCTION,
5189 Url: URL$1,
5190 Raw: RAW,
5191
5192 ExclamationMark: 33, // !
5193 QuotationMark: 34, // "
5194 NumberSign: 35, // #
5195 DollarSign: 36, // $
5196 PercentSign: 37, // %
5197 Ampersand: 38, // &
5198 Apostrophe: 39, // '
5199 LeftParenthesis: 40, // (
5200 RightParenthesis: 41, // )
5201 Asterisk: 42, // *
5202 PlusSign: 43, // +
5203 Comma: 44, // ,
5204 HyphenMinus: 45, // -
5205 FullStop: 46, // .
5206 Solidus: 47, // /
5207 Colon: 58, // :
5208 Semicolon: 59, // ;
5209 LessThanSign: 60, // <
5210 EqualsSign: 61, // =
5211 GreaterThanSign: 62, // >
5212 QuestionMark: 63, // ?
5213 CommercialAt: 64, // @
5214 LeftSquareBracket: 91, // [
5215 Backslash: 92, // \
5216 RightSquareBracket: 93, // ]
5217 CircumflexAccent: 94, // ^
5218 LowLine: 95, // _
5219 GraveAccent: 96, // `
5220 LeftCurlyBracket: 123, // {
5221 VerticalLine: 124, // |
5222 RightCurlyBracket: 125, // }
5223 Tilde: 126 // ~
5224 };
5225
5226 var NAME = Object.keys(TYPE).reduce(function(result, key) {
5227 result[TYPE[key]] = key;
5228 return result;
5229 }, {});
5230
5231 // https://drafts.csswg.org/css-syntax/#tokenizer-definitions
5232 // > non-ASCII code point
5233 // > A code point with a value equal to or greater than U+0080 <control>
5234 // > name-start code point
5235 // > A letter, a non-ASCII code point, or U+005F LOW LINE (_).
5236 // > name code point
5237 // > A name-start code point, a digit, or U+002D HYPHEN-MINUS (-)
5238 // That means only ASCII code points has a special meaning and we a maps for 0..127 codes only
5239 var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
5240 var SYMBOL_TYPE = new SafeUint32Array(0x80);
5241 var PUNCTUATION = new SafeUint32Array(0x80);
5242 var STOP_URL_RAW = new SafeUint32Array(0x80);
5243
5244 for (var i = 0; i < SYMBOL_TYPE.length; i++) {
5245 SYMBOL_TYPE[i] = IDENTIFIER;
5246 }
5247
5248 // fill categories
5249 [
5250 TYPE.ExclamationMark, // !
5251 TYPE.QuotationMark, // "
5252 TYPE.NumberSign, // #
5253 TYPE.DollarSign, // $
5254 TYPE.PercentSign, // %
5255 TYPE.Ampersand, // &
5256 TYPE.Apostrophe, // '
5257 TYPE.LeftParenthesis, // (
5258 TYPE.RightParenthesis, // )
5259 TYPE.Asterisk, // *
5260 TYPE.PlusSign, // +
5261 TYPE.Comma, // ,
5262 TYPE.HyphenMinus, // -
5263 TYPE.FullStop, // .
5264 TYPE.Solidus, // /
5265 TYPE.Colon, // :
5266 TYPE.Semicolon, // ;
5267 TYPE.LessThanSign, // <
5268 TYPE.EqualsSign, // =
5269 TYPE.GreaterThanSign, // >
5270 TYPE.QuestionMark, // ?
5271 TYPE.CommercialAt, // @
5272 TYPE.LeftSquareBracket, // [
5273 // TYPE.Backslash, // \
5274 TYPE.RightSquareBracket, // ]
5275 TYPE.CircumflexAccent, // ^
5276 // TYPE.LowLine, // _
5277 TYPE.GraveAccent, // `
5278 TYPE.LeftCurlyBracket, // {
5279 TYPE.VerticalLine, // |
5280 TYPE.RightCurlyBracket, // }
5281 TYPE.Tilde // ~
5282 ].forEach(function(key) {
5283 SYMBOL_TYPE[Number(key)] = PUNCTUATOR;
5284 PUNCTUATION[Number(key)] = PUNCTUATOR;
5285 });
5286
5287 for (var i = 48; i <= 57; i++) {
5288 SYMBOL_TYPE[i] = NUMBER;
5289 }
5290
5291 SYMBOL_TYPE[SPACE] = WHITESPACE;
5292 SYMBOL_TYPE[TAB] = WHITESPACE;
5293 SYMBOL_TYPE[N] = WHITESPACE;
5294 SYMBOL_TYPE[R] = WHITESPACE;
5295 SYMBOL_TYPE[F] = WHITESPACE;
5296
5297 SYMBOL_TYPE[TYPE.Apostrophe] = STRING;
5298 SYMBOL_TYPE[TYPE.QuotationMark] = STRING;
5299
5300 STOP_URL_RAW[SPACE] = 1;
5301 STOP_URL_RAW[TAB] = 1;
5302 STOP_URL_RAW[N] = 1;
5303 STOP_URL_RAW[R] = 1;
5304 STOP_URL_RAW[F] = 1;
5305 STOP_URL_RAW[TYPE.Apostrophe] = 1;
5306 STOP_URL_RAW[TYPE.QuotationMark] = 1;
5307 STOP_URL_RAW[TYPE.LeftParenthesis] = 1;
5308 STOP_URL_RAW[TYPE.RightParenthesis] = 1;
5309
5310 // whitespace is punctuation ...
5311 PUNCTUATION[SPACE] = PUNCTUATOR;
5312 PUNCTUATION[TAB] = PUNCTUATOR;
5313 PUNCTUATION[N] = PUNCTUATOR;
5314 PUNCTUATION[R] = PUNCTUATOR;
5315 PUNCTUATION[F] = PUNCTUATOR;
5316 // ... hyper minus is not
5317 PUNCTUATION[TYPE.HyphenMinus] = 0;
5318
5319 var _const = {
5320 TYPE: TYPE,
5321 NAME: NAME,
5322
5323 SYMBOL_TYPE: SYMBOL_TYPE,
5324 PUNCTUATION: PUNCTUATION,
5325 STOP_URL_RAW: STOP_URL_RAW
5326 };
5327
5328 var PUNCTUATION$1 = _const.PUNCTUATION;
5329 var STOP_URL_RAW$1 = _const.STOP_URL_RAW;
5330 var TYPE$1 = _const.TYPE;
5331 var FULLSTOP = TYPE$1.FullStop;
5332 var PLUSSIGN = TYPE$1.PlusSign;
5333 var HYPHENMINUS = TYPE$1.HyphenMinus;
5334 var PUNCTUATOR$1 = TYPE$1.Punctuator;
5335 var TAB$1 = 9;
5336 var N$1 = 10;
5337 var F$1 = 12;
5338 var R$1 = 13;
5339 var SPACE$1 = 32;
5340 var BACK_SLASH = 92;
5341 var E = 101; // 'e'.charCodeAt(0)
5342
5343 function firstCharOffset(source) {
5344 // detect BOM (https://en.wikipedia.org/wiki/Byte_order_mark)
5345 if (source.charCodeAt(0) === 0xFEFF || // UTF-16BE
5346 source.charCodeAt(0) === 0xFFFE) { // UTF-16LE
5347 return 1;
5348 }
5349
5350 return 0;
5351 }
5352
5353 function isHex(code) {
5354 return (code >= 48 && code <= 57) || // 0 .. 9
5355 (code >= 65 && code <= 70) || // A .. F
5356 (code >= 97 && code <= 102); // a .. f
5357 }
5358
5359 function isNumber(code) {
5360 return code >= 48 && code <= 57;
5361 }
5362
5363 function isWhiteSpace(code) {
5364 return code === SPACE$1 || code === TAB$1 || isNewline(code);
5365 }
5366
5367 function isNewline(code) {
5368 return code === R$1 || code === N$1 || code === F$1;
5369 }
5370
5371 function getNewlineLength(source, offset, code) {
5372 if (isNewline(code)) {
5373 if (code === R$1 && offset + 1 < source.length && source.charCodeAt(offset + 1) === N$1) {
5374 return 2;
5375 }
5376
5377 return 1;
5378 }
5379
5380 return 0;
5381 }
5382
5383 function cmpChar(testStr, offset, referenceCode) {
5384 var code = testStr.charCodeAt(offset);
5385
5386 // code.toLowerCase() for A..Z
5387 if (code >= 65 && code <= 90) {
5388 code = code | 32;
5389 }
5390
5391 return code === referenceCode;
5392 }
5393
5394 function cmpStr(testStr, start, end, referenceStr) {
5395 if (end - start !== referenceStr.length) {
5396 return false;
5397 }
5398
5399 if (start < 0 || end > testStr.length) {
5400 return false;
5401 }
5402
5403 for (var i = start; i < end; i++) {
5404 var testCode = testStr.charCodeAt(i);
5405 var refCode = referenceStr.charCodeAt(i - start);
5406
5407 // testCode.toLowerCase() for A..Z
5408 if (testCode >= 65 && testCode <= 90) {
5409 testCode = testCode | 32;
5410 }
5411
5412 if (testCode !== refCode) {
5413 return false;
5414 }
5415 }
5416
5417 return true;
5418 }
5419
5420 function findWhiteSpaceStart(source, offset) {
5421 while (offset >= 0 && isWhiteSpace(source.charCodeAt(offset))) {
5422 offset--;
5423 }
5424
5425 return offset + 1;
5426 }
5427
5428 function findWhiteSpaceEnd(source, offset) {
5429 while (offset < source.length && isWhiteSpace(source.charCodeAt(offset))) {
5430 offset++;
5431 }
5432
5433 return offset;
5434 }
5435
5436 function findCommentEnd(source, offset) {
5437 var commentEnd = source.indexOf('*/', offset);
5438
5439 if (commentEnd === -1) {
5440 return source.length;
5441 }
5442
5443 return commentEnd + 2;
5444 }
5445
5446 function findStringEnd(source, offset, quote) {
5447 for (; offset < source.length; offset++) {
5448 var code = source.charCodeAt(offset);
5449
5450 // TODO: bad string
5451 if (code === BACK_SLASH) {
5452 offset++;
5453 } else if (code === quote) {
5454 offset++;
5455 break;
5456 }
5457 }
5458
5459 return offset;
5460 }
5461
5462 function findDecimalNumberEnd(source, offset) {
5463 while (offset < source.length && isNumber(source.charCodeAt(offset))) {
5464 offset++;
5465 }
5466
5467 return offset;
5468 }
5469
5470 function findNumberEnd(source, offset, allowFraction) {
5471 var code;
5472
5473 offset = findDecimalNumberEnd(source, offset);
5474
5475 // fraction: .\d+
5476 if (allowFraction && offset + 1 < source.length && source.charCodeAt(offset) === FULLSTOP) {
5477 code = source.charCodeAt(offset + 1);
5478
5479 if (isNumber(code)) {
5480 offset = findDecimalNumberEnd(source, offset + 1);
5481 }
5482 }
5483
5484 // exponent: e[+-]\d+
5485 if (offset + 1 < source.length) {
5486 if ((source.charCodeAt(offset) | 32) === E) { // case insensitive check for `e`
5487 code = source.charCodeAt(offset + 1);
5488
5489 if (code === PLUSSIGN || code === HYPHENMINUS) {
5490 if (offset + 2 < source.length) {
5491 code = source.charCodeAt(offset + 2);
5492 }
5493 }
5494
5495 if (isNumber(code)) {
5496 offset = findDecimalNumberEnd(source, offset + 2);
5497 }
5498 }
5499 }
5500
5501 return offset;
5502 }
5503
5504 // skip escaped unicode sequence that can ends with space
5505 // [0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
5506 function findEscapeEnd(source, offset) {
5507 for (var i = 0; i < 7 && offset + i < source.length; i++) {
5508 var code = source.charCodeAt(offset + i);
5509
5510 if (i !== 6 && isHex(code)) {
5511 continue;
5512 }
5513
5514 if (i > 0) {
5515 offset += i - 1 + getNewlineLength(source, offset + i, code);
5516 if (code === SPACE$1 || code === TAB$1) {
5517 offset++;
5518 }
5519 }
5520
5521 break;
5522 }
5523
5524 return offset;
5525 }
5526
5527 function findIdentifierEnd(source, offset) {
5528 for (; offset < source.length; offset++) {
5529 var code = source.charCodeAt(offset);
5530
5531 if (code === BACK_SLASH) {
5532 offset = findEscapeEnd(source, offset + 1);
5533 } else if (code < 0x80 && PUNCTUATION$1[code] === PUNCTUATOR$1) {
5534 break;
5535 }
5536 }
5537
5538 return offset;
5539 }
5540
5541 function findUrlRawEnd(source, offset) {
5542 for (; offset < source.length; offset++) {
5543 var code = source.charCodeAt(offset);
5544
5545 if (code === BACK_SLASH) {
5546 offset = findEscapeEnd(source, offset + 1);
5547 } else if (code < 0x80 && STOP_URL_RAW$1[code] === 1) {
5548 break;
5549 }
5550 }
5551
5552 return offset;
5553 }
5554
5555 var utils$2 = {
5556 firstCharOffset: firstCharOffset,
5557
5558 isHex: isHex,
5559 isNumber: isNumber,
5560 isWhiteSpace: isWhiteSpace,
5561 isNewline: isNewline,
5562 getNewlineLength: getNewlineLength,
5563
5564 cmpChar: cmpChar,
5565 cmpStr: cmpStr,
5566
5567 findWhiteSpaceStart: findWhiteSpaceStart,
5568 findWhiteSpaceEnd: findWhiteSpaceEnd,
5569 findCommentEnd: findCommentEnd,
5570 findStringEnd: findStringEnd,
5571 findDecimalNumberEnd: findDecimalNumberEnd,
5572 findNumberEnd: findNumberEnd,
5573 findEscapeEnd: findEscapeEnd,
5574 findIdentifierEnd: findIdentifierEnd,
5575 findUrlRawEnd: findUrlRawEnd
5576 };
5577
5578 var TYPE$2 = _const.TYPE;
5579 var NAME$1 = _const.NAME;
5580 var SYMBOL_TYPE$1 = _const.SYMBOL_TYPE;
5581
5582
5583 var firstCharOffset$1 = utils$2.firstCharOffset;
5584 var cmpStr$1 = utils$2.cmpStr;
5585 var isNumber$1 = utils$2.isNumber;
5586 var findWhiteSpaceStart$1 = utils$2.findWhiteSpaceStart;
5587 var findWhiteSpaceEnd$1 = utils$2.findWhiteSpaceEnd;
5588 var findCommentEnd$1 = utils$2.findCommentEnd;
5589 var findStringEnd$1 = utils$2.findStringEnd;
5590 var findNumberEnd$1 = utils$2.findNumberEnd;
5591 var findIdentifierEnd$1 = utils$2.findIdentifierEnd;
5592 var findUrlRawEnd$1 = utils$2.findUrlRawEnd;
5593
5594 var NULL = 0;
5595 var WHITESPACE$1 = TYPE$2.WhiteSpace;
5596 var IDENTIFIER$1 = TYPE$2.Identifier;
5597 var NUMBER$1 = TYPE$2.Number;
5598 var STRING$1 = TYPE$2.String;
5599 var COMMENT$1 = TYPE$2.Comment;
5600 var PUNCTUATOR$2 = TYPE$2.Punctuator;
5601 var CDO$1 = TYPE$2.CDO;
5602 var CDC$1 = TYPE$2.CDC;
5603 var ATKEYWORD$1 = TYPE$2.AtKeyword;
5604 var FUNCTION$1 = TYPE$2.Function;
5605 var URL$2 = TYPE$2.Url;
5606 var RAW$1 = TYPE$2.Raw;
5607
5608 var N$2 = 10;
5609 var F$2 = 12;
5610 var R$2 = 13;
5611 var STAR = TYPE$2.Asterisk;
5612 var SLASH = TYPE$2.Solidus;
5613 var FULLSTOP$1 = TYPE$2.FullStop;
5614 var PLUSSIGN$1 = TYPE$2.PlusSign;
5615 var HYPHENMINUS$1 = TYPE$2.HyphenMinus;
5616 var GREATERTHANSIGN = TYPE$2.GreaterThanSign;
5617 var LESSTHANSIGN = TYPE$2.LessThanSign;
5618 var EXCLAMATIONMARK = TYPE$2.ExclamationMark;
5619 var COMMERCIALAT = TYPE$2.CommercialAt;
5620 var QUOTATIONMARK = TYPE$2.QuotationMark;
5621 var APOSTROPHE = TYPE$2.Apostrophe;
5622 var LEFTPARENTHESIS = TYPE$2.LeftParenthesis;
5623 var RIGHTPARENTHESIS = TYPE$2.RightParenthesis;
5624 var LEFTCURLYBRACKET = TYPE$2.LeftCurlyBracket;
5625 var RIGHTCURLYBRACKET = TYPE$2.RightCurlyBracket;
5626 var LEFTSQUAREBRACKET = TYPE$2.LeftSquareBracket;
5627 var RIGHTSQUAREBRACKET = TYPE$2.RightSquareBracket;
5628
5629 var MIN_BUFFER_SIZE = 16 * 1024;
5630 var OFFSET_MASK = 0x00FFFFFF;
5631 var TYPE_SHIFT = 24;
5632 var SafeUint32Array$1 = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
5633
5634 function computeLinesAndColumns(tokenizer, source) {
5635 var sourceLength = source.length;
5636 var start = firstCharOffset$1(source);
5637 var lines = tokenizer.lines;
5638 var line = tokenizer.startLine;
5639 var columns = tokenizer.columns;
5640 var column = tokenizer.startColumn;
5641
5642 if (lines === null || lines.length < sourceLength + 1) {
5643 lines = new SafeUint32Array$1(Math.max(sourceLength + 1024, MIN_BUFFER_SIZE));
5644 columns = new SafeUint32Array$1(lines.length);
5645 }
5646
5647 for (var i = start; i < sourceLength; i++) {
5648 var code = source.charCodeAt(i);
5649
5650 lines[i] = line;
5651 columns[i] = column++;
5652
5653 if (code === N$2 || code === R$2 || code === F$2) {
5654 if (code === R$2 && i + 1 < sourceLength && source.charCodeAt(i + 1) === N$2) {
5655 i++;
5656 lines[i] = line;
5657 columns[i] = column;
5658 }
5659
5660 line++;
5661 column = 1;
5662 }
5663 }
5664
5665 lines[i] = line;
5666 columns[i] = column;
5667
5668 tokenizer.linesAnsColumnsComputed = true;
5669 tokenizer.lines = lines;
5670 tokenizer.columns = columns;
5671 }
5672
5673 function tokenLayout(tokenizer, source, startPos) {
5674 var sourceLength = source.length;
5675 var offsetAndType = tokenizer.offsetAndType;
5676 var balance = tokenizer.balance;
5677 var tokenCount = 0;
5678 var prevType = 0;
5679 var offset = startPos;
5680 var anchor = 0;
5681 var balanceCloseCode = 0;
5682 var balanceStart = 0;
5683 var balancePrev = 0;
5684
5685 if (offsetAndType === null || offsetAndType.length < sourceLength + 1) {
5686 offsetAndType = new SafeUint32Array$1(sourceLength + 1024);
5687 balance = new SafeUint32Array$1(sourceLength + 1024);
5688 }
5689
5690 while (offset < sourceLength) {
5691 var code = source.charCodeAt(offset);
5692 var type = code < 0x80 ? SYMBOL_TYPE$1[code] : IDENTIFIER$1;
5693
5694 balance[tokenCount] = sourceLength;
5695
5696 switch (type) {
5697 case WHITESPACE$1:
5698 offset = findWhiteSpaceEnd$1(source, offset + 1);
5699 break;
5700
5701 case PUNCTUATOR$2:
5702 switch (code) {
5703 case balanceCloseCode:
5704 balancePrev = balanceStart & OFFSET_MASK;
5705 balanceStart = balance[balancePrev];
5706 balanceCloseCode = balanceStart >> TYPE_SHIFT;
5707 balance[tokenCount] = balancePrev;
5708 balance[balancePrev++] = tokenCount;
5709 for (; balancePrev < tokenCount; balancePrev++) {
5710 if (balance[balancePrev] === sourceLength) {
5711 balance[balancePrev] = tokenCount;
5712 }
5713 }
5714 break;
5715
5716 case LEFTSQUAREBRACKET:
5717 balance[tokenCount] = balanceStart;
5718 balanceCloseCode = RIGHTSQUAREBRACKET;
5719 balanceStart = (balanceCloseCode << TYPE_SHIFT) | tokenCount;
5720 break;
5721
5722 case LEFTCURLYBRACKET:
5723 balance[tokenCount] = balanceStart;
5724 balanceCloseCode = RIGHTCURLYBRACKET;
5725 balanceStart = (balanceCloseCode << TYPE_SHIFT) | tokenCount;
5726 break;
5727
5728 case LEFTPARENTHESIS:
5729 balance[tokenCount] = balanceStart;
5730 balanceCloseCode = RIGHTPARENTHESIS;
5731 balanceStart = (balanceCloseCode << TYPE_SHIFT) | tokenCount;
5732 break;
5733 }
5734
5735 // /*
5736 if (code === STAR && prevType === SLASH) {
5737 type = COMMENT$1;
5738 offset = findCommentEnd$1(source, offset + 1);
5739 tokenCount--; // rewrite prev token
5740 break;
5741 }
5742
5743 // edge case for -.123 and +.123
5744 if (code === FULLSTOP$1 && (prevType === PLUSSIGN$1 || prevType === HYPHENMINUS$1)) {
5745 if (offset + 1 < sourceLength && isNumber$1(source.charCodeAt(offset + 1))) {
5746 type = NUMBER$1;
5747 offset = findNumberEnd$1(source, offset + 2, false);
5748 tokenCount--; // rewrite prev token
5749 break;
5750 }
5751 }
5752
5753 // <!--
5754 if (code === EXCLAMATIONMARK && prevType === LESSTHANSIGN) {
5755 if (offset + 2 < sourceLength &&
5756 source.charCodeAt(offset + 1) === HYPHENMINUS$1 &&
5757 source.charCodeAt(offset + 2) === HYPHENMINUS$1) {
5758 type = CDO$1;
5759 offset = offset + 3;
5760 tokenCount--; // rewrite prev token
5761 break;
5762 }
5763 }
5764
5765 // -->
5766 if (code === HYPHENMINUS$1 && prevType === HYPHENMINUS$1) {
5767 if (offset + 1 < sourceLength && source.charCodeAt(offset + 1) === GREATERTHANSIGN) {
5768 type = CDC$1;
5769 offset = offset + 2;
5770 tokenCount--; // rewrite prev token
5771 break;
5772 }
5773 }
5774
5775 // ident(
5776 if (code === LEFTPARENTHESIS && prevType === IDENTIFIER$1) {
5777 offset = offset + 1;
5778 tokenCount--; // rewrite prev token
5779 balance[tokenCount] = balance[tokenCount + 1];
5780 balanceStart--;
5781
5782 // 4 char length identifier and equal to `url(` (case insensitive)
5783 if (offset - anchor === 4 && cmpStr$1(source, anchor, offset, 'url(')) {
5784 // special case for url() because it can contain any symbols sequence with few exceptions
5785 anchor = findWhiteSpaceEnd$1(source, offset);
5786 code = source.charCodeAt(anchor);
5787 if (code !== LEFTPARENTHESIS &&
5788 code !== RIGHTPARENTHESIS &&
5789 code !== QUOTATIONMARK &&
5790 code !== APOSTROPHE) {
5791 // url(
5792 offsetAndType[tokenCount++] = (URL$2 << TYPE_SHIFT) | offset;
5793 balance[tokenCount] = sourceLength;
5794
5795 // ws*
5796 if (anchor !== offset) {
5797 offsetAndType[tokenCount++] = (WHITESPACE$1 << TYPE_SHIFT) | anchor;
5798 balance[tokenCount] = sourceLength;
5799 }
5800
5801 // raw
5802 type = RAW$1;
5803 offset = findUrlRawEnd$1(source, anchor);
5804 } else {
5805 type = URL$2;
5806 }
5807 } else {
5808 type = FUNCTION$1;
5809 }
5810 break;
5811 }
5812
5813 type = code;
5814 offset = offset + 1;
5815 break;
5816
5817 case NUMBER$1:
5818 offset = findNumberEnd$1(source, offset + 1, prevType !== FULLSTOP$1);
5819
5820 // merge number with a preceding dot, dash or plus
5821 if (prevType === FULLSTOP$1 ||
5822 prevType === HYPHENMINUS$1 ||
5823 prevType === PLUSSIGN$1) {
5824 tokenCount--; // rewrite prev token
5825 }
5826
5827 break;
5828
5829 case STRING$1:
5830 offset = findStringEnd$1(source, offset + 1, code);
5831 break;
5832
5833 default:
5834 anchor = offset;
5835 offset = findIdentifierEnd$1(source, offset);
5836
5837 // merge identifier with a preceding dash
5838 if (prevType === HYPHENMINUS$1) {
5839 // rewrite prev token
5840 tokenCount--;
5841 // restore prev prev token type
5842 // for case @-prefix-ident
5843 prevType = tokenCount === 0 ? 0 : offsetAndType[tokenCount - 1] >> TYPE_SHIFT;
5844 }
5845
5846 if (prevType === COMMERCIALAT) {
5847 // rewrite prev token and change type to <at-keyword-token>
5848 tokenCount--;
5849 type = ATKEYWORD$1;
5850 }
5851 }
5852
5853 offsetAndType[tokenCount++] = (type << TYPE_SHIFT) | offset;
5854 prevType = type;
5855 }
5856
5857 // finalize arrays
5858 offsetAndType[tokenCount] = offset;
5859 balance[tokenCount] = sourceLength;
5860 balance[sourceLength] = sourceLength; // prevents false positive balance match with any token
5861 while (balanceStart !== 0) {
5862 balancePrev = balanceStart & OFFSET_MASK;
5863 balanceStart = balance[balancePrev];
5864 balance[balancePrev] = sourceLength;
5865 }
5866
5867 tokenizer.offsetAndType = offsetAndType;
5868 tokenizer.tokenCount = tokenCount;
5869 tokenizer.balance = balance;
5870 }
5871
5872 //
5873 // tokenizer
5874 //
5875
5876 var Tokenizer = function(source, startOffset, startLine, startColumn) {
5877 this.offsetAndType = null;
5878 this.balance = null;
5879 this.lines = null;
5880 this.columns = null;
5881
5882 this.setSource(source, startOffset, startLine, startColumn);
5883 };
5884
5885 Tokenizer.prototype = {
5886 setSource: function(source, startOffset, startLine, startColumn) {
5887 var safeSource = String(source || '');
5888 var start = firstCharOffset$1(safeSource);
5889
5890 this.source = safeSource;
5891 this.firstCharOffset = start;
5892 this.startOffset = typeof startOffset === 'undefined' ? 0 : startOffset;
5893 this.startLine = typeof startLine === 'undefined' ? 1 : startLine;
5894 this.startColumn = typeof startColumn === 'undefined' ? 1 : startColumn;
5895 this.linesAnsColumnsComputed = false;
5896
5897 this.eof = false;
5898 this.currentToken = -1;
5899 this.tokenType = 0;
5900 this.tokenStart = start;
5901 this.tokenEnd = start;
5902
5903 tokenLayout(this, safeSource, start);
5904 this.next();
5905 },
5906
5907 lookupType: function(offset) {
5908 offset += this.currentToken;
5909
5910 if (offset < this.tokenCount) {
5911 return this.offsetAndType[offset] >> TYPE_SHIFT;
5912 }
5913
5914 return NULL;
5915 },
5916 lookupNonWSType: function(offset) {
5917 offset += this.currentToken;
5918
5919 for (var type; offset < this.tokenCount; offset++) {
5920 type = this.offsetAndType[offset] >> TYPE_SHIFT;
5921
5922 if (type !== WHITESPACE$1) {
5923 return type;
5924 }
5925 }
5926
5927 return NULL;
5928 },
5929 lookupValue: function(offset, referenceStr) {
5930 offset += this.currentToken;
5931
5932 if (offset < this.tokenCount) {
5933 return cmpStr$1(
5934 this.source,
5935 this.offsetAndType[offset - 1] & OFFSET_MASK,
5936 this.offsetAndType[offset] & OFFSET_MASK,
5937 referenceStr
5938 );
5939 }
5940
5941 return false;
5942 },
5943 getTokenStart: function(tokenNum) {
5944 if (tokenNum === this.currentToken) {
5945 return this.tokenStart;
5946 }
5947
5948 if (tokenNum > 0) {
5949 return tokenNum < this.tokenCount
5950 ? this.offsetAndType[tokenNum - 1] & OFFSET_MASK
5951 : this.offsetAndType[this.tokenCount] & OFFSET_MASK;
5952 }
5953
5954 return this.firstCharOffset;
5955 },
5956 getOffsetExcludeWS: function() {
5957 if (this.currentToken > 0) {
5958 if ((this.offsetAndType[this.currentToken - 1] >> TYPE_SHIFT) === WHITESPACE$1) {
5959 return this.currentToken > 1
5960 ? this.offsetAndType[this.currentToken - 2] & OFFSET_MASK
5961 : this.firstCharOffset;
5962 }
5963 }
5964 return this.tokenStart;
5965 },
5966 getRawLength: function(startToken, endTokenType1, endTokenType2, includeTokenType2) {
5967 var cursor = startToken;
5968 var balanceEnd;
5969
5970 loop:
5971 for (; cursor < this.tokenCount; cursor++) {
5972 balanceEnd = this.balance[cursor];
5973
5974 // belance end points to offset before start
5975 if (balanceEnd < startToken) {
5976 break loop;
5977 }
5978
5979 // check token is stop type
5980 switch (this.offsetAndType[cursor] >> TYPE_SHIFT) {
5981 case endTokenType1:
5982 break loop;
5983
5984 case endTokenType2:
5985 if (includeTokenType2) {
5986 cursor++;
5987 }
5988 break loop;
5989
5990 default:
5991 // fast forward to the end of balanced block
5992 if (this.balance[balanceEnd] === cursor) {
5993 cursor = balanceEnd;
5994 }
5995 }
5996
5997 }
5998
5999 return cursor - this.currentToken;
6000 },
6001 isBalanceEdge: function(pos) {
6002 var balanceStart = this.balance[this.currentToken];
6003 return balanceStart < pos;
6004 },
6005
6006 getTokenValue: function() {
6007 return this.source.substring(this.tokenStart, this.tokenEnd);
6008 },
6009 substrToCursor: function(start) {
6010 return this.source.substring(start, this.tokenStart);
6011 },
6012
6013 skipWS: function() {
6014 for (var i = this.currentToken, skipTokenCount = 0; i < this.tokenCount; i++, skipTokenCount++) {
6015 if ((this.offsetAndType[i] >> TYPE_SHIFT) !== WHITESPACE$1) {
6016 break;
6017 }
6018 }
6019
6020 if (skipTokenCount > 0) {
6021 this.skip(skipTokenCount);
6022 }
6023 },
6024 skipSC: function() {
6025 while (this.tokenType === WHITESPACE$1 || this.tokenType === COMMENT$1) {
6026 this.next();
6027 }
6028 },
6029 skip: function(tokenCount) {
6030 var next = this.currentToken + tokenCount;
6031
6032 if (next < this.tokenCount) {
6033 this.currentToken = next;
6034 this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK;
6035 next = this.offsetAndType[next];
6036 this.tokenType = next >> TYPE_SHIFT;
6037 this.tokenEnd = next & OFFSET_MASK;
6038 } else {
6039 this.currentToken = this.tokenCount;
6040 this.next();
6041 }
6042 },
6043 next: function() {
6044 var next = this.currentToken + 1;
6045
6046 if (next < this.tokenCount) {
6047 this.currentToken = next;
6048 this.tokenStart = this.tokenEnd;
6049 next = this.offsetAndType[next];
6050 this.tokenType = next >> TYPE_SHIFT;
6051 this.tokenEnd = next & OFFSET_MASK;
6052 } else {
6053 this.currentToken = this.tokenCount;
6054 this.eof = true;
6055 this.tokenType = NULL;
6056 this.tokenStart = this.tokenEnd = this.source.length;
6057 }
6058 },
6059
6060 eat: function(tokenType) {
6061 if (this.tokenType !== tokenType) {
6062 var offset = this.tokenStart;
6063 var message = NAME$1[tokenType] + ' is expected';
6064
6065 // tweak message and offset
6066 if (tokenType === IDENTIFIER$1) {
6067 // when identifier is expected but there is a function or url
6068 if (this.tokenType === FUNCTION$1 || this.tokenType === URL$2) {
6069 offset = this.tokenEnd - 1;
6070 message += ' but function found';
6071 }
6072 } else {
6073 // when test type is part of another token show error for current position + 1
6074 // e.g. eat(HYPHENMINUS) will fail on "-foo", but pointing on "-" is odd
6075 if (this.source.charCodeAt(this.tokenStart) === tokenType) {
6076 offset = offset + 1;
6077 }
6078 }
6079
6080 this.error(message, offset);
6081 }
6082
6083 this.next();
6084 },
6085 eatNonWS: function(tokenType) {
6086 this.skipWS();
6087 this.eat(tokenType);
6088 },
6089
6090 consume: function(tokenType) {
6091 var value = this.getTokenValue();
6092
6093 this.eat(tokenType);
6094
6095 return value;
6096 },
6097 consumeFunctionName: function() {
6098 var name = this.source.substring(this.tokenStart, this.tokenEnd - 1);
6099
6100 this.eat(FUNCTION$1);
6101
6102 return name;
6103 },
6104 consumeNonWS: function(tokenType) {
6105 this.skipWS();
6106
6107 return this.consume(tokenType);
6108 },
6109
6110 expectIdentifier: function(name) {
6111 if (this.tokenType !== IDENTIFIER$1 || cmpStr$1(this.source, this.tokenStart, this.tokenEnd, name) === false) {
6112 this.error('Identifier `' + name + '` is expected');
6113 }
6114
6115 this.next();
6116 },
6117
6118 getLocation: function(offset, filename) {
6119 if (!this.linesAnsColumnsComputed) {
6120 computeLinesAndColumns(this, this.source);
6121 }
6122
6123 return {
6124 source: filename,
6125 offset: this.startOffset + offset,
6126 line: this.lines[offset],
6127 column: this.columns[offset]
6128 };
6129 },
6130
6131 getLocationRange: function(start, end, filename) {
6132 if (!this.linesAnsColumnsComputed) {
6133 computeLinesAndColumns(this, this.source);
6134 }
6135
6136 return {
6137 source: filename,
6138 start: {
6139 offset: this.startOffset + start,
6140 line: this.lines[start],
6141 column: this.columns[start]
6142 },
6143 end: {
6144 offset: this.startOffset + end,
6145 line: this.lines[end],
6146 column: this.columns[end]
6147 }
6148 };
6149 },
6150
6151 error: function(message, offset) {
6152 var location = typeof offset !== 'undefined' && offset < this.source.length
6153 ? this.getLocation(offset)
6154 : this.eof
6155 ? this.getLocation(findWhiteSpaceStart$1(this.source, this.source.length - 1))
6156 : this.getLocation(this.tokenStart);
6157
6158 throw new error(
6159 message || 'Unexpected input',
6160 this.source,
6161 location.offset,
6162 location.line,
6163 location.column
6164 );
6165 },
6166
6167 dump: function() {
6168 var offset = 0;
6169
6170 return Array.prototype.slice.call(this.offsetAndType, 0, this.tokenCount).map(function(item, idx) {
6171 var start = offset;
6172 var end = item & OFFSET_MASK;
6173
6174 offset = end;
6175
6176 return {
6177 idx: idx,
6178 type: NAME$1[item >> TYPE_SHIFT],
6179 chunk: this.source.substring(start, end),
6180 balance: this.balance[idx]
6181 };
6182 }, this);
6183 }
6184 };
6185
6186 // extend with error class
6187 Tokenizer.CssSyntaxError = error;
6188
6189 // extend tokenizer with constants
6190 Object.keys(_const).forEach(function(key) {
6191 Tokenizer[key] = _const[key];
6192 });
6193
6194 // extend tokenizer with static methods from utils
6195 Object.keys(utils$2).forEach(function(key) {
6196 Tokenizer[key] = utils$2[key];
6197 });
6198
6199 // warm up tokenizer to elimitate code branches that never execute
6200 // fix soft deoptimizations (insufficient type feedback)
6201 new Tokenizer('\n\r\r\n\f<!---->//""\'\'/*\r\n\f*/1a;.\\31\t\+2{url(a);func();+1.2e3 -.4e-5 .6e+7}').getLocation();
6202
6203 var Tokenizer_1 = Tokenizer;
6204
6205 var tokenizer = Tokenizer_1;
6206
6207 function noop$1(value) {
6208 return value;
6209 }
6210
6211 function generateMultiplier(multiplier) {
6212 if (multiplier.min === 0 && multiplier.max === 0) {
6213 return '*';
6214 }
6215
6216 if (multiplier.min === 0 && multiplier.max === 1) {
6217 return '?';
6218 }
6219
6220 if (multiplier.min === 1 && multiplier.max === 0) {
6221 return multiplier.comma ? '#' : '+';
6222 }
6223
6224 if (multiplier.min === 1 && multiplier.max === 1) {
6225 return '';
6226 }
6227
6228 return (
6229 (multiplier.comma ? '#' : '') +
6230 (multiplier.min === multiplier.max
6231 ? '{' + multiplier.min + '}'
6232 : '{' + multiplier.min + ',' + (multiplier.max !== 0 ? multiplier.max : '') + '}'
6233 )
6234 );
6235 }
6236
6237 function generateSequence(node, forceBraces, decorate) {
6238 var result = node.terms.map(function(term) {
6239 return generate(term, forceBraces, decorate);
6240 }).join(node.combinator === ' ' ? ' ' : ' ' + node.combinator + ' ');
6241
6242 if (node.explicit || forceBraces) {
6243 result = (result[0] !== ',' ? '[ ' : '[') + result + ' ]';
6244 }
6245
6246 return result;
6247 }
6248
6249 function generate(node, forceBraces, decorate) {
6250 var result;
6251
6252 switch (node.type) {
6253 case 'Group':
6254 result =
6255 generateSequence(node, forceBraces, decorate) +
6256 (node.disallowEmpty ? '!' : '');
6257 break;
6258
6259 case 'Multiplier':
6260 // return since node is a composition
6261 return (
6262 generate(node.term, forceBraces, decorate) +
6263 decorate(generateMultiplier(node), node)
6264 );
6265
6266 case 'Type':
6267 result = '<' + node.name + '>';
6268 break;
6269
6270 case 'Property':
6271 result = '<\'' + node.name + '\'>';
6272 break;
6273
6274 case 'Keyword':
6275 result = node.name;
6276 break;
6277
6278 case 'AtKeyword':
6279 result = '@' + node.name;
6280 break;
6281
6282 case 'Function':
6283 result = node.name + '(';
6284 break;
6285
6286 case 'String':
6287 case 'Token':
6288 result = node.value;
6289 break;
6290
6291 case 'Comma':
6292 result = ',';
6293 break;
6294
6295 default:
6296 throw new Error('Unknown node type `' + node.type + '`');
6297 }
6298
6299 return decorate(result, node);
6300 }
6301
6302 var generate_1 = function(node, options) {
6303 var decorate = noop$1;
6304 var forceBraces = false;
6305
6306 if (typeof options === 'function') {
6307 decorate = options;
6308 } else if (options) {
6309 forceBraces = Boolean(options.forceBraces);
6310 if (typeof options.decorate === 'function') {
6311 decorate = options.decorate;
6312 }
6313 }
6314
6315 return generate(node, forceBraces, decorate);
6316 };
6317
6318 function fromMatchResult(matchResult) {
6319 var tokens = matchResult.tokens;
6320 var longestMatch = matchResult.longestMatch;
6321 var node = longestMatch < tokens.length ? tokens[longestMatch].node : null;
6322 var mismatchOffset = 0;
6323 var entries = 0;
6324 var css = '';
6325
6326 for (var i = 0; i < tokens.length; i++) {
6327 if (i === longestMatch) {
6328 mismatchOffset = css.length;
6329 }
6330
6331 if (node !== null && tokens[i].node === node) {
6332 if (i <= longestMatch) {
6333 entries++;
6334 } else {
6335 entries = 0;
6336 }
6337 }
6338
6339 css += tokens[i].value;
6340 }
6341
6342 if (node === null) {
6343 mismatchOffset = css.length;
6344 }
6345
6346 return {
6347 node: node,
6348 css: css,
6349 mismatchOffset: mismatchOffset,
6350 last: node === null || entries > 1
6351 };
6352 }
6353
6354 function getLocation(node, point) {
6355 var loc = node && node.loc && node.loc[point];
6356
6357 if (loc) {
6358 return {
6359 offset: loc.offset,
6360 line: loc.line,
6361 column: loc.column
6362 };
6363 }
6364
6365 return null;
6366 }
6367
6368 var SyntaxReferenceError = function(type, referenceName) {
6369 var error = createCustomError(
6370 'SyntaxReferenceError',
6371 type + (referenceName ? ' `' + referenceName + '`' : '')
6372 );
6373
6374 error.reference = referenceName;
6375
6376 return error;
6377 };
6378
6379 var MatchError = function(message, lexer, syntax, node, matchResult) {
6380 var error = createCustomError('SyntaxMatchError', message);
6381 var details = fromMatchResult(matchResult);
6382 var mismatchOffset = details.mismatchOffset || 0;
6383 var badNode = details.node || node;
6384 var end = getLocation(badNode, 'end');
6385 var start = details.last ? end : getLocation(badNode, 'start');
6386 var css = details.css;
6387
6388 error.rawMessage = message;
6389 error.syntax = syntax ? generate_1(syntax) : '<generic>';
6390 error.css = css;
6391 error.mismatchOffset = mismatchOffset;
6392 error.loc = {
6393 source: (badNode && badNode.loc && badNode.loc.source) || '<unknown>',
6394 start: start,
6395 end: end
6396 };
6397 error.line = start ? start.line : undefined;
6398 error.column = start ? start.column : undefined;
6399 error.offset = start ? start.offset : undefined;
6400 error.message = message + '\n' +
6401 ' syntax: ' + error.syntax + '\n' +
6402 ' value: ' + (error.css || '<empty string>') + '\n' +
6403 ' --------' + new Array(error.mismatchOffset + 1).join('-') + '^';
6404
6405 return error;
6406 };
6407
6408 var error$1 = {
6409 SyntaxReferenceError: SyntaxReferenceError,
6410 MatchError: MatchError
6411 };
6412
6413 var hasOwnProperty = Object.prototype.hasOwnProperty;
6414 var keywords = Object.create(null);
6415 var properties = Object.create(null);
6416 var HYPHENMINUS$2 = 45; // '-'.charCodeAt()
6417
6418 function isCustomProperty(str, offset) {
6419 offset = offset || 0;
6420
6421 return str.length - offset >= 2 &&
6422 str.charCodeAt(offset) === HYPHENMINUS$2 &&
6423 str.charCodeAt(offset + 1) === HYPHENMINUS$2;
6424 }
6425
6426 function getVendorPrefix(str, offset) {
6427 offset = offset || 0;
6428
6429 // verdor prefix should be at least 3 chars length
6430 if (str.length - offset >= 3) {
6431 // vendor prefix starts with hyper minus following non-hyper minus
6432 if (str.charCodeAt(offset) === HYPHENMINUS$2 &&
6433 str.charCodeAt(offset + 1) !== HYPHENMINUS$2) {
6434 // vendor prefix should contain a hyper minus at the ending
6435 var secondDashIndex = str.indexOf('-', offset + 2);
6436
6437 if (secondDashIndex !== -1) {
6438 return str.substring(offset, secondDashIndex + 1);
6439 }
6440 }
6441 }
6442
6443 return '';
6444 }
6445
6446 function getKeywordDescriptor(keyword) {
6447 if (hasOwnProperty.call(keywords, keyword)) {
6448 return keywords[keyword];
6449 }
6450
6451 var name = keyword.toLowerCase();
6452
6453 if (hasOwnProperty.call(keywords, name)) {
6454 return keywords[keyword] = keywords[name];
6455 }
6456
6457 var custom = isCustomProperty(name, 0);
6458 var vendor = !custom ? getVendorPrefix(name, 0) : '';
6459
6460 return keywords[keyword] = Object.freeze({
6461 basename: name.substr(vendor.length),
6462 name: name,
6463 vendor: vendor,
6464 prefix: vendor,
6465 custom: custom
6466 });
6467 }
6468
6469 function getPropertyDescriptor(property) {
6470 if (hasOwnProperty.call(properties, property)) {
6471 return properties[property];
6472 }
6473
6474 var name = property;
6475 var hack = property[0];
6476
6477 if (hack === '/') {
6478 hack = property[1] === '/' ? '//' : '/';
6479 } else if (hack !== '_' &&
6480 hack !== '*' &&
6481 hack !== '$' &&
6482 hack !== '#' &&
6483 hack !== '+') {
6484 hack = '';
6485 }
6486
6487 var custom = isCustomProperty(name, hack.length);
6488
6489 // re-use result when possible (the same as for lower case)
6490 if (!custom) {
6491 name = name.toLowerCase();
6492 if (hasOwnProperty.call(properties, name)) {
6493 return properties[property] = properties[name];
6494 }
6495 }
6496
6497 var vendor = !custom ? getVendorPrefix(name, hack.length) : '';
6498 var prefix = name.substr(0, hack.length + vendor.length);
6499
6500 return properties[property] = Object.freeze({
6501 basename: name.substr(prefix.length),
6502 name: name.substr(hack.length),
6503 hack: hack,
6504 vendor: vendor,
6505 prefix: prefix,
6506 custom: custom
6507 });
6508 }
6509
6510 var names = {
6511 keyword: getKeywordDescriptor,
6512 property: getPropertyDescriptor,
6513 isCustomProperty: isCustomProperty,
6514 vendorPrefix: getVendorPrefix
6515 };
6516
6517 var findIdentifierEnd$2 = utils$2.findIdentifierEnd;
6518 var findNumberEnd$2 = utils$2.findNumberEnd;
6519 var findDecimalNumberEnd$1 = utils$2.findDecimalNumberEnd;
6520 var isHex$1 = utils$2.isHex;
6521
6522 var SYMBOL_TYPE$2 = _const.SYMBOL_TYPE;
6523 var IDENTIFIER$2 = _const.TYPE.Identifier;
6524 var PLUSSIGN$2 = _const.TYPE.PlusSign;
6525 var HYPHENMINUS$3 = _const.TYPE.HyphenMinus;
6526 var NUMBERSIGN = _const.TYPE.NumberSign;
6527
6528 var PERCENTAGE = {
6529 '%': true
6530 };
6531
6532 // https://www.w3.org/TR/css-values-3/#lengths
6533 var LENGTH = {
6534 // absolute length units
6535 'px': true,
6536 'mm': true,
6537 'cm': true,
6538 'in': true,
6539 'pt': true,
6540 'pc': true,
6541 'q': true,
6542
6543 // relative length units
6544 'em': true,
6545 'ex': true,
6546 'ch': true,
6547 'rem': true,
6548
6549 // viewport-percentage lengths
6550 'vh': true,
6551 'vw': true,
6552 'vmin': true,
6553 'vmax': true,
6554 'vm': true
6555 };
6556
6557 var ANGLE = {
6558 'deg': true,
6559 'grad': true,
6560 'rad': true,
6561 'turn': true
6562 };
6563
6564 var TIME = {
6565 's': true,
6566 'ms': true
6567 };
6568
6569 var FREQUENCY = {
6570 'hz': true,
6571 'khz': true
6572 };
6573
6574 // https://www.w3.org/TR/css-values-3/#resolution (https://drafts.csswg.org/css-values/#resolution)
6575 var RESOLUTION = {
6576 'dpi': true,
6577 'dpcm': true,
6578 'dppx': true,
6579 'x': true // https://github.com/w3c/csswg-drafts/issues/461
6580 };
6581
6582 // https://drafts.csswg.org/css-grid/#fr-unit
6583 var FLEX = {
6584 'fr': true
6585 };
6586
6587 // https://www.w3.org/TR/css3-speech/#mixing-props-voice-volume
6588 var DECIBEL = {
6589 'db': true
6590 };
6591
6592 // https://www.w3.org/TR/css3-speech/#voice-props-voice-pitch
6593 var SEMITONES = {
6594 'st': true
6595 };
6596
6597 function consumeFunction(token, addTokenToMatch, getNextToken) {
6598 var length = 1;
6599 var cursor;
6600
6601 do {
6602 cursor = getNextToken(length++);
6603 } while (cursor !== null && cursor.node !== token.node);
6604
6605 if (cursor === null) {
6606 return false;
6607 }
6608
6609 while (true) {
6610 // consume tokens until cursor
6611 if (addTokenToMatch() === cursor) {
6612 break;
6613 }
6614 }
6615
6616 return true;
6617 }
6618
6619 // TODO: implement
6620 // can be used wherever <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> values are allowed
6621 // https://drafts.csswg.org/css-values/#calc-notation
6622 function calc(token, addTokenToMatch, getNextToken) {
6623 if (token === null) {
6624 return false;
6625 }
6626
6627 var name = token.value.toLowerCase();
6628 if (name !== 'calc(' &&
6629 name !== '-moz-calc(' &&
6630 name !== '-webkit-calc(') {
6631 return false;
6632 }
6633
6634 return consumeFunction(token, addTokenToMatch, getNextToken);
6635 }
6636
6637 function attr(token, addTokenToMatch, getNextToken) {
6638 if (token === null || token.value.toLowerCase() !== 'attr(') {
6639 return false;
6640 }
6641
6642 return consumeFunction(token, addTokenToMatch, getNextToken);
6643 }
6644
6645 function expression(token, addTokenToMatch, getNextToken) {
6646 if (token === null || token.value.toLowerCase() !== 'expression(') {
6647 return false;
6648 }
6649
6650 return consumeFunction(token, addTokenToMatch, getNextToken);
6651 }
6652
6653 function url(token, addTokenToMatch, getNextToken) {
6654 if (token === null || token.value.toLowerCase() !== 'url(') {
6655 return false;
6656 }
6657
6658 return consumeFunction(token, addTokenToMatch, getNextToken);
6659 }
6660
6661 function idSelector(token, addTokenToMatch) {
6662 if (token === null) {
6663 return false;
6664 }
6665
6666 if (token.value.charCodeAt(0) !== NUMBERSIGN) {
6667 return false;
6668 }
6669
6670 if (consumeIdentifier(token.value, 1) !== token.value.length) {
6671 return false;
6672 }
6673
6674 addTokenToMatch();
6675 return true;
6676 }
6677
6678 function isNumber$2(str) {
6679 return /^[-+]?(\d+|\d*\.\d+)([eE][-+]?\d+)?$/.test(str);
6680 }
6681
6682 function consumeNumber(str, allowFraction) {
6683 var code = str.charCodeAt(0);
6684
6685 return findNumberEnd$2(str, code === PLUSSIGN$2 || code === HYPHENMINUS$3 ? 1 : 0, allowFraction);
6686 }
6687
6688 function consumeIdentifier(str, offset) {
6689 var code = str.charCodeAt(offset);
6690
6691 if (code < 0x80 && SYMBOL_TYPE$2[code] !== IDENTIFIER$2 && code !== HYPHENMINUS$3) {
6692 return offset;
6693 }
6694
6695 return findIdentifierEnd$2(str, offset + 1);
6696 }
6697
6698 function astNode(type) {
6699 return function(token, addTokenToMatch) {
6700 if (token === null || token.node.type !== type) {
6701 return false;
6702 }
6703
6704 addTokenToMatch();
6705 return true;
6706 };
6707 }
6708
6709 function dimension(type) {
6710 return function(token, addTokenToMatch, getNextToken) {
6711 if (calc(token, addTokenToMatch, getNextToken)) {
6712 return true;
6713 }
6714
6715 if (token === null) {
6716 return false;
6717 }
6718
6719 var numberEnd = consumeNumber(token.value, true);
6720 if (numberEnd === 0) {
6721 return false;
6722 }
6723
6724 if (type) {
6725 if (!type.hasOwnProperty(token.value.substr(numberEnd).toLowerCase())) {
6726 return false;
6727 }
6728 } else {
6729 var unitEnd = consumeIdentifier(token.value, numberEnd);
6730 if (unitEnd === numberEnd || unitEnd !== token.value.length) {
6731 return false;
6732 }
6733 }
6734
6735 addTokenToMatch();
6736 return true;
6737 };
6738 }
6739
6740 function zeroUnitlessDimension(type) {
6741 var isDimension = dimension(type);
6742
6743 return function(token, addTokenToMatch, getNextToken) {
6744 if (isDimension(token, addTokenToMatch, getNextToken)) {
6745 return true;
6746 }
6747
6748 if (token === null || Number(token.value) !== 0) {
6749 return false;
6750 }
6751
6752 addTokenToMatch();
6753 return true;
6754 };
6755 }
6756
6757 function number(token, addTokenToMatch, getNextToken) {
6758 if (calc(token, addTokenToMatch, getNextToken)) {
6759 return true;
6760 }
6761
6762 if (token === null) {
6763 return false;
6764 }
6765
6766 var numberEnd = consumeNumber(token.value, true);
6767 if (numberEnd !== token.value.length) {
6768 return false;
6769 }
6770
6771 addTokenToMatch();
6772 return true;
6773 }
6774
6775 function numberZeroOne(token, addTokenToMatch, getNextToken) {
6776 if (calc(token, addTokenToMatch, getNextToken)) {
6777 return true;
6778 }
6779
6780 if (token === null || !isNumber$2(token.value)) {
6781 return false;
6782 }
6783
6784 var value = Number(token.value);
6785 if (value < 0 || value > 1) {
6786 return false;
6787 }
6788
6789 addTokenToMatch();
6790 return true;
6791 }
6792
6793 function numberOneOrGreater(token, addTokenToMatch, getNextToken) {
6794 if (calc(token, addTokenToMatch, getNextToken)) {
6795 return true;
6796 }
6797
6798 if (token === null || !isNumber$2(token.value)) {
6799 return false;
6800 }
6801
6802 var value = Number(token.value);
6803 if (value < 1) {
6804 return false;
6805 }
6806
6807 addTokenToMatch();
6808 return true;
6809 }
6810
6811 // TODO: fail on 10e-2
6812 function integer(token, addTokenToMatch, getNextToken) {
6813 if (calc(token, addTokenToMatch, getNextToken)) {
6814 return true;
6815 }
6816
6817 if (token === null) {
6818 return false;
6819 }
6820
6821 var numberEnd = consumeNumber(token.value, false);
6822 if (numberEnd !== token.value.length) {
6823 return false;
6824 }
6825
6826 addTokenToMatch();
6827 return true;
6828 }
6829
6830 // TODO: fail on 10e-2
6831 function positiveInteger(token, addTokenToMatch, getNextToken) {
6832 if (calc(token, addTokenToMatch, getNextToken)) {
6833 return true;
6834 }
6835
6836 if (token === null) {
6837 return false;
6838 }
6839
6840 var numberEnd = findDecimalNumberEnd$1(token.value, 0);
6841 if (numberEnd !== token.value.length || token.value.charCodeAt(0) === HYPHENMINUS$3) {
6842 return false;
6843 }
6844
6845 addTokenToMatch();
6846 return true;
6847 }
6848
6849 function hexColor(token, addTokenToMatch) {
6850 if (token === null || token.value.charCodeAt(0) !== NUMBERSIGN) {
6851 return false;
6852 }
6853
6854 var length = token.value.length - 1;
6855
6856 // valid length is 3, 4, 6 and 8 (+1 for #)
6857 if (length !== 3 && length !== 4 && length !== 6 && length !== 8) {
6858 return false;
6859 }
6860
6861 for (var i = 1; i < length; i++) {
6862 if (!isHex$1(token.value.charCodeAt(i))) {
6863 return false;
6864 }
6865 }
6866
6867 addTokenToMatch();
6868 return true;
6869 }
6870
6871 // https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident
6872 // https://drafts.csswg.org/css-values-4/#identifier-value
6873 function customIdent(token, addTokenToMatch) {
6874 if (token === null) {
6875 return false;
6876 }
6877
6878 var identEnd = consumeIdentifier(token.value, 0);
6879 if (identEnd !== token.value.length) {
6880 return false;
6881 }
6882
6883 var name = token.value.toLowerCase();
6884
6885 // § 3.2. Author-defined Identifiers: the <custom-ident> type
6886 // The CSS-wide keywords are not valid <custom-ident>s
6887 if (name === 'unset' || name === 'initial' || name === 'inherit') {
6888 return false;
6889 }
6890
6891 // The default keyword is reserved and is also not a valid <custom-ident>
6892 if (name === 'default') {
6893 return false;
6894 }
6895
6896 // TODO: ignore property specific keywords (as described https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident)
6897
6898 addTokenToMatch();
6899 return true;
6900 }
6901
6902 var generic = {
6903 'angle': zeroUnitlessDimension(ANGLE),
6904 'attr()': attr,
6905 'custom-ident': customIdent,
6906 'decibel': dimension(DECIBEL),
6907 'dimension': dimension(),
6908 'frequency': dimension(FREQUENCY),
6909 'flex': dimension(FLEX),
6910 'hex-color': hexColor,
6911 'id-selector': idSelector, // element( <id-selector> )
6912 'ident': astNode('Identifier'),
6913 'integer': integer,
6914 'length': zeroUnitlessDimension(LENGTH),
6915 'number': number,
6916 'number-zero-one': numberZeroOne,
6917 'number-one-or-greater': numberOneOrGreater,
6918 'percentage': dimension(PERCENTAGE),
6919 'positive-integer': positiveInteger,
6920 'resolution': dimension(RESOLUTION),
6921 'semitones': dimension(SEMITONES),
6922 'string': astNode('String'),
6923 'time': dimension(TIME),
6924 'unicode-range': astNode('UnicodeRange'),
6925 'url': url,
6926
6927 // old IE stuff
6928 'progid': astNode('Raw'),
6929 'expression': expression
6930 };
6931
6932 var SyntaxParseError = function(message, input, offset) {
6933 var error = createCustomError('SyntaxParseError', message);
6934
6935 error.input = input;
6936 error.offset = offset;
6937 error.rawMessage = message;
6938 error.message = error.rawMessage + '\n' +
6939 ' ' + error.input + '\n' +
6940 '--' + new Array((error.offset || error.input.length) + 1).join('-') + '^';
6941
6942 return error;
6943 };
6944
6945 var error$2 = {
6946 SyntaxParseError: SyntaxParseError
6947 };
6948
6949 var SyntaxParseError$1 = error$2.SyntaxParseError;
6950
6951 var TAB$2 = 9;
6952 var N$3 = 10;
6953 var F$3 = 12;
6954 var R$3 = 13;
6955 var SPACE$2 = 32;
6956
6957 var Tokenizer$1 = function(str) {
6958 this.str = str;
6959 this.pos = 0;
6960 };
6961
6962 Tokenizer$1.prototype = {
6963 charCodeAt: function(pos) {
6964 return pos < this.str.length ? this.str.charCodeAt(pos) : 0;
6965 },
6966 charCode: function() {
6967 return this.charCodeAt(this.pos);
6968 },
6969 nextCharCode: function() {
6970 return this.charCodeAt(this.pos + 1);
6971 },
6972 nextNonWsCode: function(pos) {
6973 return this.charCodeAt(this.findWsEnd(pos));
6974 },
6975 findWsEnd: function(pos) {
6976 for (; pos < this.str.length; pos++) {
6977 var code = this.str.charCodeAt(pos);
6978 if (code !== R$3 && code !== N$3 && code !== F$3 && code !== SPACE$2 && code !== TAB$2) {
6979 break;
6980 }
6981 }
6982
6983 return pos;
6984 },
6985 substringToPos: function(end) {
6986 return this.str.substring(this.pos, this.pos = end);
6987 },
6988 eat: function(code) {
6989 if (this.charCode() !== code) {
6990 this.error('Expect `' + String.fromCharCode(code) + '`');
6991 }
6992
6993 this.pos++;
6994 },
6995 peek: function() {
6996 return this.pos < this.str.length ? this.str.charAt(this.pos++) : '';
6997 },
6998 error: function(message) {
6999 throw new SyntaxParseError$1(message, this.str, this.pos);
7000 }
7001 };
7002
7003 var tokenizer$1 = Tokenizer$1;
7004
7005 var TAB$3 = 9;
7006 var N$4 = 10;
7007 var F$4 = 12;
7008 var R$4 = 13;
7009 var SPACE$3 = 32;
7010 var EXCLAMATIONMARK$1 = 33; // !
7011 var NUMBERSIGN$1 = 35; // #
7012 var AMPERSAND = 38; // &
7013 var APOSTROPHE$1 = 39; // '
7014 var LEFTPARENTHESIS$1 = 40; // (
7015 var RIGHTPARENTHESIS$1 = 41; // )
7016 var ASTERISK = 42; // *
7017 var PLUSSIGN$3 = 43; // +
7018 var COMMA = 44; // ,
7019 var LESSTHANSIGN$1 = 60; // <
7020 var GREATERTHANSIGN$1 = 62; // >
7021 var QUESTIONMARK = 63; // ?
7022 var COMMERCIALAT$1 = 64; // @
7023 var LEFTSQUAREBRACKET$1 = 91; // [
7024 var RIGHTSQUAREBRACKET$1 = 93; // ]
7025 var LEFTCURLYBRACKET$1 = 123; // {
7026 var VERTICALLINE = 124; // |
7027 var RIGHTCURLYBRACKET$1 = 125; // }
7028 var NAME_CHAR = createCharMap(function(ch) {
7029 return /[a-zA-Z0-9\-]/.test(ch);
7030 });
7031 var COMBINATOR_PRECEDENCE = {
7032 ' ': 1,
7033 '&&': 2,
7034 '||': 3,
7035 '|': 4
7036 };
7037
7038 function createCharMap(fn) {
7039 var array = typeof Uint32Array === 'function' ? new Uint32Array(128) : new Array(128);
7040 for (var i = 0; i < 128; i++) {
7041 array[i] = fn(String.fromCharCode(i)) ? 1 : 0;
7042 }
7043 return array;
7044 }
7045
7046 function scanSpaces(tokenizer) {
7047 return tokenizer.substringToPos(
7048 tokenizer.findWsEnd(tokenizer.pos + 1)
7049 );
7050 }
7051
7052 function scanWord(tokenizer) {
7053 var end = tokenizer.pos;
7054
7055 for (; end < tokenizer.str.length; end++) {
7056 var code = tokenizer.str.charCodeAt(end);
7057 if (code >= 128 || NAME_CHAR[code] === 0) {
7058 break;
7059 }
7060 }
7061
7062 if (tokenizer.pos === end) {
7063 tokenizer.error('Expect a keyword');
7064 }
7065
7066 return tokenizer.substringToPos(end);
7067 }
7068
7069 function scanNumber(tokenizer) {
7070 var end = tokenizer.pos;
7071
7072 for (; end < tokenizer.str.length; end++) {
7073 var code = tokenizer.str.charCodeAt(end);
7074 if (code < 48 || code > 57) {
7075 break;
7076 }
7077 }
7078
7079 if (tokenizer.pos === end) {
7080 tokenizer.error('Expect a number');
7081 }
7082
7083 return tokenizer.substringToPos(end);
7084 }
7085
7086 function scanString(tokenizer) {
7087 var end = tokenizer.str.indexOf('\'', tokenizer.pos + 1);
7088
7089 if (end === -1) {
7090 tokenizer.pos = tokenizer.str.length;
7091 tokenizer.error('Expect an apostrophe');
7092 }
7093
7094 return tokenizer.substringToPos(end + 1);
7095 }
7096
7097 function readMultiplierRange(tokenizer) {
7098 var min = null;
7099 var max = null;
7100
7101 tokenizer.eat(LEFTCURLYBRACKET$1);
7102
7103 min = scanNumber(tokenizer);
7104
7105 if (tokenizer.charCode() === COMMA) {
7106 tokenizer.pos++;
7107 if (tokenizer.charCode() !== RIGHTCURLYBRACKET$1) {
7108 max = scanNumber(tokenizer);
7109 }
7110 } else {
7111 max = min;
7112 }
7113
7114 tokenizer.eat(RIGHTCURLYBRACKET$1);
7115
7116 return {
7117 min: Number(min),
7118 max: max ? Number(max) : 0
7119 };
7120 }
7121
7122 function readMultiplier(tokenizer) {
7123 var range = null;
7124 var comma = false;
7125
7126 switch (tokenizer.charCode()) {
7127 case ASTERISK:
7128 tokenizer.pos++;
7129
7130 range = {
7131 min: 0,
7132 max: 0
7133 };
7134
7135 break;
7136
7137 case PLUSSIGN$3:
7138 tokenizer.pos++;
7139
7140 range = {
7141 min: 1,
7142 max: 0
7143 };
7144
7145 break;
7146
7147 case QUESTIONMARK:
7148 tokenizer.pos++;
7149
7150 range = {
7151 min: 0,
7152 max: 1
7153 };
7154
7155 break;
7156
7157 case NUMBERSIGN$1:
7158 tokenizer.pos++;
7159
7160 comma = true;
7161
7162 if (tokenizer.charCode() === LEFTCURLYBRACKET$1) {
7163 range = readMultiplierRange(tokenizer);
7164 } else {
7165 range = {
7166 min: 1,
7167 max: 0
7168 };
7169 }
7170
7171 break;
7172
7173 case LEFTCURLYBRACKET$1:
7174 range = readMultiplierRange(tokenizer);
7175 break;
7176
7177 default:
7178 return null;
7179 }
7180
7181 return {
7182 type: 'Multiplier',
7183 comma: comma,
7184 min: range.min,
7185 max: range.max,
7186 term: null
7187 };
7188 }
7189
7190 function maybeMultiplied(tokenizer, node) {
7191 var multiplier = readMultiplier(tokenizer);
7192
7193 if (multiplier !== null) {
7194 multiplier.term = node;
7195 return multiplier;
7196 }
7197
7198 return node;
7199 }
7200
7201 function maybeToken(tokenizer) {
7202 var ch = tokenizer.peek();
7203
7204 if (ch === '') {
7205 return null;
7206 }
7207
7208 return {
7209 type: 'Token',
7210 value: ch
7211 };
7212 }
7213
7214 function readProperty(tokenizer) {
7215 var name;
7216
7217 tokenizer.eat(LESSTHANSIGN$1);
7218 tokenizer.eat(APOSTROPHE$1);
7219
7220 name = scanWord(tokenizer);
7221
7222 tokenizer.eat(APOSTROPHE$1);
7223 tokenizer.eat(GREATERTHANSIGN$1);
7224
7225 return maybeMultiplied(tokenizer, {
7226 type: 'Property',
7227 name: name
7228 });
7229 }
7230
7231 function readType(tokenizer) {
7232 var name;
7233
7234 tokenizer.eat(LESSTHANSIGN$1);
7235 name = scanWord(tokenizer);
7236
7237 if (tokenizer.charCode() === LEFTPARENTHESIS$1 &&
7238 tokenizer.nextCharCode() === RIGHTPARENTHESIS$1) {
7239 tokenizer.pos += 2;
7240 name += '()';
7241 }
7242
7243 tokenizer.eat(GREATERTHANSIGN$1);
7244
7245 return maybeMultiplied(tokenizer, {
7246 type: 'Type',
7247 name: name
7248 });
7249 }
7250
7251 function readKeywordOrFunction(tokenizer) {
7252 var name;
7253
7254 name = scanWord(tokenizer);
7255
7256 if (tokenizer.charCode() === LEFTPARENTHESIS$1) {
7257 tokenizer.pos++;
7258
7259 return {
7260 type: 'Function',
7261 name: name
7262 };
7263 }
7264
7265 return maybeMultiplied(tokenizer, {
7266 type: 'Keyword',
7267 name: name
7268 });
7269 }
7270
7271 function regroupTerms(terms, combinators) {
7272 function createGroup(terms, combinator) {
7273 return {
7274 type: 'Group',
7275 terms: terms,
7276 combinator: combinator,
7277 disallowEmpty: false,
7278 explicit: false
7279 };
7280 }
7281
7282 combinators = Object.keys(combinators).sort(function(a, b) {
7283 return COMBINATOR_PRECEDENCE[a] - COMBINATOR_PRECEDENCE[b];
7284 });
7285
7286 while (combinators.length > 0) {
7287 var combinator = combinators.shift();
7288 for (var i = 0, subgroupStart = 0; i < terms.length; i++) {
7289 var term = terms[i];
7290 if (term.type === 'Combinator') {
7291 if (term.value === combinator) {
7292 if (subgroupStart === -1) {
7293 subgroupStart = i - 1;
7294 }
7295 terms.splice(i, 1);
7296 i--;
7297 } else {
7298 if (subgroupStart !== -1 && i - subgroupStart > 1) {
7299 terms.splice(
7300 subgroupStart,
7301 i - subgroupStart,
7302 createGroup(terms.slice(subgroupStart, i), combinator)
7303 );
7304 i = subgroupStart + 1;
7305 }
7306 subgroupStart = -1;
7307 }
7308 }
7309 }
7310
7311 if (subgroupStart !== -1 && combinators.length) {
7312 terms.splice(
7313 subgroupStart,
7314 i - subgroupStart,
7315 createGroup(terms.slice(subgroupStart, i), combinator)
7316 );
7317 }
7318 }
7319
7320 return combinator;
7321 }
7322
7323 function readImplicitGroup(tokenizer) {
7324 var terms = [];
7325 var combinators = {};
7326 var token;
7327 var prevToken = null;
7328 var prevTokenPos = tokenizer.pos;
7329
7330 while (token = peek(tokenizer)) {
7331 if (token.type !== 'Spaces') {
7332 if (token.type === 'Combinator') {
7333 // check for combinator in group beginning and double combinator sequence
7334 if (prevToken === null || prevToken.type === 'Combinator') {
7335 tokenizer.pos = prevTokenPos;
7336 tokenizer.error('Unexpected combinator');
7337 }
7338
7339 combinators[token.value] = true;
7340 } else if (prevToken !== null && prevToken.type !== 'Combinator') {
7341 combinators[' '] = true; // a b
7342 terms.push({
7343 type: 'Combinator',
7344 value: ' '
7345 });
7346 }
7347
7348 terms.push(token);
7349 prevToken = token;
7350 prevTokenPos = tokenizer.pos;
7351 }
7352 }
7353
7354 // check for combinator in group ending
7355 if (prevToken !== null && prevToken.type === 'Combinator') {
7356 tokenizer.pos -= prevTokenPos;
7357 tokenizer.error('Unexpected combinator');
7358 }
7359
7360 return {
7361 type: 'Group',
7362 terms: terms,
7363 combinator: regroupTerms(terms, combinators) || ' ',
7364 disallowEmpty: false,
7365 explicit: false
7366 };
7367 }
7368
7369 function readGroup(tokenizer) {
7370 var result;
7371
7372 tokenizer.eat(LEFTSQUAREBRACKET$1);
7373 result = readImplicitGroup(tokenizer);
7374 tokenizer.eat(RIGHTSQUAREBRACKET$1);
7375
7376 result.explicit = true;
7377
7378 if (tokenizer.charCode() === EXCLAMATIONMARK$1) {
7379 tokenizer.pos++;
7380 result.disallowEmpty = true;
7381 }
7382
7383 return result;
7384 }
7385
7386 function peek(tokenizer) {
7387 var code = tokenizer.charCode();
7388
7389 if (code < 128 && NAME_CHAR[code] === 1) {
7390 return readKeywordOrFunction(tokenizer);
7391 }
7392
7393 switch (code) {
7394 case RIGHTSQUAREBRACKET$1:
7395 // don't eat, stop scan a group
7396 break;
7397
7398 case LEFTSQUAREBRACKET$1:
7399 return maybeMultiplied(tokenizer, readGroup(tokenizer));
7400
7401 case LESSTHANSIGN$1:
7402 return tokenizer.nextCharCode() === APOSTROPHE$1
7403 ? readProperty(tokenizer)
7404 : readType(tokenizer);
7405
7406 case VERTICALLINE:
7407 return {
7408 type: 'Combinator',
7409 value: tokenizer.substringToPos(
7410 tokenizer.nextCharCode() === VERTICALLINE
7411 ? tokenizer.pos + 2
7412 : tokenizer.pos + 1
7413 )
7414 };
7415
7416 case AMPERSAND:
7417 tokenizer.pos++;
7418 tokenizer.eat(AMPERSAND);
7419
7420 return {
7421 type: 'Combinator',
7422 value: '&&'
7423 };
7424
7425 case COMMA:
7426 tokenizer.pos++;
7427 return {
7428 type: 'Comma'
7429 };
7430
7431 case APOSTROPHE$1:
7432 return maybeMultiplied(tokenizer, {
7433 type: 'String',
7434 value: scanString(tokenizer)
7435 });
7436
7437 case SPACE$3:
7438 case TAB$3:
7439 case N$4:
7440 case R$4:
7441 case F$4:
7442 return {
7443 type: 'Spaces',
7444 value: scanSpaces(tokenizer)
7445 };
7446
7447 case COMMERCIALAT$1:
7448 code = tokenizer.nextCharCode();
7449
7450 if (code < 128 && NAME_CHAR[code] === 1) {
7451 tokenizer.pos++;
7452 return {
7453 type: 'AtKeyword',
7454 name: scanWord(tokenizer)
7455 };
7456 }
7457
7458 return maybeToken(tokenizer);
7459
7460 case ASTERISK:
7461 case PLUSSIGN$3:
7462 case QUESTIONMARK:
7463 case NUMBERSIGN$1:
7464 case EXCLAMATIONMARK$1:
7465 // prohibited tokens (used as a multiplier start)
7466 break;
7467
7468 case LEFTCURLYBRACKET$1:
7469 // LEFTCURLYBRACKET is allowed since mdn/data uses it w/o quoting
7470 // check next char isn't a number, because it's likely a disjoined multiplier
7471 code = tokenizer.nextCharCode();
7472
7473 if (code < 48 || code > 57) {
7474 return maybeToken(tokenizer);
7475 }
7476
7477 break;
7478
7479 default:
7480 return maybeToken(tokenizer);
7481 }
7482 }
7483
7484 function parse(str) {
7485 var tokenizer = new tokenizer$1(str);
7486 var result = readImplicitGroup(tokenizer);
7487
7488 if (tokenizer.pos !== str.length) {
7489 tokenizer.error('Unexpected input');
7490 }
7491
7492 // reduce redundant groups with single group term
7493 if (result.terms.length === 1 && result.terms[0].type === 'Group') {
7494 result = result.terms[0];
7495 }
7496
7497 return result;
7498 }
7499
7500 // warm up parse to elimitate code branches that never execute
7501 // fix soft deoptimizations (insufficient type feedback)
7502 parse('[a&&<b>#|<\'c\'>*||e() f{2} /,(% g#{1,2} h{2,})]!');
7503
7504 var parse_1 = parse;
7505
7506 var noop$2 = function() {};
7507
7508 function ensureFunction(value) {
7509 return typeof value === 'function' ? value : noop$2;
7510 }
7511
7512 var walk = function(node, options, context) {
7513 function walk(node) {
7514 enter.call(context, node);
7515
7516 switch (node.type) {
7517 case 'Group':
7518 node.terms.forEach(walk);
7519 break;
7520
7521 case 'Multiplier':
7522 walk(node.term);
7523 break;
7524
7525 case 'Type':
7526 case 'Property':
7527 case 'Keyword':
7528 case 'AtKeyword':
7529 case 'Function':
7530 case 'String':
7531 case 'Token':
7532 case 'Comma':
7533 break;
7534
7535 default:
7536 throw new Error('Unknown type: ' + node.type);
7537 }
7538
7539 leave.call(context, node);
7540 }
7541
7542 var enter = noop$2;
7543 var leave = noop$2;
7544
7545 if (typeof options === 'function') {
7546 enter = options;
7547 } else if (options) {
7548 enter = ensureFunction(options.enter);
7549 leave = ensureFunction(options.leave);
7550 }
7551
7552 if (enter === noop$2 && leave === noop$2) {
7553 throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
7554 }
7555
7556 walk(node, context);
7557 };
7558
7559 var astToTokens = {
7560 decorator: function(handlers) {
7561 var curNode = null;
7562 var prev = null;
7563 var tokens = [];
7564
7565 return {
7566 children: handlers.children,
7567 node: function(node) {
7568 var tmp = curNode;
7569 curNode = node;
7570 handlers.node.call(this, node);
7571 curNode = tmp;
7572 },
7573 chunk: function(chunk) {
7574 if (tokens.length > 0) {
7575 switch (curNode.type) {
7576 case 'Dimension':
7577 case 'HexColor':
7578 case 'IdSelector':
7579 case 'Percentage':
7580 if (prev.node === curNode) {
7581 prev.value += chunk;
7582 return;
7583 }
7584 break;
7585
7586 case 'Function':
7587 case 'PseudoClassSelector':
7588 case 'PseudoElementSelector':
7589 case 'Url':
7590 if (chunk === '(') {
7591 prev.value += chunk;
7592 return;
7593 }
7594 break;
7595
7596 case 'Atrule':
7597 if (prev.node === curNode && prev.value === '@') {
7598 prev.value += chunk;
7599 return;
7600 }
7601 break;
7602 }
7603 }
7604
7605 tokens.push(prev = {
7606 value: chunk,
7607 node: curNode
7608 });
7609 },
7610 result: function() {
7611 return tokens;
7612 }
7613 };
7614 }
7615 };
7616
7617 var MATCH = { type: 'Match' };
7618 var MISMATCH = { type: 'Mismatch' };
7619 var DISALLOW_EMPTY = { type: 'DisallowEmpty' };
7620 var LEFTPARENTHESIS$2 = 40; // (
7621 var RIGHTPARENTHESIS$2 = 41; // )
7622
7623 function createCondition(match, thenBranch, elseBranch) {
7624 // reduce node count
7625 if (thenBranch === MATCH && elseBranch === MISMATCH) {
7626 return match;
7627 }
7628
7629 if (match === MATCH && thenBranch === MATCH && elseBranch === MATCH) {
7630 return match;
7631 }
7632
7633 if (match.type === 'If' && match.else === MISMATCH && thenBranch === MATCH) {
7634 thenBranch = match.then;
7635 match = match.match;
7636 }
7637
7638 return {
7639 type: 'If',
7640 match: match,
7641 then: thenBranch,
7642 else: elseBranch
7643 };
7644 }
7645
7646 function isFunctionType(name) {
7647 return (
7648 name.length > 2 &&
7649 name.charCodeAt(name.length - 2) === LEFTPARENTHESIS$2 &&
7650 name.charCodeAt(name.length - 1) === RIGHTPARENTHESIS$2
7651 );
7652 }
7653
7654 function isEnumCapatible(term) {
7655 return (
7656 term.type === 'Keyword' ||
7657 term.type === 'AtKeyword' ||
7658 term.type === 'Function' ||
7659 term.type === 'Type' && isFunctionType(term.name)
7660 );
7661 }
7662
7663 function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
7664 switch (combinator) {
7665 case ' ':
7666 // Juxtaposing components means that all of them must occur, in the given order.
7667 //
7668 // a b c
7669 // =
7670 // match a
7671 // then match b
7672 // then match c
7673 // then MATCH
7674 // else MISMATCH
7675 // else MISMATCH
7676 // else MISMATCH
7677 var result = MATCH;
7678
7679 for (var i = terms.length - 1; i >= 0; i--) {
7680 var term = terms[i];
7681
7682 result = createCondition(
7683 term,
7684 result,
7685 MISMATCH
7686 );
7687 }
7688 return result;
7689
7690 case '|':
7691 // A bar (|) separates two or more alternatives: exactly one of them must occur.
7692 //
7693 // a | b | c
7694 // =
7695 // match a
7696 // then MATCH
7697 // else match b
7698 // then MATCH
7699 // else match c
7700 // then MATCH
7701 // else MISMATCH
7702
7703 var result = MISMATCH;
7704 var map = null;
7705
7706 for (var i = terms.length - 1; i >= 0; i--) {
7707 var term = terms[i];
7708
7709 // reduce sequence of keywords into a Enum
7710 if (isEnumCapatible(term)) {
7711 if (map === null && i > 0 && isEnumCapatible(terms[i - 1])) {
7712 map = Object.create(null);
7713 result = createCondition(
7714 {
7715 type: 'Enum',
7716 map: map
7717 },
7718 MATCH,
7719 result
7720 );
7721 }
7722
7723 if (map !== null) {
7724 var key = (isFunctionType(term.name) ? term.name.slice(0, -1) : term.name).toLowerCase();
7725 if (key in map === false) {
7726 map[key] = term;
7727 continue;
7728 }
7729 }
7730 }
7731
7732 map = null;
7733
7734 // create a new conditonal node
7735 result = createCondition(
7736 term,
7737 MATCH,
7738 result
7739 );
7740 }
7741 return result;
7742
7743 case '&&':
7744 // A double ampersand (&&) separates two or more components,
7745 // all of which must occur, in any order.
7746
7747 // Use MatchOnce for groups with a large number of terms,
7748 // since &&-groups produces at least N!-node trees
7749 if (terms.length > 5) {
7750 return {
7751 type: 'MatchOnce',
7752 terms: terms,
7753 all: true
7754 };
7755 }
7756
7757 // Use a combination tree for groups with small number of terms
7758 //
7759 // a && b && c
7760 // =
7761 // match a
7762 // then [b && c]
7763 // else match b
7764 // then [a && c]
7765 // else match c
7766 // then [a && b]
7767 // else MISMATCH
7768 //
7769 // a && b
7770 // =
7771 // match a
7772 // then match b
7773 // then MATCH
7774 // else MISMATCH
7775 // else match b
7776 // then match a
7777 // then MATCH
7778 // else MISMATCH
7779 // else MISMATCH
7780 var result = MISMATCH;
7781
7782 for (var i = terms.length - 1; i >= 0; i--) {
7783 var term = terms[i];
7784 var thenClause;
7785
7786 if (terms.length > 1) {
7787 thenClause = buildGroupMatchGraph(
7788 combinator,
7789 terms.filter(function(newGroupTerm) {
7790 return newGroupTerm !== term;
7791 }),
7792 false
7793 );
7794 } else {
7795 thenClause = MATCH;
7796 }
7797
7798 result = createCondition(
7799 term,
7800 thenClause,
7801 result
7802 );
7803 }
7804 return result;
7805
7806 case '||':
7807 // A double bar (||) separates two or more options:
7808 // one or more of them must occur, in any order.
7809
7810 // Use MatchOnce for groups with a large number of terms,
7811 // since ||-groups produces at least N!-node trees
7812 if (terms.length > 5) {
7813 return {
7814 type: 'MatchOnce',
7815 terms: terms,
7816 all: false
7817 }; }
7818
7819 // Use a combination tree for groups with small number of terms
7820 //
7821 // a || b || c
7822 // =
7823 // match a
7824 // then [b || c]
7825 // else match b
7826 // then [a || c]
7827 // else match c
7828 // then [a || b]
7829 // else MISMATCH
7830 //
7831 // a || b
7832 // =
7833 // match a
7834 // then match b
7835 // then MATCH
7836 // else MATCH
7837 // else match b
7838 // then match a
7839 // then MATCH
7840 // else MATCH
7841 // else MISMATCH
7842 var result = atLeastOneTermMatched ? MATCH : MISMATCH;
7843
7844 for (var i = terms.length - 1; i >= 0; i--) {
7845 var term = terms[i];
7846 var thenClause;
7847
7848 if (terms.length > 1) {
7849 thenClause = buildGroupMatchGraph(
7850 combinator,
7851 terms.filter(function(newGroupTerm) {
7852 return newGroupTerm !== term;
7853 }),
7854 true
7855 );
7856 } else {
7857 thenClause = MATCH;
7858 }
7859
7860 result = createCondition(
7861 term,
7862 thenClause,
7863 result
7864 );
7865 }
7866 return result;
7867 }
7868 }
7869
7870 function buildMultiplierMatchGraph(node) {
7871 var result = MATCH;
7872 var matchTerm = buildMatchGraph(node.term);
7873
7874 if (node.max === 0) {
7875 // disable repeating of empty match to prevent infinite loop
7876 matchTerm = createCondition(
7877 matchTerm,
7878 DISALLOW_EMPTY,
7879 MISMATCH
7880 );
7881
7882 // an occurrence count is not limited, make a cycle;
7883 // to collect more terms on each following matching mismatch
7884 result = createCondition(
7885 matchTerm,
7886 null, // will be a loop
7887 MISMATCH
7888 );
7889
7890 result.then = createCondition(
7891 MATCH,
7892 MATCH,
7893 result // make a loop
7894 );
7895
7896 if (node.comma) {
7897 result.then.else = createCondition(
7898 { type: 'Comma', syntax: node },
7899 result,
7900 MISMATCH
7901 );
7902 }
7903 } else {
7904 // create a match node chain for [min .. max] interval with optional matches
7905 for (var i = node.min || 1; i <= node.max; i++) {
7906 if (node.comma && result !== MATCH) {
7907 result = createCondition(
7908 { type: 'Comma', syntax: node },
7909 result,
7910 MISMATCH
7911 );
7912 }
7913
7914 result = createCondition(
7915 matchTerm,
7916 createCondition(
7917 MATCH,
7918 MATCH,
7919 result
7920 ),
7921 MISMATCH
7922 );
7923 }
7924 }
7925
7926 if (node.min === 0) {
7927 // allow zero match
7928 result = createCondition(
7929 MATCH,
7930 MATCH,
7931 result
7932 );
7933 } else {
7934 // create a match node chain to collect [0 ... min - 1] required matches
7935 for (var i = 0; i < node.min - 1; i++) {
7936 if (node.comma && result !== MATCH) {
7937 result = createCondition(
7938 { type: 'Comma', syntax: node },
7939 result,
7940 MISMATCH
7941 );
7942 }
7943
7944 result = createCondition(
7945 matchTerm,
7946 result,
7947 MISMATCH
7948 );
7949 }
7950 }
7951
7952 return result;
7953 }
7954
7955 function buildMatchGraph(node) {
7956 if (typeof node === 'function') {
7957 return {
7958 type: 'Generic',
7959 fn: node
7960 };
7961 }
7962
7963 switch (node.type) {
7964 case 'Group':
7965 var result = buildGroupMatchGraph(
7966 node.combinator,
7967 node.terms.map(buildMatchGraph),
7968 false
7969 );
7970
7971 if (node.disallowEmpty) {
7972 result = createCondition(
7973 result,
7974 DISALLOW_EMPTY,
7975 MISMATCH
7976 );
7977 }
7978
7979 return result;
7980
7981 case 'Multiplier':
7982 return buildMultiplierMatchGraph(node);
7983
7984 case 'Type':
7985 case 'Property':
7986 return {
7987 type: node.type,
7988 name: node.name,
7989 syntax: node
7990 };
7991
7992 case 'Keyword':
7993 return {
7994 type: node.type,
7995 name: node.name.toLowerCase(),
7996 syntax: node
7997 };
7998
7999 case 'AtKeyword':
8000 return {
8001 type: node.type,
8002 name: '@' + node.name.toLowerCase(),
8003 syntax: node
8004 };
8005
8006 case 'Function':
8007 return {
8008 type: node.type,
8009 name: node.name.toLowerCase() + '(',
8010 syntax: node
8011 };
8012
8013 case 'String':
8014 // convert a one char length String to a Token
8015 if (node.value.length === 3) {
8016 return {
8017 type: 'Token',
8018 value: node.value.charAt(1),
8019 syntax: node
8020 };
8021 }
8022
8023 // otherwise use it as is
8024 return {
8025 type: node.type,
8026 value: node.value,
8027 syntax: node
8028 };
8029
8030 case 'Token':
8031 return {
8032 type: node.type,
8033 value: node.value,
8034 syntax: node
8035 };
8036
8037 case 'Comma':
8038 return {
8039 type: node.type,
8040 syntax: node
8041 };
8042
8043 default:
8044 throw new Error('Unknown node type:', node.type);
8045 }
8046 }
8047
8048 var matchGraph = {
8049 MATCH: MATCH,
8050 MISMATCH: MISMATCH,
8051 DISALLOW_EMPTY: DISALLOW_EMPTY,
8052 buildMatchGraph: function(syntaxTree, ref) {
8053 if (typeof syntaxTree === 'string') {
8054 syntaxTree = parse_1(syntaxTree);
8055 }
8056
8057 return {
8058 type: 'MatchGraph',
8059 match: buildMatchGraph(syntaxTree),
8060 syntax: ref || null,
8061 source: syntaxTree
8062 };
8063 }
8064 };
8065
8066 var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
8067
8068 var MATCH$1 = matchGraph.MATCH;
8069 var MISMATCH$1 = matchGraph.MISMATCH;
8070 var DISALLOW_EMPTY$1 = matchGraph.DISALLOW_EMPTY;
8071
8072 var TOKEN = 1;
8073 var OPEN_SYNTAX = 2;
8074 var CLOSE_SYNTAX = 3;
8075
8076 var EXIT_REASON_MATCH = 'Match';
8077 var EXIT_REASON_MISMATCH = 'Mismatch';
8078 var EXIT_REASON_ITERATION_LIMIT = 'Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)';
8079
8080 var ITERATION_LIMIT = 10000;
8081 var totalIterationCount = 0;
8082
8083 function mapList(list, fn) {
8084 var result = [];
8085
8086 while (list) {
8087 result.unshift(fn(list));
8088 list = list.prev;
8089 }
8090
8091 return result;
8092 }
8093
8094 function isCommaContextStart(token) {
8095 if (token === null) {
8096 return true;
8097 }
8098
8099 token = token.value.charAt(token.value.length - 1);
8100
8101 return (
8102 token === ',' ||
8103 token === '(' ||
8104 token === '[' ||
8105 token === '/'
8106 );
8107 }
8108
8109 function isCommaContextEnd(token) {
8110 if (token === null) {
8111 return true;
8112 }
8113
8114 token = token.value.charAt(0);
8115
8116 return (
8117 token === ')' ||
8118 token === ']' ||
8119 token === '/'
8120 );
8121 }
8122
8123 function internalMatch(tokens, syntax, syntaxes) {
8124 function moveToNextToken() {
8125 do {
8126 tokenCursor++;
8127 token = tokenCursor < tokens.length ? tokens[tokenCursor] : null;
8128 } while (token !== null && !/\S/.test(token.value));
8129 }
8130
8131 function getNextToken(offset) {
8132 var nextIndex = tokenCursor + offset;
8133
8134 return nextIndex < tokens.length ? tokens[nextIndex] : null;
8135 }
8136
8137 function pushThenStack(nextSyntax) {
8138 thenStack = {
8139 nextSyntax: nextSyntax,
8140 matchStack: matchStack,
8141 syntaxStack: syntaxStack,
8142 prev: thenStack
8143 };
8144 }
8145
8146 function pushElseStack(nextSyntax) {
8147 elseStack = {
8148 nextSyntax: nextSyntax,
8149 matchStack: matchStack,
8150 syntaxStack: syntaxStack,
8151 thenStack: thenStack,
8152 tokenCursor: tokenCursor,
8153 token: token,
8154 prev: elseStack
8155 };
8156 }
8157
8158 function addTokenToMatch() {
8159 matchStack = {
8160 type: TOKEN,
8161 syntax: syntax.syntax,
8162 token: token,
8163 prev: matchStack
8164 };
8165
8166 moveToNextToken();
8167
8168 if (tokenCursor > longestMatch) {
8169 longestMatch = tokenCursor;
8170 }
8171
8172 return matchStack.token;
8173 }
8174
8175 function openSyntax() {
8176 syntaxStack = {
8177 syntax: syntax,
8178 prev: syntaxStack
8179 };
8180
8181 matchStack = {
8182 type: OPEN_SYNTAX,
8183 syntax: syntax.syntax,
8184 token: matchStack.token,
8185 prev: matchStack
8186 };
8187 }
8188
8189 function closeSyntax() {
8190 if (matchStack.type === OPEN_SYNTAX) {
8191 matchStack = matchStack.prev;
8192 } else {
8193 matchStack = {
8194 type: CLOSE_SYNTAX,
8195 syntax: syntaxStack.syntax,
8196 token: matchStack.token,
8197 prev: matchStack
8198 };
8199 }
8200
8201 syntaxStack = syntaxStack.prev;
8202 }
8203
8204 var syntaxStack = null;
8205 var thenStack = null;
8206 var elseStack = null;
8207
8208 var iterationCount = 0;
8209 var exitReason = EXIT_REASON_MATCH;
8210
8211 var matchStack = { type: 'Stub', syntax: null, token: null, tokenCursor: -1, prev: null };
8212 var longestMatch = 0;
8213 var tokenCursor = -1;
8214 var token = null;
8215
8216 moveToNextToken();
8217
8218 while (true) {
8219 // console.log('--\n',
8220 // '#' + iterationCount,
8221 // require('util').inspect({
8222 // match: mapList(matchStack, x => x.type === TOKEN ? x.token && x.token.value : x.syntax ? x.type + '!' + x.syntax.name : null),
8223 // elseStack: mapList(elseStack, x => x.id),
8224 // thenStack: mapList(thenStack, x => x.id),
8225 // token: token && token.value,
8226 // tokenCursor,
8227 // syntax
8228 // }, { depth: null })
8229 // );
8230
8231 // prevent infinite loop
8232 if (++iterationCount === ITERATION_LIMIT) {
8233 console.warn('[csstree-match] BREAK after ' + ITERATION_LIMIT + ' iterations');
8234 exitReason = EXIT_REASON_ITERATION_LIMIT;
8235 break;
8236 }
8237
8238 if (syntax === MATCH$1) {
8239 if (thenStack === null) {
8240 // turn to MISMATCH when some tokens left unmatched
8241 if (token !== null) {
8242 // doesn't mismatch if just one token left and it's an IE hack
8243 if (tokenCursor !== tokens.length - 1 || (token.value !== '\\0' && token.value !== '\\9')) {
8244 syntax = MISMATCH$1;
8245 continue;
8246 }
8247 }
8248
8249 // break the main loop, return a result - MATCH
8250 exitReason = EXIT_REASON_MATCH;
8251 break;
8252 }
8253
8254 // go to next syntax (`then` branch)
8255 syntax = thenStack.nextSyntax;
8256
8257 // check match is not empty
8258 if (syntax === DISALLOW_EMPTY$1) {
8259 if (thenStack.matchStack.token === matchStack.token) {
8260 syntax = MISMATCH$1;
8261 continue;
8262 } else {
8263 syntax = MATCH$1;
8264 }
8265 }
8266
8267 // close syntax if needed
8268 while (syntaxStack !== null && thenStack.syntaxStack !== syntaxStack) {
8269 closeSyntax();
8270 }
8271
8272 // pop stack
8273 thenStack = thenStack.prev;
8274 continue;
8275 }
8276
8277 if (syntax === MISMATCH$1) {
8278 if (elseStack === null) {
8279 // break the main loop, return a result - MISMATCH
8280 exitReason = EXIT_REASON_MISMATCH;
8281 break;
8282 }
8283
8284 // go to next syntax (`else` branch)
8285 syntax = elseStack.nextSyntax;
8286
8287 // restore all the rest stack states
8288 thenStack = elseStack.thenStack;
8289 syntaxStack = elseStack.syntaxStack;
8290 matchStack = elseStack.matchStack;
8291 tokenCursor = elseStack.tokenCursor;
8292 token = elseStack.token;
8293
8294 // pop stack
8295 elseStack = elseStack.prev;
8296 continue;
8297 }
8298
8299 switch (syntax.type) {
8300 case 'MatchGraph':
8301 syntax = syntax.match;
8302 break;
8303
8304 case 'If':
8305 // IMPORTANT: else stack push must go first,
8306 // since it stores the state of thenStack before changes
8307 if (syntax.else !== MISMATCH$1) {
8308 pushElseStack(syntax.else);
8309 }
8310
8311 if (syntax.then !== MATCH$1) {
8312 pushThenStack(syntax.then);
8313 }
8314
8315 syntax = syntax.match;
8316 break;
8317
8318 case 'MatchOnce':
8319 syntax = {
8320 type: 'MatchOnceBuffer',
8321 terms: syntax.terms,
8322 all: syntax.all,
8323 matchStack: matchStack,
8324 index: 0,
8325 mask: 0
8326 };
8327 break;
8328
8329 case 'MatchOnceBuffer':
8330 if (syntax.index === syntax.terms.length) {
8331 // if no matches during a cycle
8332 if (syntax.matchStack === matchStack) {
8333 // no matches at all or it's required all terms to be matched
8334 if (syntax.mask === 0 || syntax.all) {
8335 syntax = MISMATCH$1;
8336 break;
8337 }
8338
8339 // a partial match is ok
8340 syntax = MATCH$1;
8341 break;
8342 } else {
8343 // start trying to match from the start
8344 syntax.index = 0;
8345 syntax.matchStack = matchStack;
8346 }
8347 }
8348
8349 for (; syntax.index < syntax.terms.length; syntax.index++) {
8350 if ((syntax.mask & (1 << syntax.index)) === 0) {
8351 // IMPORTANT: else stack push must go first,
8352 // since it stores the state of thenStack before changes
8353 pushElseStack(syntax);
8354 pushThenStack({
8355 type: 'AddMatchOnce',
8356 buffer: syntax
8357 });
8358
8359 // match
8360 syntax = syntax.terms[syntax.index++];
8361 break;
8362 }
8363 }
8364 break;
8365
8366 case 'AddMatchOnce':
8367 syntax = syntax.buffer;
8368
8369 var newMask = syntax.mask | (1 << (syntax.index - 1));
8370
8371 // all terms are matched
8372 if (newMask === (1 << syntax.terms.length) - 1) {
8373 syntax = MATCH$1;
8374 continue;
8375 }
8376
8377 syntax = {
8378 type: 'MatchOnceBuffer',
8379 terms: syntax.terms,
8380 all: syntax.all,
8381 matchStack: syntax.matchStack,
8382 index: syntax.index,
8383 mask: newMask
8384 };
8385
8386 break;
8387
8388 case 'Enum':
8389 var name = token !== null ? token.value.toLowerCase() : '';
8390
8391 // drop \0 and \9 hack from keyword name
8392 if (name.indexOf('\\') !== -1) {
8393 name = name.replace(/\\[09].*$/, '');
8394 }
8395
8396 if (hasOwnProperty$1.call(syntax.map, name)) {
8397 syntax = syntax.map[name];
8398 } else {
8399 syntax = MISMATCH$1;
8400 }
8401
8402 break;
8403
8404 case 'Generic':
8405 syntax = syntax.fn(token, addTokenToMatch, getNextToken) ? MATCH$1 : MISMATCH$1;
8406 break;
8407
8408 case 'Type':
8409 case 'Property':
8410 openSyntax();
8411
8412 var syntaxDict = syntax.type === 'Type' ? 'types' : 'properties';
8413
8414 if (hasOwnProperty$1.call(syntaxes, syntaxDict) && syntaxes[syntaxDict][syntax.name]) {
8415 syntax = syntaxes[syntaxDict][syntax.name].match;
8416 } else {
8417 syntax = undefined;
8418 }
8419
8420 if (!syntax) {
8421 throw new Error(
8422 'Bad syntax reference: ' +
8423 (syntaxStack.syntax.type === 'Type'
8424 ? '<' + syntaxStack.syntax.name + '>'
8425 : '<\'' + syntaxStack.syntax.name + '\'>')
8426 );
8427 }
8428
8429 break;
8430
8431 case 'Keyword':
8432 var name = syntax.name;
8433
8434 if (token !== null) {
8435 var keywordName = token.value;
8436
8437 // drop \0 and \9 hack from keyword name
8438 if (keywordName.indexOf('\\') !== -1) {
8439 keywordName = keywordName.replace(/\\[09].*$/, '');
8440 }
8441
8442 if (keywordName.toLowerCase() === name) {
8443 addTokenToMatch();
8444
8445 syntax = MATCH$1;
8446 break;
8447 }
8448 }
8449
8450 syntax = MISMATCH$1;
8451 break;
8452
8453 case 'AtKeyword':
8454 case 'Function':
8455 if (token !== null && token.value.toLowerCase() === syntax.name) {
8456 addTokenToMatch();
8457
8458 syntax = MATCH$1;
8459 break;
8460 }
8461
8462 syntax = MISMATCH$1;
8463 break;
8464
8465 case 'Token':
8466 if (token !== null && token.value === syntax.value) {
8467 addTokenToMatch();
8468
8469 syntax = MATCH$1;
8470 break;
8471 }
8472
8473 syntax = MISMATCH$1;
8474 break;
8475
8476 case 'Comma':
8477 if (token !== null && token.value === ',') {
8478 if (isCommaContextStart(matchStack.token)) {
8479 syntax = MISMATCH$1;
8480 } else {
8481 addTokenToMatch();
8482 syntax = isCommaContextEnd(token) ? MISMATCH$1 : MATCH$1;
8483 }
8484 } else {
8485 syntax = isCommaContextStart(matchStack.token) || isCommaContextEnd(token) ? MATCH$1 : MISMATCH$1;
8486 }
8487
8488 break;
8489
8490 // case 'String':
8491 // TODO: strings with length other than 1 char
8492
8493 default:
8494 throw new Error('Unknown node type: ' + syntax.type);
8495 }
8496 }
8497
8498 totalIterationCount += iterationCount;
8499
8500 if (exitReason === EXIT_REASON_MATCH) {
8501 while (syntaxStack !== null) {
8502 closeSyntax();
8503 }
8504 } else {
8505 matchStack = null;
8506 }
8507
8508 return {
8509 tokens: tokens,
8510 reason: exitReason,
8511 iterations: iterationCount,
8512 match: matchStack,
8513 longestMatch: longestMatch
8514 };
8515 }
8516
8517 function matchAsList(tokens, matchGraph$$1, syntaxes) {
8518 var matchResult = internalMatch(tokens, matchGraph$$1, syntaxes || {});
8519
8520 if (matchResult.match !== null) {
8521 matchResult.match = mapList(matchResult.match, function(item) {
8522 if (item.type === OPEN_SYNTAX || item.type === CLOSE_SYNTAX) {
8523 return { type: item.type, syntax: item.syntax };
8524 }
8525
8526 return {
8527 syntax: item.syntax,
8528 token: item.token && item.token.value,
8529 node: item.token && item.token.node
8530 };
8531 }).slice(1);
8532 }
8533
8534 return matchResult;
8535 }
8536
8537 function matchAsTree(tokens, matchGraph$$1, syntaxes) {
8538 var matchResult = internalMatch(tokens, matchGraph$$1, syntaxes || {});
8539
8540 if (matchResult.match === null) {
8541 return matchResult;
8542 }
8543
8544 var cursor = matchResult.match;
8545 var host = matchResult.match = {
8546 syntax: matchGraph$$1.syntax || null,
8547 match: []
8548 };
8549 var stack = [host];
8550
8551 // revert a list
8552 var prev = null;
8553 var next = null;
8554 while (cursor !== null) {
8555 next = cursor.prev;
8556 cursor.prev = prev;
8557 prev = cursor;
8558 cursor = next;
8559 }
8560
8561 // init the cursor to start with 2nd item since 1st is a stub item
8562 cursor = prev.prev;
8563
8564 // build a tree
8565 while (cursor !== null && cursor.syntax !== null) {
8566 var entry = cursor;
8567
8568 switch (entry.type) {
8569 case OPEN_SYNTAX:
8570 host.match.push(host = {
8571 syntax: entry.syntax,
8572 match: []
8573 });
8574 stack.push(host);
8575 break;
8576
8577 case CLOSE_SYNTAX:
8578 stack.pop();
8579 host = stack[stack.length - 1];
8580 break;
8581
8582 default:
8583 host.match.push({
8584 syntax: entry.syntax || null,
8585 token: entry.token.value,
8586 node: entry.token.node
8587 });
8588 }
8589
8590 cursor = cursor.prev;
8591 }
8592
8593 return matchResult;
8594 }
8595
8596 var match = {
8597 matchAsList: matchAsList,
8598 matchAsTree: matchAsTree,
8599 getTotalIterationCount: function() {
8600 return totalIterationCount;
8601 }
8602 };
8603
8604 function getTrace(node) {
8605 function shouldPutToTrace(syntax) {
8606 if (syntax === null) {
8607 return false;
8608 }
8609
8610 return (
8611 syntax.type === 'Type' ||
8612 syntax.type === 'Property' ||
8613 syntax.type === 'Keyword'
8614 );
8615 }
8616
8617 function hasMatch(matchNode) {
8618 if (Array.isArray(matchNode.match)) {
8619 // use for-loop for better perfomance
8620 for (var i = 0; i < matchNode.match.length; i++) {
8621 if (hasMatch(matchNode.match[i])) {
8622 if (shouldPutToTrace(matchNode.syntax)) {
8623 result.unshift(matchNode.syntax);
8624 }
8625
8626 return true;
8627 }
8628 }
8629 } else if (matchNode.node === node) {
8630 result = shouldPutToTrace(matchNode.syntax)
8631 ? [matchNode.syntax]
8632 : [];
8633
8634 return true;
8635 }
8636
8637 return false;
8638 }
8639
8640 var result = null;
8641
8642 if (this.matched !== null) {
8643 hasMatch(this.matched);
8644 }
8645
8646 return result;
8647 }
8648
8649 function testNode(match, node, fn) {
8650 var trace = getTrace.call(match, node);
8651
8652 if (trace === null) {
8653 return false;
8654 }
8655
8656 return trace.some(fn);
8657 }
8658
8659 function isType(node, type) {
8660 return testNode(this, node, function(matchNode) {
8661 return matchNode.type === 'Type' && matchNode.name === type;
8662 });
8663 }
8664
8665 function isProperty(node, property) {
8666 return testNode(this, node, function(matchNode) {
8667 return matchNode.type === 'Property' && matchNode.name === property;
8668 });
8669 }
8670
8671 function isKeyword(node) {
8672 return testNode(this, node, function(matchNode) {
8673 return matchNode.type === 'Keyword';
8674 });
8675 }
8676
8677 var trace = {
8678 getTrace: getTrace,
8679 isType: isType,
8680 isProperty: isProperty,
8681 isKeyword: isKeyword
8682 };
8683
8684 function getFirstMatchNode(matchNode) {
8685 if ('node' in matchNode) {
8686 return matchNode.node;
8687 }
8688
8689 return getFirstMatchNode(matchNode.match[0]);
8690 }
8691
8692 function getLastMatchNode(matchNode) {
8693 if ('node' in matchNode) {
8694 return matchNode.node;
8695 }
8696
8697 return getLastMatchNode(matchNode.match[matchNode.match.length - 1]);
8698 }
8699
8700 function matchFragments(lexer, ast, match, type, name) {
8701 function findFragments(matchNode) {
8702 if (matchNode.syntax !== null &&
8703 matchNode.syntax.type === type &&
8704 matchNode.syntax.name === name) {
8705 var start = getFirstMatchNode(matchNode);
8706 var end = getLastMatchNode(matchNode);
8707
8708 lexer.syntax.walk(ast, function(node, item, list$$1) {
8709 if (node === start) {
8710 var nodes = new list();
8711
8712 do {
8713 nodes.appendData(item.data);
8714
8715 if (item.data === end) {
8716 break;
8717 }
8718
8719 item = item.next;
8720 } while (item !== null);
8721
8722 fragments.push({
8723 parent: list$$1,
8724 nodes: nodes
8725 });
8726 }
8727 });
8728 }
8729
8730 if (Array.isArray(matchNode.match)) {
8731 matchNode.match.forEach(findFragments);
8732 }
8733 }
8734
8735 var fragments = [];
8736
8737 if (match.matched !== null) {
8738 findFragments(match.matched);
8739 }
8740
8741 return fragments;
8742 }
8743
8744 var search = {
8745 matchFragments: matchFragments
8746 };
8747
8748 var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
8749
8750 function isValidNumber(value) {
8751 // Number.isInteger(value) && value >= 0
8752 return (
8753 typeof value === 'number' &&
8754 isFinite(value) &&
8755 Math.floor(value) === value &&
8756 value >= 0
8757 );
8758 }
8759
8760 function isValidLocation(loc) {
8761 return (
8762 Boolean(loc) &&
8763 isValidNumber(loc.offset) &&
8764 isValidNumber(loc.line) &&
8765 isValidNumber(loc.column)
8766 );
8767 }
8768
8769 function createNodeStructureChecker(type, fields) {
8770 return function checkNode(node, warn) {
8771 if (!node || node.constructor !== Object) {
8772 return warn(node, 'Type of node should be an Object');
8773 }
8774
8775 for (var key in node) {
8776 var valid = true;
8777
8778 if (hasOwnProperty$2.call(node, key) === false) {
8779 continue;
8780 }
8781
8782 if (key === 'type') {
8783 if (node.type !== type) {
8784 warn(node, 'Wrong node type `' + node.type + '`, expected `' + type + '`');
8785 }
8786 } else if (key === 'loc') {
8787 if (node.loc === null) {
8788 continue;
8789 } else if (node.loc && node.loc.constructor === Object) {
8790 if (typeof node.loc.source !== 'string') {
8791 key += '.source';
8792 } else if (!isValidLocation(node.loc.start)) {
8793 key += '.start';
8794 } else if (!isValidLocation(node.loc.end)) {
8795 key += '.end';
8796 } else {
8797 continue;
8798 }
8799 }
8800
8801 valid = false;
8802 } else if (fields.hasOwnProperty(key)) {
8803 for (var i = 0, valid = false; !valid && i < fields[key].length; i++) {
8804 var fieldType = fields[key][i];
8805
8806 switch (fieldType) {
8807 case String:
8808 valid = typeof node[key] === 'string';
8809 break;
8810
8811 case Boolean:
8812 valid = typeof node[key] === 'boolean';
8813 break;
8814
8815 case null:
8816 valid = node[key] === null;
8817 break;
8818
8819 default:
8820 if (typeof fieldType === 'string') {
8821 valid = node[key] && node[key].type === fieldType;
8822 } else if (Array.isArray(fieldType)) {
8823 valid = node[key] instanceof list;
8824 }
8825 }
8826 }
8827 } else {
8828 warn(node, 'Unknown field `' + key + '` for ' + type + ' node type');
8829 }
8830
8831 if (!valid) {
8832 warn(node, 'Bad value for `' + type + '.' + key + '`');
8833 }
8834 }
8835
8836 for (var key in fields) {
8837 if (hasOwnProperty$2.call(fields, key) &&
8838 hasOwnProperty$2.call(node, key) === false) {
8839 warn(node, 'Field `' + type + '.' + key + '` is missed');
8840 }
8841 }
8842 };
8843 }
8844
8845 function processStructure(name, nodeType) {
8846 var structure = nodeType.structure;
8847 var fields = {
8848 type: String,
8849 loc: true
8850 };
8851 var docs = {
8852 type: '"' + name + '"'
8853 };
8854
8855 for (var key in structure) {
8856 if (hasOwnProperty$2.call(structure, key) === false) {
8857 continue;
8858 }
8859
8860 var docsTypes = [];
8861 var fieldTypes = fields[key] = Array.isArray(structure[key])
8862 ? structure[key].slice()
8863 : [structure[key]];
8864
8865 for (var i = 0; i < fieldTypes.length; i++) {
8866 var fieldType = fieldTypes[i];
8867 if (fieldType === String || fieldType === Boolean) {
8868 docsTypes.push(fieldType.name);
8869 } else if (fieldType === null) {
8870 docsTypes.push('null');
8871 } else if (typeof fieldType === 'string') {
8872 docsTypes.push('<' + fieldType + '>');
8873 } else if (Array.isArray(fieldType)) {
8874 docsTypes.push('List'); // TODO: use type enum
8875 } else {
8876 throw new Error('Wrong value `' + fieldType + '` in `' + name + '.' + key + '` structure definition');
8877 }
8878 }
8879
8880 docs[key] = docsTypes.join(' | ');
8881 }
8882
8883 return {
8884 docs: docs,
8885 check: createNodeStructureChecker(name, fields)
8886 };
8887 }
8888
8889 var structure = {
8890 getStructureFromConfig: function(config) {
8891 var structure = {};
8892
8893 if (config.node) {
8894 for (var name in config.node) {
8895 if (hasOwnProperty$2.call(config.node, name)) {
8896 var nodeType = config.node[name];
8897
8898 if (nodeType.structure) {
8899 structure[name] = processStructure(name, nodeType);
8900 } else {
8901 throw new Error('Missed `structure` field in `' + name + '` node type definition');
8902 }
8903 }
8904 }
8905 }
8906
8907 return structure;
8908 }
8909 };
8910
8911 var SyntaxReferenceError$1 = error$1.SyntaxReferenceError;
8912 var MatchError$1 = error$1.MatchError;
8913
8914
8915
8916
8917
8918
8919 var buildMatchGraph$1 = matchGraph.buildMatchGraph;
8920 var matchAsTree$1 = match.matchAsTree;
8921
8922
8923 var getStructureFromConfig = structure.getStructureFromConfig;
8924 var cssWideKeywords = buildMatchGraph$1(parse_1('inherit | initial | unset'));
8925 var cssWideKeywordsWithExpression = buildMatchGraph$1(parse_1('inherit | initial | unset | <expression>'));
8926
8927 function dumpMapSyntax(map, syntaxAsAst) {
8928 var result = {};
8929
8930 for (var name in map) {
8931 if (map[name].syntax) {
8932 result[name] = syntaxAsAst ? map[name].syntax : generate_1(map[name].syntax);
8933 }
8934 }
8935
8936 return result;
8937 }
8938
8939 function valueHasVar(value) {
8940 var hasVar = false;
8941
8942 this.syntax.walk(value, function(node) {
8943 if (node.type === 'Function' && node.name.toLowerCase() === 'var') {
8944 hasVar = true;
8945 }
8946 });
8947
8948 return hasVar;
8949 }
8950
8951 function buildMatchResult(match$$1, error, iterations) {
8952 return {
8953 matched: match$$1,
8954 iterations: iterations,
8955 error: error,
8956 getTrace: trace.getTrace,
8957 isType: trace.isType,
8958 isProperty: trace.isProperty,
8959 isKeyword: trace.isKeyword
8960 };
8961 }
8962
8963 function matchSyntax(lexer, syntax, node, useCommon) {
8964 if (!node) {
8965 return buildMatchResult(null, new Error('Node is undefined'));
8966 }
8967
8968 if (valueHasVar.call(lexer, node)) {
8969 return buildMatchResult(null, new Error('Matching for a tree with var() is not supported'));
8970 }
8971
8972 var tokens = lexer.syntax.generate(node, astToTokens);
8973 var result;
8974
8975 if (useCommon) {
8976 result = matchAsTree$1(tokens, lexer.valueCommonSyntax, lexer);
8977 }
8978
8979 if (!useCommon || !result.match) {
8980 result = matchAsTree$1(tokens, syntax.match, lexer);
8981 if (!result.match) {
8982 return buildMatchResult(
8983 null,
8984 new MatchError$1(result.reason, lexer, syntax.syntax, node, result),
8985 result.iterations
8986 );
8987 }
8988 }
8989
8990 return buildMatchResult(result.match, null, result.iterations);
8991 }
8992
8993 var Lexer = function(config, syntax, structure$$1) {
8994 this.valueCommonSyntax = cssWideKeywords;
8995 this.syntax = syntax;
8996 this.generic = false;
8997 this.properties = {};
8998 this.types = {};
8999 this.structure = structure$$1 || getStructureFromConfig(config);
9000
9001 if (config) {
9002 if (config.generic) {
9003 this.generic = true;
9004 for (var name in generic) {
9005 this.addType_(name, generic[name]);
9006 }
9007 }
9008
9009 if (config.types) {
9010 for (var name in config.types) {
9011 this.addType_(name, config.types[name]);
9012 }
9013 }
9014
9015 if (config.properties) {
9016 for (var name in config.properties) {
9017 this.addProperty_(name, config.properties[name]);
9018 }
9019 }
9020 }
9021 };
9022
9023 Lexer.prototype = {
9024 structure: {},
9025 checkStructure: function(ast) {
9026 function collectWarning(node, message) {
9027 warns.push({
9028 node: node,
9029 message: message
9030 });
9031 }
9032
9033 var structure$$1 = this.structure;
9034 var warns = [];
9035
9036 this.syntax.walk(ast, function(node) {
9037 if (structure$$1.hasOwnProperty(node.type)) {
9038 structure$$1[node.type].check(node, collectWarning);
9039 } else {
9040 collectWarning(node, 'Unknown node type `' + node.type + '`');
9041 }
9042 });
9043
9044 return warns.length ? warns : false;
9045 },
9046
9047 createDescriptor: function(syntax, type, name) {
9048 var ref = {
9049 type: type,
9050 name: name
9051 };
9052 var descriptor = {
9053 type: type,
9054 name: name,
9055 syntax: null,
9056 match: null
9057 };
9058
9059 if (typeof syntax === 'function') {
9060 descriptor.match = buildMatchGraph$1(syntax, ref);
9061 } else {
9062 if (typeof syntax === 'string') {
9063 // lazy parsing on first access
9064 Object.defineProperty(descriptor, 'syntax', {
9065 get: function() {
9066 Object.defineProperty(descriptor, 'syntax', {
9067 value: parse_1(syntax)
9068 });
9069
9070 return descriptor.syntax;
9071 }
9072 });
9073 } else {
9074 descriptor.syntax = syntax;
9075 }
9076
9077 Object.defineProperty(descriptor, 'match', {
9078 get: function() {
9079 Object.defineProperty(descriptor, 'match', {
9080 value: buildMatchGraph$1(descriptor.syntax, ref)
9081 });
9082
9083 return descriptor.match;
9084 }
9085 });
9086 }
9087
9088 return descriptor;
9089 },
9090 addProperty_: function(name, syntax) {
9091 this.properties[name] = this.createDescriptor(syntax, 'Property', name);
9092 },
9093 addType_: function(name, syntax) {
9094 this.types[name] = this.createDescriptor(syntax, 'Type', name);
9095
9096 if (syntax === generic.expression) {
9097 this.valueCommonSyntax = cssWideKeywordsWithExpression;
9098 }
9099 },
9100
9101 matchDeclaration: function(node) {
9102 if (node.type !== 'Declaration') {
9103 return buildMatchResult(null, new Error('Not a Declaration node'));
9104 }
9105
9106 return this.matchProperty(node.property, node.value);
9107 },
9108 matchProperty: function(propertyName, value) {
9109 var property = names.property(propertyName);
9110
9111 // don't match syntax for a custom property
9112 if (property.custom) {
9113 return buildMatchResult(null, new Error('Lexer matching doesn\'t applicable for custom properties'));
9114 }
9115
9116 var propertySyntax = property.vendor
9117 ? this.getProperty(property.name) || this.getProperty(property.basename)
9118 : this.getProperty(property.name);
9119
9120 if (!propertySyntax) {
9121 return buildMatchResult(null, new SyntaxReferenceError$1('Unknown property', propertyName));
9122 }
9123
9124 return matchSyntax(this, propertySyntax, value, true);
9125 },
9126 matchType: function(typeName, value) {
9127 var typeSyntax = this.getType(typeName);
9128
9129 if (!typeSyntax) {
9130 return buildMatchResult(null, new SyntaxReferenceError$1('Unknown type', typeName));
9131 }
9132
9133 return matchSyntax(this, typeSyntax, value, false);
9134 },
9135 match: function(syntax, value) {
9136 if (!syntax || !syntax.type) {
9137 return buildMatchResult(null, new SyntaxReferenceError$1('Bad syntax'));
9138 }
9139
9140 if (!syntax.match) {
9141 syntax = this.createDescriptor(syntax);
9142 }
9143
9144 return matchSyntax(this, syntax, value, false);
9145 },
9146
9147 findValueFragments: function(propertyName, value, type, name) {
9148 return search.matchFragments(this, value, this.matchProperty(propertyName, value), type, name);
9149 },
9150 findDeclarationValueFragments: function(declaration, type, name) {
9151 return search.matchFragments(this, declaration.value, this.matchDeclaration(declaration), type, name);
9152 },
9153 findAllFragments: function(ast, type, name) {
9154 var result = [];
9155
9156 this.syntax.walk(ast, {
9157 visit: 'Declaration',
9158 enter: function(declaration) {
9159 result.push.apply(result, this.findDeclarationValueFragments(declaration, type, name));
9160 }.bind(this)
9161 });
9162
9163 return result;
9164 },
9165
9166 getProperty: function(name) {
9167 return this.properties.hasOwnProperty(name) ? this.properties[name] : null;
9168 },
9169 getType: function(name) {
9170 return this.types.hasOwnProperty(name) ? this.types[name] : null;
9171 },
9172
9173 validate: function() {
9174 function validate(syntax, name, broken, descriptor) {
9175 if (broken.hasOwnProperty(name)) {
9176 return broken[name];
9177 }
9178
9179 broken[name] = false;
9180 if (descriptor.syntax !== null) {
9181 walk(descriptor.syntax, function(node) {
9182 if (node.type !== 'Type' && node.type !== 'Property') {
9183 return;
9184 }
9185
9186 var map = node.type === 'Type' ? syntax.types : syntax.properties;
9187 var brokenMap = node.type === 'Type' ? brokenTypes : brokenProperties;
9188
9189 if (!map.hasOwnProperty(node.name) || validate(syntax, node.name, brokenMap, map[node.name])) {
9190 broken[name] = true;
9191 }
9192 }, this);
9193 }
9194 }
9195
9196 var brokenTypes = {};
9197 var brokenProperties = {};
9198
9199 for (var key in this.types) {
9200 validate(this, key, brokenTypes, this.types[key]);
9201 }
9202
9203 for (var key in this.properties) {
9204 validate(this, key, brokenProperties, this.properties[key]);
9205 }
9206
9207 brokenTypes = Object.keys(brokenTypes).filter(function(name) {
9208 return brokenTypes[name];
9209 });
9210 brokenProperties = Object.keys(brokenProperties).filter(function(name) {
9211 return brokenProperties[name];
9212 });
9213
9214 if (brokenTypes.length || brokenProperties.length) {
9215 return {
9216 types: brokenTypes,
9217 properties: brokenProperties
9218 };
9219 }
9220
9221 return null;
9222 },
9223 dump: function(syntaxAsAst) {
9224 return {
9225 generic: this.generic,
9226 types: dumpMapSyntax(this.types, syntaxAsAst),
9227 properties: dumpMapSyntax(this.properties, syntaxAsAst)
9228 };
9229 },
9230 toString: function() {
9231 return JSON.stringify(this.dump());
9232 }
9233 };
9234
9235 var Lexer_1 = Lexer;
9236
9237 var grammar = {
9238 SyntaxParseError: error$2.SyntaxParseError,
9239 parse: parse_1,
9240 generate: generate_1,
9241 walk: walk
9242 };
9243
9244 var TYPE$3 = tokenizer.TYPE;
9245 var WHITESPACE$2 = TYPE$3.WhiteSpace;
9246 var COMMENT$2 = TYPE$3.Comment;
9247
9248 var sequence = function readSequence(recognizer) {
9249 var children = this.createList();
9250 var child = null;
9251 var context = {
9252 recognizer: recognizer,
9253 space: null,
9254 ignoreWS: false,
9255 ignoreWSAfter: false
9256 };
9257
9258 this.scanner.skipSC();
9259
9260 while (!this.scanner.eof) {
9261 switch (this.scanner.tokenType) {
9262 case COMMENT$2:
9263 this.scanner.next();
9264 continue;
9265
9266 case WHITESPACE$2:
9267 if (context.ignoreWS) {
9268 this.scanner.next();
9269 } else {
9270 context.space = this.WhiteSpace();
9271 }
9272 continue;
9273 }
9274
9275 child = recognizer.getNode.call(this, context);
9276
9277 if (child === undefined) {
9278 break;
9279 }
9280
9281 if (context.space !== null) {
9282 children.push(context.space);
9283 context.space = null;
9284 }
9285
9286 children.push(child);
9287
9288 if (context.ignoreWSAfter) {
9289 context.ignoreWSAfter = false;
9290 context.ignoreWS = true;
9291 } else {
9292 context.ignoreWS = false;
9293 }
9294 }
9295
9296 return children;
9297 };
9298
9299 var noop$3 = function() {};
9300
9301 function createParseContext(name) {
9302 return function() {
9303 return this[name]();
9304 };
9305 }
9306
9307 function processConfig(config) {
9308 var parserConfig = {
9309 context: {},
9310 scope: {},
9311 atrule: {},
9312 pseudo: {}
9313 };
9314
9315 if (config.parseContext) {
9316 for (var name in config.parseContext) {
9317 switch (typeof config.parseContext[name]) {
9318 case 'function':
9319 parserConfig.context[name] = config.parseContext[name];
9320 break;
9321
9322 case 'string':
9323 parserConfig.context[name] = createParseContext(config.parseContext[name]);
9324 break;
9325 }
9326 }
9327 }
9328
9329 if (config.scope) {
9330 for (var name in config.scope) {
9331 parserConfig.scope[name] = config.scope[name];
9332 }
9333 }
9334
9335 if (config.atrule) {
9336 for (var name in config.atrule) {
9337 var atrule = config.atrule[name];
9338
9339 if (atrule.parse) {
9340 parserConfig.atrule[name] = atrule.parse;
9341 }
9342 }
9343 }
9344
9345 if (config.pseudo) {
9346 for (var name in config.pseudo) {
9347 var pseudo = config.pseudo[name];
9348
9349 if (pseudo.parse) {
9350 parserConfig.pseudo[name] = pseudo.parse;
9351 }
9352 }
9353 }
9354
9355 if (config.node) {
9356 for (var name in config.node) {
9357 parserConfig[name] = config.node[name].parse;
9358 }
9359 }
9360
9361 return parserConfig;
9362 }
9363
9364 var create$1 = function createParser(config) {
9365 var parser = {
9366 scanner: new tokenizer(),
9367 filename: '<unknown>',
9368 needPositions: false,
9369 onParseError: noop$3,
9370 onParseErrorThrow: false,
9371 parseAtrulePrelude: true,
9372 parseRulePrelude: true,
9373 parseValue: true,
9374 parseCustomProperty: false,
9375
9376 readSequence: sequence,
9377
9378 createList: function() {
9379 return new list();
9380 },
9381 createSingleNodeList: function(node) {
9382 return new list().appendData(node);
9383 },
9384 getFirstListNode: function(list$$1) {
9385 return list$$1 && list$$1.first();
9386 },
9387 getLastListNode: function(list$$1) {
9388 return list$$1.last();
9389 },
9390
9391 parseWithFallback: function(consumer, fallback) {
9392 var startToken = this.scanner.currentToken;
9393
9394 try {
9395 return consumer.call(this);
9396 } catch (e) {
9397 if (this.onParseErrorThrow) {
9398 throw e;
9399 }
9400
9401 var fallbackNode = fallback.call(this, startToken);
9402
9403 this.onParseErrorThrow = true;
9404 this.onParseError(e, fallbackNode);
9405 this.onParseErrorThrow = false;
9406
9407 return fallbackNode;
9408 }
9409 },
9410
9411 getLocation: function(start, end) {
9412 if (this.needPositions) {
9413 return this.scanner.getLocationRange(
9414 start,
9415 end,
9416 this.filename
9417 );
9418 }
9419
9420 return null;
9421 },
9422 getLocationFromList: function(list$$1) {
9423 if (this.needPositions) {
9424 var head = this.getFirstListNode(list$$1);
9425 var tail = this.getLastListNode(list$$1);
9426 return this.scanner.getLocationRange(
9427 head !== null ? head.loc.start.offset - this.scanner.startOffset : this.scanner.tokenStart,
9428 tail !== null ? tail.loc.end.offset - this.scanner.startOffset : this.scanner.tokenStart,
9429 this.filename
9430 );
9431 }
9432
9433 return null;
9434 }
9435 };
9436
9437 config = processConfig(config || {});
9438 for (var key in config) {
9439 parser[key] = config[key];
9440 }
9441
9442 return function(source, options) {
9443 options = options || {};
9444
9445 var context = options.context || 'default';
9446 var ast;
9447
9448 parser.scanner.setSource(source, options.offset, options.line, options.column);
9449 parser.filename = options.filename || '<unknown>';
9450 parser.needPositions = Boolean(options.positions);
9451 parser.onParseError = typeof options.onParseError === 'function' ? options.onParseError : noop$3;
9452 parser.onParseErrorThrow = false;
9453 parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true;
9454 parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true;
9455 parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true;
9456 parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false;
9457
9458 if (!parser.context.hasOwnProperty(context)) {
9459 throw new Error('Unknown context `' + context + '`');
9460 }
9461
9462 ast = parser.context[context].call(parser, options);
9463
9464 if (!parser.scanner.eof) {
9465 parser.scanner.error();
9466 }
9467
9468 return ast;
9469 };
9470 };
9471
9472 /* -*- Mode: js; js-indent-level: 2; -*- */
9473 /*
9474 * Copyright 2011 Mozilla Foundation and contributors
9475 * Licensed under the New BSD license. See LICENSE or:
9476 * http://opensource.org/licenses/BSD-3-Clause
9477 */
9478
9479 var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
9480
9481 /**
9482 * Encode an integer in the range of 0 to 63 to a single base 64 digit.
9483 */
9484 var encode = function (number) {
9485 if (0 <= number && number < intToCharMap.length) {
9486 return intToCharMap[number];
9487 }
9488 throw new TypeError("Must be between 0 and 63: " + number);
9489 };
9490
9491 /**
9492 * Decode a single base 64 character code digit to an integer. Returns -1 on
9493 * failure.
9494 */
9495 var decode = function (charCode) {
9496 var bigA = 65; // 'A'
9497 var bigZ = 90; // 'Z'
9498
9499 var littleA = 97; // 'a'
9500 var littleZ = 122; // 'z'
9501
9502 var zero = 48; // '0'
9503 var nine = 57; // '9'
9504
9505 var plus = 43; // '+'
9506 var slash = 47; // '/'
9507
9508 var littleOffset = 26;
9509 var numberOffset = 52;
9510
9511 // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
9512 if (bigA <= charCode && charCode <= bigZ) {
9513 return (charCode - bigA);
9514 }
9515
9516 // 26 - 51: abcdefghijklmnopqrstuvwxyz
9517 if (littleA <= charCode && charCode <= littleZ) {
9518 return (charCode - littleA + littleOffset);
9519 }
9520
9521 // 52 - 61: 0123456789
9522 if (zero <= charCode && charCode <= nine) {
9523 return (charCode - zero + numberOffset);
9524 }
9525
9526 // 62: +
9527 if (charCode == plus) {
9528 return 62;
9529 }
9530
9531 // 63: /
9532 if (charCode == slash) {
9533 return 63;
9534 }
9535
9536 // Invalid base64 digit.
9537 return -1;
9538 };
9539
9540 var base64 = {
9541 encode: encode,
9542 decode: decode
9543 };
9544
9545 /* -*- Mode: js; js-indent-level: 2; -*- */
9546 /*
9547 * Copyright 2011 Mozilla Foundation and contributors
9548 * Licensed under the New BSD license. See LICENSE or:
9549 * http://opensource.org/licenses/BSD-3-Clause
9550 *
9551 * Based on the Base 64 VLQ implementation in Closure Compiler:
9552 * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
9553 *
9554 * Copyright 2011 The Closure Compiler Authors. All rights reserved.
9555 * Redistribution and use in source and binary forms, with or without
9556 * modification, are permitted provided that the following conditions are
9557 * met:
9558 *
9559 * * Redistributions of source code must retain the above copyright
9560 * notice, this list of conditions and the following disclaimer.
9561 * * Redistributions in binary form must reproduce the above
9562 * copyright notice, this list of conditions and the following
9563 * disclaimer in the documentation and/or other materials provided
9564 * with the distribution.
9565 * * Neither the name of Google Inc. nor the names of its
9566 * contributors may be used to endorse or promote products derived
9567 * from this software without specific prior written permission.
9568 *
9569 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9570 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9571 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9572 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9573 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9574 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9575 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9576 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9577 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9578 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9579 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9580 */
9581
9582
9583
9584 // A single base 64 digit can contain 6 bits of data. For the base 64 variable
9585 // length quantities we use in the source map spec, the first bit is the sign,
9586 // the next four bits are the actual value, and the 6th bit is the
9587 // continuation bit. The continuation bit tells us whether there are more
9588 // digits in this value following this digit.
9589 //
9590 // Continuation
9591 // | Sign
9592 // | |
9593 // V V
9594 // 101011
9595
9596 var VLQ_BASE_SHIFT = 5;
9597
9598 // binary: 100000
9599 var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
9600
9601 // binary: 011111
9602 var VLQ_BASE_MASK = VLQ_BASE - 1;
9603
9604 // binary: 100000
9605 var VLQ_CONTINUATION_BIT = VLQ_BASE;
9606
9607 /**
9608 * Converts from a two-complement value to a value where the sign bit is
9609 * placed in the least significant bit. For example, as decimals:
9610 * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
9611 * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
9612 */
9613 function toVLQSigned(aValue) {
9614 return aValue < 0
9615 ? ((-aValue) << 1) + 1
9616 : (aValue << 1) + 0;
9617 }
9618
9619 /**
9620 * Converts to a two-complement value from a value where the sign bit is
9621 * placed in the least significant bit. For example, as decimals:
9622 * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
9623 * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
9624 */
9625 function fromVLQSigned(aValue) {
9626 var isNegative = (aValue & 1) === 1;
9627 var shifted = aValue >> 1;
9628 return isNegative
9629 ? -shifted
9630 : shifted;
9631 }
9632
9633 /**
9634 * Returns the base 64 VLQ encoded value.
9635 */
9636 var encode$1 = function base64VLQ_encode(aValue) {
9637 var encoded = "";
9638 var digit;
9639
9640 var vlq = toVLQSigned(aValue);
9641
9642 do {
9643 digit = vlq & VLQ_BASE_MASK;
9644 vlq >>>= VLQ_BASE_SHIFT;
9645 if (vlq > 0) {
9646 // There are still more digits in this value, so we must make sure the
9647 // continuation bit is marked.
9648 digit |= VLQ_CONTINUATION_BIT;
9649 }
9650 encoded += base64.encode(digit);
9651 } while (vlq > 0);
9652
9653 return encoded;
9654 };
9655
9656 /**
9657 * Decodes the next base 64 VLQ value from the given string and returns the
9658 * value and the rest of the string via the out parameter.
9659 */
9660 var decode$1 = function base64VLQ_decode(aStr, aIndex, aOutParam) {
9661 var strLen = aStr.length;
9662 var result = 0;
9663 var shift = 0;
9664 var continuation, digit;
9665
9666 do {
9667 if (aIndex >= strLen) {
9668 throw new Error("Expected more digits in base 64 VLQ value.");
9669 }
9670
9671 digit = base64.decode(aStr.charCodeAt(aIndex++));
9672 if (digit === -1) {
9673 throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
9674 }
9675
9676 continuation = !!(digit & VLQ_CONTINUATION_BIT);
9677 digit &= VLQ_BASE_MASK;
9678 result = result + (digit << shift);
9679 shift += VLQ_BASE_SHIFT;
9680 } while (continuation);
9681
9682 aOutParam.value = fromVLQSigned(result);
9683 aOutParam.rest = aIndex;
9684 };
9685
9686 var base64Vlq = {
9687 encode: encode$1,
9688 decode: decode$1
9689 };
9690
9691 var util = createCommonjsModule(function (module, exports) {
9692 /* -*- Mode: js; js-indent-level: 2; -*- */
9693 /*
9694 * Copyright 2011 Mozilla Foundation and contributors
9695 * Licensed under the New BSD license. See LICENSE or:
9696 * http://opensource.org/licenses/BSD-3-Clause
9697 */
9698
9699 /**
9700 * This is a helper function for getting values from parameter/options
9701 * objects.
9702 *
9703 * @param args The object we are extracting values from
9704 * @param name The name of the property we are getting.
9705 * @param defaultValue An optional value to return if the property is missing
9706 * from the object. If this is not specified and the property is missing, an
9707 * error will be thrown.
9708 */
9709 function getArg(aArgs, aName, aDefaultValue) {
9710 if (aName in aArgs) {
9711 return aArgs[aName];
9712 } else if (arguments.length === 3) {
9713 return aDefaultValue;
9714 } else {
9715 throw new Error('"' + aName + '" is a required argument.');
9716 }
9717 }
9718 exports.getArg = getArg;
9719
9720 var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
9721 var dataUrlRegexp = /^data:.+\,.+$/;
9722
9723 function urlParse(aUrl) {
9724 var match = aUrl.match(urlRegexp);
9725 if (!match) {
9726 return null;
9727 }
9728 return {
9729 scheme: match[1],
9730 auth: match[2],
9731 host: match[3],
9732 port: match[4],
9733 path: match[5]
9734 };
9735 }
9736 exports.urlParse = urlParse;
9737
9738 function urlGenerate(aParsedUrl) {
9739 var url = '';
9740 if (aParsedUrl.scheme) {
9741 url += aParsedUrl.scheme + ':';
9742 }
9743 url += '//';
9744 if (aParsedUrl.auth) {
9745 url += aParsedUrl.auth + '@';
9746 }
9747 if (aParsedUrl.host) {
9748 url += aParsedUrl.host;
9749 }
9750 if (aParsedUrl.port) {
9751 url += ":" + aParsedUrl.port;
9752 }
9753 if (aParsedUrl.path) {
9754 url += aParsedUrl.path;
9755 }
9756 return url;
9757 }
9758 exports.urlGenerate = urlGenerate;
9759
9760 /**
9761 * Normalizes a path, or the path portion of a URL:
9762 *
9763 * - Replaces consecutive slashes with one slash.
9764 * - Removes unnecessary '.' parts.
9765 * - Removes unnecessary '<dir>/..' parts.
9766 *
9767 * Based on code in the Node.js 'path' core module.
9768 *
9769 * @param aPath The path or url to normalize.
9770 */
9771 function normalize(aPath) {
9772 var path = aPath;
9773 var url = urlParse(aPath);
9774 if (url) {
9775 if (!url.path) {
9776 return aPath;
9777 }
9778 path = url.path;
9779 }
9780 var isAbsolute = exports.isAbsolute(path);
9781
9782 var parts = path.split(/\/+/);
9783 for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
9784 part = parts[i];
9785 if (part === '.') {
9786 parts.splice(i, 1);
9787 } else if (part === '..') {
9788 up++;
9789 } else if (up > 0) {
9790 if (part === '') {
9791 // The first part is blank if the path is absolute. Trying to go
9792 // above the root is a no-op. Therefore we can remove all '..' parts
9793 // directly after the root.
9794 parts.splice(i + 1, up);
9795 up = 0;
9796 } else {
9797 parts.splice(i, 2);
9798 up--;
9799 }
9800 }
9801 }
9802 path = parts.join('/');
9803
9804 if (path === '') {
9805 path = isAbsolute ? '/' : '.';
9806 }
9807
9808 if (url) {
9809 url.path = path;
9810 return urlGenerate(url);
9811 }
9812 return path;
9813 }
9814 exports.normalize = normalize;
9815
9816 /**
9817 * Joins two paths/URLs.
9818 *
9819 * @param aRoot The root path or URL.
9820 * @param aPath The path or URL to be joined with the root.
9821 *
9822 * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
9823 * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
9824 * first.
9825 * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
9826 * is updated with the result and aRoot is returned. Otherwise the result
9827 * is returned.
9828 * - If aPath is absolute, the result is aPath.
9829 * - Otherwise the two paths are joined with a slash.
9830 * - Joining for example 'http://' and 'www.example.com' is also supported.
9831 */
9832 function join(aRoot, aPath) {
9833 if (aRoot === "") {
9834 aRoot = ".";
9835 }
9836 if (aPath === "") {
9837 aPath = ".";
9838 }
9839 var aPathUrl = urlParse(aPath);
9840 var aRootUrl = urlParse(aRoot);
9841 if (aRootUrl) {
9842 aRoot = aRootUrl.path || '/';
9843 }
9844
9845 // `join(foo, '//www.example.org')`
9846 if (aPathUrl && !aPathUrl.scheme) {
9847 if (aRootUrl) {
9848 aPathUrl.scheme = aRootUrl.scheme;
9849 }
9850 return urlGenerate(aPathUrl);
9851 }
9852
9853 if (aPathUrl || aPath.match(dataUrlRegexp)) {
9854 return aPath;
9855 }
9856
9857 // `join('http://', 'www.example.com')`
9858 if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
9859 aRootUrl.host = aPath;
9860 return urlGenerate(aRootUrl);
9861 }
9862
9863 var joined = aPath.charAt(0) === '/'
9864 ? aPath
9865 : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
9866
9867 if (aRootUrl) {
9868 aRootUrl.path = joined;
9869 return urlGenerate(aRootUrl);
9870 }
9871 return joined;
9872 }
9873 exports.join = join;
9874
9875 exports.isAbsolute = function (aPath) {
9876 return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
9877 };
9878
9879 /**
9880 * Make a path relative to a URL or another path.
9881 *
9882 * @param aRoot The root path or URL.
9883 * @param aPath The path or URL to be made relative to aRoot.
9884 */
9885 function relative(aRoot, aPath) {
9886 if (aRoot === "") {
9887 aRoot = ".";
9888 }
9889
9890 aRoot = aRoot.replace(/\/$/, '');
9891
9892 // It is possible for the path to be above the root. In this case, simply
9893 // checking whether the root is a prefix of the path won't work. Instead, we
9894 // need to remove components from the root one by one, until either we find
9895 // a prefix that fits, or we run out of components to remove.
9896 var level = 0;
9897 while (aPath.indexOf(aRoot + '/') !== 0) {
9898 var index = aRoot.lastIndexOf("/");
9899 if (index < 0) {
9900 return aPath;
9901 }
9902
9903 // If the only part of the root that is left is the scheme (i.e. http://,
9904 // file:///, etc.), one or more slashes (/), or simply nothing at all, we
9905 // have exhausted all components, so the path is not relative to the root.
9906 aRoot = aRoot.slice(0, index);
9907 if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
9908 return aPath;
9909 }
9910
9911 ++level;
9912 }
9913
9914 // Make sure we add a "../" for each component we removed from the root.
9915 return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
9916 }
9917 exports.relative = relative;
9918
9919 var supportsNullProto = (function () {
9920 var obj = Object.create(null);
9921 return !('__proto__' in obj);
9922 }());
9923
9924 function identity (s) {
9925 return s;
9926 }
9927
9928 /**
9929 * Because behavior goes wacky when you set `__proto__` on objects, we
9930 * have to prefix all the strings in our set with an arbitrary character.
9931 *
9932 * See https://github.com/mozilla/source-map/pull/31 and
9933 * https://github.com/mozilla/source-map/issues/30
9934 *
9935 * @param String aStr
9936 */
9937 function toSetString(aStr) {
9938 if (isProtoString(aStr)) {
9939 return '$' + aStr;
9940 }
9941
9942 return aStr;
9943 }
9944 exports.toSetString = supportsNullProto ? identity : toSetString;
9945
9946 function fromSetString(aStr) {
9947 if (isProtoString(aStr)) {
9948 return aStr.slice(1);
9949 }
9950
9951 return aStr;
9952 }
9953 exports.fromSetString = supportsNullProto ? identity : fromSetString;
9954
9955 function isProtoString(s) {
9956 if (!s) {
9957 return false;
9958 }
9959
9960 var length = s.length;
9961
9962 if (length < 9 /* "__proto__".length */) {
9963 return false;
9964 }
9965
9966 if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
9967 s.charCodeAt(length - 2) !== 95 /* '_' */ ||
9968 s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
9969 s.charCodeAt(length - 4) !== 116 /* 't' */ ||
9970 s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
9971 s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
9972 s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
9973 s.charCodeAt(length - 8) !== 95 /* '_' */ ||
9974 s.charCodeAt(length - 9) !== 95 /* '_' */) {
9975 return false;
9976 }
9977
9978 for (var i = length - 10; i >= 0; i--) {
9979 if (s.charCodeAt(i) !== 36 /* '$' */) {
9980 return false;
9981 }
9982 }
9983
9984 return true;
9985 }
9986
9987 /**
9988 * Comparator between two mappings where the original positions are compared.
9989 *
9990 * Optionally pass in `true` as `onlyCompareGenerated` to consider two
9991 * mappings with the same original source/line/column, but different generated
9992 * line and column the same. Useful when searching for a mapping with a
9993 * stubbed out mapping.
9994 */
9995 function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
9996 var cmp = mappingA.source - mappingB.source;
9997 if (cmp !== 0) {
9998 return cmp;
9999 }
10000
10001 cmp = mappingA.originalLine - mappingB.originalLine;
10002 if (cmp !== 0) {
10003 return cmp;
10004 }
10005
10006 cmp = mappingA.originalColumn - mappingB.originalColumn;
10007 if (cmp !== 0 || onlyCompareOriginal) {
10008 return cmp;
10009 }
10010
10011 cmp = mappingA.generatedColumn - mappingB.generatedColumn;
10012 if (cmp !== 0) {
10013 return cmp;
10014 }
10015
10016 cmp = mappingA.generatedLine - mappingB.generatedLine;
10017 if (cmp !== 0) {
10018 return cmp;
10019 }
10020
10021 return mappingA.name - mappingB.name;
10022 }
10023 exports.compareByOriginalPositions = compareByOriginalPositions;
10024
10025 /**
10026 * Comparator between two mappings with deflated source and name indices where
10027 * the generated positions are compared.
10028 *
10029 * Optionally pass in `true` as `onlyCompareGenerated` to consider two
10030 * mappings with the same generated line and column, but different
10031 * source/name/original line and column the same. Useful when searching for a
10032 * mapping with a stubbed out mapping.
10033 */
10034 function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
10035 var cmp = mappingA.generatedLine - mappingB.generatedLine;
10036 if (cmp !== 0) {
10037 return cmp;
10038 }
10039
10040 cmp = mappingA.generatedColumn - mappingB.generatedColumn;
10041 if (cmp !== 0 || onlyCompareGenerated) {
10042 return cmp;
10043 }
10044
10045 cmp = mappingA.source - mappingB.source;
10046 if (cmp !== 0) {
10047 return cmp;
10048 }
10049
10050 cmp = mappingA.originalLine - mappingB.originalLine;
10051 if (cmp !== 0) {
10052 return cmp;
10053 }
10054
10055 cmp = mappingA.originalColumn - mappingB.originalColumn;
10056 if (cmp !== 0) {
10057 return cmp;
10058 }
10059
10060 return mappingA.name - mappingB.name;
10061 }
10062 exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
10063
10064 function strcmp(aStr1, aStr2) {
10065 if (aStr1 === aStr2) {
10066 return 0;
10067 }
10068
10069 if (aStr1 > aStr2) {
10070 return 1;
10071 }
10072
10073 return -1;
10074 }
10075
10076 /**
10077 * Comparator between two mappings with inflated source and name strings where
10078 * the generated positions are compared.
10079 */
10080 function compareByGeneratedPositionsInflated(mappingA, mappingB) {
10081 var cmp = mappingA.generatedLine - mappingB.generatedLine;
10082 if (cmp !== 0) {
10083 return cmp;
10084 }
10085
10086 cmp = mappingA.generatedColumn - mappingB.generatedColumn;
10087 if (cmp !== 0) {
10088 return cmp;
10089 }
10090
10091 cmp = strcmp(mappingA.source, mappingB.source);
10092 if (cmp !== 0) {
10093 return cmp;
10094 }
10095
10096 cmp = mappingA.originalLine - mappingB.originalLine;
10097 if (cmp !== 0) {
10098 return cmp;
10099 }
10100
10101 cmp = mappingA.originalColumn - mappingB.originalColumn;
10102 if (cmp !== 0) {
10103 return cmp;
10104 }
10105
10106 return strcmp(mappingA.name, mappingB.name);
10107 }
10108 exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
10109 });
10110 var util_1 = util.getArg;
10111 var util_2 = util.urlParse;
10112 var util_3 = util.urlGenerate;
10113 var util_4 = util.normalize;
10114 var util_5 = util.join;
10115 var util_6 = util.isAbsolute;
10116 var util_7 = util.relative;
10117 var util_8 = util.toSetString;
10118 var util_9 = util.fromSetString;
10119 var util_10 = util.compareByOriginalPositions;
10120 var util_11 = util.compareByGeneratedPositionsDeflated;
10121 var util_12 = util.compareByGeneratedPositionsInflated;
10122
10123 /* -*- Mode: js; js-indent-level: 2; -*- */
10124 /*
10125 * Copyright 2011 Mozilla Foundation and contributors
10126 * Licensed under the New BSD license. See LICENSE or:
10127 * http://opensource.org/licenses/BSD-3-Clause
10128 */
10129
10130
10131 var has = Object.prototype.hasOwnProperty;
10132 var hasNativeMap = typeof Map !== "undefined";
10133
10134 /**
10135 * A data structure which is a combination of an array and a set. Adding a new
10136 * member is O(1), testing for membership is O(1), and finding the index of an
10137 * element is O(1). Removing elements from the set is not supported. Only
10138 * strings are supported for membership.
10139 */
10140 function ArraySet() {
10141 this._array = [];
10142 this._set = hasNativeMap ? new Map() : Object.create(null);
10143 }
10144
10145 /**
10146 * Static method for creating ArraySet instances from an existing array.
10147 */
10148 ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
10149 var set = new ArraySet();
10150 for (var i = 0, len = aArray.length; i < len; i++) {
10151 set.add(aArray[i], aAllowDuplicates);
10152 }
10153 return set;
10154 };
10155
10156 /**
10157 * Return how many unique items are in this ArraySet. If duplicates have been
10158 * added, than those do not count towards the size.
10159 *
10160 * @returns Number
10161 */
10162 ArraySet.prototype.size = function ArraySet_size() {
10163 return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
10164 };
10165
10166 /**
10167 * Add the given string to this set.
10168 *
10169 * @param String aStr
10170 */
10171 ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
10172 var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
10173 var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
10174 var idx = this._array.length;
10175 if (!isDuplicate || aAllowDuplicates) {
10176 this._array.push(aStr);
10177 }
10178 if (!isDuplicate) {
10179 if (hasNativeMap) {
10180 this._set.set(aStr, idx);
10181 } else {
10182 this._set[sStr] = idx;
10183 }
10184 }
10185 };
10186
10187 /**
10188 * Is the given string a member of this set?
10189 *
10190 * @param String aStr
10191 */
10192 ArraySet.prototype.has = function ArraySet_has(aStr) {
10193 if (hasNativeMap) {
10194 return this._set.has(aStr);
10195 } else {
10196 var sStr = util.toSetString(aStr);
10197 return has.call(this._set, sStr);
10198 }
10199 };
10200
10201 /**
10202 * What is the index of the given string in the array?
10203 *
10204 * @param String aStr
10205 */
10206 ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
10207 if (hasNativeMap) {
10208 var idx = this._set.get(aStr);
10209 if (idx >= 0) {
10210 return idx;
10211 }
10212 } else {
10213 var sStr = util.toSetString(aStr);
10214 if (has.call(this._set, sStr)) {
10215 return this._set[sStr];
10216 }
10217 }
10218
10219 throw new Error('"' + aStr + '" is not in the set.');
10220 };
10221
10222 /**
10223 * What is the element at the given index?
10224 *
10225 * @param Number aIdx
10226 */
10227 ArraySet.prototype.at = function ArraySet_at(aIdx) {
10228 if (aIdx >= 0 && aIdx < this._array.length) {
10229 return this._array[aIdx];
10230 }
10231 throw new Error('No element indexed by ' + aIdx);
10232 };
10233
10234 /**
10235 * Returns the array representation of this set (which has the proper indices
10236 * indicated by indexOf). Note that this is a copy of the internal array used
10237 * for storing the members so that no one can mess with internal state.
10238 */
10239 ArraySet.prototype.toArray = function ArraySet_toArray() {
10240 return this._array.slice();
10241 };
10242
10243 var ArraySet_1 = ArraySet;
10244
10245 var arraySet = {
10246 ArraySet: ArraySet_1
10247 };
10248
10249 /* -*- Mode: js; js-indent-level: 2; -*- */
10250 /*
10251 * Copyright 2014 Mozilla Foundation and contributors
10252 * Licensed under the New BSD license. See LICENSE or:
10253 * http://opensource.org/licenses/BSD-3-Clause
10254 */
10255
10256
10257
10258 /**
10259 * Determine whether mappingB is after mappingA with respect to generated
10260 * position.
10261 */
10262 function generatedPositionAfter(mappingA, mappingB) {
10263 // Optimized for most common case
10264 var lineA = mappingA.generatedLine;
10265 var lineB = mappingB.generatedLine;
10266 var columnA = mappingA.generatedColumn;
10267 var columnB = mappingB.generatedColumn;
10268 return lineB > lineA || lineB == lineA && columnB >= columnA ||
10269 util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
10270 }
10271
10272 /**
10273 * A data structure to provide a sorted view of accumulated mappings in a
10274 * performance conscious manner. It trades a neglibable overhead in general
10275 * case for a large speedup in case of mappings being added in order.
10276 */
10277 function MappingList() {
10278 this._array = [];
10279 this._sorted = true;
10280 // Serves as infimum
10281 this._last = {generatedLine: -1, generatedColumn: 0};
10282 }
10283
10284 /**
10285 * Iterate through internal items. This method takes the same arguments that
10286 * `Array.prototype.forEach` takes.
10287 *
10288 * NOTE: The order of the mappings is NOT guaranteed.
10289 */
10290 MappingList.prototype.unsortedForEach =
10291 function MappingList_forEach(aCallback, aThisArg) {
10292 this._array.forEach(aCallback, aThisArg);
10293 };
10294
10295 /**
10296 * Add the given source mapping.
10297 *
10298 * @param Object aMapping
10299 */
10300 MappingList.prototype.add = function MappingList_add(aMapping) {
10301 if (generatedPositionAfter(this._last, aMapping)) {
10302 this._last = aMapping;
10303 this._array.push(aMapping);
10304 } else {
10305 this._sorted = false;
10306 this._array.push(aMapping);
10307 }
10308 };
10309
10310 /**
10311 * Returns the flat, sorted array of mappings. The mappings are sorted by
10312 * generated position.
10313 *
10314 * WARNING: This method returns internal data without copying, for
10315 * performance. The return value must NOT be mutated, and should be treated as
10316 * an immutable borrow. If you want to take ownership, you must make your own
10317 * copy.
10318 */
10319 MappingList.prototype.toArray = function MappingList_toArray() {
10320 if (!this._sorted) {
10321 this._array.sort(util.compareByGeneratedPositionsInflated);
10322 this._sorted = true;
10323 }
10324 return this._array;
10325 };
10326
10327 var MappingList_1 = MappingList;
10328
10329 var mappingList = {
10330 MappingList: MappingList_1
10331 };
10332
10333 /* -*- Mode: js; js-indent-level: 2; -*- */
10334 /*
10335 * Copyright 2011 Mozilla Foundation and contributors
10336 * Licensed under the New BSD license. See LICENSE or:
10337 * http://opensource.org/licenses/BSD-3-Clause
10338 */
10339
10340
10341
10342 var ArraySet$1 = arraySet.ArraySet;
10343 var MappingList$1 = mappingList.MappingList;
10344
10345 /**
10346 * An instance of the SourceMapGenerator represents a source map which is
10347 * being built incrementally. You may pass an object with the following
10348 * properties:
10349 *
10350 * - file: The filename of the generated source.
10351 * - sourceRoot: A root for all relative URLs in this source map.
10352 */
10353 function SourceMapGenerator(aArgs) {
10354 if (!aArgs) {
10355 aArgs = {};
10356 }
10357 this._file = util.getArg(aArgs, 'file', null);
10358 this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
10359 this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
10360 this._sources = new ArraySet$1();
10361 this._names = new ArraySet$1();
10362 this._mappings = new MappingList$1();
10363 this._sourcesContents = null;
10364 }
10365
10366 SourceMapGenerator.prototype._version = 3;
10367
10368 /**
10369 * Creates a new SourceMapGenerator based on a SourceMapConsumer
10370 *
10371 * @param aSourceMapConsumer The SourceMap.
10372 */
10373 SourceMapGenerator.fromSourceMap =
10374 function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
10375 var sourceRoot = aSourceMapConsumer.sourceRoot;
10376 var generator = new SourceMapGenerator({
10377 file: aSourceMapConsumer.file,
10378 sourceRoot: sourceRoot
10379 });
10380 aSourceMapConsumer.eachMapping(function (mapping) {
10381 var newMapping = {
10382 generated: {
10383 line: mapping.generatedLine,
10384 column: mapping.generatedColumn
10385 }
10386 };
10387
10388 if (mapping.source != null) {
10389 newMapping.source = mapping.source;
10390 if (sourceRoot != null) {
10391 newMapping.source = util.relative(sourceRoot, newMapping.source);
10392 }
10393
10394 newMapping.original = {
10395 line: mapping.originalLine,
10396 column: mapping.originalColumn
10397 };
10398
10399 if (mapping.name != null) {
10400 newMapping.name = mapping.name;
10401 }
10402 }
10403
10404 generator.addMapping(newMapping);
10405 });
10406 aSourceMapConsumer.sources.forEach(function (sourceFile) {
10407 var content = aSourceMapConsumer.sourceContentFor(sourceFile);
10408 if (content != null) {
10409 generator.setSourceContent(sourceFile, content);
10410 }
10411 });
10412 return generator;
10413 };
10414
10415 /**
10416 * Add a single mapping from original source line and column to the generated
10417 * source's line and column for this source map being created. The mapping
10418 * object should have the following properties:
10419 *
10420 * - generated: An object with the generated line and column positions.
10421 * - original: An object with the original line and column positions.
10422 * - source: The original source file (relative to the sourceRoot).
10423 * - name: An optional original token name for this mapping.
10424 */
10425 SourceMapGenerator.prototype.addMapping =
10426 function SourceMapGenerator_addMapping(aArgs) {
10427 var generated = util.getArg(aArgs, 'generated');
10428 var original = util.getArg(aArgs, 'original', null);
10429 var source = util.getArg(aArgs, 'source', null);
10430 var name = util.getArg(aArgs, 'name', null);
10431
10432 if (!this._skipValidation) {
10433 this._validateMapping(generated, original, source, name);
10434 }
10435
10436 if (source != null) {
10437 source = String(source);
10438 if (!this._sources.has(source)) {
10439 this._sources.add(source);
10440 }
10441 }
10442
10443 if (name != null) {
10444 name = String(name);
10445 if (!this._names.has(name)) {
10446 this._names.add(name);
10447 }
10448 }
10449
10450 this._mappings.add({
10451 generatedLine: generated.line,
10452 generatedColumn: generated.column,
10453 originalLine: original != null && original.line,
10454 originalColumn: original != null && original.column,
10455 source: source,
10456 name: name
10457 });
10458 };
10459
10460 /**
10461 * Set the source content for a source file.
10462 */
10463 SourceMapGenerator.prototype.setSourceContent =
10464 function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
10465 var source = aSourceFile;
10466 if (this._sourceRoot != null) {
10467 source = util.relative(this._sourceRoot, source);
10468 }
10469
10470 if (aSourceContent != null) {
10471 // Add the source content to the _sourcesContents map.
10472 // Create a new _sourcesContents map if the property is null.
10473 if (!this._sourcesContents) {
10474 this._sourcesContents = Object.create(null);
10475 }
10476 this._sourcesContents[util.toSetString(source)] = aSourceContent;
10477 } else if (this._sourcesContents) {
10478 // Remove the source file from the _sourcesContents map.
10479 // If the _sourcesContents map is empty, set the property to null.
10480 delete this._sourcesContents[util.toSetString(source)];
10481 if (Object.keys(this._sourcesContents).length === 0) {
10482 this._sourcesContents = null;
10483 }
10484 }
10485 };
10486
10487 /**
10488 * Applies the mappings of a sub-source-map for a specific source file to the
10489 * source map being generated. Each mapping to the supplied source file is
10490 * rewritten using the supplied source map. Note: The resolution for the
10491 * resulting mappings is the minimium of this map and the supplied map.
10492 *
10493 * @param aSourceMapConsumer The source map to be applied.
10494 * @param aSourceFile Optional. The filename of the source file.
10495 * If omitted, SourceMapConsumer's file property will be used.
10496 * @param aSourceMapPath Optional. The dirname of the path to the source map
10497 * to be applied. If relative, it is relative to the SourceMapConsumer.
10498 * This parameter is needed when the two source maps aren't in the same
10499 * directory, and the source map to be applied contains relative source
10500 * paths. If so, those relative source paths need to be rewritten
10501 * relative to the SourceMapGenerator.
10502 */
10503 SourceMapGenerator.prototype.applySourceMap =
10504 function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
10505 var sourceFile = aSourceFile;
10506 // If aSourceFile is omitted, we will use the file property of the SourceMap
10507 if (aSourceFile == null) {
10508 if (aSourceMapConsumer.file == null) {
10509 throw new Error(
10510 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
10511 'or the source map\'s "file" property. Both were omitted.'
10512 );
10513 }
10514 sourceFile = aSourceMapConsumer.file;
10515 }
10516 var sourceRoot = this._sourceRoot;
10517 // Make "sourceFile" relative if an absolute Url is passed.
10518 if (sourceRoot != null) {
10519 sourceFile = util.relative(sourceRoot, sourceFile);
10520 }
10521 // Applying the SourceMap can add and remove items from the sources and
10522 // the names array.
10523 var newSources = new ArraySet$1();
10524 var newNames = new ArraySet$1();
10525
10526 // Find mappings for the "sourceFile"
10527 this._mappings.unsortedForEach(function (mapping) {
10528 if (mapping.source === sourceFile && mapping.originalLine != null) {
10529 // Check if it can be mapped by the source map, then update the mapping.
10530 var original = aSourceMapConsumer.originalPositionFor({
10531 line: mapping.originalLine,
10532 column: mapping.originalColumn
10533 });
10534 if (original.source != null) {
10535 // Copy mapping
10536 mapping.source = original.source;
10537 if (aSourceMapPath != null) {
10538 mapping.source = util.join(aSourceMapPath, mapping.source);
10539 }
10540 if (sourceRoot != null) {
10541 mapping.source = util.relative(sourceRoot, mapping.source);
10542 }
10543 mapping.originalLine = original.line;
10544 mapping.originalColumn = original.column;
10545 if (original.name != null) {
10546 mapping.name = original.name;
10547 }
10548 }
10549 }
10550
10551 var source = mapping.source;
10552 if (source != null && !newSources.has(source)) {
10553 newSources.add(source);
10554 }
10555
10556 var name = mapping.name;
10557 if (name != null && !newNames.has(name)) {
10558 newNames.add(name);
10559 }
10560
10561 }, this);
10562 this._sources = newSources;
10563 this._names = newNames;
10564
10565 // Copy sourcesContents of applied map.
10566 aSourceMapConsumer.sources.forEach(function (sourceFile) {
10567 var content = aSourceMapConsumer.sourceContentFor(sourceFile);
10568 if (content != null) {
10569 if (aSourceMapPath != null) {
10570 sourceFile = util.join(aSourceMapPath, sourceFile);
10571 }
10572 if (sourceRoot != null) {
10573 sourceFile = util.relative(sourceRoot, sourceFile);
10574 }
10575 this.setSourceContent(sourceFile, content);
10576 }
10577 }, this);
10578 };
10579
10580 /**
10581 * A mapping can have one of the three levels of data:
10582 *
10583 * 1. Just the generated position.
10584 * 2. The Generated position, original position, and original source.
10585 * 3. Generated and original position, original source, as well as a name
10586 * token.
10587 *
10588 * To maintain consistency, we validate that any new mapping being added falls
10589 * in to one of these categories.
10590 */
10591 SourceMapGenerator.prototype._validateMapping =
10592 function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
10593 aName) {
10594 // When aOriginal is truthy but has empty values for .line and .column,
10595 // it is most likely a programmer error. In this case we throw a very
10596 // specific error message to try to guide them the right way.
10597 // For example: https://github.com/Polymer/polymer-bundler/pull/519
10598 if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
10599 throw new Error(
10600 'original.line and original.column are not numbers -- you probably meant to omit ' +
10601 'the original mapping entirely and only map the generated position. If so, pass ' +
10602 'null for the original mapping instead of an object with empty or null values.'
10603 );
10604 }
10605
10606 if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
10607 && aGenerated.line > 0 && aGenerated.column >= 0
10608 && !aOriginal && !aSource && !aName) {
10609 // Case 1.
10610 return;
10611 }
10612 else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
10613 && aOriginal && 'line' in aOriginal && 'column' in aOriginal
10614 && aGenerated.line > 0 && aGenerated.column >= 0
10615 && aOriginal.line > 0 && aOriginal.column >= 0
10616 && aSource) {
10617 // Cases 2 and 3.
10618 return;
10619 }
10620 else {
10621 throw new Error('Invalid mapping: ' + JSON.stringify({
10622 generated: aGenerated,
10623 source: aSource,
10624 original: aOriginal,
10625 name: aName
10626 }));
10627 }
10628 };
10629
10630 /**
10631 * Serialize the accumulated mappings in to the stream of base 64 VLQs
10632 * specified by the source map format.
10633 */
10634 SourceMapGenerator.prototype._serializeMappings =
10635 function SourceMapGenerator_serializeMappings() {
10636 var previousGeneratedColumn = 0;
10637 var previousGeneratedLine = 1;
10638 var previousOriginalColumn = 0;
10639 var previousOriginalLine = 0;
10640 var previousName = 0;
10641 var previousSource = 0;
10642 var result = '';
10643 var next;
10644 var mapping;
10645 var nameIdx;
10646 var sourceIdx;
10647
10648 var mappings = this._mappings.toArray();
10649 for (var i = 0, len = mappings.length; i < len; i++) {
10650 mapping = mappings[i];
10651 next = '';
10652
10653 if (mapping.generatedLine !== previousGeneratedLine) {
10654 previousGeneratedColumn = 0;
10655 while (mapping.generatedLine !== previousGeneratedLine) {
10656 next += ';';
10657 previousGeneratedLine++;
10658 }
10659 }
10660 else {
10661 if (i > 0) {
10662 if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
10663 continue;
10664 }
10665 next += ',';
10666 }
10667 }
10668
10669 next += base64Vlq.encode(mapping.generatedColumn
10670 - previousGeneratedColumn);
10671 previousGeneratedColumn = mapping.generatedColumn;
10672
10673 if (mapping.source != null) {
10674 sourceIdx = this._sources.indexOf(mapping.source);
10675 next += base64Vlq.encode(sourceIdx - previousSource);
10676 previousSource = sourceIdx;
10677
10678 // lines are stored 0-based in SourceMap spec version 3
10679 next += base64Vlq.encode(mapping.originalLine - 1
10680 - previousOriginalLine);
10681 previousOriginalLine = mapping.originalLine - 1;
10682
10683 next += base64Vlq.encode(mapping.originalColumn
10684 - previousOriginalColumn);
10685 previousOriginalColumn = mapping.originalColumn;
10686
10687 if (mapping.name != null) {
10688 nameIdx = this._names.indexOf(mapping.name);
10689 next += base64Vlq.encode(nameIdx - previousName);
10690 previousName = nameIdx;
10691 }
10692 }
10693
10694 result += next;
10695 }
10696
10697 return result;
10698 };
10699
10700 SourceMapGenerator.prototype._generateSourcesContent =
10701 function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
10702 return aSources.map(function (source) {
10703 if (!this._sourcesContents) {
10704 return null;
10705 }
10706 if (aSourceRoot != null) {
10707 source = util.relative(aSourceRoot, source);
10708 }
10709 var key = util.toSetString(source);
10710 return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
10711 ? this._sourcesContents[key]
10712 : null;
10713 }, this);
10714 };
10715
10716 /**
10717 * Externalize the source map.
10718 */
10719 SourceMapGenerator.prototype.toJSON =
10720 function SourceMapGenerator_toJSON() {
10721 var map = {
10722 version: this._version,
10723 sources: this._sources.toArray(),
10724 names: this._names.toArray(),
10725 mappings: this._serializeMappings()
10726 };
10727 if (this._file != null) {
10728 map.file = this._file;
10729 }
10730 if (this._sourceRoot != null) {
10731 map.sourceRoot = this._sourceRoot;
10732 }
10733 if (this._sourcesContents) {
10734 map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
10735 }
10736
10737 return map;
10738 };
10739
10740 /**
10741 * Render the source map being generated to a string.
10742 */
10743 SourceMapGenerator.prototype.toString =
10744 function SourceMapGenerator_toString() {
10745 return JSON.stringify(this.toJSON());
10746 };
10747
10748 var SourceMapGenerator_1 = SourceMapGenerator;
10749
10750 var sourceMapGenerator = {
10751 SourceMapGenerator: SourceMapGenerator_1
10752 };
10753
10754 var binarySearch = createCommonjsModule(function (module, exports) {
10755 /* -*- Mode: js; js-indent-level: 2; -*- */
10756 /*
10757 * Copyright 2011 Mozilla Foundation and contributors
10758 * Licensed under the New BSD license. See LICENSE or:
10759 * http://opensource.org/licenses/BSD-3-Clause
10760 */
10761
10762 exports.GREATEST_LOWER_BOUND = 1;
10763 exports.LEAST_UPPER_BOUND = 2;
10764
10765 /**
10766 * Recursive implementation of binary search.
10767 *
10768 * @param aLow Indices here and lower do not contain the needle.
10769 * @param aHigh Indices here and higher do not contain the needle.
10770 * @param aNeedle The element being searched for.
10771 * @param aHaystack The non-empty array being searched.
10772 * @param aCompare Function which takes two elements and returns -1, 0, or 1.
10773 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
10774 * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
10775 * closest element that is smaller than or greater than the one we are
10776 * searching for, respectively, if the exact element cannot be found.
10777 */
10778 function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
10779 // This function terminates when one of the following is true:
10780 //
10781 // 1. We find the exact element we are looking for.
10782 //
10783 // 2. We did not find the exact element, but we can return the index of
10784 // the next-closest element.
10785 //
10786 // 3. We did not find the exact element, and there is no next-closest
10787 // element than the one we are searching for, so we return -1.
10788 var mid = Math.floor((aHigh - aLow) / 2) + aLow;
10789 var cmp = aCompare(aNeedle, aHaystack[mid], true);
10790 if (cmp === 0) {
10791 // Found the element we are looking for.
10792 return mid;
10793 }
10794 else if (cmp > 0) {
10795 // Our needle is greater than aHaystack[mid].
10796 if (aHigh - mid > 1) {
10797 // The element is in the upper half.
10798 return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
10799 }
10800
10801 // The exact needle element was not found in this haystack. Determine if
10802 // we are in termination case (3) or (2) and return the appropriate thing.
10803 if (aBias == exports.LEAST_UPPER_BOUND) {
10804 return aHigh < aHaystack.length ? aHigh : -1;
10805 } else {
10806 return mid;
10807 }
10808 }
10809 else {
10810 // Our needle is less than aHaystack[mid].
10811 if (mid - aLow > 1) {
10812 // The element is in the lower half.
10813 return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
10814 }
10815
10816 // we are in termination case (3) or (2) and return the appropriate thing.
10817 if (aBias == exports.LEAST_UPPER_BOUND) {
10818 return mid;
10819 } else {
10820 return aLow < 0 ? -1 : aLow;
10821 }
10822 }
10823 }
10824
10825 /**
10826 * This is an implementation of binary search which will always try and return
10827 * the index of the closest element if there is no exact hit. This is because
10828 * mappings between original and generated line/col pairs are single points,
10829 * and there is an implicit region between each of them, so a miss just means
10830 * that you aren't on the very start of a region.
10831 *
10832 * @param aNeedle The element you are looking for.
10833 * @param aHaystack The array that is being searched.
10834 * @param aCompare A function which takes the needle and an element in the
10835 * array and returns -1, 0, or 1 depending on whether the needle is less
10836 * than, equal to, or greater than the element, respectively.
10837 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
10838 * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
10839 * closest element that is smaller than or greater than the one we are
10840 * searching for, respectively, if the exact element cannot be found.
10841 * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
10842 */
10843 exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
10844 if (aHaystack.length === 0) {
10845 return -1;
10846 }
10847
10848 var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
10849 aCompare, aBias || exports.GREATEST_LOWER_BOUND);
10850 if (index < 0) {
10851 return -1;
10852 }
10853
10854 // We have found either the exact element, or the next-closest element than
10855 // the one we are searching for. However, there may be more than one such
10856 // element. Make sure we always return the smallest of these.
10857 while (index - 1 >= 0) {
10858 if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
10859 break;
10860 }
10861 --index;
10862 }
10863
10864 return index;
10865 };
10866 });
10867 var binarySearch_1 = binarySearch.GREATEST_LOWER_BOUND;
10868 var binarySearch_2 = binarySearch.LEAST_UPPER_BOUND;
10869 var binarySearch_3 = binarySearch.search;
10870
10871 /* -*- Mode: js; js-indent-level: 2; -*- */
10872 /*
10873 * Copyright 2011 Mozilla Foundation and contributors
10874 * Licensed under the New BSD license. See LICENSE or:
10875 * http://opensource.org/licenses/BSD-3-Clause
10876 */
10877
10878 // It turns out that some (most?) JavaScript engines don't self-host
10879 // `Array.prototype.sort`. This makes sense because C++ will likely remain
10880 // faster than JS when doing raw CPU-intensive sorting. However, when using a
10881 // custom comparator function, calling back and forth between the VM's C++ and
10882 // JIT'd JS is rather slow *and* loses JIT type information, resulting in
10883 // worse generated code for the comparator function than would be optimal. In
10884 // fact, when sorting with a comparator, these costs outweigh the benefits of
10885 // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
10886 // a ~3500ms mean speed-up in `bench/bench.html`.
10887
10888 /**
10889 * Swap the elements indexed by `x` and `y` in the array `ary`.
10890 *
10891 * @param {Array} ary
10892 * The array.
10893 * @param {Number} x
10894 * The index of the first item.
10895 * @param {Number} y
10896 * The index of the second item.
10897 */
10898 function swap(ary, x, y) {
10899 var temp = ary[x];
10900 ary[x] = ary[y];
10901 ary[y] = temp;
10902 }
10903
10904 /**
10905 * Returns a random integer within the range `low .. high` inclusive.
10906 *
10907 * @param {Number} low
10908 * The lower bound on the range.
10909 * @param {Number} high
10910 * The upper bound on the range.
10911 */
10912 function randomIntInRange(low, high) {
10913 return Math.round(low + (Math.random() * (high - low)));
10914 }
10915
10916 /**
10917 * The Quick Sort algorithm.
10918 *
10919 * @param {Array} ary
10920 * An array to sort.
10921 * @param {function} comparator
10922 * Function to use to compare two items.
10923 * @param {Number} p
10924 * Start index of the array
10925 * @param {Number} r
10926 * End index of the array
10927 */
10928 function doQuickSort(ary, comparator, p, r) {
10929 // If our lower bound is less than our upper bound, we (1) partition the
10930 // array into two pieces and (2) recurse on each half. If it is not, this is
10931 // the empty array and our base case.
10932
10933 if (p < r) {
10934 // (1) Partitioning.
10935 //
10936 // The partitioning chooses a pivot between `p` and `r` and moves all
10937 // elements that are less than or equal to the pivot to the before it, and
10938 // all the elements that are greater than it after it. The effect is that
10939 // once partition is done, the pivot is in the exact place it will be when
10940 // the array is put in sorted order, and it will not need to be moved
10941 // again. This runs in O(n) time.
10942
10943 // Always choose a random pivot so that an input array which is reverse
10944 // sorted does not cause O(n^2) running time.
10945 var pivotIndex = randomIntInRange(p, r);
10946 var i = p - 1;
10947
10948 swap(ary, pivotIndex, r);
10949 var pivot = ary[r];
10950
10951 // Immediately after `j` is incremented in this loop, the following hold
10952 // true:
10953 //
10954 // * Every element in `ary[p .. i]` is less than or equal to the pivot.
10955 //
10956 // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
10957 for (var j = p; j < r; j++) {
10958 if (comparator(ary[j], pivot) <= 0) {
10959 i += 1;
10960 swap(ary, i, j);
10961 }
10962 }
10963
10964 swap(ary, i + 1, j);
10965 var q = i + 1;
10966
10967 // (2) Recurse on each half.
10968
10969 doQuickSort(ary, comparator, p, q - 1);
10970 doQuickSort(ary, comparator, q + 1, r);
10971 }
10972 }
10973
10974 /**
10975 * Sort the given array in-place with the given comparator function.
10976 *
10977 * @param {Array} ary
10978 * An array to sort.
10979 * @param {function} comparator
10980 * Function to use to compare two items.
10981 */
10982 var quickSort_1 = function (ary, comparator) {
10983 doQuickSort(ary, comparator, 0, ary.length - 1);
10984 };
10985
10986 var quickSort = {
10987 quickSort: quickSort_1
10988 };
10989
10990 /* -*- Mode: js; js-indent-level: 2; -*- */
10991 /*
10992 * Copyright 2011 Mozilla Foundation and contributors
10993 * Licensed under the New BSD license. See LICENSE or:
10994 * http://opensource.org/licenses/BSD-3-Clause
10995 */
10996
10997
10998
10999 var ArraySet$2 = arraySet.ArraySet;
11000
11001 var quickSort$1 = quickSort.quickSort;
11002
11003 function SourceMapConsumer(aSourceMap) {
11004 var sourceMap = aSourceMap;
11005 if (typeof aSourceMap === 'string') {
11006 sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
11007 }
11008
11009 return sourceMap.sections != null
11010 ? new IndexedSourceMapConsumer(sourceMap)
11011 : new BasicSourceMapConsumer(sourceMap);
11012 }
11013
11014 SourceMapConsumer.fromSourceMap = function(aSourceMap) {
11015 return BasicSourceMapConsumer.fromSourceMap(aSourceMap);
11016 };
11017
11018 /**
11019 * The version of the source mapping spec that we are consuming.
11020 */
11021 SourceMapConsumer.prototype._version = 3;
11022
11023 // `__generatedMappings` and `__originalMappings` are arrays that hold the
11024 // parsed mapping coordinates from the source map's "mappings" attribute. They
11025 // are lazily instantiated, accessed via the `_generatedMappings` and
11026 // `_originalMappings` getters respectively, and we only parse the mappings
11027 // and create these arrays once queried for a source location. We jump through
11028 // these hoops because there can be many thousands of mappings, and parsing
11029 // them is expensive, so we only want to do it if we must.
11030 //
11031 // Each object in the arrays is of the form:
11032 //
11033 // {
11034 // generatedLine: The line number in the generated code,
11035 // generatedColumn: The column number in the generated code,
11036 // source: The path to the original source file that generated this
11037 // chunk of code,
11038 // originalLine: The line number in the original source that
11039 // corresponds to this chunk of generated code,
11040 // originalColumn: The column number in the original source that
11041 // corresponds to this chunk of generated code,
11042 // name: The name of the original symbol which generated this chunk of
11043 // code.
11044 // }
11045 //
11046 // All properties except for `generatedLine` and `generatedColumn` can be
11047 // `null`.
11048 //
11049 // `_generatedMappings` is ordered by the generated positions.
11050 //
11051 // `_originalMappings` is ordered by the original positions.
11052
11053 SourceMapConsumer.prototype.__generatedMappings = null;
11054 Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
11055 get: function () {
11056 if (!this.__generatedMappings) {
11057 this._parseMappings(this._mappings, this.sourceRoot);
11058 }
11059
11060 return this.__generatedMappings;
11061 }
11062 });
11063
11064 SourceMapConsumer.prototype.__originalMappings = null;
11065 Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
11066 get: function () {
11067 if (!this.__originalMappings) {
11068 this._parseMappings(this._mappings, this.sourceRoot);
11069 }
11070
11071 return this.__originalMappings;
11072 }
11073 });
11074
11075 SourceMapConsumer.prototype._charIsMappingSeparator =
11076 function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
11077 var c = aStr.charAt(index);
11078 return c === ";" || c === ",";
11079 };
11080
11081 /**
11082 * Parse the mappings in a string in to a data structure which we can easily
11083 * query (the ordered arrays in the `this.__generatedMappings` and
11084 * `this.__originalMappings` properties).
11085 */
11086 SourceMapConsumer.prototype._parseMappings =
11087 function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
11088 throw new Error("Subclasses must implement _parseMappings");
11089 };
11090
11091 SourceMapConsumer.GENERATED_ORDER = 1;
11092 SourceMapConsumer.ORIGINAL_ORDER = 2;
11093
11094 SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
11095 SourceMapConsumer.LEAST_UPPER_BOUND = 2;
11096
11097 /**
11098 * Iterate over each mapping between an original source/line/column and a
11099 * generated line/column in this source map.
11100 *
11101 * @param Function aCallback
11102 * The function that is called with each mapping.
11103 * @param Object aContext
11104 * Optional. If specified, this object will be the value of `this` every
11105 * time that `aCallback` is called.
11106 * @param aOrder
11107 * Either `SourceMapConsumer.GENERATED_ORDER` or
11108 * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
11109 * iterate over the mappings sorted by the generated file's line/column
11110 * order or the original's source/line/column order, respectively. Defaults to
11111 * `SourceMapConsumer.GENERATED_ORDER`.
11112 */
11113 SourceMapConsumer.prototype.eachMapping =
11114 function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
11115 var context = aContext || null;
11116 var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
11117
11118 var mappings;
11119 switch (order) {
11120 case SourceMapConsumer.GENERATED_ORDER:
11121 mappings = this._generatedMappings;
11122 break;
11123 case SourceMapConsumer.ORIGINAL_ORDER:
11124 mappings = this._originalMappings;
11125 break;
11126 default:
11127 throw new Error("Unknown order of iteration.");
11128 }
11129
11130 var sourceRoot = this.sourceRoot;
11131 mappings.map(function (mapping) {
11132 var source = mapping.source === null ? null : this._sources.at(mapping.source);
11133 if (source != null && sourceRoot != null) {
11134 source = util.join(sourceRoot, source);
11135 }
11136 return {
11137 source: source,
11138 generatedLine: mapping.generatedLine,
11139 generatedColumn: mapping.generatedColumn,
11140 originalLine: mapping.originalLine,
11141 originalColumn: mapping.originalColumn,
11142 name: mapping.name === null ? null : this._names.at(mapping.name)
11143 };
11144 }, this).forEach(aCallback, context);
11145 };
11146
11147 /**
11148 * Returns all generated line and column information for the original source,
11149 * line, and column provided. If no column is provided, returns all mappings
11150 * corresponding to a either the line we are searching for or the next
11151 * closest line that has any mappings. Otherwise, returns all mappings
11152 * corresponding to the given line and either the column we are searching for
11153 * or the next closest column that has any offsets.
11154 *
11155 * The only argument is an object with the following properties:
11156 *
11157 * - source: The filename of the original source.
11158 * - line: The line number in the original source.
11159 * - column: Optional. the column number in the original source.
11160 *
11161 * and an array of objects is returned, each with the following properties:
11162 *
11163 * - line: The line number in the generated source, or null.
11164 * - column: The column number in the generated source, or null.
11165 */
11166 SourceMapConsumer.prototype.allGeneratedPositionsFor =
11167 function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
11168 var line = util.getArg(aArgs, 'line');
11169
11170 // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
11171 // returns the index of the closest mapping less than the needle. By
11172 // setting needle.originalColumn to 0, we thus find the last mapping for
11173 // the given line, provided such a mapping exists.
11174 var needle = {
11175 source: util.getArg(aArgs, 'source'),
11176 originalLine: line,
11177 originalColumn: util.getArg(aArgs, 'column', 0)
11178 };
11179
11180 if (this.sourceRoot != null) {
11181 needle.source = util.relative(this.sourceRoot, needle.source);
11182 }
11183 if (!this._sources.has(needle.source)) {
11184 return [];
11185 }
11186 needle.source = this._sources.indexOf(needle.source);
11187
11188 var mappings = [];
11189
11190 var index = this._findMapping(needle,
11191 this._originalMappings,
11192 "originalLine",
11193 "originalColumn",
11194 util.compareByOriginalPositions,
11195 binarySearch.LEAST_UPPER_BOUND);
11196 if (index >= 0) {
11197 var mapping = this._originalMappings[index];
11198
11199 if (aArgs.column === undefined) {
11200 var originalLine = mapping.originalLine;
11201
11202 // Iterate until either we run out of mappings, or we run into
11203 // a mapping for a different line than the one we found. Since
11204 // mappings are sorted, this is guaranteed to find all mappings for
11205 // the line we found.
11206 while (mapping && mapping.originalLine === originalLine) {
11207 mappings.push({
11208 line: util.getArg(mapping, 'generatedLine', null),
11209 column: util.getArg(mapping, 'generatedColumn', null),
11210 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
11211 });
11212
11213 mapping = this._originalMappings[++index];
11214 }
11215 } else {
11216 var originalColumn = mapping.originalColumn;
11217
11218 // Iterate until either we run out of mappings, or we run into
11219 // a mapping for a different line than the one we were searching for.
11220 // Since mappings are sorted, this is guaranteed to find all mappings for
11221 // the line we are searching for.
11222 while (mapping &&
11223 mapping.originalLine === line &&
11224 mapping.originalColumn == originalColumn) {
11225 mappings.push({
11226 line: util.getArg(mapping, 'generatedLine', null),
11227 column: util.getArg(mapping, 'generatedColumn', null),
11228 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
11229 });
11230
11231 mapping = this._originalMappings[++index];
11232 }
11233 }
11234 }
11235
11236 return mappings;
11237 };
11238
11239 var SourceMapConsumer_1 = SourceMapConsumer;
11240
11241 /**
11242 * A BasicSourceMapConsumer instance represents a parsed source map which we can
11243 * query for information about the original file positions by giving it a file
11244 * position in the generated source.
11245 *
11246 * The only parameter is the raw source map (either as a JSON string, or
11247 * already parsed to an object). According to the spec, source maps have the
11248 * following attributes:
11249 *
11250 * - version: Which version of the source map spec this map is following.
11251 * - sources: An array of URLs to the original source files.
11252 * - names: An array of identifiers which can be referrenced by individual mappings.
11253 * - sourceRoot: Optional. The URL root from which all sources are relative.
11254 * - sourcesContent: Optional. An array of contents of the original source files.
11255 * - mappings: A string of base64 VLQs which contain the actual mappings.
11256 * - file: Optional. The generated file this source map is associated with.
11257 *
11258 * Here is an example source map, taken from the source map spec[0]:
11259 *
11260 * {
11261 * version : 3,
11262 * file: "out.js",
11263 * sourceRoot : "",
11264 * sources: ["foo.js", "bar.js"],
11265 * names: ["src", "maps", "are", "fun"],
11266 * mappings: "AA,AB;;ABCDE;"
11267 * }
11268 *
11269 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
11270 */
11271 function BasicSourceMapConsumer(aSourceMap) {
11272 var sourceMap = aSourceMap;
11273 if (typeof aSourceMap === 'string') {
11274 sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
11275 }
11276
11277 var version = util.getArg(sourceMap, 'version');
11278 var sources = util.getArg(sourceMap, 'sources');
11279 // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
11280 // requires the array) to play nice here.
11281 var names = util.getArg(sourceMap, 'names', []);
11282 var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
11283 var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
11284 var mappings = util.getArg(sourceMap, 'mappings');
11285 var file = util.getArg(sourceMap, 'file', null);
11286
11287 // Once again, Sass deviates from the spec and supplies the version as a
11288 // string rather than a number, so we use loose equality checking here.
11289 if (version != this._version) {
11290 throw new Error('Unsupported version: ' + version);
11291 }
11292
11293 sources = sources
11294 .map(String)
11295 // Some source maps produce relative source paths like "./foo.js" instead of
11296 // "foo.js". Normalize these first so that future comparisons will succeed.
11297 // See bugzil.la/1090768.
11298 .map(util.normalize)
11299 // Always ensure that absolute sources are internally stored relative to
11300 // the source root, if the source root is absolute. Not doing this would
11301 // be particularly problematic when the source root is a prefix of the
11302 // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
11303 .map(function (source) {
11304 return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
11305 ? util.relative(sourceRoot, source)
11306 : source;
11307 });
11308
11309 // Pass `true` below to allow duplicate names and sources. While source maps
11310 // are intended to be compressed and deduplicated, the TypeScript compiler
11311 // sometimes generates source maps with duplicates in them. See Github issue
11312 // #72 and bugzil.la/889492.
11313 this._names = ArraySet$2.fromArray(names.map(String), true);
11314 this._sources = ArraySet$2.fromArray(sources, true);
11315
11316 this.sourceRoot = sourceRoot;
11317 this.sourcesContent = sourcesContent;
11318 this._mappings = mappings;
11319 this.file = file;
11320 }
11321
11322 BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
11323 BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
11324
11325 /**
11326 * Create a BasicSourceMapConsumer from a SourceMapGenerator.
11327 *
11328 * @param SourceMapGenerator aSourceMap
11329 * The source map that will be consumed.
11330 * @returns BasicSourceMapConsumer
11331 */
11332 BasicSourceMapConsumer.fromSourceMap =
11333 function SourceMapConsumer_fromSourceMap(aSourceMap) {
11334 var smc = Object.create(BasicSourceMapConsumer.prototype);
11335
11336 var names = smc._names = ArraySet$2.fromArray(aSourceMap._names.toArray(), true);
11337 var sources = smc._sources = ArraySet$2.fromArray(aSourceMap._sources.toArray(), true);
11338 smc.sourceRoot = aSourceMap._sourceRoot;
11339 smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
11340 smc.sourceRoot);
11341 smc.file = aSourceMap._file;
11342
11343 // Because we are modifying the entries (by converting string sources and
11344 // names to indices into the sources and names ArraySets), we have to make
11345 // a copy of the entry or else bad things happen. Shared mutable state
11346 // strikes again! See github issue #191.
11347
11348 var generatedMappings = aSourceMap._mappings.toArray().slice();
11349 var destGeneratedMappings = smc.__generatedMappings = [];
11350 var destOriginalMappings = smc.__originalMappings = [];
11351
11352 for (var i = 0, length = generatedMappings.length; i < length; i++) {
11353 var srcMapping = generatedMappings[i];
11354 var destMapping = new Mapping;
11355 destMapping.generatedLine = srcMapping.generatedLine;
11356 destMapping.generatedColumn = srcMapping.generatedColumn;
11357
11358 if (srcMapping.source) {
11359 destMapping.source = sources.indexOf(srcMapping.source);
11360 destMapping.originalLine = srcMapping.originalLine;
11361 destMapping.originalColumn = srcMapping.originalColumn;
11362
11363 if (srcMapping.name) {
11364 destMapping.name = names.indexOf(srcMapping.name);
11365 }
11366
11367 destOriginalMappings.push(destMapping);
11368 }
11369
11370 destGeneratedMappings.push(destMapping);
11371 }
11372
11373 quickSort$1(smc.__originalMappings, util.compareByOriginalPositions);
11374
11375 return smc;
11376 };
11377
11378 /**
11379 * The version of the source mapping spec that we are consuming.
11380 */
11381 BasicSourceMapConsumer.prototype._version = 3;
11382
11383 /**
11384 * The list of original sources.
11385 */
11386 Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
11387 get: function () {
11388 return this._sources.toArray().map(function (s) {
11389 return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;
11390 }, this);
11391 }
11392 });
11393
11394 /**
11395 * Provide the JIT with a nice shape / hidden class.
11396 */
11397 function Mapping() {
11398 this.generatedLine = 0;
11399 this.generatedColumn = 0;
11400 this.source = null;
11401 this.originalLine = null;
11402 this.originalColumn = null;
11403 this.name = null;
11404 }
11405
11406 /**
11407 * Parse the mappings in a string in to a data structure which we can easily
11408 * query (the ordered arrays in the `this.__generatedMappings` and
11409 * `this.__originalMappings` properties).
11410 */
11411 BasicSourceMapConsumer.prototype._parseMappings =
11412 function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
11413 var generatedLine = 1;
11414 var previousGeneratedColumn = 0;
11415 var previousOriginalLine = 0;
11416 var previousOriginalColumn = 0;
11417 var previousSource = 0;
11418 var previousName = 0;
11419 var length = aStr.length;
11420 var index = 0;
11421 var cachedSegments = {};
11422 var temp = {};
11423 var originalMappings = [];
11424 var generatedMappings = [];
11425 var mapping, str, segment, end, value;
11426
11427 while (index < length) {
11428 if (aStr.charAt(index) === ';') {
11429 generatedLine++;
11430 index++;
11431 previousGeneratedColumn = 0;
11432 }
11433 else if (aStr.charAt(index) === ',') {
11434 index++;
11435 }
11436 else {
11437 mapping = new Mapping();
11438 mapping.generatedLine = generatedLine;
11439
11440 // Because each offset is encoded relative to the previous one,
11441 // many segments often have the same encoding. We can exploit this
11442 // fact by caching the parsed variable length fields of each segment,
11443 // allowing us to avoid a second parse if we encounter the same
11444 // segment again.
11445 for (end = index; end < length; end++) {
11446 if (this._charIsMappingSeparator(aStr, end)) {
11447 break;
11448 }
11449 }
11450 str = aStr.slice(index, end);
11451
11452 segment = cachedSegments[str];
11453 if (segment) {
11454 index += str.length;
11455 } else {
11456 segment = [];
11457 while (index < end) {
11458 base64Vlq.decode(aStr, index, temp);
11459 value = temp.value;
11460 index = temp.rest;
11461 segment.push(value);
11462 }
11463
11464 if (segment.length === 2) {
11465 throw new Error('Found a source, but no line and column');
11466 }
11467
11468 if (segment.length === 3) {
11469 throw new Error('Found a source and line, but no column');
11470 }
11471
11472 cachedSegments[str] = segment;
11473 }
11474
11475 // Generated column.
11476 mapping.generatedColumn = previousGeneratedColumn + segment[0];
11477 previousGeneratedColumn = mapping.generatedColumn;
11478
11479 if (segment.length > 1) {
11480 // Original source.
11481 mapping.source = previousSource + segment[1];
11482 previousSource += segment[1];
11483
11484 // Original line.
11485 mapping.originalLine = previousOriginalLine + segment[2];
11486 previousOriginalLine = mapping.originalLine;
11487 // Lines are stored 0-based
11488 mapping.originalLine += 1;
11489
11490 // Original column.
11491 mapping.originalColumn = previousOriginalColumn + segment[3];
11492 previousOriginalColumn = mapping.originalColumn;
11493
11494 if (segment.length > 4) {
11495 // Original name.
11496 mapping.name = previousName + segment[4];
11497 previousName += segment[4];
11498 }
11499 }
11500
11501 generatedMappings.push(mapping);
11502 if (typeof mapping.originalLine === 'number') {
11503 originalMappings.push(mapping);
11504 }
11505 }
11506 }
11507
11508 quickSort$1(generatedMappings, util.compareByGeneratedPositionsDeflated);
11509 this.__generatedMappings = generatedMappings;
11510
11511 quickSort$1(originalMappings, util.compareByOriginalPositions);
11512 this.__originalMappings = originalMappings;
11513 };
11514
11515 /**
11516 * Find the mapping that best matches the hypothetical "needle" mapping that
11517 * we are searching for in the given "haystack" of mappings.
11518 */
11519 BasicSourceMapConsumer.prototype._findMapping =
11520 function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
11521 aColumnName, aComparator, aBias) {
11522 // To return the position we are searching for, we must first find the
11523 // mapping for the given position and then return the opposite position it
11524 // points to. Because the mappings are sorted, we can use binary search to
11525 // find the best mapping.
11526
11527 if (aNeedle[aLineName] <= 0) {
11528 throw new TypeError('Line must be greater than or equal to 1, got '
11529 + aNeedle[aLineName]);
11530 }
11531 if (aNeedle[aColumnName] < 0) {
11532 throw new TypeError('Column must be greater than or equal to 0, got '
11533 + aNeedle[aColumnName]);
11534 }
11535
11536 return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
11537 };
11538
11539 /**
11540 * Compute the last column for each generated mapping. The last column is
11541 * inclusive.
11542 */
11543 BasicSourceMapConsumer.prototype.computeColumnSpans =
11544 function SourceMapConsumer_computeColumnSpans() {
11545 for (var index = 0; index < this._generatedMappings.length; ++index) {
11546 var mapping = this._generatedMappings[index];
11547
11548 // Mappings do not contain a field for the last generated columnt. We
11549 // can come up with an optimistic estimate, however, by assuming that
11550 // mappings are contiguous (i.e. given two consecutive mappings, the
11551 // first mapping ends where the second one starts).
11552 if (index + 1 < this._generatedMappings.length) {
11553 var nextMapping = this._generatedMappings[index + 1];
11554
11555 if (mapping.generatedLine === nextMapping.generatedLine) {
11556 mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
11557 continue;
11558 }
11559 }
11560
11561 // The last mapping for each line spans the entire line.
11562 mapping.lastGeneratedColumn = Infinity;
11563 }
11564 };
11565
11566 /**
11567 * Returns the original source, line, and column information for the generated
11568 * source's line and column positions provided. The only argument is an object
11569 * with the following properties:
11570 *
11571 * - line: The line number in the generated source.
11572 * - column: The column number in the generated source.
11573 * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
11574 * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
11575 * closest element that is smaller than or greater than the one we are
11576 * searching for, respectively, if the exact element cannot be found.
11577 * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
11578 *
11579 * and an object is returned with the following properties:
11580 *
11581 * - source: The original source file, or null.
11582 * - line: The line number in the original source, or null.
11583 * - column: The column number in the original source, or null.
11584 * - name: The original identifier, or null.
11585 */
11586 BasicSourceMapConsumer.prototype.originalPositionFor =
11587 function SourceMapConsumer_originalPositionFor(aArgs) {
11588 var needle = {
11589 generatedLine: util.getArg(aArgs, 'line'),
11590 generatedColumn: util.getArg(aArgs, 'column')
11591 };
11592
11593 var index = this._findMapping(
11594 needle,
11595 this._generatedMappings,
11596 "generatedLine",
11597 "generatedColumn",
11598 util.compareByGeneratedPositionsDeflated,
11599 util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
11600 );
11601
11602 if (index >= 0) {
11603 var mapping = this._generatedMappings[index];
11604
11605 if (mapping.generatedLine === needle.generatedLine) {
11606 var source = util.getArg(mapping, 'source', null);
11607 if (source !== null) {
11608 source = this._sources.at(source);
11609 if (this.sourceRoot != null) {
11610 source = util.join(this.sourceRoot, source);
11611 }
11612 }
11613 var name = util.getArg(mapping, 'name', null);
11614 if (name !== null) {
11615 name = this._names.at(name);
11616 }
11617 return {
11618 source: source,
11619 line: util.getArg(mapping, 'originalLine', null),
11620 column: util.getArg(mapping, 'originalColumn', null),
11621 name: name
11622 };
11623 }
11624 }
11625
11626 return {
11627 source: null,
11628 line: null,
11629 column: null,
11630 name: null
11631 };
11632 };
11633
11634 /**
11635 * Return true if we have the source content for every source in the source
11636 * map, false otherwise.
11637 */
11638 BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
11639 function BasicSourceMapConsumer_hasContentsOfAllSources() {
11640 if (!this.sourcesContent) {
11641 return false;
11642 }
11643 return this.sourcesContent.length >= this._sources.size() &&
11644 !this.sourcesContent.some(function (sc) { return sc == null; });
11645 };
11646
11647 /**
11648 * Returns the original source content. The only argument is the url of the
11649 * original source file. Returns null if no original source content is
11650 * available.
11651 */
11652 BasicSourceMapConsumer.prototype.sourceContentFor =
11653 function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
11654 if (!this.sourcesContent) {
11655 return null;
11656 }
11657
11658 if (this.sourceRoot != null) {
11659 aSource = util.relative(this.sourceRoot, aSource);
11660 }
11661
11662 if (this._sources.has(aSource)) {
11663 return this.sourcesContent[this._sources.indexOf(aSource)];
11664 }
11665
11666 var url;
11667 if (this.sourceRoot != null
11668 && (url = util.urlParse(this.sourceRoot))) {
11669 // XXX: file:// URIs and absolute paths lead to unexpected behavior for
11670 // many users. We can help them out when they expect file:// URIs to
11671 // behave like it would if they were running a local HTTP server. See
11672 // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
11673 var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
11674 if (url.scheme == "file"
11675 && this._sources.has(fileUriAbsPath)) {
11676 return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
11677 }
11678
11679 if ((!url.path || url.path == "/")
11680 && this._sources.has("/" + aSource)) {
11681 return this.sourcesContent[this._sources.indexOf("/" + aSource)];
11682 }
11683 }
11684
11685 // This function is used recursively from
11686 // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
11687 // don't want to throw if we can't find the source - we just want to
11688 // return null, so we provide a flag to exit gracefully.
11689 if (nullOnMissing) {
11690 return null;
11691 }
11692 else {
11693 throw new Error('"' + aSource + '" is not in the SourceMap.');
11694 }
11695 };
11696
11697 /**
11698 * Returns the generated line and column information for the original source,
11699 * line, and column positions provided. The only argument is an object with
11700 * the following properties:
11701 *
11702 * - source: The filename of the original source.
11703 * - line: The line number in the original source.
11704 * - column: The column number in the original source.
11705 * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
11706 * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
11707 * closest element that is smaller than or greater than the one we are
11708 * searching for, respectively, if the exact element cannot be found.
11709 * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
11710 *
11711 * and an object is returned with the following properties:
11712 *
11713 * - line: The line number in the generated source, or null.
11714 * - column: The column number in the generated source, or null.
11715 */
11716 BasicSourceMapConsumer.prototype.generatedPositionFor =
11717 function SourceMapConsumer_generatedPositionFor(aArgs) {
11718 var source = util.getArg(aArgs, 'source');
11719 if (this.sourceRoot != null) {
11720 source = util.relative(this.sourceRoot, source);
11721 }
11722 if (!this._sources.has(source)) {
11723 return {
11724 line: null,
11725 column: null,
11726 lastColumn: null
11727 };
11728 }
11729 source = this._sources.indexOf(source);
11730
11731 var needle = {
11732 source: source,
11733 originalLine: util.getArg(aArgs, 'line'),
11734 originalColumn: util.getArg(aArgs, 'column')
11735 };
11736
11737 var index = this._findMapping(
11738 needle,
11739 this._originalMappings,
11740 "originalLine",
11741 "originalColumn",
11742 util.compareByOriginalPositions,
11743 util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
11744 );
11745
11746 if (index >= 0) {
11747 var mapping = this._originalMappings[index];
11748
11749 if (mapping.source === needle.source) {
11750 return {
11751 line: util.getArg(mapping, 'generatedLine', null),
11752 column: util.getArg(mapping, 'generatedColumn', null),
11753 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
11754 };
11755 }
11756 }
11757
11758 return {
11759 line: null,
11760 column: null,
11761 lastColumn: null
11762 };
11763 };
11764
11765 var BasicSourceMapConsumer_1 = BasicSourceMapConsumer;
11766
11767 /**
11768 * An IndexedSourceMapConsumer instance represents a parsed source map which
11769 * we can query for information. It differs from BasicSourceMapConsumer in
11770 * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
11771 * input.
11772 *
11773 * The only parameter is a raw source map (either as a JSON string, or already
11774 * parsed to an object). According to the spec for indexed source maps, they
11775 * have the following attributes:
11776 *
11777 * - version: Which version of the source map spec this map is following.
11778 * - file: Optional. The generated file this source map is associated with.
11779 * - sections: A list of section definitions.
11780 *
11781 * Each value under the "sections" field has two fields:
11782 * - offset: The offset into the original specified at which this section
11783 * begins to apply, defined as an object with a "line" and "column"
11784 * field.
11785 * - map: A source map definition. This source map could also be indexed,
11786 * but doesn't have to be.
11787 *
11788 * Instead of the "map" field, it's also possible to have a "url" field
11789 * specifying a URL to retrieve a source map from, but that's currently
11790 * unsupported.
11791 *
11792 * Here's an example source map, taken from the source map spec[0], but
11793 * modified to omit a section which uses the "url" field.
11794 *
11795 * {
11796 * version : 3,
11797 * file: "app.js",
11798 * sections: [{
11799 * offset: {line:100, column:10},
11800 * map: {
11801 * version : 3,
11802 * file: "section.js",
11803 * sources: ["foo.js", "bar.js"],
11804 * names: ["src", "maps", "are", "fun"],
11805 * mappings: "AAAA,E;;ABCDE;"
11806 * }
11807 * }],
11808 * }
11809 *
11810 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
11811 */
11812 function IndexedSourceMapConsumer(aSourceMap) {
11813 var sourceMap = aSourceMap;
11814 if (typeof aSourceMap === 'string') {
11815 sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
11816 }
11817
11818 var version = util.getArg(sourceMap, 'version');
11819 var sections = util.getArg(sourceMap, 'sections');
11820
11821 if (version != this._version) {
11822 throw new Error('Unsupported version: ' + version);
11823 }
11824
11825 this._sources = new ArraySet$2();
11826 this._names = new ArraySet$2();
11827
11828 var lastOffset = {
11829 line: -1,
11830 column: 0
11831 };
11832 this._sections = sections.map(function (s) {
11833 if (s.url) {
11834 // The url field will require support for asynchronicity.
11835 // See https://github.com/mozilla/source-map/issues/16
11836 throw new Error('Support for url field in sections not implemented.');
11837 }
11838 var offset = util.getArg(s, 'offset');
11839 var offsetLine = util.getArg(offset, 'line');
11840 var offsetColumn = util.getArg(offset, 'column');
11841
11842 if (offsetLine < lastOffset.line ||
11843 (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
11844 throw new Error('Section offsets must be ordered and non-overlapping.');
11845 }
11846 lastOffset = offset;
11847
11848 return {
11849 generatedOffset: {
11850 // The offset fields are 0-based, but we use 1-based indices when
11851 // encoding/decoding from VLQ.
11852 generatedLine: offsetLine + 1,
11853 generatedColumn: offsetColumn + 1
11854 },
11855 consumer: new SourceMapConsumer(util.getArg(s, 'map'))
11856 }
11857 });
11858 }
11859
11860 IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
11861 IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
11862
11863 /**
11864 * The version of the source mapping spec that we are consuming.
11865 */
11866 IndexedSourceMapConsumer.prototype._version = 3;
11867
11868 /**
11869 * The list of original sources.
11870 */
11871 Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
11872 get: function () {
11873 var sources = [];
11874 for (var i = 0; i < this._sections.length; i++) {
11875 for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
11876 sources.push(this._sections[i].consumer.sources[j]);
11877 }
11878 }
11879 return sources;
11880 }
11881 });
11882
11883 /**
11884 * Returns the original source, line, and column information for the generated
11885 * source's line and column positions provided. The only argument is an object
11886 * with the following properties:
11887 *
11888 * - line: The line number in the generated source.
11889 * - column: The column number in the generated source.
11890 *
11891 * and an object is returned with the following properties:
11892 *
11893 * - source: The original source file, or null.
11894 * - line: The line number in the original source, or null.
11895 * - column: The column number in the original source, or null.
11896 * - name: The original identifier, or null.
11897 */
11898 IndexedSourceMapConsumer.prototype.originalPositionFor =
11899 function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
11900 var needle = {
11901 generatedLine: util.getArg(aArgs, 'line'),
11902 generatedColumn: util.getArg(aArgs, 'column')
11903 };
11904
11905 // Find the section containing the generated position we're trying to map
11906 // to an original position.
11907 var sectionIndex = binarySearch.search(needle, this._sections,
11908 function(needle, section) {
11909 var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
11910 if (cmp) {
11911 return cmp;
11912 }
11913
11914 return (needle.generatedColumn -
11915 section.generatedOffset.generatedColumn);
11916 });
11917 var section = this._sections[sectionIndex];
11918
11919 if (!section) {
11920 return {
11921 source: null,
11922 line: null,
11923 column: null,
11924 name: null
11925 };
11926 }
11927
11928 return section.consumer.originalPositionFor({
11929 line: needle.generatedLine -
11930 (section.generatedOffset.generatedLine - 1),
11931 column: needle.generatedColumn -
11932 (section.generatedOffset.generatedLine === needle.generatedLine
11933 ? section.generatedOffset.generatedColumn - 1
11934 : 0),
11935 bias: aArgs.bias
11936 });
11937 };
11938
11939 /**
11940 * Return true if we have the source content for every source in the source
11941 * map, false otherwise.
11942 */
11943 IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
11944 function IndexedSourceMapConsumer_hasContentsOfAllSources() {
11945 return this._sections.every(function (s) {
11946 return s.consumer.hasContentsOfAllSources();
11947 });
11948 };
11949
11950 /**
11951 * Returns the original source content. The only argument is the url of the
11952 * original source file. Returns null if no original source content is
11953 * available.
11954 */
11955 IndexedSourceMapConsumer.prototype.sourceContentFor =
11956 function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
11957 for (var i = 0; i < this._sections.length; i++) {
11958 var section = this._sections[i];
11959
11960 var content = section.consumer.sourceContentFor(aSource, true);
11961 if (content) {
11962 return content;
11963 }
11964 }
11965 if (nullOnMissing) {
11966 return null;
11967 }
11968 else {
11969 throw new Error('"' + aSource + '" is not in the SourceMap.');
11970 }
11971 };
11972
11973 /**
11974 * Returns the generated line and column information for the original source,
11975 * line, and column positions provided. The only argument is an object with
11976 * the following properties:
11977 *
11978 * - source: The filename of the original source.
11979 * - line: The line number in the original source.
11980 * - column: The column number in the original source.
11981 *
11982 * and an object is returned with the following properties:
11983 *
11984 * - line: The line number in the generated source, or null.
11985 * - column: The column number in the generated source, or null.
11986 */
11987 IndexedSourceMapConsumer.prototype.generatedPositionFor =
11988 function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
11989 for (var i = 0; i < this._sections.length; i++) {
11990 var section = this._sections[i];
11991
11992 // Only consider this section if the requested source is in the list of
11993 // sources of the consumer.
11994 if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {
11995 continue;
11996 }
11997 var generatedPosition = section.consumer.generatedPositionFor(aArgs);
11998 if (generatedPosition) {
11999 var ret = {
12000 line: generatedPosition.line +
12001 (section.generatedOffset.generatedLine - 1),
12002 column: generatedPosition.column +
12003 (section.generatedOffset.generatedLine === generatedPosition.line
12004 ? section.generatedOffset.generatedColumn - 1
12005 : 0)
12006 };
12007 return ret;
12008 }
12009 }
12010
12011 return {
12012 line: null,
12013 column: null
12014 };
12015 };
12016
12017 /**
12018 * Parse the mappings in a string in to a data structure which we can easily
12019 * query (the ordered arrays in the `this.__generatedMappings` and
12020 * `this.__originalMappings` properties).
12021 */
12022 IndexedSourceMapConsumer.prototype._parseMappings =
12023 function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
12024 this.__generatedMappings = [];
12025 this.__originalMappings = [];
12026 for (var i = 0; i < this._sections.length; i++) {
12027 var section = this._sections[i];
12028 var sectionMappings = section.consumer._generatedMappings;
12029 for (var j = 0; j < sectionMappings.length; j++) {
12030 var mapping = sectionMappings[j];
12031
12032 var source = section.consumer._sources.at(mapping.source);
12033 if (section.consumer.sourceRoot !== null) {
12034 source = util.join(section.consumer.sourceRoot, source);
12035 }
12036 this._sources.add(source);
12037 source = this._sources.indexOf(source);
12038
12039 var name = section.consumer._names.at(mapping.name);
12040 this._names.add(name);
12041 name = this._names.indexOf(name);
12042
12043 // The mappings coming from the consumer for the section have
12044 // generated positions relative to the start of the section, so we
12045 // need to offset them to be relative to the start of the concatenated
12046 // generated file.
12047 var adjustedMapping = {
12048 source: source,
12049 generatedLine: mapping.generatedLine +
12050 (section.generatedOffset.generatedLine - 1),
12051 generatedColumn: mapping.generatedColumn +
12052 (section.generatedOffset.generatedLine === mapping.generatedLine
12053 ? section.generatedOffset.generatedColumn - 1
12054 : 0),
12055 originalLine: mapping.originalLine,
12056 originalColumn: mapping.originalColumn,
12057 name: name
12058 };
12059
12060 this.__generatedMappings.push(adjustedMapping);
12061 if (typeof adjustedMapping.originalLine === 'number') {
12062 this.__originalMappings.push(adjustedMapping);
12063 }
12064 }
12065 }
12066
12067 quickSort$1(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
12068 quickSort$1(this.__originalMappings, util.compareByOriginalPositions);
12069 };
12070
12071 var IndexedSourceMapConsumer_1 = IndexedSourceMapConsumer;
12072
12073 var sourceMapConsumer = {
12074 SourceMapConsumer: SourceMapConsumer_1,
12075 BasicSourceMapConsumer: BasicSourceMapConsumer_1,
12076 IndexedSourceMapConsumer: IndexedSourceMapConsumer_1
12077 };
12078
12079 /* -*- Mode: js; js-indent-level: 2; -*- */
12080 /*
12081 * Copyright 2011 Mozilla Foundation and contributors
12082 * Licensed under the New BSD license. See LICENSE or:
12083 * http://opensource.org/licenses/BSD-3-Clause
12084 */
12085
12086 var SourceMapGenerator$1 = sourceMapGenerator.SourceMapGenerator;
12087
12088
12089 // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
12090 // operating systems these days (capturing the result).
12091 var REGEX_NEWLINE = /(\r?\n)/;
12092
12093 // Newline character code for charCodeAt() comparisons
12094 var NEWLINE_CODE = 10;
12095
12096 // Private symbol for identifying `SourceNode`s when multiple versions of
12097 // the source-map library are loaded. This MUST NOT CHANGE across
12098 // versions!
12099 var isSourceNode = "$$$isSourceNode$$$";
12100
12101 /**
12102 * SourceNodes provide a way to abstract over interpolating/concatenating
12103 * snippets of generated JavaScript source code while maintaining the line and
12104 * column information associated with the original source code.
12105 *
12106 * @param aLine The original line number.
12107 * @param aColumn The original column number.
12108 * @param aSource The original source's filename.
12109 * @param aChunks Optional. An array of strings which are snippets of
12110 * generated JS, or other SourceNodes.
12111 * @param aName The original identifier.
12112 */
12113 function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
12114 this.children = [];
12115 this.sourceContents = {};
12116 this.line = aLine == null ? null : aLine;
12117 this.column = aColumn == null ? null : aColumn;
12118 this.source = aSource == null ? null : aSource;
12119 this.name = aName == null ? null : aName;
12120 this[isSourceNode] = true;
12121 if (aChunks != null) this.add(aChunks);
12122 }
12123
12124 /**
12125 * Creates a SourceNode from generated code and a SourceMapConsumer.
12126 *
12127 * @param aGeneratedCode The generated code
12128 * @param aSourceMapConsumer The SourceMap for the generated code
12129 * @param aRelativePath Optional. The path that relative sources in the
12130 * SourceMapConsumer should be relative to.
12131 */
12132 SourceNode.fromStringWithSourceMap =
12133 function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
12134 // The SourceNode we want to fill with the generated code
12135 // and the SourceMap
12136 var node = new SourceNode();
12137
12138 // All even indices of this array are one line of the generated code,
12139 // while all odd indices are the newlines between two adjacent lines
12140 // (since `REGEX_NEWLINE` captures its match).
12141 // Processed fragments are accessed by calling `shiftNextLine`.
12142 var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
12143 var remainingLinesIndex = 0;
12144 var shiftNextLine = function() {
12145 var lineContents = getNextLine();
12146 // The last line of a file might not have a newline.
12147 var newLine = getNextLine() || "";
12148 return lineContents + newLine;
12149
12150 function getNextLine() {
12151 return remainingLinesIndex < remainingLines.length ?
12152 remainingLines[remainingLinesIndex++] : undefined;
12153 }
12154 };
12155
12156 // We need to remember the position of "remainingLines"
12157 var lastGeneratedLine = 1, lastGeneratedColumn = 0;
12158
12159 // The generate SourceNodes we need a code range.
12160 // To extract it current and last mapping is used.
12161 // Here we store the last mapping.
12162 var lastMapping = null;
12163
12164 aSourceMapConsumer.eachMapping(function (mapping) {
12165 if (lastMapping !== null) {
12166 // We add the code from "lastMapping" to "mapping":
12167 // First check if there is a new line in between.
12168 if (lastGeneratedLine < mapping.generatedLine) {
12169 // Associate first line with "lastMapping"
12170 addMappingWithCode(lastMapping, shiftNextLine());
12171 lastGeneratedLine++;
12172 lastGeneratedColumn = 0;
12173 // The remaining code is added without mapping
12174 } else {
12175 // There is no new line in between.
12176 // Associate the code between "lastGeneratedColumn" and
12177 // "mapping.generatedColumn" with "lastMapping"
12178 var nextLine = remainingLines[remainingLinesIndex];
12179 var code = nextLine.substr(0, mapping.generatedColumn -
12180 lastGeneratedColumn);
12181 remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
12182 lastGeneratedColumn);
12183 lastGeneratedColumn = mapping.generatedColumn;
12184 addMappingWithCode(lastMapping, code);
12185 // No more remaining code, continue
12186 lastMapping = mapping;
12187 return;
12188 }
12189 }
12190 // We add the generated code until the first mapping
12191 // to the SourceNode without any mapping.
12192 // Each line is added as separate string.
12193 while (lastGeneratedLine < mapping.generatedLine) {
12194 node.add(shiftNextLine());
12195 lastGeneratedLine++;
12196 }
12197 if (lastGeneratedColumn < mapping.generatedColumn) {
12198 var nextLine = remainingLines[remainingLinesIndex];
12199 node.add(nextLine.substr(0, mapping.generatedColumn));
12200 remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
12201 lastGeneratedColumn = mapping.generatedColumn;
12202 }
12203 lastMapping = mapping;
12204 }, this);
12205 // We have processed all mappings.
12206 if (remainingLinesIndex < remainingLines.length) {
12207 if (lastMapping) {
12208 // Associate the remaining code in the current line with "lastMapping"
12209 addMappingWithCode(lastMapping, shiftNextLine());
12210 }
12211 // and add the remaining lines without any mapping
12212 node.add(remainingLines.splice(remainingLinesIndex).join(""));
12213 }
12214
12215 // Copy sourcesContent into SourceNode
12216 aSourceMapConsumer.sources.forEach(function (sourceFile) {
12217 var content = aSourceMapConsumer.sourceContentFor(sourceFile);
12218 if (content != null) {
12219 if (aRelativePath != null) {
12220 sourceFile = util.join(aRelativePath, sourceFile);
12221 }
12222 node.setSourceContent(sourceFile, content);
12223 }
12224 });
12225
12226 return node;
12227
12228 function addMappingWithCode(mapping, code) {
12229 if (mapping === null || mapping.source === undefined) {
12230 node.add(code);
12231 } else {
12232 var source = aRelativePath
12233 ? util.join(aRelativePath, mapping.source)
12234 : mapping.source;
12235 node.add(new SourceNode(mapping.originalLine,
12236 mapping.originalColumn,
12237 source,
12238 code,
12239 mapping.name));
12240 }
12241 }
12242 };
12243
12244 /**
12245 * Add a chunk of generated JS to this source node.
12246 *
12247 * @param aChunk A string snippet of generated JS code, another instance of
12248 * SourceNode, or an array where each member is one of those things.
12249 */
12250 SourceNode.prototype.add = function SourceNode_add(aChunk) {
12251 if (Array.isArray(aChunk)) {
12252 aChunk.forEach(function (chunk) {
12253 this.add(chunk);
12254 }, this);
12255 }
12256 else if (aChunk[isSourceNode] || typeof aChunk === "string") {
12257 if (aChunk) {
12258 this.children.push(aChunk);
12259 }
12260 }
12261 else {
12262 throw new TypeError(
12263 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
12264 );
12265 }
12266 return this;
12267 };
12268
12269 /**
12270 * Add a chunk of generated JS to the beginning of this source node.
12271 *
12272 * @param aChunk A string snippet of generated JS code, another instance of
12273 * SourceNode, or an array where each member is one of those things.
12274 */
12275 SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
12276 if (Array.isArray(aChunk)) {
12277 for (var i = aChunk.length-1; i >= 0; i--) {
12278 this.prepend(aChunk[i]);
12279 }
12280 }
12281 else if (aChunk[isSourceNode] || typeof aChunk === "string") {
12282 this.children.unshift(aChunk);
12283 }
12284 else {
12285 throw new TypeError(
12286 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
12287 );
12288 }
12289 return this;
12290 };
12291
12292 /**
12293 * Walk over the tree of JS snippets in this node and its children. The
12294 * walking function is called once for each snippet of JS and is passed that
12295 * snippet and the its original associated source's line/column location.
12296 *
12297 * @param aFn The traversal function.
12298 */
12299 SourceNode.prototype.walk = function SourceNode_walk(aFn) {
12300 var chunk;
12301 for (var i = 0, len = this.children.length; i < len; i++) {
12302 chunk = this.children[i];
12303 if (chunk[isSourceNode]) {
12304 chunk.walk(aFn);
12305 }
12306 else {
12307 if (chunk !== '') {
12308 aFn(chunk, { source: this.source,
12309 line: this.line,
12310 column: this.column,
12311 name: this.name });
12312 }
12313 }
12314 }
12315 };
12316
12317 /**
12318 * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
12319 * each of `this.children`.
12320 *
12321 * @param aSep The separator.
12322 */
12323 SourceNode.prototype.join = function SourceNode_join(aSep) {
12324 var newChildren;
12325 var i;
12326 var len = this.children.length;
12327 if (len > 0) {
12328 newChildren = [];
12329 for (i = 0; i < len-1; i++) {
12330 newChildren.push(this.children[i]);
12331 newChildren.push(aSep);
12332 }
12333 newChildren.push(this.children[i]);
12334 this.children = newChildren;
12335 }
12336 return this;
12337 };
12338
12339 /**
12340 * Call String.prototype.replace on the very right-most source snippet. Useful
12341 * for trimming whitespace from the end of a source node, etc.
12342 *
12343 * @param aPattern The pattern to replace.
12344 * @param aReplacement The thing to replace the pattern with.
12345 */
12346 SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
12347 var lastChild = this.children[this.children.length - 1];
12348 if (lastChild[isSourceNode]) {
12349 lastChild.replaceRight(aPattern, aReplacement);
12350 }
12351 else if (typeof lastChild === 'string') {
12352 this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
12353 }
12354 else {
12355 this.children.push(''.replace(aPattern, aReplacement));
12356 }
12357 return this;
12358 };
12359
12360 /**
12361 * Set the source content for a source file. This will be added to the SourceMapGenerator
12362 * in the sourcesContent field.
12363 *
12364 * @param aSourceFile The filename of the source file
12365 * @param aSourceContent The content of the source file
12366 */
12367 SourceNode.prototype.setSourceContent =
12368 function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
12369 this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
12370 };
12371
12372 /**
12373 * Walk over the tree of SourceNodes. The walking function is called for each
12374 * source file content and is passed the filename and source content.
12375 *
12376 * @param aFn The traversal function.
12377 */
12378 SourceNode.prototype.walkSourceContents =
12379 function SourceNode_walkSourceContents(aFn) {
12380 for (var i = 0, len = this.children.length; i < len; i++) {
12381 if (this.children[i][isSourceNode]) {
12382 this.children[i].walkSourceContents(aFn);
12383 }
12384 }
12385
12386 var sources = Object.keys(this.sourceContents);
12387 for (var i = 0, len = sources.length; i < len; i++) {
12388 aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
12389 }
12390 };
12391
12392 /**
12393 * Return the string representation of this source node. Walks over the tree
12394 * and concatenates all the various snippets together to one string.
12395 */
12396 SourceNode.prototype.toString = function SourceNode_toString() {
12397 var str = "";
12398 this.walk(function (chunk) {
12399 str += chunk;
12400 });
12401 return str;
12402 };
12403
12404 /**
12405 * Returns the string representation of this source node along with a source
12406 * map.
12407 */
12408 SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
12409 var generated = {
12410 code: "",
12411 line: 1,
12412 column: 0
12413 };
12414 var map = new SourceMapGenerator$1(aArgs);
12415 var sourceMappingActive = false;
12416 var lastOriginalSource = null;
12417 var lastOriginalLine = null;
12418 var lastOriginalColumn = null;
12419 var lastOriginalName = null;
12420 this.walk(function (chunk, original) {
12421 generated.code += chunk;
12422 if (original.source !== null
12423 && original.line !== null
12424 && original.column !== null) {
12425 if(lastOriginalSource !== original.source
12426 || lastOriginalLine !== original.line
12427 || lastOriginalColumn !== original.column
12428 || lastOriginalName !== original.name) {
12429 map.addMapping({
12430 source: original.source,
12431 original: {
12432 line: original.line,
12433 column: original.column
12434 },
12435 generated: {
12436 line: generated.line,
12437 column: generated.column
12438 },
12439 name: original.name
12440 });
12441 }
12442 lastOriginalSource = original.source;
12443 lastOriginalLine = original.line;
12444 lastOriginalColumn = original.column;
12445 lastOriginalName = original.name;
12446 sourceMappingActive = true;
12447 } else if (sourceMappingActive) {
12448 map.addMapping({
12449 generated: {
12450 line: generated.line,
12451 column: generated.column
12452 }
12453 });
12454 lastOriginalSource = null;
12455 sourceMappingActive = false;
12456 }
12457 for (var idx = 0, length = chunk.length; idx < length; idx++) {
12458 if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
12459 generated.line++;
12460 generated.column = 0;
12461 // Mappings end at eol
12462 if (idx + 1 === length) {
12463 lastOriginalSource = null;
12464 sourceMappingActive = false;
12465 } else if (sourceMappingActive) {
12466 map.addMapping({
12467 source: original.source,
12468 original: {
12469 line: original.line,
12470 column: original.column
12471 },
12472 generated: {
12473 line: generated.line,
12474 column: generated.column
12475 },
12476 name: original.name
12477 });
12478 }
12479 } else {
12480 generated.column++;
12481 }
12482 }
12483 });
12484 this.walkSourceContents(function (sourceFile, sourceContent) {
12485 map.setSourceContent(sourceFile, sourceContent);
12486 });
12487
12488 return { code: generated.code, map: map };
12489 };
12490
12491 var SourceNode_1 = SourceNode;
12492
12493 var sourceNode = {
12494 SourceNode: SourceNode_1
12495 };
12496
12497 /*
12498 * Copyright 2009-2011 Mozilla Foundation and contributors
12499 * Licensed under the New BSD license. See LICENSE.txt or:
12500 * http://opensource.org/licenses/BSD-3-Clause
12501 */
12502 var SourceMapGenerator$2 = sourceMapGenerator.SourceMapGenerator;
12503 var SourceMapConsumer$1 = sourceMapConsumer.SourceMapConsumer;
12504 var SourceNode$1 = sourceNode.SourceNode;
12505
12506 var sourceMap = {
12507 SourceMapGenerator: SourceMapGenerator$2,
12508 SourceMapConsumer: SourceMapConsumer$1,
12509 SourceNode: SourceNode$1
12510 };
12511
12512 var SourceMapGenerator$3 = sourceMap.SourceMapGenerator;
12513 var trackNodes = {
12514 Atrule: true,
12515 Selector: true,
12516 Declaration: true
12517 };
12518
12519 var sourceMap$1 = function generateSourceMap(handlers) {
12520 var map = new SourceMapGenerator$3();
12521 var line = 1;
12522 var column = 0;
12523 var generated = {
12524 line: 1,
12525 column: 0
12526 };
12527 var original = {
12528 line: 0, // should be zero to add first mapping
12529 column: 0
12530 };
12531 var sourceMappingActive = false;
12532 var activatedGenerated = {
12533 line: 1,
12534 column: 0
12535 };
12536 var activatedMapping = {
12537 generated: activatedGenerated
12538 };
12539
12540 var handlersNode = handlers.node;
12541 handlers.node = function(node) {
12542 if (node.loc && node.loc.start && trackNodes.hasOwnProperty(node.type)) {
12543 var nodeLine = node.loc.start.line;
12544 var nodeColumn = node.loc.start.column - 1;
12545
12546 if (original.line !== nodeLine ||
12547 original.column !== nodeColumn) {
12548 original.line = nodeLine;
12549 original.column = nodeColumn;
12550
12551 generated.line = line;
12552 generated.column = column;
12553
12554 if (sourceMappingActive) {
12555 sourceMappingActive = false;
12556 if (generated.line !== activatedGenerated.line ||
12557 generated.column !== activatedGenerated.column) {
12558 map.addMapping(activatedMapping);
12559 }
12560 }
12561
12562 sourceMappingActive = true;
12563 map.addMapping({
12564 source: node.loc.source,
12565 original: original,
12566 generated: generated
12567 });
12568 }
12569 }
12570
12571 handlersNode.call(this, node);
12572
12573 if (sourceMappingActive && trackNodes.hasOwnProperty(node.type)) {
12574 activatedGenerated.line = line;
12575 activatedGenerated.column = column;
12576 }
12577 };
12578
12579 var handlersChunk = handlers.chunk;
12580 handlers.chunk = function(chunk) {
12581 for (var i = 0; i < chunk.length; i++) {
12582 if (chunk.charCodeAt(i) === 10) { // \n
12583 line++;
12584 column = 0;
12585 } else {
12586 column++;
12587 }
12588 }
12589
12590 handlersChunk(chunk);
12591 };
12592
12593 var handlersResult = handlers.result;
12594 handlers.result = function() {
12595 if (sourceMappingActive) {
12596 map.addMapping(activatedMapping);
12597 }
12598
12599 return {
12600 css: handlersResult(),
12601 map: map
12602 };
12603 };
12604
12605 return handlers;
12606 };
12607
12608 var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
12609
12610 function processChildren(node, delimeter) {
12611 var list = node.children;
12612 var prev = null;
12613
12614 if (typeof delimeter !== 'function') {
12615 list.forEach(this.node, this);
12616 } else {
12617 list.forEach(function(node) {
12618 if (prev !== null) {
12619 delimeter.call(this, prev);
12620 }
12621
12622 this.node(node);
12623 prev = node;
12624 }, this);
12625 }
12626 }
12627
12628 var create$2 = function createGenerator(config) {
12629 function processNode(node) {
12630 if (hasOwnProperty$3.call(types, node.type)) {
12631 types[node.type].call(this, node);
12632 } else {
12633 throw new Error('Unknown node type: ' + node.type);
12634 }
12635 }
12636
12637 var types = {};
12638
12639 if (config.node) {
12640 for (var name in config.node) {
12641 types[name] = config.node[name].generate;
12642 }
12643 }
12644
12645 return function(node, options) {
12646 var buffer = '';
12647 var handlers = {
12648 children: processChildren,
12649 node: processNode,
12650 chunk: function(chunk) {
12651 buffer += chunk;
12652 },
12653 result: function() {
12654 return buffer;
12655 }
12656 };
12657
12658 if (options) {
12659 if (typeof options.decorator === 'function') {
12660 handlers = options.decorator(handlers);
12661 }
12662
12663 if (options.sourceMap) {
12664 handlers = sourceMap$1(handlers);
12665 }
12666 }
12667
12668 handlers.node(node);
12669
12670 return handlers.result();
12671 };
12672 };
12673
12674 var create$3 = function createConvertors(walk) {
12675 return {
12676 fromPlainObject: function(ast) {
12677 walk(ast, {
12678 enter: function(node) {
12679 if (node.children && node.children instanceof list === false) {
12680 node.children = new list().fromArray(node.children);
12681 }
12682 }
12683 });
12684
12685 return ast;
12686 },
12687 toPlainObject: function(ast) {
12688 walk(ast, {
12689 leave: function(node) {
12690 if (node.children && node.children instanceof list) {
12691 node.children = node.children.toArray();
12692 }
12693 }
12694 });
12695
12696 return ast;
12697 }
12698 };
12699 };
12700
12701 var hasOwnProperty$4 = Object.prototype.hasOwnProperty;
12702 var noop$4 = function() {};
12703
12704 function ensureFunction$1(value) {
12705 return typeof value === 'function' ? value : noop$4;
12706 }
12707
12708 function invokeForType(fn, type) {
12709 return function(node, item, list) {
12710 if (node.type === type) {
12711 fn.call(this, node, item, list);
12712 }
12713 };
12714 }
12715
12716 function getWalkersFromStructure(name, nodeType) {
12717 var structure = nodeType.structure;
12718 var walkers = [];
12719
12720 for (var key in structure) {
12721 if (hasOwnProperty$4.call(structure, key) === false) {
12722 continue;
12723 }
12724
12725 var fieldTypes = structure[key];
12726 var walker = {
12727 name: key,
12728 type: false,
12729 nullable: false
12730 };
12731
12732 if (!Array.isArray(structure[key])) {
12733 fieldTypes = [structure[key]];
12734 }
12735
12736 for (var i = 0; i < fieldTypes.length; i++) {
12737 var fieldType = fieldTypes[i];
12738 if (fieldType === null) {
12739 walker.nullable = true;
12740 } else if (typeof fieldType === 'string') {
12741 walker.type = 'node';
12742 } else if (Array.isArray(fieldType)) {
12743 walker.type = 'list';
12744 }
12745 }
12746
12747 if (walker.type) {
12748 walkers.push(walker);
12749 }
12750 }
12751
12752 if (walkers.length) {
12753 return {
12754 context: nodeType.walkContext,
12755 fields: walkers
12756 };
12757 }
12758
12759 return null;
12760 }
12761
12762 function getTypesFromConfig(config) {
12763 var types = {};
12764
12765 for (var name in config.node) {
12766 if (hasOwnProperty$4.call(config.node, name)) {
12767 var nodeType = config.node[name];
12768
12769 if (!nodeType.structure) {
12770 throw new Error('Missed `structure` field in `' + name + '` node type definition');
12771 }
12772
12773 types[name] = getWalkersFromStructure(name, nodeType);
12774 }
12775 }
12776
12777 return types;
12778 }
12779
12780 function createTypeIterator(config, reverse) {
12781 var fields = reverse ? config.fields.slice().reverse() : config.fields;
12782 var body = fields.map(function(field) {
12783 var ref = 'node.' + field.name;
12784 var line;
12785
12786 if (field.type === 'list') {
12787 line = reverse
12788 ? ref + '.forEachRight(walk);'
12789 : ref + '.forEach(walk);';
12790 } else {
12791 line = 'walk(' + ref + ');';
12792 }
12793
12794 if (field.nullable) {
12795 line = 'if (' + ref + ') {\n ' + line + '}';
12796 }
12797
12798 return line;
12799 });
12800
12801 if (config.context) {
12802 body = [].concat(
12803 'var old = context.' + config.context + ';',
12804 'context.' + config.context + ' = node;',
12805 body,
12806 'context.' + config.context + ' = old;'
12807 );
12808 }
12809
12810 return new Function('node', 'context', 'walk', body.join('\n'));
12811 }
12812
12813 function createFastTraveralMap(iterators) {
12814 return {
12815 Atrule: {
12816 StyleSheet: iterators.StyleSheet,
12817 Atrule: iterators.Atrule,
12818 Rule: iterators.Rule,
12819 Block: iterators.Block
12820 },
12821 Rule: {
12822 StyleSheet: iterators.StyleSheet,
12823 Atrule: iterators.Atrule,
12824 Rule: iterators.Rule,
12825 Block: iterators.Block
12826 },
12827 Declaration: {
12828 StyleSheet: iterators.StyleSheet,
12829 Atrule: iterators.Atrule,
12830 Rule: iterators.Rule,
12831 Block: iterators.Block
12832 }
12833 };
12834 }
12835
12836 var create$4 = function createWalker(config) {
12837 var types = getTypesFromConfig(config);
12838 var iteratorsNatural = {};
12839 var iteratorsReverse = {};
12840
12841 for (var name in types) {
12842 if (hasOwnProperty$4.call(types, name) && types[name] !== null) {
12843 iteratorsNatural[name] = createTypeIterator(types[name], false);
12844 iteratorsReverse[name] = createTypeIterator(types[name], true);
12845 }
12846 }
12847
12848 var fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural);
12849 var fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse);
12850
12851 return function walk(root, options) {
12852 function walkNode(node, item, list) {
12853 enter.call(context, node, item, list);
12854
12855 if (iterators.hasOwnProperty(node.type)) {
12856 iterators[node.type](node, context, walkNode);
12857 }
12858
12859 leave.call(context, node, item, list);
12860 }
12861
12862 var enter = noop$4;
12863 var leave = noop$4;
12864 var iterators = iteratorsNatural;
12865 var context = {
12866 root: root,
12867 stylesheet: null,
12868 atrule: null,
12869 atrulePrelude: null,
12870 rule: null,
12871 selector: null,
12872 block: null,
12873 declaration: null,
12874 function: null
12875 };
12876
12877 if (typeof options === 'function') {
12878 enter = options;
12879 } else if (options) {
12880 enter = ensureFunction$1(options.enter);
12881 leave = ensureFunction$1(options.leave);
12882
12883 if (options.reverse) {
12884 iterators = iteratorsReverse;
12885 }
12886
12887 if (options.visit) {
12888 if (fastTraversalIteratorsNatural.hasOwnProperty(options.visit)) {
12889 iterators = options.reverse
12890 ? fastTraversalIteratorsReverse[options.visit]
12891 : fastTraversalIteratorsNatural[options.visit];
12892 } else if (!types.hasOwnProperty(options.visit)) {
12893 throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).join(', ') + ')');
12894 }
12895
12896 enter = invokeForType(enter, options.visit);
12897 leave = invokeForType(leave, options.visit);
12898 }
12899 }
12900
12901 if (enter === noop$4 && leave === noop$4) {
12902 throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
12903 }
12904
12905 // swap handlers in reverse mode to invert visit order
12906 if (options.reverse) {
12907 var tmp = enter;
12908 enter = leave;
12909 leave = tmp;
12910 }
12911
12912 walkNode(root);
12913 };
12914 };
12915
12916 var clone = function clone(node) {
12917 var result = {};
12918
12919 for (var key in node) {
12920 var value = node[key];
12921
12922 if (value) {
12923 if (Array.isArray(value) || value instanceof list) {
12924 value = value.map(clone);
12925 } else if (value.constructor === Object) {
12926 value = clone(value);
12927 }
12928 }
12929
12930 result[key] = value;
12931 }
12932
12933 return result;
12934 };
12935
12936 var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
12937 var shape = {
12938 generic: true,
12939 types: {},
12940 properties: {},
12941 parseContext: {},
12942 scope: {},
12943 atrule: ['parse'],
12944 pseudo: ['parse'],
12945 node: ['name', 'structure', 'parse', 'generate', 'walkContext']
12946 };
12947
12948 function isObject(value) {
12949 return value && value.constructor === Object;
12950 }
12951
12952 function copy(value) {
12953 if (isObject(value)) {
12954 var res = {};
12955 for (var key in value) {
12956 if (hasOwnProperty$5.call(value, key)) {
12957 res[key] = value[key];
12958 }
12959 }
12960 return res;
12961 } else {
12962 return value;
12963 }
12964 }
12965
12966 function extend(dest, src) {
12967 for (var key in src) {
12968 if (hasOwnProperty$5.call(src, key)) {
12969 if (isObject(dest[key])) {
12970 extend(dest[key], copy(src[key]));
12971 } else {
12972 dest[key] = copy(src[key]);
12973 }
12974 }
12975 }
12976 }
12977
12978 function mix(dest, src, shape) {
12979 for (var key in shape) {
12980 if (hasOwnProperty$5.call(shape, key) === false) {
12981 continue;
12982 }
12983
12984 if (shape[key] === true) {
12985 if (key in src) {
12986 if (hasOwnProperty$5.call(src, key)) {
12987 dest[key] = copy(src[key]);
12988 }
12989 }
12990 } else if (shape[key]) {
12991 if (isObject(shape[key])) {
12992 var res = {};
12993 extend(res, dest[key]);
12994 extend(res, src[key]);
12995 dest[key] = res;
12996 } else if (Array.isArray(shape[key])) {
12997 var res = {};
12998 var innerShape = shape[key].reduce(function(s, k) {
12999 s[k] = true;
13000 return s;
13001 }, {});
13002 for (var name in dest[key]) {
13003 if (hasOwnProperty$5.call(dest[key], name)) {
13004 res[name] = {};
13005 if (dest[key] && dest[key][name]) {
13006 mix(res[name], dest[key][name], innerShape);
13007 }
13008 }
13009 }
13010 for (var name in src[key]) {
13011 if (hasOwnProperty$5.call(src[key], name)) {
13012 if (!res[name]) {
13013 res[name] = {};
13014 }
13015 if (src[key] && src[key][name]) {
13016 mix(res[name], src[key][name], innerShape);
13017 }
13018 }
13019 }
13020 dest[key] = res;
13021 }
13022 }
13023 }
13024 return dest;
13025 }
13026
13027 var mix_1 = function(dest, src) {
13028 return mix(dest, src, shape);
13029 };
13030
13031 function assign$1(dest, src) {
13032 for (var key in src) {
13033 dest[key] = src[key];
13034 }
13035
13036 return dest;
13037 }
13038
13039 function createSyntax(config) {
13040 var parse = create$1(config);
13041 var walk = create$4(config);
13042 var generate = create$2(config);
13043 var convert = create$3(walk);
13044
13045 var syntax = {
13046 List: list,
13047 Tokenizer: tokenizer,
13048 Lexer: Lexer_1,
13049
13050 vendorPrefix: names.vendorPrefix,
13051 keyword: names.keyword,
13052 property: names.property,
13053 isCustomProperty: names.isCustomProperty,
13054
13055 grammar: grammar,
13056 lexer: null,
13057 createLexer: function(config) {
13058 return new Lexer_1(config, syntax, syntax.lexer.structure);
13059 },
13060
13061 parse: parse,
13062 walk: walk,
13063 generate: generate,
13064
13065 clone: clone,
13066 fromPlainObject: convert.fromPlainObject,
13067 toPlainObject: convert.toPlainObject,
13068
13069 createSyntax: function(config) {
13070 return createSyntax(mix_1({}, config));
13071 },
13072 fork: function(extension) {
13073 var base = mix_1({}, config); // copy of config
13074 return createSyntax(
13075 typeof extension === 'function'
13076 ? extension(base, assign$1)
13077 : mix_1(base, extension)
13078 );
13079 }
13080 };
13081
13082 syntax.lexer = new Lexer_1({
13083 generic: true,
13084 types: config.types,
13085 properties: config.properties,
13086 node: config.node
13087 }, syntax);
13088
13089 return syntax;
13090 }
13091 var create_1 = function(config) {
13092 return createSyntax(mix_1({}, config));
13093 };
13094
13095 var create$5 = {
13096 create: create_1
13097 };
13098
13099 var all = {
13100 syntax: "initial | inherit | unset | revert",
13101 media: "noPracticalMedia",
13102 inherited: false,
13103 animationType: "eachOfShorthandPropertiesExceptUnicodeBiDiAndDirection",
13104 percentages: "no",
13105 groups: [
13106 "CSS Miscellaneous"
13107 ],
13108 initial: "noPracticalInitialValue",
13109 appliesto: "allElements",
13110 computed: "asSpecifiedAppliesToEachProperty",
13111 order: "uniqueOrder",
13112 status: "standard"
13113 };
13114 var animation = {
13115 syntax: "<single-animation>#",
13116 media: "visual",
13117 inherited: false,
13118 animationType: "discrete",
13119 percentages: "no",
13120 groups: [
13121 "CSS Animations"
13122 ],
13123 initial: [
13124 "animation-name",
13125 "animation-duration",
13126 "animation-timing-function",
13127 "animation-delay",
13128 "animation-iteration-count",
13129 "animation-direction",
13130 "animation-fill-mode",
13131 "animation-play-state"
13132 ],
13133 appliesto: "allElementsAndPseudos",
13134 computed: [
13135 "animation-name",
13136 "animation-duration",
13137 "animation-timing-function",
13138 "animation-delay",
13139 "animation-direction",
13140 "animation-iteration-count",
13141 "animation-fill-mode",
13142 "animation-play-state"
13143 ],
13144 order: "orderOfAppearance",
13145 status: "standard"
13146 };
13147 var appearance = {
13148 syntax: "auto | none",
13149 media: "all",
13150 inherited: false,
13151 animationType: "discrete",
13152 percentages: "no",
13153 groups: [
13154 "CSS Basic User Interface"
13155 ],
13156 initial: "auto",
13157 appliesto: "allElements",
13158 computed: "asSpecified",
13159 order: "perGrammar",
13160 status: "experimental"
13161 };
13162 var azimuth = {
13163 syntax: "<angle> | [ [ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards",
13164 media: "aural",
13165 inherited: true,
13166 animationType: "discrete",
13167 percentages: "no",
13168 groups: [
13169 "CSS Speech"
13170 ],
13171 initial: "center",
13172 appliesto: "allElements",
13173 computed: "normalizedAngle",
13174 order: "orderOfAppearance",
13175 status: "obsolete"
13176 };
13177 var background = {
13178 syntax: "[ <bg-layer> , ]* <final-bg-layer>",
13179 media: "visual",
13180 inherited: false,
13181 animationType: [
13182 "background-color",
13183 "background-image",
13184 "background-clip",
13185 "background-position",
13186 "background-size",
13187 "background-repeat",
13188 "background-attachment"
13189 ],
13190 percentages: [
13191 "background-position",
13192 "background-size"
13193 ],
13194 groups: [
13195 "CSS Backgrounds and Borders"
13196 ],
13197 initial: [
13198 "background-image",
13199 "background-position",
13200 "background-size",
13201 "background-repeat",
13202 "background-origin",
13203 "background-clip",
13204 "background-attachment",
13205 "background-color"
13206 ],
13207 appliesto: "allElements",
13208 computed: [
13209 "background-image",
13210 "background-position",
13211 "background-size",
13212 "background-repeat",
13213 "background-origin",
13214 "background-clip",
13215 "background-attachment",
13216 "background-color"
13217 ],
13218 order: "orderOfAppearance",
13219 alsoAppliesTo: [
13220 "::first-letter",
13221 "::first-line",
13222 "::placeholder"
13223 ],
13224 status: "standard"
13225 };
13226 var border = {
13227 syntax: "<br-width> || <br-style> || <color>",
13228 media: "visual",
13229 inherited: false,
13230 animationType: [
13231 "border-color",
13232 "border-style",
13233 "border-width"
13234 ],
13235 percentages: "no",
13236 groups: [
13237 "CSS Backgrounds and Borders"
13238 ],
13239 initial: [
13240 "border-width",
13241 "border-style",
13242 "border-color"
13243 ],
13244 appliesto: "allElements",
13245 computed: [
13246 "border-width",
13247 "border-style",
13248 "border-color"
13249 ],
13250 order: "orderOfAppearance",
13251 alsoAppliesTo: [
13252 "::first-letter"
13253 ],
13254 status: "standard"
13255 };
13256 var bottom = {
13257 syntax: "<length> | <percentage> | auto",
13258 media: "visual",
13259 inherited: false,
13260 animationType: "lpc",
13261 percentages: "referToContainingBlockHeight",
13262 groups: [
13263 "CSS Positioning"
13264 ],
13265 initial: "auto",
13266 appliesto: "positionedElements",
13267 computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
13268 order: "uniqueOrder",
13269 status: "standard"
13270 };
13271 var clear = {
13272 syntax: "none | left | right | both | inline-start | inline-end",
13273 media: "visual",
13274 inherited: false,
13275 animationType: "discrete",
13276 percentages: "no",
13277 groups: [
13278 "CSS Positioning"
13279 ],
13280 initial: "none",
13281 appliesto: "blockLevelElements",
13282 computed: "asSpecified",
13283 order: "uniqueOrder",
13284 status: "standard"
13285 };
13286 var clip = {
13287 syntax: "<shape> | auto",
13288 media: "visual",
13289 inherited: false,
13290 animationType: "rectangle",
13291 percentages: "no",
13292 groups: [
13293 "CSS Masking"
13294 ],
13295 initial: "auto",
13296 appliesto: "absolutelyPositionedElements",
13297 computed: "autoOrRectangle",
13298 order: "uniqueOrder",
13299 status: "standard"
13300 };
13301 var color = {
13302 syntax: "<color>",
13303 media: "visual",
13304 inherited: true,
13305 animationType: "color",
13306 percentages: "no",
13307 groups: [
13308 "CSS Color"
13309 ],
13310 initial: "variesFromBrowserToBrowser",
13311 appliesto: "allElements",
13312 computed: "translucentValuesRGBAOtherwiseRGB",
13313 order: "uniqueOrder",
13314 alsoAppliesTo: [
13315 "::first-letter",
13316 "::first-line",
13317 "::placeholder"
13318 ],
13319 status: "standard"
13320 };
13321 var columns = {
13322 syntax: "<'column-width'> || <'column-count'>",
13323 media: "visual",
13324 inherited: false,
13325 animationType: [
13326 "column-width",
13327 "column-count"
13328 ],
13329 percentages: "no",
13330 groups: [
13331 "CSS Columns"
13332 ],
13333 initial: [
13334 "column-width",
13335 "column-count"
13336 ],
13337 appliesto: "blockContainersExceptTableWrappers",
13338 computed: [
13339 "column-width",
13340 "column-count"
13341 ],
13342 order: "perGrammar",
13343 status: "standard"
13344 };
13345 var contain = {
13346 syntax: "none | strict | content | [ size || layout || style || paint ]",
13347 media: "all",
13348 inherited: false,
13349 animationType: "discrete",
13350 percentages: "no",
13351 groups: [
13352 "CSS Containment"
13353 ],
13354 initial: "none",
13355 appliesto: "allElements",
13356 computed: "asSpecified",
13357 order: "perGrammar",
13358 status: "experimental"
13359 };
13360 var content = {
13361 syntax: "normal | none | [ <content-replacement> | <content-list> ] [/ <string> ]?",
13362 media: "all",
13363 inherited: false,
13364 animationType: "discrete",
13365 percentages: "no",
13366 groups: [
13367 "CSS Generated Content"
13368 ],
13369 initial: "normal",
13370 appliesto: "beforeAndAfterPseudos",
13371 computed: "normalOnElementsForPseudosNoneAbsoluteURIStringOrAsSpecified",
13372 order: "uniqueOrder",
13373 status: "standard"
13374 };
13375 var cursor = {
13376 syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ]",
13377 media: [
13378 "visual",
13379 "interactive"
13380 ],
13381 inherited: true,
13382 animationType: "discrete",
13383 percentages: "no",
13384 groups: [
13385 "CSS Basic User Interface"
13386 ],
13387 initial: "auto",
13388 appliesto: "allElements",
13389 computed: "asSpecifiedURLsAbsolute",
13390 order: "uniqueOrder",
13391 status: "standard"
13392 };
13393 var direction = {
13394 syntax: "ltr | rtl",
13395 media: "visual",
13396 inherited: true,
13397 animationType: "discrete",
13398 percentages: "no",
13399 groups: [
13400 "CSS Writing Modes"
13401 ],
13402 initial: "ltr",
13403 appliesto: "allElements",
13404 computed: "asSpecified",
13405 order: "uniqueOrder",
13406 status: "standard"
13407 };
13408 var display = {
13409 syntax: "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>",
13410 media: "all",
13411 inherited: false,
13412 animationType: "discrete",
13413 percentages: "no",
13414 groups: [
13415 "CSS Display"
13416 ],
13417 initial: "inline",
13418 appliesto: "allElements",
13419 computed: "asSpecifiedExceptPositionedFloatingAndRootElementsKeywordMaybeDifferent",
13420 order: "uniqueOrder",
13421 status: "standard"
13422 };
13423 var filter = {
13424 syntax: "none | <filter-function-list>",
13425 media: "visual",
13426 inherited: false,
13427 animationType: "filterList",
13428 percentages: "no",
13429 groups: [
13430 "Filter Effects"
13431 ],
13432 initial: "none",
13433 appliesto: "allElementsSVGContainerElements",
13434 computed: "asSpecified",
13435 order: "uniqueOrder",
13436 status: "standard"
13437 };
13438 var flex = {
13439 syntax: "none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]",
13440 media: "visual",
13441 inherited: false,
13442 animationType: [
13443 "flex-grow",
13444 "flex-shrink",
13445 "flex-basis"
13446 ],
13447 percentages: "no",
13448 groups: [
13449 "CSS Flexible Box Layout"
13450 ],
13451 initial: [
13452 "flex-grow",
13453 "flex-shrink",
13454 "flex-basis"
13455 ],
13456 appliesto: "flexItemsAndInFlowPseudos",
13457 computed: [
13458 "flex-grow",
13459 "flex-shrink",
13460 "flex-basis"
13461 ],
13462 order: "orderOfAppearance",
13463 status: "standard"
13464 };
13465 var float = {
13466 syntax: "left | right | none | inline-start | inline-end",
13467 media: "visual",
13468 inherited: false,
13469 animationType: "discrete",
13470 percentages: "no",
13471 groups: [
13472 "CSS Positioning"
13473 ],
13474 initial: "none",
13475 appliesto: "allElementsNoEffectIfDisplayNone",
13476 computed: "asSpecified",
13477 order: "uniqueOrder",
13478 status: "standard"
13479 };
13480 var font = {
13481 syntax: "[ [ <'font-style'> || <font-variant-css21> || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar",
13482 media: "visual",
13483 inherited: true,
13484 animationType: [
13485 "font-style",
13486 "font-variant",
13487 "font-weight",
13488 "font-stretch",
13489 "font-size",
13490 "line-height",
13491 "font-family"
13492 ],
13493 percentages: [
13494 "font-size",
13495 "line-height"
13496 ],
13497 groups: [
13498 "CSS Fonts"
13499 ],
13500 initial: [
13501 "font-style",
13502 "font-variant",
13503 "font-weight",
13504 "font-stretch",
13505 "font-size",
13506 "line-height",
13507 "font-family"
13508 ],
13509 appliesto: "allElements",
13510 computed: [
13511 "font-style",
13512 "font-variant",
13513 "font-weight",
13514 "font-stretch",
13515 "font-size",
13516 "line-height",
13517 "font-family"
13518 ],
13519 order: "orderOfAppearance",
13520 alsoAppliesTo: [
13521 "::first-letter",
13522 "::first-line",
13523 "::placeholder"
13524 ],
13525 status: "standard"
13526 };
13527 var gap = {
13528 syntax: "<'row-gap'> <'column-gap'>?",
13529 media: "visual",
13530 inherited: false,
13531 animationType: [
13532 "row-gap",
13533 "column-gap"
13534 ],
13535 percentages: "no",
13536 groups: [
13537 "CSS Box Alignment"
13538 ],
13539 initial: [
13540 "row-gap",
13541 "column-gap"
13542 ],
13543 appliesto: "gridContainers",
13544 computed: [
13545 "row-gap",
13546 "column-gap"
13547 ],
13548 order: "uniqueOrder",
13549 status: "standard"
13550 };
13551 var grid = {
13552 syntax: "<'grid-template'> | <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>",
13553 media: "visual",
13554 inherited: false,
13555 animationType: "discrete",
13556 percentages: [
13557 "grid-template-rows",
13558 "grid-template-columns",
13559 "grid-auto-rows",
13560 "grid-auto-columns"
13561 ],
13562 groups: [
13563 "CSS Grid Layout"
13564 ],
13565 initial: [
13566 "grid-template-rows",
13567 "grid-template-columns",
13568 "grid-template-areas",
13569 "grid-auto-rows",
13570 "grid-auto-columns",
13571 "grid-auto-flow",
13572 "grid-column-gap",
13573 "grid-row-gap",
13574 "column-gap",
13575 "row-gap"
13576 ],
13577 appliesto: "gridContainers",
13578 computed: [
13579 "grid-template-rows",
13580 "grid-template-columns",
13581 "grid-template-areas",
13582 "grid-auto-rows",
13583 "grid-auto-columns",
13584 "grid-auto-flow",
13585 "grid-column-gap",
13586 "grid-row-gap",
13587 "column-gap",
13588 "row-gap"
13589 ],
13590 order: "uniqueOrder",
13591 status: "standard"
13592 };
13593 var height = {
13594 syntax: "[ <length> | <percentage> ] && [ border-box | content-box ]? | available | min-content | max-content | fit-content | auto",
13595 media: "visual",
13596 inherited: false,
13597 animationType: "lpc",
13598 percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesRelativeToContainingBlock",
13599 groups: [
13600 "CSS Box Model"
13601 ],
13602 initial: "auto",
13603 appliesto: "allElementsButNonReplacedAndTableColumns",
13604 computed: "percentageAutoOrAbsoluteLength",
13605 order: "uniqueOrder",
13606 status: "standard"
13607 };
13608 var hyphens = {
13609 syntax: "none | manual | auto",
13610 media: "visual",
13611 inherited: true,
13612 animationType: "discrete",
13613 percentages: "no",
13614 groups: [
13615 "CSS Text"
13616 ],
13617 initial: "manual",
13618 appliesto: "allElements",
13619 computed: "asSpecified",
13620 order: "uniqueOrder",
13621 status: "standard"
13622 };
13623 var isolation = {
13624 syntax: "auto | isolate",
13625 media: "visual",
13626 inherited: false,
13627 animationType: "discrete",
13628 percentages: "no",
13629 groups: [
13630 "Compositing and Blending"
13631 ],
13632 initial: "auto",
13633 appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
13634 computed: "asSpecified",
13635 order: "uniqueOrder",
13636 status: "standard"
13637 };
13638 var left = {
13639 syntax: "<length> | <percentage> | auto",
13640 media: "visual",
13641 inherited: false,
13642 animationType: "lpc",
13643 percentages: "referToWidthOfContainingBlock",
13644 groups: [
13645 "CSS Positioning"
13646 ],
13647 initial: "auto",
13648 appliesto: "positionedElements",
13649 computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
13650 order: "uniqueOrder",
13651 status: "standard"
13652 };
13653 var margin = {
13654 syntax: "[ <length> | <percentage> | auto ]{1,4}",
13655 media: "visual",
13656 inherited: false,
13657 animationType: "length",
13658 percentages: "referToWidthOfContainingBlock",
13659 groups: [
13660 "CSS Box Model"
13661 ],
13662 initial: [
13663 "margin-bottom",
13664 "margin-left",
13665 "margin-right",
13666 "margin-top"
13667 ],
13668 appliesto: "allElementsExceptTableDisplayTypes",
13669 computed: [
13670 "margin-bottom",
13671 "margin-left",
13672 "margin-right",
13673 "margin-top"
13674 ],
13675 order: "uniqueOrder",
13676 alsoAppliesTo: [
13677 "::first-letter"
13678 ],
13679 status: "standard"
13680 };
13681 var mask = {
13682 syntax: "<mask-layer>#",
13683 media: "visual",
13684 inherited: false,
13685 animationType: [
13686 "mask-image",
13687 "mask-mode",
13688 "mask-repeat",
13689 "mask-position",
13690 "mask-clip",
13691 "mask-origin",
13692 "mask-size",
13693 "mask-composite"
13694 ],
13695 percentages: [
13696 "mask-position"
13697 ],
13698 groups: [
13699 "CSS Masking"
13700 ],
13701 initial: [
13702 "mask-image",
13703 "mask-mode",
13704 "mask-repeat",
13705 "mask-position",
13706 "mask-clip",
13707 "mask-origin",
13708 "mask-size",
13709 "mask-composite"
13710 ],
13711 appliesto: "allElementsSVGContainerElements",
13712 computed: [
13713 "mask-image",
13714 "mask-mode",
13715 "mask-repeat",
13716 "mask-position",
13717 "mask-clip",
13718 "mask-origin",
13719 "mask-size",
13720 "mask-composite"
13721 ],
13722 order: "perGrammar",
13723 stacking: true,
13724 status: "standard"
13725 };
13726 var offset = {
13727 syntax: "[ <'offset-position'>? [ <'offset-path'> [ <'offset-distance'> || <'offset-rotate'> ]? ]? ]! [ / <'offset-anchor'> ]?",
13728 media: "visual",
13729 inherited: false,
13730 animationType: [
13731 "offset-position",
13732 "offset-path",
13733 "offset-distance",
13734 "offset-anchor",
13735 "offset-rotate"
13736 ],
13737 percentages: [
13738 "offset-position",
13739 "offset-distance",
13740 "offset-anchor"
13741 ],
13742 groups: [
13743 "CSS Motion"
13744 ],
13745 initial: [
13746 "offset-position",
13747 "offset-path",
13748 "offset-distance",
13749 "offset-anchor",
13750 "offset-rotate"
13751 ],
13752 appliesto: "transformableElements",
13753 computed: [
13754 "offset-position",
13755 "offset-path",
13756 "offset-distance",
13757 "offset-anchor",
13758 "offset-rotate"
13759 ],
13760 order: "perGrammar",
13761 stacking: true,
13762 status: "experimental"
13763 };
13764 var opacity = {
13765 syntax: "<number>",
13766 media: "visual",
13767 inherited: false,
13768 animationType: "number",
13769 percentages: "no",
13770 groups: [
13771 "CSS Color"
13772 ],
13773 initial: "1.0",
13774 appliesto: "allElements",
13775 computed: "specifiedValueClipped0To1",
13776 order: "uniqueOrder",
13777 alsoAppliesTo: [
13778 "::placeholder"
13779 ],
13780 status: "standard"
13781 };
13782 var order = {
13783 syntax: "<integer>",
13784 media: "visual",
13785 inherited: false,
13786 animationType: "integer",
13787 percentages: "no",
13788 groups: [
13789 "CSS Flexible Box Layout"
13790 ],
13791 initial: "0",
13792 appliesto: "flexItemsAndAbsolutelyPositionedFlexContainerChildren",
13793 computed: "asSpecified",
13794 order: "uniqueOrder",
13795 status: "standard"
13796 };
13797 var orphans = {
13798 syntax: "<integer>",
13799 media: "visual",
13800 inherited: true,
13801 animationType: "discrete",
13802 percentages: "no",
13803 groups: [
13804 "CSS Fragmentation"
13805 ],
13806 initial: "2",
13807 appliesto: "blockContainerElements",
13808 computed: "asSpecified",
13809 order: "perGrammar",
13810 status: "standard"
13811 };
13812 var outline = {
13813 syntax: "[ <'outline-color'> || <'outline-style'> || <'outline-width'> ]",
13814 media: [
13815 "visual",
13816 "interactive"
13817 ],
13818 inherited: false,
13819 animationType: [
13820 "outline-color",
13821 "outline-width",
13822 "outline-style"
13823 ],
13824 percentages: "no",
13825 groups: [
13826 "CSS Basic User Interface"
13827 ],
13828 initial: [
13829 "outline-color",
13830 "outline-style",
13831 "outline-width"
13832 ],
13833 appliesto: "allElements",
13834 computed: [
13835 "outline-color",
13836 "outline-width",
13837 "outline-style"
13838 ],
13839 order: "orderOfAppearance",
13840 status: "standard"
13841 };
13842 var overflow = {
13843 syntax: "[ visible | hidden | clip | scroll | auto ]{1,2}",
13844 media: "visual",
13845 inherited: false,
13846 animationType: "discrete",
13847 percentages: "no",
13848 groups: [
13849 "CSS Overflow"
13850 ],
13851 initial: "visible",
13852 appliesto: "blockContainersFlexContainersGridContainers",
13853 computed: "asSpecified",
13854 order: "uniqueOrder",
13855 status: "standard"
13856 };
13857 var padding = {
13858 syntax: "[ <length> | <percentage> ]{1,4}",
13859 media: "visual",
13860 inherited: false,
13861 animationType: "length",
13862 percentages: "referToWidthOfContainingBlock",
13863 groups: [
13864 "CSS Box Model"
13865 ],
13866 initial: [
13867 "padding-bottom",
13868 "padding-left",
13869 "padding-right",
13870 "padding-top"
13871 ],
13872 appliesto: "allElementsExceptInternalTableDisplayTypes",
13873 computed: [
13874 "padding-bottom",
13875 "padding-left",
13876 "padding-right",
13877 "padding-top"
13878 ],
13879 order: "uniqueOrder",
13880 alsoAppliesTo: [
13881 "::first-letter"
13882 ],
13883 status: "standard"
13884 };
13885 var perspective = {
13886 syntax: "none | <length>",
13887 media: "visual",
13888 inherited: false,
13889 animationType: "length",
13890 percentages: "no",
13891 groups: [
13892 "CSS Transforms"
13893 ],
13894 initial: "none",
13895 appliesto: "transformableElements",
13896 computed: "absoluteLengthOrNone",
13897 order: "uniqueOrder",
13898 stacking: true,
13899 status: "standard"
13900 };
13901 var position = {
13902 syntax: "static | relative | absolute | sticky | fixed",
13903 media: "visual",
13904 inherited: false,
13905 animationType: "discrete",
13906 percentages: "no",
13907 groups: [
13908 "CSS Positioning"
13909 ],
13910 initial: "static",
13911 appliesto: "allElements",
13912 computed: "asSpecified",
13913 order: "uniqueOrder",
13914 stacking: true,
13915 status: "standard"
13916 };
13917 var quotes = {
13918 syntax: "none | [ <string> <string> ]+",
13919 media: "visual",
13920 inherited: true,
13921 animationType: "discrete",
13922 percentages: "no",
13923 groups: [
13924 "CSS Generated Content"
13925 ],
13926 initial: "dependsOnUserAgent",
13927 appliesto: "allElements",
13928 computed: "asSpecified",
13929 order: "uniqueOrder",
13930 status: "standard"
13931 };
13932 var resize = {
13933 syntax: "none | both | horizontal | vertical",
13934 media: "visual",
13935 inherited: false,
13936 animationType: "discrete",
13937 percentages: "no",
13938 groups: [
13939 "CSS Basic User Interface"
13940 ],
13941 initial: "none",
13942 appliesto: "elementsWithOverflowNotVisibleAndReplacedElements",
13943 computed: "asSpecified",
13944 order: "uniqueOrder",
13945 status: "standard"
13946 };
13947 var right = {
13948 syntax: "<length> | <percentage> | auto",
13949 media: "visual",
13950 inherited: false,
13951 animationType: "lpc",
13952 percentages: "referToWidthOfContainingBlock",
13953 groups: [
13954 "CSS Positioning"
13955 ],
13956 initial: "auto",
13957 appliesto: "positionedElements",
13958 computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
13959 order: "uniqueOrder",
13960 status: "standard"
13961 };
13962 var rotate = {
13963 syntax: "none | [ x | y | z | <number>{3} ]? && <angle>",
13964 media: "visual",
13965 inherited: false,
13966 animationType: "transform",
13967 percentages: "no",
13968 groups: [
13969 "CSS Transforms"
13970 ],
13971 initial: "none",
13972 appliesto: "transformableElements",
13973 computed: "asSpecified",
13974 order: "perGrammar",
13975 stacking: true,
13976 status: "standard"
13977 };
13978 var scale = {
13979 syntax: "none | <number>{1,3}",
13980 media: "visual",
13981 inherited: false,
13982 animationType: "transform",
13983 percentages: "no",
13984 groups: [
13985 "CSS Transforms"
13986 ],
13987 initial: "none",
13988 appliesto: "transformableElements",
13989 computed: "asSpecified",
13990 order: "perGrammar",
13991 stacking: true,
13992 status: "standard"
13993 };
13994 var top = {
13995 syntax: "<length> | <percentage> | auto",
13996 media: "visual",
13997 inherited: false,
13998 animationType: "lpc",
13999 percentages: "referToContainingBlockHeight",
14000 groups: [
14001 "CSS Positioning"
14002 ],
14003 initial: "auto",
14004 appliesto: "positionedElements",
14005 computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
14006 order: "uniqueOrder",
14007 status: "standard"
14008 };
14009 var transform = {
14010 syntax: "none | <transform-list>",
14011 media: "visual",
14012 inherited: false,
14013 animationType: "transform",
14014 percentages: "referToSizeOfBoundingBox",
14015 groups: [
14016 "CSS Transforms"
14017 ],
14018 initial: "none",
14019 appliesto: "transformableElements",
14020 computed: "asSpecifiedRelativeToAbsoluteLengths",
14021 order: "uniqueOrder",
14022 stacking: true,
14023 status: "standard"
14024 };
14025 var transition = {
14026 syntax: "<single-transition>#",
14027 media: "interactive",
14028 inherited: false,
14029 animationType: "discrete",
14030 percentages: "no",
14031 groups: [
14032 "CSS Transitions"
14033 ],
14034 initial: [
14035 "transition-delay",
14036 "transition-duration",
14037 "transition-property",
14038 "transition-timing-function"
14039 ],
14040 appliesto: "allElementsAndPseudos",
14041 computed: [
14042 "transition-delay",
14043 "transition-duration",
14044 "transition-property",
14045 "transition-timing-function"
14046 ],
14047 order: "orderOfAppearance",
14048 status: "standard"
14049 };
14050 var translate = {
14051 syntax: "none | <length-percentage> [ <length-percentage> <length>? ]?",
14052 media: "visual",
14053 inherited: false,
14054 animationType: "transform",
14055 percentages: "referToSizeOfBoundingBox",
14056 groups: [
14057 "CSS Transforms"
14058 ],
14059 initial: "none",
14060 appliesto: "transformableElements",
14061 computed: "asSpecifiedRelativeToAbsoluteLengths",
14062 order: "perGrammar",
14063 stacking: true,
14064 status: "standard"
14065 };
14066 var visibility = {
14067 syntax: "visible | hidden | collapse",
14068 media: "visual",
14069 inherited: true,
14070 animationType: "visibility",
14071 percentages: "no",
14072 groups: [
14073 "CSS Box Model"
14074 ],
14075 initial: "visible",
14076 appliesto: "allElements",
14077 computed: "asSpecified",
14078 order: "uniqueOrder",
14079 status: "standard"
14080 };
14081 var widows = {
14082 syntax: "<integer>",
14083 media: "visual",
14084 inherited: true,
14085 animationType: "discrete",
14086 percentages: "no",
14087 groups: [
14088 "CSS Fragmentation"
14089 ],
14090 initial: "2",
14091 appliesto: "blockContainerElements",
14092 computed: "asSpecified",
14093 order: "perGrammar",
14094 status: "standard"
14095 };
14096 var width = {
14097 syntax: "[ <length> | <percentage> ] && [ border-box | content-box ]? | available | min-content | max-content | fit-content | auto",
14098 media: "visual",
14099 inherited: false,
14100 animationType: "lpc",
14101 percentages: "referToWidthOfContainingBlock",
14102 groups: [
14103 "CSS Box Model"
14104 ],
14105 initial: "auto",
14106 appliesto: "allElementsButNonReplacedAndTableRows",
14107 computed: "percentageAutoOrAbsoluteLength",
14108 order: "lengthOrPercentageBeforeKeywordIfBothPresent",
14109 status: "standard"
14110 };
14111 var zoom = {
14112 syntax: "normal | reset | <number> | <percentage>",
14113 media: "visual",
14114 inherited: false,
14115 animationType: "integer",
14116 percentages: "no",
14117 groups: [
14118 "Microsoft Extensions"
14119 ],
14120 initial: "normal",
14121 appliesto: "allElements",
14122 computed: "asSpecified",
14123 order: "uniqueOrder",
14124 status: "nonstandard"
14125 };
14126 var properties$1 = {
14127 "--*": {
14128 syntax: "<declaration-value>",
14129 media: "all",
14130 inherited: true,
14131 animationType: "discrete",
14132 percentages: "no",
14133 groups: [
14134 "CSS Variables"
14135 ],
14136 initial: "seeProse",
14137 appliesto: "allElements",
14138 computed: "asSpecifiedWithVarsSubstituted",
14139 order: "perGrammar",
14140 status: "experimental"
14141 },
14142 "-ms-accelerator": {
14143 syntax: "false | true",
14144 media: "visual",
14145 inherited: false,
14146 animationType: "discrete",
14147 percentages: "no",
14148 groups: [
14149 "Microsoft Extensions"
14150 ],
14151 initial: "false",
14152 appliesto: "allElements",
14153 computed: "asSpecified",
14154 order: "uniqueOrder",
14155 status: "nonstandard"
14156 },
14157 "-ms-block-progression": {
14158 syntax: "tb | rl | bt | lr",
14159 media: "visual",
14160 inherited: false,
14161 animationType: "discrete",
14162 percentages: "no",
14163 groups: [
14164 "Microsoft Extensions"
14165 ],
14166 initial: "tb",
14167 appliesto: "allElements",
14168 computed: "asSpecified",
14169 order: "uniqueOrder",
14170 status: "nonstandard"
14171 },
14172 "-ms-content-zoom-chaining": {
14173 syntax: "none | chained",
14174 media: "interactive",
14175 inherited: false,
14176 animationType: "discrete",
14177 percentages: "no",
14178 groups: [
14179 "Microsoft Extensions"
14180 ],
14181 initial: "none",
14182 appliesto: "nonReplacedBlockAndInlineBlockElements",
14183 computed: "asSpecified",
14184 order: "uniqueOrder",
14185 status: "nonstandard"
14186 },
14187 "-ms-content-zooming": {
14188 syntax: "none | zoom",
14189 media: "interactive",
14190 inherited: false,
14191 animationType: "discrete",
14192 percentages: "no",
14193 groups: [
14194 "Microsoft Extensions"
14195 ],
14196 initial: "zoomForTheTopLevelNoneForTheRest",
14197 appliesto: "nonReplacedBlockAndInlineBlockElements",
14198 computed: "asSpecified",
14199 order: "uniqueOrder",
14200 status: "nonstandard"
14201 },
14202 "-ms-content-zoom-limit": {
14203 syntax: "<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>",
14204 media: "interactive",
14205 inherited: false,
14206 animationType: "discrete",
14207 percentages: [
14208 "-ms-content-zoom-limit-max",
14209 "-ms-content-zoom-limit-min"
14210 ],
14211 groups: [
14212 "Microsoft Extensions"
14213 ],
14214 initial: [
14215 "-ms-content-zoom-limit-max",
14216 "-ms-content-zoom-limit-min"
14217 ],
14218 appliesto: "nonReplacedBlockAndInlineBlockElements",
14219 computed: [
14220 "-ms-content-zoom-limit-max",
14221 "-ms-content-zoom-limit-min"
14222 ],
14223 order: "uniqueOrder",
14224 status: "nonstandard"
14225 },
14226 "-ms-content-zoom-limit-max": {
14227 syntax: "<percentage>",
14228 media: "interactive",
14229 inherited: false,
14230 animationType: "discrete",
14231 percentages: "maxZoomFactor",
14232 groups: [
14233 "Microsoft Extensions"
14234 ],
14235 initial: "400%",
14236 appliesto: "nonReplacedBlockAndInlineBlockElements",
14237 computed: "asSpecified",
14238 order: "uniqueOrder",
14239 status: "nonstandard"
14240 },
14241 "-ms-content-zoom-limit-min": {
14242 syntax: "<percentage>",
14243 media: "interactive",
14244 inherited: false,
14245 animationType: "discrete",
14246 percentages: "minZoomFactor",
14247 groups: [
14248 "Microsoft Extensions"
14249 ],
14250 initial: "100%",
14251 appliesto: "nonReplacedBlockAndInlineBlockElements",
14252 computed: "asSpecified",
14253 order: "uniqueOrder",
14254 status: "nonstandard"
14255 },
14256 "-ms-content-zoom-snap": {
14257 syntax: "<'-ms-content-zoom-snap-type'> || <'-ms-content-zoom-snap-points'>",
14258 media: "interactive",
14259 inherited: false,
14260 animationType: "discrete",
14261 percentages: "no",
14262 groups: [
14263 "Microsoft Extensions"
14264 ],
14265 initial: [
14266 "-ms-content-zoom-snap-type",
14267 "-ms-content-zoom-snap-points"
14268 ],
14269 appliesto: "nonReplacedBlockAndInlineBlockElements",
14270 computed: [
14271 "-ms-content-zoom-snap-type",
14272 "-ms-content-zoom-snap-points"
14273 ],
14274 order: "uniqueOrder",
14275 status: "nonstandard"
14276 },
14277 "-ms-content-zoom-snap-points": {
14278 syntax: "snapInterval( <percentage>, <percentage> ) | snapList( <percentage># )",
14279 media: "interactive",
14280 inherited: false,
14281 animationType: "discrete",
14282 percentages: "no",
14283 groups: [
14284 "Microsoft Extensions"
14285 ],
14286 initial: "snapInterval(0%, 100%)",
14287 appliesto: "nonReplacedBlockAndInlineBlockElements",
14288 computed: "asSpecified",
14289 order: "uniqueOrder",
14290 status: "nonstandard"
14291 },
14292 "-ms-content-zoom-snap-type": {
14293 syntax: "none | proximity | mandatory",
14294 media: "interactive",
14295 inherited: false,
14296 animationType: "discrete",
14297 percentages: "no",
14298 groups: [
14299 "Microsoft Extensions"
14300 ],
14301 initial: "none",
14302 appliesto: "nonReplacedBlockAndInlineBlockElements",
14303 computed: "asSpecified",
14304 order: "uniqueOrder",
14305 status: "nonstandard"
14306 },
14307 "-ms-filter": {
14308 syntax: "<string>",
14309 media: "visual",
14310 inherited: false,
14311 animationType: "discrete",
14312 percentages: "no",
14313 groups: [
14314 "Microsoft Extensions"
14315 ],
14316 initial: "\"\"",
14317 appliesto: "allElements",
14318 computed: "asSpecified",
14319 order: "uniqueOrder",
14320 status: "nonstandard"
14321 },
14322 "-ms-flow-from": {
14323 syntax: "[ none | <custom-ident> ]#",
14324 media: "visual",
14325 inherited: false,
14326 animationType: "discrete",
14327 percentages: "no",
14328 groups: [
14329 "Microsoft Extensions"
14330 ],
14331 initial: "none",
14332 appliesto: "nonReplacedElements",
14333 computed: "asSpecified",
14334 order: "uniqueOrder",
14335 status: "nonstandard"
14336 },
14337 "-ms-flow-into": {
14338 syntax: "[ none | <custom-ident> ]#",
14339 media: "visual",
14340 inherited: false,
14341 animationType: "discrete",
14342 percentages: "no",
14343 groups: [
14344 "Microsoft Extensions"
14345 ],
14346 initial: "none",
14347 appliesto: "iframeElements",
14348 computed: "asSpecified",
14349 order: "uniqueOrder",
14350 status: "nonstandard"
14351 },
14352 "-ms-high-contrast-adjust": {
14353 syntax: "auto | none",
14354 media: "visual",
14355 inherited: true,
14356 animationType: "discrete",
14357 percentages: "no",
14358 groups: [
14359 "Microsoft Extensions"
14360 ],
14361 initial: "auto",
14362 appliesto: "allElements",
14363 computed: "asSpecified",
14364 order: "uniqueOrder",
14365 status: "nonstandard"
14366 },
14367 "-ms-hyphenate-limit-chars": {
14368 syntax: "auto | <integer>{1,3}",
14369 media: "visual",
14370 inherited: true,
14371 animationType: "discrete",
14372 percentages: "no",
14373 groups: [
14374 "Microsoft Extensions"
14375 ],
14376 initial: "auto",
14377 appliesto: "allElements",
14378 computed: "asSpecified",
14379 order: "uniqueOrder",
14380 status: "nonstandard"
14381 },
14382 "-ms-hyphenate-limit-lines": {
14383 syntax: "no-limit | <integer>",
14384 media: "visual",
14385 inherited: true,
14386 animationType: "discrete",
14387 percentages: "no",
14388 groups: [
14389 "Microsoft Extensions"
14390 ],
14391 initial: "no-limit",
14392 appliesto: "blockContainerElements",
14393 computed: "asSpecified",
14394 order: "uniqueOrder",
14395 status: "nonstandard"
14396 },
14397 "-ms-hyphenate-limit-zone": {
14398 syntax: "<percentage> | <length>",
14399 media: "visual",
14400 inherited: true,
14401 animationType: "discrete",
14402 percentages: "referToLineBoxWidth",
14403 groups: [
14404 "Microsoft Extensions"
14405 ],
14406 initial: "0",
14407 appliesto: "blockContainerElements",
14408 computed: "asSpecified",
14409 order: "uniqueOrder",
14410 status: "nonstandard"
14411 },
14412 "-ms-ime-align": {
14413 syntax: "auto | after",
14414 media: "visual",
14415 inherited: false,
14416 animationType: "discrete",
14417 percentages: "no",
14418 groups: [
14419 "Microsoft Extensions"
14420 ],
14421 initial: "auto",
14422 appliesto: "allElements",
14423 computed: "asSpecified",
14424 order: "uniqueOrder",
14425 status: "nonstandard"
14426 },
14427 "-ms-overflow-style": {
14428 syntax: "auto | none | scrollbar | -ms-autohiding-scrollbar",
14429 media: "interactive",
14430 inherited: true,
14431 animationType: "discrete",
14432 percentages: "no",
14433 groups: [
14434 "Microsoft Extensions"
14435 ],
14436 initial: "auto",
14437 appliesto: "nonReplacedBlockAndInlineBlockElements",
14438 computed: "asSpecified",
14439 order: "uniqueOrder",
14440 status: "nonstandard"
14441 },
14442 "-ms-scrollbar-3dlight-color": {
14443 syntax: "<color>",
14444 media: "visual",
14445 inherited: true,
14446 animationType: "discrete",
14447 percentages: "no",
14448 groups: [
14449 "Microsoft Extensions"
14450 ],
14451 initial: "dependsOnUserAgent",
14452 appliesto: "allElements",
14453 computed: "asSpecified",
14454 order: "uniqueOrder",
14455 status: "nonstandard"
14456 },
14457 "-ms-scrollbar-arrow-color": {
14458 syntax: "<color>",
14459 media: "visual",
14460 inherited: true,
14461 animationType: "discrete",
14462 percentages: "no",
14463 groups: [
14464 "Microsoft Extensions"
14465 ],
14466 initial: "ButtonText",
14467 appliesto: "allElements",
14468 computed: "asSpecified",
14469 order: "uniqueOrder",
14470 status: "nonstandard"
14471 },
14472 "-ms-scrollbar-base-color": {
14473 syntax: "<color>",
14474 media: "visual",
14475 inherited: true,
14476 animationType: "discrete",
14477 percentages: "no",
14478 groups: [
14479 "Microsoft Extensions"
14480 ],
14481 initial: "dependsOnUserAgent",
14482 appliesto: "allElements",
14483 computed: "asSpecified",
14484 order: "uniqueOrder",
14485 status: "nonstandard"
14486 },
14487 "-ms-scrollbar-darkshadow-color": {
14488 syntax: "<color>",
14489 media: "visual",
14490 inherited: true,
14491 animationType: "discrete",
14492 percentages: "no",
14493 groups: [
14494 "Microsoft Extensions"
14495 ],
14496 initial: "ThreeDDarkShadow",
14497 appliesto: "allElements",
14498 computed: "asSpecified",
14499 order: "uniqueOrder",
14500 status: "nonstandard"
14501 },
14502 "-ms-scrollbar-face-color": {
14503 syntax: "<color>",
14504 media: "visual",
14505 inherited: true,
14506 animationType: "discrete",
14507 percentages: "no",
14508 groups: [
14509 "Microsoft Extensions"
14510 ],
14511 initial: "ThreeDFace",
14512 appliesto: "allElements",
14513 computed: "asSpecified",
14514 order: "uniqueOrder",
14515 status: "nonstandard"
14516 },
14517 "-ms-scrollbar-highlight-color": {
14518 syntax: "<color>",
14519 media: "visual",
14520 inherited: true,
14521 animationType: "discrete",
14522 percentages: "no",
14523 groups: [
14524 "Microsoft Extensions"
14525 ],
14526 initial: "ThreeDHighlight",
14527 appliesto: "allElements",
14528 computed: "asSpecified",
14529 order: "uniqueOrder",
14530 status: "nonstandard"
14531 },
14532 "-ms-scrollbar-shadow-color": {
14533 syntax: "<color>",
14534 media: "visual",
14535 inherited: true,
14536 animationType: "discrete",
14537 percentages: "no",
14538 groups: [
14539 "Microsoft Extensions"
14540 ],
14541 initial: "ThreeDDarkShadow",
14542 appliesto: "allElements",
14543 computed: "asSpecified",
14544 order: "uniqueOrder",
14545 status: "nonstandard"
14546 },
14547 "-ms-scrollbar-track-color": {
14548 syntax: "<color>",
14549 media: "visual",
14550 inherited: true,
14551 animationType: "discrete",
14552 percentages: "no",
14553 groups: [
14554 "Microsoft Extensions"
14555 ],
14556 initial: "Scrollbar",
14557 appliesto: "allElements",
14558 computed: "asSpecified",
14559 order: "uniqueOrder",
14560 status: "nonstandard"
14561 },
14562 "-ms-scroll-chaining": {
14563 syntax: "chained | none",
14564 media: "interactive",
14565 inherited: false,
14566 animationType: "discrete",
14567 percentages: "no",
14568 groups: [
14569 "Microsoft Extensions"
14570 ],
14571 initial: "chained",
14572 appliesto: "nonReplacedBlockAndInlineBlockElements",
14573 computed: "asSpecified",
14574 order: "uniqueOrder",
14575 status: "nonstandard"
14576 },
14577 "-ms-scroll-limit": {
14578 syntax: "<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>",
14579 media: "interactive",
14580 inherited: false,
14581 animationType: "discrete",
14582 percentages: "no",
14583 groups: [
14584 "Microsoft Extensions"
14585 ],
14586 initial: [
14587 "-ms-scroll-limit-x-min",
14588 "-ms-scroll-limit-y-min",
14589 "-ms-scroll-limit-x-max",
14590 "-ms-scroll-limit-y-max"
14591 ],
14592 appliesto: "nonReplacedBlockAndInlineBlockElements",
14593 computed: [
14594 "-ms-scroll-limit-x-min",
14595 "-ms-scroll-limit-y-min",
14596 "-ms-scroll-limit-x-max",
14597 "-ms-scroll-limit-y-max"
14598 ],
14599 order: "uniqueOrder",
14600 status: "nonstandard"
14601 },
14602 "-ms-scroll-limit-x-max": {
14603 syntax: "auto | <length>",
14604 media: "interactive",
14605 inherited: false,
14606 animationType: "discrete",
14607 percentages: "no",
14608 groups: [
14609 "Microsoft Extensions"
14610 ],
14611 initial: "auto",
14612 appliesto: "nonReplacedBlockAndInlineBlockElements",
14613 computed: "asSpecified",
14614 order: "uniqueOrder",
14615 status: "nonstandard"
14616 },
14617 "-ms-scroll-limit-x-min": {
14618 syntax: "<length>",
14619 media: "interactive",
14620 inherited: false,
14621 animationType: "discrete",
14622 percentages: "no",
14623 groups: [
14624 "Microsoft Extensions"
14625 ],
14626 initial: "0",
14627 appliesto: "nonReplacedBlockAndInlineBlockElements",
14628 computed: "asSpecified",
14629 order: "uniqueOrder",
14630 status: "nonstandard"
14631 },
14632 "-ms-scroll-limit-y-max": {
14633 syntax: "auto | <length>",
14634 media: "interactive",
14635 inherited: false,
14636 animationType: "discrete",
14637 percentages: "no",
14638 groups: [
14639 "Microsoft Extensions"
14640 ],
14641 initial: "auto",
14642 appliesto: "nonReplacedBlockAndInlineBlockElements",
14643 computed: "asSpecified",
14644 order: "uniqueOrder",
14645 status: "nonstandard"
14646 },
14647 "-ms-scroll-limit-y-min": {
14648 syntax: "<length>",
14649 media: "interactive",
14650 inherited: false,
14651 animationType: "discrete",
14652 percentages: "no",
14653 groups: [
14654 "Microsoft Extensions"
14655 ],
14656 initial: "0",
14657 appliesto: "nonReplacedBlockAndInlineBlockElements",
14658 computed: "asSpecified",
14659 order: "uniqueOrder",
14660 status: "nonstandard"
14661 },
14662 "-ms-scroll-rails": {
14663 syntax: "none | railed",
14664 media: "interactive",
14665 inherited: false,
14666 animationType: "discrete",
14667 percentages: "no",
14668 groups: [
14669 "Microsoft Extensions"
14670 ],
14671 initial: "railed",
14672 appliesto: "nonReplacedBlockAndInlineBlockElements",
14673 computed: "asSpecified",
14674 order: "uniqueOrder",
14675 status: "nonstandard"
14676 },
14677 "-ms-scroll-snap-points-x": {
14678 syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
14679 media: "interactive",
14680 inherited: false,
14681 animationType: "discrete",
14682 percentages: "no",
14683 groups: [
14684 "Microsoft Extensions"
14685 ],
14686 initial: "snapInterval(0px, 100%)",
14687 appliesto: "nonReplacedBlockAndInlineBlockElements",
14688 computed: "asSpecified",
14689 order: "uniqueOrder",
14690 status: "nonstandard"
14691 },
14692 "-ms-scroll-snap-points-y": {
14693 syntax: "snapInterval( <length-percentage>, <length-percentage> ) | snapList( <length-percentage># )",
14694 media: "interactive",
14695 inherited: false,
14696 animationType: "discrete",
14697 percentages: "no",
14698 groups: [
14699 "Microsoft Extensions"
14700 ],
14701 initial: "snapInterval(0px, 100%)",
14702 appliesto: "nonReplacedBlockAndInlineBlockElements",
14703 computed: "asSpecified",
14704 order: "uniqueOrder",
14705 status: "nonstandard"
14706 },
14707 "-ms-scroll-snap-type": {
14708 syntax: "none | proximity | mandatory",
14709 media: "interactive",
14710 inherited: false,
14711 animationType: "discrete",
14712 percentages: "no",
14713 groups: [
14714 "Microsoft Extensions"
14715 ],
14716 initial: "none",
14717 appliesto: "nonReplacedBlockAndInlineBlockElements",
14718 computed: "asSpecified",
14719 order: "uniqueOrder",
14720 status: "nonstandard"
14721 },
14722 "-ms-scroll-snap-x": {
14723 syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>",
14724 media: "interactive",
14725 inherited: false,
14726 animationType: "discrete",
14727 percentages: "no",
14728 groups: [
14729 "Microsoft Extensions"
14730 ],
14731 initial: [
14732 "-ms-scroll-snap-type",
14733 "-ms-scroll-snap-points-x"
14734 ],
14735 appliesto: "nonReplacedBlockAndInlineBlockElements",
14736 computed: [
14737 "-ms-scroll-snap-type",
14738 "-ms-scroll-snap-points-x"
14739 ],
14740 order: "uniqueOrder",
14741 status: "nonstandard"
14742 },
14743 "-ms-scroll-snap-y": {
14744 syntax: "<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>",
14745 media: "interactive",
14746 inherited: false,
14747 animationType: "discrete",
14748 percentages: "no",
14749 groups: [
14750 "Microsoft Extensions"
14751 ],
14752 initial: [
14753 "-ms-scroll-snap-type",
14754 "-ms-scroll-snap-points-y"
14755 ],
14756 appliesto: "nonReplacedBlockAndInlineBlockElements",
14757 computed: [
14758 "-ms-scroll-snap-type",
14759 "-ms-scroll-snap-points-y"
14760 ],
14761 order: "uniqueOrder",
14762 status: "nonstandard"
14763 },
14764 "-ms-scroll-translation": {
14765 syntax: "none | vertical-to-horizontal",
14766 media: "interactive",
14767 inherited: true,
14768 animationType: "discrete",
14769 percentages: "no",
14770 groups: [
14771 "Microsoft Extensions"
14772 ],
14773 initial: "none",
14774 appliesto: "allElements",
14775 computed: "asSpecified",
14776 order: "uniqueOrder",
14777 status: "nonstandard"
14778 },
14779 "-ms-text-autospace": {
14780 syntax: "none | ideograph-alpha | ideograph-numeric | ideograph-parenthesis | ideograph-space",
14781 media: "visual",
14782 inherited: false,
14783 animationType: "discrete",
14784 percentages: "no",
14785 groups: [
14786 "Microsoft Extensions"
14787 ],
14788 initial: "none",
14789 appliesto: "allElements",
14790 computed: "asSpecified",
14791 order: "uniqueOrder",
14792 status: "nonstandard"
14793 },
14794 "-ms-touch-select": {
14795 syntax: "grippers | none",
14796 media: "interactive",
14797 inherited: true,
14798 animationType: "discrete",
14799 percentages: "no",
14800 groups: [
14801 "Microsoft Extensions"
14802 ],
14803 initial: "grippers",
14804 appliesto: "allElements",
14805 computed: "asSpecified",
14806 order: "uniqueOrder",
14807 status: "nonstandard"
14808 },
14809 "-ms-user-select": {
14810 syntax: "none | element | text",
14811 media: "interactive",
14812 inherited: false,
14813 animationType: "discrete",
14814 percentages: "no",
14815 groups: [
14816 "Microsoft Extensions"
14817 ],
14818 initial: "text",
14819 appliesto: "nonReplacedElements",
14820 computed: "asSpecified",
14821 order: "uniqueOrder",
14822 status: "nonstandard"
14823 },
14824 "-ms-wrap-flow": {
14825 syntax: "auto | both | start | end | maximum | clear",
14826 media: "visual",
14827 inherited: false,
14828 animationType: "discrete",
14829 percentages: "no",
14830 groups: [
14831 "Microsoft Extensions"
14832 ],
14833 initial: "auto",
14834 appliesto: "blockLevelElements",
14835 computed: "asSpecified",
14836 order: "uniqueOrder",
14837 status: "nonstandard"
14838 },
14839 "-ms-wrap-margin": {
14840 syntax: "<length>",
14841 media: "visual",
14842 inherited: false,
14843 animationType: "discrete",
14844 percentages: "no",
14845 groups: [
14846 "Microsoft Extensions"
14847 ],
14848 initial: "0",
14849 appliesto: "exclusionElements",
14850 computed: "asSpecified",
14851 order: "uniqueOrder",
14852 status: "nonstandard"
14853 },
14854 "-ms-wrap-through": {
14855 syntax: "wrap | none",
14856 media: "visual",
14857 inherited: false,
14858 animationType: "discrete",
14859 percentages: "no",
14860 groups: [
14861 "Microsoft Extensions"
14862 ],
14863 initial: "wrap",
14864 appliesto: "blockLevelElements",
14865 computed: "asSpecified",
14866 order: "uniqueOrder",
14867 status: "nonstandard"
14868 },
14869 "-moz-appearance": {
14870 syntax: "none | button | button-arrow-down | button-arrow-next | button-arrow-previous | button-arrow-up | button-bevel | button-focus | caret | checkbox | checkbox-container | checkbox-label | checkmenuitem | dualbutton | groupbox | listbox | listitem | menuarrow | menubar | menucheckbox | menuimage | menuitem | menuitemtext | menulist | menulist-button | menulist-text | menulist-textfield | menupopup | menuradio | menuseparator | meterbar | meterchunk | progressbar | progressbar-vertical | progresschunk | progresschunk-vertical | radio | radio-container | radio-label | radiomenuitem | range | range-thumb | resizer | resizerpanel | scale-horizontal | scalethumbend | scalethumb-horizontal | scalethumbstart | scalethumbtick | scalethumb-vertical | scale-vertical | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | separator | sheet | spinner | spinner-downbutton | spinner-textfield | spinner-upbutton | splitter | statusbar | statusbarpanel | tab | tabpanel | tabpanels | tab-scroll-arrow-back | tab-scroll-arrow-forward | textfield | textfield-multiline | toolbar | toolbarbutton | toolbarbutton-dropdown | toolbargripper | toolbox | tooltip | treeheader | treeheadercell | treeheadersortarrow | treeitem | treeline | treetwisty | treetwistyopen | treeview | -moz-mac-unified-toolbar | -moz-win-borderless-glass | -moz-win-browsertabbar-toolbox | -moz-win-communicationstext | -moz-win-communications-toolbox | -moz-win-exclude-glass | -moz-win-glass | -moz-win-mediatext | -moz-win-media-toolbox | -moz-window-button-box | -moz-window-button-box-maximized | -moz-window-button-close | -moz-window-button-maximize | -moz-window-button-minimize | -moz-window-button-restore | -moz-window-frame-bottom | -moz-window-frame-left | -moz-window-frame-right | -moz-window-titlebar | -moz-window-titlebar-maximized",
14871 media: "visual",
14872 inherited: false,
14873 animationType: "discrete",
14874 percentages: "no",
14875 groups: [
14876 "Mozilla Extensions",
14877 "WebKit Extensions"
14878 ],
14879 initial: "noneButOverriddenInUserAgentCSS",
14880 appliesto: "allElements",
14881 computed: "asSpecified",
14882 order: "uniqueOrder",
14883 status: "nonstandard"
14884 },
14885 "-moz-binding": {
14886 syntax: "<url> | none",
14887 media: "visual",
14888 inherited: false,
14889 animationType: "discrete",
14890 percentages: "no",
14891 groups: [
14892 "Mozilla Extensions"
14893 ],
14894 initial: "none",
14895 appliesto: "allElementsExceptGeneratedContentOrPseudoElements",
14896 computed: "asSpecified",
14897 order: "uniqueOrder",
14898 status: "nonstandard"
14899 },
14900 "-moz-border-bottom-colors": {
14901 syntax: "<color>+ | none",
14902 media: "visual",
14903 inherited: false,
14904 animationType: "discrete",
14905 percentages: "no",
14906 groups: [
14907 "Mozilla Extensions"
14908 ],
14909 initial: "none",
14910 appliesto: "allElements",
14911 computed: "asSpecified",
14912 order: "uniqueOrder",
14913 status: "nonstandard"
14914 },
14915 "-moz-border-left-colors": {
14916 syntax: "<color>+ | none",
14917 media: "visual",
14918 inherited: false,
14919 animationType: "discrete",
14920 percentages: "no",
14921 groups: [
14922 "Mozilla Extensions"
14923 ],
14924 initial: "none",
14925 appliesto: "allElements",
14926 computed: "asSpecified",
14927 order: "uniqueOrder",
14928 status: "nonstandard"
14929 },
14930 "-moz-border-right-colors": {
14931 syntax: "<color>+ | none",
14932 media: "visual",
14933 inherited: false,
14934 animationType: "discrete",
14935 percentages: "no",
14936 groups: [
14937 "Mozilla Extensions"
14938 ],
14939 initial: "none",
14940 appliesto: "allElements",
14941 computed: "asSpecified",
14942 order: "uniqueOrder",
14943 status: "nonstandard"
14944 },
14945 "-moz-border-top-colors": {
14946 syntax: "<color>+ | none",
14947 media: "visual",
14948 inherited: false,
14949 animationType: "discrete",
14950 percentages: "no",
14951 groups: [
14952 "Mozilla Extensions"
14953 ],
14954 initial: "none",
14955 appliesto: "allElements",
14956 computed: "asSpecified",
14957 order: "uniqueOrder",
14958 status: "nonstandard"
14959 },
14960 "-moz-context-properties": {
14961 syntax: "none | [ fill | fill-opacity | stroke | stroke-opacity ]#",
14962 media: "visual",
14963 inherited: true,
14964 animationType: "discrete",
14965 percentages: "no",
14966 groups: [
14967 "Mozilla Extensions"
14968 ],
14969 initial: "none",
14970 appliesto: "allElementsThatCanReferenceImages",
14971 computed: "asSpecified",
14972 order: "uniqueOrder",
14973 status: "nonstandard"
14974 },
14975 "-moz-float-edge": {
14976 syntax: "border-box | content-box | margin-box | padding-box",
14977 media: "visual",
14978 inherited: false,
14979 animationType: "discrete",
14980 percentages: "no",
14981 groups: [
14982 "Mozilla Extensions"
14983 ],
14984 initial: "content-box",
14985 appliesto: "allElements",
14986 computed: "asSpecified",
14987 order: "uniqueOrder",
14988 status: "nonstandard"
14989 },
14990 "-moz-force-broken-image-icon": {
14991 syntax: "<integer>",
14992 media: "visual",
14993 inherited: false,
14994 animationType: "discrete",
14995 percentages: "no",
14996 groups: [
14997 "Mozilla Extensions"
14998 ],
14999 initial: "0",
15000 appliesto: "images",
15001 computed: "asSpecified",
15002 order: "uniqueOrder",
15003 status: "nonstandard"
15004 },
15005 "-moz-image-region": {
15006 syntax: "<shape> | auto",
15007 media: "visual",
15008 inherited: true,
15009 animationType: "discrete",
15010 percentages: "no",
15011 groups: [
15012 "Mozilla Extensions"
15013 ],
15014 initial: "auto",
15015 appliesto: "xulImageElements",
15016 computed: "asSpecified",
15017 order: "uniqueOrder",
15018 status: "nonstandard"
15019 },
15020 "-moz-orient": {
15021 syntax: "inline | block | horizontal | vertical",
15022 media: "visual",
15023 inherited: false,
15024 animationType: "discrete",
15025 percentages: "no",
15026 groups: [
15027 "Mozilla Extensions"
15028 ],
15029 initial: "inline",
15030 appliesto: "anyElementEffectOnProgressAndMeter",
15031 computed: "asSpecified",
15032 order: "uniqueOrder",
15033 status: "nonstandard"
15034 },
15035 "-moz-outline-radius": {
15036 syntax: "<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?",
15037 media: "visual",
15038 inherited: false,
15039 animationType: [
15040 "-moz-outline-radius-topleft",
15041 "-moz-outline-radius-topright",
15042 "-moz-outline-radius-bottomright",
15043 "-moz-outline-radius-bottomleft"
15044 ],
15045 percentages: [
15046 "-moz-outline-radius-topleft",
15047 "-moz-outline-radius-topright",
15048 "-moz-outline-radius-bottomright",
15049 "-moz-outline-radius-bottomleft"
15050 ],
15051 groups: [
15052 "Mozilla Extensions"
15053 ],
15054 initial: [
15055 "-moz-outline-radius-topleft",
15056 "-moz-outline-radius-topright",
15057 "-moz-outline-radius-bottomright",
15058 "-moz-outline-radius-bottomleft"
15059 ],
15060 appliesto: "allElements",
15061 computed: [
15062 "-moz-outline-radius-topleft",
15063 "-moz-outline-radius-topright",
15064 "-moz-outline-radius-bottomright",
15065 "-moz-outline-radius-bottomleft"
15066 ],
15067 order: "uniqueOrder",
15068 status: "nonstandard"
15069 },
15070 "-moz-outline-radius-bottomleft": {
15071 syntax: "<outline-radius>",
15072 media: "visual",
15073 inherited: false,
15074 animationType: "lpc",
15075 percentages: "referToDimensionOfBorderBox",
15076 groups: [
15077 "Mozilla Extensions"
15078 ],
15079 initial: "0",
15080 appliesto: "allElements",
15081 computed: "asSpecified",
15082 order: "uniqueOrder",
15083 status: "nonstandard"
15084 },
15085 "-moz-outline-radius-bottomright": {
15086 syntax: "<outline-radius>",
15087 media: "visual",
15088 inherited: false,
15089 animationType: "lpc",
15090 percentages: "referToDimensionOfBorderBox",
15091 groups: [
15092 "Mozilla Extensions"
15093 ],
15094 initial: "0",
15095 appliesto: "allElements",
15096 computed: "asSpecified",
15097 order: "uniqueOrder",
15098 status: "nonstandard"
15099 },
15100 "-moz-outline-radius-topleft": {
15101 syntax: "<outline-radius>",
15102 media: "visual",
15103 inherited: false,
15104 animationType: "lpc",
15105 percentages: "referToDimensionOfBorderBox",
15106 groups: [
15107 "Mozilla Extensions"
15108 ],
15109 initial: "0",
15110 appliesto: "allElements",
15111 computed: "asSpecified",
15112 order: "uniqueOrder",
15113 status: "nonstandard"
15114 },
15115 "-moz-outline-radius-topright": {
15116 syntax: "<outline-radius>",
15117 media: "visual",
15118 inherited: false,
15119 animationType: "lpc",
15120 percentages: "referToDimensionOfBorderBox",
15121 groups: [
15122 "Mozilla Extensions"
15123 ],
15124 initial: "0",
15125 appliesto: "allElements",
15126 computed: "asSpecified",
15127 order: "uniqueOrder",
15128 status: "nonstandard"
15129 },
15130 "-moz-stack-sizing": {
15131 syntax: "ignore | stretch-to-fit",
15132 media: "visual",
15133 inherited: true,
15134 animationType: "discrete",
15135 percentages: "no",
15136 groups: [
15137 "Mozilla Extensions"
15138 ],
15139 initial: "stretch-to-fit",
15140 appliesto: "allElements",
15141 computed: "asSpecified",
15142 order: "uniqueOrder",
15143 status: "nonstandard"
15144 },
15145 "-moz-text-blink": {
15146 syntax: "none | blink",
15147 media: "visual",
15148 inherited: false,
15149 animationType: "discrete",
15150 percentages: "no",
15151 groups: [
15152 "Mozilla Extensions"
15153 ],
15154 initial: "none",
15155 appliesto: "allElements",
15156 computed: "asSpecified",
15157 order: "uniqueOrder",
15158 status: "nonstandard"
15159 },
15160 "-moz-user-focus": {
15161 syntax: "ignore | normal | select-after | select-before | select-menu | select-same | select-all | none",
15162 media: "interactive",
15163 inherited: false,
15164 animationType: "discrete",
15165 percentages: "no",
15166 groups: [
15167 "Mozilla Extensions"
15168 ],
15169 initial: "none",
15170 appliesto: "allElements",
15171 computed: "asSpecified",
15172 order: "uniqueOrder",
15173 status: "nonstandard"
15174 },
15175 "-moz-user-input": {
15176 syntax: "auto | none | enabled | disabled",
15177 media: "visual",
15178 inherited: true,
15179 animationType: "discrete",
15180 percentages: "no",
15181 groups: [
15182 "Mozilla Extensions"
15183 ],
15184 initial: "auto",
15185 appliesto: "allElements",
15186 computed: "asSpecified",
15187 order: "uniqueOrder",
15188 status: "nonstandard"
15189 },
15190 "-moz-user-modify": {
15191 syntax: "read-only | read-write | write-only",
15192 media: "interactive",
15193 inherited: true,
15194 animationType: "discrete",
15195 percentages: "no",
15196 groups: [
15197 "Mozilla Extensions"
15198 ],
15199 initial: "read-only",
15200 appliesto: "allElements",
15201 computed: "asSpecified",
15202 order: "uniqueOrder",
15203 status: "nonstandard"
15204 },
15205 "-moz-window-dragging": {
15206 syntax: "drag | no-drag",
15207 media: "visual",
15208 inherited: false,
15209 animationType: "discrete",
15210 percentages: "no",
15211 groups: [
15212 "Mozilla Extensions"
15213 ],
15214 initial: "drag",
15215 appliesto: "allElementsCreatingNativeWindows",
15216 computed: "asSpecified",
15217 order: "uniqueOrder",
15218 status: "nonstandard"
15219 },
15220 "-moz-window-shadow": {
15221 syntax: "default | menu | tooltip | sheet | none",
15222 media: "visual",
15223 inherited: false,
15224 animationType: "discrete",
15225 percentages: "no",
15226 groups: [
15227 "Mozilla Extensions"
15228 ],
15229 initial: "default",
15230 appliesto: "allElementsCreatingNativeWindows",
15231 computed: "asSpecified",
15232 order: "uniqueOrder",
15233 status: "nonstandard"
15234 },
15235 "-webkit-appearance": {
15236 syntax: "none | button | button-bevel | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield",
15237 media: "visual",
15238 inherited: false,
15239 animationType: "discrete",
15240 percentages: "no",
15241 groups: [
15242 "WebKit Extensions"
15243 ],
15244 initial: "noneButOverriddenInUserAgentCSS",
15245 appliesto: "allElements",
15246 computed: "asSpecified",
15247 order: "uniqueOrder",
15248 status: "nonstandard"
15249 },
15250 "-webkit-border-before": {
15251 syntax: "<'border-width'> || <'border-style'> || <'color'>",
15252 media: "visual",
15253 inherited: true,
15254 animationType: "discrete",
15255 percentages: [
15256 "-webkit-border-before-width"
15257 ],
15258 groups: [
15259 "WebKit Extensions"
15260 ],
15261 initial: [
15262 "border-width",
15263 "border-style",
15264 "color"
15265 ],
15266 appliesto: "allElements",
15267 computed: [
15268 "border-width",
15269 "border-style",
15270 "color"
15271 ],
15272 order: "uniqueOrder",
15273 status: "nonstandard"
15274 },
15275 "-webkit-border-before-color": {
15276 syntax: "<'color'>",
15277 media: "visual",
15278 inherited: true,
15279 animationType: "discrete",
15280 percentages: "no",
15281 groups: [
15282 "WebKit Extensions"
15283 ],
15284 initial: "currentcolor",
15285 appliesto: "allElements",
15286 computed: "computedColor",
15287 order: "uniqueOrder",
15288 status: "nonstandard"
15289 },
15290 "-webkit-border-before-style": {
15291 syntax: "<'border-style'>",
15292 media: "visual",
15293 inherited: true,
15294 animationType: "discrete",
15295 percentages: "no",
15296 groups: [
15297 "WebKit Extensions"
15298 ],
15299 initial: "none",
15300 appliesto: "allElements",
15301 computed: "asSpecified",
15302 order: "uniqueOrder",
15303 status: "nonstandard"
15304 },
15305 "-webkit-border-before-width": {
15306 syntax: "<'border-width'>",
15307 media: "visual",
15308 inherited: true,
15309 animationType: "discrete",
15310 percentages: "logicalWidthOfContainingBlock",
15311 groups: [
15312 "WebKit Extensions"
15313 ],
15314 initial: "medium",
15315 appliesto: "allElements",
15316 computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
15317 order: "uniqueOrder",
15318 status: "nonstandard"
15319 },
15320 "-webkit-box-reflect": {
15321 syntax: "[ above | below | right | left ]? <length>? <image>?",
15322 media: "visual",
15323 inherited: false,
15324 animationType: "discrete",
15325 percentages: "no",
15326 groups: [
15327 "WebKit Extensions"
15328 ],
15329 initial: "none",
15330 appliesto: "allElements",
15331 computed: "asSpecified",
15332 order: "uniqueOrder",
15333 status: "nonstandard"
15334 },
15335 "-webkit-mask": {
15336 syntax: "[ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#",
15337 media: "visual",
15338 inherited: false,
15339 animationType: "discrete",
15340 percentages: "no",
15341 groups: [
15342 "WebKit Extensions"
15343 ],
15344 initial: [
15345 "-webkit-mask-image",
15346 "-webkit-mask-repeat",
15347 "-webkit-mask-attachment",
15348 "-webkit-mask-position",
15349 "-webkit-mask-origin",
15350 "-webkit-mask-clip"
15351 ],
15352 appliesto: "allElements",
15353 computed: [
15354 "-webkit-mask-image",
15355 "-webkit-mask-repeat",
15356 "-webkit-mask-attachment",
15357 "-webkit-mask-position",
15358 "-webkit-mask-origin",
15359 "-webkit-mask-clip"
15360 ],
15361 order: "uniqueOrder",
15362 status: "nonstandard"
15363 },
15364 "-webkit-mask-attachment": {
15365 syntax: "<attachment>#",
15366 media: "visual",
15367 inherited: false,
15368 animationType: "discrete",
15369 percentages: "no",
15370 groups: [
15371 "WebKit Extensions"
15372 ],
15373 initial: "scroll",
15374 appliesto: "allElements",
15375 computed: "asSpecified",
15376 order: "orderOfAppearance",
15377 status: "nonstandard"
15378 },
15379 "-webkit-mask-clip": {
15380 syntax: "[ <box> | border | padding | content | text ]#",
15381 media: "visual",
15382 inherited: false,
15383 animationType: "discrete",
15384 percentages: "no",
15385 groups: [
15386 "WebKit Extensions"
15387 ],
15388 initial: "border",
15389 appliesto: "allElements",
15390 computed: "asSpecified",
15391 order: "orderOfAppearance",
15392 status: "nonstandard"
15393 },
15394 "-webkit-mask-composite": {
15395 syntax: "<composite-style>#",
15396 media: "visual",
15397 inherited: false,
15398 animationType: "discrete",
15399 percentages: "no",
15400 groups: [
15401 "WebKit Extensions"
15402 ],
15403 initial: "source-over",
15404 appliesto: "allElements",
15405 computed: "asSpecified",
15406 order: "orderOfAppearance",
15407 status: "nonstandard"
15408 },
15409 "-webkit-mask-image": {
15410 syntax: "<mask-reference>#",
15411 media: "visual",
15412 inherited: false,
15413 animationType: "discrete",
15414 percentages: "no",
15415 groups: [
15416 "WebKit Extensions"
15417 ],
15418 initial: "none",
15419 appliesto: "allElements",
15420 computed: "absoluteURIOrNone",
15421 order: "orderOfAppearance",
15422 status: "nonstandard"
15423 },
15424 "-webkit-mask-origin": {
15425 syntax: "[ <box> | border | padding | content ]#",
15426 media: "visual",
15427 inherited: false,
15428 animationType: "discrete",
15429 percentages: "no",
15430 groups: [
15431 "WebKit Extensions"
15432 ],
15433 initial: "padding",
15434 appliesto: "allElements",
15435 computed: "asSpecified",
15436 order: "orderOfAppearance",
15437 status: "nonstandard"
15438 },
15439 "-webkit-mask-position": {
15440 syntax: "<position>#",
15441 media: "visual",
15442 inherited: false,
15443 animationType: "discrete",
15444 percentages: "referToSizeOfElement",
15445 groups: [
15446 "WebKit Extensions"
15447 ],
15448 initial: "0% 0%",
15449 appliesto: "allElements",
15450 computed: "absoluteLengthOrPercentage",
15451 order: "orderOfAppearance",
15452 status: "nonstandard"
15453 },
15454 "-webkit-mask-position-x": {
15455 syntax: "[ <length-percentage> | left | center | right ]#",
15456 media: "visual",
15457 inherited: false,
15458 animationType: "discrete",
15459 percentages: "referToSizeOfElement",
15460 groups: [
15461 "WebKit Extensions"
15462 ],
15463 initial: "0%",
15464 appliesto: "allElements",
15465 computed: "absoluteLengthOrPercentage",
15466 order: "orderOfAppearance",
15467 status: "nonstandard"
15468 },
15469 "-webkit-mask-position-y": {
15470 syntax: "[ <length-percentage> | top | center | bottom ]#",
15471 media: "visual",
15472 inherited: false,
15473 animationType: "discrete",
15474 percentages: "referToSizeOfElement",
15475 groups: [
15476 "WebKit Extensions"
15477 ],
15478 initial: "0%",
15479 appliesto: "allElements",
15480 computed: "absoluteLengthOrPercentage",
15481 order: "orderOfAppearance",
15482 status: "nonstandard"
15483 },
15484 "-webkit-mask-repeat": {
15485 syntax: "<repeat-style>#",
15486 media: "visual",
15487 inherited: false,
15488 animationType: "discrete",
15489 percentages: "no",
15490 groups: [
15491 "WebKit Extensions"
15492 ],
15493 initial: "repeat",
15494 appliesto: "allElements",
15495 computed: "asSpecified",
15496 order: "orderOfAppearance",
15497 status: "nonstandard"
15498 },
15499 "-webkit-mask-repeat-x": {
15500 syntax: "repeat | no-repeat | space | round",
15501 media: "visual",
15502 inherited: false,
15503 animationType: "discrete",
15504 percentages: "no",
15505 groups: [
15506 "WebKit Extensions"
15507 ],
15508 initial: "repeat",
15509 appliesto: "allElements",
15510 computed: "asSpecified",
15511 order: "orderOfAppearance",
15512 status: "nonstandard"
15513 },
15514 "-webkit-mask-repeat-y": {
15515 syntax: "repeat | no-repeat | space | round",
15516 media: "visual",
15517 inherited: false,
15518 animationType: "discrete",
15519 percentages: "no",
15520 groups: [
15521 "WebKit Extensions"
15522 ],
15523 initial: "repeat",
15524 appliesto: "allElements",
15525 computed: "absoluteLengthOrPercentage",
15526 order: "orderOfAppearance",
15527 status: "nonstandard"
15528 },
15529 "-webkit-mask-size": {
15530 syntax: "<bg-size>#",
15531 media: "visual",
15532 inherited: false,
15533 animationType: "discrete",
15534 percentages: "relativeToBackgroundPositioningArea",
15535 groups: [
15536 "WebKit Extensions"
15537 ],
15538 initial: "auto auto",
15539 appliesto: "allElements",
15540 computed: "asSpecified",
15541 order: "orderOfAppearance",
15542 status: "nonstandard"
15543 },
15544 "-webkit-overflow-scrolling": {
15545 syntax: "auto | touch",
15546 media: "visual",
15547 inherited: false,
15548 animationType: "discrete",
15549 percentages: "no",
15550 groups: [
15551 "WebKit Extensions"
15552 ],
15553 initial: "auto",
15554 appliesto: "scrollingBoxes",
15555 computed: "asSpecified",
15556 order: "orderOfAppearance",
15557 status: "nonstandard"
15558 },
15559 "-webkit-tap-highlight-color": {
15560 syntax: "<color>",
15561 media: "visual",
15562 inherited: false,
15563 animationType: "discrete",
15564 percentages: "no",
15565 groups: [
15566 "WebKit Extensions"
15567 ],
15568 initial: "black",
15569 appliesto: "allElements",
15570 computed: "asSpecified",
15571 order: "uniqueOrder",
15572 status: "nonstandard"
15573 },
15574 "-webkit-text-fill-color": {
15575 syntax: "<color>",
15576 media: "visual",
15577 inherited: true,
15578 animationType: "color",
15579 percentages: "no",
15580 groups: [
15581 "WebKit Extensions"
15582 ],
15583 initial: "currentcolor",
15584 appliesto: "allElements",
15585 computed: "computedColor",
15586 order: "uniqueOrder",
15587 status: "nonstandard"
15588 },
15589 "-webkit-text-stroke": {
15590 syntax: "<length> || <color>",
15591 media: "visual",
15592 inherited: true,
15593 animationType: [
15594 "-webkit-text-stroke-width",
15595 "-webkit-text-stroke-color"
15596 ],
15597 percentages: "no",
15598 groups: [
15599 "WebKit Extensions"
15600 ],
15601 initial: [
15602 "-webkit-text-stroke-width",
15603 "-webkit-text-stroke-color"
15604 ],
15605 appliesto: "allElements",
15606 computed: [
15607 "-webkit-text-stroke-width",
15608 "-webkit-text-stroke-color"
15609 ],
15610 order: "canonicalOrder",
15611 status: "nonstandard"
15612 },
15613 "-webkit-text-stroke-color": {
15614 syntax: "<color>",
15615 media: "visual",
15616 inherited: true,
15617 animationType: "color",
15618 percentages: "no",
15619 groups: [
15620 "WebKit Extensions"
15621 ],
15622 initial: "currentcolor",
15623 appliesto: "allElements",
15624 computed: "computedColor",
15625 order: "uniqueOrder",
15626 status: "nonstandard"
15627 },
15628 "-webkit-text-stroke-width": {
15629 syntax: "<length>",
15630 media: "visual",
15631 inherited: true,
15632 animationType: "discrete",
15633 percentages: "no",
15634 groups: [
15635 "WebKit Extensions"
15636 ],
15637 initial: "0",
15638 appliesto: "allElements",
15639 computed: "absoluteLength",
15640 order: "uniqueOrder",
15641 status: "nonstandard"
15642 },
15643 "-webkit-touch-callout": {
15644 syntax: "default | none",
15645 media: "visual",
15646 inherited: true,
15647 animationType: "discrete",
15648 percentages: "no",
15649 groups: [
15650 "WebKit Extensions"
15651 ],
15652 initial: "default",
15653 appliesto: "allElements",
15654 computed: "asSpecified",
15655 order: "uniqueOrder",
15656 status: "nonstandard"
15657 },
15658 "-webkit-user-modify": {
15659 syntax: "read-only | read-write | read-write-plaintext-only",
15660 media: "interactive",
15661 inherited: true,
15662 animationType: "discrete",
15663 percentages: "no",
15664 groups: [
15665 "WebKit Extensions"
15666 ],
15667 initial: "read-only",
15668 appliesto: "allElements",
15669 computed: "asSpecified",
15670 order: "uniqueOrder",
15671 status: "nonstandard"
15672 },
15673 "align-content": {
15674 syntax: "normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>",
15675 media: "visual",
15676 inherited: false,
15677 animationType: "discrete",
15678 percentages: "no",
15679 groups: [
15680 "CSS Flexible Box Layout"
15681 ],
15682 initial: "normal",
15683 appliesto: "multilineFlexContainers",
15684 computed: "asSpecified",
15685 order: "uniqueOrder",
15686 status: "standard"
15687 },
15688 "align-items": {
15689 syntax: "normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]",
15690 media: "visual",
15691 inherited: false,
15692 animationType: "discrete",
15693 percentages: "no",
15694 groups: [
15695 "CSS Flexible Box Layout"
15696 ],
15697 initial: "normal",
15698 appliesto: "allElements",
15699 computed: "asSpecified",
15700 order: "uniqueOrder",
15701 status: "standard"
15702 },
15703 "align-self": {
15704 syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? <self-position>",
15705 media: "visual",
15706 inherited: false,
15707 animationType: "discrete",
15708 percentages: "no",
15709 groups: [
15710 "CSS Flexible Box Layout"
15711 ],
15712 initial: "auto",
15713 appliesto: "flexItemsGridItemsAndAbsolutelyPositionedBoxes",
15714 computed: "autoOnAbsolutelyPositionedElementsValueOfAlignItemsOnParent",
15715 order: "uniqueOrder",
15716 status: "standard"
15717 },
15718 all: all,
15719 animation: animation,
15720 "animation-delay": {
15721 syntax: "<time>#",
15722 media: "visual",
15723 inherited: false,
15724 animationType: "discrete",
15725 percentages: "no",
15726 groups: [
15727 "CSS Animations"
15728 ],
15729 initial: "0s",
15730 appliesto: "allElementsAndPseudos",
15731 computed: "asSpecified",
15732 order: "uniqueOrder",
15733 status: "standard"
15734 },
15735 "animation-direction": {
15736 syntax: "<single-animation-direction>#",
15737 media: "visual",
15738 inherited: false,
15739 animationType: "discrete",
15740 percentages: "no",
15741 groups: [
15742 "CSS Animations"
15743 ],
15744 initial: "normal",
15745 appliesto: "allElementsAndPseudos",
15746 computed: "asSpecified",
15747 order: "uniqueOrder",
15748 status: "standard"
15749 },
15750 "animation-duration": {
15751 syntax: "<time>#",
15752 media: "visual",
15753 inherited: false,
15754 animationType: "discrete",
15755 percentages: "no",
15756 groups: [
15757 "CSS Animations"
15758 ],
15759 initial: "0s",
15760 appliesto: "allElementsAndPseudos",
15761 computed: "asSpecified",
15762 order: "uniqueOrder",
15763 status: "standard"
15764 },
15765 "animation-fill-mode": {
15766 syntax: "<single-animation-fill-mode>#",
15767 media: "visual",
15768 inherited: false,
15769 animationType: "discrete",
15770 percentages: "no",
15771 groups: [
15772 "CSS Animations"
15773 ],
15774 initial: "none",
15775 appliesto: "allElementsAndPseudos",
15776 computed: "asSpecified",
15777 order: "uniqueOrder",
15778 status: "standard"
15779 },
15780 "animation-iteration-count": {
15781 syntax: "<single-animation-iteration-count>#",
15782 media: "visual",
15783 inherited: false,
15784 animationType: "discrete",
15785 percentages: "no",
15786 groups: [
15787 "CSS Animations"
15788 ],
15789 initial: "1",
15790 appliesto: "allElementsAndPseudos",
15791 computed: "asSpecified",
15792 order: "uniqueOrder",
15793 status: "standard"
15794 },
15795 "animation-name": {
15796 syntax: "[ none | <keyframes-name> ]#",
15797 media: "visual",
15798 inherited: false,
15799 animationType: "discrete",
15800 percentages: "no",
15801 groups: [
15802 "CSS Animations"
15803 ],
15804 initial: "none",
15805 appliesto: "allElementsAndPseudos",
15806 computed: "asSpecified",
15807 order: "uniqueOrder",
15808 status: "standard"
15809 },
15810 "animation-play-state": {
15811 syntax: "<single-animation-play-state>#",
15812 media: "visual",
15813 inherited: false,
15814 animationType: "discrete",
15815 percentages: "no",
15816 groups: [
15817 "CSS Animations"
15818 ],
15819 initial: "running",
15820 appliesto: "allElementsAndPseudos",
15821 computed: "asSpecified",
15822 order: "uniqueOrder",
15823 status: "standard"
15824 },
15825 "animation-timing-function": {
15826 syntax: "<single-timing-function>#",
15827 media: "visual",
15828 inherited: false,
15829 animationType: "discrete",
15830 percentages: "no",
15831 groups: [
15832 "CSS Animations"
15833 ],
15834 initial: "ease",
15835 appliesto: "allElementsAndPseudos",
15836 computed: "asSpecified",
15837 order: "uniqueOrder",
15838 status: "standard"
15839 },
15840 appearance: appearance,
15841 azimuth: azimuth,
15842 "backdrop-filter": {
15843 syntax: "none | <filter-function-list>",
15844 media: "visual",
15845 inherited: false,
15846 animationType: "filterList",
15847 percentages: "no",
15848 groups: [
15849 "Filter Effects"
15850 ],
15851 initial: "none",
15852 appliesto: "allElementsSVGContainerElements",
15853 computed: "asSpecified",
15854 order: "uniqueOrder",
15855 status: "experimental"
15856 },
15857 "backface-visibility": {
15858 syntax: "visible | hidden",
15859 media: "visual",
15860 inherited: false,
15861 animationType: "discrete",
15862 percentages: "no",
15863 groups: [
15864 "CSS Transforms"
15865 ],
15866 initial: "visible",
15867 appliesto: "transformableElements",
15868 computed: "asSpecified",
15869 order: "uniqueOrder",
15870 status: "standard"
15871 },
15872 background: background,
15873 "background-attachment": {
15874 syntax: "<attachment>#",
15875 media: "visual",
15876 inherited: false,
15877 animationType: "discrete",
15878 percentages: "no",
15879 groups: [
15880 "CSS Backgrounds and Borders"
15881 ],
15882 initial: "scroll",
15883 appliesto: "allElements",
15884 computed: "asSpecified",
15885 order: "uniqueOrder",
15886 alsoAppliesTo: [
15887 "::first-letter",
15888 "::first-line",
15889 "::placeholder"
15890 ],
15891 status: "standard"
15892 },
15893 "background-blend-mode": {
15894 syntax: "<blend-mode>#",
15895 media: "none",
15896 inherited: false,
15897 animationType: "discrete",
15898 percentages: "no",
15899 groups: [
15900 "Compositing and Blending"
15901 ],
15902 initial: "normal",
15903 appliesto: "allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
15904 computed: "asSpecified",
15905 order: "uniqueOrder",
15906 alsoAppliesTo: [
15907 "::first-letter",
15908 "::first-line",
15909 "::placeholder"
15910 ],
15911 status: "standard"
15912 },
15913 "background-clip": {
15914 syntax: "<box>#",
15915 media: "visual",
15916 inherited: false,
15917 animationType: "discrete",
15918 percentages: "no",
15919 groups: [
15920 "CSS Backgrounds and Borders"
15921 ],
15922 initial: "border-box",
15923 appliesto: "allElements",
15924 computed: "asSpecified",
15925 order: "uniqueOrder",
15926 alsoAppliesTo: [
15927 "::first-letter",
15928 "::first-line",
15929 "::placeholder"
15930 ],
15931 status: "standard"
15932 },
15933 "background-color": {
15934 syntax: "<color>",
15935 media: "visual",
15936 inherited: false,
15937 animationType: "color",
15938 percentages: "no",
15939 groups: [
15940 "CSS Backgrounds and Borders"
15941 ],
15942 initial: "transparent",
15943 appliesto: "allElements",
15944 computed: "computedColor",
15945 order: "uniqueOrder",
15946 alsoAppliesTo: [
15947 "::first-letter",
15948 "::first-line",
15949 "::placeholder"
15950 ],
15951 status: "standard"
15952 },
15953 "background-image": {
15954 syntax: "<bg-image>#",
15955 media: "visual",
15956 inherited: false,
15957 animationType: "discrete",
15958 percentages: "no",
15959 groups: [
15960 "CSS Backgrounds and Borders"
15961 ],
15962 initial: "none",
15963 appliesto: "allElements",
15964 computed: "asSpecifiedURLsAbsolute",
15965 order: "uniqueOrder",
15966 alsoAppliesTo: [
15967 "::first-letter",
15968 "::first-line",
15969 "::placeholder"
15970 ],
15971 status: "standard"
15972 },
15973 "background-origin": {
15974 syntax: "<box>#",
15975 media: "visual",
15976 inherited: false,
15977 animationType: "discrete",
15978 percentages: "no",
15979 groups: [
15980 "CSS Backgrounds and Borders"
15981 ],
15982 initial: "padding-box",
15983 appliesto: "allElements",
15984 computed: "asSpecified",
15985 order: "uniqueOrder",
15986 alsoAppliesTo: [
15987 "::first-letter",
15988 "::first-line",
15989 "::placeholder"
15990 ],
15991 status: "standard"
15992 },
15993 "background-position": {
15994 syntax: "<bg-position>#",
15995 media: "visual",
15996 inherited: false,
15997 animationType: "repeatableListOfSimpleListOfLpc",
15998 percentages: "referToSizeOfBackgroundPositioningAreaMinusBackgroundImageSize",
15999 groups: [
16000 "CSS Backgrounds and Borders"
16001 ],
16002 initial: "0% 0%",
16003 appliesto: "allElements",
16004 computed: "listEachItemTwoKeywordsOriginOffsets",
16005 order: "uniqueOrder",
16006 alsoAppliesTo: [
16007 "::first-letter",
16008 "::first-line",
16009 "::placeholder"
16010 ],
16011 status: "standard"
16012 },
16013 "background-position-x": {
16014 syntax: "[ center | [ left | right | x-start | x-end ]? <length-percentage>? ]#",
16015 media: "visual",
16016 inherited: false,
16017 animationType: "discrete",
16018 percentages: "referToWidthOfBackgroundPositioningAreaMinusBackgroundImageHeight",
16019 groups: [
16020 "CSS Backgrounds and Borders"
16021 ],
16022 initial: "left",
16023 appliesto: "allElements",
16024 computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
16025 order: "uniqueOrder",
16026 status: "experimental"
16027 },
16028 "background-position-y": {
16029 syntax: "[ center | [ top | bottom | y-start | y-end ]? <length-percentage>? ]#",
16030 media: "visual",
16031 inherited: false,
16032 animationType: "discrete",
16033 percentages: "referToHeightOfBackgroundPositioningAreaMinusBackgroundImageHeight",
16034 groups: [
16035 "CSS Backgrounds and Borders"
16036 ],
16037 initial: "top",
16038 appliesto: "allElements",
16039 computed: "listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
16040 order: "uniqueOrder",
16041 status: "experimental"
16042 },
16043 "background-repeat": {
16044 syntax: "<repeat-style>#",
16045 media: "visual",
16046 inherited: false,
16047 animationType: "discrete",
16048 percentages: "no",
16049 groups: [
16050 "CSS Backgrounds and Borders"
16051 ],
16052 initial: "repeat",
16053 appliesto: "allElements",
16054 computed: "listEachItemHasTwoKeywordsOnePerDimension",
16055 order: "uniqueOrder",
16056 alsoAppliesTo: [
16057 "::first-letter",
16058 "::first-line",
16059 "::placeholder"
16060 ],
16061 status: "standard"
16062 },
16063 "background-size": {
16064 syntax: "<bg-size>#",
16065 media: "visual",
16066 inherited: false,
16067 animationType: "repeatableListOfSimpleListOfLpc",
16068 percentages: "relativeToBackgroundPositioningArea",
16069 groups: [
16070 "CSS Backgrounds and Borders"
16071 ],
16072 initial: "auto auto",
16073 appliesto: "allElements",
16074 computed: "asSpecifiedRelativeToAbsoluteLengths",
16075 order: "uniqueOrder",
16076 alsoAppliesTo: [
16077 "::first-letter",
16078 "::first-line",
16079 "::placeholder"
16080 ],
16081 status: "standard"
16082 },
16083 "block-overflow": {
16084 syntax: "clip | ellipsis | <string>",
16085 media: "visual",
16086 inherited: true,
16087 animationType: "discrete",
16088 percentages: "no",
16089 groups: [
16090 "CSS Overflow"
16091 ],
16092 initial: "clip",
16093 appliesto: "blockContainers",
16094 computed: "asSpecified",
16095 order: "perGrammar",
16096 status: "experimental"
16097 },
16098 "block-size": {
16099 syntax: "<'width'>",
16100 media: "visual",
16101 inherited: false,
16102 animationType: "discrete",
16103 percentages: "blockSizeOfContainingBlock",
16104 groups: [
16105 "CSS Logical Properties"
16106 ],
16107 initial: "auto",
16108 appliesto: "sameAsWidthAndHeight",
16109 computed: "sameAsWidthAndHeight",
16110 order: "uniqueOrder",
16111 status: "standard"
16112 },
16113 border: border,
16114 "border-block-end": {
16115 syntax: "<'border-width'> || <'border-style'> || <'color'>",
16116 media: "visual",
16117 inherited: false,
16118 animationType: "discrete",
16119 percentages: "no",
16120 groups: [
16121 "CSS Logical Properties"
16122 ],
16123 initial: [
16124 "border-width",
16125 "border-style",
16126 "color"
16127 ],
16128 appliesto: "allElements",
16129 computed: [
16130 "border-width",
16131 "border-style",
16132 "border-block-end-color"
16133 ],
16134 order: "uniqueOrder",
16135 status: "standard"
16136 },
16137 "border-block-end-color": {
16138 syntax: "<'color'>",
16139 media: "visual",
16140 inherited: false,
16141 animationType: "discrete",
16142 percentages: "no",
16143 groups: [
16144 "CSS Logical Properties"
16145 ],
16146 initial: "currentcolor",
16147 appliesto: "allElements",
16148 computed: "computedColor",
16149 order: "uniqueOrder",
16150 status: "standard"
16151 },
16152 "border-block-end-style": {
16153 syntax: "<'border-style'>",
16154 media: "visual",
16155 inherited: false,
16156 animationType: "discrete",
16157 percentages: "no",
16158 groups: [
16159 "CSS Logical Properties"
16160 ],
16161 initial: "none",
16162 appliesto: "allElements",
16163 computed: "asSpecified",
16164 order: "uniqueOrder",
16165 status: "standard"
16166 },
16167 "border-block-end-width": {
16168 syntax: "<'border-width'>",
16169 media: "visual",
16170 inherited: false,
16171 animationType: "discrete",
16172 percentages: "logicalWidthOfContainingBlock",
16173 groups: [
16174 "CSS Logical Properties"
16175 ],
16176 initial: "medium",
16177 appliesto: "allElements",
16178 computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
16179 order: "uniqueOrder",
16180 status: "standard"
16181 },
16182 "border-block-start": {
16183 syntax: "<'border-width'> || <'border-style'> || <'color'>",
16184 media: "visual",
16185 inherited: false,
16186 animationType: "discrete",
16187 percentages: "no",
16188 groups: [
16189 "CSS Logical Properties"
16190 ],
16191 initial: [
16192 "border-width",
16193 "border-style",
16194 "color"
16195 ],
16196 appliesto: "allElements",
16197 computed: [
16198 "border-width",
16199 "border-style",
16200 "border-block-start-color"
16201 ],
16202 order: "uniqueOrder",
16203 status: "standard"
16204 },
16205 "border-block-start-color": {
16206 syntax: "<'color'>",
16207 media: "visual",
16208 inherited: false,
16209 animationType: "discrete",
16210 percentages: "no",
16211 groups: [
16212 "CSS Logical Properties"
16213 ],
16214 initial: "currentcolor",
16215 appliesto: "allElements",
16216 computed: "computedColor",
16217 order: "uniqueOrder",
16218 status: "standard"
16219 },
16220 "border-block-start-style": {
16221 syntax: "<'border-style'>",
16222 media: "visual",
16223 inherited: false,
16224 animationType: "discrete",
16225 percentages: "no",
16226 groups: [
16227 "CSS Logical Properties"
16228 ],
16229 initial: "none",
16230 appliesto: "allElements",
16231 computed: "asSpecified",
16232 order: "uniqueOrder",
16233 status: "standard"
16234 },
16235 "border-block-start-width": {
16236 syntax: "<'border-width'>",
16237 media: "visual",
16238 inherited: false,
16239 animationType: "discrete",
16240 percentages: "logicalWidthOfContainingBlock",
16241 groups: [
16242 "CSS Logical Properties"
16243 ],
16244 initial: "medium",
16245 appliesto: "allElements",
16246 computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
16247 order: "uniqueOrder",
16248 status: "standard"
16249 },
16250 "border-bottom": {
16251 syntax: "<br-width> || <br-style> || <color>",
16252 media: "visual",
16253 inherited: false,
16254 animationType: [
16255 "border-bottom-color",
16256 "border-bottom-style",
16257 "border-bottom-width"
16258 ],
16259 percentages: "no",
16260 groups: [
16261 "CSS Backgrounds and Borders"
16262 ],
16263 initial: [
16264 "border-bottom-width",
16265 "border-bottom-style",
16266 "border-bottom-color"
16267 ],
16268 appliesto: "allElements",
16269 computed: [
16270 "border-bottom-width",
16271 "border-bottom-style",
16272 "border-bottom-color"
16273 ],
16274 order: "orderOfAppearance",
16275 alsoAppliesTo: [
16276 "::first-letter"
16277 ],
16278 status: "standard"
16279 },
16280 "border-bottom-color": {
16281 syntax: "<color>",
16282 media: "visual",
16283 inherited: false,
16284 animationType: "color",
16285 percentages: "no",
16286 groups: [
16287 "CSS Backgrounds and Borders"
16288 ],
16289 initial: "currentcolor",
16290 appliesto: "allElements",
16291 computed: "computedColor",
16292 order: "uniqueOrder",
16293 alsoAppliesTo: [
16294 "::first-letter"
16295 ],
16296 status: "standard"
16297 },
16298 "border-bottom-left-radius": {
16299 syntax: "<length-percentage>{1,2}",
16300 media: "visual",
16301 inherited: false,
16302 animationType: "lpc",
16303 percentages: "referToDimensionOfBorderBox",
16304 groups: [
16305 "CSS Backgrounds and Borders"
16306 ],
16307 initial: "0",
16308 appliesto: "allElementsUAsNotRequiredWhenCollapse",
16309 computed: "twoAbsoluteLengthOrPercentages",
16310 order: "uniqueOrder",
16311 alsoAppliesTo: [
16312 "::first-letter"
16313 ],
16314 status: "standard"
16315 },
16316 "border-bottom-right-radius": {
16317 syntax: "<length-percentage>{1,2}",
16318 media: "visual",
16319 inherited: false,
16320 animationType: "lpc",
16321 percentages: "referToDimensionOfBorderBox",
16322 groups: [
16323 "CSS Backgrounds and Borders"
16324 ],
16325 initial: "0",
16326 appliesto: "allElementsUAsNotRequiredWhenCollapse",
16327 computed: "twoAbsoluteLengthOrPercentages",
16328 order: "uniqueOrder",
16329 alsoAppliesTo: [
16330 "::first-letter"
16331 ],
16332 status: "standard"
16333 },
16334 "border-bottom-style": {
16335 syntax: "<br-style>",
16336 media: "visual",
16337 inherited: false,
16338 animationType: "discrete",
16339 percentages: "no",
16340 groups: [
16341 "CSS Backgrounds and Borders"
16342 ],
16343 initial: "none",
16344 appliesto: "allElements",
16345 computed: "asSpecified",
16346 order: "uniqueOrder",
16347 alsoAppliesTo: [
16348 "::first-letter"
16349 ],
16350 status: "standard"
16351 },
16352 "border-bottom-width": {
16353 syntax: "<br-width>",
16354 media: "visual",
16355 inherited: false,
16356 animationType: "length",
16357 percentages: "no",
16358 groups: [
16359 "CSS Backgrounds and Borders"
16360 ],
16361 initial: "medium",
16362 appliesto: "allElements",
16363 computed: "absoluteLengthOr0IfBorderBottomStyleNoneOrHidden",
16364 order: "uniqueOrder",
16365 alsoAppliesTo: [
16366 "::first-letter"
16367 ],
16368 status: "standard"
16369 },
16370 "border-collapse": {
16371 syntax: "collapse | separate",
16372 media: "visual",
16373 inherited: true,
16374 animationType: "discrete",
16375 percentages: "no",
16376 groups: [
16377 "CSS Table"
16378 ],
16379 initial: "separate",
16380 appliesto: "tableElements",
16381 computed: "asSpecified",
16382 order: "uniqueOrder",
16383 status: "standard"
16384 },
16385 "border-color": {
16386 syntax: "<color>{1,4}",
16387 media: "visual",
16388 inherited: false,
16389 animationType: [
16390 "border-bottom-color",
16391 "border-left-color",
16392 "border-right-color",
16393 "border-top-color"
16394 ],
16395 percentages: "no",
16396 groups: [
16397 "CSS Backgrounds and Borders"
16398 ],
16399 initial: [
16400 "border-top-color",
16401 "border-right-color",
16402 "border-bottom-color",
16403 "border-left-color"
16404 ],
16405 appliesto: "allElements",
16406 computed: [
16407 "border-bottom-color",
16408 "border-left-color",
16409 "border-right-color",
16410 "border-top-color"
16411 ],
16412 order: "uniqueOrder",
16413 alsoAppliesTo: [
16414 "::first-letter"
16415 ],
16416 status: "standard"
16417 },
16418 "border-image": {
16419 syntax: "<'border-image-source'> || <'border-image-slice'> [ / <'border-image-width'> | / <'border-image-width'>? / <'border-image-outset'> ]? || <'border-image-repeat'>",
16420 media: "visual",
16421 inherited: false,
16422 animationType: "discrete",
16423 percentages: [
16424 "border-image-slice",
16425 "border-image-width"
16426 ],
16427 groups: [
16428 "CSS Backgrounds and Borders"
16429 ],
16430 initial: [
16431 "border-image-source",
16432 "border-image-slice",
16433 "border-image-width",
16434 "border-image-outset",
16435 "border-image-repeat"
16436 ],
16437 appliesto: "allElementsExceptTableElementsWhenCollapse",
16438 computed: [
16439 "border-image-outset",
16440 "border-image-repeat",
16441 "border-image-slice",
16442 "border-image-source",
16443 "border-image-width"
16444 ],
16445 order: "uniqueOrder",
16446 alsoAppliesTo: [
16447 "::first-letter"
16448 ],
16449 status: "standard"
16450 },
16451 "border-image-outset": {
16452 syntax: "[ <length> | <number> ]{1,4}",
16453 media: "visual",
16454 inherited: false,
16455 animationType: "discrete",
16456 percentages: "no",
16457 groups: [
16458 "CSS Backgrounds and Borders"
16459 ],
16460 initial: "0",
16461 appliesto: "allElementsExceptTableElementsWhenCollapse",
16462 computed: "asSpecifiedRelativeToAbsoluteLengths",
16463 order: "uniqueOrder",
16464 alsoAppliesTo: [
16465 "::first-letter"
16466 ],
16467 status: "standard"
16468 },
16469 "border-image-repeat": {
16470 syntax: "[ stretch | repeat | round | space ]{1,2}",
16471 media: "visual",
16472 inherited: false,
16473 animationType: "discrete",
16474 percentages: "no",
16475 groups: [
16476 "CSS Backgrounds and Borders"
16477 ],
16478 initial: "stretch",
16479 appliesto: "allElementsExceptTableElementsWhenCollapse",
16480 computed: "asSpecified",
16481 order: "uniqueOrder",
16482 alsoAppliesTo: [
16483 "::first-letter"
16484 ],
16485 status: "standard"
16486 },
16487 "border-image-slice": {
16488 syntax: "<number-percentage>{1,4} && fill?",
16489 media: "visual",
16490 inherited: false,
16491 animationType: "discrete",
16492 percentages: "referToSizeOfBorderImage",
16493 groups: [
16494 "CSS Backgrounds and Borders"
16495 ],
16496 initial: "100%",
16497 appliesto: "allElementsExceptTableElementsWhenCollapse",
16498 computed: "oneToFourPercentagesOrAbsoluteLengthsPlusFill",
16499 order: "percentagesOrLengthsFollowedByFill",
16500 alsoAppliesTo: [
16501 "::first-letter"
16502 ],
16503 status: "standard"
16504 },
16505 "border-image-source": {
16506 syntax: "none | <image>",
16507 media: "visual",
16508 inherited: false,
16509 animationType: "discrete",
16510 percentages: "no",
16511 groups: [
16512 "CSS Backgrounds and Borders"
16513 ],
16514 initial: "none",
16515 appliesto: "allElementsExceptTableElementsWhenCollapse",
16516 computed: "noneOrImageWithAbsoluteURI",
16517 order: "uniqueOrder",
16518 alsoAppliesTo: [
16519 "::first-letter"
16520 ],
16521 status: "standard"
16522 },
16523 "border-image-width": {
16524 syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
16525 media: "visual",
16526 inherited: false,
16527 animationType: "discrete",
16528 percentages: "referToWidthOrHeightOfBorderImageArea",
16529 groups: [
16530 "CSS Backgrounds and Borders"
16531 ],
16532 initial: "1",
16533 appliesto: "allElementsExceptTableElementsWhenCollapse",
16534 computed: "asSpecifiedRelativeToAbsoluteLengths",
16535 order: "uniqueOrder",
16536 alsoAppliesTo: [
16537 "::first-letter"
16538 ],
16539 status: "standard"
16540 },
16541 "border-inline-end": {
16542 syntax: "<'border-width'> || <'border-style'> || <'color'>",
16543 media: "visual",
16544 inherited: false,
16545 animationType: "discrete",
16546 percentages: "no",
16547 groups: [
16548 "CSS Logical Properties"
16549 ],
16550 initial: [
16551 "border-width",
16552 "border-style",
16553 "color"
16554 ],
16555 appliesto: "allElements",
16556 computed: [
16557 "border-width",
16558 "border-style",
16559 "border-inline-end-color"
16560 ],
16561 order: "uniqueOrder",
16562 status: "standard"
16563 },
16564 "border-inline-end-color": {
16565 syntax: "<'color'>",
16566 media: "visual",
16567 inherited: false,
16568 animationType: "discrete",
16569 percentages: "no",
16570 groups: [
16571 "CSS Logical Properties"
16572 ],
16573 initial: "currentcolor",
16574 appliesto: "allElements",
16575 computed: "computedColor",
16576 order: "uniqueOrder",
16577 status: "standard"
16578 },
16579 "border-inline-end-style": {
16580 syntax: "<'border-style'>",
16581 media: "visual",
16582 inherited: false,
16583 animationType: "discrete",
16584 percentages: "no",
16585 groups: [
16586 "CSS Logical Properties"
16587 ],
16588 initial: "none",
16589 appliesto: "allElements",
16590 computed: "asSpecified",
16591 order: "uniqueOrder",
16592 status: "standard"
16593 },
16594 "border-inline-end-width": {
16595 syntax: "<'border-width'>",
16596 media: "visual",
16597 inherited: false,
16598 animationType: "discrete",
16599 percentages: "logicalWidthOfContainingBlock",
16600 groups: [
16601 "CSS Logical Properties"
16602 ],
16603 initial: "medium",
16604 appliesto: "allElements",
16605 computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
16606 order: "uniqueOrder",
16607 status: "standard"
16608 },
16609 "border-inline-start": {
16610 syntax: "<'border-width'> || <'border-style'> || <'color'>",
16611 media: "visual",
16612 inherited: false,
16613 animationType: "discrete",
16614 percentages: "no",
16615 groups: [
16616 "CSS Logical Properties"
16617 ],
16618 initial: [
16619 "border-width",
16620 "border-style",
16621 "color"
16622 ],
16623 appliesto: "allElements",
16624 computed: [
16625 "border-width",
16626 "border-style",
16627 "border-inline-start-color"
16628 ],
16629 order: "uniqueOrder",
16630 status: "standard"
16631 },
16632 "border-inline-start-color": {
16633 syntax: "<'color'>",
16634 media: "visual",
16635 inherited: false,
16636 animationType: "discrete",
16637 percentages: "no",
16638 groups: [
16639 "CSS Logical Properties"
16640 ],
16641 initial: "currentcolor",
16642 appliesto: "allElements",
16643 computed: "computedColor",
16644 order: "uniqueOrder",
16645 status: "standard"
16646 },
16647 "border-inline-start-style": {
16648 syntax: "<'border-style'>",
16649 media: "visual",
16650 inherited: false,
16651 animationType: "discrete",
16652 percentages: "no",
16653 groups: [
16654 "CSS Logical Properties"
16655 ],
16656 initial: "none",
16657 appliesto: "allElements",
16658 computed: "asSpecified",
16659 order: "uniqueOrder",
16660 status: "standard"
16661 },
16662 "border-inline-start-width": {
16663 syntax: "<'border-width'>",
16664 media: "visual",
16665 inherited: false,
16666 animationType: "discrete",
16667 percentages: "logicalWidthOfContainingBlock",
16668 groups: [
16669 "CSS Logical Properties"
16670 ],
16671 initial: "medium",
16672 appliesto: "allElements",
16673 computed: "absoluteLengthZeroIfBorderStyleNoneOrHidden",
16674 order: "uniqueOrder",
16675 status: "standard"
16676 },
16677 "border-left": {
16678 syntax: "<br-width> || <br-style> || <color>",
16679 media: "visual",
16680 inherited: false,
16681 animationType: [
16682 "border-left-color",
16683 "border-left-style",
16684 "border-left-width"
16685 ],
16686 percentages: "no",
16687 groups: [
16688 "CSS Backgrounds and Borders"
16689 ],
16690 initial: [
16691 "border-left-width",
16692 "border-left-style",
16693 "border-left-color"
16694 ],
16695 appliesto: "allElements",
16696 computed: [
16697 "border-left-width",
16698 "border-left-style",
16699 "border-left-color"
16700 ],
16701 order: "orderOfAppearance",
16702 alsoAppliesTo: [
16703 "::first-letter"
16704 ],
16705 status: "standard"
16706 },
16707 "border-left-color": {
16708 syntax: "<color>",
16709 media: "visual",
16710 inherited: false,
16711 animationType: "color",
16712 percentages: "no",
16713 groups: [
16714 "CSS Backgrounds and Borders"
16715 ],
16716 initial: "currentcolor",
16717 appliesto: "allElements",
16718 computed: "computedColor",
16719 order: "uniqueOrder",
16720 alsoAppliesTo: [
16721 "::first-letter"
16722 ],
16723 status: "standard"
16724 },
16725 "border-left-style": {
16726 syntax: "<br-style>",
16727 media: "visual",
16728 inherited: false,
16729 animationType: "discrete",
16730 percentages: "no",
16731 groups: [
16732 "CSS Backgrounds and Borders"
16733 ],
16734 initial: "none",
16735 appliesto: "allElements",
16736 computed: "asSpecified",
16737 order: "uniqueOrder",
16738 alsoAppliesTo: [
16739 "::first-letter"
16740 ],
16741 status: "standard"
16742 },
16743 "border-left-width": {
16744 syntax: "<br-width>",
16745 media: "visual",
16746 inherited: false,
16747 animationType: "length",
16748 percentages: "no",
16749 groups: [
16750 "CSS Backgrounds and Borders"
16751 ],
16752 initial: "medium",
16753 appliesto: "allElements",
16754 computed: "absoluteLengthOr0IfBorderLeftStyleNoneOrHidden",
16755 order: "uniqueOrder",
16756 alsoAppliesTo: [
16757 "::first-letter"
16758 ],
16759 status: "standard"
16760 },
16761 "border-radius": {
16762 syntax: "<length-percentage>{1,4} [ / <length-percentage>{1,4} ]?",
16763 media: "visual",
16764 inherited: false,
16765 animationType: [
16766 "border-top-left-radius",
16767 "border-top-right-radius",
16768 "border-bottom-right-radius",
16769 "border-bottom-left-radius"
16770 ],
16771 percentages: "referToDimensionOfBorderBox",
16772 groups: [
16773 "CSS Backgrounds and Borders"
16774 ],
16775 initial: [
16776 "border-top-left-radius",
16777 "border-top-right-radius",
16778 "border-bottom-right-radius",
16779 "border-bottom-left-radius"
16780 ],
16781 appliesto: "allElementsUAsNotRequiredWhenCollapse",
16782 computed: [
16783 "border-bottom-left-radius",
16784 "border-bottom-right-radius",
16785 "border-top-left-radius",
16786 "border-top-right-radius"
16787 ],
16788 order: "uniqueOrder",
16789 alsoAppliesTo: [
16790 "::first-letter"
16791 ],
16792 status: "standard"
16793 },
16794 "border-right": {
16795 syntax: "<br-width> || <br-style> || <color>",
16796 media: "visual",
16797 inherited: false,
16798 animationType: [
16799 "border-right-color",
16800 "border-right-style",
16801 "border-right-width"
16802 ],
16803 percentages: "no",
16804 groups: [
16805 "CSS Backgrounds and Borders"
16806 ],
16807 initial: [
16808 "border-right-width",
16809 "border-right-style",
16810 "border-right-color"
16811 ],
16812 appliesto: "allElements",
16813 computed: [
16814 "border-right-width",
16815 "border-right-style",
16816 "border-right-color"
16817 ],
16818 order: "orderOfAppearance",
16819 alsoAppliesTo: [
16820 "::first-letter"
16821 ],
16822 status: "standard"
16823 },
16824 "border-right-color": {
16825 syntax: "<color>",
16826 media: "visual",
16827 inherited: false,
16828 animationType: "color",
16829 percentages: "no",
16830 groups: [
16831 "CSS Backgrounds and Borders"
16832 ],
16833 initial: "currentcolor",
16834 appliesto: "allElements",
16835 computed: "computedColor",
16836 order: "uniqueOrder",
16837 alsoAppliesTo: [
16838 "::first-letter"
16839 ],
16840 status: "standard"
16841 },
16842 "border-right-style": {
16843 syntax: "<br-style>",
16844 media: "visual",
16845 inherited: false,
16846 animationType: "discrete",
16847 percentages: "no",
16848 groups: [
16849 "CSS Backgrounds and Borders"
16850 ],
16851 initial: "none",
16852 appliesto: "allElements",
16853 computed: "asSpecified",
16854 order: "uniqueOrder",
16855 alsoAppliesTo: [
16856 "::first-letter"
16857 ],
16858 status: "standard"
16859 },
16860 "border-right-width": {
16861 syntax: "<br-width>",
16862 media: "visual",
16863 inherited: false,
16864 animationType: "length",
16865 percentages: "no",
16866 groups: [
16867 "CSS Backgrounds and Borders"
16868 ],
16869 initial: "medium",
16870 appliesto: "allElements",
16871 computed: "absoluteLengthOr0IfBorderRightStyleNoneOrHidden",
16872 order: "uniqueOrder",
16873 alsoAppliesTo: [
16874 "::first-letter"
16875 ],
16876 status: "standard"
16877 },
16878 "border-spacing": {
16879 syntax: "<length> <length>?",
16880 media: "visual",
16881 inherited: true,
16882 animationType: "discrete",
16883 percentages: "no",
16884 groups: [
16885 "CSS Table"
16886 ],
16887 initial: "0",
16888 appliesto: "tableElements",
16889 computed: "twoAbsoluteLengths",
16890 order: "uniqueOrder",
16891 status: "standard"
16892 },
16893 "border-style": {
16894 syntax: "<br-style>{1,4}",
16895 media: "visual",
16896 inherited: false,
16897 animationType: "discrete",
16898 percentages: "no",
16899 groups: [
16900 "CSS Backgrounds and Borders"
16901 ],
16902 initial: [
16903 "border-top-style",
16904 "border-right-style",
16905 "border-bottom-style",
16906 "border-left-style"
16907 ],
16908 appliesto: "allElements",
16909 computed: [
16910 "border-bottom-style",
16911 "border-left-style",
16912 "border-right-style",
16913 "border-top-style"
16914 ],
16915 order: "uniqueOrder",
16916 alsoAppliesTo: [
16917 "::first-letter"
16918 ],
16919 status: "standard"
16920 },
16921 "border-top": {
16922 syntax: "<br-width> || <br-style> || <color>",
16923 media: "visual",
16924 inherited: false,
16925 animationType: [
16926 "border-top-color",
16927 "border-top-style",
16928 "border-top-width"
16929 ],
16930 percentages: "no",
16931 groups: [
16932 "CSS Backgrounds and Borders"
16933 ],
16934 initial: [
16935 "border-top-width",
16936 "border-top-style",
16937 "border-top-color"
16938 ],
16939 appliesto: "allElements",
16940 computed: [
16941 "border-top-width",
16942 "border-top-style",
16943 "border-top-color"
16944 ],
16945 order: "orderOfAppearance",
16946 alsoAppliesTo: [
16947 "::first-letter"
16948 ],
16949 status: "standard"
16950 },
16951 "border-top-color": {
16952 syntax: "<color>",
16953 media: "visual",
16954 inherited: false,
16955 animationType: "color",
16956 percentages: "no",
16957 groups: [
16958 "CSS Backgrounds and Borders"
16959 ],
16960 initial: "currentcolor",
16961 appliesto: "allElements",
16962 computed: "computedColor",
16963 order: "uniqueOrder",
16964 alsoAppliesTo: [
16965 "::first-letter"
16966 ],
16967 status: "standard"
16968 },
16969 "border-top-left-radius": {
16970 syntax: "<length-percentage>{1,2}",
16971 media: "visual",
16972 inherited: false,
16973 animationType: "lpc",
16974 percentages: "referToDimensionOfBorderBox",
16975 groups: [
16976 "CSS Backgrounds and Borders"
16977 ],
16978 initial: "0",
16979 appliesto: "allElementsUAsNotRequiredWhenCollapse",
16980 computed: "twoAbsoluteLengthOrPercentages",
16981 order: "uniqueOrder",
16982 alsoAppliesTo: [
16983 "::first-letter"
16984 ],
16985 status: "standard"
16986 },
16987 "border-top-right-radius": {
16988 syntax: "<length-percentage>{1,2}",
16989 media: "visual",
16990 inherited: false,
16991 animationType: "lpc",
16992 percentages: "referToDimensionOfBorderBox",
16993 groups: [
16994 "CSS Backgrounds and Borders"
16995 ],
16996 initial: "0",
16997 appliesto: "allElementsUAsNotRequiredWhenCollapse",
16998 computed: "twoAbsoluteLengthOrPercentages",
16999 order: "uniqueOrder",
17000 alsoAppliesTo: [
17001 "::first-letter"
17002 ],
17003 status: "standard"
17004 },
17005 "border-top-style": {
17006 syntax: "<br-style>",
17007 media: "visual",
17008 inherited: false,
17009 animationType: "discrete",
17010 percentages: "no",
17011 groups: [
17012 "CSS Backgrounds and Borders"
17013 ],
17014 initial: "none",
17015 appliesto: "allElements",
17016 computed: "asSpecified",
17017 order: "uniqueOrder",
17018 alsoAppliesTo: [
17019 "::first-letter"
17020 ],
17021 status: "standard"
17022 },
17023 "border-top-width": {
17024 syntax: "<br-width>",
17025 media: "visual",
17026 inherited: false,
17027 animationType: "length",
17028 percentages: "no",
17029 groups: [
17030 "CSS Backgrounds and Borders"
17031 ],
17032 initial: "medium",
17033 appliesto: "allElements",
17034 computed: "absoluteLengthOr0IfBorderTopStyleNoneOrHidden",
17035 order: "uniqueOrder",
17036 alsoAppliesTo: [
17037 "::first-letter"
17038 ],
17039 status: "standard"
17040 },
17041 "border-width": {
17042 syntax: "<br-width>{1,4}",
17043 media: "visual",
17044 inherited: false,
17045 animationType: [
17046 "border-bottom-width",
17047 "border-left-width",
17048 "border-right-width",
17049 "border-top-width"
17050 ],
17051 percentages: "no",
17052 groups: [
17053 "CSS Backgrounds and Borders"
17054 ],
17055 initial: [
17056 "border-top-width",
17057 "border-right-width",
17058 "border-bottom-width",
17059 "border-left-width"
17060 ],
17061 appliesto: "allElements",
17062 computed: [
17063 "border-bottom-width",
17064 "border-left-width",
17065 "border-right-width",
17066 "border-top-width"
17067 ],
17068 order: "uniqueOrder",
17069 alsoAppliesTo: [
17070 "::first-letter"
17071 ],
17072 status: "standard"
17073 },
17074 bottom: bottom,
17075 "box-align": {
17076 syntax: "start | center | end | baseline | stretch",
17077 media: "visual",
17078 inherited: false,
17079 animationType: "discrete",
17080 percentages: "no",
17081 groups: [
17082 "Mozilla Extensions",
17083 "WebKit Extensions"
17084 ],
17085 initial: "stretch",
17086 appliesto: "elementsWithDisplayBoxOrInlineBox",
17087 computed: "asSpecified",
17088 order: "uniqueOrder",
17089 status: "nonstandard"
17090 },
17091 "box-decoration-break": {
17092 syntax: "slice | clone",
17093 media: "visual",
17094 inherited: false,
17095 animationType: "discrete",
17096 percentages: "no",
17097 groups: [
17098 "CSS Fragmentation"
17099 ],
17100 initial: "slice",
17101 appliesto: "allElements",
17102 computed: "asSpecified",
17103 order: "uniqueOrder",
17104 status: "standard"
17105 },
17106 "box-direction": {
17107 syntax: "normal | reverse | inherit",
17108 media: "visual",
17109 inherited: false,
17110 animationType: "discrete",
17111 percentages: "no",
17112 groups: [
17113 "Mozilla Extensions",
17114 "WebKit Extensions"
17115 ],
17116 initial: "normal",
17117 appliesto: "elementsWithDisplayBoxOrInlineBox",
17118 computed: "asSpecified",
17119 order: "uniqueOrder",
17120 status: "nonstandard"
17121 },
17122 "box-flex": {
17123 syntax: "<number>",
17124 media: "visual",
17125 inherited: false,
17126 animationType: "discrete",
17127 percentages: "no",
17128 groups: [
17129 "Mozilla Extensions",
17130 "WebKit Extensions"
17131 ],
17132 initial: "0",
17133 appliesto: "directChildrenOfElementsWithDisplayMozBoxMozInlineBox",
17134 computed: "asSpecified",
17135 order: "uniqueOrder",
17136 status: "nonstandard"
17137 },
17138 "box-flex-group": {
17139 syntax: "<integer>",
17140 media: "visual",
17141 inherited: false,
17142 animationType: "discrete",
17143 percentages: "no",
17144 groups: [
17145 "Mozilla Extensions",
17146 "WebKit Extensions"
17147 ],
17148 initial: "1",
17149 appliesto: "inFlowChildrenOfBoxElements",
17150 computed: "asSpecified",
17151 order: "uniqueOrder",
17152 status: "nonstandard"
17153 },
17154 "box-lines": {
17155 syntax: "single | multiple",
17156 media: "visual",
17157 inherited: false,
17158 animationType: "discrete",
17159 percentages: "no",
17160 groups: [
17161 "Mozilla Extensions",
17162 "WebKit Extensions"
17163 ],
17164 initial: "single",
17165 appliesto: "boxElements",
17166 computed: "asSpecified",
17167 order: "uniqueOrder",
17168 status: "nonstandard"
17169 },
17170 "box-ordinal-group": {
17171 syntax: "<integer>",
17172 media: "visual",
17173 inherited: false,
17174 animationType: "discrete",
17175 percentages: "no",
17176 groups: [
17177 "Mozilla Extensions",
17178 "WebKit Extensions"
17179 ],
17180 initial: "1",
17181 appliesto: "childrenOfBoxElements",
17182 computed: "asSpecified",
17183 order: "uniqueOrder",
17184 status: "nonstandard"
17185 },
17186 "box-orient": {
17187 syntax: "horizontal | vertical | inline-axis | block-axis | inherit",
17188 media: "visual",
17189 inherited: false,
17190 animationType: "discrete",
17191 percentages: "no",
17192 groups: [
17193 "Mozilla Extensions",
17194 "WebKit Extensions"
17195 ],
17196 initial: "inlineAxisHorizontalInXUL",
17197 appliesto: "elementsWithDisplayBoxOrInlineBox",
17198 computed: "asSpecified",
17199 order: "uniqueOrder",
17200 status: "nonstandard"
17201 },
17202 "box-pack": {
17203 syntax: "start | center | end | justify",
17204 media: "visual",
17205 inherited: false,
17206 animationType: "discrete",
17207 percentages: "no",
17208 groups: [
17209 "Mozilla Extensions",
17210 "WebKit Extensions"
17211 ],
17212 initial: "start",
17213 appliesto: "elementsWithDisplayMozBoxMozInlineBox",
17214 computed: "asSpecified",
17215 order: "uniqueOrder",
17216 status: "nonstandard"
17217 },
17218 "box-shadow": {
17219 syntax: "none | <shadow>#",
17220 media: "visual",
17221 inherited: false,
17222 animationType: "shadowList",
17223 percentages: "no",
17224 groups: [
17225 "CSS Backgrounds and Borders"
17226 ],
17227 initial: "none",
17228 appliesto: "allElements",
17229 computed: "absoluteLengthsSpecifiedColorAsSpecified",
17230 order: "uniqueOrder",
17231 alsoAppliesTo: [
17232 "::first-letter"
17233 ],
17234 status: "standard"
17235 },
17236 "box-sizing": {
17237 syntax: "content-box | border-box",
17238 media: "visual",
17239 inherited: false,
17240 animationType: "discrete",
17241 percentages: "no",
17242 groups: [
17243 "CSS Basic User Interface"
17244 ],
17245 initial: "content-box",
17246 appliesto: "allElementsAcceptingWidthOrHeight",
17247 computed: "asSpecified",
17248 order: "uniqueOrder",
17249 status: "standard"
17250 },
17251 "break-after": {
17252 syntax: "auto | avoid | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
17253 media: "paged",
17254 inherited: false,
17255 animationType: "discrete",
17256 percentages: "no",
17257 groups: [
17258 "CSS Fragmentation"
17259 ],
17260 initial: "auto",
17261 appliesto: "blockLevelElements",
17262 computed: "asSpecified",
17263 order: "uniqueOrder",
17264 status: "standard"
17265 },
17266 "break-before": {
17267 syntax: "auto | avoid | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region",
17268 media: "paged",
17269 inherited: false,
17270 animationType: "discrete",
17271 percentages: "no",
17272 groups: [
17273 "CSS Fragmentation"
17274 ],
17275 initial: "auto",
17276 appliesto: "blockLevelElements",
17277 computed: "asSpecified",
17278 order: "uniqueOrder",
17279 status: "standard"
17280 },
17281 "break-inside": {
17282 syntax: "auto | avoid | avoid-page | avoid-column | avoid-region",
17283 media: "paged",
17284 inherited: false,
17285 animationType: "discrete",
17286 percentages: "no",
17287 groups: [
17288 "CSS Fragmentation"
17289 ],
17290 initial: "auto",
17291 appliesto: "blockLevelElements",
17292 computed: "asSpecified",
17293 order: "uniqueOrder",
17294 status: "standard"
17295 },
17296 "caption-side": {
17297 syntax: "top | bottom | block-start | block-end | inline-start | inline-end",
17298 media: "visual",
17299 inherited: true,
17300 animationType: "discrete",
17301 percentages: "no",
17302 groups: [
17303 "CSS Table"
17304 ],
17305 initial: "top",
17306 appliesto: "tableCaptionElements",
17307 computed: "asSpecified",
17308 order: "uniqueOrder",
17309 status: "standard"
17310 },
17311 "caret-color": {
17312 syntax: "auto | <color>",
17313 media: "interactive",
17314 inherited: true,
17315 animationType: "color",
17316 percentages: "no",
17317 groups: [
17318 "CSS Basic User Interface"
17319 ],
17320 initial: "auto",
17321 appliesto: "allElements",
17322 computed: "asAutoOrColor",
17323 order: "perGrammar",
17324 status: "standard"
17325 },
17326 clear: clear,
17327 clip: clip,
17328 "clip-path": {
17329 syntax: "<clip-source> | [ <basic-shape> || <geometry-box> ] | none",
17330 media: "visual",
17331 inherited: false,
17332 animationType: "basicShapeOtherwiseNo",
17333 percentages: "referToReferenceBoxWhenSpecifiedOtherwiseBorderBox",
17334 groups: [
17335 "CSS Masking"
17336 ],
17337 initial: "none",
17338 appliesto: "allElementsSVGContainerElements",
17339 computed: "asSpecifiedURLsAbsolute",
17340 order: "uniqueOrder",
17341 status: "standard"
17342 },
17343 color: color,
17344 "color-adjust": {
17345 syntax: "economy | exact",
17346 media: "visual",
17347 inherited: true,
17348 animationType: "discrete",
17349 percentages: "no",
17350 groups: [
17351 "CSS Color"
17352 ],
17353 initial: "economy",
17354 appliesto: "allElements",
17355 computed: "asSpecified",
17356 order: "perGrammar",
17357 status: "standard"
17358 },
17359 "column-count": {
17360 syntax: "<integer> | auto",
17361 media: "visual",
17362 inherited: false,
17363 animationType: "integer",
17364 percentages: "no",
17365 groups: [
17366 "CSS Columns"
17367 ],
17368 initial: "auto",
17369 appliesto: "blockContainersExceptTableWrappers",
17370 computed: "asSpecified",
17371 order: "perGrammar",
17372 status: "standard"
17373 },
17374 "column-fill": {
17375 syntax: "auto | balance | balance-all",
17376 media: "visualInContinuousMediaNoEffectInOverflowColumns",
17377 inherited: false,
17378 animationType: "discrete",
17379 percentages: "no",
17380 groups: [
17381 "CSS Columns"
17382 ],
17383 initial: "balance",
17384 appliesto: "multicolElements",
17385 computed: "asSpecified",
17386 order: "perGrammar",
17387 status: "standard"
17388 },
17389 "column-gap": {
17390 syntax: "normal | <length-percentage>",
17391 media: "visual",
17392 inherited: false,
17393 animationType: "lpc",
17394 percentages: "referToDimensionOfContentArea",
17395 groups: [
17396 "CSS Box Alignment"
17397 ],
17398 initial: "normal",
17399 appliesto: "multiColumnElementsFlexContainersGridContainers",
17400 computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
17401 order: "perGrammar",
17402 status: "standard"
17403 },
17404 "column-rule": {
17405 syntax: "<'column-rule-width'> || <'column-rule-style'> || <'column-rule-color'>",
17406 media: "visual",
17407 inherited: false,
17408 animationType: [
17409 "column-rule-color",
17410 "column-rule-style",
17411 "column-rule-width"
17412 ],
17413 percentages: "no",
17414 groups: [
17415 "CSS Columns"
17416 ],
17417 initial: [
17418 "column-rule-width",
17419 "column-rule-style",
17420 "column-rule-color"
17421 ],
17422 appliesto: "multicolElements",
17423 computed: [
17424 "column-rule-color",
17425 "column-rule-style",
17426 "column-rule-width"
17427 ],
17428 order: "perGrammar",
17429 status: "standard"
17430 },
17431 "column-rule-color": {
17432 syntax: "<color>",
17433 media: "visual",
17434 inherited: false,
17435 animationType: "color",
17436 percentages: "no",
17437 groups: [
17438 "CSS Columns"
17439 ],
17440 initial: "currentcolor",
17441 appliesto: "multicolElements",
17442 computed: "computedColor",
17443 order: "perGrammar",
17444 status: "standard"
17445 },
17446 "column-rule-style": {
17447 syntax: "<'border-style'>",
17448 media: "visual",
17449 inherited: false,
17450 animationType: "discrete",
17451 percentages: "no",
17452 groups: [
17453 "CSS Columns"
17454 ],
17455 initial: "none",
17456 appliesto: "multicolElements",
17457 computed: "asSpecified",
17458 order: "perGrammar",
17459 status: "standard"
17460 },
17461 "column-rule-width": {
17462 syntax: "<'border-width'>",
17463 media: "visual",
17464 inherited: false,
17465 animationType: "length",
17466 percentages: "no",
17467 groups: [
17468 "CSS Columns"
17469 ],
17470 initial: "medium",
17471 appliesto: "multicolElements",
17472 computed: "absoluteLength0IfColumnRuleStyleNoneOrHidden",
17473 order: "perGrammar",
17474 status: "standard"
17475 },
17476 "column-span": {
17477 syntax: "none | all",
17478 media: "visual",
17479 inherited: false,
17480 animationType: "discrete",
17481 percentages: "no",
17482 groups: [
17483 "CSS Columns"
17484 ],
17485 initial: "none",
17486 appliesto: "inFlowBlockLevelElements",
17487 computed: "asSpecified",
17488 order: "perGrammar",
17489 status: "standard"
17490 },
17491 "column-width": {
17492 syntax: "<length> | auto",
17493 media: "visual",
17494 inherited: false,
17495 animationType: "length",
17496 percentages: "no",
17497 groups: [
17498 "CSS Columns"
17499 ],
17500 initial: "auto",
17501 appliesto: "blockContainersExceptTableWrappers",
17502 computed: "absoluteLengthZeroOrLarger",
17503 order: "perGrammar",
17504 status: "standard"
17505 },
17506 columns: columns,
17507 contain: contain,
17508 content: content,
17509 "counter-increment": {
17510 syntax: "[ <custom-ident> <integer>? ]+ | none",
17511 media: "all",
17512 inherited: false,
17513 animationType: "discrete",
17514 percentages: "no",
17515 groups: [
17516 "CSS Counter Styles"
17517 ],
17518 initial: "none",
17519 appliesto: "allElements",
17520 computed: "asSpecified",
17521 order: "uniqueOrder",
17522 status: "standard"
17523 },
17524 "counter-reset": {
17525 syntax: "[ <custom-ident> <integer>? ]+ | none",
17526 media: "all",
17527 inherited: false,
17528 animationType: "discrete",
17529 percentages: "no",
17530 groups: [
17531 "CSS Counter Styles"
17532 ],
17533 initial: "none",
17534 appliesto: "allElements",
17535 computed: "asSpecified",
17536 order: "uniqueOrder",
17537 status: "standard"
17538 },
17539 cursor: cursor,
17540 direction: direction,
17541 display: display,
17542 "empty-cells": {
17543 syntax: "show | hide",
17544 media: "visual",
17545 inherited: true,
17546 animationType: "discrete",
17547 percentages: "no",
17548 groups: [
17549 "CSS Table"
17550 ],
17551 initial: "show",
17552 appliesto: "tableCellElements",
17553 computed: "asSpecified",
17554 order: "uniqueOrder",
17555 status: "standard"
17556 },
17557 filter: filter,
17558 flex: flex,
17559 "flex-basis": {
17560 syntax: "content | <'width'>",
17561 media: "visual",
17562 inherited: false,
17563 animationType: "lpc",
17564 percentages: "referToFlexContainersInnerMainSize",
17565 groups: [
17566 "CSS Flexible Box Layout"
17567 ],
17568 initial: "auto",
17569 appliesto: "flexItemsAndInFlowPseudos",
17570 computed: "asSpecifiedRelativeToAbsoluteLengths",
17571 order: "lengthOrPercentageBeforeKeywordIfBothPresent",
17572 status: "standard"
17573 },
17574 "flex-direction": {
17575 syntax: "row | row-reverse | column | column-reverse",
17576 media: "visual",
17577 inherited: false,
17578 animationType: "discrete",
17579 percentages: "no",
17580 groups: [
17581 "CSS Flexible Box Layout"
17582 ],
17583 initial: "row",
17584 appliesto: "flexContainers",
17585 computed: "asSpecified",
17586 order: "uniqueOrder",
17587 status: "standard"
17588 },
17589 "flex-flow": {
17590 syntax: "<'flex-direction'> || <'flex-wrap'>",
17591 media: "visual",
17592 inherited: false,
17593 animationType: "discrete",
17594 percentages: "no",
17595 groups: [
17596 "CSS Flexible Box Layout"
17597 ],
17598 initial: [
17599 "flex-direction",
17600 "flex-wrap"
17601 ],
17602 appliesto: "flexContainers",
17603 computed: [
17604 "flex-direction",
17605 "flex-wrap"
17606 ],
17607 order: "orderOfAppearance",
17608 status: "standard"
17609 },
17610 "flex-grow": {
17611 syntax: "<number>",
17612 media: "visual",
17613 inherited: false,
17614 animationType: "number",
17615 percentages: "no",
17616 groups: [
17617 "CSS Flexible Box Layout"
17618 ],
17619 initial: "0",
17620 appliesto: "flexItemsAndInFlowPseudos",
17621 computed: "asSpecified",
17622 order: "uniqueOrder",
17623 status: "standard"
17624 },
17625 "flex-shrink": {
17626 syntax: "<number>",
17627 media: "visual",
17628 inherited: false,
17629 animationType: "number",
17630 percentages: "no",
17631 groups: [
17632 "CSS Flexible Box Layout"
17633 ],
17634 initial: "1",
17635 appliesto: "flexItemsAndInFlowPseudos",
17636 computed: "asSpecified",
17637 order: "uniqueOrder",
17638 status: "standard"
17639 },
17640 "flex-wrap": {
17641 syntax: "nowrap | wrap | wrap-reverse",
17642 media: "visual",
17643 inherited: false,
17644 animationType: "discrete",
17645 percentages: "no",
17646 groups: [
17647 "CSS Flexible Box Layout"
17648 ],
17649 initial: "nowrap",
17650 appliesto: "flexContainers",
17651 computed: "asSpecified",
17652 order: "uniqueOrder",
17653 status: "standard"
17654 },
17655 float: float,
17656 font: font,
17657 "font-family": {
17658 syntax: "[ <family-name> | <generic-family> ]#",
17659 media: "visual",
17660 inherited: true,
17661 animationType: "discrete",
17662 percentages: "no",
17663 groups: [
17664 "CSS Fonts"
17665 ],
17666 initial: "dependsOnUserAgent",
17667 appliesto: "allElements",
17668 computed: "asSpecified",
17669 order: "uniqueOrder",
17670 alsoAppliesTo: [
17671 "::first-letter",
17672 "::first-line",
17673 "::placeholder"
17674 ],
17675 status: "standard"
17676 },
17677 "font-feature-settings": {
17678 syntax: "normal | <feature-tag-value>#",
17679 media: "visual",
17680 inherited: true,
17681 animationType: "discrete",
17682 percentages: "no",
17683 groups: [
17684 "CSS Fonts"
17685 ],
17686 initial: "normal",
17687 appliesto: "allElements",
17688 computed: "asSpecified",
17689 order: "uniqueOrder",
17690 alsoAppliesTo: [
17691 "::first-letter",
17692 "::first-line",
17693 "::placeholder"
17694 ],
17695 status: "standard"
17696 },
17697 "font-kerning": {
17698 syntax: "auto | normal | none",
17699 media: "visual",
17700 inherited: true,
17701 animationType: "discrete",
17702 percentages: "no",
17703 groups: [
17704 "CSS Fonts"
17705 ],
17706 initial: "auto",
17707 appliesto: "allElements",
17708 computed: "asSpecified",
17709 order: "uniqueOrder",
17710 alsoAppliesTo: [
17711 "::first-letter",
17712 "::first-line",
17713 "::placeholder"
17714 ],
17715 status: "standard"
17716 },
17717 "font-language-override": {
17718 syntax: "normal | <string>",
17719 media: "visual",
17720 inherited: true,
17721 animationType: "discrete",
17722 percentages: "no",
17723 groups: [
17724 "CSS Fonts"
17725 ],
17726 initial: "normal",
17727 appliesto: "allElements",
17728 computed: "asSpecified",
17729 order: "uniqueOrder",
17730 alsoAppliesTo: [
17731 "::first-letter",
17732 "::first-line",
17733 "::placeholder"
17734 ],
17735 status: "standard"
17736 },
17737 "font-optical-sizing": {
17738 syntax: "auto | none",
17739 media: "visual",
17740 inherited: true,
17741 animationType: "discrete",
17742 percentages: "no",
17743 groups: [
17744 "CSS Fonts"
17745 ],
17746 initial: "auto",
17747 appliesto: "allElements",
17748 computed: "asSpecified",
17749 order: "perGrammar",
17750 alsoAppliesTo: [
17751 "::first-letter",
17752 "::first-line",
17753 "::placeholder"
17754 ],
17755 status: "standard"
17756 },
17757 "font-variation-settings": {
17758 syntax: "normal | [ <string> <number> ]#",
17759 media: "visual",
17760 inherited: true,
17761 animationType: "transform",
17762 percentages: "no",
17763 groups: [
17764 "CSS Fonts"
17765 ],
17766 initial: "normal",
17767 appliesto: "allElements",
17768 computed: "asSpecified",
17769 order: "perGrammar",
17770 alsoAppliesTo: [
17771 "::first-letter",
17772 "::first-line",
17773 "::placeholder"
17774 ],
17775 status: "experimental"
17776 },
17777 "font-size": {
17778 syntax: "<absolute-size> | <relative-size> | <length-percentage>",
17779 media: "visual",
17780 inherited: true,
17781 animationType: "length",
17782 percentages: "referToParentElementsFontSize",
17783 groups: [
17784 "CSS Fonts"
17785 ],
17786 initial: "medium",
17787 appliesto: "allElements",
17788 computed: "asSpecifiedRelativeToAbsoluteLengths",
17789 order: "uniqueOrder",
17790 alsoAppliesTo: [
17791 "::first-letter",
17792 "::first-line",
17793 "::placeholder"
17794 ],
17795 status: "standard"
17796 },
17797 "font-size-adjust": {
17798 syntax: "none | <number>",
17799 media: "visual",
17800 inherited: true,
17801 animationType: "number",
17802 percentages: "no",
17803 groups: [
17804 "CSS Fonts"
17805 ],
17806 initial: "none",
17807 appliesto: "allElements",
17808 computed: "asSpecified",
17809 order: "uniqueOrder",
17810 alsoAppliesTo: [
17811 "::first-letter",
17812 "::first-line",
17813 "::placeholder"
17814 ],
17815 status: "standard"
17816 },
17817 "font-stretch": {
17818 syntax: "<font-stretch-absolute>",
17819 media: "visual",
17820 inherited: true,
17821 animationType: "fontStretch",
17822 percentages: "no",
17823 groups: [
17824 "CSS Fonts"
17825 ],
17826 initial: "normal",
17827 appliesto: "allElements",
17828 computed: "asSpecified",
17829 order: "uniqueOrder",
17830 alsoAppliesTo: [
17831 "::first-letter",
17832 "::first-line",
17833 "::placeholder"
17834 ],
17835 status: "standard"
17836 },
17837 "font-style": {
17838 syntax: "normal | italic | oblique <angle>?",
17839 media: "visual",
17840 inherited: true,
17841 animationType: "discrete",
17842 percentages: "no",
17843 groups: [
17844 "CSS Fonts"
17845 ],
17846 initial: "normal",
17847 appliesto: "allElements",
17848 computed: "asSpecified",
17849 order: "uniqueOrder",
17850 alsoAppliesTo: [
17851 "::first-letter",
17852 "::first-line",
17853 "::placeholder"
17854 ],
17855 status: "standard"
17856 },
17857 "font-synthesis": {
17858 syntax: "none | [ weight || style ]",
17859 media: "visual",
17860 inherited: true,
17861 animationType: "discrete",
17862 percentages: "no",
17863 groups: [
17864 "CSS Fonts"
17865 ],
17866 initial: "weight style",
17867 appliesto: "allElements",
17868 computed: "asSpecified",
17869 order: "orderOfAppearance",
17870 alsoAppliesTo: [
17871 "::first-letter",
17872 "::first-line",
17873 "::placeholder"
17874 ],
17875 status: "standard"
17876 },
17877 "font-variant": {
17878 syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
17879 media: "visual",
17880 inherited: true,
17881 animationType: "discrete",
17882 percentages: "no",
17883 groups: [
17884 "CSS Fonts"
17885 ],
17886 initial: "normal",
17887 appliesto: "allElements",
17888 computed: "asSpecified",
17889 order: "uniqueOrder",
17890 alsoAppliesTo: [
17891 "::first-letter",
17892 "::first-line",
17893 "::placeholder"
17894 ],
17895 status: "standard"
17896 },
17897 "font-variant-alternates": {
17898 syntax: "normal | [ stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) ]",
17899 media: "visual",
17900 inherited: true,
17901 animationType: "discrete",
17902 percentages: "no",
17903 groups: [
17904 "CSS Fonts"
17905 ],
17906 initial: "normal",
17907 appliesto: "allElements",
17908 computed: "asSpecified",
17909 order: "orderOfAppearance",
17910 alsoAppliesTo: [
17911 "::first-letter",
17912 "::first-line",
17913 "::placeholder"
17914 ],
17915 status: "standard"
17916 },
17917 "font-variant-caps": {
17918 syntax: "normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps",
17919 media: "visual",
17920 inherited: true,
17921 animationType: "discrete",
17922 percentages: "no",
17923 groups: [
17924 "CSS Fonts"
17925 ],
17926 initial: "normal",
17927 appliesto: "allElements",
17928 computed: "asSpecified",
17929 order: "uniqueOrder",
17930 alsoAppliesTo: [
17931 "::first-letter",
17932 "::first-line",
17933 "::placeholder"
17934 ],
17935 status: "standard"
17936 },
17937 "font-variant-east-asian": {
17938 syntax: "normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
17939 media: "visual",
17940 inherited: true,
17941 animationType: "discrete",
17942 percentages: "no",
17943 groups: [
17944 "CSS Fonts"
17945 ],
17946 initial: "normal",
17947 appliesto: "allElements",
17948 computed: "asSpecified",
17949 order: "orderOfAppearance",
17950 alsoAppliesTo: [
17951 "::first-letter",
17952 "::first-line",
17953 "::placeholder"
17954 ],
17955 status: "standard"
17956 },
17957 "font-variant-ligatures": {
17958 syntax: "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]",
17959 media: "visual",
17960 inherited: true,
17961 animationType: "discrete",
17962 percentages: "no",
17963 groups: [
17964 "CSS Fonts"
17965 ],
17966 initial: "normal",
17967 appliesto: "allElements",
17968 computed: "asSpecified",
17969 order: "orderOfAppearance",
17970 alsoAppliesTo: [
17971 "::first-letter",
17972 "::first-line",
17973 "::placeholder"
17974 ],
17975 status: "standard"
17976 },
17977 "font-variant-numeric": {
17978 syntax: "normal | [ <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero ]",
17979 media: "visual",
17980 inherited: true,
17981 animationType: "discrete",
17982 percentages: "no",
17983 groups: [
17984 "CSS Fonts"
17985 ],
17986 initial: "normal",
17987 appliesto: "allElements",
17988 computed: "asSpecified",
17989 order: "orderOfAppearance",
17990 alsoAppliesTo: [
17991 "::first-letter",
17992 "::first-line",
17993 "::placeholder"
17994 ],
17995 status: "standard"
17996 },
17997 "font-variant-position": {
17998 syntax: "normal | sub | super",
17999 media: "visual",
18000 inherited: true,
18001 animationType: "discrete",
18002 percentages: "no",
18003 groups: [
18004 "CSS Fonts"
18005 ],
18006 initial: "normal",
18007 appliesto: "allElements",
18008 computed: "asSpecified",
18009 order: "uniqueOrder",
18010 alsoAppliesTo: [
18011 "::first-letter",
18012 "::first-line",
18013 "::placeholder"
18014 ],
18015 status: "standard"
18016 },
18017 "font-weight": {
18018 syntax: "<font-weight-absolute> | bolder | lighter",
18019 media: "visual",
18020 inherited: true,
18021 animationType: "fontWeight",
18022 percentages: "no",
18023 groups: [
18024 "CSS Fonts"
18025 ],
18026 initial: "normal",
18027 appliesto: "allElements",
18028 computed: "keywordOrNumericalValueBolderLighterTransformedToRealValue",
18029 order: "uniqueOrder",
18030 alsoAppliesTo: [
18031 "::first-letter",
18032 "::first-line",
18033 "::placeholder"
18034 ],
18035 status: "standard"
18036 },
18037 gap: gap,
18038 grid: grid,
18039 "grid-area": {
18040 syntax: "<grid-line> [ / <grid-line> ]{0,3}",
18041 media: "visual",
18042 inherited: false,
18043 animationType: "discrete",
18044 percentages: "no",
18045 groups: [
18046 "CSS Grid Layout"
18047 ],
18048 initial: [
18049 "grid-row-start",
18050 "grid-column-start",
18051 "grid-row-end",
18052 "grid-column-end"
18053 ],
18054 appliesto: "gridItemsAndBoxesWithinGridContainer",
18055 computed: [
18056 "grid-row-start",
18057 "grid-column-start",
18058 "grid-row-end",
18059 "grid-column-end"
18060 ],
18061 order: "uniqueOrder",
18062 status: "standard"
18063 },
18064 "grid-auto-columns": {
18065 syntax: "<track-size>+",
18066 media: "visual",
18067 inherited: false,
18068 animationType: "discrete",
18069 percentages: "referToDimensionOfContentArea",
18070 groups: [
18071 "CSS Grid Layout"
18072 ],
18073 initial: "auto",
18074 appliesto: "gridContainers",
18075 computed: "percentageAsSpecifiedOrAbsoluteLength",
18076 order: "uniqueOrder",
18077 status: "standard"
18078 },
18079 "grid-auto-flow": {
18080 syntax: "[ row | column ] || dense",
18081 media: "visual",
18082 inherited: false,
18083 animationType: "discrete",
18084 percentages: "no",
18085 groups: [
18086 "CSS Grid Layout"
18087 ],
18088 initial: "row",
18089 appliesto: "gridContainers",
18090 computed: "asSpecified",
18091 order: "uniqueOrder",
18092 status: "standard"
18093 },
18094 "grid-auto-rows": {
18095 syntax: "<track-size>+",
18096 media: "visual",
18097 inherited: false,
18098 animationType: "discrete",
18099 percentages: "referToDimensionOfContentArea",
18100 groups: [
18101 "CSS Grid Layout"
18102 ],
18103 initial: "auto",
18104 appliesto: "gridContainers",
18105 computed: "percentageAsSpecifiedOrAbsoluteLength",
18106 order: "uniqueOrder",
18107 status: "standard"
18108 },
18109 "grid-column": {
18110 syntax: "<grid-line> [ / <grid-line> ]?",
18111 media: "visual",
18112 inherited: false,
18113 animationType: "discrete",
18114 percentages: "no",
18115 groups: [
18116 "CSS Grid Layout"
18117 ],
18118 initial: [
18119 "grid-column-start",
18120 "grid-column-end"
18121 ],
18122 appliesto: "gridItemsAndBoxesWithinGridContainer",
18123 computed: [
18124 "grid-column-start",
18125 "grid-column-end"
18126 ],
18127 order: "uniqueOrder",
18128 status: "standard"
18129 },
18130 "grid-column-end": {
18131 syntax: "<grid-line>",
18132 media: "visual",
18133 inherited: false,
18134 animationType: "discrete",
18135 percentages: "no",
18136 groups: [
18137 "CSS Grid Layout"
18138 ],
18139 initial: "auto",
18140 appliesto: "gridItemsAndBoxesWithinGridContainer",
18141 computed: "asSpecified",
18142 order: "uniqueOrder",
18143 status: "standard"
18144 },
18145 "grid-column-gap": {
18146 syntax: "<length-percentage>",
18147 media: "visual",
18148 inherited: false,
18149 animationType: "length",
18150 percentages: "referToDimensionOfContentArea",
18151 groups: [
18152 "CSS Grid Layout"
18153 ],
18154 initial: "0",
18155 appliesto: "gridContainers",
18156 computed: "percentageAsSpecifiedOrAbsoluteLength",
18157 order: "uniqueOrder",
18158 status: "obsolete"
18159 },
18160 "grid-column-start": {
18161 syntax: "<grid-line>",
18162 media: "visual",
18163 inherited: false,
18164 animationType: "discrete",
18165 percentages: "no",
18166 groups: [
18167 "CSS Grid Layout"
18168 ],
18169 initial: "auto",
18170 appliesto: "gridItemsAndBoxesWithinGridContainer",
18171 computed: "asSpecified",
18172 order: "uniqueOrder",
18173 status: "standard"
18174 },
18175 "grid-gap": {
18176 syntax: "<'grid-row-gap'> <'grid-column-gap'>?",
18177 media: "visual",
18178 inherited: false,
18179 animationType: [
18180 "grid-row-gap",
18181 "grid-column-gap"
18182 ],
18183 percentages: "no",
18184 groups: [
18185 "CSS Grid Layout"
18186 ],
18187 initial: [
18188 "grid-row-gap",
18189 "grid-column-gap"
18190 ],
18191 appliesto: "gridContainers",
18192 computed: [
18193 "grid-row-gap",
18194 "grid-column-gap"
18195 ],
18196 order: "uniqueOrder",
18197 status: "obsolete"
18198 },
18199 "grid-row": {
18200 syntax: "<grid-line> [ / <grid-line> ]?",
18201 media: "visual",
18202 inherited: false,
18203 animationType: "discrete",
18204 percentages: "no",
18205 groups: [
18206 "CSS Grid Layout"
18207 ],
18208 initial: [
18209 "grid-row-start",
18210 "grid-row-end"
18211 ],
18212 appliesto: "gridItemsAndBoxesWithinGridContainer",
18213 computed: [
18214 "grid-row-start",
18215 "grid-row-end"
18216 ],
18217 order: "uniqueOrder",
18218 status: "standard"
18219 },
18220 "grid-row-end": {
18221 syntax: "<grid-line>",
18222 media: "visual",
18223 inherited: false,
18224 animationType: "discrete",
18225 percentages: "no",
18226 groups: [
18227 "CSS Grid Layout"
18228 ],
18229 initial: "auto",
18230 appliesto: "gridItemsAndBoxesWithinGridContainer",
18231 computed: "asSpecified",
18232 order: "uniqueOrder",
18233 status: "standard"
18234 },
18235 "grid-row-gap": {
18236 syntax: "<length-percentage>",
18237 media: "visual",
18238 inherited: false,
18239 animationType: "length",
18240 percentages: "referToDimensionOfContentArea",
18241 groups: [
18242 "CSS Grid Layout"
18243 ],
18244 initial: "0",
18245 appliesto: "gridContainers",
18246 computed: "percentageAsSpecifiedOrAbsoluteLength",
18247 order: "uniqueOrder",
18248 status: "obsolete"
18249 },
18250 "grid-row-start": {
18251 syntax: "<grid-line>",
18252 media: "visual",
18253 inherited: false,
18254 animationType: "discrete",
18255 percentages: "no",
18256 groups: [
18257 "CSS Grid Layout"
18258 ],
18259 initial: "auto",
18260 appliesto: "gridItemsAndBoxesWithinGridContainer",
18261 computed: "asSpecified",
18262 order: "uniqueOrder",
18263 status: "standard"
18264 },
18265 "grid-template": {
18266 syntax: "none | [ <'grid-template-rows'> / <'grid-template-columns'> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?",
18267 media: "visual",
18268 inherited: false,
18269 animationType: "discrete",
18270 percentages: [
18271 "grid-template-columns",
18272 "grid-template-rows"
18273 ],
18274 groups: [
18275 "CSS Grid Layout"
18276 ],
18277 initial: [
18278 "grid-template-columns",
18279 "grid-template-rows",
18280 "grid-template-areas"
18281 ],
18282 appliesto: "gridContainers",
18283 computed: [
18284 "grid-template-columns",
18285 "grid-template-rows",
18286 "grid-template-areas"
18287 ],
18288 order: "uniqueOrder",
18289 status: "standard"
18290 },
18291 "grid-template-areas": {
18292 syntax: "none | <string>+",
18293 media: "visual",
18294 inherited: false,
18295 animationType: "discrete",
18296 percentages: "no",
18297 groups: [
18298 "CSS Grid Layout"
18299 ],
18300 initial: "none",
18301 appliesto: "gridContainers",
18302 computed: "asSpecified",
18303 order: "uniqueOrder",
18304 status: "standard"
18305 },
18306 "grid-template-columns": {
18307 syntax: "none | <track-list> | <auto-track-list>",
18308 media: "visual",
18309 inherited: false,
18310 animationType: "discrete",
18311 percentages: "referToDimensionOfContentArea",
18312 groups: [
18313 "CSS Grid Layout"
18314 ],
18315 initial: "none",
18316 appliesto: "gridContainers",
18317 computed: "asSpecifiedRelativeToAbsoluteLengths",
18318 order: "uniqueOrder",
18319 status: "standard"
18320 },
18321 "grid-template-rows": {
18322 syntax: "none | <track-list> | <auto-track-list>",
18323 media: "visual",
18324 inherited: false,
18325 animationType: "discrete",
18326 percentages: "referToDimensionOfContentArea",
18327 groups: [
18328 "CSS Grid Layout"
18329 ],
18330 initial: "none",
18331 appliesto: "gridContainers",
18332 computed: "asSpecifiedRelativeToAbsoluteLengths",
18333 order: "uniqueOrder",
18334 status: "standard"
18335 },
18336 "hanging-punctuation": {
18337 syntax: "none | [ first || [ force-end | allow-end ] || last ]",
18338 media: "visual",
18339 inherited: true,
18340 animationType: "discrete",
18341 percentages: "no",
18342 groups: [
18343 "CSS Text"
18344 ],
18345 initial: "none",
18346 appliesto: "allElements",
18347 computed: "asSpecified",
18348 order: "uniqueOrder",
18349 status: "standard"
18350 },
18351 height: height,
18352 hyphens: hyphens,
18353 "image-orientation": {
18354 syntax: "from-image | <angle> | [ <angle>? flip ]",
18355 media: "visual",
18356 inherited: true,
18357 animationType: "discrete",
18358 percentages: "no",
18359 groups: [
18360 "CSS Images"
18361 ],
18362 initial: "0deg",
18363 appliesto: "allElements",
18364 computed: "angleRoundedToNextQuarter",
18365 order: "uniqueOrder",
18366 status: "standard"
18367 },
18368 "image-rendering": {
18369 syntax: "auto | crisp-edges | pixelated",
18370 media: "visual",
18371 inherited: true,
18372 animationType: "discrete",
18373 percentages: "no",
18374 groups: [
18375 "CSS Images"
18376 ],
18377 initial: "auto",
18378 appliesto: "allElements",
18379 computed: "asSpecified",
18380 order: "uniqueOrder",
18381 status: "standard"
18382 },
18383 "image-resolution": {
18384 syntax: "[ from-image || <resolution> ] && snap?",
18385 media: "visual",
18386 inherited: true,
18387 animationType: "discrete",
18388 percentages: "no",
18389 groups: [
18390 "CSS Images"
18391 ],
18392 initial: "1dppx",
18393 appliesto: "allElements",
18394 computed: "asSpecifiedWithExceptionOfResolution",
18395 order: "uniqueOrder",
18396 status: "experimental"
18397 },
18398 "ime-mode": {
18399 syntax: "auto | normal | active | inactive | disabled",
18400 media: "interactive",
18401 inherited: false,
18402 animationType: "discrete",
18403 percentages: "no",
18404 groups: [
18405 "CSS Basic User Interface"
18406 ],
18407 initial: "auto",
18408 appliesto: "textFields",
18409 computed: "asSpecified",
18410 order: "uniqueOrder",
18411 status: "obsolete"
18412 },
18413 "initial-letter": {
18414 syntax: "normal | [ <number> <integer>? ]",
18415 media: "visual",
18416 inherited: false,
18417 animationType: "discrete",
18418 percentages: "no",
18419 groups: [
18420 "CSS Inline"
18421 ],
18422 initial: "normal",
18423 appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
18424 computed: "asSpecified",
18425 order: "uniqueOrder",
18426 status: "experimental"
18427 },
18428 "initial-letter-align": {
18429 syntax: "[ auto | alphabetic | hanging | ideographic ]",
18430 media: "visual",
18431 inherited: false,
18432 animationType: "discrete",
18433 percentages: "no",
18434 groups: [
18435 "CSS Inline"
18436 ],
18437 initial: "auto",
18438 appliesto: "firstLetterPseudoElementsAndInlineLevelFirstChildren",
18439 computed: "asSpecified",
18440 order: "uniqueOrder",
18441 status: "experimental"
18442 },
18443 "inline-size": {
18444 syntax: "<'width'>",
18445 media: "visual",
18446 inherited: false,
18447 animationType: "discrete",
18448 percentages: "inlineSizeOfContainingBlock",
18449 groups: [
18450 "CSS Logical Properties"
18451 ],
18452 initial: "auto",
18453 appliesto: "sameAsWidthAndHeight",
18454 computed: "sameAsWidthAndHeight",
18455 order: "uniqueOrder",
18456 status: "standard"
18457 },
18458 isolation: isolation,
18459 "justify-content": {
18460 syntax: "normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]",
18461 media: "visual",
18462 inherited: false,
18463 animationType: "discrete",
18464 percentages: "no",
18465 groups: [
18466 "CSS Flexible Box Layout"
18467 ],
18468 initial: "normal",
18469 appliesto: "flexContainers",
18470 computed: "asSpecified",
18471 order: "uniqueOrder",
18472 status: "standard"
18473 },
18474 "justify-items": {
18475 syntax: "normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ] | legacy | legacy && [ left | right | center ]",
18476 media: "visual",
18477 inherited: false,
18478 animationType: "discrete",
18479 percentages: "no",
18480 groups: [
18481 "CSS Box Alignment"
18482 ],
18483 initial: "legacy",
18484 appliesto: "allElements",
18485 computed: "asSpecified",
18486 order: "perGrammar",
18487 status: "standard"
18488 },
18489 "justify-self": {
18490 syntax: "auto | normal | stretch | <baseline-position> | <overflow-position>? [ <self-position> | left | right ]",
18491 media: "visual",
18492 inherited: false,
18493 animationType: "discrete",
18494 percentages: "no",
18495 groups: [
18496 "CSS Box Alignment"
18497 ],
18498 initial: "auto",
18499 appliesto: "blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
18500 computed: "asSpecified",
18501 order: "uniqueOrder",
18502 status: "standard"
18503 },
18504 left: left,
18505 "letter-spacing": {
18506 syntax: "normal | <length>",
18507 media: "visual",
18508 inherited: true,
18509 animationType: "length",
18510 percentages: "no",
18511 groups: [
18512 "CSS Text"
18513 ],
18514 initial: "normal",
18515 appliesto: "allElements",
18516 computed: "optimumValueOfAbsoluteLengthOrNormal",
18517 order: "uniqueOrder",
18518 alsoAppliesTo: [
18519 "::first-letter",
18520 "::first-line"
18521 ],
18522 status: "standard"
18523 },
18524 "line-break": {
18525 syntax: "auto | loose | normal | strict",
18526 media: "visual",
18527 inherited: false,
18528 animationType: "discrete",
18529 percentages: "no",
18530 groups: [
18531 "CSS Text"
18532 ],
18533 initial: "auto",
18534 appliesto: "allElements",
18535 computed: "asSpecified",
18536 order: "uniqueOrder",
18537 status: "standard"
18538 },
18539 "line-clamp": {
18540 syntax: "none | <integer>",
18541 media: "visual",
18542 inherited: false,
18543 animationType: "integer",
18544 percentages: "no",
18545 groups: [
18546 "CSS Overflow"
18547 ],
18548 initial: "none",
18549 appliesto: "blockContainersExceptMultiColumnContainers",
18550 computed: "asSpecified",
18551 order: "perGrammar",
18552 status: "experimental"
18553 },
18554 "line-height": {
18555 syntax: "normal | <number> | <length> | <percentage>",
18556 media: "visual",
18557 inherited: true,
18558 animationType: "numberOrLength",
18559 percentages: "referToElementFontSize",
18560 groups: [
18561 "CSS Fonts"
18562 ],
18563 initial: "normal",
18564 appliesto: "allElements",
18565 computed: "absoluteLengthOrAsSpecified",
18566 order: "uniqueOrder",
18567 alsoAppliesTo: [
18568 "::first-letter",
18569 "::first-line",
18570 "::placeholder"
18571 ],
18572 status: "standard"
18573 },
18574 "line-height-step": {
18575 syntax: "<length>",
18576 media: "visual",
18577 inherited: true,
18578 animationType: "discrete",
18579 percentages: "no",
18580 groups: [
18581 "CSS Fonts"
18582 ],
18583 initial: "0",
18584 appliesto: "blockContainerElements",
18585 computed: "absoluteLength",
18586 order: "perGrammar",
18587 status: "experimental"
18588 },
18589 "list-style": {
18590 syntax: "<'list-style-type'> || <'list-style-position'> || <'list-style-image'>",
18591 media: "visual",
18592 inherited: true,
18593 animationType: "discrete",
18594 percentages: "no",
18595 groups: [
18596 "CSS Lists and Counters"
18597 ],
18598 initial: [
18599 "list-style-type",
18600 "list-style-position",
18601 "list-style-image"
18602 ],
18603 appliesto: "listItems",
18604 computed: [
18605 "list-style-image",
18606 "list-style-position",
18607 "list-style-type"
18608 ],
18609 order: "orderOfAppearance",
18610 status: "standard"
18611 },
18612 "list-style-image": {
18613 syntax: "<url> | none",
18614 media: "visual",
18615 inherited: true,
18616 animationType: "discrete",
18617 percentages: "no",
18618 groups: [
18619 "CSS Lists and Counters"
18620 ],
18621 initial: "none",
18622 appliesto: "listItems",
18623 computed: "noneOrImageWithAbsoluteURI",
18624 order: "uniqueOrder",
18625 status: "standard"
18626 },
18627 "list-style-position": {
18628 syntax: "inside | outside",
18629 media: "visual",
18630 inherited: true,
18631 animationType: "discrete",
18632 percentages: "no",
18633 groups: [
18634 "CSS Lists and Counters"
18635 ],
18636 initial: "outside",
18637 appliesto: "listItems",
18638 computed: "asSpecified",
18639 order: "uniqueOrder",
18640 status: "standard"
18641 },
18642 "list-style-type": {
18643 syntax: "<counter-style> | <string> | none",
18644 media: "visual",
18645 inherited: true,
18646 animationType: "discrete",
18647 percentages: "no",
18648 groups: [
18649 "CSS Lists and Counters"
18650 ],
18651 initial: "disc",
18652 appliesto: "listItems",
18653 computed: "asSpecified",
18654 order: "uniqueOrder",
18655 status: "standard"
18656 },
18657 margin: margin,
18658 "margin-block-end": {
18659 syntax: "<'margin-left'>",
18660 media: "visual",
18661 inherited: false,
18662 animationType: "discrete",
18663 percentages: "dependsOnLayoutModel",
18664 groups: [
18665 "CSS Logical Properties"
18666 ],
18667 initial: "0",
18668 appliesto: "sameAsMargin",
18669 computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
18670 order: "uniqueOrder",
18671 status: "standard"
18672 },
18673 "margin-block-start": {
18674 syntax: "<'margin-left'>",
18675 media: "visual",
18676 inherited: false,
18677 animationType: "discrete",
18678 percentages: "dependsOnLayoutModel",
18679 groups: [
18680 "CSS Logical Properties"
18681 ],
18682 initial: "0",
18683 appliesto: "sameAsMargin",
18684 computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
18685 order: "uniqueOrder",
18686 status: "standard"
18687 },
18688 "margin-bottom": {
18689 syntax: "<length> | <percentage> | auto",
18690 media: "visual",
18691 inherited: false,
18692 animationType: "length",
18693 percentages: "referToWidthOfContainingBlock",
18694 groups: [
18695 "CSS Box Model"
18696 ],
18697 initial: "0",
18698 appliesto: "allElementsExceptTableDisplayTypes",
18699 computed: "percentageAsSpecifiedOrAbsoluteLength",
18700 order: "uniqueOrder",
18701 alsoAppliesTo: [
18702 "::first-letter"
18703 ],
18704 status: "standard"
18705 },
18706 "margin-inline-end": {
18707 syntax: "<'margin-left'>",
18708 media: "visual",
18709 inherited: false,
18710 animationType: "discrete",
18711 percentages: "dependsOnLayoutModel",
18712 groups: [
18713 "CSS Logical Properties"
18714 ],
18715 initial: "0",
18716 appliesto: "sameAsMargin",
18717 computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
18718 order: "uniqueOrder",
18719 status: "standard"
18720 },
18721 "margin-inline-start": {
18722 syntax: "<'margin-left'>",
18723 media: "visual",
18724 inherited: false,
18725 animationType: "discrete",
18726 percentages: "dependsOnLayoutModel",
18727 groups: [
18728 "CSS Logical Properties"
18729 ],
18730 initial: "0",
18731 appliesto: "sameAsMargin",
18732 computed: "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
18733 order: "uniqueOrder",
18734 status: "standard"
18735 },
18736 "margin-left": {
18737 syntax: "<length> | <percentage> | auto",
18738 media: "visual",
18739 inherited: false,
18740 animationType: "length",
18741 percentages: "referToWidthOfContainingBlock",
18742 groups: [
18743 "CSS Box Model"
18744 ],
18745 initial: "0",
18746 appliesto: "allElementsExceptTableDisplayTypes",
18747 computed: "percentageAsSpecifiedOrAbsoluteLength",
18748 order: "uniqueOrder",
18749 alsoAppliesTo: [
18750 "::first-letter"
18751 ],
18752 status: "standard"
18753 },
18754 "margin-right": {
18755 syntax: "<length> | <percentage> | auto",
18756 media: "visual",
18757 inherited: false,
18758 animationType: "length",
18759 percentages: "referToWidthOfContainingBlock",
18760 groups: [
18761 "CSS Box Model"
18762 ],
18763 initial: "0",
18764 appliesto: "allElementsExceptTableDisplayTypes",
18765 computed: "percentageAsSpecifiedOrAbsoluteLength",
18766 order: "uniqueOrder",
18767 alsoAppliesTo: [
18768 "::first-letter"
18769 ],
18770 status: "standard"
18771 },
18772 "margin-top": {
18773 syntax: "<length> | <percentage> | auto",
18774 media: "visual",
18775 inherited: false,
18776 animationType: "length",
18777 percentages: "referToWidthOfContainingBlock",
18778 groups: [
18779 "CSS Box Model"
18780 ],
18781 initial: "0",
18782 appliesto: "allElementsExceptTableDisplayTypes",
18783 computed: "percentageAsSpecifiedOrAbsoluteLength",
18784 order: "uniqueOrder",
18785 alsoAppliesTo: [
18786 "::first-letter"
18787 ],
18788 status: "standard"
18789 },
18790 mask: mask,
18791 "mask-border": {
18792 syntax: "<'mask-border-source'> || <'mask-border-slice'> [ / <'mask-border-width'>? [ / <'mask-border-outset'> ]? ]? || <'mask-border-repeat'> || <'mask-border-mode'>",
18793 media: "visual",
18794 inherited: false,
18795 animationType: [
18796 "mask-border-mode",
18797 "mask-border-outset",
18798 "mask-border-repeat",
18799 "mask-border-slice",
18800 "mask-border-source",
18801 "mask-border-width"
18802 ],
18803 percentages: [
18804 "mask-border-slice",
18805 "mask-border-width"
18806 ],
18807 groups: [
18808 "CSS Masking"
18809 ],
18810 initial: [
18811 "mask-border-mode",
18812 "mask-border-outset",
18813 "mask-border-repeat",
18814 "mask-border-slice",
18815 "mask-border-source",
18816 "mask-border-width"
18817 ],
18818 appliesto: "allElementsSVGContainerElements",
18819 computed: [
18820 "mask-border-mode",
18821 "mask-border-outset",
18822 "mask-border-repeat",
18823 "mask-border-slice",
18824 "mask-border-source",
18825 "mask-border-width"
18826 ],
18827 order: "perGrammar",
18828 stacking: true,
18829 status: "experimental"
18830 },
18831 "mask-border-mode": {
18832 syntax: "luminance | alpha",
18833 media: "visual",
18834 inherited: false,
18835 animationType: "discrete",
18836 percentages: "no",
18837 groups: [
18838 "CSS Masking"
18839 ],
18840 initial: "alpha",
18841 appliesto: "allElementsSVGContainerElements",
18842 computed: "asSpecified",
18843 order: "perGrammar",
18844 status: "experimental"
18845 },
18846 "mask-border-outset": {
18847 syntax: "[ <length> | <number> ]{1,4}",
18848 media: "visual",
18849 inherited: false,
18850 animationType: "discrete",
18851 percentages: "no",
18852 groups: [
18853 "CSS Masking"
18854 ],
18855 initial: "0",
18856 appliesto: "allElementsSVGContainerElements",
18857 computed: "asSpecifiedRelativeToAbsoluteLengths",
18858 order: "perGrammar",
18859 status: "experimental"
18860 },
18861 "mask-border-repeat": {
18862 syntax: "[ stretch | repeat | round | space ]{1,2}",
18863 media: "visual",
18864 inherited: false,
18865 animationType: "discrete",
18866 percentages: "no",
18867 groups: [
18868 "CSS Masking"
18869 ],
18870 initial: "stretch",
18871 appliesto: "allElementsSVGContainerElements",
18872 computed: "asSpecified",
18873 order: "perGrammar",
18874 status: "experimental"
18875 },
18876 "mask-border-slice": {
18877 syntax: "<number-percentage>{1,4} fill?",
18878 media: "visual",
18879 inherited: false,
18880 animationType: "discrete",
18881 percentages: "referToSizeOfMaskBorderImage",
18882 groups: [
18883 "CSS Masking"
18884 ],
18885 initial: "0",
18886 appliesto: "allElementsSVGContainerElements",
18887 computed: "asSpecified",
18888 order: "perGrammar",
18889 status: "experimental"
18890 },
18891 "mask-border-source": {
18892 syntax: "none | <image>",
18893 media: "visual",
18894 inherited: false,
18895 animationType: "discrete",
18896 percentages: "no",
18897 groups: [
18898 "CSS Masking"
18899 ],
18900 initial: "none",
18901 appliesto: "allElementsSVGContainerElements",
18902 computed: "asSpecifiedURLsAbsolute",
18903 order: "perGrammar",
18904 status: "experimental"
18905 },
18906 "mask-border-width": {
18907 syntax: "[ <length-percentage> | <number> | auto ]{1,4}",
18908 media: "visual",
18909 inherited: false,
18910 animationType: "discrete",
18911 percentages: "relativeToMaskBorderImageArea",
18912 groups: [
18913 "CSS Masking"
18914 ],
18915 initial: "auto",
18916 appliesto: "allElementsSVGContainerElements",
18917 computed: "asSpecifiedRelativeToAbsoluteLengths",
18918 order: "perGrammar",
18919 status: "experimental"
18920 },
18921 "mask-clip": {
18922 syntax: "[ <geometry-box> | no-clip ]#",
18923 media: "visual",
18924 inherited: false,
18925 animationType: "discrete",
18926 percentages: "no",
18927 groups: [
18928 "CSS Masking"
18929 ],
18930 initial: "border-box",
18931 appliesto: "allElementsSVGContainerElements",
18932 computed: "asSpecified",
18933 order: "perGrammar",
18934 status: "standard"
18935 },
18936 "mask-composite": {
18937 syntax: "<compositing-operator>#",
18938 media: "visual",
18939 inherited: false,
18940 animationType: "discrete",
18941 percentages: "no",
18942 groups: [
18943 "CSS Masking"
18944 ],
18945 initial: "add",
18946 appliesto: "allElementsSVGContainerElements",
18947 computed: "asSpecified",
18948 order: "perGrammar",
18949 status: "standard"
18950 },
18951 "mask-image": {
18952 syntax: "<mask-reference>#",
18953 media: "visual",
18954 inherited: false,
18955 animationType: "discrete",
18956 percentages: "no",
18957 groups: [
18958 "CSS Masking"
18959 ],
18960 initial: "none",
18961 appliesto: "allElementsSVGContainerElements",
18962 computed: "asSpecifiedURLsAbsolute",
18963 order: "perGrammar",
18964 status: "standard"
18965 },
18966 "mask-mode": {
18967 syntax: "<masking-mode>#",
18968 media: "visual",
18969 inherited: false,
18970 animationType: "discrete",
18971 percentages: "no",
18972 groups: [
18973 "CSS Masking"
18974 ],
18975 initial: "match-source",
18976 appliesto: "allElementsSVGContainerElements",
18977 computed: "asSpecified",
18978 order: "perGrammar",
18979 status: "standard"
18980 },
18981 "mask-origin": {
18982 syntax: "<geometry-box>#",
18983 media: "visual",
18984 inherited: false,
18985 animationType: "discrete",
18986 percentages: "no",
18987 groups: [
18988 "CSS Masking"
18989 ],
18990 initial: "border-box",
18991 appliesto: "allElementsSVGContainerElements",
18992 computed: "asSpecified",
18993 order: "perGrammar",
18994 status: "standard"
18995 },
18996 "mask-position": {
18997 syntax: "<position>#",
18998 media: "visual",
18999 inherited: false,
19000 animationType: "repeatableListOfSimpleListOfLpc",
19001 percentages: "referToSizeOfMaskPaintingArea",
19002 groups: [
19003 "CSS Masking"
19004 ],
19005 initial: "center",
19006 appliesto: "allElementsSVGContainerElements",
19007 computed: "consistsOfTwoKeywordsForOriginAndOffsets",
19008 order: "perGrammar",
19009 status: "standard"
19010 },
19011 "mask-repeat": {
19012 syntax: "<repeat-style>#",
19013 media: "visual",
19014 inherited: false,
19015 animationType: "discrete",
19016 percentages: "no",
19017 groups: [
19018 "CSS Masking"
19019 ],
19020 initial: "no-repeat",
19021 appliesto: "allElementsSVGContainerElements",
19022 computed: "consistsOfTwoDimensionKeywords",
19023 order: "perGrammar",
19024 status: "standard"
19025 },
19026 "mask-size": {
19027 syntax: "<bg-size>#",
19028 media: "visual",
19029 inherited: false,
19030 animationType: "repeatableListOfSimpleListOfLpc",
19031 percentages: "no",
19032 groups: [
19033 "CSS Masking"
19034 ],
19035 initial: "auto",
19036 appliesto: "allElementsSVGContainerElements",
19037 computed: "asSpecifiedRelativeToAbsoluteLengths",
19038 order: "perGrammar",
19039 status: "standard"
19040 },
19041 "mask-type": {
19042 syntax: "luminance | alpha",
19043 media: "visual",
19044 inherited: false,
19045 animationType: "discrete",
19046 percentages: "no",
19047 groups: [
19048 "CSS Masking"
19049 ],
19050 initial: "luminance",
19051 appliesto: "maskElements",
19052 computed: "asSpecified",
19053 order: "perGrammar",
19054 status: "standard"
19055 },
19056 "max-block-size": {
19057 syntax: "<'max-width'>",
19058 media: "visual",
19059 inherited: false,
19060 animationType: "discrete",
19061 percentages: "blockSizeOfContainingBlock",
19062 groups: [
19063 "CSS Logical Properties"
19064 ],
19065 initial: "0",
19066 appliesto: "sameAsWidthAndHeight",
19067 computed: "sameAsMaxWidthAndMaxHeight",
19068 order: "uniqueOrder",
19069 status: "experimental"
19070 },
19071 "max-height": {
19072 syntax: "<length> | <percentage> | none | max-content | min-content | fit-content | fill-available",
19073 media: "visual",
19074 inherited: false,
19075 animationType: "lpc",
19076 percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentagesNone",
19077 groups: [
19078 "CSS Box Model"
19079 ],
19080 initial: "none",
19081 appliesto: "allElementsButNonReplacedAndTableColumns",
19082 computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
19083 order: "uniqueOrder",
19084 status: "standard"
19085 },
19086 "max-inline-size": {
19087 syntax: "<'max-width'>",
19088 media: "visual",
19089 inherited: false,
19090 animationType: "discrete",
19091 percentages: "inlineSizeOfContainingBlock",
19092 groups: [
19093 "CSS Logical Properties"
19094 ],
19095 initial: "0",
19096 appliesto: "sameAsWidthAndHeight",
19097 computed: "sameAsMaxWidthAndMaxHeight",
19098 order: "uniqueOrder",
19099 status: "experimental"
19100 },
19101 "max-lines": {
19102 syntax: "none | <integer>",
19103 media: "visual",
19104 inherited: false,
19105 animationType: "integer",
19106 percentages: "no",
19107 groups: [
19108 "CSS Overflow"
19109 ],
19110 initial: "none",
19111 appliesto: "blockContainersExceptMultiColumnContainers",
19112 computed: "asSpecified",
19113 order: "perGrammar",
19114 status: "experimental"
19115 },
19116 "max-width": {
19117 syntax: "<length> | <percentage> | none | max-content | min-content | fit-content | fill-available",
19118 media: "visual",
19119 inherited: false,
19120 animationType: "lpc",
19121 percentages: "referToWidthOfContainingBlock",
19122 groups: [
19123 "CSS Box Model"
19124 ],
19125 initial: "none",
19126 appliesto: "allElementsButNonReplacedAndTableRows",
19127 computed: "percentageAsSpecifiedAbsoluteLengthOrNone",
19128 order: "uniqueOrder",
19129 status: "standard"
19130 },
19131 "min-block-size": {
19132 syntax: "<'min-width'>",
19133 media: "visual",
19134 inherited: false,
19135 animationType: "discrete",
19136 percentages: "blockSizeOfContainingBlock",
19137 groups: [
19138 "CSS Logical Properties"
19139 ],
19140 initial: "0",
19141 appliesto: "sameAsWidthAndHeight",
19142 computed: "sameAsMinWidthAndMinHeight",
19143 order: "uniqueOrder",
19144 status: "standard"
19145 },
19146 "min-height": {
19147 syntax: "<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available",
19148 media: "visual",
19149 inherited: false,
19150 animationType: "lpc",
19151 percentages: "regardingHeightOfGeneratedBoxContainingBlockPercentages0",
19152 groups: [
19153 "CSS Box Model"
19154 ],
19155 initial: "0",
19156 appliesto: "allElementsButNonReplacedAndTableColumns",
19157 computed: "percentageAsSpecifiedOrAbsoluteLength",
19158 order: "uniqueOrder",
19159 status: "standard"
19160 },
19161 "min-inline-size": {
19162 syntax: "<'min-width'>",
19163 media: "visual",
19164 inherited: false,
19165 animationType: "discrete",
19166 percentages: "inlineSizeOfContainingBlock",
19167 groups: [
19168 "CSS Logical Properties"
19169 ],
19170 initial: "0",
19171 appliesto: "sameAsWidthAndHeight",
19172 computed: "sameAsMinWidthAndMinHeight",
19173 order: "uniqueOrder",
19174 status: "standard"
19175 },
19176 "min-width": {
19177 syntax: "<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available",
19178 media: "visual",
19179 inherited: false,
19180 animationType: "lpc",
19181 percentages: "referToWidthOfContainingBlock",
19182 groups: [
19183 "CSS Box Model"
19184 ],
19185 initial: "0",
19186 appliesto: "allElementsButNonReplacedAndTableRows",
19187 computed: "percentageAsSpecifiedOrAbsoluteLength",
19188 order: "uniqueOrder",
19189 status: "standard"
19190 },
19191 "mix-blend-mode": {
19192 syntax: "<blend-mode>",
19193 media: "visual",
19194 inherited: false,
19195 animationType: "discrete",
19196 percentages: "no",
19197 groups: [
19198 "Compositing and Blending"
19199 ],
19200 initial: "normal",
19201 appliesto: "allElements",
19202 computed: "asSpecified",
19203 order: "uniqueOrder",
19204 stacking: true,
19205 status: "standard"
19206 },
19207 "object-fit": {
19208 syntax: "fill | contain | cover | none | scale-down",
19209 media: "visual",
19210 inherited: false,
19211 animationType: "discrete",
19212 percentages: "no",
19213 groups: [
19214 "CSS Images"
19215 ],
19216 initial: "fill",
19217 appliesto: "replacedElements",
19218 computed: "asSpecified",
19219 order: "uniqueOrder",
19220 status: "standard"
19221 },
19222 "object-position": {
19223 syntax: "<position>",
19224 media: "visual",
19225 inherited: true,
19226 animationType: "repeatableListOfSimpleListOfLpc",
19227 percentages: "referToWidthAndHeightOfElement",
19228 groups: [
19229 "CSS Images"
19230 ],
19231 initial: "50% 50%",
19232 appliesto: "replacedElements",
19233 computed: "asSpecified",
19234 order: "uniqueOrder",
19235 status: "standard"
19236 },
19237 offset: offset,
19238 "offset-anchor": {
19239 syntax: "auto | <position>",
19240 media: "visual",
19241 inherited: false,
19242 animationType: "position",
19243 percentages: "relativeToWidthAndHeight",
19244 groups: [
19245 "CSS Motion"
19246 ],
19247 initial: "auto",
19248 appliesto: "transformableElements",
19249 computed: "forLengthAbsoluteValueOtherwisePercentage",
19250 order: "perGrammar",
19251 status: "experimental"
19252 },
19253 "offset-block-end": {
19254 syntax: "<'left'>",
19255 media: "visual",
19256 inherited: false,
19257 animationType: "discrete",
19258 percentages: "logicalHeightOfContainingBlock",
19259 groups: [
19260 "CSS Logical Properties"
19261 ],
19262 initial: "auto",
19263 appliesto: "positionedElements",
19264 computed: "sameAsBoxOffsets",
19265 order: "uniqueOrder",
19266 status: "standard"
19267 },
19268 "offset-block-start": {
19269 syntax: "<'left'>",
19270 media: "visual",
19271 inherited: false,
19272 animationType: "discrete",
19273 percentages: "logicalHeightOfContainingBlock",
19274 groups: [
19275 "CSS Logical Properties"
19276 ],
19277 initial: "auto",
19278 appliesto: "positionedElements",
19279 computed: "sameAsBoxOffsets",
19280 order: "uniqueOrder",
19281 status: "standard"
19282 },
19283 "offset-inline-end": {
19284 syntax: "<'left'>",
19285 media: "visual",
19286 inherited: false,
19287 animationType: "discrete",
19288 percentages: "logicalWidthOfContainingBlock",
19289 groups: [
19290 "CSS Logical Properties"
19291 ],
19292 initial: "auto",
19293 appliesto: "positionedElements",
19294 computed: "sameAsBoxOffsets",
19295 order: "uniqueOrder",
19296 status: "standard"
19297 },
19298 "offset-inline-start": {
19299 syntax: "<'left'>",
19300 media: "visual",
19301 inherited: false,
19302 animationType: "discrete",
19303 percentages: "logicalWidthOfContainingBlock",
19304 groups: [
19305 "CSS Logical Properties"
19306 ],
19307 initial: "auto",
19308 appliesto: "positionedElements",
19309 computed: "sameAsBoxOffsets",
19310 order: "uniqueOrder",
19311 status: "standard"
19312 },
19313 "offset-distance": {
19314 syntax: "<length-percentage>",
19315 media: "visual",
19316 inherited: false,
19317 animationType: "lpc",
19318 percentages: "referToTotalPathLength",
19319 groups: [
19320 "CSS Motion"
19321 ],
19322 initial: "0",
19323 appliesto: "transformableElements",
19324 computed: "forLengthAbsoluteValueOtherwisePercentage",
19325 order: "perGrammar",
19326 status: "experimental"
19327 },
19328 "offset-path": {
19329 syntax: "none | ray( [ <angle> && <size>? && contain? ] ) | <path()> | <url> | [ <basic-shape> || <geometry-box> ]",
19330 media: "visual",
19331 inherited: false,
19332 animationType: "angleOrBasicShapeOrPath",
19333 percentages: "no",
19334 groups: [
19335 "CSS Motion"
19336 ],
19337 initial: "none",
19338 appliesto: "transformableElements",
19339 computed: "asSpecified",
19340 order: "perGrammar",
19341 stacking: true,
19342 status: "experimental"
19343 },
19344 "offset-position": {
19345 syntax: "auto | <position>",
19346 media: "visual",
19347 inherited: false,
19348 animationType: "position",
19349 percentages: "referToSizeOfContainingBlock",
19350 groups: [
19351 "CSS Motion"
19352 ],
19353 initial: "auto",
19354 appliesto: "transformableElements",
19355 computed: "forLengthAbsoluteValueOtherwisePercentage",
19356 order: "perGrammar",
19357 status: "experimental"
19358 },
19359 "offset-rotate": {
19360 syntax: "[ auto | reverse ] || <angle>",
19361 media: "visual",
19362 inherited: false,
19363 animationType: "angle",
19364 percentages: "no",
19365 groups: [
19366 "CSS Motion"
19367 ],
19368 initial: "auto",
19369 appliesto: "transformableElements",
19370 computed: "asSpecified",
19371 order: "perGrammar",
19372 status: "experimental"
19373 },
19374 opacity: opacity,
19375 order: order,
19376 orphans: orphans,
19377 outline: outline,
19378 "outline-color": {
19379 syntax: "<color> | invert",
19380 media: [
19381 "visual",
19382 "interactive"
19383 ],
19384 inherited: false,
19385 animationType: "color",
19386 percentages: "no",
19387 groups: [
19388 "CSS Basic User Interface"
19389 ],
19390 initial: "invertOrCurrentColor",
19391 appliesto: "allElements",
19392 computed: "invertForTranslucentColorRGBAOtherwiseRGB",
19393 order: "uniqueOrder",
19394 status: "standard"
19395 },
19396 "outline-offset": {
19397 syntax: "<length>",
19398 media: [
19399 "visual",
19400 "interactive"
19401 ],
19402 inherited: false,
19403 animationType: "length",
19404 percentages: "no",
19405 groups: [
19406 "CSS Basic User Interface"
19407 ],
19408 initial: "0",
19409 appliesto: "allElements",
19410 computed: "asSpecifiedRelativeToAbsoluteLengths",
19411 order: "uniqueOrder",
19412 status: "standard"
19413 },
19414 "outline-style": {
19415 syntax: "auto | <br-style>",
19416 media: [
19417 "visual",
19418 "interactive"
19419 ],
19420 inherited: false,
19421 animationType: "discrete",
19422 percentages: "no",
19423 groups: [
19424 "CSS Basic User Interface"
19425 ],
19426 initial: "none",
19427 appliesto: "allElements",
19428 computed: "asSpecified",
19429 order: "uniqueOrder",
19430 status: "standard"
19431 },
19432 "outline-width": {
19433 syntax: "<br-width>",
19434 media: [
19435 "visual",
19436 "interactive"
19437 ],
19438 inherited: false,
19439 animationType: "length",
19440 percentages: "no",
19441 groups: [
19442 "CSS Basic User Interface"
19443 ],
19444 initial: "medium",
19445 appliesto: "allElements",
19446 computed: "absoluteLength0ForNone",
19447 order: "uniqueOrder",
19448 status: "standard"
19449 },
19450 overflow: overflow,
19451 "overflow-anchor": {
19452 syntax: "auto | none",
19453 media: "visual",
19454 inherited: false,
19455 animationType: "discrete",
19456 percentages: "no",
19457 groups: [
19458 "CSS Scroll Anchoring"
19459 ],
19460 initial: "auto",
19461 appliesto: "allElements",
19462 computed: "asSpecified",
19463 order: "perGrammar",
19464 status: "experimental"
19465 },
19466 "overflow-block": {
19467 syntax: "<'overflow'>",
19468 media: "visual",
19469 inherited: false,
19470 animationType: "discrete",
19471 percentages: "no",
19472 groups: [
19473 "CSS Overflow"
19474 ],
19475 initial: "auto",
19476 appliesto: "blockContainersFlexContainersGridContainers",
19477 computed: "asSpecified",
19478 order: "perGrammar",
19479 status: "experimental"
19480 },
19481 "overflow-clip-box": {
19482 syntax: "padding-box | content-box",
19483 media: "visual",
19484 inherited: false,
19485 animationType: "discrete",
19486 percentages: "no",
19487 groups: [
19488 "Mozilla Extensions"
19489 ],
19490 initial: "padding-box",
19491 appliesto: "allElements",
19492 computed: "asSpecified",
19493 order: "uniqueOrder",
19494 status: "nonstandard"
19495 },
19496 "overflow-inline": {
19497 syntax: "<'overflow'>",
19498 media: "visual",
19499 inherited: false,
19500 animationType: "discrete",
19501 percentages: "no",
19502 groups: [
19503 "CSS Overflow"
19504 ],
19505 initial: "auto",
19506 appliesto: "blockContainersFlexContainersGridContainers",
19507 computed: "asSpecified",
19508 order: "perGrammar",
19509 status: "experimental"
19510 },
19511 "overflow-wrap": {
19512 syntax: "normal | break-word",
19513 media: "visual",
19514 inherited: true,
19515 animationType: "discrete",
19516 percentages: "no",
19517 groups: [
19518 "CSS Text"
19519 ],
19520 initial: "normal",
19521 appliesto: "allElements",
19522 computed: "asSpecified",
19523 order: "uniqueOrder",
19524 status: "standard"
19525 },
19526 "overflow-x": {
19527 syntax: "visible | hidden | clip | scroll | auto",
19528 media: "visual",
19529 inherited: false,
19530 animationType: "discrete",
19531 percentages: "no",
19532 groups: [
19533 "CSS Overflow"
19534 ],
19535 initial: "visible",
19536 appliesto: "blockContainersFlexContainersGridContainers",
19537 computed: "asSpecified",
19538 order: "uniqueOrder",
19539 status: "standard"
19540 },
19541 "overflow-y": {
19542 syntax: "visible | hidden | clip | scroll | auto",
19543 media: "visual",
19544 inherited: false,
19545 animationType: "discrete",
19546 percentages: "no",
19547 groups: [
19548 "CSS Overflow"
19549 ],
19550 initial: "visible",
19551 appliesto: "blockContainersFlexContainersGridContainers",
19552 computed: "asSpecified",
19553 order: "uniqueOrder",
19554 status: "standard"
19555 },
19556 "overscroll-behavior": {
19557 syntax: "[ contain | none | auto ]{1,2}",
19558 media: "visual",
19559 inherited: false,
19560 animationType: "discrete",
19561 percentages: "no",
19562 groups: [
19563 "CSS Box Model"
19564 ],
19565 initial: "auto",
19566 appliesto: "nonReplacedBlockAndInlineBlockElements",
19567 computed: "asSpecified",
19568 order: "uniqueOrder",
19569 status: "nonstandard"
19570 },
19571 "overscroll-behavior-x": {
19572 syntax: "contain | none | auto",
19573 media: "visual",
19574 inherited: false,
19575 animationType: "discrete",
19576 percentages: "no",
19577 groups: [
19578 "CSS Box Model"
19579 ],
19580 initial: "auto",
19581 appliesto: "nonReplacedBlockAndInlineBlockElements",
19582 computed: "asSpecified",
19583 order: "uniqueOrder",
19584 status: "nonstandard"
19585 },
19586 "overscroll-behavior-y": {
19587 syntax: "contain | none | auto",
19588 media: "visual",
19589 inherited: false,
19590 animationType: "discrete",
19591 percentages: "no",
19592 groups: [
19593 "CSS Box Model"
19594 ],
19595 initial: "auto",
19596 appliesto: "nonReplacedBlockAndInlineBlockElements",
19597 computed: "asSpecified",
19598 order: "uniqueOrder",
19599 status: "nonstandard"
19600 },
19601 padding: padding,
19602 "padding-block-end": {
19603 syntax: "<'padding-left'>",
19604 media: "visual",
19605 inherited: false,
19606 animationType: "discrete",
19607 percentages: "logicalWidthOfContainingBlock",
19608 groups: [
19609 "CSS Logical Properties"
19610 ],
19611 initial: "0",
19612 appliesto: "allElements",
19613 computed: "asLength",
19614 order: "uniqueOrder",
19615 status: "standard"
19616 },
19617 "padding-block-start": {
19618 syntax: "<'padding-left'>",
19619 media: "visual",
19620 inherited: false,
19621 animationType: "discrete",
19622 percentages: "logicalWidthOfContainingBlock",
19623 groups: [
19624 "CSS Logical Properties"
19625 ],
19626 initial: "0",
19627 appliesto: "allElements",
19628 computed: "asLength",
19629 order: "uniqueOrder",
19630 status: "standard"
19631 },
19632 "padding-bottom": {
19633 syntax: "<length> | <percentage>",
19634 media: "visual",
19635 inherited: false,
19636 animationType: "length",
19637 percentages: "referToWidthOfContainingBlock",
19638 groups: [
19639 "CSS Box Model"
19640 ],
19641 initial: "0",
19642 appliesto: "allElementsExceptInternalTableDisplayTypes",
19643 computed: "percentageAsSpecifiedOrAbsoluteLength",
19644 order: "uniqueOrder",
19645 alsoAppliesTo: [
19646 "::first-letter"
19647 ],
19648 status: "standard"
19649 },
19650 "padding-inline-end": {
19651 syntax: "<'padding-left'>",
19652 media: "visual",
19653 inherited: false,
19654 animationType: "discrete",
19655 percentages: "logicalWidthOfContainingBlock",
19656 groups: [
19657 "CSS Logical Properties"
19658 ],
19659 initial: "0",
19660 appliesto: "allElements",
19661 computed: "asLength",
19662 order: "uniqueOrder",
19663 status: "standard"
19664 },
19665 "padding-inline-start": {
19666 syntax: "<'padding-left'>",
19667 media: "visual",
19668 inherited: false,
19669 animationType: "discrete",
19670 percentages: "logicalWidthOfContainingBlock",
19671 groups: [
19672 "CSS Logical Properties"
19673 ],
19674 initial: "0",
19675 appliesto: "allElements",
19676 computed: "asLength",
19677 order: "uniqueOrder",
19678 status: "standard"
19679 },
19680 "padding-left": {
19681 syntax: "<length> | <percentage>",
19682 media: "visual",
19683 inherited: false,
19684 animationType: "length",
19685 percentages: "referToWidthOfContainingBlock",
19686 groups: [
19687 "CSS Box Model"
19688 ],
19689 initial: "0",
19690 appliesto: "allElementsExceptInternalTableDisplayTypes",
19691 computed: "percentageAsSpecifiedOrAbsoluteLength",
19692 order: "uniqueOrder",
19693 alsoAppliesTo: [
19694 "::first-letter"
19695 ],
19696 status: "standard"
19697 },
19698 "padding-right": {
19699 syntax: "<length> | <percentage>",
19700 media: "visual",
19701 inherited: false,
19702 animationType: "length",
19703 percentages: "referToWidthOfContainingBlock",
19704 groups: [
19705 "CSS Box Model"
19706 ],
19707 initial: "0",
19708 appliesto: "allElementsExceptInternalTableDisplayTypes",
19709 computed: "percentageAsSpecifiedOrAbsoluteLength",
19710 order: "uniqueOrder",
19711 alsoAppliesTo: [
19712 "::first-letter"
19713 ],
19714 status: "standard"
19715 },
19716 "padding-top": {
19717 syntax: "<length> | <percentage>",
19718 media: "visual",
19719 inherited: false,
19720 animationType: "length",
19721 percentages: "referToWidthOfContainingBlock",
19722 groups: [
19723 "CSS Box Model"
19724 ],
19725 initial: "0",
19726 appliesto: "allElementsExceptInternalTableDisplayTypes",
19727 computed: "percentageAsSpecifiedOrAbsoluteLength",
19728 order: "uniqueOrder",
19729 alsoAppliesTo: [
19730 "::first-letter"
19731 ],
19732 status: "standard"
19733 },
19734 "page-break-after": {
19735 syntax: "auto | always | avoid | left | right | recto | verso",
19736 media: [
19737 "visual",
19738 "paged"
19739 ],
19740 inherited: false,
19741 animationType: "discrete",
19742 percentages: "no",
19743 groups: [
19744 "CSS Pages"
19745 ],
19746 initial: "auto",
19747 appliesto: "blockElementsInNormalFlow",
19748 computed: "asSpecified",
19749 order: "uniqueOrder",
19750 status: "standard"
19751 },
19752 "page-break-before": {
19753 syntax: "auto | always | avoid | left | right | recto | verso",
19754 media: [
19755 "visual",
19756 "paged"
19757 ],
19758 inherited: false,
19759 animationType: "discrete",
19760 percentages: "no",
19761 groups: [
19762 "CSS Pages"
19763 ],
19764 initial: "auto",
19765 appliesto: "blockElementsInNormalFlow",
19766 computed: "asSpecified",
19767 order: "uniqueOrder",
19768 status: "standard"
19769 },
19770 "page-break-inside": {
19771 syntax: "auto | avoid",
19772 media: [
19773 "visual",
19774 "paged"
19775 ],
19776 inherited: false,
19777 animationType: "discrete",
19778 percentages: "no",
19779 groups: [
19780 "CSS Pages"
19781 ],
19782 initial: "auto",
19783 appliesto: "blockElementsInNormalFlow",
19784 computed: "asSpecified",
19785 order: "uniqueOrder",
19786 status: "standard"
19787 },
19788 "paint-order": {
19789 syntax: "normal | [ fill || stroke || markers ]",
19790 media: "visual",
19791 inherited: true,
19792 animationType: "discrete",
19793 percentages: "no",
19794 groups: [
19795 "CSS Text"
19796 ],
19797 initial: "normal",
19798 appliesto: "textElements",
19799 computed: "asSpecified",
19800 order: "uniqueOrder",
19801 status: "experimental"
19802 },
19803 perspective: perspective,
19804 "perspective-origin": {
19805 syntax: "<position>",
19806 media: "visual",
19807 inherited: false,
19808 animationType: "simpleListOfLpc",
19809 percentages: "referToSizeOfBoundingBox",
19810 groups: [
19811 "CSS Transforms"
19812 ],
19813 initial: "50% 50%",
19814 appliesto: "transformableElements",
19815 computed: "forLengthAbsoluteValueOtherwisePercentage",
19816 order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
19817 status: "standard"
19818 },
19819 "place-content": {
19820 syntax: "<'align-content'> <'justify-content'>?",
19821 media: "visual",
19822 inherited: false,
19823 animationType: "discrete",
19824 percentages: "no",
19825 groups: [
19826 "CSS Flexible Box Layout"
19827 ],
19828 initial: "normal",
19829 appliesto: "multilineFlexContainers",
19830 computed: "asSpecified",
19831 order: "uniqueOrder",
19832 status: "standard"
19833 },
19834 "pointer-events": {
19835 syntax: "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
19836 media: "visual",
19837 inherited: true,
19838 animationType: "discrete",
19839 percentages: "no",
19840 groups: [
19841 "Pointer Events"
19842 ],
19843 initial: "auto",
19844 appliesto: "allElements",
19845 computed: "asSpecified",
19846 order: "uniqueOrder",
19847 status: "standard"
19848 },
19849 position: position,
19850 quotes: quotes,
19851 resize: resize,
19852 right: right,
19853 rotate: rotate,
19854 "row-gap": {
19855 syntax: "normal | <length-percentage>",
19856 media: "visual",
19857 inherited: false,
19858 animationType: "lpc",
19859 percentages: "referToDimensionOfContentArea",
19860 groups: [
19861 "CSS Box Alignment"
19862 ],
19863 initial: "normal",
19864 appliesto: "multiColumnElementsFlexContainersGridContainers",
19865 computed: "asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
19866 order: "perGrammar",
19867 status: "standard"
19868 },
19869 "ruby-align": {
19870 syntax: "start | center | space-between | space-around",
19871 media: "visual",
19872 inherited: true,
19873 animationType: "discrete",
19874 percentages: "no",
19875 groups: [
19876 "CSS Ruby"
19877 ],
19878 initial: "space-around",
19879 appliesto: "rubyBasesAnnotationsBaseAnnotationContainers",
19880 computed: "asSpecified",
19881 order: "uniqueOrder",
19882 status: "experimental"
19883 },
19884 "ruby-merge": {
19885 syntax: "separate | collapse | auto",
19886 media: "visual",
19887 inherited: true,
19888 animationType: "discrete",
19889 percentages: "no",
19890 groups: [
19891 "CSS Ruby"
19892 ],
19893 initial: "separate",
19894 appliesto: "rubyAnnotationsContainers",
19895 computed: "asSpecified",
19896 order: "uniqueOrder",
19897 status: "experimental"
19898 },
19899 "ruby-position": {
19900 syntax: "over | under | inter-character",
19901 media: "visual",
19902 inherited: true,
19903 animationType: "discrete",
19904 percentages: "no",
19905 groups: [
19906 "CSS Ruby"
19907 ],
19908 initial: "over",
19909 appliesto: "rubyAnnotationsContainers",
19910 computed: "asSpecified",
19911 order: "uniqueOrder",
19912 status: "experimental"
19913 },
19914 scale: scale,
19915 "scroll-behavior": {
19916 syntax: "auto | smooth",
19917 media: "visual",
19918 inherited: false,
19919 animationType: "discrete",
19920 percentages: "no",
19921 groups: [
19922 "CSSOM View"
19923 ],
19924 initial: "auto",
19925 appliesto: "scrollingBoxes",
19926 computed: "asSpecified",
19927 order: "uniqueOrder",
19928 status: "standard"
19929 },
19930 "scroll-snap-coordinate": {
19931 syntax: "none | <position>#",
19932 media: "interactive",
19933 inherited: false,
19934 animationType: "position",
19935 percentages: "referToBorderBox",
19936 groups: [
19937 "CSS Scroll Snap"
19938 ],
19939 initial: "none",
19940 appliesto: "allElements",
19941 computed: "asSpecifiedRelativeToAbsoluteLengths",
19942 order: "uniqueOrder",
19943 status: "standard"
19944 },
19945 "scroll-snap-destination": {
19946 syntax: "<position>",
19947 media: "interactive",
19948 inherited: false,
19949 animationType: "position",
19950 percentages: "relativeToScrollContainerPaddingBoxAxis",
19951 groups: [
19952 "CSS Scroll Snap"
19953 ],
19954 initial: "0px 0px",
19955 appliesto: "scrollContainers",
19956 computed: "asSpecifiedRelativeToAbsoluteLengths",
19957 order: "uniqueOrder",
19958 status: "standard"
19959 },
19960 "scroll-snap-points-x": {
19961 syntax: "none | repeat( <length-percentage> )",
19962 media: "interactive",
19963 inherited: false,
19964 animationType: "discrete",
19965 percentages: "relativeToScrollContainerPaddingBoxAxis",
19966 groups: [
19967 "CSS Scroll Snap"
19968 ],
19969 initial: "none",
19970 appliesto: "scrollContainers",
19971 computed: "asSpecifiedRelativeToAbsoluteLengths",
19972 order: "uniqueOrder",
19973 status: "obsolete"
19974 },
19975 "scroll-snap-points-y": {
19976 syntax: "none | repeat( <length-percentage> )",
19977 media: "interactive",
19978 inherited: false,
19979 animationType: "discrete",
19980 percentages: "relativeToScrollContainerPaddingBoxAxis",
19981 groups: [
19982 "CSS Scroll Snap"
19983 ],
19984 initial: "none",
19985 appliesto: "scrollContainers",
19986 computed: "asSpecifiedRelativeToAbsoluteLengths",
19987 order: "uniqueOrder",
19988 status: "obsolete"
19989 },
19990 "scroll-snap-type": {
19991 syntax: "none | mandatory | proximity",
19992 media: "interactive",
19993 inherited: false,
19994 animationType: "discrete",
19995 percentages: "no",
19996 groups: [
19997 "CSS Scroll Snap"
19998 ],
19999 initial: "none",
20000 appliesto: "scrollContainers",
20001 computed: "asSpecified",
20002 order: "uniqueOrder",
20003 status: "standard"
20004 },
20005 "scroll-snap-type-x": {
20006 syntax: "none | mandatory | proximity",
20007 media: "interactive",
20008 inherited: false,
20009 animationType: "discrete",
20010 percentages: "no",
20011 groups: [
20012 "CSS Scroll Snap"
20013 ],
20014 initial: "none",
20015 appliesto: "scrollContainers",
20016 computed: "asSpecified",
20017 order: "uniqueOrder",
20018 status: "nonstandard"
20019 },
20020 "scroll-snap-type-y": {
20021 syntax: "none | mandatory | proximity",
20022 media: "interactive",
20023 inherited: false,
20024 animationType: "discrete",
20025 percentages: "no",
20026 groups: [
20027 "CSS Scroll Snap"
20028 ],
20029 initial: "none",
20030 appliesto: "scrollContainers",
20031 computed: "asSpecified",
20032 order: "uniqueOrder",
20033 status: "nonstandard"
20034 },
20035 "shape-image-threshold": {
20036 syntax: "<number>",
20037 media: "visual",
20038 inherited: false,
20039 animationType: "number",
20040 percentages: "no",
20041 groups: [
20042 "CSS Shapes"
20043 ],
20044 initial: "0.0",
20045 appliesto: "floats",
20046 computed: "specifiedValueNumberClipped0To1",
20047 order: "uniqueOrder",
20048 status: "standard"
20049 },
20050 "shape-margin": {
20051 syntax: "<length-percentage>",
20052 media: "visual",
20053 inherited: false,
20054 animationType: "lpc",
20055 percentages: "referToWidthOfContainingBlock",
20056 groups: [
20057 "CSS Shapes"
20058 ],
20059 initial: "0",
20060 appliesto: "floats",
20061 computed: "asSpecifiedRelativeToAbsoluteLengths",
20062 order: "uniqueOrder",
20063 status: "standard"
20064 },
20065 "shape-outside": {
20066 syntax: "none | <shape-box> || <basic-shape> | <image>",
20067 media: "visual",
20068 inherited: false,
20069 animationType: "basicShapeOtherwiseNo",
20070 percentages: "no",
20071 groups: [
20072 "CSS Shapes"
20073 ],
20074 initial: "none",
20075 appliesto: "floats",
20076 computed: "asDefinedForBasicShapeWithAbsoluteURIOtherwiseAsSpecified",
20077 order: "uniqueOrder",
20078 status: "standard"
20079 },
20080 "tab-size": {
20081 syntax: "<integer> | <length>",
20082 media: "visual",
20083 inherited: true,
20084 animationType: "length",
20085 percentages: "no",
20086 groups: [
20087 "CSS Text"
20088 ],
20089 initial: "8",
20090 appliesto: "blockContainers",
20091 computed: "specifiedIntegerOrAbsoluteLength",
20092 order: "uniqueOrder",
20093 status: "standard"
20094 },
20095 "table-layout": {
20096 syntax: "auto | fixed",
20097 media: "visual",
20098 inherited: false,
20099 animationType: "discrete",
20100 percentages: "no",
20101 groups: [
20102 "CSS Table"
20103 ],
20104 initial: "auto",
20105 appliesto: "tableElements",
20106 computed: "asSpecified",
20107 order: "uniqueOrder",
20108 status: "standard"
20109 },
20110 "text-align": {
20111 syntax: "start | end | left | right | center | justify | match-parent",
20112 media: "visual",
20113 inherited: true,
20114 animationType: "discrete",
20115 percentages: "no",
20116 groups: [
20117 "CSS Text"
20118 ],
20119 initial: "startOrNamelessValueIfLTRRightIfRTL",
20120 appliesto: "blockContainers",
20121 computed: "asSpecifiedExceptMatchParent",
20122 order: "orderOfAppearance",
20123 alsoAppliesTo: [
20124 "::placeholder"
20125 ],
20126 status: "standard"
20127 },
20128 "text-align-last": {
20129 syntax: "auto | start | end | left | right | center | justify",
20130 media: "visual",
20131 inherited: true,
20132 animationType: "discrete",
20133 percentages: "no",
20134 groups: [
20135 "CSS Text"
20136 ],
20137 initial: "auto",
20138 appliesto: "blockContainers",
20139 computed: "asSpecified",
20140 order: "uniqueOrder",
20141 status: "standard"
20142 },
20143 "text-combine-upright": {
20144 syntax: "none | all | [ digits <integer>? ]",
20145 media: "visual",
20146 inherited: true,
20147 animationType: "discrete",
20148 percentages: "no",
20149 groups: [
20150 "CSS Writing Modes"
20151 ],
20152 initial: "none",
20153 appliesto: "nonReplacedInlineElements",
20154 computed: "keywordPlusIntegerIfDigits",
20155 order: "uniqueOrder",
20156 status: "standard"
20157 },
20158 "text-decoration": {
20159 syntax: "<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'>",
20160 media: "visual",
20161 inherited: false,
20162 animationType: [
20163 "text-decoration-color",
20164 "text-decoration-style",
20165 "text-decoration-line"
20166 ],
20167 percentages: "no",
20168 groups: [
20169 "CSS Text Decoration"
20170 ],
20171 initial: [
20172 "text-decoration-color",
20173 "text-decoration-style",
20174 "text-decoration-line"
20175 ],
20176 appliesto: "allElements",
20177 computed: [
20178 "text-decoration-line",
20179 "text-decoration-style",
20180 "text-decoration-color"
20181 ],
20182 order: "orderOfAppearance",
20183 alsoAppliesTo: [
20184 "::first-letter",
20185 "::first-line",
20186 "::placeholder"
20187 ],
20188 status: "standard"
20189 },
20190 "text-decoration-color": {
20191 syntax: "<color>",
20192 media: "visual",
20193 inherited: false,
20194 animationType: "color",
20195 percentages: "no",
20196 groups: [
20197 "CSS Text Decoration"
20198 ],
20199 initial: "currentcolor",
20200 appliesto: "allElements",
20201 computed: "computedColor",
20202 order: "uniqueOrder",
20203 alsoAppliesTo: [
20204 "::first-letter",
20205 "::first-line",
20206 "::placeholder"
20207 ],
20208 status: "standard"
20209 },
20210 "text-decoration-line": {
20211 syntax: "none | [ underline || overline || line-through || blink ]",
20212 media: "visual",
20213 inherited: false,
20214 animationType: "discrete",
20215 percentages: "no",
20216 groups: [
20217 "CSS Text Decoration"
20218 ],
20219 initial: "none",
20220 appliesto: "allElements",
20221 computed: "asSpecified",
20222 order: "orderOfAppearance",
20223 alsoAppliesTo: [
20224 "::first-letter",
20225 "::first-line",
20226 "::placeholder"
20227 ],
20228 status: "standard"
20229 },
20230 "text-decoration-skip": {
20231 syntax: "none | [ objects || [ spaces | [ leading-spaces || trailing-spaces ] ] || edges || box-decoration ]",
20232 media: "visual",
20233 inherited: true,
20234 animationType: "discrete",
20235 percentages: "no",
20236 groups: [
20237 "CSS Text Decoration"
20238 ],
20239 initial: "objects",
20240 appliesto: "allElements",
20241 computed: "asSpecified",
20242 order: "orderOfAppearance",
20243 status: "experimental"
20244 },
20245 "text-decoration-skip-ink": {
20246 syntax: "auto | none",
20247 media: "visual",
20248 inherited: true,
20249 animationType: "discrete",
20250 percentages: "no",
20251 groups: [
20252 "CSS Text Decoration"
20253 ],
20254 initial: "auto",
20255 appliesto: "allElements",
20256 computed: "asSpecified",
20257 order: "orderOfAppearance",
20258 status: "experimental"
20259 },
20260 "text-decoration-style": {
20261 syntax: "solid | double | dotted | dashed | wavy",
20262 media: "visual",
20263 inherited: false,
20264 animationType: "discrete",
20265 percentages: "no",
20266 groups: [
20267 "CSS Text Decoration"
20268 ],
20269 initial: "solid",
20270 appliesto: "allElements",
20271 computed: "asSpecified",
20272 order: "uniqueOrder",
20273 alsoAppliesTo: [
20274 "::first-letter",
20275 "::first-line",
20276 "::placeholder"
20277 ],
20278 status: "standard"
20279 },
20280 "text-emphasis": {
20281 syntax: "<'text-emphasis-style'> || <'text-emphasis-color'>",
20282 media: "visual",
20283 inherited: false,
20284 animationType: [
20285 "text-emphasis-color",
20286 "text-emphasis-style"
20287 ],
20288 percentages: "no",
20289 groups: [
20290 "CSS Text Decoration"
20291 ],
20292 initial: [
20293 "text-emphasis-style",
20294 "text-emphasis-color"
20295 ],
20296 appliesto: "allElements",
20297 computed: [
20298 "text-emphasis-style",
20299 "text-emphasis-color"
20300 ],
20301 order: "orderOfAppearance",
20302 status: "standard"
20303 },
20304 "text-emphasis-color": {
20305 syntax: "<color>",
20306 media: "visual",
20307 inherited: false,
20308 animationType: "color",
20309 percentages: "no",
20310 groups: [
20311 "CSS Text Decoration"
20312 ],
20313 initial: "currentcolor",
20314 appliesto: "allElements",
20315 computed: "computedColor",
20316 order: "uniqueOrder",
20317 status: "standard"
20318 },
20319 "text-emphasis-position": {
20320 syntax: "[ over | under ] && [ right | left ]",
20321 media: "visual",
20322 inherited: false,
20323 animationType: "discrete",
20324 percentages: "no",
20325 groups: [
20326 "CSS Text Decoration"
20327 ],
20328 initial: "over right",
20329 appliesto: "allElements",
20330 computed: "asSpecified",
20331 order: "uniqueOrder",
20332 status: "standard"
20333 },
20334 "text-emphasis-style": {
20335 syntax: "none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>",
20336 media: "visual",
20337 inherited: false,
20338 animationType: "discrete",
20339 percentages: "no",
20340 groups: [
20341 "CSS Text Decoration"
20342 ],
20343 initial: "none",
20344 appliesto: "allElements",
20345 computed: "asSpecified",
20346 order: "uniqueOrder",
20347 status: "standard"
20348 },
20349 "text-indent": {
20350 syntax: "<length-percentage> && hanging? && each-line?",
20351 media: "visual",
20352 inherited: true,
20353 animationType: "lpc",
20354 percentages: "referToWidthOfContainingBlock",
20355 groups: [
20356 "CSS Text"
20357 ],
20358 initial: "0",
20359 appliesto: "blockContainers",
20360 computed: "percentageOrAbsoluteLengthPlusKeywords",
20361 order: "lengthOrPercentageBeforeKeywords",
20362 status: "standard"
20363 },
20364 "text-justify": {
20365 syntax: "auto | inter-character | inter-word | none",
20366 media: "visual",
20367 inherited: true,
20368 animationType: "discrete",
20369 percentages: "no",
20370 groups: [
20371 "CSS Text"
20372 ],
20373 initial: "auto",
20374 appliesto: "inlineLevelAndTableCellElements",
20375 computed: "asSpecified",
20376 order: "uniqueOrder",
20377 status: "standard"
20378 },
20379 "text-orientation": {
20380 syntax: "mixed | upright | sideways",
20381 media: "visual",
20382 inherited: true,
20383 animationType: "discrete",
20384 percentages: "no",
20385 groups: [
20386 "CSS Writing Modes"
20387 ],
20388 initial: "mixed",
20389 appliesto: "allElementsExceptTableRowGroupsRowsColumnGroupsAndColumns",
20390 computed: "asSpecified",
20391 order: "uniqueOrder",
20392 status: "standard"
20393 },
20394 "text-overflow": {
20395 syntax: "[ clip | ellipsis | <string> ]{1,2}",
20396 media: "visual",
20397 inherited: false,
20398 animationType: "discrete",
20399 percentages: "no",
20400 groups: [
20401 "CSS Basic User Interface"
20402 ],
20403 initial: "clip",
20404 appliesto: "blockContainerElements",
20405 computed: "asSpecified",
20406 order: "uniqueOrder",
20407 alsoAppliesTo: [
20408 "::placeholder"
20409 ],
20410 status: "standard"
20411 },
20412 "text-rendering": {
20413 syntax: "auto | optimizeSpeed | optimizeLegibility | geometricPrecision",
20414 media: "visual",
20415 inherited: true,
20416 animationType: "discrete",
20417 percentages: "no",
20418 groups: [
20419 "CSS Miscellaneous"
20420 ],
20421 initial: "auto",
20422 appliesto: "textElements",
20423 computed: "asSpecified",
20424 order: "uniqueOrder",
20425 status: "standard"
20426 },
20427 "text-shadow": {
20428 syntax: "none | <shadow-t>#",
20429 media: "visual",
20430 inherited: true,
20431 animationType: "shadowList",
20432 percentages: "no",
20433 groups: [
20434 "CSS Text Decoration"
20435 ],
20436 initial: "none",
20437 appliesto: "allElements",
20438 computed: "colorPlusThreeAbsoluteLengths",
20439 order: "uniqueOrder",
20440 alsoAppliesTo: [
20441 "::first-letter",
20442 "::first-line",
20443 "::placeholder"
20444 ],
20445 status: "standard"
20446 },
20447 "text-size-adjust": {
20448 syntax: "none | auto | <percentage>",
20449 media: "visual",
20450 inherited: true,
20451 animationType: "discrete",
20452 percentages: "referToSizeOfFont",
20453 groups: [
20454 "CSS Text"
20455 ],
20456 initial: "autoForSmartphoneBrowsersSupportingInflation",
20457 appliesto: "allElements",
20458 computed: "asSpecified",
20459 order: "uniqueOrder",
20460 status: "experimental"
20461 },
20462 "text-transform": {
20463 syntax: "none | capitalize | uppercase | lowercase | full-width",
20464 media: "visual",
20465 inherited: true,
20466 animationType: "discrete",
20467 percentages: "no",
20468 groups: [
20469 "CSS Text"
20470 ],
20471 initial: "none",
20472 appliesto: "allElements",
20473 computed: "asSpecified",
20474 order: "uniqueOrder",
20475 alsoAppliesTo: [
20476 "::first-letter",
20477 "::first-line",
20478 "::placeholder"
20479 ],
20480 status: "standard"
20481 },
20482 "text-underline-position": {
20483 syntax: "auto | [ under || [ left | right ] ]",
20484 media: "visual",
20485 inherited: true,
20486 animationType: "discrete",
20487 percentages: "no",
20488 groups: [
20489 "CSS Text Decoration"
20490 ],
20491 initial: "auto",
20492 appliesto: "allElements",
20493 computed: "asSpecified",
20494 order: "orderOfAppearance",
20495 status: "standard"
20496 },
20497 top: top,
20498 "touch-action": {
20499 syntax: "auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation",
20500 media: "visual",
20501 inherited: false,
20502 animationType: "discrete",
20503 percentages: "no",
20504 groups: [
20505 "Pointer Events"
20506 ],
20507 initial: "auto",
20508 appliesto: "allElementsExceptNonReplacedInlineElementsTableRowsColumnsRowColumnGroups",
20509 computed: "asSpecified",
20510 order: "uniqueOrder",
20511 status: "standard"
20512 },
20513 transform: transform,
20514 "transform-box": {
20515 syntax: "border-box | fill-box | view-box",
20516 media: "visual",
20517 inherited: false,
20518 animationType: "discrete",
20519 percentages: "no",
20520 groups: [
20521 "CSS Transforms"
20522 ],
20523 initial: "border-box ",
20524 appliesto: "transformableElements",
20525 computed: "asSpecified",
20526 order: "uniqueOrder",
20527 status: "standard"
20528 },
20529 "transform-origin": {
20530 syntax: "[ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>?",
20531 media: "visual",
20532 inherited: false,
20533 animationType: "simpleListOfLpc",
20534 percentages: "referToSizeOfBoundingBox",
20535 groups: [
20536 "CSS Transforms"
20537 ],
20538 initial: "50% 50% 0",
20539 appliesto: "transformableElements",
20540 computed: "forLengthAbsoluteValueOtherwisePercentage",
20541 order: "oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
20542 status: "standard"
20543 },
20544 "transform-style": {
20545 syntax: "flat | preserve-3d",
20546 media: "visual",
20547 inherited: false,
20548 animationType: "discrete",
20549 percentages: "no",
20550 groups: [
20551 "CSS Transforms"
20552 ],
20553 initial: "flat",
20554 appliesto: "transformableElements",
20555 computed: "asSpecified",
20556 order: "uniqueOrder",
20557 stacking: true,
20558 status: "standard"
20559 },
20560 transition: transition,
20561 "transition-delay": {
20562 syntax: "<time>#",
20563 media: "interactive",
20564 inherited: false,
20565 animationType: "discrete",
20566 percentages: "no",
20567 groups: [
20568 "CSS Transitions"
20569 ],
20570 initial: "0s",
20571 appliesto: "allElementsAndPseudos",
20572 computed: "asSpecified",
20573 order: "uniqueOrder",
20574 status: "standard"
20575 },
20576 "transition-duration": {
20577 syntax: "<time>#",
20578 media: "interactive",
20579 inherited: false,
20580 animationType: "discrete",
20581 percentages: "no",
20582 groups: [
20583 "CSS Transitions"
20584 ],
20585 initial: "0s",
20586 appliesto: "allElementsAndPseudos",
20587 computed: "asSpecified",
20588 order: "uniqueOrder",
20589 status: "standard"
20590 },
20591 "transition-property": {
20592 syntax: "none | <single-transition-property>#",
20593 media: "visual",
20594 inherited: false,
20595 animationType: "discrete",
20596 percentages: "no",
20597 groups: [
20598 "CSS Transitions"
20599 ],
20600 initial: "all",
20601 appliesto: "allElementsAndPseudos",
20602 computed: "asSpecified",
20603 order: "uniqueOrder",
20604 status: "standard"
20605 },
20606 "transition-timing-function": {
20607 syntax: "<single-transition-timing-function>#",
20608 media: "interactive",
20609 inherited: false,
20610 animationType: "discrete",
20611 percentages: "no",
20612 groups: [
20613 "CSS Transitions"
20614 ],
20615 initial: "ease",
20616 appliesto: "allElementsAndPseudos",
20617 computed: "asSpecified",
20618 order: "uniqueOrder",
20619 status: "standard"
20620 },
20621 translate: translate,
20622 "unicode-bidi": {
20623 syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext",
20624 media: "visual",
20625 inherited: false,
20626 animationType: "discrete",
20627 percentages: "no",
20628 groups: [
20629 "CSS Writing Modes"
20630 ],
20631 initial: "normal",
20632 appliesto: "allElementsSomeValuesNoEffectOnNonInlineElements",
20633 computed: "asSpecified",
20634 order: "uniqueOrder",
20635 status: "standard"
20636 },
20637 "user-select": {
20638 syntax: "auto | text | none | contain | all",
20639 media: "visual",
20640 inherited: false,
20641 animationType: "discrete",
20642 percentages: "no",
20643 groups: [
20644 "CSS Basic User Interface"
20645 ],
20646 initial: "auto",
20647 appliesto: "allElements",
20648 computed: "asSpecified",
20649 order: "uniqueOrder",
20650 status: "nonstandard"
20651 },
20652 "vertical-align": {
20653 syntax: "baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>",
20654 media: "visual",
20655 inherited: false,
20656 animationType: "length",
20657 percentages: "referToLineHeight",
20658 groups: [
20659 "CSS Table"
20660 ],
20661 initial: "baseline",
20662 appliesto: "inlineLevelAndTableCellElements",
20663 computed: "absoluteLengthOrKeyword",
20664 order: "uniqueOrder",
20665 alsoAppliesTo: [
20666 "::first-letter",
20667 "::first-line",
20668 "::placeholder"
20669 ],
20670 status: "standard"
20671 },
20672 visibility: visibility,
20673 "white-space": {
20674 syntax: "normal | pre | nowrap | pre-wrap | pre-line",
20675 media: "visual",
20676 inherited: true,
20677 animationType: "discrete",
20678 percentages: "no",
20679 groups: [
20680 "CSS Text"
20681 ],
20682 initial: "normal",
20683 appliesto: "allElements",
20684 computed: "asSpecified",
20685 order: "uniqueOrder",
20686 status: "standard"
20687 },
20688 widows: widows,
20689 width: width,
20690 "will-change": {
20691 syntax: "auto | <animateable-feature>#",
20692 media: "all",
20693 inherited: false,
20694 animationType: "discrete",
20695 percentages: "no",
20696 groups: [
20697 "CSS Will Change"
20698 ],
20699 initial: "auto",
20700 appliesto: "allElements",
20701 computed: "asSpecified",
20702 order: "uniqueOrder",
20703 status: "standard"
20704 },
20705 "word-break": {
20706 syntax: "normal | break-all | keep-all | break-word",
20707 media: "visual",
20708 inherited: true,
20709 animationType: "discrete",
20710 percentages: "no",
20711 groups: [
20712 "CSS Text"
20713 ],
20714 initial: "normal",
20715 appliesto: "allElements",
20716 computed: "asSpecified",
20717 order: "uniqueOrder",
20718 status: "standard"
20719 },
20720 "word-spacing": {
20721 syntax: "normal | <length-percentage>",
20722 media: "visual",
20723 inherited: true,
20724 animationType: "length",
20725 percentages: "referToWidthOfAffectedGlyph",
20726 groups: [
20727 "CSS Text"
20728 ],
20729 initial: "normal",
20730 appliesto: "allElements",
20731 computed: "optimumMinAndMaxValueOfAbsoluteLengthPercentageOrNormal",
20732 order: "uniqueOrder",
20733 alsoAppliesTo: [
20734 "::first-letter",
20735 "::first-line",
20736 "::placeholder"
20737 ],
20738 status: "standard"
20739 },
20740 "word-wrap": {
20741 syntax: "normal | break-word",
20742 media: "visual",
20743 inherited: true,
20744 animationType: "discrete",
20745 percentages: "no",
20746 groups: [
20747 "CSS Text"
20748 ],
20749 initial: "normal",
20750 appliesto: "allElements",
20751 computed: "asSpecified",
20752 order: "uniqueOrder",
20753 status: "standard"
20754 },
20755 "writing-mode": {
20756 syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr",
20757 media: "visual",
20758 inherited: true,
20759 animationType: "discrete",
20760 percentages: "no",
20761 groups: [
20762 "CSS Writing Modes"
20763 ],
20764 initial: "horizontal-tb",
20765 appliesto: "allElementsExceptTableRowColumnGroupsTableRowsColumns",
20766 computed: "asSpecified",
20767 order: "uniqueOrder",
20768 status: "standard"
20769 },
20770 "z-index": {
20771 syntax: "auto | <integer>",
20772 media: "visual",
20773 inherited: false,
20774 animationType: "integer",
20775 percentages: "no",
20776 groups: [
20777 "CSS Positioning"
20778 ],
20779 initial: "auto",
20780 appliesto: "positionedElements",
20781 computed: "asSpecified",
20782 order: "uniqueOrder",
20783 stacking: true,
20784 status: "standard"
20785 },
20786 zoom: zoom
20787 };
20788
20789 var properties$2 = /*#__PURE__*/Object.freeze({
20790 all: all,
20791 animation: animation,
20792 appearance: appearance,
20793 azimuth: azimuth,
20794 background: background,
20795 border: border,
20796 bottom: bottom,
20797 clear: clear,
20798 clip: clip,
20799 color: color,
20800 columns: columns,
20801 contain: contain,
20802 content: content,
20803 cursor: cursor,
20804 direction: direction,
20805 display: display,
20806 filter: filter,
20807 flex: flex,
20808 float: float,
20809 font: font,
20810 gap: gap,
20811 grid: grid,
20812 height: height,
20813 hyphens: hyphens,
20814 isolation: isolation,
20815 left: left,
20816 margin: margin,
20817 mask: mask,
20818 offset: offset,
20819 opacity: opacity,
20820 order: order,
20821 orphans: orphans,
20822 outline: outline,
20823 overflow: overflow,
20824 padding: padding,
20825 perspective: perspective,
20826 position: position,
20827 quotes: quotes,
20828 resize: resize,
20829 right: right,
20830 rotate: rotate,
20831 scale: scale,
20832 top: top,
20833 transform: transform,
20834 transition: transition,
20835 translate: translate,
20836 visibility: visibility,
20837 widows: widows,
20838 width: width,
20839 zoom: zoom,
20840 default: properties$1
20841 });
20842
20843 var attachment = {
20844 syntax: "scroll | fixed | local"
20845 };
20846 var box = {
20847 syntax: "border-box | padding-box | content-box"
20848 };
20849 var color$1 = {
20850 syntax: "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>"
20851 };
20852 var gradient = {
20853 syntax: "<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()>"
20854 };
20855 var hue = {
20856 syntax: "<number> | <angle>"
20857 };
20858 var image = {
20859 syntax: "<url> | <image()> | <image-set()> | <element()> | <cross-fade()> | <gradient>"
20860 };
20861 var nth = {
20862 syntax: "<an-plus-b> | even | odd"
20863 };
20864 var position$1 = {
20865 syntax: "[ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]"
20866 };
20867 var quote = {
20868 syntax: "open-quote | close-quote | no-open-quote | no-close-quote"
20869 };
20870 var shadow = {
20871 syntax: "inset? && <length>{2,4} && <color>?"
20872 };
20873 var shape$1 = {
20874 syntax: "rect(<top>, <right>, <bottom>, <left>)"
20875 };
20876 var size = {
20877 syntax: "closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}"
20878 };
20879 var symbol = {
20880 syntax: "<string> | <image> | <custom-ident>"
20881 };
20882 var target = {
20883 syntax: "<target-counter()> | <target-counters()> | <target-text()>"
20884 };
20885 var syntaxes = {
20886 "absolute-size": {
20887 syntax: "xx-small | x-small | small | medium | large | x-large | xx-large"
20888 },
20889 "alpha-value": {
20890 syntax: "<number> | <percentage>"
20891 },
20892 "angle-percentage": {
20893 syntax: "<angle> | <percentage>"
20894 },
20895 "animateable-feature": {
20896 syntax: "scroll-position | contents | <custom-ident>"
20897 },
20898 attachment: attachment,
20899 "attr()": {
20900 syntax: "attr( <attr-name> <type-or-unit>? [, <attr-fallback> ]? )"
20901 },
20902 "attr-matcher": {
20903 syntax: "[ '~' | '|' | '^' | '$' | '*' ]? '='"
20904 },
20905 "attr-modifier": {
20906 syntax: "i"
20907 },
20908 "attribute-selector": {
20909 syntax: "'[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'"
20910 },
20911 "auto-repeat": {
20912 syntax: "repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
20913 },
20914 "auto-track-list": {
20915 syntax: "[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>? <auto-repeat>\n[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?"
20916 },
20917 "baseline-position": {
20918 syntax: "[ first | last ]? baseline"
20919 },
20920 "basic-shape": {
20921 syntax: "<inset()> | <circle()> | <ellipse()> | <polygon()>"
20922 },
20923 "bg-image": {
20924 syntax: "none | <image>"
20925 },
20926 "bg-layer": {
20927 syntax: "<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
20928 },
20929 "bg-position": {
20930 syntax: "[ [ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] | [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ] ]"
20931 },
20932 "bg-size": {
20933 syntax: "[ <length-percentage> | auto ]{1,2} | cover | contain"
20934 },
20935 "blur()": {
20936 syntax: "blur( <length> )"
20937 },
20938 "blend-mode": {
20939 syntax: "normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity"
20940 },
20941 box: box,
20942 "br-style": {
20943 syntax: "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset"
20944 },
20945 "br-width": {
20946 syntax: "<length> | thin | medium | thick"
20947 },
20948 "brightness()": {
20949 syntax: "brightness( <number-percentage> )"
20950 },
20951 "calc()": {
20952 syntax: "calc( <calc-sum> )"
20953 },
20954 "calc-sum": {
20955 syntax: "<calc-product> [ [ '+' | '-' ] <calc-product> ]*"
20956 },
20957 "calc-product": {
20958 syntax: "<calc-value> [ '*' <calc-value> | '/' <number> ]*"
20959 },
20960 "calc-value": {
20961 syntax: "<number> | <dimension> | <percentage> | ( <calc-sum> )"
20962 },
20963 "cf-final-image": {
20964 syntax: "<image> | <color>"
20965 },
20966 "cf-mixing-image": {
20967 syntax: "<percentage>? && <image>"
20968 },
20969 "circle()": {
20970 syntax: "circle( [ <shape-radius> ]? [ at <position> ]? )"
20971 },
20972 "class-selector": {
20973 syntax: "'.' <ident-token>"
20974 },
20975 "clip-source": {
20976 syntax: "<url>"
20977 },
20978 color: color$1,
20979 "color-stop": {
20980 syntax: "<color> <length-percentage>?"
20981 },
20982 "color-stop-list": {
20983 syntax: "<color-stop>#{2,}"
20984 },
20985 "common-lig-values": {
20986 syntax: "[ common-ligatures | no-common-ligatures ]"
20987 },
20988 "composite-style": {
20989 syntax: "clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor"
20990 },
20991 "compositing-operator": {
20992 syntax: "add | subtract | intersect | exclude"
20993 },
20994 "compound-selector": {
20995 syntax: "[ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!"
20996 },
20997 "compound-selector-list": {
20998 syntax: "<compound-selector>#"
20999 },
21000 "contextual-alt-values": {
21001 syntax: "[ contextual | no-contextual ]"
21002 },
21003 "content-distribution": {
21004 syntax: "space-between | space-around | space-evenly | stretch"
21005 },
21006 "content-list": {
21007 syntax: "[ <string> | contents | <image> | <quote> | <target> | <leader()> ]+"
21008 },
21009 "content-position": {
21010 syntax: "center | start | end | flex-start | flex-end"
21011 },
21012 "content-replacement": {
21013 syntax: "<image>"
21014 },
21015 "contrast()": {
21016 syntax: "contrast( [ <number-percentage> ] )"
21017 },
21018 "counter-style": {
21019 syntax: "<counter-style-name> | symbols()"
21020 },
21021 "counter-style-name": {
21022 syntax: "<custom-ident>"
21023 },
21024 "cross-fade()": {
21025 syntax: "cross-fade( <cf-mixing-image> , <cf-final-image>? )"
21026 },
21027 "cubic-bezier-timing-function": {
21028 syntax: "ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number>, <number>, <number>, <number>)"
21029 },
21030 "deprecated-system-color": {
21031 syntax: "ActiveBorder | ActiveCaption | AppWorkspace | Background | ButtonFace | ButtonHighlight | ButtonShadow | ButtonText | CaptionText | GrayText | Highlight | HighlightText | InactiveBorder | InactiveCaption | InactiveCaptionText | InfoBackground | InfoText | Menu | MenuText | Scrollbar | ThreeDDarkShadow | ThreeDFace | ThreeDHighlight | ThreeDLightShadow | ThreeDShadow | Window | WindowFrame | WindowText"
21032 },
21033 "discretionary-lig-values": {
21034 syntax: "[ discretionary-ligatures | no-discretionary-ligatures ]"
21035 },
21036 "display-box": {
21037 syntax: "contents | none"
21038 },
21039 "display-inside": {
21040 syntax: "flow | flow-root | table | flex | grid | subgrid | ruby"
21041 },
21042 "display-internal": {
21043 syntax: "table-row-group | table-header-group | table-footer-group | table-row | table-cell | table-column-group | table-column | table-caption | ruby-base | ruby-text | ruby-base-container | ruby-text-container"
21044 },
21045 "display-legacy": {
21046 syntax: "inline-block | inline-list-item | inline-table | inline-flex | inline-grid"
21047 },
21048 "display-listitem": {
21049 syntax: "<display-outside>? && [ flow | flow-root ]? && list-item"
21050 },
21051 "display-outside": {
21052 syntax: "block | inline | run-in"
21053 },
21054 "drop-shadow()": {
21055 syntax: "drop-shadow( <length>{2,3} <color>? )"
21056 },
21057 "east-asian-variant-values": {
21058 syntax: "[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]"
21059 },
21060 "east-asian-width-values": {
21061 syntax: "[ full-width | proportional-width ]"
21062 },
21063 "element()": {
21064 syntax: "element( <id-selector> )"
21065 },
21066 "ellipse()": {
21067 syntax: "ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )"
21068 },
21069 "ending-shape": {
21070 syntax: "circle | ellipse"
21071 },
21072 "explicit-track-list": {
21073 syntax: "[ <line-names>? <track-size> ]+ <line-names>?"
21074 },
21075 "family-name": {
21076 syntax: "<string> | <custom-ident>+"
21077 },
21078 "feature-tag-value": {
21079 syntax: "<string> [ <integer> | on | off ]?"
21080 },
21081 "feature-type": {
21082 syntax: "@stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation"
21083 },
21084 "feature-value-block": {
21085 syntax: "<feature-type> {\n <feature-value-declaration-list>\n}"
21086 },
21087 "feature-value-block-list": {
21088 syntax: "<feature-value-block>+"
21089 },
21090 "feature-value-declaration": {
21091 syntax: "<custom-ident>: <integer>+;"
21092 },
21093 "feature-value-declaration-list": {
21094 syntax: "<feature-value-declaration>"
21095 },
21096 "feature-value-name": {
21097 syntax: "<custom-ident>"
21098 },
21099 "fill-rule": {
21100 syntax: "nonzero | evenodd"
21101 },
21102 "filter-function": {
21103 syntax: "<blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>"
21104 },
21105 "filter-function-list": {
21106 syntax: "[ <filter-function> | <url> ]+"
21107 },
21108 "final-bg-layer": {
21109 syntax: "<'background-color'> || <bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
21110 },
21111 "fit-content()": {
21112 syntax: "fit-content( [ <length> | <percentage> ] )"
21113 },
21114 "fixed-breadth": {
21115 syntax: "<length-percentage>"
21116 },
21117 "fixed-repeat": {
21118 syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
21119 },
21120 "fixed-size": {
21121 syntax: "<fixed-breadth> | minmax( <fixed-breadth> , <track-breadth> ) | minmax( <inflexible-breadth> , <fixed-breadth> )"
21122 },
21123 "font-stretch-absolute": {
21124 syntax: "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage>"
21125 },
21126 "font-variant-css21": {
21127 syntax: "[ normal | small-caps ]"
21128 },
21129 "font-weight-absolute": {
21130 syntax: "normal | bold | <number>"
21131 },
21132 "frames-timing-function": {
21133 syntax: "frames(<integer>)"
21134 },
21135 "frequency-percentage": {
21136 syntax: "<frequency> | <percentage>"
21137 },
21138 "general-enclosed": {
21139 syntax: "[ <function-token> <any-value> ) ] | ( <ident> <any-value> )"
21140 },
21141 "generic-family": {
21142 syntax: "serif | sans-serif | cursive | fantasy | monospace"
21143 },
21144 "generic-name": {
21145 syntax: "serif | sans-serif | cursive | fantasy | monospace"
21146 },
21147 "geometry-box": {
21148 syntax: "<shape-box> | fill-box | stroke-box | view-box"
21149 },
21150 gradient: gradient,
21151 "grayscale()": {
21152 syntax: "grayscale( <number-percentage> )"
21153 },
21154 "grid-line": {
21155 syntax: "auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ]"
21156 },
21157 "historical-lig-values": {
21158 syntax: "[ historical-ligatures | no-historical-ligatures ]"
21159 },
21160 "hsl()": {
21161 syntax: "hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )"
21162 },
21163 "hsla()": {
21164 syntax: "hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )"
21165 },
21166 hue: hue,
21167 "hue-rotate()": {
21168 syntax: "hue-rotate( <angle> )"
21169 },
21170 "id-selector": {
21171 syntax: "<hash-token>"
21172 },
21173 image: image,
21174 "image()": {
21175 syntax: "image( [ [ <image> | <string> ]? , <color>? ]! )"
21176 },
21177 "image-set()": {
21178 syntax: "image-set( <image-set-option># )"
21179 },
21180 "image-set-option": {
21181 syntax: "[ <image> | <string> ] <resolution>"
21182 },
21183 "inflexible-breadth": {
21184 syntax: "<length> | <percentage> | min-content | max-content | auto"
21185 },
21186 "inset()": {
21187 syntax: "inset( <length-percentage>{1,4} [ round <border-radius> ]? )"
21188 },
21189 "invert()": {
21190 syntax: "invert( <number-percentage> )"
21191 },
21192 "keyframes-name": {
21193 syntax: "<custom-ident> | <string>"
21194 },
21195 "keyframe-block": {
21196 syntax: "<keyframe-selector># {\n <declaration-list>\n}"
21197 },
21198 "keyframe-block-list": {
21199 syntax: "<keyframe-block>+"
21200 },
21201 "keyframe-selector": {
21202 syntax: "from | to | <percentage>"
21203 },
21204 "leader()": {
21205 syntax: "leader( <leader-type> )"
21206 },
21207 "leader-type": {
21208 syntax: "dotted | solid | space | <string>"
21209 },
21210 "length-percentage": {
21211 syntax: "<length> | <percentage>"
21212 },
21213 "line-names": {
21214 syntax: "'[' <custom-ident>* ']'"
21215 },
21216 "line-name-list": {
21217 syntax: "[ <line-names> | <name-repeat> ]+"
21218 },
21219 "linear-gradient()": {
21220 syntax: "linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
21221 },
21222 "mask-layer": {
21223 syntax: "<mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>"
21224 },
21225 "mask-position": {
21226 syntax: "[ <length-percentage> | left | center | right ] [ <length-percentage> | top | center | bottom ]?"
21227 },
21228 "mask-reference": {
21229 syntax: "none | <image> | <mask-source>"
21230 },
21231 "mask-source": {
21232 syntax: "<url>"
21233 },
21234 "masking-mode": {
21235 syntax: "alpha | luminance | match-source"
21236 },
21237 "matrix()": {
21238 syntax: "matrix( <number> [, <number> ]{5,5} )"
21239 },
21240 "matrix3d()": {
21241 syntax: "matrix3d( <number> [, <number> ]{15,15} )"
21242 },
21243 "media-and": {
21244 syntax: "<media-in-parens> [ and <media-in-parens> ]+"
21245 },
21246 "media-condition": {
21247 syntax: "<media-not> | <media-and> | <media-or> | <media-in-parens>"
21248 },
21249 "media-condition-without-or": {
21250 syntax: "<media-not> | <media-and> | <media-in-parens>"
21251 },
21252 "media-feature": {
21253 syntax: "( [ <mf-plain> | <mf-boolean> | <mf-range> ] )"
21254 },
21255 "media-in-parens": {
21256 syntax: "( <media-condition> ) | <media-feature> | <general-enclosed>"
21257 },
21258 "media-not": {
21259 syntax: "not <media-in-parens>"
21260 },
21261 "media-or": {
21262 syntax: "<media-in-parens> [ or <media-in-parens> ]+"
21263 },
21264 "media-query": {
21265 syntax: "<media-condition> | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?"
21266 },
21267 "media-query-list": {
21268 syntax: "<media-query>#"
21269 },
21270 "media-type": {
21271 syntax: "<ident>"
21272 },
21273 "mf-boolean": {
21274 syntax: "<mf-name>"
21275 },
21276 "mf-name": {
21277 syntax: "<ident>"
21278 },
21279 "mf-plain": {
21280 syntax: "<mf-name> : <mf-value>"
21281 },
21282 "mf-range": {
21283 syntax: "<mf-name> [ '<' | '>' ]? '='? <mf-value>\n| <mf-value> [ '<' | '>' ]? '='? <mf-name>\n| <mf-value> '<' '='? <mf-name> '<' '='? <mf-value>\n| <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>"
21284 },
21285 "mf-value": {
21286 syntax: "<number> | <dimension> | <ident> | <ratio>"
21287 },
21288 "minmax()": {
21289 syntax: "minmax( [ <length> | <percentage> | <flex> | min-content | max-content | auto ] , [ <length> | <percentage> | <flex> | min-content | max-content | auto ] )"
21290 },
21291 "named-color": {
21292 syntax: "transparent | aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen"
21293 },
21294 "namespace-prefix": {
21295 syntax: "<ident>"
21296 },
21297 "ns-prefix": {
21298 syntax: "[ <ident-token> | '*' ]? '|'"
21299 },
21300 "number-percentage": {
21301 syntax: "<number> | <percentage>"
21302 },
21303 "numeric-figure-values": {
21304 syntax: "[ lining-nums | oldstyle-nums ]"
21305 },
21306 "numeric-fraction-values": {
21307 syntax: "[ diagonal-fractions | stacked-fractions ]"
21308 },
21309 "numeric-spacing-values": {
21310 syntax: "[ proportional-nums | tabular-nums ]"
21311 },
21312 nth: nth,
21313 "opacity()": {
21314 syntax: "opacity( [ <number-percentage> ] )"
21315 },
21316 "overflow-position": {
21317 syntax: "unsafe | safe"
21318 },
21319 "outline-radius": {
21320 syntax: "<length> | <percentage>"
21321 },
21322 "page-body": {
21323 syntax: "<declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>"
21324 },
21325 "page-margin-box": {
21326 syntax: "<page-margin-box-type> {\n <declaration-list>\n}"
21327 },
21328 "page-margin-box-type": {
21329 syntax: "@top-left-corner | @top-left | @top-center | @top-right | @top-right-corner | @bottom-left-corner | @bottom-left | @bottom-center | @bottom-right | @bottom-right-corner | @left-top | @left-middle | @left-bottom | @right-top | @right-middle | @right-bottom"
21330 },
21331 "page-selector-list": {
21332 syntax: "[ <page-selector># ]?"
21333 },
21334 "page-selector": {
21335 syntax: "<pseudo-page>+ | <ident> <pseudo-page>*"
21336 },
21337 "perspective()": {
21338 syntax: "perspective( <length> )"
21339 },
21340 "polygon()": {
21341 syntax: "polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )"
21342 },
21343 position: position$1,
21344 "pseudo-class-selector": {
21345 syntax: "':' <ident-token> | ':' <function-token> <any-value> ')'"
21346 },
21347 "pseudo-element-selector": {
21348 syntax: "':' <pseudo-class-selector>"
21349 },
21350 "pseudo-page": {
21351 syntax: ": [ left | right | first | blank ]"
21352 },
21353 quote: quote,
21354 "radial-gradient()": {
21355 syntax: "radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
21356 },
21357 "relative-size": {
21358 syntax: "larger | smaller"
21359 },
21360 "repeat-style": {
21361 syntax: "repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}"
21362 },
21363 "repeating-linear-gradient()": {
21364 syntax: "repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
21365 },
21366 "repeating-radial-gradient()": {
21367 syntax: "repeating-radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
21368 },
21369 "rgb()": {
21370 syntax: "rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )"
21371 },
21372 "rgba()": {
21373 syntax: "rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )"
21374 },
21375 "rotate()": {
21376 syntax: "rotate( <angle> )"
21377 },
21378 "rotate3d()": {
21379 syntax: "rotate3d( <number> , <number> , <number> , <angle> )"
21380 },
21381 "rotateX()": {
21382 syntax: "rotateX( <angle> )"
21383 },
21384 "rotateY()": {
21385 syntax: "rotateY( <angle> )"
21386 },
21387 "rotateZ()": {
21388 syntax: "rotateZ( <angle> )"
21389 },
21390 "saturate()": {
21391 syntax: "saturate( <number-percentage> )"
21392 },
21393 "scale()": {
21394 syntax: "scale( <number> [, <number> ]? )"
21395 },
21396 "scale3d()": {
21397 syntax: "scale3d( <number> , <number> , <number> )"
21398 },
21399 "scaleX()": {
21400 syntax: "scaleX( <number> )"
21401 },
21402 "scaleY()": {
21403 syntax: "scaleY( <number> )"
21404 },
21405 "scaleZ()": {
21406 syntax: "scaleZ( <number> )"
21407 },
21408 "self-position": {
21409 syntax: "center | start | end | self-start | self-end | flex-start | flex-end"
21410 },
21411 "shape-radius": {
21412 syntax: "<length-percentage> | closest-side | farthest-side"
21413 },
21414 "skew()": {
21415 syntax: "skew( <angle> [, <angle> ]? )"
21416 },
21417 "skewX()": {
21418 syntax: "skewX( <angle> )"
21419 },
21420 "skewY()": {
21421 syntax: "skewY( <angle> )"
21422 },
21423 "sepia()": {
21424 syntax: "sepia( <number-percentage> )"
21425 },
21426 shadow: shadow,
21427 "shadow-t": {
21428 syntax: "[ <length>{2,3} && <color>? ]"
21429 },
21430 shape: shape$1,
21431 "shape-box": {
21432 syntax: "<box> | margin-box"
21433 },
21434 "side-or-corner": {
21435 syntax: "[ left | right ] || [ top | bottom ]"
21436 },
21437 "single-animation": {
21438 syntax: "<time> || <single-timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ]"
21439 },
21440 "single-animation-direction": {
21441 syntax: "normal | reverse | alternate | alternate-reverse"
21442 },
21443 "single-animation-fill-mode": {
21444 syntax: "none | forwards | backwards | both"
21445 },
21446 "single-animation-iteration-count": {
21447 syntax: "infinite | <number>"
21448 },
21449 "single-animation-play-state": {
21450 syntax: "running | paused"
21451 },
21452 "single-timing-function": {
21453 syntax: "linear | <cubic-bezier-timing-function> | <step-timing-function> | <frames-timing-function>"
21454 },
21455 "single-transition": {
21456 syntax: "[ none | <single-transition-property> ] || <time> || <single-transition-timing-function> || <time>"
21457 },
21458 "single-transition-timing-function": {
21459 syntax: "<single-timing-function>"
21460 },
21461 "single-transition-property": {
21462 syntax: "all | <custom-ident>"
21463 },
21464 size: size,
21465 "step-timing-function": {
21466 syntax: "step-start | step-end | steps(<integer>[, [ start | end ] ]?)"
21467 },
21468 "subclass-selector": {
21469 syntax: "<id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector>"
21470 },
21471 symbol: symbol,
21472 target: target,
21473 "target-counter()": {
21474 syntax: "target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )"
21475 },
21476 "target-counters()": {
21477 syntax: "target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )"
21478 },
21479 "target-text()": {
21480 syntax: "target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )"
21481 },
21482 "time-percentage": {
21483 syntax: "<time> | <percentage>"
21484 },
21485 "track-breadth": {
21486 syntax: "<length-percentage> | <flex> | min-content | max-content | auto"
21487 },
21488 "track-list": {
21489 syntax: "[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?"
21490 },
21491 "track-repeat": {
21492 syntax: "repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )"
21493 },
21494 "track-size": {
21495 syntax: "<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )"
21496 },
21497 "transform-function": {
21498 syntax: "<matrix()> | <translate()> | <translateX()> | <translateY()> | <scale()> | <scaleX()> | <scaleY()> | <rotate()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <translate3d()> | <translateZ()> | <scale3d()> | <scaleZ()> | <rotate3d()> | <rotateX()> | <rotateY()> | <rotateZ()> | <perspective()>"
21499 },
21500 "transform-list": {
21501 syntax: "<transform-function>+"
21502 },
21503 "translate()": {
21504 syntax: "translate( <length-percentage> [, <length-percentage> ]? )"
21505 },
21506 "translate3d()": {
21507 syntax: "translate3d( <length-percentage> , <length-percentage> , <length> )"
21508 },
21509 "translateX()": {
21510 syntax: "translateX( <length-percentage> )"
21511 },
21512 "translateY()": {
21513 syntax: "translateY( <length-percentage> )"
21514 },
21515 "translateZ()": {
21516 syntax: "translateZ( <length> )"
21517 },
21518 "type-or-unit": {
21519 syntax: "string | integer | color | url | integer | number | length | angle | time | frequency | em | ex | px | rem | vw | vh | vmin | vmax | mm | q | cm | in | pt | pc | deg | grad | rad | ms | s | Hz | kHz | %"
21520 },
21521 "type-selector": {
21522 syntax: "<wq-name> | <ns-prefix>? '*'"
21523 },
21524 "var()": {
21525 syntax: "var( <custom-property-name> [, <declaration-value> ]? )"
21526 },
21527 "viewport-length": {
21528 syntax: "auto | <length-percentage>"
21529 },
21530 "wq-name": {
21531 syntax: "<ns-prefix>? <ident-token>"
21532 }
21533 };
21534
21535 var syntaxes$1 = /*#__PURE__*/Object.freeze({
21536 attachment: attachment,
21537 box: box,
21538 color: color$1,
21539 gradient: gradient,
21540 hue: hue,
21541 image: image,
21542 nth: nth,
21543 position: position$1,
21544 quote: quote,
21545 shadow: shadow,
21546 shape: shape$1,
21547 size: size,
21548 symbol: symbol,
21549 target: target,
21550 default: syntaxes
21551 });
21552
21553 var properties$3 = {
21554 "--*": {
21555 comment: "syntax is incorrect and can't be parsed, drop for now",
21556 syntax: null
21557 },
21558 "-moz-background-clip": {
21559 comment: "deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
21560 syntax: "padding | border"
21561 },
21562 "-moz-border-radius-bottomleft": {
21563 comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-left-radius",
21564 syntax: "<'border-bottom-left-radius'>"
21565 },
21566 "-moz-border-radius-bottomright": {
21567 comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
21568 syntax: "<'border-bottom-right-radius'>"
21569 },
21570 "-moz-border-radius-topleft": {
21571 comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius",
21572 syntax: "<'border-top-left-radius'>"
21573 },
21574 "-moz-border-radius-topright": {
21575 comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
21576 syntax: "<'border-bottom-right-radius'>"
21577 },
21578 "-moz-osx-font-smoothing": {
21579 comment: "misssed old syntax https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
21580 syntax: "auto | grayscale"
21581 },
21582 "-moz-user-select": {
21583 comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
21584 syntax: "none | text | all | -moz-none"
21585 },
21586 "-ms-flex-align": {
21587 comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
21588 syntax: "start | end | center | baseline | stretch"
21589 },
21590 "-ms-flex-item-align": {
21591 comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
21592 syntax: "auto | start | end | center | baseline | stretch"
21593 },
21594 "-ms-flex-line-pack": {
21595 comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-line-pack",
21596 syntax: "start | end | center | justify | distribute | stretch"
21597 },
21598 "-ms-flex-negative": {
21599 comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
21600 syntax: "<'flex-shrink'>"
21601 },
21602 "-ms-flex-pack": {
21603 comment: "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack",
21604 syntax: "start | end | center | justify | distribute"
21605 },
21606 "-ms-flex-order": {
21607 comment: "misssed old syntax implemented in IE; https://msdn.microsoft.com/en-us/library/jj127303(v=vs.85).aspx",
21608 syntax: "<integer>"
21609 },
21610 "-ms-flex-positive": {
21611 comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
21612 syntax: "<'flex-grow'>"
21613 },
21614 "-ms-flex-preferred-size": {
21615 comment: "misssed old syntax implemented in IE; TODO: find references for comfirmation",
21616 syntax: "<'flex-basis'>"
21617 },
21618 "-ms-interpolation-mode": {
21619 comment: "https://msdn.microsoft.com/en-us/library/ff521095(v=vs.85).aspx",
21620 syntax: "nearest-neighbor | bicubic"
21621 },
21622 "-ms-grid-column-align": {
21623 comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx",
21624 syntax: "start | end | center | stretch"
21625 },
21626 "-ms-grid-row-align": {
21627 comment: "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx",
21628 syntax: "start | end | center | stretch"
21629 },
21630 "-webkit-appearance": {
21631 comment: "webkit specific keywords",
21632 references: [
21633 "http://css-infos.net/property/-webkit-appearance"
21634 ],
21635 syntax: "none | button | button-bevel | caps-lock-indicator | caret | checkbox | default-button | listbox | listitem | media-fullscreen-button | media-mute-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | push-button | radio | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield"
21636 },
21637 "-webkit-background-clip": {
21638 comment: "https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
21639 syntax: "[ <box> | border | padding | content | text ]#"
21640 },
21641 "-webkit-column-break-after": {
21642 comment: "added, http://help.dottoro.com/lcrthhhv.php",
21643 syntax: "always | auto | avoid"
21644 },
21645 "-webkit-column-break-before": {
21646 comment: "added, http://help.dottoro.com/lcxquvkf.php",
21647 syntax: "always | auto | avoid"
21648 },
21649 "-webkit-column-break-inside": {
21650 comment: "added, http://help.dottoro.com/lclhnthl.php",
21651 syntax: "always | auto | avoid"
21652 },
21653 "-webkit-font-smoothing": {
21654 comment: "https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
21655 syntax: "auto | none | antialiased | subpixel-antialiased"
21656 },
21657 "-webkit-line-clamp": {
21658 comment: "non-standard and deprecated but may still using by some sites",
21659 syntax: "<positive-integer>"
21660 },
21661 "-webkit-mask-box-image": {
21662 comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
21663 syntax: "[ <url> | <gradient> | none ] [ <length-percentage>{4} <-webkit-mask-box-repeat>{2} ]?"
21664 },
21665 "-webkit-mask-clip": {
21666 comment: "change type to <-webkit-mask-clip-style> since it differ from <mask-clip>, extra space between [ and ,",
21667 syntax: "<-webkit-mask-clip-style> [, <-webkit-mask-clip-style> ]*"
21668 },
21669 "-webkit-print-color-adjust": {
21670 comment: "missed",
21671 references: [
21672 "https://developer.mozilla.org/en/docs/Web/CSS/-webkit-print-color-adjust"
21673 ],
21674 syntax: "economy | exact"
21675 },
21676 "-webkit-text-security": {
21677 comment: "missed; http://help.dottoro.com/lcbkewgt.php",
21678 syntax: "none | circle | disc | square"
21679 },
21680 "-webkit-user-drag": {
21681 comment: "missed; http://help.dottoro.com/lcbixvwm.php",
21682 syntax: "none | element | auto"
21683 },
21684 "-webkit-user-select": {
21685 comment: "auto is supported by old webkit, https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
21686 syntax: "auto | none | text | all"
21687 },
21688 "alignment-baseline": {
21689 comment: "added SVG property",
21690 references: [
21691 "https://www.w3.org/TR/SVG/text.html#AlignmentBaselineProperty"
21692 ],
21693 syntax: "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"
21694 },
21695 "baseline-shift": {
21696 comment: "added SVG property",
21697 references: [
21698 "https://www.w3.org/TR/SVG/text.html#BaselineShiftProperty"
21699 ],
21700 syntax: "baseline | sub | super | <svg-length>"
21701 },
21702 behavior: {
21703 comment: "added old IE property https://msdn.microsoft.com/en-us/library/ms530723(v=vs.85).aspx",
21704 syntax: "<url>+"
21705 },
21706 "clip-rule": {
21707 comment: "added SVG property",
21708 references: [
21709 "https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty"
21710 ],
21711 syntax: "nonzero | evenodd"
21712 },
21713 cue: {
21714 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21715 syntax: "<'cue-before'> <'cue-after'>?"
21716 },
21717 "cue-after": {
21718 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21719 syntax: "<url> <decibel>? | none"
21720 },
21721 "cue-before": {
21722 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21723 syntax: "<url> <decibel>? | none"
21724 },
21725 cursor: {
21726 comment: "added legacy keywords: hand, -webkit-grab. -webkit-grabbing, -webkit-zoom-in, -webkit-zoom-out, -moz-grab, -moz-grabbing, -moz-zoom-in, -moz-zoom-out",
21727 refenrences: [
21728 "https://www.sitepoint.com/css3-cursor-styles/"
21729 ],
21730 syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing | hand | -webkit-grab | -webkit-grabbing | -webkit-zoom-in | -webkit-zoom-out | -moz-grab | -moz-grabbing | -moz-zoom-in | -moz-zoom-out ] ]"
21731 },
21732 display: {
21733 comment: "extended with -ms-flexbox",
21734 syntax: "none | inline | block | list-item | inline-list-item | inline-block | inline-table | table | table-cell | table-column | table-column-group | table-footer-group | table-header-group | table-row | table-row-group | flex | inline-flex | grid | inline-grid | run-in | ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | contents | -ms-flexbox | -ms-inline-flexbox | -ms-grid | -ms-inline-grid | -webkit-flex | -webkit-inline-flex | -webkit-box | -webkit-inline-box | -moz-inline-stack | -moz-box | -moz-inline-box"
21735 },
21736 position: {
21737 comment: "extended with -webkit-sticky",
21738 syntax: "static | relative | absolute | sticky | fixed | -webkit-sticky"
21739 },
21740 "dominant-baseline": {
21741 comment: "added SVG property",
21742 references: [
21743 "https://www.w3.org/TR/SVG/text.html#DominantBaselineProperty"
21744 ],
21745 syntax: "auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"
21746 },
21747 "image-rendering": {
21748 comment: "extended with <-non-standard-image-rendering>, added SVG keywords optimizeSpeed and optimizeQuality",
21749 references: [
21750 "https://developer.mozilla.org/en/docs/Web/CSS/image-rendering",
21751 "https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty"
21752 ],
21753 syntax: "auto | crisp-edges | pixelated | optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"
21754 },
21755 fill: {
21756 comment: "added SVG property",
21757 references: [
21758 "https://www.w3.org/TR/SVG/painting.html#FillProperty"
21759 ],
21760 syntax: "<paint>"
21761 },
21762 "fill-opacity": {
21763 comment: "added SVG property",
21764 references: [
21765 "https://www.w3.org/TR/SVG/painting.html#FillProperty"
21766 ],
21767 syntax: "<number-zero-one>"
21768 },
21769 "fill-rule": {
21770 comment: "added SVG property",
21771 references: [
21772 "https://www.w3.org/TR/SVG/painting.html#FillProperty"
21773 ],
21774 syntax: "nonzero | evenodd"
21775 },
21776 filter: {
21777 comment: "extend with IE legacy syntaxes",
21778 syntax: "none | <filter-function-list> | <-ms-filter>"
21779 },
21780 font: {
21781 comment: "extend with non-standard fonts",
21782 syntax: "[ [ <'font-style'> || <font-variant-css21> || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | <-non-standard-font>"
21783 },
21784 "glyph-orientation-horizontal": {
21785 comment: "added SVG property",
21786 references: [
21787 "https://www.w3.org/TR/SVG/text.html#GlyphOrientationHorizontalProperty"
21788 ],
21789 syntax: "<angle>"
21790 },
21791 "glyph-orientation-vertical": {
21792 comment: "added SVG property",
21793 references: [
21794 "https://www.w3.org/TR/SVG/text.html#GlyphOrientationVerticalProperty"
21795 ],
21796 syntax: "<angle>"
21797 },
21798 kerning: {
21799 comment: "added SVG property",
21800 references: [
21801 "https://www.w3.org/TR/SVG/text.html#KerningProperty"
21802 ],
21803 syntax: "auto | <svg-length>"
21804 },
21805 "letter-spacing": {
21806 comment: "fix syntax <length> -> <length-percentage>",
21807 references: [
21808 "https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing"
21809 ],
21810 syntax: "normal | <length-percentage>"
21811 },
21812 "line-height-step": {
21813 comment: "fix extra spaces around",
21814 syntax: "none | <length>"
21815 },
21816 marker: {
21817 comment: "added SVG property",
21818 references: [
21819 "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
21820 ],
21821 syntax: "none | <url>"
21822 },
21823 "marker-end": {
21824 comment: "added SVG property",
21825 references: [
21826 "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
21827 ],
21828 syntax: "none | <url>"
21829 },
21830 "marker-mid": {
21831 comment: "added SVG property",
21832 references: [
21833 "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
21834 ],
21835 syntax: "none | <url>"
21836 },
21837 "marker-start": {
21838 comment: "added SVG property",
21839 references: [
21840 "https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
21841 ],
21842 syntax: "none | <url>"
21843 },
21844 "max-width": {
21845 comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width",
21846 syntax: "<length> | <percentage> | none | max-content | min-content | fit-content | fill-available | <-non-standard-width>"
21847 },
21848 "min-width": {
21849 comment: "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
21850 syntax: "<length> | <percentage> | auto | max-content | min-content | fit-content | fill-available | <-non-standard-width>"
21851 },
21852 opacity: {
21853 comment: "strict to 0..1 <number> -> <number-zero-one>",
21854 syntax: "<number-zero-one>"
21855 },
21856 overflow: {
21857 comment: "extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
21858 syntax: "visible | hidden | scroll | auto | <-non-standard-overflow>"
21859 },
21860 pause: {
21861 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21862 syntax: "<'pause-before'> <'pause-after'>?"
21863 },
21864 "pause-after": {
21865 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21866 syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
21867 },
21868 "pause-before": {
21869 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21870 syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
21871 },
21872 rest: {
21873 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21874 syntax: "<'rest-before'> <'rest-after'>?"
21875 },
21876 "rest-after": {
21877 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21878 syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
21879 },
21880 "rest-before": {
21881 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21882 syntax: "<time> | none | x-weak | weak | medium | strong | x-strong"
21883 },
21884 "shape-rendering": {
21885 comment: "added SVG property",
21886 references: [
21887 "https://www.w3.org/TR/SVG/painting.html#ShapeRenderingPropert"
21888 ],
21889 syntax: "auto | optimizeSpeed | crispEdges | geometricPrecision"
21890 },
21891 src: {
21892 comment: "added @font-face's src property https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src",
21893 syntax: "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#"
21894 },
21895 speak: {
21896 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21897 syntax: "auto | none | normal"
21898 },
21899 "speak-as": {
21900 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21901 syntax: "normal | spell-out || digits || [ literal-punctuation | no-punctuation ]"
21902 },
21903 stroke: {
21904 comment: "added SVG property",
21905 references: [
21906 "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
21907 ],
21908 syntax: "<paint>"
21909 },
21910 "stroke-dasharray": {
21911 comment: "added SVG property; a list of comma and/or white space separated <length>s and <percentage>s",
21912 references: [
21913 "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
21914 ],
21915 syntax: "none | [ <svg-length>+ ]#"
21916 },
21917 "stroke-dashoffset": {
21918 comment: "added SVG property",
21919 references: [
21920 "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
21921 ],
21922 syntax: "<svg-length>"
21923 },
21924 "stroke-linecap": {
21925 comment: "added SVG property",
21926 references: [
21927 "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
21928 ],
21929 syntax: "butt | round | square"
21930 },
21931 "stroke-linejoin": {
21932 comment: "added SVG property",
21933 references: [
21934 "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
21935 ],
21936 syntax: "miter | round | bevel"
21937 },
21938 "stroke-miterlimit": {
21939 comment: "added SVG property (<miterlimit> = <number-one-or-greater>) ",
21940 references: [
21941 "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
21942 ],
21943 syntax: "<number-one-or-greater>"
21944 },
21945 "stroke-opacity": {
21946 comment: "added SVG property",
21947 references: [
21948 "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
21949 ],
21950 syntax: "<number-zero-one>"
21951 },
21952 "stroke-width": {
21953 comment: "added SVG property",
21954 references: [
21955 "https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
21956 ],
21957 syntax: "<svg-length>"
21958 },
21959 "text-anchor": {
21960 comment: "added SVG property",
21961 references: [
21962 "https://www.w3.org/TR/SVG/text.html#TextAlignmentProperties"
21963 ],
21964 syntax: "start | middle | end"
21965 },
21966 "transform-origin": {
21967 comment: "move first group to the end since less collecting",
21968 syntax: "[ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>? | [ <length-percentage> | left | center | right | top | bottom ]"
21969 },
21970 "unicode-bidi": {
21971 comment: "added prefixed keywords https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi",
21972 syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext | -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate"
21973 },
21974 "unicode-range": {
21975 comment: "added missed property https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range",
21976 syntax: "<unicode-range>#"
21977 },
21978 "voice-balance": {
21979 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21980 syntax: "<number> | left | center | right | leftwards | rightwards"
21981 },
21982 "voice-duration": {
21983 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21984 syntax: "auto | <time>"
21985 },
21986 "voice-family": {
21987 comment: "<name> -> <family-name>, https://www.w3.org/TR/css3-speech/#property-index",
21988 syntax: "[ [ <family-name> | <generic-voice> ] , ]* [ <family-name> | <generic-voice> ] | preserve"
21989 },
21990 "voice-pitch": {
21991 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21992 syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
21993 },
21994 "voice-range": {
21995 comment: "https://www.w3.org/TR/css3-speech/#property-index",
21996 syntax: "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
21997 },
21998 "voice-rate": {
21999 comment: "https://www.w3.org/TR/css3-speech/#property-index",
22000 syntax: "[ normal | x-slow | slow | medium | fast | x-fast ] || <percentage>"
22001 },
22002 "voice-stress": {
22003 comment: "https://www.w3.org/TR/css3-speech/#property-index",
22004 syntax: "normal | strong | moderate | none | reduced"
22005 },
22006 "voice-volume": {
22007 comment: "https://www.w3.org/TR/css3-speech/#property-index",
22008 syntax: "silent | [ [ x-soft | soft | medium | loud | x-loud ] || <decibel> ]"
22009 },
22010 "word-break": {
22011 comment: "extend with non-standard keywords",
22012 syntax: "normal | break-all | keep-all | <-non-standard-word-break>"
22013 },
22014 "writing-mode": {
22015 comment: "extend with SVG keywords",
22016 syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr | <svg-writing-mode>"
22017 }
22018 };
22019 var syntaxes$2 = {
22020 "-legacy-gradient": {
22021 comment: "added collection of legacy gradient syntaxes",
22022 syntax: "<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>"
22023 },
22024 "-legacy-linear-gradient": {
22025 comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
22026 syntax: "-moz-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-linear-gradient( <-legacy-linear-gradient-arguments> )"
22027 },
22028 "-legacy-repeating-linear-gradient": {
22029 comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
22030 syntax: "-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )"
22031 },
22032 "-legacy-linear-gradient-arguments": {
22033 comment: "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
22034 syntax: "[ <angle> | <side-or-corner> ]? , <color-stop-list>"
22035 },
22036 "-legacy-radial-gradient": {
22037 comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
22038 syntax: "-moz-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-radial-gradient( <-legacy-radial-gradient-arguments> )"
22039 },
22040 "-legacy-repeating-radial-gradient": {
22041 comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
22042 syntax: "-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )"
22043 },
22044 "-legacy-radial-gradient-arguments": {
22045 comment: "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
22046 syntax: "[ <position> , ]? [ [ [ <-legacy-radial-gradient-shape> || <-legacy-radial-gradient-size> ] | [ <length> | <percentage> ]{2} ] , ]? <color-stop-list>"
22047 },
22048 "-legacy-radial-gradient-size": {
22049 comment: "before a standard it contains 2 extra keywords (`contain` and `cover`) https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltsize",
22050 syntax: "closest-side | closest-corner | farthest-side | farthest-corner | contain | cover"
22051 },
22052 "-legacy-radial-gradient-shape": {
22053 comment: "define to duoble sure it doesn't extends in future https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltshape",
22054 syntax: "circle | ellipse"
22055 },
22056 "-non-standard-font": {
22057 comment: "non standard fonts",
22058 preferences: [
22059 "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
22060 ],
22061 syntax: "-apple-system-body | -apple-system-headline | -apple-system-subheadline | -apple-system-caption1 | -apple-system-caption2 | -apple-system-footnote | -apple-system-short-body | -apple-system-short-headline | -apple-system-short-subheadline | -apple-system-short-caption1 | -apple-system-short-footnote | -apple-system-tall-body"
22062 },
22063 "-non-standard-color": {
22064 comment: "non standard colors",
22065 references: [
22066 "http://cssdot.ru/%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA_CSS/color-i305.html",
22067 "https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Mozilla_Color_Preference_Extensions"
22068 ],
22069 syntax: "-moz-ButtonDefault | -moz-ButtonHoverFace | -moz-ButtonHoverText | -moz-CellHighlight | -moz-CellHighlightText | -moz-Combobox | -moz-ComboboxText | -moz-Dialog | -moz-DialogText | -moz-dragtargetzone | -moz-EvenTreeRow | -moz-Field | -moz-FieldText | -moz-html-CellHighlight | -moz-html-CellHighlightText | -moz-mac-accentdarkestshadow | -moz-mac-accentdarkshadow | -moz-mac-accentface | -moz-mac-accentlightesthighlight | -moz-mac-accentlightshadow | -moz-mac-accentregularhighlight | -moz-mac-accentregularshadow | -moz-mac-chrome-active | -moz-mac-chrome-inactive | -moz-mac-focusring | -moz-mac-menuselect | -moz-mac-menushadow | -moz-mac-menutextselect | -moz-MenuHover | -moz-MenuHoverText | -moz-MenuBarText | -moz-MenuBarHoverText | -moz-nativehyperlinktext | -moz-OddTreeRow | -moz-win-communicationstext | -moz-win-mediatext | -moz-activehyperlinktext | -moz-default-background-color | -moz-default-color | -moz-hyperlinktext | -moz-visitedhyperlinktext | -webkit-activelink | -webkit-focus-ring-color | -webkit-link | -webkit-text"
22070 },
22071 "-non-standard-image-rendering": {
22072 comment: "non-standard keywords http://phrogz.net/tmp/canvas_image_zoom.html",
22073 syntax: "optimize-contrast | -moz-crisp-edges | -o-crisp-edges | -webkit-optimize-contrast"
22074 },
22075 "-non-standard-overflow": {
22076 comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
22077 syntax: "-moz-scrollbars-none | -moz-scrollbars-horizontal | -moz-scrollbars-vertical | -moz-hidden-unscrollable"
22078 },
22079 "-non-standard-width": {
22080 comment: "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
22081 syntax: "min-intrinsic | intrinsic | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content"
22082 },
22083 "-non-standard-word-break": {
22084 comment: "non-standard keywords https://css-tricks.com/almanac/properties/w/word-break/",
22085 syntax: "break-word"
22086 },
22087 "-webkit-gradient()": {
22088 comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/ - TODO: simplify when after match algorithm improvement ( [, point, radius | , point] -> [, radius]? , point )",
22089 syntax: "-webkit-gradient( <-webkit-gradient-type>, <-webkit-gradient-point> [, <-webkit-gradient-point> | , <-webkit-gradient-radius>, <-webkit-gradient-point> ] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )"
22090 },
22091 "-webkit-gradient-color-stop": {
22092 comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
22093 syntax: "from( <color> ) | color-stop( [ <number-zero-one> | <percentage> ] , <color> ) | to( <color> )"
22094 },
22095 "-webkit-gradient-point": {
22096 comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
22097 syntax: "[ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]"
22098 },
22099 "-webkit-gradient-radius": {
22100 comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
22101 syntax: "<length> | <percentage>"
22102 },
22103 "-webkit-gradient-type": {
22104 comment: "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
22105 syntax: "linear | radial"
22106 },
22107 "-webkit-mask-box-repeat": {
22108 comment: "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
22109 syntax: "repeat | stretch | round"
22110 },
22111 "-webkit-mask-clip-style": {
22112 comment: "missed; there is no enough information about `-webkit-mask-clip` property, but looks like all those keywords are working",
22113 syntax: "border | border-box | padding | padding-box | content | content-box | text"
22114 },
22115 "-ms-filter": {
22116 syntax: "[ <progid> | FlipH | FlipV ]+"
22117 },
22118 age: {
22119 comment: "https://www.w3.org/TR/css3-speech/#voice-family",
22120 syntax: "child | young | old"
22121 },
22122 "attr()": {
22123 comment: "drop it since it's a generic",
22124 syntax: null
22125 },
22126 "border-radius": {
22127 comment: "missed, https://drafts.csswg.org/css-backgrounds-3/#the-border-radius",
22128 syntax: "<length-percentage>{1,2}"
22129 },
22130 bottom: {
22131 comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
22132 syntax: "<length> | auto"
22133 },
22134 "content-list": {
22135 comment: "missed -> https://drafts.csswg.org/css-content/#typedef-content-list (document-url, <target> and leader() is omitted util stabilization)",
22136 syntax: "[ <string> | contents | <url> | <quote> | <attr()> | counter( <ident>, <'list-style-type'>? ) ]+"
22137 },
22138 "inset()": {
22139 comment: "changed <border-radius> to <'border-radius'>",
22140 syntax: "inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )"
22141 },
22142 "generic-voice": {
22143 comment: "https://www.w3.org/TR/css3-speech/#voice-family",
22144 syntax: "[ <age>? <gender> <integer>? ]"
22145 },
22146 gender: {
22147 comment: "https://www.w3.org/TR/css3-speech/#voice-family",
22148 syntax: "male | female | neutral"
22149 },
22150 "generic-family": {
22151 comment: "added -apple-system",
22152 references: [
22153 "https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
22154 ],
22155 syntax: "serif | sans-serif | cursive | fantasy | monospace | -apple-system"
22156 },
22157 gradient: {
22158 comment: "added -webkit-gradient() since may to be used for legacy support",
22159 syntax: "<-legacy-gradient> | <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()>"
22160 },
22161 left: {
22162 comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
22163 syntax: "<length> | auto"
22164 },
22165 "mask-image": {
22166 comment: "missed; https://drafts.fxtf.org/css-masking-1/#the-mask-image",
22167 syntax: "<mask-reference>#"
22168 },
22169 "matrix()": {
22170 comment: "redundant max",
22171 syntax: "matrix( <number> [, <number> ]{5} )"
22172 },
22173 "matrix3d()": {
22174 comment: "redundant max",
22175 syntax: "matrix3d( <number> [, <number> ]{15} )"
22176 },
22177 "name-repeat": {
22178 comment: "missed, and looks like obsolete, keep it as is since other property syntaxes should be changed too; https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-name-repeat",
22179 syntax: "repeat( [ <positive-integer> | auto-fill ], <line-names>+)"
22180 },
22181 "named-color": {
22182 comment: "replaced <ident> to list of colors according to https://www.w3.org/TR/css-color-4/#named-colors",
22183 syntax: "transparent | aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen | <-non-standard-color>"
22184 },
22185 "outline-radius": {
22186 comment: "missed, looks like it's a similar to <border-radius> https://developer.mozilla.org/en/docs/Web/CSS/-moz-outline-radius",
22187 syntax: "<border-radius>"
22188 },
22189 paint: {
22190 comment: "simplified SVG syntax (omit <icccolor>, replace <funciri> for <url>) https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint",
22191 syntax: "none | currentColor | <color> | <url> [ none | currentColor | <color> ]?"
22192 },
22193 "path()": {
22194 comment: "missed, `motion` property was renamed, but left it as is for now; path() syntax was get from last draft https://drafts.fxtf.org/motion-1/#funcdef-offset-path-path",
22195 syntax: "path( <string> )"
22196 },
22197 right: {
22198 comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
22199 syntax: "<length> | auto"
22200 },
22201 shape: {
22202 comment: "missed spaces in function body and add backwards compatible syntax",
22203 syntax: "rect( [ [ <top>, <right>, <bottom>, <left> ] | [ <top> <right> <bottom> <left> ] ] )"
22204 },
22205 "single-transition": {
22206 comment: "moved <single-transition-timing-function> in the beginning to avoid wrong match to <single-transition-property>",
22207 syntax: "<single-transition-timing-function> || [ none | <single-transition-property> ] || <time> || <time>"
22208 },
22209 "svg-length": {
22210 comment: "All coordinates and lengths in SVG can be specified with or without a unit identifier",
22211 references: [
22212 "https://www.w3.org/TR/SVG11/coords.html#Units"
22213 ],
22214 syntax: "<percentage> | <length> | <number>"
22215 },
22216 "svg-writing-mode": {
22217 comment: "SVG specific keywords (deprecated for CSS)",
22218 references: [
22219 "https://developer.mozilla.org/en/docs/Web/CSS/writing-mode",
22220 "https://www.w3.org/TR/SVG/text.html#WritingModeProperty"
22221 ],
22222 syntax: "lr-tb | rl-tb | tb-rl | lr | rl | tb"
22223 },
22224 top: {
22225 comment: "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
22226 syntax: "<length> | auto"
22227 },
22228 x: {
22229 comment: "missed; not sure we should add it, but no others except `cursor` is using it so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
22230 syntax: "<number>"
22231 },
22232 y: {
22233 comment: "missed; not sure we should add it, but no others except `cursor` is using so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
22234 syntax: "<number>"
22235 },
22236 "var()": {
22237 comment: "drop it since it's a generic (also syntax is incorrect and can't be parsed)",
22238 syntax: null
22239 },
22240 "an-plus-b": {
22241 comment: "syntax is incorrect and can't be parsed, drop for now",
22242 syntax: null
22243 },
22244 "feature-type": {
22245 comment: "syntax is incorrect and can't be parsed, drop for now",
22246 syntax: null
22247 },
22248 "feature-value-block": {
22249 comment: "syntax is incorrect and can't be parsed, drop for now",
22250 syntax: null
22251 },
22252 "feature-value-declaration": {
22253 comment: "syntax is incorrect and can't be parsed, drop for now",
22254 syntax: null
22255 },
22256 "feature-value-block-list": {
22257 comment: "syntax is incorrect and can't be parsed, drop for now",
22258 syntax: null
22259 },
22260 "feature-value-declaration-list": {
22261 comment: "syntax is incorrect and can't be parsed, drop for now",
22262 syntax: null
22263 },
22264 "general-enclosed": {
22265 comment: "syntax is incorrect and can't be parsed, drop for now",
22266 syntax: null
22267 },
22268 "keyframe-block": {
22269 comment: "syntax is incorrect and can't be parsed, drop for now",
22270 syntax: null
22271 },
22272 "keyframe-block-list": {
22273 comment: "syntax is incorrect and can't be parsed, drop for now",
22274 syntax: null
22275 },
22276 "mf-plain": {
22277 comment: "syntax is incorrect and can't be parsed, drop for now",
22278 syntax: null
22279 },
22280 "mf-range": {
22281 comment: "syntax is incorrect and can't be parsed, drop for now",
22282 syntax: null
22283 },
22284 "mf-value": {
22285 comment: "syntax is incorrect and can't be parsed, drop for now",
22286 syntax: null
22287 },
22288 "media-and": {
22289 comment: "syntax is incorrect and can't be parsed, drop for now",
22290 syntax: null
22291 },
22292 "media-condition": {
22293 comment: "syntax is incorrect and can't be parsed, drop for now",
22294 syntax: null
22295 },
22296 "media-not": {
22297 comment: "syntax is incorrect and can't be parsed, drop for now",
22298 syntax: null
22299 },
22300 "media-or": {
22301 comment: "syntax is incorrect and can't be parsed, drop for now",
22302 syntax: null
22303 },
22304 "media-in-parens": {
22305 comment: "syntax is incorrect and can't be parsed, drop for now",
22306 syntax: null
22307 },
22308 "media-feature": {
22309 comment: "syntax is incorrect and can't be parsed, drop for now",
22310 syntax: null
22311 },
22312 "media-condition-without-or": {
22313 comment: "syntax is incorrect and can't be parsed, drop for now",
22314 syntax: null
22315 },
22316 "media-query": {
22317 comment: "syntax is incorrect and can't be parsed, drop for now",
22318 syntax: null
22319 },
22320 "media-query-list": {
22321 comment: "syntax is incorrect and can't be parsed, drop for now",
22322 syntax: null
22323 },
22324 nth: {
22325 comment: "syntax has <an-plus-b> that doesn't support currently, drop for now",
22326 syntax: null
22327 },
22328 "page-selector": {
22329 comment: "syntax is incorrect and can't be parsed, drop for now",
22330 syntax: null
22331 },
22332 "page-selector-list": {
22333 comment: "syntax is incorrect and can't be parsed, drop for now",
22334 syntax: null
22335 },
22336 "page-body": {
22337 comment: "syntax is incorrect and can't be parsed, drop for now",
22338 syntax: null
22339 },
22340 "page-margin-box": {
22341 comment: "syntax is incorrect and can't be parsed, drop for now",
22342 syntax: null
22343 },
22344 "page-margin-box-type": {
22345 comment: "syntax is incorrect and can't be parsed, drop for now",
22346 syntax: null
22347 },
22348 "pseudo-page": {
22349 comment: "syntax is incorrect and can't be parsed, drop for now",
22350 syntax: null
22351 }
22352 };
22353 var patch = {
22354 properties: properties$3,
22355 syntaxes: syntaxes$2
22356 };
22357
22358 var patch$1 = /*#__PURE__*/Object.freeze({
22359 properties: properties$3,
22360 syntaxes: syntaxes$2,
22361 default: patch
22362 });
22363
22364 var mdnProperties = ( properties$2 && properties$1 ) || properties$2;
22365
22366 var mdnSyntaxes = ( syntaxes$1 && syntaxes ) || syntaxes$1;
22367
22368 var patch$2 = ( patch$1 && patch ) || patch$1;
22369
22370 function buildDictionary(dict, patchDict) {
22371 var result = {};
22372
22373 // copy all syntaxes for an original dict
22374 for (var key in dict) {
22375 result[key] = dict[key].syntax;
22376 }
22377
22378 // apply a patch
22379 for (var key in patchDict) {
22380 if (key in dict) {
22381 if (patchDict[key].syntax) {
22382 result[key] = patchDict[key].syntax;
22383 } else {
22384 delete result[key];
22385 }
22386 } else {
22387 if (patchDict[key].syntax) {
22388 result[key] = patchDict[key].syntax;
22389 }
22390 }
22391 }
22392
22393 return result;
22394 }
22395
22396 var data = {
22397 properties: buildDictionary(mdnProperties, patch$2.properties),
22398 types: buildDictionary(mdnSyntaxes, patch$2.syntaxes)
22399 };
22400
22401 var cmpChar$1 = tokenizer.cmpChar;
22402 var isNumber$3 = tokenizer.isNumber;
22403 var TYPE$4 = tokenizer.TYPE;
22404
22405 var IDENTIFIER$3 = TYPE$4.Identifier;
22406 var NUMBER$2 = TYPE$4.Number;
22407 var PLUSSIGN$4 = TYPE$4.PlusSign;
22408 var HYPHENMINUS$4 = TYPE$4.HyphenMinus;
22409 var N$5 = 110; // 'n'.charCodeAt(0)
22410 var DISALLOW_SIGN = true;
22411 var ALLOW_SIGN = false;
22412
22413 function checkTokenIsInteger(scanner, disallowSign) {
22414 var pos = scanner.tokenStart;
22415
22416 if (scanner.source.charCodeAt(pos) === PLUSSIGN$4 ||
22417 scanner.source.charCodeAt(pos) === HYPHENMINUS$4) {
22418 if (disallowSign) {
22419 scanner.error();
22420 }
22421 pos++;
22422 }
22423
22424 for (; pos < scanner.tokenEnd; pos++) {
22425 if (!isNumber$3(scanner.source.charCodeAt(pos))) {
22426 scanner.error('Unexpected input', pos);
22427 }
22428 }
22429 }
22430
22431 // An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
22432 var AnPlusB = {
22433 name: 'AnPlusB',
22434 structure: {
22435 a: [String, null],
22436 b: [String, null]
22437 },
22438 parse: function() {
22439 var start = this.scanner.tokenStart;
22440 var end = start;
22441 var prefix = '';
22442 var a = null;
22443 var b = null;
22444
22445 if (this.scanner.tokenType === NUMBER$2 ||
22446 this.scanner.tokenType === PLUSSIGN$4) {
22447 checkTokenIsInteger(this.scanner, ALLOW_SIGN);
22448 prefix = this.scanner.getTokenValue();
22449 this.scanner.next();
22450 end = this.scanner.tokenStart;
22451 }
22452
22453 if (this.scanner.tokenType === IDENTIFIER$3) {
22454 var bStart = this.scanner.tokenStart;
22455
22456 if (cmpChar$1(this.scanner.source, bStart, HYPHENMINUS$4)) {
22457 if (prefix === '') {
22458 prefix = '-';
22459 bStart++;
22460 } else {
22461 this.scanner.error('Unexpected hyphen minus');
22462 }
22463 }
22464
22465 if (!cmpChar$1(this.scanner.source, bStart, N$5)) {
22466 this.scanner.error();
22467 }
22468
22469 a = prefix === '' ? '1' :
22470 prefix === '+' ? '+1' :
22471 prefix === '-' ? '-1' :
22472 prefix;
22473
22474 var len = this.scanner.tokenEnd - bStart;
22475 if (len > 1) {
22476 // ..n-..
22477 if (this.scanner.source.charCodeAt(bStart + 1) !== HYPHENMINUS$4) {
22478 this.scanner.error('Unexpected input', bStart + 1);
22479 }
22480
22481 if (len > 2) {
22482 // ..n-{number}..
22483 this.scanner.tokenStart = bStart + 2;
22484 } else {
22485 // ..n- {number}
22486 this.scanner.next();
22487 this.scanner.skipSC();
22488 }
22489
22490 checkTokenIsInteger(this.scanner, DISALLOW_SIGN);
22491 b = '-' + this.scanner.getTokenValue();
22492 this.scanner.next();
22493 end = this.scanner.tokenStart;
22494 } else {
22495 prefix = '';
22496 this.scanner.next();
22497 end = this.scanner.tokenStart;
22498 this.scanner.skipSC();
22499
22500 if (this.scanner.tokenType === HYPHENMINUS$4 ||
22501 this.scanner.tokenType === PLUSSIGN$4) {
22502 prefix = this.scanner.getTokenValue();
22503 this.scanner.next();
22504 this.scanner.skipSC();
22505 }
22506
22507 if (this.scanner.tokenType === NUMBER$2) {
22508 checkTokenIsInteger(this.scanner, prefix !== '');
22509
22510 if (!isNumber$3(this.scanner.source.charCodeAt(this.scanner.tokenStart))) {
22511 prefix = this.scanner.source.charAt(this.scanner.tokenStart);
22512 this.scanner.tokenStart++;
22513 }
22514
22515 if (prefix === '') {
22516 // should be an operator before number
22517 this.scanner.error();
22518 } else if (prefix === '+') {
22519 // plus is using by default
22520 prefix = '';
22521 }
22522
22523 b = prefix + this.scanner.getTokenValue();
22524
22525 this.scanner.next();
22526 end = this.scanner.tokenStart;
22527 } else {
22528 if (prefix) {
22529 this.scanner.eat(NUMBER$2);
22530 }
22531 }
22532 }
22533 } else {
22534 if (prefix === '' || prefix === '+') { // no number
22535 this.scanner.error(
22536 'Number or identifier is expected',
22537 this.scanner.tokenStart + (
22538 this.scanner.tokenType === PLUSSIGN$4 ||
22539 this.scanner.tokenType === HYPHENMINUS$4
22540 )
22541 );
22542 }
22543
22544 b = prefix;
22545 }
22546
22547 return {
22548 type: 'AnPlusB',
22549 loc: this.getLocation(start, end),
22550 a: a,
22551 b: b
22552 };
22553 },
22554 generate: function(node) {
22555 var a = node.a !== null && node.a !== undefined;
22556 var b = node.b !== null && node.b !== undefined;
22557
22558 if (a) {
22559 this.chunk(
22560 node.a === '+1' ? '+n' :
22561 node.a === '1' ? 'n' :
22562 node.a === '-1' ? '-n' :
22563 node.a + 'n'
22564 );
22565
22566 if (b) {
22567 b = String(node.b);
22568 if (b.charAt(0) === '-' || b.charAt(0) === '+') {
22569 this.chunk(b.charAt(0));
22570 this.chunk(b.substr(1));
22571 } else {
22572 this.chunk('+');
22573 this.chunk(b);
22574 }
22575 }
22576 } else {
22577 this.chunk(String(node.b));
22578 }
22579 }
22580 };
22581
22582 var TYPE$5 = tokenizer.TYPE;
22583
22584 var ATKEYWORD$2 = TYPE$5.AtKeyword;
22585 var SEMICOLON = TYPE$5.Semicolon;
22586 var LEFTCURLYBRACKET$2 = TYPE$5.LeftCurlyBracket;
22587 var RIGHTCURLYBRACKET$2 = TYPE$5.RightCurlyBracket;
22588
22589 function consumeRaw(startToken) {
22590 return this.Raw(startToken, SEMICOLON, LEFTCURLYBRACKET$2, false, true);
22591 }
22592
22593 function isDeclarationBlockAtrule() {
22594 for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {
22595 if (type === RIGHTCURLYBRACKET$2) {
22596 return true;
22597 }
22598
22599 if (type === LEFTCURLYBRACKET$2 ||
22600 type === ATKEYWORD$2) {
22601 return false;
22602 }
22603 }
22604
22605 return false;
22606 }
22607
22608 var Atrule = {
22609 name: 'Atrule',
22610 structure: {
22611 name: String,
22612 prelude: ['AtrulePrelude', 'Raw', null],
22613 block: ['Block', null]
22614 },
22615 parse: function() {
22616 var start = this.scanner.tokenStart;
22617 var name;
22618 var nameLowerCase;
22619 var prelude = null;
22620 var block = null;
22621
22622 this.scanner.eat(ATKEYWORD$2);
22623
22624 name = this.scanner.substrToCursor(start + 1);
22625 nameLowerCase = name.toLowerCase();
22626 this.scanner.skipSC();
22627
22628 // parse prelude
22629 if (this.scanner.eof === false &&
22630 this.scanner.tokenType !== LEFTCURLYBRACKET$2 &&
22631 this.scanner.tokenType !== SEMICOLON) {
22632 if (this.parseAtrulePrelude) {
22633 prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw);
22634
22635 // turn empty AtrulePrelude into null
22636 if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) {
22637 prelude = null;
22638 }
22639 } else {
22640 prelude = consumeRaw.call(this, this.scanner.currentToken);
22641 }
22642
22643 this.scanner.skipSC();
22644 }
22645
22646 switch (this.scanner.tokenType) {
22647 case SEMICOLON:
22648 this.scanner.next();
22649 break;
22650
22651 case LEFTCURLYBRACKET$2:
22652 if (this.atrule.hasOwnProperty(nameLowerCase) &&
22653 typeof this.atrule[nameLowerCase].block === 'function') {
22654 block = this.atrule[nameLowerCase].block.call(this);
22655 } else {
22656 // TODO: should consume block content as Raw?
22657 block = this.Block(isDeclarationBlockAtrule.call(this));
22658 }
22659
22660 break;
22661 }
22662
22663 return {
22664 type: 'Atrule',
22665 loc: this.getLocation(start, this.scanner.tokenStart),
22666 name: name,
22667 prelude: prelude,
22668 block: block
22669 };
22670 },
22671 generate: function(node) {
22672 this.chunk('@');
22673 this.chunk(node.name);
22674
22675 if (node.prelude !== null) {
22676 this.chunk(' ');
22677 this.node(node.prelude);
22678 }
22679
22680 if (node.block) {
22681 this.node(node.block);
22682 } else {
22683 this.chunk(';');
22684 }
22685 },
22686 walkContext: 'atrule'
22687 };
22688
22689 var TYPE$6 = tokenizer.TYPE;
22690
22691 var SEMICOLON$1 = TYPE$6.Semicolon;
22692 var LEFTCURLYBRACKET$3 = TYPE$6.LeftCurlyBracket;
22693
22694 var AtrulePrelude = {
22695 name: 'AtrulePrelude',
22696 structure: {
22697 children: [[]]
22698 },
22699 parse: function(name) {
22700 var children = null;
22701
22702 if (name !== null) {
22703 name = name.toLowerCase();
22704 }
22705
22706 this.scanner.skipSC();
22707
22708 if (this.atrule.hasOwnProperty(name) &&
22709 typeof this.atrule[name].prelude === 'function') {
22710 // custom consumer
22711 children = this.atrule[name].prelude.call(this);
22712 } else {
22713 // default consumer
22714 children = this.readSequence(this.scope.AtrulePrelude);
22715 }
22716
22717 this.scanner.skipSC();
22718
22719 if (this.scanner.eof !== true &&
22720 this.scanner.tokenType !== LEFTCURLYBRACKET$3 &&
22721 this.scanner.tokenType !== SEMICOLON$1) {
22722 this.scanner.error('Semicolon or block is expected');
22723 }
22724
22725 if (children === null) {
22726 children = this.createList();
22727 }
22728
22729 return {
22730 type: 'AtrulePrelude',
22731 loc: this.getLocationFromList(children),
22732 children: children
22733 };
22734 },
22735 generate: function(node) {
22736 this.children(node);
22737 },
22738 walkContext: 'atrulePrelude'
22739 };
22740
22741 var TYPE$7 = tokenizer.TYPE;
22742
22743 var IDENTIFIER$4 = TYPE$7.Identifier;
22744 var STRING$2 = TYPE$7.String;
22745 var DOLLARSIGN = TYPE$7.DollarSign;
22746 var ASTERISK$1 = TYPE$7.Asterisk;
22747 var COLON = TYPE$7.Colon;
22748 var EQUALSSIGN = TYPE$7.EqualsSign;
22749 var LEFTSQUAREBRACKET$2 = TYPE$7.LeftSquareBracket;
22750 var RIGHTSQUAREBRACKET$2 = TYPE$7.RightSquareBracket;
22751 var CIRCUMFLEXACCENT = TYPE$7.CircumflexAccent;
22752 var VERTICALLINE$1 = TYPE$7.VerticalLine;
22753 var TILDE = TYPE$7.Tilde;
22754
22755 function getAttributeName() {
22756 if (this.scanner.eof) {
22757 this.scanner.error('Unexpected end of input');
22758 }
22759
22760 var start = this.scanner.tokenStart;
22761 var expectIdentifier = false;
22762 var checkColon = true;
22763
22764 if (this.scanner.tokenType === ASTERISK$1) {
22765 expectIdentifier = true;
22766 checkColon = false;
22767 this.scanner.next();
22768 } else if (this.scanner.tokenType !== VERTICALLINE$1) {
22769 this.scanner.eat(IDENTIFIER$4);
22770 }
22771
22772 if (this.scanner.tokenType === VERTICALLINE$1) {
22773 if (this.scanner.lookupType(1) !== EQUALSSIGN) {
22774 this.scanner.next();
22775 this.scanner.eat(IDENTIFIER$4);
22776 } else if (expectIdentifier) {
22777 this.scanner.error('Identifier is expected', this.scanner.tokenEnd);
22778 }
22779 } else if (expectIdentifier) {
22780 this.scanner.error('Vertical line is expected');
22781 }
22782
22783 if (checkColon && this.scanner.tokenType === COLON) {
22784 this.scanner.next();
22785 this.scanner.eat(IDENTIFIER$4);
22786 }
22787
22788 return {
22789 type: 'Identifier',
22790 loc: this.getLocation(start, this.scanner.tokenStart),
22791 name: this.scanner.substrToCursor(start)
22792 };
22793 }
22794
22795 function getOperator() {
22796 var start = this.scanner.tokenStart;
22797 var tokenType = this.scanner.tokenType;
22798
22799 if (tokenType !== EQUALSSIGN && // =
22800 tokenType !== TILDE && // ~=
22801 tokenType !== CIRCUMFLEXACCENT && // ^=
22802 tokenType !== DOLLARSIGN && // $=
22803 tokenType !== ASTERISK$1 && // *=
22804 tokenType !== VERTICALLINE$1 // |=
22805 ) {
22806 this.scanner.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
22807 }
22808
22809 if (tokenType === EQUALSSIGN) {
22810 this.scanner.next();
22811 } else {
22812 this.scanner.next();
22813 this.scanner.eat(EQUALSSIGN);
22814 }
22815
22816 return this.scanner.substrToCursor(start);
22817 }
22818
22819 // '[' S* attrib_name ']'
22820 // '[' S* attrib_name S* attrib_matcher S* [ IDENT | STRING ] S* attrib_flags? S* ']'
22821 var AttributeSelector = {
22822 name: 'AttributeSelector',
22823 structure: {
22824 name: 'Identifier',
22825 matcher: [String, null],
22826 value: ['String', 'Identifier', null],
22827 flags: [String, null]
22828 },
22829 parse: function() {
22830 var start = this.scanner.tokenStart;
22831 var name;
22832 var matcher = null;
22833 var value = null;
22834 var flags = null;
22835
22836 this.scanner.eat(LEFTSQUAREBRACKET$2);
22837 this.scanner.skipSC();
22838
22839 name = getAttributeName.call(this);
22840 this.scanner.skipSC();
22841
22842 if (this.scanner.tokenType !== RIGHTSQUAREBRACKET$2) {
22843 // avoid case `[name i]`
22844 if (this.scanner.tokenType !== IDENTIFIER$4) {
22845 matcher = getOperator.call(this);
22846
22847 this.scanner.skipSC();
22848
22849 value = this.scanner.tokenType === STRING$2
22850 ? this.String()
22851 : this.Identifier();
22852
22853 this.scanner.skipSC();
22854 }
22855
22856 // attribute flags
22857 if (this.scanner.tokenType === IDENTIFIER$4) {
22858 flags = this.scanner.getTokenValue();
22859 this.scanner.next();
22860
22861 this.scanner.skipSC();
22862 }
22863 }
22864
22865 this.scanner.eat(RIGHTSQUAREBRACKET$2);
22866
22867 return {
22868 type: 'AttributeSelector',
22869 loc: this.getLocation(start, this.scanner.tokenStart),
22870 name: name,
22871 matcher: matcher,
22872 value: value,
22873 flags: flags
22874 };
22875 },
22876 generate: function(node) {
22877 var flagsPrefix = ' ';
22878
22879 this.chunk('[');
22880 this.node(node.name);
22881
22882 if (node.matcher !== null) {
22883 this.chunk(node.matcher);
22884
22885 if (node.value !== null) {
22886 this.node(node.value);
22887
22888 // space between string and flags is not required
22889 if (node.value.type === 'String') {
22890 flagsPrefix = '';
22891 }
22892 }
22893 }
22894
22895 if (node.flags !== null) {
22896 this.chunk(flagsPrefix);
22897 this.chunk(node.flags);
22898 }
22899
22900 this.chunk(']');
22901 }
22902 };
22903
22904 var TYPE$8 = tokenizer.TYPE;
22905
22906 var WHITESPACE$3 = TYPE$8.WhiteSpace;
22907 var COMMENT$3 = TYPE$8.Comment;
22908 var SEMICOLON$2 = TYPE$8.Semicolon;
22909 var ATKEYWORD$3 = TYPE$8.AtKeyword;
22910 var LEFTCURLYBRACKET$4 = TYPE$8.LeftCurlyBracket;
22911 var RIGHTCURLYBRACKET$3 = TYPE$8.RightCurlyBracket;
22912
22913 function consumeRaw$1(startToken) {
22914 return this.Raw(startToken, 0, 0, false, true);
22915 }
22916 function consumeRule() {
22917 return this.parseWithFallback(this.Rule, consumeRaw$1);
22918 }
22919 function consumeRawDeclaration(startToken) {
22920 return this.Raw(startToken, 0, SEMICOLON$2, true, true);
22921 }
22922 function consumeDeclaration() {
22923 if (this.scanner.tokenType === SEMICOLON$2) {
22924 return consumeRawDeclaration.call(this, this.scanner.currentToken);
22925 }
22926
22927 var node = this.parseWithFallback(this.Declaration, consumeRawDeclaration);
22928
22929 if (this.scanner.tokenType === SEMICOLON$2) {
22930 this.scanner.next();
22931 }
22932
22933 return node;
22934 }
22935
22936 var Block = {
22937 name: 'Block',
22938 structure: {
22939 children: [[
22940 'Atrule',
22941 'Rule',
22942 'Declaration'
22943 ]]
22944 },
22945 parse: function(isDeclaration) {
22946 var consumer = isDeclaration ? consumeDeclaration : consumeRule;
22947
22948 var start = this.scanner.tokenStart;
22949 var children = this.createList();
22950
22951 this.scanner.eat(LEFTCURLYBRACKET$4);
22952
22953 scan:
22954 while (!this.scanner.eof) {
22955 switch (this.scanner.tokenType) {
22956 case RIGHTCURLYBRACKET$3:
22957 break scan;
22958
22959 case WHITESPACE$3:
22960 case COMMENT$3:
22961 this.scanner.next();
22962 break;
22963
22964 case ATKEYWORD$3:
22965 children.push(this.parseWithFallback(this.Atrule, consumeRaw$1));
22966 break;
22967
22968 default:
22969 children.push(consumer.call(this));
22970 }
22971 }
22972
22973 if (!this.scanner.eof) {
22974 this.scanner.eat(RIGHTCURLYBRACKET$3);
22975 }
22976
22977 return {
22978 type: 'Block',
22979 loc: this.getLocation(start, this.scanner.tokenStart),
22980 children: children
22981 };
22982 },
22983 generate: function(node) {
22984 this.chunk('{');
22985 this.children(node, function(prev) {
22986 if (prev.type === 'Declaration') {
22987 this.chunk(';');
22988 }
22989 });
22990 this.chunk('}');
22991 },
22992 walkContext: 'block'
22993 };
22994
22995 var TYPE$9 = tokenizer.TYPE;
22996 var LEFTSQUAREBRACKET$3 = TYPE$9.LeftSquareBracket;
22997 var RIGHTSQUAREBRACKET$3 = TYPE$9.RightSquareBracket;
22998
22999 var Brackets = {
23000 name: 'Brackets',
23001 structure: {
23002 children: [[]]
23003 },
23004 parse: function(readSequence, recognizer) {
23005 var start = this.scanner.tokenStart;
23006 var children = null;
23007
23008 this.scanner.eat(LEFTSQUAREBRACKET$3);
23009
23010 children = readSequence.call(this, recognizer);
23011
23012 if (!this.scanner.eof) {
23013 this.scanner.eat(RIGHTSQUAREBRACKET$3);
23014 }
23015
23016 return {
23017 type: 'Brackets',
23018 loc: this.getLocation(start, this.scanner.tokenStart),
23019 children: children
23020 };
23021 },
23022 generate: function(node) {
23023 this.chunk('[');
23024 this.children(node);
23025 this.chunk(']');
23026 }
23027 };
23028
23029 var CDC$2 = tokenizer.TYPE.CDC;
23030
23031 var CDC_1 = {
23032 name: 'CDC',
23033 structure: [],
23034 parse: function() {
23035 var start = this.scanner.tokenStart;
23036
23037 this.scanner.eat(CDC$2); // -->
23038
23039 return {
23040 type: 'CDC',
23041 loc: this.getLocation(start, this.scanner.tokenStart)
23042 };
23043 },
23044 generate: function() {
23045 this.chunk('-->');
23046 }
23047 };
23048
23049 var CDO$2 = tokenizer.TYPE.CDO;
23050
23051 var CDO_1 = {
23052 name: 'CDO',
23053 structure: [],
23054 parse: function() {
23055 var start = this.scanner.tokenStart;
23056
23057 this.scanner.eat(CDO$2); // <!--
23058
23059 return {
23060 type: 'CDO',
23061 loc: this.getLocation(start, this.scanner.tokenStart)
23062 };
23063 },
23064 generate: function() {
23065 this.chunk('<!--');
23066 }
23067 };
23068
23069 var TYPE$a = tokenizer.TYPE;
23070 var IDENTIFIER$5 = TYPE$a.Identifier;
23071 var FULLSTOP$2 = TYPE$a.FullStop;
23072
23073 // '.' ident
23074 var ClassSelector = {
23075 name: 'ClassSelector',
23076 structure: {
23077 name: String
23078 },
23079 parse: function() {
23080 this.scanner.eat(FULLSTOP$2);
23081
23082 return {
23083 type: 'ClassSelector',
23084 loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
23085 name: this.scanner.consume(IDENTIFIER$5)
23086 };
23087 },
23088 generate: function(node) {
23089 this.chunk('.');
23090 this.chunk(node.name);
23091 }
23092 };
23093
23094 var TYPE$b = tokenizer.TYPE;
23095
23096 var PLUSSIGN$5 = TYPE$b.PlusSign;
23097 var SOLIDUS = TYPE$b.Solidus;
23098 var GREATERTHANSIGN$2 = TYPE$b.GreaterThanSign;
23099 var TILDE$1 = TYPE$b.Tilde;
23100
23101 // + | > | ~ | /deep/
23102 var Combinator = {
23103 name: 'Combinator',
23104 structure: {
23105 name: String
23106 },
23107 parse: function() {
23108 var start = this.scanner.tokenStart;
23109
23110 switch (this.scanner.tokenType) {
23111 case GREATERTHANSIGN$2:
23112 case PLUSSIGN$5:
23113 case TILDE$1:
23114 this.scanner.next();
23115 break;
23116
23117 case SOLIDUS:
23118 this.scanner.next();
23119 this.scanner.expectIdentifier('deep');
23120 this.scanner.eat(SOLIDUS);
23121 break;
23122
23123 default:
23124 this.scanner.error('Combinator is expected');
23125 }
23126
23127 return {
23128 type: 'Combinator',
23129 loc: this.getLocation(start, this.scanner.tokenStart),
23130 name: this.scanner.substrToCursor(start)
23131 };
23132 },
23133 generate: function(node) {
23134 this.chunk(node.name);
23135 }
23136 };
23137
23138 var TYPE$c = tokenizer.TYPE;
23139
23140 var ASTERISK$2 = TYPE$c.Asterisk;
23141 var SOLIDUS$1 = TYPE$c.Solidus;
23142
23143 // '/*' .* '*/'
23144 var Comment = {
23145 name: 'Comment',
23146 structure: {
23147 value: String
23148 },
23149 parse: function() {
23150 var start = this.scanner.tokenStart;
23151 var end = this.scanner.tokenEnd;
23152
23153 if ((end - start + 2) >= 2 &&
23154 this.scanner.source.charCodeAt(end - 2) === ASTERISK$2 &&
23155 this.scanner.source.charCodeAt(end - 1) === SOLIDUS$1) {
23156 end -= 2;
23157 }
23158
23159 this.scanner.next();
23160
23161 return {
23162 type: 'Comment',
23163 loc: this.getLocation(start, this.scanner.tokenStart),
23164 value: this.scanner.source.substring(start + 2, end)
23165 };
23166 },
23167 generate: function(node) {
23168 this.chunk('/*');
23169 this.chunk(node.value);
23170 this.chunk('*/');
23171 }
23172 };
23173
23174 var isCustomProperty$1 = names.isCustomProperty;
23175 var TYPE$d = tokenizer.TYPE;
23176
23177 var IDENTIFIER$6 = TYPE$d.Identifier;
23178 var COLON$1 = TYPE$d.Colon;
23179 var EXCLAMATIONMARK$2 = TYPE$d.ExclamationMark;
23180 var SOLIDUS$2 = TYPE$d.Solidus;
23181 var ASTERISK$3 = TYPE$d.Asterisk;
23182 var DOLLARSIGN$1 = TYPE$d.DollarSign;
23183 var HYPHENMINUS$5 = TYPE$d.HyphenMinus;
23184 var SEMICOLON$3 = TYPE$d.Semicolon;
23185 var PLUSSIGN$6 = TYPE$d.PlusSign;
23186 var NUMBERSIGN$2 = TYPE$d.NumberSign;
23187
23188 function consumeValueRaw(startToken) {
23189 return this.Raw(startToken, EXCLAMATIONMARK$2, SEMICOLON$3, false, true);
23190 }
23191
23192 function consumeCustomPropertyRaw(startToken) {
23193 return this.Raw(startToken, EXCLAMATIONMARK$2, SEMICOLON$3, false, false);
23194 }
23195
23196 function consumeValue() {
23197 var startValueToken = this.scanner.currentToken;
23198 var value = this.Value();
23199
23200 if (value.type !== 'Raw' &&
23201 this.scanner.eof === false &&
23202 this.scanner.tokenType !== SEMICOLON$3 &&
23203 this.scanner.tokenType !== EXCLAMATIONMARK$2 &&
23204 this.scanner.isBalanceEdge(startValueToken) === false) {
23205 this.scanner.error();
23206 }
23207
23208 return value;
23209 }
23210
23211 var Declaration = {
23212 name: 'Declaration',
23213 structure: {
23214 important: [Boolean, String],
23215 property: String,
23216 value: ['Value', 'Raw']
23217 },
23218 parse: function() {
23219 var start = this.scanner.tokenStart;
23220 var startToken = this.scanner.currentToken;
23221 var property = readProperty$1.call(this);
23222 var customProperty = isCustomProperty$1(property);
23223 var parseValue = customProperty ? this.parseCustomProperty : this.parseValue;
23224 var consumeRaw = customProperty ? consumeCustomPropertyRaw : consumeValueRaw;
23225 var important = false;
23226 var value;
23227
23228 this.scanner.skipSC();
23229 this.scanner.eat(COLON$1);
23230
23231 if (!customProperty) {
23232 this.scanner.skipSC();
23233 }
23234
23235 if (parseValue) {
23236 value = this.parseWithFallback(consumeValue, consumeRaw);
23237 } else {
23238 value = consumeRaw.call(this, this.scanner.currentToken);
23239 }
23240
23241 if (this.scanner.tokenType === EXCLAMATIONMARK$2) {
23242 important = getImportant(this.scanner);
23243 this.scanner.skipSC();
23244 }
23245
23246 // Do not include semicolon to range per spec
23247 // https://drafts.csswg.org/css-syntax/#declaration-diagram
23248
23249 if (this.scanner.eof === false &&
23250 this.scanner.tokenType !== SEMICOLON$3 &&
23251 this.scanner.isBalanceEdge(startToken) === false) {
23252 this.scanner.error();
23253 }
23254
23255 return {
23256 type: 'Declaration',
23257 loc: this.getLocation(start, this.scanner.tokenStart),
23258 important: important,
23259 property: property,
23260 value: value
23261 };
23262 },
23263 generate: function(node) {
23264 this.chunk(node.property);
23265 this.chunk(':');
23266 this.node(node.value);
23267
23268 if (node.important) {
23269 this.chunk(node.important === true ? '!important' : '!' + node.important);
23270 }
23271 },
23272 walkContext: 'declaration'
23273 };
23274
23275 function readProperty$1() {
23276 var start = this.scanner.tokenStart;
23277 var prefix = 0;
23278
23279 // hacks
23280 switch (this.scanner.tokenType) {
23281 case ASTERISK$3:
23282 case DOLLARSIGN$1:
23283 case PLUSSIGN$6:
23284 case NUMBERSIGN$2:
23285 prefix = 1;
23286 break;
23287
23288 // TODO: not sure we should support this hack
23289 case SOLIDUS$2:
23290 prefix = this.scanner.lookupType(1) === SOLIDUS$2 ? 2 : 1;
23291 break;
23292 }
23293
23294 if (this.scanner.lookupType(prefix) === HYPHENMINUS$5) {
23295 prefix++;
23296 }
23297
23298 if (prefix) {
23299 this.scanner.skip(prefix);
23300 }
23301
23302 this.scanner.eat(IDENTIFIER$6);
23303
23304 return this.scanner.substrToCursor(start);
23305 }
23306
23307 // ! ws* important
23308 function getImportant(scanner) {
23309 scanner.eat(EXCLAMATIONMARK$2);
23310 scanner.skipSC();
23311
23312 var important = scanner.consume(IDENTIFIER$6);
23313
23314 // store original value in case it differ from `important`
23315 // for better original source restoring and hacks like `!ie` support
23316 return important === 'important' ? true : important;
23317 }
23318
23319 var TYPE$e = tokenizer.TYPE;
23320
23321 var WHITESPACE$4 = TYPE$e.WhiteSpace;
23322 var COMMENT$4 = TYPE$e.Comment;
23323 var SEMICOLON$4 = TYPE$e.Semicolon;
23324
23325 function consumeRaw$2(startToken) {
23326 return this.Raw(startToken, 0, SEMICOLON$4, true, true);
23327 }
23328
23329 var DeclarationList = {
23330 name: 'DeclarationList',
23331 structure: {
23332 children: [[
23333 'Declaration'
23334 ]]
23335 },
23336 parse: function() {
23337 var children = this.createList();
23338
23339 scan:
23340 while (!this.scanner.eof) {
23341 switch (this.scanner.tokenType) {
23342 case WHITESPACE$4:
23343 case COMMENT$4:
23344 case SEMICOLON$4:
23345 this.scanner.next();
23346 break;
23347
23348 default:
23349 children.push(this.parseWithFallback(this.Declaration, consumeRaw$2));
23350 }
23351 }
23352
23353 return {
23354 type: 'DeclarationList',
23355 loc: this.getLocationFromList(children),
23356 children: children
23357 };
23358 },
23359 generate: function(node) {
23360 this.children(node, function(prev) {
23361 if (prev.type === 'Declaration') {
23362 this.chunk(';');
23363 }
23364 });
23365 }
23366 };
23367
23368 var NUMBER$3 = tokenizer.TYPE.Number;
23369
23370 // special reader for units to avoid adjoined IE hacks (i.e. '1px\9')
23371 function readUnit(scanner) {
23372 var unit = scanner.getTokenValue();
23373 var backSlashPos = unit.indexOf('\\');
23374
23375 if (backSlashPos > 0) {
23376 // patch token offset
23377 scanner.tokenStart += backSlashPos;
23378
23379 // return part before backslash
23380 return unit.substring(0, backSlashPos);
23381 }
23382
23383 // no backslash in unit name
23384 scanner.next();
23385
23386 return unit;
23387 }
23388
23389 // number ident
23390 var Dimension = {
23391 name: 'Dimension',
23392 structure: {
23393 value: String,
23394 unit: String
23395 },
23396 parse: function() {
23397 var start = this.scanner.tokenStart;
23398 var value = this.scanner.consume(NUMBER$3);
23399 var unit = readUnit(this.scanner);
23400
23401 return {
23402 type: 'Dimension',
23403 loc: this.getLocation(start, this.scanner.tokenStart),
23404 value: value,
23405 unit: unit
23406 };
23407 },
23408 generate: function(node) {
23409 this.chunk(node.value);
23410 this.chunk(node.unit);
23411 }
23412 };
23413
23414 var TYPE$f = tokenizer.TYPE;
23415 var RIGHTPARENTHESIS$3 = TYPE$f.RightParenthesis;
23416
23417 // <function-token> <sequence> ')'
23418 var _Function = {
23419 name: 'Function',
23420 structure: {
23421 name: String,
23422 children: [[]]
23423 },
23424 parse: function(readSequence, recognizer) {
23425 var start = this.scanner.tokenStart;
23426 var name = this.scanner.consumeFunctionName();
23427 var nameLowerCase = name.toLowerCase();
23428 var children;
23429
23430 children = recognizer.hasOwnProperty(nameLowerCase)
23431 ? recognizer[nameLowerCase].call(this, recognizer)
23432 : readSequence.call(this, recognizer);
23433
23434 if (!this.scanner.eof) {
23435 this.scanner.eat(RIGHTPARENTHESIS$3);
23436 }
23437
23438 return {
23439 type: 'Function',
23440 loc: this.getLocation(start, this.scanner.tokenStart),
23441 name: name,
23442 children: children
23443 };
23444 },
23445 generate: function(node) {
23446 this.chunk(node.name);
23447 this.chunk('(');
23448 this.children(node);
23449 this.chunk(')');
23450 },
23451 walkContext: 'function'
23452 };
23453
23454 var isHex$2 = tokenizer.isHex;
23455 var TYPE$g = tokenizer.TYPE;
23456
23457 var IDENTIFIER$7 = TYPE$g.Identifier;
23458 var NUMBER$4 = TYPE$g.Number;
23459 var NUMBERSIGN$3 = TYPE$g.NumberSign;
23460
23461 function consumeHexSequence(scanner, required) {
23462 if (!isHex$2(scanner.source.charCodeAt(scanner.tokenStart))) {
23463 if (required) {
23464 scanner.error('Unexpected input', scanner.tokenStart);
23465 } else {
23466 return;
23467 }
23468 }
23469
23470 for (var pos = scanner.tokenStart + 1; pos < scanner.tokenEnd; pos++) {
23471 var code = scanner.source.charCodeAt(pos);
23472
23473 // break on non-hex char
23474 if (!isHex$2(code)) {
23475 // break token, exclude symbol
23476 scanner.tokenStart = pos;
23477 return;
23478 }
23479 }
23480
23481 // token is full hex sequence, go to next token
23482 scanner.next();
23483 }
23484
23485 // # ident
23486 var HexColor = {
23487 name: 'HexColor',
23488 structure: {
23489 value: String
23490 },
23491 parse: function() {
23492 var start = this.scanner.tokenStart;
23493
23494 this.scanner.eat(NUMBERSIGN$3);
23495
23496 scan:
23497 switch (this.scanner.tokenType) {
23498 case NUMBER$4:
23499 consumeHexSequence(this.scanner, true);
23500
23501 // if token is identifier then number consists of hex only,
23502 // try to add identifier to result
23503 if (this.scanner.tokenType === IDENTIFIER$7) {
23504 consumeHexSequence(this.scanner, false);
23505 }
23506
23507 break;
23508
23509 case IDENTIFIER$7:
23510 consumeHexSequence(this.scanner, true);
23511 break;
23512
23513 default:
23514 this.scanner.error('Number or identifier is expected');
23515 }
23516
23517 return {
23518 type: 'HexColor',
23519 loc: this.getLocation(start, this.scanner.tokenStart),
23520 value: this.scanner.substrToCursor(start + 1) // skip #
23521 };
23522 },
23523 generate: function(node) {
23524 this.chunk('#');
23525 this.chunk(node.value);
23526 }
23527 };
23528
23529 var TYPE$h = tokenizer.TYPE;
23530 var IDENTIFIER$8 = TYPE$h.Identifier;
23531
23532 var Identifier = {
23533 name: 'Identifier',
23534 structure: {
23535 name: String
23536 },
23537 parse: function() {
23538 return {
23539 type: 'Identifier',
23540 loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
23541 name: this.scanner.consume(IDENTIFIER$8)
23542 };
23543 },
23544 generate: function(node) {
23545 this.chunk(node.name);
23546 }
23547 };
23548
23549 var TYPE$i = tokenizer.TYPE;
23550 var IDENTIFIER$9 = TYPE$i.Identifier;
23551 var NUMBERSIGN$4 = TYPE$i.NumberSign;
23552
23553 // '#' ident
23554 var IdSelector = {
23555 name: 'IdSelector',
23556 structure: {
23557 name: String
23558 },
23559 parse: function() {
23560 this.scanner.eat(NUMBERSIGN$4);
23561
23562 return {
23563 type: 'IdSelector',
23564 loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
23565 name: this.scanner.consume(IDENTIFIER$9)
23566 };
23567 },
23568 generate: function(node) {
23569 this.chunk('#');
23570 this.chunk(node.name);
23571 }
23572 };
23573
23574 var TYPE$j = tokenizer.TYPE;
23575
23576 var IDENTIFIER$a = TYPE$j.Identifier;
23577 var NUMBER$5 = TYPE$j.Number;
23578 var LEFTPARENTHESIS$3 = TYPE$j.LeftParenthesis;
23579 var RIGHTPARENTHESIS$4 = TYPE$j.RightParenthesis;
23580 var COLON$2 = TYPE$j.Colon;
23581 var SOLIDUS$3 = TYPE$j.Solidus;
23582
23583 var MediaFeature = {
23584 name: 'MediaFeature',
23585 structure: {
23586 name: String,
23587 value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
23588 },
23589 parse: function() {
23590 var start = this.scanner.tokenStart;
23591 var name;
23592 var value = null;
23593
23594 this.scanner.eat(LEFTPARENTHESIS$3);
23595 this.scanner.skipSC();
23596
23597 name = this.scanner.consume(IDENTIFIER$a);
23598 this.scanner.skipSC();
23599
23600 if (this.scanner.tokenType !== RIGHTPARENTHESIS$4) {
23601 this.scanner.eat(COLON$2);
23602 this.scanner.skipSC();
23603
23604 switch (this.scanner.tokenType) {
23605 case NUMBER$5:
23606 if (this.scanner.lookupType(1) === IDENTIFIER$a) {
23607 value = this.Dimension();
23608 } else if (this.scanner.lookupNonWSType(1) === SOLIDUS$3) {
23609 value = this.Ratio();
23610 } else {
23611 value = this.Number();
23612 }
23613
23614 break;
23615
23616 case IDENTIFIER$a:
23617 value = this.Identifier();
23618
23619 break;
23620
23621 default:
23622 this.scanner.error('Number, dimension, ratio or identifier is expected');
23623 }
23624
23625 this.scanner.skipSC();
23626 }
23627
23628 this.scanner.eat(RIGHTPARENTHESIS$4);
23629
23630 return {
23631 type: 'MediaFeature',
23632 loc: this.getLocation(start, this.scanner.tokenStart),
23633 name: name,
23634 value: value
23635 };
23636 },
23637 generate: function(node) {
23638 this.chunk('(');
23639 this.chunk(node.name);
23640 if (node.value !== null) {
23641 this.chunk(':');
23642 this.node(node.value);
23643 }
23644 this.chunk(')');
23645 }
23646 };
23647
23648 var TYPE$k = tokenizer.TYPE;
23649
23650 var WHITESPACE$5 = TYPE$k.WhiteSpace;
23651 var COMMENT$5 = TYPE$k.Comment;
23652 var IDENTIFIER$b = TYPE$k.Identifier;
23653 var LEFTPARENTHESIS$4 = TYPE$k.LeftParenthesis;
23654
23655 var MediaQuery = {
23656 name: 'MediaQuery',
23657 structure: {
23658 children: [[
23659 'Identifier',
23660 'MediaFeature',
23661 'WhiteSpace'
23662 ]]
23663 },
23664 parse: function() {
23665 this.scanner.skipSC();
23666
23667 var children = this.createList();
23668 var child = null;
23669 var space = null;
23670
23671 scan:
23672 while (!this.scanner.eof) {
23673 switch (this.scanner.tokenType) {
23674 case COMMENT$5:
23675 this.scanner.next();
23676 continue;
23677
23678 case WHITESPACE$5:
23679 space = this.WhiteSpace();
23680 continue;
23681
23682 case IDENTIFIER$b:
23683 child = this.Identifier();
23684 break;
23685
23686 case LEFTPARENTHESIS$4:
23687 child = this.MediaFeature();
23688 break;
23689
23690 default:
23691 break scan;
23692 }
23693
23694 if (space !== null) {
23695 children.push(space);
23696 space = null;
23697 }
23698
23699 children.push(child);
23700 }
23701
23702 if (child === null) {
23703 this.scanner.error('Identifier or parenthesis is expected');
23704 }
23705
23706 return {
23707 type: 'MediaQuery',
23708 loc: this.getLocationFromList(children),
23709 children: children
23710 };
23711 },
23712 generate: function(node) {
23713 this.children(node);
23714 }
23715 };
23716
23717 var COMMA$1 = tokenizer.TYPE.Comma;
23718
23719 var MediaQueryList = {
23720 name: 'MediaQueryList',
23721 structure: {
23722 children: [[
23723 'MediaQuery'
23724 ]]
23725 },
23726 parse: function(relative) {
23727 var children = this.createList();
23728
23729 this.scanner.skipSC();
23730
23731 while (!this.scanner.eof) {
23732 children.push(this.MediaQuery(relative));
23733
23734 if (this.scanner.tokenType !== COMMA$1) {
23735 break;
23736 }
23737
23738 this.scanner.next();
23739 }
23740
23741 return {
23742 type: 'MediaQueryList',
23743 loc: this.getLocationFromList(children),
23744 children: children
23745 };
23746 },
23747 generate: function(node) {
23748 this.children(node, function() {
23749 this.chunk(',');
23750 });
23751 }
23752 };
23753
23754 // https://drafts.csswg.org/css-syntax-3/#the-anb-type
23755 var Nth = {
23756 name: 'Nth',
23757 structure: {
23758 nth: ['AnPlusB', 'Identifier'],
23759 selector: ['SelectorList', null]
23760 },
23761 parse: function(allowOfClause) {
23762 this.scanner.skipSC();
23763
23764 var start = this.scanner.tokenStart;
23765 var end = start;
23766 var selector = null;
23767 var query;
23768
23769 if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
23770 query = this.Identifier();
23771 } else {
23772 query = this.AnPlusB();
23773 }
23774
23775 this.scanner.skipSC();
23776
23777 if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
23778 this.scanner.next();
23779
23780 selector = this.SelectorList();
23781
23782 if (this.needPositions) {
23783 end = this.getLastListNode(selector.children).loc.end.offset;
23784 }
23785 } else {
23786 if (this.needPositions) {
23787 end = query.loc.end.offset;
23788 }
23789 }
23790
23791 return {
23792 type: 'Nth',
23793 loc: this.getLocation(start, end),
23794 nth: query,
23795 selector: selector
23796 };
23797 },
23798 generate: function(node) {
23799 this.node(node.nth);
23800 if (node.selector !== null) {
23801 this.chunk(' of ');
23802 this.node(node.selector);
23803 }
23804 }
23805 };
23806
23807 var NUMBER$6 = tokenizer.TYPE.Number;
23808
23809 var _Number = {
23810 name: 'Number',
23811 structure: {
23812 value: String
23813 },
23814 parse: function() {
23815 return {
23816 type: 'Number',
23817 loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
23818 value: this.scanner.consume(NUMBER$6)
23819 };
23820 },
23821 generate: function(node) {
23822 this.chunk(node.value);
23823 }
23824 };
23825
23826 // '/' | '*' | ',' | ':' | '+' | '-'
23827 var Operator = {
23828 name: 'Operator',
23829 structure: {
23830 value: String
23831 },
23832 parse: function() {
23833 var start = this.scanner.tokenStart;
23834
23835 this.scanner.next();
23836
23837 return {
23838 type: 'Operator',
23839 loc: this.getLocation(start, this.scanner.tokenStart),
23840 value: this.scanner.substrToCursor(start)
23841 };
23842 },
23843 generate: function(node) {
23844 this.chunk(node.value);
23845 }
23846 };
23847
23848 var TYPE$l = tokenizer.TYPE;
23849 var LEFTPARENTHESIS$5 = TYPE$l.LeftParenthesis;
23850 var RIGHTPARENTHESIS$5 = TYPE$l.RightParenthesis;
23851
23852 var Parentheses = {
23853 name: 'Parentheses',
23854 structure: {
23855 children: [[]]
23856 },
23857 parse: function(readSequence, recognizer) {
23858 var start = this.scanner.tokenStart;
23859 var children = null;
23860
23861 this.scanner.eat(LEFTPARENTHESIS$5);
23862
23863 children = readSequence.call(this, recognizer);
23864
23865 if (!this.scanner.eof) {
23866 this.scanner.eat(RIGHTPARENTHESIS$5);
23867 }
23868
23869 return {
23870 type: 'Parentheses',
23871 loc: this.getLocation(start, this.scanner.tokenStart),
23872 children: children
23873 };
23874 },
23875 generate: function(node) {
23876 this.chunk('(');
23877 this.children(node);
23878 this.chunk(')');
23879 }
23880 };
23881
23882 var TYPE$m = tokenizer.TYPE;
23883
23884 var NUMBER$7 = TYPE$m.Number;
23885 var PERCENTSIGN = TYPE$m.PercentSign;
23886
23887 var Percentage = {
23888 name: 'Percentage',
23889 structure: {
23890 value: String
23891 },
23892 parse: function() {
23893 var start = this.scanner.tokenStart;
23894 var number = this.scanner.consume(NUMBER$7);
23895
23896 this.scanner.eat(PERCENTSIGN);
23897
23898 return {
23899 type: 'Percentage',
23900 loc: this.getLocation(start, this.scanner.tokenStart),
23901 value: number
23902 };
23903 },
23904 generate: function(node) {
23905 this.chunk(node.value);
23906 this.chunk('%');
23907 }
23908 };
23909
23910 var TYPE$n = tokenizer.TYPE;
23911
23912 var IDENTIFIER$c = TYPE$n.Identifier;
23913 var FUNCTION$2 = TYPE$n.Function;
23914 var COLON$3 = TYPE$n.Colon;
23915 var RIGHTPARENTHESIS$6 = TYPE$n.RightParenthesis;
23916
23917 // : ident [ '(' .. ')' ]?
23918 var PseudoClassSelector = {
23919 name: 'PseudoClassSelector',
23920 structure: {
23921 name: String,
23922 children: [['Raw'], null]
23923 },
23924 parse: function() {
23925 var start = this.scanner.tokenStart;
23926 var children = null;
23927 var name;
23928 var nameLowerCase;
23929
23930 this.scanner.eat(COLON$3);
23931
23932 if (this.scanner.tokenType === FUNCTION$2) {
23933 name = this.scanner.consumeFunctionName();
23934 nameLowerCase = name.toLowerCase();
23935
23936 if (this.pseudo.hasOwnProperty(nameLowerCase)) {
23937 this.scanner.skipSC();
23938 children = this.pseudo[nameLowerCase].call(this);
23939 this.scanner.skipSC();
23940 } else {
23941 children = this.createList();
23942 children.push(
23943 this.Raw(this.scanner.currentToken, 0, 0, false, false)
23944 );
23945 }
23946
23947 this.scanner.eat(RIGHTPARENTHESIS$6);
23948 } else {
23949 name = this.scanner.consume(IDENTIFIER$c);
23950 }
23951
23952 return {
23953 type: 'PseudoClassSelector',
23954 loc: this.getLocation(start, this.scanner.tokenStart),
23955 name: name,
23956 children: children
23957 };
23958 },
23959 generate: function(node) {
23960 this.chunk(':');
23961 this.chunk(node.name);
23962
23963 if (node.children !== null) {
23964 this.chunk('(');
23965 this.children(node);
23966 this.chunk(')');
23967 }
23968 },
23969 walkContext: 'function'
23970 };
23971
23972 var TYPE$o = tokenizer.TYPE;
23973
23974 var IDENTIFIER$d = TYPE$o.Identifier;
23975 var FUNCTION$3 = TYPE$o.Function;
23976 var COLON$4 = TYPE$o.Colon;
23977 var RIGHTPARENTHESIS$7 = TYPE$o.RightParenthesis;
23978
23979 // :: ident [ '(' .. ')' ]?
23980 var PseudoElementSelector = {
23981 name: 'PseudoElementSelector',
23982 structure: {
23983 name: String,
23984 children: [['Raw'], null]
23985 },
23986 parse: function() {
23987 var start = this.scanner.tokenStart;
23988 var children = null;
23989 var name;
23990 var nameLowerCase;
23991
23992 this.scanner.eat(COLON$4);
23993 this.scanner.eat(COLON$4);
23994
23995 if (this.scanner.tokenType === FUNCTION$3) {
23996 name = this.scanner.consumeFunctionName();
23997 nameLowerCase = name.toLowerCase();
23998
23999 if (this.pseudo.hasOwnProperty(nameLowerCase)) {
24000 this.scanner.skipSC();
24001 children = this.pseudo[nameLowerCase].call(this);
24002 this.scanner.skipSC();
24003 } else {
24004 children = this.createList();
24005 children.push(
24006 this.Raw(this.scanner.currentToken, 0, 0, false, false)
24007 );
24008 }
24009
24010 this.scanner.eat(RIGHTPARENTHESIS$7);
24011 } else {
24012 name = this.scanner.consume(IDENTIFIER$d);
24013 }
24014
24015 return {
24016 type: 'PseudoElementSelector',
24017 loc: this.getLocation(start, this.scanner.tokenStart),
24018 name: name,
24019 children: children
24020 };
24021 },
24022 generate: function(node) {
24023 this.chunk('::');
24024 this.chunk(node.name);
24025
24026 if (node.children !== null) {
24027 this.chunk('(');
24028 this.children(node);
24029 this.chunk(')');
24030 }
24031 },
24032 walkContext: 'function'
24033 };
24034
24035 var isNumber$4 = tokenizer.isNumber;
24036 var TYPE$p = tokenizer.TYPE;
24037 var NUMBER$8 = TYPE$p.Number;
24038 var SOLIDUS$4 = TYPE$p.Solidus;
24039 var FULLSTOP$3 = TYPE$p.FullStop;
24040
24041 // Terms of <ratio> should to be a positive number (not zero or negative)
24042 // (see https://drafts.csswg.org/mediaqueries-3/#values)
24043 // However, -o-min-device-pixel-ratio takes fractional values as a ratio's term
24044 // and this is using by various sites. Therefore we relax checking on parse
24045 // to test a term is unsigned number without exponent part.
24046 // Additional checks may to be applied on lexer validation.
24047 function consumeNumber$1(scanner) {
24048 var value = scanner.consumeNonWS(NUMBER$8);
24049
24050 for (var i = 0; i < value.length; i++) {
24051 var code = value.charCodeAt(i);
24052 if (!isNumber$4(code) && code !== FULLSTOP$3) {
24053 scanner.error('Unsigned number is expected', scanner.tokenStart - value.length + i);
24054 }
24055 }
24056
24057 if (Number(value) === 0) {
24058 scanner.error('Zero number is not allowed', scanner.tokenStart - value.length);
24059 }
24060
24061 return value;
24062 }
24063
24064 // <positive-integer> S* '/' S* <positive-integer>
24065 var Ratio = {
24066 name: 'Ratio',
24067 structure: {
24068 left: String,
24069 right: String
24070 },
24071 parse: function() {
24072 var start = this.scanner.tokenStart;
24073 var left = consumeNumber$1(this.scanner);
24074 var right;
24075
24076 this.scanner.eatNonWS(SOLIDUS$4);
24077 right = consumeNumber$1(this.scanner);
24078
24079 return {
24080 type: 'Ratio',
24081 loc: this.getLocation(start, this.scanner.tokenStart),
24082 left: left,
24083 right: right
24084 };
24085 },
24086 generate: function(node) {
24087 this.chunk(node.left);
24088 this.chunk('/');
24089 this.chunk(node.right);
24090 }
24091 };
24092
24093 var Raw = {
24094 name: 'Raw',
24095 structure: {
24096 value: String
24097 },
24098 parse: function(startToken, endTokenType1, endTokenType2, includeTokenType2, excludeWhiteSpace) {
24099 var startOffset = this.scanner.getTokenStart(startToken);
24100 var endOffset;
24101
24102 this.scanner.skip(
24103 this.scanner.getRawLength(
24104 startToken,
24105 endTokenType1,
24106 endTokenType2,
24107 includeTokenType2
24108 )
24109 );
24110
24111 if (excludeWhiteSpace && this.scanner.tokenStart > startOffset) {
24112 endOffset = this.scanner.getOffsetExcludeWS();
24113 } else {
24114 endOffset = this.scanner.tokenStart;
24115 }
24116
24117 return {
24118 type: 'Raw',
24119 loc: this.getLocation(startOffset, endOffset),
24120 value: this.scanner.source.substring(startOffset, endOffset)
24121 };
24122 },
24123 generate: function(node) {
24124 this.chunk(node.value);
24125 }
24126 };
24127
24128 var TYPE$q = tokenizer.TYPE;
24129
24130 var LEFTCURLYBRACKET$5 = TYPE$q.LeftCurlyBracket;
24131
24132 function consumeRaw$3(startToken) {
24133 return this.Raw(startToken, LEFTCURLYBRACKET$5, 0, false, true);
24134 }
24135
24136 function consumePrelude() {
24137 var prelude = this.SelectorList();
24138
24139 if (prelude.type !== 'Raw' &&
24140 this.scanner.eof === false &&
24141 this.scanner.tokenType !== LEFTCURLYBRACKET$5) {
24142 this.scanner.error();
24143 }
24144
24145 return prelude;
24146 }
24147
24148 var Rule = {
24149 name: 'Rule',
24150 structure: {
24151 prelude: ['SelectorList', 'Raw'],
24152 block: ['Block']
24153 },
24154 parse: function() {
24155 var startToken = this.scanner.currentToken;
24156 var startOffset = this.scanner.tokenStart;
24157 var prelude;
24158 var block;
24159
24160 if (this.parseRulePrelude) {
24161 prelude = this.parseWithFallback(consumePrelude, consumeRaw$3);
24162 } else {
24163 prelude = consumeRaw$3.call(this, startToken);
24164 }
24165
24166 block = this.Block(true);
24167
24168 return {
24169 type: 'Rule',
24170 loc: this.getLocation(startOffset, this.scanner.tokenStart),
24171 prelude: prelude,
24172 block: block
24173 };
24174 },
24175 generate: function(node) {
24176 this.node(node.prelude);
24177 this.node(node.block);
24178 },
24179 walkContext: 'rule'
24180 };
24181
24182 var Selector = {
24183 name: 'Selector',
24184 structure: {
24185 children: [[
24186 'TypeSelector',
24187 'IdSelector',
24188 'ClassSelector',
24189 'AttributeSelector',
24190 'PseudoClassSelector',
24191 'PseudoElementSelector',
24192 'Combinator',
24193 'WhiteSpace'
24194 ]]
24195 },
24196 parse: function() {
24197 var children = this.readSequence(this.scope.Selector);
24198
24199 // nothing were consumed
24200 if (this.getFirstListNode(children) === null) {
24201 this.scanner.error('Selector is expected');
24202 }
24203
24204 return {
24205 type: 'Selector',
24206 loc: this.getLocationFromList(children),
24207 children: children
24208 };
24209 },
24210 generate: function(node) {
24211 this.children(node);
24212 }
24213 };
24214
24215 var TYPE$r = tokenizer.TYPE;
24216
24217 var COMMA$2 = TYPE$r.Comma;
24218
24219 var SelectorList = {
24220 name: 'SelectorList',
24221 structure: {
24222 children: [[
24223 'Selector',
24224 'Raw'
24225 ]]
24226 },
24227 parse: function() {
24228 var children = this.createList();
24229
24230 while (!this.scanner.eof) {
24231 children.push(this.Selector());
24232
24233 if (this.scanner.tokenType === COMMA$2) {
24234 this.scanner.next();
24235 continue;
24236 }
24237
24238 break;
24239 }
24240
24241 return {
24242 type: 'SelectorList',
24243 loc: this.getLocationFromList(children),
24244 children: children
24245 };
24246 },
24247 generate: function(node) {
24248 this.children(node, function() {
24249 this.chunk(',');
24250 });
24251 },
24252 walkContext: 'selector'
24253 };
24254
24255 var STRING$3 = tokenizer.TYPE.String;
24256
24257 var _String = {
24258 name: 'String',
24259 structure: {
24260 value: String
24261 },
24262 parse: function() {
24263 return {
24264 type: 'String',
24265 loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
24266 value: this.scanner.consume(STRING$3)
24267 };
24268 },
24269 generate: function(node) {
24270 this.chunk(node.value);
24271 }
24272 };
24273
24274 var TYPE$s = tokenizer.TYPE;
24275
24276 var WHITESPACE$6 = TYPE$s.WhiteSpace;
24277 var COMMENT$6 = TYPE$s.Comment;
24278 var EXCLAMATIONMARK$3 = TYPE$s.ExclamationMark;
24279 var ATKEYWORD$4 = TYPE$s.AtKeyword;
24280 var CDO$3 = TYPE$s.CDO;
24281 var CDC$3 = TYPE$s.CDC;
24282
24283 function consumeRaw$4(startToken) {
24284 return this.Raw(startToken, 0, 0, false, false);
24285 }
24286
24287 var StyleSheet = {
24288 name: 'StyleSheet',
24289 structure: {
24290 children: [[
24291 'Comment',
24292 'CDO',
24293 'CDC',
24294 'Atrule',
24295 'Rule',
24296 'Raw'
24297 ]]
24298 },
24299 parse: function() {
24300 var start = this.scanner.tokenStart;
24301 var children = this.createList();
24302 var child;
24303
24304 scan:
24305 while (!this.scanner.eof) {
24306 switch (this.scanner.tokenType) {
24307 case WHITESPACE$6:
24308 this.scanner.next();
24309 continue;
24310
24311 case COMMENT$6:
24312 // ignore comments except exclamation comments (i.e. /*! .. */) on top level
24313 if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK$3) {
24314 this.scanner.next();
24315 continue;
24316 }
24317
24318 child = this.Comment();
24319 break;
24320
24321 case CDO$3: // <!--
24322 child = this.CDO();
24323 break;
24324
24325 case CDC$3: // -->
24326 child = this.CDC();
24327 break;
24328
24329 // CSS Syntax Module Level 3
24330 // §2.2 Error handling
24331 // At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule.
24332 case ATKEYWORD$4:
24333 child = this.parseWithFallback(this.Atrule, consumeRaw$4);
24334 break;
24335
24336 // Anything else starts a qualified rule ...
24337 default:
24338 child = this.parseWithFallback(this.Rule, consumeRaw$4);
24339 }
24340
24341 children.push(child);
24342 }
24343
24344 return {
24345 type: 'StyleSheet',
24346 loc: this.getLocation(start, this.scanner.tokenStart),
24347 children: children
24348 };
24349 },
24350 generate: function(node) {
24351 this.children(node);
24352 },
24353 walkContext: 'stylesheet'
24354 };
24355
24356 var TYPE$t = tokenizer.TYPE;
24357
24358 var IDENTIFIER$e = TYPE$t.Identifier;
24359 var ASTERISK$4 = TYPE$t.Asterisk;
24360 var VERTICALLINE$2 = TYPE$t.VerticalLine;
24361
24362 function eatIdentifierOrAsterisk() {
24363 if (this.scanner.tokenType !== IDENTIFIER$e &&
24364 this.scanner.tokenType !== ASTERISK$4) {
24365 this.scanner.error('Identifier or asterisk is expected');
24366 }
24367
24368 this.scanner.next();
24369 }
24370
24371 // ident
24372 // ident|ident
24373 // ident|*
24374 // *
24375 // *|ident
24376 // *|*
24377 // |ident
24378 // |*
24379 var TypeSelector = {
24380 name: 'TypeSelector',
24381 structure: {
24382 name: String
24383 },
24384 parse: function() {
24385 var start = this.scanner.tokenStart;
24386
24387 if (this.scanner.tokenType === VERTICALLINE$2) {
24388 this.scanner.next();
24389 eatIdentifierOrAsterisk.call(this);
24390 } else {
24391 eatIdentifierOrAsterisk.call(this);
24392
24393 if (this.scanner.tokenType === VERTICALLINE$2) {
24394 this.scanner.next();
24395 eatIdentifierOrAsterisk.call(this);
24396 }
24397 }
24398
24399 return {
24400 type: 'TypeSelector',
24401 loc: this.getLocation(start, this.scanner.tokenStart),
24402 name: this.scanner.substrToCursor(start)
24403 };
24404 },
24405 generate: function(node) {
24406 this.chunk(node.name);
24407 }
24408 };
24409
24410 var isHex$3 = tokenizer.isHex;
24411 var TYPE$u = tokenizer.TYPE;
24412
24413 var IDENTIFIER$f = TYPE$u.Identifier;
24414 var NUMBER$9 = TYPE$u.Number;
24415 var PLUSSIGN$7 = TYPE$u.PlusSign;
24416 var HYPHENMINUS$6 = TYPE$u.HyphenMinus;
24417 var FULLSTOP$4 = TYPE$u.FullStop;
24418 var QUESTIONMARK$1 = TYPE$u.QuestionMark;
24419
24420 function scanUnicodeNumber(scanner) {
24421 for (var pos = scanner.tokenStart + 1; pos < scanner.tokenEnd; pos++) {
24422 var code = scanner.source.charCodeAt(pos);
24423
24424 // break on fullstop or hyperminus/plussign after exponent
24425 if (code === FULLSTOP$4 || code === PLUSSIGN$7) {
24426 // break token, exclude symbol
24427 scanner.tokenStart = pos;
24428 return false;
24429 }
24430 }
24431
24432 return true;
24433 }
24434
24435 // https://drafts.csswg.org/css-syntax-3/#urange
24436 function scanUnicodeRange(scanner) {
24437 var hexStart = scanner.tokenStart + 1; // skip +
24438 var hexLength = 0;
24439
24440 scan: {
24441 if (scanner.tokenType === NUMBER$9) {
24442 if (scanner.source.charCodeAt(scanner.tokenStart) !== FULLSTOP$4 && scanUnicodeNumber(scanner)) {
24443 scanner.next();
24444 } else if (scanner.source.charCodeAt(scanner.tokenStart) !== HYPHENMINUS$6) {
24445 break scan;
24446 }
24447 } else {
24448 scanner.next(); // PLUSSIGN
24449 }
24450
24451 if (scanner.tokenType === HYPHENMINUS$6) {
24452 scanner.next();
24453 }
24454
24455 if (scanner.tokenType === NUMBER$9) {
24456 scanner.next();
24457 }
24458
24459 if (scanner.tokenType === IDENTIFIER$f) {
24460 scanner.next();
24461 }
24462
24463 if (scanner.tokenStart === hexStart) {
24464 scanner.error('Unexpected input', hexStart);
24465 }
24466 }
24467
24468 // validate for U+x{1,6} or U+x{1,6}-x{1,6}
24469 // where x is [0-9a-fA-F]
24470 for (var i = hexStart, wasHyphenMinus = false; i < scanner.tokenStart; i++) {
24471 var code = scanner.source.charCodeAt(i);
24472
24473 if (isHex$3(code) === false && (code !== HYPHENMINUS$6 || wasHyphenMinus)) {
24474 scanner.error('Unexpected input', i);
24475 }
24476
24477 if (code === HYPHENMINUS$6) {
24478 // hex sequence shouldn't be an empty
24479 if (hexLength === 0) {
24480 scanner.error('Unexpected input', i);
24481 }
24482
24483 wasHyphenMinus = true;
24484 hexLength = 0;
24485 } else {
24486 hexLength++;
24487
24488 // too long hex sequence
24489 if (hexLength > 6) {
24490 scanner.error('Too long hex sequence', i);
24491 }
24492 }
24493
24494 }
24495
24496 // check we have a non-zero sequence
24497 if (hexLength === 0) {
24498 scanner.error('Unexpected input', i - 1);
24499 }
24500
24501 // U+abc???
24502 if (!wasHyphenMinus) {
24503 // consume as many U+003F QUESTION MARK (?) code points as possible
24504 for (; hexLength < 6 && !scanner.eof; scanner.next()) {
24505 if (scanner.tokenType !== QUESTIONMARK$1) {
24506 break;
24507 }
24508
24509 hexLength++;
24510 }
24511 }
24512 }
24513
24514 var UnicodeRange = {
24515 name: 'UnicodeRange',
24516 structure: {
24517 value: String
24518 },
24519 parse: function() {
24520 var start = this.scanner.tokenStart;
24521
24522 this.scanner.next(); // U or u
24523 scanUnicodeRange(this.scanner);
24524
24525 return {
24526 type: 'UnicodeRange',
24527 loc: this.getLocation(start, this.scanner.tokenStart),
24528 value: this.scanner.substrToCursor(start)
24529 };
24530 },
24531 generate: function(node) {
24532 this.chunk(node.value);
24533 }
24534 };
24535
24536 var TYPE$v = tokenizer.TYPE;
24537
24538 var STRING$4 = TYPE$v.String;
24539 var URL$3 = TYPE$v.Url;
24540 var RAW$2 = TYPE$v.Raw;
24541 var RIGHTPARENTHESIS$8 = TYPE$v.RightParenthesis;
24542
24543 // url '(' S* (string | raw) S* ')'
24544 var Url = {
24545 name: 'Url',
24546 structure: {
24547 value: ['String', 'Raw']
24548 },
24549 parse: function() {
24550 var start = this.scanner.tokenStart;
24551 var value;
24552
24553 this.scanner.eat(URL$3);
24554 this.scanner.skipSC();
24555
24556 switch (this.scanner.tokenType) {
24557 case STRING$4:
24558 value = this.String();
24559 break;
24560
24561 case RAW$2:
24562 value = this.Raw(this.scanner.currentToken, 0, RAW$2, true, false);
24563 break;
24564
24565 default:
24566 this.scanner.error('String or Raw is expected');
24567 }
24568
24569 this.scanner.skipSC();
24570 this.scanner.eat(RIGHTPARENTHESIS$8);
24571
24572 return {
24573 type: 'Url',
24574 loc: this.getLocation(start, this.scanner.tokenStart),
24575 value: value
24576 };
24577 },
24578 generate: function(node) {
24579 this.chunk('url');
24580 this.chunk('(');
24581 this.node(node.value);
24582 this.chunk(')');
24583 }
24584 };
24585
24586 var Value = {
24587 name: 'Value',
24588 structure: {
24589 children: [[]]
24590 },
24591 parse: function() {
24592 var start = this.scanner.tokenStart;
24593 var children = this.readSequence(this.scope.Value);
24594
24595 return {
24596 type: 'Value',
24597 loc: this.getLocation(start, this.scanner.tokenStart),
24598 children: children
24599 };
24600 },
24601 generate: function(node) {
24602 this.children(node);
24603 }
24604 };
24605
24606 var WHITESPACE$7 = tokenizer.TYPE.WhiteSpace;
24607 var SPACE$4 = Object.freeze({
24608 type: 'WhiteSpace',
24609 loc: null,
24610 value: ' '
24611 });
24612
24613 var WhiteSpace = {
24614 name: 'WhiteSpace',
24615 structure: {
24616 value: String
24617 },
24618 parse: function() {
24619 this.scanner.eat(WHITESPACE$7);
24620 return SPACE$4;
24621
24622 // return {
24623 // type: 'WhiteSpace',
24624 // loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
24625 // value: this.scanner.consume(WHITESPACE)
24626 // };
24627 },
24628 generate: function(node) {
24629 this.chunk(node.value);
24630 }
24631 };
24632
24633 var node = {
24634 AnPlusB: AnPlusB,
24635 Atrule: Atrule,
24636 AtrulePrelude: AtrulePrelude,
24637 AttributeSelector: AttributeSelector,
24638 Block: Block,
24639 Brackets: Brackets,
24640 CDC: CDC_1,
24641 CDO: CDO_1,
24642 ClassSelector: ClassSelector,
24643 Combinator: Combinator,
24644 Comment: Comment,
24645 Declaration: Declaration,
24646 DeclarationList: DeclarationList,
24647 Dimension: Dimension,
24648 Function: _Function,
24649 HexColor: HexColor,
24650 Identifier: Identifier,
24651 IdSelector: IdSelector,
24652 MediaFeature: MediaFeature,
24653 MediaQuery: MediaQuery,
24654 MediaQueryList: MediaQueryList,
24655 Nth: Nth,
24656 Number: _Number,
24657 Operator: Operator,
24658 Parentheses: Parentheses,
24659 Percentage: Percentage,
24660 PseudoClassSelector: PseudoClassSelector,
24661 PseudoElementSelector: PseudoElementSelector,
24662 Ratio: Ratio,
24663 Raw: Raw,
24664 Rule: Rule,
24665 Selector: Selector,
24666 SelectorList: SelectorList,
24667 String: _String,
24668 StyleSheet: StyleSheet,
24669 TypeSelector: TypeSelector,
24670 UnicodeRange: UnicodeRange,
24671 Url: Url,
24672 Value: Value,
24673 WhiteSpace: WhiteSpace
24674 };
24675
24676 var lexer = {
24677 generic: true,
24678 types: data.types,
24679 properties: data.properties,
24680 node: node
24681 };
24682
24683 var cmpChar$2 = tokenizer.cmpChar;
24684 var TYPE$w = tokenizer.TYPE;
24685
24686 var IDENTIFIER$g = TYPE$w.Identifier;
24687 var STRING$5 = TYPE$w.String;
24688 var NUMBER$a = TYPE$w.Number;
24689 var FUNCTION$4 = TYPE$w.Function;
24690 var URL$4 = TYPE$w.Url;
24691 var NUMBERSIGN$5 = TYPE$w.NumberSign;
24692 var LEFTPARENTHESIS$6 = TYPE$w.LeftParenthesis;
24693 var LEFTSQUAREBRACKET$4 = TYPE$w.LeftSquareBracket;
24694 var PLUSSIGN$8 = TYPE$w.PlusSign;
24695 var HYPHENMINUS$7 = TYPE$w.HyphenMinus;
24696 var COMMA$3 = TYPE$w.Comma;
24697 var SOLIDUS$5 = TYPE$w.Solidus;
24698 var ASTERISK$5 = TYPE$w.Asterisk;
24699 var PERCENTSIGN$1 = TYPE$w.PercentSign;
24700 var BACKSLASH = TYPE$w.Backslash;
24701 var U = 117; // 'u'.charCodeAt(0)
24702
24703 var _default = function defaultRecognizer(context) {
24704 switch (this.scanner.tokenType) {
24705 case NUMBERSIGN$5:
24706 return this.HexColor();
24707
24708 case COMMA$3:
24709 context.space = null;
24710 context.ignoreWSAfter = true;
24711 return this.Operator();
24712
24713 case SOLIDUS$5:
24714 case ASTERISK$5:
24715 case PLUSSIGN$8:
24716 case HYPHENMINUS$7:
24717 return this.Operator();
24718
24719 case LEFTPARENTHESIS$6:
24720 return this.Parentheses(this.readSequence, context.recognizer);
24721
24722 case LEFTSQUAREBRACKET$4:
24723 return this.Brackets(this.readSequence, context.recognizer);
24724
24725 case STRING$5:
24726 return this.String();
24727
24728 case NUMBER$a:
24729 switch (this.scanner.lookupType(1)) {
24730 case PERCENTSIGN$1:
24731 return this.Percentage();
24732
24733 case IDENTIFIER$g:
24734 // edge case: number with folowing \0 and \9 hack shouldn't to be a Dimension
24735 if (cmpChar$2(this.scanner.source, this.scanner.tokenEnd, BACKSLASH)) {
24736 return this.Number();
24737 } else {
24738 return this.Dimension();
24739 }
24740
24741 default:
24742 return this.Number();
24743 }
24744
24745 case FUNCTION$4:
24746 return this.Function(this.readSequence, context.recognizer);
24747
24748 case URL$4:
24749 return this.Url();
24750
24751 case IDENTIFIER$g:
24752 // check for unicode range, it should start with u+ or U+
24753 if (cmpChar$2(this.scanner.source, this.scanner.tokenStart, U) &&
24754 cmpChar$2(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN$8)) {
24755 return this.UnicodeRange();
24756 } else {
24757 return this.Identifier();
24758 }
24759 }
24760 };
24761
24762 var atrulePrelude = {
24763 getNode: _default
24764 };
24765
24766 var TYPE$x = tokenizer.TYPE;
24767
24768 var IDENTIFIER$h = TYPE$x.Identifier;
24769 var NUMBER$b = TYPE$x.Number;
24770 var NUMBERSIGN$6 = TYPE$x.NumberSign;
24771 var LEFTSQUAREBRACKET$5 = TYPE$x.LeftSquareBracket;
24772 var PLUSSIGN$9 = TYPE$x.PlusSign;
24773 var SOLIDUS$6 = TYPE$x.Solidus;
24774 var ASTERISK$6 = TYPE$x.Asterisk;
24775 var FULLSTOP$5 = TYPE$x.FullStop;
24776 var COLON$5 = TYPE$x.Colon;
24777 var GREATERTHANSIGN$3 = TYPE$x.GreaterThanSign;
24778 var VERTICALLINE$3 = TYPE$x.VerticalLine;
24779 var TILDE$2 = TYPE$x.Tilde;
24780
24781 function getNode(context) {
24782 switch (this.scanner.tokenType) {
24783 case PLUSSIGN$9:
24784 case GREATERTHANSIGN$3:
24785 case TILDE$2:
24786 context.space = null;
24787 context.ignoreWSAfter = true;
24788 return this.Combinator();
24789
24790 case SOLIDUS$6: // /deep/
24791 return this.Combinator();
24792
24793 case FULLSTOP$5:
24794 return this.ClassSelector();
24795
24796 case LEFTSQUAREBRACKET$5:
24797 return this.AttributeSelector();
24798
24799 case NUMBERSIGN$6:
24800 return this.IdSelector();
24801
24802 case COLON$5:
24803 if (this.scanner.lookupType(1) === COLON$5) {
24804 return this.PseudoElementSelector();
24805 } else {
24806 return this.PseudoClassSelector();
24807 }
24808
24809 case IDENTIFIER$h:
24810 case ASTERISK$6:
24811 case VERTICALLINE$3:
24812 return this.TypeSelector();
24813
24814 case NUMBER$b:
24815 return this.Percentage();
24816 }
24817 }
24818 var selector = {
24819 getNode: getNode
24820 };
24821
24822 // https://drafts.csswg.org/css-images-4/#element-notation
24823 // https://developer.mozilla.org/en-US/docs/Web/CSS/element
24824 var element = function() {
24825 this.scanner.skipSC();
24826
24827 var children = this.createSingleNodeList(
24828 this.IdSelector()
24829 );
24830
24831 this.scanner.skipSC();
24832
24833 return children;
24834 };
24835
24836 // legacy IE function
24837 // expression '(' raw ')'
24838 var expression$1 = function() {
24839 return this.createSingleNodeList(
24840 this.Raw(this.scanner.currentToken, 0, 0, false, false)
24841 );
24842 };
24843
24844 var TYPE$y = tokenizer.TYPE;
24845
24846 var IDENTIFIER$i = TYPE$y.Identifier;
24847 var COMMA$4 = TYPE$y.Comma;
24848 var SEMICOLON$5 = TYPE$y.Semicolon;
24849 var HYPHENMINUS$8 = TYPE$y.HyphenMinus;
24850 var EXCLAMATIONMARK$4 = TYPE$y.ExclamationMark;
24851
24852 // var '(' ident (',' <value>? )? ')'
24853 var _var = function() {
24854 var children = this.createList();
24855
24856 this.scanner.skipSC();
24857
24858 var identStart = this.scanner.tokenStart;
24859
24860 this.scanner.eat(HYPHENMINUS$8);
24861 if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== HYPHENMINUS$8) {
24862 this.scanner.error('HyphenMinus is expected');
24863 }
24864 this.scanner.eat(IDENTIFIER$i);
24865
24866 children.push({
24867 type: 'Identifier',
24868 loc: this.getLocation(identStart, this.scanner.tokenStart),
24869 name: this.scanner.substrToCursor(identStart)
24870 });
24871
24872 this.scanner.skipSC();
24873
24874 if (this.scanner.tokenType === COMMA$4) {
24875 children.push(this.Operator());
24876 children.push(this.parseCustomProperty
24877 ? this.Value(null)
24878 : this.Raw(this.scanner.currentToken, EXCLAMATIONMARK$4, SEMICOLON$5, false, false)
24879 );
24880 }
24881
24882 return children;
24883 };
24884
24885 var value = {
24886 getNode: _default,
24887 '-moz-element': element,
24888 'element': element,
24889 'expression': expression$1,
24890 'var': _var
24891 };
24892
24893 var scope = {
24894 AtrulePrelude: atrulePrelude,
24895 Selector: selector,
24896 Value: value
24897 };
24898
24899 var fontFace = {
24900 parse: {
24901 prelude: null,
24902 block: function() {
24903 return this.Block(true);
24904 }
24905 }
24906 };
24907
24908 var TYPE$z = tokenizer.TYPE;
24909
24910 var STRING$6 = TYPE$z.String;
24911 var IDENTIFIER$j = TYPE$z.Identifier;
24912 var URL$5 = TYPE$z.Url;
24913 var LEFTPARENTHESIS$7 = TYPE$z.LeftParenthesis;
24914
24915 var _import = {
24916 parse: {
24917 prelude: function() {
24918 var children = this.createList();
24919
24920 this.scanner.skipSC();
24921
24922 switch (this.scanner.tokenType) {
24923 case STRING$6:
24924 children.push(this.String());
24925 break;
24926
24927 case URL$5:
24928 children.push(this.Url());
24929 break;
24930
24931 default:
24932 this.scanner.error('String or url() is expected');
24933 }
24934
24935 if (this.scanner.lookupNonWSType(0) === IDENTIFIER$j ||
24936 this.scanner.lookupNonWSType(0) === LEFTPARENTHESIS$7) {
24937 children.push(this.WhiteSpace());
24938 children.push(this.MediaQueryList());
24939 }
24940
24941 return children;
24942 },
24943 block: null
24944 }
24945 };
24946
24947 var media = {
24948 parse: {
24949 prelude: function() {
24950 return this.createSingleNodeList(
24951 this.MediaQueryList()
24952 );
24953 },
24954 block: function() {
24955 return this.Block(false);
24956 }
24957 }
24958 };
24959
24960 var page$2 = {
24961 parse: {
24962 prelude: function() {
24963 return this.createSingleNodeList(
24964 this.SelectorList()
24965 );
24966 },
24967 block: function() {
24968 return this.Block(true);
24969 }
24970 }
24971 };
24972
24973 var TYPE$A = tokenizer.TYPE;
24974
24975 var WHITESPACE$8 = TYPE$A.WhiteSpace;
24976 var COMMENT$7 = TYPE$A.Comment;
24977 var IDENTIFIER$k = TYPE$A.Identifier;
24978 var FUNCTION$5 = TYPE$A.Function;
24979 var LEFTPARENTHESIS$8 = TYPE$A.LeftParenthesis;
24980 var HYPHENMINUS$9 = TYPE$A.HyphenMinus;
24981 var COLON$6 = TYPE$A.Colon;
24982
24983 function consumeRaw$5() {
24984 return this.createSingleNodeList(
24985 this.Raw(this.scanner.currentToken, 0, 0, false, false)
24986 );
24987 }
24988
24989 function parentheses() {
24990 var index = 0;
24991
24992 this.scanner.skipSC();
24993
24994 // TODO: make it simplier
24995 if (this.scanner.tokenType === IDENTIFIER$k) {
24996 index = 1;
24997 } else if (this.scanner.tokenType === HYPHENMINUS$9 &&
24998 this.scanner.lookupType(1) === IDENTIFIER$k) {
24999 index = 2;
25000 }
25001
25002 if (index !== 0 && this.scanner.lookupNonWSType(index) === COLON$6) {
25003 return this.createSingleNodeList(
25004 this.Declaration()
25005 );
25006 }
25007
25008 return readSequence.call(this);
25009 }
25010
25011 function readSequence() {
25012 var children = this.createList();
25013 var space = null;
25014 var child;
25015
25016 this.scanner.skipSC();
25017
25018 scan:
25019 while (!this.scanner.eof) {
25020 switch (this.scanner.tokenType) {
25021 case WHITESPACE$8:
25022 space = this.WhiteSpace();
25023 continue;
25024
25025 case COMMENT$7:
25026 this.scanner.next();
25027 continue;
25028
25029 case FUNCTION$5:
25030 child = this.Function(consumeRaw$5, this.scope.AtrulePrelude);
25031 break;
25032
25033 case IDENTIFIER$k:
25034 child = this.Identifier();
25035 break;
25036
25037 case LEFTPARENTHESIS$8:
25038 child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
25039 break;
25040
25041 default:
25042 break scan;
25043 }
25044
25045 if (space !== null) {
25046 children.push(space);
25047 space = null;
25048 }
25049
25050 children.push(child);
25051 }
25052
25053 return children;
25054 }
25055
25056 var supports = {
25057 parse: {
25058 prelude: function() {
25059 var children = readSequence.call(this);
25060
25061 if (this.getFirstListNode(children) === null) {
25062 this.scanner.error('Condition is expected');
25063 }
25064
25065 return children;
25066 },
25067 block: function() {
25068 return this.Block(false);
25069 }
25070 }
25071 };
25072
25073 var atrule = {
25074 'font-face': fontFace,
25075 'import': _import,
25076 'media': media,
25077 'page': page$2,
25078 'supports': supports
25079 };
25080
25081 var dir = {
25082 parse: function() {
25083 return this.createSingleNodeList(
25084 this.Identifier()
25085 );
25086 }
25087 };
25088
25089 var has$1 = {
25090 parse: function() {
25091 return this.createSingleNodeList(
25092 this.SelectorList()
25093 );
25094 }
25095 };
25096
25097 var lang = {
25098 parse: function() {
25099 return this.createSingleNodeList(
25100 this.Identifier()
25101 );
25102 }
25103 };
25104
25105 var selectorList = {
25106 parse: function selectorList() {
25107 return this.createSingleNodeList(
25108 this.SelectorList()
25109 );
25110 }
25111 };
25112
25113 var matches = selectorList;
25114
25115 var not = selectorList;
25116
25117 var ALLOW_OF_CLAUSE = true;
25118
25119 var nthWithOfClause = {
25120 parse: function nthWithOfClause() {
25121 return this.createSingleNodeList(
25122 this.Nth(ALLOW_OF_CLAUSE)
25123 );
25124 }
25125 };
25126
25127 var nthChild = nthWithOfClause;
25128
25129 var nthLastChild = nthWithOfClause;
25130
25131 var DISALLOW_OF_CLAUSE = false;
25132
25133 var nth$1 = {
25134 parse: function nth() {
25135 return this.createSingleNodeList(
25136 this.Nth(DISALLOW_OF_CLAUSE)
25137 );
25138 }
25139 };
25140
25141 var nthLastOfType = nth$1;
25142
25143 var nthOfType = nth$1;
25144
25145 var slotted = {
25146 parse: function compoundSelector() {
25147 return this.createSingleNodeList(
25148 this.Selector()
25149 );
25150 }
25151 };
25152
25153 var pseudo = {
25154 'dir': dir,
25155 'has': has$1,
25156 'lang': lang,
25157 'matches': matches,
25158 'not': not,
25159 'nth-child': nthChild,
25160 'nth-last-child': nthLastChild,
25161 'nth-last-of-type': nthLastOfType,
25162 'nth-of-type': nthOfType,
25163 'slotted': slotted
25164 };
25165
25166 var parser$2 = {
25167 parseContext: {
25168 default: 'StyleSheet',
25169 stylesheet: 'StyleSheet',
25170 atrule: 'Atrule',
25171 atrulePrelude: function(options) {
25172 return this.AtrulePrelude(options.atrule ? String(options.atrule) : null);
25173 },
25174 mediaQueryList: 'MediaQueryList',
25175 mediaQuery: 'MediaQuery',
25176 rule: 'Rule',
25177 selectorList: 'SelectorList',
25178 selector: 'Selector',
25179 block: function() {
25180 return this.Block(true);
25181 },
25182 declarationList: 'DeclarationList',
25183 declaration: 'Declaration',
25184 value: 'Value'
25185 },
25186 scope: scope,
25187 atrule: atrule,
25188 pseudo: pseudo,
25189 node: node
25190 };
25191
25192 var walker = {
25193 node: node
25194 };
25195
25196 function merge() {
25197 var dest = {};
25198
25199 for (var i = 0; i < arguments.length; i++) {
25200 var src = arguments[i];
25201 for (var key in src) {
25202 dest[key] = src[key];
25203 }
25204 }
25205
25206 return dest;
25207 }
25208
25209 var syntax = create$5.create(
25210 merge(
25211 lexer,
25212 parser$2,
25213 walker
25214 )
25215 );
25216
25217 var lib = syntax;
25218
25219 var sheet = createCommonjsModule(function (module, exports) {
25220
25221
25222
25223 Object.defineProperty(exports, "__esModule", {
25224 value: true
25225 });
25226 exports.default = void 0;
25227
25228 var _regenerator = interopRequireDefault(regenerator);
25229
25230 var _asyncToGenerator2 = interopRequireDefault(asyncToGenerator);
25231
25232 var _classCallCheck2 = interopRequireDefault(classCallCheck);
25233
25234 var _createClass2 = interopRequireDefault(createClass);
25235
25236 var _cssTree = interopRequireDefault(lib);
25237
25238
25239
25240 var _hook = interopRequireDefault(hook);
25241
25242 var Sheet =
25243 /*#__PURE__*/
25244 function () {
25245 function Sheet(url, hooks) {
25246 (0, _classCallCheck2.default)(this, Sheet);
25247
25248 if (hooks) {
25249 this.hooks = hooks;
25250 } else {
25251 this.hooks = {};
25252 this.hooks.onUrl = new _hook.default(this);
25253 this.hooks.onAtPage = new _hook.default(this);
25254 this.hooks.onAtMedia = new _hook.default(this);
25255 this.hooks.onRule = new _hook.default(this);
25256 this.hooks.onDeclaration = new _hook.default(this);
25257 this.hooks.onContent = new _hook.default(this);
25258 this.hooks.onImport = new _hook.default(this);
25259 this.hooks.beforeTreeParse = new _hook.default(this);
25260 this.hooks.beforeTreeWalk = new _hook.default(this);
25261 this.hooks.afterTreeWalk = new _hook.default(this);
25262 }
25263
25264 try {
25265 this.url = new URL(url, window.location.href);
25266 } catch (e) {
25267 this.url = new URL(window.location.href);
25268 }
25269 } // parse
25270
25271
25272 (0, _createClass2.default)(Sheet, [{
25273 key: "parse",
25274 value: function () {
25275 var _parse = (0, _asyncToGenerator2.default)(
25276 /*#__PURE__*/
25277 _regenerator.default.mark(function _callee(text) {
25278 return _regenerator.default.wrap(function _callee$(_context) {
25279 while (1) {
25280 switch (_context.prev = _context.next) {
25281 case 0:
25282 this.text = text;
25283 _context.next = 3;
25284 return this.hooks.beforeTreeParse.trigger(this.text, this);
25285
25286 case 3:
25287 // send to csstree
25288 this.ast = _cssTree.default.parse(this._text);
25289 _context.next = 6;
25290 return this.hooks.beforeTreeWalk.trigger(this.ast);
25291
25292 case 6:
25293 // Replace urls
25294 this.replaceUrls(this.ast); // Scope
25295
25296 this.id = (0, utils.UUID)(); // this.addScope(this.ast, this.uuid);
25297 // Replace IDs with data-id
25298
25299 this.replaceIds(this.ast);
25300 this.imported = []; // Trigger Hooks
25301
25302 this.urls(this.ast);
25303 this.rules(this.ast);
25304 this.atrules(this.ast);
25305 _context.next = 15;
25306 return this.hooks.afterTreeWalk.trigger(this.ast, this);
25307
25308 case 15:
25309 return _context.abrupt("return", this.ast);
25310
25311 case 16:
25312 case "end":
25313 return _context.stop();
25314 }
25315 }
25316 }, _callee, this);
25317 }));
25318
25319 return function parse(_x) {
25320 return _parse.apply(this, arguments);
25321 };
25322 }()
25323 }, {
25324 key: "insertRule",
25325 value: function insertRule(rule) {
25326 var _this = this;
25327
25328 var inserted = this.ast.children.appendData(rule);
25329 inserted.forEach(function (item) {
25330 _this.declarations(item);
25331 });
25332 }
25333 }, {
25334 key: "urls",
25335 value: function urls(ast) {
25336 var _this2 = this;
25337
25338 _cssTree.default.walk(ast, {
25339 visit: "Url",
25340 enter: function enter(node, item, list) {
25341 _this2.hooks.onUrl.trigger(node, item, list);
25342 }
25343 });
25344 }
25345 }, {
25346 key: "atrules",
25347 value: function atrules(ast) {
25348 var _this3 = this;
25349
25350 _cssTree.default.walk(ast, {
25351 visit: "Atrule",
25352 enter: function enter(node, item, list) {
25353 var basename = _cssTree.default.keyword(node.name).basename;
25354
25355 if (basename === "page") {
25356 _this3.hooks.onAtPage.trigger(node, item, list);
25357
25358 _this3.declarations(node, item, list);
25359 }
25360
25361 if (basename === "media") {
25362 _this3.hooks.onAtMedia.trigger(node, item, list);
25363
25364 _this3.declarations(node, item, list);
25365 }
25366
25367 if (basename === "import") {
25368 _this3.hooks.onImport.trigger(node, item, list);
25369
25370 _this3.imports(node, item, list);
25371 }
25372 }
25373 });
25374 }
25375 }, {
25376 key: "rules",
25377 value: function rules(ast) {
25378 var _this4 = this;
25379
25380 _cssTree.default.walk(ast, {
25381 visit: "Rule",
25382 enter: function enter(ruleNode, ruleItem, rulelist) {
25383 // console.log("rule", ruleNode);
25384 _this4.hooks.onRule.trigger(ruleNode, ruleItem, rulelist);
25385
25386 _this4.declarations(ruleNode, ruleItem, rulelist);
25387 }
25388 });
25389 }
25390 }, {
25391 key: "declarations",
25392 value: function declarations(ruleNode, ruleItem, rulelist) {
25393 var _this5 = this;
25394
25395 _cssTree.default.walk(ruleNode, {
25396 visit: "Declaration",
25397 enter: function enter(declarationNode, dItem, dList) {
25398 // console.log(declarationNode);
25399 _this5.hooks.onDeclaration.trigger(declarationNode, dItem, dList, {
25400 ruleNode: ruleNode,
25401 ruleItem: ruleItem,
25402 rulelist: rulelist
25403 });
25404
25405 if (declarationNode.property === "content") {
25406 _cssTree.default.walk(declarationNode, {
25407 visit: "Function",
25408 enter: function enter(funcNode, fItem, fList) {
25409 _this5.hooks.onContent.trigger(funcNode, fItem, fList, {
25410 declarationNode: declarationNode,
25411 dItem: dItem,
25412 dList: dList
25413 }, {
25414 ruleNode: ruleNode,
25415 ruleItem: ruleItem,
25416 rulelist: rulelist
25417 });
25418 }
25419 });
25420 }
25421 }
25422 });
25423 }
25424 }, {
25425 key: "replaceUrls",
25426 value: function replaceUrls(ast) {
25427 var _this6 = this;
25428
25429 _cssTree.default.walk(ast, {
25430 visit: "Url",
25431 enter: function enter(node, item, list) {
25432 var href = node.value.value.replace(/["']/g, "");
25433 var url = new URL(href, _this6.url);
25434 node.value.value = url.toString();
25435 }
25436 });
25437 }
25438 }, {
25439 key: "addScope",
25440 value: function addScope(ast, id) {
25441 // Get all selector lists
25442 // add an id
25443 _cssTree.default.walk(ast, {
25444 visit: "Selector",
25445 enter: function enter(node, item, list) {
25446 var children = node.children;
25447 children.prepend(children.createItem({
25448 type: "WhiteSpace",
25449 value: " "
25450 }));
25451 children.prepend(children.createItem({
25452 type: "IdSelector",
25453 name: id,
25454 loc: null,
25455 children: null
25456 }));
25457 }
25458 });
25459 }
25460 }, {
25461 key: "getNamedPageSelectors",
25462 value: function getNamedPageSelectors(ast) {
25463 var namedPageSelectors = {};
25464
25465 _cssTree.default.walk(ast, {
25466 visit: "Rule",
25467 enter: function enter(node, item, list) {
25468 _cssTree.default.walk(node, {
25469 visit: "Declaration",
25470 enter: function enter(declaration, dItem, dList) {
25471 if (declaration.property === "page") {
25472 var value = declaration.value.children.first();
25473 var name = value.name;
25474
25475 var selector = _cssTree.default.generate(node.prelude);
25476
25477 namedPageSelectors[name] = {
25478 name: name,
25479 selector: selector
25480 }; // dList.remove(dItem);
25481 // Add in page break
25482
25483 declaration.property = "break-before";
25484 value.type = "Identifier";
25485 value.name = "always";
25486 }
25487 }
25488 });
25489 }
25490 });
25491
25492 return namedPageSelectors;
25493 }
25494 }, {
25495 key: "replaceIds",
25496 value: function replaceIds(ast) {
25497 _cssTree.default.walk(ast, {
25498 visit: "Rule",
25499 enter: function enter(node, item, list) {
25500 _cssTree.default.walk(node, {
25501 visit: "IdSelector",
25502 enter: function enter(idNode, idItem, idList) {
25503 var name = idNode.name;
25504 idNode.flags = null;
25505 idNode.matcher = "=";
25506 idNode.name = {
25507 type: "Identifier",
25508 loc: null,
25509 name: "data-id"
25510 };
25511 idNode.type = "AttributeSelector";
25512 idNode.value = {
25513 type: "String",
25514 loc: null,
25515 value: "\"".concat(name, "\"")
25516 };
25517 }
25518 });
25519 }
25520 });
25521 }
25522 }, {
25523 key: "imports",
25524 value: function imports(node, item, list) {
25525 var _this7 = this;
25526
25527 // console.log("import", node, item, list);
25528 var queries = [];
25529
25530 _cssTree.default.walk(node, {
25531 visit: "MediaQuery",
25532 enter: function enter(mqNode, mqItem, mqList) {
25533 _cssTree.default.walk(mqNode, {
25534 visit: "Identifier",
25535 enter: function enter(identNode, identItem, identList) {
25536 queries.push(identNode.name);
25537 }
25538 });
25539 }
25540 }); // Just basic media query support for now
25541
25542
25543 var shouldNotApply = queries.some(function (query, index) {
25544 var q = query;
25545
25546 if (q === "not") {
25547 q = queries[index + 1];
25548 return !(q === "screen" || q === "speech");
25549 } else {
25550 return q === "screen" || q === "speech";
25551 }
25552 });
25553
25554 if (shouldNotApply) {
25555 return;
25556 }
25557
25558 _cssTree.default.walk(node, {
25559 visit: "String",
25560 enter: function enter(urlNode, urlItem, urlList) {
25561 var href = urlNode.value.replace(/["']/g, "");
25562 var url = new URL(href, _this7.url);
25563 var value = url.toString();
25564
25565 _this7.imported.push(value); // Remove the original
25566
25567
25568 list.remove(item);
25569 }
25570 });
25571 }
25572 }, {
25573 key: "toString",
25574 // generate string
25575 value: function toString(ast) {
25576 return _cssTree.default.generate(ast || this.ast);
25577 }
25578 }, {
25579 key: "text",
25580 set: function set(t) {
25581 this._text = t;
25582 },
25583 get: function get() {
25584 return this._text;
25585 }
25586 }]);
25587 return Sheet;
25588 }();
25589
25590 var _default = Sheet;
25591 exports.default = _default;
25592 });
25593
25594 unwrapExports(sheet);
25595
25596 var base = createCommonjsModule(function (module, exports) {
25597
25598 Object.defineProperty(exports, "__esModule", {
25599 value: true
25600 });
25601 exports.default = void 0;
25602 var _default = "\n:root {\n\t--width: 8.5in;\n\t--height: 11in;\n\t--margin-top: 1in;\n\t--margin-right: 1in;\n\t--margin-bottom: 1in;\n\t--margin-left: 1in;\n\t--page-count: 0;\n}\n\n@page {\n\tsize: letter;\n\tmargin: 0;\n}\n\n.pagedjs_page {\n\tbox-sizing: border-box;\n\twidth: var(--width);\n\theight: var(--height);\n\toverflow: hidden;\n\tposition: relative;\n\tdisplay: grid;\n\tgrid-template-columns: [left] var(--margin-left) [center] calc(var(--width) - var(--margin-left) - var(--margin-right)) [right] var(--margin-right);\n\tgrid-template-rows: [header] var(--margin-top) [page] calc(var(--height) - var(--margin-top) - var(--margin-bottom)) [footer] var(--margin-bottom);\n}\n\n.pagedjs_page * {\n\tbox-sizing: border-box;\n}\n\n.pagedjs_margin-top {\n\twidth: calc(var(--width) - var(--margin-left) - var(--margin-right));\n\theight: var(--margin-top);\n\tgrid-column: center;\n\tgrid-row: header;\n\tflex-wrap: nowrap;\n\tdisplay: grid;\n\tgrid-template-columns: repeat(3, 1fr);\n\tgrid-template-rows: 100%;\n}\n\n.pagedjs_margin-top-left-corner-holder {\n\twidth: var(--margin-left);\n\theight: var(--margin-top);\n\tdisplay: flex;\n\tgrid-column: left;\n\tgrid-row: header;\n}\n\n.pagedjs_margin-top-right-corner-holder {\n\twidth: var(--margin-right);\n\theight: var(--margin-top);\n\tdisplay: flex;\n\tgrid-column: right;\n\tgrid-row: header;\n}\n\n.pagedjs_margin-top-left-corner {\n\twidth: var(--margin-left);\n}\n\n.pagedjs_margin-top-right-corner {\n\twidth: var(--margin-right);\n}\n\n\n.pagedjs_margin-right {\n\theight: calc(var(--height) - var(--margin-top) - var(--margin-bottom));\n\twidth: var(--margin-right);\n\tright: 0;\n\tgrid-column: right;\n\tgrid-row: page;\n\tdisplay: grid;\n\tgrid-template-rows: repeat(3, 33.3333%);\n\tgrid-template-columns: 100%;\n}\n\n\n\n.pagedjs_margin-bottom {\n\twidth: calc(var(--width) - var(--margin-left) - var(--margin-right));\n\theight: var(--margin-bottom);\n\tgrid-column: center;\n\tgrid-row: footer;\n\tdisplay: grid;\n\tgrid-template-columns: repeat(3, 1fr);\n\tgrid-template-rows: 100%;\n}\n\n.pagedjs_margin-bottom-left-corner-holder {\n\twidth: var(--margin-left);\n\theight: var(--margin-bottom);\n\tdisplay: flex;\n\tgrid-column: left;\n\tgrid-row: footer;\n}\n\n.pagedjs_margin-bottom-right-corner-holder {\n\twidth: var(--margin-right);\n\theight: var(--margin-bottom);\n\tdisplay: flex;\n\tgrid-column: right;\n\tgrid-row: footer;\n}\n\n.pagedjs_margin-bottom-left-corner {\n\twidth: var(--margin-left);\n}\n\n.pagedjs_margin-bottom-right-corner {\n\twidth: var(--margin-right);\n}\n\n\n\n.pagedjs_margin-left {\n\theight: calc(var(--height) - var(--margin-top) - var(--margin-bottom));\n\twidth: var(--margin-left);\n\tgrid-column: left;\n\tgrid-row: page;\n\tdisplay: grid;\n\tgrid-template-rows: repeat(3, 33.33333%);\n\tgrid-template-columns: 100%;\n}\n\n.pagedjs_pages .pagedjs_page .pagedjs_margin:not(.hasContent) {\n\tvisibility: hidden;\n}\n\n.pagedjs_page > .pagedjs_area {\n\tgrid-column: center;\n\tgrid-row: page;\n\twidth: 100%;\n\theight: 100%;\n}\n\n.pagedjs_page > .pagedjs_area > .pagedjs_page_content {\n\twidth: 100%;\n\theight: 100%;\n\tposition: relative;\n\tcolumn-fill: auto;\n}\n\n.pagedjs_page {\n\tcounter-increment: page;\n}\n\n.pagedjs_pages {\n\tcounter-reset: pages var(--page-count);\n}\n\n\n.pagedjs_page .pagedjs_margin-top-left-corner,\n.pagedjs_page .pagedjs_margin-top-right-corner,\n.pagedjs_page .pagedjs_margin-bottom-left-corner,\n.pagedjs_page .pagedjs_margin-bottom-right-corner,\n.pagedjs_page .pagedjs_margin-top-left,\n.pagedjs_page .pagedjs_margin-top-right,\n.pagedjs_page .pagedjs_margin-bottom-left,\n.pagedjs_page .pagedjs_margin-bottom-right,\n.pagedjs_page .pagedjs_margin-top-center,\n.pagedjs_page .pagedjs_margin-bottom-center,\n.pagedjs_page .pagedjs_margin-top-center,\n.pagedjs_page .pagedjs_margin-bottom-center,\n.pagedjs_margin-right-middle,\n.pagedjs_margin-left-middle {\n\tdisplay: flex;\n\talign-items: center;\n}\n\n.pagedjs_margin-right-top,\n.pagedjs_margin-left-top {\n\tdisplay: flex;\n\talign-items: flex-top;\n}\n\n\n.pagedjs_margin-right-bottom,\n.pagedjs_margin-left-bottom {\n\tdisplay: flex;\n\talign-items: flex-end;\n}\n\n\n\n/*\n.pagedjs_page .pagedjs_margin-top-center,\n.pagedjs_page .pagedjs_margin-bottom-center {\n\theight: 100%;\n\tdisplay: none;\n\talign-items: center;\n\tflex: 1 0 33%;\n\tmargin: 0 auto;\n}\n\n.pagedjs_page .pagedjs_margin-top-left-corner,\n.pagedjs_page .pagedjs_margin-top-right-corner,\n.pagedjs_page .pagedjs_margin-bottom-right-corner,\n.pagedjs_page .pagedjs_margin-bottom-left-corner {\n\tdisplay: none;\n\talign-items: center;\n}\n\n.pagedjs_page .pagedjs_margin-left-top,\n.pagedjs_page .pagedjs_margin-right-top {\n\tdisplay: none;\n\talign-items: flex-start;\n}\n\n.pagedjs_page .pagedjs_margin-right-middle,\n.pagedjs_page .pagedjs_margin-left-middle {\n\tdisplay: none;\n\talign-items: center;\n}\n\n.pagedjs_page .pagedjs_margin-left-bottom,\n.pagedjs_page .pagedjs_margin-right-bottom {\n\tdisplay: none;\n\talign-items: flex-end;\n}\n*/\n\n.pagedjs_page .pagedjs_margin-top-left,\n.pagedjs_page .pagedjs_margin-top-right-corner,\n.pagedjs_page .pagedjs_margin-bottom-left,\n.pagedjs_page .pagedjs_margin-bottom-right-corner { text-align: left; }\n\n.pagedjs_page .pagedjs_margin-top-left-corner,\n.pagedjs_page .pagedjs_margin-top-right,\n.pagedjs_page .pagedjs_margin-bottom-left-corner,\n.pagedjs_page .pagedjs_margin-bottom-right { text-align: right; }\n\n.pagedjs_page .pagedjs_margin-top-center,\n.pagedjs_page .pagedjs_margin-bottom-center,\n.pagedjs_page .pagedjs_margin-left-top,\n.pagedjs_page .pagedjs_margin-left-middle,\n.pagedjs_page .pagedjs_margin-left-bottom,\n.pagedjs_page .pagedjs_margin-right-top,\n.pagedjs_page .pagedjs_margin-right-middle,\n.pagedjs_page .pagedjs_margin-right-bottom { text-align: center; }\n\n.pagedjs_pages .pagedjs_margin .pagedjs_margin-content {\n\twidth: 100%;\n}\n\n.pagedjs_pages .pagedjs_margin-left .pagedjs_margin-content::after,\n.pagedjs_pages .pagedjs_margin-top .pagedjs_margin-content::after,\n.pagedjs_pages .pagedjs_margin-right .pagedjs_margin-content::after,\n.pagedjs_pages .pagedjs_margin-bottom .pagedjs_margin-content::after {\n\tdisplay: block;\n}\n\n.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-to] {\n\tmargin-bottom: unset;\n\tpadding-bottom: unset;\n}\n\n.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-from] {\n\ttext-indent: unset;\n\tmargin-top: unset;\n\tpadding-top: unset;\n\tinitial-letter: unset;\n}\n\n.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-from] > *::first-letter,\n.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-from]::first-letter {\n\tcolor: unset;\n\tfont-size: unset;\n\tfont-weight: unset;\n\tfont-family: unset;\n\tcolor: unset;\n\tline-height: unset;\n\tfloat: unset;\n\tpadding: unset;\n\tmargin: unset;\n}\n\n.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-to]:after,\n.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-to]::after {\n\tcontent: unset;\n}\n\n.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-from]:before,\n.pagedjs_pages > .pagedjs_page > .pagedjs_area > div [data-split-from]::before {\n\tcontent: unset;\n}\n\n.pagedjs_pages > .pagedjs_page > .pagedjs_area > div li[data-split-from]:first-of-type {\n\tlist-style: none;\n}\n\n/*\n[data-page]:not([data-split-from]),\n[data-break-before=\"page\"]:not([data-split-from]),\n[data-break-before=\"always\"]:not([data-split-from]),\n[data-break-before=\"left\"]:not([data-split-from]),\n[data-break-before=\"right\"]:not([data-split-from]),\n[data-break-before=\"recto\"]:not([data-split-from]),\n[data-break-before=\"verso\"]:not([data-split-from])\n{\n\tbreak-before: column;\n}\n\n[data-page]:not([data-split-to]),\n[data-break-after=\"page\"]:not([data-split-to]),\n[data-break-after=\"always\"]:not([data-split-to]),\n[data-break-after=\"left\"]:not([data-split-to]),\n[data-break-after=\"right\"]:not([data-split-to]),\n[data-break-after=\"recto\"]:not([data-split-to]),\n[data-break-after=\"verso\"]:not([data-split-to])\n{\n\tbreak-after: column;\n}\n*/\n\n.pagedjs_clear-after::after {\n\tcontent: none !important;\n}\n\nimg {\n\theight: auto;\n}\n\n@media print {\n\thtml {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\tbody {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t\tmin-width: 100%;\n\t\tmax-width: 100%;\n\t\tmin-height: 100%;\n\t\tmax-height: 100%;\n\t}\n\t.pagedjs_pages {\n\t\twidth: var(--width);\n\t\tdisplay: block !important;\n\t\ttransform: none !important;\n\t\theight: 100% !important;\n\t\tmin-height: 100%;\n\t\tmax-height: 100%;\n\t\toverflow: visible;\n\t}\n\t.pagedjs_page {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tmax-height: 100%;\n\t\tmin-height: 100%;\n\t\theight: 100% !important;\n\t\tpage-break-after: always;\n\t\tbreak-after: page;\n\t}\n}\n";
25603 exports.default = _default;
25604 });
25605
25606 unwrapExports(base);
25607
25608 var request_1 = createCommonjsModule(function (module, exports) {
25609
25610
25611
25612 Object.defineProperty(exports, "__esModule", {
25613 value: true
25614 });
25615 exports.default = request;
25616
25617 var _regenerator = interopRequireDefault(regenerator);
25618
25619 var _asyncToGenerator2 = interopRequireDefault(asyncToGenerator);
25620
25621 function request(_x) {
25622 return _request.apply(this, arguments);
25623 }
25624
25625 function _request() {
25626 _request = (0, _asyncToGenerator2.default)(
25627 /*#__PURE__*/
25628 _regenerator.default.mark(function _callee(url) {
25629 var options,
25630 _args = arguments;
25631 return _regenerator.default.wrap(function _callee$(_context) {
25632 while (1) {
25633 switch (_context.prev = _context.next) {
25634 case 0:
25635 options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
25636 return _context.abrupt("return", new Promise(function (resolve, reject) {
25637 var request = new XMLHttpRequest();
25638 request.open(options.method || 'get', url, true);
25639
25640 for (var i in options.headers) {
25641 request.setRequestHeader(i, options.headers[i]);
25642 }
25643
25644 request.withCredentials = options.credentials == 'include';
25645
25646 request.onload = function () {
25647 resolve(new Response(request.responseText, {
25648 status: request.status
25649 }));
25650 };
25651
25652 request.onerror = reject;
25653 request.send(options.body || null);
25654 }));
25655
25656 case 2:
25657 case "end":
25658 return _context.stop();
25659 }
25660 }
25661 }, _callee, this);
25662 }));
25663 return _request.apply(this, arguments);
25664 }
25665 });
25666
25667 unwrapExports(request_1);
25668
25669 var polisher = createCommonjsModule(function (module, exports) {
25670
25671
25672
25673 Object.defineProperty(exports, "__esModule", {
25674 value: true
25675 });
25676 exports.default = void 0;
25677
25678 var _regenerator = interopRequireDefault(regenerator);
25679
25680 var _typeof2 = interopRequireDefault(_typeof_1);
25681
25682 var _asyncToGenerator2 = interopRequireDefault(asyncToGenerator);
25683
25684 var _classCallCheck2 = interopRequireDefault(classCallCheck);
25685
25686 var _createClass2 = interopRequireDefault(createClass);
25687
25688 var _sheet = interopRequireDefault(sheet);
25689
25690 var _base = interopRequireDefault(base);
25691
25692 var _hook = interopRequireDefault(hook);
25693
25694 var _request = interopRequireDefault(request_1);
25695
25696 var Polisher =
25697 /*#__PURE__*/
25698 function () {
25699 function Polisher(setup) {
25700 (0, _classCallCheck2.default)(this, Polisher);
25701 this.sheets = [];
25702 this.inserted = [];
25703 this.hooks = {};
25704 this.hooks.onUrl = new _hook.default(this);
25705 this.hooks.onAtPage = new _hook.default(this);
25706 this.hooks.onAtMedia = new _hook.default(this);
25707 this.hooks.onRule = new _hook.default(this);
25708 this.hooks.onDeclaration = new _hook.default(this);
25709 this.hooks.onContent = new _hook.default(this);
25710 this.hooks.onImport = new _hook.default(this);
25711 this.hooks.beforeTreeParse = new _hook.default(this);
25712 this.hooks.beforeTreeWalk = new _hook.default(this);
25713 this.hooks.afterTreeWalk = new _hook.default(this);
25714
25715 if (setup !== false) {
25716 this.setup();
25717 }
25718 }
25719
25720 (0, _createClass2.default)(Polisher, [{
25721 key: "setup",
25722 value: function setup() {
25723 this.base = this.insert(_base.default);
25724 this.styleEl = document.createElement("style");
25725 document.head.appendChild(this.styleEl);
25726 this.styleSheet = this.styleEl.sheet;
25727 return this.styleSheet;
25728 }
25729 }, {
25730 key: "add",
25731 value: function () {
25732 var _add = (0, _asyncToGenerator2.default)(
25733 /*#__PURE__*/
25734 _regenerator.default.mark(function _callee2() {
25735 var _arguments = arguments,
25736 _this = this;
25737
25738 var fetched,
25739 urls,
25740 i,
25741 f,
25742 _loop,
25743 url,
25744 _args2 = arguments;
25745
25746 return _regenerator.default.wrap(function _callee2$(_context2) {
25747 while (1) {
25748 switch (_context2.prev = _context2.next) {
25749 case 0:
25750 fetched = [];
25751 urls = [];
25752
25753 for (i = 0; i < _args2.length; i++) {
25754 f = void 0;
25755
25756 if ((0, _typeof2.default)(_args2[i]) === "object") {
25757 _loop = function _loop(url) {
25758 var obj = _arguments[i];
25759 f = new Promise(function (resolve, reject) {
25760 urls.push(url);
25761 resolve(obj[url]);
25762 });
25763 };
25764
25765 for (url in _args2[i]) {
25766 _loop(url);
25767 }
25768 } else {
25769 urls.push(_args2[i]);
25770 f = (0, _request.default)(_args2[i]).then(function (response) {
25771 return response.text();
25772 });
25773 }
25774
25775 fetched.push(f);
25776 }
25777
25778 _context2.next = 5;
25779 return Promise.all(fetched).then(
25780 /*#__PURE__*/
25781 function () {
25782 var _ref = (0, _asyncToGenerator2.default)(
25783 /*#__PURE__*/
25784 _regenerator.default.mark(function _callee(originals) {
25785 var text, index;
25786 return _regenerator.default.wrap(function _callee$(_context) {
25787 while (1) {
25788 switch (_context.prev = _context.next) {
25789 case 0:
25790 text = "";
25791 index = 0;
25792
25793 case 2:
25794 if (!(index < originals.length)) {
25795 _context.next = 10;
25796 break;
25797 }
25798
25799 _context.next = 5;
25800 return _this.convertViaSheet(originals[index], urls[index]);
25801
25802 case 5:
25803 text = _context.sent;
25804
25805 _this.insert(text);
25806
25807 case 7:
25808 index++;
25809 _context.next = 2;
25810 break;
25811
25812 case 10:
25813 return _context.abrupt("return", text);
25814
25815 case 11:
25816 case "end":
25817 return _context.stop();
25818 }
25819 }
25820 }, _callee, this);
25821 }));
25822
25823 return function (_x) {
25824 return _ref.apply(this, arguments);
25825 };
25826 }());
25827
25828 case 5:
25829 return _context2.abrupt("return", _context2.sent);
25830
25831 case 6:
25832 case "end":
25833 return _context2.stop();
25834 }
25835 }
25836 }, _callee2, this);
25837 }));
25838
25839 return function add() {
25840 return _add.apply(this, arguments);
25841 };
25842 }()
25843 }, {
25844 key: "convertViaSheet",
25845 value: function () {
25846 var _convertViaSheet = (0, _asyncToGenerator2.default)(
25847 /*#__PURE__*/
25848 _regenerator.default.mark(function _callee3(cssStr, href) {
25849 var sheet$$1, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, url, str, text;
25850
25851 return _regenerator.default.wrap(function _callee3$(_context3) {
25852 while (1) {
25853 switch (_context3.prev = _context3.next) {
25854 case 0:
25855 sheet$$1 = new _sheet.default(href, this.hooks);
25856 _context3.next = 3;
25857 return sheet$$1.parse(cssStr);
25858
25859 case 3:
25860 // Insert the imported sheets first
25861 _iteratorNormalCompletion = true;
25862 _didIteratorError = false;
25863 _iteratorError = undefined;
25864 _context3.prev = 6;
25865 _iterator = sheet$$1.imported[Symbol.iterator]();
25866
25867 case 8:
25868 if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
25869 _context3.next = 20;
25870 break;
25871 }
25872
25873 url = _step.value;
25874 _context3.next = 12;
25875 return (0, _request.default)(url).then(function (response) {
25876 return response.text();
25877 });
25878
25879 case 12:
25880 str = _context3.sent;
25881 _context3.next = 15;
25882 return this.convertViaSheet(str, url);
25883
25884 case 15:
25885 text = _context3.sent;
25886 this.insert(text);
25887
25888 case 17:
25889 _iteratorNormalCompletion = true;
25890 _context3.next = 8;
25891 break;
25892
25893 case 20:
25894 _context3.next = 26;
25895 break;
25896
25897 case 22:
25898 _context3.prev = 22;
25899 _context3.t0 = _context3["catch"](6);
25900 _didIteratorError = true;
25901 _iteratorError = _context3.t0;
25902
25903 case 26:
25904 _context3.prev = 26;
25905 _context3.prev = 27;
25906
25907 if (!_iteratorNormalCompletion && _iterator.return != null) {
25908 _iterator.return();
25909 }
25910
25911 case 29:
25912 _context3.prev = 29;
25913
25914 if (!_didIteratorError) {
25915 _context3.next = 32;
25916 break;
25917 }
25918
25919 throw _iteratorError;
25920
25921 case 32:
25922 return _context3.finish(29);
25923
25924 case 33:
25925 return _context3.finish(26);
25926
25927 case 34:
25928 this.sheets.push(sheet$$1);
25929
25930 if (typeof sheet$$1.width !== "undefined") {
25931 this.width = sheet$$1.width;
25932 }
25933
25934 if (typeof sheet$$1.height !== "undefined") {
25935 this.height = sheet$$1.height;
25936 }
25937
25938 if (typeof sheet$$1.orientation !== "undefined") {
25939 this.orientation = sheet$$1.orientation;
25940 }
25941
25942 return _context3.abrupt("return", sheet$$1.toString());
25943
25944 case 39:
25945 case "end":
25946 return _context3.stop();
25947 }
25948 }
25949 }, _callee3, this, [[6, 22, 26, 34], [27,, 29, 33]]);
25950 }));
25951
25952 return function convertViaSheet(_x2, _x3) {
25953 return _convertViaSheet.apply(this, arguments);
25954 };
25955 }()
25956 }, {
25957 key: "insert",
25958 value: function insert(text) {
25959 var head = document.querySelector("head");
25960 var style = document.createElement("style");
25961 style.type = "text/css";
25962 style.setAttribute("data-pagedjs-inserted-styles", "true");
25963 style.appendChild(document.createTextNode(text));
25964 head.appendChild(style);
25965 this.inserted.push(style);
25966 return style;
25967 }
25968 }, {
25969 key: "destroy",
25970 value: function destroy() {
25971 this.styleEl.remove();
25972 this.inserted.forEach(function (s) {
25973 s.remove();
25974 });
25975 this.sheets = [];
25976 }
25977 }]);
25978 return Polisher;
25979 }();
25980
25981 var _default = Polisher;
25982 exports.default = _default;
25983 });
25984
25985 unwrapExports(polisher);
25986
25987 function _arrayWithoutHoles(arr) {
25988 if (Array.isArray(arr)) {
25989 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
25990 arr2[i] = arr[i];
25991 }
25992
25993 return arr2;
25994 }
25995 }
25996
25997 var arrayWithoutHoles = _arrayWithoutHoles;
25998
25999 function _iterableToArray(iter) {
26000 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
26001 }
26002
26003 var iterableToArray = _iterableToArray;
26004
26005 function _nonIterableSpread() {
26006 throw new TypeError("Invalid attempt to spread non-iterable instance");
26007 }
26008
26009 var nonIterableSpread = _nonIterableSpread;
26010
26011 function _toConsumableArray(arr) {
26012 return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
26013 }
26014
26015 var toConsumableArray = _toConsumableArray;
26016
26017 function _assertThisInitialized(self) {
26018 if (self === void 0) {
26019 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
26020 }
26021
26022 return self;
26023 }
26024
26025 var assertThisInitialized = _assertThisInitialized;
26026
26027 function _possibleConstructorReturn(self, call) {
26028 if (call && (_typeof_1(call) === "object" || typeof call === "function")) {
26029 return call;
26030 }
26031
26032 return assertThisInitialized(self);
26033 }
26034
26035 var possibleConstructorReturn = _possibleConstructorReturn;
26036
26037 var getPrototypeOf = createCommonjsModule(function (module) {
26038 function _getPrototypeOf(o) {
26039 module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
26040 return o.__proto__ || Object.getPrototypeOf(o);
26041 };
26042 return _getPrototypeOf(o);
26043 }
26044
26045 module.exports = _getPrototypeOf;
26046 });
26047
26048 var setPrototypeOf = createCommonjsModule(function (module) {
26049 function _setPrototypeOf(o, p) {
26050 module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
26051 o.__proto__ = p;
26052 return o;
26053 };
26054
26055 return _setPrototypeOf(o, p);
26056 }
26057
26058 module.exports = _setPrototypeOf;
26059 });
26060
26061 function _inherits(subClass, superClass) {
26062 if (typeof superClass !== "function" && superClass !== null) {
26063 throw new TypeError("Super expression must either be null or a function");
26064 }
26065
26066 subClass.prototype = Object.create(superClass && superClass.prototype, {
26067 constructor: {
26068 value: subClass,
26069 writable: true,
26070 configurable: true
26071 }
26072 });
26073 if (superClass) setPrototypeOf(subClass, superClass);
26074 }
26075
26076 var inherits = _inherits;
26077
26078 var handler = createCommonjsModule(function (module, exports) {
26079
26080
26081
26082 Object.defineProperty(exports, "__esModule", {
26083 value: true
26084 });
26085 exports.default = void 0;
26086
26087 var _classCallCheck2 = interopRequireDefault(classCallCheck);
26088
26089 var _eventEmitter = interopRequireDefault(eventEmitter);
26090
26091 var Handler = function Handler(chunker, polisher, caller) {
26092 (0, _classCallCheck2.default)(this, Handler);
26093 var hooks = Object.assign({}, chunker && chunker.hooks, polisher && polisher.hooks, caller && caller.hooks);
26094 this.chunker = chunker;
26095 this.polisher = polisher;
26096 this.caller = caller;
26097
26098 for (var name in hooks) {
26099 if (name in this) {
26100 var hook = hooks[name];
26101 hook.register(this[name].bind(this));
26102 }
26103 }
26104 };
26105
26106 (0, _eventEmitter.default)(Handler.prototype);
26107 var _default = Handler;
26108 exports.default = _default;
26109 });
26110
26111 unwrapExports(handler);
26112
26113 var sizes = createCommonjsModule(function (module, exports) {
26114
26115 Object.defineProperty(exports, "__esModule", {
26116 value: true
26117 });
26118 exports.default = void 0;
26119 // https://www.w3.org/TR/css3-page/#page-size-prop
26120 var _default = {
26121 "A0": {
26122 width: {
26123 value: 841,
26124 unit: "mm"
26125 },
26126 height: {
26127 value: 1189,
26128 unit: "mm"
26129 }
26130 },
26131 "A1": {
26132 width: {
26133 value: 594,
26134 unit: "mm"
26135 },
26136 height: {
26137 value: 841,
26138 unit: "mm"
26139 }
26140 },
26141 "A2": {
26142 width: {
26143 value: 420,
26144 unit: "mm"
26145 },
26146 height: {
26147 value: 594,
26148 unit: "mm"
26149 }
26150 },
26151 "A3": {
26152 width: {
26153 value: 297,
26154 unit: "mm"
26155 },
26156 height: {
26157 value: 420,
26158 unit: "mm"
26159 }
26160 },
26161 "A4": {
26162 width: {
26163 value: 210,
26164 unit: "mm"
26165 },
26166 height: {
26167 value: 297,
26168 unit: "mm"
26169 }
26170 },
26171 "A5": {
26172 width: {
26173 value: 148,
26174 unit: "mm"
26175 },
26176 height: {
26177 value: 210,
26178 unit: "mm"
26179 }
26180 },
26181 "A6": {
26182 width: {
26183 value: 105,
26184 unit: "mm"
26185 },
26186 height: {
26187 value: 148,
26188 unit: "mm"
26189 }
26190 },
26191 "A7": {
26192 width: {
26193 value: 74,
26194 unit: "mm"
26195 },
26196 height: {
26197 value: 105,
26198 unit: "mm"
26199 }
26200 },
26201 "A8": {
26202 width: {
26203 value: 52,
26204 unit: "mm"
26205 },
26206 height: {
26207 value: 74,
26208 unit: "mm"
26209 }
26210 },
26211 "A9": {
26212 width: {
26213 value: 37,
26214 unit: "mm"
26215 },
26216 height: {
26217 value: 52,
26218 unit: "mm"
26219 }
26220 },
26221 "A10": {
26222 width: {
26223 value: 26,
26224 unit: "mm"
26225 },
26226 height: {
26227 value: 37,
26228 unit: "mm"
26229 }
26230 },
26231 "B4": {
26232 width: {
26233 value: 250,
26234 unit: "mm"
26235 },
26236 height: {
26237 value: 353,
26238 unit: "mm"
26239 }
26240 },
26241 "B5": {
26242 width: {
26243 value: 250,
26244 unit: "mm"
26245 },
26246 height: {
26247 value: 250,
26248 unit: "mm"
26249 }
26250 },
26251 "letter": {
26252 width: {
26253 value: 8.5,
26254 unit: "in"
26255 },
26256 height: {
26257 value: 11,
26258 unit: "in"
26259 }
26260 },
26261 "legal": {
26262 width: {
26263 value: 8.5,
26264 unit: "mm"
26265 },
26266 height: {
26267 value: 14,
26268 unit: "mm"
26269 }
26270 },
26271 "ledger": {
26272 width: {
26273 value: 11,
26274 unit: "mm"
26275 },
26276 height: {
26277 value: 17,
26278 unit: "mm"
26279 }
26280 }
26281 };
26282 exports.default = _default;
26283 });
26284
26285 unwrapExports(sizes);
26286
26287 var atpage = createCommonjsModule(function (module, exports) {
26288
26289
26290
26291 Object.defineProperty(exports, "__esModule", {
26292 value: true
26293 });
26294 exports.default = void 0;
26295
26296 var _classCallCheck2 = interopRequireDefault(classCallCheck);
26297
26298 var _createClass2 = interopRequireDefault(createClass);
26299
26300 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
26301
26302 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
26303
26304 var _inherits2 = interopRequireDefault(inherits);
26305
26306 var _handler = interopRequireDefault(handler);
26307
26308 var _cssTree = interopRequireDefault(lib);
26309
26310 var _sizes = interopRequireDefault(sizes);
26311
26312
26313
26314 var AtPage =
26315 /*#__PURE__*/
26316 function (_Handler) {
26317 (0, _inherits2.default)(AtPage, _Handler);
26318
26319 function AtPage(chunker, polisher, caller) {
26320 var _this;
26321
26322 (0, _classCallCheck2.default)(this, AtPage);
26323 _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(AtPage).call(this, chunker, polisher, caller));
26324 _this.pages = {};
26325 _this.width = undefined;
26326 _this.height = undefined;
26327 _this.orientation = undefined;
26328 _this.marginalia = {};
26329 return _this;
26330 }
26331
26332 (0, _createClass2.default)(AtPage, [{
26333 key: "pageModel",
26334 value: function pageModel(selector) {
26335 return {
26336 selector: selector,
26337 name: undefined,
26338 psuedo: undefined,
26339 nth: undefined,
26340 marginalia: {},
26341 width: undefined,
26342 height: undefined,
26343 orientation: undefined,
26344 margin: {
26345 top: {},
26346 right: {},
26347 left: {},
26348 bottom: {}
26349 },
26350 block: {},
26351 marks: undefined
26352 };
26353 } // Find and Remove @page rules
26354
26355 }, {
26356 key: "onAtPage",
26357 value: function onAtPage(node, item, list) {
26358 var page, marginalia;
26359 var selector = "";
26360 var named, psuedo, nth;
26361 var needsMerge = false;
26362
26363 if (node.prelude) {
26364 named = this.getTypeSelector(node);
26365 psuedo = this.getPsuedoSelector(node);
26366 nth = this.getNthSelector(node);
26367 selector = _cssTree.default.generate(node.prelude);
26368 } else {
26369 selector = "*";
26370 }
26371
26372 if (selector in this.pages) {
26373 // this.pages[selector] = Object.assign(this.pages[selector], page);
26374 // console.log("after", selector, this.pages[selector]);
26375 // this.pages[selector].added = false;
26376 page = this.pages[selector];
26377 marginalia = this.replaceMarginalia(node);
26378 needsMerge = true;
26379 } else {
26380 page = this.pageModel(selector);
26381 marginalia = this.replaceMarginalia(node);
26382 this.pages[selector] = page;
26383 }
26384
26385 page.name = named;
26386 page.psuedo = psuedo;
26387 page.nth = nth;
26388
26389 if (needsMerge) {
26390 page.marginalia = Object.assign(page.marginalia, marginalia);
26391 } else {
26392 page.marginalia = marginalia;
26393 }
26394
26395 var declarations = this.replaceDeclartations(node);
26396
26397 if (declarations.size) {
26398 page.size = declarations.size;
26399 page.width = declarations.size.width;
26400 page.height = declarations.size.height;
26401 page.orientation = declarations.size.orientation;
26402 page.format = declarations.size.format;
26403 }
26404
26405 if (declarations.margin) {
26406 page.margin = declarations.margin;
26407 }
26408
26409 if (declarations.marks) {
26410 page.marks = declarations.marks;
26411 }
26412
26413 if (needsMerge) {
26414 page.block.children.appendList(node.block.children);
26415 } else {
26416 page.block = node.block;
26417 } // Remove the rule
26418
26419
26420 list.remove(item);
26421 }
26422 /* Handled in breaks */
26423
26424 /*
26425 afterParsed(parsed) {
26426 for (let b in this.named) {
26427 // Find elements
26428 let elements = parsed.querySelectorAll(b);
26429 // Add break data
26430 for (var i = 0; i < elements.length; i++) {
26431 elements[i].setAttribute("data-page", this.named[b]);
26432 }
26433 }
26434 }
26435 */
26436
26437 }, {
26438 key: "afterTreeWalk",
26439 value: function afterTreeWalk(ast, sheet) {
26440 this.addPageClasses(this.pages, ast, sheet);
26441
26442 if ("*" in this.pages) {
26443 var width = this.pages["*"].width;
26444 var height = this.pages["*"].height;
26445 var format = this.pages["*"].format;
26446 var orientation = this.pages["*"].orientation;
26447
26448 if (width && height && (this.width !== width || this.height !== height)) {
26449 this.width = width;
26450 this.height = height;
26451 this.format = format;
26452 this.orientation = orientation;
26453 this.addRootVars(ast, width, height, orientation);
26454 this.addRootPage(ast, this.pages["*"].size);
26455 this.emit("size", {
26456 width: width,
26457 height: height,
26458 orientation: orientation,
26459 format: format
26460 });
26461 }
26462 }
26463 }
26464 }, {
26465 key: "getTypeSelector",
26466 value: function getTypeSelector(ast) {
26467 // Find page name
26468 var name;
26469
26470 _cssTree.default.walk(ast, {
26471 visit: "TypeSelector",
26472 enter: function enter(node, item, list) {
26473 name = node.name;
26474 }
26475 });
26476
26477 return name;
26478 }
26479 }, {
26480 key: "getPsuedoSelector",
26481 value: function getPsuedoSelector(ast) {
26482 // Find if it has :left & :right & :black & :first
26483 var name;
26484
26485 _cssTree.default.walk(ast, {
26486 visit: "PseudoClassSelector",
26487 enter: function enter(node, item, list) {
26488 if (node.name !== "nth") {
26489 name = node.name;
26490 }
26491 }
26492 });
26493
26494 return name;
26495 }
26496 }, {
26497 key: "getNthSelector",
26498 value: function getNthSelector(ast) {
26499 // Find if it has :nth
26500 var nth;
26501
26502 _cssTree.default.walk(ast, {
26503 visit: "PseudoClassSelector",
26504 enter: function enter(node, item, list) {
26505 if (node.name === "nth" && node.children) {
26506 var raw = node.children.first();
26507 nth = raw.value;
26508 }
26509 }
26510 });
26511
26512 return nth;
26513 }
26514 }, {
26515 key: "replaceMarginalia",
26516 value: function replaceMarginalia(ast) {
26517 var parsed = {};
26518
26519 _cssTree.default.walk(ast.block, {
26520 visit: "Atrule",
26521 enter: function enter(node, item, list) {
26522 var name = node.name;
26523
26524 if (name === "top") {
26525 name = "top-center";
26526 }
26527
26528 if (name === "right") {
26529 name = "right-middle";
26530 }
26531
26532 if (name === "left") {
26533 name = "left-middle";
26534 }
26535
26536 if (name === "bottom") {
26537 name = "bottom-center";
26538 }
26539
26540 parsed[name] = node.block;
26541 list.remove(item);
26542 }
26543 });
26544
26545 return parsed;
26546 }
26547 }, {
26548 key: "replaceDeclartations",
26549 value: function replaceDeclartations(ast) {
26550 var _this2 = this;
26551
26552 var parsed = {};
26553
26554 _cssTree.default.walk(ast.block, {
26555 visit: "Declaration",
26556 enter: function enter(declaration, dItem, dList) {
26557 var prop = _cssTree.default.property(declaration.property).name;
26558
26559 var value = declaration.value;
26560
26561 if (prop === "marks") {
26562 parsed.marks = value.children.first().name;
26563 dList.remove(dItem);
26564 } else if (prop === "margin") {
26565 parsed.margin = _this2.getMargins(declaration);
26566 dList.remove(dItem);
26567 } else if (prop.indexOf("margin-") === 0) {
26568 var m = prop.substring("margin-".length);
26569
26570 if (!parsed.margin) {
26571 parsed.margin = {
26572 top: {},
26573 right: {},
26574 left: {},
26575 bottom: {}
26576 };
26577 }
26578
26579 parsed.margin[m] = declaration.value.children.first();
26580 dList.remove(dItem);
26581 } else if (prop === "size") {
26582 parsed.size = _this2.getSize(declaration);
26583 dList.remove(dItem);
26584 }
26585 }
26586 });
26587
26588 return parsed;
26589 }
26590 }, {
26591 key: "getSize",
26592 value: function getSize(declaration) {
26593 var width, height, orientation, format; // Get size: Xmm Ymm
26594
26595 _cssTree.default.walk(declaration, {
26596 visit: "Dimension",
26597 enter: function enter(node, item, list) {
26598 var value = node.value,
26599 unit = node.unit;
26600
26601 if (typeof width === "undefined") {
26602 width = {
26603 value: value,
26604 unit: unit
26605 };
26606 } else if (typeof height === "undefined") {
26607 height = {
26608 value: value,
26609 unit: unit
26610 };
26611 }
26612 }
26613 }); // Get size: "A4"
26614
26615
26616 _cssTree.default.walk(declaration, {
26617 visit: "String",
26618 enter: function enter(node, item, list) {
26619 var name = node.value.replace(/["|']/g, "");
26620 var s = _sizes.default[name];
26621
26622 if (s) {
26623 width = s.width;
26624 height = s.height;
26625 }
26626 }
26627 }); // Get Format or Landscape or Portrait
26628
26629
26630 _cssTree.default.walk(declaration, {
26631 visit: "Identifier",
26632 enter: function enter(node, item, list) {
26633 var name = node.name;
26634
26635 if (name === "landscape" || name === "portrait") {
26636 orientation = node.name;
26637 } else if (name !== "auto") {
26638 var s = _sizes.default[name];
26639
26640 if (s) {
26641 width = s.width;
26642 height = s.height;
26643 }
26644
26645 format = name;
26646 }
26647 }
26648 });
26649
26650 return {
26651 width: width,
26652 height: height,
26653 orientation: orientation,
26654 format: format
26655 };
26656 }
26657 }, {
26658 key: "getMargins",
26659 value: function getMargins(declaration) {
26660 var margins = [];
26661 var margin = {
26662 top: {},
26663 right: {},
26664 left: {},
26665 bottom: {}
26666 };
26667
26668 _cssTree.default.walk(declaration, {
26669 visit: "Dimension",
26670 enter: function enter(node, item, list) {
26671 margins.push(node);
26672 }
26673 });
26674
26675 if (margins.length === 1) {
26676 for (var m in margin) {
26677 margin[m] = margins[0];
26678 }
26679 } else if (margins.length === 2) {
26680 margin.top = margins[0];
26681 margin.right = margins[1];
26682 margin.bottom = margins[0];
26683 margin.left = margins[1];
26684 } else if (margins.length === 3) {
26685 margin.top = margins[0];
26686 margin.right = margins[1];
26687 margin.bottom = margins[2];
26688 margin.left = margins[1];
26689 } else if (margins.length === 4) {
26690 margin.top = margins[0];
26691 margin.right = margins[1];
26692 margin.bottom = margins[2];
26693 margin.left = margins[3];
26694 }
26695
26696 return margin;
26697 }
26698 }, {
26699 key: "addPageClasses",
26700 value: function addPageClasses(pages, ast, sheet) {
26701 // First add * page
26702 if ("*" in pages && !pages["*"].added) {
26703 var p = this.createPage(pages["*"], ast.children, sheet);
26704 sheet.insertRule(p);
26705 pages["*"].added = true;
26706 } // Add :left & :right
26707
26708
26709 if (":left" in pages && !pages[":left"].added) {
26710 var left = this.createPage(pages[":left"], ast.children, sheet);
26711 sheet.insertRule(left);
26712 pages[":left"].added = true;
26713 }
26714
26715 if (":right" in pages && !pages[":right"].added) {
26716 var right = this.createPage(pages[":right"], ast.children, sheet);
26717 sheet.insertRule(right);
26718 pages[":right"].added = true;
26719 } // Add :first & :blank
26720
26721
26722 if (":first" in pages && !pages[":first"].first) {
26723 var first = this.createPage(pages[":first"], ast.children, sheet);
26724 sheet.insertRule(first);
26725 pages[":first"].added = true;
26726 }
26727
26728 if (":blank" in pages && !pages[":blank"].added) {
26729 var blank = this.createPage(pages[":blank"], ast.children, sheet);
26730 sheet.insertRule(blank);
26731 pages[":blank"].added = true;
26732 } // Add nth pages
26733
26734
26735 for (var pg in pages) {
26736 if (pages[pg].nth && !pages[pg].added) {
26737 var nth = this.createPage(pages[pg], ast.children, sheet);
26738 sheet.insertRule(nth);
26739 pages[pg].added = true;
26740 }
26741 } // Add named pages
26742
26743
26744 for (var _pg in pages) {
26745 if (pages[_pg].name && !pages[_pg].added) {
26746 var named = this.createPage(pages[_pg], ast.children, sheet);
26747 sheet.insertRule(named);
26748 pages[_pg].added = true;
26749 }
26750 }
26751 }
26752 }, {
26753 key: "createPage",
26754 value: function createPage(page, ruleList, sheet) {
26755 var selectors = this.selectorsForPage(page);
26756 var children = page.block.children.copy();
26757 var block = {
26758 type: "Block",
26759 loc: 0,
26760 children: children
26761 };
26762 var rule = this.createRule(selectors, block);
26763 this.addMarginVars(page.margin, children, children.first());
26764
26765 if (page.width) {
26766 this.addDimensions(page.width, page.height, page.orientation, children, children.first());
26767 }
26768
26769 if (page.marginalia) {
26770 this.addMarginaliaStyles(page, ruleList, rule, sheet);
26771 this.addMarginaliaContent(page, ruleList, rule, sheet);
26772 }
26773
26774 return rule;
26775 }
26776 }, {
26777 key: "addMarginVars",
26778 value: function addMarginVars(margin, list, item) {
26779 // variables for margins
26780 for (var m in margin) {
26781 if (typeof margin[m].value !== "undefined") {
26782 var value = margin[m].value + (margin[m].unit || "");
26783 var mVar = list.createItem({
26784 type: "Declaration",
26785 property: "--margin-" + m,
26786 value: {
26787 type: "Raw",
26788 value: value
26789 }
26790 });
26791 list.append(mVar, item);
26792 }
26793 }
26794 }
26795 }, {
26796 key: "addDimensions",
26797 value: function addDimensions(width, height, orientation, list, item) {
26798 var outputWidth, outputHeight;
26799
26800 if (!orientation || orientation === "portrait") {
26801 outputWidth = width;
26802 outputHeight = height;
26803 } else {
26804 outputWidth = height;
26805 outputHeight = width;
26806 } // width variable
26807
26808
26809 var wVar = this.createVariable("--width", outputWidth.value + (outputWidth.unit || ""));
26810 list.appendData(wVar); // height variable
26811
26812 var hVar = this.createVariable("--height", outputHeight.value + (outputHeight.unit || ""));
26813 list.appendData(hVar); // width dimension
26814
26815 var w = this.createDimension("width", outputWidth.value, outputWidth.unit);
26816 list.appendData(w); // height dimension
26817
26818 var h = this.createDimension("height", outputHeight.value, outputHeight.unit);
26819 list.appendData(h);
26820 }
26821 }, {
26822 key: "addMarginaliaStyles",
26823 value: function addMarginaliaStyles(page, list, item, sheet) {
26824 var _this3 = this;
26825
26826 var _loop = function _loop(loc) {
26827 var block = _cssTree.default.clone(page.marginalia[loc]);
26828
26829 var hasContent = false;
26830
26831 if (block.children.isEmpty()) {
26832 return "continue";
26833 }
26834
26835 _cssTree.default.walk(block, {
26836 visit: "Declaration",
26837 enter: function enter(node, item, list) {
26838 if (node.property === "content") {
26839 if (node.value.children && node.value.children.first().name === "none") {
26840 hasContent = false;
26841 } else {
26842 hasContent = true;
26843 }
26844
26845 list.remove(item);
26846 }
26847
26848 if (node.property === "vertical-align") {
26849 _cssTree.default.walk(node, {
26850 visit: "Identifier",
26851 enter: function enter(identNode, identItem, identlist) {
26852 var name = identNode.name;
26853
26854 if (name === "top") {
26855 identNode.name = "flex-start";
26856 } else if (name === "middle") {
26857 identNode.name = "center";
26858 } else if (name === "bottom") {
26859 identNode.name = "flex-end";
26860 }
26861 }
26862 });
26863
26864 node.property = "align-items";
26865 }
26866
26867 if (node.property === "width" && (loc === "top-left" || loc === "top-center" || loc === "top-right" || loc === "bottom-left" || loc === "bottom-center" || loc === "bottom-right")) {
26868 var c = _cssTree.default.clone(node);
26869
26870 c.property = "max-width";
26871 list.appendData(c);
26872 }
26873
26874 if (node.property === "height" && (loc === "left-top" || loc === "left-middle" || loc === "left-bottom" || loc === "right-top" || loc === "right-middle" || loc === "right-bottom")) {
26875 var _c = _cssTree.default.clone(node);
26876
26877 _c.property = "max-height";
26878 list.appendData(_c);
26879 }
26880 }
26881 });
26882
26883 var marginSelectors = _this3.selectorsForPageMargin(page, loc);
26884
26885 var marginRule = _this3.createRule(marginSelectors, block);
26886
26887 list.appendData(marginRule);
26888
26889 var sel = _cssTree.default.generate({
26890 type: "Selector",
26891 children: marginSelectors
26892 });
26893
26894 _this3.marginalia[sel] = {
26895 page: page,
26896 selector: sel,
26897 block: page.marginalia[loc],
26898 hasContent: hasContent
26899 };
26900 };
26901
26902 for (var loc in page.marginalia) {
26903 var _ret = _loop(loc);
26904
26905 if (_ret === "continue") continue;
26906 }
26907 }
26908 }, {
26909 key: "addMarginaliaContent",
26910 value: function addMarginaliaContent(page, list, item, sheet) {
26911 var displayNone; // Just content
26912
26913 for (var loc in page.marginalia) {
26914 var content = _cssTree.default.clone(page.marginalia[loc]);
26915
26916 _cssTree.default.walk(content, {
26917 visit: "Declaration",
26918 enter: function enter(node, item, list) {
26919 if (node.property !== "content") {
26920 list.remove(item);
26921 }
26922
26923 if (node.value.children && node.value.children.first().name === "none") {
26924 displayNone = true;
26925 }
26926 }
26927 });
26928
26929 if (content.children.isEmpty()) {
26930 continue;
26931 }
26932
26933 var displaySelectors = this.selectorsForPageMargin(page, loc);
26934 var displayDeclaration = void 0;
26935 displaySelectors.insertData({
26936 type: "Combinator",
26937 name: ">"
26938 });
26939 displaySelectors.insertData({
26940 type: "ClassSelector",
26941 name: "pagedjs_margin-content"
26942 });
26943 displaySelectors.insertData({
26944 type: "Combinator",
26945 name: ">"
26946 });
26947 displaySelectors.insertData({
26948 type: "TypeSelector",
26949 name: "*"
26950 });
26951
26952 if (displayNone) {
26953 displayDeclaration = this.createDeclaration("display", "none");
26954 } else {
26955 displayDeclaration = this.createDeclaration("display", "block");
26956 }
26957
26958 var displayRule = this.createRule(displaySelectors, [displayDeclaration]);
26959 sheet.insertRule(displayRule); // insert content rule
26960
26961 var contentSelectors = this.selectorsForPageMargin(page, loc);
26962 contentSelectors.insertData({
26963 type: "Combinator",
26964 name: ">"
26965 });
26966 contentSelectors.insertData({
26967 type: "ClassSelector",
26968 name: "pagedjs_margin-content"
26969 });
26970 contentSelectors.insertData({
26971 type: "PseudoElementSelector",
26972 name: "after",
26973 children: null
26974 });
26975 var contentRule = this.createRule(contentSelectors, content);
26976 sheet.insertRule(contentRule);
26977 }
26978 }
26979 }, {
26980 key: "addRootVars",
26981 value: function addRootVars(ast, width, height, orientation) {
26982 var selectors = new _cssTree.default.List();
26983 selectors.insertData({
26984 type: "PseudoClassSelector",
26985 name: "root",
26986 children: null
26987 }); // orientation variable
26988
26989 var oVar = this.createVariable("--orientation", orientation || "");
26990 var widthString, heightString;
26991
26992 if (!orientation || orientation === "portrait") {
26993 widthString = width.value + (width.unit || "");
26994 heightString = height.value + (height.unit || "");
26995 } else {
26996 widthString = height.value + (height.unit || "");
26997 heightString = width.value + (width.unit || "");
26998 }
26999
27000 var wVar = this.createVariable("--width", widthString);
27001 var hVar = this.createVariable("--height", heightString);
27002 var rule = this.createRule(selectors, [wVar, hVar, oVar]);
27003 ast.children.appendData(rule);
27004 }
27005 /*
27006 @page {
27007 size: var(--width) var(--height);
27008 margin: 0;
27009 padding: 0;
27010 }
27011 */
27012
27013 }, {
27014 key: "addRootPage",
27015 value: function addRootPage(ast, size) {
27016 var width = size.width,
27017 height = size.height,
27018 orientation = size.orientation,
27019 format = size.format;
27020 var children = new _cssTree.default.List();
27021 var dimensions = new _cssTree.default.List();
27022
27023 if (format) {
27024 dimensions.appendData({
27025 type: "Identifier",
27026 name: format
27027 });
27028
27029 if (orientation) {
27030 dimensions.appendData({
27031 type: "WhiteSpace",
27032 value: " "
27033 });
27034 dimensions.appendData({
27035 type: "Identifier",
27036 name: orientation
27037 });
27038 }
27039 } else {
27040 dimensions.appendData({
27041 type: "Dimension",
27042 unit: width.unit,
27043 value: width.value
27044 });
27045 dimensions.appendData({
27046 type: "WhiteSpace",
27047 value: " "
27048 });
27049 dimensions.appendData({
27050 type: "Dimension",
27051 unit: height.unit,
27052 value: height.value
27053 });
27054 }
27055
27056 children.appendData({
27057 type: "Declaration",
27058 property: "size",
27059 loc: null,
27060 value: {
27061 type: "Value",
27062 children: dimensions
27063 }
27064 });
27065 children.appendData({
27066 type: "Declaration",
27067 property: "margin",
27068 loc: null,
27069 value: {
27070 type: "Value",
27071 children: [{
27072 type: "Dimension",
27073 unit: "px",
27074 value: 0
27075 }]
27076 }
27077 });
27078 children.appendData({
27079 type: "Declaration",
27080 property: "padding",
27081 loc: null,
27082 value: {
27083 type: "Value",
27084 children: [{
27085 type: "Dimension",
27086 unit: "px",
27087 value: 0
27088 }]
27089 }
27090 });
27091 var rule = ast.children.createItem({
27092 type: "Atrule",
27093 prelude: null,
27094 name: "page",
27095 block: {
27096 type: "Block",
27097 loc: null,
27098 children: children
27099 }
27100 });
27101 ast.children.append(rule);
27102 }
27103 }, {
27104 key: "getNth",
27105 value: function getNth(nth) {
27106 var n = nth.indexOf("n");
27107 var plus = nth.indexOf("+");
27108 var splitN = nth.split("n");
27109 var splitP = nth.split("+");
27110 var a = null;
27111 var b = null;
27112
27113 if (n > -1) {
27114 a = splitN[0];
27115
27116 if (plus > -1) {
27117 b = splitP[1];
27118 }
27119 } else {
27120 b = nth;
27121 }
27122
27123 return {
27124 type: "Nth",
27125 loc: null,
27126 selector: null,
27127 nth: {
27128 type: "AnPlusB",
27129 loc: null,
27130 a: a,
27131 b: b
27132 }
27133 };
27134 }
27135 }, {
27136 key: "addPageAttributes",
27137 value: function addPageAttributes(page, start, pages) {
27138 var named = start.dataset.page;
27139
27140 if (named) {
27141 page.name = named;
27142 page.element.classList.add("pagedjs_named_page");
27143 page.element.classList.add("pagedjs_" + named + "_page");
27144
27145 if (!start.dataset.splitFrom) {
27146 page.element.classList.add("pagedjs_" + named + "_first_page");
27147 }
27148 }
27149 }
27150 }, {
27151 key: "getStartElement",
27152 value: function getStartElement(content, breakToken) {
27153 var node = breakToken && breakToken.node;
27154
27155 if (!content && !breakToken) {
27156 return;
27157 } // No break
27158
27159
27160 if (!node) {
27161 return content.children[0];
27162 } // Top level element
27163
27164
27165 if (node.nodeType === 1 && node.parentNode.nodeType === 11) {
27166 return node;
27167 } // Named page
27168
27169
27170 if (node.nodeType === 1 && node.dataset.page) {
27171 return node;
27172 } // Get top level Named parent
27173
27174
27175 var fragment = (0, dom.rebuildAncestors)(node);
27176 var pages = fragment.querySelectorAll("[data-page]");
27177
27178 if (pages.length) {
27179 return pages[pages.length - 1];
27180 } else {
27181 return fragment.children[0];
27182 }
27183 }
27184 }, {
27185 key: "beforePageLayout",
27186 value: function beforePageLayout(page, contents, breakToken, chunker) {
27187 var start = this.getStartElement(contents, breakToken);
27188
27189 if (start) {
27190 this.addPageAttributes(page, start, chunker.pages);
27191 }
27192 }
27193 }, {
27194 key: "afterPageLayout",
27195 value: function afterPageLayout(fragment, page, breakToken, chunker) {
27196 for (var m in this.marginalia) {
27197 var margin = this.marginalia[m];
27198 var sels = m.split(" ");
27199 var content = void 0;
27200
27201 if (page.element.matches(sels[0]) && margin.hasContent) {
27202 content = page.element.querySelector(sels[1]);
27203 content.classList.add("hasContent");
27204 }
27205 } // check center
27206
27207
27208 ["top", "bottom"].forEach(function (loc) {
27209 var marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
27210 var center = page.element.querySelector(".pagedjs_margin-" + loc + "-center");
27211 var left = page.element.querySelector(".pagedjs_margin-" + loc + "-left");
27212 var right = page.element.querySelector(".pagedjs_margin-" + loc + "-right");
27213 var centerContent = center.classList.contains("hasContent");
27214 var leftContent = left.classList.contains("hasContent");
27215 var rightContent = right.classList.contains("hasContent");
27216 var centerWidth, leftWidth, rightWidth;
27217
27218 if (leftContent) {
27219 leftWidth = window.getComputedStyle(left)["max-width"];
27220 }
27221
27222 if (rightContent) {
27223 rightWidth = window.getComputedStyle(right)["max-width"];
27224 }
27225
27226 if (centerContent) {
27227 centerWidth = window.getComputedStyle(center)["max-width"];
27228
27229 if (centerWidth === "none" || centerWidth === "auto") {
27230 if (!leftContent && !rightContent) {
27231 marginGroup.style["grid-template-columns"] = "0 1fr 0";
27232 } else if (leftContent) {
27233 if (!rightContent) {
27234 if (leftWidth !== "none" && leftWidth !== "auto") {
27235 marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
27236 } else {
27237 marginGroup.style["grid-template-columns"] = "auto auto 1fr";
27238 left.style["white-space"] = "nowrap";
27239 center.style["white-space"] = "nowrap";
27240 var leftOuterWidth = left.offsetWidth;
27241 var centerOuterWidth = center.offsetWidth;
27242 var outerwidths = leftOuterWidth + centerOuterWidth;
27243 var newcenterWidth = centerOuterWidth * 100 / outerwidths;
27244 marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + newcenterWidth + "%) minmax(16.66%, 1fr)";
27245 left.style["white-space"] = "normal";
27246 center.style["white-space"] = "normal";
27247 }
27248 } else {
27249 if (leftWidth !== "none" && leftWidth !== "auto") {
27250 if (rightWidth !== "none" && rightWidth !== "auto") {
27251 marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
27252 } else {
27253 marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + leftWidth;
27254 }
27255 } else {
27256 if (rightWidth !== "none" && rightWidth !== "auto") {
27257 marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
27258 } else {
27259 marginGroup.style["grid-template-columns"] = "auto auto 1fr";
27260 left.style["white-space"] = "nowrap";
27261 center.style["white-space"] = "nowrap";
27262 right.style["white-space"] = "nowrap";
27263 var _leftOuterWidth = left.offsetWidth;
27264 var _centerOuterWidth = center.offsetWidth;
27265 var rightOuterWidth = right.offsetWidth;
27266
27267 var _outerwidths = _leftOuterWidth + _centerOuterWidth + rightOuterWidth;
27268
27269 var _newcenterWidth = _centerOuterWidth * 100 / _outerwidths;
27270
27271 if (_newcenterWidth > 40) {
27272 marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + _newcenterWidth + "%) minmax(16.66%, 1fr)";
27273 } else {
27274 marginGroup.style["grid-template-columns"] = "repeat(3, 1fr)";
27275 }
27276
27277 left.style["white-space"] = "normal";
27278 center.style["white-space"] = "normal";
27279 right.style["white-space"] = "normal";
27280 }
27281 }
27282 }
27283 } else {
27284 if (rightWidth !== "none" && rightWidth !== "auto") {
27285 marginGroup.style["grid-template-columns"] = rightWidth + " 1fr " + rightWidth;
27286 } else {
27287 marginGroup.style["grid-template-columns"] = "auto auto 1fr";
27288 right.style["white-space"] = "nowrap";
27289 center.style["white-space"] = "nowrap";
27290 var _rightOuterWidth = right.offsetWidth;
27291 var _centerOuterWidth2 = center.offsetWidth;
27292
27293 var _outerwidths2 = _rightOuterWidth + _centerOuterWidth2;
27294
27295 var _newcenterWidth2 = _centerOuterWidth2 * 100 / _outerwidths2;
27296
27297 marginGroup.style["grid-template-columns"] = "minmax(16.66%, 1fr) minmax(33%, " + _newcenterWidth2 + "%) minmax(16.66%, 1fr)";
27298 right.style["white-space"] = "normal";
27299 center.style["white-space"] = "normal";
27300 }
27301 }
27302 } else if (centerWidth !== "none" && centerWidth !== "auto") {
27303 if (leftContent && leftWidth !== "none" && leftWidth !== "auto") {
27304 marginGroup.style["grid-template-columns"] = leftWidth + " " + centerWidth + " 1fr";
27305 } else if (rightContent && rightWidth !== "none" && rightWidth !== "auto") {
27306 marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " " + rightWidth;
27307 } else {
27308 marginGroup.style["grid-template-columns"] = "1fr " + centerWidth + " 1fr";
27309 }
27310 }
27311 } else {
27312 if (leftContent) {
27313 if (!rightContent) {
27314 marginGroup.style["grid-template-columns"] = "1fr 0 0";
27315 } else {
27316 if (leftWidth !== "none" && leftWidth !== "auto") {
27317 if (rightWidth !== "none" && rightWidth !== "auto") {
27318 marginGroup.style["grid-template-columns"] = leftWidth + " 1fr " + rightWidth;
27319 } else {
27320 marginGroup.style["grid-template-columns"] = leftWidth + " 0 1fr";
27321 }
27322 } else {
27323 if (rightWidth !== "none" && rightWidth !== "auto") {
27324 marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
27325 } else {
27326 marginGroup.style["grid-template-columns"] = "auto 1fr auto";
27327 left.style["white-space"] = "nowrap";
27328 right.style["white-space"] = "nowrap";
27329 var _leftOuterWidth2 = left.offsetWidth;
27330 var _rightOuterWidth2 = right.offsetWidth;
27331
27332 var _outerwidths3 = _leftOuterWidth2 + _rightOuterWidth2;
27333
27334 var newLeftWidth = _leftOuterWidth2 * 100 / _outerwidths3;
27335 marginGroup.style["grid-template-columns"] = "minmax(16.66%, " + newLeftWidth + "%) 0 1fr";
27336 left.style["white-space"] = "normal";
27337 right.style["white-space"] = "normal";
27338 }
27339 }
27340 }
27341 } else {
27342 if (rightWidth !== "none" && rightWidth !== "auto") {
27343 marginGroup.style["grid-template-columns"] = "1fr 0 " + rightWidth;
27344 } else {
27345 marginGroup.style["grid-template-columns"] = "0 0 1fr";
27346 }
27347 }
27348 }
27349 }); // check middle
27350
27351 ["left", "right"].forEach(function (loc) {
27352 var middle = page.element.querySelector(".pagedjs_margin-" + loc + "-middle.hasContent");
27353 var marginGroup = page.element.querySelector(".pagedjs_margin-" + loc);
27354 var top = page.element.querySelector(".pagedjs_margin-" + loc + "-top");
27355 var bottom = page.element.querySelector(".pagedjs_margin-" + loc + "-bottom");
27356 var topContent = top.classList.contains("hasContent");
27357 var bottomContent = bottom.classList.contains("hasContent");
27358 var middleHeight, topHeight, bottomHeight;
27359
27360 if (topContent) {
27361 topHeight = window.getComputedStyle(top)["max-height"];
27362 }
27363
27364 if (bottomContent) {
27365 bottomHeight = window.getComputedStyle(bottom)["max-height"];
27366 }
27367
27368 if (middle) {
27369 middleHeight = window.getComputedStyle(middle)["max-height"];
27370
27371 if (middleHeight === "none" || middleHeight === "auto") {
27372 if (!topContent && !bottomContent) {
27373 marginGroup.style["grid-template-rows"] = "0 1fr 0";
27374 } else if (topContent) {
27375 if (!bottomContent) {
27376 if (topHeight !== "none" && topHeight !== "auto") {
27377 marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
27378 }
27379 } else {
27380 if (topHeight !== "none" && topHeight !== "auto") {
27381 if (bottomHeight !== "none" && bottomHeight !== "auto") {
27382 marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + " - " + bottomHeight + ") " + bottomHeight;
27383 } else {
27384 marginGroup.style["grid-template-rows"] = topHeight + " calc(100% - " + topHeight + "*2) " + topHeight;
27385 }
27386 } else {
27387 if (bottomHeight !== "none" && bottomHeight !== "auto") {
27388 marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
27389 }
27390 }
27391 }
27392 } else {
27393 if (bottomHeight !== "none" && bottomHeight !== "auto") {
27394 marginGroup.style["grid-template-rows"] = bottomHeight + " calc(100% - " + bottomHeight + "*2) " + bottomHeight;
27395 }
27396 }
27397 } else {
27398 if (topContent && topHeight !== "none" && topHeight !== "auto") {
27399 marginGroup.style["grid-template-rows"] = topHeight + " " + middleHeight + " calc(100% - (" + topHeight + " + " + middleHeight + "))";
27400 } else if (bottomContent && bottomHeight !== "none" && bottomHeight !== "auto") {
27401 marginGroup.style["grid-template-rows"] = "1fr " + middleHeight + " " + bottomHeight;
27402 } else {
27403 marginGroup.style["grid-template-rows"] = "calc((100% - " + middleHeight + ")/2) " + middleHeight + " calc((100% - " + middleHeight + ")/2)";
27404 }
27405 }
27406 } else {
27407 if (topContent) {
27408 if (!bottomContent) {
27409 marginGroup.style["grid-template-rows"] = "1fr 0 0";
27410 } else {
27411 if (topHeight !== "none" && topHeight !== "auto") {
27412 if (bottomHeight !== "none" && bottomHeight !== "auto") {
27413 marginGroup.style["grid-template-rows"] = topHeight + " 1fr " + bottomHeight;
27414 } else {
27415 marginGroup.style["grid-template-rows"] = topHeight + " 0 1fr";
27416 }
27417 } else {
27418 if (bottomHeight !== "none" && bottomHeight !== "auto") {
27419 marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
27420 } else {
27421 marginGroup.style["grid-template-rows"] = "1fr 0 1fr";
27422 }
27423 }
27424 }
27425 } else {
27426 if (bottomHeight !== "none" && bottomHeight !== "auto") {
27427 marginGroup.style["grid-template-rows"] = "1fr 0 " + bottomHeight;
27428 } else {
27429 marginGroup.style["grid-template-rows"] = "0 0 1fr";
27430 }
27431 }
27432 }
27433 });
27434 } // CSS Tree Helpers
27435
27436 }, {
27437 key: "selectorsForPage",
27438 value: function selectorsForPage(page) {
27439 var nthlist;
27440 var nth;
27441 var selectors = new _cssTree.default.List();
27442 selectors.insertData({
27443 type: "ClassSelector",
27444 name: "pagedjs_page"
27445 }); // Named page
27446
27447 if (page.name) {
27448 selectors.insertData({
27449 type: "ClassSelector",
27450 name: "pagedjs_named_page"
27451 });
27452 selectors.insertData({
27453 type: "ClassSelector",
27454 name: "pagedjs_" + page.name + "_page"
27455 });
27456 } // PsuedoSelector
27457
27458
27459 if (page.psuedo && !(page.name && page.psuedo === "first")) {
27460 selectors.insertData({
27461 type: "ClassSelector",
27462 name: "pagedjs_" + page.psuedo + "_page"
27463 });
27464 }
27465
27466 if (page.name && page.psuedo === "first") {
27467 selectors.insertData({
27468 type: "ClassSelector",
27469 name: "pagedjs_" + page.name + "_" + page.psuedo + "_page"
27470 });
27471 } // Nth
27472
27473
27474 if (page.nth) {
27475 nthlist = new _cssTree.default.List();
27476 nth = this.getNth(page.nth);
27477 nthlist.insertData(nth);
27478 selectors.insertData({
27479 type: "PseudoClassSelector",
27480 name: "nth-of-type",
27481 children: nthlist
27482 });
27483 }
27484
27485 return selectors;
27486 }
27487 }, {
27488 key: "selectorsForPageMargin",
27489 value: function selectorsForPageMargin(page, margin) {
27490 var selectors = this.selectorsForPage(page);
27491 selectors.insertData({
27492 type: "Combinator",
27493 name: " "
27494 });
27495 selectors.insertData({
27496 type: "ClassSelector",
27497 name: "pagedjs_margin-" + margin
27498 });
27499 return selectors;
27500 }
27501 }, {
27502 key: "createDeclaration",
27503 value: function createDeclaration(property, value, important) {
27504 var children = new _cssTree.default.List();
27505 children.insertData({
27506 type: "Identifier",
27507 loc: null,
27508 name: value
27509 });
27510 return {
27511 type: "Declaration",
27512 loc: null,
27513 important: important,
27514 property: property,
27515 value: {
27516 type: "Value",
27517 loc: null,
27518 children: children
27519 }
27520 };
27521 }
27522 }, {
27523 key: "createVariable",
27524 value: function createVariable(property, value) {
27525 return {
27526 type: "Declaration",
27527 loc: null,
27528 property: property,
27529 value: {
27530 type: "Raw",
27531 value: value
27532 }
27533 };
27534 }
27535 }, {
27536 key: "createDimension",
27537 value: function createDimension(property, value, unit, important) {
27538 var children = new _cssTree.default.List();
27539 children.insertData({
27540 type: "Dimension",
27541 loc: null,
27542 value: value,
27543 unit: unit
27544 });
27545 return {
27546 type: "Declaration",
27547 loc: null,
27548 important: important,
27549 property: property,
27550 value: {
27551 type: "Value",
27552 loc: null,
27553 children: children
27554 }
27555 };
27556 }
27557 }, {
27558 key: "createBlock",
27559 value: function createBlock(declarations) {
27560 var block = new _cssTree.default.List();
27561 declarations.forEach(function (declaration) {
27562 block.insertData(declaration);
27563 });
27564 return {
27565 type: "Block",
27566 loc: null,
27567 children: block
27568 };
27569 }
27570 }, {
27571 key: "createRule",
27572 value: function createRule(selectors, block) {
27573 var selectorList = new _cssTree.default.List();
27574 selectorList.insertData({
27575 type: "Selector",
27576 children: selectors
27577 });
27578
27579 if (Array.isArray(block)) {
27580 block = this.createBlock(block);
27581 }
27582
27583 return {
27584 type: "Rule",
27585 prelude: {
27586 type: "SelectorList",
27587 children: selectorList
27588 },
27589 block: block
27590 };
27591 }
27592 }]);
27593 return AtPage;
27594 }(_handler.default);
27595
27596 var _default = AtPage;
27597 exports.default = _default;
27598 });
27599
27600 unwrapExports(atpage);
27601
27602 var breaks = createCommonjsModule(function (module, exports) {
27603
27604
27605
27606 Object.defineProperty(exports, "__esModule", {
27607 value: true
27608 });
27609 exports.default = void 0;
27610
27611 var _classCallCheck2 = interopRequireDefault(classCallCheck);
27612
27613 var _createClass2 = interopRequireDefault(createClass);
27614
27615 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
27616
27617 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
27618
27619 var _inherits2 = interopRequireDefault(inherits);
27620
27621 var _handler = interopRequireDefault(handler);
27622
27623 var _cssTree = interopRequireDefault(lib);
27624
27625
27626
27627 var Breaks =
27628 /*#__PURE__*/
27629 function (_Handler) {
27630 (0, _inherits2.default)(Breaks, _Handler);
27631
27632 function Breaks(chunker, polisher, caller) {
27633 var _this;
27634
27635 (0, _classCallCheck2.default)(this, Breaks);
27636 _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Breaks).call(this, chunker, polisher, caller));
27637 _this.breaks = {};
27638 return _this;
27639 }
27640
27641 (0, _createClass2.default)(Breaks, [{
27642 key: "onDeclaration",
27643 value: function onDeclaration(declaration, dItem, dList, rule) {
27644 var _this2 = this;
27645
27646 var property = declaration.property;
27647
27648 if (property === "page") {
27649 var children = declaration.value.children.first();
27650 var value = children.name;
27651
27652 var selector = _cssTree.default.generate(rule.ruleNode.prelude);
27653
27654 var name = value;
27655 var breaker = {
27656 property: property,
27657 value: value,
27658 selector: selector,
27659 name: name
27660 };
27661 selector.split(",").forEach(function (s) {
27662 if (!_this2.breaks[s]) {
27663 _this2.breaks[s] = [breaker];
27664 } else {
27665 _this2.breaks[s].push(breaker);
27666 }
27667 });
27668 dList.remove(dItem);
27669 }
27670
27671 if (property === "break-before" || property === "break-after" || property === "page-break-before" || property === "page-break-after") {
27672 var child = declaration.value.children.first();
27673 var _value = child.name;
27674
27675 var _selector = _cssTree.default.generate(rule.ruleNode.prelude);
27676
27677 if (property === "page-break-before") {
27678 property = "break-before";
27679 } else if (property === "page-break-after") {
27680 property = "break-after";
27681 }
27682
27683 var _breaker = {
27684 property: property,
27685 value: _value,
27686 selector: _selector
27687 };
27688
27689 _selector.split(",").forEach(function (s) {
27690 if (!_this2.breaks[s]) {
27691 _this2.breaks[s] = [_breaker];
27692 } else {
27693 _this2.breaks[s].push(_breaker);
27694 }
27695 }); // Remove from CSS -- handle right / left in module
27696
27697
27698 dList.remove(dItem);
27699 }
27700 }
27701 }, {
27702 key: "afterParsed",
27703 value: function afterParsed(parsed) {
27704 this.processBreaks(parsed, this.breaks);
27705 }
27706 }, {
27707 key: "processBreaks",
27708 value: function processBreaks(parsed, breaks) {
27709 for (var b in breaks) {
27710 // Find elements
27711 var elements = parsed.querySelectorAll(b); // Add break data
27712
27713 for (var i = 0; i < elements.length; i++) {
27714 var _iteratorNormalCompletion = true;
27715 var _didIteratorError = false;
27716 var _iteratorError = undefined;
27717
27718 try {
27719 for (var _iterator = breaks[b][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
27720 var prop = _step.value;
27721
27722 if (prop.property === "break-after") {
27723 var nodeAfter = (0, dom.elementAfter)(elements[i], parsed);
27724 elements[i].setAttribute("data-break-after", prop.value);
27725
27726 if (nodeAfter) {
27727 nodeAfter.setAttribute("data-previous-break-after", prop.value);
27728 }
27729 } else if (prop.property === "page") {
27730 elements[i].setAttribute("data-page", prop.value);
27731
27732 var _nodeAfter = (0, dom.elementAfter)(elements[i], parsed);
27733
27734 if (_nodeAfter) {
27735 _nodeAfter.setAttribute("data-after-page", prop.value);
27736 }
27737 } else {
27738 elements[i].setAttribute("data-" + prop.property, prop.value);
27739 }
27740 }
27741 } catch (err) {
27742 _didIteratorError = true;
27743 _iteratorError = err;
27744 } finally {
27745 try {
27746 if (!_iteratorNormalCompletion && _iterator.return != null) {
27747 _iterator.return();
27748 }
27749 } finally {
27750 if (_didIteratorError) {
27751 throw _iteratorError;
27752 }
27753 }
27754 }
27755 }
27756 }
27757 }
27758 }, {
27759 key: "mergeBreaks",
27760 value: function mergeBreaks(pageBreaks, newBreaks) {
27761 for (var b in newBreaks) {
27762 if (b in pageBreaks) {
27763 pageBreaks[b] = pageBreaks[b].concat(newBreaks[b]);
27764 } else {
27765 pageBreaks[b] = newBreaks[b];
27766 }
27767 }
27768
27769 return pageBreaks;
27770 }
27771 }, {
27772 key: "addBreakAttributes",
27773 value: function addBreakAttributes(pageElement, page) {
27774 var before = pageElement.querySelector("[data-break-before]");
27775 var after = pageElement.querySelector("[data-break-after]");
27776 var previousBreakAfter = pageElement.querySelector("[data-previous-break-after]");
27777
27778 if (before) {
27779 if (before.dataset.splitFrom) {
27780 page.splitFrom = before.dataset.splitFrom;
27781 pageElement.setAttribute("data-split-from", before.dataset.splitFrom);
27782 } else if (before.dataset.breakBefore && before.dataset.breakBefore !== "avoid") {
27783 page.breakBefore = before.dataset.breakBefore;
27784 pageElement.setAttribute("data-break-before", before.dataset.breakBefore);
27785 }
27786 }
27787
27788 if (after && after.dataset) {
27789 if (after.dataset.splitTo) {
27790 page.splitTo = after.dataset.splitTo;
27791 pageElement.setAttribute("data-split-to", after.dataset.splitTo);
27792 } else if (after.dataset.breakAfter && after.dataset.breakAfter !== "avoid") {
27793 page.breakAfter = after.dataset.breakAfter;
27794 pageElement.setAttribute("data-break-after", after.dataset.breakAfter);
27795 }
27796 }
27797
27798 if (previousBreakAfter && previousBreakAfter.dataset) {
27799 if (previousBreakAfter.dataset.previousBreakAfter && previousBreakAfter.dataset.previousBreakAfter !== "avoid") {
27800 page.previousBreakAfter = previousBreakAfter.dataset.previousBreakAfter;
27801 }
27802 }
27803 }
27804 }, {
27805 key: "afterPageLayout",
27806 value: function afterPageLayout(pageElement, page) {
27807 this.addBreakAttributes(pageElement, page);
27808 }
27809 }]);
27810 return Breaks;
27811 }(_handler.default);
27812
27813 var _default = Breaks;
27814 exports.default = _default;
27815 });
27816
27817 unwrapExports(breaks);
27818
27819 var printMedia = createCommonjsModule(function (module, exports) {
27820
27821
27822
27823 Object.defineProperty(exports, "__esModule", {
27824 value: true
27825 });
27826 exports.default = void 0;
27827
27828 var _classCallCheck2 = interopRequireDefault(classCallCheck);
27829
27830 var _createClass2 = interopRequireDefault(createClass);
27831
27832 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
27833
27834 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
27835
27836 var _inherits2 = interopRequireDefault(inherits);
27837
27838 var _handler = interopRequireDefault(handler);
27839
27840 var _cssTree = interopRequireDefault(lib);
27841
27842 var PrintMedia =
27843 /*#__PURE__*/
27844 function (_Handler) {
27845 (0, _inherits2.default)(PrintMedia, _Handler);
27846
27847 function PrintMedia(chunker, polisher, caller) {
27848 (0, _classCallCheck2.default)(this, PrintMedia);
27849 return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(PrintMedia).call(this, chunker, polisher, caller));
27850 }
27851
27852 (0, _createClass2.default)(PrintMedia, [{
27853 key: "onAtMedia",
27854 value: function onAtMedia(node, item, list) {
27855 var media = this.getMediaName(node);
27856 var rules;
27857
27858 if (media === "print") {
27859 rules = node.block.children; // Remove rules from the @media block
27860
27861 node.block.children = new _cssTree.default.List(); // Append rules to the end of main rules list
27862
27863 list.appendList(rules);
27864 }
27865 }
27866 }, {
27867 key: "getMediaName",
27868 value: function getMediaName(node) {
27869 var media = "";
27870
27871 if (typeof node.prelude === "undefined" || node.prelude.type !== "AtrulePrelude") {
27872 return;
27873 }
27874
27875 _cssTree.default.walk(node.prelude, {
27876 visit: "Identifier",
27877 enter: function enter(identNode, iItem, iList) {
27878 media = identNode.name;
27879 }
27880 });
27881
27882 return media;
27883 }
27884 }]);
27885 return PrintMedia;
27886 }(_handler.default);
27887
27888 var _default = PrintMedia;
27889 exports.default = _default;
27890 });
27891
27892 unwrapExports(printMedia);
27893
27894 var splits = createCommonjsModule(function (module, exports) {
27895
27896
27897
27898 Object.defineProperty(exports, "__esModule", {
27899 value: true
27900 });
27901 exports.default = void 0;
27902
27903 var _classCallCheck2 = interopRequireDefault(classCallCheck);
27904
27905 var _createClass2 = interopRequireDefault(createClass);
27906
27907 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
27908
27909 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
27910
27911 var _inherits2 = interopRequireDefault(inherits);
27912
27913 var _handler = interopRequireDefault(handler);
27914
27915 var Splits =
27916 /*#__PURE__*/
27917 function (_Handler) {
27918 (0, _inherits2.default)(Splits, _Handler);
27919
27920 function Splits(chunker, polisher, caller) {
27921 (0, _classCallCheck2.default)(this, Splits);
27922 return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Splits).call(this, chunker, polisher, caller));
27923 }
27924
27925 (0, _createClass2.default)(Splits, [{
27926 key: "afterPageLayout",
27927 value: function afterPageLayout(pageElement, page, breakToken, chunker) {
27928 var _this = this;
27929
27930 var splits = Array.from(pageElement.querySelectorAll("[data-split-from]"));
27931 var pages = pageElement.parentNode;
27932 var index = Array.prototype.indexOf.call(pages.children, pageElement);
27933 var prevPage;
27934
27935 if (index === 0) {
27936 return;
27937 }
27938
27939 prevPage = pages.children[index - 1];
27940 splits.forEach(function (split) {
27941 var ref = split.dataset.ref;
27942 var from = prevPage.querySelector("[data-ref='" + ref + "']:not([data-split-to])");
27943
27944 if (from) {
27945 from.dataset.splitTo = ref;
27946
27947 if (!from.dataset.splitFrom) {
27948 from.dataset.splitOriginal = true;
27949 }
27950
27951 _this.handleAlignment(from);
27952 }
27953 });
27954 }
27955 }, {
27956 key: "handleAlignment",
27957 value: function handleAlignment(node) {
27958 var styles = window.getComputedStyle(node);
27959 var align = styles["text-align"];
27960 var alignLast = styles["text-align-last"];
27961
27962 if (align === "justify" && alignLast === "auto") {
27963 node.style["text-align-last"] = "justify";
27964 }
27965 }
27966 }]);
27967 return Splits;
27968 }(_handler.default);
27969
27970 var _default = Splits;
27971 exports.default = _default;
27972 });
27973
27974 unwrapExports(splits);
27975
27976 var counters = createCommonjsModule(function (module, exports) {
27977
27978
27979
27980 Object.defineProperty(exports, "__esModule", {
27981 value: true
27982 });
27983 exports.default = void 0;
27984
27985 var _classCallCheck2 = interopRequireDefault(classCallCheck);
27986
27987 var _createClass2 = interopRequireDefault(createClass);
27988
27989 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
27990
27991 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
27992
27993 var _inherits2 = interopRequireDefault(inherits);
27994
27995 var _handler = interopRequireDefault(handler);
27996
27997 var _cssTree = interopRequireDefault(lib);
27998
27999 var Counters =
28000 /*#__PURE__*/
28001 function (_Handler) {
28002 (0, _inherits2.default)(Counters, _Handler);
28003
28004 function Counters(chunker, polisher, caller) {
28005 var _this;
28006
28007 (0, _classCallCheck2.default)(this, Counters);
28008 _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Counters).call(this, chunker, polisher, caller));
28009 _this.styleSheet = polisher.styleSheet;
28010 _this.counters = {};
28011 return _this;
28012 }
28013
28014 (0, _createClass2.default)(Counters, [{
28015 key: "onDeclaration",
28016 value: function onDeclaration(declaration, dItem, dList, rule) {
28017 var property = declaration.property;
28018
28019 if (property === "counter-increment") {
28020 var inc = this.handleIncrement(declaration, rule);
28021
28022 if (inc) {
28023 dList.remove(dItem);
28024 }
28025 } else if (property === "counter-reset") {
28026 var reset = this.handleReset(declaration, rule);
28027
28028 if (reset) {
28029 dList.remove(dItem);
28030 }
28031 }
28032 }
28033 }, {
28034 key: "onContent",
28035 value: function onContent(funcNode, fItem, fList, declaration, rule) {
28036 if (funcNode.name === "counter") ;
28037 }
28038 }, {
28039 key: "afterParsed",
28040 value: function afterParsed(parsed) {
28041 this.processCounters(parsed, this.counters);
28042 }
28043 }, {
28044 key: "addCounter",
28045 value: function addCounter(name) {
28046 if (name in this.counters) {
28047 return this.counters[name];
28048 }
28049
28050 this.counters[name] = {
28051 name: name,
28052 increments: {},
28053 resets: {}
28054 };
28055 return this.counters[name];
28056 }
28057 }, {
28058 key: "handleIncrement",
28059 value: function handleIncrement(declaration, rule) {
28060 var identifier = declaration.value.children.first();
28061 var number = declaration.value.children.getSize() > 1 && declaration.value.children.last().value;
28062 var name = identifier && identifier.name;
28063
28064 if (name === "page" || name.indexOf("target-counter-") === 0) {
28065 return;
28066 }
28067
28068 var selector = _cssTree.default.generate(rule.ruleNode.prelude);
28069
28070 var counter;
28071
28072 if (!(name in this.counters)) {
28073 counter = this.addCounter(name);
28074 } else {
28075 counter = this.counters[name];
28076 }
28077
28078 return counter.increments[selector] = {
28079 selector: selector,
28080 number: number || 1
28081 };
28082 }
28083 }, {
28084 key: "handleReset",
28085 value: function handleReset(declaration, rule) {
28086 var identifier = declaration.value.children.first();
28087 var number = declaration.value.children.getSize() > 1 && declaration.value.children.last().value;
28088 var name = identifier && identifier.name;
28089
28090 var selector = _cssTree.default.generate(rule.ruleNode.prelude);
28091
28092 var counter;
28093
28094 if (!(name in this.counters)) {
28095 counter = this.addCounter(name);
28096 } else {
28097 counter = this.counters[name];
28098 }
28099
28100 return counter.resets[selector] = {
28101 selector: selector,
28102 number: number || 0
28103 };
28104 }
28105 }, {
28106 key: "processCounters",
28107 value: function processCounters(parsed, counters) {
28108 var counter;
28109
28110 for (var c in counters) {
28111 counter = this.counters[c];
28112 this.processCounterIncrements(parsed, counter);
28113 this.processCounterResets(parsed, counter);
28114 this.addCounterValues(parsed, counter);
28115 }
28116 }
28117 }, {
28118 key: "processCounterIncrements",
28119 value: function processCounterIncrements(parsed, counter) {
28120 var increment;
28121
28122 for (var inc in counter.increments) {
28123 increment = counter.increments[inc]; // Find elements for increments
28124
28125 var incrementElements = parsed.querySelectorAll(increment.selector); // Add counter data
28126
28127 for (var i = 0; i < incrementElements.length; i++) {
28128 incrementElements[i].setAttribute("data-counter-" + counter.name + "-increment", increment.number);
28129 }
28130 }
28131 }
28132 }, {
28133 key: "processCounterResets",
28134 value: function processCounterResets(parsed, counter) {
28135 var reset;
28136
28137 for (var r in counter.resets) {
28138 reset = counter.resets[r]; // Find elements for resets
28139
28140 var resetElements = parsed.querySelectorAll(reset.selector); // Add counter data
28141
28142 for (var i = 0; i < resetElements.length; i++) {
28143 resetElements[i].setAttribute("data-counter-" + counter.name + "-reset", reset.number);
28144 }
28145 }
28146 }
28147 }, {
28148 key: "addCounterValues",
28149 value: function addCounterValues(parsed, counter) {
28150 var counterName = counter.name;
28151 var elements = parsed.querySelectorAll("[data-counter-" + counterName + "-reset], [data-counter-" + counterName + "-increment]");
28152 var count = 0;
28153 var element;
28154 var increment, reset;
28155
28156 for (var i = 0; i < elements.length; i++) {
28157 element = elements[i];
28158
28159 if (element.hasAttribute("data-counter-" + counterName + "-reset")) {
28160 reset = element.getAttribute("data-counter-" + counterName + "-reset");
28161 count = parseInt(reset);
28162 }
28163
28164 if (element.hasAttribute("data-counter-" + counterName + "-increment")) {
28165 increment = element.getAttribute("data-counter-" + counterName + "-increment");
28166 this.styleSheet.insertRule("[data-ref=\"".concat(element.dataset.ref, "\"] { counter-reset: ").concat(counterName, " ").concat(count, " }"), this.styleSheet.cssRules.length);
28167 this.styleSheet.insertRule("[data-ref=\"".concat(element.dataset.ref, "\"] { counter-increment: ").concat(counterName, " ").concat(increment, "}"), this.styleSheet.cssRules.length);
28168 count += parseInt(increment);
28169 element.setAttribute("data-counter-" + counterName + "-value", count);
28170 }
28171 }
28172 }
28173 }, {
28174 key: "afterPageLayout",
28175 value: function afterPageLayout(pageElement, page) {
28176 var _this2 = this;
28177
28178 var pgreset = pageElement.querySelectorAll("[data-counter-page-reset]");
28179 pgreset.forEach(function (reset) {
28180 var value = reset.datasetCounterPageReset;
28181
28182 _this2.styleSheet.insertRule("[data-page-number=\"".concat(pageElement.dataset.pageNumber, "\"] { counter-reset: page ").concat(value, " }"), _this2.styleSheet.cssRules.length);
28183 });
28184 }
28185 }]);
28186 return Counters;
28187 }(_handler.default);
28188
28189 var _default = Counters;
28190 exports.default = _default;
28191 });
28192
28193 unwrapExports(counters);
28194
28195 var lists = createCommonjsModule(function (module, exports) {
28196
28197
28198
28199 Object.defineProperty(exports, "__esModule", {
28200 value: true
28201 });
28202 exports.default = void 0;
28203
28204 var _classCallCheck2 = interopRequireDefault(classCallCheck);
28205
28206 var _createClass2 = interopRequireDefault(createClass);
28207
28208 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
28209
28210 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
28211
28212 var _inherits2 = interopRequireDefault(inherits);
28213
28214 var _handler = interopRequireDefault(handler);
28215
28216 var Lists =
28217 /*#__PURE__*/
28218 function (_Handler) {
28219 (0, _inherits2.default)(Lists, _Handler);
28220
28221 function Lists(chunker, polisher, caller) {
28222 (0, _classCallCheck2.default)(this, Lists);
28223 return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Lists).call(this, chunker, polisher, caller));
28224 }
28225
28226 (0, _createClass2.default)(Lists, [{
28227 key: "afterParsed",
28228 value: function afterParsed(content) {
28229 var orderedLists = content.querySelectorAll("ol");
28230 var _iteratorNormalCompletion = true;
28231 var _didIteratorError = false;
28232 var _iteratorError = undefined;
28233
28234 try {
28235 for (var _iterator = orderedLists[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
28236 var list = _step.value;
28237 this.addDataNumbers(list);
28238 }
28239 } catch (err) {
28240 _didIteratorError = true;
28241 _iteratorError = err;
28242 } finally {
28243 try {
28244 if (!_iteratorNormalCompletion && _iterator.return != null) {
28245 _iterator.return();
28246 }
28247 } finally {
28248 if (_didIteratorError) {
28249 throw _iteratorError;
28250 }
28251 }
28252 }
28253 }
28254 }, {
28255 key: "afterPageLayout",
28256 value: function afterPageLayout(pageElement, page, breakToken, chunker) {
28257 var orderedLists = pageElement.getElementsByTagName("ol");
28258 var _iteratorNormalCompletion2 = true;
28259 var _didIteratorError2 = false;
28260 var _iteratorError2 = undefined;
28261
28262 try {
28263 for (var _iterator2 = orderedLists[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
28264 var list = _step2.value;
28265 list.start = list.firstElementChild.dataset.itemNum;
28266 }
28267 } catch (err) {
28268 _didIteratorError2 = true;
28269 _iteratorError2 = err;
28270 } finally {
28271 try {
28272 if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
28273 _iterator2.return();
28274 }
28275 } finally {
28276 if (_didIteratorError2) {
28277 throw _iteratorError2;
28278 }
28279 }
28280 }
28281 }
28282 }, {
28283 key: "addDataNumbers",
28284 value: function addDataNumbers(list) {
28285 var items = list.children;
28286
28287 for (var i = 0; i < items.length; i++) {
28288 items[i].setAttribute("data-item-num", i + 1);
28289 }
28290 }
28291 }]);
28292 return Lists;
28293 }(_handler.default);
28294
28295 var _default = Lists;
28296 exports.default = _default;
28297 });
28298
28299 unwrapExports(lists);
28300
28301 var pagedMedia = createCommonjsModule(function (module, exports) {
28302
28303
28304
28305 Object.defineProperty(exports, "__esModule", {
28306 value: true
28307 });
28308 exports.default = void 0;
28309
28310 var _atpage = interopRequireDefault(atpage);
28311
28312 var _breaks = interopRequireDefault(breaks);
28313
28314 var _printMedia = interopRequireDefault(printMedia);
28315
28316 var _splits = interopRequireDefault(splits);
28317
28318 var _counters = interopRequireDefault(counters);
28319
28320 var _lists = interopRequireDefault(lists);
28321
28322 var _default = [_atpage.default, _breaks.default, _printMedia.default, _splits.default, _counters.default, _lists.default];
28323 exports.default = _default;
28324 });
28325
28326 unwrapExports(pagedMedia);
28327
28328 var runningHeaders = createCommonjsModule(function (module, exports) {
28329
28330
28331
28332 Object.defineProperty(exports, "__esModule", {
28333 value: true
28334 });
28335 exports.default = void 0;
28336
28337 var _classCallCheck2 = interopRequireDefault(classCallCheck);
28338
28339 var _createClass2 = interopRequireDefault(createClass);
28340
28341 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
28342
28343 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
28344
28345 var _inherits2 = interopRequireDefault(inherits);
28346
28347 var _handler = interopRequireDefault(handler);
28348
28349 var _cssTree = interopRequireDefault(lib);
28350
28351 var RunningHeaders =
28352 /*#__PURE__*/
28353 function (_Handler) {
28354 (0, _inherits2.default)(RunningHeaders, _Handler);
28355
28356 function RunningHeaders(chunker, polisher, caller) {
28357 var _this;
28358
28359 (0, _classCallCheck2.default)(this, RunningHeaders);
28360 _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(RunningHeaders).call(this, chunker, polisher, caller));
28361 _this.runningSelectors = {};
28362 _this.elements = {};
28363 return _this;
28364 }
28365
28366 (0, _createClass2.default)(RunningHeaders, [{
28367 key: "onDeclaration",
28368 value: function onDeclaration(declaration, dItem, dList, rule) {
28369 var _this2 = this;
28370
28371 if (declaration.property === "position") {
28372 var selector = _cssTree.default.generate(rule.ruleNode.prelude);
28373
28374 var identifier = declaration.value.children.first().name;
28375
28376 if (identifier === "running") {
28377 var value;
28378
28379 _cssTree.default.walk(declaration, {
28380 visit: "Function",
28381 enter: function enter(node, item, list) {
28382 value = node.children.first().name;
28383 }
28384 });
28385
28386 this.runningSelectors[value] = {
28387 identifier: identifier,
28388 value: value,
28389 selector: selector
28390 };
28391 }
28392 }
28393
28394 if (declaration.property === "content") {
28395 _cssTree.default.walk(declaration, {
28396 visit: "Function",
28397 enter: function enter(funcNode, fItem, fList) {
28398 if (funcNode.name.indexOf("element") > -1) {
28399 var _selector = _cssTree.default.generate(rule.ruleNode.prelude);
28400
28401 var func = funcNode.name;
28402 var _value = funcNode.children.first().name;
28403 var args = [_value]; // we only handle first for now
28404
28405 var style = "first";
28406
28407 _selector.split(",").forEach(function (s) {
28408 // remove before / after
28409 s = s.replace(/::after|::before/, "");
28410 _this2.elements[s] = {
28411 func: func,
28412 args: args,
28413 value: _value,
28414 style: style,
28415 selector: s,
28416 fullSelector: _selector
28417 };
28418 });
28419 }
28420 }
28421 });
28422 }
28423 }
28424 }, {
28425 key: "afterParsed",
28426 value: function afterParsed(fragment) {
28427 var _arr = Object.keys(this.runningSelectors);
28428
28429 for (var _i = 0; _i < _arr.length; _i++) {
28430 var name = _arr[_i];
28431 var set = this.runningSelectors[name];
28432 var selected = Array.from(fragment.querySelectorAll(set.selector));
28433
28434 if (set.identifier === "running") {
28435 for (var _i2 = 0; _i2 < selected.length; _i2++) {
28436 var header = selected[_i2];
28437 header.style.display = "none";
28438 }
28439 }
28440 }
28441 }
28442 }, {
28443 key: "afterPageLayout",
28444 value: function afterPageLayout(fragment) {
28445 var _arr2 = Object.keys(this.runningSelectors);
28446
28447 for (var _i3 = 0; _i3 < _arr2.length; _i3++) {
28448 var name = _arr2[_i3];
28449 var set = this.runningSelectors[name];
28450 var selected = fragment.querySelector(set.selector);
28451
28452 if (selected) {
28453 // let cssVar;
28454 if (set.identifier === "running") {
28455 // cssVar = selected.textContent.replace(/\\([\s\S])|(["|'])/g,"\\$1$2");
28456 // this.styleSheet.insertRule(`:root { --string-${name}: "${cssVar}"; }`, this.styleSheet.cssRules.length);
28457 // fragment.style.setProperty(`--string-${name}`, `"${cssVar}"`);
28458 set.first = selected;
28459 } else {
28460 console.warn(set.value + "needs css replacement");
28461 }
28462 }
28463 } // move elements
28464
28465
28466 if (!this.orderedSelectors) {
28467 this.orderedSelectors = this.orderSelectors(this.elements);
28468 }
28469
28470 var _iteratorNormalCompletion = true;
28471 var _didIteratorError = false;
28472 var _iteratorError = undefined;
28473
28474 try {
28475 for (var _iterator = this.orderedSelectors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
28476 var selector = _step.value;
28477
28478 if (selector) {
28479 var el = this.elements[selector];
28480
28481 var _selected = fragment.querySelector(selector);
28482
28483 if (_selected) {
28484 var running = this.runningSelectors[el.args[0]];
28485
28486 if (running && running.first) {
28487 _selected.innerHTML = ""; // Clear node
28488 // selected.classList.add("pagedjs_clear-after"); // Clear ::after
28489
28490 var clone = running.first.cloneNode(true);
28491 clone.style.display = null;
28492
28493 _selected.appendChild(clone);
28494 }
28495 }
28496 }
28497 }
28498 } catch (err) {
28499 _didIteratorError = true;
28500 _iteratorError = err;
28501 } finally {
28502 try {
28503 if (!_iteratorNormalCompletion && _iterator.return != null) {
28504 _iterator.return();
28505 }
28506 } finally {
28507 if (_didIteratorError) {
28508 throw _iteratorError;
28509 }
28510 }
28511 }
28512 }
28513 /**
28514 * Assign a weight to @page selector classes
28515 * 1) page
28516 * 2) left & right
28517 * 3) blank
28518 * 4) first & nth
28519 * 5) named page
28520 * 6) named left & right
28521 * 7) named first & nth
28522 * @param {string} [s] selector string
28523 * @return {int} weight
28524 */
28525
28526 }, {
28527 key: "pageWeight",
28528 value: function pageWeight(s) {
28529 var weight = 1;
28530 var selector = s.split(" ");
28531 var parts = selector.length && selector[0].split(".");
28532 parts.shift(); // remove empty first part
28533
28534 switch (parts.length) {
28535 case 4:
28536 if (parts[3] === "pagedjs_first_page") {
28537 weight = 7;
28538 } else if (parts[3] === "pagedjs_left_page" || parts[3] === "pagedjs_right_page") {
28539 weight = 6;
28540 }
28541
28542 break;
28543
28544 case 3:
28545 if (parts[1] === "pagedjs_named_page") {
28546 if (parts[2].indexOf(":nth-of-type") > -1) {
28547 weight = 7;
28548 } else {
28549 weight = 5;
28550 }
28551 }
28552
28553 break;
28554
28555 case 2:
28556 if (parts[1] === "pagedjs_first_page") {
28557 weight = 4;
28558 } else if (parts[1] === "pagedjs_blank_page") {
28559 weight = 3;
28560 } else if (parts[1] === "pagedjs_left_page" || parts[1] === "pagedjs_right_page") {
28561 weight = 2;
28562 }
28563
28564 break;
28565
28566 default:
28567 if (parts[0].indexOf(":nth-of-type") > -1) {
28568 weight = 4;
28569 } else {
28570 weight = 1;
28571 }
28572
28573 }
28574
28575 return weight;
28576 }
28577 /**
28578 * Orders the selectors based on weight
28579 *
28580 * Does not try to deduplicate base on specifity of the selector
28581 * Previous matched selector will just be overwritten
28582 * @param {obj} [obj] selectors object
28583 * @return {Array} orderedSelectors
28584 */
28585
28586 }, {
28587 key: "orderSelectors",
28588 value: function orderSelectors(obj) {
28589 var selectors = Object.keys(obj);
28590 var weighted = {
28591 1: [],
28592 2: [],
28593 3: [],
28594 4: [],
28595 5: [],
28596 6: [],
28597 7: []
28598 };
28599 var orderedSelectors = [];
28600
28601 for (var _i4 = 0; _i4 < selectors.length; _i4++) {
28602 var s = selectors[_i4];
28603 var w = this.pageWeight(s);
28604 weighted[w].unshift(s);
28605 }
28606
28607 for (var i = 1; i <= 7; i++) {
28608 orderedSelectors = orderedSelectors.concat(weighted[i]);
28609 }
28610
28611 return orderedSelectors;
28612 }
28613 }, {
28614 key: "beforeTreeParse",
28615 value: function beforeTreeParse(text, sheet) {
28616 // element(x) is parsed as image element selector, so update element to element-ident
28617 sheet.text = text.replace(/element[\s]*\(([^|^#)]*)\)/g, "element-ident($1)");
28618 }
28619 }]);
28620 return RunningHeaders;
28621 }(_handler.default);
28622
28623 var _default = RunningHeaders;
28624 exports.default = _default;
28625 });
28626
28627 unwrapExports(runningHeaders);
28628
28629 var stringSets = createCommonjsModule(function (module, exports) {
28630
28631
28632
28633 Object.defineProperty(exports, "__esModule", {
28634 value: true
28635 });
28636 exports.default = void 0;
28637
28638 var _classCallCheck2 = interopRequireDefault(classCallCheck);
28639
28640 var _createClass2 = interopRequireDefault(createClass);
28641
28642 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
28643
28644 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
28645
28646 var _inherits2 = interopRequireDefault(inherits);
28647
28648 var _handler = interopRequireDefault(handler);
28649
28650 var _cssTree = interopRequireDefault(lib);
28651
28652 var StringSets =
28653 /*#__PURE__*/
28654 function (_Handler) {
28655 (0, _inherits2.default)(StringSets, _Handler);
28656
28657 function StringSets(chunker, polisher, caller) {
28658 var _this;
28659
28660 (0, _classCallCheck2.default)(this, StringSets);
28661 _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(StringSets).call(this, chunker, polisher, caller));
28662 _this.stringSetSelectors = {};
28663 return _this;
28664 }
28665
28666 (0, _createClass2.default)(StringSets, [{
28667 key: "onDeclaration",
28668 value: function onDeclaration(declaration, dItem, dList, rule) {
28669 if (declaration.property === "string-set") {
28670 var selector = _cssTree.default.generate(rule.ruleNode.prelude);
28671
28672 var identifier = declaration.value.children.first().name;
28673 var value;
28674
28675 _cssTree.default.walk(declaration, {
28676 visit: "Function",
28677 enter: function enter(node, item, list) {
28678 value = _cssTree.default.generate(node);
28679 }
28680 });
28681
28682 this.stringSetSelectors[identifier] = {
28683 identifier: identifier,
28684 value: value,
28685 selector: selector
28686 };
28687 }
28688 }
28689 }, {
28690 key: "onContent",
28691 value: function onContent(funcNode, fItem, fList, declaration, rule) {
28692 if (funcNode.name === "string") {
28693 var identifier = funcNode.children && funcNode.children.first().name;
28694 funcNode.name = "var";
28695 funcNode.children = new _cssTree.default.List();
28696 funcNode.children.append(funcNode.children.createItem({
28697 type: "Identifier",
28698 loc: null,
28699 name: "--string-" + identifier
28700 }));
28701 }
28702 }
28703 }, {
28704 key: "afterPageLayout",
28705 value: function afterPageLayout(fragment) {
28706 var _arr = Object.keys(this.stringSetSelectors);
28707
28708 for (var _i = 0; _i < _arr.length; _i++) {
28709 var name = _arr[_i];
28710 var set = this.stringSetSelectors[name];
28711 var selected = fragment.querySelector(set.selector);
28712
28713 if (selected) {
28714 var cssVar = void 0;
28715
28716 if (set.value === "content" || set.value === "content()" || set.value === "content(text)") {
28717 cssVar = selected.textContent.replace(/\\([\s\S])|(["|'])/g, "\\$1$2"); // this.styleSheet.insertRule(`:root { --string-${name}: "${cssVar}"; }`, this.styleSheet.cssRules.length);
28718 // fragment.style.setProperty(`--string-${name}`, `"${cssVar}"`);
28719
28720 set.first = cssVar;
28721 fragment.style.setProperty("--string-".concat(name), "\"".concat(set.first, "\""));
28722 } else {
28723 console.warn(set.value + "needs css replacement");
28724 }
28725 } else {
28726 // Use the previous values
28727 if (set.first) {
28728 fragment.style.setProperty("--string-".concat(name), "\"".concat(set.first, "\""));
28729 }
28730 }
28731 }
28732 }
28733 }]);
28734 return StringSets;
28735 }(_handler.default);
28736
28737 var _default = StringSets;
28738 exports.default = _default;
28739 });
28740
28741 unwrapExports(stringSets);
28742
28743 var targetCounters = createCommonjsModule(function (module, exports) {
28744
28745
28746
28747 Object.defineProperty(exports, "__esModule", {
28748 value: true
28749 });
28750 exports.default = void 0;
28751
28752 var _classCallCheck2 = interopRequireDefault(classCallCheck);
28753
28754 var _createClass2 = interopRequireDefault(createClass);
28755
28756 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
28757
28758 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
28759
28760 var _inherits2 = interopRequireDefault(inherits);
28761
28762 var _handler = interopRequireDefault(handler);
28763
28764
28765
28766 var _cssTree = interopRequireDefault(lib);
28767
28768 var TargetCounters =
28769 /*#__PURE__*/
28770 function (_Handler) {
28771 (0, _inherits2.default)(TargetCounters, _Handler);
28772
28773 function TargetCounters(chunker, polisher, caller) {
28774 var _this;
28775
28776 (0, _classCallCheck2.default)(this, TargetCounters);
28777 _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(TargetCounters).call(this, chunker, polisher, caller));
28778 _this.styleSheet = polisher.styleSheet;
28779 _this.counterTargets = {};
28780 return _this;
28781 }
28782
28783 (0, _createClass2.default)(TargetCounters, [{
28784 key: "onContent",
28785 value: function onContent(funcNode, fItem, fList, declaration, rule) {
28786 var _this2 = this;
28787
28788 if (funcNode.name === "target-counter") {
28789 var selector = _cssTree.default.generate(rule.ruleNode.prelude);
28790
28791 var first = funcNode.children.first();
28792 var func = first.name;
28793
28794 var value = _cssTree.default.generate(funcNode);
28795
28796 var args = [];
28797 first.children.forEach(function (child) {
28798 if (child.type === "Identifier") {
28799 args.push(child.name);
28800 }
28801 });
28802 var counter;
28803 var style;
28804 var styleIdentifier;
28805 funcNode.children.forEach(function (child) {
28806 if (child.type === "Identifier") {
28807 if (!counter) {
28808 counter = child.name;
28809 } else if (!style) {
28810 styleIdentifier = _cssTree.default.clone(child);
28811 style = child.name;
28812 }
28813 }
28814 });
28815 var variable = "target-counter-" + (0, utils.UUID)();
28816 selector.split(",").forEach(function (s) {
28817 _this2.counterTargets[s] = {
28818 func: func,
28819 args: args,
28820 value: value,
28821 counter: counter,
28822 style: style,
28823 selector: s,
28824 fullSelector: selector,
28825 variable: variable
28826 };
28827 }); // Replace with counter
28828
28829 funcNode.name = "counter";
28830 funcNode.children = new _cssTree.default.List();
28831 funcNode.children.appendData({
28832 type: "Identifier",
28833 loc: 0,
28834 name: variable
28835 });
28836
28837 if (styleIdentifier) {
28838 funcNode.children.appendData({
28839 type: "Operator",
28840 loc: null,
28841 value: ","
28842 });
28843 funcNode.children.appendData(styleIdentifier);
28844 }
28845 }
28846 }
28847 }, {
28848 key: "afterPageLayout",
28849 value: function afterPageLayout(fragment, page, breakToken, chunker) {
28850 var _this3 = this;
28851
28852 Object.keys(this.counterTargets).forEach(function (name) {
28853 var target = _this3.counterTargets[name];
28854 var split = target.selector.split("::");
28855 var query = split[0];
28856 var queried = chunker.pagesArea.querySelectorAll(query + ":not([data-" + target.variable + "])");
28857 queried.forEach(function (selected, index) {
28858 // TODO: handle func other than attr
28859 if (target.func !== "attr") {
28860 return;
28861 }
28862
28863 var val = (0, utils.attr)(selected, target.args);
28864 var element = chunker.pagesArea.querySelector((0, utils.querySelectorEscape)(val));
28865
28866 if (element) {
28867 var selector = (0, utils.UUID)();
28868 selected.setAttribute("data-" + target.variable, selector); // TODO: handle other counter types (by query)
28869
28870 if (target.counter === "page") {
28871 var pages = chunker.pagesArea.querySelectorAll(".pagedjs_page");
28872 var pg = 0;
28873
28874 for (var i = 0; i < pages.length; i++) {
28875 var styles = window.getComputedStyle(pages[i]);
28876 var reset = styles["counter-reset"].replace("page", "").trim();
28877
28878 if (reset !== "none") {
28879 pg = parseInt(reset);
28880 }
28881
28882 pg += 1;
28883
28884 if (pages[i].contains(element)) {
28885 break;
28886 }
28887 }
28888
28889 var _psuedo = "";
28890
28891 if (split.length > 1) {
28892 _psuedo += "::" + split[1];
28893 }
28894
28895 _this3.styleSheet.insertRule("[data-".concat(target.variable, "=\"").concat(selector, "\"]").concat(_psuedo, " { counter-reset: ").concat(target.variable, " ").concat(pg, "; }"), _this3.styleSheet.cssRules.length);
28896 } else {
28897 var value = element.getAttribute("data-counter-".concat(target.counter, "-value"));
28898
28899 if (value) {
28900 _this3.styleSheet.insertRule("[data-".concat(target.variable, "=\"").concat(selector, "\"]").concat(psuedo, " { counter-reset: ").concat(target.variable, " ").concat(target.variable, " ").concat(parseInt(value), "; }"), _this3.styleSheet.cssRules.length);
28901 }
28902 }
28903 }
28904 });
28905 });
28906 }
28907 }]);
28908 return TargetCounters;
28909 }(_handler.default);
28910
28911 var _default = TargetCounters;
28912 exports.default = _default;
28913 });
28914
28915 unwrapExports(targetCounters);
28916
28917 var targetText = createCommonjsModule(function (module, exports) {
28918
28919
28920
28921 Object.defineProperty(exports, "__esModule", {
28922 value: true
28923 });
28924 exports.default = void 0;
28925
28926 var _classCallCheck2 = interopRequireDefault(classCallCheck);
28927
28928 var _createClass2 = interopRequireDefault(createClass);
28929
28930 var _possibleConstructorReturn2 = interopRequireDefault(possibleConstructorReturn);
28931
28932 var _getPrototypeOf2 = interopRequireDefault(getPrototypeOf);
28933
28934 var _inherits2 = interopRequireDefault(inherits);
28935
28936 var _handler = interopRequireDefault(handler);
28937
28938
28939
28940 var _cssTree = interopRequireDefault(lib);
28941
28942 var TargetText =
28943 /*#__PURE__*/
28944 function (_Handler) {
28945 (0, _inherits2.default)(TargetText, _Handler);
28946
28947 function TargetText(chunker, polisher, caller) {
28948 var _this;
28949
28950 (0, _classCallCheck2.default)(this, TargetText);
28951 _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(TargetText).call(this, chunker, polisher, caller));
28952 _this.styleSheet = polisher.styleSheet;
28953 _this.textTargets = {};
28954 return _this;
28955 }
28956
28957 (0, _createClass2.default)(TargetText, [{
28958 key: "onContent",
28959 value: function onContent(funcNode, fItem, fList, declaration, rule) {
28960 var _this2 = this;
28961
28962 if (funcNode.name === "target-text") {
28963 var selector = _cssTree.default.generate(rule.ruleNode.prelude);
28964
28965 var first = funcNode.children.first();
28966 var last = funcNode.children.last();
28967 var func = first.name;
28968
28969 var value = _cssTree.default.generate(funcNode);
28970
28971 var args = [];
28972 first.children.forEach(function (child) {
28973 if (child.type === "Identifier") {
28974 args.push(child.name);
28975 }
28976 });
28977 var style;
28978
28979 if (last !== first) {
28980 style = last.name;
28981 }
28982
28983 var variable = "--" + (0, utils.UUID)();
28984 selector.split(",").forEach(function (s) {
28985 _this2.textTargets[s] = {
28986 func: func,
28987 args: args,
28988 value: value,
28989 style: style || "content",
28990 selector: s,
28991 fullSelector: selector,
28992 variable: variable
28993 };
28994 }); // Replace with variable
28995
28996 funcNode.name = "var";
28997 funcNode.children = new _cssTree.default.List();
28998 funcNode.children.appendData({
28999 type: "Identifier",
29000 loc: 0,
29001 name: variable
29002 });
29003 }
29004 }
29005 }, {
29006 key: "afterParsed",
29007 value: function afterParsed(fragment) {
29008 var _this3 = this;
29009
29010 Object.keys(this.textTargets).forEach(function (name) {
29011 var target = _this3.textTargets[name];
29012 var split = target.selector.split("::");
29013 var query = split[0];
29014 var queried = fragment.querySelectorAll(query);
29015 queried.forEach(function (selected, index) {
29016 var val = (0, utils.attr)(selected, target.args);
29017 var element = fragment.querySelector((0, utils.querySelectorEscape)(val));
29018
29019 if (element) {
29020 if (target.style === "content") {
29021 var selector = (0, utils.UUID)();
29022 selected.setAttribute("data-target-text", selector);
29023 var psuedo = "";
29024
29025 if (split.length > 1) {
29026 psuedo += "::" + split[1];
29027 }
29028
29029 var textContent = element.textContent.trim().replace(/["']/g, function (match) {
29030 return "\\" + match;
29031 }).replace(/[\n]/g, function (match) {
29032 return "\\00000A";
29033 }); // this.styleSheet.insertRule(`[data-target-text="${selector}"]${psuedo} { content: "${element.textContent}" }`, this.styleSheet.cssRules.length);
29034
29035 _this3.styleSheet.insertRule("[data-target-text=\"".concat(selector, "\"]").concat(psuedo, " { ").concat(target.variable, ": \"").concat(textContent, "\" }"), _this3.styleSheet.cssRules.length);
29036 }
29037 } else {
29038 console.warn("missed target", val);
29039 }
29040 });
29041 });
29042 }
29043 }]);
29044 return TargetText;
29045 }(_handler.default);
29046
29047 var _default = TargetText;
29048 exports.default = _default;
29049 });
29050
29051 unwrapExports(targetText);
29052
29053 var generatedContent = createCommonjsModule(function (module, exports) {
29054
29055
29056
29057 Object.defineProperty(exports, "__esModule", {
29058 value: true
29059 });
29060 exports.default = void 0;
29061
29062 var _runningHeaders = interopRequireDefault(runningHeaders);
29063
29064 var _stringSets = interopRequireDefault(stringSets);
29065
29066 var _targetCounters = interopRequireDefault(targetCounters);
29067
29068 var _targetText = interopRequireDefault(targetText);
29069
29070 var _default = [_runningHeaders.default, _stringSets.default, _targetCounters.default, _targetText.default];
29071 exports.default = _default;
29072 });
29073
29074 unwrapExports(generatedContent);
29075
29076 var isImplemented$3 = function () {
29077 var from = Array.from, arr, result;
29078 if (typeof from !== "function") return false;
29079 arr = ["raz", "dwa"];
29080 result = from(arr);
29081 return Boolean(result && (result !== arr) && (result[1] === "dwa"));
29082 };
29083
29084 var validTypes = { object: true, symbol: true };
29085
29086 var isImplemented$4 = function () {
29087 if (typeof Symbol !== 'function') return false;
29088 try { } catch (e) { return false; }
29089
29090 // Return 'true' also for polyfills
29091 if (!validTypes[typeof Symbol.iterator]) return false;
29092 if (!validTypes[typeof Symbol.toPrimitive]) return false;
29093 if (!validTypes[typeof Symbol.toStringTag]) return false;
29094
29095 return true;
29096 };
29097
29098 var isSymbol = function (x) {
29099 if (!x) return false;
29100 if (typeof x === 'symbol') return true;
29101 if (!x.constructor) return false;
29102 if (x.constructor.name !== 'Symbol') return false;
29103 return (x[x.constructor.toStringTag] === 'Symbol');
29104 };
29105
29106 var validateSymbol = function (value) {
29107 if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
29108 return value;
29109 };
29110
29111 var create$6 = Object.create, defineProperties = Object.defineProperties
29112 , defineProperty = Object.defineProperty, objPrototype = Object.prototype
29113 , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create$6(null)
29114 , isNativeSafe;
29115
29116 if (typeof Symbol === 'function') {
29117 NativeSymbol = Symbol;
29118 try {
29119 String(NativeSymbol());
29120 isNativeSafe = true;
29121 } catch (ignore) {}
29122 }
29123
29124 var generateName = (function () {
29125 var created = create$6(null);
29126 return function (desc) {
29127 var postfix = 0, name, ie11BugWorkaround;
29128 while (created[desc + (postfix || '')]) ++postfix;
29129 desc += (postfix || '');
29130 created[desc] = true;
29131 name = '@@' + desc;
29132 defineProperty(objPrototype, name, d_1.gs(null, function (value) {
29133 // For IE11 issue see:
29134 // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/
29135 // ie11-broken-getters-on-dom-objects
29136 // https://github.com/medikoo/es6-symbol/issues/12
29137 if (ie11BugWorkaround) return;
29138 ie11BugWorkaround = true;
29139 defineProperty(this, name, d_1(value));
29140 ie11BugWorkaround = false;
29141 }));
29142 return name;
29143 };
29144 }());
29145
29146 // Internal constructor (not one exposed) for creating Symbol instances.
29147 // This one is used to ensure that `someSymbol instanceof Symbol` always return false
29148 HiddenSymbol = function Symbol(description) {
29149 if (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');
29150 return SymbolPolyfill(description);
29151 };
29152
29153 // Exposed `Symbol` constructor
29154 // (returns instances of HiddenSymbol)
29155 var polyfill = SymbolPolyfill = function Symbol(description) {
29156 var symbol;
29157 if (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');
29158 if (isNativeSafe) return NativeSymbol(description);
29159 symbol = create$6(HiddenSymbol.prototype);
29160 description = (description === undefined ? '' : String(description));
29161 return defineProperties(symbol, {
29162 __description__: d_1('', description),
29163 __name__: d_1('', generateName(description))
29164 });
29165 };
29166 defineProperties(SymbolPolyfill, {
29167 for: d_1(function (key) {
29168 if (globalSymbols[key]) return globalSymbols[key];
29169 return (globalSymbols[key] = SymbolPolyfill(String(key)));
29170 }),
29171 keyFor: d_1(function (s) {
29172 var key;
29173 validateSymbol(s);
29174 for (key in globalSymbols) if (globalSymbols[key] === s) return key;
29175 }),
29176
29177 // To ensure proper interoperability with other native functions (e.g. Array.from)
29178 // fallback to eventual native implementation of given symbol
29179 hasInstance: d_1('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),
29180 isConcatSpreadable: d_1('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||
29181 SymbolPolyfill('isConcatSpreadable')),
29182 iterator: d_1('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),
29183 match: d_1('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),
29184 replace: d_1('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),
29185 search: d_1('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),
29186 species: d_1('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),
29187 split: d_1('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),
29188 toPrimitive: d_1('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),
29189 toStringTag: d_1('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),
29190 unscopables: d_1('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))
29191 });
29192
29193 // Internal tweaks for real symbol producer
29194 defineProperties(HiddenSymbol.prototype, {
29195 constructor: d_1(SymbolPolyfill),
29196 toString: d_1('', function () { return this.__name__; })
29197 });
29198
29199 // Proper implementation of methods exposed on Symbol.prototype
29200 // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype
29201 defineProperties(SymbolPolyfill.prototype, {
29202 toString: d_1(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
29203 valueOf: d_1(function () { return validateSymbol(this); })
29204 });
29205 defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d_1('', function () {
29206 var symbol = validateSymbol(this);
29207 if (typeof symbol === 'symbol') return symbol;
29208 return symbol.toString();
29209 }));
29210 defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d_1('c', 'Symbol'));
29211
29212 // Proper implementaton of toPrimitive and toStringTag for returned symbol instances
29213 defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,
29214 d_1('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
29215
29216 // Note: It's important to define `toPrimitive` as last one, as some implementations
29217 // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)
29218 // And that may invoke error in definition flow:
29219 // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149
29220 defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
29221 d_1('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
29222
29223 var es6Symbol = isImplemented$4() ? Symbol : polyfill;
29224
29225 var objToString = Object.prototype.toString
29226 , id = objToString.call(
29227 (function () {
29228 return arguments;
29229 })()
29230 );
29231
29232 var isArguments = function (value) {
29233 return objToString.call(value) === id;
29234 };
29235
29236 var objToString$1 = Object.prototype.toString, id$1 = objToString$1.call(noop);
29237
29238 var isFunction = function (value) {
29239 return typeof value === "function" && objToString$1.call(value) === id$1;
29240 };
29241
29242 var isImplemented$5 = function () {
29243 var sign = Math.sign;
29244 if (typeof sign !== "function") return false;
29245 return (sign(10) === 1) && (sign(-20) === -1);
29246 };
29247
29248 var shim$3 = function (value) {
29249 value = Number(value);
29250 if (isNaN(value) || (value === 0)) return value;
29251 return value > 0 ? 1 : -1;
29252 };
29253
29254 var sign = isImplemented$5()
29255 ? Math.sign
29256 : shim$3;
29257
29258 var abs = Math.abs, floor = Math.floor;
29259
29260 var toInteger = function (value) {
29261 if (isNaN(value)) return 0;
29262 value = Number(value);
29263 if ((value === 0) || !isFinite(value)) return value;
29264 return sign(value) * floor(abs(value));
29265 };
29266
29267 var max$1 = Math.max;
29268
29269 var toPosInteger = function (value) {
29270 return max$1(0, toInteger(value));
29271 };
29272
29273 var objToString$2 = Object.prototype.toString, id$2 = objToString$2.call("");
29274
29275 var isString = function (value) {
29276 return (
29277 typeof value === "string" ||
29278 (value &&
29279 typeof value === "object" &&
29280 (value instanceof String || objToString$2.call(value) === id$2)) ||
29281 false
29282 );
29283 };
29284
29285 var iteratorSymbol = es6Symbol.iterator
29286 , isArray = Array.isArray
29287 , call = Function.prototype.call
29288 , desc = { configurable: true, enumerable: true, writable: true, value: null }
29289 , defineProperty$1 = Object.defineProperty;
29290
29291 // eslint-disable-next-line complexity
29292 var shim$4 = function (arrayLike /*, mapFn, thisArg*/) {
29293 var mapFn = arguments[1]
29294 , thisArg = arguments[2]
29295 , Context
29296 , i
29297 , j
29298 , arr
29299 , length
29300 , code
29301 , iterator
29302 , result
29303 , getIterator
29304 , value;
29305
29306 arrayLike = Object(validValue(arrayLike));
29307
29308 if (isValue(mapFn)) validCallable(mapFn);
29309 if (!this || this === Array || !isFunction(this)) {
29310 // Result: Plain array
29311 if (!mapFn) {
29312 if (isArguments(arrayLike)) {
29313 // Source: Arguments
29314 length = arrayLike.length;
29315 if (length !== 1) return Array.apply(null, arrayLike);
29316 arr = new Array(1);
29317 arr[0] = arrayLike[0];
29318 return arr;
29319 }
29320 if (isArray(arrayLike)) {
29321 // Source: Array
29322 arr = new Array(length = arrayLike.length);
29323 for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
29324 return arr;
29325 }
29326 }
29327 arr = [];
29328 } else {
29329 // Result: Non plain array
29330 Context = this;
29331 }
29332
29333 if (!isArray(arrayLike)) {
29334 if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
29335 // Source: Iterator
29336 iterator = validCallable(getIterator).call(arrayLike);
29337 if (Context) arr = new Context();
29338 result = iterator.next();
29339 i = 0;
29340 while (!result.done) {
29341 value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
29342 if (Context) {
29343 desc.value = value;
29344 defineProperty$1(arr, i, desc);
29345 } else {
29346 arr[i] = value;
29347 }
29348 result = iterator.next();
29349 ++i;
29350 }
29351 length = i;
29352 } else if (isString(arrayLike)) {
29353 // Source: String
29354 length = arrayLike.length;
29355 if (Context) arr = new Context();
29356 for (i = 0, j = 0; i < length; ++i) {
29357 value = arrayLike[i];
29358 if (i + 1 < length) {
29359 code = value.charCodeAt(0);
29360 // eslint-disable-next-line max-depth
29361 if (code >= 0xd800 && code <= 0xdbff) value += arrayLike[++i];
29362 }
29363 value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
29364 if (Context) {
29365 desc.value = value;
29366 defineProperty$1(arr, j, desc);
29367 } else {
29368 arr[j] = value;
29369 }
29370 ++j;
29371 }
29372 length = j;
29373 }
29374 }
29375 if (length === undefined) {
29376 // Source: array or array-like
29377 length = toPosInteger(arrayLike.length);
29378 if (Context) arr = new Context(length);
29379 for (i = 0; i < length; ++i) {
29380 value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
29381 if (Context) {
29382 desc.value = value;
29383 defineProperty$1(arr, i, desc);
29384 } else {
29385 arr[i] = value;
29386 }
29387 }
29388 }
29389 if (Context) {
29390 desc.value = null;
29391 arr.length = length;
29392 }
29393 return arr;
29394 };
29395
29396 var from = isImplemented$3()
29397 ? Array.from
29398 : shim$4;
29399
29400 var isImplemented$6 = function () {
29401 var numberIsNaN = Number.isNaN;
29402 if (typeof numberIsNaN !== "function") return false;
29403 return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
29404 };
29405
29406 var shim$5 = function (value) {
29407 // eslint-disable-next-line no-self-compare
29408 return value !== value;
29409 };
29410
29411 var isNan = isImplemented$6()
29412 ? Number.isNaN
29413 : shim$5;
29414
29415 var indexOf$1 = Array.prototype.indexOf
29416 , objHasOwnProperty = Object.prototype.hasOwnProperty
29417 , abs$1 = Math.abs
29418 , floor$1 = Math.floor;
29419
29420 var eIndexOf = function (searchElement /*, fromIndex*/) {
29421 var i, length, fromIndex, val;
29422 if (!isNan(searchElement)) return indexOf$1.apply(this, arguments);
29423
29424 length = toPosInteger(validValue(this).length);
29425 fromIndex = arguments[1];
29426 if (isNaN(fromIndex)) fromIndex = 0;
29427 else if (fromIndex >= 0) fromIndex = floor$1(fromIndex);
29428 else fromIndex = toPosInteger(this.length) - floor$1(abs$1(fromIndex));
29429
29430 for (i = fromIndex; i < length; ++i) {
29431 if (objHasOwnProperty.call(this, i)) {
29432 val = this[i];
29433 if (isNan(val)) return i; // Jslint: ignore
29434 }
29435 }
29436 return -1;
29437 };
29438
29439 var forEach$1 = Array.prototype.forEach
29440 , splice = Array.prototype.splice;
29441
29442 // eslint-disable-next-line no-unused-vars
29443 var remove = function (itemToRemove /*, …item*/) {
29444 forEach$1.call(
29445 arguments,
29446 function (item) {
29447 var index = eIndexOf.call(this, item);
29448 if (index !== -1) splice.call(this, index, 1);
29449 },
29450 this
29451 );
29452 };
29453
29454 var map = { function: true, object: true };
29455
29456 var isObject$1 = function (value) {
29457 return (isValue(value) && map[typeof value]) || false;
29458 };
29459
29460 var validObject = function (value) {
29461 if (!isObject$1(value)) throw new TypeError(value + " is not an Object");
29462 return value;
29463 };
29464
29465 var emit = eventEmitter.methods.emit
29466
29467 , defineProperty$2 = Object.defineProperty
29468 , hasOwnProperty$6 = Object.prototype.hasOwnProperty
29469 , getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
29470
29471 var pipe = function (e1, e2/*, name*/) {
29472 var pipes, pipe, desc, name;
29473
29474 (validObject(e1) && validObject(e2));
29475 name = arguments[2];
29476 if (name === undefined) name = 'emit';
29477
29478 pipe = {
29479 close: function () { remove.call(pipes, e2); }
29480 };
29481 if (hasOwnProperty$6.call(e1, '__eePipes__')) {
29482 (pipes = e1.__eePipes__).push(e2);
29483 return pipe;
29484 }
29485 defineProperty$2(e1, '__eePipes__', d_1('c', pipes = [e2]));
29486 desc = getOwnPropertyDescriptor(e1, name);
29487 if (!desc) {
29488 desc = d_1('c', undefined);
29489 } else {
29490 delete desc.get;
29491 delete desc.set;
29492 }
29493 desc.value = function () {
29494 var i, emitter, data = from(pipes);
29495 emit.apply(this, arguments);
29496 for (i = 0; (emitter = data[i]); ++i) emit.apply(emitter, arguments);
29497 };
29498 defineProperty$2(e1, name, desc);
29499 return pipe;
29500 };
29501
29502 var handlers = createCommonjsModule(function (module, exports) {
29503
29504
29505
29506 Object.defineProperty(exports, "__esModule", {
29507 value: true
29508 });
29509 exports.registerHandlers = registerHandlers;
29510 exports.initializeHandlers = initializeHandlers;
29511
29512 var _classCallCheck2 = interopRequireDefault(classCallCheck);
29513
29514 var _toConsumableArray2 = interopRequireDefault(toConsumableArray);
29515
29516 var _index = interopRequireDefault(pagedMedia);
29517
29518 var _index2 = interopRequireDefault(generatedContent);
29519
29520 var _eventEmitter = interopRequireDefault(eventEmitter);
29521
29522 var _pipe = interopRequireDefault(pipe);
29523
29524 var registeredHandlers = (0, _toConsumableArray2.default)(_index.default).concat((0, _toConsumableArray2.default)(_index2.default));
29525
29526 var Handlers = function Handlers(chunker, polisher, caller) {
29527 var _this = this;
29528
29529 (0, _classCallCheck2.default)(this, Handlers);
29530 registeredHandlers.forEach(function (Handler) {
29531 var handler = new Handler(chunker, polisher, caller);
29532 (0, _pipe.default)(handler, _this);
29533 });
29534 };
29535
29536 (0, _eventEmitter.default)(Handlers.prototype);
29537
29538 function registerHandlers() {
29539 for (var i = 0; i < arguments.length; i++) {
29540 registeredHandlers.push(arguments[i]);
29541 }
29542 }
29543
29544 function initializeHandlers(chunker, polisher, caller) {
29545 var handlers = new Handlers(chunker, polisher, caller);
29546 return handlers;
29547 }
29548 });
29549
29550 unwrapExports(handlers);
29551 var handlers_1 = handlers.registerHandlers;
29552 var handlers_2 = handlers.initializeHandlers;
29553
29554 var previewer = createCommonjsModule(function (module, exports) {
29555
29556
29557
29558 Object.defineProperty(exports, "__esModule", {
29559 value: true
29560 });
29561 exports.default = void 0;
29562
29563 var _regenerator = interopRequireDefault(regenerator);
29564
29565 var _toConsumableArray2 = interopRequireDefault(toConsumableArray);
29566
29567 var _asyncToGenerator2 = interopRequireDefault(asyncToGenerator);
29568
29569 var _classCallCheck2 = interopRequireDefault(classCallCheck);
29570
29571 var _createClass2 = interopRequireDefault(createClass);
29572
29573 var _eventEmitter = interopRequireDefault(eventEmitter);
29574
29575 var _chunker = interopRequireDefault(chunker);
29576
29577 var _polisher = interopRequireDefault(polisher);
29578
29579
29580
29581 var Previewer =
29582 /*#__PURE__*/
29583 function () {
29584 function Previewer() {
29585 var _this = this;
29586
29587 (0, _classCallCheck2.default)(this, Previewer);
29588 // this.preview = this.getParams("preview") !== "false";
29589 // Process styles
29590 this.polisher = new _polisher.default(false); // Chunk contents
29591
29592 this.chunker = new _chunker.default(); // Hooks
29593
29594 this.hooks = {}; // default size
29595
29596 this.size = {
29597 width: {
29598 value: 8.5,
29599 unit: "in"
29600 },
29601 height: {
29602 value: 11,
29603 unit: "in"
29604 },
29605 format: undefined,
29606 orientation: undefined
29607 };
29608 var counter = 0;
29609 this.chunker.on("page", function (page) {
29610 counter += 1;
29611
29612 _this.emit("page", page);
29613
29614 if (typeof window.PuppeteerLogger !== "undefined") {
29615 window.PuppeteerLogger("page", counter);
29616 }
29617 });
29618 this.chunker.on("rendering", function () {
29619 _this.emit("rendering", _this.chunker);
29620 });
29621 }
29622
29623 (0, _createClass2.default)(Previewer, [{
29624 key: "initializeHandlers",
29625 value: function initializeHandlers() {
29626 var _this2 = this;
29627
29628 var handlers$$1 = (0, handlers.initializeHandlers)(this.chunker, this.polisher, this);
29629 handlers$$1.on("size", function (size) {
29630 _this2.size = size;
29631
29632 _this2.emit("size", size);
29633 });
29634 return handlers$$1;
29635 }
29636 }, {
29637 key: "registerHandlers",
29638 value: function registerHandlers() {
29639 return handlers.registerHandlers.apply(handlers.registerHandlers, arguments);
29640 }
29641 }, {
29642 key: "getParams",
29643 value: function getParams(name) {
29644 var param;
29645 var url = new URL(window.location);
29646 var params = new URLSearchParams(url.search);
29647 var _iteratorNormalCompletion = true;
29648 var _didIteratorError = false;
29649 var _iteratorError = undefined;
29650
29651 try {
29652 for (var _iterator = params.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
29653 var pair = _step.value;
29654
29655 if (pair[0] === name) {
29656 param = pair[1];
29657 }
29658 }
29659 } catch (err) {
29660 _didIteratorError = true;
29661 _iteratorError = err;
29662 } finally {
29663 try {
29664 if (!_iteratorNormalCompletion && _iterator.return != null) {
29665 _iterator.return();
29666 }
29667 } finally {
29668 if (_didIteratorError) {
29669 throw _iteratorError;
29670 }
29671 }
29672 }
29673
29674 return param;
29675 }
29676 }, {
29677 key: "wrapContent",
29678 value: function wrapContent() {
29679 // Wrap body in template tag
29680 var body = document.querySelector("body"); // Check if a template exists
29681
29682 var template;
29683 template = body.querySelector(":scope > template[data-ref='pagedjs-content']");
29684
29685 if (!template) {
29686 // Otherwise create one
29687 template = document.createElement("template");
29688 template.dataset.ref = "pagedjs-content";
29689 template.innerHTML = body.innerHTML;
29690 body.innerHTML = "";
29691 body.appendChild(template);
29692 }
29693
29694 return template.content;
29695 }
29696 }, {
29697 key: "removeStyles",
29698 value: function removeStyles() {
29699 var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
29700 // Get all stylesheets
29701 var stylesheets = Array.from(doc.querySelectorAll("link[rel='stylesheet']"));
29702 var hrefs = stylesheets.map(function (sheet) {
29703 sheet.remove();
29704 return sheet.href;
29705 }); // Get inline styles
29706
29707 var inlineStyles = Array.from(doc.querySelectorAll("style:not([data-pagedjs-inserted-styles])"));
29708 inlineStyles.forEach(function (inlineStyle) {
29709 var obj = {};
29710 obj[window.location.href] = inlineStyle.textContent;
29711 hrefs.push(obj);
29712 inlineStyle.remove();
29713 });
29714 return hrefs;
29715 }
29716 }, {
29717 key: "preview",
29718 value: function () {
29719 var _preview = (0, _asyncToGenerator2.default)(
29720 /*#__PURE__*/
29721 _regenerator.default.mark(function _callee(content, stylesheets, renderTo) {
29722 var _this$polisher;
29723
29724 var startTime, flow, endTime, msg;
29725 return _regenerator.default.wrap(function _callee$(_context) {
29726 while (1) {
29727 switch (_context.prev = _context.next) {
29728 case 0:
29729 if (!content) {
29730 content = this.wrapContent();
29731 }
29732
29733 if (!stylesheets) {
29734 stylesheets = this.removeStyles();
29735 }
29736
29737 this.polisher.setup();
29738 this.handlers = this.initializeHandlers();
29739 _context.next = 6;
29740 return (_this$polisher = this.polisher).add.apply(_this$polisher, (0, _toConsumableArray2.default)(stylesheets));
29741
29742 case 6:
29743 startTime = performance.now(); // Render flow
29744
29745 _context.next = 9;
29746 return this.chunker.flow(content, renderTo);
29747
29748 case 9:
29749 flow = _context.sent;
29750 endTime = performance.now();
29751 msg = "Rendering " + flow.total + " pages took " + (endTime - startTime) + " milliseconds.";
29752 flow.performance = endTime - startTime;
29753 flow.size = this.size;
29754 this.emit("rendered", msg, this.size.width && this.size.width.value + this.size.width.unit, this.size.height && this.size.height.value + this.size.height.unit, this.size.orientation, this.size.format);
29755
29756 if (typeof window.onPagesRendered !== "undefined") {
29757 window.onPagesRendered(msg, this.size.width && this.size.width.value + this.size.width.unit, this.size.height && this.size.height.value + this.size.height.unit, this.size.orientation, this.size.format);
29758 }
29759
29760 return _context.abrupt("return", flow);
29761
29762 case 17:
29763 case "end":
29764 return _context.stop();
29765 }
29766 }
29767 }, _callee, this);
29768 }));
29769
29770 return function preview(_x, _x2, _x3) {
29771 return _preview.apply(this, arguments);
29772 };
29773 }()
29774 }]);
29775 return Previewer;
29776 }();
29777
29778 (0, _eventEmitter.default)(Previewer.prototype);
29779 var _default = Previewer;
29780 exports.default = _default;
29781 });
29782
29783 unwrapExports(previewer);
29784
29785 var lib$1 = createCommonjsModule(function (module, exports) {
29786
29787
29788
29789 Object.defineProperty(exports, "__esModule", {
29790 value: true
29791 });
29792 Object.defineProperty(exports, "Chunker", {
29793 enumerable: true,
29794 get: function get() {
29795 return _chunker.default;
29796 }
29797 });
29798 Object.defineProperty(exports, "Polisher", {
29799 enumerable: true,
29800 get: function get() {
29801 return _polisher.default;
29802 }
29803 });
29804 Object.defineProperty(exports, "Previewer", {
29805 enumerable: true,
29806 get: function get() {
29807 return _previewer.default;
29808 }
29809 });
29810 Object.defineProperty(exports, "Handler", {
29811 enumerable: true,
29812 get: function get() {
29813 return _handler.default;
29814 }
29815 });
29816 Object.defineProperty(exports, "registerHandlers", {
29817 enumerable: true,
29818 get: function get() {
29819 return handlers.registerHandlers;
29820 }
29821 });
29822 Object.defineProperty(exports, "initializeHandlers", {
29823 enumerable: true,
29824 get: function get() {
29825 return handlers.initializeHandlers;
29826 }
29827 });
29828
29829 var _chunker = interopRequireDefault(chunker);
29830
29831 var _polisher = interopRequireDefault(polisher);
29832
29833 var _previewer = interopRequireDefault(previewer);
29834
29835 var _handler = interopRequireDefault(handler);
29836 });
29837
29838 var index$2 = unwrapExports(lib$1);
29839
29840 return index$2;
29841
29842})));