Subversion Repositories oidplus

Rev

Rev 637 | Rev 759 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 637 Rev 679
Line 2... Line 2...
2
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
2
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
3
 * Licensed under the LGPL or a commercial license.
3
 * Licensed under the LGPL or a commercial license.
4
 * For LGPL see License.txt in the project root for license information.
4
 * For LGPL see License.txt in the project root for license information.
5
 * For commercial licenses see https://www.tiny.cloud/
5
 * For commercial licenses see https://www.tiny.cloud/
6
 *
6
 *
7
 * Version: 5.9.2 (2021-09-08)
7
 * Version: 5.10.2 (2021-11-17)
8
 */
8
 */
9
(function () {
9
(function () {
10
    'use strict';
10
    'use strict';
11
 
11
 
12
    var typeOf = function (x) {
12
    var typeOf = function (x) {
Line 119... Line 119...
119
      };
119
      };
120
    };
120
    };
121
    var never = constant$1(false);
121
    var never = constant$1(false);
122
    var always = constant$1(true);
122
    var always = constant$1(true);
123
 
123
 
124
    var global$h = tinymce.util.Tools.resolve('tinymce.ThemeManager');
124
    var global$g = tinymce.util.Tools.resolve('tinymce.ThemeManager');
125
 
125
 
126
    var __assign = function () {
126
    var __assign = function () {
127
      __assign = Object.assign || function __assign(t) {
127
      __assign = Object.assign || function __assign(t) {
128
        for (var s, i = 1, n = arguments.length; i < n; i++) {
128
        for (var s, i = 1, n = arguments.length; i < n; i++) {
129
          s = arguments[i];
129
          s = arguments[i];
Line 432... Line 432...
432
        }
432
        }
433
      }
433
      }
434
      return Optional.none();
434
      return Optional.none();
435
    };
435
    };
436
 
436
 
-
 
437
    var keys = Object.keys;
-
 
438
    var hasOwnProperty = Object.hasOwnProperty;
-
 
439
    var each = function (obj, f) {
-
 
440
      var props = keys(obj);
-
 
441
      for (var k = 0, len = props.length; k < len; k++) {
-
 
442
        var i = props[k];
-
 
443
        var x = obj[i];
-
 
444
        f(x, i);
-
 
445
      }
-
 
446
    };
-
 
447
    var map$1 = function (obj, f) {
-
 
448
      return tupleMap(obj, function (x, i) {
-
 
449
        return {
-
 
450
          k: i,
-
 
451
          v: f(x, i)
-
 
452
        };
-
 
453
      });
-
 
454
    };
-
 
455
    var tupleMap = function (obj, f) {
-
 
456
      var r = {};
-
 
457
      each(obj, function (x, i) {
-
 
458
        var tuple = f(x, i);
-
 
459
        r[tuple.k] = tuple.v;
-
 
460
      });
-
 
461
      return r;
-
 
462
    };
-
 
463
    var objAcc = function (r) {
-
 
464
      return function (x, i) {
-
 
465
        r[i] = x;
-
 
466
      };
-
 
467
    };
-
 
468
    var internalFilter = function (obj, pred, onTrue, onFalse) {
-
 
469
      var r = {};
-
 
470
      each(obj, function (x, i) {
-
 
471
        (pred(x, i) ? onTrue : onFalse)(x, i);
-
 
472
      });
-
 
473
      return r;
-
 
474
    };
-
 
475
    var filter$1 = function (obj, pred) {
-
 
476
      var t = {};
-
 
477
      internalFilter(obj, pred, objAcc(t), noop);
-
 
478
      return t;
-
 
479
    };
-
 
480
    var mapToArray = function (obj, f) {
-
 
481
      var r = [];
-
 
482
      each(obj, function (value, name) {
-
 
483
        r.push(f(value, name));
-
 
484
      });
-
 
485
      return r;
-
 
486
    };
-
 
487
    var find$4 = function (obj, pred) {
-
 
488
      var props = keys(obj);
-
 
489
      for (var k = 0, len = props.length; k < len; k++) {
-
 
490
        var i = props[k];
-
 
491
        var x = obj[i];
-
 
492
        if (pred(x, i, obj)) {
-
 
493
          return Optional.some(x);
-
 
494
        }
-
 
495
      }
-
 
496
      return Optional.none();
-
 
497
    };
-
 
498
    var values = function (obj) {
-
 
499
      return mapToArray(obj, identity$1);
-
 
500
    };
-
 
501
    var get$e = function (obj, key) {
-
 
502
      return has$2(obj, key) ? Optional.from(obj[key]) : Optional.none();
-
 
503
    };
-
 
504
    var has$2 = function (obj, key) {
-
 
505
      return hasOwnProperty.call(obj, key);
-
 
506
    };
-
 
507
    var hasNonNullableKey = function (obj, key) {
-
 
508
      return has$2(obj, key) && obj[key] !== undefined && obj[key] !== null;
-
 
509
    };
-
 
510
 
-
 
511
    var is$1 = function (lhs, rhs, comparator) {
-
 
512
      if (comparator === void 0) {
-
 
513
        comparator = tripleEquals;
-
 
514
      }
-
 
515
      return lhs.exists(function (left) {
-
 
516
        return comparator(left, rhs);
-
 
517
      });
-
 
518
    };
-
 
519
    var equals = function (lhs, rhs, comparator) {
-
 
520
      if (comparator === void 0) {
-
 
521
        comparator = tripleEquals;
-
 
522
      }
-
 
523
      return lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone());
-
 
524
    };
-
 
525
    var cat = function (arr) {
-
 
526
      var r = [];
-
 
527
      var push = function (x) {
-
 
528
        r.push(x);
-
 
529
      };
-
 
530
      for (var i = 0; i < arr.length; i++) {
-
 
531
        arr[i].each(push);
-
 
532
      }
-
 
533
      return r;
-
 
534
    };
-
 
535
    var sequence = function (arr) {
-
 
536
      var r = [];
-
 
537
      for (var i = 0; i < arr.length; i++) {
-
 
538
        var x = arr[i];
-
 
539
        if (x.isSome()) {
-
 
540
          r.push(x.getOrDie());
-
 
541
        } else {
-
 
542
          return Optional.none();
-
 
543
        }
-
 
544
      }
-
 
545
      return Optional.some(r);
-
 
546
    };
-
 
547
    var lift2 = function (oa, ob, f) {
-
 
548
      return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();
-
 
549
    };
-
 
550
    var lift3 = function (oa, ob, oc, f) {
-
 
551
      return oa.isSome() && ob.isSome() && oc.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Optional.none();
-
 
552
    };
-
 
553
    var mapFrom = function (a, f) {
-
 
554
      return a !== undefined && a !== null ? Optional.some(f(a)) : Optional.none();
-
 
555
    };
-
 
556
    var someIf = function (b, a) {
-
 
557
      return b ? Optional.some(a) : Optional.none();
-
 
558
    };
-
 
559
 
-
 
560
    var addToEnd = function (str, suffix) {
-
 
561
      return str + suffix;
-
 
562
    };
-
 
563
    var removeFromStart = function (str, numChars) {
-
 
564
      return str.substring(numChars);
-
 
565
    };
-
 
566
 
-
 
567
    var checkRange = function (str, substr, start) {
-
 
568
      return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
-
 
569
    };
-
 
570
    var removeLeading = function (str, prefix) {
-
 
571
      return startsWith(str, prefix) ? removeFromStart(str, prefix.length) : str;
-
 
572
    };
-
 
573
    var ensureTrailing = function (str, suffix) {
-
 
574
      return endsWith(str, suffix) ? str : addToEnd(str, suffix);
-
 
575
    };
-
 
576
    var contains$1 = function (str, substr) {
-
 
577
      return str.indexOf(substr) !== -1;
-
 
578
    };
-
 
579
    var startsWith = function (str, prefix) {
-
 
580
      return checkRange(str, prefix, 0);
-
 
581
    };
-
 
582
    var endsWith = function (str, suffix) {
-
 
583
      return checkRange(str, suffix, str.length - suffix.length);
-
 
584
    };
-
 
585
    var blank = function (r) {
-
 
586
      return function (s) {
-
 
587
        return s.replace(r, '');
-
 
588
      };
-
 
589
    };
-
 
590
    var trim$1 = blank(/^\s+|\s+$/g);
-
 
591
    var isNotEmpty = function (s) {
-
 
592
      return s.length > 0;
-
 
593
    };
-
 
594
    var isEmpty = function (s) {
-
 
595
      return !isNotEmpty(s);
-
 
596
    };
-
 
597
 
-
 
598
    var isSupported$1 = function (dom) {
-
 
599
      return dom.style !== undefined && isFunction(dom.style.getPropertyValue);
-
 
600
    };
-
 
601
 
-
 
602
    var fromHtml$2 = function (html, scope) {
-
 
603
      var doc = scope || document;
-
 
604
      var div = doc.createElement('div');
-
 
605
      div.innerHTML = html;
-
 
606
      if (!div.hasChildNodes() || div.childNodes.length > 1) {
-
 
607
        console.error('HTML does not have a single root node', html);
-
 
608
        throw new Error('HTML must have a single root node');
-
 
609
      }
-
 
610
      return fromDom(div.childNodes[0]);
-
 
611
    };
-
 
612
    var fromTag = function (tag, scope) {
-
 
613
      var doc = scope || document;
-
 
614
      var node = doc.createElement(tag);
-
 
615
      return fromDom(node);
-
 
616
    };
-
 
617
    var fromText = function (text, scope) {
-
 
618
      var doc = scope || document;
-
 
619
      var node = doc.createTextNode(text);
-
 
620
      return fromDom(node);
-
 
621
    };
-
 
622
    var fromDom = function (node) {
-
 
623
      if (node === null || node === undefined) {
-
 
624
        throw new Error('Node cannot be null or undefined');
-
 
625
      }
-
 
626
      return { dom: node };
-
 
627
    };
-
 
628
    var fromPoint = function (docElm, x, y) {
-
 
629
      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
-
 
630
    };
-
 
631
    var SugarElement = {
-
 
632
      fromHtml: fromHtml$2,
-
 
633
      fromTag: fromTag,
-
 
634
      fromText: fromText,
-
 
635
      fromDom: fromDom,
-
 
636
      fromPoint: fromPoint
-
 
637
    };
-
 
638
 
-
 
639
    typeof window !== 'undefined' ? window : Function('return this;')();
-
 
640
 
-
 
641
    var DOCUMENT = 9;
-
 
642
    var DOCUMENT_FRAGMENT = 11;
-
 
643
    var ELEMENT = 1;
-
 
644
    var TEXT = 3;
-
 
645
 
-
 
646
    var name$2 = function (element) {
-
 
647
      var r = element.dom.nodeName;
-
 
648
      return r.toLowerCase();
-
 
649
    };
-
 
650
    var type = function (element) {
-
 
651
      return element.dom.nodeType;
-
 
652
    };
-
 
653
    var isType = function (t) {
-
 
654
      return function (element) {
-
 
655
        return type(element) === t;
-
 
656
      };
-
 
657
    };
-
 
658
    var isElement$2 = isType(ELEMENT);
-
 
659
    var isText$1 = isType(TEXT);
-
 
660
    var isDocument = isType(DOCUMENT);
-
 
661
    var isDocumentFragment = isType(DOCUMENT_FRAGMENT);
-
 
662
 
-
 
663
    var cached = function (f) {
-
 
664
      var called = false;
-
 
665
      var r;
-
 
666
      return function () {
-
 
667
        var args = [];
-
 
668
        for (var _i = 0; _i < arguments.length; _i++) {
-
 
669
          args[_i] = arguments[_i];
-
 
670
        }
-
 
671
        if (!called) {
-
 
672
          called = true;
-
 
673
          r = f.apply(null, args);
-
 
674
        }
-
 
675
        return r;
-
 
676
      };
-
 
677
    };
-
 
678
 
-
 
679
    var DeviceType = function (os, browser, userAgent, mediaMatch) {
-
 
680
      var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
-
 
681
      var isiPhone = os.isiOS() && !isiPad;
-
 
682
      var isMobile = os.isiOS() || os.isAndroid();
-
 
683
      var isTouch = isMobile || mediaMatch('(pointer:coarse)');
-
 
684
      var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');
-
 
685
      var isPhone = isiPhone || isMobile && !isTablet;
-
 
686
      var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
-
 
687
      var isDesktop = !isPhone && !isTablet && !iOSwebview;
-
 
688
      return {
-
 
689
        isiPad: constant$1(isiPad),
-
 
690
        isiPhone: constant$1(isiPhone),
-
 
691
        isTablet: constant$1(isTablet),
-
 
692
        isPhone: constant$1(isPhone),
-
 
693
        isTouch: constant$1(isTouch),
-
 
694
        isAndroid: os.isAndroid,
-
 
695
        isiOS: os.isiOS,
-
 
696
        isWebView: constant$1(iOSwebview),
-
 
697
        isDesktop: constant$1(isDesktop)
-
 
698
      };
-
 
699
    };
-
 
700
 
-
 
701
    var firstMatch = function (regexes, s) {
-
 
702
      for (var i = 0; i < regexes.length; i++) {
-
 
703
        var x = regexes[i];
-
 
704
        if (x.test(s)) {
-
 
705
          return x;
-
 
706
        }
-
 
707
      }
-
 
708
      return undefined;
-
 
709
    };
-
 
710
    var find$3 = function (regexes, agent) {
-
 
711
      var r = firstMatch(regexes, agent);
-
 
712
      if (!r) {
-
 
713
        return {
-
 
714
          major: 0,
-
 
715
          minor: 0
-
 
716
        };
-
 
717
      }
-
 
718
      var group = function (i) {
-
 
719
        return Number(agent.replace(r, '$' + i));
-
 
720
      };
-
 
721
      return nu$d(group(1), group(2));
-
 
722
    };
-
 
723
    var detect$4 = function (versionRegexes, agent) {
-
 
724
      var cleanedAgent = String(agent).toLowerCase();
-
 
725
      if (versionRegexes.length === 0) {
-
 
726
        return unknown$3();
-
 
727
      }
-
 
728
      return find$3(versionRegexes, cleanedAgent);
-
 
729
    };
-
 
730
    var unknown$3 = function () {
-
 
731
      return nu$d(0, 0);
-
 
732
    };
-
 
733
    var nu$d = function (major, minor) {
-
 
734
      return {
-
 
735
        major: major,
-
 
736
        minor: minor
-
 
737
      };
-
 
738
    };
-
 
739
    var Version = {
-
 
740
      nu: nu$d,
-
 
741
      detect: detect$4,
-
 
742
      unknown: unknown$3
-
 
743
    };
-
 
744
 
-
 
745
    var detectBrowser$1 = function (browsers, userAgentData) {
-
 
746
      return findMap(userAgentData.brands, function (uaBrand) {
-
 
747
        var lcBrand = uaBrand.brand.toLowerCase();
-
 
748
        return find$5(browsers, function (browser) {
-
 
749
          var _a;
-
 
750
          return lcBrand === ((_a = browser.brand) === null || _a === void 0 ? void 0 : _a.toLowerCase());
-
 
751
        }).map(function (info) {
-
 
752
          return {
-
 
753
            current: info.name,
-
 
754
            version: Version.nu(parseInt(uaBrand.version, 10), 0)
-
 
755
          };
-
 
756
        });
-
 
757
      });
-
 
758
    };
-
 
759
 
-
 
760
    var detect$3 = function (candidates, userAgent) {
-
 
761
      var agent = String(userAgent).toLowerCase();
-
 
762
      return find$5(candidates, function (candidate) {
-
 
763
        return candidate.search(agent);
-
 
764
      });
-
 
765
    };
-
 
766
    var detectBrowser = function (browsers, userAgent) {
-
 
767
      return detect$3(browsers, userAgent).map(function (browser) {
-
 
768
        var version = Version.detect(browser.versionRegexes, userAgent);
-
 
769
        return {
-
 
770
          current: browser.name,
-
 
771
          version: version
-
 
772
        };
-
 
773
      });
-
 
774
    };
-
 
775
    var detectOs = function (oses, userAgent) {
-
 
776
      return detect$3(oses, userAgent).map(function (os) {
-
 
777
        var version = Version.detect(os.versionRegexes, userAgent);
-
 
778
        return {
-
 
779
          current: os.name,
-
 
780
          version: version
-
 
781
        };
-
 
782
      });
-
 
783
    };
-
 
784
 
-
 
785
    var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
-
 
786
    var checkContains = function (target) {
-
 
787
      return function (uastring) {
-
 
788
        return contains$1(uastring, target);
-
 
789
      };
-
 
790
    };
-
 
791
    var browsers = [
-
 
792
      {
-
 
793
        name: 'Edge',
-
 
794
        versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
-
 
795
        search: function (uastring) {
-
 
796
          return contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit');
-
 
797
        }
-
 
798
      },
-
 
799
      {
-
 
800
        name: 'Chrome',
-
 
801
        brand: 'Chromium',
-
 
802
        versionRegexes: [
-
 
803
          /.*?chrome\/([0-9]+)\.([0-9]+).*/,
-
 
804
          normalVersionRegex
-
 
805
        ],
-
 
806
        search: function (uastring) {
-
 
807
          return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe');
-
 
808
        }
-
 
809
      },
-
 
810
      {
-
 
811
        name: 'IE',
-
 
812
        versionRegexes: [
-
 
813
          /.*?msie\ ?([0-9]+)\.([0-9]+).*/,
-
 
814
          /.*?rv:([0-9]+)\.([0-9]+).*/
-
 
815
        ],
-
 
816
        search: function (uastring) {
-
 
817
          return contains$1(uastring, 'msie') || contains$1(uastring, 'trident');
-
 
818
        }
-
 
819
      },
-
 
820
      {
-
 
821
        name: 'Opera',
-
 
822
        versionRegexes: [
-
 
823
          normalVersionRegex,
-
 
824
          /.*?opera\/([0-9]+)\.([0-9]+).*/
-
 
825
        ],
-
 
826
        search: checkContains('opera')
-
 
827
      },
-
 
828
      {
-
 
829
        name: 'Firefox',
-
 
830
        versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
-
 
831
        search: checkContains('firefox')
-
 
832
      },
-
 
833
      {
-
 
834
        name: 'Safari',
-
 
835
        versionRegexes: [
-
 
836
          normalVersionRegex,
-
 
837
          /.*?cpu os ([0-9]+)_([0-9]+).*/
-
 
838
        ],
-
 
839
        search: function (uastring) {
-
 
840
          return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit');
-
 
841
        }
-
 
842
      }
-
 
843
    ];
-
 
844
    var oses = [
-
 
845
      {
-
 
846
        name: 'Windows',
-
 
847
        search: checkContains('win'),
-
 
848
        versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
-
 
849
      },
-
 
850
      {
-
 
851
        name: 'iOS',
-
 
852
        search: function (uastring) {
-
 
853
          return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad');
-
 
854
        },
-
 
855
        versionRegexes: [
-
 
856
          /.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
-
 
857
          /.*cpu os ([0-9]+)_([0-9]+).*/,
-
 
858
          /.*cpu iphone os ([0-9]+)_([0-9]+).*/
-
 
859
        ]
-
 
860
      },
-
 
861
      {
-
 
862
        name: 'Android',
-
 
863
        search: checkContains('android'),
-
 
864
        versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
-
 
865
      },
-
 
866
      {
-
 
867
        name: 'OSX',
-
 
868
        search: checkContains('mac os x'),
-
 
869
        versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]
-
 
870
      },
-
 
871
      {
-
 
872
        name: 'Linux',
-
 
873
        search: checkContains('linux'),
-
 
874
        versionRegexes: []
-
 
875
      },
-
 
876
      {
-
 
877
        name: 'Solaris',
-
 
878
        search: checkContains('sunos'),
-
 
879
        versionRegexes: []
-
 
880
      },
-
 
881
      {
-
 
882
        name: 'FreeBSD',
-
 
883
        search: checkContains('freebsd'),
-
 
884
        versionRegexes: []
-
 
885
      },
-
 
886
      {
-
 
887
        name: 'ChromeOS',
-
 
888
        search: checkContains('cros'),
-
 
889
        versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/]
-
 
890
      }
-
 
891
    ];
-
 
892
    var PlatformInfo = {
-
 
893
      browsers: constant$1(browsers),
-
 
894
      oses: constant$1(oses)
-
 
895
    };
-
 
896
 
-
 
897
    var edge = 'Edge';
-
 
898
    var chrome = 'Chrome';
-
 
899
    var ie = 'IE';
-
 
900
    var opera = 'Opera';
-
 
901
    var firefox = 'Firefox';
-
 
902
    var safari = 'Safari';
-
 
903
    var unknown$2 = function () {
-
 
904
      return nu$c({
-
 
905
        current: undefined,
-
 
906
        version: Version.unknown()
-
 
907
      });
-
 
908
    };
-
 
909
    var nu$c = function (info) {
-
 
910
      var current = info.current;
-
 
911
      var version = info.version;
-
 
912
      var isBrowser = function (name) {
-
 
913
        return function () {
-
 
914
          return current === name;
-
 
915
        };
-
 
916
      };
-
 
917
      return {
-
 
918
        current: current,
-
 
919
        version: version,
-
 
920
        isEdge: isBrowser(edge),
-
 
921
        isChrome: isBrowser(chrome),
-
 
922
        isIE: isBrowser(ie),
-
 
923
        isOpera: isBrowser(opera),
-
 
924
        isFirefox: isBrowser(firefox),
-
 
925
        isSafari: isBrowser(safari)
-
 
926
      };
-
 
927
    };
-
 
928
    var Browser = {
-
 
929
      unknown: unknown$2,
-
 
930
      nu: nu$c,
-
 
931
      edge: constant$1(edge),
-
 
932
      chrome: constant$1(chrome),
-
 
933
      ie: constant$1(ie),
-
 
934
      opera: constant$1(opera),
-
 
935
      firefox: constant$1(firefox),
-
 
936
      safari: constant$1(safari)
-
 
937
    };
-
 
938
 
-
 
939
    var windows = 'Windows';
-
 
940
    var ios = 'iOS';
-
 
941
    var android = 'Android';
-
 
942
    var linux = 'Linux';
-
 
943
    var osx = 'OSX';
-
 
944
    var solaris = 'Solaris';
-
 
945
    var freebsd = 'FreeBSD';
-
 
946
    var chromeos = 'ChromeOS';
-
 
947
    var unknown$1 = function () {
-
 
948
      return nu$b({
-
 
949
        current: undefined,
-
 
950
        version: Version.unknown()
-
 
951
      });
-
 
952
    };
-
 
953
    var nu$b = function (info) {
-
 
954
      var current = info.current;
-
 
955
      var version = info.version;
-
 
956
      var isOS = function (name) {
-
 
957
        return function () {
-
 
958
          return current === name;
-
 
959
        };
-
 
960
      };
-
 
961
      return {
-
 
962
        current: current,
-
 
963
        version: version,
-
 
964
        isWindows: isOS(windows),
-
 
965
        isiOS: isOS(ios),
-
 
966
        isAndroid: isOS(android),
-
 
967
        isOSX: isOS(osx),
-
 
968
        isLinux: isOS(linux),
-
 
969
        isSolaris: isOS(solaris),
-
 
970
        isFreeBSD: isOS(freebsd),
-
 
971
        isChromeOS: isOS(chromeos)
-
 
972
      };
-
 
973
    };
-
 
974
    var OperatingSystem = {
-
 
975
      unknown: unknown$1,
-
 
976
      nu: nu$b,
-
 
977
      windows: constant$1(windows),
-
 
978
      ios: constant$1(ios),
-
 
979
      android: constant$1(android),
-
 
980
      linux: constant$1(linux),
-
 
981
      osx: constant$1(osx),
-
 
982
      solaris: constant$1(solaris),
-
 
983
      freebsd: constant$1(freebsd),
-
 
984
      chromeos: constant$1(chromeos)
-
 
985
    };
-
 
986
 
-
 
987
    var detect$2 = function (userAgent, userAgentDataOpt, mediaMatch) {
-
 
988
      var browsers = PlatformInfo.browsers();
-
 
989
      var oses = PlatformInfo.oses();
-
 
990
      var browser = userAgentDataOpt.bind(function (userAgentData) {
-
 
991
        return detectBrowser$1(browsers, userAgentData);
-
 
992
      }).orThunk(function () {
-
 
993
        return detectBrowser(browsers, userAgent);
-
 
994
      }).fold(Browser.unknown, Browser.nu);
-
 
995
      var os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
-
 
996
      var deviceType = DeviceType(os, browser, userAgent, mediaMatch);
-
 
997
      return {
-
 
998
        browser: browser,
-
 
999
        os: os,
-
 
1000
        deviceType: deviceType
-
 
1001
      };
-
 
1002
    };
-
 
1003
    var PlatformDetection = { detect: detect$2 };
-
 
1004
 
-
 
1005
    var mediaMatch = function (query) {
-
 
1006
      return window.matchMedia(query).matches;
-
 
1007
    };
-
 
1008
    var platform = cached(function () {
-
 
1009
      return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch);
-
 
1010
    });
-
 
1011
    var detect$1 = function () {
-
 
1012
      return platform();
-
 
1013
    };
-
 
1014
 
-
 
1015
    var compareDocumentPosition = function (a, b, match) {
-
 
1016
      return (a.compareDocumentPosition(b) & match) !== 0;
-
 
1017
    };
-
 
1018
    var documentPositionContainedBy = function (a, b) {
-
 
1019
      return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY);
-
 
1020
    };
-
 
1021
 
-
 
1022
    var is = function (element, selector) {
-
 
1023
      var dom = element.dom;
-
 
1024
      if (dom.nodeType !== ELEMENT) {
-
 
1025
        return false;
-
 
1026
      } else {
-
 
1027
        var elem = dom;
-
 
1028
        if (elem.matches !== undefined) {
-
 
1029
          return elem.matches(selector);
-
 
1030
        } else if (elem.msMatchesSelector !== undefined) {
-
 
1031
          return elem.msMatchesSelector(selector);
-
 
1032
        } else if (elem.webkitMatchesSelector !== undefined) {
-
 
1033
          return elem.webkitMatchesSelector(selector);
-
 
1034
        } else if (elem.mozMatchesSelector !== undefined) {
-
 
1035
          return elem.mozMatchesSelector(selector);
-
 
1036
        } else {
-
 
1037
          throw new Error('Browser lacks native selectors');
-
 
1038
        }
-
 
1039
      }
-
 
1040
    };
-
 
1041
    var bypassSelector = function (dom) {
-
 
1042
      return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;
-
 
1043
    };
-
 
1044
    var all$3 = function (selector, scope) {
-
 
1045
      var base = scope === undefined ? document : scope.dom;
-
 
1046
      return bypassSelector(base) ? [] : map$2(base.querySelectorAll(selector), SugarElement.fromDom);
-
 
1047
    };
-
 
1048
    var one = function (selector, scope) {
-
 
1049
      var base = scope === undefined ? document : scope.dom;
-
 
1050
      return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector)).map(SugarElement.fromDom);
-
 
1051
    };
-
 
1052
 
-
 
1053
    var eq = function (e1, e2) {
-
 
1054
      return e1.dom === e2.dom;
-
 
1055
    };
-
 
1056
    var regularContains = function (e1, e2) {
-
 
1057
      var d1 = e1.dom;
-
 
1058
      var d2 = e2.dom;
-
 
1059
      return d1 === d2 ? false : d1.contains(d2);
-
 
1060
    };
-
 
1061
    var ieContains = function (e1, e2) {
-
 
1062
      return documentPositionContainedBy(e1.dom, e2.dom);
-
 
1063
    };
-
 
1064
    var contains = function (e1, e2) {
-
 
1065
      return detect$1().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2);
-
 
1066
    };
-
 
1067
 
-
 
1068
    var owner$4 = function (element) {
-
 
1069
      return SugarElement.fromDom(element.dom.ownerDocument);
-
 
1070
    };
-
 
1071
    var documentOrOwner = function (dos) {
-
 
1072
      return isDocument(dos) ? dos : owner$4(dos);
-
 
1073
    };
-
 
1074
    var documentElement = function (element) {
-
 
1075
      return SugarElement.fromDom(documentOrOwner(element).dom.documentElement);
-
 
1076
    };
-
 
1077
    var defaultView = function (element) {
-
 
1078
      return SugarElement.fromDom(documentOrOwner(element).dom.defaultView);
-
 
1079
    };
-
 
1080
    var parent = function (element) {
-
 
1081
      return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
-
 
1082
    };
-
 
1083
    var parentNode = function (element) {
-
 
1084
      return parent(element);
-
 
1085
    };
-
 
1086
    var offsetParent = function (element) {
-
 
1087
      return Optional.from(element.dom.offsetParent).map(SugarElement.fromDom);
-
 
1088
    };
-
 
1089
    var nextSibling = function (element) {
-
 
1090
      return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);
-
 
1091
    };
-
 
1092
    var children = function (element) {
-
 
1093
      return map$2(element.dom.childNodes, SugarElement.fromDom);
-
 
1094
    };
-
 
1095
    var child$2 = function (element, index) {
-
 
1096
      var cs = element.dom.childNodes;
-
 
1097
      return Optional.from(cs[index]).map(SugarElement.fromDom);
-
 
1098
    };
-
 
1099
    var firstChild = function (element) {
-
 
1100
      return child$2(element, 0);
-
 
1101
    };
-
 
1102
    var spot = function (element, offset) {
-
 
1103
      return {
-
 
1104
        element: element,
-
 
1105
        offset: offset
-
 
1106
      };
-
 
1107
    };
-
 
1108
    var leaf = function (element, offset) {
-
 
1109
      var cs = children(element);
-
 
1110
      return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
-
 
1111
    };
-
 
1112
 
-
 
1113
    var isShadowRoot = function (dos) {
-
 
1114
      return isDocumentFragment(dos) && isNonNullable(dos.dom.host);
-
 
1115
    };
-
 
1116
    var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
-
 
1117
    var isSupported = constant$1(supported);
-
 
1118
    var getRootNode = supported ? function (e) {
-
 
1119
      return SugarElement.fromDom(e.dom.getRootNode());
-
 
1120
    } : documentOrOwner;
-
 
1121
    var getContentContainer = function (dos) {
-
 
1122
      return isShadowRoot(dos) ? dos : SugarElement.fromDom(documentOrOwner(dos).dom.body);
-
 
1123
    };
-
 
1124
    var isInShadowRoot = function (e) {
-
 
1125
      return getShadowRoot(e).isSome();
-
 
1126
    };
-
 
1127
    var getShadowRoot = function (e) {
-
 
1128
      var r = getRootNode(e);
-
 
1129
      return isShadowRoot(r) ? Optional.some(r) : Optional.none();
-
 
1130
    };
-
 
1131
    var getShadowHost = function (e) {
-
 
1132
      return SugarElement.fromDom(e.dom.host);
-
 
1133
    };
-
 
1134
    var getOriginalEventTarget = function (event) {
-
 
1135
      if (isSupported() && isNonNullable(event.target)) {
-
 
1136
        var el = SugarElement.fromDom(event.target);
-
 
1137
        if (isElement$2(el) && isOpenShadowHost(el)) {
-
 
1138
          if (event.composed && event.composedPath) {
-
 
1139
            var composedPath = event.composedPath();
-
 
1140
            if (composedPath) {
-
 
1141
              return head(composedPath);
-
 
1142
            }
-
 
1143
          }
-
 
1144
        }
-
 
1145
      }
-
 
1146
      return Optional.from(event.target);
-
 
1147
    };
-
 
1148
    var isOpenShadowHost = function (element) {
-
 
1149
      return isNonNullable(element.dom.shadowRoot);
-
 
1150
    };
-
 
1151
 
-
 
1152
    var inBody = function (element) {
-
 
1153
      var dom = isText$1(element) ? element.dom.parentNode : element.dom;
-
 
1154
      if (dom === undefined || dom === null || dom.ownerDocument === null) {
-
 
1155
        return false;
-
 
1156
      }
-
 
1157
      var doc = dom.ownerDocument;
-
 
1158
      return getShadowRoot(SugarElement.fromDom(dom)).fold(function () {
-
 
1159
        return doc.body.contains(dom);
-
 
1160
      }, compose1(inBody, getShadowHost));
-
 
1161
    };
-
 
1162
    var body = function () {
-
 
1163
      return getBody(SugarElement.fromDom(document));
-
 
1164
    };
-
 
1165
    var getBody = function (doc) {
-
 
1166
      var b = doc.dom.body;
-
 
1167
      if (b === null || b === undefined) {
-
 
1168
        throw new Error('Body is not available yet');
-
 
1169
      }
-
 
1170
      return SugarElement.fromDom(b);
-
 
1171
    };
-
 
1172
 
-
 
1173
    var rawSet = function (dom, key, value) {
-
 
1174
      if (isString(value) || isBoolean(value) || isNumber(value)) {
-
 
1175
        dom.setAttribute(key, value + '');
-
 
1176
      } else {
-
 
1177
        console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
-
 
1178
        throw new Error('Attribute value was not simple');
-
 
1179
      }
-
 
1180
    };
-
 
1181
    var set$8 = function (element, key, value) {
-
 
1182
      rawSet(element.dom, key, value);
-
 
1183
    };
-
 
1184
    var setAll$1 = function (element, attrs) {
-
 
1185
      var dom = element.dom;
-
 
1186
      each(attrs, function (v, k) {
-
 
1187
        rawSet(dom, k, v);
-
 
1188
      });
-
 
1189
    };
-
 
1190
    var get$d = function (element, key) {
-
 
1191
      var v = element.dom.getAttribute(key);
-
 
1192
      return v === null ? undefined : v;
-
 
1193
    };
-
 
1194
    var getOpt = function (element, key) {
-
 
1195
      return Optional.from(get$d(element, key));
-
 
1196
    };
-
 
1197
    var has$1 = function (element, key) {
-
 
1198
      var dom = element.dom;
-
 
1199
      return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
-
 
1200
    };
-
 
1201
    var remove$7 = function (element, key) {
-
 
1202
      element.dom.removeAttribute(key);
-
 
1203
    };
-
 
1204
 
-
 
1205
    var internalSet = function (dom, property, value) {
-
 
1206
      if (!isString(value)) {
-
 
1207
        console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
-
 
1208
        throw new Error('CSS value must be a string: ' + value);
-
 
1209
      }
-
 
1210
      if (isSupported$1(dom)) {
-
 
1211
        dom.style.setProperty(property, value);
-
 
1212
      }
-
 
1213
    };
-
 
1214
    var internalRemove = function (dom, property) {
-
 
1215
      if (isSupported$1(dom)) {
-
 
1216
        dom.style.removeProperty(property);
-
 
1217
      }
-
 
1218
    };
-
 
1219
    var set$7 = function (element, property, value) {
-
 
1220
      var dom = element.dom;
-
 
1221
      internalSet(dom, property, value);
-
 
1222
    };
-
 
1223
    var setAll = function (element, css) {
-
 
1224
      var dom = element.dom;
-
 
1225
      each(css, function (v, k) {
-
 
1226
        internalSet(dom, k, v);
-
 
1227
      });
-
 
1228
    };
-
 
1229
    var setOptions = function (element, css) {
-
 
1230
      var dom = element.dom;
-
 
1231
      each(css, function (v, k) {
-
 
1232
        v.fold(function () {
-
 
1233
          internalRemove(dom, k);
-
 
1234
        }, function (value) {
-
 
1235
          internalSet(dom, k, value);
-
 
1236
        });
-
 
1237
      });
-
 
1238
    };
-
 
1239
    var get$c = function (element, property) {
-
 
1240
      var dom = element.dom;
-
 
1241
      var styles = window.getComputedStyle(dom);
-
 
1242
      var r = styles.getPropertyValue(property);
-
 
1243
      return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;
-
 
1244
    };
-
 
1245
    var getUnsafeProperty = function (dom, property) {
-
 
1246
      return isSupported$1(dom) ? dom.style.getPropertyValue(property) : '';
-
 
1247
    };
-
 
1248
    var getRaw = function (element, property) {
-
 
1249
      var dom = element.dom;
-
 
1250
      var raw = getUnsafeProperty(dom, property);
-
 
1251
      return Optional.from(raw).filter(function (r) {
-
 
1252
        return r.length > 0;
-
 
1253
      });
-
 
1254
    };
-
 
1255
    var getAllRaw = function (element) {
-
 
1256
      var css = {};
-
 
1257
      var dom = element.dom;
-
 
1258
      if (isSupported$1(dom)) {
-
 
1259
        for (var i = 0; i < dom.style.length; i++) {
-
 
1260
          var ruleName = dom.style.item(i);
-
 
1261
          css[ruleName] = dom.style[ruleName];
-
 
1262
        }
-
 
1263
      }
-
 
1264
      return css;
-
 
1265
    };
-
 
1266
    var isValidValue = function (tag, property, value) {
-
 
1267
      var element = SugarElement.fromTag(tag);
-
 
1268
      set$7(element, property, value);
-
 
1269
      var style = getRaw(element, property);
-
 
1270
      return style.isSome();
-
 
1271
    };
-
 
1272
    var remove$6 = function (element, property) {
-
 
1273
      var dom = element.dom;
-
 
1274
      internalRemove(dom, property);
-
 
1275
      if (is$1(getOpt(element, 'style').map(trim$1), '')) {
-
 
1276
        remove$7(element, 'style');
-
 
1277
      }
-
 
1278
    };
-
 
1279
    var reflow = function (e) {
-
 
1280
      return e.dom.offsetWidth;
-
 
1281
    };
-
 
1282
 
-
 
1283
    var Dimension = function (name, getOffset) {
-
 
1284
      var set = function (element, h) {
-
 
1285
        if (!isNumber(h) && !h.match(/^[0-9]+$/)) {
-
 
1286
          throw new Error(name + '.set accepts only positive integer values. Value was ' + h);
-
 
1287
        }
-
 
1288
        var dom = element.dom;
-
 
1289
        if (isSupported$1(dom)) {
-
 
1290
          dom.style[name] = h + 'px';
-
 
1291
        }
-
 
1292
      };
-
 
1293
      var get = function (element) {
-
 
1294
        var r = getOffset(element);
-
 
1295
        if (r <= 0 || r === null) {
-
 
1296
          var css = get$c(element, name);
-
 
1297
          return parseFloat(css) || 0;
-
 
1298
        }
-
 
1299
        return r;
-
 
1300
      };
-
 
1301
      var getOuter = get;
-
 
1302
      var aggregate = function (element, properties) {
-
 
1303
        return foldl(properties, function (acc, property) {
-
 
1304
          var val = get$c(element, property);
-
 
1305
          var value = val === undefined ? 0 : parseInt(val, 10);
-
 
1306
          return isNaN(value) ? acc : acc + value;
-
 
1307
        }, 0);
-
 
1308
      };
-
 
1309
      var max = function (element, value, properties) {
-
 
1310
        var cumulativeInclusions = aggregate(element, properties);
-
 
1311
        var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0;
-
 
1312
        return absoluteMax;
-
 
1313
      };
-
 
1314
      return {
-
 
1315
        set: set,
-
 
1316
        get: get,
-
 
1317
        getOuter: getOuter,
-
 
1318
        aggregate: aggregate,
-
 
1319
        max: max
-
 
1320
      };
-
 
1321
    };
-
 
1322
 
-
 
1323
    var api$3 = Dimension('height', function (element) {
-
 
1324
      var dom = element.dom;
-
 
1325
      return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight;
-
 
1326
    });
-
 
1327
    var get$b = function (element) {
-
 
1328
      return api$3.get(element);
-
 
1329
    };
-
 
1330
    var getOuter$2 = function (element) {
-
 
1331
      return api$3.getOuter(element);
-
 
1332
    };
-
 
1333
    var setMax$1 = function (element, value) {
-
 
1334
      var inclusions = [
-
 
1335
        'margin-top',
-
 
1336
        'border-top-width',
-
 
1337
        'padding-top',
-
 
1338
        'padding-bottom',
-
 
1339
        'border-bottom-width',
-
 
1340
        'margin-bottom'
-
 
1341
      ];
-
 
1342
      var absMax = api$3.max(element, value, inclusions);
-
 
1343
      set$7(element, 'max-height', absMax + 'px');
-
 
1344
    };
-
 
1345
 
-
 
1346
    var r$1 = function (left, top) {
-
 
1347
      var translate = function (x, y) {
-
 
1348
        return r$1(left + x, top + y);
-
 
1349
      };
-
 
1350
      return {
-
 
1351
        left: left,
-
 
1352
        top: top,
-
 
1353
        translate: translate
-
 
1354
      };
-
 
1355
    };
-
 
1356
    var SugarPosition = r$1;
-
 
1357
 
-
 
1358
    var boxPosition = function (dom) {
-
 
1359
      var box = dom.getBoundingClientRect();
-
 
1360
      return SugarPosition(box.left, box.top);
-
 
1361
    };
-
 
1362
    var firstDefinedOrZero = function (a, b) {
-
 
1363
      if (a !== undefined) {
-
 
1364
        return a;
-
 
1365
      } else {
-
 
1366
        return b !== undefined ? b : 0;
-
 
1367
      }
-
 
1368
    };
-
 
1369
    var absolute$3 = function (element) {
-
 
1370
      var doc = element.dom.ownerDocument;
-
 
1371
      var body = doc.body;
-
 
1372
      var win = doc.defaultView;
-
 
1373
      var html = doc.documentElement;
-
 
1374
      if (body === element.dom) {
-
 
1375
        return SugarPosition(body.offsetLeft, body.offsetTop);
-
 
1376
      }
-
 
1377
      var scrollTop = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop);
-
 
1378
      var scrollLeft = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft);
-
 
1379
      var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);
-
 
1380
      var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);
-
 
1381
      return viewport$1(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);
-
 
1382
    };
-
 
1383
    var viewport$1 = function (element) {
-
 
1384
      var dom = element.dom;
-
 
1385
      var doc = dom.ownerDocument;
-
 
1386
      var body = doc.body;
-
 
1387
      if (body === dom) {
-
 
1388
        return SugarPosition(body.offsetLeft, body.offsetTop);
-
 
1389
      }
-
 
1390
      if (!inBody(element)) {
-
 
1391
        return SugarPosition(0, 0);
-
 
1392
      }
-
 
1393
      return boxPosition(dom);
-
 
1394
    };
-
 
1395
 
-
 
1396
    var api$2 = Dimension('width', function (element) {
-
 
1397
      return element.dom.offsetWidth;
-
 
1398
    });
-
 
1399
    var set$6 = function (element, h) {
-
 
1400
      return api$2.set(element, h);
-
 
1401
    };
-
 
1402
    var get$a = function (element) {
-
 
1403
      return api$2.get(element);
-
 
1404
    };
-
 
1405
    var getOuter$1 = function (element) {
-
 
1406
      return api$2.getOuter(element);
-
 
1407
    };
-
 
1408
    var setMax = function (element, value) {
-
 
1409
      var inclusions = [
-
 
1410
        'margin-left',
-
 
1411
        'border-left-width',
-
 
1412
        'padding-left',
-
 
1413
        'padding-right',
-
 
1414
        'border-right-width',
-
 
1415
        'margin-right'
-
 
1416
      ];
-
 
1417
      var absMax = api$2.max(element, value, inclusions);
-
 
1418
      set$7(element, 'max-width', absMax + 'px');
-
 
1419
    };
-
 
1420
 
-
 
1421
    var mkEvent = function (target, x, y, stop, prevent, kill, raw) {
-
 
1422
      return {
-
 
1423
        target: target,
-
 
1424
        x: x,
-
 
1425
        y: y,
-
 
1426
        stop: stop,
-
 
1427
        prevent: prevent,
-
 
1428
        kill: kill,
-
 
1429
        raw: raw
-
 
1430
      };
-
 
1431
    };
-
 
1432
    var fromRawEvent$1 = function (rawEvent) {
-
 
1433
      var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target));
-
 
1434
      var stop = function () {
-
 
1435
        return rawEvent.stopPropagation();
-
 
1436
      };
-
 
1437
      var prevent = function () {
-
 
1438
        return rawEvent.preventDefault();
-
 
1439
      };
-
 
1440
      var kill = compose(prevent, stop);
-
 
1441
      return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);
-
 
1442
    };
-
 
1443
    var handle = function (filter, handler) {
-
 
1444
      return function (rawEvent) {
-
 
1445
        if (filter(rawEvent)) {
-
 
1446
          handler(fromRawEvent$1(rawEvent));
-
 
1447
        }
-
 
1448
      };
-
 
1449
    };
-
 
1450
    var binder = function (element, event, filter, handler, useCapture) {
-
 
1451
      var wrapped = handle(filter, handler);
-
 
1452
      element.dom.addEventListener(event, wrapped, useCapture);
-
 
1453
      return { unbind: curry(unbind, element, event, wrapped, useCapture) };
-
 
1454
    };
-
 
1455
    var bind$2 = function (element, event, filter, handler) {
-
 
1456
      return binder(element, event, filter, handler, false);
-
 
1457
    };
-
 
1458
    var capture$1 = function (element, event, filter, handler) {
-
 
1459
      return binder(element, event, filter, handler, true);
-
 
1460
    };
-
 
1461
    var unbind = function (element, event, handler, useCapture) {
-
 
1462
      element.dom.removeEventListener(event, handler, useCapture);
-
 
1463
    };
-
 
1464
 
-
 
1465
    var before$2 = function (marker, element) {
-
 
1466
      var parent$1 = parent(marker);
-
 
1467
      parent$1.each(function (v) {
-
 
1468
        v.dom.insertBefore(element.dom, marker.dom);
-
 
1469
      });
-
 
1470
    };
-
 
1471
    var after$2 = function (marker, element) {
-
 
1472
      var sibling = nextSibling(marker);
-
 
1473
      sibling.fold(function () {
-
 
1474
        var parent$1 = parent(marker);
-
 
1475
        parent$1.each(function (v) {
-
 
1476
          append$2(v, element);
-
 
1477
        });
-
 
1478
      }, function (v) {
-
 
1479
        before$2(v, element);
-
 
1480
      });
-
 
1481
    };
-
 
1482
    var prepend$1 = function (parent, element) {
-
 
1483
      var firstChild$1 = firstChild(parent);
-
 
1484
      firstChild$1.fold(function () {
-
 
1485
        append$2(parent, element);
-
 
1486
      }, function (v) {
-
 
1487
        parent.dom.insertBefore(element.dom, v.dom);
-
 
1488
      });
-
 
1489
    };
-
 
1490
    var append$2 = function (parent, element) {
-
 
1491
      parent.dom.appendChild(element.dom);
-
 
1492
    };
-
 
1493
    var appendAt = function (parent, element, index) {
-
 
1494
      child$2(parent, index).fold(function () {
-
 
1495
        append$2(parent, element);
-
 
1496
      }, function (v) {
-
 
1497
        before$2(v, element);
-
 
1498
      });
-
 
1499
    };
-
 
1500
 
-
 
1501
    var before$1 = function (marker, elements) {
-
 
1502
      each$1(elements, function (x) {
-
 
1503
        before$2(marker, x);
-
 
1504
      });
-
 
1505
    };
-
 
1506
    var append$1 = function (parent, elements) {
-
 
1507
      each$1(elements, function (x) {
-
 
1508
        append$2(parent, x);
-
 
1509
      });
-
 
1510
    };
-
 
1511
 
-
 
1512
    var empty = function (element) {
-
 
1513
      element.dom.textContent = '';
-
 
1514
      each$1(children(element), function (rogue) {
-
 
1515
        remove$5(rogue);
-
 
1516
      });
-
 
1517
    };
-
 
1518
    var remove$5 = function (element) {
-
 
1519
      var dom = element.dom;
-
 
1520
      if (dom.parentNode !== null) {
-
 
1521
        dom.parentNode.removeChild(dom);
-
 
1522
      }
-
 
1523
    };
-
 
1524
    var unwrap = function (wrapper) {
-
 
1525
      var children$1 = children(wrapper);
-
 
1526
      if (children$1.length > 0) {
-
 
1527
        before$1(wrapper, children$1);
-
 
1528
      }
-
 
1529
      remove$5(wrapper);
-
 
1530
    };
-
 
1531
 
-
 
1532
    var get$9 = function (_DOC) {
-
 
1533
      var doc = _DOC !== undefined ? _DOC.dom : document;
-
 
1534
      var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
-
 
1535
      var y = doc.body.scrollTop || doc.documentElement.scrollTop;
-
 
1536
      return SugarPosition(x, y);
-
 
1537
    };
-
 
1538
    var to = function (x, y, _DOC) {
-
 
1539
      var doc = _DOC !== undefined ? _DOC.dom : document;
-
 
1540
      var win = doc.defaultView;
-
 
1541
      if (win) {
-
 
1542
        win.scrollTo(x, y);
-
 
1543
      }
-
 
1544
    };
-
 
1545
 
-
 
1546
    var get$8 = function (_win) {
-
 
1547
      var win = _win === undefined ? window : _win;
-
 
1548
      if (detect$1().browser.isFirefox()) {
-
 
1549
        return Optional.none();
-
 
1550
      } else {
-
 
1551
        return Optional.from(win['visualViewport']);
-
 
1552
      }
-
 
1553
    };
-
 
1554
    var bounds$1 = function (x, y, width, height) {
-
 
1555
      return {
-
 
1556
        x: x,
-
 
1557
        y: y,
-
 
1558
        width: width,
-
 
1559
        height: height,
-
 
1560
        right: x + width,
-
 
1561
        bottom: y + height
-
 
1562
      };
-
 
1563
    };
-
 
1564
    var getBounds$3 = function (_win) {
-
 
1565
      var win = _win === undefined ? window : _win;
-
 
1566
      var doc = win.document;
-
 
1567
      var scroll = get$9(SugarElement.fromDom(doc));
-
 
1568
      return get$8(win).fold(function () {
-
 
1569
        var html = win.document.documentElement;
-
 
1570
        var width = html.clientWidth;
-
 
1571
        var height = html.clientHeight;
-
 
1572
        return bounds$1(scroll.left, scroll.top, width, height);
-
 
1573
      }, function (visualViewport) {
-
 
1574
        return bounds$1(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height);
-
 
1575
      });
-
 
1576
    };
-
 
1577
 
-
 
1578
    var walkUp = function (navigation, doc) {
-
 
1579
      var frame = navigation.view(doc);
-
 
1580
      return frame.fold(constant$1([]), function (f) {
-
 
1581
        var parent = navigation.owner(f);
-
 
1582
        var rest = walkUp(navigation, parent);
-
 
1583
        return [f].concat(rest);
-
 
1584
      });
-
 
1585
    };
-
 
1586
    var pathTo = function (element, navigation) {
-
 
1587
      var d = navigation.owner(element);
-
 
1588
      var paths = walkUp(navigation, d);
-
 
1589
      return Optional.some(paths);
-
 
1590
    };
-
 
1591
 
-
 
1592
    var view = function (doc) {
-
 
1593
      var _a;
-
 
1594
      var element = doc.dom === document ? Optional.none() : Optional.from((_a = doc.dom.defaultView) === null || _a === void 0 ? void 0 : _a.frameElement);
-
 
1595
      return element.map(SugarElement.fromDom);
-
 
1596
    };
-
 
1597
    var owner$3 = function (element) {
-
 
1598
      return owner$4(element);
-
 
1599
    };
-
 
1600
 
-
 
1601
    var Navigation = /*#__PURE__*/Object.freeze({
-
 
1602
        __proto__: null,
-
 
1603
        view: view,
-
 
1604
        owner: owner$3
-
 
1605
    });
-
 
1606
 
-
 
1607
    var find$2 = function (element) {
-
 
1608
      var doc = SugarElement.fromDom(document);
-
 
1609
      var scroll = get$9(doc);
-
 
1610
      var path = pathTo(element, Navigation);
-
 
1611
      return path.fold(curry(absolute$3, element), function (frames) {
-
 
1612
        var offset = viewport$1(element);
-
 
1613
        var r = foldr(frames, function (b, a) {
-
 
1614
          var loc = viewport$1(a);
-
 
1615
          return {
-
 
1616
            left: b.left + loc.left,
-
 
1617
            top: b.top + loc.top
-
 
1618
          };
-
 
1619
        }, {
-
 
1620
          left: 0,
-
 
1621
          top: 0
-
 
1622
        });
-
 
1623
        return SugarPosition(r.left + offset.left + scroll.left, r.top + offset.top + scroll.top);
-
 
1624
      });
-
 
1625
    };
-
 
1626
 
-
 
1627
    var pointed = function (point, width, height) {
-
 
1628
      return {
-
 
1629
        point: point,
-
 
1630
        width: width,
-
 
1631
        height: height
-
 
1632
      };
-
 
1633
    };
-
 
1634
    var rect = function (x, y, width, height) {
-
 
1635
      return {
-
 
1636
        x: x,
-
 
1637
        y: y,
-
 
1638
        width: width,
-
 
1639
        height: height
-
 
1640
      };
-
 
1641
    };
-
 
1642
    var bounds = function (x, y, width, height) {
-
 
1643
      return {
-
 
1644
        x: x,
-
 
1645
        y: y,
-
 
1646
        width: width,
-
 
1647
        height: height,
-
 
1648
        right: x + width,
-
 
1649
        bottom: y + height
-
 
1650
      };
-
 
1651
    };
-
 
1652
    var box$1 = function (element) {
-
 
1653
      var xy = absolute$3(element);
-
 
1654
      var w = getOuter$1(element);
-
 
1655
      var h = getOuter$2(element);
-
 
1656
      return bounds(xy.left, xy.top, w, h);
-
 
1657
    };
-
 
1658
    var absolute$2 = function (element) {
-
 
1659
      var position = find$2(element);
-
 
1660
      var width = getOuter$1(element);
-
 
1661
      var height = getOuter$2(element);
-
 
1662
      return bounds(position.left, position.top, width, height);
-
 
1663
    };
-
 
1664
    var win = function () {
-
 
1665
      return getBounds$3(window);
-
 
1666
    };
-
 
1667
 
437
    var value$3 = function (o) {
1668
    var value$3 = function (o) {
438
      var or = function (_opt) {
1669
      var or = function (_opt) {
439
        return value$3(o);
1670
        return value$3(o);
440
      };
1671
      };
441
      var orThunk = function (_f) {
1672
      var orThunk = function (_f) {
Line 566... Line 1797...
566
        };
1797
        };
567
      } else {
1798
      } else {
568
        return res;
1799
        return res;
569
      }
1800
      }
570
    };
1801
    };
571
    var map$1 = function (res, f) {
1802
    var map = function (res, f) {
572
      if (res.stype === SimpleResultType.Value) {
1803
      if (res.stype === SimpleResultType.Value) {
573
        return {
1804
        return {
574
          stype: SimpleResultType.Value,
1805
          stype: SimpleResultType.Value,
575
          svalue: f(res.svalue)
1806
          svalue: f(res.svalue)
576
        };
1807
        };
577
      } else {
1808
      } else {
578
        return res;
1809
        return res;
579
      }
1810
      }
580
    };
1811
    };
581
    var bind$2 = function (res, f) {
1812
    var bind$1 = function (res, f) {
582
      if (res.stype === SimpleResultType.Value) {
1813
      if (res.stype === SimpleResultType.Value) {
583
        return f(res.svalue);
1814
        return f(res.svalue);
584
      } else {
1815
      } else {
585
        return res;
1816
        return res;
586
      }
1817
      }
Line 614... Line 1845...
614
      fromResult: fromResult$1,
1845
      fromResult: fromResult$1,
615
      toResult: toResult$1,
1846
      toResult: toResult$1,
616
      svalue: svalue,
1847
      svalue: svalue,
617
      partition: partition$2,
1848
      partition: partition$2,
618
      serror: serror,
1849
      serror: serror,
619
      bind: bind$2,
1850
      bind: bind$1,
620
      bindError: bindError,
1851
      bindError: bindError,
621
      map: map$1,
1852
      map: map,
622
      mapError: mapError,
1853
      mapError: mapError,
623
      fold: fold$1
1854
      fold: fold$1
624
    };
1855
    };
625
 
1856
 
626
    var field$2 = function (key, newKey, presence, prop) {
1857
    var field$2 = function (key, newKey, presence, prop) {
Line 646... Line 1877...
646
      case 'custom':
1877
      case 'custom':
647
        return ifCustom(value.newKey, value.instantiator);
1878
        return ifCustom(value.newKey, value.instantiator);
648
      }
1879
      }
649
    };
1880
    };
650
 
1881
 
651
    var keys = Object.keys;
-
 
652
    var hasOwnProperty = Object.hasOwnProperty;
-
 
653
    var each = function (obj, f) {
-
 
654
      var props = keys(obj);
-
 
655
      for (var k = 0, len = props.length; k < len; k++) {
-
 
656
        var i = props[k];
-
 
657
        var x = obj[i];
-
 
658
        f(x, i);
-
 
659
      }
-
 
660
    };
-
 
661
    var map = function (obj, f) {
-
 
662
      return tupleMap(obj, function (x, i) {
-
 
663
        return {
-
 
664
          k: i,
-
 
665
          v: f(x, i)
-
 
666
        };
-
 
667
      });
-
 
668
    };
-
 
669
    var tupleMap = function (obj, f) {
-
 
670
      var r = {};
-
 
671
      each(obj, function (x, i) {
-
 
672
        var tuple = f(x, i);
-
 
673
        r[tuple.k] = tuple.v;
-
 
674
      });
-
 
675
      return r;
-
 
676
    };
-
 
677
    var objAcc = function (r) {
-
 
678
      return function (x, i) {
-
 
679
        r[i] = x;
-
 
680
      };
-
 
681
    };
-
 
682
    var internalFilter = function (obj, pred, onTrue, onFalse) {
-
 
683
      var r = {};
-
 
684
      each(obj, function (x, i) {
-
 
685
        (pred(x, i) ? onTrue : onFalse)(x, i);
-
 
686
      });
-
 
687
      return r;
-
 
688
    };
-
 
689
    var filter$1 = function (obj, pred) {
-
 
690
      var t = {};
-
 
691
      internalFilter(obj, pred, objAcc(t), noop);
-
 
692
      return t;
-
 
693
    };
-
 
694
    var mapToArray = function (obj, f) {
-
 
695
      var r = [];
-
 
696
      each(obj, function (value, name) {
-
 
697
        r.push(f(value, name));
-
 
698
      });
-
 
699
      return r;
-
 
700
    };
-
 
701
    var find$4 = function (obj, pred) {
-
 
702
      var props = keys(obj);
-
 
703
      for (var k = 0, len = props.length; k < len; k++) {
-
 
704
        var i = props[k];
-
 
705
        var x = obj[i];
-
 
706
        if (pred(x, i, obj)) {
-
 
707
          return Optional.some(x);
-
 
708
        }
-
 
709
      }
-
 
710
      return Optional.none();
-
 
711
    };
-
 
712
    var values = function (obj) {
-
 
713
      return mapToArray(obj, identity$1);
-
 
714
    };
-
 
715
    var get$e = function (obj, key) {
-
 
716
      return has$2(obj, key) ? Optional.from(obj[key]) : Optional.none();
-
 
717
    };
-
 
718
    var has$2 = function (obj, key) {
-
 
719
      return hasOwnProperty.call(obj, key);
-
 
720
    };
-
 
721
    var hasNonNullableKey = function (obj, key) {
-
 
722
      return has$2(obj, key) && obj[key] !== undefined && obj[key] !== null;
-
 
723
    };
-
 
724
 
-
 
725
    var shallow$1 = function (old, nu) {
1882
    var shallow$1 = function (old, nu) {
726
      return nu;
1883
      return nu;
727
    };
1884
    };
728
    var deep = function (old, nu) {
1885
    var deep = function (old, nu) {
729
      var bothObjects = isObject(old) && isObject(nu);
1886
      var bothObjects = isObject(old) && isObject(nu);
Line 751... Line 1908...
751
      };
1908
      };
752
    };
1909
    };
753
    var deepMerge = baseMerge(deep);
1910
    var deepMerge = baseMerge(deep);
754
    var merge$1 = baseMerge(shallow$1);
1911
    var merge$1 = baseMerge(shallow$1);
755
 
1912
 
756
    var cached = function (f) {
-
 
757
      var called = false;
-
 
758
      var r;
-
 
759
      return function () {
-
 
760
        var args = [];
-
 
761
        for (var _i = 0; _i < arguments.length; _i++) {
-
 
762
          args[_i] = arguments[_i];
-
 
763
        }
-
 
764
        if (!called) {
-
 
765
          called = true;
-
 
766
          r = f.apply(null, args);
-
 
767
        }
-
 
768
        return r;
-
 
769
      };
-
 
770
    };
-
 
771
 
-
 
772
    var required$2 = function () {
1913
    var required$2 = function () {
773
      return {
1914
      return {
774
        tag: 'required',
1915
        tag: 'required',
775
        process: {}
1916
        process: {}
776
      };
1917
      };
Line 830... Line 1971...
830
      return map$2(es, function (e) {
1971
      return map$2(es, function (e) {
831
        return 'Failed path: (' + e.path.join(' > ') + ')\n' + e.getErrorInfo();
1972
        return 'Failed path: (' + e.path.join(' > ') + ')\n' + e.getErrorInfo();
832
      });
1973
      });
833
    };
1974
    };
834
 
1975
 
835
    var nu$d = function (path, getErrorInfo) {
1976
    var nu$a = function (path, getErrorInfo) {
836
      return SimpleResult.serror([{
1977
      return SimpleResult.serror([{
837
          path: path,
1978
          path: path,
838
          getErrorInfo: getErrorInfo
1979
          getErrorInfo: getErrorInfo
839
        }]);
1980
        }]);
840
    };
1981
    };
841
    var missingRequired = function (path, key, obj) {
1982
    var missingRequired = function (path, key, obj) {
842
      return nu$d(path, function () {
1983
      return nu$a(path, function () {
843
        return 'Could not find valid *required* value for "' + key + '" in ' + formatObj(obj);
1984
        return 'Could not find valid *required* value for "' + key + '" in ' + formatObj(obj);
844
      });
1985
      });
845
    };
1986
    };
846
    var missingKey = function (path, key) {
1987
    var missingKey = function (path, key) {
847
      return nu$d(path, function () {
1988
      return nu$a(path, function () {
848
        return 'Choice schema did not contain choice key: "' + key + '"';
1989
        return 'Choice schema did not contain choice key: "' + key + '"';
849
      });
1990
      });
850
    };
1991
    };
851
    var missingBranch = function (path, branches, branch) {
1992
    var missingBranch = function (path, branches, branch) {
852
      return nu$d(path, function () {
1993
      return nu$a(path, function () {
853
        return 'The chosen schema: "' + branch + '" did not exist in branches: ' + formatObj(branches);
1994
        return 'The chosen schema: "' + branch + '" did not exist in branches: ' + formatObj(branches);
854
      });
1995
      });
855
    };
1996
    };
856
    var unsupportedFields = function (path, unsupported) {
1997
    var unsupportedFields = function (path, unsupported) {
857
      return nu$d(path, function () {
1998
      return nu$a(path, function () {
858
        return 'There are unsupported fields: [' + unsupported.join(', ') + '] specified';
1999
        return 'There are unsupported fields: [' + unsupported.join(', ') + '] specified';
859
      });
2000
      });
860
    };
2001
    };
861
    var custom = function (path, err) {
2002
    var custom = function (path, err) {
862
      return nu$d(path, constant$1(err));
2003
      return nu$a(path, constant$1(err));
863
    };
2004
    };
864
 
2005
 
865
    var value$2 = function (validator) {
2006
    var value$2 = function (validator) {
866
      var extract = function (path, val) {
2007
      var extract = function (path, val) {
867
        return SimpleResult.bindError(validator(val), function (err) {
2008
        return SimpleResult.bindError(validator(val), function (err) {
Line 1177... Line 2318...
1177
    };
2318
    };
1178
    var formatError = function (errInfo) {
2319
    var formatError = function (errInfo) {
1179
      return 'Errors: \n' + formatErrors(errInfo.errors).join('\n') + '\n\nInput object: ' + formatObj(errInfo.input);
2320
      return 'Errors: \n' + formatErrors(errInfo.errors).join('\n') + '\n\nInput object: ' + formatObj(errInfo.input);
1180
    };
2321
    };
1181
    var choose$1 = function (key, branches) {
2322
    var choose$1 = function (key, branches) {
1182
      return choose$2(key, map(branches, objOf));
2323
      return choose$2(key, map$1(branches, objOf));
1183
    };
2324
    };
1184
    var thunkOf = function (desc, schema) {
2325
    var thunkOf = function (desc, schema) {
1185
      return thunk(desc, schema);
2326
      return thunk(desc, schema);
1186
    };
2327
    };
1187
 
2328
 
Line 1294... Line 2435...
1294
        get: get,
2435
        get: get,
1295
        set: set
2436
        set: set
1296
      };
2437
      };
1297
    };
2438
    };
1298
 
2439
 
1299
    var fromHtml$2 = function (html, scope) {
-
 
1300
      var doc = scope || document;
-
 
1301
      var div = doc.createElement('div');
-
 
1302
      div.innerHTML = html;
-
 
1303
      if (!div.hasChildNodes() || div.childNodes.length > 1) {
-
 
1304
        console.error('HTML does not have a single root node', html);
-
 
1305
        throw new Error('HTML must have a single root node');
-
 
1306
      }
-
 
1307
      return fromDom(div.childNodes[0]);
-
 
1308
    };
-
 
1309
    var fromTag = function (tag, scope) {
-
 
1310
      var doc = scope || document;
-
 
1311
      var node = doc.createElement(tag);
-
 
1312
      return fromDom(node);
-
 
1313
    };
-
 
1314
    var fromText = function (text, scope) {
-
 
1315
      var doc = scope || document;
-
 
1316
      var node = doc.createTextNode(text);
-
 
1317
      return fromDom(node);
-
 
1318
    };
-
 
1319
    var fromDom = function (node) {
-
 
1320
      if (node === null || node === undefined) {
-
 
1321
        throw new Error('Node cannot be null or undefined');
-
 
1322
      }
-
 
1323
      return { dom: node };
-
 
1324
    };
-
 
1325
    var fromPoint = function (docElm, x, y) {
-
 
1326
      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
-
 
1327
    };
-
 
1328
    var SugarElement = {
-
 
1329
      fromHtml: fromHtml$2,
-
 
1330
      fromTag: fromTag,
-
 
1331
      fromText: fromText,
-
 
1332
      fromDom: fromDom,
-
 
1333
      fromPoint: fromPoint
-
 
1334
    };
-
 
1335
 
-
 
1336
    var DeviceType = function (os, browser, userAgent, mediaMatch) {
-
 
1337
      var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
-
 
1338
      var isiPhone = os.isiOS() && !isiPad;
-
 
1339
      var isMobile = os.isiOS() || os.isAndroid();
-
 
1340
      var isTouch = isMobile || mediaMatch('(pointer:coarse)');
-
 
1341
      var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');
-
 
1342
      var isPhone = isiPhone || isMobile && !isTablet;
-
 
1343
      var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
-
 
1344
      var isDesktop = !isPhone && !isTablet && !iOSwebview;
-
 
1345
      return {
-
 
1346
        isiPad: constant$1(isiPad),
-
 
1347
        isiPhone: constant$1(isiPhone),
-
 
1348
        isTablet: constant$1(isTablet),
-
 
1349
        isPhone: constant$1(isPhone),
-
 
1350
        isTouch: constant$1(isTouch),
-
 
1351
        isAndroid: os.isAndroid,
-
 
1352
        isiOS: os.isiOS,
-
 
1353
        isWebView: constant$1(iOSwebview),
-
 
1354
        isDesktop: constant$1(isDesktop)
-
 
1355
      };
-
 
1356
    };
-
 
1357
 
-
 
1358
    var firstMatch = function (regexes, s) {
-
 
1359
      for (var i = 0; i < regexes.length; i++) {
-
 
1360
        var x = regexes[i];
-
 
1361
        if (x.test(s)) {
-
 
1362
          return x;
-
 
1363
        }
-
 
1364
      }
-
 
1365
      return undefined;
-
 
1366
    };
-
 
1367
    var find$3 = function (regexes, agent) {
-
 
1368
      var r = firstMatch(regexes, agent);
-
 
1369
      if (!r) {
-
 
1370
        return {
-
 
1371
          major: 0,
-
 
1372
          minor: 0
-
 
1373
        };
-
 
1374
      }
-
 
1375
      var group = function (i) {
-
 
1376
        return Number(agent.replace(r, '$' + i));
-
 
1377
      };
-
 
1378
      return nu$c(group(1), group(2));
-
 
1379
    };
-
 
1380
    var detect$4 = function (versionRegexes, agent) {
-
 
1381
      var cleanedAgent = String(agent).toLowerCase();
-
 
1382
      if (versionRegexes.length === 0) {
-
 
1383
        return unknown$3();
-
 
1384
      }
-
 
1385
      return find$3(versionRegexes, cleanedAgent);
-
 
1386
    };
-
 
1387
    var unknown$3 = function () {
-
 
1388
      return nu$c(0, 0);
-
 
1389
    };
-
 
1390
    var nu$c = function (major, minor) {
-
 
1391
      return {
-
 
1392
        major: major,
-
 
1393
        minor: minor
-
 
1394
      };
-
 
1395
    };
-
 
1396
    var Version = {
-
 
1397
      nu: nu$c,
-
 
1398
      detect: detect$4,
-
 
1399
      unknown: unknown$3
-
 
1400
    };
-
 
1401
 
-
 
1402
    var detectBrowser$1 = function (browsers, userAgentData) {
-
 
1403
      return findMap(userAgentData.brands, function (uaBrand) {
-
 
1404
        var lcBrand = uaBrand.brand.toLowerCase();
-
 
1405
        return find$5(browsers, function (browser) {
-
 
1406
          var _a;
-
 
1407
          return lcBrand === ((_a = browser.brand) === null || _a === void 0 ? void 0 : _a.toLowerCase());
-
 
1408
        }).map(function (info) {
-
 
1409
          return {
-
 
1410
            current: info.name,
-
 
1411
            version: Version.nu(parseInt(uaBrand.version, 10), 0)
-
 
1412
          };
-
 
1413
        });
-
 
1414
      });
-
 
1415
    };
-
 
1416
 
-
 
1417
    var detect$3 = function (candidates, userAgent) {
-
 
1418
      var agent = String(userAgent).toLowerCase();
-
 
1419
      return find$5(candidates, function (candidate) {
-
 
1420
        return candidate.search(agent);
-
 
1421
      });
-
 
1422
    };
-
 
1423
    var detectBrowser = function (browsers, userAgent) {
-
 
1424
      return detect$3(browsers, userAgent).map(function (browser) {
-
 
1425
        var version = Version.detect(browser.versionRegexes, userAgent);
-
 
1426
        return {
-
 
1427
          current: browser.name,
-
 
1428
          version: version
-
 
1429
        };
-
 
1430
      });
-
 
1431
    };
-
 
1432
    var detectOs = function (oses, userAgent) {
-
 
1433
      return detect$3(oses, userAgent).map(function (os) {
-
 
1434
        var version = Version.detect(os.versionRegexes, userAgent);
-
 
1435
        return {
-
 
1436
          current: os.name,
-
 
1437
          version: version
-
 
1438
        };
-
 
1439
      });
-
 
1440
    };
-
 
1441
 
-
 
1442
    var addToEnd = function (str, suffix) {
-
 
1443
      return str + suffix;
-
 
1444
    };
-
 
1445
    var removeFromStart = function (str, numChars) {
-
 
1446
      return str.substring(numChars);
-
 
1447
    };
-
 
1448
 
-
 
1449
    var checkRange = function (str, substr, start) {
-
 
1450
      return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
-
 
1451
    };
-
 
1452
    var removeLeading = function (str, prefix) {
-
 
1453
      return startsWith(str, prefix) ? removeFromStart(str, prefix.length) : str;
-
 
1454
    };
-
 
1455
    var ensureTrailing = function (str, suffix) {
-
 
1456
      return endsWith(str, suffix) ? str : addToEnd(str, suffix);
-
 
1457
    };
-
 
1458
    var contains$1 = function (str, substr) {
-
 
1459
      return str.indexOf(substr) !== -1;
-
 
1460
    };
-
 
1461
    var startsWith = function (str, prefix) {
-
 
1462
      return checkRange(str, prefix, 0);
-
 
1463
    };
-
 
1464
    var endsWith = function (str, suffix) {
-
 
1465
      return checkRange(str, suffix, str.length - suffix.length);
-
 
1466
    };
-
 
1467
    var blank = function (r) {
-
 
1468
      return function (s) {
-
 
1469
        return s.replace(r, '');
-
 
1470
      };
-
 
1471
    };
-
 
1472
    var trim$1 = blank(/^\s+|\s+$/g);
-
 
1473
    var isNotEmpty = function (s) {
-
 
1474
      return s.length > 0;
-
 
1475
    };
-
 
1476
    var isEmpty = function (s) {
-
 
1477
      return !isNotEmpty(s);
-
 
1478
    };
-
 
1479
 
-
 
1480
    var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
-
 
1481
    var checkContains = function (target) {
-
 
1482
      return function (uastring) {
-
 
1483
        return contains$1(uastring, target);
-
 
1484
      };
-
 
1485
    };
-
 
1486
    var browsers = [
-
 
1487
      {
-
 
1488
        name: 'Edge',
-
 
1489
        versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
-
 
1490
        search: function (uastring) {
-
 
1491
          return contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit');
-
 
1492
        }
-
 
1493
      },
-
 
1494
      {
-
 
1495
        name: 'Chrome',
-
 
1496
        brand: 'Chromium',
-
 
1497
        versionRegexes: [
-
 
1498
          /.*?chrome\/([0-9]+)\.([0-9]+).*/,
-
 
1499
          normalVersionRegex
-
 
1500
        ],
-
 
1501
        search: function (uastring) {
-
 
1502
          return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe');
-
 
1503
        }
-
 
1504
      },
-
 
1505
      {
-
 
1506
        name: 'IE',
-
 
1507
        versionRegexes: [
-
 
1508
          /.*?msie\ ?([0-9]+)\.([0-9]+).*/,
-
 
1509
          /.*?rv:([0-9]+)\.([0-9]+).*/
-
 
1510
        ],
-
 
1511
        search: function (uastring) {
-
 
1512
          return contains$1(uastring, 'msie') || contains$1(uastring, 'trident');
-
 
1513
        }
-
 
1514
      },
-
 
1515
      {
-
 
1516
        name: 'Opera',
-
 
1517
        versionRegexes: [
-
 
1518
          normalVersionRegex,
-
 
1519
          /.*?opera\/([0-9]+)\.([0-9]+).*/
-
 
1520
        ],
-
 
1521
        search: checkContains('opera')
-
 
1522
      },
-
 
1523
      {
-
 
1524
        name: 'Firefox',
-
 
1525
        versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
-
 
1526
        search: checkContains('firefox')
-
 
1527
      },
-
 
1528
      {
-
 
1529
        name: 'Safari',
-
 
1530
        versionRegexes: [
-
 
1531
          normalVersionRegex,
-
 
1532
          /.*?cpu os ([0-9]+)_([0-9]+).*/
-
 
1533
        ],
-
 
1534
        search: function (uastring) {
-
 
1535
          return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit');
-
 
1536
        }
-
 
1537
      }
-
 
1538
    ];
-
 
1539
    var oses = [
-
 
1540
      {
-
 
1541
        name: 'Windows',
-
 
1542
        search: checkContains('win'),
-
 
1543
        versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
-
 
1544
      },
-
 
1545
      {
-
 
1546
        name: 'iOS',
-
 
1547
        search: function (uastring) {
-
 
1548
          return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad');
-
 
1549
        },
-
 
1550
        versionRegexes: [
-
 
1551
          /.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
-
 
1552
          /.*cpu os ([0-9]+)_([0-9]+).*/,
-
 
1553
          /.*cpu iphone os ([0-9]+)_([0-9]+).*/
-
 
1554
        ]
-
 
1555
      },
-
 
1556
      {
-
 
1557
        name: 'Android',
-
 
1558
        search: checkContains('android'),
-
 
1559
        versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
-
 
1560
      },
-
 
1561
      {
-
 
1562
        name: 'OSX',
-
 
1563
        search: checkContains('mac os x'),
-
 
1564
        versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]
-
 
1565
      },
-
 
1566
      {
-
 
1567
        name: 'Linux',
-
 
1568
        search: checkContains('linux'),
-
 
1569
        versionRegexes: []
-
 
1570
      },
-
 
1571
      {
-
 
1572
        name: 'Solaris',
-
 
1573
        search: checkContains('sunos'),
-
 
1574
        versionRegexes: []
-
 
1575
      },
-
 
1576
      {
-
 
1577
        name: 'FreeBSD',
-
 
1578
        search: checkContains('freebsd'),
-
 
1579
        versionRegexes: []
-
 
1580
      },
-
 
1581
      {
-
 
1582
        name: 'ChromeOS',
-
 
1583
        search: checkContains('cros'),
-
 
1584
        versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/]
-
 
1585
      }
-
 
1586
    ];
-
 
1587
    var PlatformInfo = {
-
 
1588
      browsers: constant$1(browsers),
-
 
1589
      oses: constant$1(oses)
-
 
1590
    };
-
 
1591
 
-
 
1592
    var edge = 'Edge';
-
 
1593
    var chrome = 'Chrome';
-
 
1594
    var ie = 'IE';
-
 
1595
    var opera = 'Opera';
-
 
1596
    var firefox = 'Firefox';
-
 
1597
    var safari = 'Safari';
-
 
1598
    var unknown$2 = function () {
-
 
1599
      return nu$b({
-
 
1600
        current: undefined,
-
 
1601
        version: Version.unknown()
-
 
1602
      });
-
 
1603
    };
-
 
1604
    var nu$b = function (info) {
-
 
1605
      var current = info.current;
-
 
1606
      var version = info.version;
-
 
1607
      var isBrowser = function (name) {
-
 
1608
        return function () {
-
 
1609
          return current === name;
-
 
1610
        };
-
 
1611
      };
-
 
1612
      return {
-
 
1613
        current: current,
-
 
1614
        version: version,
-
 
1615
        isEdge: isBrowser(edge),
-
 
1616
        isChrome: isBrowser(chrome),
-
 
1617
        isIE: isBrowser(ie),
-
 
1618
        isOpera: isBrowser(opera),
-
 
1619
        isFirefox: isBrowser(firefox),
-
 
1620
        isSafari: isBrowser(safari)
-
 
1621
      };
-
 
1622
    };
-
 
1623
    var Browser = {
-
 
1624
      unknown: unknown$2,
-
 
1625
      nu: nu$b,
-
 
1626
      edge: constant$1(edge),
-
 
1627
      chrome: constant$1(chrome),
-
 
1628
      ie: constant$1(ie),
-
 
1629
      opera: constant$1(opera),
-
 
1630
      firefox: constant$1(firefox),
-
 
1631
      safari: constant$1(safari)
-
 
1632
    };
-
 
1633
 
-
 
1634
    var windows = 'Windows';
-
 
1635
    var ios = 'iOS';
-
 
1636
    var android = 'Android';
-
 
1637
    var linux = 'Linux';
-
 
1638
    var osx = 'OSX';
-
 
1639
    var solaris = 'Solaris';
-
 
1640
    var freebsd = 'FreeBSD';
-
 
1641
    var chromeos = 'ChromeOS';
-
 
1642
    var unknown$1 = function () {
-
 
1643
      return nu$a({
-
 
1644
        current: undefined,
-
 
1645
        version: Version.unknown()
-
 
1646
      });
-
 
1647
    };
-
 
1648
    var nu$a = function (info) {
-
 
1649
      var current = info.current;
-
 
1650
      var version = info.version;
-
 
1651
      var isOS = function (name) {
-
 
1652
        return function () {
-
 
1653
          return current === name;
-
 
1654
        };
-
 
1655
      };
-
 
1656
      return {
-
 
1657
        current: current,
-
 
1658
        version: version,
-
 
1659
        isWindows: isOS(windows),
-
 
1660
        isiOS: isOS(ios),
-
 
1661
        isAndroid: isOS(android),
-
 
1662
        isOSX: isOS(osx),
-
 
1663
        isLinux: isOS(linux),
-
 
1664
        isSolaris: isOS(solaris),
-
 
1665
        isFreeBSD: isOS(freebsd),
-
 
1666
        isChromeOS: isOS(chromeos)
-
 
1667
      };
-
 
1668
    };
-
 
1669
    var OperatingSystem = {
-
 
1670
      unknown: unknown$1,
-
 
1671
      nu: nu$a,
-
 
1672
      windows: constant$1(windows),
-
 
1673
      ios: constant$1(ios),
-
 
1674
      android: constant$1(android),
-
 
1675
      linux: constant$1(linux),
-
 
1676
      osx: constant$1(osx),
-
 
1677
      solaris: constant$1(solaris),
-
 
1678
      freebsd: constant$1(freebsd),
-
 
1679
      chromeos: constant$1(chromeos)
-
 
1680
    };
-
 
1681
 
-
 
1682
    var detect$2 = function (userAgent, userAgentDataOpt, mediaMatch) {
-
 
1683
      var browsers = PlatformInfo.browsers();
-
 
1684
      var oses = PlatformInfo.oses();
-
 
1685
      var browser = userAgentDataOpt.bind(function (userAgentData) {
-
 
1686
        return detectBrowser$1(browsers, userAgentData);
-
 
1687
      }).orThunk(function () {
-
 
1688
        return detectBrowser(browsers, userAgent);
-
 
1689
      }).fold(Browser.unknown, Browser.nu);
-
 
1690
      var os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
-
 
1691
      var deviceType = DeviceType(os, browser, userAgent, mediaMatch);
-
 
1692
      return {
-
 
1693
        browser: browser,
-
 
1694
        os: os,
-
 
1695
        deviceType: deviceType
-
 
1696
      };
-
 
1697
    };
-
 
1698
    var PlatformDetection = { detect: detect$2 };
-
 
1699
 
-
 
1700
    var mediaMatch = function (query) {
-
 
1701
      return window.matchMedia(query).matches;
-
 
1702
    };
-
 
1703
    var platform = cached(function () {
-
 
1704
      return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch);
-
 
1705
    });
-
 
1706
    var detect$1 = function () {
-
 
1707
      return platform();
-
 
1708
    };
-
 
1709
 
-
 
1710
    var compareDocumentPosition = function (a, b, match) {
-
 
1711
      return (a.compareDocumentPosition(b) & match) !== 0;
-
 
1712
    };
-
 
1713
    var documentPositionContainedBy = function (a, b) {
-
 
1714
      return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY);
-
 
1715
    };
-
 
1716
 
-
 
1717
    var DOCUMENT = 9;
-
 
1718
    var DOCUMENT_FRAGMENT = 11;
-
 
1719
    var ELEMENT = 1;
-
 
1720
    var TEXT = 3;
-
 
1721
 
-
 
1722
    var is$1 = function (element, selector) {
-
 
1723
      var dom = element.dom;
-
 
1724
      if (dom.nodeType !== ELEMENT) {
-
 
1725
        return false;
-
 
1726
      } else {
-
 
1727
        var elem = dom;
-
 
1728
        if (elem.matches !== undefined) {
-
 
1729
          return elem.matches(selector);
-
 
1730
        } else if (elem.msMatchesSelector !== undefined) {
-
 
1731
          return elem.msMatchesSelector(selector);
-
 
1732
        } else if (elem.webkitMatchesSelector !== undefined) {
-
 
1733
          return elem.webkitMatchesSelector(selector);
-
 
1734
        } else if (elem.mozMatchesSelector !== undefined) {
-
 
1735
          return elem.mozMatchesSelector(selector);
-
 
1736
        } else {
-
 
1737
          throw new Error('Browser lacks native selectors');
-
 
1738
        }
-
 
1739
      }
-
 
1740
    };
-
 
1741
    var bypassSelector = function (dom) {
-
 
1742
      return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;
-
 
1743
    };
-
 
1744
    var all$3 = function (selector, scope) {
-
 
1745
      var base = scope === undefined ? document : scope.dom;
-
 
1746
      return bypassSelector(base) ? [] : map$2(base.querySelectorAll(selector), SugarElement.fromDom);
-
 
1747
    };
-
 
1748
    var one = function (selector, scope) {
-
 
1749
      var base = scope === undefined ? document : scope.dom;
-
 
1750
      return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector)).map(SugarElement.fromDom);
-
 
1751
    };
-
 
1752
 
-
 
1753
    var eq = function (e1, e2) {
-
 
1754
      return e1.dom === e2.dom;
-
 
1755
    };
-
 
1756
    var regularContains = function (e1, e2) {
-
 
1757
      var d1 = e1.dom;
-
 
1758
      var d2 = e2.dom;
-
 
1759
      return d1 === d2 ? false : d1.contains(d2);
-
 
1760
    };
-
 
1761
    var ieContains = function (e1, e2) {
-
 
1762
      return documentPositionContainedBy(e1.dom, e2.dom);
-
 
1763
    };
-
 
1764
    var contains = function (e1, e2) {
-
 
1765
      return detect$1().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2);
-
 
1766
    };
-
 
1767
 
-
 
1768
    var generate$7 = function (cases) {
2440
    var generate$7 = function (cases) {
1769
      if (!isArray(cases)) {
2441
      if (!isArray(cases)) {
1770
        throw new Error('cases must be an array');
2442
        throw new Error('cases must be an array');
1771
      }
2443
      }
1772
      if (cases.length === 0) {
2444
      if (cases.length === 0) {
Line 2189... Line 2861...
2189
    var runOnAttached = runOnSourceName(attachedToDom());
2861
    var runOnAttached = runOnSourceName(attachedToDom());
2190
    var runOnDetached = runOnSourceName(detachedFromDom());
2862
    var runOnDetached = runOnSourceName(detachedFromDom());
2191
    var runOnInit = runOnSourceName(systemInit());
2863
    var runOnInit = runOnSourceName(systemInit());
2192
    var runOnExecute$1 = runOnName(execute$5());
2864
    var runOnExecute$1 = runOnName(execute$5());
2193
 
2865
 
2194
    typeof window !== 'undefined' ? window : Function('return this;')();
-
 
2195
 
-
 
2196
    var name$2 = function (element) {
-
 
2197
      var r = element.dom.nodeName;
-
 
2198
      return r.toLowerCase();
-
 
2199
    };
-
 
2200
    var type = function (element) {
-
 
2201
      return element.dom.nodeType;
-
 
2202
    };
-
 
2203
    var isType = function (t) {
-
 
2204
      return function (element) {
-
 
2205
        return type(element) === t;
-
 
2206
      };
-
 
2207
    };
-
 
2208
    var isElement$2 = isType(ELEMENT);
-
 
2209
    var isText$1 = isType(TEXT);
-
 
2210
    var isDocument = isType(DOCUMENT);
-
 
2211
    var isDocumentFragment = isType(DOCUMENT_FRAGMENT);
-
 
2212
 
-
 
2213
    var owner$4 = function (element) {
-
 
2214
      return SugarElement.fromDom(element.dom.ownerDocument);
-
 
2215
    };
-
 
2216
    var documentOrOwner = function (dos) {
-
 
2217
      return isDocument(dos) ? dos : owner$4(dos);
-
 
2218
    };
-
 
2219
    var documentElement = function (element) {
-
 
2220
      return SugarElement.fromDom(documentOrOwner(element).dom.documentElement);
-
 
2221
    };
-
 
2222
    var defaultView = function (element) {
-
 
2223
      return SugarElement.fromDom(documentOrOwner(element).dom.defaultView);
-
 
2224
    };
-
 
2225
    var parent = function (element) {
-
 
2226
      return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
-
 
2227
    };
-
 
2228
    var parentNode = function (element) {
-
 
2229
      return parent(element);
-
 
2230
    };
-
 
2231
    var offsetParent = function (element) {
-
 
2232
      return Optional.from(element.dom.offsetParent).map(SugarElement.fromDom);
-
 
2233
    };
-
 
2234
    var nextSibling = function (element) {
-
 
2235
      return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);
-
 
2236
    };
-
 
2237
    var children = function (element) {
-
 
2238
      return map$2(element.dom.childNodes, SugarElement.fromDom);
-
 
2239
    };
-
 
2240
    var child$2 = function (element, index) {
-
 
2241
      var cs = element.dom.childNodes;
-
 
2242
      return Optional.from(cs[index]).map(SugarElement.fromDom);
-
 
2243
    };
-
 
2244
    var firstChild = function (element) {
-
 
2245
      return child$2(element, 0);
-
 
2246
    };
-
 
2247
    var spot = function (element, offset) {
-
 
2248
      return {
-
 
2249
        element: element,
-
 
2250
        offset: offset
-
 
2251
      };
-
 
2252
    };
-
 
2253
    var leaf = function (element, offset) {
-
 
2254
      var cs = children(element);
-
 
2255
      return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
-
 
2256
    };
-
 
2257
 
-
 
2258
    var isShadowRoot = function (dos) {
-
 
2259
      return isDocumentFragment(dos) && isNonNullable(dos.dom.host);
-
 
2260
    };
-
 
2261
    var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
-
 
2262
    var isSupported$1 = constant$1(supported);
-
 
2263
    var getRootNode = supported ? function (e) {
-
 
2264
      return SugarElement.fromDom(e.dom.getRootNode());
-
 
2265
    } : documentOrOwner;
-
 
2266
    var getContentContainer = function (dos) {
-
 
2267
      return isShadowRoot(dos) ? dos : SugarElement.fromDom(documentOrOwner(dos).dom.body);
-
 
2268
    };
-
 
2269
    var isInShadowRoot = function (e) {
-
 
2270
      return getShadowRoot(e).isSome();
-
 
2271
    };
-
 
2272
    var getShadowRoot = function (e) {
-
 
2273
      var r = getRootNode(e);
-
 
2274
      return isShadowRoot(r) ? Optional.some(r) : Optional.none();
-
 
2275
    };
-
 
2276
    var getShadowHost = function (e) {
-
 
2277
      return SugarElement.fromDom(e.dom.host);
-
 
2278
    };
-
 
2279
    var getOriginalEventTarget = function (event) {
-
 
2280
      if (isSupported$1() && isNonNullable(event.target)) {
-
 
2281
        var el = SugarElement.fromDom(event.target);
-
 
2282
        if (isElement$2(el) && isOpenShadowHost(el)) {
-
 
2283
          if (event.composed && event.composedPath) {
-
 
2284
            var composedPath = event.composedPath();
-
 
2285
            if (composedPath) {
-
 
2286
              return head(composedPath);
-
 
2287
            }
-
 
2288
          }
-
 
2289
        }
-
 
2290
      }
-
 
2291
      return Optional.from(event.target);
-
 
2292
    };
-
 
2293
    var isOpenShadowHost = function (element) {
-
 
2294
      return isNonNullable(element.dom.shadowRoot);
-
 
2295
    };
-
 
2296
 
-
 
2297
    var before$2 = function (marker, element) {
-
 
2298
      var parent$1 = parent(marker);
-
 
2299
      parent$1.each(function (v) {
-
 
2300
        v.dom.insertBefore(element.dom, marker.dom);
-
 
2301
      });
-
 
2302
    };
-
 
2303
    var after$2 = function (marker, element) {
-
 
2304
      var sibling = nextSibling(marker);
-
 
2305
      sibling.fold(function () {
-
 
2306
        var parent$1 = parent(marker);
-
 
2307
        parent$1.each(function (v) {
-
 
2308
          append$2(v, element);
-
 
2309
        });
-
 
2310
      }, function (v) {
-
 
2311
        before$2(v, element);
-
 
2312
      });
-
 
2313
    };
-
 
2314
    var prepend$1 = function (parent, element) {
-
 
2315
      var firstChild$1 = firstChild(parent);
-
 
2316
      firstChild$1.fold(function () {
-
 
2317
        append$2(parent, element);
-
 
2318
      }, function (v) {
-
 
2319
        parent.dom.insertBefore(element.dom, v.dom);
-
 
2320
      });
-
 
2321
    };
-
 
2322
    var append$2 = function (parent, element) {
-
 
2323
      parent.dom.appendChild(element.dom);
-
 
2324
    };
-
 
2325
    var appendAt = function (parent, element, index) {
-
 
2326
      child$2(parent, index).fold(function () {
-
 
2327
        append$2(parent, element);
-
 
2328
      }, function (v) {
-
 
2329
        before$2(v, element);
-
 
2330
      });
-
 
2331
    };
-
 
2332
 
-
 
2333
    var before$1 = function (marker, elements) {
-
 
2334
      each$1(elements, function (x) {
-
 
2335
        before$2(marker, x);
-
 
2336
      });
-
 
2337
    };
-
 
2338
    var append$1 = function (parent, elements) {
-
 
2339
      each$1(elements, function (x) {
-
 
2340
        append$2(parent, x);
-
 
2341
      });
-
 
2342
    };
-
 
2343
 
-
 
2344
    var empty = function (element) {
-
 
2345
      element.dom.textContent = '';
-
 
2346
      each$1(children(element), function (rogue) {
-
 
2347
        remove$7(rogue);
-
 
2348
      });
-
 
2349
    };
-
 
2350
    var remove$7 = function (element) {
-
 
2351
      var dom = element.dom;
-
 
2352
      if (dom.parentNode !== null) {
-
 
2353
        dom.parentNode.removeChild(dom);
-
 
2354
      }
-
 
2355
    };
-
 
2356
    var unwrap = function (wrapper) {
-
 
2357
      var children$1 = children(wrapper);
-
 
2358
      if (children$1.length > 0) {
-
 
2359
        before$1(wrapper, children$1);
-
 
2360
      }
-
 
2361
      remove$7(wrapper);
-
 
2362
    };
-
 
2363
 
-
 
2364
    var fromHtml$1 = function (html, scope) {
2866
    var fromHtml$1 = function (html, scope) {
2365
      var doc = scope || document;
2867
      var doc = scope || document;
2366
      var div = doc.createElement('div');
2868
      var div = doc.createElement('div');
2367
      div.innerHTML = html;
2869
      div.innerHTML = html;
2368
      return children(SugarElement.fromDom(div));
2870
      return children(SugarElement.fromDom(div));
2369
    };
2871
    };
2370
 
2872
 
2371
    var get$d = function (element) {
2873
    var get$7 = function (element) {
2372
      return element.dom.innerHTML;
2874
      return element.dom.innerHTML;
2373
    };
2875
    };
2374
    var set$8 = function (element, content) {
2876
    var set$5 = function (element, content) {
2375
      var owner = owner$4(element);
2877
      var owner = owner$4(element);
2376
      var docDom = owner.dom;
2878
      var docDom = owner.dom;
2377
      var fragment = SugarElement.fromDom(docDom.createDocumentFragment());
2879
      var fragment = SugarElement.fromDom(docDom.createDocumentFragment());
2378
      var contentElements = fromHtml$1(content, docDom);
2880
      var contentElements = fromHtml$1(content, docDom);
2379
      append$1(fragment, contentElements);
2881
      append$1(fragment, contentElements);
2380
      empty(element);
2882
      empty(element);
2381
      append$2(element, fragment);
2883
      append$2(element, fragment);
2382
    };
2884
    };
2383
    var getOuter$2 = function (element) {
2885
    var getOuter = function (element) {
2384
      var container = SugarElement.fromTag('div');
2886
      var container = SugarElement.fromTag('div');
2385
      var clone = SugarElement.fromDom(element.dom.cloneNode(true));
2887
      var clone = SugarElement.fromDom(element.dom.cloneNode(true));
2386
      append$2(container, clone);
2888
      append$2(container, clone);
2387
      return get$d(container);
2889
      return get$7(container);
2388
    };
-
 
2389
 
-
 
2390
    var rawSet = function (dom, key, value) {
-
 
2391
      if (isString(value) || isBoolean(value) || isNumber(value)) {
-
 
2392
        dom.setAttribute(key, value + '');
-
 
2393
      } else {
-
 
2394
        console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
-
 
2395
        throw new Error('Attribute value was not simple');
-
 
2396
      }
-
 
2397
    };
-
 
2398
    var set$7 = function (element, key, value) {
-
 
2399
      rawSet(element.dom, key, value);
-
 
2400
    };
-
 
2401
    var setAll$1 = function (element, attrs) {
-
 
2402
      var dom = element.dom;
-
 
2403
      each(attrs, function (v, k) {
-
 
2404
        rawSet(dom, k, v);
-
 
2405
      });
-
 
2406
    };
-
 
2407
    var get$c = function (element, key) {
-
 
2408
      var v = element.dom.getAttribute(key);
-
 
2409
      return v === null ? undefined : v;
-
 
2410
    };
-
 
2411
    var getOpt = function (element, key) {
-
 
2412
      return Optional.from(get$c(element, key));
-
 
2413
    };
-
 
2414
    var has$1 = function (element, key) {
-
 
2415
      var dom = element.dom;
-
 
2416
      return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
-
 
2417
    };
-
 
2418
    var remove$6 = function (element, key) {
-
 
2419
      element.dom.removeAttribute(key);
-
 
2420
    };
2890
    };
2421
 
2891
 
2422
    var clone$1 = function (original, isDeep) {
2892
    var clone$1 = function (original, isDeep) {
2423
      return SugarElement.fromDom(original.dom.cloneNode(isDeep));
2893
      return SugarElement.fromDom(original.dom.cloneNode(isDeep));
2424
    };
2894
    };
Line 2429... Line 2899...
2429
    var getHtml = function (element) {
2899
    var getHtml = function (element) {
2430
      if (isShadowRoot(element)) {
2900
      if (isShadowRoot(element)) {
2431
        return '#shadow-root';
2901
        return '#shadow-root';
2432
      } else {
2902
      } else {
2433
        var clone = shallow(element);
2903
        var clone = shallow(element);
2434
        return getOuter$2(clone);
2904
        return getOuter(clone);
2435
      }
2905
      }
2436
    };
2906
    };
2437
 
2907
 
2438
    var element = function (elem) {
2908
    var element = function (elem) {
2439
      return getHtml(elem);
2909
      return getHtml(elem);
Line 2587... Line 3057...
2587
          rest[_i - 1] = arguments[_i];
3057
          rest[_i - 1] = arguments[_i];
2588
        }
3058
        }
2589
        return f.apply(void 0, __spreadArray([
3059
        return f.apply(void 0, __spreadArray([
2590
          component.getApis(),
3060
          component.getApis(),
2591
          component
3061
          component
2592
        ], rest));
3062
        ], rest, false));
2593
      }, f);
3063
      }, f);
2594
    };
3064
    };
2595
 
3065
 
2596
    var NoState = {
3066
    var NoState = {
2597
      init: function () {
3067
      init: function () {
Line 2612... Line 3082...
2612
      var validated = asRaw('component.behaviours', objOf(schema), spec.behaviours).fold(function (errInfo) {
3082
      var validated = asRaw('component.behaviours', objOf(schema), spec.behaviours).fold(function (errInfo) {
2613
        throw new Error(formatError(errInfo) + '\nComplete spec:\n' + JSON.stringify(spec, null, 2));
3083
        throw new Error(formatError(errInfo) + '\nComplete spec:\n' + JSON.stringify(spec, null, 2));
2614
      }, identity$1);
3084
      }, identity$1);
2615
      return {
3085
      return {
2616
        list: all,
3086
        list: all,
2617
        data: map(validated, function (optBlobThunk) {
3087
        data: map$1(validated, function (optBlobThunk) {
2618
          var output = optBlobThunk.map(function (blob) {
3088
          var output = optBlobThunk.map(function (blob) {
2619
            return {
3089
            return {
2620
              config: blob.config,
3090
              config: blob.config,
2621
              state: blob.state.init(blob.config)
3091
              state: blob.state.init(blob.config)
2622
            };
3092
            };
Line 2881... Line 3351...
2881
    var toEvents = function (info) {
3351
    var toEvents = function (info) {
2882
      return info.events;
3352
      return info.events;
2883
    };
3353
    };
2884
 
3354
 
2885
    var read = function (element, attr) {
3355
    var read = function (element, attr) {
2886
      var value = get$c(element, attr);
3356
      var value = get$d(element, attr);
2887
      return value === undefined || value === '' ? [] : value.split(' ');
3357
      return value === undefined || value === '' ? [] : value.split(' ');
2888
    };
3358
    };
2889
    var add$4 = function (element, attr, id) {
3359
    var add$4 = function (element, attr, id) {
2890
      var old = read(element, attr);
3360
      var old = read(element, attr);
2891
      var nu = old.concat([id]);
3361
      var nu = old.concat([id]);
2892
      set$7(element, attr, nu.join(' '));
3362
      set$8(element, attr, nu.join(' '));
2893
      return true;
3363
      return true;
2894
    };
3364
    };
2895
    var remove$5 = function (element, attr, id) {
3365
    var remove$4 = function (element, attr, id) {
2896
      var nu = filter$2(read(element, attr), function (v) {
3366
      var nu = filter$2(read(element, attr), function (v) {
2897
        return v !== id;
3367
        return v !== id;
2898
      });
3368
      });
2899
      if (nu.length > 0) {
3369
      if (nu.length > 0) {
2900
        set$7(element, attr, nu.join(' '));
3370
        set$8(element, attr, nu.join(' '));
2901
      } else {
3371
      } else {
2902
        remove$6(element, attr);
3372
        remove$7(element, attr);
2903
      }
3373
      }
2904
      return false;
3374
      return false;
2905
    };
3375
    };
2906
 
3376
 
2907
    var supports = function (element) {
3377
    var supports = function (element) {
2908
      return element.dom.classList !== undefined;
3378
      return element.dom.classList !== undefined;
2909
    };
3379
    };
2910
    var get$b = function (element) {
3380
    var get$6 = function (element) {
2911
      return read(element, 'class');
3381
      return read(element, 'class');
2912
    };
3382
    };
2913
    var add$3 = function (element, clazz) {
3383
    var add$3 = function (element, clazz) {
2914
      return add$4(element, 'class', clazz);
3384
      return add$4(element, 'class', clazz);
2915
    };
3385
    };
2916
    var remove$4 = function (element, clazz) {
3386
    var remove$3 = function (element, clazz) {
2917
      return remove$5(element, 'class', clazz);
3387
      return remove$4(element, 'class', clazz);
2918
    };
3388
    };
2919
 
3389
 
2920
    var add$2 = function (element, clazz) {
3390
    var add$2 = function (element, clazz) {
2921
      if (supports(element)) {
3391
      if (supports(element)) {
2922
        element.dom.classList.add(clazz);
3392
        element.dom.classList.add(clazz);
2923
      } else {
3393
      } else {
2924
        add$3(element, clazz);
3394
        add$3(element, clazz);
2925
      }
3395
      }
2926
    };
3396
    };
2927
    var cleanClass = function (element) {
3397
    var cleanClass = function (element) {
2928
      var classList = supports(element) ? element.dom.classList : get$b(element);
3398
      var classList = supports(element) ? element.dom.classList : get$6(element);
2929
      if (classList.length === 0) {
3399
      if (classList.length === 0) {
2930
        remove$6(element, 'class');
3400
        remove$7(element, 'class');
2931
      }
3401
      }
2932
    };
3402
    };
2933
    var remove$3 = function (element, clazz) {
3403
    var remove$2 = function (element, clazz) {
2934
      if (supports(element)) {
3404
      if (supports(element)) {
2935
        var classList = element.dom.classList;
3405
        var classList = element.dom.classList;
2936
        classList.remove(clazz);
3406
        classList.remove(clazz);
2937
      } else {
3407
      } else {
2938
        remove$4(element, clazz);
3408
        remove$3(element, clazz);
2939
      }
3409
      }
2940
      cleanClass(element);
3410
      cleanClass(element);
2941
    };
3411
    };
2942
    var has = function (element, clazz) {
3412
    var has = function (element, clazz) {
2943
      return supports(element) && element.dom.classList.contains(clazz);
3413
      return supports(element) && element.dom.classList.contains(clazz);
Line 2946... Line 3416...
2946
    var add$1 = function (element, classes) {
3416
    var add$1 = function (element, classes) {
2947
      each$1(classes, function (x) {
3417
      each$1(classes, function (x) {
2948
        add$2(element, x);
3418
        add$2(element, x);
2949
      });
3419
      });
2950
    };
3420
    };
2951
    var remove$2 = function (element, classes) {
3421
    var remove$1 = function (element, classes) {
2952
      each$1(classes, function (x) {
3422
      each$1(classes, function (x) {
2953
        remove$3(element, x);
3423
        remove$2(element, x);
2954
      });
3424
      });
2955
    };
3425
    };
2956
    var hasAll = function (element, classes) {
3426
    var hasAll = function (element, classes) {
2957
      return forall(classes, function (clazz) {
3427
      return forall(classes, function (clazz) {
2958
        return has(element, clazz);
3428
        return has(element, clazz);
2959
      });
3429
      });
2960
    };
3430
    };
2961
 
3431
 
2962
    var is = function (lhs, rhs, comparator) {
-
 
2963
      if (comparator === void 0) {
-
 
2964
        comparator = tripleEquals;
-
 
2965
      }
-
 
2966
      return lhs.exists(function (left) {
-
 
2967
        return comparator(left, rhs);
-
 
2968
      });
-
 
2969
    };
-
 
2970
    var equals = function (lhs, rhs, comparator) {
-
 
2971
      if (comparator === void 0) {
-
 
2972
        comparator = tripleEquals;
-
 
2973
      }
-
 
2974
      return lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone());
-
 
2975
    };
-
 
2976
    var cat = function (arr) {
-
 
2977
      var r = [];
-
 
2978
      var push = function (x) {
-
 
2979
        r.push(x);
-
 
2980
      };
-
 
2981
      for (var i = 0; i < arr.length; i++) {
-
 
2982
        arr[i].each(push);
-
 
2983
      }
-
 
2984
      return r;
-
 
2985
    };
-
 
2986
    var sequence = function (arr) {
-
 
2987
      var r = [];
-
 
2988
      for (var i = 0; i < arr.length; i++) {
-
 
2989
        var x = arr[i];
-
 
2990
        if (x.isSome()) {
-
 
2991
          r.push(x.getOrDie());
-
 
2992
        } else {
-
 
2993
          return Optional.none();
-
 
2994
        }
-
 
2995
      }
-
 
2996
      return Optional.some(r);
-
 
2997
    };
-
 
2998
    var lift2 = function (oa, ob, f) {
-
 
2999
      return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();
-
 
3000
    };
-
 
3001
    var lift3 = function (oa, ob, oc, f) {
-
 
3002
      return oa.isSome() && ob.isSome() && oc.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Optional.none();
-
 
3003
    };
-
 
3004
    var mapFrom = function (a, f) {
-
 
3005
      return a !== undefined && a !== null ? Optional.some(f(a)) : Optional.none();
-
 
3006
    };
-
 
3007
    var someIf = function (b, a) {
-
 
3008
      return b ? Optional.some(a) : Optional.none();
-
 
3009
    };
-
 
3010
 
-
 
3011
    var isSupported = function (dom) {
-
 
3012
      return dom.style !== undefined && isFunction(dom.style.getPropertyValue);
-
 
3013
    };
-
 
3014
 
-
 
3015
    var inBody = function (element) {
-
 
3016
      var dom = isText$1(element) ? element.dom.parentNode : element.dom;
-
 
3017
      if (dom === undefined || dom === null || dom.ownerDocument === null) {
-
 
3018
        return false;
-
 
3019
      }
-
 
3020
      var doc = dom.ownerDocument;
-
 
3021
      return getShadowRoot(SugarElement.fromDom(dom)).fold(function () {
-
 
3022
        return doc.body.contains(dom);
-
 
3023
      }, compose1(inBody, getShadowHost));
-
 
3024
    };
-
 
3025
    var body = function () {
-
 
3026
      return getBody(SugarElement.fromDom(document));
-
 
3027
    };
-
 
3028
    var getBody = function (doc) {
-
 
3029
      var b = doc.dom.body;
-
 
3030
      if (b === null || b === undefined) {
-
 
3031
        throw new Error('Body is not available yet');
-
 
3032
      }
-
 
3033
      return SugarElement.fromDom(b);
-
 
3034
    };
-
 
3035
 
-
 
3036
    var internalSet = function (dom, property, value) {
-
 
3037
      if (!isString(value)) {
-
 
3038
        console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
-
 
3039
        throw new Error('CSS value must be a string: ' + value);
-
 
3040
      }
-
 
3041
      if (isSupported(dom)) {
-
 
3042
        dom.style.setProperty(property, value);
-
 
3043
      }
-
 
3044
    };
-
 
3045
    var internalRemove = function (dom, property) {
-
 
3046
      if (isSupported(dom)) {
-
 
3047
        dom.style.removeProperty(property);
-
 
3048
      }
-
 
3049
    };
-
 
3050
    var set$6 = function (element, property, value) {
-
 
3051
      var dom = element.dom;
-
 
3052
      internalSet(dom, property, value);
-
 
3053
    };
-
 
3054
    var setAll = function (element, css) {
-
 
3055
      var dom = element.dom;
-
 
3056
      each(css, function (v, k) {
-
 
3057
        internalSet(dom, k, v);
-
 
3058
      });
-
 
3059
    };
-
 
3060
    var setOptions = function (element, css) {
-
 
3061
      var dom = element.dom;
-
 
3062
      each(css, function (v, k) {
-
 
3063
        v.fold(function () {
-
 
3064
          internalRemove(dom, k);
-
 
3065
        }, function (value) {
-
 
3066
          internalSet(dom, k, value);
-
 
3067
        });
-
 
3068
      });
-
 
3069
    };
-
 
3070
    var get$a = function (element, property) {
-
 
3071
      var dom = element.dom;
-
 
3072
      var styles = window.getComputedStyle(dom);
-
 
3073
      var r = styles.getPropertyValue(property);
-
 
3074
      return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;
-
 
3075
    };
-
 
3076
    var getUnsafeProperty = function (dom, property) {
-
 
3077
      return isSupported(dom) ? dom.style.getPropertyValue(property) : '';
-
 
3078
    };
-
 
3079
    var getRaw = function (element, property) {
-
 
3080
      var dom = element.dom;
-
 
3081
      var raw = getUnsafeProperty(dom, property);
-
 
3082
      return Optional.from(raw).filter(function (r) {
-
 
3083
        return r.length > 0;
-
 
3084
      });
-
 
3085
    };
-
 
3086
    var getAllRaw = function (element) {
-
 
3087
      var css = {};
-
 
3088
      var dom = element.dom;
-
 
3089
      if (isSupported(dom)) {
-
 
3090
        for (var i = 0; i < dom.style.length; i++) {
-
 
3091
          var ruleName = dom.style.item(i);
-
 
3092
          css[ruleName] = dom.style[ruleName];
-
 
3093
        }
-
 
3094
      }
-
 
3095
      return css;
-
 
3096
    };
-
 
3097
    var isValidValue = function (tag, property, value) {
-
 
3098
      var element = SugarElement.fromTag(tag);
-
 
3099
      set$6(element, property, value);
-
 
3100
      var style = getRaw(element, property);
-
 
3101
      return style.isSome();
-
 
3102
    };
-
 
3103
    var remove$1 = function (element, property) {
-
 
3104
      var dom = element.dom;
-
 
3105
      internalRemove(dom, property);
-
 
3106
      if (is(getOpt(element, 'style').map(trim$1), '')) {
-
 
3107
        remove$6(element, 'style');
-
 
3108
      }
-
 
3109
    };
-
 
3110
    var reflow = function (e) {
-
 
3111
      return e.dom.offsetWidth;
-
 
3112
    };
-
 
3113
 
-
 
3114
    var get$9 = function (element) {
3432
    var get$5 = function (element) {
3115
      return element.dom.value;
3433
      return element.dom.value;
3116
    };
3434
    };
3117
    var set$5 = function (element, value) {
3435
    var set$4 = function (element, value) {
3118
      if (value === undefined) {
3436
      if (value === undefined) {
3119
        throw new Error('Value.set was undefined');
3437
        throw new Error('Value.set was undefined');
3120
      }
3438
      }
3121
      element.dom.value = value;
3439
      element.dom.value = value;
3122
    };
3440
    };
Line 3125... Line 3443...
3125
      var subject = SugarElement.fromTag(definition.tag);
3443
      var subject = SugarElement.fromTag(definition.tag);
3126
      setAll$1(subject, definition.attributes);
3444
      setAll$1(subject, definition.attributes);
3127
      add$1(subject, definition.classes);
3445
      add$1(subject, definition.classes);
3128
      setAll(subject, definition.styles);
3446
      setAll(subject, definition.styles);
3129
      definition.innerHtml.each(function (html) {
3447
      definition.innerHtml.each(function (html) {
3130
        return set$8(subject, html);
3448
        return set$5(subject, html);
3131
      });
3449
      });
3132
      var children = definition.domChildren;
3450
      var children = definition.domChildren;
3133
      append$1(subject, children);
3451
      append$1(subject, children);
3134
      definition.value.each(function (value) {
3452
      definition.value.each(function (value) {
3135
        set$5(subject, value);
3453
        set$4(subject, value);
3136
      });
3454
      });
3137
      if (!definition.uid) {
3455
      if (!definition.uid) {
3138
        debugger;
3456
        debugger;
3139
      }
3457
      }
3140
      writeOnly(subject, definition.uid);
3458
      writeOnly(subject, definition.uid);
3141
      return subject;
3459
      return subject;
3142
    };
3460
    };
3143
 
3461
 
3144
    var getBehaviours$2 = function (spec) {
3462
    var getBehaviours$2 = function (spec) {
3145
      var behaviours = get$e(spec, 'behaviours').getOr({});
3463
      var behaviours = get$e(spec, 'behaviours').getOr({});
3146
      var keys$1 = filter$2(keys(behaviours), function (k) {
3464
      return bind$3(keys(behaviours), function (name) {
3147
        return behaviours[k] !== undefined;
3465
        var behaviour = behaviours[name];
3148
      });
-
 
3149
      return map$2(keys$1, function (k) {
-
 
3150
        return behaviours[k].me;
3466
        return isNonNullable(behaviour) ? [behaviour.me] : [];
3151
      });
3467
      });
3152
    };
3468
    };
3153
    var generateFrom = function (spec, all) {
3469
    var generateFrom = function (spec, all) {
3154
      return generateFrom$1(spec, all);
3470
      return generateFrom$1(spec, all);
3155
    };
3471
    };
Line 3297... Line 3613...
3297
        return buildFromSpec(userSpecWithUid).getOrDie();
3613
        return buildFromSpec(userSpecWithUid).getOrDie();
3298
      });
3614
      });
3299
    };
3615
    };
3300
    var premade = premade$1;
3616
    var premade = premade$1;
3301
 
3617
 
3302
    var Dimension = function (name, getOffset) {
-
 
3303
      var set = function (element, h) {
-
 
3304
        if (!isNumber(h) && !h.match(/^[0-9]+$/)) {
-
 
3305
          throw new Error(name + '.set accepts only positive integer values. Value was ' + h);
-
 
3306
        }
-
 
3307
        var dom = element.dom;
-
 
3308
        if (isSupported(dom)) {
-
 
3309
          dom.style[name] = h + 'px';
-
 
3310
        }
-
 
3311
      };
-
 
3312
      var get = function (element) {
-
 
3313
        var r = getOffset(element);
-
 
3314
        if (r <= 0 || r === null) {
-
 
3315
          var css = get$a(element, name);
-
 
3316
          return parseFloat(css) || 0;
-
 
3317
        }
-
 
3318
        return r;
-
 
3319
      };
-
 
3320
      var getOuter = get;
-
 
3321
      var aggregate = function (element, properties) {
-
 
3322
        return foldl(properties, function (acc, property) {
-
 
3323
          var val = get$a(element, property);
-
 
3324
          var value = val === undefined ? 0 : parseInt(val, 10);
-
 
3325
          return isNaN(value) ? acc : acc + value;
-
 
3326
        }, 0);
-
 
3327
      };
-
 
3328
      var max = function (element, value, properties) {
-
 
3329
        var cumulativeInclusions = aggregate(element, properties);
-
 
3330
        var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0;
-
 
3331
        return absoluteMax;
-
 
3332
      };
-
 
3333
      return {
-
 
3334
        set: set,
-
 
3335
        get: get,
-
 
3336
        getOuter: getOuter,
-
 
3337
        aggregate: aggregate,
-
 
3338
        max: max
-
 
3339
      };
-
 
3340
    };
-
 
3341
 
-
 
3342
    var api$2 = Dimension('height', function (element) {
-
 
3343
      var dom = element.dom;
-
 
3344
      return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight;
-
 
3345
    });
-
 
3346
    var get$8 = function (element) {
-
 
3347
      return api$2.get(element);
-
 
3348
    };
-
 
3349
    var getOuter$1 = function (element) {
-
 
3350
      return api$2.getOuter(element);
-
 
3351
    };
-
 
3352
    var setMax$1 = function (element, value) {
-
 
3353
      var inclusions = [
-
 
3354
        'margin-top',
-
 
3355
        'border-top-width',
-
 
3356
        'padding-top',
-
 
3357
        'padding-bottom',
-
 
3358
        'border-bottom-width',
-
 
3359
        'margin-bottom'
-
 
3360
      ];
-
 
3361
      var absMax = api$2.max(element, value, inclusions);
-
 
3362
      set$6(element, 'max-height', absMax + 'px');
-
 
3363
    };
-
 
3364
 
-
 
3365
    var r$1 = function (left, top) {
-
 
3366
      var translate = function (x, y) {
-
 
3367
        return r$1(left + x, top + y);
-
 
3368
      };
-
 
3369
      return {
-
 
3370
        left: left,
-
 
3371
        top: top,
-
 
3372
        translate: translate
-
 
3373
      };
-
 
3374
    };
-
 
3375
    var SugarPosition = r$1;
-
 
3376
 
-
 
3377
    var boxPosition = function (dom) {
-
 
3378
      var box = dom.getBoundingClientRect();
-
 
3379
      return SugarPosition(box.left, box.top);
-
 
3380
    };
-
 
3381
    var firstDefinedOrZero = function (a, b) {
-
 
3382
      if (a !== undefined) {
-
 
3383
        return a;
-
 
3384
      } else {
-
 
3385
        return b !== undefined ? b : 0;
-
 
3386
      }
-
 
3387
    };
-
 
3388
    var absolute$3 = function (element) {
-
 
3389
      var doc = element.dom.ownerDocument;
-
 
3390
      var body = doc.body;
-
 
3391
      var win = doc.defaultView;
-
 
3392
      var html = doc.documentElement;
-
 
3393
      if (body === element.dom) {
-
 
3394
        return SugarPosition(body.offsetLeft, body.offsetTop);
-
 
3395
      }
-
 
3396
      var scrollTop = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop);
-
 
3397
      var scrollLeft = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft);
-
 
3398
      var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);
-
 
3399
      var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);
-
 
3400
      return viewport$1(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);
-
 
3401
    };
-
 
3402
    var viewport$1 = function (element) {
-
 
3403
      var dom = element.dom;
-
 
3404
      var doc = dom.ownerDocument;
-
 
3405
      var body = doc.body;
-
 
3406
      if (body === dom) {
-
 
3407
        return SugarPosition(body.offsetLeft, body.offsetTop);
-
 
3408
      }
-
 
3409
      if (!inBody(element)) {
-
 
3410
        return SugarPosition(0, 0);
-
 
3411
      }
-
 
3412
      return boxPosition(dom);
-
 
3413
    };
-
 
3414
 
-
 
3415
    var api$1 = Dimension('width', function (element) {
-
 
3416
      return element.dom.offsetWidth;
-
 
3417
    });
-
 
3418
    var set$4 = function (element, h) {
-
 
3419
      return api$1.set(element, h);
-
 
3420
    };
-
 
3421
    var get$7 = function (element) {
-
 
3422
      return api$1.get(element);
-
 
3423
    };
-
 
3424
    var getOuter = function (element) {
-
 
3425
      return api$1.getOuter(element);
-
 
3426
    };
-
 
3427
    var setMax = function (element, value) {
-
 
3428
      var inclusions = [
-
 
3429
        'margin-left',
-
 
3430
        'border-left-width',
-
 
3431
        'padding-left',
-
 
3432
        'padding-right',
-
 
3433
        'border-right-width',
-
 
3434
        'margin-right'
-
 
3435
      ];
-
 
3436
      var absMax = api$1.max(element, value, inclusions);
-
 
3437
      set$6(element, 'max-width', absMax + 'px');
-
 
3438
    };
-
 
3439
 
-
 
3440
    var mkEvent = function (target, x, y, stop, prevent, kill, raw) {
-
 
3441
      return {
-
 
3442
        target: target,
-
 
3443
        x: x,
-
 
3444
        y: y,
-
 
3445
        stop: stop,
-
 
3446
        prevent: prevent,
-
 
3447
        kill: kill,
-
 
3448
        raw: raw
-
 
3449
      };
-
 
3450
    };
-
 
3451
    var fromRawEvent$1 = function (rawEvent) {
-
 
3452
      var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target));
-
 
3453
      var stop = function () {
-
 
3454
        return rawEvent.stopPropagation();
-
 
3455
      };
-
 
3456
      var prevent = function () {
-
 
3457
        return rawEvent.preventDefault();
-
 
3458
      };
-
 
3459
      var kill = compose(prevent, stop);
-
 
3460
      return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);
-
 
3461
    };
-
 
3462
    var handle = function (filter, handler) {
-
 
3463
      return function (rawEvent) {
-
 
3464
        if (filter(rawEvent)) {
-
 
3465
          handler(fromRawEvent$1(rawEvent));
-
 
3466
        }
-
 
3467
      };
-
 
3468
    };
-
 
3469
    var binder = function (element, event, filter, handler, useCapture) {
-
 
3470
      var wrapped = handle(filter, handler);
-
 
3471
      element.dom.addEventListener(event, wrapped, useCapture);
-
 
3472
      return { unbind: curry(unbind, element, event, wrapped, useCapture) };
-
 
3473
    };
-
 
3474
    var bind$1 = function (element, event, filter, handler) {
-
 
3475
      return binder(element, event, filter, handler, false);
-
 
3476
    };
-
 
3477
    var capture$1 = function (element, event, filter, handler) {
-
 
3478
      return binder(element, event, filter, handler, true);
-
 
3479
    };
-
 
3480
    var unbind = function (element, event, handler, useCapture) {
-
 
3481
      element.dom.removeEventListener(event, handler, useCapture);
-
 
3482
    };
-
 
3483
 
-
 
3484
    var get$6 = function (_DOC) {
-
 
3485
      var doc = _DOC !== undefined ? _DOC.dom : document;
-
 
3486
      var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
-
 
3487
      var y = doc.body.scrollTop || doc.documentElement.scrollTop;
-
 
3488
      return SugarPosition(x, y);
-
 
3489
    };
-
 
3490
    var to = function (x, y, _DOC) {
-
 
3491
      var doc = _DOC !== undefined ? _DOC.dom : document;
-
 
3492
      var win = doc.defaultView;
-
 
3493
      if (win) {
-
 
3494
        win.scrollTo(x, y);
-
 
3495
      }
-
 
3496
    };
-
 
3497
 
-
 
3498
    var get$5 = function (_win) {
-
 
3499
      var win = _win === undefined ? window : _win;
-
 
3500
      return Optional.from(win['visualViewport']);
-
 
3501
    };
-
 
3502
    var bounds$1 = function (x, y, width, height) {
-
 
3503
      return {
-
 
3504
        x: x,
-
 
3505
        y: y,
-
 
3506
        width: width,
-
 
3507
        height: height,
-
 
3508
        right: x + width,
-
 
3509
        bottom: y + height
-
 
3510
      };
-
 
3511
    };
-
 
3512
    var getBounds$3 = function (_win) {
-
 
3513
      var win = _win === undefined ? window : _win;
-
 
3514
      var doc = win.document;
-
 
3515
      var scroll = get$6(SugarElement.fromDom(doc));
-
 
3516
      return get$5(win).fold(function () {
-
 
3517
        var html = win.document.documentElement;
-
 
3518
        var width = html.clientWidth;
-
 
3519
        var height = html.clientHeight;
-
 
3520
        return bounds$1(scroll.left, scroll.top, width, height);
-
 
3521
      }, function (visualViewport) {
-
 
3522
        return bounds$1(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height);
-
 
3523
      });
-
 
3524
    };
-
 
3525
 
-
 
3526
    var walkUp = function (navigation, doc) {
-
 
3527
      var frame = navigation.view(doc);
-
 
3528
      return frame.fold(constant$1([]), function (f) {
-
 
3529
        var parent = navigation.owner(f);
-
 
3530
        var rest = walkUp(navigation, parent);
-
 
3531
        return [f].concat(rest);
-
 
3532
      });
-
 
3533
    };
-
 
3534
    var pathTo = function (element, navigation) {
-
 
3535
      var d = navigation.owner(element);
-
 
3536
      var paths = walkUp(navigation, d);
-
 
3537
      return Optional.some(paths);
-
 
3538
    };
-
 
3539
 
-
 
3540
    var view = function (doc) {
-
 
3541
      var _a;
-
 
3542
      var element = doc.dom === document ? Optional.none() : Optional.from((_a = doc.dom.defaultView) === null || _a === void 0 ? void 0 : _a.frameElement);
-
 
3543
      return element.map(SugarElement.fromDom);
-
 
3544
    };
-
 
3545
    var owner$3 = function (element) {
-
 
3546
      return owner$4(element);
-
 
3547
    };
-
 
3548
 
-
 
3549
    var Navigation = /*#__PURE__*/Object.freeze({
-
 
3550
        __proto__: null,
-
 
3551
        view: view,
-
 
3552
        owner: owner$3
-
 
3553
    });
-
 
3554
 
-
 
3555
    var find$2 = function (element) {
-
 
3556
      var doc = SugarElement.fromDom(document);
-
 
3557
      var scroll = get$6(doc);
-
 
3558
      var path = pathTo(element, Navigation);
-
 
3559
      return path.fold(curry(absolute$3, element), function (frames) {
-
 
3560
        var offset = viewport$1(element);
-
 
3561
        var r = foldr(frames, function (b, a) {
-
 
3562
          var loc = viewport$1(a);
-
 
3563
          return {
-
 
3564
            left: b.left + loc.left,
-
 
3565
            top: b.top + loc.top
-
 
3566
          };
-
 
3567
        }, {
-
 
3568
          left: 0,
-
 
3569
          top: 0
-
 
3570
        });
-
 
3571
        return SugarPosition(r.left + offset.left + scroll.left, r.top + offset.top + scroll.top);
-
 
3572
      });
-
 
3573
    };
-
 
3574
 
-
 
3575
    var pointed = function (point, width, height) {
-
 
3576
      return {
-
 
3577
        point: point,
-
 
3578
        width: width,
-
 
3579
        height: height
-
 
3580
      };
-
 
3581
    };
-
 
3582
    var rect = function (x, y, width, height) {
-
 
3583
      return {
-
 
3584
        x: x,
-
 
3585
        y: y,
-
 
3586
        width: width,
-
 
3587
        height: height
-
 
3588
      };
-
 
3589
    };
-
 
3590
    var bounds = function (x, y, width, height) {
-
 
3591
      return {
-
 
3592
        x: x,
-
 
3593
        y: y,
-
 
3594
        width: width,
-
 
3595
        height: height,
-
 
3596
        right: x + width,
-
 
3597
        bottom: y + height
-
 
3598
      };
-
 
3599
    };
-
 
3600
    var box$1 = function (element) {
-
 
3601
      var xy = absolute$3(element);
-
 
3602
      var w = getOuter(element);
-
 
3603
      var h = getOuter$1(element);
-
 
3604
      return bounds(xy.left, xy.top, w, h);
-
 
3605
    };
-
 
3606
    var absolute$2 = function (element) {
-
 
3607
      var position = find$2(element);
-
 
3608
      var width = getOuter(element);
-
 
3609
      var height = getOuter$1(element);
-
 
3610
      return bounds(position.left, position.top, width, height);
-
 
3611
    };
-
 
3612
    var win = function () {
-
 
3613
      return getBounds$3(window);
-
 
3614
    };
-
 
3615
 
-
 
3616
    function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {
3618
    function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {
3617
      if (is(scope, a)) {
3619
      if (is(scope, a)) {
3618
        return Optional.some(scope);
3620
        return Optional.some(scope);
3619
      } else if (isFunction(isRoot) && isRoot(scope)) {
3621
      } else if (isFunction(isRoot) && isRoot(scope)) {
3620
        return Optional.none();
3622
        return Optional.none();
Line 3671... Line 3673...
3671
      return closest$3(scope, predicate, isRoot).isSome();
3673
      return closest$3(scope, predicate, isRoot).isSome();
3672
    };
3674
    };
3673
 
3675
 
3674
    var ancestor = function (scope, selector, isRoot) {
3676
    var ancestor = function (scope, selector, isRoot) {
3675
      return ancestor$1(scope, function (e) {
3677
      return ancestor$1(scope, function (e) {
3676
        return is$1(e, selector);
3678
        return is(e, selector);
3677
      }, isRoot);
3679
      }, isRoot);
3678
    };
3680
    };
3679
    var child = function (scope, selector) {
3681
    var child = function (scope, selector) {
3680
      return child$1(scope, function (e) {
3682
      return child$1(scope, function (e) {
3681
        return is$1(e, selector);
3683
        return is(e, selector);
3682
      });
3684
      });
3683
    };
3685
    };
3684
    var descendant = function (scope, selector) {
3686
    var descendant = function (scope, selector) {
3685
      return one(selector, scope);
3687
      return one(selector, scope);
3686
    };
3688
    };
3687
    var closest$1 = function (scope, selector, isRoot) {
3689
    var closest$1 = function (scope, selector, isRoot) {
3688
      var is = function (element, selector) {
3690
      var is$1 = function (element, selector) {
3689
        return is$1(element, selector);
3691
        return is(element, selector);
3690
      };
3692
      };
3691
      return ClosestOrAncestor(is, ancestor, scope, selector, isRoot);
3693
      return ClosestOrAncestor(is$1, ancestor, scope, selector, isRoot);
3692
    };
3694
    };
3693
 
3695
 
3694
    var find$1 = function (queryElem) {
3696
    var find$1 = function (queryElem) {
3695
      var dependent = closest$3(queryElem, function (elem) {
3697
      var dependent = closest$3(queryElem, function (elem) {
3696
        if (!isElement$2(elem)) {
3698
        if (!isElement$2(elem)) {
3697
          return false;
3699
          return false;
3698
        }
3700
        }
3699
        var id = get$c(elem, 'id');
3701
        var id = get$d(elem, 'id');
3700
        return id !== undefined && id.indexOf('aria-owns') > -1;
3702
        return id !== undefined && id.indexOf('aria-owns') > -1;
3701
      });
3703
      });
3702
      return dependent.bind(function (dep) {
3704
      return dependent.bind(function (dep) {
3703
        var id = get$c(dep, 'id');
3705
        var id = get$d(dep, 'id');
3704
        var dos = getRootNode(dep);
3706
        var dos = getRootNode(dep);
3705
        return descendant(dos, '[aria-owns="' + id + '"]');
3707
        return descendant(dos, '[aria-owns="' + id + '"]');
3706
      });
3708
      });
3707
    };
3709
    };
3708
    var manager = function () {
3710
    var manager = function () {
3709
      var ariaId = generate$6('aria-owns');
3711
      var ariaId = generate$6('aria-owns');
3710
      var link = function (elem) {
3712
      var link = function (elem) {
3711
        set$7(elem, 'aria-owns', ariaId);
3713
        set$8(elem, 'aria-owns', ariaId);
3712
      };
3714
      };
3713
      var unlink = function (elem) {
3715
      var unlink = function (elem) {
3714
        remove$6(elem, 'aria-owns');
3716
        remove$7(elem, 'aria-owns');
3715
      };
3717
      };
3716
      return {
3718
      return {
3717
        id: ariaId,
3719
        id: ariaId,
3718
        link: link,
3720
        link: link,
3719
        unlink: unlink
3721
        unlink: unlink
Line 4215... Line 4217...
4215
    };
4217
    };
4216
    var doCreate = function (configSchema, schemaSchema, name, active, apis, extra, state) {
4218
    var doCreate = function (configSchema, schemaSchema, name, active, apis, extra, state) {
4217
      var getConfig = function (info) {
4219
      var getConfig = function (info) {
4218
        return hasNonNullableKey(info, name) ? info[name]() : Optional.none();
4220
        return hasNonNullableKey(info, name) ? info[name]() : Optional.none();
4219
      };
4221
      };
4220
      var wrappedApis = map(apis, function (apiF, apiName) {
4222
      var wrappedApis = map$1(apis, function (apiF, apiName) {
4221
        return wrapApi(name, apiF, apiName);
4223
        return wrapApi(name, apiF, apiName);
4222
      });
4224
      });
4223
      var wrappedExtra = map(extra, function (extraF, extraName) {
4225
      var wrappedExtra = map$1(extra, function (extraF, extraName) {
4224
        return markAsExtraApi(extraF, extraName);
4226
        return markAsExtraApi(extraF, extraName);
4225
      });
4227
      });
4226
      var me = __assign(__assign(__assign({}, wrappedExtra), wrappedApis), {
4228
      var me = __assign(__assign(__assign({}, wrappedExtra), wrappedApis), {
4227
        revoke: curry(revokeBehaviour, name),
4229
        revoke: curry(revokeBehaviour, name),
4228
        config: function (spec) {
4230
        config: function (spec) {
Line 4434... Line 4436...
4434
      });
4436
      });
4435
    };
4437
    };
4436
    var toBox = function (origin, element) {
4438
    var toBox = function (origin, element) {
4437
      var rel = curry(find$2, element);
4439
      var rel = curry(find$2, element);
4438
      var position = origin.fold(rel, rel, function () {
4440
      var position = origin.fold(rel, rel, function () {
4439
        var scroll = get$6();
4441
        var scroll = get$9();
4440
        return find$2(element).translate(-scroll.left, -scroll.top);
4442
        return find$2(element).translate(-scroll.left, -scroll.top);
4441
      });
4443
      });
4442
      var width = getOuter(element);
4444
      var width = getOuter$1(element);
4443
      var height = getOuter$1(element);
4445
      var height = getOuter$2(element);
4444
      return bounds(position.left, position.top, width, height);
4446
      return bounds(position.left, position.top, width, height);
4445
    };
4447
    };
4446
    var viewport = function (origin, getBounds) {
4448
    var viewport = function (origin, getBounds) {
4447
      return getBounds.fold(function () {
4449
      return getBounds.fold(function () {
4448
        return origin.fold(win, win, bounds);
4450
        return origin.fold(win, win, bounds);
Line 4455... Line 4457...
4455
      });
4457
      });
4456
    };
4458
    };
4457
    var translate$2 = function (origin, x, y) {
4459
    var translate$2 = function (origin, x, y) {
4458
      var pos = SugarPosition(x, y);
4460
      var pos = SugarPosition(x, y);
4459
      var removeScroll = function () {
4461
      var removeScroll = function () {
4460
        var outerScroll = get$6();
4462
        var outerScroll = get$9();
4461
        return pos.translate(-outerScroll.left, -outerScroll.top);
4463
        return pos.translate(-outerScroll.left, -outerScroll.top);
4462
      };
4464
      };
4463
      return origin.fold(constant$1(pos), constant$1(pos), removeScroll);
4465
      return origin.fold(constant$1(pos), constant$1(pos), removeScroll);
4464
    };
4466
    };
4465
    var cata$1 = function (subject, onNone, onRelative, onFixed) {
4467
    var cata$1 = function (subject, onNone, onRelative, onFixed) {
Line 4479... Line 4481...
4479
      return anchor(anchorBox, origin);
4481
      return anchor(anchorBox, origin);
4480
    };
4482
    };
4481
 
4483
 
4482
    var placementAttribute = 'data-alloy-placement';
4484
    var placementAttribute = 'data-alloy-placement';
4483
    var setPlacement$1 = function (element, placement) {
4485
    var setPlacement$1 = function (element, placement) {
4484
      set$7(element, placementAttribute, placement);
4486
      set$8(element, placementAttribute, placement);
4485
    };
4487
    };
4486
    var getPlacement = function (element) {
4488
    var getPlacement = function (element) {
4487
      return getOpt(element, placementAttribute);
4489
      return getOpt(element, placementAttribute);
4488
    };
4490
    };
4489
    var reset$2 = function (element) {
4491
    var reset$2 = function (element) {
4490
      return remove$6(element, placementAttribute);
4492
      return remove$7(element, placementAttribute);
4491
    };
4493
    };
4492
 
4494
 
4493
    var adt$8 = Adt.generate([
4495
    var adt$8 = Adt.generate([
4494
      { fit: ['reposition'] },
4496
      { fit: ['reposition'] },
4495
      {
4497
      {
Line 4633... Line 4635...
4633
    var unbindable = function () {
4635
    var unbindable = function () {
4634
      return singleton(function (s) {
4636
      return singleton(function (s) {
4635
        return s.unbind();
4637
        return s.unbind();
4636
      });
4638
      });
4637
    };
4639
    };
-
 
4640
    var api$1 = function () {
-
 
4641
      var subject = destroyable();
-
 
4642
      var run = function (f) {
-
 
4643
        return subject.get().each(f);
-
 
4644
      };
-
 
4645
      return __assign(__assign({}, subject), { run: run });
-
 
4646
    };
4638
    var value$1 = function () {
4647
    var value$1 = function () {
4639
      var subject = singleton(noop);
4648
      var subject = singleton(noop);
4640
      var on = function (f) {
4649
      var on = function (f) {
4641
        return subject.get().each(f);
4650
        return subject.get().each(f);
4642
      };
4651
      };
4643
      return __assign(__assign({}, subject), { on: on });
4652
      return __assign(__assign({}, subject), { on: on });
4644
    };
4653
    };
4645
 
4654
 
4646
    var filter = always;
4655
    var filter = always;
4647
    var bind = function (element, event, handler) {
4656
    var bind = function (element, event, handler) {
4648
      return bind$1(element, event, filter, handler);
4657
      return bind$2(element, event, filter, handler);
4649
    };
4658
    };
4650
    var capture = function (element, event, handler) {
4659
    var capture = function (element, event, handler) {
4651
      return capture$1(element, event, filter, handler);
4660
      return capture$1(element, event, filter, handler);
4652
    };
4661
    };
4653
    var fromRawEvent = fromRawEvent$1;
4662
    var fromRawEvent = fromRawEvent$1;
Line 4668... Line 4677...
4668
        return mode === 'all' ? true : placer[mode] !== decision[mode];
4677
        return mode === 'all' ? true : placer[mode] !== decision[mode];
4669
      });
4678
      });
4670
    };
4679
    };
4671
    var hasChanges = function (position, intermediate) {
4680
    var hasChanges = function (position, intermediate) {
4672
      var round = function (value) {
4681
      var round = function (value) {
4673
        return parseFloat(value).toPrecision(3);
4682
        return parseFloat(value).toFixed(3);
4674
      };
4683
      };
4675
      return find$4(intermediate, function (value, key) {
4684
      return find$4(intermediate, function (value, key) {
4676
        var newValue = position[key].map(round);
4685
        var newValue = position[key].map(round);
4677
        var val = value.map(round);
4686
        var val = value.map(round);
4678
        return !equals(newValue, val);
4687
        return !equals(newValue, val);
4679
      }).isSome();
4688
      }).isSome();
4680
    };
4689
    };
4681
    var getTransitionDuration = function (element) {
4690
    var getTransitionDuration = function (element) {
4682
      var get = function (name) {
4691
      var get = function (name) {
4683
        var style = get$a(element, name);
4692
        var style = get$c(element, name);
4684
        var times = isString(style) ? style.split(/\s*,\s*/) : [];
4693
        var times = isString(style) ? style.split(/\s*,\s*/) : [];
4685
        return filter$2(times, isNotEmpty);
4694
        return filter$2(times, isNotEmpty);
4686
      };
4695
      };
4687
      var parse = function (value) {
4696
      var parse = function (value) {
4688
        if (isString(value) && /^[\d.]+/.test(value)) {
4697
        if (isString(value) && /^[\d.]+/.test(value)) {
Line 4713... Line 4722...
4713
          transitionEnd.clear();
4722
          transitionEnd.clear();
4714
          transitionCancel.clear();
4723
          transitionCancel.clear();
4715
          var type = e === null || e === void 0 ? void 0 : e.raw.type;
4724
          var type = e === null || e === void 0 ? void 0 : e.raw.type;
4716
          if (isNullable(type) || type === transitionend()) {
4725
          if (isNullable(type) || type === transitionend()) {
4717
            clearTimeout(timer);
4726
            clearTimeout(timer);
4718
            remove$6(element, timerAttr);
4727
            remove$7(element, timerAttr);
4719
            remove$2(element, transition.classes);
4728
            remove$1(element, transition.classes);
4720
          }
4729
          }
4721
        }
4730
        }
4722
      };
4731
      };
4723
      var transitionStarted = function () {
4732
      var transitionStarted = function () {
4724
        transitionEnd.set(bind(element, transitionend(), transitionDone));
4733
        transitionEnd.set(bind(element, transitionend(), transitionDone));
Line 4735... Line 4744...
4735
        transitionStarted();
4744
        transitionStarted();
4736
      }
4745
      }
4737
      var duration = getTransitionDuration(element);
4746
      var duration = getTransitionDuration(element);
4738
      requestAnimationFrame(function () {
4747
      requestAnimationFrame(function () {
4739
        timer = setTimeout(transitionDone, duration + 17);
4748
        timer = setTimeout(transitionDone, duration + 17);
4740
        set$7(element, timerAttr, timer);
4749
        set$8(element, timerAttr, timer);
4741
      });
4750
      });
4742
    };
4751
    };
4743
    var startTransitioning = function (element, transition) {
4752
    var startTransitioning = function (element, transition) {
4744
      add$1(element, transition.classes);
4753
      add$1(element, transition.classes);
4745
      getOpt(element, timerAttr).each(function (timerId) {
4754
      getOpt(element, timerAttr).each(function (timerId) {
4746
        clearTimeout(parseInt(timerId, 10));
4755
        clearTimeout(parseInt(timerId, 10));
4747
        remove$6(element, timerAttr);
4756
        remove$7(element, timerAttr);
4748
      });
4757
      });
4749
      setupTransitionListeners(element, transition);
4758
      setupTransitionListeners(element, transition);
4750
    };
4759
    };
4751
    var applyTransitionCss = function (element, origin, position, transition, decision, lastPlacement) {
4760
    var applyTransitionCss = function (element, origin, position, transition, decision, lastPlacement) {
4752
      var shouldTransition = shouldApplyTransitionCss(transition, decision, lastPlacement);
4761
      var shouldTransition = shouldApplyTransitionCss(transition, decision, lastPlacement);
4753
      if (shouldTransition || isTransitioning$1(element, transition)) {
4762
      if (shouldTransition || isTransitioning$1(element, transition)) {
4754
        set$6(element, 'position', position.position);
4763
        set$7(element, 'position', position.position);
4755
        var rect = toBox(origin, element);
4764
        var rect = toBox(origin, element);
4756
        var intermediatePosition_1 = reposition(origin, __assign(__assign({}, decision), { rect: rect }));
4765
        var intermediatePosition_1 = reposition(origin, __assign(__assign({}, decision), { rect: rect }));
4757
        var intermediateCssOptions = mapToObject(properties, function (prop) {
4766
        var intermediateCssOptions = mapToObject(properties, function (prop) {
4758
          return intermediatePosition_1[prop];
4767
          return intermediatePosition_1[prop];
4759
        });
4768
        });
Line 4763... Line 4772...
4763
            startTransitioning(element, transition);
4772
            startTransitioning(element, transition);
4764
          }
4773
          }
4765
          reflow(element);
4774
          reflow(element);
4766
        }
4775
        }
4767
      } else {
4776
      } else {
4768
        remove$2(element, transition.classes);
4777
        remove$1(element, transition.classes);
4769
      }
4778
      }
4770
    };
4779
    };
4771
 
4780
 
4772
    var elementSize = function (p) {
4781
    var elementSize = function (p) {
4773
      return {
4782
      return {
4774
        width: getOuter(p),
4783
        width: getOuter$1(p),
4775
        height: getOuter$1(p)
4784
        height: getOuter$2(p)
4776
      };
4785
      };
4777
    };
4786
    };
4778
    var layout = function (anchorBox, element, bubbles, options) {
4787
    var layout = function (anchorBox, element, bubbles, options) {
4779
      remove$1(element, 'max-height');
4788
      remove$6(element, 'max-height');
4780
      remove$1(element, 'max-width');
4789
      remove$6(element, 'max-width');
4781
      var elementBox = elementSize(element);
4790
      var elementBox = elementSize(element);
4782
      return attempts(element, options.preference, anchorBox, elementBox, bubbles, options.bounds);
4791
      return attempts(element, options.preference, anchorBox, elementBox, bubbles, options.bounds);
4783
    };
4792
    };
4784
    var setClasses = function (element, decision) {
4793
    var setClasses = function (element, decision) {
4785
      var classInfo = decision.classes;
4794
      var classInfo = decision.classes;
4786
      remove$2(element, classInfo.off);
4795
      remove$1(element, classInfo.off);
4787
      add$1(element, classInfo.on);
4796
      add$1(element, classInfo.on);
4788
    };
4797
    };
4789
    var setHeight = function (element, decision, options) {
4798
    var setHeight = function (element, decision, options) {
4790
      var maxHeightFunction = options.maxHeightFunction;
4799
      var maxHeightFunction = options.maxHeightFunction;
4791
      maxHeightFunction(element, decision.maxHeight);
4800
      maxHeightFunction(element, decision.maxHeight);
Line 4996... Line 5005...
4996
      return function (element) {
5005
      return function (element) {
4997
        return getDirection(element) === 'rtl' ? isRtl : isLtr;
5006
        return getDirection(element) === 'rtl' ? isRtl : isLtr;
4998
      };
5007
      };
4999
    };
5008
    };
5000
    var getDirection = function (element) {
5009
    var getDirection = function (element) {
5001
      return get$a(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
5010
      return get$c(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
5002
    };
5011
    };
5003
 
5012
 
5004
    var AttributeValue;
5013
    var AttributeValue;
5005
    (function (AttributeValue) {
5014
    (function (AttributeValue) {
5006
      AttributeValue['TopToBottom'] = 'toptobottom';
5015
      AttributeValue['TopToBottom'] = 'toptobottom';
5007
      AttributeValue['BottomToTop'] = 'bottomtotop';
5016
      AttributeValue['BottomToTop'] = 'bottomtotop';
5008
    }(AttributeValue || (AttributeValue = {})));
5017
    }(AttributeValue || (AttributeValue = {})));
5009
    var Attribute = 'data-alloy-vertical-dir';
5018
    var Attribute = 'data-alloy-vertical-dir';
5010
    var isBottomToTopDir = function (el) {
5019
    var isBottomToTopDir = function (el) {
5011
      return closest$2(el, function (current) {
5020
      return closest$2(el, function (current) {
5012
        return isElement$2(current) && get$c(current, 'data-alloy-vertical-dir') === AttributeValue.BottomToTop;
5021
        return isElement$2(current) && get$d(current, 'data-alloy-vertical-dir') === AttributeValue.BottomToTop;
5013
      });
5022
      });
5014
    };
5023
    };
5015
 
5024
 
5016
    var schema$y = function () {
5025
    var schema$y = function () {
5017
      return optionObjOf('layouts', [
5026
      return optionObjOf('layouts', [
Line 5129... Line 5138...
5129
      };
5138
      };
5130
      return Optional.from(win.frameElement).map(SugarElement.fromDom).filter(hasSameOwner).map(absolute$3);
5139
      return Optional.from(win.frameElement).map(SugarElement.fromDom).filter(hasSameOwner).map(absolute$3);
5131
    };
5140
    };
5132
    var getRootPoint = function (component, origin, anchorInfo) {
5141
    var getRootPoint = function (component, origin, anchorInfo) {
5133
      var doc = owner$4(component.element);
5142
      var doc = owner$4(component.element);
5134
      var outerScroll = get$6(doc);
5143
      var outerScroll = get$9(doc);
5135
      var offset = getOffset(component, origin, anchorInfo).getOr(outerScroll);
5144
      var offset = getOffset(component, origin, anchorInfo).getOr(outerScroll);
5136
      return absolute$1(offset, outerScroll.left, outerScroll.top);
5145
      return absolute$1(offset, outerScroll.left, outerScroll.top);
5137
    };
5146
    };
5138
 
5147
 
5139
    var getBox = function (left, top, width, height) {
5148
    var getBox = function (left, top, width, height) {
Line 5581... Line 5590...
5581
      var selectionBox = getAnchorSelection(win, anchorInfo).bind(function (sel) {
5590
      var selectionBox = getAnchorSelection(win, anchorInfo).bind(function (sel) {
5582
        var optRect = getBounds$1(win, SimSelection.exactFromRange(sel)).orThunk(function () {
5591
        var optRect = getBounds$1(win, SimSelection.exactFromRange(sel)).orThunk(function () {
5583
          var x = SugarElement.fromText(zeroWidth);
5592
          var x = SugarElement.fromText(zeroWidth);
5584
          before$2(sel.start, x);
5593
          before$2(sel.start, x);
5585
          var rect = getFirstRect(win, SimSelection.exact(x, 0, x, 1));
5594
          var rect = getFirstRect(win, SimSelection.exact(x, 0, x, 1));
5586
          remove$7(x);
5595
          remove$5(x);
5587
          return rect;
5596
          return rect;
5588
        });
5597
        });
5589
        return optRect.bind(function (rawRect) {
5598
        return optRect.bind(function (rawRect) {
5590
          return getBox(rawRect.left, rawRect.top, rawRect.width, rawRect.height);
5599
          return getBox(rawRect.left, rawRect.top, rawRect.width, rawRect.height);
5591
        });
5600
        });
Line 5727... Line 5736...
5727
      var placeeDetail = asRawOrDie$1('placement.info', objOf(PlacementSchema), placementSpec);
5736
      var placeeDetail = asRawOrDie$1('placement.info', objOf(PlacementSchema), placementSpec);
5728
      var anchorage = placeeDetail.anchor;
5737
      var anchorage = placeeDetail.anchor;
5729
      var element = placee.element;
5738
      var element = placee.element;
5730
      var placeeState = posState.get(placee.uid);
5739
      var placeeState = posState.get(placee.uid);
5731
      preserve$1(function () {
5740
      preserve$1(function () {
5732
        set$6(element, 'position', 'fixed');
5741
        set$7(element, 'position', 'fixed');
5733
        var oldVisibility = getRaw(element, 'visibility');
5742
        var oldVisibility = getRaw(element, 'visibility');
5734
        set$6(element, 'visibility', 'hidden');
5743
        set$7(element, 'visibility', 'hidden');
5735
        var origin = posConfig.useFixed() ? getFixedOrigin() : getRelativeOrigin(component);
5744
        var origin = posConfig.useFixed() ? getFixedOrigin() : getRelativeOrigin(component);
5736
        var placer = anchorage.placement;
5745
        var placer = anchorage.placement;
5737
        var getBounds = bounds.map(constant$1).or(posConfig.getBounds);
5746
        var getBounds = bounds.map(constant$1).or(posConfig.getBounds);
5738
        placer(component, anchorage, origin).each(function (anchoring) {
5747
        placer(component, anchorage, origin).each(function (anchoring) {
5739
          var doPlace = anchoring.placer.getOr(place);
5748
          var doPlace = anchoring.placer.getOr(place);
5740
          var newState = doPlace(component, origin, anchoring, getBounds, placee, placeeState, placeeDetail.transition);
5749
          var newState = doPlace(component, origin, anchoring, getBounds, placee, placeeState, placeeDetail.transition);
5741
          posState.set(placee.uid, newState);
5750
          posState.set(placee.uid, newState);
5742
        });
5751
        });
5743
        oldVisibility.fold(function () {
5752
        oldVisibility.fold(function () {
5744
          remove$1(element, 'visibility');
5753
          remove$6(element, 'visibility');
5745
        }, function (vis) {
5754
        }, function (vis) {
5746
          set$6(element, 'visibility', vis);
5755
          set$7(element, 'visibility', vis);
5747
        });
5756
        });
5748
        if (getRaw(element, 'left').isNone() && getRaw(element, 'top').isNone() && getRaw(element, 'right').isNone() && getRaw(element, 'bottom').isNone() && is(getRaw(element, 'position'), 'fixed')) {
5757
        if (getRaw(element, 'left').isNone() && getRaw(element, 'top').isNone() && getRaw(element, 'right').isNone() && getRaw(element, 'bottom').isNone() && is$1(getRaw(element, 'position'), 'fixed')) {
5749
          remove$1(element, 'position');
5758
          remove$6(element, 'position');
5750
        }
5759
        }
5751
      }, element);
5760
      }, element);
5752
    };
5761
    };
5753
    var getMode = function (component, pConfig, _pState) {
5762
    var getMode = function (component, pConfig, _pState) {
5754
      return pConfig.useFixed() ? 'fixed' : 'absolute';
5763
      return pConfig.useFixed() ? 'fixed' : 'absolute';
Line 5760... Line 5769...
5760
        'left',
5769
        'left',
5761
        'right',
5770
        'right',
5762
        'top',
5771
        'top',
5763
        'bottom'
5772
        'bottom'
5764
      ], function (prop) {
5773
      ], function (prop) {
5765
        return remove$1(element, prop);
5774
        return remove$6(element, prop);
5766
      });
5775
      });
5767
      reset$2(element);
5776
      reset$2(element);
5768
      posState.clear(placee.uid);
5777
      posState.clear(placee.uid);
5769
    };
5778
    };
5770
 
5779
 
Line 5828... Line 5837...
5828
    var attach$1 = function (parent, child) {
5837
    var attach$1 = function (parent, child) {
5829
      append$2(parent.element, child.element);
5838
      append$2(parent.element, child.element);
5830
    };
5839
    };
5831
    var detachChildren$1 = function (component) {
5840
    var detachChildren$1 = function (component) {
5832
      each$1(component.components(), function (childComp) {
5841
      each$1(component.components(), function (childComp) {
5833
        return remove$7(childComp.element);
5842
        return remove$5(childComp.element);
5834
      });
5843
      });
5835
      empty(component.element);
5844
      empty(component.element);
5836
      component.syncComponents();
5845
      component.syncComponents();
5837
    };
5846
    };
5838
    var replaceChildren = function (component, newChildren) {
5847
    var replaceChildren = function (component, newChildren) {
Line 5868... Line 5877...
5868
      }
5877
      }
5869
      parent.syncComponents();
5878
      parent.syncComponents();
5870
    };
5879
    };
5871
    var doDetach = function (component) {
5880
    var doDetach = function (component) {
5872
      fireDetaching(component);
5881
      fireDetaching(component);
5873
      remove$7(component.element);
5882
      remove$5(component.element);
5874
      component.getSystem().removeFromWorld(component);
5883
      component.getSystem().removeFromWorld(component);
5875
    };
5884
    };
5876
    var detach = function (component) {
5885
    var detach = function (component) {
5877
      var parent$1 = parent(component.element).bind(function (p) {
5886
      var parent$1 = parent(component.element).bind(function (p) {
5878
        return component.getSystem().getByDom(p).toOptional();
5887
        return component.getSystem().getByDom(p).toOptional();
Line 5904... Line 5913...
5904
    var detachSystem = function (guiSystem) {
5913
    var detachSystem = function (guiSystem) {
5905
      var children$1 = children(guiSystem.element);
5914
      var children$1 = children(guiSystem.element);
5906
      each$1(children$1, function (child) {
5915
      each$1(children$1, function (child) {
5907
        guiSystem.getByDom(child).each(fireDetaching);
5916
        guiSystem.getByDom(child).each(fireDetaching);
5908
      });
5917
      });
5909
      remove$7(guiSystem.element);
5918
      remove$5(guiSystem.element);
5910
    };
5919
    };
5911
 
5920
 
5912
    var rebuild = function (sandbox, sConfig, sState, data) {
5921
    var rebuild = function (sandbox, sConfig, sState, data) {
5913
      sState.get().each(function (_data) {
5922
      sState.get().each(function (_data) {
5914
        detachChildren(sandbox);
5923
        detachChildren(sandbox);
Line 5955... Line 5964...
5955
    var getState$2 = function (_sandbox, _sConfig, sState) {
5964
    var getState$2 = function (_sandbox, _sConfig, sState) {
5956
      return sState.get();
5965
      return sState.get();
5957
    };
5966
    };
5958
    var store = function (sandbox, cssKey, attr, newValue) {
5967
    var store = function (sandbox, cssKey, attr, newValue) {
5959
      getRaw(sandbox.element, cssKey).fold(function () {
5968
      getRaw(sandbox.element, cssKey).fold(function () {
5960
        remove$6(sandbox.element, attr);
5969
        remove$7(sandbox.element, attr);
5961
      }, function (v) {
5970
      }, function (v) {
5962
        set$7(sandbox.element, attr, v);
5971
        set$8(sandbox.element, attr, v);
5963
      });
5972
      });
5964
      set$6(sandbox.element, cssKey, newValue);
5973
      set$7(sandbox.element, cssKey, newValue);
5965
    };
5974
    };
5966
    var restore = function (sandbox, cssKey, attr) {
5975
    var restore = function (sandbox, cssKey, attr) {
5967
      getOpt(sandbox.element, attr).fold(function () {
5976
      getOpt(sandbox.element, attr).fold(function () {
5968
        return remove$1(sandbox.element, cssKey);
5977
        return remove$6(sandbox.element, cssKey);
5969
      }, function (oldValue) {
5978
      }, function (oldValue) {
5970
        return set$6(sandbox.element, cssKey, oldValue);
5979
        return set$7(sandbox.element, cssKey, oldValue);
5971
      });
5980
      });
5972
    };
5981
    };
5973
    var cloak = function (sandbox, sConfig, _sState) {
5982
    var cloak = function (sandbox, sConfig, _sState) {
5974
      var sink = sConfig.getAttachPoint(sandbox);
5983
      var sink = sConfig.getAttachPoint(sandbox);
5975
      set$6(sandbox.element, 'position', Positioning.getMode(sink));
5984
      set$7(sandbox.element, 'position', Positioning.getMode(sink));
5976
      store(sandbox, 'visibility', sConfig.cloakVisibilityAttr, 'hidden');
5985
      store(sandbox, 'visibility', sConfig.cloakVisibilityAttr, 'hidden');
5977
    };
5986
    };
5978
    var hasPosition = function (element) {
5987
    var hasPosition = function (element) {
5979
      return exists([
5988
      return exists([
5980
        'top',
5989
        'top',
Line 5985... Line 5994...
5985
        return getRaw(element, pos).isSome();
5994
        return getRaw(element, pos).isSome();
5986
      });
5995
      });
5987
    };
5996
    };
5988
    var decloak = function (sandbox, sConfig, _sState) {
5997
    var decloak = function (sandbox, sConfig, _sState) {
5989
      if (!hasPosition(sandbox.element)) {
5998
      if (!hasPosition(sandbox.element)) {
5990
        remove$1(sandbox.element, 'position');
5999
        remove$6(sandbox.element, 'position');
5991
      }
6000
      }
5992
      restore(sandbox, 'visibility', sConfig.cloakVisibilityAttr);
6001
      restore(sandbox, 'visibility', sConfig.cloakVisibilityAttr);
5993
    };
6002
    };
5994
 
6003
 
5995
    var SandboxApis = /*#__PURE__*/Object.freeze({
6004
    var SandboxApis = /*#__PURE__*/Object.freeze({
Line 6339... Line 6348...
6339
    };
6348
    };
6340
    var get$2 = function (data) {
6349
    var get$2 = function (data) {
6341
      return data.dump;
6350
      return data.dump;
6342
    };
6351
    };
6343
    var augment = function (data, original) {
6352
    var augment = function (data, original) {
6344
      return __assign(__assign({}, data.dump), derive$1(original));
6353
      return __assign(__assign({}, derive$1(original)), data.dump);
6345
    };
6354
    };
6346
    var SketchBehaviours = {
6355
    var SketchBehaviours = {
6347
      field: field,
6356
      field: field,
6348
      augment: augment,
6357
      augment: augment,
6349
      get: get$2
6358
      get: get$2
Line 6435... Line 6444...
6435
        used: used,
6444
        used: used,
6436
        replace: replace
6445
        replace: replace
6437
      };
6446
      };
6438
    };
6447
    };
6439
    var substitutePlaces = function (owner, detail, components, placeholders) {
6448
    var substitutePlaces = function (owner, detail, components, placeholders) {
6440
      var ps = map(placeholders, function (ph, name) {
6449
      var ps = map$1(placeholders, function (ph, name) {
6441
        return oneReplace(name, ph);
6450
        return oneReplace(name, ph);
6442
      });
6451
      });
6443
      var outcome = substituteAll(owner, detail, components, ps);
6452
      var outcome = substituteAll(owner, detail, components, ps);
6444
      each(ps, function (p) {
6453
      each(ps, function (p) {
6445
        if (p.used() === false && p.required()) {
6454
        if (p.used() === false && p.required()) {
Line 6634... Line 6643...
6634
      });
6643
      });
6635
      return r;
6644
      return r;
6636
    };
6645
    };
6637
    var getAllParts = function (component, detail) {
6646
    var getAllParts = function (component, detail) {
6638
      var system = component.getSystem();
6647
      var system = component.getSystem();
6639
      return map(detail.partUids, function (pUid, _k) {
6648
      return map$1(detail.partUids, function (pUid, _k) {
6640
        return constant$1(system.getByUid(pUid));
6649
        return constant$1(system.getByUid(pUid));
6641
      });
6650
      });
6642
    };
6651
    };
6643
    var getAllPartNames = function (detail) {
6652
    var getAllPartNames = function (detail) {
6644
      return keys(detail.partUids);
6653
      return keys(detail.partUids);
Line 6742... Line 6751...
6742
    var single = function (rawConfig) {
6751
    var single = function (rawConfig) {
6743
      var config = asRawOrDie$1('Sketcher for ' + rawConfig.name, singleSchema, rawConfig);
6752
      var config = asRawOrDie$1('Sketcher for ' + rawConfig.name, singleSchema, rawConfig);
6744
      var sketch = function (spec) {
6753
      var sketch = function (spec) {
6745
        return single$1(config.name, config.configFields, config.factory, spec);
6754
        return single$1(config.name, config.configFields, config.factory, spec);
6746
      };
6755
      };
6747
      var apis = map(config.apis, makeApi);
6756
      var apis = map$1(config.apis, makeApi);
6748
      var extraApis = map(config.extraApis, function (f, k) {
6757
      var extraApis = map$1(config.extraApis, function (f, k) {
6749
        return markAsExtraApi(f, k);
6758
        return markAsExtraApi(f, k);
6750
      });
6759
      });
6751
      return __assign(__assign({
6760
      return __assign(__assign({
6752
        name: config.name,
6761
        name: config.name,
6753
        configFields: config.configFields,
6762
        configFields: config.configFields,
Line 6758... Line 6767...
6758
      var config = asRawOrDie$1('Sketcher for ' + rawConfig.name, compositeSchema, rawConfig);
6767
      var config = asRawOrDie$1('Sketcher for ' + rawConfig.name, compositeSchema, rawConfig);
6759
      var sketch = function (spec) {
6768
      var sketch = function (spec) {
6760
        return composite$1(config.name, config.configFields, config.partFields, config.factory, spec);
6769
        return composite$1(config.name, config.configFields, config.partFields, config.factory, spec);
6761
      };
6770
      };
6762
      var parts = generate$3(config.name, config.partFields);
6771
      var parts = generate$3(config.name, config.partFields);
6763
      var apis = map(config.apis, makeApi);
6772
      var apis = map$1(config.apis, makeApi);
6764
      var extraApis = map(config.extraApis, function (f, k) {
6773
      var extraApis = map$1(config.extraApis, function (f, k) {
6765
        return markAsExtraApi(f, k);
6774
        return markAsExtraApi(f, k);
6766
      });
6775
      });
6767
      return __assign(__assign({
6776
      return __assign(__assign({
6768
        name: config.name,
6777
        name: config.name,
6769
        partFields: config.partFields,
6778
        partFields: config.partFields,
Line 6772... Line 6781...
6772
        parts: parts
6781
        parts: parts
6773
      }, apis), extraApis);
6782
      }, apis), extraApis);
6774
    };
6783
    };
6775
 
6784
 
6776
    var inside = function (target) {
6785
    var inside = function (target) {
6777
      return name$2(target) === 'input' && get$c(target, 'type') !== 'radio' || name$2(target) === 'textarea';
6786
      return name$2(target) === 'input' && get$d(target, 'type') !== 'radio' || name$2(target) === 'textarea';
6778
    };
6787
    };
6779
 
6788
 
6780
    var getCurrent = function (component, composeConfig, _composeState) {
6789
    var getCurrent = function (component, composeConfig, _composeState) {
6781
      return composeConfig.find(component);
6790
      return composeConfig.find(component);
6782
    };
6791
    };
Line 6809... Line 6818...
6809
    };
6818
    };
6810
    var nativeIsDisabled = function (component) {
6819
    var nativeIsDisabled = function (component) {
6811
      return has$1(component.element, 'disabled');
6820
      return has$1(component.element, 'disabled');
6812
    };
6821
    };
6813
    var nativeDisable = function (component) {
6822
    var nativeDisable = function (component) {
6814
      set$7(component.element, 'disabled', 'disabled');
6823
      set$8(component.element, 'disabled', 'disabled');
6815
    };
6824
    };
6816
    var nativeEnable = function (component) {
6825
    var nativeEnable = function (component) {
6817
      remove$6(component.element, 'disabled');
6826
      remove$7(component.element, 'disabled');
6818
    };
6827
    };
6819
    var ariaIsDisabled = function (component) {
6828
    var ariaIsDisabled = function (component) {
6820
      return get$c(component.element, 'aria-disabled') === 'true';
6829
      return get$d(component.element, 'aria-disabled') === 'true';
6821
    };
6830
    };
6822
    var ariaDisable = function (component) {
6831
    var ariaDisable = function (component) {
6823
      set$7(component.element, 'aria-disabled', 'true');
6832
      set$8(component.element, 'aria-disabled', 'true');
6824
    };
6833
    };
6825
    var ariaEnable = function (component) {
6834
    var ariaEnable = function (component) {
6826
      set$7(component.element, 'aria-disabled', 'false');
6835
      set$8(component.element, 'aria-disabled', 'false');
6827
    };
6836
    };
6828
    var disable$1 = function (component, disableConfig, _disableState) {
6837
    var disable$1 = function (component, disableConfig, _disableState) {
6829
      disableConfig.disableClass.each(function (disableClass) {
6838
      disableConfig.disableClass.each(function (disableClass) {
6830
        add$2(component.element, disableClass);
6839
        add$2(component.element, disableClass);
6831
      });
6840
      });
Line 6833... Line 6842...
6833
      f(component);
6842
      f(component);
6834
      disableConfig.onDisabled(component);
6843
      disableConfig.onDisabled(component);
6835
    };
6844
    };
6836
    var enable$1 = function (component, disableConfig, _disableState) {
6845
    var enable$1 = function (component, disableConfig, _disableState) {
6837
      disableConfig.disableClass.each(function (disableClass) {
6846
      disableConfig.disableClass.each(function (disableClass) {
6838
        remove$3(component.element, disableClass);
6847
        remove$2(component.element, disableClass);
6839
      });
6848
      });
6840
      var f = hasNative(component, disableConfig) ? nativeEnable : ariaEnable;
6849
      var f = hasNative(component, disableConfig) ? nativeEnable : ariaEnable;
6841
      f(component);
6850
      f(component);
6842
      disableConfig.onEnabled(component);
6851
      disableConfig.onEnabled(component);
6843
    };
6852
    };
Line 6895... Line 6904...
6895
      var highlighted = descendants(component.element, '.' + hConfig.highlightClass);
6904
      var highlighted = descendants(component.element, '.' + hConfig.highlightClass);
6896
      each$1(highlighted, function (h) {
6905
      each$1(highlighted, function (h) {
6897
        if (!exists(skip, function (skipComp) {
6906
        if (!exists(skip, function (skipComp) {
6898
            return skipComp.element === h;
6907
            return skipComp.element === h;
6899
          })) {
6908
          })) {
6900
          remove$3(h, hConfig.highlightClass);
6909
          remove$2(h, hConfig.highlightClass);
6901
          component.getSystem().getByDom(h).each(function (target) {
6910
          component.getSystem().getByDom(h).each(function (target) {
6902
            hConfig.onDehighlight(component, target);
6911
            hConfig.onDehighlight(component, target);
6903
            emit(target, dehighlight$1());
6912
            emit(target, dehighlight$1());
6904
          });
6913
          });
6905
        }
6914
        }
Line 6908... Line 6917...
6908
    var dehighlightAll = function (component, hConfig, hState) {
6917
    var dehighlightAll = function (component, hConfig, hState) {
6909
      return dehighlightAllExcept(component, hConfig, hState, []);
6918
      return dehighlightAllExcept(component, hConfig, hState, []);
6910
    };
6919
    };
6911
    var dehighlight = function (component, hConfig, hState, target) {
6920
    var dehighlight = function (component, hConfig, hState, target) {
6912
      if (isHighlighted(component, hConfig, hState, target)) {
6921
      if (isHighlighted(component, hConfig, hState, target)) {
6913
        remove$3(target.element, hConfig.highlightClass);
6922
        remove$2(target.element, hConfig.highlightClass);
6914
        hConfig.onDehighlight(component, target);
6923
        hConfig.onDehighlight(component, target);
6915
        emit(target, dehighlight$1());
6924
        emit(target, dehighlight$1());
6916
      }
6925
      }
6917
    };
6926
    };
6918
    var highlight = function (component, hConfig, hState, target) {
6927
    var highlight = function (component, hConfig, hState, target) {
Line 7222... Line 7231...
7222
      ].concat([cyclicField]);
7231
      ].concat([cyclicField]);
7223
      var isVisible = function (tabbingConfig, element) {
7232
      var isVisible = function (tabbingConfig, element) {
7224
        var target = tabbingConfig.visibilitySelector.bind(function (sel) {
7233
        var target = tabbingConfig.visibilitySelector.bind(function (sel) {
7225
          return closest$1(element, sel);
7234
          return closest$1(element, sel);
7226
        }).getOr(element);
7235
        }).getOr(element);
7227
        return get$8(target) > 0;
7236
        return get$b(target) > 0;
7228
      };
7237
      };
7229
      var findInitial = function (component, tabbingConfig) {
7238
      var findInitial = function (component, tabbingConfig) {
7230
        var tabstops = descendants(component.element, tabbingConfig.selector);
7239
        var tabstops = descendants(component.element, tabbingConfig.selector);
7231
        var visibles = filter$2(tabstops, function (elem) {
7240
        var visibles = filter$2(tabstops, function (elem) {
7232
          return isVisible(tabbingConfig, elem);
7241
          return isVisible(tabbingConfig, elem);
Line 7555... Line 7564...
7555
      return Optional.some(focusIn$3);
7564
      return Optional.some(focusIn$3);
7556
    });
7565
    });
7557
 
7566
 
7558
    var horizontal = function (container, selector, current, delta) {
7567
    var horizontal = function (container, selector, current, delta) {
7559
      var isDisabledButton = function (candidate) {
7568
      var isDisabledButton = function (candidate) {
7560
        return name$2(candidate) === 'button' && get$c(candidate, 'disabled') === 'disabled';
7569
        return name$2(candidate) === 'button' && get$d(candidate, 'disabled') === 'disabled';
7561
      };
7570
      };
7562
      var tryCycle = function (initial, index, candidates) {
7571
      var tryCycle = function (initial, index, candidates) {
7563
        var newIndex = cycleBy(index, delta, 0, candidates.length - 1);
7572
        var newIndex = cycleBy(index, delta, 0, candidates.length - 1);
7564
        if (newIndex === initial) {
7573
        if (newIndex === initial) {
7565
          return Optional.none();
7574
          return Optional.none();
Line 8069... Line 8078...
8069
    var updateClass = function (component, toggleConfig, toggleState) {
8078
    var updateClass = function (component, toggleConfig, toggleState) {
8070
      toggleConfig.toggleClass.each(function (toggleClass) {
8079
      toggleConfig.toggleClass.each(function (toggleClass) {
8071
        if (toggleState.get()) {
8080
        if (toggleState.get()) {
8072
          add$2(component.element, toggleClass);
8081
          add$2(component.element, toggleClass);
8073
        } else {
8082
        } else {
8074
          remove$3(component.element, toggleClass);
8083
          remove$2(component.element, toggleClass);
8075
        }
8084
        }
8076
      });
8085
      });
8077
    };
8086
    };
8078
    var toggle$2 = function (component, toggleConfig, toggleState) {
8087
    var toggle$2 = function (component, toggleConfig, toggleState) {
8079
      set$1(component, toggleConfig, toggleState, !toggleState.get());
8088
      set$1(component, toggleConfig, toggleState, !toggleState.get());
Line 8126... Line 8135...
8126
        exhibit: exhibit$3,
8135
        exhibit: exhibit$3,
8127
        events: events$b
8136
        events: events$b
8128
    });
8137
    });
8129
 
8138
 
8130
    var updatePressed = function (component, ariaInfo, status) {
8139
    var updatePressed = function (component, ariaInfo, status) {
8131
      set$7(component.element, 'aria-pressed', status);
8140
      set$8(component.element, 'aria-pressed', status);
8132
      if (ariaInfo.syncWithExpanded) {
8141
      if (ariaInfo.syncWithExpanded) {
8133
        updateExpanded(component, ariaInfo, status);
8142
        updateExpanded(component, ariaInfo, status);
8134
      }
8143
      }
8135
    };
8144
    };
8136
    var updateSelected = function (component, ariaInfo, status) {
8145
    var updateSelected = function (component, ariaInfo, status) {
8137
      set$7(component.element, 'aria-selected', status);
8146
      set$8(component.element, 'aria-selected', status);
8138
    };
8147
    };
8139
    var updateChecked = function (component, ariaInfo, status) {
8148
    var updateChecked = function (component, ariaInfo, status) {
8140
      set$7(component.element, 'aria-checked', status);
8149
      set$8(component.element, 'aria-checked', status);
8141
    };
8150
    };
8142
    var updateExpanded = function (component, ariaInfo, status) {
8151
    var updateExpanded = function (component, ariaInfo, status) {
8143
      set$7(component.element, 'aria-expanded', status);
8152
      set$8(component.element, 'aria-expanded', status);
8144
    };
8153
    };
8145
 
8154
 
8146
    var ToggleSchema = [
8155
    var ToggleSchema = [
8147
      defaulted('selected', false),
8156
      defaulted('selected', false),
8148
      option('toggleClass'),
8157
      option('toggleClass'),
Line 8228... Line 8237...
8228
            store: {
8237
            store: {
8229
              mode: 'memory',
8238
              mode: 'memory',
8230
              initialValue: detail.data
8239
              initialValue: detail.data
8231
            }
8240
            }
8232
          }),
8241
          }),
8233
          config('item-type-events', __spreadArray(__spreadArray([], pointerEvents()), [
8242
          config('item-type-events', __spreadArray(__spreadArray([], pointerEvents(), true), [
8234
            run$1(mouseover(), onHover),
8243
            run$1(mouseover(), onHover),
8235
            run$1(focusItem(), Focusing.focus)
8244
            run$1(focusItem(), Focusing.focus)
8236
          ]))
8245
          ], false))
8237
        ]),
8246
        ]),
8238
        components: detail.components,
8247
        components: detail.components,
8239
        eventOrder: detail.eventOrder
8248
        eventOrder: detail.eventOrder
8240
      };
8249
      };
8241
    };
8250
    };
Line 8542... Line 8551...
8542
          items[item] = menu;
8551
          items[item] = menu;
8543
        });
8552
        });
8544
      });
8553
      });
8545
      var byItem = expansions;
8554
      var byItem = expansions;
8546
      var byMenu = transpose$1(expansions);
8555
      var byMenu = transpose$1(expansions);
8547
      var menuPaths = map(byMenu, function (_triggerItem, submenu) {
8556
      var menuPaths = map$1(byMenu, function (_triggerItem, submenu) {
8548
        return [submenu].concat(trace(items, byItem, byMenu, submenu));
8557
        return [submenu].concat(trace(items, byItem, byMenu, submenu));
8549
      });
8558
      });
8550
      return map(items, function (menu) {
8559
      return map$1(items, function (menu) {
8551
        return get$e(menuPaths, menu).getOr([menu]);
8560
        return get$e(menuPaths, menu).getOr([menu]);
8552
      });
8561
      });
8553
    };
8562
    };
8554
 
8563
 
8555
    var init$c = function () {
8564
    var init$c = function () {
Line 8606... Line 8615...
8606
        });
8615
        });
8607
        return get$e(paths.get(), itemValue).bind(function (path) {
8616
        return get$e(paths.get(), itemValue).bind(function (path) {
8608
          var revPath = reverse(extraPath.concat(path));
8617
          var revPath = reverse(extraPath.concat(path));
8609
          var triggers = bind$3(revPath, function (menuValue, menuIndex) {
8618
          var triggers = bind$3(revPath, function (menuValue, menuIndex) {
8610
            return getTriggerData(menuValue, getItemByValue, revPath.slice(0, menuIndex + 1)).fold(function () {
8619
            return getTriggerData(menuValue, getItemByValue, revPath.slice(0, menuIndex + 1)).fold(function () {
8611
              return is(primary.get(), menuValue) ? [] : [Optional.none()];
8620
              return is$1(primary.get(), menuValue) ? [] : [Optional.none()];
8612
            }, function (data) {
8621
            }, function (data) {
8613
              return [Optional.some(data)];
8622
              return [Optional.some(data)];
8614
            });
8623
            });
8615
          });
8624
          });
8616
          return sequence(triggers);
8625
          return sequence(triggers);
Line 8674... Line 8683...
8674
    };
8683
    };
8675
 
8684
 
8676
    var make$6 = function (detail, _rawUiSpec) {
8685
    var make$6 = function (detail, _rawUiSpec) {
8677
      var submenuParentItems = value$1();
8686
      var submenuParentItems = value$1();
8678
      var buildMenus = function (container, primaryName, menus) {
8687
      var buildMenus = function (container, primaryName, menus) {
8679
        return map(menus, function (spec, name) {
8688
        return map$1(menus, function (spec, name) {
8680
          var makeSketch = function () {
8689
          var makeSketch = function () {
8681
            return Menu.sketch(__assign(__assign({}, spec), {
8690
            return Menu.sketch(__assign(__assign({}, spec), {
8682
              value: name,
8691
              value: name,
8683
              markers: detail.markers,
8692
              markers: detail.markers,
8684
              fakeFocus: detail.fakeFocus,
8693
              fakeFocus: detail.fakeFocus,
Line 8715... Line 8724...
8715
            return getItemValue(c) === itemValue;
8724
            return getItemValue(c) === itemValue;
8716
          });
8725
          });
8717
        });
8726
        });
8718
      };
8727
      };
8719
      var toDirectory = function (_container) {
8728
      var toDirectory = function (_container) {
8720
        return map(detail.data.menus, function (data, _menuName) {
8729
        return map$1(detail.data.menus, function (data, _menuName) {
8721
          return bind$3(data.items, function (item) {
8730
          return bind$3(data.items, function (item) {
8722
            return item.type === 'separator' ? [] : [item.data.value];
8731
            return item.type === 'separator' ? [] : [item.data.value];
8723
          });
8732
          });
8724
        });
8733
        });
8725
      };
8734
      };
Line 8739... Line 8748...
8739
        }));
8748
        }));
8740
      };
8749
      };
8741
      var closeOthers = function (container, state, path) {
8750
      var closeOthers = function (container, state, path) {
8742
        var others = getMenus(state, state.otherMenus(path));
8751
        var others = getMenus(state, state.otherMenus(path));
8743
        each$1(others, function (o) {
8752
        each$1(others, function (o) {
8744
          remove$2(o.element, [detail.markers.backgroundMenu]);
8753
          remove$1(o.element, [detail.markers.backgroundMenu]);
8745
          if (!detail.stayInDom) {
8754
          if (!detail.stayInDom) {
8746
            Replacing.remove(container, o);
8755
            Replacing.remove(container, o);
8747
          }
8756
          }
8748
        });
8757
        });
8749
      };
8758
      };
8750
      var getSubmenuParents = function (container) {
8759
      var getSubmenuParents = function (container) {
8751
        return submenuParentItems.get().getOrThunk(function () {
8760
        return submenuParentItems.get().getOrThunk(function () {
8752
          var r = {};
8761
          var r = {};
8753
          var items = descendants(container.element, '.' + detail.markers.item);
8762
          var items = descendants(container.element, '.' + detail.markers.item);
8754
          var parentItems = filter$2(items, function (i) {
8763
          var parentItems = filter$2(items, function (i) {
8755
            return get$c(i, 'aria-haspopup') === 'true';
8764
            return get$d(i, 'aria-haspopup') === 'true';
8756
          });
8765
          });
8757
          each$1(parentItems, function (i) {
8766
          each$1(parentItems, function (i) {
8758
            container.getSystem().getByDom(i).each(function (itemComp) {
8767
            container.getSystem().getByDom(i).each(function (itemComp) {
8759
              var key = getItemValue(itemComp);
8768
              var key = getItemValue(itemComp);
8760
              r[key] = itemComp;
8769
              r[key] = itemComp;
Line 8766... Line 8775...
8766
      };
8775
      };
8767
      var updateAriaExpansions = function (container, path) {
8776
      var updateAriaExpansions = function (container, path) {
8768
        var parentItems = getSubmenuParents(container);
8777
        var parentItems = getSubmenuParents(container);
8769
        each(parentItems, function (v, k) {
8778
        each(parentItems, function (v, k) {
8770
          var expanded = contains$2(path, k);
8779
          var expanded = contains$2(path, k);
8771
          set$7(v.element, 'aria-expanded', expanded);
8780
          set$8(v.element, 'aria-expanded', expanded);
8772
        });
8781
        });
8773
      };
8782
      };
8774
      var updateMenuPath = function (container, state, path) {
8783
      var updateMenuPath = function (container, state, path) {
8775
        return Optional.from(path[0]).bind(function (latestMenuName) {
8784
        return Optional.from(path[0]).bind(function (latestMenuName) {
8776
          return state.lookupMenu(latestMenuName).bind(function (menuPrep) {
8785
          return state.lookupMenu(latestMenuName).bind(function (menuPrep) {
Line 8783... Line 8792...
8783
                add$2(r.element, detail.markers.backgroundMenu);
8792
                add$2(r.element, detail.markers.backgroundMenu);
8784
              });
8793
              });
8785
              if (!inBody(activeMenu.element)) {
8794
              if (!inBody(activeMenu.element)) {
8786
                Replacing.append(container, premade(activeMenu));
8795
                Replacing.append(container, premade(activeMenu));
8787
              }
8796
              }
8788
              remove$2(activeMenu.element, [detail.markers.backgroundMenu]);
8797
              remove$1(activeMenu.element, [detail.markers.backgroundMenu]);
8789
              setActiveMenu(container, activeMenu);
8798
              setActiveMenu(container, activeMenu);
8790
              closeOthers(container, state, path);
8799
              closeOthers(container, state, path);
8791
              return Optional.some(activeMenu);
8800
              return Optional.some(activeMenu);
8792
            }
8801
            }
8793
          });
8802
          });
Line 8927... Line 8936...
8927
          setActiveMenu(container, primary);
8936
          setActiveMenu(container, primary);
8928
        });
8937
        });
8929
      };
8938
      };
8930
      var extractMenuFromContainer = function (container) {
8939
      var extractMenuFromContainer = function (container) {
8931
        return Optional.from(container.components()[0]).filter(function (comp) {
8940
        return Optional.from(container.components()[0]).filter(function (comp) {
8932
          return get$c(comp.element, 'role') === 'menu';
8941
          return get$d(comp.element, 'role') === 'menu';
8933
        });
8942
        });
8934
      };
8943
      };
8935
      var repositionMenus = function (container) {
8944
      var repositionMenus = function (container) {
8936
        var maybeActivePrimary = layeredState.getPrimary().bind(function (primary) {
8945
        var maybeActivePrimary = layeredState.getPrimary().bind(function (primary) {
8937
          return getActiveItem(container).bind(function (currentItem) {
8946
          return getActiveItem(container).bind(function (currentItem) {
Line 9396... Line 9405...
9396
    var flip$2 = function (anchor, element, bubbles, placee, bounds) {
9405
    var flip$2 = function (anchor, element, bubbles, placee, bounds) {
9397
      var layout = getPlacement(placee).map(lookupFlippedLayout).getOr(north);
9406
      var layout = getPlacement(placee).map(lookupFlippedLayout).getOr(north);
9398
      return layout(anchor, element, bubbles, placee, bounds);
9407
      return layout(anchor, element, bubbles, placee, bounds);
9399
    };
9408
    };
9400
 
9409
 
9401
    var global$g = tinymce.util.Tools.resolve('tinymce.util.Delay');
9410
    var global$f = tinymce.util.Tools.resolve('tinymce.util.Delay');
9402
 
9411
 
9403
    var factory$l = function (detail) {
9412
    var factory$l = function (detail) {
9404
      var events = events$a(detail.action);
9413
      var events = events$a(detail.action);
9405
      var tag = detail.dom.tag;
9414
      var tag = detail.dom.tag;
9406
      var lookupAttr = function (attr) {
9415
      var lookupAttr = function (attr) {
Line 9470... Line 9479...
9470
        getOpt: getOpt,
9479
        getOpt: getOpt,
9471
        asSpec: asSpec
9480
        asSpec: asSpec
9472
      };
9481
      };
9473
    };
9482
    };
9474
 
9483
 
9475
    var global$f = tinymce.util.Tools.resolve('tinymce.util.I18n');
9484
    var global$e = tinymce.util.Tools.resolve('tinymce.util.I18n');
9476
 
9485
 
9477
    var rtlTransform = {
9486
    var rtlTransform = {
9478
      'indent': true,
9487
      'indent': true,
9479
      'outdent': true,
9488
      'outdent': true,
9480
      'table-insert-column-after': true,
9489
      'table-insert-column-after': true,
Line 9492... Line 9501...
9492
        return get$e(icons, defaultIconName).getOr('!not found!');
9501
        return get$e(icons, defaultIconName).getOr('!not found!');
9493
      };
9502
      };
9494
    };
9503
    };
9495
    var getIconName = function (name, icons) {
9504
    var getIconName = function (name, icons) {
9496
      var lcName = name.toLowerCase();
9505
      var lcName = name.toLowerCase();
9497
      if (global$f.isRtl()) {
9506
      if (global$e.isRtl()) {
9498
        var rtlName = ensureTrailing(lcName, '-rtl');
9507
        var rtlName = ensureTrailing(lcName, '-rtl');
9499
        return has$2(icons, rtlName) ? rtlName : lcName;
9508
        return has$2(icons, rtlName) ? rtlName : lcName;
9500
      } else {
9509
      } else {
9501
        return lcName;
9510
        return lcName;
9502
      }
9511
      }
Line 9511... Line 9520...
9511
    var getOr = function (name, iconProvider, fallbackIcon) {
9520
    var getOr = function (name, iconProvider, fallbackIcon) {
9512
      var icons = iconProvider();
9521
      var icons = iconProvider();
9513
      return lookupIcon(name, icons).or(fallbackIcon).getOrThunk(defaultIcon(icons));
9522
      return lookupIcon(name, icons).or(fallbackIcon).getOrThunk(defaultIcon(icons));
9514
    };
9523
    };
9515
    var needsRtlTransform = function (iconName) {
9524
    var needsRtlTransform = function (iconName) {
9516
      return global$f.isRtl() ? has$2(rtlTransform, iconName) : false;
9525
      return global$e.isRtl() ? has$2(rtlTransform, iconName) : false;
9517
    };
9526
    };
9518
    var addFocusableBehaviour = function () {
9527
    var addFocusableBehaviour = function () {
9519
      return config('add-focusable', [runOnAttached(function (comp) {
9528
      return config('add-focusable', [runOnAttached(function (comp) {
9520
          child(comp.element, 'svg').each(function (svg) {
9529
          child(comp.element, 'svg').each(function (svg) {
9521
            return set$7(svg, 'focusable', 'false');
9530
            return set$8(svg, 'focusable', 'false');
9522
          });
9531
          });
9523
        })]);
9532
        })]);
9524
    };
9533
    };
9525
    var renderIcon$2 = function (spec, iconName, icons, fallbackIcon) {
9534
    var renderIcon$2 = function (spec, iconName, icons, fallbackIcon) {
9526
      var _a, _b;
9535
      var _a, _b;
Line 9531... Line 9540...
9531
          tag: spec.tag,
9540
          tag: spec.tag,
9532
          attributes: (_a = spec.attributes) !== null && _a !== void 0 ? _a : {},
9541
          attributes: (_a = spec.attributes) !== null && _a !== void 0 ? _a : {},
9533
          classes: spec.classes.concat(rtlIconClasses),
9542
          classes: spec.classes.concat(rtlIconClasses),
9534
          innerHtml: iconHtml
9543
          innerHtml: iconHtml
9535
        },
9544
        },
9536
        behaviours: derive$1(__spreadArray(__spreadArray([], (_b = spec.behaviours) !== null && _b !== void 0 ? _b : []), [addFocusableBehaviour()]))
9545
        behaviours: derive$1(__spreadArray(__spreadArray([], (_b = spec.behaviours) !== null && _b !== void 0 ? _b : [], true), [addFocusableBehaviour()], false))
9537
      };
9546
      };
9538
    };
9547
    };
9539
    var render$3 = function (iconName, spec, iconProvider, fallbackIcon) {
9548
    var render$3 = function (iconName, spec, iconProvider, fallbackIcon) {
9540
      if (fallbackIcon === void 0) {
9549
      if (fallbackIcon === void 0) {
9541
        fallbackIcon = Optional.none();
9550
        fallbackIcon = Optional.none();
Line 9734... Line 9743...
9734
        case 'bc-tc':
9743
        case 'bc-tc':
9735
        default:
9744
        default:
9736
          return south$2;
9745
          return south$2;
9737
        }
9746
        }
9738
      };
9747
      };
9739
      var prePositionNotifications = function (notifications) {
9748
      var reposition = function (notifications) {
9740
        each$1(notifications, function (notification) {
-
 
9741
          return notification.moveTo(0, 0);
-
 
9742
        });
-
 
9743
      };
-
 
9744
      var positionNotifications = function (notifications) {
-
 
9745
        if (notifications.length > 0) {
9749
        if (notifications.length > 0) {
9746
          head(notifications).each(function (firstItem) {
-
 
9747
            return firstItem.moveRel(null, 'banner');
-
 
9748
          });
-
 
9749
          each$1(notifications, function (notification, index) {
9750
          each$1(notifications, function (notification, index) {
9750
            if (index > 0) {
9751
            if (index === 0) {
-
 
9752
              notification.moveRel(null, 'banner');
-
 
9753
            } else {
9751
              notification.moveRel(notifications[index - 1].getEl(), 'bc-tc');
9754
              notification.moveRel(notifications[index - 1].getEl(), 'bc-tc');
9752
            }
9755
            }
9753
          });
9756
          });
9754
        }
9757
        }
9755
      };
9758
      };
9756
      var reposition = function (notifications) {
-
 
9757
        prePositionNotifications(notifications);
-
 
9758
        positionNotifications(notifications);
-
 
9759
      };
-
 
9760
      var open = function (settings, closeCallback) {
9759
      var open = function (settings, closeCallback) {
9761
        var hideCloseButton = !settings.closeButton && settings.timeout && (settings.timeout > 0 || settings.timeout < 0);
9760
        var hideCloseButton = !settings.closeButton && settings.timeout && (settings.timeout > 0 || settings.timeout < 0);
9762
        var close = function () {
9761
        var close = function () {
9763
          closeCallback();
9762
          closeCallback();
9764
          InlineView.hide(notificationWrapper);
9763
          InlineView.hide(notificationWrapper);
Line 9787... Line 9786...
9787
          lazySink: sharedBackstage.getSink,
9786
          lazySink: sharedBackstage.getSink,
9788
          fireDismissalEventInstead: {}
9787
          fireDismissalEventInstead: {}
9789
        }, sharedBackstage.header.isPositionedAtTop() ? {} : { fireRepositionEventInstead: {} })));
9788
        }, sharedBackstage.header.isPositionedAtTop() ? {} : { fireRepositionEventInstead: {} })));
9790
        uiMothership.add(notificationWrapper);
9789
        uiMothership.add(notificationWrapper);
9791
        if (settings.timeout > 0) {
9790
        if (settings.timeout > 0) {
9792
          global$g.setTimeout(function () {
9791
          global$f.setTimeout(function () {
9793
            close();
9792
            close();
9794
          }, settings.timeout);
9793
          }, settings.timeout);
9795
        }
9794
        }
-
 
9795
        var getBounds = function () {
-
 
9796
          var contentArea = box$1(SugarElement.fromDom(editor.getContentAreaContainer()));
-
 
9797
          var win$1 = win();
-
 
9798
          var x = clamp$1(win$1.x, contentArea.x, contentArea.right);
-
 
9799
          var y = clamp$1(win$1.y, contentArea.y, contentArea.bottom);
-
 
9800
          var right = Math.max(contentArea.right, win$1.right);
-
 
9801
          var bottom = Math.max(contentArea.bottom, win$1.bottom);
-
 
9802
          return Optional.some(bounds(x, y, right - x, bottom - y));
-
 
9803
        };
9796
        return {
9804
        return {
9797
          close: close,
9805
          close: close,
9798
          moveTo: function (x, y) {
9806
          moveTo: function (x, y) {
9799
            InlineView.showAt(notificationWrapper, premade(notification), {
9807
            InlineView.showAt(notificationWrapper, premade(notification), {
9800
              anchor: {
9808
              anchor: {
Line 9803... Line 9811...
9803
                y: y
9811
                y: y
9804
              }
9812
              }
9805
            });
9813
            });
9806
          },
9814
          },
9807
          moveRel: function (element, rel) {
9815
          moveRel: function (element, rel) {
-
 
9816
            var notificationSpec = premade(notification);
-
 
9817
            var anchorOverrides = { maxHeightFunction: expandable$1() };
9808
            if (rel !== 'banner') {
9818
            if (rel !== 'banner' && isNonNullable(element)) {
9809
              var layoutDirection_1 = getLayoutDirection(rel);
9819
              var layoutDirection_1 = getLayoutDirection(rel);
9810
              var nodeAnchor = {
9820
              var nodeAnchor = {
9811
                type: 'node',
9821
                type: 'node',
9812
                root: body(),
9822
                root: body(),
9813
                node: Optional.some(SugarElement.fromDom(element)),
9823
                node: Optional.some(SugarElement.fromDom(element)),
-
 
9824
                overrides: anchorOverrides,
9814
                layouts: {
9825
                layouts: {
9815
                  onRtl: function () {
9826
                  onRtl: function () {
9816
                    return [layoutDirection_1];
9827
                    return [layoutDirection_1];
9817
                  },
9828
                  },
9818
                  onLtr: function () {
9829
                  onLtr: function () {
9819
                    return [layoutDirection_1];
9830
                    return [layoutDirection_1];
9820
                  }
9831
                  }
9821
                }
9832
                }
9822
              };
9833
              };
9823
              InlineView.showAt(notificationWrapper, premade(notification), { anchor: nodeAnchor });
9834
              InlineView.showWithinBounds(notificationWrapper, notificationSpec, { anchor: nodeAnchor }, getBounds);
9824
            } else {
9835
            } else {
-
 
9836
              var anchor = __assign(__assign({}, sharedBackstage.anchors.banner()), { overrides: anchorOverrides });
9825
              InlineView.showAt(notificationWrapper, premade(notification), { anchor: sharedBackstage.anchors.banner() });
9837
              InlineView.showWithinBounds(notificationWrapper, notificationSpec, { anchor: anchor }, getBounds);
9826
            }
9838
            }
9827
          },
9839
          },
9828
          text: function (nuText) {
9840
          text: function (nuText) {
9829
            Notification.updateText(notification, nuText);
9841
            Notification.updateText(notification, nuText);
9830
          },
9842
          },
Line 9901... Line 9913...
9901
        cancel: cancel,
9913
        cancel: cancel,
9902
        throttle: throttle
9914
        throttle: throttle
9903
      };
9915
      };
9904
    };
9916
    };
9905
 
9917
 
9906
    var global$e = tinymce.util.Tools.resolve('tinymce.dom.TextSeeker');
9918
    var global$d = tinymce.util.Tools.resolve('tinymce.dom.TextSeeker');
9907
 
9919
 
9908
    var isBoundary = function (dom, node) {
9920
    var isBoundary = function (dom, node) {
9909
      return dom.isBlock(node) || contains$2([
9921
      return dom.isBlock(node) || contains$2([
9910
        'BR',
9922
        'BR',
9911
        'IMG',
9923
        'IMG',
9912
        'HR',
9924
        'HR',
9913
        'INPUT'
9925
        'INPUT'
9914
      ], node.nodeName) || dom.getContentEditable(node) === 'false';
9926
      ], node.nodeName) || dom.getContentEditable(node) === 'false';
9915
    };
9927
    };
9916
    var repeatLeft = function (dom, node, offset, process, rootNode) {
9928
    var repeatLeft = function (dom, node, offset, process, rootNode) {
9917
      var search = global$e(dom, function (node) {
9929
      var search = global$d(dom, function (node) {
9918
        return isBoundary(dom, node);
9930
        return isBoundary(dom, node);
9919
      });
9931
      });
9920
      return Optional.from(search.backwards(node, offset, process, rootNode));
9932
      return Optional.from(search.backwards(node, offset, process, rootNode));
9921
    };
9933
    };
9922
 
9934
 
Line 10063... Line 10075...
10063
        }
10075
        }
10064
      });
10076
      });
10065
    };
10077
    };
10066
    var AutocompleterEditorEvents = { setup: setup$e };
10078
    var AutocompleterEditorEvents = { setup: setup$e };
10067
 
10079
 
10068
    var global$d = tinymce.util.Tools.resolve('tinymce.util.Promise');
10080
    var global$c = tinymce.util.Tools.resolve('tinymce.util.Promise');
10069
 
10081
 
10070
    var point = function (container, offset) {
10082
    var point = function (container, offset) {
10071
      return {
10083
      return {
10072
        container: container,
10084
        container: container,
10073
        offset: offset
10085
        offset: offset
Line 10138... Line 10150...
10138
        })(context.range, startText, context.text);
10150
        })(context.range, startText, context.text);
10139
      });
10151
      });
10140
      if (autocompleters.length === 0) {
10152
      if (autocompleters.length === 0) {
10141
        return Optional.none();
10153
        return Optional.none();
10142
      }
10154
      }
10143
      var lookupData = global$d.all(map$2(autocompleters, function (ac) {
10155
      var lookupData = global$c.all(map$2(autocompleters, function (ac) {
10144
        var fetchResult = ac.fetch(context.text, ac.maxResults, fetchOptions);
10156
        var fetchResult = ac.fetch(context.text, ac.maxResults, fetchOptions);
10145
        return fetchResult.then(function (results) {
10157
        return fetchResult.then(function (results) {
10146
          return {
10158
          return {
10147
            matchText: context.text,
10159
            matchText: context.text,
10148
            items: results,
10160
            items: results,
Line 10283... Line 10295...
10283
      return keys(all);
10295
      return keys(all);
10284
    };
10296
    };
10285
 
10297
 
10286
    var register$b = function (editor) {
10298
    var register$b = function (editor) {
10287
      var popups = editor.ui.registry.getAll().popups;
10299
      var popups = editor.ui.registry.getAll().popups;
10288
      var dataset = map(popups, function (popup) {
10300
      var dataset = map$1(popups, function (popup) {
10289
        return createAutocompleter(popup).fold(function (err) {
10301
        return createAutocompleter(popup).fold(function (err) {
10290
          throw new Error(formatError(err));
10302
          throw new Error(formatError(err));
10291
        }, identity$1);
10303
        }, identity$1);
10292
      });
10304
      });
10293
      var triggerChars = stringArray(mapToArray(dataset, function (v) {
10305
      var triggerChars = stringArray(mapToArray(dataset, function (v) {
Line 10920... Line 10932...
10920
 
10932
 
10921
    var escape = function (text) {
10933
    var escape = function (text) {
10922
      return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
10934
      return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
10923
    };
10935
    };
10924
 
10936
 
10925
    var global$c = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
10937
    var global$b = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
10926
 
10938
 
10927
    var global$b = tinymce.util.Tools.resolve('tinymce.EditorManager');
10939
    var global$a = tinymce.util.Tools.resolve('tinymce.EditorManager');
10928
 
10940
 
10929
    var getSkinUrl = function (editor) {
10941
    var getSkinUrl = function (editor) {
10930
      var skin = editor.getParam('skin');
10942
      var skin = editor.getParam('skin');
10931
      var skinUrl = editor.getParam('skin_url');
10943
      var skinUrl = editor.getParam('skin_url');
10932
      if (skin !== false) {
10944
      if (skin !== false) {
10933
        var skinName = skin ? skin : 'oxide';
10945
        var skinName = skin ? skin : 'oxide';
10934
        if (skinUrl) {
10946
        if (skinUrl) {
10935
          skinUrl = editor.documentBaseURI.toAbsolute(skinUrl);
10947
          skinUrl = editor.documentBaseURI.toAbsolute(skinUrl);
10936
        } else {
10948
        } else {
10937
          skinUrl = global$b.baseURL + '/skins/ui/' + skinName;
10949
          skinUrl = global$a.baseURL + '/skins/ui/' + skinName;
10938
        }
10950
        }
10939
      }
10951
      }
10940
      return skinUrl;
10952
      return skinUrl;
10941
    };
10953
    };
10942
    var isReadOnly = function (editor) {
10954
    var isReadOnly = function (editor) {
Line 10947... Line 10959...
10947
    };
10959
    };
10948
    var getHeightSetting = function (editor) {
10960
    var getHeightSetting = function (editor) {
10949
      return editor.getParam('height', Math.max(editor.getElement().offsetHeight, 200));
10961
      return editor.getParam('height', Math.max(editor.getElement().offsetHeight, 200));
10950
    };
10962
    };
10951
    var getWidthSetting = function (editor) {
10963
    var getWidthSetting = function (editor) {
10952
      return editor.getParam('width', global$c.DOM.getStyle(editor.getElement(), 'width'));
10964
      return editor.getParam('width', global$b.DOM.getStyle(editor.getElement(), 'width'));
10953
    };
10965
    };
10954
    var getMinWidthSetting = function (editor) {
10966
    var getMinWidthSetting = function (editor) {
10955
      return Optional.from(editor.getParam('min_width')).filter(isNumber);
10967
      return Optional.from(editor.getParam('min_width')).filter(isNumber);
10956
    };
10968
    };
10957
    var getMinHeightSetting = function (editor) {
10969
    var getMinHeightSetting = function (editor) {
Line 11074... Line 11086...
11074
      return editor.getParam('draggable_modal', false, 'boolean');
11086
      return editor.getParam('draggable_modal', false, 'boolean');
11075
    };
11087
    };
11076
    var getMenus = function (editor) {
11088
    var getMenus = function (editor) {
11077
      var menu = editor.getParam('menu');
11089
      var menu = editor.getParam('menu');
11078
      if (menu) {
11090
      if (menu) {
11079
        return map(menu, function (menu) {
11091
        return map$1(menu, function (menu) {
11080
          return __assign(__assign({}, menu), { items: menu.items });
11092
          return __assign(__assign({}, menu), { items: menu.items });
11081
        });
11093
        });
11082
      } else {
11094
      } else {
11083
        return {};
11095
        return {};
11084
      }
11096
      }
Line 11251... Line 11263...
11251
        value: source.value,
11263
        value: source.value,
11252
        meta: __assign({ text: source.text.getOr('') }, source.meta)
11264
        meta: __assign({ text: source.text.getOr('') }, source.meta)
11253
      };
11265
      };
11254
    };
11266
    };
11255
 
11267
 
11256
    var global$a = tinymce.util.Tools.resolve('tinymce.Env');
11268
    var global$9 = tinymce.util.Tools.resolve('tinymce.Env');
11257
 
11269
 
11258
    var convertText = function (source) {
11270
    var convertText = function (source) {
11259
      var mac = {
11271
      var mac = {
11260
        alt: '&#x2325;',
11272
        alt: '&#x2325;',
11261
        ctrl: '&#x2303;',
11273
        ctrl: '&#x2303;',
Line 11265... Line 11277...
11265
      };
11277
      };
11266
      var other = {
11278
      var other = {
11267
        meta: 'Ctrl',
11279
        meta: 'Ctrl',
11268
        access: 'Shift+Alt'
11280
        access: 'Shift+Alt'
11269
      };
11281
      };
11270
      var replace = global$a.mac ? mac : other;
11282
      var replace = global$9.mac ? mac : other;
11271
      var shortcut = source.split('+');
11283
      var shortcut = source.split('+');
11272
      var updated = map$2(shortcut, function (segment) {
11284
      var updated = map$2(shortcut, function (segment) {
11273
        var search = segment.toLowerCase().trim();
11285
        var search = segment.toLowerCase().trim();
11274
        return has$2(replace, search) ? replace[search] : segment;
11286
        return has$2(replace, search) ? replace[search] : segment;
11275
      });
11287
      });
11276
      return global$a.mac ? updated.join('') : updated.join('+');
11288
      return global$9.mac ? updated.join('') : updated.join('+');
11277
    };
11289
    };
11278
 
11290
 
11279
    var renderIcon$1 = function (name, icons, classes) {
11291
    var renderIcon$1 = function (name, icons, classes) {
11280
      if (classes === void 0) {
11292
      if (classes === void 0) {
11281
        classes = [iconClass];
11293
        classes = [iconClass];
Line 11289... Line 11301...
11289
      return {
11301
      return {
11290
        dom: {
11302
        dom: {
11291
          tag: 'div',
11303
          tag: 'div',
11292
          classes: [textClass]
11304
          classes: [textClass]
11293
        },
11305
        },
11294
        components: [text(global$f.translate(text$1))]
11306
        components: [text(global$e.translate(text$1))]
11295
      };
11307
      };
11296
    };
11308
    };
11297
    var renderHtml = function (html, classes) {
11309
    var renderHtml = function (html, classes) {
11298
      return {
11310
      return {
11299
        dom: {
11311
        dom: {
Line 11312... Line 11324...
11312
        components: [{
11324
        components: [{
11313
            dom: {
11325
            dom: {
11314
              tag: style.tag,
11326
              tag: style.tag,
11315
              styles: style.styles
11327
              styles: style.styles
11316
            },
11328
            },
11317
            components: [text(global$f.translate(text$1))]
11329
            components: [text(global$e.translate(text$1))]
11318
          }]
11330
          }]
11319
      };
11331
      };
11320
    };
11332
    };
11321
    var renderShortcut = function (shortcut) {
11333
    var renderShortcut = function (shortcut) {
11322
      return {
11334
      return {
Line 11395... Line 11407...
11395
          classes: [common]
11407
          classes: [common]
11396
        };
11408
        };
11397
        if (itemValue === colorPickerCommand) {
11409
        if (itemValue === colorPickerCommand) {
11398
          return __assign(__assign({}, baseDom), {
11410
          return __assign(__assign({}, baseDom), {
11399
            tag: 'button',
11411
            tag: 'button',
11400
            classes: __spreadArray(__spreadArray([], baseDom.classes), ['tox-swatches__picker-btn']),
11412
            classes: __spreadArray(__spreadArray([], baseDom.classes, true), ['tox-swatches__picker-btn'], false),
11401
            innerHtml: icon
11413
            innerHtml: icon
11402
          });
11414
          });
11403
        } else if (itemValue === removeColorCommand) {
11415
        } else if (itemValue === removeColorCommand) {
11404
          return __assign(__assign({}, baseDom), {
11416
          return __assign(__assign({}, baseDom), {
11405
            classes: __spreadArray(__spreadArray([], baseDom.classes), ['tox-swatch--remove']),
11417
            classes: __spreadArray(__spreadArray([], baseDom.classes, true), ['tox-swatch--remove'], false),
11406
            innerHtml: icon
11418
            innerHtml: icon
11407
          });
11419
          });
11408
        } else {
11420
        } else {
11409
          return __assign(__assign({}, baseDom), {
11421
          return __assign(__assign({}, baseDom), {
11410
            attributes: __assign(__assign({}, baseDom.attributes), { 'data-mce-color': itemValue }),
11422
            attributes: __assign(__assign({}, baseDom.attributes), { 'data-mce-color': itemValue }),
Line 11417... Line 11429...
11417
        optComponents: []
11429
        optComponents: []
11418
      };
11430
      };
11419
    };
11431
    };
11420
    var renderItemDomStructure = function (ariaLabel) {
11432
    var renderItemDomStructure = function (ariaLabel) {
11421
      var domTitle = ariaLabel.map(function (label) {
11433
      var domTitle = ariaLabel.map(function (label) {
11422
        return { attributes: { title: global$f.translate(label) } };
11434
        return { attributes: { title: global$e.translate(label) } };
11423
      }).getOr({});
11435
      }).getOr({});
11424
      return __assign({
11436
      return __assign({
11425
        tag: 'div',
11437
        tag: 'div',
11426
        classes: [
11438
        classes: [
11427
          navClass,
11439
          navClass,
Line 11499... Line 11511...
11499
            }
11511
            }
11500
          })];
11512
          })];
11501
      }).getOr([]);
11513
      }).getOr([]);
11502
    };
11514
    };
11503
    var encodeText = function (text) {
11515
    var encodeText = function (text) {
11504
      return global$c.DOM.encode(text);
11516
      return global$b.DOM.encode(text);
11505
    };
11517
    };
11506
    var replaceText = function (text, matchText) {
11518
    var replaceText = function (text, matchText) {
11507
      var translated = global$f.translate(text);
11519
      var translated = global$e.translate(text);
11508
      var encoded = encodeText(translated);
11520
      var encoded = encodeText(translated);
11509
      if (matchText.length > 0) {
11521
      if (matchText.length > 0) {
11510
        var escapedMatchRegex = new RegExp(escape(matchText), 'gi');
11522
        var escapedMatchRegex = new RegExp(escape(matchText), 'gi');
11511
        return encoded.replace(escapedMatchRegex, function (match) {
11523
        return encoded.replace(escapedMatchRegex, function (match) {
11512
          return '<span class="tox-autocompleter-highlight">' + match + '</span>';
11524
          return '<span class="tox-autocompleter-highlight">' + match + '</span>';
Line 11875... Line 11887...
11875
        var a = rgba[3];
11887
        var a = rgba[3];
11876
        return fromRgba(rgbaColour(r, g, b, a));
11888
        return fromRgba(rgbaColour(r, g, b, a));
11877
      });
11889
      });
11878
    };
11890
    };
11879
 
11891
 
11880
    var global$9 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');
11892
    var global$8 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');
11881
 
11893
 
11882
    var storageName = 'tinymce-custom-colors';
11894
    var storageName = 'tinymce-custom-colors';
11883
    function ColorCache (max) {
11895
    function ColorCache (max) {
11884
      if (max === void 0) {
11896
      if (max === void 0) {
11885
        max = 10;
11897
        max = 10;
11886
      }
11898
      }
11887
      var storageString = global$9.getItem(storageName);
11899
      var storageString = global$8.getItem(storageName);
11888
      var localstorage = isString(storageString) ? JSON.parse(storageString) : [];
11900
      var localstorage = isString(storageString) ? JSON.parse(storageString) : [];
11889
      var prune = function (list) {
11901
      var prune = function (list) {
11890
        var diff = max - list.length;
11902
        var diff = max - list.length;
11891
        return diff < 0 ? list.slice(0, max) : list;
11903
        return diff < 0 ? list.slice(0, max) : list;
11892
      };
11904
      };
Line 11895... Line 11907...
11895
        indexOf(cache, key).each(remove);
11907
        indexOf(cache, key).each(remove);
11896
        cache.unshift(key);
11908
        cache.unshift(key);
11897
        if (cache.length > max) {
11909
        if (cache.length > max) {
11898
          cache.pop();
11910
          cache.pop();
11899
        }
11911
        }
11900
        global$9.setItem(storageName, JSON.stringify(cache));
11912
        global$8.setItem(storageName, JSON.stringify(cache));
11901
      };
11913
      };
11902
      var remove = function (idx) {
11914
      var remove = function (idx) {
11903
        cache.splice(idx, 1);
11915
        cache.splice(idx, 1);
11904
      };
11916
      };
11905
      var state = function () {
11917
      var state = function () {
Line 12060... Line 12072...
12060
    };
12072
    };
12061
    var addColor = function (color) {
12073
    var addColor = function (color) {
12062
      colorCache.add(color);
12074
      colorCache.add(color);
12063
    };
12075
    };
12064
 
12076
 
-
 
12077
    var fallbackColor = '#000000';
12065
    var getCurrentColor = function (editor, format) {
12078
    var getCurrentColor = function (editor, format) {
12066
      var color;
12079
      var color;
12067
      editor.dom.getParents(editor.selection.getStart(), function (elm) {
12080
      editor.dom.getParents(editor.selection.getStart(), function (elm) {
12068
        var value;
12081
        var value;
12069
        if (value = elm.style[format === 'forecolor' ? 'color' : 'background-color']) {
12082
        if (value = elm.style[format === 'forecolor' ? 'color' : 'background-color']) {
12070
          color = color ? color : value;
12083
          color = color ? color : value;
12071
        }
12084
        }
12072
      });
12085
      });
12073
      return color;
12086
      return Optional.from(color);
12074
    };
12087
    };
12075
    var applyFormat = function (editor, format, value) {
12088
    var applyFormat = function (editor, format, value) {
12076
      editor.undoManager.transact(function () {
12089
      editor.undoManager.transact(function () {
12077
        editor.focus();
12090
        editor.focus();
12078
        editor.formatter.apply(format, { value: value });
12091
        editor.formatter.apply(format, { value: value });
Line 12128... Line 12141...
12128
          colorOpt.each(function (color) {
12141
          colorOpt.each(function (color) {
12129
            addColor(color);
12142
            addColor(color);
12130
            editor.execCommand('mceApplyTextcolor', format, color);
12143
            editor.execCommand('mceApplyTextcolor', format, color);
12131
            onChoice(color);
12144
            onChoice(color);
12132
          });
12145
          });
12133
        }, '#000000');
12146
        }, fallbackColor);
12134
      } else if (value === 'remove') {
12147
      } else if (value === 'remove') {
12135
        onChoice('');
12148
        onChoice('');
12136
        editor.execCommand('mceRemoveTextcolor', format);
12149
        editor.execCommand('mceRemoveTextcolor', format);
12137
      } else {
12150
      } else {
12138
        onChoice(value);
12151
        onChoice(value);
Line 12155... Line 12168...
12155
      editor.ui.registry.addSplitButton(name, {
12168
      editor.ui.registry.addSplitButton(name, {
12156
        tooltip: tooltip,
12169
        tooltip: tooltip,
12157
        presets: 'color',
12170
        presets: 'color',
12158
        icon: name === 'forecolor' ? 'text-color' : 'highlight-bg-color',
12171
        icon: name === 'forecolor' ? 'text-color' : 'highlight-bg-color',
12159
        select: function (value) {
12172
        select: function (value) {
12160
          var optCurrentRgb = Optional.from(getCurrentColor(editor, format));
12173
          var optCurrentRgb = getCurrentColor(editor, format);
12161
          return optCurrentRgb.bind(function (currentRgb) {
12174
          return optCurrentRgb.bind(function (currentRgb) {
12162
            return fromString(currentRgb).map(function (rgba) {
12175
            return fromString(currentRgb).map(function (rgba) {
12163
              var currentHex = fromRgba(rgba).value;
12176
              var currentHex = fromRgba(rgba).value;
12164
              return contains$1(value.toLowerCase(), currentHex);
12177
              return contains$1(value.toLowerCase(), currentHex);
12165
            });
12178
            });
12166
          }).getOr(false);
12179
          }).getOr(false);
12167
        },
12180
        },
12168
        columns: getColorCols$1(editor),
12181
        columns: getColorCols$1(editor),
12169
        fetch: getFetch$1(getColors$2(editor), hasCustomColors$1(editor)),
12182
        fetch: getFetch$1(getColors$2(editor), hasCustomColors$1(editor)),
12170
        onAction: function (_splitButtonApi) {
12183
        onAction: function (_splitButtonApi) {
12171
          if (lastColor.get() !== null) {
-
 
12172
            applyColor(editor, format, lastColor.get(), noop);
12184
          applyColor(editor, format, lastColor.get(), noop);
12173
          }
-
 
12174
        },
12185
        },
12175
        onItemAction: function (_splitButtonApi, value) {
12186
        onItemAction: function (_splitButtonApi, value) {
12176
          applyColor(editor, format, value, function (newColor) {
12187
          applyColor(editor, format, value, function (newColor) {
12177
            lastColor.set(newColor);
12188
            lastColor.set(newColor);
12178
            fireTextColorChange(editor, {
12189
            fireTextColorChange(editor, {
Line 12180... Line 12191...
12180
              color: newColor
12191
              color: newColor
12181
            });
12192
            });
12182
          });
12193
          });
12183
        },
12194
        },
12184
        onSetup: function (splitButtonApi) {
12195
        onSetup: function (splitButtonApi) {
12185
          if (lastColor.get() !== null) {
-
 
12186
            setIconColor(splitButtonApi, name, lastColor.get());
12196
          setIconColor(splitButtonApi, name, lastColor.get());
12187
          }
-
 
12188
          var handler = function (e) {
12197
          var handler = function (e) {
12189
            if (e.name === name) {
12198
            if (e.name === name) {
12190
              setIconColor(splitButtonApi, e.name, e.color);
12199
              setIconColor(splitButtonApi, e.name, e.color);
12191
            }
12200
            }
12192
          };
12201
          };
Line 12268... Line 12277...
12268
        });
12277
        });
12269
      };
12278
      };
12270
    };
12279
    };
12271
    var register$a = function (editor) {
12280
    var register$a = function (editor) {
12272
      registerCommands(editor);
12281
      registerCommands(editor);
12273
      var lastForeColor = Cell(null);
12282
      var lastForeColor = Cell(fallbackColor);
12274
      var lastBackColor = Cell(null);
12283
      var lastBackColor = Cell(fallbackColor);
12275
      registerTextColorButton(editor, 'forecolor', 'forecolor', 'Text color', lastForeColor);
12284
      registerTextColorButton(editor, 'forecolor', 'forecolor', 'Text color', lastForeColor);
12276
      registerTextColorButton(editor, 'backcolor', 'hilitecolor', 'Background color', lastBackColor);
12285
      registerTextColorButton(editor, 'backcolor', 'hilitecolor', 'Background color', lastBackColor);
12277
      registerTextColorMenuItem(editor, 'forecolor', 'forecolor', 'Text color');
12286
      registerTextColorMenuItem(editor, 'forecolor', 'forecolor', 'Text color');
12278
      registerTextColorMenuItem(editor, 'backcolor', 'hilitecolor', 'Background color');
12287
      registerTextColorMenuItem(editor, 'backcolor', 'hilitecolor', 'Background color');
12279
    };
12288
    };
Line 12440... Line 12449...
12440
      return bind$3(cells, function (cellRow) {
12449
      return bind$3(cells, function (cellRow) {
12441
        return map$2(cellRow, premade);
12450
        return map$2(cellRow, premade);
12442
      });
12451
      });
12443
    };
12452
    };
12444
    var makeLabelText = function (row, col) {
12453
    var makeLabelText = function (row, col) {
12445
      return text(col + 1 + 'x' + (row + 1));
12454
      return text(col + 'x' + row);
12446
    };
12455
    };
12447
    var renderInsertTableMenuItem = function (spec) {
12456
    var renderInsertTableMenuItem = function (spec) {
12448
      var numRows = 10;
12457
      var numRows = 10;
12449
      var numColumns = 10;
12458
      var numColumns = 10;
12450
      var sizeLabelId = generate$6('size-label');
12459
      var sizeLabelId = generate$6('size-label');
12451
      var cells = makeCells(sizeLabelId, numRows, numColumns);
12460
      var cells = makeCells(sizeLabelId, numRows, numColumns);
-
 
12461
      var emptyLabelText = makeLabelText(0, 0);
12452
      var memLabel = record({
12462
      var memLabel = record({
12453
        dom: {
12463
        dom: {
12454
          tag: 'span',
12464
          tag: 'span',
12455
          classes: ['tox-insert-table-picker__label'],
12465
          classes: ['tox-insert-table-picker__label'],
12456
          attributes: { id: sizeLabelId }
12466
          attributes: { id: sizeLabelId }
12457
        },
12467
        },
12458
        components: [text('0x0')],
12468
        components: [emptyLabelText],
12459
        behaviours: derive$1([Replacing.config({})])
12469
        behaviours: derive$1([Replacing.config({})])
12460
      });
12470
      });
12461
      return {
12471
      return {
12462
        type: 'widget',
12472
        type: 'widget',
12463
        data: { value: generate$6('widget-id') },
12473
        data: { value: generate$6('widget-id') },
Line 12472... Line 12482...
12472
              classes: ['tox-insert-table-picker']
12482
              classes: ['tox-insert-table-picker']
12473
            },
12483
            },
12474
            components: makeComponents(cells).concat(memLabel.asSpec()),
12484
            components: makeComponents(cells).concat(memLabel.asSpec()),
12475
            behaviours: derive$1([
12485
            behaviours: derive$1([
12476
              config('insert-table-picker', [
12486
              config('insert-table-picker', [
-
 
12487
                runOnAttached(function (c) {
-
 
12488
                  Replacing.set(memLabel.get(c), [emptyLabelText]);
-
 
12489
                }),
12477
                runWithTarget(cellOverEvent, function (c, t, e) {
12490
                runWithTarget(cellOverEvent, function (c, t, e) {
12478
                  var row = e.event.row;
-
 
12479
                  var col = e.event.col;
12491
                  var _a = e.event, row = _a.row, col = _a.col;
12480
                  selectCells(cells, row, col, numRows, numColumns);
12492
                  selectCells(cells, row, col, numRows, numColumns);
12481
                  Replacing.set(memLabel.get(c), [makeLabelText(row, col)]);
12493
                  Replacing.set(memLabel.get(c), [makeLabelText(row + 1, col + 1)]);
12482
                }),
12494
                }),
12483
                runWithTarget(cellExecuteEvent, function (c, _, e) {
12495
                runWithTarget(cellExecuteEvent, function (c, _, e) {
-
 
12496
                  var _a = e.event, row = _a.row, col = _a.col;
12484
                  spec.onAction({
12497
                  spec.onAction({
12485
                    numRows: e.event.row + 1,
12498
                    numRows: row + 1,
12486
                    numColumns: e.event.col + 1
12499
                    numColumns: col + 1
12487
                  });
12500
                  });
12488
                  emit(c, sandboxClose());
12501
                  emit(c, sandboxClose());
12489
                })
12502
                })
12490
              ]),
12503
              ]),
12491
              Keying.config({
12504
              Keying.config({
Line 13040... Line 13053...
13040
      ], name$2(event.target)) && !closest(event.target, '[contenteditable="true"]');
13053
      ], name$2(event.target)) && !closest(event.target, '[contenteditable="true"]');
13041
    };
13054
    };
13042
    var isFirefox = function () {
13055
    var isFirefox = function () {
13043
      return detect$1().browser.isFirefox();
13056
      return detect$1().browser.isFirefox();
13044
    };
13057
    };
13045
    var settingsSchema = objOfOnly([
-
 
13046
      requiredFunction('triggerEvent'),
-
 
13047
      defaulted('stopBackspace', true)
-
 
13048
    ]);
-
 
13049
    var bindFocus = function (container, handler) {
13058
    var bindFocus = function (container, handler) {
13050
      if (isFirefox()) {
13059
      if (isFirefox()) {
13051
        return capture(container, 'focus', handler);
13060
        return capture(container, 'focus', handler);
13052
      } else {
13061
      } else {
13053
        return bind(container, 'focusin', handler);
13062
        return bind(container, 'focusin', handler);
Line 13059... Line 13068...
13059
      } else {
13068
      } else {
13060
        return bind(container, 'focusout', handler);
13069
        return bind(container, 'focusout', handler);
13061
      }
13070
      }
13062
    };
13071
    };
13063
    var setup$d = function (container, rawSettings) {
13072
    var setup$d = function (container, rawSettings) {
13064
      var settings = asRawOrDie$1('Getting GUI events settings', settingsSchema, rawSettings);
13073
      var settings = __assign({ stopBackspace: true }, rawSettings);
13065
      var pointerEvents = [
13074
      var pointerEvents = [
13066
        'touchstart',
13075
        'touchstart',
13067
        'touchmove',
13076
        'touchmove',
13068
        'touchend',
13077
        'touchend',
13069
        'touchcancel',
13078
        'touchcancel',
Line 13121... Line 13130...
13121
      });
13130
      });
13122
      var onKeydown = bind(container, 'keydown', function (event) {
13131
      var onKeydown = bind(container, 'keydown', function (event) {
13123
        var stopped = settings.triggerEvent('keydown', event);
13132
        var stopped = settings.triggerEvent('keydown', event);
13124
        if (stopped) {
13133
        if (stopped) {
13125
          event.kill();
13134
          event.kill();
13126
        } else if (settings.stopBackspace === true && isDangerous(event)) {
13135
        } else if (settings.stopBackspace && isDangerous(event)) {
13127
          event.prevent();
13136
          event.prevent();
13128
        }
13137
        }
13129
      });
13138
      });
13130
      var onFocusIn = bindFocus(container, function (event) {
13139
      var onFocusIn = bindFocus(container, function (event) {
13131
        var stopped = settings.triggerEvent('focusin', event);
13140
        var stopped = settings.triggerEvent('focusin', event);
Line 13275... Line 13284...
13275
          handlers[id] = curryArgs(v, extraArgs);
13284
          handlers[id] = curryArgs(v, extraArgs);
13276
          registry[k] = handlers;
13285
          registry[k] = handlers;
13277
        });
13286
        });
13278
      };
13287
      };
13279
      var findHandler = function (handlers, elem) {
13288
      var findHandler = function (handlers, elem) {
13280
        return read$1(elem).fold(function () {
13289
        return read$1(elem).bind(function (id) {
13281
          return Optional.none();
-
 
13282
        }, function (id) {
-
 
13283
          return handlers.bind(function (h) {
-
 
13284
            return get$e(h, id);
13290
          return get$e(handlers, id);
13285
          }).map(function (descHandler) {
13291
        }).map(function (descHandler) {
13286
            return eventHandler(elem, descHandler);
13292
          return eventHandler(elem, descHandler);
13287
          });
13293
        });
13288
        });
-
 
13289
      };
13294
      };
13290
      var filterByType = function (type) {
13295
      var filterByType = function (type) {
13291
        return get$e(registry, type).map(function (handlers) {
13296
        return get$e(registry, type).map(function (handlers) {
13292
          return mapToArray(handlers, function (f, id) {
13297
          return mapToArray(handlers, function (f, id) {
13293
            return broadcastHandler(id, f);
13298
            return broadcastHandler(id, f);
13294
          });
13299
          });
13295
        }).getOr([]);
13300
        }).getOr([]);
13296
      };
13301
      };
13297
      var find = function (isAboveRoot, type, target) {
13302
      var find = function (isAboveRoot, type, target) {
13298
        var handlers = get$e(registry, type);
13303
        return get$e(registry, type).bind(function (handlers) {
13299
        return closest$4(target, function (elem) {
13304
          return closest$4(target, function (elem) {
13300
          return findHandler(handlers, elem);
13305
            return findHandler(handlers, elem);
13301
        }, isAboveRoot);
13306
          }, isAboveRoot);
-
 
13307
        });
13302
      };
13308
      };
13303
      var unregisterId = function (id) {
13309
      var unregisterId = function (id) {
13304
        each(registry, function (handlersById, _eventName) {
13310
        each(registry, function (handlersById, _eventName) {
13305
          if (has$2(handlersById, id)) {
13311
          if (has$2(handlersById, id)) {
13306
            delete handlersById[id];
13312
            delete handlersById[id];
Line 13485... Line 13491...
13485
      var remove = function (component) {
13491
      var remove = function (component) {
13486
        detach(component);
13492
        detach(component);
13487
      };
13493
      };
13488
      var destroy = function () {
13494
      var destroy = function () {
13489
        domEvents.unbind();
13495
        domEvents.unbind();
13490
        remove$7(root.element);
13496
        remove$5(root.element);
13491
      };
13497
      };
13492
      var broadcastData = function (data) {
13498
      var broadcastData = function (data) {
13493
        var receivers = registry.filter(receive());
13499
        var receivers = registry.filter(receive());
13494
        each$1(receivers, function (receiver) {
13500
        each$1(receivers, function (receiver) {
13495
          var descHandler = receiver.descHandler;
13501
          var descHandler = receiver.descHandler;
Line 13622... Line 13628...
13622
            'aria-descriptor'
13628
            'aria-descriptor'
13623
          ]);
13629
          ]);
13624
          ps.field().each(function (field) {
13630
          ps.field().each(function (field) {
13625
            var id = generate$6(detail.prefix);
13631
            var id = generate$6(detail.prefix);
13626
            ps.label().each(function (label) {
13632
            ps.label().each(function (label) {
13627
              set$7(label.element, 'for', id);
13633
              set$8(label.element, 'for', id);
13628
              set$7(field.element, 'id', id);
13634
              set$8(field.element, 'id', id);
13629
            });
13635
            });
13630
            ps['aria-descriptor']().each(function (descriptor) {
13636
            ps['aria-descriptor']().each(function (descriptor) {
13631
              var descriptorId = generate$6(detail.prefix);
13637
              var descriptorId = generate$6(detail.prefix);
13632
              set$7(descriptor.element, 'id', descriptorId);
13638
              set$8(descriptor.element, 'id', descriptorId);
13633
              set$7(field.element, 'aria-describedby', descriptorId);
13639
              set$8(field.element, 'aria-describedby', descriptorId);
13634
            });
13640
            });
13635
          });
13641
          });
13636
        })]);
13642
        })]);
13637
      var apis = {
13643
      var apis = {
13638
        getField: function (container) {
13644
        getField: function (container) {
Line 13686... Line 13692...
13686
      fields: TabstopSchema,
13692
      fields: TabstopSchema,
13687
      name: 'tabstopping',
13693
      name: 'tabstopping',
13688
      active: ActiveTabstopping
13694
      active: ActiveTabstopping
13689
    });
13695
    });
13690
 
13696
 
13691
    var global$8 = tinymce.util.Tools.resolve('tinymce.html.Entities');
13697
    var global$7 = tinymce.util.Tools.resolve('tinymce.html.Entities');
13692
 
13698
 
13693
    var renderFormFieldWith = function (pLabel, pField, extraClasses, extraBehaviours) {
13699
    var renderFormFieldWith = function (pLabel, pField, extraClasses, extraBehaviours) {
13694
      var spec = renderFormFieldSpecWith(pLabel, pField, extraClasses, extraBehaviours);
13700
      var spec = renderFormFieldSpecWith(pLabel, pField, extraClasses, extraBehaviours);
13695
      return FormField.sketch(spec);
13701
      return FormField.sketch(spec);
13696
    };
13702
    };
Line 13739... Line 13745...
13739
        return renderLabel$2(label, providersBackstage);
13745
        return renderLabel$2(label, providersBackstage);
13740
      });
13746
      });
13741
      var runOnItem = function (f) {
13747
      var runOnItem = function (f) {
13742
        return function (comp, se) {
13748
        return function (comp, se) {
13743
          closest$1(se.event.target, '[data-collection-item-value]').each(function (target) {
13749
          closest$1(se.event.target, '[data-collection-item-value]').each(function (target) {
13744
            f(comp, se, target, get$c(target, 'data-collection-item-value'));
13750
            f(comp, se, target, get$d(target, 'data-collection-item-value'));
13745
          });
13751
          });
13746
        };
13752
        };
13747
      };
13753
      };
13748
      var setContents = function (comp, items) {
13754
      var setContents = function (comp, items) {
13749
        var htmlLines = map$2(items, function (item) {
13755
        var htmlLines = map$2(items, function (item) {
13750
          var itemText = global$f.translate(item.text);
13756
          var itemText = global$e.translate(item.text);
13751
          var textContent = spec.columns === 1 ? '<div class="tox-collection__item-label">' + itemText + '</div>' : '';
13757
          var textContent = spec.columns === 1 ? '<div class="tox-collection__item-label">' + itemText + '</div>' : '';
13752
          var iconContent = '<div class="tox-collection__item-icon">' + item.icon + '</div>';
13758
          var iconContent = '<div class="tox-collection__item-icon">' + item.icon + '</div>';
13753
          var mapItemName = {
13759
          var mapItemName = {
13754
            '_': ' ',
13760
            '_': ' ',
13755
            ' - ': ' ',
13761
            ' - ': ' ',
Line 13757... Line 13763...
13757
          };
13763
          };
13758
          var ariaLabel = itemText.replace(/\_| \- |\-/g, function (match) {
13764
          var ariaLabel = itemText.replace(/\_| \- |\-/g, function (match) {
13759
            return mapItemName[match];
13765
            return mapItemName[match];
13760
          });
13766
          });
13761
          var disabledClass = providersBackstage.isDisabled() ? ' tox-collection__item--state-disabled' : '';
13767
          var disabledClass = providersBackstage.isDisabled() ? ' tox-collection__item--state-disabled' : '';
13762
          return '<div class="tox-collection__item' + disabledClass + '" tabindex="-1" data-collection-item-value="' + global$8.encodeAllRaw(item.value) + '" title="' + ariaLabel + '" aria-label="' + ariaLabel + '">' + iconContent + textContent + '</div>';
13768
          return '<div class="tox-collection__item' + disabledClass + '" tabindex="-1" data-collection-item-value="' + global$7.encodeAllRaw(item.value) + '" title="' + ariaLabel + '" aria-label="' + ariaLabel + '">' + iconContent + textContent + '</div>';
13763
        });
13769
        });
13764
        var chunks = spec.columns !== 'auto' && spec.columns > 1 ? chunk$1(htmlLines, spec.columns) : [htmlLines];
13770
        var chunks = spec.columns !== 'auto' && spec.columns > 1 ? chunk$1(htmlLines, spec.columns) : [htmlLines];
13765
        var html = map$2(chunks, function (ch) {
13771
        var html = map$2(chunks, function (ch) {
13766
          return '<div class="tox-collection__group">' + ch.join('') + '</div>';
13772
          return '<div class="tox-collection__group">' + ch.join('') + '</div>';
13767
        });
13773
        });
13768
        set$8(comp.element, html.join(''));
13774
        set$5(comp.element, html.join(''));
13769
      };
13775
      };
13770
      var onClick = runOnItem(function (comp, se, tgt, itemValue) {
13776
      var onClick = runOnItem(function (comp, se, tgt, itemValue) {
13771
        se.stop();
13777
        se.stop();
13772
        if (!providersBackstage.isDisabled()) {
13778
        if (!providersBackstage.isDisabled()) {
13773
          emitWith(comp, formActionEvent, {
13779
          emitWith(comp, formActionEvent, {
Line 13782... Line 13788...
13782
        })),
13788
        })),
13783
        run$1(click(), onClick),
13789
        run$1(click(), onClick),
13784
        run$1(tap(), onClick),
13790
        run$1(tap(), onClick),
13785
        run$1(focusin(), runOnItem(function (comp, se, tgt) {
13791
        run$1(focusin(), runOnItem(function (comp, se, tgt) {
13786
          descendant(comp.element, '.' + activeClass).each(function (currentActive) {
13792
          descendant(comp.element, '.' + activeClass).each(function (currentActive) {
13787
            remove$3(currentActive, activeClass);
13793
            remove$2(currentActive, activeClass);
13788
          });
13794
          });
13789
          add$2(tgt, activeClass);
13795
          add$2(tgt, activeClass);
13790
        })),
13796
        })),
13791
        run$1(focusout(), runOnItem(function (comp) {
13797
        run$1(focusout(), runOnItem(function (comp) {
13792
          descendant(comp.element, '.' + activeClass).each(function (currentActive) {
13798
          descendant(comp.element, '.' + activeClass).each(function (currentActive) {
13793
            remove$3(currentActive, activeClass);
13799
            remove$2(currentActive, activeClass);
13794
          });
13800
          });
13795
        })),
13801
        })),
13796
        runOnExecute$1(runOnItem(function (comp, se, tgt, itemValue) {
13802
        runOnExecute$1(runOnItem(function (comp, se, tgt, itemValue) {
13797
          emitWith(comp, formActionEvent, {
13803
          emitWith(comp, formActionEvent, {
13798
            name: spec.name,
13804
            name: spec.name,
Line 13814... Line 13820...
13814
          Disabling.config({
13820
          Disabling.config({
13815
            disabled: providersBackstage.isDisabled,
13821
            disabled: providersBackstage.isDisabled,
13816
            onDisabled: function (comp) {
13822
            onDisabled: function (comp) {
13817
              iterCollectionItems(comp, function (childElm) {
13823
              iterCollectionItems(comp, function (childElm) {
13818
                add$2(childElm, 'tox-collection__item--state-disabled');
13824
                add$2(childElm, 'tox-collection__item--state-disabled');
13819
                set$7(childElm, 'aria-disabled', true);
13825
                set$8(childElm, 'aria-disabled', true);
13820
              });
13826
              });
13821
            },
13827
            },
13822
            onEnabled: function (comp) {
13828
            onEnabled: function (comp) {
13823
              iterCollectionItems(comp, function (childElm) {
13829
              iterCollectionItems(comp, function (childElm) {
13824
                remove$3(childElm, 'tox-collection__item--state-disabled');
13830
                remove$2(childElm, 'tox-collection__item--state-disabled');
13825
                remove$6(childElm, 'aria-disabled');
13831
                remove$7(childElm, 'aria-disabled');
13826
              });
13832
              });
13827
            }
13833
            }
13828
          }),
13834
          }),
13829
          receivingConfig(),
13835
          receivingConfig(),
13830
          Replacing.config({}),
13836
          Replacing.config({}),
Line 13875... Line 13881...
13875
    ]);
13881
    ]);
13876
    var focusBehaviours = function (detail) {
13882
    var focusBehaviours = function (detail) {
13877
      return derive$1([Focusing.config({
13883
      return derive$1([Focusing.config({
13878
          onFocus: !detail.selectOnFocus ? noop : function (component) {
13884
          onFocus: !detail.selectOnFocus ? noop : function (component) {
13879
            var input = component.element;
13885
            var input = component.element;
13880
            var value = get$9(input);
13886
            var value = get$5(input);
13881
            input.dom.setSelectionRange(0, value.length);
13887
            input.dom.setSelectionRange(0, value.length);
13882
          }
13888
          }
13883
        })]);
13889
        })]);
13884
    };
13890
    };
13885
    var behaviours = function (detail) {
13891
    var behaviours = function (detail) {
13886
      return __assign(__assign({}, focusBehaviours(detail)), augment(detail.inputBehaviours, [Representing.config({
13892
      return __assign(__assign({}, focusBehaviours(detail)), augment(detail.inputBehaviours, [Representing.config({
13887
          store: __assign(__assign({ mode: 'manual' }, detail.data.map(function (data) {
13893
          store: __assign(__assign({ mode: 'manual' }, detail.data.map(function (data) {
13888
            return { initialValue: data };
13894
            return { initialValue: data };
13889
          }).getOr({})), {
13895
          }).getOr({})), {
13890
            getValue: function (input) {
13896
            getValue: function (input) {
13891
              return get$9(input.element);
13897
              return get$5(input.element);
13892
            },
13898
            },
13893
            setValue: function (input, data) {
13899
            setValue: function (input, data) {
13894
              var current = get$9(input.element);
13900
              var current = get$5(input.element);
13895
              if (current !== data) {
13901
              if (current !== data) {
13896
                set$5(input.element, data);
13902
                set$4(input.element, data);
13897
              }
13903
              }
13898
            }
13904
            }
13899
          }),
13905
          }),
13900
          onSetValue: detail.onSetValue
13906
          onSetValue: detail.onSetValue
13901
        })]));
13907
        })]));
Line 13924... Line 13930...
13924
      factory: factory$h
13930
      factory: factory$h
13925
    });
13931
    });
13926
 
13932
 
13927
    var exports$1 = {}, module = { exports: exports$1 };
13933
    var exports$1 = {}, module = { exports: exports$1 };
13928
    (function (define, exports, module, require) {
13934
    (function (define, exports, module, require) {
13929
      (function (f) {
13935
      (function (global, factory) {
13930
        if (typeof exports === 'object' && typeof module !== 'undefined') {
13936
        typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EphoxContactWrapper = factory());
13931
          module.exports = f();
-
 
13932
        } else if (typeof define === 'function' && define.amd) {
-
 
13933
          define([], f);
-
 
13934
        } else {
-
 
13935
          var g;
-
 
13936
          if (typeof window !== 'undefined') {
-
 
13937
            g = window;
-
 
13938
          } else if (typeof global !== 'undefined') {
-
 
13939
            g = global;
-
 
13940
          } else if (typeof self !== 'undefined') {
-
 
13941
            g = self;
-
 
13942
          } else {
-
 
13943
            g = this;
-
 
13944
          }
-
 
13945
          g.EphoxContactWrapper = f();
-
 
13946
        }
-
 
13947
      }(function () {
13937
      }(this, function () {
13948
        return function () {
-
 
13949
          function r(e, n, t) {
-
 
13950
            function o(i, f) {
-
 
13951
              if (!n[i]) {
-
 
13952
                if (!e[i]) {
-
 
13953
                  var c = 'function' == typeof require && require;
-
 
13954
                  if (!f && c)
-
 
13955
                    return c(i, !0);
-
 
13956
                  if (u)
-
 
13957
                    return u(i, !0);
-
 
13958
                  var a = new Error('Cannot find module \'' + i + '\'');
13938
        var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
13959
                  throw a.code = 'MODULE_NOT_FOUND', a;
-
 
13960
                }
-
 
13961
                var p = n[i] = { exports: {} };
13939
        var promise = { exports: {} };
13962
                e[i][0].call(p.exports, function (r) {
-
 
13963
                  var n = e[i][1][r];
-
 
13964
                  return o(n || r);
-
 
13965
                }, p, p.exports, r, e, n, t);
-
 
13966
              }
-
 
13967
              return n[i].exports;
-
 
13968
            }
-
 
13969
            for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++)
-
 
13970
              o(t[i]);
-
 
13971
            return o;
-
 
13972
          }
-
 
13973
          return r;
-
 
13974
        }()({
-
 
13975
          1: [
-
 
13976
            function (require, module, exports) {
-
 
13977
              var process = module.exports = {};
-
 
13978
              var cachedSetTimeout;
-
 
13979
              var cachedClearTimeout;
-
 
13980
              function defaultSetTimout() {
-
 
13981
                throw new Error('setTimeout has not been defined');
-
 
13982
              }
-
 
13983
              function defaultClearTimeout() {
-
 
13984
                throw new Error('clearTimeout has not been defined');
-
 
13985
              }
-
 
13986
              (function () {
-
 
13987
                try {
-
 
13988
                  if (typeof setTimeout === 'function') {
-
 
13989
                    cachedSetTimeout = setTimeout;
-
 
13990
                  } else {
-
 
13991
                    cachedSetTimeout = defaultSetTimout;
-
 
13992
                  }
-
 
13993
                } catch (e) {
-
 
13994
                  cachedSetTimeout = defaultSetTimout;
-
 
13995
                }
-
 
13996
                try {
-
 
13997
                  if (typeof clearTimeout === 'function') {
-
 
13998
                    cachedClearTimeout = clearTimeout;
-
 
13999
                  } else {
-
 
14000
                    cachedClearTimeout = defaultClearTimeout;
-
 
14001
                  }
-
 
14002
                } catch (e) {
-
 
14003
                  cachedClearTimeout = defaultClearTimeout;
-
 
14004
                }
-
 
14005
              }());
-
 
14006
              function runTimeout(fun) {
-
 
14007
                if (cachedSetTimeout === setTimeout) {
-
 
14008
                  return setTimeout(fun, 0);
-
 
14009
                }
-
 
14010
                if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
-
 
14011
                  cachedSetTimeout = setTimeout;
-
 
14012
                  return setTimeout(fun, 0);
-
 
14013
                }
-
 
14014
                try {
-
 
14015
                  return cachedSetTimeout(fun, 0);
-
 
14016
                } catch (e) {
-
 
14017
                  try {
-
 
14018
                    return cachedSetTimeout.call(null, fun, 0);
-
 
14019
                  } catch (e) {
-
 
14020
                    return cachedSetTimeout.call(this, fun, 0);
-
 
14021
                  }
-
 
14022
                }
-
 
14023
              }
-
 
14024
              function runClearTimeout(marker) {
-
 
14025
                if (cachedClearTimeout === clearTimeout) {
-
 
14026
                  return clearTimeout(marker);
-
 
14027
                }
-
 
14028
                if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
-
 
14029
                  cachedClearTimeout = clearTimeout;
-
 
14030
                  return clearTimeout(marker);
-
 
14031
                }
-
 
14032
                try {
-
 
14033
                  return cachedClearTimeout(marker);
-
 
14034
                } catch (e) {
-
 
14035
                  try {
-
 
14036
                    return cachedClearTimeout.call(null, marker);
-
 
14037
                  } catch (e) {
-
 
14038
                    return cachedClearTimeout.call(this, marker);
-
 
14039
                  }
-
 
14040
                }
-
 
14041
              }
-
 
14042
              var queue = [];
-
 
14043
              var draining = false;
-
 
14044
              var currentQueue;
-
 
14045
              var queueIndex = -1;
-
 
14046
              function cleanUpNextTick() {
-
 
14047
                if (!draining || !currentQueue) {
-
 
14048
                  return;
-
 
14049
                }
-
 
14050
                draining = false;
-
 
14051
                if (currentQueue.length) {
-
 
14052
                  queue = currentQueue.concat(queue);
-
 
14053
                } else {
-
 
14054
                  queueIndex = -1;
-
 
14055
                }
-
 
14056
                if (queue.length) {
-
 
14057
                  drainQueue();
-
 
14058
                }
-
 
14059
              }
-
 
14060
              function drainQueue() {
-
 
14061
                if (draining) {
-
 
14062
                  return;
-
 
14063
                }
-
 
14064
                var timeout = runTimeout(cleanUpNextTick);
-
 
14065
                draining = true;
-
 
14066
                var len = queue.length;
-
 
14067
                while (len) {
-
 
14068
                  currentQueue = queue;
-
 
14069
                  queue = [];
-
 
14070
                  while (++queueIndex < len) {
-
 
14071
                    if (currentQueue) {
-
 
14072
                      currentQueue[queueIndex].run();
-
 
14073
                    }
-
 
14074
                  }
-
 
14075
                  queueIndex = -1;
-
 
14076
                  len = queue.length;
-
 
14077
                }
-
 
14078
                currentQueue = null;
-
 
14079
                draining = false;
-
 
14080
                runClearTimeout(timeout);
-
 
14081
              }
-
 
14082
              process.nextTick = function (fun) {
-
 
14083
                var args = new Array(arguments.length - 1);
-
 
14084
                if (arguments.length > 1) {
-
 
14085
                  for (var i = 1; i < arguments.length; i++) {
-
 
14086
                    args[i - 1] = arguments[i];
-
 
14087
                  }
-
 
14088
                }
-
 
14089
                queue.push(new Item(fun, args));
-
 
14090
                if (queue.length === 1 && !draining) {
-
 
14091
                  runTimeout(drainQueue);
-
 
14092
                }
-
 
14093
              };
-
 
14094
              function Item(fun, array) {
-
 
14095
                this.fun = fun;
-
 
14096
                this.array = array;
-
 
14097
              }
-
 
14098
              Item.prototype.run = function () {
-
 
14099
                this.fun.apply(null, this.array);
-
 
14100
              };
-
 
14101
              process.title = 'browser';
-
 
14102
              process.browser = true;
-
 
14103
              process.env = {};
-
 
14104
              process.argv = [];
-
 
14105
              process.version = '';
-
 
14106
              process.versions = {};
-
 
14107
              function noop() {
13940
        (function (module) {
14108
              }
-
 
14109
              process.on = noop;
-
 
14110
              process.addListener = noop;
-
 
14111
              process.once = noop;
-
 
14112
              process.off = noop;
-
 
14113
              process.removeListener = noop;
-
 
14114
              process.removeAllListeners = noop;
-
 
14115
              process.emit = noop;
-
 
14116
              process.prependListener = noop;
-
 
14117
              process.prependOnceListener = noop;
-
 
14118
              process.listeners = function (name) {
-
 
14119
                return [];
-
 
14120
              };
-
 
14121
              process.binding = function (name) {
-
 
14122
                throw new Error('process.binding is not supported');
-
 
14123
              };
-
 
14124
              process.cwd = function () {
-
 
14125
                return '/';
-
 
14126
              };
-
 
14127
              process.chdir = function (dir) {
-
 
14128
                throw new Error('process.chdir is not supported');
-
 
14129
              };
-
 
14130
              process.umask = function () {
-
 
14131
                return 0;
-
 
14132
              };
-
 
14133
            },
-
 
14134
            {}
-
 
14135
          ],
-
 
14136
          2: [
-
 
14137
            function (require, module, exports) {
-
 
14138
              (function (setImmediate) {
-
 
14139
                (function (root) {
13941
          (function (root) {
14140
                  var setTimeoutFunc = setTimeout;
13942
            var setTimeoutFunc = setTimeout;
14141
                  function noop() {
13943
            function noop() {
14142
                  }
13944
            }
14143
                  function bind(fn, thisArg) {
13945
            function bind(fn, thisArg) {
Line 14320... Line 14122...
14320
                    Promise._immediateFn = fn;
14122
              Promise._immediateFn = fn;
14321
                  };
14123
            };
14322
                  Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {
14124
            Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {
14323
                    Promise._unhandledRejectionFn = fn;
14125
              Promise._unhandledRejectionFn = fn;
14324
                  };
14126
            };
14325
                  if (typeof module !== 'undefined' && module.exports) {
14127
            if (module.exports) {
14326
                    module.exports = Promise;
14128
              module.exports = Promise;
14327
                  } else if (!root.Promise) {
14129
            } else if (!root.Promise) {
14328
                    root.Promise = Promise;
14130
              root.Promise = Promise;
14329
                  }
14131
            }
14330
                }(this));
14132
          }(commonjsGlobal));
14331
              }.call(this, require('timers').setImmediate));
-
 
14332
            },
-
 
14333
            { 'timers': 3 }
-
 
14334
          ],
-
 
14335
          3: [
-
 
14336
            function (require, module, exports) {
-
 
14337
              (function (setImmediate, clearImmediate) {
-
 
14338
                var nextTick = require('process/browser.js').nextTick;
-
 
14339
                var apply = Function.prototype.apply;
-
 
14340
                var slice = Array.prototype.slice;
-
 
14341
                var immediateIds = {};
-
 
14342
                var nextImmediateId = 0;
-
 
14343
                exports.setTimeout = function () {
-
 
14344
                  return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
-
 
14345
                };
-
 
14346
                exports.setInterval = function () {
-
 
14347
                  return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
-
 
14348
                };
-
 
14349
                exports.clearTimeout = exports.clearInterval = function (timeout) {
-
 
14350
                  timeout.close();
-
 
14351
                };
-
 
14352
                function Timeout(id, clearFn) {
-
 
14353
                  this._id = id;
-
 
14354
                  this._clearFn = clearFn;
-
 
14355
                }
-
 
14356
                Timeout.prototype.unref = Timeout.prototype.ref = function () {
-
 
14357
                };
-
 
14358
                Timeout.prototype.close = function () {
-
 
14359
                  this._clearFn.call(window, this._id);
-
 
14360
                };
-
 
14361
                exports.enroll = function (item, msecs) {
-
 
14362
                  clearTimeout(item._idleTimeoutId);
-
 
14363
                  item._idleTimeout = msecs;
-
 
14364
                };
-
 
14365
                exports.unenroll = function (item) {
-
 
14366
                  clearTimeout(item._idleTimeoutId);
-
 
14367
                  item._idleTimeout = -1;
-
 
14368
                };
-
 
14369
                exports._unrefActive = exports.active = function (item) {
-
 
14370
                  clearTimeout(item._idleTimeoutId);
-
 
14371
                  var msecs = item._idleTimeout;
-
 
14372
                  if (msecs >= 0) {
-
 
14373
                    item._idleTimeoutId = setTimeout(function onTimeout() {
-
 
14374
                      if (item._onTimeout)
-
 
14375
                        item._onTimeout();
-
 
14376
                    }, msecs);
-
 
14377
                  }
-
 
14378
                };
-
 
14379
                exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) {
-
 
14380
                  var id = nextImmediateId++;
-
 
14381
                  var args = arguments.length < 2 ? false : slice.call(arguments, 1);
-
 
14382
                  immediateIds[id] = true;
-
 
14383
                  nextTick(function onNextTick() {
-
 
14384
                    if (immediateIds[id]) {
-
 
14385
                      if (args) {
-
 
14386
                        fn.apply(null, args);
-
 
14387
                      } else {
-
 
14388
                        fn.call(null);
-
 
14389
                      }
-
 
14390
                      exports.clearImmediate(id);
-
 
14391
                    }
-
 
14392
                  });
14133
        }(promise));
14393
                  return id;
-
 
14394
                };
-
 
14395
                exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) {
-
 
14396
                  delete immediateIds[id];
-
 
14397
                };
-
 
14398
              }.call(this, require('timers').setImmediate, require('timers').clearImmediate));
-
 
14399
            },
-
 
14400
            {
-
 
14401
              'process/browser.js': 1,
-
 
14402
              'timers': 3
-
 
14403
            }
-
 
14404
          ],
-
 
14405
          4: [
-
 
14406
            function (require, module, exports) {
-
 
14407
              var promisePolyfill = require('promise-polyfill');
14134
        var promisePolyfill = promise.exports;
14408
              var Global = function () {
14135
        var Global = function () {
14409
                if (typeof window !== 'undefined') {
14136
          if (typeof window !== 'undefined') {
14410
                  return window;
14137
            return window;
14411
                } else {
14138
          } else {
14412
                  return Function('return this;')();
14139
            return Function('return this;')();
14413
                }
14140
          }
14414
              }();
14141
        }();
14415
              module.exports = { boltExport: Global.Promise || promisePolyfill };
14142
        var promisePolyfill_1 = { boltExport: Global.Promise || promisePolyfill };
14416
            },
-
 
14417
            { 'promise-polyfill': 2 }
14143
        return promisePolyfill_1;
14418
          ]
-
 
14419
        }, {}, [4])(4);
-
 
14420
      }));
14144
      }));
14421
    }(undefined, exports$1, module, undefined));
14145
    }(undefined, exports$1, module));
14422
    var Promise$2 = module.exports.boltExport;
14146
    var Promise$1 = module.exports.boltExport;
14423
 
14147
 
14424
    var nu$3 = function (baseFn) {
14148
    var nu$3 = function (baseFn) {
14425
      var data = Optional.none();
14149
      var data = Optional.none();
14426
      var callbacks = [];
14150
      var callbacks = [];
14427
      var map = function (f) {
14151
      var map = function (f) {
Line 14526... Line 14250...
14526
        get: get
14250
        get: get
14527
      };
14251
      };
14528
    };
14252
    };
14529
    var nu$2 = function (baseFn) {
14253
    var nu$2 = function (baseFn) {
14530
      return make$5(function () {
14254
      return make$5(function () {
14531
        return new Promise$2(baseFn);
14255
        return new Promise$1(baseFn);
14532
      });
14256
      });
14533
    };
14257
    };
14534
    var pure = function (a) {
14258
    var pure = function (a) {
14535
      return make$5(function () {
14259
      return make$5(function () {
14536
        return Promise$2.resolve(a);
14260
        return Promise$1.resolve(a);
14537
      });
14261
      });
14538
    };
14262
    };
14539
    var Future = {
14263
    var Future = {
14540
      nu: nu$2,
14264
      nu: nu$2,
14541
      pure: pure
14265
      pure: pure
Line 14549... Line 14273...
14549
      var name = name$2(elem);
14273
      var name = name$2(elem);
14550
      return contains$2(ariaElements, name);
14274
      return contains$2(ariaElements, name);
14551
    };
14275
    };
14552
    var markValid = function (component, invalidConfig) {
14276
    var markValid = function (component, invalidConfig) {
14553
      var elem = invalidConfig.getRoot(component).getOr(component.element);
14277
      var elem = invalidConfig.getRoot(component).getOr(component.element);
14554
      remove$3(elem, invalidConfig.invalidClass);
14278
      remove$2(elem, invalidConfig.invalidClass);
14555
      invalidConfig.notify.each(function (notifyInfo) {
14279
      invalidConfig.notify.each(function (notifyInfo) {
14556
        if (isAriaElement(component.element)) {
14280
        if (isAriaElement(component.element)) {
14557
          set$7(component.element, 'aria-invalid', false);
14281
          set$8(component.element, 'aria-invalid', false);
14558
        }
14282
        }
14559
        notifyInfo.getContainer(component).each(function (container) {
14283
        notifyInfo.getContainer(component).each(function (container) {
14560
          set$8(container, notifyInfo.validHtml);
14284
          set$5(container, notifyInfo.validHtml);
14561
        });
14285
        });
14562
        notifyInfo.onValid(component);
14286
        notifyInfo.onValid(component);
14563
      });
14287
      });
14564
    };
14288
    };
14565
    var markInvalid = function (component, invalidConfig, invalidState, text) {
14289
    var markInvalid = function (component, invalidConfig, invalidState, text) {
14566
      var elem = invalidConfig.getRoot(component).getOr(component.element);
14290
      var elem = invalidConfig.getRoot(component).getOr(component.element);
14567
      add$2(elem, invalidConfig.invalidClass);
14291
      add$2(elem, invalidConfig.invalidClass);
14568
      invalidConfig.notify.each(function (notifyInfo) {
14292
      invalidConfig.notify.each(function (notifyInfo) {
14569
        if (isAriaElement(component.element)) {
14293
        if (isAriaElement(component.element)) {
14570
          set$7(component.element, 'aria-invalid', true);
14294
          set$8(component.element, 'aria-invalid', true);
14571
        }
14295
        }
14572
        notifyInfo.getContainer(component).each(function (container) {
14296
        notifyInfo.getContainer(component).each(function (container) {
14573
          set$8(container, text);
14297
          set$5(container, text);
14574
        });
14298
        });
14575
        notifyInfo.onInvalid(component, text);
14299
        notifyInfo.onInvalid(component, text);
14576
      });
14300
      });
14577
    };
14301
    };
14578
    var query = function (component, invalidConfig, _invalidState) {
14302
    var query = function (component, invalidConfig, _invalidState) {
Line 14821... Line 14545...
14821
      var action = showing ? close : open;
14545
      var action = showing ? close : open;
14822
      return action(detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen);
14546
      return action(detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen);
14823
    };
14547
    };
14824
    var matchWidth = function (hotspot, container, useMinWidth) {
14548
    var matchWidth = function (hotspot, container, useMinWidth) {
14825
      var menu = Composing.getCurrent(container).getOr(container);
14549
      var menu = Composing.getCurrent(container).getOr(container);
14826
      var buttonWidth = get$7(hotspot.element);
14550
      var buttonWidth = get$a(hotspot.element);
14827
      if (useMinWidth) {
14551
      if (useMinWidth) {
14828
        set$6(menu.element, 'min-width', buttonWidth + 'px');
14552
        set$7(menu.element, 'min-width', buttonWidth + 'px');
14829
      } else {
14553
      } else {
14830
        set$4(menu.element, buttonWidth);
14554
        set$6(menu.element, buttonWidth);
14831
      }
14555
      }
14832
    };
14556
    };
14833
    var getSink = function (anyInSystem, sinkDetail) {
14557
    var getSink = function (anyInSystem, sinkDetail) {
14834
      return anyInSystem.getSystem().getByUid(sinkDetail.uid + '-' + suffix()).map(function (internalSink) {
14558
      return anyInSystem.getSystem().getByUid(sinkDetail.uid + '-' + suffix()).map(function (internalSink) {
14835
        return function () {
14559
        return function () {
Line 15173... Line 14897...
15173
                var inputValue = Representing.getValue(input);
14897
                var inputValue = Representing.getValue(input);
15174
                if (inputValue.length === 0) {
14898
                if (inputValue.length === 0) {
15175
                  return Future.pure(Result.value(true));
14899
                  return Future.pure(Result.value(true));
15176
                } else {
14900
                } else {
15177
                  var span = SugarElement.fromTag('span');
14901
                  var span = SugarElement.fromTag('span');
15178
                  set$6(span, 'background-color', inputValue);
14902
                  set$7(span, 'background-color', inputValue);
15179
                  var res = getRaw(span, 'background-color').fold(function () {
14903
                  var res = getRaw(span, 'background-color').fold(function () {
15180
                    return Result.error('blah');
14904
                    return Result.error('blah');
15181
                  }, function (_) {
14905
                  }, function (_) {
15182
                    return Result.value(inputValue);
14906
                    return Result.value(inputValue);
15183
                  });
14907
                  });
Line 15256... Line 14980...
15256
            ]
14980
            ]
15257
          }]),
14981
          }]),
15258
        fieldBehaviours: derive$1([config('form-field-events', [
14982
        fieldBehaviours: derive$1([config('form-field-events', [
15259
            run$1(colorInputChangeEvent, function (comp, se) {
14983
            run$1(colorInputChangeEvent, function (comp, se) {
15260
              memColorButton.getOpt(comp).each(function (colorButton) {
14984
              memColorButton.getOpt(comp).each(function (colorButton) {
15261
                set$6(colorButton.element, 'background-color', se.event.color);
14985
                set$7(colorButton.element, 'background-color', se.event.color);
15262
              });
14986
              });
15263
              emitWith(comp, formChangeEvent, { name: spec.name });
14987
              emitWith(comp, formChangeEvent, { name: spec.name });
15264
            }),
14988
            }),
15265
            run$1(colorSwatchChangeEvent, function (comp, se) {
14989
            run$1(colorSwatchChangeEvent, function (comp, se) {
15266
              FormField.getField(comp).each(function (field) {
14990
              FormField.getField(comp).each(function (field) {
Line 15391... Line 15115...
15391
      spectrumPart
15115
      spectrumPart
15392
    ];
15116
    ];
15393
 
15117
 
15394
    var _sliderChangeEvent = 'slider.change.value';
15118
    var _sliderChangeEvent = 'slider.change.value';
15395
    var sliderChangeEvent = constant$1(_sliderChangeEvent);
15119
    var sliderChangeEvent = constant$1(_sliderChangeEvent);
15396
    var isTouchEvent$1 = function (evt) {
15120
    var isTouchEvent$2 = function (evt) {
15397
      return evt.type.indexOf('touch') !== -1;
15121
      return evt.type.indexOf('touch') !== -1;
15398
    };
15122
    };
15399
    var getEventSource = function (simulatedEvent) {
15123
    var getEventSource = function (simulatedEvent) {
15400
      var evt = simulatedEvent.event.raw;
15124
      var evt = simulatedEvent.event.raw;
15401
      if (isTouchEvent$1(evt)) {
15125
      if (isTouchEvent$2(evt)) {
15402
        var touchEvent = evt;
15126
        var touchEvent = evt;
15403
        return touchEvent.touches !== undefined && touchEvent.touches.length === 1 ? Optional.some(touchEvent.touches[0]).map(function (t) {
15127
        return touchEvent.touches !== undefined && touchEvent.touches.length === 1 ? Optional.some(touchEvent.touches[0]).map(function (t) {
15404
          return SugarPosition(t.clientX, t.clientY);
15128
          return SugarPosition(t.clientX, t.clientY);
15405
        }) : Optional.none();
15129
        }) : Optional.none();
15406
      } else {
15130
      } else {
Line 15744... Line 15468...
15744
      return getMinXBounds(spectrum) - getMinXBounds(slider) + offset;
15468
      return getMinXBounds(spectrum) - getMinXBounds(slider) + offset;
15745
    };
15469
    };
15746
    var setPositionFromValue$2 = function (slider, thumb, detail, edges) {
15470
    var setPositionFromValue$2 = function (slider, thumb, detail, edges) {
15747
      var value = currentValue(detail);
15471
      var value = currentValue(detail);
15748
      var pos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);
15472
      var pos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);
15749
      var thumbRadius = get$7(thumb.element) / 2;
15473
      var thumbRadius = get$a(thumb.element) / 2;
15750
      set$6(thumb.element, 'left', pos - thumbRadius + 'px');
15474
      set$7(thumb.element, 'left', pos - thumbRadius + 'px');
15751
    };
15475
    };
15752
    var onLeft$2 = handleMovement$2(-1);
15476
    var onLeft$2 = handleMovement$2(-1);
15753
    var onRight$2 = handleMovement$2(1);
15477
    var onRight$2 = handleMovement$2(1);
15754
    var onUp$2 = Optional.none;
15478
    var onUp$2 = Optional.none;
15755
    var onDown$2 = Optional.none;
15479
    var onDown$2 = Optional.none;
Line 15865... Line 15589...
15865
      return getMinYBounds(spectrum) - getMinYBounds(slider) + offset;
15589
      return getMinYBounds(spectrum) - getMinYBounds(slider) + offset;
15866
    };
15590
    };
15867
    var setPositionFromValue$1 = function (slider, thumb, detail, edges) {
15591
    var setPositionFromValue$1 = function (slider, thumb, detail, edges) {
15868
      var value = currentValue(detail);
15592
      var value = currentValue(detail);
15869
      var pos = findPositionOfValue(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);
15593
      var pos = findPositionOfValue(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);
15870
      var thumbRadius = get$8(thumb.element) / 2;
15594
      var thumbRadius = get$b(thumb.element) / 2;
15871
      set$6(thumb.element, 'top', pos - thumbRadius + 'px');
15595
      set$7(thumb.element, 'top', pos - thumbRadius + 'px');
15872
    };
15596
    };
15873
    var onLeft$1 = Optional.none;
15597
    var onLeft$1 = Optional.none;
15874
    var onRight$1 = Optional.none;
15598
    var onRight$1 = Optional.none;
15875
    var onUp$1 = handleMovement$1(-1);
15599
    var onUp$1 = handleMovement$1(-1);
15876
    var onDown$1 = handleMovement$1(1);
15600
    var onDown$1 = handleMovement$1(1);
Line 15944... Line 15668...
15944
    };
15668
    };
15945
    var setPositionFromValue = function (slider, thumb, detail, edges) {
15669
    var setPositionFromValue = function (slider, thumb, detail, edges) {
15946
      var value = currentValue(detail);
15670
      var value = currentValue(detail);
15947
      var xPos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);
15671
      var xPos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);
15948
      var yPos = findPositionOfValue(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);
15672
      var yPos = findPositionOfValue(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);
15949
      var thumbXRadius = get$7(thumb.element) / 2;
15673
      var thumbXRadius = get$a(thumb.element) / 2;
15950
      var thumbYRadius = get$8(thumb.element) / 2;
15674
      var thumbYRadius = get$b(thumb.element) / 2;
15951
      set$6(thumb.element, 'left', xPos - thumbXRadius + 'px');
15675
      set$7(thumb.element, 'left', xPos - thumbXRadius + 'px');
15952
      set$6(thumb.element, 'top', yPos - thumbYRadius + 'px');
15676
      set$7(thumb.element, 'top', yPos - thumbYRadius + 'px');
15953
    };
15677
    };
15954
    var onLeft = handleMovement(-1, false);
15678
    var onLeft = handleMovement(-1, false);
15955
    var onRight = handleMovement(1, false);
15679
    var onRight = handleMovement(1, false);
15956
    var onUp = handleMovement(-1, true);
15680
    var onUp = handleMovement(-1, true);
15957
    var onDown = handleMovement(1, true);
15681
    var onDown = handleMovement(1, true);
Line 16254... Line 15978...
16254
        behaviours: augment(detail.formBehaviours, [Representing.config({
15978
        behaviours: augment(detail.formBehaviours, [Representing.config({
16255
            store: {
15979
            store: {
16256
              mode: 'manual',
15980
              mode: 'manual',
16257
              getValue: function (form) {
15981
              getValue: function (form) {
16258
                var resPs = getAllParts(form, detail);
15982
                var resPs = getAllParts(form, detail);
16259
                return map(resPs, function (resPThunk, pName) {
15983
                return map$1(resPs, function (resPThunk, pName) {
16260
                  return resPThunk().bind(function (v) {
15984
                  return resPThunk().bind(function (v) {
16261
                    var opt = Composing.getCurrent(v);
15985
                    var opt = Composing.getCurrent(v);
16262
                    return toResult(opt, new Error('Cannot find a current component to extract the value from for form part \'' + pName + '\': ' + element(v.element)));
15986
                    return toResult(opt, new Error('Cannot find a current component to extract the value from for form part \'' + pName + '\': ' + element(v.element)));
16263
                  }).map(Representing.getValue);
15987
                  }).map(Representing.getValue);
16264
                });
15988
                });
Line 16389... Line 16113...
16389
          attributes: { role: 'presentation' }
16113
          attributes: { role: 'presentation' }
16390
        }
16114
        }
16391
      });
16115
      });
16392
      var updatePreview = function (anyInSystem, hex) {
16116
      var updatePreview = function (anyInSystem, hex) {
16393
        memPreview.getOpt(anyInSystem).each(function (preview) {
16117
        memPreview.getOpt(anyInSystem).each(function (preview) {
16394
          set$6(preview.element, 'background-color', '#' + hex.value);
16118
          set$7(preview.element, 'background-color', '#' + hex.value);
16395
        });
16119
        });
16396
      };
16120
      };
16397
      var factory = function () {
16121
      var factory = function () {
16398
        var state = {
16122
        var state = {
16399
          red: Cell(Optional.some(255)),
16123
          red: Cell(Optional.some(255)),
Line 16855... Line 16579...
16855
          ComposingConfigs.self()
16579
          ComposingConfigs.self()
16856
        ])
16580
        ])
16857
      };
16581
      };
16858
    };
16582
    };
16859
 
16583
 
16860
    var global$7 = tinymce.util.Tools.resolve('tinymce.Resource');
16584
    var global$6 = tinymce.util.Tools.resolve('tinymce.Resource');
16861
 
16585
 
16862
    var isOldCustomEditor = function (spec) {
16586
    var isOldCustomEditor = function (spec) {
16863
      return has$2(spec, 'init');
16587
      return has$2(spec, 'init');
16864
    };
16588
    };
16865
    var renderCustomEditor = function (spec) {
16589
    var renderCustomEditor = function (spec) {
Line 16872... Line 16596...
16872
          classes: ['tox-custom-editor']
16596
          classes: ['tox-custom-editor']
16873
        },
16597
        },
16874
        behaviours: derive$1([
16598
        behaviours: derive$1([
16875
          config('custom-editor-events', [runOnAttached(function (component) {
16599
          config('custom-editor-events', [runOnAttached(function (component) {
16876
              memReplaced.getOpt(component).each(function (ta) {
16600
              memReplaced.getOpt(component).each(function (ta) {
16877
                (isOldCustomEditor(spec) ? spec.init(ta.element.dom) : global$7.load(spec.scriptId, spec.scriptUrl).then(function (init) {
16601
                (isOldCustomEditor(spec) ? spec.init(ta.element.dom) : global$6.load(spec.scriptId, spec.scriptUrl).then(function (init) {
16878
                  return init(ta.element.dom, spec.settings);
16602
                  return init(ta.element.dom, spec.settings);
16879
                })).then(function (ea) {
16603
                })).then(function (ea) {
16880
                  initialValue.on(function (cvalue) {
16604
                  initialValue.on(function (cvalue) {
16881
                    ea.setValue(cvalue);
16605
                    ea.setValue(cvalue);
16882
                  });
16606
                  });
Line 16908... Line 16632...
16908
        ]),
16632
        ]),
16909
        components: [memReplaced.asSpec()]
16633
        components: [memReplaced.asSpec()]
16910
      };
16634
      };
16911
    };
16635
    };
16912
 
16636
 
16913
    var global$6 = tinymce.util.Tools.resolve('tinymce.util.Tools');
16637
    var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
16914
 
16638
 
16915
    var processors = objOf([
16639
    var processors = objOf([
16916
      defaulted('preprocess', identity$1),
16640
      defaulted('preprocess', identity$1),
16917
      defaulted('postprocess', identity$1)
16641
      defaulted('postprocess', identity$1)
16918
    ]);
16642
    ]);
Line 16951... Line 16675...
16951
      }, function (c, v) {
16675
      }, function (c, v) {
16952
        return setter(c.element, v);
16676
        return setter(c.element, v);
16953
      });
16677
      });
16954
    };
16678
    };
16955
    var domValue = function (optInitialValue) {
16679
    var domValue = function (optInitialValue) {
16956
      return withElement(optInitialValue, get$9, set$5);
16680
      return withElement(optInitialValue, get$5, set$4);
16957
    };
16681
    };
16958
    var domHtml = function (optInitialValue) {
16682
    var domHtml = function (optInitialValue) {
16959
      return withElement(optInitialValue, get$d, set$8);
16683
      return withElement(optInitialValue, get$7, set$5);
16960
    };
16684
    };
16961
    var memory = function (initialValue) {
16685
    var memory = function (initialValue) {
16962
      return Representing.config({
16686
      return Representing.config({
16963
        store: {
16687
        store: {
16964
          mode: 'memory',
16688
          mode: 'memory',
Line 16975... Line 16699...
16975
      memory: memory
16699
      memory: memory
16976
    };
16700
    };
16977
 
16701
 
16978
    var defaultImageFileTypes = 'jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp';
16702
    var defaultImageFileTypes = 'jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp';
16979
    var filterByExtension = function (files, providersBackstage) {
16703
    var filterByExtension = function (files, providersBackstage) {
16980
      var allowedImageFileTypes = global$6.explode(providersBackstage.getSetting('images_file_types', defaultImageFileTypes, 'string'));
16704
      var allowedImageFileTypes = global$5.explode(providersBackstage.getSetting('images_file_types', defaultImageFileTypes, 'string'));
16981
      var isFileInAllowedTypes = function (file) {
16705
      var isFileInAllowedTypes = function (file) {
16982
        return exists(allowedImageFileTypes, function (type) {
16706
        return exists(allowedImageFileTypes, function (type) {
16983
          return endsWith(file.name.toLowerCase(), '.' + type.toLowerCase());
16707
          return endsWith(file.name.toLowerCase(), '.' + type.toLowerCase());
16984
        });
16708
        });
16985
      };
16709
      };
Line 17178... Line 16902...
17178
        getValue: function (_frameComponent) {
16902
        getValue: function (_frameComponent) {
17179
          return cachedValue.get();
16903
          return cachedValue.get();
17180
        },
16904
        },
17181
        setValue: function (frameComponent, html) {
16905
        setValue: function (frameComponent, html) {
17182
          if (!isSandbox) {
16906
          if (!isSandbox) {
17183
            set$7(frameComponent.element, 'src', 'javascript:\'\'');
16907
            set$8(frameComponent.element, 'src', 'javascript:\'\'');
17184
            var doc = frameComponent.element.dom.contentWindow.document;
16908
            var doc = frameComponent.element.dom.contentWindow.document;
17185
            doc.open();
16909
            doc.open();
17186
            doc.write(html);
16910
            doc.write(html);
17187
            doc.close();
16911
            doc.close();
17188
          } else {
16912
          } else {
17189
            set$7(frameComponent.element, 'srcdoc', html);
16913
            set$8(frameComponent.element, 'srcdoc', html);
17190
          }
16914
          }
17191
          cachedValue.set(html);
16915
          cachedValue.set(html);
17192
        }
16916
        }
17193
      };
16917
      };
17194
    };
16918
    };
Line 17242... Line 16966...
17242
    };
16966
    };
17243
    var getHeight$1 = function (image) {
16967
    var getHeight$1 = function (image) {
17244
      return image.naturalHeight || image.height;
16968
      return image.naturalHeight || image.height;
17245
    };
16969
    };
17246
 
16970
 
17247
    var promise = function () {
-
 
17248
      var Promise = function (fn) {
-
 
17249
        if (typeof this !== 'object') {
-
 
17250
          throw new TypeError('Promises must be constructed via new');
-
 
17251
        }
-
 
17252
        if (typeof fn !== 'function') {
-
 
17253
          throw new TypeError('not a function');
-
 
17254
        }
-
 
17255
        this._state = null;
-
 
17256
        this._value = null;
-
 
17257
        this._deferreds = [];
-
 
17258
        doResolve(fn, bind(resolve, this), bind(reject, this));
-
 
17259
      };
-
 
17260
      var anyWindow = window;
-
 
17261
      var asap = Promise.immediateFn || typeof anyWindow.setImmediate === 'function' && anyWindow.setImmediate || function (fn) {
-
 
17262
        return setTimeout(fn, 1);
-
 
17263
      };
-
 
17264
      var bind = function (fn, thisArg) {
-
 
17265
        return function () {
-
 
17266
          var args = [];
-
 
17267
          for (var _i = 0; _i < arguments.length; _i++) {
-
 
17268
            args[_i] = arguments[_i];
-
 
17269
          }
-
 
17270
          return fn.apply(thisArg, args);
-
 
17271
        };
-
 
17272
      };
-
 
17273
      var isArray = Array.isArray || function (value) {
-
 
17274
        return Object.prototype.toString.call(value) === '[object Array]';
-
 
17275
      };
-
 
17276
      function handle(deferred) {
-
 
17277
        var me = this;
-
 
17278
        if (this._state === null) {
-
 
17279
          this._deferreds.push(deferred);
-
 
17280
          return;
-
 
17281
        }
-
 
17282
        asap(function () {
-
 
17283
          var cb = me._state ? deferred.onFulfilled : deferred.onRejected;
-
 
17284
          if (cb === null) {
-
 
17285
            (me._state ? deferred.resolve : deferred.reject)(me._value);
-
 
17286
            return;
-
 
17287
          }
-
 
17288
          var ret;
-
 
17289
          try {
-
 
17290
            ret = cb(me._value);
-
 
17291
          } catch (e) {
-
 
17292
            deferred.reject(e);
-
 
17293
            return;
-
 
17294
          }
-
 
17295
          deferred.resolve(ret);
-
 
17296
        });
-
 
17297
      }
-
 
17298
      function resolve(newValue) {
-
 
17299
        try {
-
 
17300
          if (newValue === this) {
-
 
17301
            throw new TypeError('A promise cannot be resolved with itself.');
-
 
17302
          }
-
 
17303
          if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
-
 
17304
            var then = newValue.then;
-
 
17305
            if (typeof then === 'function') {
-
 
17306
              doResolve(bind(then, newValue), bind(resolve, this), bind(reject, this));
-
 
17307
              return;
-
 
17308
            }
-
 
17309
          }
-
 
17310
          this._state = true;
-
 
17311
          this._value = newValue;
-
 
17312
          finale.call(this);
-
 
17313
        } catch (e) {
-
 
17314
          reject.call(this, e);
-
 
17315
        }
-
 
17316
      }
-
 
17317
      function reject(newValue) {
-
 
17318
        this._state = false;
-
 
17319
        this._value = newValue;
-
 
17320
        finale.call(this);
-
 
17321
      }
-
 
17322
      function finale() {
-
 
17323
        for (var _i = 0, _a = this._deferreds; _i < _a.length; _i++) {
-
 
17324
          var deferred = _a[_i];
-
 
17325
          handle.call(this, deferred);
-
 
17326
        }
-
 
17327
        this._deferreds = [];
-
 
17328
      }
-
 
17329
      function Handler(onFulfilled, onRejected, resolve, reject) {
-
 
17330
        this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
-
 
17331
        this.onRejected = typeof onRejected === 'function' ? onRejected : null;
-
 
17332
        this.resolve = resolve;
-
 
17333
        this.reject = reject;
-
 
17334
      }
-
 
17335
      var doResolve = function (fn, onFulfilled, onRejected) {
-
 
17336
        var done = false;
-
 
17337
        try {
-
 
17338
          fn(function (value) {
-
 
17339
            if (done) {
-
 
17340
              return;
-
 
17341
            }
-
 
17342
            done = true;
-
 
17343
            onFulfilled(value);
-
 
17344
          }, function (reason) {
-
 
17345
            if (done) {
-
 
17346
              return;
-
 
17347
            }
-
 
17348
            done = true;
-
 
17349
            onRejected(reason);
-
 
17350
          });
-
 
17351
        } catch (ex) {
-
 
17352
          if (done) {
-
 
17353
            return;
-
 
17354
          }
-
 
17355
          done = true;
-
 
17356
          onRejected(ex);
-
 
17357
        }
-
 
17358
      };
-
 
17359
      Promise.prototype.catch = function (onRejected) {
-
 
17360
        return this.then(null, onRejected);
-
 
17361
      };
-
 
17362
      Promise.prototype.then = function (onFulfilled, onRejected) {
-
 
17363
        var me = this;
-
 
17364
        return new Promise(function (resolve, reject) {
-
 
17365
          handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject));
-
 
17366
        });
-
 
17367
      };
-
 
17368
      Promise.all = function () {
-
 
17369
        var values = [];
-
 
17370
        for (var _i = 0; _i < arguments.length; _i++) {
-
 
17371
          values[_i] = arguments[_i];
-
 
17372
        }
-
 
17373
        var args = Array.prototype.slice.call(values.length === 1 && isArray(values[0]) ? values[0] : values);
-
 
17374
        return new Promise(function (resolve, reject) {
-
 
17375
          if (args.length === 0) {
-
 
17376
            return resolve([]);
-
 
17377
          }
-
 
17378
          var remaining = args.length;
-
 
17379
          var res = function (i, val) {
-
 
17380
            try {
-
 
17381
              if (val && (typeof val === 'object' || typeof val === 'function')) {
-
 
17382
                var then = val.then;
-
 
17383
                if (typeof then === 'function') {
-
 
17384
                  then.call(val, function (val) {
-
 
17385
                    res(i, val);
-
 
17386
                  }, reject);
-
 
17387
                  return;
-
 
17388
                }
-
 
17389
              }
-
 
17390
              args[i] = val;
-
 
17391
              if (--remaining === 0) {
-
 
17392
                resolve(args);
-
 
17393
              }
-
 
17394
            } catch (ex) {
-
 
17395
              reject(ex);
-
 
17396
            }
-
 
17397
          };
-
 
17398
          for (var i = 0; i < args.length; i++) {
-
 
17399
            res(i, args[i]);
-
 
17400
          }
-
 
17401
        });
-
 
17402
      };
-
 
17403
      Promise.resolve = function (value) {
-
 
17404
        if (value && typeof value === 'object' && value.constructor === Promise) {
-
 
17405
          return value;
-
 
17406
        }
-
 
17407
        return new Promise(function (resolve) {
-
 
17408
          resolve(value);
-
 
17409
        });
-
 
17410
      };
-
 
17411
      Promise.reject = function (reason) {
-
 
17412
        return new Promise(function (resolve, reject) {
-
 
17413
          reject(reason);
-
 
17414
        });
-
 
17415
      };
-
 
17416
      Promise.race = function (values) {
-
 
17417
        return new Promise(function (resolve, reject) {
-
 
17418
          for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
-
 
17419
            var value = values_1[_i];
-
 
17420
            value.then(resolve, reject);
-
 
17421
          }
-
 
17422
        });
-
 
17423
      };
-
 
17424
      return Promise;
-
 
17425
    };
-
 
17426
    var Promise$1 = window.Promise ? window.Promise : promise();
-
 
17427
 
-
 
17428
    var blobToImage = function (blob) {
16971
    var blobToImage = function (blob) {
17429
      return new Promise$1(function (resolve, reject) {
16972
      return new Promise$1(function (resolve, reject) {
17430
        var blobUrl = URL.createObjectURL(blob);
16973
        var blobUrl = URL.createObjectURL(blob);
17431
        var image = new Image();
16974
        var image = new Image();
17432
        var removeListeners = function () {
16975
        var removeListeners = function () {
Line 18234... Line 17777...
18234
          }),
17777
          }),
18235
          Optional.some(iconSpec)
17778
          Optional.some(iconSpec)
18236
        ]),
17779
        ]),
18237
        matchWidth: true,
17780
        matchWidth: true,
18238
        useMinWidth: true,
17781
        useMinWidth: true,
18239
        dropdownBehaviours: derive$1(__spreadArray(__spreadArray([], spec.dropdownBehaviours), [
17782
        dropdownBehaviours: derive$1(__spreadArray(__spreadArray([], spec.dropdownBehaviours, true), [
18240
          DisablingConfigs.button(function () {
17783
          DisablingConfigs.button(function () {
18241
            return spec.disabled || sharedBackstage.providers.isDisabled();
17784
            return spec.disabled || sharedBackstage.providers.isDisabled();
18242
          }),
17785
          }),
18243
          receivingConfig(),
17786
          receivingConfig(),
18244
          Unselecting.config({}),
17787
          Unselecting.config({}),
Line 18261... Line 17804...
18261
              }).each(function (displayIcon) {
17804
              }).each(function (displayIcon) {
18262
                Replacing.set(displayIcon, [renderReplacableIconFromPack(se.event.icon, sharedBackstage.providers.icons)]);
17805
                Replacing.set(displayIcon, [renderReplacableIconFromPack(se.event.icon, sharedBackstage.providers.icons)]);
18263
              });
17806
              });
18264
            })
17807
            })
18265
          ])
17808
          ])
18266
        ])),
17809
        ], false)),
18267
        eventOrder: deepMerge(toolbarButtonEventOrder, {
17810
        eventOrder: deepMerge(toolbarButtonEventOrder, {
18268
          mousedown: [
17811
          mousedown: [
18269
            'focusing',
17812
            'focusing',
18270
            'alloy.base.behaviour',
17813
            'alloy.base.behaviour',
18271
            'item-type-events',
17814
            'item-type-events',
Line 18368... Line 17911...
18368
      var data = expand(items, backstage.shared.providers.menuItems());
17911
      var data = expand(items, backstage.shared.providers.menuItems());
18369
      if (data.items.length === 0) {
17912
      if (data.items.length === 0) {
18370
        return Optional.none();
17913
        return Optional.none();
18371
      }
17914
      }
18372
      var mainMenu = createPartialMenu(primary, data.items, itemResponse, backstage, isHorizontalMenu);
17915
      var mainMenu = createPartialMenu(primary, data.items, itemResponse, backstage, isHorizontalMenu);
18373
      var submenus = map(data.menus, function (menuItems, menuName) {
17916
      var submenus = map$1(data.menus, function (menuItems, menuName) {
18374
        return createPartialMenu(menuName, menuItems, itemResponse, backstage, false);
17917
        return createPartialMenu(menuName, menuItems, itemResponse, backstage, false);
18375
      });
17918
      });
18376
      var menus = deepMerge(submenus, wrap$1(primary, mainMenu));
17919
      var menus = deepMerge(submenus, wrap$1(primary, mainMenu));
18377
      return Optional.from(tieredMenu.tieredData(primary, menus, data.expansions));
17920
      return Optional.from(tieredMenu.tieredData(primary, menus, data.expansions));
18378
    };
17921
    };
Line 18387... Line 17930...
18387
        },
17930
        },
18388
        setActive: function (state) {
17931
        setActive: function (state) {
18389
          var elm = component.element;
17932
          var elm = component.element;
18390
          if (state) {
17933
          if (state) {
18391
            add$2(elm, 'tox-tbtn--enabled');
17934
            add$2(elm, 'tox-tbtn--enabled');
18392
            set$7(elm, 'aria-pressed', true);
17935
            set$8(elm, 'aria-pressed', true);
18393
          } else {
17936
          } else {
18394
            remove$3(elm, 'tox-tbtn--enabled');
17937
            remove$2(elm, 'tox-tbtn--enabled');
18395
            remove$6(elm, 'aria-pressed');
17938
            remove$7(elm, 'aria-pressed');
18396
          }
17939
          }
18397
        },
17940
        },
18398
        isActive: function () {
17941
        isActive: function () {
18399
          return has(component.element, 'tox-tbtn--enabled');
17942
          return has(component.element, 'tox-tbtn--enabled');
18400
        }
17943
        }
Line 18536... Line 18079...
18536
      var components = icon.isSome() ? componentRenderPipeline([icon]) : [];
18079
      var components = icon.isSome() ? componentRenderPipeline([icon]) : [];
18537
      var innerHtml = icon.isSome() ? {} : { innerHtml: translatedText };
18080
      var innerHtml = icon.isSome() ? {} : { innerHtml: translatedText };
18538
      var classes = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], !spec.primary && !spec.borderless ? [
18081
      var classes = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], !spec.primary && !spec.borderless ? [
18539
        'tox-button',
18082
        'tox-button',
18540
        'tox-button--secondary'
18083
        'tox-button--secondary'
18541
      ] : ['tox-button']), icon.isSome() ? ['tox-button--icon'] : []), spec.borderless ? ['tox-button--naked'] : []), extraClasses);
18084
      ] : ['tox-button'], true), icon.isSome() ? ['tox-button--icon'] : [], true), spec.borderless ? ['tox-button--naked'] : [], true), extraClasses, true);
18542
      var dom = __assign(__assign({
18085
      var dom = __assign(__assign({
18543
        tag: 'button',
18086
        tag: 'button',
18544
        classes: classes
18087
        classes: classes
18545
      }, innerHtml), { attributes: { title: translatedText } });
18088
      }, innerHtml), { attributes: { title: translatedText } });
18546
      return renderCommonSpec(spec, action, extraBehaviours, dom, components, providersBackstage);
18089
      return renderCommonSpec(spec, action, extraBehaviours, dom, components, providersBackstage);
Line 19390... Line 18933...
19390
        memContainer: memContainer,
18933
        memContainer: memContainer,
19391
        getApplyButton: getApplyButton
18934
        getApplyButton: getApplyButton
19392
      };
18935
      };
19393
    };
18936
    };
19394
 
18937
 
19395
    var global$5 = tinymce.util.Tools.resolve('tinymce.geom.Rect');
18938
    var global$4 = tinymce.util.Tools.resolve('tinymce.geom.Rect');
19396
 
-
 
19397
    var global$4 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');
-
 
19398
 
18939
 
19399
    var global$3 = tinymce.util.Tools.resolve('tinymce.util.Observable');
18940
    var global$3 = tinymce.util.Tools.resolve('tinymce.util.Observable');
19400
 
18941
 
19401
    var global$2 = tinymce.util.Tools.resolve('tinymce.util.VK');
18942
    var global$2 = tinymce.util.Tools.resolve('tinymce.util.VK');
19402
 
18943
 
Line 19413... Line 18954...
19413
      return {
18954
      return {
19414
        width: scrollWidth < offsetWidth ? clientWidth : scrollWidth,
18955
        width: scrollWidth < offsetWidth ? clientWidth : scrollWidth,
19415
        height: scrollHeight < offsetHeight ? clientHeight : scrollHeight
18956
        height: scrollHeight < offsetHeight ? clientHeight : scrollHeight
19416
      };
18957
      };
19417
    };
18958
    };
-
 
18959
    var isTouchEvent$1 = function (e) {
-
 
18960
      return isNonNullable(e.changedTouches);
-
 
18961
    };
19418
    var updateWithTouchData = function (e) {
18962
    var updateWithTouchData = function (e) {
19419
      var keys, i;
-
 
19420
      if (e.changedTouches) {
18963
      if (isTouchEvent$1(e)) {
19421
        keys = 'screenX screenY pageX pageY clientX clientY'.split(' ');
18964
        var keys = 'screenX screenY pageX pageY clientX clientY'.split(' ');
19422
        for (i = 0; i < keys.length; i++) {
18965
        for (var i = 0; i < keys.length; i++) {
19423
          e[keys[i]] = e.changedTouches[0][keys[i]];
18966
          e[keys[i]] = e.changedTouches[0][keys[i]];
19424
        }
18967
        }
19425
      }
18968
      }
19426
    };
18969
    };
19427
    function DragHelper (id, settings) {
18970
    function DragHelper (id, settings) {
-
 
18971
      var _a, _b, _c;
19428
      var $eventOverlay;
18972
      var eventOverlay;
-
 
18973
      var handleEvents = [];
-
 
18974
      var overlayEvents = [];
19429
      var doc = settings.document || document;
18975
      var doc = (_a = settings.document) !== null && _a !== void 0 ? _a : document;
-
 
18976
      var root = (_b = settings.root) !== null && _b !== void 0 ? _b : doc;
-
 
18977
      var sugarDoc = SugarElement.fromDom(doc);
19430
      var downButton;
18978
      var downButton;
-
 
18979
      var startX;
19431
      var startX, startY;
18980
      var startY;
19432
      var handleElement = doc.getElementById(settings.handle || id);
18981
      var handleElement = SugarElement.fromDom(root.getElementById((_c = settings.handle) !== null && _c !== void 0 ? _c : id));
19433
      var start = function (e) {
18982
      var start = function (e) {
-
 
18983
        var rawEvent = e.raw;
19434
        var docSize = getDocumentSize(doc);
18984
        var docSize = getDocumentSize(doc);
19435
        var cursor;
-
 
19436
        updateWithTouchData(e);
18985
        updateWithTouchData(rawEvent);
19437
        e.preventDefault();
18986
        e.prevent();
19438
        downButton = e.button;
18987
        downButton = rawEvent.button;
19439
        var handleElm = handleElement;
-
 
19440
        startX = e.screenX;
18988
        startX = rawEvent.screenX;
19441
        startY = e.screenY;
18989
        startY = rawEvent.screenY;
19442
        if (window.getComputedStyle) {
-
 
19443
          cursor = window.getComputedStyle(handleElm, null).getPropertyValue('cursor');
18990
        var cursor = get$c(handleElement, 'cursor');
19444
        } else {
-
 
19445
          cursor = handleElm.runtimeStyle.cursor;
18991
        eventOverlay = SugarElement.fromTag('div', doc);
19446
        }
-
 
19447
        $eventOverlay = global$4('<div></div>').css({
18992
        setAll(eventOverlay, {
19448
          position: 'absolute',
18993
          'position': 'absolute',
19449
          top: 0,
18994
          'top': '0',
19450
          left: 0,
18995
          'left': '0',
19451
          width: docSize.width,
18996
          'width': docSize.width + 'px',
19452
          height: docSize.height,
18997
          'height': docSize.height + 'px',
19453
          zIndex: 2147483647,
18998
          'z-index': 2147483647 + '',
19454
          opacity: 0.0001,
18999
          'opacity': '0.0001',
19455
          cursor: cursor
19000
          cursor: cursor
-
 
19001
        });
19456
        }).appendTo(doc.body);
19002
        append$2(getBody(sugarDoc), eventOverlay);
19457
        global$4(doc).on('mousemove touchmove', drag).on('mouseup touchend', stop);
19003
        overlayEvents.push(bind(sugarDoc, 'mousemove', drag), bind(sugarDoc, 'touchmove', drag), bind(sugarDoc, 'mouseup', stop), bind(sugarDoc, 'touchend', stop));
19458
        settings.start(e);
19004
        settings.start(rawEvent);
19459
      };
19005
      };
19460
      var drag = function (e) {
19006
      var drag = function (e) {
-
 
19007
        var rawEvent = e.raw;
19461
        updateWithTouchData(e);
19008
        updateWithTouchData(rawEvent);
19462
        if (e.button !== downButton) {
19009
        if (rawEvent.button !== downButton) {
19463
          return stop(e);
19010
          return stop(e);
19464
        }
19011
        }
19465
        e.deltaX = e.screenX - startX;
19012
        rawEvent.deltaX = rawEvent.screenX - startX;
19466
        e.deltaY = e.screenY - startY;
19013
        rawEvent.deltaY = rawEvent.screenY - startY;
19467
        e.preventDefault();
19014
        e.prevent();
19468
        settings.drag(e);
19015
        settings.drag(rawEvent);
19469
      };
19016
      };
19470
      var stop = function (e) {
19017
      var stop = function (e) {
19471
        updateWithTouchData(e);
19018
        updateWithTouchData(e.raw);
19472
        global$4(doc).off('mousemove touchmove', drag).off('mouseup touchend', stop);
19019
        each$1(overlayEvents, function (e) {
-
 
19020
          return e.unbind();
-
 
19021
        });
-
 
19022
        overlayEvents = [];
19473
        $eventOverlay.remove();
19023
        remove$5(eventOverlay);
19474
        if (settings.stop) {
19024
        if (settings.stop) {
19475
          settings.stop(e);
19025
          settings.stop(e.raw);
19476
        }
19026
        }
19477
      };
19027
      };
19478
      var destroy = function () {
19028
      var destroy = function () {
-
 
19029
        each$1(overlayEvents.concat(handleEvents), function (e) {
-
 
19030
          return e.unbind();
-
 
19031
        });
-
 
19032
        overlayEvents = [];
19479
        global$4(handleElement).off();
19033
        handleEvents = [];
-
 
19034
        if (isNonNullable(eventOverlay)) {
-
 
19035
          remove$5(eventOverlay);
-
 
19036
        }
19480
      };
19037
      };
19481
      global$4(handleElement).on('mousedown touchstart', start);
19038
      handleEvents.push(bind(handleElement, 'mousedown', start), bind(handleElement, 'touchstart', start));
19482
      return { destroy: destroy };
19039
      return { destroy: destroy };
19483
    }
19040
    }
19484
 
19041
 
19485
    var count = 0;
19042
    var count = 0;
19486
    var create$1 = function (currentRect, viewPortRect, clampRect, containerElm, action) {
19043
    var create$1 = function (currentRect, viewPortRect, clampRect, containerElm, action) {
19487
      var dragHelpers;
19044
      var dragHelpers;
-
 
19045
      var events = [];
19488
      var prefix = 'tox-';
19046
      var prefix = 'tox-';
19489
      var id = prefix + 'crid-' + count++;
19047
      var id = prefix + 'crid-' + count++;
-
 
19048
      var container = SugarElement.fromDom(containerElm);
19490
      var handles = [
19049
      var handles = [
19491
        {
19050
        {
19492
          name: 'move',
19051
          name: 'move',
19493
          xMul: 0,
19052
          xMul: 0,
19494
          yMul: 0,
19053
          yMul: 0,
Line 19563... Line 19122...
19563
      };
19122
      };
19564
      var getInnerRect = function () {
19123
      var getInnerRect = function () {
19565
        return getRelativeRect(clampRect, currentRect);
19124
        return getRelativeRect(clampRect, currentRect);
19566
      };
19125
      };
19567
      var moveRect = function (handle, startRect, deltaX, deltaY) {
19126
      var moveRect = function (handle, startRect, deltaX, deltaY) {
19568
        var x, y, w, h, rect;
-
 
19569
        x = startRect.x;
-
 
19570
        y = startRect.y;
-
 
19571
        w = startRect.w;
-
 
19572
        h = startRect.h;
-
 
19573
        x += deltaX * handle.deltaX;
19127
        var x = startRect.x + deltaX * handle.deltaX;
19574
        y += deltaY * handle.deltaY;
19128
        var y = startRect.y + deltaY * handle.deltaY;
19575
        w += deltaX * handle.deltaW;
19129
        var w = Math.max(20, startRect.w + deltaX * handle.deltaW);
19576
        h += deltaY * handle.deltaH;
19130
        var h = Math.max(20, startRect.h + deltaY * handle.deltaH);
19577
        if (w < 20) {
-
 
19578
          w = 20;
-
 
19579
        }
-
 
19580
        if (h < 20) {
-
 
19581
          h = 20;
-
 
19582
        }
-
 
19583
        rect = currentRect = global$5.clamp({
19131
        var rect = currentRect = global$4.clamp({
19584
          x: x,
19132
          x: x,
19585
          y: y,
19133
          y: y,
19586
          w: w,
19134
          w: w,
19587
          h: h
19135
          h: h
19588
        }, clampRect, handle.name === 'move');
19136
        }, clampRect, handle.name === 'move');
Line 19593... Line 19141...
19593
      var render = function () {
19141
      var render = function () {
19594
        var createDragHelper = function (handle) {
19142
        var createDragHelper = function (handle) {
19595
          var startRect;
19143
          var startRect;
19596
          return DragHelper(id, {
19144
          return DragHelper(id, {
19597
            document: containerElm.ownerDocument,
19145
            document: containerElm.ownerDocument,
-
 
19146
            root: getRootNode(container).dom,
19598
            handle: id + '-' + handle.name,
19147
            handle: id + '-' + handle.name,
19599
            start: function () {
19148
            start: function () {
19600
              startRect = currentRect;
19149
              startRect = currentRect;
19601
            },
19150
            },
19602
            drag: function (e) {
19151
            drag: function (e) {
19603
              moveRect(handle, startRect, e.deltaX, e.deltaY);
19152
              moveRect(handle, startRect, e.deltaX, e.deltaY);
19604
            }
19153
            }
19605
          });
19154
          });
19606
        };
19155
        };
-
 
19156
        var cropContainer = SugarElement.fromTag('div');
-
 
19157
        setAll$1(cropContainer, {
-
 
19158
          id: id,
19607
        global$4('<div id="' + id + '" class="' + prefix + 'croprect-container"' + ' role="grid" aria-dropeffect="execute">').appendTo(containerElm);
19159
          'class': prefix + 'croprect-container',
-
 
19160
          'role': 'grid',
-
 
19161
          'aria-dropeffect': 'execute'
-
 
19162
        });
-
 
19163
        append$2(container, cropContainer);
19608
        global$6.each(blockers, function (blocker) {
19164
        each$1(blockers, function (blocker) {
19609
          global$4('#' + id, containerElm).append('<div id="' + id + '-' + blocker + '"class="' + prefix + 'croprect-block" style="display: none" data-mce-bogus="all">');
19165
          descendant(container, '#' + id).each(function (blockerElm) {
-
 
19166
            var cropBlocker = SugarElement.fromTag('div');
-
 
19167
            setAll$1(cropBlocker, {
-
 
19168
              'id': id + '-' + blocker,
-
 
19169
              'class': prefix + 'croprect-block',
-
 
19170
              'data-mce-bogus': 'all'
-
 
19171
            });
-
 
19172
            set$7(cropBlocker, 'display', 'none');
-
 
19173
            append$2(blockerElm, cropBlocker);
-
 
19174
          });
-
 
19175
        });
-
 
19176
        each$1(handles, function (handle) {
-
 
19177
          descendant(container, '#' + id).each(function (handleElm) {
-
 
19178
            var cropHandle = SugarElement.fromTag('div');
-
 
19179
            setAll$1(cropHandle, {
-
 
19180
              'id': id + '-' + handle.name,
-
 
19181
              'aria-label': handle.label,
-
 
19182
              'aria-grabbed': 'false',
-
 
19183
              'data-mce-bogus': 'all',
-
 
19184
              'role': 'gridcell',
-
 
19185
              'tabindex': '-1',
-
 
19186
              'title': handle.label
-
 
19187
            });
-
 
19188
            add$1(cropHandle, [
-
 
19189
              prefix + 'croprect-handle',
-
 
19190
              prefix + 'croprect-handle-' + handle.name
-
 
19191
            ]);
-
 
19192
            set$7(cropHandle, 'display', 'none');
-
 
19193
            append$2(handleElm, cropHandle);
19610
        });
19194
          });
19611
        global$6.each(handles, function (handle) {
-
 
19612
          global$4('#' + id, containerElm).append('<div id="' + id + '-' + handle.name + '" class="' + prefix + 'croprect-handle ' + prefix + 'croprect-handle-' + handle.name + '"' + 'style="display: none" data-mce-bogus="all" role="gridcell" tabindex="-1"' + ' aria-label="' + handle.label + '" aria-grabbed="false" title="' + handle.label + '">');
-
 
19613
        });
19195
        });
19614
        dragHelpers = global$6.map(handles, createDragHelper);
19196
        dragHelpers = map$2(handles, createDragHelper);
19615
        repaint(currentRect);
19197
        repaint(currentRect);
19616
        global$4(containerElm).on('focusin focusout', function (e) {
19198
        var handleFocus = function (e) {
19617
          global$4(e.target).attr('aria-grabbed', e.type === 'focus' ? 'true' : 'false');
19199
          set$8(e.target, 'aria-grabbed', e.raw.type === 'focus' ? 'true' : 'false');
19618
        });
19200
        };
19619
        global$4(containerElm).on('keydown', function (e) {
19201
        var handleKeydown = function (e) {
19620
          var activeHandle;
19202
          var activeHandle;
19621
          global$6.each(handles, function (handle) {
19203
          each$1(handles, function (handle) {
19622
            if (e.target.id === id + '-' + handle.name) {
19204
            if (get$d(e.target, 'id') === id + '-' + handle.name) {
19623
              activeHandle = handle;
19205
              activeHandle = handle;
19624
              return false;
19206
              return false;
19625
            }
19207
            }
19626
          });
19208
          });
19627
          var moveAndBlock = function (evt, handle, startRect, deltaX, deltaY) {
19209
          var moveAndBlock = function (evt, handle, startRect, deltaX, deltaY) {
19628
            evt.stopPropagation();
19210
            evt.stopPropagation();
19629
            evt.preventDefault();
19211
            evt.preventDefault();
19630
            moveRect(activeHandle, startRect, deltaX, deltaY);
19212
            moveRect(activeHandle, startRect, deltaX, deltaY);
19631
          };
19213
          };
19632
          switch (e.keyCode) {
19214
          switch (e.raw.keyCode) {
19633
          case global$2.LEFT:
19215
          case global$2.LEFT:
19634
            moveAndBlock(e, activeHandle, currentRect, -10, 0);
19216
            moveAndBlock(e, activeHandle, currentRect, -10, 0);
19635
            break;
19217
            break;
19636
          case global$2.RIGHT:
19218
          case global$2.RIGHT:
19637
            moveAndBlock(e, activeHandle, currentRect, 10, 0);
19219
            moveAndBlock(e, activeHandle, currentRect, 10, 0);
Line 19642... Line 19224...
19642
          case global$2.DOWN:
19224
          case global$2.DOWN:
19643
            moveAndBlock(e, activeHandle, currentRect, 0, 10);
19225
            moveAndBlock(e, activeHandle, currentRect, 0, 10);
19644
            break;
19226
            break;
19645
          case global$2.ENTER:
19227
          case global$2.ENTER:
19646
          case global$2.SPACEBAR:
19228
          case global$2.SPACEBAR:
19647
            e.preventDefault();
19229
            e.prevent();
19648
            action();
19230
            action();
19649
            break;
19231
            break;
19650
          }
19232
          }
19651
        });
19233
        };
-
 
19234
        events.push(bind(container, 'focusin', handleFocus), bind(container, 'focusout', handleFocus), bind(container, 'keydown', handleKeydown));
19652
      };
19235
      };
19653
      var toggleVisibility = function (state) {
19236
      var toggleVisibility = function (state) {
19654
        var selectors = global$6.map(handles, function (handle) {
19237
        var selectors = __spreadArray(__spreadArray([], map$2(handles, function (handle) {
19655
          return '#' + id + '-' + handle.name;
19238
          return '#' + id + '-' + handle.name;
19656
        }).concat(global$6.map(blockers, function (blocker) {
19239
        }), true), map$2(blockers, function (blocker) {
19657
          return '#' + id + '-' + blocker;
19240
          return '#' + id + '-' + blocker;
19658
        })).join(',');
19241
        }), true).join(',');
-
 
19242
        var elems = descendants(container, selectors);
19659
        if (state) {
19243
        if (state) {
19660
          global$4(selectors, containerElm).show();
19244
          each$1(elems, function (elm) {
-
 
19245
            return remove$6(elm, 'display');
-
 
19246
          });
19661
        } else {
19247
        } else {
19662
          global$4(selectors, containerElm).hide();
19248
          each$1(elems, function (elm) {
-
 
19249
            return set$7(elm, 'display', 'none');
-
 
19250
          });
19663
        }
19251
        }
19664
      };
19252
      };
19665
      var repaint = function (rect) {
19253
      var repaint = function (rect) {
19666
        var updateElementRect = function (name, rect) {
19254
        var updateElementRect = function (name, newRect) {
19667
          if (rect.h < 0) {
19255
          descendant(container, '#' + id + '-' + name).each(function (elm) {
19668
            rect.h = 0;
19256
            setAll(elm, {
19669
          }
-
 
19670
          if (rect.w < 0) {
19257
              left: newRect.x + 'px',
19671
            rect.w = 0;
19258
              top: newRect.y + 'px',
19672
          }
-
 
19673
          global$4('#' + id + '-' + name, containerElm).css({
19259
              width: Math.max(0, newRect.w) + 'px',
19674
            left: rect.x,
19260
              height: Math.max(0, newRect.h) + 'px'
19675
            top: rect.y,
19261
            });
19676
            width: rect.w,
-
 
19677
            height: rect.h
-
 
19678
          });
19262
          });
19679
        };
19263
        };
19680
        global$6.each(handles, function (handle) {
19264
        each$1(handles, function (handle) {
19681
          global$4('#' + id + '-' + handle.name, containerElm).css({
19265
          descendant(container, '#' + id + '-' + handle.name).each(function (elm) {
-
 
19266
            setAll(elm, {
19682
            left: rect.w * handle.xMul + rect.x,
19267
              left: rect.w * handle.xMul + rect.x + 'px',
19683
            top: rect.h * handle.yMul + rect.y
19268
              top: rect.h * handle.yMul + rect.y + 'px'
-
 
19269
            });
19684
          });
19270
          });
19685
        });
19271
        });
19686
        updateElementRect('top', {
19272
        updateElementRect('top', {
19687
          x: viewPortRect.x,
19273
          x: viewPortRect.x,
19688
          y: viewPortRect.y,
19274
          y: viewPortRect.y,
Line 19723... Line 19309...
19723
      var setClampRect = function (rect) {
19309
      var setClampRect = function (rect) {
19724
        clampRect = rect;
19310
        clampRect = rect;
19725
        repaint(currentRect);
19311
        repaint(currentRect);
19726
      };
19312
      };
19727
      var destroy = function () {
19313
      var destroy = function () {
19728
        global$6.each(dragHelpers, function (helper) {
19314
        each$1(dragHelpers, function (helper) {
19729
          helper.destroy();
19315
          return helper.destroy();
19730
        });
19316
        });
19731
        dragHelpers = [];
19317
        dragHelpers = [];
-
 
19318
        each$1(events, function (e) {
-
 
19319
          return e.unbind();
-
 
19320
        });
-
 
19321
        events = [];
19732
      };
19322
      };
19733
      render();
19323
      render();
19734
      var instance = global$6.extend({
19324
      var instance = __assign(__assign({}, global$3), {
19735
        toggleVisibility: toggleVisibility,
19325
        toggleVisibility: toggleVisibility,
19736
        setClampRect: setClampRect,
19326
        setClampRect: setClampRect,
19737
        setRect: setRect,
19327
        setRect: setRect,
19738
        getInnerRect: getInnerRect,
19328
        getInnerRect: getInnerRect,
19739
        setInnerRect: setInnerRect,
19329
        setInnerRect: setInnerRect,
19740
        setViewPortRect: setViewPortRect,
19330
        setViewPortRect: setViewPortRect,
19741
        destroy: destroy
19331
        destroy: destroy
19742
      }, global$3);
19332
      });
19743
      return instance;
19333
      return instance;
19744
    };
19334
    };
19745
    var CropRect = { create: create$1 };
19335
    var CropRect = { create: create$1 };
19746
 
19336
 
19747
    var loadImage = function (image) {
19337
    var loadImage = function (image) {
19748
      return new global$d(function (resolve) {
19338
      return new global$c(function (resolve) {
19749
        var loaded = function () {
19339
        var loaded = function () {
19750
          image.removeEventListener('load', loaded);
19340
          image.removeEventListener('load', loaded);
19751
          resolve(image);
19341
          resolve(image);
19752
        };
19342
        };
19753
        if (image.complete) {
19343
        if (image.complete) {
Line 19764... Line 19354...
19764
          classes: ['tox-image-tools__image-bg'],
19354
          classes: ['tox-image-tools__image-bg'],
19765
          attributes: { role: 'presentation' }
19355
          attributes: { role: 'presentation' }
19766
        }
19356
        }
19767
      });
19357
      });
19768
      var zoomState = Cell(1);
19358
      var zoomState = Cell(1);
19769
      var cropRect = value$1();
19359
      var cropRect = api$1();
19770
      var rectState = Cell({
19360
      var rectState = Cell({
19771
        x: 0,
19361
        x: 0,
19772
        y: 0,
19362
        y: 0,
19773
        w: 1,
19363
        w: 1,
19774
        h: 1
19364
        h: 1
Line 19780... Line 19370...
19780
        h: 1
19370
        h: 1
19781
      });
19371
      });
19782
      var repaintImg = function (anyInSystem, img) {
19372
      var repaintImg = function (anyInSystem, img) {
19783
        memContainer.getOpt(anyInSystem).each(function (panel) {
19373
        memContainer.getOpt(anyInSystem).each(function (panel) {
19784
          var zoom = zoomState.get();
19374
          var zoom = zoomState.get();
19785
          var panelW = get$7(panel.element);
19375
          var panelW = get$a(panel.element);
19786
          var panelH = get$8(panel.element);
19376
          var panelH = get$b(panel.element);
19787
          var width = img.dom.naturalWidth * zoom;
19377
          var width = img.dom.naturalWidth * zoom;
19788
          var height = img.dom.naturalHeight * zoom;
19378
          var height = img.dom.naturalHeight * zoom;
19789
          var left = Math.max(0, panelW / 2 - width / 2);
19379
          var left = Math.max(0, panelW / 2 - width / 2);
19790
          var top = Math.max(0, panelH / 2 - height / 2);
19380
          var top = Math.max(0, panelH / 2 - height / 2);
19791
          var css = {
19381
          var css = {
Line 19797... Line 19387...
19797
          };
19387
          };
19798
          setAll(img, css);
19388
          setAll(img, css);
19799
          memBg.getOpt(panel).each(function (bg) {
19389
          memBg.getOpt(panel).each(function (bg) {
19800
            setAll(bg.element, css);
19390
            setAll(bg.element, css);
19801
          });
19391
          });
19802
          cropRect.on(function (cRect) {
19392
          cropRect.run(function (cRect) {
19803
            var rect = rectState.get();
19393
            var rect = rectState.get();
19804
            cRect.setRect({
19394
            cRect.setRect({
19805
              x: rect.x * zoom + left,
19395
              x: rect.x * zoom + left,
19806
              y: rect.y * zoom + top,
19396
              y: rect.y * zoom + top,
19807
              w: rect.w * zoom,
19397
              w: rect.w * zoom,
Line 19822... Line 19412...
19822
          });
19412
          });
19823
        });
19413
        });
19824
      };
19414
      };
19825
      var zoomFit = function (anyInSystem, img) {
19415
      var zoomFit = function (anyInSystem, img) {
19826
        memContainer.getOpt(anyInSystem).each(function (panel) {
19416
        memContainer.getOpt(anyInSystem).each(function (panel) {
19827
          var panelW = get$7(panel.element);
19417
          var panelW = get$a(panel.element);
19828
          var panelH = get$8(panel.element);
19418
          var panelH = get$b(panel.element);
19829
          var width = img.dom.naturalWidth;
19419
          var width = img.dom.naturalWidth;
19830
          var height = img.dom.naturalHeight;
19420
          var height = img.dom.naturalHeight;
19831
          var zoom = Math.min(panelW / width, panelH / height);
19421
          var zoom = Math.min(panelW / width, panelH / height);
19832
          if (zoom >= 1) {
19422
          if (zoom >= 1) {
19833
            zoomState.set(1);
19423
            zoomState.set(1);
Line 19836... Line 19426...
19836
          }
19426
          }
19837
        });
19427
        });
19838
      };
19428
      };
19839
      var updateSrc = function (anyInSystem, url) {
19429
      var updateSrc = function (anyInSystem, url) {
19840
        var img = SugarElement.fromTag('img');
19430
        var img = SugarElement.fromTag('img');
19841
        set$7(img, 'src', url);
19431
        set$8(img, 'src', url);
19842
        return loadImage(img.dom).then(function () {
19432
        return loadImage(img.dom).then(function () {
19843
          if (anyInSystem.getSystem().isConnected()) {
19433
          if (anyInSystem.getSystem().isConnected()) {
19844
            memContainer.getOpt(anyInSystem).map(function (panel) {
19434
            memContainer.getOpt(anyInSystem).map(function (panel) {
19845
              var aImg = external$2({ element: img });
19435
              var aImg = external$2({ element: img });
19846
              Replacing.replaceAt(panel, 1, Optional.some(aImg));
19436
              Replacing.replaceAt(panel, 1, Optional.some(aImg));
Line 19850... Line 19440...
19850
                y: 0,
19440
                y: 0,
19851
                w: img.dom.naturalWidth,
19441
                w: img.dom.naturalWidth,
19852
                h: img.dom.naturalHeight
19442
                h: img.dom.naturalHeight
19853
              };
19443
              };
19854
              viewRectState.set(viewRect);
19444
              viewRectState.set(viewRect);
19855
              var rect = global$5.inflate(viewRect, -20, -20);
19445
              var rect = global$4.inflate(viewRect, -20, -20);
19856
              rectState.set(rect);
19446
              rectState.set(rect);
19857
              if (lastViewRect.w !== viewRect.w || lastViewRect.h !== viewRect.h) {
19447
              if (lastViewRect.w !== viewRect.w || lastViewRect.h !== viewRect.h) {
19858
                zoomFit(panel, img);
19448
                zoomFit(panel, img);
19859
              }
19449
              }
19860
              repaintImg(panel, img);
19450
              repaintImg(panel, img);
Line 19870... Line 19460...
19870
          var img = panel.components()[1].element;
19460
          var img = panel.components()[1].element;
19871
          repaintImg(panel, img);
19461
          repaintImg(panel, img);
19872
        });
19462
        });
19873
      };
19463
      };
19874
      var showCrop = function () {
19464
      var showCrop = function () {
19875
        cropRect.on(function (cRect) {
19465
        cropRect.run(function (cRect) {
19876
          cRect.toggleVisibility(true);
19466
          cRect.toggleVisibility(true);
19877
        });
19467
        });
19878
      };
19468
      };
19879
      var hideCrop = function () {
19469
      var hideCrop = function () {
19880
        cropRect.on(function (cRect) {
19470
        cropRect.run(function (cRect) {
19881
          cRect.toggleVisibility(false);
19471
          cRect.toggleVisibility(false);
19882
        });
19472
        });
19883
      };
19473
      };
19884
      var getRect = function () {
19474
      var getRect = function () {
19885
        return rectState.get();
19475
        return rectState.get();
Line 19897... Line 19487...
19897
              attributes: { src: initialUrl }
19487
              attributes: { src: initialUrl }
19898
            }
19488
            }
19899
          },
19489
          },
19900
          {
19490
          {
19901
            dom: { tag: 'div' },
19491
            dom: { tag: 'div' },
19902
            behaviours: derive$1([config('image-panel-crop-events', [runOnAttached(function (comp) {
19492
            behaviours: derive$1([config('image-panel-crop-events', [
-
 
19493
                runOnAttached(function (comp) {
19903
                  memContainer.getOpt(comp).each(function (container) {
19494
                  memContainer.getOpt(comp).each(function (container) {
19904
                    var el = container.element.dom;
19495
                    var el = container.element.dom;
19905
                    var cRect = CropRect.create({
19496
                    var cRect = CropRect.create({
19906
                      x: 10,
19497
                      x: 10,
19907
                      y: 10,
19498
                      y: 10,
Line 19930... Line 19521...
19930
                      };
19521
                      };
19931
                      rectState.set(newRect);
19522
                      rectState.set(newRect);
19932
                    });
19523
                    });
19933
                    cropRect.set(cRect);
19524
                    cropRect.set(cRect);
19934
                  });
19525
                  });
19935
                })])])
19526
                }),
-
 
19527
                runOnDetached(function () {
-
 
19528
                  cropRect.clear();
-
 
19529
                })
-
 
19530
              ])])
19936
          }
19531
          }
19937
        ],
19532
        ],
19938
        containerBehaviours: derive$1([
19533
        containerBehaviours: derive$1([
19939
          Replacing.config({}),
19534
          Replacing.config({}),
19940
          config('image-panel-events', [runOnAttached(function (comp) {
19535
          config('image-panel-events', [runOnAttached(function (comp) {
Line 20083... Line 19678...
20083
      };
19678
      };
20084
      var destroyState = function (state) {
19679
      var destroyState = function (state) {
20085
        URL.revokeObjectURL(state.url);
19680
        URL.revokeObjectURL(state.url);
20086
      };
19681
      };
20087
      var destroyStates = function (states) {
19682
      var destroyStates = function (states) {
20088
        global$6.each(states, destroyState);
19683
        global$5.each(states, destroyState);
20089
      };
19684
      };
20090
      var destroyTempState = function () {
19685
      var destroyTempState = function () {
20091
        tempState.on(destroyState);
19686
        tempState.on(destroyState);
20092
        tempState.clear();
19687
        tempState.clear();
20093
      };
19688
      };
Line 20412... Line 20007...
20412
                    mode: 'manual',
20007
                    mode: 'manual',
20413
                    initialValue: initialItem.map(function (item) {
20008
                    initialValue: initialItem.map(function (item) {
20414
                      return item.value;
20009
                      return item.value;
20415
                    }).getOr(''),
20010
                    }).getOr(''),
20416
                    getValue: function (comp) {
20011
                    getValue: function (comp) {
20417
                      return get$c(comp.element, dataAttribute);
20012
                      return get$d(comp.element, dataAttribute);
20418
                    },
20013
                    },
20419
                    setValue: function (comp, data) {
20014
                    setValue: function (comp, data) {
20420
                      findItemByValue(spec.items, data).each(function (item) {
20015
                      findItemByValue(spec.items, data).each(function (item) {
20421
                        set$7(comp.element, dataAttribute, item.value);
20016
                        set$8(comp.element, dataAttribute, item.value);
20422
                        emitWith(comp, updateMenuText, { text: item.text });
20017
                        emitWith(comp, updateMenuText, { text: item.text });
20423
                      });
20018
                      });
20424
                    }
20019
                    }
20425
                  }
20020
                  }
20426
                })
20021
                })
Line 20492... Line 20087...
20492
          Focusing.config({}),
20087
          Focusing.config({}),
20493
          Representing.config({
20088
          Representing.config({
20494
            store: __assign({
20089
            store: __assign({
20495
              mode: 'manual',
20090
              mode: 'manual',
20496
              getValue: function (select) {
20091
              getValue: function (select) {
20497
                return get$9(select.element);
20092
                return get$5(select.element);
20498
              },
20093
              },
20499
              setValue: function (select, newValue) {
20094
              setValue: function (select, newValue) {
20500
                var found = find$5(detail.options, function (opt) {
20095
                var found = find$5(detail.options, function (opt) {
20501
                  return opt.value === newValue;
20096
                  return opt.value === newValue;
20502
                });
20097
                });
20503
                if (found.isSome()) {
20098
                if (found.isSome()) {
20504
                  set$5(select.element, newValue);
20099
                  set$4(select.element, newValue);
20505
                }
20100
                }
20506
              }
20101
              }
20507
            }, initialValues)
20102
            }, initialValues)
20508
          })
20103
          })
20509
        ])
20104
        ])
Line 20845... Line 20440...
20845
      Representing.setValue(input, itemData);
20440
      Representing.setValue(input, itemData);
20846
      setCursorAtEnd(input);
20441
      setCursorAtEnd(input);
20847
    };
20442
    };
20848
    var setSelectionOn = function (input, f) {
20443
    var setSelectionOn = function (input, f) {
20849
      var el = input.element;
20444
      var el = input.element;
20850
      var value = get$9(el);
20445
      var value = get$5(el);
20851
      var node = el.dom;
20446
      var node = el.dom;
20852
      if (get$c(el, 'type') !== 'number') {
20447
      if (get$d(el, 'type') !== 'number') {
20853
        f(node, value);
20448
        f(node, value);
20854
      }
20449
      }
20855
    };
20450
    };
20856
    var setCursorAtEnd = function (input) {
20451
    var setCursorAtEnd = function (input) {
20857
      setSelectionOn(input, function (node, value) {
20452
      setSelectionOn(input, function (node, value) {
Line 20922... Line 20517...
20922
        Representing.config({
20517
        Representing.config({
20923
          onSetValue: detail.onSetValue,
20518
          onSetValue: detail.onSetValue,
20924
          store: __assign({
20519
          store: __assign({
20925
            mode: 'dataset',
20520
            mode: 'dataset',
20926
            getDataKey: function (comp) {
20521
            getDataKey: function (comp) {
20927
              return get$9(comp.element);
20522
              return get$5(comp.element);
20928
            },
20523
            },
20929
            getFallbackEntry: function (itemString) {
20524
            getFallbackEntry: function (itemString) {
20930
              return {
20525
              return {
20931
                value: itemString,
20526
                value: itemString,
20932
                meta: {}
20527
                meta: {}
20933
              };
20528
              };
20934
            },
20529
            },
20935
            setValue: function (comp, data) {
20530
            setValue: function (comp, data) {
20936
              set$5(comp.element, detail.model.getDisplayText(data));
20531
              set$4(comp.element, detail.model.getDisplayText(data));
20937
            }
20532
            }
20938
          }, detail.initialData.map(function (d) {
20533
          }, detail.initialData.map(function (d) {
20939
            return wrap$1('initialValue', d);
20534
            return wrap$1('initialValue', d);
20940
          }).getOr({}))
20535
          }).getOr({}))
20941
        }),
20536
        }),
Line 20947... Line 20542...
20947
          },
20542
          },
20948
          onStream: function (component, _simulatedEvent) {
20543
          onStream: function (component, _simulatedEvent) {
20949
            var sandbox = Coupling.getCoupled(component, 'sandbox');
20544
            var sandbox = Coupling.getCoupled(component, 'sandbox');
20950
            var focusInInput = Focusing.isFocused(component);
20545
            var focusInInput = Focusing.isFocused(component);
20951
            if (focusInInput) {
20546
            if (focusInInput) {
20952
              if (get$9(component.element).length >= detail.minChars) {
20547
              if (get$5(component.element).length >= detail.minChars) {
20953
                var previousValue_1 = Composing.getCurrent(sandbox).bind(function (menu) {
20548
                var previousValue_1 = Composing.getCurrent(sandbox).bind(function (menu) {
20954
                  return Highlighting.getHighlighted(menu).map(Representing.getValue);
20549
                  return Highlighting.getHighlighted(menu).map(Representing.getValue);
20955
                });
20550
                });
20956
                detail.previewing.set(true);
20551
                detail.previewing.set(true);
20957
                var onOpenSync = function (_sandbox) {
20552
                var onOpenSync = function (_sandbox) {
Line 21375... Line 20970...
21375
              },
20970
              },
21376
              invalidClass: 'tox-control-wrap--status-invalid',
20971
              invalidClass: 'tox-control-wrap--status-invalid',
21377
              notify: {
20972
              notify: {
21378
                onInvalid: function (comp, err) {
20973
                onInvalid: function (comp, err) {
21379
                  memInvalidIcon.getOpt(comp).each(function (invalidComp) {
20974
                  memInvalidIcon.getOpt(comp).each(function (invalidComp) {
21380
                    set$7(invalidComp.element, 'title', providersBackstage.translate(err));
20975
                    set$8(invalidComp.element, 'title', providersBackstage.translate(err));
21381
                  });
20976
                  });
21382
                }
20977
                }
21383
              },
20978
              },
21384
              validator: {
20979
              validator: {
21385
                validate: function (input) {
20980
                validate: function (input) {
Line 22290... Line 21885...
22290
    };
21885
    };
22291
 
21886
 
22292
    var isElement = function (node) {
21887
    var isElement = function (node) {
22293
      return isNonNullable(node) && node.nodeType === 1;
21888
      return isNonNullable(node) && node.nodeType === 1;
22294
    };
21889
    };
22295
    var trim = global$6.trim;
21890
    var trim = global$5.trim;
22296
    var hasContentEditableState = function (value) {
21891
    var hasContentEditableState = function (value) {
22297
      return function (node) {
21892
      return function (node) {
22298
        if (isElement(node)) {
21893
        if (isElement(node)) {
22299
          if (node.contentEditable === value) {
21894
          if (node.contentEditable === value) {
22300
            return true;
21895
            return true;
Line 22398... Line 21993...
22398
      return isObject(r) && find$4(r, function (value) {
21993
      return isObject(r) && find$4(r, function (value) {
22399
        return !isArrayOfUrl(value);
21994
        return !isArrayOfUrl(value);
22400
      }).isNone();
21995
      }).isNone();
22401
    };
21996
    };
22402
    var getAllHistory = function () {
21997
    var getAllHistory = function () {
22403
      var unparsedHistory = global$9.getItem(STORAGE_KEY);
21998
      var unparsedHistory = global$8.getItem(STORAGE_KEY);
22404
      if (unparsedHistory === null) {
21999
      if (unparsedHistory === null) {
22405
        return {};
22000
        return {};
22406
      }
22001
      }
22407
      var history;
22002
      var history;
22408
      try {
22003
      try {
Line 22422... Line 22017...
22422
    };
22017
    };
22423
    var setAllHistory = function (history) {
22018
    var setAllHistory = function (history) {
22424
      if (!isRecordOfUrlArray(history)) {
22019
      if (!isRecordOfUrlArray(history)) {
22425
        throw new Error('Bad format for history:\n' + JSON.stringify(history));
22020
        throw new Error('Bad format for history:\n' + JSON.stringify(history));
22426
      }
22021
      }
22427
      global$9.setItem(STORAGE_KEY, JSON.stringify(history));
22022
      global$8.setItem(STORAGE_KEY, JSON.stringify(history));
22428
    };
22023
    };
22429
    var getHistory = function (fileType) {
22024
    var getHistory = function (fileType) {
22430
      var history = getAllHistory();
22025
      var history = getAllHistory();
22431
      return get$e(history, fileType).getOr([]);
22026
      return get$e(history, fileType).getOr([]);
22432
    };
22027
    };
Line 22445... Line 22040...
22445
 
22040
 
22446
    var isTruthy = function (value) {
22041
    var isTruthy = function (value) {
22447
      return !!value;
22042
      return !!value;
22448
    };
22043
    };
22449
    var makeMap = function (value) {
22044
    var makeMap = function (value) {
22450
      return map(global$6.makeMap(value, /[, ]/), isTruthy);
22045
      return map$1(global$5.makeMap(value, /[, ]/), isTruthy);
22451
    };
22046
    };
22452
    var getPicker = function (editor) {
22047
    var getPicker = function (editor) {
22453
      return Optional.from(getFilePickerCallback(editor)).filter(isFunction);
22048
      return Optional.from(getFilePickerCallback(editor)).filter(isFunction);
22454
    };
22049
    };
22455
    var getPickerTypes = function (editor) {
22050
    var getPickerTypes = function (editor) {
Line 22538... Line 22133...
22538
              return editor.ui.registry.getAll().icons;
22133
              return editor.ui.registry.getAll().icons;
22539
            },
22134
            },
22540
            menuItems: function () {
22135
            menuItems: function () {
22541
              return editor.ui.registry.getAll().menuItems;
22136
              return editor.ui.registry.getAll().menuItems;
22542
            },
22137
            },
22543
            translate: global$f.translate,
22138
            translate: global$e.translate,
22544
            isDisabled: function () {
22139
            isDisabled: function () {
22545
              return editor.mode.isReadOnly() || editor.ui.isDisabled();
22140
              return editor.mode.isReadOnly() || editor.ui.isDisabled();
22546
            },
22141
            },
22547
            getSetting: editor.getParam.bind(editor)
22142
            getSetting: editor.getParam.bind(editor)
22548
          },
22143
          },
Line 22587... Line 22182...
22587
        });
22182
        });
22588
      };
22183
      };
22589
      var fireDismissPopups = function (evt) {
22184
      var fireDismissPopups = function (evt) {
22590
        return broadcastOn(dismissPopups(), { target: evt.target });
22185
        return broadcastOn(dismissPopups(), { target: evt.target });
22591
      };
22186
      };
-
 
22187
      var doc = getDocument();
22592
      var onTouchstart = bind(SugarElement.fromDom(document), 'touchstart', fireDismissPopups);
22188
      var onTouchstart = bind(doc, 'touchstart', fireDismissPopups);
22593
      var onTouchmove = bind(SugarElement.fromDom(document), 'touchmove', function (evt) {
22189
      var onTouchmove = bind(doc, 'touchmove', function (evt) {
22594
        return broadcastEvent(documentTouchmove(), evt);
22190
        return broadcastEvent(documentTouchmove(), evt);
22595
      });
22191
      });
22596
      var onTouchend = bind(SugarElement.fromDom(document), 'touchend', function (evt) {
22192
      var onTouchend = bind(doc, 'touchend', function (evt) {
22597
        return broadcastEvent(documentTouchend(), evt);
22193
        return broadcastEvent(documentTouchend(), evt);
22598
      });
22194
      });
22599
      var onMousedown = bind(SugarElement.fromDom(document), 'mousedown', fireDismissPopups);
22195
      var onMousedown = bind(doc, 'mousedown', fireDismissPopups);
22600
      var onMouseup = bind(SugarElement.fromDom(document), 'mouseup', function (evt) {
22196
      var onMouseup = bind(doc, 'mouseup', function (evt) {
22601
        if (evt.raw.button === 0) {
22197
        if (evt.raw.button === 0) {
22602
          broadcastOn(mouseReleased(), { target: evt.target });
22198
          broadcastOn(mouseReleased(), { target: evt.target });
22603
        }
22199
        }
22604
      });
22200
      });
22605
      var onContentClick = function (raw) {
22201
      var onContentClick = function (raw) {
Line 22807... Line 22403...
22807
        isDocked: isDocked$2,
22403
        isDocked: isDocked$2,
22808
        getBehaviours: getBehaviours$1
22404
        getBehaviours: getBehaviours$1
22809
    });
22405
    });
22810
 
22406
 
22811
    var getOffsetParent = function (element) {
22407
    var getOffsetParent = function (element) {
22812
      var isFixed = is(getRaw(element, 'position'), 'fixed');
22408
      var isFixed = is$1(getRaw(element, 'position'), 'fixed');
22813
      var offsetParent$1 = isFixed ? Optional.none() : offsetParent(element);
22409
      var offsetParent$1 = isFixed ? Optional.none() : offsetParent(element);
22814
      return offsetParent$1.orThunk(function () {
22410
      return offsetParent$1.orThunk(function () {
22815
        var marker = SugarElement.fromTag('span');
22411
        var marker = SugarElement.fromTag('span');
22816
        return parent(element).bind(function (parent) {
22412
        return parent(element).bind(function (parent) {
22817
          append$2(parent, marker);
22413
          append$2(parent, marker);
22818
          var offsetParent$1 = offsetParent(marker);
22414
          var offsetParent$1 = offsetParent(marker);
22819
          remove$7(marker);
22415
          remove$5(marker);
22820
          return offsetParent$1;
22416
          return offsetParent$1;
22821
        });
22417
        });
22822
      });
22418
      });
22823
    };
22419
    };
22824
    var getOrigin = function (element) {
22420
    var getOrigin = function (element) {
Line 22833... Line 22429...
22833
      { fixed: ['positionCss'] }
22429
      { fixed: ['positionCss'] }
22834
    ]);
22430
    ]);
22835
    var appear = function (component, contextualInfo) {
22431
    var appear = function (component, contextualInfo) {
22836
      var elem = component.element;
22432
      var elem = component.element;
22837
      add$2(elem, contextualInfo.transitionClass);
22433
      add$2(elem, contextualInfo.transitionClass);
22838
      remove$3(elem, contextualInfo.fadeOutClass);
22434
      remove$2(elem, contextualInfo.fadeOutClass);
22839
      add$2(elem, contextualInfo.fadeInClass);
22435
      add$2(elem, contextualInfo.fadeInClass);
22840
      contextualInfo.onShow(component);
22436
      contextualInfo.onShow(component);
22841
    };
22437
    };
22842
    var disappear = function (component, contextualInfo) {
22438
    var disappear = function (component, contextualInfo) {
22843
      var elem = component.element;
22439
      var elem = component.element;
22844
      add$2(elem, contextualInfo.transitionClass);
22440
      add$2(elem, contextualInfo.transitionClass);
22845
      remove$3(elem, contextualInfo.fadeInClass);
22441
      remove$2(elem, contextualInfo.fadeInClass);
22846
      add$2(elem, contextualInfo.fadeOutClass);
22442
      add$2(elem, contextualInfo.fadeOutClass);
22847
      contextualInfo.onHide(component);
22443
      contextualInfo.onHide(component);
22848
    };
22444
    };
22849
    var isPartiallyVisible = function (box, viewport) {
22445
    var isPartiallyVisible = function (box, viewport) {
22850
      return box.y < viewport.bottom && box.bottom > viewport.y;
22446
      return box.y < viewport.bottom && box.bottom > viewport.y;
Line 22865... Line 22461...
22865
        }
22461
        }
22866
      });
22462
      });
22867
    };
22463
    };
22868
    var getPrior = function (elem, state) {
22464
    var getPrior = function (elem, state) {
22869
      return state.getInitialPos().map(function (pos) {
22465
      return state.getInitialPos().map(function (pos) {
22870
        return bounds(pos.bounds.x, pos.bounds.y, get$7(elem), get$8(elem));
22466
        return bounds(pos.bounds.x, pos.bounds.y, get$a(elem), get$b(elem));
22871
      });
22467
      });
22872
    };
22468
    };
22873
    var storePrior = function (elem, box, state) {
22469
    var storePrior = function (elem, box, state) {
22874
      state.setInitialPos({
22470
      state.setInitialPos({
22875
        style: getAllRaw(elem),
22471
        style: getAllRaw(elem),
22876
        position: get$a(elem, 'position') || 'static',
22472
        position: get$c(elem, 'position') || 'static',
22877
        bounds: box
22473
        bounds: box
22878
      });
22474
      });
22879
    };
22475
    };
22880
    var revertToOriginal = function (elem, box, state) {
22476
    var revertToOriginal = function (elem, box, state) {
22881
      return state.getInitialPos().bind(function (position) {
22477
      return state.getInitialPos().bind(function (position) {
Line 22922... Line 22518...
22922
        return Optional.none();
22518
        return Optional.none();
22923
      }
22519
      }
22924
    };
22520
    };
22925
    var getMorph = function (component, viewport, state) {
22521
    var getMorph = function (component, viewport, state) {
22926
      var elem = component.element;
22522
      var elem = component.element;
22927
      var isDocked = is(getRaw(elem, 'position'), 'fixed');
22523
      var isDocked = is$1(getRaw(elem, 'position'), 'fixed');
22928
      return isDocked ? morphToOriginal(elem, viewport, state) : morphToFixed(elem, viewport, state);
22524
      return isDocked ? morphToOriginal(elem, viewport, state) : morphToFixed(elem, viewport, state);
22929
    };
22525
    };
22930
    var getMorphToOriginal = function (component, state) {
22526
    var getMorphToOriginal = function (component, state) {
22931
      var elem = component.element;
22527
      var elem = component.element;
22932
      return getPrior(elem, state).bind(function (box) {
22528
      return getPrior(elem, state).bind(function (box) {
22933
        return revertToOriginal(elem, box, state);
22529
        return revertToOriginal(elem, box, state);
22934
      });
22530
      });
22935
    };
22531
    };
22936
 
22532
 
22937
    var morphToStatic = function (component, config) {
22533
    var morphToStatic = function (component, config, state) {
-
 
22534
      state.setDocked(false);
22938
      each$1([
22535
      each$1([
22939
        'left',
22536
        'left',
22940
        'right',
22537
        'right',
22941
        'top',
22538
        'top',
22942
        'bottom',
22539
        'bottom',
22943
        'position'
22540
        'position'
22944
      ], function (prop) {
22541
      ], function (prop) {
22945
        return remove$1(component.element, prop);
22542
        return remove$6(component.element, prop);
22946
      });
22543
      });
22947
      config.onUndocked(component);
22544
      config.onUndocked(component);
22948
    };
22545
    };
22949
    var morphToCoord = function (component, config, position) {
22546
    var morphToCoord = function (component, config, state, position) {
-
 
22547
      var isDocked = position.position === 'fixed';
-
 
22548
      state.setDocked(isDocked);
22950
      applyPositionCss(component.element, position);
22549
      applyPositionCss(component.element, position);
22951
      var method = position.position === 'fixed' ? config.onDocked : config.onUndocked;
22550
      var method = isDocked ? config.onDocked : config.onUndocked;
22952
      method(component);
22551
      method(component);
22953
    };
22552
    };
22954
    var updateVisibility = function (component, config, state, viewport, morphToDocked) {
22553
    var updateVisibility = function (component, config, state, viewport, morphToDocked) {
22955
      if (morphToDocked === void 0) {
22554
      if (morphToDocked === void 0) {
22956
        morphToDocked = false;
22555
        morphToDocked = false;
Line 22976... Line 22575...
22976
      var isDocked = state.isDocked();
22575
      var isDocked = state.isDocked();
22977
      if (isDocked) {
22576
      if (isDocked) {
22978
        updateVisibility(component, config, state, viewport);
22577
        updateVisibility(component, config, state, viewport);
22979
      }
22578
      }
22980
      getMorph(component, viewport, state).each(function (morph) {
22579
      getMorph(component, viewport, state).each(function (morph) {
22981
        state.setDocked(!isDocked);
-
 
22982
        morph.fold(function () {
22580
        morph.fold(function () {
22983
          return morphToStatic(component, config);
22581
          return morphToStatic(component, config, state);
22984
        }, function (position) {
22582
        }, function (position) {
22985
          return morphToCoord(component, config, position);
22583
          return morphToCoord(component, config, state, position);
22986
        }, function (position) {
22584
        }, function (position) {
22987
          updateVisibility(component, config, state, viewport, true);
22585
          updateVisibility(component, config, state, viewport, true);
22988
          morphToCoord(component, config, position);
22586
          morphToCoord(component, config, state, position);
22989
        });
22587
        });
22990
      });
22588
      });
22991
    };
22589
    };
22992
    var resetInternal = function (component, config, state) {
22590
    var resetInternal = function (component, config, state) {
22993
      var elem = component.element;
22591
      var elem = component.element;
22994
      state.setDocked(false);
22592
      state.setDocked(false);
22995
      getMorphToOriginal(component, state).each(function (morph) {
22593
      getMorphToOriginal(component, state).each(function (morph) {
22996
        morph.fold(function () {
22594
        morph.fold(function () {
22997
          return morphToStatic(component, config);
22595
          return morphToStatic(component, config, state);
22998
        }, function (position) {
22596
        }, function (position) {
22999
          return morphToCoord(component, config, position);
22597
          return morphToCoord(component, config, state, position);
23000
        }, noop);
22598
        }, noop);
23001
      });
22599
      });
23002
      state.setVisible(true);
22600
      state.setVisible(true);
23003
      config.contextual.each(function (contextInfo) {
22601
      config.contextual.each(function (contextInfo) {
23004
        remove$2(elem, [
22602
        remove$1(elem, [
23005
          contextInfo.fadeInClass,
22603
          contextInfo.fadeInClass,
23006
          contextInfo.fadeOutClass,
22604
          contextInfo.fadeOutClass,
23007
          contextInfo.transitionClass
22605
          contextInfo.transitionClass
23008
        ]);
22606
        ]);
23009
        contextInfo.onShow(component);
22607
        contextInfo.onShow(component);
Line 23042... Line 22640...
23042
    var events$5 = function (dockInfo, dockState) {
22640
    var events$5 = function (dockInfo, dockState) {
23043
      return derive$2([
22641
      return derive$2([
23044
        runOnSource(transitionend(), function (component, simulatedEvent) {
22642
        runOnSource(transitionend(), function (component, simulatedEvent) {
23045
          dockInfo.contextual.each(function (contextInfo) {
22643
          dockInfo.contextual.each(function (contextInfo) {
23046
            if (has(component.element, contextInfo.transitionClass)) {
22644
            if (has(component.element, contextInfo.transitionClass)) {
23047
              remove$2(component.element, [
22645
              remove$1(component.element, [
23048
                contextInfo.transitionClass,
22646
                contextInfo.transitionClass,
23049
                contextInfo.fadeInClass
22647
                contextInfo.fadeInClass
23050
              ]);
22648
              ]);
23051
              var notify = dockState.isVisible() ? contextInfo.onShown : contextInfo.onHidden;
22649
              var notify = dockState.isVisible() ? contextInfo.onShown : contextInfo.onHidden;
23052
              notify(component);
22650
              notify(component);
Line 23133... Line 22731...
23133
    var editorStickyOnClass = 'tox-tinymce--toolbar-sticky-on';
22731
    var editorStickyOnClass = 'tox-tinymce--toolbar-sticky-on';
23134
    var editorStickyOffClass = 'tox-tinymce--toolbar-sticky-off';
22732
    var editorStickyOffClass = 'tox-tinymce--toolbar-sticky-off';
23135
    var scrollFromBehindHeader = function (e, containerHeader) {
22733
    var scrollFromBehindHeader = function (e, containerHeader) {
23136
      var doc = owner$4(containerHeader);
22734
      var doc = owner$4(containerHeader);
23137
      var viewHeight = doc.dom.defaultView.innerHeight;
22735
      var viewHeight = doc.dom.defaultView.innerHeight;
23138
      var scrollPos = get$6(doc);
22736
      var scrollPos = get$9(doc);
23139
      var markerElement = SugarElement.fromDom(e.elm);
22737
      var markerElement = SugarElement.fromDom(e.elm);
23140
      var markerPos = absolute$2(markerElement);
22738
      var markerPos = absolute$2(markerElement);
23141
      var markerHeight = get$8(markerElement);
22739
      var markerHeight = get$b(markerElement);
23142
      var markerTop = markerPos.y;
22740
      var markerTop = markerPos.y;
23143
      var markerBottom = markerTop + markerHeight;
22741
      var markerBottom = markerTop + markerHeight;
23144
      var editorHeaderPos = absolute$3(containerHeader);
22742
      var editorHeaderPos = absolute$3(containerHeader);
23145
      var editorHeaderHeight = get$8(containerHeader);
22743
      var editorHeaderHeight = get$b(containerHeader);
23146
      var editorHeaderTop = editorHeaderPos.top;
22744
      var editorHeaderTop = editorHeaderPos.top;
23147
      var editorHeaderBottom = editorHeaderTop + editorHeaderHeight;
22745
      var editorHeaderBottom = editorHeaderTop + editorHeaderHeight;
23148
      var editorHeaderDockedAtTop = Math.abs(editorHeaderTop - scrollPos.top) < 2;
22746
      var editorHeaderDockedAtTop = Math.abs(editorHeaderTop - scrollPos.top) < 2;
23149
      var editorHeaderDockedAtBottom = Math.abs(editorHeaderBottom - (scrollPos.top + viewHeight)) < 2;
22747
      var editorHeaderDockedAtBottom = Math.abs(editorHeaderBottom - (scrollPos.top + viewHeight)) < 2;
23150
      if (editorHeaderDockedAtTop && markerTop < editorHeaderBottom) {
22748
      if (editorHeaderDockedAtTop && markerTop < editorHeaderBottom) {
Line 23157... Line 22755...
23157
    var isDockedMode = function (header, mode) {
22755
    var isDockedMode = function (header, mode) {
23158
      return contains$2(Docking.getModes(header), mode);
22756
      return contains$2(Docking.getModes(header), mode);
23159
    };
22757
    };
23160
    var updateIframeContentFlow = function (header) {
22758
    var updateIframeContentFlow = function (header) {
23161
      var getOccupiedHeight = function (elm) {
22759
      var getOccupiedHeight = function (elm) {
23162
        return getOuter$1(elm) + (parseInt(get$a(elm, 'margin-top'), 10) || 0) + (parseInt(get$a(elm, 'margin-bottom'), 10) || 0);
22760
        return getOuter$2(elm) + (parseInt(get$c(elm, 'margin-top'), 10) || 0) + (parseInt(get$c(elm, 'margin-bottom'), 10) || 0);
23163
      };
22761
      };
23164
      var elm = header.element;
22762
      var elm = header.element;
23165
      parent(elm).each(function (parentElem) {
22763
      parent(elm).each(function (parentElem) {
23166
        var padding = 'padding-' + Docking.getModes(header)[0];
22764
        var padding = 'padding-' + Docking.getModes(header)[0];
23167
        if (Docking.isDocked(header)) {
22765
        if (Docking.isDocked(header)) {
23168
          var parentWidth = get$7(parentElem);
22766
          var parentWidth = get$a(parentElem);
23169
          set$6(elm, 'width', parentWidth + 'px');
22767
          set$7(elm, 'width', parentWidth + 'px');
23170
          set$6(parentElem, padding, getOccupiedHeight(elm) + 'px');
22768
          set$7(parentElem, padding, getOccupiedHeight(elm) + 'px');
23171
        } else {
22769
        } else {
23172
          remove$1(elm, 'width');
22770
          remove$6(elm, 'width');
23173
          remove$1(parentElem, padding);
22771
          remove$6(parentElem, padding);
23174
        }
22772
        }
23175
      });
22773
      });
23176
    };
22774
    };
23177
    var updateSinkVisibility = function (sinkElem, visible) {
22775
    var updateSinkVisibility = function (sinkElem, visible) {
23178
      if (visible) {
22776
      if (visible) {
23179
        remove$3(sinkElem, visibility.fadeOutClass);
22777
        remove$2(sinkElem, visibility.fadeOutClass);
23180
        add$1(sinkElem, [
22778
        add$1(sinkElem, [
23181
          visibility.transitionClass,
22779
          visibility.transitionClass,
23182
          visibility.fadeInClass
22780
          visibility.fadeInClass
23183
        ]);
22781
        ]);
23184
      } else {
22782
      } else {
23185
        remove$3(sinkElem, visibility.fadeInClass);
22783
        remove$2(sinkElem, visibility.fadeInClass);
23186
        add$1(sinkElem, [
22784
        add$1(sinkElem, [
23187
          visibility.fadeOutClass,
22785
          visibility.fadeOutClass,
23188
          visibility.transitionClass
22786
          visibility.transitionClass
23189
        ]);
22787
        ]);
23190
      }
22788
      }
23191
    };
22789
    };
23192
    var updateEditorClasses = function (editor, docked) {
22790
    var updateEditorClasses = function (editor, docked) {
23193
      var editorContainer = SugarElement.fromDom(editor.getContainer());
22791
      var editorContainer = SugarElement.fromDom(editor.getContainer());
23194
      if (docked) {
22792
      if (docked) {
23195
        add$2(editorContainer, editorStickyOnClass);
22793
        add$2(editorContainer, editorStickyOnClass);
23196
        remove$3(editorContainer, editorStickyOffClass);
22794
        remove$2(editorContainer, editorStickyOffClass);
23197
      } else {
22795
      } else {
23198
        add$2(editorContainer, editorStickyOffClass);
22796
        add$2(editorContainer, editorStickyOffClass);
23199
        remove$3(editorContainer, editorStickyOnClass);
22797
        remove$2(editorContainer, editorStickyOnClass);
23200
      }
22798
      }
23201
    };
22799
    };
23202
    var restoreFocus = function (headerElem, focusedElem) {
22800
    var restoreFocus = function (headerElem, focusedElem) {
23203
      var ownerDoc = owner$4(focusedElem);
22801
      var ownerDoc = owner$4(focusedElem);
23204
      active(ownerDoc).filter(function (activeElm) {
22802
      active(ownerDoc).filter(function (activeElm) {
Line 23277... Line 22875...
23277
      return __spreadArray([
22875
      return __spreadArray([
23278
        Focusing.config({}),
22876
        Focusing.config({}),
23279
        Docking.config({
22877
        Docking.config({
23280
          contextual: __assign({
22878
          contextual: __assign({
23281
            lazyContext: function (comp) {
22879
            lazyContext: function (comp) {
23282
              var headerHeight = getOuter$1(comp.element);
22880
              var headerHeight = getOuter$2(comp.element);
23283
              var container = editor.inline ? editor.getContentAreaContainer() : editor.getContainer();
22881
              var container = editor.inline ? editor.getContentAreaContainer() : editor.getContainer();
23284
              var box = box$1(SugarElement.fromDom(container));
22882
              var box = box$1(SugarElement.fromDom(container));
23285
              var boxHeight = box.height - headerHeight;
22883
              var boxHeight = box.height - headerHeight;
23286
              var topBound = box.y + (isDockedMode(comp, 'top') ? 0 : headerHeight);
22884
              var topBound = box.y + (isDockedMode(comp, 'top') ? 0 : headerHeight);
23287
              return Optional.some(bounds(box.x, topBound, box.width, boxHeight));
22885
              return Optional.some(bounds(box.x, topBound, box.width, boxHeight));
Line 23291... Line 22889...
23291
                return updateSinkVisibility(elem, true);
22889
                return updateSinkVisibility(elem, true);
23292
              });
22890
              });
23293
            },
22891
            },
23294
            onShown: function (comp) {
22892
            onShown: function (comp) {
23295
              runOnSinkElement(function (elem) {
22893
              runOnSinkElement(function (elem) {
23296
                return remove$2(elem, [
22894
                return remove$1(elem, [
23297
                  visibility.transitionClass,
22895
                  visibility.transitionClass,
23298
                  visibility.fadeInClass
22896
                  visibility.fadeInClass
23299
                ]);
22897
                ]);
23300
              });
22898
              });
23301
              focusedElm.get().each(function (elem) {
22899
              focusedElm.get().each(function (elem) {
Line 23309... Line 22907...
23309
                return updateSinkVisibility(elem, false);
22907
                return updateSinkVisibility(elem, false);
23310
              });
22908
              });
23311
            },
22909
            },
23312
            onHidden: function () {
22910
            onHidden: function () {
23313
              runOnSinkElement(function (elem) {
22911
              runOnSinkElement(function (elem) {
23314
                return remove$2(elem, [visibility.transitionClass]);
22912
                return remove$1(elem, [visibility.transitionClass]);
23315
              });
22913
              });
23316
            }
22914
            }
23317
          }, visibility),
22915
          }, visibility),
23318
          lazyViewport: function (comp) {
22916
          lazyViewport: function (comp) {
23319
            var win$1 = win();
22917
            var win$1 = win();
Line 23324... Line 22922...
23324
          },
22922
          },
23325
          modes: [sharedBackstage.header.getDockingMode()],
22923
          modes: [sharedBackstage.header.getDockingMode()],
23326
          onDocked: onDockingSwitch,
22924
          onDocked: onDockingSwitch,
23327
          onUndocked: onDockingSwitch
22925
          onUndocked: onDockingSwitch
23328
        })
22926
        })
23329
      ], additionalBehaviours);
22927
      ], additionalBehaviours, true);
23330
    };
22928
    };
23331
 
22929
 
23332
    var StickyHeader = /*#__PURE__*/Object.freeze({
22930
    var StickyHeader = /*#__PURE__*/Object.freeze({
23333
        __proto__: null,
22931
        __proto__: null,
23334
        setup: setup$9,
22932
        setup: setup$9,
Line 23369... Line 22967...
23369
      defaultedFunction('onSetup', function () {
22967
      defaultedFunction('onSetup', function () {
23370
        return noop;
22968
        return noop;
23371
      })
22969
      })
23372
    ];
22970
    ];
23373
 
22971
 
23374
    var MenuButtonSchema = objOf(__spreadArray([requiredString('type')], baseMenuButtonFields));
22972
    var MenuButtonSchema = objOf(__spreadArray([requiredString('type')], baseMenuButtonFields, true));
23375
    var createMenuButton = function (spec) {
22973
    var createMenuButton = function (spec) {
23376
      return asRaw('menubutton', MenuButtonSchema, spec);
22974
      return asRaw('menubutton', MenuButtonSchema, spec);
23377
    };
22975
    };
23378
 
22976
 
23379
    var splitButtonSchema = objOf([
22977
    var splitButtonSchema = objOf([
Line 23508... Line 23106...
23508
    var getDimension = function (slideConfig, elem) {
23106
    var getDimension = function (slideConfig, elem) {
23509
      return slideConfig.dimension.getDimension(elem);
23107
      return slideConfig.dimension.getDimension(elem);
23510
    };
23108
    };
23511
    var disableTransitions = function (component, slideConfig) {
23109
    var disableTransitions = function (component, slideConfig) {
23512
      var root = getAnimationRoot(component, slideConfig);
23110
      var root = getAnimationRoot(component, slideConfig);
23513
      remove$2(root, [
23111
      remove$1(root, [
23514
        slideConfig.shrinkingClass,
23112
        slideConfig.shrinkingClass,
23515
        slideConfig.growingClass
23113
        slideConfig.growingClass
23516
      ]);
23114
      ]);
23517
    };
23115
    };
23518
    var setShrunk = function (component, slideConfig) {
23116
    var setShrunk = function (component, slideConfig) {
23519
      remove$3(component.element, slideConfig.openClass);
23117
      remove$2(component.element, slideConfig.openClass);
23520
      add$2(component.element, slideConfig.closedClass);
23118
      add$2(component.element, slideConfig.closedClass);
23521
      set$6(component.element, getDimensionProperty(slideConfig), '0px');
23119
      set$7(component.element, getDimensionProperty(slideConfig), '0px');
23522
      reflow(component.element);
23120
      reflow(component.element);
23523
    };
23121
    };
23524
    var setGrown = function (component, slideConfig) {
23122
    var setGrown = function (component, slideConfig) {
23525
      remove$3(component.element, slideConfig.closedClass);
23123
      remove$2(component.element, slideConfig.closedClass);
23526
      add$2(component.element, slideConfig.openClass);
23124
      add$2(component.element, slideConfig.openClass);
23527
      remove$1(component.element, getDimensionProperty(slideConfig));
23125
      remove$6(component.element, getDimensionProperty(slideConfig));
23528
    };
23126
    };
23529
    var doImmediateShrink = function (component, slideConfig, slideState, _calculatedSize) {
23127
    var doImmediateShrink = function (component, slideConfig, slideState, _calculatedSize) {
23530
      slideState.setCollapsed();
23128
      slideState.setCollapsed();
23531
      set$6(component.element, getDimensionProperty(slideConfig), getDimension(slideConfig, component.element));
23129
      set$7(component.element, getDimensionProperty(slideConfig), getDimension(slideConfig, component.element));
23532
      reflow(component.element);
23130
      reflow(component.element);
23533
      disableTransitions(component, slideConfig);
23131
      disableTransitions(component, slideConfig);
23534
      setShrunk(component, slideConfig);
23132
      setShrunk(component, slideConfig);
23535
      slideConfig.onStartShrink(component);
23133
      slideConfig.onStartShrink(component);
23536
      slideConfig.onShrunk(component);
23134
      slideConfig.onShrunk(component);
Line 23538... Line 23136...
23538
    var doStartShrink = function (component, slideConfig, slideState, calculatedSize) {
23136
    var doStartShrink = function (component, slideConfig, slideState, calculatedSize) {
23539
      var size = calculatedSize.getOrThunk(function () {
23137
      var size = calculatedSize.getOrThunk(function () {
23540
        return getDimension(slideConfig, component.element);
23138
        return getDimension(slideConfig, component.element);
23541
      });
23139
      });
23542
      slideState.setCollapsed();
23140
      slideState.setCollapsed();
23543
      set$6(component.element, getDimensionProperty(slideConfig), size);
23141
      set$7(component.element, getDimensionProperty(slideConfig), size);
23544
      reflow(component.element);
23142
      reflow(component.element);
23545
      var root = getAnimationRoot(component, slideConfig);
23143
      var root = getAnimationRoot(component, slideConfig);
23546
      remove$3(root, slideConfig.growingClass);
23144
      remove$2(root, slideConfig.growingClass);
23547
      add$2(root, slideConfig.shrinkingClass);
23145
      add$2(root, slideConfig.shrinkingClass);
23548
      setShrunk(component, slideConfig);
23146
      setShrunk(component, slideConfig);
23549
      slideConfig.onStartShrink(component);
23147
      slideConfig.onStartShrink(component);
23550
    };
23148
    };
23551
    var doStartSmartShrink = function (component, slideConfig, slideState) {
23149
    var doStartSmartShrink = function (component, slideConfig, slideState) {
Line 23558... Line 23156...
23558
      var wasShrinking = has(root, slideConfig.shrinkingClass);
23156
      var wasShrinking = has(root, slideConfig.shrinkingClass);
23559
      var beforeSize = getDimension(slideConfig, component.element);
23157
      var beforeSize = getDimension(slideConfig, component.element);
23560
      setGrown(component, slideConfig);
23158
      setGrown(component, slideConfig);
23561
      var fullSize = getDimension(slideConfig, component.element);
23159
      var fullSize = getDimension(slideConfig, component.element);
23562
      var startPartialGrow = function () {
23160
      var startPartialGrow = function () {
23563
        set$6(component.element, getDimensionProperty(slideConfig), beforeSize);
23161
        set$7(component.element, getDimensionProperty(slideConfig), beforeSize);
23564
        reflow(component.element);
23162
        reflow(component.element);
23565
      };
23163
      };
23566
      var startCompleteGrow = function () {
23164
      var startCompleteGrow = function () {
23567
        setShrunk(component, slideConfig);
23165
        setShrunk(component, slideConfig);
23568
      };
23166
      };
23569
      var setStartSize = wasShrinking ? startPartialGrow : startCompleteGrow;
23167
      var setStartSize = wasShrinking ? startPartialGrow : startCompleteGrow;
23570
      setStartSize();
23168
      setStartSize();
23571
      remove$3(root, slideConfig.shrinkingClass);
23169
      remove$2(root, slideConfig.shrinkingClass);
23572
      add$2(root, slideConfig.growingClass);
23170
      add$2(root, slideConfig.growingClass);
23573
      setGrown(component, slideConfig);
23171
      setGrown(component, slideConfig);
23574
      set$6(component.element, getDimensionProperty(slideConfig), fullSize);
23172
      set$7(component.element, getDimensionProperty(slideConfig), fullSize);
23575
      slideState.setExpanded();
23173
      slideState.setExpanded();
23576
      slideConfig.onStartGrow(component);
23174
      slideConfig.onStartGrow(component);
23577
    };
23175
    };
23578
    var refresh$3 = function (component, slideConfig, slideState) {
23176
    var refresh$3 = function (component, slideConfig, slideState) {
23579
      if (slideState.isExpanded()) {
23177
      if (slideState.isExpanded()) {
23580
        remove$1(component.element, getDimensionProperty(slideConfig));
23178
        remove$6(component.element, getDimensionProperty(slideConfig));
23581
        var fullSize = getDimension(slideConfig, component.element);
23179
        var fullSize = getDimension(slideConfig, component.element);
23582
        set$6(component.element, getDimensionProperty(slideConfig), fullSize);
23180
        set$7(component.element, getDimensionProperty(slideConfig), fullSize);
23583
      }
23181
      }
23584
    };
23182
    };
23585
    var grow = function (component, slideConfig, slideState) {
23183
    var grow = function (component, slideConfig, slideState) {
23586
      if (!slideState.isExpanded()) {
23184
      if (!slideState.isExpanded()) {
23587
        doStartGrow(component, slideConfig, slideState);
23185
        doStartGrow(component, slideConfig, slideState);
Line 23648... Line 23246...
23648
      return derive$2([runOnSource(transitionend(), function (component, simulatedEvent) {
23246
      return derive$2([runOnSource(transitionend(), function (component, simulatedEvent) {
23649
          var raw = simulatedEvent.event.raw;
23247
          var raw = simulatedEvent.event.raw;
23650
          if (raw.propertyName === slideConfig.dimension.property) {
23248
          if (raw.propertyName === slideConfig.dimension.property) {
23651
            disableTransitions(component, slideConfig);
23249
            disableTransitions(component, slideConfig);
23652
            if (slideState.isExpanded()) {
23250
            if (slideState.isExpanded()) {
23653
              remove$1(component.element, slideConfig.dimension.property);
23251
              remove$6(component.element, slideConfig.dimension.property);
23654
            }
23252
            }
23655
            var notify = slideState.isExpanded() ? slideConfig.onGrown : slideConfig.onShrunk;
23253
            var notify = slideState.isExpanded() ? slideConfig.onGrown : slideConfig.onShrunk;
23656
            notify(component);
23254
            notify(component);
23657
          }
23255
          }
23658
        })]);
23256
        })]);
Line 23677... Line 23275...
23677
      defaulted('expanded', false),
23275
      defaulted('expanded', false),
23678
      requiredOf('dimension', choose$1('property', {
23276
      requiredOf('dimension', choose$1('property', {
23679
        width: [
23277
        width: [
23680
          output$1('property', 'width'),
23278
          output$1('property', 'width'),
23681
          output$1('getDimension', function (elem) {
23279
          output$1('getDimension', function (elem) {
23682
            return get$7(elem) + 'px';
23280
            return get$a(elem) + 'px';
23683
          })
23281
          })
23684
        ],
23282
        ],
23685
        height: [
23283
        height: [
23686
          output$1('property', 'height'),
23284
          output$1('property', 'height'),
23687
          output$1('getDimension', function (elem) {
23285
          output$1('getDimension', function (elem) {
23688
            return get$8(elem) + 'px';
23286
            return get$b(elem) + 'px';
23689
          })
23287
          })
23690
        ]
23288
        ]
23691
      }))
23289
      }))
23692
    ];
23290
    ];
23693
 
23291
 
Line 23769... Line 23367...
23769
            return f(container, key);
23367
            return f(container, key);
23770
          });
23368
          });
23771
        };
23369
        };
23772
      };
23370
      };
23773
      var doShowing = function (comp, _key) {
23371
      var doShowing = function (comp, _key) {
23774
        return get$c(comp.element, 'aria-hidden') !== 'true';
23372
        return get$d(comp.element, 'aria-hidden') !== 'true';
23775
      };
23373
      };
23776
      var doShow = function (comp, key) {
23374
      var doShow = function (comp, key) {
23777
        if (!doShowing(comp)) {
23375
        if (!doShowing(comp)) {
23778
          var element = comp.element;
23376
          var element = comp.element;
23779
          remove$1(element, 'display');
23377
          remove$6(element, 'display');
23780
          remove$6(element, 'aria-hidden');
23378
          remove$7(element, 'aria-hidden');
23781
          emitWith(comp, slotVisibility(), {
23379
          emitWith(comp, slotVisibility(), {
23782
            name: key,
23380
            name: key,
23783
            visible: true
23381
            visible: true
23784
          });
23382
          });
23785
        }
23383
        }
23786
      };
23384
      };
23787
      var doHide = function (comp, key) {
23385
      var doHide = function (comp, key) {
23788
        if (doShowing(comp)) {
23386
        if (doShowing(comp)) {
23789
          var element = comp.element;
23387
          var element = comp.element;
23790
          set$6(element, 'display', 'none');
23388
          set$7(element, 'display', 'none');
23791
          set$7(element, 'aria-hidden', 'true');
23389
          set$8(element, 'aria-hidden', 'true');
23792
          emitWith(comp, slotVisibility(), {
23390
          emitWith(comp, slotVisibility(), {
23793
            name: key,
23391
            name: key,
23794
            visible: false
23392
            visible: false
23795
          });
23393
          });
23796
        }
23394
        }
Line 23816... Line 23414...
23816
        components: components,
23414
        components: components,
23817
        behaviours: get$2(detail.slotBehaviours),
23415
        behaviours: get$2(detail.slotBehaviours),
23818
        apis: apis
23416
        apis: apis
23819
      };
23417
      };
23820
    };
23418
    };
23821
    var slotApis = map({
23419
    var slotApis = map$1({
23822
      getSlotNames: function (apis, c) {
23420
      getSlotNames: function (apis, c) {
23823
        return apis.getSlotNames(c);
23421
        return apis.getSlotNames(c);
23824
      },
23422
      },
23825
      getSlot: function (apis, c, key) {
23423
      getSlot: function (apis, c, key) {
23826
        return apis.getSlot(c, key);
23424
        return apis.getSlot(c, key);
Line 23858... Line 23456...
23858
    var setup$8 = function (editor) {
23456
    var setup$8 = function (editor) {
23859
      var sidebars = editor.ui.registry.getAll().sidebars;
23457
      var sidebars = editor.ui.registry.getAll().sidebars;
23860
      each$1(keys(sidebars), function (name) {
23458
      each$1(keys(sidebars), function (name) {
23861
        var spec = sidebars[name];
23459
        var spec = sidebars[name];
23862
        var isActive = function () {
23460
        var isActive = function () {
23863
          return is(Optional.from(editor.queryCommandValue('ToggleSidebar')), name);
23461
          return is$1(Optional.from(editor.queryCommandValue('ToggleSidebar')), name);
23864
        };
23462
        };
23865
        editor.ui.registry.addToggleButton(name, {
23463
        editor.ui.registry.addToggleButton(name, {
23866
          icon: spec.icon,
23464
          icon: spec.icon,
23867
          tooltip: spec.tooltip,
23465
          tooltip: spec.tooltip,
23868
          onAction: function (buttonApi) {
23466
          onAction: function (buttonApi) {
Line 24015... Line 23613...
24015
                },
23613
                },
24016
                onStartGrow: function (slider) {
23614
                onStartGrow: function (slider) {
24017
                  emitWith(slider, fixSize, { width: getRaw(slider.element, 'width').getOr('') });
23615
                  emitWith(slider, fixSize, { width: getRaw(slider.element, 'width').getOr('') });
24018
                },
23616
                },
24019
                onStartShrink: function (slider) {
23617
                onStartShrink: function (slider) {
24020
                  emitWith(slider, fixSize, { width: get$7(slider.element) + 'px' });
23618
                  emitWith(slider, fixSize, { width: get$a(slider.element) + 'px' });
24021
                }
23619
                }
24022
              }),
23620
              }),
24023
              Replacing.config({}),
23621
              Replacing.config({}),
24024
              Composing.config({
23622
              Composing.config({
24025
                find: function (comp) {
23623
                find: function (comp) {
Line 24031... Line 23629...
24031
          }],
23629
          }],
24032
        behaviours: derive$1([
23630
        behaviours: derive$1([
24033
          ComposingConfigs.childAt(0),
23631
          ComposingConfigs.childAt(0),
24034
          config('sidebar-sliding-events', [
23632
          config('sidebar-sliding-events', [
24035
            run$1(fixSize, function (comp, se) {
23633
            run$1(fixSize, function (comp, se) {
24036
              set$6(comp.element, 'width', se.event.width);
23634
              set$7(comp.element, 'width', se.event.width);
24037
            }),
23635
            }),
24038
            run$1(autoSize, function (comp, _se) {
23636
            run$1(autoSize, function (comp, _se) {
24039
              remove$1(comp.element, 'width');
23637
              remove$6(comp.element, 'width');
24040
            })
23638
            })
24041
          ])
23639
          ])
24042
        ])
23640
        ])
24043
      };
23641
      };
24044
    };
23642
    };
24045
 
23643
 
24046
    var block = function (component, config, state, getBusySpec) {
23644
    var block = function (component, config, state, getBusySpec) {
24047
      set$7(component.element, 'aria-busy', true);
23645
      set$8(component.element, 'aria-busy', true);
24048
      var root = config.getRoot(component).getOr(component);
23646
      var root = config.getRoot(component).getOr(component);
24049
      var blockerBehaviours = derive$1([
23647
      var blockerBehaviours = derive$1([
24050
        Keying.config({
23648
        Keying.config({
24051
          mode: 'special',
23649
          mode: 'special',
24052
          onTab: function () {
23650
          onTab: function () {
Line 24070... Line 23668...
24070
      state.blockWith(function () {
23668
      state.blockWith(function () {
24071
        return Replacing.remove(root, blocker);
23669
        return Replacing.remove(root, blocker);
24072
      });
23670
      });
24073
    };
23671
    };
24074
    var unblock = function (component, config, state) {
23672
    var unblock = function (component, config, state) {
24075
      remove$6(component.element, 'aria-busy');
23673
      remove$7(component.element, 'aria-busy');
24076
      if (state.isBlocked()) {
23674
      if (state.isBlocked()) {
24077
        config.onUnblock(component);
23675
        config.onUnblock(component);
24078
      }
23676
      }
24079
      state.clear();
23677
      state.clear();
24080
    };
23678
    };
Line 24134... Line 23732...
24134
    var fromHtml = function (html) {
23732
    var fromHtml = function (html) {
24135
      var elem = SugarElement.fromHtml(html);
23733
      var elem = SugarElement.fromHtml(html);
24136
      var children$1 = children(elem);
23734
      var children$1 = children(elem);
24137
      var attrs = getAttrs(elem);
23735
      var attrs = getAttrs(elem);
24138
      var classes = getClasses(elem);
23736
      var classes = getClasses(elem);
24139
      var contents = children$1.length === 0 ? {} : { innerHtml: get$d(elem) };
23737
      var contents = children$1.length === 0 ? {} : { innerHtml: get$7(elem) };
24140
      return __assign({
23738
      return __assign({
24141
        tag: name$2(elem),
23739
        tag: name$2(elem),
24142
        classes: classes,
23740
        classes: classes,
24143
        attributes: attrs
23741
        attributes: attrs
24144
      }, contents);
23742
      }, contents);
Line 24168... Line 23766...
24168
      var tabIndexAttr = 'tabindex';
23766
      var tabIndexAttr = 'tabindex';
24169
      var dataTabIndexAttr = 'data-mce-' + tabIndexAttr;
23767
      var dataTabIndexAttr = 'data-mce-' + tabIndexAttr;
24170
      Optional.from(editor.iframeElement).map(SugarElement.fromDom).each(function (iframe) {
23768
      Optional.from(editor.iframeElement).map(SugarElement.fromDom).each(function (iframe) {
24171
        if (state) {
23769
        if (state) {
24172
          getOpt(iframe, tabIndexAttr).each(function (tabIndex) {
23770
          getOpt(iframe, tabIndexAttr).each(function (tabIndex) {
24173
            return set$7(iframe, dataTabIndexAttr, tabIndex);
23771
            return set$8(iframe, dataTabIndexAttr, tabIndex);
24174
          });
23772
          });
24175
          set$7(iframe, tabIndexAttr, -1);
23773
          set$8(iframe, tabIndexAttr, -1);
24176
        } else {
23774
        } else {
24177
          remove$6(iframe, tabIndexAttr);
23775
          remove$7(iframe, tabIndexAttr);
24178
          getOpt(iframe, dataTabIndexAttr).each(function (tabIndex) {
23776
          getOpt(iframe, dataTabIndexAttr).each(function (tabIndex) {
24179
            set$7(iframe, tabIndexAttr, tabIndex);
23777
            set$8(iframe, tabIndexAttr, tabIndex);
24180
            remove$6(iframe, dataTabIndexAttr);
23778
            remove$7(iframe, dataTabIndexAttr);
24181
          });
23779
          });
24182
        }
23780
        }
24183
      });
23781
      });
24184
    };
23782
    };
24185
    var toggleThrobber = function (editor, comp, state, providerBackstage) {
23783
    var toggleThrobber = function (editor, comp, state, providerBackstage) {
24186
      var element = comp.element;
23784
      var element = comp.element;
24187
      toggleEditorTabIndex(editor, state);
23785
      toggleEditorTabIndex(editor, state);
24188
      if (state) {
23786
      if (state) {
24189
        Blocking.block(comp, getBusySpec$1(providerBackstage));
23787
        Blocking.block(comp, getBusySpec$1(providerBackstage));
24190
        remove$1(element, 'display');
23788
        remove$6(element, 'display');
24191
        remove$6(element, 'aria-hidden');
23789
        remove$7(element, 'aria-hidden');
24192
        if (editor.hasFocus()) {
23790
        if (editor.hasFocus()) {
24193
          focusBusyComponent(comp);
23791
          focusBusyComponent(comp);
24194
        }
23792
        }
24195
      } else {
23793
      } else {
24196
        var throbberFocus = Composing.getCurrent(comp).exists(function (busyComp) {
23794
        var throbberFocus = Composing.getCurrent(comp).exists(function (busyComp) {
24197
          return hasFocus(busyComp.element);
23795
          return hasFocus(busyComp.element);
24198
        });
23796
        });
24199
        Blocking.unblock(comp);
23797
        Blocking.unblock(comp);
24200
        set$6(element, 'display', 'none');
23798
        set$7(element, 'display', 'none');
24201
        set$7(element, 'aria-hidden', 'true');
23799
        set$8(element, 'aria-hidden', 'true');
24202
        if (throbberFocus) {
23800
        if (throbberFocus) {
24203
          editor.focus();
23801
          editor.focus();
24204
        }
23802
        }
24205
      }
23803
      }
24206
    };
23804
    };
Line 24264... Line 23862...
24264
          toggleThrobber(editor, lazyThrobber(), state, sharedBackstage.providers);
23862
          toggleThrobber(editor, lazyThrobber(), state, sharedBackstage.providers);
24265
          editor.fire('AfterProgressState', { state: state });
23863
          editor.fire('AfterProgressState', { state: state });
24266
        }
23864
        }
24267
      };
23865
      };
24268
      editor.on('ProgressState', function (e) {
23866
      editor.on('ProgressState', function (e) {
24269
        timer.on(global$g.clearTimeout);
23867
        timer.on(global$f.clearTimeout);
24270
        if (isNumber(e.time)) {
23868
        if (isNumber(e.time)) {
24271
          var timerId = global$g.setEditorTimeout(editor, function () {
23869
          var timerId = global$f.setEditorTimeout(editor, function () {
24272
            return toggle(e.state);
23870
            return toggle(e.state);
24273
          }, e.time);
23871
          }, e.time);
24274
          timer.set(timerId);
23872
          timer.set(timerId);
24275
        } else {
23873
        } else {
24276
          toggle(e.state);
23874
          toggle(e.state);
Line 24380... Line 23978...
24380
      if (builtGroups.length === 0) {
23978
      if (builtGroups.length === 0) {
24381
        return;
23979
        return;
24382
      }
23980
      }
24383
      var primary = getPartOrDie(toolbar, detail, 'primary');
23981
      var primary = getPartOrDie(toolbar, detail, 'primary');
24384
      var overflowGroup = Coupling.getCoupled(toolbar, 'overflowGroup');
23982
      var overflowGroup = Coupling.getCoupled(toolbar, 'overflowGroup');
24385
      set$6(primary.element, 'visibility', 'hidden');
23983
      set$7(primary.element, 'visibility', 'hidden');
24386
      var groups = builtGroups.concat([overflowGroup]);
23984
      var groups = builtGroups.concat([overflowGroup]);
24387
      var focusedComp = findFocusedComp(groups);
23985
      var focusedComp = findFocusedComp(groups);
24388
      setOverflow([]);
23986
      setOverflow([]);
24389
      setGroups$1(primary, groups);
23987
      setGroups$1(primary, groups);
24390
      var availableWidth = get$7(primary.element);
23988
      var availableWidth = get$a(primary.element);
24391
      var overflows = partition(availableWidth, detail.builtGroups.get(), function (comp) {
23989
      var overflows = partition(availableWidth, detail.builtGroups.get(), function (comp) {
24392
        return get$7(comp.element);
23990
        return get$a(comp.element);
24393
      }, overflowGroup);
23991
      }, overflowGroup);
24394
      if (overflows.extra.length === 0) {
23992
      if (overflows.extra.length === 0) {
24395
        Replacing.remove(primary, overflowGroup);
23993
        Replacing.remove(primary, overflowGroup);
24396
        setOverflow([]);
23994
        setOverflow([]);
24397
      } else {
23995
      } else {
24398
        setGroups$1(primary, overflows.within);
23996
        setGroups$1(primary, overflows.within);
24399
        setOverflow(overflows.extra);
23997
        setOverflow(overflows.extra);
24400
      }
23998
      }
24401
      remove$1(primary.element, 'visibility');
23999
      remove$6(primary.element, 'visibility');
24402
      reflow(primary.element);
24000
      reflow(primary.element);
24403
      focusedComp.each(Focusing.focus);
24001
      focusedComp.each(Focusing.focus);
24404
    };
24002
    };
24405
 
24003
 
24406
    var schema$c = constant$1([
24004
    var schema$c = constant$1([
Line 25440... Line 25038...
25440
        return fireSkinLoadError$1(editor, { message: err });
25038
        return fireSkinLoadError$1(editor, { message: err });
25441
      };
25039
      };
25442
    };
25040
    };
25443
 
25041
 
25444
    var loadStylesheet = function (editor, stylesheetUrl, styleSheetLoader) {
25042
    var loadStylesheet = function (editor, stylesheetUrl, styleSheetLoader) {
25445
      return new global$d(function (resolve, reject) {
25043
      return new global$c(function (resolve, reject) {
25446
        styleSheetLoader.load(stylesheetUrl, resolve, reject);
25044
        styleSheetLoader.load(stylesheetUrl, resolve, reject);
25447
        editor.on('remove', function () {
25045
        editor.on('remove', function () {
25448
          return styleSheetLoader.unload(stylesheetUrl);
25046
          return styleSheetLoader.unload(stylesheetUrl);
25449
        });
25047
        });
25450
      });
25048
      });
Line 25455... Line 25053...
25455
    };
25053
    };
25456
    var loadShadowDomUiSkins = function (editor, skinUrl) {
25054
    var loadShadowDomUiSkins = function (editor, skinUrl) {
25457
      var isInShadowRoot$1 = isInShadowRoot(SugarElement.fromDom(editor.getElement()));
25055
      var isInShadowRoot$1 = isInShadowRoot(SugarElement.fromDom(editor.getElement()));
25458
      if (isInShadowRoot$1) {
25056
      if (isInShadowRoot$1) {
25459
        var shadowDomSkinCss = skinUrl + '/skin.shadowdom.min.css';
25057
        var shadowDomSkinCss = skinUrl + '/skin.shadowdom.min.css';
25460
        return loadStylesheet(editor, shadowDomSkinCss, global$c.DOM.styleSheetLoader);
25058
        return loadStylesheet(editor, shadowDomSkinCss, global$b.DOM.styleSheetLoader);
25461
      } else {
25059
      } else {
25462
        return global$d.resolve();
25060
        return global$c.resolve();
25463
      }
25061
      }
25464
    };
25062
    };
25465
    var loadSkin = function (isInline, editor) {
25063
    var loadSkin = function (isInline, editor) {
25466
      var skinUrl = getSkinUrl(editor);
25064
      var skinUrl = getSkinUrl(editor);
25467
      if (skinUrl) {
25065
      if (skinUrl) {
25468
        editor.contentCSS.push(skinUrl + (isInline ? '/content.inline' : '/content') + '.min.css');
25066
        editor.contentCSS.push(skinUrl + (isInline ? '/content.inline' : '/content') + '.min.css');
25469
      }
25067
      }
25470
      if (isSkinDisabled(editor) === false && isString(skinUrl)) {
25068
      if (isSkinDisabled(editor) === false && isString(skinUrl)) {
25471
        global$d.all([
25069
        global$c.all([
25472
          loadUiSkins(editor, skinUrl),
25070
          loadUiSkins(editor, skinUrl),
25473
          loadShadowDomUiSkins(editor, skinUrl)
25071
          loadShadowDomUiSkins(editor, skinUrl)
25474
        ]).then(fireSkinLoaded(editor), fireSkinLoadError(editor, 'Skin could not be loaded'));
25072
        ]).then(fireSkinLoaded(editor), fireSkinLoadError(editor, 'Skin could not be loaded'));
25475
      } else {
25073
      } else {
25476
        fireSkinLoaded(editor)();
25074
        fireSkinLoaded(editor)();
Line 26315... Line 25913...
26315
      };
25913
      };
26316
      var buttonEvents = __assign(__assign({}, derive$2([runOnAttached(function (component, _simulatedEvent) {
25914
      var buttonEvents = __assign(__assign({}, derive$2([runOnAttached(function (component, _simulatedEvent) {
26317
          var ariaDescriptor = getPart(component, detail, 'aria-descriptor');
25915
          var ariaDescriptor = getPart(component, detail, 'aria-descriptor');
26318
          ariaDescriptor.each(function (descriptor) {
25916
          ariaDescriptor.each(function (descriptor) {
26319
            var descriptorId = generate$6('aria');
25917
            var descriptorId = generate$6('aria');
26320
            set$7(descriptor.element, 'id', descriptorId);
25918
            set$8(descriptor.element, 'id', descriptorId);
26321
            set$7(component.element, 'aria-describedby', descriptorId);
25919
            set$8(component.element, 'aria-describedby', descriptorId);
26322
          });
25920
          });
26323
        })])), events$a(Optional.some(action)));
25921
        })])), events$a(Optional.some(action)));
26324
      var apis = {
25922
      var apis = {
26325
        repositionMenus: function (comp) {
25923
        repositionMenus: function (comp) {
26326
          if (Toggling.isOn(comp)) {
25924
          if (Toggling.isOn(comp)) {
Line 26576... Line 26174...
26576
          setDisabled: function (state) {
26174
          setDisabled: function (state) {
26577
            return Disabling.set(comp, state);
26175
            return Disabling.set(comp, state);
26578
          },
26176
          },
26579
          setIconFill: function (id, value) {
26177
          setIconFill: function (id, value) {
26580
            descendant(comp.element, 'svg path[id="' + id + '"], rect[id="' + id + '"]').each(function (underlinePath) {
26178
            descendant(comp.element, 'svg path[id="' + id + '"], rect[id="' + id + '"]').each(function (underlinePath) {
26581
              set$7(underlinePath, 'fill', value);
26179
              set$8(underlinePath, 'fill', value);
26582
            });
26180
            });
26583
          },
26181
          },
26584
          setIconStroke: function (id, value) {
26182
          setIconStroke: function (id, value) {
26585
            descendant(comp.element, 'svg path[id="' + id + '"], rect[id="' + id + '"]').each(function (underlinePath) {
26183
            descendant(comp.element, 'svg path[id="' + id + '"], rect[id="' + id + '"]').each(function (underlinePath) {
26586
              set$7(underlinePath, 'stroke', value);
26184
              set$8(underlinePath, 'stroke', value);
26587
            });
26185
            });
26588
          },
26186
          },
26589
          setActive: function (state) {
26187
          setActive: function (state) {
26590
            set$7(comp.element, 'aria-pressed', state);
26188
            set$8(comp.element, 'aria-pressed', state);
26591
            descendant(comp.element, 'span').each(function (button) {
26189
            descendant(comp.element, 'span').each(function (button) {
26592
              comp.getSystem().getByDom(button).each(function (buttonComp) {
26190
              comp.getSystem().getByDom(button).each(function (buttonComp) {
26593
                return Toggling.set(buttonComp, state);
26191
                return Toggling.set(buttonComp, state);
26594
              });
26192
              });
26595
            });
26193
            });
Line 26901... Line 26499...
26901
      dom.bind(contentWindow, 'resize', resizeWindow);
26499
      dom.bind(contentWindow, 'resize', resizeWindow);
26902
      dom.bind(contentWindow, 'scroll', scroll);
26500
      dom.bind(contentWindow, 'scroll', scroll);
26903
      var elementLoad = capture(SugarElement.fromDom(editor.getBody()), 'load', resizeDocument);
26501
      var elementLoad = capture(SugarElement.fromDom(editor.getBody()), 'load', resizeDocument);
26904
      var mothership = uiComponents.uiMothership.element;
26502
      var mothership = uiComponents.uiMothership.element;
26905
      editor.on('hide', function () {
26503
      editor.on('hide', function () {
26906
        set$6(mothership, 'display', 'none');
26504
        set$7(mothership, 'display', 'none');
26907
      });
26505
      });
26908
      editor.on('show', function () {
26506
      editor.on('show', function () {
26909
        remove$1(mothership, 'display');
26507
        remove$6(mothership, 'display');
26910
      });
26508
      });
26911
      editor.on('NodeChange', resizeDocument);
26509
      editor.on('NodeChange', resizeDocument);
26912
      editor.on('remove', function () {
26510
      editor.on('remove', function () {
26913
        elementLoad.unbind();
26511
        elementLoad.unbind();
26914
        dom.unbind(contentWindow, 'resize', resizeWindow);
26512
        dom.unbind(contentWindow, 'resize', resizeWindow);
Line 27032... Line 26630...
27032
      return width.getOr(getWidthSetting(editor));
26630
      return width.getOr(getWidthSetting(editor));
27033
    };
26631
    };
27034
 
26632
 
27035
    var InlineHeader = function (editor, targetElm, uiComponents, backstage, floatContainer) {
26633
    var InlineHeader = function (editor, targetElm, uiComponents, backstage, floatContainer) {
27036
      var uiMothership = uiComponents.uiMothership, outerContainer = uiComponents.outerContainer;
26634
      var uiMothership = uiComponents.uiMothership, outerContainer = uiComponents.outerContainer;
27037
      var DOM = global$c.DOM;
26635
      var DOM = global$b.DOM;
27038
      var useFixedToolbarContainer = useFixedContainer(editor);
26636
      var useFixedToolbarContainer = useFixedContainer(editor);
27039
      var isSticky = isStickyToolbar(editor);
26637
      var isSticky = isStickyToolbar(editor);
27040
      var editorMaxWidthOpt = getMaxWidthSetting(editor).or(getWidth(editor));
26638
      var editorMaxWidthOpt = getMaxWidthSetting(editor).or(getWidth(editor));
27041
      var headerBackstage = backstage.shared.header;
26639
      var headerBackstage = backstage.shared.header;
27042
      var isPositionedAtTop = headerBackstage.isPositionedAtTop;
26640
      var isPositionedAtTop = headerBackstage.isPositionedAtTop;
Line 27046... Line 26644...
27046
      var isVisible = function () {
26644
      var isVisible = function () {
27047
        return visible.get() && !editor.removed;
26645
        return visible.get() && !editor.removed;
27048
      };
26646
      };
27049
      var calcToolbarOffset = function (toolbar) {
26647
      var calcToolbarOffset = function (toolbar) {
27050
        return isSplitToolbar ? toolbar.fold(constant$1(0), function (tbar) {
26648
        return isSplitToolbar ? toolbar.fold(constant$1(0), function (tbar) {
27051
          return tbar.components().length > 1 ? get$8(tbar.components()[1].element) : 0;
26649
          return tbar.components().length > 1 ? get$b(tbar.components()[1].element) : 0;
27052
        }) : 0;
26650
        }) : 0;
27053
      };
26651
      };
27054
      var calcMode = function (container) {
26652
      var calcMode = function (container) {
27055
        switch (getToolbarLocation(editor)) {
26653
        switch (getToolbarLocation(editor)) {
27056
        case ToolbarLocation.auto:
26654
        case ToolbarLocation.auto:
27057
          var toolbar_1 = OuterContainer.getToolbar(outerContainer);
26655
          var toolbar_1 = OuterContainer.getToolbar(outerContainer);
27058
          var offset = calcToolbarOffset(toolbar_1);
26656
          var offset = calcToolbarOffset(toolbar_1);
27059
          var toolbarHeight = get$8(container.element) - offset;
26657
          var toolbarHeight = get$b(container.element) - offset;
27060
          var targetBounds = box$1(targetElm);
26658
          var targetBounds = box$1(targetElm);
27061
          var roomAtTop = targetBounds.y > toolbarHeight;
26659
          var roomAtTop = targetBounds.y > toolbarHeight;
27062
          if (roomAtTop) {
26660
          if (roomAtTop) {
27063
            return 'top';
26661
            return 'top';
27064
          } else {
26662
          } else {
27065
            var doc = documentElement(targetElm);
26663
            var doc = documentElement(targetElm);
27066
            var docHeight = Math.max(doc.dom.scrollHeight, get$8(doc));
26664
            var docHeight = Math.max(doc.dom.scrollHeight, get$b(doc));
27067
            var roomAtBottom = targetBounds.bottom < docHeight - toolbarHeight;
26665
            var roomAtBottom = targetBounds.bottom < docHeight - toolbarHeight;
27068
            if (roomAtBottom) {
26666
            if (roomAtBottom) {
27069
              return 'bottom';
26667
              return 'bottom';
27070
            } else {
26668
            } else {
27071
              var winBounds = win();
26669
              var winBounds = win();
Line 27083... Line 26681...
27083
      var setupMode = function (mode) {
26681
      var setupMode = function (mode) {
27084
        var container = floatContainer.get();
26682
        var container = floatContainer.get();
27085
        Docking.setModes(container, [mode]);
26683
        Docking.setModes(container, [mode]);
27086
        headerBackstage.setDockingMode(mode);
26684
        headerBackstage.setDockingMode(mode);
27087
        var verticalDir = isPositionedAtTop() ? AttributeValue.TopToBottom : AttributeValue.BottomToTop;
26685
        var verticalDir = isPositionedAtTop() ? AttributeValue.TopToBottom : AttributeValue.BottomToTop;
27088
        set$7(container.element, Attribute, verticalDir);
26686
        set$8(container.element, Attribute, verticalDir);
27089
      };
26687
      };
27090
      var updateChromeWidth = function () {
26688
      var updateChromeWidth = function () {
27091
        var maxWidth = editorMaxWidthOpt.getOrThunk(function () {
26689
        var maxWidth = editorMaxWidthOpt.getOrThunk(function () {
27092
          var bodyMargin = parseToInt(get$a(body(), 'margin-left')).getOr(0);
26690
          var bodyMargin = parseToInt(get$c(body(), 'margin-left')).getOr(0);
27093
          return get$7(body()) - absolute$3(targetElm).left + bodyMargin;
26691
          return get$a(body()) - absolute$3(targetElm).left + bodyMargin;
27094
        });
26692
        });
27095
        set$6(floatContainer.get().element, 'max-width', maxWidth + 'px');
26693
        set$7(floatContainer.get().element, 'max-width', maxWidth + 'px');
27096
      };
26694
      };
27097
      var updateChromePosition = function () {
26695
      var updateChromePosition = function () {
27098
        var toolbar = OuterContainer.getToolbar(outerContainer);
26696
        var toolbar = OuterContainer.getToolbar(outerContainer);
27099
        var offset = calcToolbarOffset(toolbar);
26697
        var offset = calcToolbarOffset(toolbar);
27100
        var targetBounds = box$1(targetElm);
26698
        var targetBounds = box$1(targetElm);
27101
        var top = isPositionedAtTop() ? Math.max(targetBounds.y - get$8(floatContainer.get().element) + offset, 0) : targetBounds.bottom;
26699
        var top = isPositionedAtTop() ? Math.max(targetBounds.y - get$b(floatContainer.get().element) + offset, 0) : targetBounds.bottom;
27102
        setAll(outerContainer.element, {
26700
        setAll(outerContainer.element, {
27103
          position: 'absolute',
26701
          position: 'absolute',
27104
          top: Math.round(top) + 'px',
26702
          top: Math.round(top) + 'px',
27105
          left: Math.round(targetBounds.x) + 'px'
26703
          left: Math.round(targetBounds.x) + 'px'
27106
        });
26704
        });
Line 27146... Line 26744...
27146
          }
26744
          }
27147
        }
26745
        }
27148
      };
26746
      };
27149
      var show = function () {
26747
      var show = function () {
27150
        visible.set(true);
26748
        visible.set(true);
27151
        set$6(outerContainer.element, 'display', 'flex');
26749
        set$7(outerContainer.element, 'display', 'flex');
27152
        DOM.addClass(editor.getBody(), 'mce-edit-focus');
26750
        DOM.addClass(editor.getBody(), 'mce-edit-focus');
27153
        remove$1(uiMothership.element, 'display');
26751
        remove$6(uiMothership.element, 'display');
27154
        updateMode(false);
26752
        updateMode(false);
27155
        updateChromeUi();
26753
        updateChromeUi();
27156
      };
26754
      };
27157
      var hide = function () {
26755
      var hide = function () {
27158
        visible.set(false);
26756
        visible.set(false);
27159
        if (uiComponents.outerContainer) {
26757
        if (uiComponents.outerContainer) {
27160
          set$6(outerContainer.element, 'display', 'none');
26758
          set$7(outerContainer.element, 'display', 'none');
27161
          DOM.removeClass(editor.getBody(), 'mce-edit-focus');
26759
          DOM.removeClass(editor.getBody(), 'mce-edit-focus');
27162
        }
26760
        }
27163
        set$6(uiMothership.element, 'display', 'none');
26761
        set$7(uiMothership.element, 'display', 'none');
27164
      };
26762
      };
27165
      return {
26763
      return {
27166
        isVisible: isVisible,
26764
        isVisible: isVisible,
27167
        isPositionedAtTop: isPositionedAtTop,
26765
        isPositionedAtTop: isPositionedAtTop,
27168
        show: show,
26766
        show: show,
Line 27208... Line 26806...
27208
      }
26806
      }
27209
      editor.on('SkinLoaded ResizeWindow', function () {
26807
      editor.on('SkinLoaded ResizeWindow', function () {
27210
        return ui.update(true);
26808
        return ui.update(true);
27211
      });
26809
      });
27212
      editor.on('NodeChange keydown', function (e) {
26810
      editor.on('NodeChange keydown', function (e) {
27213
        global$g.requestAnimationFrame(function () {
26811
        global$f.requestAnimationFrame(function () {
27214
          return resizeContent(e);
26812
          return resizeContent(e);
27215
        });
26813
        });
27216
      });
26814
      });
27217
      editor.on('ScrollWindow', function () {
26815
      editor.on('ScrollWindow', function () {
27218
        return ui.updateMode();
26816
        return ui.updateMode();
Line 27244... Line 26842...
27244
        ui.show();
26842
        ui.show();
27245
        setupEvents(editor, targetElm, ui, toolbarPersist);
26843
        setupEvents(editor, targetElm, ui, toolbarPersist);
27246
        editor.nodeChanged();
26844
        editor.nodeChanged();
27247
      };
26845
      };
27248
      var delayedRender = function () {
26846
      var delayedRender = function () {
27249
        return global$g.setEditorTimeout(editor, render, 0);
26847
        return global$f.setEditorTimeout(editor, render, 0);
27250
      };
26848
      };
27251
      editor.on('show', render);
26849
      editor.on('show', render);
27252
      editor.on('hide', ui.hide);
26850
      editor.on('hide', ui.hide);
27253
      if (!toolbarPersist) {
26851
      if (!toolbarPersist) {
27254
        editor.on('focus', delayedRender);
26852
        editor.on('focus', delayedRender);
Line 27437... Line 27035...
27437
    };
27035
    };
27438
    var getSelectionBounds = function (editor) {
27036
    var getSelectionBounds = function (editor) {
27439
      var rng = editor.selection.getRng();
27037
      var rng = editor.selection.getRng();
27440
      var rect = getRangeRect(rng);
27038
      var rect = getRangeRect(rng);
27441
      if (editor.inline) {
27039
      if (editor.inline) {
27442
        var scroll_1 = get$6();
27040
        var scroll_1 = get$9();
27443
        return bounds(scroll_1.left + rect.left, scroll_1.top + rect.top, rect.width, rect.height);
27041
        return bounds(scroll_1.left + rect.left, scroll_1.top + rect.top, rect.width, rect.height);
27444
      } else {
27042
      } else {
27445
        var bodyPos = absolute$2(SugarElement.fromDom(editor.getBody()));
27043
        var bodyPos = absolute$2(SugarElement.fromDom(editor.getBody()));
27446
        return bounds(bodyPos.x + rect.left, bodyPos.y + rect.top, rect.width, rect.height);
27044
        return bounds(bodyPos.x + rect.left, bodyPos.y + rect.top, rect.width, rect.height);
27447
      }
27045
      }
Line 27527... Line 27125...
27527
      var leaf$1 = leaf(SugarElement.fromDom(rng.startContainer), rng.startOffset);
27125
      var leaf$1 = leaf(SugarElement.fromDom(rng.startContainer), rng.startOffset);
27528
      return rng.startContainer === rng.endContainer && rng.startOffset === rng.endOffset - 1 && eq(leaf$1.element, elem);
27126
      return rng.startContainer === rng.endContainer && rng.startOffset === rng.endOffset - 1 && eq(leaf$1.element, elem);
27529
    };
27127
    };
27530
    var preservePosition = function (elem, position, f) {
27128
    var preservePosition = function (elem, position, f) {
27531
      var currentPosition = getRaw(elem, 'position');
27129
      var currentPosition = getRaw(elem, 'position');
27532
      set$6(elem, 'position', position);
27130
      set$7(elem, 'position', position);
27533
      var result = f(elem);
27131
      var result = f(elem);
27534
      currentPosition.each(function (pos) {
27132
      currentPosition.each(function (pos) {
27535
        return set$6(elem, 'position', pos);
27133
        return set$7(elem, 'position', pos);
27536
      });
27134
      });
27537
      return result;
27135
      return result;
27538
    };
27136
    };
27539
    var shouldUseInsetLayouts = function (position) {
27137
    var shouldUseInsetLayouts = function (position) {
27540
      return position === 'node';
27138
      return position === 'node';
Line 27550... Line 27148...
27550
        return preservePosition(contextbar, data.getMode(), function () {
27148
        return preservePosition(contextbar, data.getMode(), function () {
27551
          var isOverlapping = isVerticalOverlap(selectionBounds, box$1(contextbar));
27149
          var isOverlapping = isVerticalOverlap(selectionBounds, box$1(contextbar));
27552
          return isOverlapping && !data.isReposition() ? flip$2 : preserve;
27150
          return isOverlapping && !data.isReposition() ? flip$2 : preserve;
27553
        });
27151
        });
27554
      } else {
27152
      } else {
27555
        var yBounds = data.getMode() === 'fixed' ? bounds.y + get$6().top : bounds.y;
27153
        var yBounds = data.getMode() === 'fixed' ? bounds.y + get$9().top : bounds.y;
27556
        var contextbarHeight = get$8(contextbar) + bubbleSize$1;
27154
        var contextbarHeight = get$b(contextbar) + bubbleSize$1;
27557
        return yBounds + contextbarHeight <= selectionBounds.y ? north : south;
27155
        return yBounds + contextbarHeight <= selectionBounds.y ? north : south;
27558
      }
27156
      }
27559
    };
27157
    };
27560
    var getAnchorSpec$2 = function (editor, mobile, data, position) {
27158
    var getAnchorSpec$2 = function (editor, mobile, data, position) {
27561
      var smartInsetLayout = function (elem) {
27159
      var smartInsetLayout = function (elem) {
Line 27833... Line 27431...
27833
        },
27431
        },
27834
        fireDismissalEventInstead: { event: 'doNotDismissYet' },
27432
        fireDismissalEventInstead: { event: 'doNotDismissYet' },
27835
        onShow: function (comp) {
27433
        onShow: function (comp) {
27836
          stack.set([]);
27434
          stack.set([]);
27837
          InlineView.getContent(comp).each(function (c) {
27435
          InlineView.getContent(comp).each(function (c) {
27838
            remove$1(c.element, 'visibility');
27436
            remove$6(c.element, 'visibility');
27839
          });
27437
          });
27840
          remove$3(comp.element, resizingClass);
27438
          remove$2(comp.element, resizingClass);
27841
          remove$1(comp.element, 'width');
27439
          remove$6(comp.element, 'width');
27842
        },
27440
        },
27843
        inlineBehaviours: derive$1([
27441
        inlineBehaviours: derive$1([
27844
          config('context-toolbar-events', [
27442
          config('context-toolbar-events', [
27845
            runOnSource(transitionend(), function (comp, se) {
27443
            runOnSource(transitionend(), function (comp, se) {
27846
              if (se.event.raw.propertyName === 'width') {
27444
              if (se.event.raw.propertyName === 'width') {
27847
                remove$3(comp.element, resizingClass);
27445
                remove$2(comp.element, resizingClass);
27848
                remove$1(comp.element, 'width');
27446
                remove$6(comp.element, 'width');
27849
              }
27447
              }
27850
            }),
27448
            }),
27851
            run$1(changeSlideEvent, function (comp, se) {
27449
            run$1(changeSlideEvent, function (comp, se) {
27852
              var elem = comp.element;
27450
              var elem = comp.element;
27853
              remove$1(elem, 'width');
27451
              remove$6(elem, 'width');
27854
              var currentWidth = get$7(elem);
27452
              var currentWidth = get$a(elem);
27855
              InlineView.setContent(comp, se.event.contents);
27453
              InlineView.setContent(comp, se.event.contents);
27856
              add$2(elem, resizingClass);
27454
              add$2(elem, resizingClass);
27857
              var newWidth = get$7(elem);
27455
              var newWidth = get$a(elem);
27858
              set$6(elem, 'width', currentWidth + 'px');
27456
              set$7(elem, 'width', currentWidth + 'px');
27859
              InlineView.getContent(comp).each(function (newContents) {
27457
              InlineView.getContent(comp).each(function (newContents) {
27860
                se.event.focus.bind(function (f) {
27458
                se.event.focus.bind(function (f) {
27861
                  focus$3(f);
27459
                  focus$3(f);
27862
                  return search(elem);
27460
                  return search(elem);
27863
                }).orThunk(function () {
27461
                }).orThunk(function () {
27864
                  Keying.focusIn(newContents);
27462
                  Keying.focusIn(newContents);
27865
                  return active(getRootNode(elem));
27463
                  return active(getRootNode(elem));
27866
                });
27464
                });
27867
              });
27465
              });
27868
              global$g.setTimeout(function () {
27466
              global$f.setTimeout(function () {
27869
                set$6(comp.element, 'width', newWidth + 'px');
27467
                set$7(comp.element, 'width', newWidth + 'px');
27870
              }, 0);
27468
              }, 0);
27871
            }),
27469
            }),
27872
            run$1(forwardSlideEvent, function (comp, se) {
27470
            run$1(forwardSlideEvent, function (comp, se) {
27873
              InlineView.getContent(comp).each(function (oldContents) {
27471
              InlineView.getContent(comp).each(function (oldContents) {
27874
                stack.set(stack.get().concat([{
27472
                stack.set(stack.get().concat([{
Line 27931... Line 27529...
27931
      };
27529
      };
27932
      var canLaunchToolbar = function () {
27530
      var canLaunchToolbar = function () {
27933
        return !editor.removed && !(isTouch() && backstage.isContextMenuOpen());
27531
        return !editor.removed && !(isTouch() && backstage.isContextMenuOpen());
27934
      };
27532
      };
27935
      var isSameLaunchElement = function (elem) {
27533
      var isSameLaunchElement = function (elem) {
27936
        return is(lift2(elem, lastElement.get(), eq), true);
27534
        return is$1(lift2(elem, lastElement.get(), eq), true);
27937
      };
27535
      };
27938
      var shouldContextToolbarHide = function () {
27536
      var shouldContextToolbarHide = function () {
27939
        if (!canLaunchToolbar()) {
27537
        if (!canLaunchToolbar()) {
27940
          return true;
27538
          return true;
27941
        } else {
27539
        } else {
27942
          var contextToolbarBounds = getBounds();
27540
          var contextToolbarBounds = getBounds();
27943
          var anchorBounds = is(lastContextPosition.get(), 'node') ? getAnchorElementBounds(editor, lastElement.get()) : getSelectionBounds(editor);
27541
          var anchorBounds = is$1(lastContextPosition.get(), 'node') ? getAnchorElementBounds(editor, lastElement.get()) : getSelectionBounds(editor);
27944
          return contextToolbarBounds.height <= 0 || !isVerticalOverlap(anchorBounds, contextToolbarBounds);
27542
          return contextToolbarBounds.height <= 0 || !isVerticalOverlap(anchorBounds, contextToolbarBounds);
27945
        }
27543
        }
27946
      };
27544
      };
27947
      var close = function () {
27545
      var close = function () {
27948
        lastElement.clear();
27546
        lastElement.clear();
Line 27951... Line 27549...
27951
        InlineView.hide(contextbar);
27549
        InlineView.hide(contextbar);
27952
      };
27550
      };
27953
      var hideOrRepositionIfNecessary = function () {
27551
      var hideOrRepositionIfNecessary = function () {
27954
        if (InlineView.isOpen(contextbar)) {
27552
        if (InlineView.isOpen(contextbar)) {
27955
          var contextBarEle = contextbar.element;
27553
          var contextBarEle = contextbar.element;
27956
          remove$1(contextBarEle, 'display');
27554
          remove$6(contextBarEle, 'display');
27957
          if (shouldContextToolbarHide()) {
27555
          if (shouldContextToolbarHide()) {
27958
            set$6(contextBarEle, 'display', 'none');
27556
            set$7(contextBarEle, 'display', 'none');
27959
          } else {
27557
          } else {
27960
            lastTrigger.set(0);
27558
            lastTrigger.set(0);
27961
            InlineView.reposition(contextbar);
27559
            InlineView.reposition(contextbar);
27962
          }
27560
          }
27963
        }
27561
        }
Line 28020... Line 27618...
28020
      var getAnchor = function (position, element) {
27618
      var getAnchor = function (position, element) {
28021
        var anchorage = position === 'node' ? sharedBackstage.anchors.node(element) : sharedBackstage.anchors.cursor();
27619
        var anchorage = position === 'node' ? sharedBackstage.anchors.node(element) : sharedBackstage.anchors.cursor();
28022
        var anchorLayout = getAnchorLayout(editor, position, isTouch(), {
27620
        var anchorLayout = getAnchorLayout(editor, position, isTouch(), {
28023
          lastElement: lastElement.get,
27621
          lastElement: lastElement.get,
28024
          isReposition: function () {
27622
          isReposition: function () {
28025
            return is(lastTrigger.get(), 0);
27623
            return is$1(lastTrigger.get(), 0);
28026
          },
27624
          },
28027
          getMode: function () {
27625
          getMode: function () {
28028
            return Positioning.getMode(sink);
27626
            return Positioning.getMode(sink);
28029
          }
27627
          }
28030
        });
27628
        });
Line 28039... Line 27637...
28039
        var position = toolbarApi[0].position;
27637
        var position = toolbarApi[0].position;
28040
        var anchor = getAnchor(position, elem);
27638
        var anchor = getAnchor(position, elem);
28041
        lastContextPosition.set(position);
27639
        lastContextPosition.set(position);
28042
        lastTrigger.set(1);
27640
        lastTrigger.set(1);
28043
        var contextBarEle = contextbar.element;
27641
        var contextBarEle = contextbar.element;
28044
        remove$1(contextBarEle, 'display');
27642
        remove$6(contextBarEle, 'display');
28045
        if (!isSameLaunchElement(elem)) {
27643
        if (!isSameLaunchElement(elem)) {
28046
          remove$3(contextBarEle, transitionClass);
27644
          remove$2(contextBarEle, transitionClass);
28047
          Positioning.reset(sink, contextbar);
27645
          Positioning.reset(sink, contextbar);
28048
        }
27646
        }
28049
        InlineView.showWithinBounds(contextbar, wrapInPopDialog(toolbarSpec), {
27647
        InlineView.showWithinBounds(contextbar, wrapInPopDialog(toolbarSpec), {
28050
          anchor: anchor,
27648
          anchor: anchor,
28051
          transition: {
27649
          transition: {
Line 28055... Line 27653...
28055
        }, function () {
27653
        }, function () {
28056
          return Optional.some(getBounds());
27654
          return Optional.some(getBounds());
28057
        });
27655
        });
28058
        elem.fold(lastElement.clear, lastElement.set);
27656
        elem.fold(lastElement.clear, lastElement.set);
28059
        if (shouldContextToolbarHide()) {
27657
        if (shouldContextToolbarHide()) {
28060
          set$6(contextBarEle, 'display', 'none');
27658
          set$7(contextBarEle, 'display', 'none');
28061
        }
27659
        }
28062
      };
27660
      };
28063
      var launchContextToolbar = last(function () {
27661
      var launchContextToolbar = last(function () {
28064
        if (!editor.hasFocus() || editor.removed) {
27662
        if (!editor.hasFocus() || editor.removed) {
28065
          return;
27663
          return;
Line 28084... Line 27682...
28084
            launchContext([ctx], someIf(e.target !== editor, e.target));
27682
            launchContext([ctx], someIf(e.target !== editor, e.target));
28085
            InlineView.getContent(contextbar).each(Keying.focusIn);
27683
            InlineView.getContent(contextbar).each(Keying.focusIn);
28086
          });
27684
          });
28087
        });
27685
        });
28088
        editor.on('focusout', function (_e) {
27686
        editor.on('focusout', function (_e) {
28089
          global$g.setEditorTimeout(editor, function () {
27687
          global$f.setEditorTimeout(editor, function () {
28090
            if (search(sink.element).isNone() && search(contextbar.element).isNone()) {
27688
            if (search(sink.element).isNone() && search(contextbar.element).isNone()) {
28091
              close();
27689
              close();
28092
            }
27690
            }
28093
          }, 0);
27691
          }, 0);
28094
        });
27692
        });
Line 28246... Line 27844...
28246
                  });
27844
                  });
28247
                  current.set(api);
27845
                  current.set(api);
28248
                }
27846
                }
28249
                api.setActive(active);
27847
                api.setActive(active);
28250
              };
27848
              };
28251
              setActive(is(initial, spec.hash(value)));
27849
              setActive(is$1(initial, spec.hash(value)));
28252
              var unbindWatcher = spec.watcher(editor, value, setActive);
27850
              var unbindWatcher = spec.watcher(editor, value, setActive);
28253
              return function () {
27851
              return function () {
28254
                current.clear();
27852
                current.clear();
28255
                unbindWatcher();
27853
                unbindWatcher();
28256
              };
27854
              };
Line 28388... Line 27986...
28388
      return function () {
27986
      return function () {
28389
        editor.execCommand('mceToggleFormat', false, fmt);
27987
        editor.execCommand('mceToggleFormat', false, fmt);
28390
      };
27988
      };
28391
    };
27989
    };
28392
    var registerFormatButtons = function (editor) {
27990
    var registerFormatButtons = function (editor) {
28393
      global$6.each([
27991
      global$5.each([
28394
        {
27992
        {
28395
          name: 'bold',
27993
          name: 'bold',
28396
          text: 'Bold',
27994
          text: 'Bold',
28397
          icon: 'bold'
27995
          icon: 'bold'
28398
        },
27996
        },
Line 28438... Line 28036...
28438
          onAction: onActionToggleFormat(editor, name_1)
28036
          onAction: onActionToggleFormat(editor, name_1)
28439
        });
28037
        });
28440
      }
28038
      }
28441
    };
28039
    };
28442
    var registerCommandButtons = function (editor) {
28040
    var registerCommandButtons = function (editor) {
28443
      global$6.each([
28041
      global$5.each([
28444
        {
28042
        {
28445
          name: 'cut',
28043
          name: 'cut',
28446
          text: 'Cut',
28044
          text: 'Cut',
28447
          action: 'Cut',
28045
          action: 'Cut',
28448
          icon: 'cut'
28046
          icon: 'cut'
Line 28496... Line 28094...
28496
          onAction: onActionExecCommand(editor, btn.action)
28094
          onAction: onActionExecCommand(editor, btn.action)
28497
        });
28095
        });
28498
      });
28096
      });
28499
    };
28097
    };
28500
    var registerCommandToggleButtons = function (editor) {
28098
    var registerCommandToggleButtons = function (editor) {
28501
      global$6.each([{
28099
      global$5.each([{
28502
          name: 'blockquote',
28100
          name: 'blockquote',
28503
          text: 'Blockquote',
28101
          text: 'Blockquote',
28504
          action: 'mceBlockQuote',
28102
          action: 'mceBlockQuote',
28505
          icon: 'quote'
28103
          icon: 'quote'
28506
        }], function (btn) {
28104
        }], function (btn) {
Line 28516... Line 28114...
28516
      registerFormatButtons(editor);
28114
      registerFormatButtons(editor);
28517
      registerCommandButtons(editor);
28115
      registerCommandButtons(editor);
28518
      registerCommandToggleButtons(editor);
28116
      registerCommandToggleButtons(editor);
28519
    };
28117
    };
28520
    var registerMenuItems$2 = function (editor) {
28118
    var registerMenuItems$2 = function (editor) {
28521
      global$6.each([
28119
      global$5.each([
28522
        {
28120
        {
28523
          name: 'bold',
28121
          name: 'bold',
28524
          text: 'Bold',
28122
          text: 'Bold',
28525
          action: 'Bold',
28123
          action: 'Bold',
28526
          icon: 'bold',
28124
          icon: 'bold',
Line 28727... Line 28325...
28727
      } else {
28325
      } else {
28728
        return nu(e.clientX, e.clientY);
28326
        return nu(e.clientX, e.clientY);
28729
      }
28327
      }
28730
    };
28328
    };
28731
    var transposeContentAreaContainer = function (element, pos) {
28329
    var transposeContentAreaContainer = function (element, pos) {
28732
      var containerPos = global$c.DOM.getPos(element);
28330
      var containerPos = global$b.DOM.getPos(element);
28733
      return transpose(pos, containerPos.x, containerPos.y);
28331
      return transpose(pos, containerPos.x, containerPos.y);
28734
    };
28332
    };
28735
    var getPointAnchor = function (editor, e) {
28333
    var getPointAnchor = function (editor, e) {
28736
      if (e.type === 'contextmenu' || e.type === 'longpress') {
28334
      if (e.type === 'contextmenu' || e.type === 'longpress') {
28737
        if (editor.inline) {
28335
        if (editor.inline) {
Line 28838... Line 28436...
28838
      }
28436
      }
28839
    };
28437
    };
28840
    var setupiOSOverrides = function (editor) {
28438
    var setupiOSOverrides = function (editor) {
28841
      var originalSelection = editor.selection.getRng();
28439
      var originalSelection = editor.selection.getRng();
28842
      var selectionReset = function () {
28440
      var selectionReset = function () {
28843
        global$g.setEditorTimeout(editor, function () {
28441
        global$f.setEditorTimeout(editor, function () {
28844
          editor.selection.setRng(originalSelection);
28442
          editor.selection.setRng(originalSelection);
28845
        }, 10);
28443
        }, 10);
28846
        unbindEventListeners();
28444
        unbindEventListeners();
28847
      };
28445
      };
28848
      editor.once('touchend', selectionReset);
28446
      editor.once('touchend', selectionReset);
Line 29193... Line 28791...
29193
    var offset = adt.offset;
28791
    var offset = adt.offset;
29194
    var absolute = adt.absolute;
28792
    var absolute = adt.absolute;
29195
    var fixed = adt.fixed;
28793
    var fixed = adt.fixed;
29196
 
28794
 
29197
    var parseAttrToInt = function (element, name) {
28795
    var parseAttrToInt = function (element, name) {
29198
      var value = get$c(element, name);
28796
      var value = get$d(element, name);
29199
      return isUndefined(value) ? NaN : parseInt(value, 10);
28797
      return isUndefined(value) ? NaN : parseInt(value, 10);
29200
    };
28798
    };
29201
    var get = function (component, snapsInfo) {
28799
    var get = function (component, snapsInfo) {
29202
      var element = component.element;
28800
      var element = component.element;
29203
      var x = parseAttrToInt(element, snapsInfo.leftAttr);
28801
      var x = parseAttrToInt(element, snapsInfo.leftAttr);
29204
      var y = parseAttrToInt(element, snapsInfo.topAttr);
28802
      var y = parseAttrToInt(element, snapsInfo.topAttr);
29205
      return isNaN(x) || isNaN(y) ? Optional.none() : Optional.some(SugarPosition(x, y));
28803
      return isNaN(x) || isNaN(y) ? Optional.none() : Optional.some(SugarPosition(x, y));
29206
    };
28804
    };
29207
    var set = function (component, snapsInfo, pt) {
28805
    var set = function (component, snapsInfo, pt) {
29208
      var element = component.element;
28806
      var element = component.element;
29209
      set$7(element, snapsInfo.leftAttr, pt.left + 'px');
28807
      set$8(element, snapsInfo.leftAttr, pt.left + 'px');
29210
      set$7(element, snapsInfo.topAttr, pt.top + 'px');
28808
      set$8(element, snapsInfo.topAttr, pt.top + 'px');
29211
    };
28809
    };
29212
    var clear = function (component, snapsInfo) {
28810
    var clear = function (component, snapsInfo) {
29213
      var element = component.element;
28811
      var element = component.element;
29214
      remove$6(element, snapsInfo.leftAttr);
28812
      remove$7(element, snapsInfo.leftAttr);
29215
      remove$6(element, snapsInfo.topAttr);
28813
      remove$7(element, snapsInfo.topAttr);
29216
    };
28814
    };
29217
 
28815
 
29218
    var getCoords = function (component, snapInfo, coord, delta) {
28816
    var getCoords = function (component, snapInfo, coord, delta) {
29219
      return get(component, snapInfo).fold(function () {
28817
      return get(component, snapInfo).fold(function () {
29220
        return coord;
28818
        return coord;
Line 29301... Line 28899...
29301
 
28899
 
29302
    var snapTo = function (component, dragConfig, _state, snap) {
28900
    var snapTo = function (component, dragConfig, _state, snap) {
29303
      var target = dragConfig.getTarget(component.element);
28901
      var target = dragConfig.getTarget(component.element);
29304
      if (dragConfig.repositionTarget) {
28902
      if (dragConfig.repositionTarget) {
29305
        var doc = owner$4(component.element);
28903
        var doc = owner$4(component.element);
29306
        var scroll_1 = get$6(doc);
28904
        var scroll_1 = get$9(doc);
29307
        var origin_1 = getOrigin(target);
28905
        var origin_1 = getOrigin(target);
29308
        var snapPin = snapTo$1(snap, scroll_1, origin_1);
28906
        var snapPin = snapTo$1(snap, scroll_1, origin_1);
29309
        var styles = toStyles(snapPin.coord, scroll_1, origin_1);
28907
        var styles = toStyles(snapPin.coord, scroll_1, origin_1);
29310
        setOptions(target, styles);
28908
        setOptions(target, styles);
29311
      }
28909
      }
Line 29318... Line 28916...
29318
 
28916
 
29319
    var initialAttribute = 'data-initial-z-index';
28917
    var initialAttribute = 'data-initial-z-index';
29320
    var resetZIndex = function (blocker) {
28918
    var resetZIndex = function (blocker) {
29321
      parent(blocker.element).filter(isElement$2).each(function (root) {
28919
      parent(blocker.element).filter(isElement$2).each(function (root) {
29322
        getOpt(root, initialAttribute).fold(function () {
28920
        getOpt(root, initialAttribute).fold(function () {
29323
          return remove$1(root, 'z-index');
28921
          return remove$6(root, 'z-index');
29324
        }, function (zIndex) {
28922
        }, function (zIndex) {
29325
          return set$6(root, 'z-index', zIndex);
28923
          return set$7(root, 'z-index', zIndex);
29326
        });
28924
        });
29327
        remove$6(root, initialAttribute);
28925
        remove$7(root, initialAttribute);
29328
      });
28926
      });
29329
    };
28927
    };
29330
    var changeZIndex = function (blocker) {
28928
    var changeZIndex = function (blocker) {
29331
      parent(blocker.element).filter(isElement$2).each(function (root) {
28929
      parent(blocker.element).filter(isElement$2).each(function (root) {
29332
        getRaw(root, 'z-index').each(function (zindex) {
28930
        getRaw(root, 'z-index').each(function (zindex) {
29333
          set$7(root, initialAttribute, zindex);
28931
          set$8(root, initialAttribute, zindex);
29334
        });
28932
        });
29335
        set$6(root, 'z-index', get$a(blocker.element, 'z-index'));
28933
        set$7(root, 'z-index', get$c(blocker.element, 'z-index'));
29336
      });
28934
      });
29337
    };
28935
    };
29338
    var instigate = function (anyComponent, blocker) {
28936
    var instigate = function (anyComponent, blocker) {
29339
      anyComponent.getSystem().addToGui(blocker);
28937
      anyComponent.getSystem().addToGui(blocker);
29340
      changeZIndex(blocker);
28938
      changeZIndex(blocker);
Line 29419... Line 29017...
29419
    };
29017
    };
29420
    var dragBy = function (component, dragConfig, startData, delta) {
29018
    var dragBy = function (component, dragConfig, startData, delta) {
29421
      var target = dragConfig.getTarget(component.element);
29019
      var target = dragConfig.getTarget(component.element);
29422
      if (dragConfig.repositionTarget) {
29020
      if (dragConfig.repositionTarget) {
29423
        var doc = owner$4(component.element);
29021
        var doc = owner$4(component.element);
29424
        var scroll_1 = get$6(doc);
29022
        var scroll_1 = get$9(doc);
29425
        var origin_1 = getOrigin(target);
29023
        var origin_1 = getOrigin(target);
29426
        var currentCoord = getCurrentCoord(target);
29024
        var currentCoord = getCurrentCoord(target);
29427
        var newCoord = calcNewCoord(component, dragConfig.snaps, currentCoord, scroll_1, origin_1, delta, startData);
29025
        var newCoord = calcNewCoord(component, dragConfig.snaps, currentCoord, scroll_1, origin_1, delta, startData);
29428
        var styles = toStyles(newCoord, scroll_1, origin_1);
29026
        var styles = toStyles(newCoord, scroll_1, origin_1);
29429
        setOptions(target, styles);
29027
        setOptions(target, styles);
Line 29432... Line 29030...
29432
    };
29030
    };
29433
 
29031
 
29434
    var calcStartData = function (dragConfig, comp) {
29032
    var calcStartData = function (dragConfig, comp) {
29435
      return {
29033
      return {
29436
        bounds: dragConfig.getBounds(),
29034
        bounds: dragConfig.getBounds(),
29437
        height: getOuter$1(comp.element),
29035
        height: getOuter$2(comp.element),
29438
        width: getOuter(comp.element)
29036
        width: getOuter$1(comp.element)
29439
      };
29037
      };
29440
    };
29038
    };
29441
    var move = function (component, dragConfig, dragState, dragMode, event) {
29039
    var move = function (component, dragConfig, dragState, dragMode, event) {
29442
      var delta = dragState.update(dragMode, event);
29040
      var delta = dragState.update(dragMode, event);
29443
      var dragStartData = dragState.getStartData().getOrThunk(function () {
29041
      var dragStartData = dragState.getStartData().getOrThunk(function () {
Line 29463... Line 29061...
29463
        };
29061
        };
29464
        return derive$2(__spreadArray([run$1(windowScroll(), function (comp) {
29062
        return derive$2(__spreadArray([run$1(windowScroll(), function (comp) {
29465
            dragState.getStartData().each(function () {
29063
            dragState.getStartData().each(function () {
29466
              return updateStartState(comp);
29064
              return updateStartState(comp);
29467
            });
29065
            });
29468
          })], events(dragConfig, dragState, updateStartState)));
29066
          })], events(dragConfig, dragState, updateStartState), true));
29469
      };
29067
      };
29470
    };
29068
    };
29471
 
29069
 
29472
    var init$2 = function (dragApi) {
29070
    var init$2 = function (dragApi) {
29473
      return derive$2([
29071
      return derive$2([
Line 29519... Line 29117...
29519
            instigate(component, blocker);
29117
            instigate(component, blocker);
29520
          };
29118
          };
29521
          start();
29119
          start();
29522
        })];
29120
        })];
29523
    };
29121
    };
29524
    var schema$5 = __spreadArray(__spreadArray([], schema$6), [output$1('dragger', { handlers: handlers(events$2) })]);
29122
    var schema$5 = __spreadArray(__spreadArray([], schema$6, true), [output$1('dragger', { handlers: handlers(events$2) })], false);
29525
 
29123
 
29526
    var init$1 = function (dragApi) {
29124
    var init$1 = function (dragApi) {
29527
      return derive$2([
29125
      return derive$2([
29528
        run$1(touchstart(), dragApi.forceDrop),
29126
        run$1(touchstart(), dragApi.forceDrop),
29529
        run$1(touchend(), dragApi.drop),
29127
        run$1(touchend(), dragApi.drop),
Line 29590... Line 29188...
29590
          stopBlocking(component);
29188
          stopBlocking(component);
29591
        }),
29189
        }),
29592
        run$1(touchcancel(), stopBlocking)
29190
        run$1(touchcancel(), stopBlocking)
29593
      ];
29191
      ];
29594
    };
29192
    };
29595
    var schema$4 = __spreadArray(__spreadArray([], schema$6), [output$1('dragger', { handlers: handlers(events$1) })]);
29193
    var schema$4 = __spreadArray(__spreadArray([], schema$6, true), [output$1('dragger', { handlers: handlers(events$1) })], false);
29596
 
29194
 
29597
    var events = function (dragConfig, dragState, updateStartState) {
29195
    var events = function (dragConfig, dragState, updateStartState) {
29598
      return __spreadArray(__spreadArray([], events$2(dragConfig, dragState, updateStartState)), events$1(dragConfig, dragState, updateStartState));
29196
      return __spreadArray(__spreadArray([], events$2(dragConfig, dragState, updateStartState), true), events$1(dragConfig, dragState, updateStartState), true);
29599
    };
29197
    };
29600
    var schema$3 = __spreadArray(__spreadArray([], schema$6), [output$1('dragger', { handlers: handlers(events) })]);
29198
    var schema$3 = __spreadArray(__spreadArray([], schema$6, true), [output$1('dragger', { handlers: handlers(events) })], false);
29601
 
29199
 
29602
    var mouse = schema$5;
29200
    var mouse = schema$5;
29603
    var touch = schema$4;
29201
    var touch = schema$4;
29604
    var mouseOrTouch = schema$3;
29202
    var mouseOrTouch = schema$3;
29605
 
29203
 
Line 29788... Line 29386...
29788
      var memBottomRight = createSelector(bottomRightSnaps);
29386
      var memBottomRight = createSelector(bottomRightSnaps);
29789
      var topLeft = build$1(memTopLeft.asSpec());
29387
      var topLeft = build$1(memTopLeft.asSpec());
29790
      var bottomRight = build$1(memBottomRight.asSpec());
29388
      var bottomRight = build$1(memBottomRight.asSpec());
29791
      var showOrHideHandle = function (selector, cell, isAbove, isBelow) {
29389
      var showOrHideHandle = function (selector, cell, isAbove, isBelow) {
29792
        var cellRect = cell.dom.getBoundingClientRect();
29390
        var cellRect = cell.dom.getBoundingClientRect();
29793
        remove$1(selector.element, 'display');
29391
        remove$6(selector.element, 'display');
29794
        var viewportHeight = defaultView(SugarElement.fromDom(editor.getBody())).dom.innerHeight;
29392
        var viewportHeight = defaultView(SugarElement.fromDom(editor.getBody())).dom.innerHeight;
29795
        var aboveViewport = isAbove(cellRect);
29393
        var aboveViewport = isAbove(cellRect);
29796
        var belowViewport = isBelow(cellRect, viewportHeight);
29394
        var belowViewport = isBelow(cellRect, viewportHeight);
29797
        if (aboveViewport || belowViewport) {
29395
        if (aboveViewport || belowViewport) {
29798
          set$6(selector.element, 'display', 'none');
29396
          set$7(selector.element, 'display', 'none');
29799
        }
29397
        }
29800
      };
29398
      };
29801
      var snapTo = function (selector, cell, getSnapConfig, pos) {
29399
      var snapTo = function (selector, cell, getSnapConfig, pos) {
29802
        var snap = getSnapConfig(cell);
29400
        var snap = getSnapConfig(cell);
29803
        Dragging.snapTo(selector, snap);
29401
        Dragging.snapTo(selector, snap);
Line 29979... Line 29577...
29979
      }
29577
      }
29980
      return dimensions;
29578
      return dimensions;
29981
    };
29579
    };
29982
    var resize = function (editor, deltas, resizeType) {
29580
    var resize = function (editor, deltas, resizeType) {
29983
      var container = SugarElement.fromDom(editor.getContainer());
29581
      var container = SugarElement.fromDom(editor.getContainer());
29984
      var dimensions = getDimensions(editor, deltas, resizeType, get$8(container), get$7(container));
29582
      var dimensions = getDimensions(editor, deltas, resizeType, get$b(container), get$a(container));
29985
      each(dimensions, function (val, dim) {
29583
      each(dimensions, function (val, dim) {
29986
        return set$6(container, dim, numToPx(val));
29584
        return set$7(container, dim, numToPx(val));
29987
      });
29585
      });
29988
      fireResizeEditor(editor);
29586
      fireResizeEditor(editor);
29989
    };
29587
    };
29990
 
29588
 
29991
    var getResizeType = function (editor) {
29589
    var getResizeType = function (editor) {
Line 30105... Line 29703...
30105
      });
29703
      });
30106
    };
29704
    };
30107
 
29705
 
30108
    var renderStatusbar = function (editor, providersBackstage) {
29706
    var renderStatusbar = function (editor, providersBackstage) {
30109
      var renderBranding = function () {
29707
      var renderBranding = function () {
30110
        var label = global$f.translate([
29708
        var label = global$e.translate([
30111
          'Powered by {0}',
29709
          'Powered by {0}',
30112
          'Tiny'
29710
          'Tiny'
30113
        ]);
29711
        ]);
30114
        var linkHtml = '<a href="https://www.tiny.cloud/?utm_campaign=editor_referral&amp;utm_medium=poweredby&amp;utm_source=tinymce&amp;utm_content=v5" rel="noopener" target="_blank" tabindex="-1" aria-label="' + label + '">' + label + '</a>';
29712
        var linkHtml = '<a href="https://www.tiny.cloud/?utm_campaign=editor_referral&amp;utm_medium=poweredby&amp;utm_source=tinymce&amp;utm_content=v5" rel="noopener" target="_blank" tabindex="-1" aria-label="' + label + '">' + label + '</a>';
30115
        return {
29713
        return {
Line 30168... Line 29766...
30168
      var isTouch = platform.deviceType.isTouch();
29766
      var isTouch = platform.deviceType.isTouch();
30169
      var touchPlatformClass = 'tox-platform-touch';
29767
      var touchPlatformClass = 'tox-platform-touch';
30170
      var deviceClasses = isTouch ? [touchPlatformClass] : [];
29768
      var deviceClasses = isTouch ? [touchPlatformClass] : [];
30171
      var isToolbarBottom = isToolbarLocationBottom(editor);
29769
      var isToolbarBottom = isToolbarLocationBottom(editor);
30172
      var uiContainer = getUiContainer(editor);
29770
      var uiContainer = getUiContainer(editor);
30173
      var dirAttributes = global$f.isRtl() ? { attributes: { dir: 'rtl' } } : {};
29771
      var dirAttributes = global$e.isRtl() ? { attributes: { dir: 'rtl' } } : {};
30174
      var verticalDirAttributes = { attributes: (_a = {}, _a[Attribute] = isToolbarBottom ? AttributeValue.BottomToTop : AttributeValue.TopToBottom, _a) };
29772
      var verticalDirAttributes = { attributes: (_a = {}, _a[Attribute] = isToolbarBottom ? AttributeValue.BottomToTop : AttributeValue.TopToBottom, _a) };
30175
      var lazyHeader = function () {
29773
      var lazyHeader = function () {
30176
        return lazyOuterContainer.bind(OuterContainer.getHeader);
29774
        return lazyOuterContainer.bind(OuterContainer.getHeader);
30177
      };
29775
      };
30178
      var isHeaderDocked = function () {
29776
      var isHeaderDocked = function () {
30179
        return header.isDocked(lazyHeader);
29777
        return header.isDocked(lazyHeader);
30180
      };
29778
      };
30181
      var resizeUiMothership = function () {
29779
      var resizeUiMothership = function () {
30182
        set$6(uiMothership.element, 'width', document.body.clientWidth + 'px');
29780
        set$7(uiMothership.element, 'width', document.body.clientWidth + 'px');
30183
      };
29781
      };
30184
      var makeSinkDefinition = function () {
29782
      var makeSinkDefinition = function () {
30185
        var isGridUiContainer = eq(body(), uiContainer) && get$a(uiContainer, 'display') === 'grid';
29783
        var isGridUiContainer = eq(body(), uiContainer) && get$c(uiContainer, 'display') === 'grid';
30186
        var sinkSpec = {
29784
        var sinkSpec = {
30187
          dom: __assign({
29785
          dom: __assign({
30188
            tag: 'div',
29786
            tag: 'div',
30189
            classes: [
29787
            classes: [
30190
              'tox',
29788
              'tox',
Line 30341... Line 29939...
30341
        [editorContainer],
29939
        [editorContainer],
30342
        isInline ? [] : statusbar.toArray(),
29940
        isInline ? [] : statusbar.toArray(),
30343
        [partThrobber]
29941
        [partThrobber]
30344
      ]);
29942
      ]);
30345
      var isHidden = isDistractionFree(editor);
29943
      var isHidden = isDistractionFree(editor);
30346
      var attributes = __assign(__assign({ role: 'application' }, global$f.isRtl() ? { dir: 'rtl' } : {}), isHidden ? { 'aria-hidden': 'true' } : {});
29944
      var attributes = __assign(__assign({ role: 'application' }, global$e.isRtl() ? { dir: 'rtl' } : {}), isHidden ? { 'aria-hidden': 'true' } : {});
30347
      var outerContainer = build$1(OuterContainer.sketch({
29945
      var outerContainer = build$1(OuterContainer.sketch({
30348
        dom: {
29946
        dom: {
30349
          tag: 'div',
29947
          tag: 'div',
30350
          classes: [
29948
          classes: [
30351
            'tox',
29949
            'tox',
Line 30394... Line 29992...
30394
      var setEditorSize = function () {
29992
      var setEditorSize = function () {
30395
        var parsedHeight = numToPx(getHeightWithFallback(editor));
29993
        var parsedHeight = numToPx(getHeightWithFallback(editor));
30396
        var parsedWidth = numToPx(getWidthWithFallback(editor));
29994
        var parsedWidth = numToPx(getWidthWithFallback(editor));
30397
        if (!editor.inline) {
29995
        if (!editor.inline) {
30398
          if (isValidValue('div', 'width', parsedWidth)) {
29996
          if (isValidValue('div', 'width', parsedWidth)) {
30399
            set$6(outerContainer.element, 'width', parsedWidth);
29997
            set$7(outerContainer.element, 'width', parsedWidth);
30400
          }
29998
          }
30401
          if (isValidValue('div', 'height', parsedHeight)) {
29999
          if (isValidValue('div', 'height', parsedHeight)) {
30402
            set$6(outerContainer.element, 'height', parsedHeight);
30000
            set$7(outerContainer.element, 'height', parsedHeight);
30403
          } else {
30001
          } else {
30404
            set$6(outerContainer.element, 'height', '200px');
30002
            set$7(outerContainer.element, 'height', '200px');
30405
          }
30003
          }
30406
        }
30004
        }
30407
        return parsedHeight;
30005
        return parsedHeight;
30408
      };
30006
      };
30409
      var renderUI = function () {
30007
      var renderUI = function () {
30410
        header.setup(editor, backstage.shared, lazyHeader);
30008
        header.setup(editor, backstage.shared, lazyHeader);
30411
        setup$6(editor, backstage);
30009
        setup$6(editor, backstage);
30412
        setup$5(editor, lazySink, backstage);
30010
        setup$5(editor, lazySink, backstage);
30413
        setup$8(editor);
30011
        setup$8(editor);
30414
        setup$7(editor, lazyThrobber, backstage.shared);
30012
        setup$7(editor, lazyThrobber, backstage.shared);
30415
        map(getToolbarGroups(editor), function (toolbarGroupButtonConfig, name) {
30013
        map$1(getToolbarGroups(editor), function (toolbarGroupButtonConfig, name) {
30416
          editor.ui.registry.addGroupToolbarButton(name, toolbarGroupButtonConfig);
30014
          editor.ui.registry.addGroupToolbarButton(name, toolbarGroupButtonConfig);
30417
        });
30015
        });
30418
        var _a = editor.ui.registry.getAll(), buttons = _a.buttons, menuItems = _a.menuItems, contextToolbars = _a.contextToolbars, sidebars = _a.sidebars;
30016
        var _a = editor.ui.registry.getAll(), buttons = _a.buttons, menuItems = _a.menuItems, contextToolbars = _a.contextToolbars, sidebars = _a.sidebars;
30419
        var toolbarOpt = getMultipleToolbarsSetting(editor);
30017
        var toolbarOpt = getMultipleToolbarsSetting(editor);
30420
        var rawUiConfig = {
30018
        var rawUiConfig = {
Line 30451... Line 30049...
30451
        getUi: getUi
30049
        getUi: getUi
30452
      };
30050
      };
30453
    };
30051
    };
30454
 
30052
 
30455
    var describedBy = function (describedElement, describeElement) {
30053
    var describedBy = function (describedElement, describeElement) {
30456
      var describeId = Optional.from(get$c(describedElement, 'id')).fold(function () {
30054
      var describeId = Optional.from(get$d(describedElement, 'id')).fold(function () {
30457
        var id = generate$6('dialog-describe');
30055
        var id = generate$6('dialog-describe');
30458
        set$7(describeElement, 'id', id);
30056
        set$8(describeElement, 'id', id);
30459
        return id;
30057
        return id;
30460
      }, identity$1);
30058
      }, identity$1);
30461
      set$7(describedElement, 'aria-describedby', describeId);
30059
      set$8(describedElement, 'aria-describedby', describeId);
30462
    };
30060
    };
30463
 
30061
 
30464
    var labelledBy = function (labelledElement, labelElement) {
30062
    var labelledBy = function (labelledElement, labelElement) {
30465
      var labelId = getOpt(labelledElement, 'id').fold(function () {
30063
      var labelId = getOpt(labelledElement, 'id').fold(function () {
30466
        var id = generate$6('dialog-label');
30064
        var id = generate$6('dialog-label');
30467
        set$7(labelElement, 'id', id);
30065
        set$8(labelElement, 'id', id);
30468
        return id;
30066
        return id;
30469
      }, identity$1);
30067
      }, identity$1);
30470
      set$7(labelledElement, 'aria-labelledby', labelId);
30068
      set$8(labelledElement, 'aria-labelledby', labelId);
30471
    };
30069
    };
30472
 
30070
 
30473
    var schema$2 = constant$1([
30071
    var schema$2 = constant$1([
30474
      required$1('lazySink'),
30072
      required$1('lazySink'),
30475
      option('dragBlockClass'),
30073
      option('dragBlockClass'),
Line 30661... Line 30259...
30661
        'end'
30259
        'end'
30662
      ]),
30260
      ]),
30663
      defaultedBoolean('primary', false),
30261
      defaultedBoolean('primary', false),
30664
      defaultedBoolean('disabled', false)
30262
      defaultedBoolean('disabled', false)
30665
    ];
30263
    ];
30666
    var dialogFooterButtonFields = __spreadArray(__spreadArray([], baseFooterButtonFields), [requiredString('text')]);
30264
    var dialogFooterButtonFields = __spreadArray(__spreadArray([], baseFooterButtonFields, true), [requiredString('text')], false);
30667
    var normalFooterButtonFields = __spreadArray([requiredStringEnum('type', [
30265
    var normalFooterButtonFields = __spreadArray([requiredStringEnum('type', [
30668
        'submit',
30266
        'submit',
30669
        'cancel',
30267
        'cancel',
30670
        'custom'
30268
        'custom'
30671
      ])], dialogFooterButtonFields);
30269
      ])], dialogFooterButtonFields, true);
30672
    var menuFooterButtonFields = __spreadArray([
30270
    var menuFooterButtonFields = __spreadArray([
30673
      requiredStringEnum('type', ['menu']),
30271
      requiredStringEnum('type', ['menu']),
30674
      optionString('text'),
30272
      optionString('text'),
30675
      optionString('tooltip'),
30273
      optionString('tooltip'),
30676
      optionString('icon'),
30274
      optionString('icon'),
30677
      requiredArrayOf('items', dialogToggleMenuItemSchema)
30275
      requiredArrayOf('items', dialogToggleMenuItemSchema)
30678
    ], baseFooterButtonFields);
30276
    ], baseFooterButtonFields, true);
30679
    var dialogFooterButtonSchema = choose$1('type', {
30277
    var dialogFooterButtonSchema = choose$1('type', {
30680
      submit: normalFooterButtonFields,
30278
      submit: normalFooterButtonFields,
30681
      cancel: normalFooterButtonFields,
30279
      cancel: normalFooterButtonFields,
30682
      custom: normalFooterButtonFields,
30280
      custom: normalFooterButtonFields,
30683
      menu: menuFooterButtonFields
30281
      menu: menuFooterButtonFields
Line 30963... Line 30561...
30963
    };
30561
    };
30964
 
30562
 
30965
    var urlDialogButtonSchema = objOf(__spreadArray([requiredStringEnum('type', [
30563
    var urlDialogButtonSchema = objOf(__spreadArray([requiredStringEnum('type', [
30966
        'cancel',
30564
        'cancel',
30967
        'custom'
30565
        'custom'
30968
      ])], dialogButtonFields));
30566
      ])], dialogButtonFields, true));
30969
    var urlDialogSchema = objOf([
30567
    var urlDialogSchema = objOf([
30970
      requiredString('title'),
30568
      requiredString('title'),
30971
      requiredString('url'),
30569
      requiredString('url'),
30972
      optionNumber('height'),
30570
      optionNumber('height'),
30973
      optionNumber('width'),
30571
      optionNumber('width'),
Line 31221... Line 30819...
31221
        'behaviours': augment(detail.tabbarBehaviours, [
30819
        'behaviours': augment(detail.tabbarBehaviours, [
31222
          Highlighting.config({
30820
          Highlighting.config({
31223
            highlightClass: detail.markers.selectedClass,
30821
            highlightClass: detail.markers.selectedClass,
31224
            itemClass: detail.markers.tabClass,
30822
            itemClass: detail.markers.tabClass,
31225
            onHighlight: function (tabbar, tab) {
30823
            onHighlight: function (tabbar, tab) {
31226
              set$7(tab.element, 'aria-selected', 'true');
30824
              set$8(tab.element, 'aria-selected', 'true');
31227
            },
30825
            },
31228
            onDehighlight: function (tabbar, tab) {
30826
            onDehighlight: function (tabbar, tab) {
31229
              set$7(tab.element, 'aria-selected', 'false');
30827
              set$8(tab.element, 'aria-selected', 'false');
31230
            }
30828
            }
31231
          }),
30829
          }),
31232
          Keying.config({
30830
          Keying.config({
31233
            mode: 'flow',
30831
            mode: 'flow',
31234
            getInitial: function (tabbar) {
30832
            getInitial: function (tabbar) {
Line 31301... Line 30899...
31301
            return t.value === tabValue;
30899
            return t.value === tabValue;
31302
          });
30900
          });
31303
          tabWithValue.each(function (tabData) {
30901
          tabWithValue.each(function (tabData) {
31304
            var panel = tabData.view();
30902
            var panel = tabData.view();
31305
            getOpt(button.element, 'id').each(function (id) {
30903
            getOpt(button.element, 'id').each(function (id) {
31306
              set$7(tabview.element, 'aria-labelledby', id);
30904
              set$8(tabview.element, 'aria-labelledby', id);
31307
            });
30905
            });
31308
            Replacing.set(tabview, panel);
30906
            Replacing.set(tabview, panel);
31309
            detail.onChangeTab(tabview, button, panel);
30907
            detail.onChangeTab(tabview, button, panel);
31310
          });
30908
          });
31311
        });
30909
        });
Line 31391... Line 30989...
31391
      }));
30989
      }));
31392
    };
30990
    };
31393
    var getMaxTabviewHeight = function (dialog, tabview, tablist) {
30991
    var getMaxTabviewHeight = function (dialog, tabview, tablist) {
31394
      var documentElement$1 = documentElement(dialog).dom;
30992
      var documentElement$1 = documentElement(dialog).dom;
31395
      var rootElm = ancestor(dialog, '.tox-dialog-wrap').getOr(dialog);
30993
      var rootElm = ancestor(dialog, '.tox-dialog-wrap').getOr(dialog);
31396
      var isFixed = get$a(rootElm, 'position') === 'fixed';
30994
      var isFixed = get$c(rootElm, 'position') === 'fixed';
31397
      var maxHeight;
30995
      var maxHeight;
31398
      if (isFixed) {
30996
      if (isFixed) {
31399
        maxHeight = Math.max(documentElement$1.clientHeight, window.innerHeight);
30997
        maxHeight = Math.max(documentElement$1.clientHeight, window.innerHeight);
31400
      } else {
30998
      } else {
31401
        maxHeight = Math.max(documentElement$1.offsetHeight, documentElement$1.scrollHeight);
30999
        maxHeight = Math.max(documentElement$1.offsetHeight, documentElement$1.scrollHeight);
31402
      }
31000
      }
31403
      var tabviewHeight = get$8(tabview);
31001
      var tabviewHeight = get$b(tabview);
31404
      var isTabListBeside = tabview.dom.offsetLeft >= tablist.dom.offsetLeft + get$7(tablist);
31002
      var isTabListBeside = tabview.dom.offsetLeft >= tablist.dom.offsetLeft + get$a(tablist);
31405
      var currentTabHeight = isTabListBeside ? Math.max(get$8(tablist), tabviewHeight) : tabviewHeight;
31003
      var currentTabHeight = isTabListBeside ? Math.max(get$b(tablist), tabviewHeight) : tabviewHeight;
31406
      var dialogTopMargin = parseInt(get$a(dialog, 'margin-top'), 10) || 0;
31004
      var dialogTopMargin = parseInt(get$c(dialog, 'margin-top'), 10) || 0;
31407
      var dialogBottomMargin = parseInt(get$a(dialog, 'margin-bottom'), 10) || 0;
31005
      var dialogBottomMargin = parseInt(get$c(dialog, 'margin-bottom'), 10) || 0;
31408
      var dialogHeight = get$8(dialog) + dialogTopMargin + dialogBottomMargin;
31006
      var dialogHeight = get$b(dialog) + dialogTopMargin + dialogBottomMargin;
31409
      var chromeHeight = dialogHeight - currentTabHeight;
31007
      var chromeHeight = dialogHeight - currentTabHeight;
31410
      return maxHeight - chromeHeight;
31008
      return maxHeight - chromeHeight;
31411
    };
31009
    };
31412
    var showTab = function (allTabs, comp) {
31010
    var showTab = function (allTabs, comp) {
31413
      head(allTabs).each(function (tab) {
31011
      head(allTabs).each(function (tab) {
31414
        return TabSection.showTab(comp, tab.value);
31012
        return TabSection.showTab(comp, tab.value);
31415
      });
31013
      });
31416
    };
31014
    };
31417
    var setTabviewHeight = function (tabview, height) {
31015
    var setTabviewHeight = function (tabview, height) {
31418
      set$6(tabview, 'height', height + 'px');
31016
      set$7(tabview, 'height', height + 'px');
31419
      if (!detect$1().browser.isIE()) {
31017
      if (!detect$1().browser.isIE()) {
31420
        set$6(tabview, 'flex-basis', height + 'px');
31018
        set$7(tabview, 'flex-basis', height + 'px');
31421
      } else {
31019
      } else {
31422
        remove$1(tabview, 'flex-basis');
31020
        remove$6(tabview, 'flex-basis');
31423
      }
31021
      }
31424
    };
31022
    };
31425
    var updateTabviewHeight = function (dialogBody, tabview, maxTabHeight) {
31023
    var updateTabviewHeight = function (dialogBody, tabview, maxTabHeight) {
31426
      ancestor(dialogBody, '[role="dialog"]').each(function (dialog) {
31024
      ancestor(dialogBody, '[role="dialog"]').each(function (dialog) {
31427
        descendant(dialog, '[role="tablist"]').each(function (tablist) {
31025
        descendant(dialog, '[role="tablist"]').each(function (tablist) {
31428
          maxTabHeight.get().map(function (height) {
31026
          maxTabHeight.get().map(function (height) {
31429
            set$6(tabview, 'height', '0');
31027
            set$7(tabview, 'height', '0');
31430
            set$6(tabview, 'flex-basis', '0');
31028
            set$7(tabview, 'flex-basis', '0');
31431
            return Math.min(height, getMaxTabviewHeight(dialog, tabview, tablist));
31029
            return Math.min(height, getMaxTabviewHeight(dialog, tabview, tablist));
31432
          }).each(function (height) {
31030
          }).each(function (height) {
31433
            setTabviewHeight(tabview, height);
31031
            setTabviewHeight(tabview, height);
31434
          });
31032
          });
31435
        });
31033
        });
Line 31443... Line 31041...
31443
        var maxTabHeight = value$1();
31041
        var maxTabHeight = value$1();
31444
        var extraEvents = [
31042
        var extraEvents = [
31445
          runOnAttached(function (comp) {
31043
          runOnAttached(function (comp) {
31446
            var dialog = comp.element;
31044
            var dialog = comp.element;
31447
            getTabview(dialog).each(function (tabview) {
31045
            getTabview(dialog).each(function (tabview) {
31448
              set$6(tabview, 'visibility', 'hidden');
31046
              set$7(tabview, 'visibility', 'hidden');
31449
              comp.getSystem().getByDom(tabview).toOptional().each(function (tabviewComp) {
31047
              comp.getSystem().getByDom(tabview).toOptional().each(function (tabviewComp) {
31450
                var heights = measureHeights(allTabs, tabview, tabviewComp);
31048
                var heights = measureHeights(allTabs, tabview, tabviewComp);
31451
                var maxTabHeightOpt = getMaxHeight(heights);
31049
                var maxTabHeightOpt = getMaxHeight(heights);
31452
                maxTabHeightOpt.fold(maxTabHeight.clear, maxTabHeight.set);
31050
                maxTabHeightOpt.fold(maxTabHeight.clear, maxTabHeight.set);
31453
              });
31051
              });
31454
              updateTabviewHeight(dialog, tabview, maxTabHeight);
31052
              updateTabviewHeight(dialog, tabview, maxTabHeight);
31455
              remove$1(tabview, 'visibility');
31053
              remove$6(tabview, 'visibility');
31456
              showTab(allTabs, comp);
31054
              showTab(allTabs, comp);
31457
              global$g.requestAnimationFrame(function () {
31055
              global$f.requestAnimationFrame(function () {
31458
                updateTabviewHeight(dialog, tabview, maxTabHeight);
31056
                updateTabviewHeight(dialog, tabview, maxTabHeight);
31459
              });
31057
              });
31460
            });
31058
            });
31461
          }),
31059
          }),
31462
          run$1(windowResize(), function (comp) {
31060
          run$1(windowResize(), function (comp) {
Line 31467... Line 31065...
31467
          }),
31065
          }),
31468
          run$1(formResizeEvent, function (comp, _se) {
31066
          run$1(formResizeEvent, function (comp, _se) {
31469
            var dialog = comp.element;
31067
            var dialog = comp.element;
31470
            getTabview(dialog).each(function (tabview) {
31068
            getTabview(dialog).each(function (tabview) {
31471
              var oldFocus = active(getRootNode(tabview));
31069
              var oldFocus = active(getRootNode(tabview));
31472
              set$6(tabview, 'visibility', 'hidden');
31070
              set$7(tabview, 'visibility', 'hidden');
31473
              var oldHeight = getRaw(tabview, 'height').map(function (h) {
31071
              var oldHeight = getRaw(tabview, 'height').map(function (h) {
31474
                return parseInt(h, 10);
31072
                return parseInt(h, 10);
31475
              });
31073
              });
31476
              remove$1(tabview, 'height');
31074
              remove$6(tabview, 'height');
31477
              remove$1(tabview, 'flex-basis');
31075
              remove$6(tabview, 'flex-basis');
31478
              var newHeight = tabview.dom.getBoundingClientRect().height;
31076
              var newHeight = tabview.dom.getBoundingClientRect().height;
31479
              var hasGrown = oldHeight.forall(function (h) {
31077
              var hasGrown = oldHeight.forall(function (h) {
31480
                return newHeight > h;
31078
                return newHeight > h;
31481
              });
31079
              });
31482
              if (hasGrown) {
31080
              if (hasGrown) {
Line 31485... Line 31083...
31485
              } else {
31083
              } else {
31486
                oldHeight.each(function (h) {
31084
                oldHeight.each(function (h) {
31487
                  setTabviewHeight(tabview, h);
31085
                  setTabviewHeight(tabview, h);
31488
                });
31086
                });
31489
              }
31087
              }
31490
              remove$1(tabview, 'visibility');
31088
              remove$6(tabview, 'visibility');
31491
              oldFocus.each(focus$3);
31089
              oldFocus.each(focus$3);
31492
            });
31090
            });
31493
          })
31091
          })
31494
        ];
31092
        ];
31495
        var selectFirst = false;
31093
        var selectFirst = false;
Line 31714... Line 31312...
31714
          })])
31312
          })])
31715
      };
31313
      };
31716
      return ModalDialog.parts.body(bodySpec);
31314
      return ModalDialog.parts.body(bodySpec);
31717
    };
31315
    };
31718
 
31316
 
31719
    var isTouch = global$a.deviceType.isTouch();
31317
    var isTouch = global$9.deviceType.isTouch();
31720
    var hiddenHeader = function (title, close) {
31318
    var hiddenHeader = function (title, close) {
31721
      return {
31319
      return {
31722
        dom: {
31320
        dom: {
31723
          tag: 'div',
31321
          tag: 'div',
31724
          styles: { display: 'none' },
31322
          styles: { display: 'none' },
Line 31821... Line 31419...
31821
          styles: __assign({ position: 'relative' }, spec.extraStyles)
31419
          styles: __assign({ position: 'relative' }, spec.extraStyles)
31822
        },
31420
        },
31823
        components: __spreadArray([
31421
        components: __spreadArray([
31824
          spec.header,
31422
          spec.header,
31825
          spec.body
31423
          spec.body
31826
        ], spec.footer.toArray()),
31424
        ], spec.footer.toArray(), true),
31827
        parts: {
31425
        parts: {
31828
          blocker: {
31426
          blocker: {
31829
            dom: fromHtml('<div class="' + blockerClass + '"></div>'),
31427
            dom: fromHtml('<div class="' + blockerClass + '"></div>'),
31830
            components: [{
31428
            components: [{
31831
                dom: {
31429
                dom: {
Line 31847... Line 31445...
31847
          config('scroll-lock', [
31445
          config('scroll-lock', [
31848
            runOnAttached(function () {
31446
            runOnAttached(function () {
31849
              add$2(body(), scrollLockClass);
31447
              add$2(body(), scrollLockClass);
31850
            }),
31448
            }),
31851
            runOnDetached(function () {
31449
            runOnDetached(function () {
31852
              remove$3(body(), scrollLockClass);
31450
              remove$2(body(), scrollLockClass);
31853
            })
31451
            })
31854
          ])
31452
          ])
31855
        ], spec.extraBehaviours)),
31453
        ], spec.extraBehaviours, true)),
31856
        eventOrder: __assign((_a = {}, _a[execute$5()] = ['dialog-events'], _a[attachedToDom()] = [
31454
        eventOrder: __assign((_a = {}, _a[execute$5()] = ['dialog-events'], _a[attachedToDom()] = [
31857
          'scroll-lock',
31455
          'scroll-lock',
31858
          'dialog-events',
31456
          'dialog-events',
31859
          'alloy.base.behaviour'
31457
          'alloy.base.behaviour'
31860
        ], _a[detachedFromDom()] = [
31458
        ], _a[detachedFromDom()] = [
Line 31997... Line 31595...
31997
            channel: dialogChannel,
31595
            channel: dialogChannel,
31998
            updateState: updateState,
31596
            updateState: updateState,
31999
            initialData: initialData
31597
            initialData: initialData
32000
          }),
31598
          }),
32001
          RepresentingConfigs.memory({})
31599
          RepresentingConfigs.memory({})
32002
        ], spec.extraBehaviours),
31600
        ], spec.extraBehaviours, true),
32003
        onEscape: function (comp) {
31601
        onEscape: function (comp) {
32004
          emit(comp, formCancelEvent);
31602
          emit(comp, formCancelEvent);
32005
        },
31603
        },
32006
        dialogEvents: dialogEvents,
31604
        dialogEvents: dialogEvents,
32007
        eventOrder: (_a = {}, _a[receive()] = [
31605
        eventOrder: (_a = {}, _a[receive()] = [
Line 32080... Line 31678...
32080
      var withSpec = function (c, f) {
31678
      var withSpec = function (c, f) {
32081
        Reflecting.getState(c).get().each(function (currentDialog) {
31679
        Reflecting.getState(c).get().each(function (currentDialog) {
32082
          f(currentDialog, c);
31680
          f(currentDialog, c);
32083
        });
31681
        });
32084
      };
31682
      };
32085
      return __spreadArray(__spreadArray([], initCommonEvents(fireApiEvent, extras)), [fireApiEvent(formActionEvent, function (api, spec, event) {
31683
      return __spreadArray(__spreadArray([], initCommonEvents(fireApiEvent, extras), true), [fireApiEvent(formActionEvent, function (api, spec, event) {
32086
          spec.onAction(api, { name: event.name });
31684
          spec.onAction(api, { name: event.name });
32087
        })]);
31685
        })], false);
32088
    };
31686
    };
32089
    var initDialog = function (getInstanceApi, extras, getSink) {
31687
    var initDialog = function (getInstanceApi, extras, getSink) {
32090
      var fireApiEvent = function (eventName, f) {
31688
      var fireApiEvent = function (eventName, f) {
32091
        return run$1(eventName, function (c, se) {
31689
        return run$1(eventName, function (c, se) {
32092
          withSpec(c, function (spec, _c) {
31690
          withSpec(c, function (spec, _c) {
Line 32097... Line 31695...
32097
      var withSpec = function (c, f) {
31695
      var withSpec = function (c, f) {
32098
        Reflecting.getState(c).get().each(function (currentDialogInit) {
31696
        Reflecting.getState(c).get().each(function (currentDialogInit) {
32099
          f(currentDialogInit.internalDialog, c);
31697
          f(currentDialogInit.internalDialog, c);
32100
        });
31698
        });
32101
      };
31699
      };
32102
      return __spreadArray(__spreadArray([], initCommonEvents(fireApiEvent, extras)), [
31700
      return __spreadArray(__spreadArray([], initCommonEvents(fireApiEvent, extras), true), [
32103
        fireApiEvent(formSubmitEvent, function (api, spec) {
31701
        fireApiEvent(formSubmitEvent, function (api, spec) {
32104
          return spec.onSubmit(api);
31702
          return spec.onSubmit(api);
32105
        }),
31703
        }),
32106
        fireApiEvent(formChangeEvent, function (api, spec, event) {
31704
        fireApiEvent(formChangeEvent, function (api, spec, event) {
32107
          spec.onChange(api, { name: event.name });
31705
          spec.onChange(api, { name: event.name });
Line 32143... Line 31741...
32143
        }),
31741
        }),
32144
        runOnDetached(function (component) {
31742
        runOnDetached(function (component) {
32145
          var api = getInstanceApi();
31743
          var api = getInstanceApi();
32146
          Representing.setValue(component, api.getData());
31744
          Representing.setValue(component, api.getData());
32147
        })
31745
        })
32148
      ]);
31746
      ], false);
32149
    };
31747
    };
32150
    var SilverDialogEvents = {
31748
    var SilverDialogEvents = {
32151
      initUrlDialog: initUrlDialog,
31749
      initUrlDialog: initUrlDialog,
32152
      initDialog: initDialog
31750
      initDialog: initDialog
32153
    };
31751
    };
Line 32255... Line 31853...
32255
      };
31853
      };
32256
      var getData = function () {
31854
      var getData = function () {
32257
        var root = access.getRoot();
31855
        var root = access.getRoot();
32258
        var valueComp = root.getSystem().isConnected() ? access.getFormWrapper() : root;
31856
        var valueComp = root.getSystem().isConnected() ? access.getFormWrapper() : root;
32259
        var representedValues = Representing.getValue(valueComp);
31857
        var representedValues = Representing.getValue(valueComp);
32260
        var menuItemCurrentState = map(menuItemStates, function (cell) {
31858
        var menuItemCurrentState = map$1(menuItemStates, function (cell) {
32261
          return cell.get();
31859
          return cell.get();
32262
        });
31860
        });
32263
        return __assign(__assign({}, representedValues), menuItemCurrentState);
31861
        return __assign(__assign({}, representedValues), menuItemCurrentState);
32264
      };
31862
      };
32265
      var setData = function (newData) {
31863
      var setData = function (newData) {
Line 32447... Line 32045...
32447
            onEscape: function (c) {
32045
            onEscape: function (c) {
32448
              emit(c, formCloseEvent);
32046
              emit(c, formCloseEvent);
32449
              return Optional.some(true);
32047
              return Optional.some(true);
32450
            },
32048
            },
32451
            useTabstopAt: function (elem) {
32049
            useTabstopAt: function (elem) {
32452
              return !isPseudoStop(elem) && (name$2(elem) !== 'button' || get$c(elem, 'disabled') !== 'disabled');
32050
              return !isPseudoStop(elem) && (name$2(elem) !== 'button' || get$d(elem, 'disabled') !== 'disabled');
32453
            }
32051
            }
32454
          }),
32052
          }),
32455
          Reflecting.config({
32053
          Reflecting.config({
32456
            channel: dialogChannel,
32054
            channel: dialogChannel,
32457
            updateState: updateState,
32055
            updateState: updateState,
Line 32855... Line 32453...
32855
            },
32453
            },
32856
            fireDismissalEventInstead: {}
32454
            fireDismissalEventInstead: {}
32857
          }, isToolbarLocationTop ? {} : { fireRepositionEventInstead: {} }), {
32455
          }, isToolbarLocationTop ? {} : { fireRepositionEventInstead: {} }), {
32858
            inlineBehaviours: derive$1(__spreadArray([config('window-manager-inline-events', [run$1(dismissRequested(), function (_comp, _se) {
32456
            inlineBehaviours: derive$1(__spreadArray([config('window-manager-inline-events', [run$1(dismissRequested(), function (_comp, _se) {
32859
                  emit(dialogUi.dialog, formCancelEvent);
32457
                  emit(dialogUi.dialog, formCancelEvent);
32860
                })])], inlineAdditionalBehaviours(editor, isStickyToolbar$1, isToolbarLocationTop))),
32458
                })])], inlineAdditionalBehaviours(editor, isStickyToolbar$1, isToolbarLocationTop), true)),
32861
            isExtraPart: function (_comp, target) {
32459
            isExtraPart: function (_comp, target) {
32862
              return isAlertOrConfirmDialog(target);
32460
              return isAlertOrConfirmDialog(target);
32863
            }
32461
            }
32864
          })));
32462
          })));
32865
          inlineDialog.set(inlineDialogComp);
32463
          inlineDialog.set(inlineDialogComp);
Line 32895... Line 32493...
32895
        confirm: confirm
32493
        confirm: confirm
32896
      };
32494
      };
32897
    };
32495
    };
32898
 
32496
 
32899
    function Theme () {
32497
    function Theme () {
32900
      global$h.add('silver', function (editor) {
32498
      global$g.add('silver', function (editor) {
32901
        var _a = setup$3(editor), uiMothership = _a.uiMothership, backstage = _a.backstage, renderUI = _a.renderUI, getUi = _a.getUi;
32499
        var _a = setup$3(editor), uiMothership = _a.uiMothership, backstage = _a.backstage, renderUI = _a.renderUI, getUi = _a.getUi;
32902
        Autocompleter.register(editor, backstage.shared);
32500
        Autocompleter.register(editor, backstage.shared);
32903
        var windowMgr = setup({
32501
        var windowMgr = setup({
32904
          editor: editor,
32502
          editor: editor,
32905
          backstage: backstage
32503
          backstage: backstage