@phun-ky/speccer 4.2.1 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/speccer.js CHANGED
@@ -1,1680 +1 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
- typeof define === 'function' && define.amd ? define(factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.speccer = factory());
5
- })(this, (function () { 'use strict';
6
-
7
- const after = (el, newSibling) => el.insertAdjacentElement('afterend', newSibling);
8
- const removeAll = function (selector) {
9
- let el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
10
- [].forEach.call(el.querySelectorAll(selector), function (e) {
11
- e.remove();
12
- });
13
- };
14
-
15
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
16
- try {
17
- var info = gen[key](arg);
18
- var value = info.value;
19
- } catch (error) {
20
- reject(error);
21
- return;
22
- }
23
-
24
- if (info.done) {
25
- resolve(value);
26
- } else {
27
- Promise.resolve(value).then(_next, _throw);
28
- }
29
- }
30
-
31
- function _asyncToGenerator(fn) {
32
- return function () {
33
- var self = this,
34
- args = arguments;
35
- return new Promise(function (resolve, reject) {
36
- var gen = fn.apply(self, args);
37
-
38
- function _next(value) {
39
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
40
- }
41
-
42
- function _throw(err) {
43
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
44
- }
45
-
46
- _next(undefined);
47
- });
48
- };
49
- }
50
-
51
- function createCommonjsModule(fn) {
52
- var module = { exports: {} };
53
- return fn(module, module.exports), module.exports;
54
- }
55
-
56
- /**
57
- * Copyright (c) 2014-present, Facebook, Inc.
58
- *
59
- * This source code is licensed under the MIT license found in the
60
- * LICENSE file in the root directory of this source tree.
61
- */
62
-
63
- var runtime_1 = createCommonjsModule(function (module) {
64
- var runtime = (function (exports) {
65
-
66
- var Op = Object.prototype;
67
- var hasOwn = Op.hasOwnProperty;
68
- var undefined$1; // More compressible than void 0.
69
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
70
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
71
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
72
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
73
-
74
- function define(obj, key, value) {
75
- Object.defineProperty(obj, key, {
76
- value: value,
77
- enumerable: true,
78
- configurable: true,
79
- writable: true
80
- });
81
- return obj[key];
82
- }
83
- try {
84
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
85
- define({}, "");
86
- } catch (err) {
87
- define = function(obj, key, value) {
88
- return obj[key] = value;
89
- };
90
- }
91
-
92
- function wrap(innerFn, outerFn, self, tryLocsList) {
93
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
94
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
95
- var generator = Object.create(protoGenerator.prototype);
96
- var context = new Context(tryLocsList || []);
97
-
98
- // The ._invoke method unifies the implementations of the .next,
99
- // .throw, and .return methods.
100
- generator._invoke = makeInvokeMethod(innerFn, self, context);
101
-
102
- return generator;
103
- }
104
- exports.wrap = wrap;
105
-
106
- // Try/catch helper to minimize deoptimizations. Returns a completion
107
- // record like context.tryEntries[i].completion. This interface could
108
- // have been (and was previously) designed to take a closure to be
109
- // invoked without arguments, but in all the cases we care about we
110
- // already have an existing method we want to call, so there's no need
111
- // to create a new function object. We can even get away with assuming
112
- // the method takes exactly one argument, since that happens to be true
113
- // in every case, so we don't have to touch the arguments object. The
114
- // only additional allocation required is the completion record, which
115
- // has a stable shape and so hopefully should be cheap to allocate.
116
- function tryCatch(fn, obj, arg) {
117
- try {
118
- return { type: "normal", arg: fn.call(obj, arg) };
119
- } catch (err) {
120
- return { type: "throw", arg: err };
121
- }
122
- }
123
-
124
- var GenStateSuspendedStart = "suspendedStart";
125
- var GenStateSuspendedYield = "suspendedYield";
126
- var GenStateExecuting = "executing";
127
- var GenStateCompleted = "completed";
128
-
129
- // Returning this object from the innerFn has the same effect as
130
- // breaking out of the dispatch switch statement.
131
- var ContinueSentinel = {};
132
-
133
- // Dummy constructor functions that we use as the .constructor and
134
- // .constructor.prototype properties for functions that return Generator
135
- // objects. For full spec compliance, you may wish to configure your
136
- // minifier not to mangle the names of these two functions.
137
- function Generator() {}
138
- function GeneratorFunction() {}
139
- function GeneratorFunctionPrototype() {}
140
-
141
- // This is a polyfill for %IteratorPrototype% for environments that
142
- // don't natively support it.
143
- var IteratorPrototype = {};
144
- define(IteratorPrototype, iteratorSymbol, function () {
145
- return this;
146
- });
147
-
148
- var getProto = Object.getPrototypeOf;
149
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
150
- if (NativeIteratorPrototype &&
151
- NativeIteratorPrototype !== Op &&
152
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
153
- // This environment has a native %IteratorPrototype%; use it instead
154
- // of the polyfill.
155
- IteratorPrototype = NativeIteratorPrototype;
156
- }
157
-
158
- var Gp = GeneratorFunctionPrototype.prototype =
159
- Generator.prototype = Object.create(IteratorPrototype);
160
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
161
- define(Gp, "constructor", GeneratorFunctionPrototype);
162
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
163
- GeneratorFunction.displayName = define(
164
- GeneratorFunctionPrototype,
165
- toStringTagSymbol,
166
- "GeneratorFunction"
167
- );
168
-
169
- // Helper for defining the .next, .throw, and .return methods of the
170
- // Iterator interface in terms of a single ._invoke method.
171
- function defineIteratorMethods(prototype) {
172
- ["next", "throw", "return"].forEach(function(method) {
173
- define(prototype, method, function(arg) {
174
- return this._invoke(method, arg);
175
- });
176
- });
177
- }
178
-
179
- exports.isGeneratorFunction = function(genFun) {
180
- var ctor = typeof genFun === "function" && genFun.constructor;
181
- return ctor
182
- ? ctor === GeneratorFunction ||
183
- // For the native GeneratorFunction constructor, the best we can
184
- // do is to check its .name property.
185
- (ctor.displayName || ctor.name) === "GeneratorFunction"
186
- : false;
187
- };
188
-
189
- exports.mark = function(genFun) {
190
- if (Object.setPrototypeOf) {
191
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
192
- } else {
193
- genFun.__proto__ = GeneratorFunctionPrototype;
194
- define(genFun, toStringTagSymbol, "GeneratorFunction");
195
- }
196
- genFun.prototype = Object.create(Gp);
197
- return genFun;
198
- };
199
-
200
- // Within the body of any async function, `await x` is transformed to
201
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
202
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
203
- // meant to be awaited.
204
- exports.awrap = function(arg) {
205
- return { __await: arg };
206
- };
207
-
208
- function AsyncIterator(generator, PromiseImpl) {
209
- function invoke(method, arg, resolve, reject) {
210
- var record = tryCatch(generator[method], generator, arg);
211
- if (record.type === "throw") {
212
- reject(record.arg);
213
- } else {
214
- var result = record.arg;
215
- var value = result.value;
216
- if (value &&
217
- typeof value === "object" &&
218
- hasOwn.call(value, "__await")) {
219
- return PromiseImpl.resolve(value.__await).then(function(value) {
220
- invoke("next", value, resolve, reject);
221
- }, function(err) {
222
- invoke("throw", err, resolve, reject);
223
- });
224
- }
225
-
226
- return PromiseImpl.resolve(value).then(function(unwrapped) {
227
- // When a yielded Promise is resolved, its final value becomes
228
- // the .value of the Promise<{value,done}> result for the
229
- // current iteration.
230
- result.value = unwrapped;
231
- resolve(result);
232
- }, function(error) {
233
- // If a rejected Promise was yielded, throw the rejection back
234
- // into the async generator function so it can be handled there.
235
- return invoke("throw", error, resolve, reject);
236
- });
237
- }
238
- }
239
-
240
- var previousPromise;
241
-
242
- function enqueue(method, arg) {
243
- function callInvokeWithMethodAndArg() {
244
- return new PromiseImpl(function(resolve, reject) {
245
- invoke(method, arg, resolve, reject);
246
- });
247
- }
248
-
249
- return previousPromise =
250
- // If enqueue has been called before, then we want to wait until
251
- // all previous Promises have been resolved before calling invoke,
252
- // so that results are always delivered in the correct order. If
253
- // enqueue has not been called before, then it is important to
254
- // call invoke immediately, without waiting on a callback to fire,
255
- // so that the async generator function has the opportunity to do
256
- // any necessary setup in a predictable way. This predictability
257
- // is why the Promise constructor synchronously invokes its
258
- // executor callback, and why async functions synchronously
259
- // execute code before the first await. Since we implement simple
260
- // async functions in terms of async generators, it is especially
261
- // important to get this right, even though it requires care.
262
- previousPromise ? previousPromise.then(
263
- callInvokeWithMethodAndArg,
264
- // Avoid propagating failures to Promises returned by later
265
- // invocations of the iterator.
266
- callInvokeWithMethodAndArg
267
- ) : callInvokeWithMethodAndArg();
268
- }
269
-
270
- // Define the unified helper method that is used to implement .next,
271
- // .throw, and .return (see defineIteratorMethods).
272
- this._invoke = enqueue;
273
- }
274
-
275
- defineIteratorMethods(AsyncIterator.prototype);
276
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
277
- return this;
278
- });
279
- exports.AsyncIterator = AsyncIterator;
280
-
281
- // Note that simple async functions are implemented on top of
282
- // AsyncIterator objects; they just return a Promise for the value of
283
- // the final result produced by the iterator.
284
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
285
- if (PromiseImpl === void 0) PromiseImpl = Promise;
286
-
287
- var iter = new AsyncIterator(
288
- wrap(innerFn, outerFn, self, tryLocsList),
289
- PromiseImpl
290
- );
291
-
292
- return exports.isGeneratorFunction(outerFn)
293
- ? iter // If outerFn is a generator, return the full iterator.
294
- : iter.next().then(function(result) {
295
- return result.done ? result.value : iter.next();
296
- });
297
- };
298
-
299
- function makeInvokeMethod(innerFn, self, context) {
300
- var state = GenStateSuspendedStart;
301
-
302
- return function invoke(method, arg) {
303
- if (state === GenStateExecuting) {
304
- throw new Error("Generator is already running");
305
- }
306
-
307
- if (state === GenStateCompleted) {
308
- if (method === "throw") {
309
- throw arg;
310
- }
311
-
312
- // Be forgiving, per 25.3.3.3.3 of the spec:
313
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
314
- return doneResult();
315
- }
316
-
317
- context.method = method;
318
- context.arg = arg;
319
-
320
- while (true) {
321
- var delegate = context.delegate;
322
- if (delegate) {
323
- var delegateResult = maybeInvokeDelegate(delegate, context);
324
- if (delegateResult) {
325
- if (delegateResult === ContinueSentinel) continue;
326
- return delegateResult;
327
- }
328
- }
329
-
330
- if (context.method === "next") {
331
- // Setting context._sent for legacy support of Babel's
332
- // function.sent implementation.
333
- context.sent = context._sent = context.arg;
334
-
335
- } else if (context.method === "throw") {
336
- if (state === GenStateSuspendedStart) {
337
- state = GenStateCompleted;
338
- throw context.arg;
339
- }
340
-
341
- context.dispatchException(context.arg);
342
-
343
- } else if (context.method === "return") {
344
- context.abrupt("return", context.arg);
345
- }
346
-
347
- state = GenStateExecuting;
348
-
349
- var record = tryCatch(innerFn, self, context);
350
- if (record.type === "normal") {
351
- // If an exception is thrown from innerFn, we leave state ===
352
- // GenStateExecuting and loop back for another invocation.
353
- state = context.done
354
- ? GenStateCompleted
355
- : GenStateSuspendedYield;
356
-
357
- if (record.arg === ContinueSentinel) {
358
- continue;
359
- }
360
-
361
- return {
362
- value: record.arg,
363
- done: context.done
364
- };
365
-
366
- } else if (record.type === "throw") {
367
- state = GenStateCompleted;
368
- // Dispatch the exception by looping back around to the
369
- // context.dispatchException(context.arg) call above.
370
- context.method = "throw";
371
- context.arg = record.arg;
372
- }
373
- }
374
- };
375
- }
376
-
377
- // Call delegate.iterator[context.method](context.arg) and handle the
378
- // result, either by returning a { value, done } result from the
379
- // delegate iterator, or by modifying context.method and context.arg,
380
- // setting context.delegate to null, and returning the ContinueSentinel.
381
- function maybeInvokeDelegate(delegate, context) {
382
- var method = delegate.iterator[context.method];
383
- if (method === undefined$1) {
384
- // A .throw or .return when the delegate iterator has no .throw
385
- // method always terminates the yield* loop.
386
- context.delegate = null;
387
-
388
- if (context.method === "throw") {
389
- // Note: ["return"] must be used for ES3 parsing compatibility.
390
- if (delegate.iterator["return"]) {
391
- // If the delegate iterator has a return method, give it a
392
- // chance to clean up.
393
- context.method = "return";
394
- context.arg = undefined$1;
395
- maybeInvokeDelegate(delegate, context);
396
-
397
- if (context.method === "throw") {
398
- // If maybeInvokeDelegate(context) changed context.method from
399
- // "return" to "throw", let that override the TypeError below.
400
- return ContinueSentinel;
401
- }
402
- }
403
-
404
- context.method = "throw";
405
- context.arg = new TypeError(
406
- "The iterator does not provide a 'throw' method");
407
- }
408
-
409
- return ContinueSentinel;
410
- }
411
-
412
- var record = tryCatch(method, delegate.iterator, context.arg);
413
-
414
- if (record.type === "throw") {
415
- context.method = "throw";
416
- context.arg = record.arg;
417
- context.delegate = null;
418
- return ContinueSentinel;
419
- }
420
-
421
- var info = record.arg;
422
-
423
- if (! info) {
424
- context.method = "throw";
425
- context.arg = new TypeError("iterator result is not an object");
426
- context.delegate = null;
427
- return ContinueSentinel;
428
- }
429
-
430
- if (info.done) {
431
- // Assign the result of the finished delegate to the temporary
432
- // variable specified by delegate.resultName (see delegateYield).
433
- context[delegate.resultName] = info.value;
434
-
435
- // Resume execution at the desired location (see delegateYield).
436
- context.next = delegate.nextLoc;
437
-
438
- // If context.method was "throw" but the delegate handled the
439
- // exception, let the outer generator proceed normally. If
440
- // context.method was "next", forget context.arg since it has been
441
- // "consumed" by the delegate iterator. If context.method was
442
- // "return", allow the original .return call to continue in the
443
- // outer generator.
444
- if (context.method !== "return") {
445
- context.method = "next";
446
- context.arg = undefined$1;
447
- }
448
-
449
- } else {
450
- // Re-yield the result returned by the delegate method.
451
- return info;
452
- }
453
-
454
- // The delegate iterator is finished, so forget it and continue with
455
- // the outer generator.
456
- context.delegate = null;
457
- return ContinueSentinel;
458
- }
459
-
460
- // Define Generator.prototype.{next,throw,return} in terms of the
461
- // unified ._invoke helper method.
462
- defineIteratorMethods(Gp);
463
-
464
- define(Gp, toStringTagSymbol, "Generator");
465
-
466
- // A Generator should always return itself as the iterator object when the
467
- // @@iterator function is called on it. Some browsers' implementations of the
468
- // iterator prototype chain incorrectly implement this, causing the Generator
469
- // object to not be returned from this call. This ensures that doesn't happen.
470
- // See https://github.com/facebook/regenerator/issues/274 for more details.
471
- define(Gp, iteratorSymbol, function() {
472
- return this;
473
- });
474
-
475
- define(Gp, "toString", function() {
476
- return "[object Generator]";
477
- });
478
-
479
- function pushTryEntry(locs) {
480
- var entry = { tryLoc: locs[0] };
481
-
482
- if (1 in locs) {
483
- entry.catchLoc = locs[1];
484
- }
485
-
486
- if (2 in locs) {
487
- entry.finallyLoc = locs[2];
488
- entry.afterLoc = locs[3];
489
- }
490
-
491
- this.tryEntries.push(entry);
492
- }
493
-
494
- function resetTryEntry(entry) {
495
- var record = entry.completion || {};
496
- record.type = "normal";
497
- delete record.arg;
498
- entry.completion = record;
499
- }
500
-
501
- function Context(tryLocsList) {
502
- // The root entry object (effectively a try statement without a catch
503
- // or a finally block) gives us a place to store values thrown from
504
- // locations where there is no enclosing try statement.
505
- this.tryEntries = [{ tryLoc: "root" }];
506
- tryLocsList.forEach(pushTryEntry, this);
507
- this.reset(true);
508
- }
509
-
510
- exports.keys = function(object) {
511
- var keys = [];
512
- for (var key in object) {
513
- keys.push(key);
514
- }
515
- keys.reverse();
516
-
517
- // Rather than returning an object with a next method, we keep
518
- // things simple and return the next function itself.
519
- return function next() {
520
- while (keys.length) {
521
- var key = keys.pop();
522
- if (key in object) {
523
- next.value = key;
524
- next.done = false;
525
- return next;
526
- }
527
- }
528
-
529
- // To avoid creating an additional object, we just hang the .value
530
- // and .done properties off the next function object itself. This
531
- // also ensures that the minifier will not anonymize the function.
532
- next.done = true;
533
- return next;
534
- };
535
- };
536
-
537
- function values(iterable) {
538
- if (iterable) {
539
- var iteratorMethod = iterable[iteratorSymbol];
540
- if (iteratorMethod) {
541
- return iteratorMethod.call(iterable);
542
- }
543
-
544
- if (typeof iterable.next === "function") {
545
- return iterable;
546
- }
547
-
548
- if (!isNaN(iterable.length)) {
549
- var i = -1, next = function next() {
550
- while (++i < iterable.length) {
551
- if (hasOwn.call(iterable, i)) {
552
- next.value = iterable[i];
553
- next.done = false;
554
- return next;
555
- }
556
- }
557
-
558
- next.value = undefined$1;
559
- next.done = true;
560
-
561
- return next;
562
- };
563
-
564
- return next.next = next;
565
- }
566
- }
567
-
568
- // Return an iterator with no values.
569
- return { next: doneResult };
570
- }
571
- exports.values = values;
572
-
573
- function doneResult() {
574
- return { value: undefined$1, done: true };
575
- }
576
-
577
- Context.prototype = {
578
- constructor: Context,
579
-
580
- reset: function(skipTempReset) {
581
- this.prev = 0;
582
- this.next = 0;
583
- // Resetting context._sent for legacy support of Babel's
584
- // function.sent implementation.
585
- this.sent = this._sent = undefined$1;
586
- this.done = false;
587
- this.delegate = null;
588
-
589
- this.method = "next";
590
- this.arg = undefined$1;
591
-
592
- this.tryEntries.forEach(resetTryEntry);
593
-
594
- if (!skipTempReset) {
595
- for (var name in this) {
596
- // Not sure about the optimal order of these conditions:
597
- if (name.charAt(0) === "t" &&
598
- hasOwn.call(this, name) &&
599
- !isNaN(+name.slice(1))) {
600
- this[name] = undefined$1;
601
- }
602
- }
603
- }
604
- },
605
-
606
- stop: function() {
607
- this.done = true;
608
-
609
- var rootEntry = this.tryEntries[0];
610
- var rootRecord = rootEntry.completion;
611
- if (rootRecord.type === "throw") {
612
- throw rootRecord.arg;
613
- }
614
-
615
- return this.rval;
616
- },
617
-
618
- dispatchException: function(exception) {
619
- if (this.done) {
620
- throw exception;
621
- }
622
-
623
- var context = this;
624
- function handle(loc, caught) {
625
- record.type = "throw";
626
- record.arg = exception;
627
- context.next = loc;
628
-
629
- if (caught) {
630
- // If the dispatched exception was caught by a catch block,
631
- // then let that catch block handle the exception normally.
632
- context.method = "next";
633
- context.arg = undefined$1;
634
- }
635
-
636
- return !! caught;
637
- }
638
-
639
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
640
- var entry = this.tryEntries[i];
641
- var record = entry.completion;
642
-
643
- if (entry.tryLoc === "root") {
644
- // Exception thrown outside of any try block that could handle
645
- // it, so set the completion value of the entire function to
646
- // throw the exception.
647
- return handle("end");
648
- }
649
-
650
- if (entry.tryLoc <= this.prev) {
651
- var hasCatch = hasOwn.call(entry, "catchLoc");
652
- var hasFinally = hasOwn.call(entry, "finallyLoc");
653
-
654
- if (hasCatch && hasFinally) {
655
- if (this.prev < entry.catchLoc) {
656
- return handle(entry.catchLoc, true);
657
- } else if (this.prev < entry.finallyLoc) {
658
- return handle(entry.finallyLoc);
659
- }
660
-
661
- } else if (hasCatch) {
662
- if (this.prev < entry.catchLoc) {
663
- return handle(entry.catchLoc, true);
664
- }
665
-
666
- } else if (hasFinally) {
667
- if (this.prev < entry.finallyLoc) {
668
- return handle(entry.finallyLoc);
669
- }
670
-
671
- } else {
672
- throw new Error("try statement without catch or finally");
673
- }
674
- }
675
- }
676
- },
677
-
678
- abrupt: function(type, arg) {
679
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
680
- var entry = this.tryEntries[i];
681
- if (entry.tryLoc <= this.prev &&
682
- hasOwn.call(entry, "finallyLoc") &&
683
- this.prev < entry.finallyLoc) {
684
- var finallyEntry = entry;
685
- break;
686
- }
687
- }
688
-
689
- if (finallyEntry &&
690
- (type === "break" ||
691
- type === "continue") &&
692
- finallyEntry.tryLoc <= arg &&
693
- arg <= finallyEntry.finallyLoc) {
694
- // Ignore the finally entry if control is not jumping to a
695
- // location outside the try/catch block.
696
- finallyEntry = null;
697
- }
698
-
699
- var record = finallyEntry ? finallyEntry.completion : {};
700
- record.type = type;
701
- record.arg = arg;
702
-
703
- if (finallyEntry) {
704
- this.method = "next";
705
- this.next = finallyEntry.finallyLoc;
706
- return ContinueSentinel;
707
- }
708
-
709
- return this.complete(record);
710
- },
711
-
712
- complete: function(record, afterLoc) {
713
- if (record.type === "throw") {
714
- throw record.arg;
715
- }
716
-
717
- if (record.type === "break" ||
718
- record.type === "continue") {
719
- this.next = record.arg;
720
- } else if (record.type === "return") {
721
- this.rval = this.arg = record.arg;
722
- this.method = "return";
723
- this.next = "end";
724
- } else if (record.type === "normal" && afterLoc) {
725
- this.next = afterLoc;
726
- }
727
-
728
- return ContinueSentinel;
729
- },
730
-
731
- finish: function(finallyLoc) {
732
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
733
- var entry = this.tryEntries[i];
734
- if (entry.finallyLoc === finallyLoc) {
735
- this.complete(entry.completion, entry.afterLoc);
736
- resetTryEntry(entry);
737
- return ContinueSentinel;
738
- }
739
- }
740
- },
741
-
742
- "catch": function(tryLoc) {
743
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
744
- var entry = this.tryEntries[i];
745
- if (entry.tryLoc === tryLoc) {
746
- var record = entry.completion;
747
- if (record.type === "throw") {
748
- var thrown = record.arg;
749
- resetTryEntry(entry);
750
- }
751
- return thrown;
752
- }
753
- }
754
-
755
- // The context.catch method must only be called with a location
756
- // argument that corresponds to a known catch block.
757
- throw new Error("illegal catch attempt");
758
- },
759
-
760
- delegateYield: function(iterable, resultName, nextLoc) {
761
- this.delegate = {
762
- iterator: values(iterable),
763
- resultName: resultName,
764
- nextLoc: nextLoc
765
- };
766
-
767
- if (this.method === "next") {
768
- // Deliberately forget the last sent value so that we don't
769
- // accidentally pass it on to the delegate.
770
- this.arg = undefined$1;
771
- }
772
-
773
- return ContinueSentinel;
774
- }
775
- };
776
-
777
- // Regardless of whether this script is executing as a CommonJS module
778
- // or not, return the runtime object so that we can declare the variable
779
- // regeneratorRuntime in the outer scope, which allows this module to be
780
- // injected easily by `bin/regenerator --include-runtime script.js`.
781
- return exports;
782
-
783
- }(
784
- // If this script is executing as a CommonJS module, use module.exports
785
- // as the regeneratorRuntime namespace. Otherwise create a new empty
786
- // object. Either way, the resulting object will be used to initialize
787
- // the regeneratorRuntime variable at the top of this file.
788
- module.exports
789
- ));
790
-
791
- try {
792
- regeneratorRuntime = runtime;
793
- } catch (accidentalStrictMode) {
794
- // This module should not be running in strict mode, so the above
795
- // assignment should always work unless something is misconfigured. Just
796
- // in case runtime.js accidentally runs in strict mode, in modern engines
797
- // we can explicitly access globalThis. In older engines we can escape
798
- // strict mode using a global Function call. This could conceivably fail
799
- // if a Content Security Policy forbids using Function, but in that case
800
- // the proper solution is to fix the accidental strict mode problem. If
801
- // you've misconfigured your bundler to force strict mode and applied a
802
- // CSP to forbid Function, and you're not willing to fix either of those
803
- // problems, please detail your unique predicament in a GitHub issue.
804
- if (typeof globalThis === "object") {
805
- globalThis.regeneratorRuntime = runtime;
806
- } else {
807
- Function("r", "regeneratorRuntime = r")(runtime);
808
- }
809
- }
810
- });
811
-
812
- var regenerator = runtime_1;
813
-
814
- /* eslint no-console:0 */
815
-
816
- const set = function (el, cls) {
817
- let avoid = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'noop';
818
- if (!el) return;
819
- if (!cls || cls && cls.length === 0) return;
820
- cls.trim().split(' ').filter(cl => cl !== avoid).forEach(cl => el.classList.add(cl));
821
- };
822
-
823
- /* eslint no-console:0 */
824
-
825
- const getNumberValue = value => parseInt(value, 10);
826
- const normalizeNumberValue = value => {
827
- const _value = parseFloat(value);
828
-
829
- return _value >= 0 && _value < 1 || _value <= 0 && _value > -1 ? 0 : _value;
830
- };
831
- const getSpacing = style => {
832
- const {
833
- marginTop,
834
- marginBottom,
835
- marginLeft,
836
- marginRight,
837
- paddingTop,
838
- paddingBottom,
839
- paddingLeft,
840
- paddingRight
841
- } = style;
842
- return {
843
- marginTop,
844
- marginBottom,
845
- marginLeft,
846
- marginRight,
847
- paddingTop,
848
- paddingBottom,
849
- paddingLeft,
850
- paddingRight
851
- };
852
- };
853
- const getTypography = style => {
854
- const {
855
- lineHeight,
856
- letterSpacing,
857
- fontFamily,
858
- fontSize,
859
- fontStyle,
860
- fontVariationSettings,
861
- fontWeight
862
- } = style;
863
- return {
864
- lineHeight,
865
- letterSpacing,
866
- fontFamily,
867
- fontSize,
868
- fontStyle,
869
- fontVariationSettings,
870
- fontWeight
871
- };
872
- };
873
-
874
- /* eslint no-console:0 */
875
-
876
- const waitForFrame = () => new Promise(requestAnimationFrame);
877
-
878
- const debounce = function (func, wait, immediate) {
879
- var timeout;
880
- return function () {
881
- var context = this,
882
- args = arguments;
883
-
884
- var later = function () {
885
- timeout = null;
886
- if (!immediate) func.apply(context, args);
887
- };
888
-
889
- var callNow = immediate && !timeout;
890
- clearTimeout(timeout);
891
- timeout = setTimeout(later, wait);
892
- if (callNow) func.apply(context, args);
893
- };
894
- };
895
-
896
- /* eslint no-console:0 */
897
- const add = /*#__PURE__*/function () {
898
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(el, styles) {
899
- return regenerator.wrap(function _callee$(_context) {
900
- while (1) switch (_context.prev = _context.next) {
901
- case 0:
902
- if (el) {
903
- _context.next = 2;
904
- break;
905
- }
906
-
907
- return _context.abrupt("return");
908
-
909
- case 2:
910
- if (!(!styles || styles && styles.length === 0 && styles.constructor === String || styles && styles.length === 0 && styles.constructor === Array || styles && Object.keys(styles).length === 0 && styles.constructor === Object)) {
911
- _context.next = 4;
912
- break;
913
- }
914
-
915
- return _context.abrupt("return");
916
-
917
- case 4:
918
- _context.next = 6;
919
- return waitForFrame();
920
-
921
- case 6:
922
- if (typeof styles === 'string' || Array.isArray(styles)) {
923
- styles.forEach(style => el.style[style.key] = style.value);
924
- } else {
925
- Object.keys(styles).forEach(key => el.style[key] = styles[key]);
926
- }
927
-
928
- case 7:
929
- case "end":
930
- return _context.stop();
931
- }
932
- }, _callee);
933
- }));
934
-
935
- return function add(_x, _x2) {
936
- return _ref.apply(this, arguments);
937
- };
938
- }();
939
- const get = /*#__PURE__*/function () {
940
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(el) {
941
- return regenerator.wrap(function _callee2$(_context2) {
942
- while (1) switch (_context2.prev = _context2.next) {
943
- case 0:
944
- _context2.next = 2;
945
- return waitForFrame();
946
-
947
- case 2:
948
- return _context2.abrupt("return", window.getComputedStyle ? getComputedStyle(el, null) : el.currentStyle);
949
-
950
- case 3:
951
- case "end":
952
- return _context2.stop();
953
- }
954
- }, _callee2);
955
- }));
956
-
957
- return function get(_x3) {
958
- return _ref2.apply(this, arguments);
959
- };
960
- }();
961
-
962
- /* eslint no-console:0 */
963
-
964
- const SPECCER_LITERALS = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ'];
965
- const SPECCER_TAGS_TO_AVOID = ['TR', 'TH', 'TD', 'TBODY', 'THEAD', 'TFOOT'];
966
-
967
- /* eslint no-console:0 */
968
- const create$3 = function () {
969
- let text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
970
- let tag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'span';
971
-
972
- const _el = document.createElement(tag);
973
-
974
- const textContent = document.createTextNode(text);
975
-
976
- _el.appendChild(textContent);
977
-
978
- _el.setAttribute('title', text + 'px');
979
-
980
- set(_el, 'ph speccer spacing');
981
- return _el;
982
- };
983
- const element$3 = /*#__PURE__*/function () {
984
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(el) {
985
- var _speccer_el, _el_style, _parent_el_style, _speccer_margin_top_el, _speccer_margin_right_el, _speccer_margin_bottom_el, _speccer_margin_left_el, _speccer_padding_top_el, _speccer_padding_bottom_el, _speccer_padding_right_el, _speccer_padding_left_el;
986
-
987
- return regenerator.wrap(function _callee$(_context) {
988
- while (1) switch (_context.prev = _context.next) {
989
- case 0:
990
- _speccer_el = {};
991
- _context.next = 3;
992
- return get(el);
993
-
994
- case 3:
995
- _el_style = _context.sent;
996
-
997
- if (!(_el_style.display === 'none' || _el_style.visibility === 'hidden')) {
998
- _context.next = 6;
999
- break;
1000
- }
1001
-
1002
- return _context.abrupt("return");
1003
-
1004
- case 6:
1005
- el.classList.add('is-specced');
1006
- _parent_el_style = get(el.parentElement);
1007
-
1008
- if (_parent_el_style.position === 'static') {
1009
- window.requestAnimationFrame(() => {
1010
- el.parentElement.style.position = 'relative';
1011
- });
1012
- }
1013
-
1014
- _speccer_el.styles = getSpacing(_el_style);
1015
- _speccer_el.rect = el.getBoundingClientRect();
1016
-
1017
- if (_speccer_el.styles['marginTop'] !== '0px') {
1018
- _speccer_margin_top_el = create$3(getNumberValue(_speccer_el.styles.marginTop));
1019
- set(_speccer_margin_top_el, 'margin top');
1020
- add(_speccer_margin_top_el, {
1021
- height: _speccer_el.styles.marginTop,
1022
- width: _speccer_el.rect.width + 'px',
1023
- left: normalizeNumberValue(_speccer_el.rect.x - el.parentElement.getBoundingClientRect().x) + 'px',
1024
- top: normalizeNumberValue(_speccer_el.rect.y - el.parentElement.getBoundingClientRect().y - parseInt(_speccer_el.styles.marginTop, 10)) + 'px'
1025
- });
1026
-
1027
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1028
- after(el.closest('table'), _speccer_margin_top_el);
1029
- } else {
1030
- after(el, _speccer_margin_top_el);
1031
- }
1032
- }
1033
-
1034
- if (_speccer_el.styles['marginRight'] !== '0px') {
1035
- _speccer_margin_right_el = create$3(getNumberValue(_speccer_el.styles.marginRight));
1036
- set(_speccer_margin_right_el, 'margin right');
1037
- add(_speccer_margin_right_el, {
1038
- height: _speccer_el.rect.height + 'px',
1039
- width: _speccer_el.styles.marginRight,
1040
- left: normalizeNumberValue(_speccer_el.rect.x - el.parentElement.getBoundingClientRect().x + parseInt(_speccer_el.rect.width, 10)) + 'px',
1041
- top: normalizeNumberValue(_speccer_el.rect.y - el.parentElement.getBoundingClientRect().y) + 'px'
1042
- });
1043
-
1044
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1045
- after(el.closest('table'), _speccer_margin_right_el);
1046
- } else {
1047
- after(el, _speccer_margin_right_el);
1048
- }
1049
- }
1050
-
1051
- if (_speccer_el.styles['marginBottom'] !== '0px') {
1052
- _speccer_margin_bottom_el = create$3(getNumberValue(_speccer_el.styles.marginBottom));
1053
- set(_speccer_margin_bottom_el, 'margin bottom');
1054
- add(_speccer_margin_bottom_el, {
1055
- height: _speccer_el.styles.marginBottom,
1056
- width: _speccer_el.rect.width + 'px',
1057
- left: normalizeNumberValue(_speccer_el.rect.x - el.parentElement.getBoundingClientRect().x) + 'px',
1058
- top: normalizeNumberValue(_speccer_el.rect.y - el.parentElement.getBoundingClientRect().y + parseInt(_speccer_el.rect.height, 10)) + 'px'
1059
- });
1060
-
1061
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1062
- after(el.closest('table'), _speccer_margin_bottom_el);
1063
- } else {
1064
- after(el, _speccer_margin_bottom_el);
1065
- }
1066
- }
1067
-
1068
- if (_speccer_el.styles['marginLeft'] !== '0px') {
1069
- _speccer_margin_left_el = create$3(getNumberValue(_speccer_el.styles.marginLeft));
1070
- set(_speccer_margin_left_el, 'margin left');
1071
- add(_speccer_margin_left_el, {
1072
- height: _speccer_el.rect.height + 'px',
1073
- width: _speccer_el.styles.marginLeft,
1074
- left: normalizeNumberValue(_speccer_el.rect.x - el.parentElement.getBoundingClientRect().x - parseInt(_speccer_el.styles.marginLeft, 10)) + 'px',
1075
- top: normalizeNumberValue(_speccer_el.rect.y - el.parentElement.getBoundingClientRect().y) + 'px'
1076
- });
1077
-
1078
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1079
- after(el.closest('table'), _speccer_margin_left_el);
1080
- } else {
1081
- after(el, _speccer_margin_left_el);
1082
- }
1083
- }
1084
-
1085
- if (_speccer_el.styles['paddingTop'] !== '0px') {
1086
- _speccer_padding_top_el = create$3(getNumberValue(_speccer_el.styles.paddingTop));
1087
- set(_speccer_padding_top_el, 'padding top');
1088
- add(_speccer_padding_top_el, {
1089
- height: _speccer_el.styles.paddingTop,
1090
- width: _speccer_el.rect.width + 'px',
1091
- left: normalizeNumberValue(_speccer_el.rect.x - el.parentElement.getBoundingClientRect().x) + 'px',
1092
- top: normalizeNumberValue(_speccer_el.rect.y - el.parentElement.getBoundingClientRect().y) + 'px'
1093
- });
1094
-
1095
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1096
- after(el.closest('table'), _speccer_padding_top_el);
1097
- } else {
1098
- after(el, _speccer_padding_top_el);
1099
- }
1100
- }
1101
-
1102
- if (_speccer_el.styles['paddingBottom'] !== '0px') {
1103
- _speccer_padding_bottom_el = create$3(getNumberValue(_speccer_el.styles.paddingBottom));
1104
- set(_speccer_padding_bottom_el, 'padding bottom');
1105
- add(_speccer_padding_bottom_el, {
1106
- height: _speccer_el.styles.paddingBottom,
1107
- width: _speccer_el.rect.width + 'px',
1108
- left: normalizeNumberValue(_speccer_el.rect.x - el.parentElement.getBoundingClientRect().x) + 'px',
1109
- top: normalizeNumberValue(_speccer_el.rect.y - el.parentElement.getBoundingClientRect().y + (parseInt(_speccer_el.rect.height, 10) - parseInt(_speccer_el.styles.paddingBottom, 10))) + 'px'
1110
- });
1111
-
1112
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1113
- after(el.closest('table'), _speccer_padding_bottom_el);
1114
- } else {
1115
- after(el, _speccer_padding_bottom_el);
1116
- }
1117
- }
1118
-
1119
- if (_speccer_el.styles['paddingRight'] !== '0px') {
1120
- _speccer_padding_right_el = create$3(getNumberValue(_speccer_el.styles.paddingRight));
1121
- set(_speccer_padding_right_el, 'padding right');
1122
- add(_speccer_padding_right_el, {
1123
- height: _speccer_el.rect.height + 'px',
1124
- width: _speccer_el.styles.paddingRight,
1125
- left: normalizeNumberValue(_speccer_el.rect.x - el.parentElement.getBoundingClientRect().x + (parseInt(_speccer_el.rect.width, 10) - parseInt(_speccer_el.styles.paddingRight, 10))) + 'px',
1126
- top: normalizeNumberValue(_speccer_el.rect.y - el.parentElement.getBoundingClientRect().y) + 'px'
1127
- });
1128
-
1129
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1130
- after(el.closest('table'), _speccer_padding_right_el);
1131
- } else {
1132
- after(el, _speccer_padding_right_el);
1133
- }
1134
- }
1135
-
1136
- if (_speccer_el.styles['paddingLeft'] !== '0px') {
1137
- _speccer_padding_left_el = create$3(getNumberValue(_speccer_el.styles.paddingLeft));
1138
- set(_speccer_padding_left_el, 'padding left');
1139
- add(_speccer_padding_left_el, {
1140
- height: _speccer_el.rect.height + 'px',
1141
- width: _speccer_el.styles.paddingLeft,
1142
- left: normalizeNumberValue(_speccer_el.rect.x - el.parentElement.getBoundingClientRect().x) + 'px',
1143
- top: normalizeNumberValue(_speccer_el.rect.y - el.parentElement.getBoundingClientRect().y) + 'px'
1144
- });
1145
-
1146
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1147
- after(el.closest('table'), _speccer_padding_left_el);
1148
- } else {
1149
- after(el, _speccer_padding_left_el);
1150
- }
1151
- }
1152
-
1153
- case 19:
1154
- case "end":
1155
- return _context.stop();
1156
- }
1157
- }, _callee);
1158
- }));
1159
-
1160
- return function element(_x) {
1161
- return _ref.apply(this, arguments);
1162
- };
1163
- }();
1164
-
1165
- /* eslint no-console:0 */
1166
- const create$2 = function () {
1167
- let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1168
- let t = arguments.length > 1 ? arguments[1] : undefined;
1169
- let n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'span';
1170
-
1171
- const _el = document.createElement(n);
1172
-
1173
- const o = document.createTextNode(e);
1174
-
1175
- if (t.indexOf('full') === -1 && t.indexOf('enclose') === -1) {
1176
- _el.appendChild(o);
1177
- } else if (t.indexOf('full') !== -1 || t.indexOf('enclose') !== -1) {
1178
- _el.setAttribute('data-dissection-counter', e);
1179
- }
1180
-
1181
- set(_el, `ph speccer dissection ${t}`);
1182
- return _el;
1183
- };
1184
- const element$2 = (el, dissectIndex) => {
1185
- const _el_rect = el.getBoundingClientRect();
1186
-
1187
- const _area = el.getAttribute('data-anatomy');
1188
-
1189
- const _dissection_node = create$2(SPECCER_LITERALS[dissectIndex], _area);
1190
-
1191
- const _is_table_correction_needed = SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0;
1192
-
1193
- let _table_top = 0;
1194
- let _table_left = 0;
1195
-
1196
- if (_is_table_correction_needed) {
1197
- const table = el.closest('table');
1198
- const tableStyle = get(table.parentElement);
1199
- after(table, _dissection_node);
1200
-
1201
- const _table_rect = table.getBoundingClientRect();
1202
-
1203
- _table_top = _table_rect.top - parseInt(tableStyle.getPropertyValue('padding-top'), 10);
1204
- _table_left = _table_rect.left - parseInt(tableStyle.getPropertyValue('padding-left'), 10);
1205
- } else {
1206
- after(el, _dissection_node);
1207
- }
1208
-
1209
- const _el_offset_left = el.offsetLeft;
1210
- const _el_offset_top = el.offsetTop;
1211
-
1212
- const _dissection_node_rect = _dissection_node.getBoundingClientRect();
1213
-
1214
- let _outline_left_position_left = (_is_table_correction_needed ? _el_rect.left - _table_left : _el_offset_left) - _dissection_node_rect.width - 48 + 'px';
1215
-
1216
- let _outline_left_position_top = (_is_table_correction_needed ? _el_rect.top - _table_top : _el_offset_top) + _el_rect.height / 2 - _dissection_node_rect.height / 2 + 'px';
1217
-
1218
- let _outline_right_position_left = (_is_table_correction_needed ? _el_rect.left - _table_left : _el_offset_left) + _el_rect.width + 48 + 'px';
1219
-
1220
- let _outline_right_position_top = (_is_table_correction_needed ? _el_rect.top - _table_top : _el_offset_top) + _el_rect.height / 2 - _dissection_node_rect.height / 2 + 'px';
1221
-
1222
- let _outline_top_position_left = (_is_table_correction_needed ? _el_rect.left - _table_left : _el_offset_left) + _el_rect.width / 2 - _dissection_node_rect.width / 2 + 'px';
1223
-
1224
- let _outline_top_position_top = (_is_table_correction_needed ? _el_rect.top - _table_top : _el_offset_top) - _dissection_node_rect.height - 48 + 'px';
1225
-
1226
- let _outline_bottom_position_left = (_is_table_correction_needed ? _el_rect.left - _table_left : _el_offset_left) + _el_rect.width / 2 - _dissection_node_rect.width / 2 + 'px';
1227
-
1228
- let _outline_bottom_position_top = (_is_table_correction_needed ? _el_rect.top - _table_top : _el_offset_top) + _el_rect.height + 48 + 'px';
1229
-
1230
- let _dissection_node_styles = {};
1231
-
1232
- if (_area.indexOf('outline') !== -1) {
1233
- if (_area.indexOf('left') !== -1) {
1234
- if (_area.indexOf('full') !== -1) {
1235
- _dissection_node_styles = {
1236
- left: _el_offset_left - 8 + 'px',
1237
- top: _el_offset_top + -1 + 'px',
1238
- height: _el_rect.height + 'px'
1239
- };
1240
- } else if (_area.indexOf('enclose') !== -1) {
1241
- _dissection_node_styles = {
1242
- left: _el_offset_left - 1 + 'px',
1243
- top: _el_offset_top + -1 + 'px',
1244
- height: _el_rect.height + 'px',
1245
- width: _el_rect.width + 'px'
1246
- };
1247
- } else {
1248
- _dissection_node_styles = {
1249
- left: _outline_left_position_left,
1250
- top: _outline_left_position_top
1251
- };
1252
- }
1253
- } else if (_area.indexOf('right') !== -1) {
1254
- if (_area.indexOf('full') !== -1) {
1255
- _dissection_node_styles = {
1256
- left: _el_offset_left + _el_rect.width + 'px',
1257
- top: _el_offset_top + -1 + 'px',
1258
- height: _el_rect.height + 'px'
1259
- };
1260
- } else if (_area.indexOf('enclose') !== -1) {
1261
- _dissection_node_styles = {
1262
- left: _el_offset_left + -1 + 'px',
1263
- top: _el_offset_top + -1 + 'px',
1264
- height: _el_rect.height + 'px',
1265
- width: _el_rect.width + 'px'
1266
- };
1267
- } else {
1268
- _dissection_node_styles = {
1269
- left: _outline_right_position_left,
1270
- top: _outline_right_position_top
1271
- };
1272
- }
1273
- } else if (_area.indexOf('top') !== -1) {
1274
- if (_area.indexOf('full') !== -1) {
1275
- _dissection_node_styles = {
1276
- top: _el_offset_top + -8 + 'px',
1277
- left: _el_offset_left + -1 + 'px',
1278
- width: _el_rect.width + 'px'
1279
- };
1280
- } else if (_area.indexOf('enclose') !== -1) {
1281
- _dissection_node_styles = {
1282
- top: _el_offset_top + -1 + 'px',
1283
- left: _el_offset_left + -1 + 'px',
1284
- height: _el_rect.height + 'px',
1285
- width: _el_rect.width + 'px'
1286
- };
1287
- } else {
1288
- _dissection_node_styles = {
1289
- left: _outline_top_position_left,
1290
- top: _outline_top_position_top
1291
- };
1292
- }
1293
- } else if (_area.indexOf('bottom') !== -1) {
1294
- if (_area.indexOf('full') !== -1) {
1295
- _dissection_node_styles = {
1296
- top: _el_offset_top + _el_rect.height + 'px',
1297
- left: _el_offset_left + -1 + 'px',
1298
- width: _el_rect.width + 'px'
1299
- };
1300
- } else if (_area.indexOf('enclose') !== -1) {
1301
- _dissection_node_styles = {
1302
- top: _el_offset_top + -1 + 'px',
1303
- left: _el_offset_left + -1 + 'px',
1304
- height: _el_rect.height + 'px',
1305
- width: _el_rect.width + 'px'
1306
- };
1307
- } else {
1308
- _dissection_node_styles = {
1309
- left: _outline_bottom_position_left,
1310
- top: _outline_bottom_position_top
1311
- };
1312
- }
1313
- } else {
1314
- if (_area.indexOf('full') !== -1) {
1315
- _dissection_node_styles = {
1316
- left: _el_offset_left + _el_rect.width + 'px',
1317
- top: _el_offset_top + 'px',
1318
- height: _el_rect.height + 'px'
1319
- };
1320
- } else if (_area.indexOf('enclose') !== -1) {
1321
- _dissection_node_styles = {
1322
- left: _el_offset_left + _el_rect.width + 'px',
1323
- top: _el_offset_top + -1 + 'px',
1324
- height: _el_rect.height + 'px',
1325
- width: _el_rect.width + 'px'
1326
- };
1327
- } else {
1328
- _dissection_node_styles = {
1329
- left: _outline_left_position_left,
1330
- top: _outline_left_position_top
1331
- };
1332
- }
1333
- }
1334
- } else {
1335
- if (_area.indexOf('full') !== -1) {
1336
- _dissection_node_styles = {
1337
- left: _el_offset_left - 8 + 'px',
1338
- top: _el_offset_top + -1 + 'px',
1339
- height: _el_rect.height + 'px'
1340
- };
1341
- } else if (_area.indexOf('enclose') !== -1) {
1342
- _dissection_node_styles = {
1343
- left: _el_offset_left - 1 + 'px',
1344
- top: _el_offset_top + -1 + 'px',
1345
- height: _el_rect.height + 'px',
1346
- width: _el_rect.width + 'px'
1347
- };
1348
- } else {
1349
- _dissection_node_styles = {
1350
- left: _outline_left_position_left,
1351
- top: _outline_left_position_top
1352
- };
1353
- }
1354
- }
1355
-
1356
- add(_dissection_node, _dissection_node_styles);
1357
- };
1358
-
1359
- /* eslint no-console:0 */
1360
-
1361
- const create$1 = function () {
1362
- let text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1363
- let area = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1364
- let tag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'span';
1365
-
1366
- const _el = document.createElement(tag);
1367
-
1368
- _el.setAttribute('title', text + 'px');
1369
-
1370
- _el.setAttribute('data-measure', parseInt(text, 10) + 'px');
1371
-
1372
- set(_el, `ph speccer measure ${area}`);
1373
- return _el;
1374
- };
1375
-
1376
- const element$1 = el => {
1377
- if (!el) return;
1378
-
1379
- const _el_rect = el.getBoundingClientRect();
1380
-
1381
- const _area = el.getAttribute('data-speccer-measure');
1382
-
1383
- if (_area === '') {
1384
- return;
1385
- }
1386
-
1387
- const _el_offset_top = el.offsetTop;
1388
- const _el_offset_left = el.offsetLeft;
1389
-
1390
- if (_area.indexOf('width') !== -1) {
1391
- if (_area.indexOf('bottom') !== -1) {
1392
- const _measure_node = create$1(_el_rect.width, 'width bottom');
1393
-
1394
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1395
- after(el.closest('table'), _measure_node);
1396
- } else {
1397
- after(el, _measure_node);
1398
- }
1399
-
1400
- add(_measure_node, {
1401
- left: _el_offset_left + 'px',
1402
- top: _el_offset_top + _el_rect.height + 1 + 'px',
1403
- width: _el_rect.width + 'px'
1404
- });
1405
- } else {
1406
- const _measure_node = create$1(_el_rect.width, 'width top');
1407
-
1408
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1409
- after(el.closest('table'), _measure_node);
1410
- } else {
1411
- after(el, _measure_node);
1412
- }
1413
-
1414
- const _measure_node_rect = _measure_node.getBoundingClientRect();
1415
-
1416
- add(_measure_node, {
1417
- left: _el_offset_left + 'px',
1418
- top: _el_offset_top - _measure_node_rect.height + 1 + 'px',
1419
- width: _el_rect.width + 'px'
1420
- });
1421
- }
1422
- } else if (_area.indexOf('height') !== -1) {
1423
- if (_area.indexOf('right') !== -1) {
1424
- const _measure_node = create$1(_el_rect.height, 'height right');
1425
-
1426
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1427
- after(el.closest('table'), _measure_node);
1428
- } else {
1429
- after(el, _measure_node);
1430
- }
1431
-
1432
- add(_measure_node, {
1433
- left: _el_offset_left + _el_rect.width + 'px',
1434
- top: _el_offset_top + 'px',
1435
- height: _el_rect.height + 'px'
1436
- });
1437
- } else {
1438
- const _measure_node = create$1(_el_rect.height, 'height left');
1439
-
1440
- if (SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0) {
1441
- after(el.closest('table'), _measure_node);
1442
- } else {
1443
- after(el, _measure_node);
1444
- }
1445
-
1446
- const _measure_node_rect = _measure_node.getBoundingClientRect();
1447
-
1448
- add(_measure_node, {
1449
- left: _el_offset_left - _measure_node_rect.width + 'px',
1450
- top: _el_offset_top + 'px',
1451
- height: _el_rect.height + 'px'
1452
- });
1453
- }
1454
- }
1455
- };
1456
-
1457
- /* eslint no-console:0 */
1458
-
1459
- const to3Decimals = number => parseFloat(number).toFixed(3);
1460
-
1461
- /* eslint no-console:0 */
1462
- const create = (html, area) => {
1463
- const _el = document.createElement('div');
1464
-
1465
- _el.innerHTML = html;
1466
- set(_el, `ph speccer typography ${area}`);
1467
- return _el;
1468
- };
1469
- const element = /*#__PURE__*/function () {
1470
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(el) {
1471
- var _area, _el_style, _parent_style, _styles, _el_rect, html, speccerNode, tableCorrectionTop, tableCorrectionLeft, tableCorrection, table, tableStyle, rectOfSpeccerNode, outlineLeftLeft, outlineLeftTop, outlineRightLeft, outlineRightTop, outlineTopLeft, outlineTopTop, outlineBottomleft, outlineBottomTop, position;
1472
-
1473
- return regenerator.wrap(function _callee$(_context) {
1474
- while (1) switch (_context.prev = _context.next) {
1475
- case 0:
1476
- _area = el.getAttribute('data-speccer-typography');
1477
- _context.next = 3;
1478
- return get(el);
1479
-
1480
- case 3:
1481
- _el_style = _context.sent;
1482
-
1483
- if (!(_el_style.display === 'none' || _el_style.visibility === 'hidden')) {
1484
- _context.next = 6;
1485
- break;
1486
- }
1487
-
1488
- return _context.abrupt("return");
1489
-
1490
- case 6:
1491
- el.classList.add('is-specced');
1492
- _parent_style = get(el.parentElement);
1493
-
1494
- if (_parent_style.position === 'static') {
1495
- window.requestAnimationFrame(() => {
1496
- el.parentElement.style.position = 'relative';
1497
- });
1498
- }
1499
-
1500
- _styles = getTypography(_el_style);
1501
- _el_rect = el.getBoundingClientRect();
1502
- html = `
1503
- ` + 'font-styles: {' + '<ul class="speccer-styles">' + ` <li><span class="property">font-family:</span> ${_styles['fontFamily']};</li>` + ` <li><span class="property">font-size:</span> ${_styles['fontSize']} / ${parseInt(_styles['fontSize'], 10) / 16}rem;</li>` + ` <li><span class="property">font-weight:</span> ${_styles['fontWeight']};</li>` + ` <li><span class="property">font-variation-settings:</span> ${_styles['fontVariationSettings']};</li>` + ` <li><span class="property">line-height:</span> ${_styles['lineHeight']} / ${parseInt(_styles['lineHeight'], 10) / 16}rem;</li>` + ` <li><span class="property">letter-spacing:</span> ${_styles['letterSpacing']};</li>` + ` <li><span class="property">font-style:</span> ${_styles['fontStyle']};</li>` + '</ul>' + '}';
1504
- speccerNode = create(html, _area);
1505
- tableCorrectionTop = 0;
1506
- tableCorrectionLeft = 0;
1507
- tableCorrection = SPECCER_TAGS_TO_AVOID.indexOf(el.nodeName) >= 0;
1508
-
1509
- if (tableCorrection) {
1510
- table = el.parentElement;
1511
- tableStyle = window.getComputedStyle(table.parentElement);
1512
- after(table, speccerNode);
1513
- tableCorrectionTop = table.getBoundingClientRect().top - parseInt(tableStyle.getPropertyValue('padding-top'), 10);
1514
- tableCorrectionLeft = table.getBoundingClientRect().left - parseInt(tableStyle.getPropertyValue('padding-left'), 10);
1515
- } else {
1516
- after(el, speccerNode);
1517
- }
1518
-
1519
- rectOfSpeccerNode = speccerNode.getBoundingClientRect();
1520
- outlineLeftLeft = (tableCorrection ? rectOfSpeccerNode.left - tableCorrectionLeft : el.offsetLeft) - rectOfSpeccerNode.width - 48 + 'px';
1521
- outlineLeftTop = to3Decimals((tableCorrection ? rectOfSpeccerNode.top - tableCorrectionTop : el.offsetTop) - rectOfSpeccerNode.height / 2 + _el_rect.height / 2) + 'px';
1522
- outlineRightLeft = (tableCorrection ? rectOfSpeccerNode.left - tableCorrectionLeft : el.offsetLeft) + _el_rect.width + 48 + 'px';
1523
- outlineRightTop = to3Decimals((tableCorrection ? rectOfSpeccerNode.top - tableCorrectionTop : el.offsetTop) - rectOfSpeccerNode.height / 2 + _el_rect.height / 2) + 'px';
1524
- outlineTopLeft = to3Decimals((tableCorrection ? rectOfSpeccerNode.left - tableCorrectionLeft : el.offsetLeft) - rectOfSpeccerNode.width / 2 + _el_rect.width / 2) + 'px';
1525
- outlineTopTop = (tableCorrection ? rectOfSpeccerNode.top - tableCorrectionTop : el.offsetTop) - rectOfSpeccerNode.height - 48 + 'px';
1526
- outlineBottomleft = to3Decimals((tableCorrection ? rectOfSpeccerNode.left - tableCorrectionLeft : el.offsetLeft) - rectOfSpeccerNode.width / 2 + _el_rect.width / 2) + 'px';
1527
- outlineBottomTop = (tableCorrection ? rectOfSpeccerNode.top - tableCorrectionTop : el.offsetTop) + _el_rect.height + 48 + 'px';
1528
- position = {
1529
- left: outlineLeftLeft,
1530
- top: outlineLeftTop
1531
- };
1532
-
1533
- if (_area.indexOf('right') !== -1) {
1534
- position = {
1535
- left: outlineRightLeft,
1536
- top: outlineRightTop
1537
- };
1538
- } else if (_area.indexOf('top') !== -1) {
1539
- position = {
1540
- left: outlineTopLeft,
1541
- top: outlineTopTop
1542
- };
1543
- } else if (_area.indexOf('bottom') !== -1) {
1544
- position = {
1545
- left: outlineBottomleft,
1546
- top: outlineBottomTop
1547
- };
1548
- }
1549
-
1550
- add(speccerNode, position);
1551
-
1552
- case 29:
1553
- case "end":
1554
- return _context.stop();
1555
- }
1556
- }, _callee);
1557
- }));
1558
-
1559
- return function element(_x) {
1560
- return _ref.apply(this, arguments);
1561
- };
1562
- }();
1563
-
1564
- /* eslint no-console:0 */
1565
- const activate$1 = speccer => {
1566
- const speccerEventFunc = debounce(() => {
1567
- speccer();
1568
- }, 300);
1569
- window.removeEventListener('resize', speccerEventFunc);
1570
- window.addEventListener('resize', speccerEventFunc);
1571
- };
1572
-
1573
- /* eslint no-console:0 */
1574
- const dom = speccer => {
1575
- if (document.readyState === 'loading') {
1576
- document.addEventListener('DOMContentLoaded', speccer);
1577
- } else {
1578
- // `DOMContentLoaded` already fired
1579
- speccer();
1580
- }
1581
- };
1582
- const lazy = () => {
1583
- let _spec_observer = new IntersectionObserver((els, observer) => {
1584
- els.forEach(el => {
1585
- if (el.intersectionRatio > 0) {
1586
- element$3(el.target);
1587
- observer.unobserve(el.target);
1588
- }
1589
- });
1590
- });
1591
-
1592
- document.querySelectorAll('[data-speccer],[data-speccer] *:not(td)').forEach(el => {
1593
- _spec_observer.observe(el);
1594
- });
1595
-
1596
- let _measure_observer = new IntersectionObserver((els, observer) => {
1597
- els.forEach(el => {
1598
- if (el.intersectionRatio > 0) {
1599
- element$1(el.target);
1600
- observer.unobserve(el.target);
1601
- }
1602
- });
1603
- });
1604
-
1605
- document.querySelectorAll('[data-speccer-measure]').forEach(el => {
1606
- _measure_observer.observe(el);
1607
- });
1608
-
1609
- let _dissect_observer = new IntersectionObserver((els, observer) => {
1610
- els.forEach(el => {
1611
- const targets = el.target.querySelectorAll('[data-anatomy]');
1612
-
1613
- if (el.intersectionRatio > 0) {
1614
- targets.forEach(element$2);
1615
- observer.unobserve(el.target);
1616
- }
1617
- });
1618
- });
1619
-
1620
- document.querySelectorAll('[data-anatomy-section]').forEach(el => {
1621
- _dissect_observer.observe(el);
1622
- });
1623
- };
1624
- const manual = speccer => {
1625
- window.speccer = speccer;
1626
- };
1627
- const activate = speccer => {
1628
- const _script = document.currentScript;
1629
-
1630
- if (_script) {
1631
- const _speccer_script_src = _script.getAttribute('src');
1632
-
1633
- if (_speccer_script_src.indexOf('speccer.js') !== -1 || // for codepen
1634
- _speccer_script_src.indexOf('JaXpOK.js') !== -1) {
1635
- if (_script.hasAttribute('data-manual')) {
1636
- manual(speccer);
1637
- } else if (_script.hasAttribute('data-instant')) {
1638
- speccer();
1639
- } else if (_script.hasAttribute('data-dom')) {
1640
- dom(speccer);
1641
- } else if (_script.hasAttribute('data-lazy')) {
1642
- lazy();
1643
- } else {
1644
- dom(speccer);
1645
- }
1646
-
1647
- if (!_script.hasAttribute('data-manual') && !_script.hasAttribute('data-lazy')) {
1648
- activate$1(speccer);
1649
- }
1650
- }
1651
- }
1652
- };
1653
-
1654
- /* eslint no-console:0 */
1655
-
1656
- const speccer = () => {
1657
- removeAll('.speccer');
1658
- removeAll('.dissection');
1659
-
1660
- const _els_to_be_specced = document.querySelectorAll('[data-speccer],[data-speccer] *:not(td)');
1661
-
1662
- const _els_to_be_measured = document.querySelectorAll('[data-speccer-measure]');
1663
-
1664
- const _els_to_be_typography_specced = document.querySelectorAll('[data-speccer-typography]');
1665
-
1666
- const _els_to_be_dissected = document.querySelectorAll('[data-anatomy-section] [data-anatomy]');
1667
-
1668
- _els_to_be_specced.forEach(element$3);
1669
-
1670
- _els_to_be_measured.forEach(element$1);
1671
-
1672
- _els_to_be_typography_specced.forEach(element);
1673
-
1674
- _els_to_be_dissected.forEach(element$2);
1675
- };
1676
- activate(speccer);
1677
-
1678
- return speccer;
1679
-
1680
- }));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).speccer={})}(this,(function(t){"use strict";const e=(t,e)=>t.insertAdjacentElement("afterend",e),n=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;[].forEach.call(e.querySelectorAll(t),(function(t){t.remove()}))};function r(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(r,i)}function i(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var a=t.apply(e,n);function c(t){r(a,i,o,c,s,"next",t)}function s(t){r(a,i,o,c,s,"throw",t)}c(void 0)}))}}var o=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof x?e:x,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(t,e,n){var r=h;return function(i,o){if(r===d)throw new Error("Generator is already running");if(r===u){if("throw"===i)throw o;return C()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=R(a,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=u,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var s=p(t,e,n);if("normal"===s.type){if(r=n.done?u:f,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=u,n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h="suspendedStart",f="suspendedYield",d="executing",u="completed",g={};function x(){}function y(){}function m(){}var w={};s(w,o,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(A([])));b&&b!==n&&r.call(b,o)&&(w=b);var O=m.prototype=x.prototype=Object.create(w);function E(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function n(i,o,a,c){var s=p(t[i],t,o);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(s.arg)}var i;this._invoke=function(t,r){function o(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(o,o):o()}}function R(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,R(t,n),"throw"===n.method))return g;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=p(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var o=i.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function A(t){if(t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}return{next:C}}function C(){return{value:e,done:!0}}return y.prototype=m,s(O,"constructor",m),s(m,"constructor",y),y.displayName=s(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,s(t,c,"GeneratorFunction")),t.prototype=Object.create(O),t},t.awrap=function(t){return{__await:t}},E(L.prototype),s(L.prototype,a,(function(){return this})),t.AsyncIterator=L,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new L(l(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(O),s(O,c,"Generator"),s(O,o,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=A,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return c.type="throw",c.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}})),a=o;const c=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"noop";t&&(!e||e&&0===e.length||e.trim().split(" ").filter((t=>t!==n)).forEach((e=>t.classList.add(e))))},s=t=>parseInt(t,10),l=t=>{const e=parseFloat(t);return e>=0&&e<1||e<=0&&e>-1?0:e},p=t=>{const{marginTop:e,marginBottom:n,marginLeft:r,marginRight:i,paddingTop:o,paddingBottom:a,paddingLeft:c,paddingRight:s}=t;return{marginTop:e,marginBottom:n,marginLeft:r,marginRight:i,paddingTop:o,paddingBottom:a,paddingLeft:c,paddingRight:s}},h=t=>{const{lineHeight:e,letterSpacing:n,fontFamily:r,fontSize:i,fontStyle:o,fontVariationSettings:a,fontWeight:c}=t;return{lineHeight:e,letterSpacing:n,fontFamily:r,fontSize:i,fontStyle:o,fontVariationSettings:a,fontWeight:c}},f=()=>new Promise(requestAnimationFrame),d=function(){var t=i(a.mark((function t(e,n){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return");case 2:if(!(!n||n&&0===n.length&&n.constructor===String||n&&0===n.length&&n.constructor===Array||n&&0===Object.keys(n).length&&n.constructor===Object)){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,f();case 6:"string"==typeof n||Array.isArray(n)?n.forEach((t=>e.style[t.key]=t.value)):Object.keys(n).forEach((t=>e.style[t]=n[t]));case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),u=function(){var t=i(a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f();case 2:return t.abrupt("return",window.getComputedStyle?getComputedStyle(e,null):e.currentStyle);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),g=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"],x=["TR","TH","TD","TBODY","THEAD","TFOOT"],y=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"span";const n=document.createElement(e),r=document.createTextNode(t);return n.appendChild(r),n.setAttribute("title",t+"px"),c(n,"ph speccer spacing"),n},m=function(){var t=i(a.mark((function t(n){var r,i,o,h,f,g,m,w,v,b;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={},t.next=3,u(n);case 3:if("none"!==(i=t.sent).display&&"hidden"!==i.visibility){t.next=6;break}return t.abrupt("return");case 6:n.classList.add("is-specced"),"static"===u(n.parentElement).position&&window.requestAnimationFrame((()=>{n.parentElement.style.position="relative"})),r.styles=p(i),r.rect=n.getBoundingClientRect(),"0px"!==r.styles.marginTop&&(o=y(s(r.styles.marginTop)),c(o,"margin top"),d(o,{height:r.styles.marginTop,width:r.rect.width+"px",left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y-parseInt(r.styles.marginTop,10))+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),o):e(n,o)),"0px"!==r.styles.marginRight&&(h=y(s(r.styles.marginRight)),c(h,"margin right"),d(h,{height:r.rect.height+"px",width:r.styles.marginRight,left:l(r.rect.x-n.parentElement.getBoundingClientRect().x+parseInt(r.rect.width,10))+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),h):e(n,h)),"0px"!==r.styles.marginBottom&&(f=y(s(r.styles.marginBottom)),c(f,"margin bottom"),d(f,{height:r.styles.marginBottom,width:r.rect.width+"px",left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y+parseInt(r.rect.height,10))+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),f):e(n,f)),"0px"!==r.styles.marginLeft&&(g=y(s(r.styles.marginLeft)),c(g,"margin left"),d(g,{height:r.rect.height+"px",width:r.styles.marginLeft,left:l(r.rect.x-n.parentElement.getBoundingClientRect().x-parseInt(r.styles.marginLeft,10))+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),g):e(n,g)),"0px"!==r.styles.paddingTop&&(m=y(s(r.styles.paddingTop)),c(m,"padding top"),d(m,{height:r.styles.paddingTop,width:r.rect.width+"px",left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),m):e(n,m)),"0px"!==r.styles.paddingBottom&&(w=y(s(r.styles.paddingBottom)),c(w,"padding bottom"),d(w,{height:r.styles.paddingBottom,width:r.rect.width+"px",left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y+(parseInt(r.rect.height,10)-parseInt(r.styles.paddingBottom,10)))+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),w):e(n,w)),"0px"!==r.styles.paddingRight&&(v=y(s(r.styles.paddingRight)),c(v,"padding right"),d(v,{height:r.rect.height+"px",width:r.styles.paddingRight,left:l(r.rect.x-n.parentElement.getBoundingClientRect().x+(parseInt(r.rect.width,10)-parseInt(r.styles.paddingRight,10)))+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),v):e(n,v)),"0px"!==r.styles.paddingLeft&&(b=y(s(r.styles.paddingLeft)),c(b,"padding left"),d(b,{height:r.rect.height+"px",width:r.styles.paddingLeft,left:l(r.rect.x-n.parentElement.getBoundingClientRect().x)+"px",top:l(r.rect.y-n.parentElement.getBoundingClientRect().y)+"px"}),x.indexOf(n.nodeName)>=0?e(n.closest("table"),b):e(n,b));case 19:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();var w=Object.freeze({__proto__:null,create:y,element:m});const v=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"span";const r=document.createElement(n),i=document.createTextNode(t);return-1===e.indexOf("full")&&-1===e.indexOf("enclose")?r.appendChild(i):-1===e.indexOf("full")&&-1===e.indexOf("enclose")||r.setAttribute("data-dissection-counter",t),c(r,`ph speccer dissection ${e}`),r},b=(t,n)=>{const r=t.getBoundingClientRect(),i=t.getAttribute("data-anatomy"),o=v(g[n],i),a=x.indexOf(t.nodeName)>=0;let c=0,s=0;if(a){const n=t.closest("table"),r=u(n.parentElement);e(n,o);const i=n.getBoundingClientRect();c=i.top-parseInt(r.getPropertyValue("padding-top"),10),s=i.left-parseInt(r.getPropertyValue("padding-left"),10)}else e(t,o);const l=t.offsetLeft,p=t.offsetTop,h=o.getBoundingClientRect();let f=(a?r.left-s:l)-h.width-48+"px",y=(a?r.top-c:p)+r.height/2-h.height/2+"px",m=(a?r.left-s:l)+r.width+48+"px",w=(a?r.top-c:p)+r.height/2-h.height/2+"px",b=(a?r.left-s:l)+r.width/2-h.width/2+"px",O=(a?r.top-c:p)-h.height-48+"px",E=(a?r.left-s:l)+r.width/2-h.width/2+"px",L=(a?r.top-c:p)+r.height+48+"px",R={};R=-1!==i.indexOf("outline")?-1!==i.indexOf("left")?-1!==i.indexOf("full")?{left:l-8+"px",top:p+-1+"px",height:r.height+"px"}:-1!==i.indexOf("enclose")?{left:l-1+"px",top:p+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:f,top:y}:-1!==i.indexOf("right")?-1!==i.indexOf("full")?{left:l+r.width+"px",top:p+-1+"px",height:r.height+"px"}:-1!==i.indexOf("enclose")?{left:l+-1+"px",top:p+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:m,top:w}:-1!==i.indexOf("top")?-1!==i.indexOf("full")?{top:p+-8+"px",left:l+-1+"px",width:r.width+"px"}:-1!==i.indexOf("enclose")?{top:p+-1+"px",left:l+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:b,top:O}:-1!==i.indexOf("bottom")?-1!==i.indexOf("full")?{top:p+r.height+"px",left:l+-1+"px",width:r.width+"px"}:-1!==i.indexOf("enclose")?{top:p+-1+"px",left:l+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:E,top:L}:-1!==i.indexOf("full")?{left:l+r.width+"px",top:p+"px",height:r.height+"px"}:-1!==i.indexOf("enclose")?{left:l+r.width+"px",top:p+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:f,top:y}:-1!==i.indexOf("full")?{left:l-8+"px",top:p+-1+"px",height:r.height+"px"}:-1!==i.indexOf("enclose")?{left:l-1+"px",top:p+-1+"px",height:r.height+"px",width:r.width+"px"}:{left:f,top:y},d(o,R)};var O=Object.freeze({__proto__:null,create:v,element:b});const E=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"span";const r=document.createElement(n);return r.setAttribute("title",t+"px"),r.setAttribute("data-measure",parseInt(t,10)+"px"),c(r,`ph speccer measure ${e}`),r},L=t=>{if(!t)return;const n=t.getBoundingClientRect(),r=t.getAttribute("data-speccer-measure");if(""===r)return;const i=t.offsetTop,o=t.offsetLeft;if(-1!==r.indexOf("width"))if(-1!==r.indexOf("bottom")){const r=E(n.width,"width bottom");x.indexOf(t.nodeName)>=0?e(t.closest("table"),r):e(t,r),d(r,{left:o+"px",top:i+n.height+1+"px",width:n.width+"px"})}else{const r=E(n.width,"width top");x.indexOf(t.nodeName)>=0?e(t.closest("table"),r):e(t,r);const a=r.getBoundingClientRect();d(r,{left:o+"px",top:i-a.height+1+"px",width:n.width+"px"})}else if(-1!==r.indexOf("height"))if(-1!==r.indexOf("right")){const r=E(n.height,"height right");x.indexOf(t.nodeName)>=0?e(t.closest("table"),r):e(t,r),d(r,{left:o+n.width+"px",top:i+"px",height:n.height+"px"})}else{const r=E(n.height,"height left");x.indexOf(t.nodeName)>=0?e(t.closest("table"),r):e(t,r);const a=r.getBoundingClientRect();d(r,{left:o-a.width+"px",top:i+"px",height:n.height+"px"})}};var R=Object.freeze({__proto__:null,element:L});const B=t=>parseFloat(t).toFixed(3),T=(t,e)=>{const n=document.createElement("div");return n.innerHTML=t,c(n,`ph speccer typography ${e}`),n},S=function(){var t=i(a.mark((function t(n){var r,i,o,c,s,l,p,f,g,y,m,w,v,b,O,E,L,R,S,A,C;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.getAttribute("data-speccer-typography"),t.next=3,u(n);case 3:if("none"!==(i=t.sent).display&&"hidden"!==i.visibility){t.next=6;break}return t.abrupt("return");case 6:n.classList.add("is-specced"),"static"===u(n.parentElement).position&&window.requestAnimationFrame((()=>{n.parentElement.style.position="relative"})),o=h(i),c=n.getBoundingClientRect(),s=`\n font-styles: {<ul class="speccer-styles"> <li><span class="property">font-family:</span> ${o.fontFamily};</li> <li><span class="property">font-size:</span> ${o.fontSize} / ${parseInt(o.fontSize,10)/16}rem;</li> <li><span class="property">font-weight:</span> ${o.fontWeight};</li> <li><span class="property">font-variation-settings:</span> ${o.fontVariationSettings};</li> <li><span class="property">line-height:</span> ${o.lineHeight} / ${parseInt(o.lineHeight,10)/16}rem;</li> <li><span class="property">letter-spacing:</span> ${o.letterSpacing};</li> <li><span class="property">font-style:</span> ${o.fontStyle};</li></ul>}`,l=T(s,r),p=0,f=0,(g=x.indexOf(n.nodeName)>=0)?(y=n.parentElement,m=window.getComputedStyle(y.parentElement),e(y,l),p=y.getBoundingClientRect().top-parseInt(m.getPropertyValue("padding-top"),10),f=y.getBoundingClientRect().left-parseInt(m.getPropertyValue("padding-left"),10)):e(n,l),w=l.getBoundingClientRect(),v=(g?w.left-f:n.offsetLeft)-w.width-48+"px",b=B((g?w.top-p:n.offsetTop)-w.height/2+c.height/2)+"px",O=(g?w.left-f:n.offsetLeft)+c.width+48+"px",E=B((g?w.top-p:n.offsetTop)-w.height/2+c.height/2)+"px",L=B((g?w.left-f:n.offsetLeft)-w.width/2+c.width/2)+"px",R=(g?w.top-p:n.offsetTop)-w.height-48+"px",S=B((g?w.left-f:n.offsetLeft)-w.width/2+c.width/2)+"px",A=(g?w.top-p:n.offsetTop)+c.height+48+"px",C={left:v,top:b},-1!==r.indexOf("right")?C={left:O,top:E}:-1!==r.indexOf("top")?C={left:L,top:R}:-1!==r.indexOf("bottom")&&(C={left:S,top:A}),d(l,C);case 29:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();const A=t=>{const e=(n=()=>{t()},r=300,function(){var t=this,e=arguments,a=function(){o=null,i||n.apply(t,e)},c=i&&!o;clearTimeout(o),o=setTimeout(a,r),c&&n.apply(t,e)});var n,r,i,o;window.removeEventListener("resize",e),window.addEventListener("resize",e)},C=t=>{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()},_=()=>{n(".speccer"),n(".dissection");const t=document.querySelectorAll("[data-speccer],[data-speccer] *:not(td)"),e=document.querySelectorAll("[data-speccer-measure]"),r=document.querySelectorAll("[data-speccer-typography]"),i=document.querySelectorAll("[data-anatomy-section] [data-anatomy]");t.forEach(m),e.forEach(L),r.forEach(S),i.forEach(b)},N=w,j=O,I=R,k=Object.freeze({__proto__:null,create:T,element:S});(t=>{const e=document.currentScript;if(e){const n=e.getAttribute("src");-1===n.indexOf("speccer.js")&&-1===n.indexOf("JaXpOK.js")||(e.hasAttribute("data-manual")?(t=>{window.speccer=t})(t):e.hasAttribute("data-instant")?t():e.hasAttribute("data-dom")?C(t):e.hasAttribute("data-lazy")?(()=>{let t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{t.intersectionRatio>0&&(m(t.target),e.unobserve(t.target))}))}));document.querySelectorAll("[data-speccer],[data-speccer] *:not(td)").forEach((e=>{t.observe(e)}));let e=new IntersectionObserver(((t,e)=>{t.forEach((t=>{t.intersectionRatio>0&&(L(t.target),e.unobserve(t.target))}))}));document.querySelectorAll("[data-speccer-measure]").forEach((t=>{e.observe(t)}));let n=new IntersectionObserver(((t,e)=>{t.forEach((t=>{const n=t.target.querySelectorAll("[data-anatomy]");t.intersectionRatio>0&&(n.forEach(b),e.unobserve(t.target))}))}));document.querySelectorAll("[data-anatomy-section]").forEach((t=>{n.observe(t)}))})():C(t),e.hasAttribute("data-manual")||e.hasAttribute("data-lazy")||A(t))}})(_),t.default=_,t.dissect=j,t.measure=I,t.spacing=N,t.typography=k,Object.defineProperty(t,"__esModule",{value:!0})}));