Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 1... Línea 1...
1
/**
1
/**
2
 * TinyMCE version 6.8.3 (2024-02-08)
2
 * TinyMCE version 7.7.1 (2025-03-05)
3
 */
3
 */
Línea 4... Línea 4...
4
 
4
 
5
(function () {
5
(function () {
Línea 334... Línea 334...
334
    const sort = (xs, comparator) => {
334
    const sort = (xs, comparator) => {
335
      const copy = nativeSlice.call(xs, 0);
335
      const copy = nativeSlice.call(xs, 0);
336
      copy.sort(comparator);
336
      copy.sort(comparator);
337
      return copy;
337
      return copy;
338
    };
338
    };
339
    const get$h = (xs, i) => i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
339
    const get$i = (xs, i) => i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
340
    const head = xs => get$h(xs, 0);
340
    const head = xs => get$i(xs, 0);
341
    const last$1 = xs => get$h(xs, xs.length - 1);
341
    const last$1 = xs => get$i(xs, xs.length - 1);
342
    const from = isFunction(Array.from) ? Array.from : x => nativeSlice.call(x);
342
    const from = isFunction(Array.from) ? Array.from : x => nativeSlice.call(x);
343
    const findMap = (arr, f) => {
343
    const findMap = (arr, f) => {
344
      for (let i = 0; i < arr.length; i++) {
344
      for (let i = 0; i < arr.length; i++) {
345
        const r = f(arr[i], i);
345
        const r = f(arr[i], i);
346
        if (r.isSome()) {
346
        if (r.isSome()) {
Línea 415... Línea 415...
415
      return Optional.none();
415
      return Optional.none();
416
    };
416
    };
417
    const values = obj => {
417
    const values = obj => {
418
      return mapToArray(obj, identity);
418
      return mapToArray(obj, identity);
419
    };
419
    };
420
    const get$g = (obj, key) => {
420
    const get$h = (obj, key) => {
421
      return has$2(obj, key) ? Optional.from(obj[key]) : Optional.none();
421
      return has$2(obj, key) ? Optional.from(obj[key]) : Optional.none();
422
    };
422
    };
423
    const has$2 = (obj, key) => hasOwnProperty.call(obj, key);
423
    const has$2 = (obj, key) => hasOwnProperty.call(obj, key);
424
    const hasNonNullableKey = (obj, key) => has$2(obj, key) && obj[key] !== undefined && obj[key] !== null;
424
    const hasNonNullableKey = (obj, key) => has$2(obj, key) && obj[key] !== undefined && obj[key] !== null;
Línea 482... Línea 482...
482
    };
482
    };
483
    const blank = r => s => s.replace(r, '');
483
    const blank = r => s => s.replace(r, '');
484
    const trim$1 = blank(/^\s+|\s+$/g);
484
    const trim$1 = blank(/^\s+|\s+$/g);
485
    const isNotEmpty = s => s.length > 0;
485
    const isNotEmpty = s => s.length > 0;
486
    const isEmpty = s => !isNotEmpty(s);
486
    const isEmpty = s => !isNotEmpty(s);
-
 
487
    const toFloat = value => {
-
 
488
      const num = parseFloat(value);
-
 
489
      return isNaN(num) ? Optional.none() : Optional.some(num);
-
 
490
    };
Línea 487... Línea 491...
487
 
491
 
Línea 488... Línea 492...
488
    const isSupported$1 = dom => dom.style !== undefined && isFunction(dom.style.getPropertyValue);
492
    const isSupported = dom => dom.style !== undefined && isFunction(dom.style.getPropertyValue);
489
 
493
 
490
    const fromHtml$2 = (html, scope) => {
494
    const fromHtml$2 = (html, scope) => {
491
      const doc = scope || document;
495
      const doc = scope || document;
Línea 650... Línea 654...
650
      const cs = children(element);
654
      const cs = children(element);
651
      return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
655
      return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
652
    };
656
    };
Línea 653... Línea 657...
653
 
657
 
654
    const isShadowRoot = dos => isDocumentFragment(dos) && isNonNullable(dos.dom.host);
-
 
655
    const supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
-
 
656
    const isSupported = constant$1(supported);
658
    const isShadowRoot = dos => isDocumentFragment(dos) && isNonNullable(dos.dom.host);
657
    const getRootNode = supported ? e => SugarElement.fromDom(e.dom.getRootNode()) : documentOrOwner;
659
    const getRootNode = e => SugarElement.fromDom(e.dom.getRootNode());
658
    const getContentContainer = dos => isShadowRoot(dos) ? dos : SugarElement.fromDom(documentOrOwner(dos).dom.body);
660
    const getContentContainer = dos => isShadowRoot(dos) ? dos : SugarElement.fromDom(documentOrOwner(dos).dom.body);
659
    const isInShadowRoot = e => getShadowRoot(e).isSome();
661
    const isInShadowRoot = e => getShadowRoot(e).isSome();
660
    const getShadowRoot = e => {
662
    const getShadowRoot = e => {
661
      const r = getRootNode(e);
663
      const r = getRootNode(e);
662
      return isShadowRoot(r) ? Optional.some(r) : Optional.none();
664
      return isShadowRoot(r) ? Optional.some(r) : Optional.none();
663
    };
665
    };
664
    const getShadowHost = e => SugarElement.fromDom(e.dom.host);
666
    const getShadowHost = e => SugarElement.fromDom(e.dom.host);
665
    const getOriginalEventTarget = event => {
667
    const getOriginalEventTarget = event => {
666
      if (isSupported() && isNonNullable(event.target)) {
668
      if (isNonNullable(event.target)) {
667
        const el = SugarElement.fromDom(event.target);
669
        const el = SugarElement.fromDom(event.target);
668
        if (isElement$1(el) && isOpenShadowHost(el)) {
670
        if (isElement$1(el) && isOpenShadowHost(el)) {
669
          if (event.composed && event.composedPath) {
671
          if (event.composed && event.composedPath) {
670
            const composedPath = event.composedPath();
672
            const composedPath = event.composedPath();
Línea 710... Línea 712...
710
      const dom = element.dom;
712
      const dom = element.dom;
711
      each(attrs, (v, k) => {
713
      each(attrs, (v, k) => {
712
        rawSet(dom, k, v);
714
        rawSet(dom, k, v);
713
      });
715
      });
714
    };
716
    };
715
    const get$f = (element, key) => {
717
    const get$g = (element, key) => {
716
      const v = element.dom.getAttribute(key);
718
      const v = element.dom.getAttribute(key);
717
      return v === null ? undefined : v;
719
      return v === null ? undefined : v;
718
    };
720
    };
719
    const getOpt = (element, key) => Optional.from(get$f(element, key));
721
    const getOpt = (element, key) => Optional.from(get$g(element, key));
720
    const has$1 = (element, key) => {
722
    const has$1 = (element, key) => {
721
      const dom = element.dom;
723
      const dom = element.dom;
722
      return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
724
      return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
723
    };
725
    };
724
    const remove$7 = (element, key) => {
726
    const remove$8 = (element, key) => {
725
      element.dom.removeAttribute(key);
727
      element.dom.removeAttribute(key);
726
    };
728
    };
727
    const clone$2 = element => foldl(element.dom.attributes, (acc, attr) => {
729
    const clone$2 = element => foldl(element.dom.attributes, (acc, attr) => {
728
      acc[attr.name] = attr.value;
730
      acc[attr.name] = attr.value;
729
      return acc;
731
      return acc;
Línea 732... Línea 734...
732
    const internalSet = (dom, property, value) => {
734
    const internalSet = (dom, property, value) => {
733
      if (!isString(value)) {
735
      if (!isString(value)) {
734
        console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
736
        console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
735
        throw new Error('CSS value must be a string: ' + value);
737
        throw new Error('CSS value must be a string: ' + value);
736
      }
738
      }
737
      if (isSupported$1(dom)) {
739
      if (isSupported(dom)) {
738
        dom.style.setProperty(property, value);
740
        dom.style.setProperty(property, value);
739
      }
741
      }
740
    };
742
    };
741
    const internalRemove = (dom, property) => {
743
    const internalRemove = (dom, property) => {
742
      if (isSupported$1(dom)) {
744
      if (isSupported(dom)) {
743
        dom.style.removeProperty(property);
745
        dom.style.removeProperty(property);
744
      }
746
      }
745
    };
747
    };
746
    const set$8 = (element, property, value) => {
748
    const set$8 = (element, property, value) => {
747
      const dom = element.dom;
749
      const dom = element.dom;
Línea 761... Línea 763...
761
        }, value => {
763
        }, value => {
762
          internalSet(dom, k, value);
764
          internalSet(dom, k, value);
763
        });
765
        });
764
      });
766
      });
765
    };
767
    };
766
    const get$e = (element, property) => {
768
    const get$f = (element, property) => {
767
      const dom = element.dom;
769
      const dom = element.dom;
768
      const styles = window.getComputedStyle(dom);
770
      const styles = window.getComputedStyle(dom);
769
      const r = styles.getPropertyValue(property);
771
      const r = styles.getPropertyValue(property);
770
      return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;
772
      return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;
771
    };
773
    };
772
    const getUnsafeProperty = (dom, property) => isSupported$1(dom) ? dom.style.getPropertyValue(property) : '';
774
    const getUnsafeProperty = (dom, property) => isSupported(dom) ? dom.style.getPropertyValue(property) : '';
773
    const getRaw = (element, property) => {
775
    const getRaw = (element, property) => {
774
      const dom = element.dom;
776
      const dom = element.dom;
775
      const raw = getUnsafeProperty(dom, property);
777
      const raw = getUnsafeProperty(dom, property);
776
      return Optional.from(raw).filter(r => r.length > 0);
778
      return Optional.from(raw).filter(r => r.length > 0);
777
    };
779
    };
778
    const getAllRaw = element => {
780
    const getAllRaw = element => {
779
      const css = {};
781
      const css = {};
780
      const dom = element.dom;
782
      const dom = element.dom;
781
      if (isSupported$1(dom)) {
783
      if (isSupported(dom)) {
782
        for (let i = 0; i < dom.style.length; i++) {
784
        for (let i = 0; i < dom.style.length; i++) {
783
          const ruleName = dom.style.item(i);
785
          const ruleName = dom.style.item(i);
784
          css[ruleName] = dom.style[ruleName];
786
          css[ruleName] = dom.style[ruleName];
785
        }
787
        }
786
      }
788
      }
Línea 790... Línea 792...
790
      const element = SugarElement.fromTag(tag);
792
      const element = SugarElement.fromTag(tag);
791
      set$8(element, property, value);
793
      set$8(element, property, value);
792
      const style = getRaw(element, property);
794
      const style = getRaw(element, property);
793
      return style.isSome();
795
      return style.isSome();
794
    };
796
    };
795
    const remove$6 = (element, property) => {
797
    const remove$7 = (element, property) => {
796
      const dom = element.dom;
798
      const dom = element.dom;
797
      internalRemove(dom, property);
799
      internalRemove(dom, property);
798
      if (is$1(getOpt(element, 'style').map(trim$1), '')) {
800
      if (is$1(getOpt(element, 'style').map(trim$1), '')) {
799
        remove$7(element, 'style');
801
        remove$8(element, 'style');
800
      }
802
      }
801
    };
803
    };
802
    const reflow = e => e.dom.offsetWidth;
804
    const reflow = e => e.dom.offsetWidth;
Línea 803... Línea 805...
803
 
805
 
804
    const Dimension = (name, getOffset) => {
806
    const Dimension = (name, getOffset) => {
805
      const set = (element, h) => {
807
      const set = (element, h) => {
806
        if (!isNumber(h) && !h.match(/^[0-9]+$/)) {
808
        if (!isNumber(h) && !h.match(/^[0-9]+$/)) {
807
          throw new Error(name + '.set accepts only positive integer values. Value was ' + h);
809
          throw new Error(name + '.set accepts only positive integer values. Value was ' + h);
808
        }
810
        }
809
        const dom = element.dom;
811
        const dom = element.dom;
810
        if (isSupported$1(dom)) {
812
        if (isSupported(dom)) {
811
          dom.style[name] = h + 'px';
813
          dom.style[name] = h + 'px';
812
        }
814
        }
813
      };
815
      };
814
      const get = element => {
816
      const get = element => {
815
        const r = getOffset(element);
817
        const r = getOffset(element);
816
        if (r <= 0 || r === null) {
818
        if (r <= 0 || r === null) {
817
          const css = get$e(element, name);
819
          const css = get$f(element, name);
818
          return parseFloat(css) || 0;
820
          return parseFloat(css) || 0;
819
        }
821
        }
820
        return r;
822
        return r;
821
      };
823
      };
822
      const getOuter = get;
824
      const getOuter = get;
823
      const aggregate = (element, properties) => foldl(properties, (acc, property) => {
825
      const aggregate = (element, properties) => foldl(properties, (acc, property) => {
824
        const val = get$e(element, property);
826
        const val = get$f(element, property);
825
        const value = val === undefined ? 0 : parseInt(val, 10);
827
        const value = val === undefined ? 0 : parseInt(val, 10);
826
        return isNaN(value) ? acc : acc + value;
828
        return isNaN(value) ? acc : acc + value;
827
      }, 0);
829
      }, 0);
828
      const max = (element, value, properties) => {
830
      const max = (element, value, properties) => {
Línea 841... Línea 843...
841
 
843
 
842
    const api$2 = Dimension('height', element => {
844
    const api$2 = Dimension('height', element => {
843
      const dom = element.dom;
845
      const dom = element.dom;
844
      return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight;
846
      return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight;
845
    });
847
    });
846
    const get$d = element => api$2.get(element);
848
    const get$e = element => api$2.get(element);
847
    const getOuter$2 = element => api$2.getOuter(element);
849
    const getOuter$2 = element => api$2.getOuter(element);
848
    const setMax$1 = (element, value) => {
850
    const setMax$1 = (element, value) => {
849
      const inclusions = [
851
      const inclusions = [
850
        'margin-top',
852
        'margin-top',
Línea 906... Línea 908...
906
      return boxPosition(dom);
908
      return boxPosition(dom);
907
    };
909
    };
Línea 908... Línea 910...
908
 
910
 
909
    const api$1 = Dimension('width', element => element.dom.offsetWidth);
911
    const api$1 = Dimension('width', element => element.dom.offsetWidth);
910
    const set$7 = (element, h) => api$1.set(element, h);
912
    const set$7 = (element, h) => api$1.set(element, h);
911
    const get$c = element => api$1.get(element);
913
    const get$d = element => api$1.get(element);
912
    const getOuter$1 = element => api$1.getOuter(element);
914
    const getOuter$1 = element => api$1.getOuter(element);
913
    const setMax = (element, value) => {
915
    const setMax = (element, value) => {
914
      const inclusions = [
916
      const inclusions = [
915
        'margin-left',
917
        'margin-left',
Línea 977... Línea 979...
977
      const group = i => {
979
      const group = i => {
978
        return Number(agent.replace(r, '$' + i));
980
        return Number(agent.replace(r, '$' + i));
979
      };
981
      };
980
      return nu$d(group(1), group(2));
982
      return nu$d(group(1), group(2));
981
    };
983
    };
982
    const detect$5 = (versionRegexes, agent) => {
984
    const detect$4 = (versionRegexes, agent) => {
983
      const cleanedAgent = String(agent).toLowerCase();
985
      const cleanedAgent = String(agent).toLowerCase();
984
      if (versionRegexes.length === 0) {
986
      if (versionRegexes.length === 0) {
985
        return unknown$3();
987
        return unknown$3();
986
      }
988
      }
987
      return find$3(versionRegexes, cleanedAgent);
989
      return find$3(versionRegexes, cleanedAgent);
Línea 995... Línea 997...
995
        minor
997
        minor
996
      };
998
      };
997
    };
999
    };
998
    const Version = {
1000
    const Version = {
999
      nu: nu$d,
1001
      nu: nu$d,
1000
      detect: detect$5,
1002
      detect: detect$4,
1001
      unknown: unknown$3
1003
      unknown: unknown$3
1002
    };
1004
    };
Línea 1003... Línea 1005...
1003
 
1005
 
1004
    const detectBrowser$1 = (browsers, userAgentData) => {
1006
    const detectBrowser$1 = (browsers, userAgentData) => {
Línea 1012... Línea 1014...
1012
          version: Version.nu(parseInt(uaBrand.version, 10), 0)
1014
          version: Version.nu(parseInt(uaBrand.version, 10), 0)
1013
        }));
1015
        }));
1014
      });
1016
      });
1015
    };
1017
    };
Línea 1016... Línea 1018...
1016
 
1018
 
1017
    const detect$4 = (candidates, userAgent) => {
1019
    const detect$3 = (candidates, userAgent) => {
1018
      const agent = String(userAgent).toLowerCase();
1020
      const agent = String(userAgent).toLowerCase();
1019
      return find$5(candidates, candidate => {
1021
      return find$5(candidates, candidate => {
1020
        return candidate.search(agent);
1022
        return candidate.search(agent);
1021
      });
1023
      });
1022
    };
1024
    };
1023
    const detectBrowser = (browsers, userAgent) => {
1025
    const detectBrowser = (browsers, userAgent) => {
1024
      return detect$4(browsers, userAgent).map(browser => {
1026
      return detect$3(browsers, userAgent).map(browser => {
1025
        const version = Version.detect(browser.versionRegexes, userAgent);
1027
        const version = Version.detect(browser.versionRegexes, userAgent);
1026
        return {
1028
        return {
1027
          current: browser.name,
1029
          current: browser.name,
1028
          version
1030
          version
1029
        };
1031
        };
1030
      });
1032
      });
1031
    };
1033
    };
1032
    const detectOs = (oses, userAgent) => {
1034
    const detectOs = (oses, userAgent) => {
1033
      return detect$4(oses, userAgent).map(os => {
1035
      return detect$3(oses, userAgent).map(os => {
1034
        const version = Version.detect(os.versionRegexes, userAgent);
1036
        const version = Version.detect(os.versionRegexes, userAgent);
1035
        return {
1037
        return {
1036
          current: os.name,
1038
          current: os.name,
1037
          version
1039
          version
Línea 1231... Línea 1233...
1231
      solaris: constant$1(solaris),
1233
      solaris: constant$1(solaris),
1232
      freebsd: constant$1(freebsd),
1234
      freebsd: constant$1(freebsd),
1233
      chromeos: constant$1(chromeos)
1235
      chromeos: constant$1(chromeos)
1234
    };
1236
    };
Línea 1235... Línea 1237...
1235
 
1237
 
1236
    const detect$3 = (userAgent, userAgentDataOpt, mediaMatch) => {
1238
    const detect$2 = (userAgent, userAgentDataOpt, mediaMatch) => {
1237
      const browsers = PlatformInfo.browsers();
1239
      const browsers = PlatformInfo.browsers();
1238
      const oses = PlatformInfo.oses();
1240
      const oses = PlatformInfo.oses();
1239
      const browser = userAgentDataOpt.bind(userAgentData => detectBrowser$1(browsers, userAgentData)).orThunk(() => detectBrowser(browsers, userAgent)).fold(Browser.unknown, Browser.nu);
1241
      const browser = userAgentDataOpt.bind(userAgentData => detectBrowser$1(browsers, userAgentData)).orThunk(() => detectBrowser(browsers, userAgent)).fold(Browser.unknown, Browser.nu);
1240
      const os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
1242
      const os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
Línea 1243... Línea 1245...
1243
        browser,
1245
        browser,
1244
        os,
1246
        os,
1245
        deviceType
1247
        deviceType
1246
      };
1248
      };
1247
    };
1249
    };
1248
    const PlatformDetection = { detect: detect$3 };
1250
    const PlatformDetection = { detect: detect$2 };
Línea 1249... Línea 1251...
1249
 
1251
 
1250
    const mediaMatch = query => window.matchMedia(query).matches;
1252
    const mediaMatch = query => window.matchMedia(query).matches;
1251
    let platform = cached(() => PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch));
1253
    let platform = cached(() => PlatformDetection.detect(window.navigator.userAgent, Optional.from(window.navigator.userAgentData), mediaMatch));
Línea 1252... Línea 1254...
1252
    const detect$2 = () => platform();
1254
    const detect$1 = () => platform();
1253
 
1255
 
1254
    const mkEvent = (target, x, y, stop, prevent, kill, raw) => ({
1256
    const mkEvent = (target, x, y, stop, prevent, kill, raw) => ({
1255
      target,
1257
      target,
Línea 1326... Línea 1328...
1326
    };
1328
    };
Línea 1327... Línea 1329...
1327
 
1329
 
1328
    const empty = element => {
1330
    const empty = element => {
1329
      element.dom.textContent = '';
1331
      element.dom.textContent = '';
1330
      each$1(children(element), rogue => {
1332
      each$1(children(element), rogue => {
1331
        remove$5(rogue);
1333
        remove$6(rogue);
1332
      });
1334
      });
1333
    };
1335
    };
1334
    const remove$5 = element => {
1336
    const remove$6 = element => {
1335
      const dom = element.dom;
1337
      const dom = element.dom;
1336
      if (dom.parentNode !== null) {
1338
      if (dom.parentNode !== null) {
1337
        dom.parentNode.removeChild(dom);
1339
        dom.parentNode.removeChild(dom);
1338
      }
1340
      }
Línea 1339... Línea 1341...
1339
    };
1341
    };
1340
 
1342
 
1341
    const get$b = _DOC => {
1343
    const get$c = _DOC => {
1342
      const doc = _DOC !== undefined ? _DOC.dom : document;
1344
      const doc = _DOC !== undefined ? _DOC.dom : document;
1343
      const x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
1345
      const x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
1344
      const y = doc.body.scrollTop || doc.documentElement.scrollTop;
1346
      const y = doc.body.scrollTop || doc.documentElement.scrollTop;
Línea 1350... Línea 1352...
1350
      if (win) {
1352
      if (win) {
1351
        win.scrollTo(x, y);
1353
        win.scrollTo(x, y);
1352
      }
1354
      }
1353
    };
1355
    };
Línea 1354... Línea 1356...
1354
 
1356
 
1355
    const get$a = _win => {
1357
    const get$b = _win => {
1356
      const win = _win === undefined ? window : _win;
1358
      const win = _win === undefined ? window : _win;
1357
      if (detect$2().browser.isFirefox()) {
1359
      if (detect$1().browser.isFirefox()) {
1358
        return Optional.none();
1360
        return Optional.none();
1359
      } else {
1361
      } else {
1360
        return Optional.from(win.visualViewport);
1362
        return Optional.from(win.visualViewport);
1361
      }
1363
      }
Línea 1369... Línea 1371...
1369
      bottom: y + height
1371
      bottom: y + height
1370
    });
1372
    });
1371
    const getBounds$3 = _win => {
1373
    const getBounds$3 = _win => {
1372
      const win = _win === undefined ? window : _win;
1374
      const win = _win === undefined ? window : _win;
1373
      const doc = win.document;
1375
      const doc = win.document;
1374
      const scroll = get$b(SugarElement.fromDom(doc));
1376
      const scroll = get$c(SugarElement.fromDom(doc));
1375
      return get$a(win).fold(() => {
1377
      return get$b(win).fold(() => {
1376
        const html = win.document.documentElement;
1378
        const html = win.document.documentElement;
1377
        const width = html.clientWidth;
1379
        const width = html.clientWidth;
1378
        const height = html.clientHeight;
1380
        const height = html.clientHeight;
1379
        return bounds$1(scroll.left, scroll.top, width, height);
1381
        return bounds$1(scroll.left, scroll.top, width, height);
1380
      }, visualViewport => bounds$1(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height));
1382
      }, visualViewport => bounds$1(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height));
Línea 1409... Línea 1411...
1409
        owner: owner$3
1411
        owner: owner$3
1410
    });
1412
    });
Línea 1411... Línea 1413...
1411
 
1413
 
1412
    const find$2 = element => {
1414
    const find$2 = element => {
1413
      const doc = getDocument();
1415
      const doc = getDocument();
1414
      const scroll = get$b(doc);
1416
      const scroll = get$c(doc);
1415
      const path = pathTo(element, Navigation);
1417
      const path = pathTo(element, Navigation);
1416
      return path.fold(curry(absolute$3, element), frames => {
1418
      return path.fold(curry(absolute$3, element), frames => {
1417
        const offset = viewport$1(element);
1419
        const offset = viewport$1(element);
1418
        const r = foldr(frames, (b, a) => {
1420
        const r = foldr(frames, (b, a) => {
Línea 1472... Línea 1474...
1472
    const constrainByMany = (original, constraints) => {
1474
    const constrainByMany = (original, constraints) => {
1473
      return foldl(constraints, (acc, c) => constrain(acc, c), original);
1475
      return foldl(constraints, (acc, c) => constrain(acc, c), original);
1474
    };
1476
    };
1475
    const win = () => getBounds$3(window);
1477
    const win = () => getBounds$3(window);
Línea -... Línea 1478...
-
 
1478
 
-
 
1479
    const Cell = initial => {
-
 
1480
      let value = initial;
-
 
1481
      const get = () => {
-
 
1482
        return value;
-
 
1483
      };
-
 
1484
      const set = v => {
-
 
1485
        value = v;
-
 
1486
      };
-
 
1487
      return {
-
 
1488
        get,
-
 
1489
        set
-
 
1490
      };
-
 
1491
    };
-
 
1492
 
-
 
1493
    const singleton$1 = doRevoke => {
-
 
1494
      const subject = Cell(Optional.none());
-
 
1495
      const revoke = () => subject.get().each(doRevoke);
-
 
1496
      const clear = () => {
-
 
1497
        revoke();
-
 
1498
        subject.set(Optional.none());
-
 
1499
      };
-
 
1500
      const isSet = () => subject.get().isSome();
-
 
1501
      const get = () => subject.get();
-
 
1502
      const set = s => {
-
 
1503
        revoke();
-
 
1504
        subject.set(Optional.some(s));
-
 
1505
      };
-
 
1506
      return {
-
 
1507
        clear,
-
 
1508
        isSet,
-
 
1509
        get,
-
 
1510
        set
-
 
1511
      };
-
 
1512
    };
-
 
1513
    const destroyable = () => singleton$1(s => s.destroy());
-
 
1514
    const unbindable = () => singleton$1(s => s.unbind());
-
 
1515
    const value$4 = () => {
-
 
1516
      const subject = singleton$1(noop);
-
 
1517
      const on = f => subject.get().each(f);
-
 
1518
      return {
-
 
1519
        ...subject,
-
 
1520
        on
-
 
1521
      };
-
 
1522
    };
1476
 
1523
 
Línea 1477... Línea 1524...
1477
    var global$a = tinymce.util.Tools.resolve('tinymce.ThemeManager');
1524
    var global$a = tinymce.util.Tools.resolve('tinymce.ThemeManager');
1478
 
1525
 
1479
    const value$4 = value => {
1526
    const value$3 = value => {
1480
      const applyHelper = fn => fn(value);
1527
      const applyHelper = fn => fn(value);
1481
      const constHelper = constant$1(value);
1528
      const constHelper = constant$1(value);
1482
      const outputHelper = () => output;
1529
      const outputHelper = () => output;
Línea 1524... Línea 1571...
1524
        each: noop,
1571
        each: noop,
1525
        toOptional: Optional.none
1572
        toOptional: Optional.none
1526
      };
1573
      };
1527
      return output;
1574
      return output;
1528
    };
1575
    };
1529
    const fromOption = (optional, err) => optional.fold(() => error$1(err), value$4);
1576
    const fromOption = (optional, err) => optional.fold(() => error$1(err), value$3);
1530
    const Result = {
1577
    const Result = {
1531
      value: value$4,
1578
      value: value$3,
1532
      error: error$1,
1579
      error: error$1,
1533
      fromOption
1580
      fromOption
1534
    };
1581
    };
Línea 1535... Línea 1582...
1535
 
1582
 
Línea 1712... Línea 1759...
1712
    const missingKey = (path, key) => nu$a(path, () => 'Choice schema did not contain choice key: "' + key + '"');
1759
    const missingKey = (path, key) => nu$a(path, () => 'Choice schema did not contain choice key: "' + key + '"');
1713
    const missingBranch = (path, branches, branch) => nu$a(path, () => 'The chosen schema: "' + branch + '" did not exist in branches: ' + formatObj(branches));
1760
    const missingBranch = (path, branches, branch) => nu$a(path, () => 'The chosen schema: "' + branch + '" did not exist in branches: ' + formatObj(branches));
1714
    const unsupportedFields = (path, unsupported) => nu$a(path, () => 'There are unsupported fields: [' + unsupported.join(', ') + '] specified');
1761
    const unsupportedFields = (path, unsupported) => nu$a(path, () => 'There are unsupported fields: [' + unsupported.join(', ') + '] specified');
1715
    const custom = (path, err) => nu$a(path, constant$1(err));
1762
    const custom = (path, err) => nu$a(path, constant$1(err));
Línea 1716... Línea 1763...
1716
 
1763
 
1717
    const value$3 = validator => {
1764
    const value$2 = validator => {
1718
      const extract = (path, val) => {
1765
      const extract = (path, val) => {
1719
        return SimpleResult.bindError(validator(val), err => custom(path, err));
1766
        return SimpleResult.bindError(validator(val), err => custom(path, err));
1720
      };
1767
      };
1721
      const toString = constant$1('val');
1768
      const toString = constant$1('val');
1722
      return {
1769
      return {
1723
        extract,
1770
        extract,
1724
        toString
1771
        toString
1725
      };
1772
      };
1726
    };
1773
    };
Línea 1727... Línea 1774...
1727
    const anyValue$1 = value$3(SimpleResult.svalue);
1774
    const anyValue$1 = value$2(SimpleResult.svalue);
1728
 
1775
 
1729
    const requiredAccess = (path, obj, key, bundle) => get$g(obj, key).fold(() => missingRequired(path, key, obj), bundle);
1776
    const requiredAccess = (path, obj, key, bundle) => get$h(obj, key).fold(() => missingRequired(path, key, obj), bundle);
1730
    const fallbackAccess = (obj, key, fallback, bundle) => {
1777
    const fallbackAccess = (obj, key, fallback, bundle) => {
1731
      const v = get$g(obj, key).getOrThunk(() => fallback(obj));
1778
      const v = get$h(obj, key).getOrThunk(() => fallback(obj));
1732
      return bundle(v);
1779
      return bundle(v);
1733
    };
1780
    };
1734
    const optionAccess = (obj, key, bundle) => bundle(get$g(obj, key));
1781
    const optionAccess = (obj, key, bundle) => bundle(get$h(obj, key));
1735
    const optionDefaultedAccess = (obj, key, fallback, bundle) => {
1782
    const optionDefaultedAccess = (obj, key, fallback, bundle) => {
1736
      const opt = get$g(obj, key).map(val => val === true ? fallback(obj) : val);
1783
      const opt = get$h(obj, key).map(val => val === true ? fallback(obj) : val);
1737
      return bundle(opt);
1784
      return bundle(opt);
1738
    };
1785
    };
1739
    const extractField = (field, path, obj, key, prop) => {
1786
    const extractField = (field, path, obj, key, prop) => {
Línea 1843... Línea 1890...
1843
        extract,
1890
        extract,
1844
        toString
1891
        toString
1845
      };
1892
      };
1846
    };
1893
    };
1847
    const setOf$1 = (validator, prop) => {
1894
    const setOf$1 = (validator, prop) => {
1848
      const validateKeys = (path, keys) => arrOf(value$3(validator)).extract(path, keys);
1895
      const validateKeys = (path, keys) => arrOf(value$2(validator)).extract(path, keys);
1849
      const extract = (path, o) => {
1896
      const extract = (path, o) => {
1850
        const keys$1 = keys(o);
1897
        const keys$1 = keys(o);
1851
        const validatedKeys = validateKeys(path, keys$1);
1898
        const validatedKeys = validateKeys(path, keys$1);
1852
        return SimpleResult.bind(validatedKeys, validKeys => {
1899
        return SimpleResult.bind(validatedKeys, validKeys => {
1853
          const schema = map$2(validKeys, vk => {
1900
          const schema = map$2(validKeys, vk => {
Línea 1872... Línea 1919...
1872
      };
1919
      };
1873
    };
1920
    };
1874
    const arrOfObj = compose(arrOf, objOf);
1921
    const arrOfObj = compose(arrOf, objOf);
Línea 1875... Línea 1922...
1875
 
1922
 
1876
    const anyValue = constant$1(anyValue$1);
1923
    const anyValue = constant$1(anyValue$1);
1877
    const typedValue = (validator, expectedType) => value$3(a => {
1924
    const typedValue = (validator, expectedType) => value$2(a => {
1878
      const actualType = typeof a;
1925
      const actualType = typeof a;
1879
      return validator(a) ? SimpleResult.svalue(a) : SimpleResult.serror(`Expected type: ${ expectedType } but got: ${ actualType }`);
1926
      return validator(a) ? SimpleResult.svalue(a) : SimpleResult.serror(`Expected type: ${ expectedType } but got: ${ actualType }`);
1880
    });
1927
    });
1881
    const number = typedValue(isNumber, 'number');
1928
    const number = typedValue(isNumber, 'number');
Línea 1903... Línea 1950...
1903
        return Object.keys(val).every(prop => isPostMessageable(val[prop]));
1950
        return Object.keys(val).every(prop => isPostMessageable(val[prop]));
1904
      default:
1951
      default:
1905
        return false;
1952
        return false;
1906
      }
1953
      }
1907
    };
1954
    };
1908
    const postMessageable = value$3(a => {
1955
    const postMessageable = value$2(a => {
1909
      if (isPostMessageable(a)) {
1956
      if (isPostMessageable(a)) {
1910
        return SimpleResult.svalue(a);
1957
        return SimpleResult.svalue(a);
1911
      } else {
1958
      } else {
1912
        return SimpleResult.serror('Expected value to be acceptable for sending via postMessage');
1959
        return SimpleResult.serror('Expected value to be acceptable for sending via postMessage');
1913
      }
1960
      }
1914
    });
1961
    });
Línea 1915... Línea 1962...
1915
 
1962
 
1916
    const chooseFrom = (path, input, branches, ch) => {
1963
    const chooseFrom = (path, input, branches, ch) => {
1917
      const fields = get$g(branches, ch);
1964
      const fields = get$h(branches, ch);
1918
      return fields.fold(() => missingBranch(path, branches, ch), vp => vp.extract(path.concat(['branch: ' + ch]), input));
1965
      return fields.fold(() => missingBranch(path, branches, ch), vp => vp.extract(path.concat(['branch: ' + ch]), input));
1919
    };
1966
    };
1920
    const choose$2 = (key, branches) => {
1967
    const choose$2 = (key, branches) => {
1921
      const extract = (path, input) => {
1968
      const extract = (path, input) => {
1922
        const choice = get$g(input, key);
1969
        const choice = get$h(input, key);
1923
        return choice.fold(() => missingKey(path, key), chosen => chooseFrom(path, input, branches, chosen));
1970
        return choice.fold(() => missingKey(path, key), chosen => chooseFrom(path, input, branches, chosen));
1924
      };
1971
      };
1925
      const toString = () => 'chooseOn(' + key + '). Possible values: ' + keys(branches);
1972
      const toString = () => 'chooseOn(' + key + '). Possible values: ' + keys(branches);
1926
      return {
1973
      return {
1927
        extract,
1974
        extract,
1928
        toString
1975
        toString
1929
      };
1976
      };
Línea 1930... Línea 1977...
1930
    };
1977
    };
1931
 
1978
 
1932
    const arrOfVal = () => arrOf(anyValue$1);
1979
    const arrOfVal = () => arrOf(anyValue$1);
1933
    const valueOf = validator => value$3(v => validator(v).fold(SimpleResult.serror, SimpleResult.svalue));
1980
    const valueOf = validator => value$2(v => validator(v).fold(SimpleResult.serror, SimpleResult.svalue));
1934
    const setOf = (validator, prop) => setOf$1(v => SimpleResult.fromResult(validator(v)), prop);
1981
    const setOf = (validator, prop) => setOf$1(v => SimpleResult.fromResult(validator(v)), prop);
1935
    const extractValue = (label, prop, obj) => {
1982
    const extractValue = (label, prop, obj) => {
1936
      const res = prop.extract([label], obj);
1983
      const res = prop.extract([label], obj);
Línea 1958... Línea 2005...
1958
    const required$1 = key => field$1(key, key, required$2(), anyValue());
2005
    const required$1 = key => field$1(key, key, required$2(), anyValue());
1959
    const requiredOf = (key, schema) => field$1(key, key, required$2(), schema);
2006
    const requiredOf = (key, schema) => field$1(key, key, required$2(), schema);
1960
    const requiredNumber = key => requiredOf(key, number);
2007
    const requiredNumber = key => requiredOf(key, number);
1961
    const requiredString = key => requiredOf(key, string);
2008
    const requiredString = key => requiredOf(key, string);
1962
    const requiredStringEnum = (key, values) => field$1(key, key, required$2(), validateEnum(values));
2009
    const requiredStringEnum = (key, values) => field$1(key, key, required$2(), validateEnum(values));
1963
    const requiredBoolean = key => requiredOf(key, boolean);
-
 
1964
    const requiredFunction = key => requiredOf(key, functionProcessor);
2010
    const requiredFunction = key => requiredOf(key, functionProcessor);
1965
    const forbid = (key, message) => field$1(key, key, asOption(), value$3(_v => SimpleResult.serror('The field: ' + key + ' is forbidden. ' + message)));
2011
    const forbid = (key, message) => field$1(key, key, asOption(), value$2(_v => SimpleResult.serror('The field: ' + key + ' is forbidden. ' + message)));
1966
    const requiredObjOf = (key, objSchema) => field$1(key, key, required$2(), objOf(objSchema));
2012
    const requiredObjOf = (key, objSchema) => field$1(key, key, required$2(), objOf(objSchema));
1967
    const requiredArrayOfObj = (key, objFields) => field$1(key, key, required$2(), arrOfObj(objFields));
2013
    const requiredArrayOfObj = (key, objFields) => field$1(key, key, required$2(), arrOfObj(objFields));
1968
    const requiredArrayOf = (key, schema) => field$1(key, key, required$2(), arrOf(schema));
2014
    const requiredArrayOf = (key, schema) => field$1(key, key, required$2(), arrOf(schema));
1969
    const option$3 = key => field$1(key, key, asOption(), anyValue());
2015
    const option$3 = key => field$1(key, key, asOption(), anyValue());
1970
    const optionOf = (key, schema) => field$1(key, key, asOption(), schema);
2016
    const optionOf = (key, schema) => field$1(key, key, asOption(), schema);
Línea 1984... Línea 2030...
1984
    const defaultedFunction = (key, fallback) => defaultedOf(key, fallback, functionProcessor);
2030
    const defaultedFunction = (key, fallback) => defaultedOf(key, fallback, functionProcessor);
1985
    const defaultedPostMsg = (key, fallback) => defaultedOf(key, fallback, postMessageable);
2031
    const defaultedPostMsg = (key, fallback) => defaultedOf(key, fallback, postMessageable);
1986
    const defaultedArrayOf = (key, fallback, schema) => defaultedOf(key, fallback, arrOf(schema));
2032
    const defaultedArrayOf = (key, fallback, schema) => defaultedOf(key, fallback, arrOf(schema));
1987
    const defaultedObjOf = (key, fallback, objSchema) => defaultedOf(key, fallback, objOf(objSchema));
2033
    const defaultedObjOf = (key, fallback, objSchema) => defaultedOf(key, fallback, objOf(objSchema));
Línea 1988... Línea -...
1988
 
-
 
1989
    const Cell = initial => {
-
 
1990
      let value = initial;
-
 
1991
      const get = () => {
-
 
1992
        return value;
-
 
1993
      };
-
 
1994
      const set = v => {
-
 
1995
        value = v;
-
 
1996
      };
-
 
1997
      return {
-
 
1998
        get,
-
 
1999
        set
-
 
2000
      };
-
 
2001
    };
-
 
2002
 
2034
 
2003
    const generate$7 = cases => {
2035
    const generate$7 = cases => {
2004
      if (!isArray(cases)) {
2036
      if (!isArray(cases)) {
2005
        throw new Error('cases must be an array');
2037
        throw new Error('cases must be an array');
2006
      }
2038
      }
Línea 2373... Línea 2405...
2373
    const runOnAttached = runOnSourceName(attachedToDom());
2405
    const runOnAttached = runOnSourceName(attachedToDom());
2374
    const runOnDetached = runOnSourceName(detachedFromDom());
2406
    const runOnDetached = runOnSourceName(detachedFromDom());
2375
    const runOnInit = runOnSourceName(systemInit());
2407
    const runOnInit = runOnSourceName(systemInit());
2376
    const runOnExecute$1 = runOnName(execute$5());
2408
    const runOnExecute$1 = runOnName(execute$5());
Línea -... Línea 2409...
-
 
2409
 
-
 
2410
    const markAsBehaviourApi = (f, apiName, apiFunction) => {
-
 
2411
      const delegate = apiFunction.toString();
-
 
2412
      const endIndex = delegate.indexOf(')') + 1;
-
 
2413
      const openBracketIndex = delegate.indexOf('(');
-
 
2414
      const parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/);
-
 
2415
      f.toFunctionAnnotation = () => ({
-
 
2416
        name: apiName,
-
 
2417
        parameters: cleanParameters(parameters.slice(0, 1).concat(parameters.slice(3)))
-
 
2418
      });
-
 
2419
      return f;
-
 
2420
    };
-
 
2421
    const cleanParameters = parameters => map$2(parameters, p => endsWith(p, '/*') ? p.substring(0, p.length - '/*'.length) : p);
-
 
2422
    const markAsExtraApi = (f, extraName) => {
-
 
2423
      const delegate = f.toString();
-
 
2424
      const endIndex = delegate.indexOf(')') + 1;
-
 
2425
      const openBracketIndex = delegate.indexOf('(');
-
 
2426
      const parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/);
-
 
2427
      f.toFunctionAnnotation = () => ({
-
 
2428
        name: extraName,
-
 
2429
        parameters: cleanParameters(parameters)
-
 
2430
      });
-
 
2431
      return f;
-
 
2432
    };
-
 
2433
    const markAsSketchApi = (f, apiFunction) => {
-
 
2434
      const delegate = apiFunction.toString();
-
 
2435
      const endIndex = delegate.indexOf(')') + 1;
-
 
2436
      const openBracketIndex = delegate.indexOf('(');
-
 
2437
      const parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/);
-
 
2438
      f.toFunctionAnnotation = () => ({
-
 
2439
        name: 'OVERRIDE',
-
 
2440
        parameters: cleanParameters(parameters.slice(1))
-
 
2441
      });
-
 
2442
      return f;
-
 
2443
    };
-
 
2444
 
-
 
2445
    const nu$8 = s => ({
-
 
2446
      classes: isUndefined(s.classes) ? [] : s.classes,
-
 
2447
      attributes: isUndefined(s.attributes) ? {} : s.attributes,
-
 
2448
      styles: isUndefined(s.styles) ? {} : s.styles
-
 
2449
    });
-
 
2450
    const merge = (defnA, mod) => ({
-
 
2451
      ...defnA,
-
 
2452
      attributes: {
-
 
2453
        ...defnA.attributes,
-
 
2454
        ...mod.attributes
-
 
2455
      },
-
 
2456
      styles: {
-
 
2457
        ...defnA.styles,
-
 
2458
        ...mod.styles
-
 
2459
      },
-
 
2460
      classes: defnA.classes.concat(mod.classes)
-
 
2461
    });
-
 
2462
 
-
 
2463
    const executeEvent = (bConfig, bState, executor) => runOnExecute$1(component => {
-
 
2464
      executor(component, bConfig, bState);
-
 
2465
    });
-
 
2466
    const loadEvent = (bConfig, bState, f) => runOnInit((component, _simulatedEvent) => {
-
 
2467
      f(component, bConfig, bState);
-
 
2468
    });
-
 
2469
    const create$5 = (schema, name, active, apis, extra, state) => {
-
 
2470
      const configSchema = objOfOnly(schema);
-
 
2471
      const schemaSchema = optionObjOf(name, [optionObjOfOnly('config', schema)]);
-
 
2472
      return doCreate(configSchema, schemaSchema, name, active, apis, extra, state);
-
 
2473
    };
-
 
2474
    const createModes$1 = (modes, name, active, apis, extra, state) => {
-
 
2475
      const configSchema = modes;
-
 
2476
      const schemaSchema = optionObjOf(name, [optionOf('config', modes)]);
-
 
2477
      return doCreate(configSchema, schemaSchema, name, active, apis, extra, state);
-
 
2478
    };
-
 
2479
    const wrapApi = (bName, apiFunction, apiName) => {
-
 
2480
      const f = (component, ...rest) => {
-
 
2481
        const args = [component].concat(rest);
-
 
2482
        return component.config({ name: constant$1(bName) }).fold(() => {
-
 
2483
          throw new Error('We could not find any behaviour configuration for: ' + bName + '. Using API: ' + apiName);
-
 
2484
        }, info => {
-
 
2485
          const rest = Array.prototype.slice.call(args, 1);
-
 
2486
          return apiFunction.apply(undefined, [
-
 
2487
            component,
-
 
2488
            info.config,
-
 
2489
            info.state
-
 
2490
          ].concat(rest));
-
 
2491
        });
-
 
2492
      };
-
 
2493
      return markAsBehaviourApi(f, apiName, apiFunction);
-
 
2494
    };
-
 
2495
    const revokeBehaviour = name => ({
-
 
2496
      key: name,
-
 
2497
      value: undefined
-
 
2498
    });
-
 
2499
    const doCreate = (configSchema, schemaSchema, name, active, apis, extra, state) => {
-
 
2500
      const getConfig = info => hasNonNullableKey(info, name) ? info[name]() : Optional.none();
-
 
2501
      const wrappedApis = map$1(apis, (apiF, apiName) => wrapApi(name, apiF, apiName));
-
 
2502
      const wrappedExtra = map$1(extra, (extraF, extraName) => markAsExtraApi(extraF, extraName));
-
 
2503
      const me = {
-
 
2504
        ...wrappedExtra,
-
 
2505
        ...wrappedApis,
-
 
2506
        revoke: curry(revokeBehaviour, name),
-
 
2507
        config: spec => {
-
 
2508
          const prepared = asRawOrDie$1(name + '-config', configSchema, spec);
-
 
2509
          return {
-
 
2510
            key: name,
-
 
2511
            value: {
-
 
2512
              config: prepared,
-
 
2513
              me,
-
 
2514
              configAsRaw: cached(() => asRawOrDie$1(name + '-config', configSchema, spec)),
-
 
2515
              initialConfig: spec,
-
 
2516
              state
-
 
2517
            }
-
 
2518
          };
-
 
2519
        },
-
 
2520
        schema: constant$1(schemaSchema),
-
 
2521
        exhibit: (info, base) => {
-
 
2522
          return lift2(getConfig(info), get$h(active, 'exhibit'), (behaviourInfo, exhibitor) => {
-
 
2523
            return exhibitor(base, behaviourInfo.config, behaviourInfo.state);
-
 
2524
          }).getOrThunk(() => nu$8({}));
-
 
2525
        },
-
 
2526
        name: constant$1(name),
-
 
2527
        handlers: info => {
-
 
2528
          return getConfig(info).map(behaviourInfo => {
-
 
2529
            const getEvents = get$h(active, 'events').getOr(() => ({}));
-
 
2530
            return getEvents(behaviourInfo.config, behaviourInfo.state);
-
 
2531
          }).getOr({});
-
 
2532
        }
-
 
2533
      };
-
 
2534
      return me;
-
 
2535
    };
-
 
2536
 
-
 
2537
    const NoState = { init: () => nu$7({ readState: constant$1('No State required') }) };
-
 
2538
    const nu$7 = spec => spec;
-
 
2539
 
-
 
2540
    const derive$1 = capabilities => wrapAll(capabilities);
-
 
2541
    const simpleSchema = objOfOnly([
-
 
2542
      required$1('fields'),
-
 
2543
      required$1('name'),
-
 
2544
      defaulted('active', {}),
-
 
2545
      defaulted('apis', {}),
-
 
2546
      defaulted('state', NoState),
-
 
2547
      defaulted('extra', {})
-
 
2548
    ]);
-
 
2549
    const create$4 = data => {
-
 
2550
      const value = asRawOrDie$1('Creating behaviour: ' + data.name, simpleSchema, data);
-
 
2551
      return create$5(value.fields, value.name, value.active, value.apis, value.extra, value.state);
-
 
2552
    };
-
 
2553
    const modeSchema = objOfOnly([
-
 
2554
      required$1('branchKey'),
-
 
2555
      required$1('branches'),
-
 
2556
      required$1('name'),
-
 
2557
      defaulted('active', {}),
-
 
2558
      defaulted('apis', {}),
-
 
2559
      defaulted('state', NoState),
-
 
2560
      defaulted('extra', {})
-
 
2561
    ]);
-
 
2562
    const createModes = data => {
-
 
2563
      const value = asRawOrDie$1('Creating behaviour: ' + data.name, modeSchema, data);
-
 
2564
      return createModes$1(choose$1(value.branchKey, value.branches), value.name, value.active, value.apis, value.extra, value.state);
-
 
2565
    };
-
 
2566
    const revoke = constant$1(undefined);
-
 
2567
 
-
 
2568
    const read$1 = (element, attr) => {
-
 
2569
      const value = get$g(element, attr);
-
 
2570
      return value === undefined || value === '' ? [] : value.split(' ');
-
 
2571
    };
-
 
2572
    const add$4 = (element, attr, id) => {
-
 
2573
      const old = read$1(element, attr);
-
 
2574
      const nu = old.concat([id]);
-
 
2575
      set$9(element, attr, nu.join(' '));
-
 
2576
      return true;
-
 
2577
    };
-
 
2578
    const remove$5 = (element, attr, id) => {
-
 
2579
      const nu = filter$2(read$1(element, attr), v => v !== id);
-
 
2580
      if (nu.length > 0) {
-
 
2581
        set$9(element, attr, nu.join(' '));
-
 
2582
      } else {
-
 
2583
        remove$8(element, attr);
-
 
2584
      }
-
 
2585
      return false;
-
 
2586
    };
-
 
2587
 
-
 
2588
    const supports = element => element.dom.classList !== undefined;
-
 
2589
    const get$a = element => read$1(element, 'class');
-
 
2590
    const add$3 = (element, clazz) => add$4(element, 'class', clazz);
-
 
2591
    const remove$4 = (element, clazz) => remove$5(element, 'class', clazz);
-
 
2592
    const toggle$5 = (element, clazz) => {
-
 
2593
      if (contains$2(get$a(element), clazz)) {
-
 
2594
        return remove$4(element, clazz);
-
 
2595
      } else {
-
 
2596
        return add$3(element, clazz);
-
 
2597
      }
-
 
2598
    };
-
 
2599
 
-
 
2600
    const add$2 = (element, clazz) => {
-
 
2601
      if (supports(element)) {
-
 
2602
        element.dom.classList.add(clazz);
-
 
2603
      } else {
-
 
2604
        add$3(element, clazz);
-
 
2605
      }
-
 
2606
    };
-
 
2607
    const cleanClass = element => {
-
 
2608
      const classList = supports(element) ? element.dom.classList : get$a(element);
-
 
2609
      if (classList.length === 0) {
-
 
2610
        remove$8(element, 'class');
-
 
2611
      }
-
 
2612
    };
-
 
2613
    const remove$3 = (element, clazz) => {
-
 
2614
      if (supports(element)) {
-
 
2615
        const classList = element.dom.classList;
-
 
2616
        classList.remove(clazz);
-
 
2617
      } else {
-
 
2618
        remove$4(element, clazz);
-
 
2619
      }
-
 
2620
      cleanClass(element);
-
 
2621
    };
-
 
2622
    const toggle$4 = (element, clazz) => {
-
 
2623
      const result = supports(element) ? element.dom.classList.toggle(clazz) : toggle$5(element, clazz);
-
 
2624
      cleanClass(element);
-
 
2625
      return result;
-
 
2626
    };
-
 
2627
    const has = (element, clazz) => supports(element) && element.dom.classList.contains(clazz);
-
 
2628
 
-
 
2629
    const add$1 = (element, classes) => {
-
 
2630
      each$1(classes, x => {
-
 
2631
        add$2(element, x);
-
 
2632
      });
-
 
2633
    };
-
 
2634
    const remove$2 = (element, classes) => {
-
 
2635
      each$1(classes, x => {
-
 
2636
        remove$3(element, x);
-
 
2637
      });
-
 
2638
    };
-
 
2639
    const toggle$3 = (element, classes) => {
-
 
2640
      each$1(classes, x => {
-
 
2641
        toggle$4(element, x);
-
 
2642
      });
-
 
2643
    };
-
 
2644
    const hasAll = (element, classes) => forall(classes, clazz => has(element, clazz));
-
 
2645
    const getNative = element => {
-
 
2646
      const classList = element.dom.classList;
-
 
2647
      const r = new Array(classList.length);
-
 
2648
      for (let i = 0; i < classList.length; i++) {
-
 
2649
        const item = classList.item(i);
-
 
2650
        if (item !== null) {
-
 
2651
          r[i] = item;
-
 
2652
        }
-
 
2653
      }
-
 
2654
      return r;
-
 
2655
    };
-
 
2656
    const get$9 = element => supports(element) ? getNative(element) : get$a(element);
-
 
2657
 
-
 
2658
    const NuPositionCss = (position, left, top, right, bottom) => {
-
 
2659
      const toPx = num => num + 'px';
-
 
2660
      return {
-
 
2661
        position,
-
 
2662
        left: left.map(toPx),
-
 
2663
        top: top.map(toPx),
-
 
2664
        right: right.map(toPx),
-
 
2665
        bottom: bottom.map(toPx)
-
 
2666
      };
-
 
2667
    };
-
 
2668
    const toOptions = position => ({
-
 
2669
      ...position,
-
 
2670
      position: Optional.some(position.position)
-
 
2671
    });
-
 
2672
    const applyPositionCss = (element, position) => {
-
 
2673
      setOptions(element, toOptions(position));
-
 
2674
    };
-
 
2675
 
-
 
2676
    const getOffsetParent = element => {
-
 
2677
      const isFixed = is$1(getRaw(element, 'position'), 'fixed');
-
 
2678
      const offsetParent$1 = isFixed ? Optional.none() : offsetParent(element);
-
 
2679
      return offsetParent$1.orThunk(() => {
-
 
2680
        const marker = SugarElement.fromTag('span');
-
 
2681
        return parent(element).bind(parent => {
-
 
2682
          append$2(parent, marker);
-
 
2683
          const offsetParent$1 = offsetParent(marker);
-
 
2684
          remove$6(marker);
-
 
2685
          return offsetParent$1;
-
 
2686
        });
-
 
2687
      });
-
 
2688
    };
-
 
2689
    const getOrigin = element => getOffsetParent(element).map(absolute$3).getOrThunk(() => SugarPosition(0, 0));
-
 
2690
 
-
 
2691
    const appear = (component, contextualInfo) => {
-
 
2692
      const elem = component.element;
-
 
2693
      add$2(elem, contextualInfo.transitionClass);
-
 
2694
      remove$3(elem, contextualInfo.fadeOutClass);
-
 
2695
      add$2(elem, contextualInfo.fadeInClass);
-
 
2696
      contextualInfo.onShow(component);
-
 
2697
    };
-
 
2698
    const disappear = (component, contextualInfo) => {
-
 
2699
      const elem = component.element;
-
 
2700
      add$2(elem, contextualInfo.transitionClass);
-
 
2701
      remove$3(elem, contextualInfo.fadeInClass);
-
 
2702
      add$2(elem, contextualInfo.fadeOutClass);
-
 
2703
      contextualInfo.onHide(component);
-
 
2704
    };
-
 
2705
    const isPartiallyVisible = (box, bounds) => box.y < bounds.bottom && box.bottom > bounds.y;
-
 
2706
    const isTopCompletelyVisible = (box, bounds) => box.y >= bounds.y;
-
 
2707
    const isBottomCompletelyVisible = (box, bounds) => box.bottom <= bounds.bottom;
-
 
2708
    const forceTopPosition = (winBox, leftX, viewport) => ({
-
 
2709
      location: 'top',
-
 
2710
      leftX,
-
 
2711
      topY: viewport.bounds.y - winBox.y
-
 
2712
    });
-
 
2713
    const forceBottomPosition = (winBox, leftX, viewport) => ({
-
 
2714
      location: 'bottom',
-
 
2715
      leftX,
-
 
2716
      bottomY: winBox.bottom - viewport.bounds.bottom
-
 
2717
    });
-
 
2718
    const getDockedLeftPosition = bounds => {
-
 
2719
      return bounds.box.x - bounds.win.x;
-
 
2720
    };
-
 
2721
    const tryDockingPosition = (modes, bounds, viewport) => {
-
 
2722
      const winBox = bounds.win;
-
 
2723
      const box = bounds.box;
-
 
2724
      const leftX = getDockedLeftPosition(bounds);
-
 
2725
      return findMap(modes, mode => {
-
 
2726
        switch (mode) {
-
 
2727
        case 'bottom':
-
 
2728
          return !isBottomCompletelyVisible(box, viewport.bounds) ? Optional.some(forceBottomPosition(winBox, leftX, viewport)) : Optional.none();
-
 
2729
        case 'top':
-
 
2730
          return !isTopCompletelyVisible(box, viewport.bounds) ? Optional.some(forceTopPosition(winBox, leftX, viewport)) : Optional.none();
-
 
2731
        default:
-
 
2732
          return Optional.none();
-
 
2733
        }
-
 
2734
      }).getOr({ location: 'no-dock' });
-
 
2735
    };
-
 
2736
    const isVisibleForModes = (modes, box, viewport) => forall(modes, mode => {
-
 
2737
      switch (mode) {
-
 
2738
      case 'bottom':
-
 
2739
        return isBottomCompletelyVisible(box, viewport.bounds);
-
 
2740
      case 'top':
-
 
2741
        return isTopCompletelyVisible(box, viewport.bounds);
-
 
2742
      }
-
 
2743
    });
-
 
2744
    const getXYForRestoring = (pos, viewport) => {
-
 
2745
      const priorY = viewport.optScrollEnv.fold(constant$1(pos.bounds.y), scrollEnv => scrollEnv.scrollElmTop + (pos.bounds.y - scrollEnv.currentScrollTop));
-
 
2746
      return SugarPosition(pos.bounds.x, priorY);
-
 
2747
    };
-
 
2748
    const getXYForSaving = (box, viewport) => {
-
 
2749
      const priorY = viewport.optScrollEnv.fold(constant$1(box.y), scrollEnv => box.y + scrollEnv.currentScrollTop - scrollEnv.scrollElmTop);
-
 
2750
      return SugarPosition(box.x, priorY);
-
 
2751
    };
-
 
2752
    const getPrior = (elem, viewport, state) => state.getInitialPos().map(pos => {
-
 
2753
      const xy = getXYForRestoring(pos, viewport);
-
 
2754
      return {
-
 
2755
        box: bounds(xy.left, xy.top, get$d(elem), get$e(elem)),
-
 
2756
        location: pos.location
-
 
2757
      };
-
 
2758
    });
-
 
2759
    const storePrior = (elem, box, viewport, state, decision) => {
-
 
2760
      const xy = getXYForSaving(box, viewport);
-
 
2761
      const bounds$1 = bounds(xy.left, xy.top, box.width, box.height);
-
 
2762
      state.setInitialPos({
-
 
2763
        style: getAllRaw(elem),
-
 
2764
        position: get$f(elem, 'position') || 'static',
-
 
2765
        bounds: bounds$1,
-
 
2766
        location: decision.location
-
 
2767
      });
-
 
2768
    };
-
 
2769
    const storePriorIfNone = (elem, box, viewport, state, decision) => {
-
 
2770
      state.getInitialPos().fold(() => storePrior(elem, box, viewport, state, decision), () => noop);
-
 
2771
    };
-
 
2772
    const revertToOriginal = (elem, box, state) => state.getInitialPos().bind(position => {
-
 
2773
      var _a;
-
 
2774
      state.clearInitialPos();
-
 
2775
      switch (position.position) {
-
 
2776
      case 'static':
-
 
2777
        return Optional.some({ morph: 'static' });
-
 
2778
      case 'absolute':
-
 
2779
        const offsetParent = getOffsetParent(elem).getOr(body());
-
 
2780
        const offsetBox = box$1(offsetParent);
-
 
2781
        const scrollDelta = (_a = offsetParent.dom.scrollTop) !== null && _a !== void 0 ? _a : 0;
-
 
2782
        return Optional.some({
-
 
2783
          morph: 'absolute',
-
 
2784
          positionCss: NuPositionCss('absolute', get$h(position.style, 'left').map(_left => box.x - offsetBox.x), get$h(position.style, 'top').map(_top => box.y - offsetBox.y + scrollDelta), get$h(position.style, 'right').map(_right => offsetBox.right - box.right), get$h(position.style, 'bottom').map(_bottom => offsetBox.bottom - box.bottom))
-
 
2785
        });
-
 
2786
      default:
-
 
2787
        return Optional.none();
-
 
2788
      }
-
 
2789
    });
-
 
2790
    const tryMorphToOriginal = (elem, viewport, state) => getPrior(elem, viewport, state).filter(({box}) => isVisibleForModes(state.getModes(), box, viewport)).bind(({box}) => revertToOriginal(elem, box, state));
-
 
2791
    const tryDecisionToFixedMorph = decision => {
-
 
2792
      switch (decision.location) {
-
 
2793
      case 'top': {
-
 
2794
          return Optional.some({
-
 
2795
            morph: 'fixed',
-
 
2796
            positionCss: NuPositionCss('fixed', Optional.some(decision.leftX), Optional.some(decision.topY), Optional.none(), Optional.none())
-
 
2797
          });
-
 
2798
        }
-
 
2799
      case 'bottom': {
-
 
2800
          return Optional.some({
-
 
2801
            morph: 'fixed',
-
 
2802
            positionCss: NuPositionCss('fixed', Optional.some(decision.leftX), Optional.none(), Optional.none(), Optional.some(decision.bottomY))
-
 
2803
          });
-
 
2804
        }
-
 
2805
      default:
-
 
2806
        return Optional.none();
-
 
2807
      }
-
 
2808
    };
-
 
2809
    const tryMorphToFixed = (elem, viewport, state) => {
-
 
2810
      const box = box$1(elem);
-
 
2811
      const winBox = win();
-
 
2812
      const decision = tryDockingPosition(state.getModes(), {
-
 
2813
        win: winBox,
-
 
2814
        box
-
 
2815
      }, viewport);
-
 
2816
      if (decision.location === 'top' || decision.location === 'bottom') {
-
 
2817
        storePrior(elem, box, viewport, state, decision);
-
 
2818
        return tryDecisionToFixedMorph(decision);
-
 
2819
      } else {
-
 
2820
        return Optional.none();
-
 
2821
      }
-
 
2822
    };
-
 
2823
    const tryMorphToOriginalOrUpdateFixed = (elem, viewport, state) => {
-
 
2824
      return tryMorphToOriginal(elem, viewport, state).orThunk(() => {
-
 
2825
        return viewport.optScrollEnv.bind(_ => getPrior(elem, viewport, state)).bind(({box, location}) => {
-
 
2826
          const winBox = win();
-
 
2827
          const leftX = getDockedLeftPosition({
-
 
2828
            win: winBox,
-
 
2829
            box
-
 
2830
          });
-
 
2831
          const decision = location === 'top' ? forceTopPosition(winBox, leftX, viewport) : forceBottomPosition(winBox, leftX, viewport);
-
 
2832
          return tryDecisionToFixedMorph(decision);
-
 
2833
        });
-
 
2834
      });
-
 
2835
    };
-
 
2836
    const tryMorph = (component, viewport, state) => {
-
 
2837
      const elem = component.element;
-
 
2838
      const isDocked = is$1(getRaw(elem, 'position'), 'fixed');
-
 
2839
      return isDocked ? tryMorphToOriginalOrUpdateFixed(elem, viewport, state) : tryMorphToFixed(elem, viewport, state);
-
 
2840
    };
-
 
2841
    const calculateMorphToOriginal = (component, viewport, state) => {
-
 
2842
      const elem = component.element;
-
 
2843
      return getPrior(elem, viewport, state).bind(({box}) => revertToOriginal(elem, box, state));
-
 
2844
    };
-
 
2845
    const forceDockWith = (elem, viewport, state, getDecision) => {
-
 
2846
      const box = box$1(elem);
-
 
2847
      const winBox = win();
-
 
2848
      const leftX = getDockedLeftPosition({
-
 
2849
        win: winBox,
-
 
2850
        box
-
 
2851
      });
-
 
2852
      const decision = getDecision(winBox, leftX, viewport);
-
 
2853
      if (decision.location === 'bottom' || decision.location === 'top') {
-
 
2854
        storePriorIfNone(elem, box, viewport, state, decision);
-
 
2855
        return tryDecisionToFixedMorph(decision);
-
 
2856
      } else {
-
 
2857
        return Optional.none();
-
 
2858
      }
-
 
2859
    };
-
 
2860
 
-
 
2861
    const morphToStatic = (component, config, state) => {
-
 
2862
      state.setDocked(false);
-
 
2863
      each$1([
-
 
2864
        'left',
-
 
2865
        'right',
-
 
2866
        'top',
-
 
2867
        'bottom',
-
 
2868
        'position'
-
 
2869
      ], prop => remove$7(component.element, prop));
-
 
2870
      config.onUndocked(component);
-
 
2871
    };
-
 
2872
    const morphToCoord = (component, config, state, position) => {
-
 
2873
      const isDocked = position.position === 'fixed';
-
 
2874
      state.setDocked(isDocked);
-
 
2875
      applyPositionCss(component.element, position);
-
 
2876
      const method = isDocked ? config.onDocked : config.onUndocked;
-
 
2877
      method(component);
-
 
2878
    };
-
 
2879
    const updateVisibility = (component, config, state, viewport, morphToDocked = false) => {
-
 
2880
      config.contextual.each(contextInfo => {
-
 
2881
        contextInfo.lazyContext(component).each(box => {
-
 
2882
          const isVisible = isPartiallyVisible(box, viewport.bounds);
-
 
2883
          if (isVisible !== state.isVisible()) {
-
 
2884
            state.setVisible(isVisible);
-
 
2885
            if (morphToDocked && !isVisible) {
-
 
2886
              add$1(component.element, [contextInfo.fadeOutClass]);
-
 
2887
              contextInfo.onHide(component);
-
 
2888
            } else {
-
 
2889
              const method = isVisible ? appear : disappear;
-
 
2890
              method(component, contextInfo);
-
 
2891
            }
-
 
2892
          }
-
 
2893
        });
-
 
2894
      });
-
 
2895
    };
-
 
2896
    const applyFixedMorph = (component, config, state, viewport, morph) => {
-
 
2897
      updateVisibility(component, config, state, viewport, true);
-
 
2898
      morphToCoord(component, config, state, morph.positionCss);
-
 
2899
    };
-
 
2900
    const applyMorph = (component, config, state, viewport, morph) => {
-
 
2901
      switch (morph.morph) {
-
 
2902
      case 'static': {
-
 
2903
          return morphToStatic(component, config, state);
-
 
2904
        }
-
 
2905
      case 'absolute': {
-
 
2906
          return morphToCoord(component, config, state, morph.positionCss);
-
 
2907
        }
-
 
2908
      case 'fixed': {
-
 
2909
          return applyFixedMorph(component, config, state, viewport, morph);
-
 
2910
        }
-
 
2911
      }
-
 
2912
    };
-
 
2913
    const refreshInternal = (component, config, state) => {
-
 
2914
      const viewport = config.lazyViewport(component);
-
 
2915
      updateVisibility(component, config, state, viewport);
-
 
2916
      tryMorph(component, viewport, state).each(morph => {
-
 
2917
        applyMorph(component, config, state, viewport, morph);
-
 
2918
      });
-
 
2919
    };
-
 
2920
    const resetInternal = (component, config, state) => {
-
 
2921
      const elem = component.element;
-
 
2922
      state.setDocked(false);
-
 
2923
      const viewport = config.lazyViewport(component);
-
 
2924
      calculateMorphToOriginal(component, viewport, state).each(staticOrAbsoluteMorph => {
-
 
2925
        switch (staticOrAbsoluteMorph.morph) {
-
 
2926
        case 'static': {
-
 
2927
            morphToStatic(component, config, state);
-
 
2928
            break;
-
 
2929
          }
-
 
2930
        case 'absolute': {
-
 
2931
            morphToCoord(component, config, state, staticOrAbsoluteMorph.positionCss);
-
 
2932
            break;
-
 
2933
          }
-
 
2934
        }
-
 
2935
      });
-
 
2936
      state.setVisible(true);
-
 
2937
      config.contextual.each(contextInfo => {
-
 
2938
        remove$2(elem, [
-
 
2939
          contextInfo.fadeInClass,
-
 
2940
          contextInfo.fadeOutClass,
-
 
2941
          contextInfo.transitionClass
-
 
2942
        ]);
-
 
2943
        contextInfo.onShow(component);
-
 
2944
      });
-
 
2945
      refresh$4(component, config, state);
-
 
2946
    };
-
 
2947
    const refresh$4 = (component, config, state) => {
-
 
2948
      if (component.getSystem().isConnected()) {
-
 
2949
        refreshInternal(component, config, state);
-
 
2950
      }
-
 
2951
    };
-
 
2952
    const reset$2 = (component, config, state) => {
-
 
2953
      if (state.isDocked()) {
-
 
2954
        resetInternal(component, config, state);
-
 
2955
      }
-
 
2956
    };
-
 
2957
    const forceDockWithDecision = getDecision => (component, config, state) => {
-
 
2958
      const viewport = config.lazyViewport(component);
-
 
2959
      const optMorph = forceDockWith(component.element, viewport, state, getDecision);
-
 
2960
      optMorph.each(morph => {
-
 
2961
        applyFixedMorph(component, config, state, viewport, morph);
-
 
2962
      });
-
 
2963
    };
-
 
2964
    const forceDockToTop = forceDockWithDecision(forceTopPosition);
-
 
2965
    const forceDockToBottom = forceDockWithDecision(forceBottomPosition);
-
 
2966
    const isDocked$2 = (component, config, state) => state.isDocked();
-
 
2967
    const setModes = (component, config, state, modes) => state.setModes(modes);
-
 
2968
    const getModes = (component, config, state) => state.getModes();
-
 
2969
 
-
 
2970
    var DockingApis = /*#__PURE__*/Object.freeze({
-
 
2971
        __proto__: null,
-
 
2972
        refresh: refresh$4,
-
 
2973
        reset: reset$2,
-
 
2974
        isDocked: isDocked$2,
-
 
2975
        getModes: getModes,
-
 
2976
        setModes: setModes,
-
 
2977
        forceDockToTop: forceDockToTop,
-
 
2978
        forceDockToBottom: forceDockToBottom
-
 
2979
    });
-
 
2980
 
-
 
2981
    const events$i = (dockInfo, dockState) => derive$2([
-
 
2982
      runOnSource(transitionend(), (component, simulatedEvent) => {
-
 
2983
        dockInfo.contextual.each(contextInfo => {
-
 
2984
          if (has(component.element, contextInfo.transitionClass)) {
-
 
2985
            remove$2(component.element, [
-
 
2986
              contextInfo.transitionClass,
-
 
2987
              contextInfo.fadeInClass
-
 
2988
            ]);
-
 
2989
            const notify = dockState.isVisible() ? contextInfo.onShown : contextInfo.onHidden;
-
 
2990
            notify(component);
-
 
2991
          }
-
 
2992
          simulatedEvent.stop();
-
 
2993
        });
-
 
2994
      }),
-
 
2995
      run$1(windowScroll(), (component, _) => {
-
 
2996
        refresh$4(component, dockInfo, dockState);
-
 
2997
      }),
-
 
2998
      run$1(externalElementScroll(), (component, _) => {
-
 
2999
        refresh$4(component, dockInfo, dockState);
-
 
3000
      }),
-
 
3001
      run$1(windowResize(), (component, _) => {
-
 
3002
        reset$2(component, dockInfo, dockState);
-
 
3003
      })
-
 
3004
    ]);
-
 
3005
 
-
 
3006
    var ActiveDocking = /*#__PURE__*/Object.freeze({
-
 
3007
        __proto__: null,
-
 
3008
        events: events$i
-
 
3009
    });
2377
 
3010
 
2378
    const fromHtml$1 = (html, scope) => {
3011
    const fromHtml$1 = (html, scope) => {
2379
      const doc = scope || document;
3012
      const doc = scope || document;
2380
      const div = doc.createElement('div');
3013
      const div = doc.createElement('div');
2381
      div.innerHTML = html;
3014
      div.innerHTML = html;
2382
      return children(SugarElement.fromDom(div));
3015
      return children(SugarElement.fromDom(div));
Línea 2383... Línea 3016...
2383
    };
3016
    };
2384
 
3017
 
2385
    const get$9 = element => element.dom.innerHTML;
3018
    const get$8 = element => element.dom.innerHTML;
2386
    const set$6 = (element, content) => {
3019
    const set$6 = (element, content) => {
2387
      const owner = owner$4(element);
3020
      const owner = owner$4(element);
2388
      const docDom = owner.dom;
3021
      const docDom = owner.dom;
Línea 2394... Línea 3027...
2394
    };
3027
    };
2395
    const getOuter = element => {
3028
    const getOuter = element => {
2396
      const container = SugarElement.fromTag('div');
3029
      const container = SugarElement.fromTag('div');
2397
      const clone = SugarElement.fromDom(element.dom.cloneNode(true));
3030
      const clone = SugarElement.fromDom(element.dom.cloneNode(true));
2398
      append$2(container, clone);
3031
      append$2(container, clone);
2399
      return get$9(container);
3032
      return get$8(container);
2400
    };
3033
    };
Línea 2401... Línea 3034...
2401
 
3034
 
2402
    const clone$1 = (original, isDeep) => SugarElement.fromDom(original.dom.cloneNode(isDeep));
3035
    const clone$1 = (original, isDeep) => SugarElement.fromDom(original.dom.cloneNode(isDeep));
2403
    const shallow = original => clone$1(original, false);
3036
    const shallow = original => clone$1(original, false);
Línea 2412... Línea 3045...
2412
      }
3045
      }
2413
    };
3046
    };
Línea 2414... Línea 3047...
2414
 
3047
 
Línea -... Línea 3048...
-
 
3048
    const element = elem => getHtml(elem);
-
 
3049
 
-
 
3050
    const unknown = 'unknown';
-
 
3051
    var EventConfiguration;
-
 
3052
    (function (EventConfiguration) {
-
 
3053
      EventConfiguration[EventConfiguration['STOP'] = 0] = 'STOP';
-
 
3054
      EventConfiguration[EventConfiguration['NORMAL'] = 1] = 'NORMAL';
-
 
3055
      EventConfiguration[EventConfiguration['LOGGING'] = 2] = 'LOGGING';
-
 
3056
    }(EventConfiguration || (EventConfiguration = {})));
-
 
3057
    const eventConfig = Cell({});
-
 
3058
    const makeEventLogger = (eventName, initialTarget) => {
-
 
3059
      const sequence = [];
-
 
3060
      const startTime = new Date().getTime();
-
 
3061
      return {
-
 
3062
        logEventCut: (_name, target, purpose) => {
-
 
3063
          sequence.push({
-
 
3064
            outcome: 'cut',
-
 
3065
            target,
-
 
3066
            purpose
-
 
3067
          });
-
 
3068
        },
-
 
3069
        logEventStopped: (_name, target, purpose) => {
-
 
3070
          sequence.push({
-
 
3071
            outcome: 'stopped',
-
 
3072
            target,
-
 
3073
            purpose
-
 
3074
          });
-
 
3075
        },
-
 
3076
        logNoParent: (_name, target, purpose) => {
-
 
3077
          sequence.push({
-
 
3078
            outcome: 'no-parent',
-
 
3079
            target,
-
 
3080
            purpose
-
 
3081
          });
-
 
3082
        },
-
 
3083
        logEventNoHandlers: (_name, target) => {
-
 
3084
          sequence.push({
-
 
3085
            outcome: 'no-handlers-left',
-
 
3086
            target
-
 
3087
          });
-
 
3088
        },
-
 
3089
        logEventResponse: (_name, target, purpose) => {
-
 
3090
          sequence.push({
-
 
3091
            outcome: 'response',
-
 
3092
            purpose,
-
 
3093
            target
-
 
3094
          });
-
 
3095
        },
-
 
3096
        write: () => {
-
 
3097
          const finishTime = new Date().getTime();
-
 
3098
          if (contains$2([
-
 
3099
              'mousemove',
-
 
3100
              'mouseover',
-
 
3101
              'mouseout',
-
 
3102
              systemInit()
-
 
3103
            ], eventName)) {
-
 
3104
            return;
-
 
3105
          }
-
 
3106
          console.log(eventName, {
-
 
3107
            event: eventName,
-
 
3108
            time: finishTime - startTime,
-
 
3109
            target: initialTarget.dom,
-
 
3110
            sequence: map$2(sequence, s => {
-
 
3111
              if (!contains$2([
-
 
3112
                  'cut',
-
 
3113
                  'stopped',
-
 
3114
                  'response'
-
 
3115
                ], s.outcome)) {
-
 
3116
                return s.outcome;
-
 
3117
              } else {
-
 
3118
                return '{' + s.purpose + '} ' + s.outcome + ' at (' + element(s.target) + ')';
-
 
3119
              }
-
 
3120
            })
-
 
3121
          });
-
 
3122
        }
-
 
3123
      };
-
 
3124
    };
-
 
3125
    const processEvent = (eventName, initialTarget, f) => {
-
 
3126
      const status = get$h(eventConfig.get(), eventName).orThunk(() => {
-
 
3127
        const patterns = keys(eventConfig.get());
-
 
3128
        return findMap(patterns, p => eventName.indexOf(p) > -1 ? Optional.some(eventConfig.get()[p]) : Optional.none());
-
 
3129
      }).getOr(EventConfiguration.NORMAL);
-
 
3130
      switch (status) {
-
 
3131
      case EventConfiguration.NORMAL:
-
 
3132
        return f(noLogger());
-
 
3133
      case EventConfiguration.LOGGING: {
-
 
3134
          const logger = makeEventLogger(eventName, initialTarget);
-
 
3135
          const output = f(logger);
-
 
3136
          logger.write();
-
 
3137
          return output;
-
 
3138
        }
-
 
3139
      case EventConfiguration.STOP:
-
 
3140
        return true;
-
 
3141
      }
-
 
3142
    };
-
 
3143
    const path = [
-
 
3144
      'alloy/data/Fields',
-
 
3145
      'alloy/debugging/Debugging'
-
 
3146
    ];
-
 
3147
    const getTrace = () => {
-
 
3148
      const err = new Error();
-
 
3149
      if (err.stack !== undefined) {
-
 
3150
        const lines = err.stack.split('\n');
-
 
3151
        return find$5(lines, line => line.indexOf('alloy') > 0 && !exists(path, p => line.indexOf(p) > -1)).getOr(unknown);
-
 
3152
      } else {
-
 
3153
        return unknown;
-
 
3154
      }
-
 
3155
    };
-
 
3156
    const ignoreEvent = {
-
 
3157
      logEventCut: noop,
-
 
3158
      logEventStopped: noop,
-
 
3159
      logNoParent: noop,
-
 
3160
      logEventNoHandlers: noop,
-
 
3161
      logEventResponse: noop,
-
 
3162
      write: noop
-
 
3163
    };
-
 
3164
    const monitorEvent = (eventName, initialTarget, f) => processEvent(eventName, initialTarget, f);
-
 
3165
    const noLogger = constant$1(ignoreEvent);
-
 
3166
 
-
 
3167
    const menuFields = constant$1([
-
 
3168
      required$1('menu'),
-
 
3169
      required$1('selectedMenu')
-
 
3170
    ]);
-
 
3171
    const itemFields = constant$1([
-
 
3172
      required$1('item'),
-
 
3173
      required$1('selectedItem')
-
 
3174
    ]);
-
 
3175
    constant$1(objOf(itemFields().concat(menuFields())));
-
 
3176
    const itemSchema$3 = constant$1(objOf(itemFields()));
-
 
3177
 
-
 
3178
    const _initSize = requiredObjOf('initSize', [
-
 
3179
      required$1('numColumns'),
-
 
3180
      required$1('numRows')
-
 
3181
    ]);
-
 
3182
    const itemMarkers = () => requiredOf('markers', itemSchema$3());
-
 
3183
    const tieredMenuMarkers = () => requiredObjOf('markers', [required$1('backgroundMenu')].concat(menuFields()).concat(itemFields()));
-
 
3184
    const markers$1 = required => requiredObjOf('markers', map$2(required, required$1));
-
 
3185
    const onPresenceHandler = (label, fieldName, presence) => {
-
 
3186
      getTrace();
-
 
3187
      return field$1(fieldName, fieldName, presence, valueOf(f => Result.value((...args) => {
-
 
3188
        return f.apply(undefined, args);
-
 
3189
      })));
-
 
3190
    };
-
 
3191
    const onHandler = fieldName => onPresenceHandler('onHandler', fieldName, defaulted$1(noop));
-
 
3192
    const onKeyboardHandler = fieldName => onPresenceHandler('onKeyboardHandler', fieldName, defaulted$1(Optional.none));
-
 
3193
    const onStrictHandler = fieldName => onPresenceHandler('onHandler', fieldName, required$2());
-
 
3194
    const onStrictKeyboardHandler = fieldName => onPresenceHandler('onKeyboardHandler', fieldName, required$2());
-
 
3195
    const output$1 = (name, value) => customField(name, constant$1(value));
-
 
3196
    const snapshot = name => customField(name, identity);
-
 
3197
    const initSize = constant$1(_initSize);
-
 
3198
 
-
 
3199
    var DockingSchema = [
-
 
3200
      optionObjOf('contextual', [
-
 
3201
        requiredString('fadeInClass'),
-
 
3202
        requiredString('fadeOutClass'),
-
 
3203
        requiredString('transitionClass'),
-
 
3204
        requiredFunction('lazyContext'),
-
 
3205
        onHandler('onShow'),
-
 
3206
        onHandler('onShown'),
-
 
3207
        onHandler('onHide'),
-
 
3208
        onHandler('onHidden')
-
 
3209
      ]),
-
 
3210
      defaultedFunction('lazyViewport', () => ({
-
 
3211
        bounds: win(),
-
 
3212
        optScrollEnv: Optional.none()
-
 
3213
      })),
-
 
3214
      defaultedArrayOf('modes', [
-
 
3215
        'top',
-
 
3216
        'bottom'
-
 
3217
      ], string),
-
 
3218
      onHandler('onDocked'),
-
 
3219
      onHandler('onUndocked')
-
 
3220
    ];
-
 
3221
 
-
 
3222
    const init$g = spec => {
-
 
3223
      const docked = Cell(false);
-
 
3224
      const visible = Cell(true);
-
 
3225
      const initialBounds = value$4();
-
 
3226
      const modes = Cell(spec.modes);
-
 
3227
      const readState = () => `docked:  ${ docked.get() }, visible: ${ visible.get() }, modes: ${ modes.get().join(',') }`;
-
 
3228
      return nu$7({
-
 
3229
        isDocked: docked.get,
-
 
3230
        setDocked: docked.set,
-
 
3231
        getInitialPos: initialBounds.get,
-
 
3232
        setInitialPos: initialBounds.set,
-
 
3233
        clearInitialPos: initialBounds.clear,
-
 
3234
        isVisible: visible.get,
-
 
3235
        setVisible: visible.set,
-
 
3236
        getModes: modes.get,
-
 
3237
        setModes: modes.set,
-
 
3238
        readState
-
 
3239
      });
-
 
3240
    };
-
 
3241
 
-
 
3242
    var DockingState = /*#__PURE__*/Object.freeze({
-
 
3243
        __proto__: null,
-
 
3244
        init: init$g
-
 
3245
    });
-
 
3246
 
-
 
3247
    const Docking = create$4({
-
 
3248
      fields: DockingSchema,
-
 
3249
      name: 'docking',
-
 
3250
      active: ActiveDocking,
-
 
3251
      apis: DockingApis,
-
 
3252
      state: DockingState
2415
    const element = elem => getHtml(elem);
3253
    });
2416
 
3254
 
2417
    const isRecursive = (component, originator, target) => eq(originator, component.element) && !eq(originator, target);
3255
    const isRecursive = (component, originator, target) => eq(originator, component.element) && !eq(originator, target);
2418
    const events$i = derive$2([can(focus$4(), (component, simulatedEvent) => {
3256
    const events$h = derive$2([can(focus$4(), (component, simulatedEvent) => {
2419
        const event = simulatedEvent.event;
3257
        const event = simulatedEvent.event;
2420
        const originator = event.originator;
3258
        const originator = event.originator;
2421
        const target = event.target;
3259
        const target = event.target;
Línea 2427... Línea 3265...
2427
        }
3265
        }
2428
      })]);
3266
      })]);
Línea 2429... Línea 3267...
2429
 
3267
 
2430
    var DefaultEvents = /*#__PURE__*/Object.freeze({
3268
    var DefaultEvents = /*#__PURE__*/Object.freeze({
2431
        __proto__: null,
3269
        __proto__: null,
2432
        events: events$i
3270
        events: events$h
Línea -... Línea 3271...
-
 
3271
    });
-
 
3272
 
-
 
3273
    const cycleBy = (value, delta, min, max) => {
-
 
3274
      const r = value + delta;
-
 
3275
      if (r > max) {
-
 
3276
        return min;
-
 
3277
      } else if (r < min) {
-
 
3278
        return max;
-
 
3279
      } else {
-
 
3280
        return r;
-
 
3281
      }
-
 
3282
    };
-
 
3283
    const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
2433
    });
3284
    const random = () => window.crypto.getRandomValues(new Uint32Array(1))[0] / 4294967295;
2434
 
3285
 
2435
    let unique = 0;
3286
    let unique = 0;
2436
    const generate$6 = prefix => {
3287
    const generate$6 = prefix => {
2437
      const date = new Date();
3288
      const date = new Date();
2438
      const time = date.getTime();
3289
      const time = date.getTime();
2439
      const random = Math.floor(Math.random() * 1000000000);
3290
      const random$1 = Math.floor(random() * 1000000000);
2440
      unique++;
3291
      unique++;
Línea 2441... Línea 3292...
2441
      return prefix + '_' + random + unique + String(time);
3292
      return prefix + '_' + random$1 + unique + String(time);
2442
    };
3293
    };
Línea 2455... Línea 3306...
2455
      Object.defineProperty(elem.dom, idAttr, {
3306
      Object.defineProperty(elem.dom, idAttr, {
2456
        value: uid,
3307
        value: uid,
2457
        writable: true
3308
        writable: true
2458
      });
3309
      });
2459
    };
3310
    };
2460
    const read$1 = elem => {
3311
    const read = elem => {
2461
      const id = isElement$1(elem) ? elem.dom[idAttr] : null;
3312
      const id = isElement$1(elem) ? elem.dom[idAttr] : null;
2462
      return Optional.from(id);
3313
      return Optional.from(id);
2463
    };
3314
    };
2464
    const generate$5 = prefix => generate$6(prefix);
3315
    const generate$5 = prefix => generate$6(prefix);
Línea 2490... Línea 3341...
2490
        getByUid: fail('getByUid'),
3341
        getByUid: fail('getByUid'),
2491
        getByDom: fail('getByDom'),
3342
        getByDom: fail('getByDom'),
2492
        isConnected: never
3343
        isConnected: never
2493
      };
3344
      };
2494
    };
3345
    };
2495
    const singleton$1 = NoContextApi();
3346
    const singleton = NoContextApi();
2496
 
-
 
2497
    const markAsBehaviourApi = (f, apiName, apiFunction) => {
-
 
2498
      const delegate = apiFunction.toString();
-
 
2499
      const endIndex = delegate.indexOf(')') + 1;
-
 
2500
      const openBracketIndex = delegate.indexOf('(');
-
 
2501
      const parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/);
-
 
2502
      f.toFunctionAnnotation = () => ({
-
 
2503
        name: apiName,
-
 
2504
        parameters: cleanParameters(parameters.slice(0, 1).concat(parameters.slice(3)))
-
 
2505
      });
-
 
2506
      return f;
-
 
2507
    };
-
 
2508
    const cleanParameters = parameters => map$2(parameters, p => endsWith(p, '/*') ? p.substring(0, p.length - '/*'.length) : p);
-
 
2509
    const markAsExtraApi = (f, extraName) => {
-
 
2510
      const delegate = f.toString();
-
 
2511
      const endIndex = delegate.indexOf(')') + 1;
-
 
2512
      const openBracketIndex = delegate.indexOf('(');
-
 
2513
      const parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/);
-
 
2514
      f.toFunctionAnnotation = () => ({
-
 
2515
        name: extraName,
-
 
2516
        parameters: cleanParameters(parameters)
-
 
2517
      });
-
 
2518
      return f;
-
 
2519
    };
-
 
2520
    const markAsSketchApi = (f, apiFunction) => {
-
 
2521
      const delegate = apiFunction.toString();
-
 
2522
      const endIndex = delegate.indexOf(')') + 1;
-
 
2523
      const openBracketIndex = delegate.indexOf('(');
-
 
2524
      const parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/);
-
 
2525
      f.toFunctionAnnotation = () => ({
-
 
2526
        name: 'OVERRIDE',
-
 
2527
        parameters: cleanParameters(parameters.slice(1))
-
 
2528
      });
-
 
2529
      return f;
-
 
2530
    };
-
 
Línea 2531... Línea 3347...
2531
 
3347
 
2532
    const premadeTag = generate$6('alloy-premade');
3348
    const premadeTag = generate$6('alloy-premade');
2533
    const premade$1 = comp => {
3349
    const premade$1 = comp => {
2534
      Object.defineProperty(comp.element.dom, premadeTag, {
3350
      Object.defineProperty(comp.element.dom, premadeTag, {
2535
        value: comp.uid,
3351
        value: comp.uid,
2536
        writable: true
3352
        writable: true
2537
      });
3353
      });
2538
      return wrap$1(premadeTag, comp);
3354
      return wrap$1(premadeTag, comp);
2539
    };
3355
    };
2540
    const isPremade = element => has$2(element.dom, premadeTag);
3356
    const isPremade = element => has$2(element.dom, premadeTag);
2541
    const getPremade = spec => get$g(spec, premadeTag);
3357
    const getPremade = spec => get$h(spec, premadeTag);
Línea 2542... Línea -...
2542
    const makeApi = f => markAsSketchApi((component, ...rest) => f(component.getApis(), component, ...rest), f);
-
 
2543
 
-
 
2544
    const NoState = { init: () => nu$8({ readState: constant$1('No State required') }) };
-
 
2545
    const nu$8 = spec => spec;
3358
    const makeApi = f => markAsSketchApi((component, ...rest) => f(component.getApis(), component, ...rest), f);
2546
 
3359
 
2547
    const generateFrom$1 = (spec, all) => {
3360
    const generateFrom$1 = (spec, all) => {
2548
      const schema = map$2(all, a => optionObjOf(a.name(), [
3361
      const schema = map$2(all, a => optionObjOf(a.name(), [
2549
        required$1('config'),
3362
        required$1('config'),
Línea 2568... Línea 3381...
2568
 
3381
 
2569
    const byInnerKey = (data, tuple) => {
3382
    const byInnerKey = (data, tuple) => {
2570
      const r = {};
3383
      const r = {};
2571
      each(data, (detail, key) => {
3384
      each(data, (detail, key) => {
2572
        each(detail, (value, indexKey) => {
3385
        each(detail, (value, indexKey) => {
2573
          const chain = get$g(r, indexKey).getOr([]);
3386
          const chain = get$h(r, indexKey).getOr([]);
2574
          r[indexKey] = chain.concat([tuple(key, value)]);
3387
          r[indexKey] = chain.concat([tuple(key, value)]);
2575
        });
3388
        });
2576
      });
3389
      });
2577
      return r;
3390
      return r;
Línea 2578... Línea -...
2578
    };
-
 
2579
 
-
 
2580
    const nu$7 = s => ({
-
 
2581
      classes: isUndefined(s.classes) ? [] : s.classes,
-
 
2582
      attributes: isUndefined(s.attributes) ? {} : s.attributes,
-
 
2583
      styles: isUndefined(s.styles) ? {} : s.styles
-
 
2584
    });
-
 
2585
    const merge = (defnA, mod) => ({
-
 
2586
      ...defnA,
-
 
2587
      attributes: {
-
 
2588
        ...defnA.attributes,
-
 
2589
        ...mod.attributes
-
 
2590
      },
-
 
2591
      styles: {
-
 
2592
        ...defnA.styles,
-
 
2593
        ...mod.styles
-
 
2594
      },
-
 
2595
      classes: defnA.classes.concat(mod.classes)
-
 
2596
    });
3391
    };
2597
 
3392
 
2598
    const combine$2 = (info, baseMod, behaviours, base) => {
3393
    const combine$2 = (info, baseMod, behaviours, base) => {
2599
      const modsByBehaviour = { ...baseMod };
3394
      const modsByBehaviour = { ...baseMod };
2600
      each$1(behaviours, behaviour => {
3395
      each$1(behaviours, behaviour => {
Línea 2609... Línea 3404...
2609
        ...b
3404
        ...b
2610
      }), {});
3405
      }), {});
2611
      const combinedClasses = foldr(byAspect.classes, (b, a) => a.modification.concat(b), []);
3406
      const combinedClasses = foldr(byAspect.classes, (b, a) => a.modification.concat(b), []);
2612
      const combinedAttributes = combineObjects(byAspect.attributes);
3407
      const combinedAttributes = combineObjects(byAspect.attributes);
2613
      const combinedStyles = combineObjects(byAspect.styles);
3408
      const combinedStyles = combineObjects(byAspect.styles);
2614
      return nu$7({
3409
      return nu$8({
2615
        classes: combinedClasses,
3410
        classes: combinedClasses,
2616
        attributes: combinedAttributes,
3411
        attributes: combinedAttributes,
2617
        styles: combinedStyles
3412
        styles: combinedStyles
2618
      });
3413
      });
2619
    };
3414
    };
Línea 2744... Línea 3539...
2744
        ],
3539
        ],
2745
        [systemInit()]: [
3540
        [systemInit()]: [
2746
          baseBehaviour,
3541
          baseBehaviour,
2747
          'disabling',
3542
          'disabling',
2748
          'toggling',
3543
          'toggling',
2749
          'representing'
3544
          'representing',
-
 
3545
          'tooltipping'
2750
        ],
3546
        ],
2751
        [input()]: [
3547
        [input()]: [
2752
          baseBehaviour,
3548
          baseBehaviour,
2753
          'representing',
3549
          'representing',
2754
          'streaming',
3550
          'streaming',
Línea 2756... Línea 3552...
2756
        ],
3552
        ],
2757
        [detachedFromDom()]: [
3553
        [detachedFromDom()]: [
2758
          baseBehaviour,
3554
          baseBehaviour,
2759
          'representing',
3555
          'representing',
2760
          'item-events',
3556
          'item-events',
-
 
3557
          'toolbar-button-events',
2761
          'tooltipping'
3558
          'tooltipping'
2762
        ],
3559
        ],
2763
        [mousedown()]: [
3560
        [mousedown()]: [
2764
          'focusing',
3561
          'focusing',
2765
          baseBehaviour,
3562
          baseBehaviour,
Línea 2786... Línea 3583...
2786
    const toDefinition = detail => ({
3583
    const toDefinition = detail => ({
2787
      ...detail.dom,
3584
      ...detail.dom,
2788
      uid: detail.uid,
3585
      uid: detail.uid,
2789
      domChildren: map$2(detail.components, comp => comp.element)
3586
      domChildren: map$2(detail.components, comp => comp.element)
2790
    });
3587
    });
2791
    const toModification = detail => detail.domModification.fold(() => nu$7({}), nu$7);
3588
    const toModification = detail => detail.domModification.fold(() => nu$8({}), nu$8);
2792
    const toEvents = info => info.events;
3589
    const toEvents = info => info.events;
Línea 2793... Línea -...
2793
 
-
 
2794
    const read = (element, attr) => {
-
 
2795
      const value = get$f(element, attr);
-
 
2796
      return value === undefined || value === '' ? [] : value.split(' ');
-
 
2797
    };
-
 
2798
    const add$4 = (element, attr, id) => {
-
 
2799
      const old = read(element, attr);
-
 
2800
      const nu = old.concat([id]);
-
 
2801
      set$9(element, attr, nu.join(' '));
-
 
2802
      return true;
-
 
2803
    };
-
 
2804
    const remove$4 = (element, attr, id) => {
-
 
2805
      const nu = filter$2(read(element, attr), v => v !== id);
-
 
2806
      if (nu.length > 0) {
-
 
2807
        set$9(element, attr, nu.join(' '));
-
 
2808
      } else {
-
 
2809
        remove$7(element, attr);
-
 
2810
      }
-
 
2811
      return false;
-
 
2812
    };
-
 
2813
 
-
 
2814
    const supports = element => element.dom.classList !== undefined;
-
 
2815
    const get$8 = element => read(element, 'class');
-
 
2816
    const add$3 = (element, clazz) => add$4(element, 'class', clazz);
-
 
2817
    const remove$3 = (element, clazz) => remove$4(element, 'class', clazz);
-
 
2818
    const toggle$5 = (element, clazz) => {
-
 
2819
      if (contains$2(get$8(element), clazz)) {
-
 
2820
        return remove$3(element, clazz);
-
 
2821
      } else {
-
 
2822
        return add$3(element, clazz);
-
 
2823
      }
-
 
2824
    };
-
 
2825
 
-
 
2826
    const add$2 = (element, clazz) => {
-
 
2827
      if (supports(element)) {
-
 
2828
        element.dom.classList.add(clazz);
-
 
2829
      } else {
-
 
2830
        add$3(element, clazz);
-
 
2831
      }
-
 
2832
    };
-
 
2833
    const cleanClass = element => {
-
 
2834
      const classList = supports(element) ? element.dom.classList : get$8(element);
-
 
2835
      if (classList.length === 0) {
-
 
2836
        remove$7(element, 'class');
-
 
2837
      }
-
 
2838
    };
-
 
2839
    const remove$2 = (element, clazz) => {
-
 
2840
      if (supports(element)) {
-
 
2841
        const classList = element.dom.classList;
-
 
2842
        classList.remove(clazz);
-
 
2843
      } else {
-
 
2844
        remove$3(element, clazz);
-
 
2845
      }
-
 
2846
      cleanClass(element);
-
 
2847
    };
-
 
2848
    const toggle$4 = (element, clazz) => {
-
 
2849
      const result = supports(element) ? element.dom.classList.toggle(clazz) : toggle$5(element, clazz);
-
 
2850
      cleanClass(element);
-
 
2851
      return result;
-
 
2852
    };
-
 
2853
    const has = (element, clazz) => supports(element) && element.dom.classList.contains(clazz);
-
 
2854
 
-
 
2855
    const add$1 = (element, classes) => {
-
 
2856
      each$1(classes, x => {
-
 
2857
        add$2(element, x);
-
 
2858
      });
-
 
2859
    };
-
 
2860
    const remove$1 = (element, classes) => {
-
 
2861
      each$1(classes, x => {
-
 
2862
        remove$2(element, x);
-
 
2863
      });
-
 
2864
    };
-
 
2865
    const toggle$3 = (element, classes) => {
-
 
2866
      each$1(classes, x => {
-
 
2867
        toggle$4(element, x);
-
 
2868
      });
-
 
2869
    };
-
 
2870
    const hasAll = (element, classes) => forall(classes, clazz => has(element, clazz));
-
 
2871
    const getNative = element => {
-
 
2872
      const classList = element.dom.classList;
-
 
2873
      const r = new Array(classList.length);
-
 
2874
      for (let i = 0; i < classList.length; i++) {
-
 
2875
        const item = classList.item(i);
-
 
2876
        if (item !== null) {
-
 
2877
          r[i] = item;
-
 
2878
        }
-
 
2879
      }
-
 
2880
      return r;
-
 
2881
    };
-
 
2882
    const get$7 = element => supports(element) ? getNative(element) : get$8(element);
-
 
2883
 
3590
 
2884
    const get$6 = element => element.dom.value;
3591
    const get$7 = element => element.dom.value;
2885
    const set$5 = (element, value) => {
3592
    const set$5 = (element, value) => {
2886
      if (value === undefined) {
3593
      if (value === undefined) {
2887
        throw new Error('Value.set was undefined');
3594
        throw new Error('Value.set was undefined');
2888
      }
3595
      }
Línea 2905... Línea 3612...
2905
    };
3612
    };
2906
    const ensureInDom = (parent, child, obsoleted) => {
3613
    const ensureInDom = (parent, child, obsoleted) => {
2907
      obsoleted.fold(() => append$2(parent, child), obs => {
3614
      obsoleted.fold(() => append$2(parent, child), obs => {
2908
        if (!eq(obs, child)) {
3615
        if (!eq(obs, child)) {
2909
          before$1(obs, child);
3616
          before$1(obs, child);
2910
          remove$5(obs);
3617
          remove$6(obs);
2911
        }
3618
        }
2912
      });
3619
      });
2913
    };
3620
    };
2914
    const patchChildrenWith = (parent, nu, f) => {
3621
    const patchChildrenWith = (parent, nu, f) => {
2915
      const builtChildren = map$2(nu, f);
3622
      const builtChildren = map$2(nu, f);
2916
      const currentChildren = children(parent);
3623
      const currentChildren = children(parent);
2917
      each$1(currentChildren.slice(builtChildren.length), remove$5);
3624
      each$1(currentChildren.slice(builtChildren.length), remove$6);
2918
      return builtChildren;
3625
      return builtChildren;
2919
    };
3626
    };
2920
    const patchSpecChild = (parent, index, spec, build) => {
3627
    const patchSpecChild = (parent, index, spec, build) => {
2921
      const oldObsoleted = child$2(parent, index);
3628
      const oldObsoleted = child$2(parent, index);
2922
      const childComp = build(spec, oldObsoleted);
3629
      const childComp = build(spec, oldObsoleted);
Línea 2952... Línea 3659...
2952
      const {
3659
      const {
2953
        toSet: attrsToSet,
3660
        toSet: attrsToSet,
2954
        toRemove: attrsToRemove
3661
        toRemove: attrsToRemove
2955
      } = diffKeyValueSet(definition.attributes, existingAttributes);
3662
      } = diffKeyValueSet(definition.attributes, existingAttributes);
2956
      const updateAttrs = () => {
3663
      const updateAttrs = () => {
2957
        each$1(attrsToRemove, a => remove$7(obsoleted, a));
3664
        each$1(attrsToRemove, a => remove$8(obsoleted, a));
2958
        setAll$1(obsoleted, attrsToSet);
3665
        setAll$1(obsoleted, attrsToSet);
2959
      };
3666
      };
2960
      const existingStyles = getAllRaw(obsoleted);
3667
      const existingStyles = getAllRaw(obsoleted);
2961
      const {
3668
      const {
2962
        toSet: stylesToSet,
3669
        toSet: stylesToSet,
2963
        toRemove: stylesToRemove
3670
        toRemove: stylesToRemove
2964
      } = diffKeyValueSet(definition.styles, existingStyles);
3671
      } = diffKeyValueSet(definition.styles, existingStyles);
2965
      const updateStyles = () => {
3672
      const updateStyles = () => {
2966
        each$1(stylesToRemove, s => remove$6(obsoleted, s));
3673
        each$1(stylesToRemove, s => remove$7(obsoleted, s));
2967
        setAll(obsoleted, stylesToSet);
3674
        setAll(obsoleted, stylesToSet);
2968
      };
3675
      };
2969
      const existingClasses = get$7(obsoleted);
3676
      const existingClasses = get$9(obsoleted);
2970
      const classesToRemove = difference(existingClasses, definition.classes);
3677
      const classesToRemove = difference(existingClasses, definition.classes);
2971
      const classesToAdd = difference(definition.classes, existingClasses);
3678
      const classesToAdd = difference(definition.classes, existingClasses);
2972
      const updateClasses = () => {
3679
      const updateClasses = () => {
2973
        add$1(obsoleted, classesToAdd);
3680
        add$1(obsoleted, classesToAdd);
2974
        remove$1(obsoleted, classesToRemove);
3681
        remove$2(obsoleted, classesToRemove);
2975
      };
3682
      };
2976
      const updateHtml = html => {
3683
      const updateHtml = html => {
2977
        set$6(obsoleted, html);
3684
        set$6(obsoleted, html);
2978
      };
3685
      };
2979
      const updateChildren = () => {
3686
      const updateChildren = () => {
Línea 2981... Línea 3688...
2981
        patchDomChildren(obsoleted, children);
3688
        patchDomChildren(obsoleted, children);
2982
      };
3689
      };
2983
      const updateValue = () => {
3690
      const updateValue = () => {
2984
        const valueElement = obsoleted;
3691
        const valueElement = obsoleted;
2985
        const value = definition.value.getOrUndefined();
3692
        const value = definition.value.getOrUndefined();
2986
        if (value !== get$6(valueElement)) {
3693
        if (value !== get$7(valueElement)) {
2987
          set$5(valueElement, value !== null && value !== void 0 ? value : '');
3694
          set$5(valueElement, value !== null && value !== void 0 ? value : '');
2988
        }
3695
        }
2989
      };
3696
      };
2990
      updateAttrs();
3697
      updateAttrs();
2991
      updateClasses();
3698
      updateClasses();
Línea 3010... Línea 3717...
3010
    };
3717
    };
3011
    const attemptPatch = (definition, obsoleted) => {
3718
    const attemptPatch = (definition, obsoleted) => {
3012
      try {
3719
      try {
3013
        const e = reconcileToDom(definition, obsoleted);
3720
        const e = reconcileToDom(definition, obsoleted);
3014
        return Optional.some(e);
3721
        return Optional.some(e);
3015
      } catch (err) {
3722
      } catch (_a) {
3016
        return Optional.none();
3723
        return Optional.none();
3017
      }
3724
      }
3018
    };
3725
    };
3019
    const hasMixedChildren = definition => definition.innerHtml.isSome() && definition.domChildren.length > 0;
3726
    const hasMixedChildren = definition => definition.innerHtml.isSome() && definition.domChildren.length > 0;
3020
    const renderToDom = (definition, optObsoleted) => {
3727
    const renderToDom = (definition, optObsoleted) => {
Línea 3023... Línea 3730...
3023
      writeOnly(elem, definition.uid);
3730
      writeOnly(elem, definition.uid);
3024
      return elem;
3731
      return elem;
3025
    };
3732
    };
Línea 3026... Línea 3733...
3026
 
3733
 
3027
    const getBehaviours$2 = spec => {
3734
    const getBehaviours$2 = spec => {
3028
      const behaviours = get$g(spec, 'behaviours').getOr({});
3735
      const behaviours = get$h(spec, 'behaviours').getOr({});
3029
      return bind$3(keys(behaviours), name => {
3736
      return bind$3(keys(behaviours), name => {
3030
        const behaviour = behaviours[name];
3737
        const behaviour = behaviours[name];
3031
        return isNonNullable(behaviour) ? [behaviour.me] : [];
3738
        return isNonNullable(behaviour) ? [behaviour.me] : [];
3032
      });
3739
      });
Línea 3048... Línea 3755...
3048
      const baseEvents = { 'alloy.base.behaviour': toEvents(info) };
3755
      const baseEvents = { 'alloy.base.behaviour': toEvents(info) };
3049
      return combine$1(bData, info.eventOrder, bList, baseEvents).getOrDie();
3756
      return combine$1(bData, info.eventOrder, bList, baseEvents).getOrDie();
3050
    };
3757
    };
3051
    const build$2 = (spec, obsoleted) => {
3758
    const build$2 = (spec, obsoleted) => {
3052
      const getMe = () => me;
3759
      const getMe = () => me;
3053
      const systemApi = Cell(singleton$1);
3760
      const systemApi = Cell(singleton);
3054
      const info = getOrDie(toInfo(spec));
3761
      const info = getOrDie(toInfo(spec));
3055
      const bBlob = generate$4(spec);
3762
      const bBlob = generate$4(spec);
3056
      const bList = getBehaviours$3(bBlob);
3763
      const bList = getBehaviours$3(bBlob);
3057
      const bData = getData$2(bBlob);
3764
      const bData = getData$2(bBlob);
3058
      const modDefinition = getDomDefinition(info, bList, bData);
3765
      const modDefinition = getDomDefinition(info, bList, bData);
Línea 3097... Línea 3804...
3097
      };
3804
      };
3098
      return me;
3805
      return me;
3099
    };
3806
    };
Línea 3100... Línea 3807...
3100
 
3807
 
3101
    const buildSubcomponents = (spec, obsoleted) => {
3808
    const buildSubcomponents = (spec, obsoleted) => {
3102
      const components = get$g(spec, 'components').getOr([]);
3809
      const components = get$h(spec, 'components').getOr([]);
3103
      return obsoleted.fold(() => map$2(components, build$1), obs => map$2(components, (c, i) => {
3810
      return obsoleted.fold(() => map$2(components, build$1), obs => map$2(components, (c, i) => {
3104
        return buildOrPatch(c, child$2(obs, i));
3811
        return buildOrPatch(c, child$2(obs, i));
3105
      }));
3812
      }));
3106
    };
3813
    };
Línea 3193... Línea 3900...
3193
    };
3900
    };
3194
    const closest$3 = (scope, predicate, isRoot) => {
3901
    const closest$3 = (scope, predicate, isRoot) => {
3195
      const is = (s, test) => test(s);
3902
      const is = (s, test) => test(s);
3196
      return ClosestOrAncestor(is, ancestor$1, scope, predicate, isRoot);
3903
      return ClosestOrAncestor(is, ancestor$1, scope, predicate, isRoot);
3197
    };
3904
    };
-
 
3905
    const sibling$1 = (scope, predicate) => {
-
 
3906
      const element = scope.dom;
-
 
3907
      if (!element.parentNode) {
-
 
3908
        return Optional.none();
-
 
3909
      }
-
 
3910
      return child$1(SugarElement.fromDom(element.parentNode), x => !eq(scope, x) && predicate(x));
-
 
3911
    };
3198
    const child$1 = (scope, predicate) => {
3912
    const child$1 = (scope, predicate) => {
3199
      const pred = node => predicate(SugarElement.fromDom(node));
3913
      const pred = node => predicate(SugarElement.fromDom(node));
3200
      const result = find$5(scope.dom.childNodes, pred);
3914
      const result = find$5(scope.dom.childNodes, pred);
3201
      return result.map(SugarElement.fromDom);
3915
      return result.map(SugarElement.fromDom);
3202
    };
3916
    };
Línea 3217... Línea 3931...
3217
      return descend(scope.dom);
3931
      return descend(scope.dom);
3218
    };
3932
    };
Línea 3219... Línea 3933...
3219
 
3933
 
Línea -... Línea 3934...
-
 
3934
    const closest$2 = (scope, predicate, isRoot) => closest$3(scope, predicate, isRoot).isSome();
3220
    const closest$2 = (scope, predicate, isRoot) => closest$3(scope, predicate, isRoot).isSome();
3935
 
-
 
3936
    const first$1 = selector => one(selector);
3221
 
3937
    const ancestor = (scope, selector, isRoot) => ancestor$1(scope, e => is(e, selector), isRoot);
3222
    const ancestor = (scope, selector, isRoot) => ancestor$1(scope, e => is(e, selector), isRoot);
3938
    const sibling = (scope, selector) => sibling$1(scope, e => is(e, selector));
3223
    const child = (scope, selector) => child$1(scope, e => is(e, selector));
3939
    const child = (scope, selector) => child$1(scope, e => is(e, selector));
3224
    const descendant = (scope, selector) => one(selector, scope);
3940
    const descendant = (scope, selector) => one(selector, scope);
3225
    const closest$1 = (scope, selector, isRoot) => {
3941
    const closest$1 = (scope, selector, isRoot) => {
Línea 3231... Línea 3947...
3231
    const find$1 = queryElem => {
3947
    const find$1 = queryElem => {
3232
      const dependent = closest$3(queryElem, elem => {
3948
      const dependent = closest$3(queryElem, elem => {
3233
        if (!isElement$1(elem)) {
3949
        if (!isElement$1(elem)) {
3234
          return false;
3950
          return false;
3235
        }
3951
        }
3236
        const id = get$f(elem, 'id');
3952
        const id = get$g(elem, 'id');
3237
        return id !== undefined && id.indexOf(attribute) > -1;
3953
        return id !== undefined && id.indexOf(attribute) > -1;
3238
      });
3954
      });
3239
      return dependent.bind(dep => {
3955
      return dependent.bind(dep => {
3240
        const id = get$f(dep, 'id');
3956
        const id = get$g(dep, 'id');
3241
        const dos = getRootNode(dep);
3957
        const dos = getRootNode(dep);
3242
        return descendant(dos, `[${ attribute }="${ id }"]`);
3958
        return descendant(dos, `[${ attribute }="${ id }"]`);
3243
      });
3959
      });
3244
    };
3960
    };
3245
    const manager = () => {
3961
    const manager = () => {
3246
      const ariaId = generate$6(attribute);
3962
      const ariaId = generate$6(attribute);
3247
      const link = elem => {
3963
      const link = elem => {
3248
        set$9(elem, attribute, ariaId);
3964
        set$9(elem, attribute, ariaId);
3249
      };
3965
      };
3250
      const unlink = elem => {
3966
      const unlink = elem => {
3251
        remove$7(elem, attribute);
3967
        remove$8(elem, attribute);
3252
      };
3968
      };
3253
      return {
3969
      return {
3254
        id: ariaId,
3970
        id: ariaId,
3255
        link,
3971
        link,
3256
        unlink
3972
        unlink
Línea 3258... Línea 3974...
3258
    };
3974
    };
Línea 3259... Línea 3975...
3259
 
3975
 
3260
    const isAriaPartOf = (component, queryElem) => find$1(queryElem).exists(owner => isPartOf$1(component, owner));
3976
    const isAriaPartOf = (component, queryElem) => find$1(queryElem).exists(owner => isPartOf$1(component, owner));
Línea 3261... Línea -...
3261
    const isPartOf$1 = (component, queryElem) => closest$2(queryElem, el => eq(el, component.element), never) || isAriaPartOf(component, queryElem);
-
 
3262
 
-
 
3263
    const unknown = 'unknown';
-
 
3264
    var EventConfiguration;
-
 
3265
    (function (EventConfiguration) {
-
 
3266
      EventConfiguration[EventConfiguration['STOP'] = 0] = 'STOP';
-
 
3267
      EventConfiguration[EventConfiguration['NORMAL'] = 1] = 'NORMAL';
-
 
3268
      EventConfiguration[EventConfiguration['LOGGING'] = 2] = 'LOGGING';
-
 
3269
    }(EventConfiguration || (EventConfiguration = {})));
-
 
3270
    const eventConfig = Cell({});
-
 
3271
    const makeEventLogger = (eventName, initialTarget) => {
-
 
3272
      const sequence = [];
-
 
3273
      const startTime = new Date().getTime();
-
 
3274
      return {
-
 
3275
        logEventCut: (_name, target, purpose) => {
-
 
3276
          sequence.push({
-
 
3277
            outcome: 'cut',
-
 
3278
            target,
-
 
3279
            purpose
-
 
3280
          });
-
 
3281
        },
-
 
3282
        logEventStopped: (_name, target, purpose) => {
-
 
3283
          sequence.push({
-
 
3284
            outcome: 'stopped',
-
 
3285
            target,
-
 
3286
            purpose
-
 
3287
          });
-
 
3288
        },
-
 
3289
        logNoParent: (_name, target, purpose) => {
-
 
3290
          sequence.push({
-
 
3291
            outcome: 'no-parent',
-
 
3292
            target,
-
 
3293
            purpose
-
 
3294
          });
-
 
3295
        },
-
 
3296
        logEventNoHandlers: (_name, target) => {
-
 
3297
          sequence.push({
-
 
3298
            outcome: 'no-handlers-left',
-
 
3299
            target
-
 
3300
          });
-
 
3301
        },
-
 
3302
        logEventResponse: (_name, target, purpose) => {
-
 
3303
          sequence.push({
-
 
3304
            outcome: 'response',
-
 
3305
            purpose,
-
 
3306
            target
-
 
3307
          });
-
 
3308
        },
-
 
3309
        write: () => {
-
 
3310
          const finishTime = new Date().getTime();
-
 
3311
          if (contains$2([
-
 
3312
              'mousemove',
-
 
3313
              'mouseover',
-
 
3314
              'mouseout',
-
 
3315
              systemInit()
-
 
3316
            ], eventName)) {
-
 
3317
            return;
-
 
3318
          }
-
 
3319
          console.log(eventName, {
-
 
3320
            event: eventName,
-
 
3321
            time: finishTime - startTime,
-
 
3322
            target: initialTarget.dom,
-
 
3323
            sequence: map$2(sequence, s => {
-
 
3324
              if (!contains$2([
-
 
3325
                  'cut',
-
 
3326
                  'stopped',
-
 
3327
                  'response'
-
 
3328
                ], s.outcome)) {
-
 
3329
                return s.outcome;
-
 
3330
              } else {
-
 
3331
                return '{' + s.purpose + '} ' + s.outcome + ' at (' + element(s.target) + ')';
-
 
3332
              }
-
 
3333
            })
-
 
3334
          });
-
 
3335
        }
-
 
3336
      };
-
 
3337
    };
-
 
3338
    const processEvent = (eventName, initialTarget, f) => {
-
 
3339
      const status = get$g(eventConfig.get(), eventName).orThunk(() => {
-
 
3340
        const patterns = keys(eventConfig.get());
-
 
3341
        return findMap(patterns, p => eventName.indexOf(p) > -1 ? Optional.some(eventConfig.get()[p]) : Optional.none());
-
 
3342
      }).getOr(EventConfiguration.NORMAL);
-
 
3343
      switch (status) {
-
 
3344
      case EventConfiguration.NORMAL:
-
 
3345
        return f(noLogger());
-
 
3346
      case EventConfiguration.LOGGING: {
-
 
3347
          const logger = makeEventLogger(eventName, initialTarget);
-
 
3348
          const output = f(logger);
-
 
3349
          logger.write();
-
 
3350
          return output;
-
 
3351
        }
-
 
3352
      case EventConfiguration.STOP:
-
 
3353
        return true;
-
 
3354
      }
-
 
3355
    };
-
 
3356
    const path = [
-
 
3357
      'alloy/data/Fields',
-
 
3358
      'alloy/debugging/Debugging'
-
 
3359
    ];
-
 
3360
    const getTrace = () => {
-
 
3361
      const err = new Error();
-
 
3362
      if (err.stack !== undefined) {
-
 
3363
        const lines = err.stack.split('\n');
-
 
3364
        return find$5(lines, line => line.indexOf('alloy') > 0 && !exists(path, p => line.indexOf(p) > -1)).getOr(unknown);
-
 
3365
      } else {
-
 
3366
        return unknown;
-
 
3367
      }
-
 
3368
    };
-
 
3369
    const ignoreEvent = {
-
 
3370
      logEventCut: noop,
-
 
3371
      logEventStopped: noop,
-
 
3372
      logNoParent: noop,
-
 
3373
      logEventNoHandlers: noop,
-
 
3374
      logEventResponse: noop,
-
 
3375
      write: noop
-
 
3376
    };
-
 
3377
    const monitorEvent = (eventName, initialTarget, f) => processEvent(eventName, initialTarget, f);
-
 
3378
    const noLogger = constant$1(ignoreEvent);
-
 
3379
 
-
 
3380
    const menuFields = constant$1([
-
 
3381
      required$1('menu'),
-
 
3382
      required$1('selectedMenu')
-
 
3383
    ]);
-
 
3384
    const itemFields = constant$1([
-
 
3385
      required$1('item'),
-
 
3386
      required$1('selectedItem')
-
 
3387
    ]);
-
 
3388
    constant$1(objOf(itemFields().concat(menuFields())));
-
 
3389
    const itemSchema$3 = constant$1(objOf(itemFields()));
-
 
3390
 
-
 
3391
    const _initSize = requiredObjOf('initSize', [
-
 
3392
      required$1('numColumns'),
-
 
3393
      required$1('numRows')
-
 
3394
    ]);
-
 
3395
    const itemMarkers = () => requiredOf('markers', itemSchema$3());
-
 
3396
    const tieredMenuMarkers = () => requiredObjOf('markers', [required$1('backgroundMenu')].concat(menuFields()).concat(itemFields()));
-
 
3397
    const markers$1 = required => requiredObjOf('markers', map$2(required, required$1));
-
 
3398
    const onPresenceHandler = (label, fieldName, presence) => {
-
 
3399
      getTrace();
-
 
3400
      return field$1(fieldName, fieldName, presence, valueOf(f => Result.value((...args) => {
-
 
3401
        return f.apply(undefined, args);
-
 
3402
      })));
-
 
3403
    };
-
 
3404
    const onHandler = fieldName => onPresenceHandler('onHandler', fieldName, defaulted$1(noop));
-
 
3405
    const onKeyboardHandler = fieldName => onPresenceHandler('onKeyboardHandler', fieldName, defaulted$1(Optional.none));
-
 
3406
    const onStrictHandler = fieldName => onPresenceHandler('onHandler', fieldName, required$2());
-
 
3407
    const onStrictKeyboardHandler = fieldName => onPresenceHandler('onKeyboardHandler', fieldName, required$2());
-
 
3408
    const output$1 = (name, value) => customField(name, constant$1(value));
-
 
3409
    const snapshot = name => customField(name, identity);
-
 
3410
    const initSize = constant$1(_initSize);
3977
    const isPartOf$1 = (component, queryElem) => closest$2(queryElem, el => eq(el, component.element), never) || isAriaPartOf(component, queryElem);
3411
 
3978
 
3412
    const nu$6 = (x, y, bubble, direction, placement, boundsRestriction, labelPrefix, alwaysFit = false) => ({
3979
    const nu$6 = (x, y, bubble, direction, placement, boundsRestriction, labelPrefix, alwaysFit = false) => ({
3413
      x,
3980
      x,
3414
      y,
3981
      y,
Línea 3440... Línea 4007...
3440
    const south$3 = adt$a.south;
4007
    const south$3 = adt$a.south;
3441
    const north$3 = adt$a.north;
4008
    const north$3 = adt$a.north;
3442
    const east$3 = adt$a.east;
4009
    const east$3 = adt$a.east;
3443
    const west$3 = adt$a.west;
4010
    const west$3 = adt$a.west;
Línea 3444... Línea -...
3444
 
-
 
3445
    const cycleBy = (value, delta, min, max) => {
-
 
3446
      const r = value + delta;
-
 
3447
      if (r > max) {
-
 
3448
        return min;
-
 
3449
      } else if (r < min) {
-
 
3450
        return max;
-
 
3451
      } else {
-
 
3452
        return r;
-
 
3453
      }
-
 
3454
    };
-
 
3455
    const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
-
 
3456
 
4011
 
3457
    const getRestriction = (anchor, restriction) => {
4012
    const getRestriction = (anchor, restriction) => {
3458
      switch (restriction) {
4013
      switch (restriction) {
3459
      case 1:
4014
      case 1:
3460
        return anchor.x;
4015
        return anchor.x;
Línea 3469... Línea 4024...
3469
    const boundsRestriction = (anchor, restrictions) => mapToObject([
4024
    const boundsRestriction = (anchor, restrictions) => mapToObject([
3470
      'left',
4025
      'left',
3471
      'right',
4026
      'right',
3472
      'top',
4027
      'top',
3473
      'bottom'
4028
      'bottom'
3474
    ], dir => get$g(restrictions, dir).map(restriction => getRestriction(anchor, restriction)));
4029
    ], dir => get$h(restrictions, dir).map(restriction => getRestriction(anchor, restriction)));
3475
    const adjustBounds = (bounds$1, restriction, bubbleOffset) => {
4030
    const adjustBounds = (bounds$1, restriction, bubbleOffset) => {
3476
      const applyRestriction = (dir, current) => restriction[dir].map(pos => {
4031
      const applyRestriction = (dir, current) => restriction[dir].map(pos => {
3477
        const isVerticalAxis = dir === 'top' || dir === 'bottom';
4032
        const isVerticalAxis = dir === 'top' || dir === 'bottom';
3478
        const offset = isVerticalAxis ? bubbleOffset.top : bubbleOffset.left;
4033
        const offset = isVerticalAxis ? bubbleOffset.top : bubbleOffset.left;
3479
        const comparator = dir === 'left' || dir === 'top' ? Math.max : Math.min;
4034
        const comparator = dir === 'left' || dir === 'top' ? Math.max : Math.min;
Línea 3568... Línea 4123...
3568
      south$2,
4123
      south$2,
3569
      north$2
4124
      north$2
3570
    ];
4125
    ];
Línea 3571... Línea 4126...
3571
 
4126
 
3572
    const chooseChannels = (channels, message) => message.universal ? channels : filter$2(channels, ch => contains$2(message.channels, ch));
4127
    const chooseChannels = (channels, message) => message.universal ? channels : filter$2(channels, ch => contains$2(message.channels, ch));
3573
    const events$h = receiveConfig => derive$2([run$1(receive(), (component, message) => {
4128
    const events$g = receiveConfig => derive$2([run$1(receive(), (component, message) => {
3574
        const channelMap = receiveConfig.channels;
4129
        const channelMap = receiveConfig.channels;
3575
        const channels = keys(channelMap);
4130
        const channels = keys(channelMap);
3576
        const receivingData = message;
4131
        const receivingData = message;
3577
        const targetChannels = chooseChannels(channels, receivingData);
4132
        const targetChannels = chooseChannels(channels, receivingData);
Línea 3583... Línea 4138...
3583
        });
4138
        });
3584
      })]);
4139
      })]);
Línea 3585... Línea 4140...
3585
 
4140
 
3586
    var ActiveReceiving = /*#__PURE__*/Object.freeze({
4141
    var ActiveReceiving = /*#__PURE__*/Object.freeze({
3587
        __proto__: null,
4142
        __proto__: null,
3588
        events: events$h
4143
        events: events$g
Línea 3589... Línea 4144...
3589
    });
4144
    });
3590
 
4145
 
3591
    var ReceivingSchema = [requiredOf('channels', setOf(Result.value, objOfOnly([
4146
    var ReceivingSchema = [requiredOf('channels', setOf(Result.value, objOfOnly([
3592
        onStrictHandler('onReceive'),
4147
        onStrictHandler('onReceive'),
Línea 3593... Línea -...
3593
        defaulted('schema', anyValue())
-
 
3594
      ])))];
-
 
3595
 
-
 
3596
    const executeEvent = (bConfig, bState, executor) => runOnExecute$1(component => {
-
 
3597
      executor(component, bConfig, bState);
-
 
3598
    });
-
 
3599
    const loadEvent = (bConfig, bState, f) => runOnInit((component, _simulatedEvent) => {
-
 
3600
      f(component, bConfig, bState);
-
 
3601
    });
-
 
3602
    const create$5 = (schema, name, active, apis, extra, state) => {
-
 
3603
      const configSchema = objOfOnly(schema);
-
 
3604
      const schemaSchema = optionObjOf(name, [optionObjOfOnly('config', schema)]);
-
 
3605
      return doCreate(configSchema, schemaSchema, name, active, apis, extra, state);
-
 
3606
    };
-
 
3607
    const createModes$1 = (modes, name, active, apis, extra, state) => {
-
 
3608
      const configSchema = modes;
-
 
3609
      const schemaSchema = optionObjOf(name, [optionOf('config', modes)]);
-
 
3610
      return doCreate(configSchema, schemaSchema, name, active, apis, extra, state);
-
 
3611
    };
-
 
3612
    const wrapApi = (bName, apiFunction, apiName) => {
-
 
3613
      const f = (component, ...rest) => {
-
 
3614
        const args = [component].concat(rest);
-
 
3615
        return component.config({ name: constant$1(bName) }).fold(() => {
-
 
3616
          throw new Error('We could not find any behaviour configuration for: ' + bName + '. Using API: ' + apiName);
-
 
3617
        }, info => {
-
 
3618
          const rest = Array.prototype.slice.call(args, 1);
-
 
3619
          return apiFunction.apply(undefined, [
-
 
3620
            component,
-
 
3621
            info.config,
-
 
3622
            info.state
-
 
3623
          ].concat(rest));
-
 
3624
        });
-
 
3625
      };
-
 
3626
      return markAsBehaviourApi(f, apiName, apiFunction);
-
 
3627
    };
-
 
3628
    const revokeBehaviour = name => ({
-
 
3629
      key: name,
-
 
3630
      value: undefined
-
 
3631
    });
-
 
3632
    const doCreate = (configSchema, schemaSchema, name, active, apis, extra, state) => {
-
 
3633
      const getConfig = info => hasNonNullableKey(info, name) ? info[name]() : Optional.none();
-
 
3634
      const wrappedApis = map$1(apis, (apiF, apiName) => wrapApi(name, apiF, apiName));
-
 
3635
      const wrappedExtra = map$1(extra, (extraF, extraName) => markAsExtraApi(extraF, extraName));
-
 
3636
      const me = {
-
 
3637
        ...wrappedExtra,
-
 
3638
        ...wrappedApis,
-
 
3639
        revoke: curry(revokeBehaviour, name),
-
 
3640
        config: spec => {
-
 
3641
          const prepared = asRawOrDie$1(name + '-config', configSchema, spec);
-
 
3642
          return {
-
 
3643
            key: name,
-
 
3644
            value: {
-
 
3645
              config: prepared,
-
 
3646
              me,
-
 
3647
              configAsRaw: cached(() => asRawOrDie$1(name + '-config', configSchema, spec)),
-
 
3648
              initialConfig: spec,
-
 
3649
              state
-
 
3650
            }
-
 
3651
          };
-
 
3652
        },
-
 
3653
        schema: constant$1(schemaSchema),
-
 
3654
        exhibit: (info, base) => {
-
 
3655
          return lift2(getConfig(info), get$g(active, 'exhibit'), (behaviourInfo, exhibitor) => {
-
 
3656
            return exhibitor(base, behaviourInfo.config, behaviourInfo.state);
-
 
3657
          }).getOrThunk(() => nu$7({}));
-
 
3658
        },
-
 
3659
        name: constant$1(name),
-
 
3660
        handlers: info => {
-
 
3661
          return getConfig(info).map(behaviourInfo => {
-
 
3662
            const getEvents = get$g(active, 'events').getOr(() => ({}));
-
 
3663
            return getEvents(behaviourInfo.config, behaviourInfo.state);
-
 
3664
          }).getOr({});
-
 
3665
        }
-
 
3666
      };
-
 
3667
      return me;
-
 
3668
    };
-
 
3669
 
-
 
3670
    const derive$1 = capabilities => wrapAll(capabilities);
-
 
3671
    const simpleSchema = objOfOnly([
-
 
3672
      required$1('fields'),
-
 
3673
      required$1('name'),
-
 
3674
      defaulted('active', {}),
-
 
3675
      defaulted('apis', {}),
-
 
3676
      defaulted('state', NoState),
-
 
3677
      defaulted('extra', {})
-
 
3678
    ]);
-
 
3679
    const create$4 = data => {
-
 
3680
      const value = asRawOrDie$1('Creating behaviour: ' + data.name, simpleSchema, data);
-
 
3681
      return create$5(value.fields, value.name, value.active, value.apis, value.extra, value.state);
-
 
3682
    };
-
 
3683
    const modeSchema = objOfOnly([
-
 
3684
      required$1('branchKey'),
-
 
3685
      required$1('branches'),
-
 
3686
      required$1('name'),
-
 
3687
      defaulted('active', {}),
-
 
3688
      defaulted('apis', {}),
-
 
3689
      defaulted('state', NoState),
-
 
3690
      defaulted('extra', {})
-
 
3691
    ]);
-
 
3692
    const createModes = data => {
-
 
3693
      const value = asRawOrDie$1('Creating behaviour: ' + data.name, modeSchema, data);
-
 
3694
      return createModes$1(choose$1(value.branchKey, value.branches), value.name, value.active, value.apis, value.extra, value.state);
-
 
3695
    };
4148
        defaulted('schema', anyValue())
3696
    const revoke = constant$1(undefined);
4149
      ])))];
3697
 
4150
 
3698
    const Receiving = create$4({
4151
    const Receiving = create$4({
3699
      fields: ReceivingSchema,
4152
      fields: ReceivingSchema,
Línea 3700... Línea 4153...
3700
      name: 'receiving',
4153
      name: 'receiving',
3701
      active: ActiveReceiving
4154
      active: ActiveReceiving
3702
    });
4155
    });
3703
 
4156
 
Línea 3704... Línea 4157...
3704
    const exhibit$6 = (base, posConfig) => nu$7({
4157
    const exhibit$6 = (base, posConfig) => nu$8({
Línea 3733... Línea 4186...
3733
        }, noop);
4186
        }, noop);
3734
      });
4187
      });
3735
      return result;
4188
      return result;
3736
    };
4189
    };
Línea 3737... Línea -...
3737
 
-
 
3738
    const NuPositionCss = (position, left, top, right, bottom) => {
-
 
3739
      const toPx = num => num + 'px';
-
 
3740
      return {
-
 
3741
        position,
-
 
3742
        left: left.map(toPx),
-
 
3743
        top: top.map(toPx),
-
 
3744
        right: right.map(toPx),
-
 
3745
        bottom: bottom.map(toPx)
-
 
3746
      };
-
 
3747
    };
-
 
3748
    const toOptions = position => ({
-
 
3749
      ...position,
-
 
3750
      position: Optional.some(position.position)
-
 
3751
    });
-
 
3752
    const applyPositionCss = (element, position) => {
-
 
3753
      setOptions(element, toOptions(position));
-
 
3754
    };
-
 
3755
 
4190
 
3756
    const adt$9 = Adt.generate([
4191
    const adt$9 = Adt.generate([
3757
      { none: [] },
4192
      { none: [] },
3758
      {
4193
      {
3759
        relative: [
4194
        relative: [
Línea 3796... Línea 4231...
3796
      return positionWithDirection('fixed', decision, x, y, width, height);
4231
      return positionWithDirection('fixed', decision, x, y, width, height);
3797
    });
4232
    });
3798
    const toBox = (origin, element) => {
4233
    const toBox = (origin, element) => {
3799
      const rel = curry(find$2, element);
4234
      const rel = curry(find$2, element);
3800
      const position = origin.fold(rel, rel, () => {
4235
      const position = origin.fold(rel, rel, () => {
3801
        const scroll = get$b();
4236
        const scroll = get$c();
3802
        return find$2(element).translate(-scroll.left, -scroll.top);
4237
        return find$2(element).translate(-scroll.left, -scroll.top);
3803
      });
4238
      });
3804
      const width = getOuter$1(element);
4239
      const width = getOuter$1(element);
3805
      const height = getOuter$2(element);
4240
      const height = getOuter$2(element);
3806
      return bounds(position.left, position.top, width, height);
4241
      return bounds(position.left, position.top, width, height);
Línea 3810... Línea 4245...
3810
      return bounds(pos.left, pos.top, bounds$1.width, bounds$1.height);
4245
      return bounds(pos.left, pos.top, bounds$1.width, bounds$1.height);
3811
    }));
4246
    }));
3812
    const translate$2 = (origin, x, y) => {
4247
    const translate$2 = (origin, x, y) => {
3813
      const pos = SugarPosition(x, y);
4248
      const pos = SugarPosition(x, y);
3814
      const removeScroll = () => {
4249
      const removeScroll = () => {
3815
        const outerScroll = get$b();
4250
        const outerScroll = get$c();
3816
        return pos.translate(-outerScroll.left, -outerScroll.top);
4251
        return pos.translate(-outerScroll.left, -outerScroll.top);
3817
      };
4252
      };
3818
      return origin.fold(constant$1(pos), constant$1(pos), removeScroll);
4253
      return origin.fold(constant$1(pos), constant$1(pos), removeScroll);
3819
    };
4254
    };
3820
    const cata$1 = (subject, onNone, onRelative, onFixed) => subject.fold(onNone, onRelative, onFixed);
4255
    const cata$1 = (subject, onNone, onRelative, onFixed) => subject.fold(onNone, onRelative, onFixed);
Línea 3831... Línea 4266...
3831
    const placementAttribute = 'data-alloy-placement';
4266
    const placementAttribute = 'data-alloy-placement';
3832
    const setPlacement$1 = (element, placement) => {
4267
    const setPlacement$1 = (element, placement) => {
3833
      set$9(element, placementAttribute, placement);
4268
      set$9(element, placementAttribute, placement);
3834
    };
4269
    };
3835
    const getPlacement = element => getOpt(element, placementAttribute);
4270
    const getPlacement = element => getOpt(element, placementAttribute);
3836
    const reset$2 = element => remove$7(element, placementAttribute);
4271
    const reset$1 = element => remove$8(element, placementAttribute);
Línea 3837... Línea 4272...
3837
 
4272
 
3838
    const adt$8 = Adt.generate([
4273
    const adt$8 = Adt.generate([
3839
      { fit: ['reposition'] },
4274
      { fit: ['reposition'] },
3840
      {
4275
      {
Línea 3952... Línea 4387...
3952
        testY: anchorBox.y
4387
        testY: anchorBox.y
3953
      }, -1, -1, false));
4388
      }, -1, -1, false));
3954
      return abc.fold(identity, identity);
4389
      return abc.fold(identity, identity);
3955
    };
4390
    };
Línea 3956... Línea -...
3956
 
-
 
3957
    const singleton = doRevoke => {
-
 
3958
      const subject = Cell(Optional.none());
-
 
3959
      const revoke = () => subject.get().each(doRevoke);
-
 
3960
      const clear = () => {
-
 
3961
        revoke();
-
 
3962
        subject.set(Optional.none());
-
 
3963
      };
-
 
3964
      const isSet = () => subject.get().isSome();
-
 
3965
      const get = () => subject.get();
-
 
3966
      const set = s => {
-
 
3967
        revoke();
-
 
3968
        subject.set(Optional.some(s));
-
 
3969
      };
-
 
3970
      return {
-
 
3971
        clear,
-
 
3972
        isSet,
-
 
3973
        get,
-
 
3974
        set
-
 
3975
      };
-
 
3976
    };
-
 
3977
    const destroyable = () => singleton(s => s.destroy());
-
 
3978
    const unbindable = () => singleton(s => s.unbind());
-
 
3979
    const value$2 = () => {
-
 
3980
      const subject = singleton(noop);
-
 
3981
      const on = f => subject.get().each(f);
-
 
3982
      return {
-
 
3983
        ...subject,
-
 
3984
        on
-
 
3985
      };
-
 
3986
    };
-
 
3987
 
4391
 
3988
    const filter = always;
4392
    const filter = always;
3989
    const bind = (element, event, handler) => bind$2(element, event, filter, handler);
4393
    const bind = (element, event, handler) => bind$2(element, event, filter, handler);
3990
    const capture = (element, event, handler) => capture$1(element, event, filter, handler);
4394
    const capture = (element, event, handler) => capture$1(element, event, filter, handler);
Línea 4012... Línea 4416...
4012
        return !equals(newValue, val);
4416
        return !equals(newValue, val);
4013
      }).isSome();
4417
      }).isSome();
4014
    };
4418
    };
4015
    const getTransitionDuration = element => {
4419
    const getTransitionDuration = element => {
4016
      const get = name => {
4420
      const get = name => {
4017
        const style = get$e(element, name);
4421
        const style = get$f(element, name);
4018
        const times = style.split(/\s*,\s*/);
4422
        const times = style.split(/\s*,\s*/);
4019
        return filter$2(times, isNotEmpty);
4423
        return filter$2(times, isNotEmpty);
4020
      };
4424
      };
4021
      const parse = value => {
4425
      const parse = value => {
4022
        if (isString(value) && /^[\d.]+/.test(value)) {
4426
        if (isString(value) && /^[\d.]+/.test(value)) {
Línea 4047... Línea 4451...
4047
          transitionEnd.clear();
4451
          transitionEnd.clear();
4048
          transitionCancel.clear();
4452
          transitionCancel.clear();
4049
          const type = e === null || e === void 0 ? void 0 : e.raw.type;
4453
          const type = e === null || e === void 0 ? void 0 : e.raw.type;
4050
          if (isNullable(type) || type === transitionend()) {
4454
          if (isNullable(type) || type === transitionend()) {
4051
            clearTimeout(timer);
4455
            clearTimeout(timer);
4052
            remove$7(element, timerAttr);
4456
            remove$8(element, timerAttr);
4053
            remove$1(element, transition.classes);
4457
            remove$2(element, transition.classes);
4054
          }
4458
          }
4055
        }
4459
        }
4056
      };
4460
      };
4057
      const transitionStart = bind(element, transitionstart(), e => {
4461
      const transitionStart = bind(element, transitionstart(), e => {
4058
        if (isSourceTransition(e)) {
4462
        if (isSourceTransition(e)) {
Línea 4069... Línea 4473...
4069
    };
4473
    };
4070
    const startTransitioning = (element, transition) => {
4474
    const startTransitioning = (element, transition) => {
4071
      add$1(element, transition.classes);
4475
      add$1(element, transition.classes);
4072
      getOpt(element, timerAttr).each(timerId => {
4476
      getOpt(element, timerAttr).each(timerId => {
4073
        clearTimeout(parseInt(timerId, 10));
4477
        clearTimeout(parseInt(timerId, 10));
4074
        remove$7(element, timerAttr);
4478
        remove$8(element, timerAttr);
4075
      });
4479
      });
4076
      setupTransitionListeners(element, transition);
4480
      setupTransitionListeners(element, transition);
4077
    };
4481
    };
4078
    const applyTransitionCss = (element, origin, position, transition, decision, lastPlacement) => {
4482
    const applyTransitionCss = (element, origin, position, transition, decision, lastPlacement) => {
4079
      const shouldTransition = shouldApplyTransitionCss(transition, decision, lastPlacement);
4483
      const shouldTransition = shouldApplyTransitionCss(transition, decision, lastPlacement);
Línea 4091... Línea 4495...
4091
            startTransitioning(element, transition);
4495
            startTransitioning(element, transition);
4092
          }
4496
          }
4093
          reflow(element);
4497
          reflow(element);
4094
        }
4498
        }
4095
      } else {
4499
      } else {
4096
        remove$1(element, transition.classes);
4500
        remove$2(element, transition.classes);
4097
      }
4501
      }
4098
    };
4502
    };
Línea 4099... Línea 4503...
4099
 
4503
 
4100
    const elementSize = p => ({
4504
    const elementSize = p => ({
4101
      width: getOuter$1(p),
4505
      width: getOuter$1(p),
4102
      height: getOuter$2(p)
4506
      height: getOuter$2(p)
4103
    });
4507
    });
4104
    const layout = (anchorBox, element, bubbles, options) => {
4508
    const layout = (anchorBox, element, bubbles, options) => {
4105
      remove$6(element, 'max-height');
4509
      remove$7(element, 'max-height');
4106
      remove$6(element, 'max-width');
4510
      remove$7(element, 'max-width');
4107
      const elementBox = elementSize(element);
4511
      const elementBox = elementSize(element);
4108
      return attempts(element, options.preference, anchorBox, elementBox, bubbles, options.bounds);
4512
      return attempts(element, options.preference, anchorBox, elementBox, bubbles, options.bounds);
4109
    };
4513
    };
4110
    const setClasses = (element, decision) => {
4514
    const setClasses = (element, decision) => {
4111
      const classInfo = decision.classes;
4515
      const classInfo = decision.classes;
4112
      remove$1(element, classInfo.off);
4516
      remove$2(element, classInfo.off);
4113
      add$1(element, classInfo.on);
4517
      add$1(element, classInfo.on);
4114
    };
4518
    };
4115
    const setHeight = (element, decision, options) => {
4519
    const setHeight = (element, decision, options) => {
4116
      const maxHeightFunction = options.maxHeightFunction;
4520
      const maxHeightFunction = options.maxHeightFunction;
Línea 4187... Línea 4591...
4187
      'inset'
4591
      'inset'
4188
    ];
4592
    ];
4189
    const nu$5 = (xOffset, yOffset, classes, insetModifier = 1) => {
4593
    const nu$5 = (xOffset, yOffset, classes, insetModifier = 1) => {
4190
      const insetXOffset = xOffset * insetModifier;
4594
      const insetXOffset = xOffset * insetModifier;
4191
      const insetYOffset = yOffset * insetModifier;
4595
      const insetYOffset = yOffset * insetModifier;
4192
      const getClasses = prop => get$g(classes, prop).getOr([]);
4596
      const getClasses = prop => get$h(classes, prop).getOr([]);
4193
      const make = (xDelta, yDelta, alignmentsOn) => {
4597
      const make = (xDelta, yDelta, alignmentsOn) => {
4194
        const alignmentsOff = difference(allAlignments, alignmentsOn);
4598
        const alignmentsOff = difference(allAlignments, alignmentsOn);
4195
        return {
4599
        return {
4196
          offset: SugarPosition(xDelta, yDelta),
4600
          offset: SugarPosition(xDelta, yDelta),
4197
          classesOn: bind$3(alignmentsOn, getClasses),
4601
          classesOn: bind$3(alignmentsOn, getClasses),
Línea 4276... Línea 4680...
4276
    const fallback = () => nu$5(0, 0, {});
4680
    const fallback = () => nu$5(0, 0, {});
Línea 4277... Línea 4681...
4277
 
4681
 
Línea 4278... Línea 4682...
4278
    const nu$4 = identity;
4682
    const nu$4 = identity;
4279
 
4683
 
Línea 4280... Línea 4684...
4280
    const onDirection = (isLtr, isRtl) => element => getDirection(element) === 'rtl' ? isRtl : isLtr;
4684
    const onDirection = (isLtr, isRtl) => element => getDirection(element) === 'rtl' ? isRtl : isLtr;
4281
    const getDirection = element => get$e(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
4685
    const getDirection = element => get$f(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
4282
 
4686
 
4283
    var AttributeValue;
4687
    var AttributeValue;
4284
    (function (AttributeValue) {
4688
    (function (AttributeValue) {
4285
      AttributeValue['TopToBottom'] = 'toptobottom';
4689
      AttributeValue['TopToBottom'] = 'toptobottom';
4286
      AttributeValue['BottomToTop'] = 'bottomtotop';
4690
      AttributeValue['BottomToTop'] = 'bottomtotop';
Línea 4287... Línea 4691...
4287
    }(AttributeValue || (AttributeValue = {})));
4691
    }(AttributeValue || (AttributeValue = {})));
4288
    const Attribute = 'data-alloy-vertical-dir';
4692
    const Attribute = 'data-alloy-vertical-dir';
4289
    const isBottomToTopDir = el => closest$2(el, current => isElement$1(current) && get$f(current, 'data-alloy-vertical-dir') === AttributeValue.BottomToTop);
4693
    const isBottomToTopDir = el => closest$2(el, current => isElement$1(current) && get$g(current, 'data-alloy-vertical-dir') === AttributeValue.BottomToTop);
4290
 
4694
 
4291
    const schema$y = () => optionObjOf('layouts', [
4695
    const schema$y = () => optionObjOf('layouts', [
4292
      required$1('onLtr'),
4696
      required$1('onLtr'),
4293
      required$1('onRtl'),
4697
      required$1('onRtl'),
4294
      option$3('onBottomLtr'),
4698
      option$3('onBottomLtr'),
4295
      option$3('onBottomRtl')
4699
      option$3('onBottomRtl')
4296
    ]);
4700
    ]);
4297
    const get$5 = (elem, info, defaultLtr, defaultRtl, defaultBottomLtr, defaultBottomRtl, dirElement) => {
4701
    const get$6 = (elem, info, defaultLtr, defaultRtl, defaultBottomLtr, defaultBottomRtl, dirElement) => {
4298
      const isBottomToTop = dirElement.map(isBottomToTopDir).getOr(false);
4702
      const isBottomToTop = dirElement.map(isBottomToTopDir).getOr(false);
Línea 4305... Línea 4709...
4305
    };
4709
    };
Línea 4306... Línea 4710...
4306
 
4710
 
4307
    const placement$4 = (component, anchorInfo, origin) => {
4711
    const placement$4 = (component, anchorInfo, origin) => {
4308
      const hotspot = anchorInfo.hotspot;
4712
      const hotspot = anchorInfo.hotspot;
4309
      const anchorBox = toBox(origin, hotspot.element);
4713
      const anchorBox = toBox(origin, hotspot.element);
4310
      const layouts = get$5(component.element, anchorInfo, belowOrAbove(), belowOrAboveRtl(), aboveOrBelow(), aboveOrBelowRtl(), Optional.some(anchorInfo.hotspot.element));
4714
      const layouts = get$6(component.element, anchorInfo, belowOrAbove(), belowOrAboveRtl(), aboveOrBelow(), aboveOrBelowRtl(), Optional.some(anchorInfo.hotspot.element));
4311
      return Optional.some(nu$4({
4715
      return Optional.some(nu$4({
4312
        anchorBox,
4716
        anchorBox,
4313
        bubble: anchorInfo.bubble.getOr(fallback()),
4717
        bubble: anchorInfo.bubble.getOr(fallback()),
4314
        overrides: anchorInfo.overrides,
4718
        overrides: anchorInfo.overrides,
Línea 4324... Línea 4728...
4324
    ];
4728
    ];
Línea 4325... Línea 4729...
4325
 
4729
 
4326
    const placement$3 = (component, anchorInfo, origin) => {
4730
    const placement$3 = (component, anchorInfo, origin) => {
4327
      const pos = translate$2(origin, anchorInfo.x, anchorInfo.y);
4731
      const pos = translate$2(origin, anchorInfo.x, anchorInfo.y);
4328
      const anchorBox = bounds(pos.left, pos.top, anchorInfo.width, anchorInfo.height);
4732
      const anchorBox = bounds(pos.left, pos.top, anchorInfo.width, anchorInfo.height);
4329
      const layouts = get$5(component.element, anchorInfo, all$1(), allRtl$1(), all$1(), allRtl$1(), Optional.none());
4733
      const layouts = get$6(component.element, anchorInfo, all$1(), allRtl$1(), all$1(), allRtl$1(), Optional.none());
4330
      return Optional.some(nu$4({
4734
      return Optional.some(nu$4({
4331
        anchorBox,
4735
        anchorBox,
4332
        bubble: anchorInfo.bubble,
4736
        bubble: anchorInfo.bubble,
4333
        overrides: anchorInfo.overrides,
4737
        overrides: anchorInfo.overrides,
Línea 4378... Línea 4782...
4378
      };
4782
      };
4379
      return Optional.from(win.frameElement).map(SugarElement.fromDom).filter(hasSameOwner).map(absolute$3);
4783
      return Optional.from(win.frameElement).map(SugarElement.fromDom).filter(hasSameOwner).map(absolute$3);
4380
    };
4784
    };
4381
    const getRootPoint = (component, origin, anchorInfo) => {
4785
    const getRootPoint = (component, origin, anchorInfo) => {
4382
      const doc = owner$4(component.element);
4786
      const doc = owner$4(component.element);
4383
      const outerScroll = get$b(doc);
4787
      const outerScroll = get$c(doc);
4384
      const offset = getOffset(component, origin, anchorInfo).getOr(outerScroll);
4788
      const offset = getOffset(component, origin, anchorInfo).getOr(outerScroll);
4385
      return absolute$1(offset, outerScroll.left, outerScroll.top);
4789
      return absolute$1(offset, outerScroll.left, outerScroll.top);
4386
    };
4790
    };
Línea 4387... Línea 4791...
4387
 
4791
 
Línea 4396... Línea 4800...
4396
      ];
4800
      ];
4397
      const topLeft = cata$1(origin, () => sumAsAbsolute(points), () => sumAsAbsolute(points), () => sumAsFixed(points));
4801
      const topLeft = cata$1(origin, () => sumAsAbsolute(points), () => sumAsAbsolute(points), () => sumAsFixed(points));
4398
      const anchorBox = rect(topLeft.left, topLeft.top, box.width, box.height);
4802
      const anchorBox = rect(topLeft.left, topLeft.top, box.width, box.height);
4399
      const layoutsLtr = anchorInfo.showAbove ? aboveOrBelow() : belowOrAbove();
4803
      const layoutsLtr = anchorInfo.showAbove ? aboveOrBelow() : belowOrAbove();
4400
      const layoutsRtl = anchorInfo.showAbove ? aboveOrBelowRtl() : belowOrAboveRtl();
4804
      const layoutsRtl = anchorInfo.showAbove ? aboveOrBelowRtl() : belowOrAboveRtl();
4401
      const layouts = get$5(elem, anchorInfo, layoutsLtr, layoutsRtl, layoutsLtr, layoutsRtl, Optional.none());
4805
      const layouts = get$6(elem, anchorInfo, layoutsLtr, layoutsRtl, layoutsLtr, layoutsRtl, Optional.none());
4402
      return nu$4({
4806
      return nu$4({
4403
        anchorBox,
4807
        anchorBox,
4404
        bubble: anchorInfo.bubble.getOr(fallback()),
4808
        bubble: anchorInfo.bubble.getOr(fallback()),
4405
        overrides: anchorInfo.overrides,
4809
        overrides: anchorInfo.overrides,
4406
        layouts
4810
        layouts
Línea 4686... Línea 5090...
4686
        set
5090
        set
4687
      };
5091
      };
4688
    };
5092
    };
Línea 4689... Línea 5093...
4689
 
5093
 
4690
    const api = NodeValue(isText, 'text');
5094
    const api = NodeValue(isText, 'text');
Línea 4691... Línea 5095...
4691
    const get$4 = element => api.get(element);
5095
    const get$5 = element => api.get(element);
4692
 
5096
 
4693
    const point = (element, offset) => ({
5097
    const point = (element, offset) => ({
4694
      element,
5098
      element,
Línea 4700... Línea 5104...
4700
        return point(element, offset);
5104
        return point(element, offset);
4701
      } else if (offset < children$1.length) {
5105
      } else if (offset < children$1.length) {
4702
        return point(children$1[offset], 0);
5106
        return point(children$1[offset], 0);
4703
      } else {
5107
      } else {
4704
        const last = children$1[children$1.length - 1];
5108
        const last = children$1[children$1.length - 1];
4705
        const len = isText(last) ? get$4(last).length : children(last).length;
5109
        const len = isText(last) ? get$5(last).length : children(last).length;
4706
        return point(last, len);
5110
        return point(last, len);
4707
      }
5111
      }
4708
    };
5112
    };
Línea 4709... Línea 5113...
4709
 
5113
 
Línea 4728... Línea 5132...
4728
        if (isSimRange(sel)) {
5132
        if (isSimRange(sel)) {
4729
          const optRect = getBounds$1(win, SimSelection.exactFromRange(sel)).orThunk(() => {
5133
          const optRect = getBounds$1(win, SimSelection.exactFromRange(sel)).orThunk(() => {
4730
            const zeroWidth$1 = SugarElement.fromText(zeroWidth);
5134
            const zeroWidth$1 = SugarElement.fromText(zeroWidth);
4731
            before$1(sel.start, zeroWidth$1);
5135
            before$1(sel.start, zeroWidth$1);
4732
            const rect = getFirstRect(win, SimSelection.exact(zeroWidth$1, 0, zeroWidth$1, 1));
5136
            const rect = getFirstRect(win, SimSelection.exact(zeroWidth$1, 0, zeroWidth$1, 1));
4733
            remove$5(zeroWidth$1);
5137
            remove$6(zeroWidth$1);
4734
            return rect;
5138
            return rect;
4735
          });
5139
          });
4736
          return optRect.bind(rawRect => {
5140
          return optRect.bind(rawRect => {
4737
            return getBox(rawRect.left, rawRect.top, rawRect.width, rawRect.height);
5141
            return getBox(rawRect.left, rawRect.top, rawRect.width, rawRect.height);
4738
          });
5142
          });
Línea 4801... Línea 5205...
4801
      northeast$1
5205
      northeast$1
4802
    ];
5206
    ];
Línea 4803... Línea 5207...
4803
 
5207
 
4804
    const placement = (component, submenuInfo, origin) => {
5208
    const placement = (component, submenuInfo, origin) => {
4805
      const anchorBox = toBox(origin, submenuInfo.item.element);
5209
      const anchorBox = toBox(origin, submenuInfo.item.element);
4806
      const layouts = get$5(component.element, submenuInfo, all(), allRtl(), all(), allRtl(), Optional.none());
5210
      const layouts = get$6(component.element, submenuInfo, all(), allRtl(), all(), allRtl(), Optional.none());
4807
      return Optional.some(nu$4({
5211
      return Optional.some(nu$4({
4808
        anchorBox,
5212
        anchorBox,
4809
        bubble: fallback(),
5213
        bubble: fallback(),
4810
        overrides: submenuInfo.overrides,
5214
        overrides: submenuInfo.overrides,
Línea 4874... Línea 5278...
4874
          const optBounds = optWithinBounds.orThunk(() => posConfig.getBounds.map(apply$1));
5278
          const optBounds = optWithinBounds.orThunk(() => posConfig.getBounds.map(apply$1));
4875
          const newState = place(origin, anchoring, optBounds, placee, placeeState, placeeDetail.transition);
5279
          const newState = place(origin, anchoring, optBounds, placee, placeeState, placeeDetail.transition);
4876
          posState.set(placee.uid, newState);
5280
          posState.set(placee.uid, newState);
4877
        });
5281
        });
4878
        oldVisibility.fold(() => {
5282
        oldVisibility.fold(() => {
4879
          remove$6(element, 'visibility');
5283
          remove$7(element, 'visibility');
4880
        }, vis => {
5284
        }, vis => {
4881
          set$8(element, 'visibility', vis);
5285
          set$8(element, 'visibility', vis);
4882
        });
5286
        });
4883
        if (getRaw(element, 'left').isNone() && getRaw(element, 'top').isNone() && getRaw(element, 'right').isNone() && getRaw(element, 'bottom').isNone() && is$1(getRaw(element, 'position'), 'fixed')) {
5287
        if (getRaw(element, 'left').isNone() && getRaw(element, 'top').isNone() && getRaw(element, 'right').isNone() && getRaw(element, 'bottom').isNone() && is$1(getRaw(element, 'position'), 'fixed')) {
4884
          remove$6(element, 'position');
5288
          remove$7(element, 'position');
4885
        }
5289
        }
4886
      }, element);
5290
      }, element);
4887
    };
5291
    };
4888
    const getMode = (component, pConfig, _pState) => pConfig.useFixed() ? 'fixed' : 'absolute';
5292
    const getMode = (component, pConfig, _pState) => pConfig.useFixed() ? 'fixed' : 'absolute';
4889
    const reset$1 = (component, pConfig, posState, placee) => {
5293
    const reset = (component, pConfig, posState, placee) => {
4890
      const element = placee.element;
5294
      const element = placee.element;
4891
      each$1([
5295
      each$1([
4892
        'position',
5296
        'position',
4893
        'left',
5297
        'left',
4894
        'right',
5298
        'right',
4895
        'top',
5299
        'top',
4896
        'bottom'
5300
        'bottom'
4897
      ], prop => remove$6(element, prop));
5301
      ], prop => remove$7(element, prop));
4898
      reset$2(element);
5302
      reset$1(element);
4899
      posState.clear(placee.uid);
5303
      posState.clear(placee.uid);
4900
    };
5304
    };
Línea 4901... Línea 5305...
4901
 
5305
 
4902
    var PositionApis = /*#__PURE__*/Object.freeze({
5306
    var PositionApis = /*#__PURE__*/Object.freeze({
4903
        __proto__: null,
5307
        __proto__: null,
4904
        position: position$1,
5308
        position: position$1,
4905
        positionWithinBounds: positionWithinBounds,
5309
        positionWithinBounds: positionWithinBounds,
4906
        getMode: getMode,
5310
        getMode: getMode,
4907
        reset: reset$1
5311
        reset: reset
Línea 4908... Línea 5312...
4908
    });
5312
    });
4909
 
5313
 
4910
    const init$g = () => {
5314
    const init$f = () => {
4911
      let state = {};
5315
      let state = {};
4912
      const set = (id, data) => {
5316
      const set = (id, data) => {
4913
        state[id] = data;
5317
        state[id] = data;
4914
      };
5318
      };
4915
      const get = id => get$g(state, id);
5319
      const get = id => get$h(state, id);
4916
      const clear = id => {
5320
      const clear = id => {
4917
        if (isNonNullable(id)) {
5321
        if (isNonNullable(id)) {
4918
          delete state[id];
5322
          delete state[id];
4919
        } else {
5323
        } else {
4920
          state = {};
5324
          state = {};
4921
        }
5325
        }
4922
      };
5326
      };
4923
      return nu$8({
5327
      return nu$7({
4924
        readState: () => state,
5328
        readState: () => state,
4925
        clear,
5329
        clear,
4926
        set,
5330
        set,
4927
        get
5331
        get
Línea 4928... Línea 5332...
4928
      });
5332
      });
4929
    };
5333
    };
4930
 
5334
 
4931
    var PositioningState = /*#__PURE__*/Object.freeze({
5335
    var PositioningState = /*#__PURE__*/Object.freeze({
Línea 4932... Línea 5336...
4932
        __proto__: null,
5336
        __proto__: null,
4933
        init: init$g
5337
        init: init$f
4934
    });
5338
    });
Línea 4964... Línea 5368...
4964
    };
5368
    };
4965
    const attach$1 = (parent, child) => {
5369
    const attach$1 = (parent, child) => {
4966
      append$2(parent.element, child.element);
5370
      append$2(parent.element, child.element);
4967
    };
5371
    };
4968
    const detachChildren$1 = component => {
5372
    const detachChildren$1 = component => {
4969
      each$1(component.components(), childComp => remove$5(childComp.element));
5373
      each$1(component.components(), childComp => remove$6(childComp.element));
4970
      empty(component.element);
5374
      empty(component.element);
4971
      component.syncComponents();
5375
      component.syncComponents();
4972
    };
5376
    };
4973
    const replaceChildren = (component, newSpecs, buildNewChildren) => {
5377
    const replaceChildren = (component, newSpecs, buildNewChildren) => {
4974
      const subs = component.components();
5378
      const subs = component.components();
Línea 5026... Línea 5430...
5026
      }
5430
      }
5027
      parent.syncComponents();
5431
      parent.syncComponents();
5028
    };
5432
    };
5029
    const doDetach = component => {
5433
    const doDetach = component => {
5030
      fireDetaching(component);
5434
      fireDetaching(component);
5031
      remove$5(component.element);
5435
      remove$6(component.element);
5032
      component.getSystem().removeFromWorld(component);
5436
      component.getSystem().removeFromWorld(component);
5033
    };
5437
    };
5034
    const detach = component => {
5438
    const detach = component => {
5035
      const parent$1 = parent(component.element).bind(p => component.getSystem().getByDom(p).toOptional());
5439
      const parent$1 = parent(component.element).bind(p => component.getSystem().getByDom(p).toOptional());
5036
      doDetach(component);
5440
      doDetach(component);
Línea 5060... Línea 5464...
5060
    const detachSystem = guiSystem => {
5464
    const detachSystem = guiSystem => {
5061
      const children$1 = children(guiSystem.element);
5465
      const children$1 = children(guiSystem.element);
5062
      each$1(children$1, child => {
5466
      each$1(children$1, child => {
5063
        guiSystem.getByDom(child).each(fireDetaching);
5467
        guiSystem.getByDom(child).each(fireDetaching);
5064
      });
5468
      });
5065
      remove$5(guiSystem.element);
5469
      remove$6(guiSystem.element);
5066
    };
5470
    };
Línea 5067... Línea 5471...
5067
 
5471
 
5068
    const rebuild = (sandbox, sConfig, sState, data) => {
5472
    const rebuild = (sandbox, sConfig, sState, data) => {
5069
      sState.get().each(_data => {
5473
      sState.get().each(_data => {
Línea 5099... Línea 5503...
5099
    const isOpen$1 = (_sandbox, _sConfig, sState) => sState.isOpen();
5503
    const isOpen$1 = (_sandbox, _sConfig, sState) => sState.isOpen();
5100
    const isPartOf = (sandbox, sConfig, sState, queryElem) => isOpen$1(sandbox, sConfig, sState) && sState.get().exists(data => sConfig.isPartOf(sandbox, data, queryElem));
5504
    const isPartOf = (sandbox, sConfig, sState, queryElem) => isOpen$1(sandbox, sConfig, sState) && sState.get().exists(data => sConfig.isPartOf(sandbox, data, queryElem));
5101
    const getState$2 = (_sandbox, _sConfig, sState) => sState.get();
5505
    const getState$2 = (_sandbox, _sConfig, sState) => sState.get();
5102
    const store = (sandbox, cssKey, attr, newValue) => {
5506
    const store = (sandbox, cssKey, attr, newValue) => {
5103
      getRaw(sandbox.element, cssKey).fold(() => {
5507
      getRaw(sandbox.element, cssKey).fold(() => {
5104
        remove$7(sandbox.element, attr);
5508
        remove$8(sandbox.element, attr);
5105
      }, v => {
5509
      }, v => {
5106
        set$9(sandbox.element, attr, v);
5510
        set$9(sandbox.element, attr, v);
5107
      });
5511
      });
5108
      set$8(sandbox.element, cssKey, newValue);
5512
      set$8(sandbox.element, cssKey, newValue);
5109
    };
5513
    };
5110
    const restore = (sandbox, cssKey, attr) => {
5514
    const restore = (sandbox, cssKey, attr) => {
5111
      getOpt(sandbox.element, attr).fold(() => remove$6(sandbox.element, cssKey), oldValue => set$8(sandbox.element, cssKey, oldValue));
5515
      getOpt(sandbox.element, attr).fold(() => remove$7(sandbox.element, cssKey), oldValue => set$8(sandbox.element, cssKey, oldValue));
5112
    };
5516
    };
5113
    const cloak = (sandbox, sConfig, _sState) => {
5517
    const cloak = (sandbox, sConfig, _sState) => {
5114
      const sink = sConfig.getAttachPoint(sandbox);
5518
      const sink = sConfig.getAttachPoint(sandbox);
5115
      set$8(sandbox.element, 'position', Positioning.getMode(sink));
5519
      set$8(sandbox.element, 'position', Positioning.getMode(sink));
5116
      store(sandbox, 'visibility', sConfig.cloakVisibilityAttr, 'hidden');
5520
      store(sandbox, 'visibility', sConfig.cloakVisibilityAttr, 'hidden');
Línea 5121... Línea 5525...
5121
      'right',
5525
      'right',
5122
      'bottom'
5526
      'bottom'
5123
    ], pos => getRaw(element, pos).isSome());
5527
    ], pos => getRaw(element, pos).isSome());
5124
    const decloak = (sandbox, sConfig, _sState) => {
5528
    const decloak = (sandbox, sConfig, _sState) => {
5125
      if (!hasPosition(sandbox.element)) {
5529
      if (!hasPosition(sandbox.element)) {
5126
        remove$6(sandbox.element, 'position');
5530
        remove$7(sandbox.element, 'position');
5127
      }
5531
      }
5128
      restore(sandbox, 'visibility', sConfig.cloakVisibilityAttr);
5532
      restore(sandbox, 'visibility', sConfig.cloakVisibilityAttr);
5129
    };
5533
    };
Línea 5130... Línea 5534...
5130
 
5534
 
Línea 5139... Línea 5543...
5139
        isPartOf: isPartOf,
5543
        isPartOf: isPartOf,
5140
        getState: getState$2,
5544
        getState: getState$2,
5141
        setContent: setContent
5545
        setContent: setContent
5142
    });
5546
    });
Línea 5143... Línea 5547...
5143
 
5547
 
5144
    const events$g = (sandboxConfig, sandboxState) => derive$2([run$1(sandboxClose(), (sandbox, _simulatedEvent) => {
5548
    const events$f = (sandboxConfig, sandboxState) => derive$2([run$1(sandboxClose(), (sandbox, _simulatedEvent) => {
5145
        close$1(sandbox, sandboxConfig, sandboxState);
5549
        close$1(sandbox, sandboxConfig, sandboxState);
Línea 5146... Línea 5550...
5146
      })]);
5550
      })]);
5147
 
5551
 
5148
    var ActiveSandbox = /*#__PURE__*/Object.freeze({
5552
    var ActiveSandbox = /*#__PURE__*/Object.freeze({
5149
        __proto__: null,
5553
        __proto__: null,
Línea 5150... Línea 5554...
5150
        events: events$g
5554
        events: events$f
5151
    });
5555
    });
5152
 
5556
 
5153
    var SandboxSchema = [
5557
    var SandboxSchema = [
5154
      onHandler('onOpen'),
5558
      onHandler('onOpen'),
5155
      onHandler('onClose'),
5559
      onHandler('onClose'),
5156
      required$1('isPartOf'),
5560
      required$1('isPartOf'),
Línea 5157... Línea 5561...
5157
      required$1('getAttachPoint'),
5561
      required$1('getAttachPoint'),
5158
      defaulted('cloakVisibilityAttr', 'data-precloak-visibility')
5562
      defaulted('cloakVisibilityAttr', 'data-precloak-visibility')
5159
    ];
5563
    ];
5160
 
5564
 
5161
    const init$f = () => {
5565
    const init$e = () => {
5162
      const contents = value$2();
5566
      const contents = value$4();
5163
      const readState = constant$1('not-implemented');
5567
      const readState = constant$1('not-implemented');
5164
      return nu$8({
5568
      return nu$7({
5165
        readState,
5569
        readState,
5166
        isOpen: contents.isSet,
5570
        isOpen: contents.isSet,
5167
        clear: contents.clear,
5571
        clear: contents.clear,
Línea 5168... Línea 5572...
5168
        set: contents.set,
5572
        set: contents.set,
5169
        get: contents.get
5573
        get: contents.get
5170
      });
5574
      });
5171
    };
5575
    };
Línea 5172... Línea 5576...
5172
 
5576
 
5173
    var SandboxState = /*#__PURE__*/Object.freeze({
5577
    var SandboxState = /*#__PURE__*/Object.freeze({
5174
        __proto__: null,
5578
        __proto__: null,
Línea 5244... Línea 5648...
5244
        setValue: setValue$3,
5648
        setValue: setValue$3,
5245
        getValue: getValue$3,
5649
        getValue: getValue$3,
5246
        getState: getState$1
5650
        getState: getState$1
5247
    });
5651
    });
Línea 5248... Línea 5652...
5248
 
5652
 
5249
    const events$f = (repConfig, repState) => {
5653
    const events$e = (repConfig, repState) => {
5250
      const es = repConfig.resetOnDom ? [
5654
      const es = repConfig.resetOnDom ? [
5251
        runOnAttached((comp, _se) => {
5655
        runOnAttached((comp, _se) => {
5252
          onLoad$5(comp, repConfig, repState);
5656
          onLoad$5(comp, repConfig, repState);
5253
        }),
5657
        }),
Línea 5258... Línea 5662...
5258
      return derive$2(es);
5662
      return derive$2(es);
5259
    };
5663
    };
Línea 5260... Línea 5664...
5260
 
5664
 
5261
    var ActiveRepresenting = /*#__PURE__*/Object.freeze({
5665
    var ActiveRepresenting = /*#__PURE__*/Object.freeze({
5262
        __proto__: null,
5666
        __proto__: null,
5263
        events: events$f
5667
        events: events$e
Línea 5264... Línea 5668...
5264
    });
5668
    });
5265
 
5669
 
5266
    const memory$1 = () => {
5670
    const memory$1 = () => {
Línea 5271... Línea 5675...
5271
      });
5675
      });
5272
      const isNotSet = () => data.get() === null;
5676
      const isNotSet = () => data.get() === null;
5273
      const clear = () => {
5677
      const clear = () => {
5274
        data.set(null);
5678
        data.set(null);
5275
      };
5679
      };
5276
      return nu$8({
5680
      return nu$7({
5277
        set: data.set,
5681
        set: data.set,
5278
        get: data.get,
5682
        get: data.get,
5279
        isNotSet,
5683
        isNotSet,
5280
        clear,
5684
        clear,
5281
        readState
5685
        readState
5282
      });
5686
      });
5283
    };
5687
    };
5284
    const manual = () => {
5688
    const manual = () => {
5285
      const readState = noop;
5689
      const readState = noop;
5286
      return nu$8({ readState });
5690
      return nu$7({ readState });
5287
    };
5691
    };
5288
    const dataset = () => {
5692
    const dataset = () => {
5289
      const dataByValue = Cell({});
5693
      const dataByValue = Cell({});
5290
      const dataByText = Cell({});
5694
      const dataByText = Cell({});
5291
      const readState = () => ({
5695
      const readState = () => ({
Línea 5295... Línea 5699...
5295
      });
5699
      });
5296
      const clear = () => {
5700
      const clear = () => {
5297
        dataByValue.set({});
5701
        dataByValue.set({});
5298
        dataByText.set({});
5702
        dataByText.set({});
5299
      };
5703
      };
5300
      const lookup = itemString => get$g(dataByValue.get(), itemString).orThunk(() => get$g(dataByText.get(), itemString));
5704
      const lookup = itemString => get$h(dataByValue.get(), itemString).orThunk(() => get$h(dataByText.get(), itemString));
5301
      const update = items => {
5705
      const update = items => {
5302
        const currentDataByValue = dataByValue.get();
5706
        const currentDataByValue = dataByValue.get();
5303
        const currentDataByText = dataByText.get();
5707
        const currentDataByText = dataByText.get();
5304
        const newDataByValue = {};
5708
        const newDataByValue = {};
5305
        const newDataByText = {};
5709
        const newDataByText = {};
5306
        each$1(items, item => {
5710
        each$1(items, item => {
5307
          newDataByValue[item.value] = item;
5711
          newDataByValue[item.value] = item;
5308
          get$g(item, 'meta').each(meta => {
5712
          get$h(item, 'meta').each(meta => {
5309
            get$g(meta, 'text').each(text => {
5713
            get$h(meta, 'text').each(text => {
5310
              newDataByText[text] = item;
5714
              newDataByText[text] = item;
5311
            });
5715
            });
5312
          });
5716
          });
5313
        });
5717
        });
5314
        dataByValue.set({
5718
        dataByValue.set({
Línea 5318... Línea 5722...
5318
        dataByText.set({
5722
        dataByText.set({
5319
          ...currentDataByText,
5723
          ...currentDataByText,
5320
          ...newDataByText
5724
          ...newDataByText
5321
        });
5725
        });
5322
      };
5726
      };
5323
      return nu$8({
5727
      return nu$7({
5324
        readState,
5728
        readState,
5325
        lookup,
5729
        lookup,
5326
        update,
5730
        update,
5327
        clear
5731
        clear
5328
      });
5732
      });
5329
    };
5733
    };
5330
    const init$e = spec => spec.store.manager.state(spec);
5734
    const init$d = spec => spec.store.manager.state(spec);
Línea 5331... Línea 5735...
5331
 
5735
 
5332
    var RepresentState = /*#__PURE__*/Object.freeze({
5736
    var RepresentState = /*#__PURE__*/Object.freeze({
5333
        __proto__: null,
5737
        __proto__: null,
5334
        memory: memory$1,
5738
        memory: memory$1,
5335
        dataset: dataset,
5739
        dataset: dataset,
5336
        manual: manual,
5740
        manual: manual,
5337
        init: init$e
5741
        init: init$d
Línea 5338... Línea 5742...
5338
    });
5742
    });
5339
 
5743
 
5340
    const setValue$2 = (component, repConfig, repState, data) => {
5744
    const setValue$2 = (component, repConfig, repState, data) => {
Línea 5443... Línea 5847...
5443
      },
5847
      },
5444
      state: RepresentState
5848
      state: RepresentState
5445
    });
5849
    });
Línea 5446... Línea 5850...
5446
 
5850
 
5447
    const field = (name, forbidden) => defaultedObjOf(name, {}, map$2(forbidden, f => forbid(f.name(), 'Cannot configure ' + f.name() + ' for ' + name)).concat([customField('dump', identity)]));
5851
    const field = (name, forbidden) => defaultedObjOf(name, {}, map$2(forbidden, f => forbid(f.name(), 'Cannot configure ' + f.name() + ' for ' + name)).concat([customField('dump', identity)]));
5448
    const get$3 = data => data.dump;
5852
    const get$4 = data => data.dump;
5449
    const augment = (data, original) => ({
5853
    const augment = (data, original) => ({
5450
      ...derive$1(original),
5854
      ...derive$1(original),
5451
      ...data.dump
5855
      ...data.dump
5452
    });
5856
    });
5453
    const SketchBehaviours = {
5857
    const SketchBehaviours = {
5454
      field,
5858
      field,
5455
      augment,
5859
      augment,
5456
      get: get$3
5860
      get: get$4
Línea 5457... Línea 5861...
5457
    };
5861
    };
5458
 
5862
 
5459
    const _placeholder = 'placeholder';
5863
    const _placeholder = 'placeholder';
Línea 5474... Línea 5878...
5474
    const isSubstituted = spec => has$2(spec, 'uiType');
5878
    const isSubstituted = spec => has$2(spec, 'uiType');
5475
    const subPlaceholder = (owner, detail, compSpec, placeholders) => {
5879
    const subPlaceholder = (owner, detail, compSpec, placeholders) => {
5476
      if (owner.exists(o => o !== compSpec.owner)) {
5880
      if (owner.exists(o => o !== compSpec.owner)) {
5477
        return adt$3.single(true, constant$1(compSpec));
5881
        return adt$3.single(true, constant$1(compSpec));
5478
      }
5882
      }
5479
      return get$g(placeholders, compSpec.name).fold(() => {
5883
      return get$h(placeholders, compSpec.name).fold(() => {
5480
        throw new Error('Unknown placeholder component: ' + compSpec.name + '\nKnown: [' + keys(placeholders) + ']\nNamespace: ' + owner.getOr('none') + '\nSpec: ' + JSON.stringify(compSpec, null, 2));
5884
        throw new Error('Unknown placeholder component: ' + compSpec.name + '\nKnown: [' + keys(placeholders) + ']\nNamespace: ' + owner.getOr('none') + '\nSpec: ' + JSON.stringify(compSpec, null, 2));
5481
      }, newSpec => newSpec.replace());
5885
      }, newSpec => newSpec.replace());
5482
    };
5886
    };
5483
    const scan = (owner, detail, compSpec, placeholders) => {
5887
    const scan = (owner, detail, compSpec, placeholders) => {
5484
      if (isSubstituted(compSpec) && compSpec.uiType === _placeholder) {
5888
      if (isSubstituted(compSpec) && compSpec.uiType === _placeholder) {
Línea 5489... Línea 5893...
5489
    };
5893
    };
5490
    const substitute = (owner, detail, compSpec, placeholders) => {
5894
    const substitute = (owner, detail, compSpec, placeholders) => {
5491
      const base = scan(owner, detail, compSpec, placeholders);
5895
      const base = scan(owner, detail, compSpec, placeholders);
5492
      return base.fold((req, valueThunk) => {
5896
      return base.fold((req, valueThunk) => {
5493
        const value = isSubstituted(compSpec) ? valueThunk(detail, compSpec.config, compSpec.validated) : valueThunk(detail);
5897
        const value = isSubstituted(compSpec) ? valueThunk(detail, compSpec.config, compSpec.validated) : valueThunk(detail);
5494
        const childSpecs = get$g(value, 'components').getOr([]);
5898
        const childSpecs = get$h(value, 'components').getOr([]);
5495
        const substituted = bind$3(childSpecs, c => substitute(owner, detail, c, placeholders));
5899
        const substituted = bind$3(childSpecs, c => substitute(owner, detail, c, placeholders));
5496
        return [{
5900
        return [{
5497
            ...value,
5901
            ...value,
5498
            components: substituted
5902
            components: substituted
5499
          }];
5903
          }];
Línea 5813... Línea 6217...
5813
        ...apis,
6217
        ...apis,
5814
        ...extraApis
6218
        ...extraApis
5815
      };
6219
      };
5816
    };
6220
    };
Línea 5817... Línea 6221...
5817
 
6221
 
Línea 5818... Línea 6222...
5818
    const inside = target => isTag('input')(target) && get$f(target, 'type') !== 'radio' || isTag('textarea')(target);
6222
    const inside = target => isTag('input')(target) && get$g(target, 'type') !== 'radio' || isTag('textarea')(target);
Línea 5819... Línea 6223...
5819
 
6223
 
5820
    const getCurrent = (component, composeConfig, _composeState) => composeConfig.find(component);
6224
    const getCurrent = (component, composeConfig, _composeState) => composeConfig.find(component);
Línea 5846... Línea 6250...
5846
    const nativeIsDisabled = component => has$1(component.element, 'disabled');
6250
    const nativeIsDisabled = component => has$1(component.element, 'disabled');
5847
    const nativeDisable = component => {
6251
    const nativeDisable = component => {
5848
      set$9(component.element, 'disabled', 'disabled');
6252
      set$9(component.element, 'disabled', 'disabled');
5849
    };
6253
    };
5850
    const nativeEnable = component => {
6254
    const nativeEnable = component => {
5851
      remove$7(component.element, 'disabled');
6255
      remove$8(component.element, 'disabled');
5852
    };
6256
    };
5853
    const ariaIsDisabled = component => get$f(component.element, 'aria-disabled') === 'true';
6257
    const ariaIsDisabled = component => get$g(component.element, 'aria-disabled') === 'true';
5854
    const ariaDisable = component => {
6258
    const ariaDisable = component => {
5855
      set$9(component.element, 'aria-disabled', 'true');
6259
      set$9(component.element, 'aria-disabled', 'true');
5856
    };
6260
    };
5857
    const ariaEnable = component => {
6261
    const ariaEnable = component => {
5858
      set$9(component.element, 'aria-disabled', 'false');
6262
      set$9(component.element, 'aria-disabled', 'false');
Línea 5865... Línea 6269...
5865
      f(component);
6269
      f(component);
5866
      disableConfig.onDisabled(component);
6270
      disableConfig.onDisabled(component);
5867
    };
6271
    };
5868
    const enable = (component, disableConfig, _disableState) => {
6272
    const enable = (component, disableConfig, _disableState) => {
5869
      disableConfig.disableClass.each(disableClass => {
6273
      disableConfig.disableClass.each(disableClass => {
5870
        remove$2(component.element, disableClass);
6274
        remove$3(component.element, disableClass);
5871
      });
6275
      });
5872
      const f = hasNative(component, disableConfig) ? nativeEnable : ariaEnable;
6276
      const f = hasNative(component, disableConfig) ? nativeEnable : ariaEnable;
5873
      f(component);
6277
      f(component);
5874
      disableConfig.onEnabled(component);
6278
      disableConfig.onEnabled(component);
5875
    };
6279
    };
5876
    const isDisabled = (component, disableConfig) => hasNative(component, disableConfig) ? nativeIsDisabled(component) : ariaIsDisabled(component);
6280
    const isDisabled$1 = (component, disableConfig) => hasNative(component, disableConfig) ? nativeIsDisabled(component) : ariaIsDisabled(component);
5877
    const set$4 = (component, disableConfig, disableState, disabled) => {
6281
    const set$4 = (component, disableConfig, disableState, disabled) => {
5878
      const f = disabled ? disable : enable;
6282
      const f = disabled ? disable : enable;
5879
      f(component, disableConfig);
6283
      f(component, disableConfig);
5880
    };
6284
    };
Línea 5881... Línea 6285...
5881
 
6285
 
5882
    var DisableApis = /*#__PURE__*/Object.freeze({
6286
    var DisableApis = /*#__PURE__*/Object.freeze({
5883
        __proto__: null,
6287
        __proto__: null,
5884
        enable: enable,
6288
        enable: enable,
5885
        disable: disable,
6289
        disable: disable,
5886
        isDisabled: isDisabled,
6290
        isDisabled: isDisabled$1,
5887
        onLoad: onLoad$1,
6291
        onLoad: onLoad$1,
5888
        set: set$4
6292
        set: set$4
Línea 5889... Línea 6293...
5889
    });
6293
    });
5890
 
6294
 
5891
    const exhibit$5 = (base, disableConfig) => nu$7({ classes: disableConfig.disabled() ? disableConfig.disableClass.toArray() : [] });
6295
    const exhibit$5 = (base, disableConfig) => nu$8({ classes: disableConfig.disabled() ? disableConfig.disableClass.toArray() : [] });
5892
    const events$e = (disableConfig, disableState) => derive$2([
6296
    const events$d = (disableConfig, disableState) => derive$2([
5893
      abort(execute$5(), (component, _simulatedEvent) => isDisabled(component, disableConfig)),
6297
      abort(execute$5(), (component, _simulatedEvent) => isDisabled$1(component, disableConfig)),
Línea 5894... Línea 6298...
5894
      loadEvent(disableConfig, disableState, onLoad$1)
6298
      loadEvent(disableConfig, disableState, onLoad$1)
5895
    ]);
6299
    ]);
5896
 
6300
 
5897
    var ActiveDisable = /*#__PURE__*/Object.freeze({
6301
    var ActiveDisable = /*#__PURE__*/Object.freeze({
5898
        __proto__: null,
6302
        __proto__: null,
Línea 5899... Línea 6303...
5899
        exhibit: exhibit$5,
6303
        exhibit: exhibit$5,
5900
        events: events$e
6304
        events: events$d
5901
    });
6305
    });
Línea 5918... Línea 6322...
5918
    const dehighlightAllExcept = (component, hConfig, hState, skip) => {
6322
    const dehighlightAllExcept = (component, hConfig, hState, skip) => {
5919
      const highlighted = descendants(component.element, '.' + hConfig.highlightClass);
6323
      const highlighted = descendants(component.element, '.' + hConfig.highlightClass);
5920
      each$1(highlighted, h => {
6324
      each$1(highlighted, h => {
5921
        const shouldSkip = exists(skip, skipComp => eq(skipComp.element, h));
6325
        const shouldSkip = exists(skip, skipComp => eq(skipComp.element, h));
5922
        if (!shouldSkip) {
6326
        if (!shouldSkip) {
5923
          remove$2(h, hConfig.highlightClass);
6327
          remove$3(h, hConfig.highlightClass);
5924
          component.getSystem().getByDom(h).each(target => {
6328
          component.getSystem().getByDom(h).each(target => {
5925
            hConfig.onDehighlight(component, target);
6329
            hConfig.onDehighlight(component, target);
5926
            emit(target, dehighlight$1());
6330
            emit(target, dehighlight$1());
5927
          });
6331
          });
5928
        }
6332
        }
5929
      });
6333
      });
5930
    };
6334
    };
5931
    const dehighlightAll = (component, hConfig, hState) => dehighlightAllExcept(component, hConfig, hState, []);
6335
    const dehighlightAll = (component, hConfig, hState) => dehighlightAllExcept(component, hConfig, hState, []);
5932
    const dehighlight = (component, hConfig, hState, target) => {
6336
    const dehighlight = (component, hConfig, hState, target) => {
5933
      if (isHighlighted(component, hConfig, hState, target)) {
6337
      if (isHighlighted(component, hConfig, hState, target)) {
5934
        remove$2(target.element, hConfig.highlightClass);
6338
        remove$3(target.element, hConfig.highlightClass);
5935
        hConfig.onDehighlight(component, target);
6339
        hConfig.onDehighlight(component, target);
5936
        emit(target, dehighlight$1());
6340
        emit(target, dehighlight$1());
5937
      }
6341
      }
5938
    };
6342
    };
5939
    const highlight = (component, hConfig, hState, target) => {
6343
    const highlight = (component, hConfig, hState, target) => {
Línea 6187... Línea 6591...
6187
        defaulted('useTabstopAt', always),
6591
        defaulted('useTabstopAt', always),
6188
        option$3('visibilitySelector')
6592
        option$3('visibilitySelector')
6189
      ].concat([cyclicField]);
6593
      ].concat([cyclicField]);
6190
      const isVisible = (tabbingConfig, element) => {
6594
      const isVisible = (tabbingConfig, element) => {
6191
        const target = tabbingConfig.visibilitySelector.bind(sel => closest$1(element, sel)).getOr(element);
6595
        const target = tabbingConfig.visibilitySelector.bind(sel => closest$1(element, sel)).getOr(element);
6192
        return get$d(target) > 0;
6596
        return get$e(target) > 0;
6193
      };
6597
      };
6194
      const findInitial = (component, tabbingConfig) => {
6598
      const findInitial = (component, tabbingConfig) => {
6195
        const tabstops = descendants(component.element, tabbingConfig.selector);
6599
        const tabstops = descendants(component.element, tabbingConfig.selector);
6196
        const visibles = filter$2(tabstops, elem => isVisible(tabbingConfig, elem));
6600
        const visibles = filter$2(tabstops, elem => isVisible(tabbingConfig, elem));
6197
        return Optional.from(visibles[tabbingConfig.firstTabstop]);
6601
        return Optional.from(visibles[tabbingConfig.firstTabstop]);
Línea 6206... Línea 6610...
6206
      const goFromTabstop = (component, tabstops, stopIndex, tabbingConfig, cycle) => cycle(tabstops, stopIndex, elem => isTabstop(tabbingConfig, elem)).fold(() => tabbingConfig.cyclic ? Optional.some(true) : Optional.none(), target => {
6610
      const goFromTabstop = (component, tabstops, stopIndex, tabbingConfig, cycle) => cycle(tabstops, stopIndex, elem => isTabstop(tabbingConfig, elem)).fold(() => tabbingConfig.cyclic ? Optional.some(true) : Optional.none(), target => {
6207
        tabbingConfig.focusManager.set(component, target);
6611
        tabbingConfig.focusManager.set(component, target);
6208
        return Optional.some(true);
6612
        return Optional.some(true);
6209
      });
6613
      });
6210
      const go = (component, _simulatedEvent, tabbingConfig, cycle) => {
6614
      const go = (component, _simulatedEvent, tabbingConfig, cycle) => {
6211
        const tabstops = descendants(component.element, tabbingConfig.selector);
6615
        const tabstops = filter$2(descendants(component.element, tabbingConfig.selector), element => isVisible(tabbingConfig, element));
6212
        return findCurrent(component, tabbingConfig).bind(tabstop => {
6616
        return findCurrent(component, tabbingConfig).bind(tabstop => {
6213
          const optStopIndex = findIndex$1(tabstops, curry(eq, tabstop));
6617
          const optStopIndex = findIndex$1(tabstops, curry(eq, tabstop));
6214
          return optStopIndex.bind(stopIndex => goFromTabstop(component, tabstops, stopIndex, tabbingConfig, cycle));
6618
          return optStopIndex.bind(stopIndex => goFromTabstop(component, tabstops, stopIndex, tabbingConfig, cycle));
6215
        });
6619
        });
6216
      };
6620
      };
Línea 6278... Línea 6682...
6278
    };
6682
    };
6279
    const getKeyupRules$5 = (component, _simulatedEvent, executeConfig, _executeState) => executeConfig.useSpace && !inside(component.element) ? [rule(inSet(SPACE), stopEventForFirefox)] : [];
6683
    const getKeyupRules$5 = (component, _simulatedEvent, executeConfig, _executeState) => executeConfig.useSpace && !inside(component.element) ? [rule(inSet(SPACE), stopEventForFirefox)] : [];
6280
    var ExecutionType = typical(schema$v, NoState.init, getKeydownRules$5, getKeyupRules$5, () => Optional.none());
6684
    var ExecutionType = typical(schema$v, NoState.init, getKeydownRules$5, getKeyupRules$5, () => Optional.none());
Línea 6281... Línea 6685...
6281
 
6685
 
6282
    const flatgrid$1 = () => {
6686
    const flatgrid$1 = () => {
6283
      const dimensions = value$2();
6687
      const dimensions = value$4();
6284
      const setGridSize = (numRows, numColumns) => {
6688
      const setGridSize = (numRows, numColumns) => {
6285
        dimensions.set({
6689
        dimensions.set({
6286
          numRows,
6690
          numRows,
6287
          numColumns
6691
          numColumns
6288
        });
6692
        });
6289
      };
6693
      };
6290
      const getNumRows = () => dimensions.get().map(d => d.numRows);
6694
      const getNumRows = () => dimensions.get().map(d => d.numRows);
6291
      const getNumColumns = () => dimensions.get().map(d => d.numColumns);
6695
      const getNumColumns = () => dimensions.get().map(d => d.numColumns);
6292
      return nu$8({
6696
      return nu$7({
6293
        readState: () => dimensions.get().map(d => ({
6697
        readState: () => dimensions.get().map(d => ({
6294
          numRows: String(d.numRows),
6698
          numRows: String(d.numRows),
6295
          numColumns: String(d.numColumns)
6699
          numColumns: String(d.numColumns)
6296
        })).getOr({
6700
        })).getOr({
Línea 6300... Línea 6704...
6300
        setGridSize,
6704
        setGridSize,
6301
        getNumRows,
6705
        getNumRows,
6302
        getNumColumns
6706
        getNumColumns
6303
      });
6707
      });
6304
    };
6708
    };
6305
    const init$d = spec => spec.state(spec);
6709
    const init$c = spec => spec.state(spec);
Línea 6306... Línea 6710...
6306
 
6710
 
6307
    var KeyingState = /*#__PURE__*/Object.freeze({
6711
    var KeyingState = /*#__PURE__*/Object.freeze({
6308
        __proto__: null,
6712
        __proto__: null,
6309
        flatgrid: flatgrid$1,
6713
        flatgrid: flatgrid$1,
6310
        init: init$d
6714
        init: init$c
Línea 6311... Línea 6715...
6311
    });
6715
    });
6312
 
6716
 
6313
    const useH = movement => (component, simulatedEvent, config, state) => {
6717
    const useH = movement => (component, simulatedEvent, config, state) => {
Línea 6387... Línea 6791...
6387
      defaulted('execute', defaultExecute),
6791
      defaulted('execute', defaultExecute),
6388
      onKeyboardHandler('onEscape'),
6792
      onKeyboardHandler('onEscape'),
6389
      defaulted('captureTab', false),
6793
      defaulted('captureTab', false),
6390
      initSize()
6794
      initSize()
6391
    ];
6795
    ];
6392
    const focusIn$3 = (component, gridConfig, _gridState) => {
6796
    const focusIn$4 = (component, gridConfig, _gridState) => {
6393
      descendant(component.element, gridConfig.selector).each(first => {
6797
      descendant(component.element, gridConfig.selector).each(first => {
6394
        gridConfig.focusManager.set(component, first);
6798
        gridConfig.focusManager.set(component, first);
6395
      });
6799
      });
6396
    };
6800
    };
6397
    const findCurrent$1 = (component, gridConfig) => gridConfig.focusManager.get(component).bind(elem => closest$1(elem, gridConfig.selector));
6801
    const findCurrent$1 = (component, gridConfig) => gridConfig.focusManager.get(component).bind(elem => closest$1(elem, gridConfig.selector));
Línea 6420... Línea 6824...
6420
    ]);
6824
    ]);
6421
    const getKeyupRules$4 = constant$1([
6825
    const getKeyupRules$4 = constant$1([
6422
      rule(inSet(ESCAPE), doEscape$1),
6826
      rule(inSet(ESCAPE), doEscape$1),
6423
      rule(inSet(SPACE), stopEventForFirefox)
6827
      rule(inSet(SPACE), stopEventForFirefox)
6424
    ]);
6828
    ]);
6425
    var FlatgridType = typical(schema$u, flatgrid$1, getKeydownRules$4, getKeyupRules$4, () => Optional.some(focusIn$3));
6829
    var FlatgridType = typical(schema$u, flatgrid$1, getKeydownRules$4, getKeyupRules$4, () => Optional.some(focusIn$4));
Línea 6426... Línea 6830...
6426
 
6830
 
6427
    const f = (container, selector, current, delta, getNewIndex) => {
6831
    const f = (container, selector, current, delta, getNewIndex) => {
6428
      const isDisabledButton = candidate => name$3(candidate) === 'button' && get$f(candidate, 'disabled') === 'disabled';
6832
      const isDisabledButton = candidate => name$3(candidate) === 'button' && get$g(candidate, 'disabled') === 'disabled';
6429
      const tryNewIndex = (initial, index, candidates) => getNewIndex(initial, index, delta, 0, candidates.length - 1, candidates[index], newIndex => isDisabledButton(candidates[newIndex]) ? tryNewIndex(initial, newIndex, candidates) : Optional.from(candidates[newIndex]));
6833
      const tryNewIndex = (initial, index, candidates) => getNewIndex(initial, index, delta, 0, candidates.length - 1, candidates[index], newIndex => isDisabledButton(candidates[newIndex]) ? tryNewIndex(initial, newIndex, candidates) : Optional.from(candidates[newIndex]));
6430
      return locateVisible(container, current, selector).bind(identified => {
6834
      return locateVisible(container, current, selector).bind(identified => {
6431
        const index = identified.index;
6835
        const index = identified.index;
6432
        const candidates = identified.candidates;
6836
        const candidates = identified.candidates;
Línea 6452... Línea 6856...
6452
      defaulted('allowHorizontal', true),
6856
      defaulted('allowHorizontal', true),
6453
      defaulted('cycles', true)
6857
      defaulted('cycles', true)
6454
    ];
6858
    ];
6455
    const findCurrent = (component, flowConfig) => flowConfig.focusManager.get(component).bind(elem => closest$1(elem, flowConfig.selector));
6859
    const findCurrent = (component, flowConfig) => flowConfig.focusManager.get(component).bind(elem => closest$1(elem, flowConfig.selector));
6456
    const execute$2 = (component, simulatedEvent, flowConfig) => findCurrent(component, flowConfig).bind(focused => flowConfig.execute(component, simulatedEvent, focused));
6860
    const execute$2 = (component, simulatedEvent, flowConfig) => findCurrent(component, flowConfig).bind(focused => flowConfig.execute(component, simulatedEvent, focused));
6457
    const focusIn$2 = (component, flowConfig, _state) => {
6861
    const focusIn$3 = (component, flowConfig, _state) => {
6458
      flowConfig.getInitial(component).orThunk(() => descendant(component.element, flowConfig.selector)).each(first => {
6862
      flowConfig.getInitial(component).orThunk(() => descendant(component.element, flowConfig.selector)).each(first => {
6459
        flowConfig.focusManager.set(component, first);
6863
        flowConfig.focusManager.set(component, first);
6460
      });
6864
      });
6461
    };
6865
    };
6462
    const moveLeft$2 = (element, focused, info) => (info.cycles ? horizontal : horizontalWithoutCycles)(element, info.selector, focused, -1);
6866
    const moveLeft$2 = (element, focused, info) => (info.cycles ? horizontal : horizontalWithoutCycles)(element, info.selector, focused, -1);
Línea 6475... Línea 6879...
6475
    };
6879
    };
6476
    const getKeyupRules$3 = constant$1([
6880
    const getKeyupRules$3 = constant$1([
6477
      rule(inSet(SPACE), stopEventForFirefox),
6881
      rule(inSet(SPACE), stopEventForFirefox),
6478
      rule(inSet(ESCAPE), doEscape)
6882
      rule(inSet(ESCAPE), doEscape)
6479
    ]);
6883
    ]);
6480
    var FlowType = typical(schema$t, NoState.init, getKeydownRules$3, getKeyupRules$3, () => Optional.some(focusIn$2));
6884
    var FlowType = typical(schema$t, NoState.init, getKeydownRules$3, getKeyupRules$3, () => Optional.some(focusIn$3));
Línea 6481... Línea 6885...
6481
 
6885
 
6482
    const toCell = (matrix, rowIndex, columnIndex) => Optional.from(matrix[rowIndex]).bind(row => Optional.from(row[columnIndex]).map(cell => ({
6886
    const toCell = (matrix, rowIndex, columnIndex) => Optional.from(matrix[rowIndex]).bind(row => Optional.from(row[columnIndex]).map(cell => ({
6483
      rowIndex,
6887
      rowIndex,
6484
      columnIndex,
6888
      columnIndex,
Línea 6524... Línea 6928...
6524
      ]),
6928
      ]),
6525
      defaulted('cycles', true),
6929
      defaulted('cycles', true),
6526
      defaulted('previousSelector', Optional.none),
6930
      defaulted('previousSelector', Optional.none),
6527
      defaulted('execute', defaultExecute)
6931
      defaulted('execute', defaultExecute)
6528
    ];
6932
    ];
6529
    const focusIn$1 = (component, matrixConfig, _state) => {
6933
    const focusIn$2 = (component, matrixConfig, _state) => {
6530
      const focused = matrixConfig.previousSelector(component).orThunk(() => {
6934
      const focused = matrixConfig.previousSelector(component).orThunk(() => {
6531
        const selectors = matrixConfig.selectors;
6935
        const selectors = matrixConfig.selectors;
6532
        return descendant(component.element, selectors.cell);
6936
        return descendant(component.element, selectors.cell);
6533
      });
6937
      });
6534
      focused.each(cell => {
6938
      focused.each(cell => {
Línea 6560... Línea 6964...
6560
      rule(inSet(UP), north$1(moveNorth)),
6964
      rule(inSet(UP), north$1(moveNorth)),
6561
      rule(inSet(DOWN), south$1(moveSouth)),
6965
      rule(inSet(DOWN), south$1(moveSouth)),
6562
      rule(inSet(SPACE.concat(ENTER)), execute$1)
6966
      rule(inSet(SPACE.concat(ENTER)), execute$1)
6563
    ]);
6967
    ]);
6564
    const getKeyupRules$2 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]);
6968
    const getKeyupRules$2 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]);
6565
    var MatrixType = typical(schema$s, NoState.init, getKeydownRules$2, getKeyupRules$2, () => Optional.some(focusIn$1));
6969
    var MatrixType = typical(schema$s, NoState.init, getKeydownRules$2, getKeyupRules$2, () => Optional.some(focusIn$2));
Línea 6566... Línea 6970...
6566
 
6970
 
6567
    const schema$r = [
6971
    const schema$r = [
6568
      required$1('selector'),
6972
      required$1('selector'),
6569
      defaulted('execute', defaultExecute),
6973
      defaulted('execute', defaultExecute),
6570
      defaulted('moveOnTab', false)
6974
      defaulted('moveOnTab', false)
6571
    ];
6975
    ];
6572
    const execute = (component, simulatedEvent, menuConfig) => menuConfig.focusManager.get(component).bind(focused => menuConfig.execute(component, simulatedEvent, focused));
6976
    const execute = (component, simulatedEvent, menuConfig) => menuConfig.focusManager.get(component).bind(focused => menuConfig.execute(component, simulatedEvent, focused));
6573
    const focusIn = (component, menuConfig, _state) => {
6977
    const focusIn$1 = (component, menuConfig, _state) => {
6574
      descendant(component.element, menuConfig.selector).each(first => {
6978
      descendant(component.element, menuConfig.selector).each(first => {
6575
        menuConfig.focusManager.set(component, first);
6979
        menuConfig.focusManager.set(component, first);
6576
      });
6980
      });
6577
    };
6981
    };
Línea 6592... Línea 6996...
6592
      ]), fireTab),
6996
      ]), fireTab),
6593
      rule(inSet(ENTER), execute),
6997
      rule(inSet(ENTER), execute),
6594
      rule(inSet(SPACE), execute)
6998
      rule(inSet(SPACE), execute)
6595
    ]);
6999
    ]);
6596
    const getKeyupRules$1 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]);
7000
    const getKeyupRules$1 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]);
6597
    var MenuType = typical(schema$r, NoState.init, getKeydownRules$1, getKeyupRules$1, () => Optional.some(focusIn));
7001
    var MenuType = typical(schema$r, NoState.init, getKeydownRules$1, getKeyupRules$1, () => Optional.some(focusIn$1));
Línea 6598... Línea 7002...
6598
 
7002
 
6599
    const schema$q = [
7003
    const schema$q = [
6600
      onKeyboardHandler('onSpace'),
7004
      onKeyboardHandler('onSpace'),
6601
      onKeyboardHandler('onEnter'),
7005
      onKeyboardHandler('onEnter'),
Línea 6726... Línea 7130...
6726
      insert(component, append$2, appendee);
7130
      insert(component, append$2, appendee);
6727
    };
7131
    };
6728
    const prepend = (component, replaceConfig, replaceState, prependee) => {
7132
    const prepend = (component, replaceConfig, replaceState, prependee) => {
6729
      insert(component, prepend$1, prependee);
7133
      insert(component, prepend$1, prependee);
6730
    };
7134
    };
6731
    const remove = (component, replaceConfig, replaceState, removee) => {
7135
    const remove$1 = (component, replaceConfig, replaceState, removee) => {
6732
      const children = contents(component);
7136
      const children = contents(component);
6733
      const foundChild = find$5(children, child => eq(removee.element, child.element));
7137
      const foundChild = find$5(children, child => eq(removee.element, child.element));
6734
      foundChild.each(detach);
7138
      foundChild.each(detach);
6735
    };
7139
    };
6736
    const contents = (component, _replaceConfig) => component.components();
7140
    const contents = (component, _replaceConfig) => component.components();
Línea 6751... Línea 7155...
6751
 
7155
 
6752
    var ReplaceApis = /*#__PURE__*/Object.freeze({
7156
    var ReplaceApis = /*#__PURE__*/Object.freeze({
6753
        __proto__: null,
7157
        __proto__: null,
6754
        append: append,
7158
        append: append,
6755
        prepend: prepend,
7159
        prepend: prepend,
6756
        remove: remove,
7160
        remove: remove$1,
6757
        replaceAt: replaceAt,
7161
        replaceAt: replaceAt,
6758
        replaceBy: replaceBy,
7162
        replaceBy: replaceBy,
6759
        set: set$3,
7163
        set: set$3,
6760
        contents: contents
7164
        contents: contents
Línea 6764... Línea 7168...
6764
      fields: [defaultedBoolean('reuseDom', true)],
7168
      fields: [defaultedBoolean('reuseDom', true)],
6765
      name: 'replacing',
7169
      name: 'replacing',
6766
      apis: ReplaceApis
7170
      apis: ReplaceApis
6767
    });
7171
    });
Línea 6768... Línea 7172...
6768
 
7172
 
6769
    const events$d = (name, eventHandlers) => {
7173
    const events$c = (name, eventHandlers) => {
6770
      const events = derive$2(eventHandlers);
7174
      const events = derive$2(eventHandlers);
6771
      return create$4({
7175
      return create$4({
6772
        fields: [required$1('enabled')],
7176
        fields: [required$1('enabled')],
6773
        name,
7177
        name,
6774
        active: { events: constant$1(events) }
7178
        active: { events: constant$1(events) }
6775
      });
7179
      });
6776
    };
7180
    };
6777
    const config = (name, eventHandlers) => {
7181
    const config = (name, eventHandlers) => {
6778
      const me = events$d(name, eventHandlers);
7182
      const me = events$c(name, eventHandlers);
6779
      return {
7183
      return {
6780
        key: name,
7184
        key: name,
6781
        value: {
7185
        value: {
6782
          config: {},
7186
          config: {},
Línea 6808... Línea 7212...
6808
        isFocused: isFocused
7212
        isFocused: isFocused
6809
    });
7213
    });
Línea 6810... Línea 7214...
6810
 
7214
 
6811
    const exhibit$4 = (base, focusConfig) => {
7215
    const exhibit$4 = (base, focusConfig) => {
6812
      const mod = focusConfig.ignore ? {} : { attributes: { tabindex: '-1' } };
7216
      const mod = focusConfig.ignore ? {} : { attributes: { tabindex: '-1' } };
6813
      return nu$7(mod);
7217
      return nu$8(mod);
6814
    };
7218
    };
6815
    const events$c = focusConfig => derive$2([run$1(focus$4(), (component, simulatedEvent) => {
7219
    const events$b = focusConfig => derive$2([run$1(focus$4(), (component, simulatedEvent) => {
6816
        focus$2(component, focusConfig);
7220
        focus$2(component, focusConfig);
6817
        simulatedEvent.stop();
7221
        simulatedEvent.stop();
6818
      })].concat(focusConfig.stopMousedown ? [run$1(mousedown(), (_, simulatedEvent) => {
7222
      })].concat(focusConfig.stopMousedown ? [run$1(mousedown(), (_, simulatedEvent) => {
6819
        simulatedEvent.event.prevent();
7223
        simulatedEvent.event.prevent();
Línea 6820... Línea 7224...
6820
      })] : []));
7224
      })] : []));
6821
 
7225
 
6822
    var ActiveFocus = /*#__PURE__*/Object.freeze({
7226
    var ActiveFocus = /*#__PURE__*/Object.freeze({
6823
        __proto__: null,
7227
        __proto__: null,
6824
        exhibit: exhibit$4,
7228
        exhibit: exhibit$4,
Línea 6825... Línea 7229...
6825
        events: events$c
7229
        events: events$b
6826
    });
7230
    });
6827
 
7231
 
Línea 6862... Línea 7266...
6862
    const updateClass = (component, toggleConfig, toggleState) => {
7266
    const updateClass = (component, toggleConfig, toggleState) => {
6863
      toggleConfig.toggleClass.each(toggleClass => {
7267
      toggleConfig.toggleClass.each(toggleClass => {
6864
        if (toggleState.get()) {
7268
        if (toggleState.get()) {
6865
          add$2(component.element, toggleClass);
7269
          add$2(component.element, toggleClass);
6866
        } else {
7270
        } else {
6867
          remove$2(component.element, toggleClass);
7271
          remove$3(component.element, toggleClass);
6868
        }
7272
        }
6869
      });
7273
      });
6870
    };
7274
    };
6871
    const set$2 = (component, toggleConfig, toggleState, state) => {
7275
    const set$2 = (component, toggleConfig, toggleState, state) => {
6872
      const initialState = toggleState.get();
7276
      const initialState = toggleState.get();
Línea 6899... Línea 7303...
6899
        on: on,
7303
        on: on,
6900
        off: off,
7304
        off: off,
6901
        set: set$2
7305
        set: set$2
6902
    });
7306
    });
Línea 6903... Línea 7307...
6903
 
7307
 
6904
    const exhibit$3 = () => nu$7({});
7308
    const exhibit$3 = () => nu$8({});
6905
    const events$b = (toggleConfig, toggleState) => {
7309
    const events$a = (toggleConfig, toggleState) => {
6906
      const execute = executeEvent(toggleConfig, toggleState, toggle$2);
7310
      const execute = executeEvent(toggleConfig, toggleState, toggle$2);
6907
      const load = loadEvent(toggleConfig, toggleState, onLoad);
7311
      const load = loadEvent(toggleConfig, toggleState, onLoad);
6908
      return derive$2(flatten([
7312
      return derive$2(flatten([
6909
        toggleConfig.toggleOnExecute ? [execute] : [],
7313
        toggleConfig.toggleOnExecute ? [execute] : [],
Línea 6912... Línea 7316...
6912
    };
7316
    };
Línea 6913... Línea 7317...
6913
 
7317
 
6914
    var ActiveToggle = /*#__PURE__*/Object.freeze({
7318
    var ActiveToggle = /*#__PURE__*/Object.freeze({
6915
        __proto__: null,
7319
        __proto__: null,
6916
        exhibit: exhibit$3,
7320
        exhibit: exhibit$3,
6917
        events: events$b
7321
        events: events$a
Línea 6918... Línea 7322...
6918
    });
7322
    });
6919
 
7323
 
6920
    const updatePressed = (component, ariaInfo, status) => {
7324
    const updatePressed = (component, ariaInfo, status) => {
Línea 6968... Línea 7372...
6968
        run$1(tap(), onClick),
7372
        run$1(tap(), onClick),
6969
        cutter(touchstart()),
7373
        cutter(touchstart()),
6970
        cutter(mousedown())
7374
        cutter(mousedown())
6971
      ];
7375
      ];
6972
    };
7376
    };
6973
    const events$a = optAction => {
7377
    const events$9 = optAction => {
6974
      const executeHandler = action => runOnExecute$1((component, simulatedEvent) => {
7378
      const executeHandler = action => runOnExecute$1((component, simulatedEvent) => {
6975
        action(component);
7379
        action(component);
6976
        simulatedEvent.stop();
7380
        simulatedEvent.stop();
6977
      });
7381
      });
6978
      return derive$2(flatten([
7382
      return derive$2(flatten([
Línea 7003... Línea 7407...
7003
    };
7407
    };
7004
    const hover = constant$1(hoverEvent);
7408
    const hover = constant$1(hoverEvent);
7005
    const focus$1 = constant$1(focusEvent);
7409
    const focus$1 = constant$1(focusEvent);
7006
    const toggled = constant$1(toggledEvent);
7410
    const toggled = constant$1(toggledEvent);
Línea 7007... Línea 7411...
7007
 
7411
 
7008
    const getItemRole = detail => detail.toggling.map(toggling => toggling.exclusive ? 'menuitemradio' : 'menuitemcheckbox').getOr('menuitem');
7412
    const getItemRole = detail => detail.role.fold(() => detail.toggling.map(toggling => toggling.exclusive ? 'menuitemradio' : 'menuitemcheckbox').getOr('menuitem'), identity);
7009
    const getTogglingSpec = tConfig => ({
7413
    const getTogglingSpec = (tConfig, isOption) => ({
7010
      aria: { mode: 'checked' },
7414
      aria: { mode: isOption ? 'selected' : 'checked' },
7011
      ...filter$1(tConfig, (_value, name) => name !== 'exclusive'),
7415
      ...filter$1(tConfig, (_value, name) => name !== 'exclusive'),
7012
      onToggled: (component, state) => {
7416
      onToggled: (component, state) => {
7013
        if (isFunction(tConfig.onToggled)) {
7417
        if (isFunction(tConfig.onToggled)) {
7014
          tConfig.onToggled(component, state);
7418
          tConfig.onToggled(component, state);
Línea 7026... Línea 7430...
7026
          'aria-haspopup': detail.hasSubmenu,
7430
          'aria-haspopup': detail.hasSubmenu,
7027
          ...detail.hasSubmenu ? { 'aria-expanded': false } : {}
7431
          ...detail.hasSubmenu ? { 'aria-expanded': false } : {}
7028
        }
7432
        }
7029
      },
7433
      },
7030
      behaviours: SketchBehaviours.augment(detail.itemBehaviours, [
7434
      behaviours: SketchBehaviours.augment(detail.itemBehaviours, [
7031
        detail.toggling.fold(Toggling.revoke, tConfig => Toggling.config(getTogglingSpec(tConfig))),
7435
        detail.toggling.fold(Toggling.revoke, tConfig => Toggling.config(getTogglingSpec(tConfig, detail.role.exists(role => role === 'option')))),
7032
        Focusing.config({
7436
        Focusing.config({
7033
          ignore: detail.ignoreFocus,
7437
          ignore: detail.ignoreFocus,
7034
          stopMousedown: detail.ignoreFocus,
7438
          stopMousedown: detail.ignoreFocus,
7035
          onFocus: component => {
7439
          onFocus: component => {
7036
            onFocus$1(component);
7440
            onFocus$1(component);
Línea 7056... Línea 7460...
7056
      required$1('data'),
7460
      required$1('data'),
7057
      required$1('components'),
7461
      required$1('components'),
7058
      required$1('dom'),
7462
      required$1('dom'),
7059
      defaulted('hasSubmenu', false),
7463
      defaulted('hasSubmenu', false),
7060
      option$3('toggling'),
7464
      option$3('toggling'),
-
 
7465
      option$3('role'),
7061
      SketchBehaviours.field('itemBehaviours', [
7466
      SketchBehaviours.field('itemBehaviours', [
7062
        Toggling,
7467
        Toggling,
7063
        Focusing,
7468
        Focusing,
7064
        Keying,
7469
        Keying,
7065
        Representing
7470
        Representing
Línea 7236... Línea 7641...
7236
            domModification: { classes: [detail.markers.item] }
7641
            domModification: { classes: [detail.markers.item] }
7237
          };
7642
          };
7238
        }
7643
        }
7239
      })]);
7644
      })]);
7240
    const schema$m = constant$1([
7645
    const schema$m = constant$1([
-
 
7646
      optionString('role'),
7241
      required$1('value'),
7647
      required$1('value'),
7242
      required$1('items'),
7648
      required$1('items'),
7243
      required$1('dom'),
7649
      required$1('dom'),
7244
      required$1('components'),
7650
      required$1('components'),
7245
      defaulted('eventOrder', {}),
7651
      defaulted('eventOrder', {}),
Línea 7269... Línea 7675...
7269
      })),
7675
      })),
7270
      itemMarkers(),
7676
      itemMarkers(),
7271
      defaulted('fakeFocus', false),
7677
      defaulted('fakeFocus', false),
7272
      defaulted('focusManager', dom$2()),
7678
      defaulted('focusManager', dom$2()),
7273
      onHandler('onHighlight'),
7679
      onHandler('onHighlight'),
7274
      onHandler('onDehighlight')
7680
      onHandler('onDehighlight'),
-
 
7681
      defaulted('showMenuRole', true)
7275
    ]);
7682
    ]);
Línea 7276... Línea 7683...
7276
 
7683
 
Línea 7277... Línea 7684...
7277
    const focus = constant$1('alloy.menu-focus');
7684
    const focus = constant$1('alloy.menu-focus');
Línea 7322... Línea 7729...
7322
          const item = simulatedEvent.event.item;
7729
          const item = simulatedEvent.event.item;
7323
          Highlighting.highlight(menu, item);
7730
          Highlighting.highlight(menu, item);
7324
        }),
7731
        }),
7325
        run$1(toggled(), (menu, simulatedEvent) => {
7732
        run$1(toggled(), (menu, simulatedEvent) => {
7326
          const {item, state} = simulatedEvent.event;
7733
          const {item, state} = simulatedEvent.event;
7327
          if (state && get$f(item.element, 'role') === 'menuitemradio') {
7734
          if (state && get$g(item.element, 'role') === 'menuitemradio') {
7328
            deselectOtherRadioItems(menu, item);
7735
            deselectOtherRadioItems(menu, item);
7329
          }
7736
          }
7330
        })
7737
        })
7331
      ]),
7738
      ]),
7332
      components,
7739
      components,
7333
      eventOrder: detail.eventOrder,
7740
      eventOrder: detail.eventOrder,
7334
      domModification: { attributes: { role: 'menu' } }
7741
      ...detail.showMenuRole ? { domModification: { attributes: { role: detail.role.getOr('menu') } } } : {}
7335
    });
7742
    });
Línea 7336... Línea 7743...
7336
 
7743
 
7337
    const Menu = composite({
7744
    const Menu = composite({
7338
      name: 'Menu',
7745
      name: 'Menu',
Línea 7343... Línea 7750...
7343
 
7750
 
7344
    const transpose$1 = obj => tupleMap(obj, (v, k) => ({
7751
    const transpose$1 = obj => tupleMap(obj, (v, k) => ({
7345
      k: v,
7752
      k: v,
7346
      v: k
7753
      v: k
7347
    }));
7754
    }));
7348
    const trace = (items, byItem, byMenu, finish) => get$g(byMenu, finish).bind(triggerItem => get$g(items, triggerItem).bind(triggerMenu => {
7755
    const trace = (items, byItem, byMenu, finish) => get$h(byMenu, finish).bind(triggerItem => get$h(items, triggerItem).bind(triggerMenu => {
7349
      const rest = trace(items, byItem, byMenu, triggerMenu);
7756
      const rest = trace(items, byItem, byMenu, triggerMenu);
7350
      return Optional.some([triggerMenu].concat(rest));
7757
      return Optional.some([triggerMenu].concat(rest));
7351
    })).getOr([]);
7758
    })).getOr([]);
7352
    const generate$2 = (menus, expansions) => {
7759
    const generate$2 = (menus, expansions) => {
Línea 7357... Línea 7764...
7357
        });
7764
        });
7358
      });
7765
      });
7359
      const byItem = expansions;
7766
      const byItem = expansions;
7360
      const byMenu = transpose$1(expansions);
7767
      const byMenu = transpose$1(expansions);
7361
      const menuPaths = map$1(byMenu, (_triggerItem, submenu) => [submenu].concat(trace(items, byItem, byMenu, submenu)));
7768
      const menuPaths = map$1(byMenu, (_triggerItem, submenu) => [submenu].concat(trace(items, byItem, byMenu, submenu)));
7362
      return map$1(items, menu => get$g(menuPaths, menu).getOr([menu]));
7769
      return map$1(items, menu => get$h(menuPaths, menu).getOr([menu]));
7363
    };
7770
    };
Línea 7364... Línea 7771...
7364
 
7771
 
7365
    const init$c = () => {
7772
    const init$b = () => {
7366
      const expansions = Cell({});
7773
      const expansions = Cell({});
7367
      const menus = Cell({});
7774
      const menus = Cell({});
7368
      const paths = Cell({});
7775
      const paths = Cell({});
7369
      const primary = value$2();
7776
      const primary = value$4();
7370
      const directory = Cell({});
7777
      const directory = Cell({});
7371
      const clear = () => {
7778
      const clear = () => {
7372
        expansions.set({});
7779
        expansions.set({});
7373
        menus.set({});
7780
        menus.set({});
Línea 7398... Línea 7805...
7398
        triggeringItem: triggeredItem,
7805
        triggeringItem: triggeredItem,
7399
        triggeringPath: path
7806
        triggeringPath: path
7400
      }))));
7807
      }))));
7401
      const getTriggeringPath = (itemValue, getItemByValue) => {
7808
      const getTriggeringPath = (itemValue, getItemByValue) => {
7402
        const extraPath = filter$2(lookupItem(itemValue).toArray(), menuValue => getPreparedMenu(menuValue).isSome());
7809
        const extraPath = filter$2(lookupItem(itemValue).toArray(), menuValue => getPreparedMenu(menuValue).isSome());
7403
        return get$g(paths.get(), itemValue).bind(path => {
7810
        return get$h(paths.get(), itemValue).bind(path => {
7404
          const revPath = reverse(extraPath.concat(path));
7811
          const revPath = reverse(extraPath.concat(path));
7405
          const triggers = bind$3(revPath, (menuValue, menuIndex) => getTriggerData(menuValue, getItemByValue, revPath.slice(0, menuIndex + 1)).fold(() => is$1(primary.get(), menuValue) ? [] : [Optional.none()], data => [Optional.some(data)]));
7812
          const triggers = bind$3(revPath, (menuValue, menuIndex) => getTriggerData(menuValue, getItemByValue, revPath.slice(0, menuIndex + 1)).fold(() => is$1(primary.get(), menuValue) ? [] : [Optional.none()], data => [Optional.some(data)]));
7406
          return sequence(triggers);
7813
          return sequence(triggers);
7407
        });
7814
        });
7408
      };
7815
      };
7409
      const expand = itemValue => get$g(expansions.get(), itemValue).map(menu => {
7816
      const expand = itemValue => get$h(expansions.get(), itemValue).map(menu => {
7410
        const current = get$g(paths.get(), itemValue).getOr([]);
7817
        const current = get$h(paths.get(), itemValue).getOr([]);
7411
        return [menu].concat(current);
7818
        return [menu].concat(current);
7412
      });
7819
      });
7413
      const collapse = itemValue => get$g(paths.get(), itemValue).bind(path => path.length > 1 ? Optional.some(path.slice(1)) : Optional.none());
7820
      const collapse = itemValue => get$h(paths.get(), itemValue).bind(path => path.length > 1 ? Optional.some(path.slice(1)) : Optional.none());
7414
      const refresh = itemValue => get$g(paths.get(), itemValue);
7821
      const refresh = itemValue => get$h(paths.get(), itemValue);
7415
      const getPreparedMenu = menuValue => lookupMenu(menuValue).bind(extractPreparedMenu);
7822
      const getPreparedMenu = menuValue => lookupMenu(menuValue).bind(extractPreparedMenu);
7416
      const lookupMenu = menuValue => get$g(menus.get(), menuValue);
7823
      const lookupMenu = menuValue => get$h(menus.get(), menuValue);
7417
      const lookupItem = itemValue => get$g(expansions.get(), itemValue);
7824
      const lookupItem = itemValue => get$h(expansions.get(), itemValue);
7418
      const otherMenus = path => {
7825
      const otherMenus = path => {
7419
        const menuValues = directory.get();
7826
        const menuValues = directory.get();
7420
        return difference(keys(menuValues), path);
7827
        return difference(keys(menuValues), path);
7421
      };
7828
      };
7422
      const getPrimary = () => primary.get().bind(getPreparedMenu);
7829
      const getPrimary = () => primary.get().bind(getPreparedMenu);
Línea 7437... Línea 7844...
7437
        getTriggeringPath
7844
        getTriggeringPath
7438
      };
7845
      };
7439
    };
7846
    };
7440
    const extractPreparedMenu = prep => prep.type === 'prepared' ? Optional.some(prep.menu) : Optional.none();
7847
    const extractPreparedMenu = prep => prep.type === 'prepared' ? Optional.some(prep.menu) : Optional.none();
7441
    const LayeredState = {
7848
    const LayeredState = {
7442
      init: init$c,
7849
      init: init$b,
7443
      extractPreparedMenu
7850
      extractPreparedMenu
7444
    };
7851
    };
Línea 7445... Línea 7852...
7445
 
7852
 
7446
    const onMenuItemHighlightedEvent = generate$6('tiered-menu-item-highlight');
7853
    const onMenuItemHighlightedEvent = generate$6('tiered-menu-item-highlight');
Línea 7452... Línea 7859...
7452
      HighlightOnOpen[HighlightOnOpen['HighlightJustMenu'] = 1] = 'HighlightJustMenu';
7859
      HighlightOnOpen[HighlightOnOpen['HighlightJustMenu'] = 1] = 'HighlightJustMenu';
7453
      HighlightOnOpen[HighlightOnOpen['HighlightNone'] = 2] = 'HighlightNone';
7860
      HighlightOnOpen[HighlightOnOpen['HighlightNone'] = 2] = 'HighlightNone';
7454
    }(HighlightOnOpen || (HighlightOnOpen = {})));
7861
    }(HighlightOnOpen || (HighlightOnOpen = {})));
Línea 7455... Línea 7862...
7455
 
7862
 
7456
    const make$6 = (detail, _rawUiSpec) => {
7863
    const make$6 = (detail, _rawUiSpec) => {
7457
      const submenuParentItems = value$2();
7864
      const submenuParentItems = value$4();
7458
      const buildMenus = (container, primaryName, menus) => map$1(menus, (spec, name) => {
7865
      const buildMenus = (container, primaryName, menus) => map$1(menus, (spec, name) => {
7459
        const makeSketch = () => Menu.sketch({
7866
        const makeSketch = () => Menu.sketch({
7460
          ...spec,
7867
          ...spec,
7461
          value: name,
7868
          value: name,
Línea 7514... Línea 7921...
7514
      };
7921
      };
7515
      const getMenus = (state, menuValues) => cat(map$2(menuValues, mv => state.lookupMenu(mv).bind(prep => prep.type === 'prepared' ? Optional.some(prep.menu) : Optional.none())));
7922
      const getMenus = (state, menuValues) => cat(map$2(menuValues, mv => state.lookupMenu(mv).bind(prep => prep.type === 'prepared' ? Optional.some(prep.menu) : Optional.none())));
7516
      const closeOthers = (container, state, path) => {
7923
      const closeOthers = (container, state, path) => {
7517
        const others = getMenus(state, state.otherMenus(path));
7924
        const others = getMenus(state, state.otherMenus(path));
7518
        each$1(others, o => {
7925
        each$1(others, o => {
7519
          remove$1(o.element, [detail.markers.backgroundMenu]);
7926
          remove$2(o.element, [detail.markers.backgroundMenu]);
7520
          if (!detail.stayInDom) {
7927
          if (!detail.stayInDom) {
7521
            Replacing.remove(container, o);
7928
            Replacing.remove(container, o);
7522
          }
7929
          }
7523
        });
7930
        });
7524
      };
7931
      };
7525
      const getSubmenuParents = container => submenuParentItems.get().getOrThunk(() => {
7932
      const getSubmenuParents = container => submenuParentItems.get().getOrThunk(() => {
7526
        const r = {};
7933
        const r = {};
7527
        const items = descendants(container.element, `.${ detail.markers.item }`);
7934
        const items = descendants(container.element, `.${ detail.markers.item }`);
7528
        const parentItems = filter$2(items, i => get$f(i, 'aria-haspopup') === 'true');
7935
        const parentItems = filter$2(items, i => get$g(i, 'aria-haspopup') === 'true');
7529
        each$1(parentItems, i => {
7936
        each$1(parentItems, i => {
7530
          container.getSystem().getByDom(i).each(itemComp => {
7937
          container.getSystem().getByDom(i).each(itemComp => {
7531
            const key = getItemValue(itemComp);
7938
            const key = getItemValue(itemComp);
7532
            r[key] = itemComp;
7939
            r[key] = itemComp;
7533
          });
7940
          });
Línea 7552... Línea 7959...
7552
            add$2(r.element, detail.markers.backgroundMenu);
7959
            add$2(r.element, detail.markers.backgroundMenu);
7553
          });
7960
          });
7554
          if (!inBody(activeMenu.element)) {
7961
          if (!inBody(activeMenu.element)) {
7555
            Replacing.append(container, premade(activeMenu));
7962
            Replacing.append(container, premade(activeMenu));
7556
          }
7963
          }
7557
          remove$1(activeMenu.element, [detail.markers.backgroundMenu]);
7964
          remove$2(activeMenu.element, [detail.markers.backgroundMenu]);
7558
          setActiveMenuAndItem(container, activeMenu);
7965
          setActiveMenuAndItem(container, activeMenu);
7559
          closeOthers(container, state, path);
7966
          closeOthers(container, state, path);
7560
          return Optional.some(activeMenu);
7967
          return Optional.some(activeMenu);
7561
        }
7968
        }
7562
      }));
7969
      }));
Línea 7676... Línea 8083...
7676
      const highlightPrimary = container => {
8083
      const highlightPrimary = container => {
7677
        layeredState.getPrimary().each(primary => {
8084
        layeredState.getPrimary().each(primary => {
7678
          setActiveMenuAndItem(container, primary);
8085
          setActiveMenuAndItem(container, primary);
7679
        });
8086
        });
7680
      };
8087
      };
7681
      const extractMenuFromContainer = container => Optional.from(container.components()[0]).filter(comp => get$f(comp.element, 'role') === 'menu');
8088
      const extractMenuFromContainer = container => Optional.from(container.components()[0]).filter(comp => get$g(comp.element, 'role') === 'menu');
7682
      const repositionMenus = container => {
8089
      const repositionMenus = container => {
7683
        const maybeActivePrimary = layeredState.getPrimary().bind(primary => getActiveItem(container).bind(currentItem => {
8090
        const maybeActivePrimary = layeredState.getPrimary().bind(primary => getActiveItem(container).bind(currentItem => {
7684
          const itemValue = getItemValue(currentItem);
8091
          const itemValue = getItemValue(currentItem);
7685
          const allMenus = values(layeredState.getMenus());
8092
          const allMenus = values(layeredState.getMenus());
7686
          const preparedMenus = cat(map$2(allMenus, LayeredState.extractPreparedMenu));
8093
          const preparedMenus = cat(map$2(allMenus, LayeredState.extractPreparedMenu));
Línea 8005... Línea 8412...
8005
      }
8412
      }
8006
    });
8413
    });
Línea 8007... Línea 8414...
8007
 
8414
 
Línea -... Línea 8415...
-
 
8415
    var global$9 = tinymce.util.Tools.resolve('tinymce.util.Delay');
-
 
8416
 
-
 
8417
    var global$8 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
-
 
8418
 
-
 
8419
    var global$7 = tinymce.util.Tools.resolve('tinymce.EditorManager');
-
 
8420
 
-
 
8421
    var global$6 = tinymce.util.Tools.resolve('tinymce.Env');
-
 
8422
 
-
 
8423
    var ToolbarMode$1;
-
 
8424
    (function (ToolbarMode) {
-
 
8425
      ToolbarMode['default'] = 'wrap';
-
 
8426
      ToolbarMode['floating'] = 'floating';
-
 
8427
      ToolbarMode['sliding'] = 'sliding';
-
 
8428
      ToolbarMode['scrolling'] = 'scrolling';
-
 
8429
    }(ToolbarMode$1 || (ToolbarMode$1 = {})));
-
 
8430
    var ToolbarLocation$1;
-
 
8431
    (function (ToolbarLocation) {
-
 
8432
      ToolbarLocation['auto'] = 'auto';
-
 
8433
      ToolbarLocation['top'] = 'top';
-
 
8434
      ToolbarLocation['bottom'] = 'bottom';
-
 
8435
    }(ToolbarLocation$1 || (ToolbarLocation$1 = {})));
-
 
8436
    const option$2 = name => editor => editor.options.get(name);
-
 
8437
    const wrapOptional = fn => editor => Optional.from(fn(editor));
-
 
8438
    const register$f = editor => {
-
 
8439
      const isPhone = global$6.deviceType.isPhone();
-
 
8440
      const isMobile = global$6.deviceType.isTablet() || isPhone;
-
 
8441
      const registerOption = editor.options.register;
-
 
8442
      const stringOrFalseProcessor = value => isString(value) || value === false;
-
 
8443
      const stringOrNumberProcessor = value => isString(value) || isNumber(value);
-
 
8444
      registerOption('skin', {
-
 
8445
        processor: value => isString(value) || value === false,
-
 
8446
        default: 'oxide'
-
 
8447
      });
-
 
8448
      registerOption('skin_url', { processor: 'string' });
-
 
8449
      registerOption('height', {
-
 
8450
        processor: stringOrNumberProcessor,
-
 
8451
        default: Math.max(editor.getElement().offsetHeight, 400)
-
 
8452
      });
-
 
8453
      registerOption('width', {
-
 
8454
        processor: stringOrNumberProcessor,
-
 
8455
        default: global$8.DOM.getStyle(editor.getElement(), 'width')
-
 
8456
      });
-
 
8457
      registerOption('min_height', {
-
 
8458
        processor: 'number',
-
 
8459
        default: 100
-
 
8460
      });
-
 
8461
      registerOption('min_width', { processor: 'number' });
-
 
8462
      registerOption('max_height', { processor: 'number' });
-
 
8463
      registerOption('max_width', { processor: 'number' });
-
 
8464
      registerOption('style_formats', { processor: 'object[]' });
-
 
8465
      registerOption('style_formats_merge', {
-
 
8466
        processor: 'boolean',
-
 
8467
        default: false
-
 
8468
      });
-
 
8469
      registerOption('style_formats_autohide', {
-
 
8470
        processor: 'boolean',
-
 
8471
        default: false
-
 
8472
      });
-
 
8473
      registerOption('line_height_formats', {
-
 
8474
        processor: 'string',
-
 
8475
        default: '1 1.1 1.2 1.3 1.4 1.5 2'
-
 
8476
      });
-
 
8477
      registerOption('font_family_formats', {
-
 
8478
        processor: 'string',
-
 
8479
        default: 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats'
-
 
8480
      });
-
 
8481
      registerOption('font_size_formats', {
-
 
8482
        processor: 'string',
-
 
8483
        default: '8pt 10pt 12pt 14pt 18pt 24pt 36pt'
-
 
8484
      });
-
 
8485
      registerOption('font_size_input_default_unit', {
-
 
8486
        processor: 'string',
-
 
8487
        default: 'pt'
-
 
8488
      });
-
 
8489
      registerOption('block_formats', {
-
 
8490
        processor: 'string',
-
 
8491
        default: 'Paragraph=p;' + 'Heading 1=h1;' + 'Heading 2=h2;' + 'Heading 3=h3;' + 'Heading 4=h4;' + 'Heading 5=h5;' + 'Heading 6=h6;' + 'Preformatted=pre'
-
 
8492
      });
-
 
8493
      registerOption('content_langs', { processor: 'object[]' });
-
 
8494
      registerOption('removed_menuitems', {
-
 
8495
        processor: 'string',
-
 
8496
        default: ''
-
 
8497
      });
-
 
8498
      registerOption('menubar', {
-
 
8499
        processor: value => isString(value) || isBoolean(value),
-
 
8500
        default: !isPhone
-
 
8501
      });
-
 
8502
      registerOption('menu', {
-
 
8503
        processor: 'object',
-
 
8504
        default: {}
-
 
8505
      });
-
 
8506
      registerOption('toolbar', {
-
 
8507
        processor: value => {
-
 
8508
          if (isBoolean(value) || isString(value) || isArray(value)) {
-
 
8509
            return {
-
 
8510
              value,
-
 
8511
              valid: true
-
 
8512
            };
-
 
8513
          } else {
-
 
8514
            return {
-
 
8515
              valid: false,
-
 
8516
              message: 'Must be a boolean, string or array.'
-
 
8517
            };
-
 
8518
          }
-
 
8519
        },
-
 
8520
        default: true
-
 
8521
      });
-
 
8522
      range$2(9, num => {
-
 
8523
        registerOption('toolbar' + (num + 1), { processor: 'string' });
-
 
8524
      });
-
 
8525
      registerOption('toolbar_mode', {
-
 
8526
        processor: 'string',
-
 
8527
        default: isMobile ? 'scrolling' : 'floating'
-
 
8528
      });
-
 
8529
      registerOption('toolbar_groups', {
-
 
8530
        processor: 'object',
-
 
8531
        default: {}
-
 
8532
      });
-
 
8533
      registerOption('toolbar_location', {
-
 
8534
        processor: 'string',
-
 
8535
        default: ToolbarLocation$1.auto
-
 
8536
      });
-
 
8537
      registerOption('toolbar_persist', {
-
 
8538
        processor: 'boolean',
-
 
8539
        default: false
-
 
8540
      });
-
 
8541
      registerOption('toolbar_sticky', {
-
 
8542
        processor: 'boolean',
-
 
8543
        default: editor.inline
-
 
8544
      });
-
 
8545
      registerOption('toolbar_sticky_offset', {
-
 
8546
        processor: 'number',
-
 
8547
        default: 0
-
 
8548
      });
-
 
8549
      registerOption('fixed_toolbar_container', {
-
 
8550
        processor: 'string',
-
 
8551
        default: ''
-
 
8552
      });
-
 
8553
      registerOption('fixed_toolbar_container_target', { processor: 'object' });
-
 
8554
      registerOption('ui_mode', {
-
 
8555
        processor: 'string',
-
 
8556
        default: 'combined'
-
 
8557
      });
-
 
8558
      registerOption('file_picker_callback', { processor: 'function' });
-
 
8559
      registerOption('file_picker_validator_handler', { processor: 'function' });
-
 
8560
      registerOption('file_picker_types', { processor: 'string' });
-
 
8561
      registerOption('typeahead_urls', {
-
 
8562
        processor: 'boolean',
-
 
8563
        default: true
-
 
8564
      });
-
 
8565
      registerOption('anchor_top', {
-
 
8566
        processor: stringOrFalseProcessor,
-
 
8567
        default: '#top'
-
 
8568
      });
-
 
8569
      registerOption('anchor_bottom', {
-
 
8570
        processor: stringOrFalseProcessor,
-
 
8571
        default: '#bottom'
-
 
8572
      });
-
 
8573
      registerOption('draggable_modal', {
-
 
8574
        processor: 'boolean',
-
 
8575
        default: false
-
 
8576
      });
-
 
8577
      registerOption('statusbar', {
-
 
8578
        processor: 'boolean',
-
 
8579
        default: true
-
 
8580
      });
-
 
8581
      registerOption('elementpath', {
-
 
8582
        processor: 'boolean',
-
 
8583
        default: true
-
 
8584
      });
-
 
8585
      registerOption('branding', {
-
 
8586
        processor: 'boolean',
-
 
8587
        default: true
-
 
8588
      });
-
 
8589
      registerOption('promotion', {
-
 
8590
        processor: 'boolean',
-
 
8591
        default: true
-
 
8592
      });
-
 
8593
      registerOption('resize', {
-
 
8594
        processor: value => value === 'both' || isBoolean(value),
-
 
8595
        default: !global$6.deviceType.isTouch()
-
 
8596
      });
-
 
8597
      registerOption('sidebar_show', { processor: 'string' });
-
 
8598
      registerOption('help_accessibility', {
-
 
8599
        processor: 'boolean',
-
 
8600
        default: editor.hasPlugin('help')
-
 
8601
      });
-
 
8602
      registerOption('default_font_stack', {
-
 
8603
        processor: 'string[]',
-
 
8604
        default: []
-
 
8605
      });
-
 
8606
    };
-
 
8607
    const isReadOnly = option$2('readonly');
-
 
8608
    const isDisabled = option$2('disabled');
-
 
8609
    const getHeightOption = option$2('height');
-
 
8610
    const getWidthOption = option$2('width');
-
 
8611
    const getMinWidthOption = wrapOptional(option$2('min_width'));
-
 
8612
    const getMinHeightOption = wrapOptional(option$2('min_height'));
-
 
8613
    const getMaxWidthOption = wrapOptional(option$2('max_width'));
-
 
8614
    const getMaxHeightOption = wrapOptional(option$2('max_height'));
-
 
8615
    const getUserStyleFormats = wrapOptional(option$2('style_formats'));
-
 
8616
    const shouldMergeStyleFormats = option$2('style_formats_merge');
-
 
8617
    const shouldAutoHideStyleFormats = option$2('style_formats_autohide');
-
 
8618
    const getContentLanguages = option$2('content_langs');
-
 
8619
    const getRemovedMenuItems = option$2('removed_menuitems');
-
 
8620
    const getToolbarMode = option$2('toolbar_mode');
-
 
8621
    const getToolbarGroups = option$2('toolbar_groups');
-
 
8622
    const getToolbarLocation = option$2('toolbar_location');
-
 
8623
    const fixedContainerSelector = option$2('fixed_toolbar_container');
-
 
8624
    const fixedToolbarContainerTarget = option$2('fixed_toolbar_container_target');
-
 
8625
    const isToolbarPersist = option$2('toolbar_persist');
-
 
8626
    const getStickyToolbarOffset = option$2('toolbar_sticky_offset');
-
 
8627
    const getMenubar = option$2('menubar');
-
 
8628
    const getToolbar = option$2('toolbar');
-
 
8629
    const getFilePickerCallback = option$2('file_picker_callback');
-
 
8630
    const getFilePickerValidatorHandler = option$2('file_picker_validator_handler');
-
 
8631
    const getFontSizeInputDefaultUnit = option$2('font_size_input_default_unit');
-
 
8632
    const getFilePickerTypes = option$2('file_picker_types');
-
 
8633
    const useTypeaheadUrls = option$2('typeahead_urls');
-
 
8634
    const getAnchorTop = option$2('anchor_top');
-
 
8635
    const getAnchorBottom = option$2('anchor_bottom');
-
 
8636
    const isDraggableModal$1 = option$2('draggable_modal');
-
 
8637
    const useStatusBar = option$2('statusbar');
-
 
8638
    const useElementPath = option$2('elementpath');
-
 
8639
    const useBranding = option$2('branding');
-
 
8640
    const getResize = option$2('resize');
-
 
8641
    const getPasteAsText = option$2('paste_as_text');
-
 
8642
    const getSidebarShow = option$2('sidebar_show');
-
 
8643
    const promotionEnabled = option$2('promotion');
-
 
8644
    const useHelpAccessibility = option$2('help_accessibility');
-
 
8645
    const getDefaultFontStack = option$2('default_font_stack');
-
 
8646
    const getSkin = option$2('skin');
-
 
8647
    const isSkinDisabled = editor => editor.options.get('skin') === false;
-
 
8648
    const isMenubarEnabled = editor => editor.options.get('menubar') !== false;
-
 
8649
    const getSkinUrl = editor => {
-
 
8650
      const skinUrl = editor.options.get('skin_url');
-
 
8651
      if (isSkinDisabled(editor)) {
-
 
8652
        return skinUrl;
-
 
8653
      } else {
-
 
8654
        if (skinUrl) {
-
 
8655
          return editor.documentBaseURI.toAbsolute(skinUrl);
-
 
8656
        } else {
-
 
8657
          const skin = editor.options.get('skin');
-
 
8658
          return global$7.baseURL + '/skins/ui/' + skin;
-
 
8659
        }
-
 
8660
      }
-
 
8661
    };
-
 
8662
    const getSkinUrlOption = editor => Optional.from(editor.options.get('skin_url'));
-
 
8663
    const getLineHeightFormats = editor => editor.options.get('line_height_formats').split(' ');
-
 
8664
    const isToolbarEnabled = editor => {
-
 
8665
      const toolbar = getToolbar(editor);
-
 
8666
      const isToolbarString = isString(toolbar);
-
 
8667
      const isToolbarObjectArray = isArray(toolbar) && toolbar.length > 0;
-
 
8668
      return !isMultipleToolbars(editor) && (isToolbarObjectArray || isToolbarString || toolbar === true);
-
 
8669
    };
-
 
8670
    const getMultipleToolbarsOption = editor => {
-
 
8671
      const toolbars = range$2(9, num => editor.options.get('toolbar' + (num + 1)));
-
 
8672
      const toolbarArray = filter$2(toolbars, isString);
-
 
8673
      return someIf(toolbarArray.length > 0, toolbarArray);
-
 
8674
    };
-
 
8675
    const isMultipleToolbars = editor => getMultipleToolbarsOption(editor).fold(() => {
-
 
8676
      const toolbar = getToolbar(editor);
-
 
8677
      return isArrayOf(toolbar, isString) && toolbar.length > 0;
-
 
8678
    }, always);
-
 
8679
    const isToolbarLocationBottom = editor => getToolbarLocation(editor) === ToolbarLocation$1.bottom;
-
 
8680
    const fixedContainerTarget = editor => {
-
 
8681
      var _a;
-
 
8682
      if (!editor.inline) {
-
 
8683
        return Optional.none();
-
 
8684
      }
-
 
8685
      const selector = (_a = fixedContainerSelector(editor)) !== null && _a !== void 0 ? _a : '';
-
 
8686
      if (selector.length > 0) {
-
 
8687
        return descendant(body(), selector);
-
 
8688
      }
-
 
8689
      const element = fixedToolbarContainerTarget(editor);
-
 
8690
      if (isNonNullable(element)) {
-
 
8691
        return Optional.some(SugarElement.fromDom(element));
-
 
8692
      }
-
 
8693
      return Optional.none();
-
 
8694
    };
-
 
8695
    const useFixedContainer = editor => editor.inline && fixedContainerTarget(editor).isSome();
-
 
8696
    const getUiContainer = editor => {
-
 
8697
      const fixedContainer = fixedContainerTarget(editor);
-
 
8698
      return fixedContainer.getOrThunk(() => getContentContainer(getRootNode(SugarElement.fromDom(editor.getElement()))));
-
 
8699
    };
-
 
8700
    const isDistractionFree = editor => editor.inline && !isMenubarEnabled(editor) && !isToolbarEnabled(editor) && !isMultipleToolbars(editor);
-
 
8701
    const isStickyToolbar = editor => {
-
 
8702
      const isStickyToolbar = editor.options.get('toolbar_sticky');
-
 
8703
      return (isStickyToolbar || editor.inline) && !useFixedContainer(editor) && !isDistractionFree(editor);
-
 
8704
    };
-
 
8705
    const isSplitUiMode = editor => !useFixedContainer(editor) && editor.options.get('ui_mode') === 'split';
-
 
8706
    const getMenus = editor => {
-
 
8707
      const menu = editor.options.get('menu');
-
 
8708
      return map$1(menu, menu => ({
-
 
8709
        ...menu,
-
 
8710
        items: menu.items
-
 
8711
      }));
-
 
8712
    };
-
 
8713
 
-
 
8714
    var Options = /*#__PURE__*/Object.freeze({
-
 
8715
        __proto__: null,
-
 
8716
        get ToolbarMode () { return ToolbarMode$1; },
-
 
8717
        get ToolbarLocation () { return ToolbarLocation$1; },
-
 
8718
        register: register$f,
-
 
8719
        getSkinUrl: getSkinUrl,
-
 
8720
        getSkinUrlOption: getSkinUrlOption,
-
 
8721
        isReadOnly: isReadOnly,
-
 
8722
        isDisabled: isDisabled,
-
 
8723
        getSkin: getSkin,
-
 
8724
        isSkinDisabled: isSkinDisabled,
-
 
8725
        getHeightOption: getHeightOption,
-
 
8726
        getWidthOption: getWidthOption,
-
 
8727
        getMinWidthOption: getMinWidthOption,
-
 
8728
        getMinHeightOption: getMinHeightOption,
-
 
8729
        getMaxWidthOption: getMaxWidthOption,
-
 
8730
        getMaxHeightOption: getMaxHeightOption,
-
 
8731
        getUserStyleFormats: getUserStyleFormats,
-
 
8732
        shouldMergeStyleFormats: shouldMergeStyleFormats,
-
 
8733
        shouldAutoHideStyleFormats: shouldAutoHideStyleFormats,
-
 
8734
        getLineHeightFormats: getLineHeightFormats,
-
 
8735
        getContentLanguages: getContentLanguages,
-
 
8736
        getRemovedMenuItems: getRemovedMenuItems,
-
 
8737
        isMenubarEnabled: isMenubarEnabled,
-
 
8738
        isMultipleToolbars: isMultipleToolbars,
-
 
8739
        isToolbarEnabled: isToolbarEnabled,
-
 
8740
        isToolbarPersist: isToolbarPersist,
-
 
8741
        getMultipleToolbarsOption: getMultipleToolbarsOption,
-
 
8742
        getUiContainer: getUiContainer,
-
 
8743
        useFixedContainer: useFixedContainer,
-
 
8744
        isSplitUiMode: isSplitUiMode,
-
 
8745
        getToolbarMode: getToolbarMode,
-
 
8746
        isDraggableModal: isDraggableModal$1,
-
 
8747
        isDistractionFree: isDistractionFree,
-
 
8748
        isStickyToolbar: isStickyToolbar,
-
 
8749
        getStickyToolbarOffset: getStickyToolbarOffset,
-
 
8750
        getToolbarLocation: getToolbarLocation,
-
 
8751
        isToolbarLocationBottom: isToolbarLocationBottom,
-
 
8752
        getToolbarGroups: getToolbarGroups,
-
 
8753
        getMenus: getMenus,
-
 
8754
        getMenubar: getMenubar,
-
 
8755
        getToolbar: getToolbar,
-
 
8756
        getFilePickerCallback: getFilePickerCallback,
-
 
8757
        getFilePickerTypes: getFilePickerTypes,
-
 
8758
        useTypeaheadUrls: useTypeaheadUrls,
-
 
8759
        getAnchorTop: getAnchorTop,
-
 
8760
        getAnchorBottom: getAnchorBottom,
-
 
8761
        getFilePickerValidatorHandler: getFilePickerValidatorHandler,
-
 
8762
        getFontSizeInputDefaultUnit: getFontSizeInputDefaultUnit,
-
 
8763
        useStatusBar: useStatusBar,
-
 
8764
        useElementPath: useElementPath,
-
 
8765
        promotionEnabled: promotionEnabled,
-
 
8766
        useBranding: useBranding,
-
 
8767
        getResize: getResize,
-
 
8768
        getPasteAsText: getPasteAsText,
-
 
8769
        getSidebarShow: getSidebarShow,
-
 
8770
        useHelpAccessibility: useHelpAccessibility,
-
 
8771
        getDefaultFontStack: getDefaultFontStack
-
 
8772
    });
-
 
8773
 
-
 
8774
    const nonScrollingOverflows = [
-
 
8775
      'visible',
-
 
8776
      'hidden',
-
 
8777
      'clip'
-
 
8778
    ];
-
 
8779
    const isScrollingOverflowValue = value => trim$1(value).length > 0 && !contains$2(nonScrollingOverflows, value);
-
 
8780
    const isScroller = elem => {
-
 
8781
      if (isHTMLElement(elem)) {
-
 
8782
        const overflowX = get$f(elem, 'overflow-x');
-
 
8783
        const overflowY = get$f(elem, 'overflow-y');
-
 
8784
        return isScrollingOverflowValue(overflowX) || isScrollingOverflowValue(overflowY);
-
 
8785
      } else {
-
 
8786
        return false;
-
 
8787
      }
-
 
8788
    };
-
 
8789
    const isFullscreen = editor => editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
-
 
8790
    const detect = (editor, popupSinkElem) => {
-
 
8791
      const ancestorsScrollers = ancestors(popupSinkElem, isScroller);
-
 
8792
      const scrollers = ancestorsScrollers.length === 0 ? getShadowRoot(popupSinkElem).map(getShadowHost).map(x => ancestors(x, isScroller)).getOr([]) : ancestorsScrollers;
-
 
8793
      return head(scrollers).map(element => ({
-
 
8794
        element,
-
 
8795
        others: scrollers.slice(1),
-
 
8796
        isFullscreen: () => isFullscreen(editor)
-
 
8797
      }));
-
 
8798
    };
-
 
8799
    const detectWhenSplitUiMode = (editor, popupSinkElem) => isSplitUiMode(editor) ? detect(editor, popupSinkElem) : Optional.none();
-
 
8800
    const getBoundsFrom = sc => {
-
 
8801
      const scrollableBoxes = [
-
 
8802
        ...map$2(sc.others, box$1),
-
 
8803
        win()
-
 
8804
      ];
-
 
8805
      return sc.isFullscreen() ? win() : constrainByMany(box$1(sc.element), scrollableBoxes);
8008
    var global$9 = tinymce.util.Tools.resolve('tinymce.util.Delay');
8806
    };
8009
 
8807
 
8010
    const factory$n = detail => {
8808
    const factory$n = detail => {
8011
      const events = events$a(detail.action);
8809
      const events = events$9(detail.action);
8012
      const tag = detail.dom.tag;
8810
      const tag = detail.dom.tag;
8013
      const lookupAttr = attr => get$g(detail.dom, 'attributes').bind(attrs => get$g(attrs, attr));
8811
      const lookupAttr = attr => get$h(detail.dom, 'attributes').bind(attrs => get$h(attrs, attr));
8014
      const getModAttributes = () => {
8812
      const getModAttributes = () => {
8015
        if (tag === 'button') {
8813
        if (tag === 'button') {
8016
          const type = lookupAttr('type').getOr('button');
8814
          const type = lookupAttr('type').getOr('button');
Línea 8075... Línea 8873...
8075
    const fromHtml = html => {
8873
    const fromHtml = html => {
8076
      const elem = SugarElement.fromHtml(html);
8874
      const elem = SugarElement.fromHtml(html);
8077
      const children$1 = children(elem);
8875
      const children$1 = children(elem);
8078
      const attrs = getAttrs(elem);
8876
      const attrs = getAttrs(elem);
8079
      const classes = getClasses(elem);
8877
      const classes = getClasses(elem);
8080
      const contents = children$1.length === 0 ? {} : { innerHtml: get$9(elem) };
8878
      const contents = children$1.length === 0 ? {} : { innerHtml: get$8(elem) };
8081
      return {
8879
      return {
8082
        tag: name$3(elem),
8880
        tag: name$3(elem),
8083
        classes,
8881
        classes,
8084
        attributes: attrs,
8882
        attributes: attrs,
8085
        ...contents
8883
        ...contents
Línea 8099... Línea 8897...
8099
        getOpt,
8897
        getOpt,
8100
        asSpec
8898
        asSpec
8101
      };
8899
      };
8102
    };
8900
    };
Línea -... Línea 8901...
-
 
8901
 
-
 
8902
    const exhibit$2 = (base, tabConfig) => nu$8({
-
 
8903
      attributes: wrapAll([{
-
 
8904
          key: tabConfig.tabAttr,
-
 
8905
          value: 'true'
-
 
8906
        }])
-
 
8907
    });
-
 
8908
 
-
 
8909
    var ActiveTabstopping = /*#__PURE__*/Object.freeze({
-
 
8910
        __proto__: null,
-
 
8911
        exhibit: exhibit$2
-
 
8912
    });
-
 
8913
 
-
 
8914
    var TabstopSchema = [defaulted('tabAttr', 'data-alloy-tabstop')];
-
 
8915
 
-
 
8916
    const Tabstopping = create$4({
-
 
8917
      fields: TabstopSchema,
-
 
8918
      name: 'tabstopping',
-
 
8919
      active: ActiveTabstopping
-
 
8920
    });
-
 
8921
 
-
 
8922
    const ExclusivityChannel = generate$6('tooltip.exclusive');
-
 
8923
    const ShowTooltipEvent = generate$6('tooltip.show');
-
 
8924
    const HideTooltipEvent = generate$6('tooltip.hide');
-
 
8925
    const ImmediateHideTooltipEvent = generate$6('tooltip.immediateHide');
-
 
8926
    const ImmediateShowTooltipEvent = generate$6('tooltip.immediateShow');
-
 
8927
 
-
 
8928
    const hideAllExclusive = (component, _tConfig, _tState) => {
-
 
8929
      component.getSystem().broadcastOn([ExclusivityChannel], {});
-
 
8930
    };
-
 
8931
    const setComponents = (_component, _tConfig, tState, specs) => {
-
 
8932
      tState.getTooltip().each(tooltip => {
-
 
8933
        if (tooltip.getSystem().isConnected()) {
-
 
8934
          Replacing.set(tooltip, specs);
-
 
8935
        }
-
 
8936
      });
-
 
8937
    };
8103
 
8938
    const isEnabled = (_component, _tConfig, tState) => tState.isEnabled();
-
 
8939
    const setEnabled = (_component, _tConfig, tState, enabled) => tState.setEnabled(enabled);
-
 
8940
    const immediateOpenClose = (component, _tConfig, _tState, open) => emit(component, open ? ImmediateShowTooltipEvent : ImmediateHideTooltipEvent);
-
 
8941
 
-
 
8942
    var TooltippingApis = /*#__PURE__*/Object.freeze({
-
 
8943
        __proto__: null,
8104
    const {entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor} = Object;
8944
        hideAllExclusive: hideAllExclusive,
-
 
8945
        immediateOpenClose: immediateOpenClose,
-
 
8946
        isEnabled: isEnabled,
-
 
8947
        setComponents: setComponents,
-
 
8948
        setEnabled: setEnabled
-
 
8949
    });
8105
    let {freeze, seal, create: create$1} = Object;
8950
 
-
 
8951
    const events$8 = (tooltipConfig, state) => {
-
 
8952
      const hide = comp => {
-
 
8953
        state.getTooltip().each(p => {
8106
    let {apply, construct} = typeof Reflect !== 'undefined' && Reflect;
8954
          if (p.getSystem().isConnected()) {
8107
    if (!apply) {
8955
            detach(p);
-
 
8956
            tooltipConfig.onHide(comp, p);
-
 
8957
            state.clearTooltip();
-
 
8958
          }
8108
      apply = function apply(fun, thisValue, args) {
8959
        });
8109
        return fun.apply(thisValue, args);
8960
        state.clearTimer();
-
 
8961
      };
-
 
8962
      const show = comp => {
-
 
8963
        if (!state.isShowing() && state.isEnabled()) {
-
 
8964
          hideAllExclusive(comp);
-
 
8965
          const sink = tooltipConfig.lazySink(comp).getOrDie();
-
 
8966
          const popup = comp.getSystem().build({
-
 
8967
            dom: tooltipConfig.tooltipDom,
-
 
8968
            components: tooltipConfig.tooltipComponents,
-
 
8969
            events: derive$2(tooltipConfig.mode === 'normal' ? [
-
 
8970
              run$1(mouseover(), _ => {
-
 
8971
                emit(comp, ShowTooltipEvent);
-
 
8972
              }),
-
 
8973
              run$1(mouseout(), _ => {
-
 
8974
                emit(comp, HideTooltipEvent);
-
 
8975
              })
-
 
8976
            ] : []),
-
 
8977
            behaviours: derive$1([Replacing.config({})])
-
 
8978
          });
-
 
8979
          state.setTooltip(popup);
-
 
8980
          attach(sink, popup);
-
 
8981
          tooltipConfig.onShow(comp, popup);
-
 
8982
          Positioning.position(sink, popup, { anchor: tooltipConfig.anchor(comp) });
-
 
8983
        }
-
 
8984
      };
-
 
8985
      const reposition = comp => {
-
 
8986
        state.getTooltip().each(tooltip => {
-
 
8987
          const sink = tooltipConfig.lazySink(comp).getOrDie();
-
 
8988
          Positioning.position(sink, tooltip, { anchor: tooltipConfig.anchor(comp) });
-
 
8989
        });
-
 
8990
      };
-
 
8991
      const getEvents = () => {
-
 
8992
        switch (tooltipConfig.mode) {
-
 
8993
        case 'normal':
-
 
8994
          return [
-
 
8995
            run$1(focusin(), comp => {
-
 
8996
              emit(comp, ImmediateShowTooltipEvent);
-
 
8997
            }),
-
 
8998
            run$1(postBlur(), comp => {
-
 
8999
              emit(comp, ImmediateHideTooltipEvent);
-
 
9000
            }),
-
 
9001
            run$1(mouseover(), comp => {
-
 
9002
              emit(comp, ShowTooltipEvent);
-
 
9003
            }),
-
 
9004
            run$1(mouseout(), comp => {
-
 
9005
              emit(comp, HideTooltipEvent);
-
 
9006
            })
-
 
9007
          ];
-
 
9008
        case 'follow-highlight':
-
 
9009
          return [
-
 
9010
            run$1(highlight$1(), (comp, _se) => {
-
 
9011
              emit(comp, ShowTooltipEvent);
-
 
9012
            }),
-
 
9013
            run$1(dehighlight$1(), comp => {
-
 
9014
              emit(comp, HideTooltipEvent);
-
 
9015
            })
-
 
9016
          ];
-
 
9017
        case 'children-normal':
-
 
9018
          return [
-
 
9019
            run$1(focusin(), (comp, se) => {
-
 
9020
              search(comp.element).each(_ => {
-
 
9021
                if (is(se.event.target, '[data-mce-tooltip]')) {
-
 
9022
                  state.getTooltip().fold(() => {
-
 
9023
                    emit(comp, ImmediateShowTooltipEvent);
-
 
9024
                  }, tooltip => {
-
 
9025
                    if (state.isShowing()) {
-
 
9026
                      tooltipConfig.onShow(comp, tooltip);
-
 
9027
                      reposition(comp);
-
 
9028
                    }
-
 
9029
                  });
-
 
9030
                }
-
 
9031
              });
-
 
9032
            }),
-
 
9033
            run$1(postBlur(), comp => {
-
 
9034
              search(comp.element).fold(() => {
-
 
9035
                emit(comp, ImmediateHideTooltipEvent);
-
 
9036
              }, noop);
-
 
9037
            }),
-
 
9038
            run$1(mouseover(), comp => {
-
 
9039
              descendant(comp.element, '[data-mce-tooltip]:hover').each(_ => {
-
 
9040
                state.getTooltip().fold(() => {
-
 
9041
                  emit(comp, ShowTooltipEvent);
-
 
9042
                }, tooltip => {
-
 
9043
                  if (state.isShowing()) {
-
 
9044
                    tooltipConfig.onShow(comp, tooltip);
-
 
9045
                    reposition(comp);
-
 
9046
                  }
-
 
9047
                });
-
 
9048
              });
-
 
9049
            }),
-
 
9050
            run$1(mouseout(), comp => {
-
 
9051
              descendant(comp.element, '[data-mce-tooltip]:hover').fold(() => {
-
 
9052
                emit(comp, HideTooltipEvent);
-
 
9053
              }, noop);
-
 
9054
            })
-
 
9055
          ];
-
 
9056
        default:
-
 
9057
          return [
-
 
9058
            run$1(focusin(), (comp, se) => {
-
 
9059
              search(comp.element).each(_ => {
-
 
9060
                if (is(se.event.target, '[data-mce-tooltip]')) {
-
 
9061
                  state.getTooltip().fold(() => {
-
 
9062
                    emit(comp, ImmediateShowTooltipEvent);
-
 
9063
                  }, tooltip => {
-
 
9064
                    if (state.isShowing()) {
-
 
9065
                      tooltipConfig.onShow(comp, tooltip);
-
 
9066
                      reposition(comp);
-
 
9067
                    }
-
 
9068
                  });
-
 
9069
                }
-
 
9070
              });
-
 
9071
            }),
-
 
9072
            run$1(postBlur(), comp => {
-
 
9073
              search(comp.element).fold(() => {
-
 
9074
                emit(comp, ImmediateHideTooltipEvent);
-
 
9075
              }, noop);
-
 
9076
            })
-
 
9077
          ];
-
 
9078
        }
-
 
9079
      };
-
 
9080
      return derive$2(flatten([
-
 
9081
        [
-
 
9082
          runOnInit(component => {
-
 
9083
            tooltipConfig.onSetup(component);
-
 
9084
          }),
-
 
9085
          run$1(ShowTooltipEvent, comp => {
-
 
9086
            state.resetTimer(() => {
-
 
9087
              show(comp);
-
 
9088
            }, tooltipConfig.delayForShow());
-
 
9089
          }),
-
 
9090
          run$1(HideTooltipEvent, comp => {
-
 
9091
            state.resetTimer(() => {
-
 
9092
              hide(comp);
-
 
9093
            }, tooltipConfig.delayForHide());
-
 
9094
          }),
-
 
9095
          run$1(ImmediateShowTooltipEvent, comp => {
-
 
9096
            state.resetTimer(() => {
-
 
9097
              show(comp);
-
 
9098
            }, 0);
-
 
9099
          }),
-
 
9100
          run$1(ImmediateHideTooltipEvent, comp => {
-
 
9101
            state.resetTimer(() => {
-
 
9102
              hide(comp);
-
 
9103
            }, 0);
-
 
9104
          }),
-
 
9105
          run$1(receive(), (comp, message) => {
-
 
9106
            const receivingData = message;
-
 
9107
            if (!receivingData.universal) {
-
 
9108
              if (contains$2(receivingData.channels, ExclusivityChannel)) {
-
 
9109
                hide(comp);
-
 
9110
              }
-
 
9111
            }
-
 
9112
          }),
-
 
9113
          runOnDetached(comp => {
-
 
9114
            hide(comp);
-
 
9115
          })
-
 
9116
        ],
-
 
9117
        getEvents()
8110
      };
9118
      ]));
-
 
9119
    };
-
 
9120
 
-
 
9121
    var ActiveTooltipping = /*#__PURE__*/Object.freeze({
-
 
9122
        __proto__: null,
-
 
9123
        events: events$8
-
 
9124
    });
-
 
9125
 
-
 
9126
    var TooltippingSchema = [
-
 
9127
      required$1('lazySink'),
-
 
9128
      required$1('tooltipDom'),
-
 
9129
      defaulted('exclusive', true),
-
 
9130
      defaulted('tooltipComponents', []),
-
 
9131
      defaultedFunction('delayForShow', constant$1(300)),
-
 
9132
      defaultedFunction('delayForHide', constant$1(100)),
-
 
9133
      defaultedFunction('onSetup', noop),
-
 
9134
      defaultedStringEnum('mode', 'normal', [
-
 
9135
        'normal',
-
 
9136
        'follow-highlight',
-
 
9137
        'children-keyboard-focus',
-
 
9138
        'children-normal'
-
 
9139
      ]),
-
 
9140
      defaulted('anchor', comp => ({
-
 
9141
        type: 'hotspot',
-
 
9142
        hotspot: comp,
-
 
9143
        layouts: {
-
 
9144
          onLtr: constant$1([
-
 
9145
            south$2,
-
 
9146
            north$2,
-
 
9147
            southeast$2,
-
 
9148
            northeast$2,
-
 
9149
            southwest$2,
-
 
9150
            northwest$2
-
 
9151
          ]),
-
 
9152
          onRtl: constant$1([
-
 
9153
            south$2,
-
 
9154
            north$2,
-
 
9155
            southeast$2,
-
 
9156
            northeast$2,
-
 
9157
            southwest$2,
-
 
9158
            northwest$2
-
 
9159
          ])
-
 
9160
        },
-
 
9161
        bubble: nu$5(0, -2, {})
-
 
9162
      })),
-
 
9163
      onHandler('onHide'),
-
 
9164
      onHandler('onShow')
-
 
9165
    ];
-
 
9166
 
-
 
9167
    const init$a = () => {
-
 
9168
      const enabled = Cell(true);
-
 
9169
      const timer = value$4();
-
 
9170
      const popup = value$4();
-
 
9171
      const clearTimer = () => {
-
 
9172
        timer.on(clearTimeout);
-
 
9173
      };
-
 
9174
      const resetTimer = (f, delay) => {
-
 
9175
        clearTimer();
-
 
9176
        timer.set(setTimeout(f, delay));
-
 
9177
      };
-
 
9178
      const readState = constant$1('not-implemented');
-
 
9179
      return nu$7({
-
 
9180
        getTooltip: popup.get,
-
 
9181
        isShowing: popup.isSet,
-
 
9182
        setTooltip: popup.set,
-
 
9183
        clearTooltip: popup.clear,
-
 
9184
        clearTimer,
-
 
9185
        resetTimer,
-
 
9186
        readState,
-
 
9187
        isEnabled: () => enabled.get(),
-
 
9188
        setEnabled: setToEnabled => enabled.set(setToEnabled)
-
 
9189
      });
-
 
9190
    };
-
 
9191
 
-
 
9192
    var TooltippingState = /*#__PURE__*/Object.freeze({
-
 
9193
        __proto__: null,
-
 
9194
        init: init$a
-
 
9195
    });
-
 
9196
 
-
 
9197
    const Tooltipping = create$4({
-
 
9198
      fields: TooltippingSchema,
-
 
9199
      name: 'tooltipping',
-
 
9200
      active: ActiveTooltipping,
-
 
9201
      state: TooltippingState,
-
 
9202
      apis: TooltippingApis
-
 
9203
    });
-
 
9204
 
-
 
9205
    /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
-
 
9206
 
-
 
9207
    const {
-
 
9208
      entries,
-
 
9209
      setPrototypeOf,
-
 
9210
      isFrozen,
-
 
9211
      getPrototypeOf,
-
 
9212
      getOwnPropertyDescriptor
-
 
9213
    } = Object;
-
 
9214
    let {
-
 
9215
      freeze,
-
 
9216
      seal,
-
 
9217
      create: create$1
-
 
9218
    } = Object; // eslint-disable-line import/no-mutable-exports
-
 
9219
    let {
-
 
9220
      apply,
-
 
9221
      construct
8111
    }
9222
    } = typeof Reflect !== 'undefined' && Reflect;
8112
    if (!freeze) {
9223
    if (!freeze) {
8113
      freeze = function freeze(x) {
9224
      freeze = function freeze(x) {
8114
        return x;
9225
        return x;
8115
      };
9226
      };
8116
    }
9227
    }
8117
    if (!seal) {
9228
    if (!seal) {
8118
      seal = function seal(x) {
9229
      seal = function seal(x) {
8119
        return x;
9230
        return x;
8120
      };
9231
      };
-
 
9232
    }
-
 
9233
    if (!apply) {
-
 
9234
      apply = function apply(fun, thisValue, args) {
-
 
9235
        return fun.apply(thisValue, args);
-
 
9236
      };
8121
    }
9237
    }
8122
    if (!construct) {
9238
    if (!construct) {
8123
      construct = function construct(Func, args) {
9239
      construct = function construct(Func, args) {
8124
        return new Func(...args);
9240
        return new Func(...args);
8125
      };
9241
      };
8126
    }
9242
    }
-
 
9243
    const arrayForEach = unapply(Array.prototype.forEach);
8127
    const arrayForEach = unapply(Array.prototype.forEach);
9244
    const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
8128
    const arrayPop = unapply(Array.prototype.pop);
9245
    const arrayPop = unapply(Array.prototype.pop);
-
 
9246
    const arrayPush = unapply(Array.prototype.push);
8129
    const arrayPush = unapply(Array.prototype.push);
9247
    const arraySplice = unapply(Array.prototype.splice);
8130
    const stringToLowerCase = unapply(String.prototype.toLowerCase);
9248
    const stringToLowerCase = unapply(String.prototype.toLowerCase);
8131
    const stringToString = unapply(String.prototype.toString);
9249
    const stringToString = unapply(String.prototype.toString);
8132
    const stringMatch = unapply(String.prototype.match);
9250
    const stringMatch = unapply(String.prototype.match);
8133
    const stringReplace = unapply(String.prototype.replace);
9251
    const stringReplace = unapply(String.prototype.replace);
8134
    const stringIndexOf = unapply(String.prototype.indexOf);
9252
    const stringIndexOf = unapply(String.prototype.indexOf);
-
 
9253
    const stringTrim = unapply(String.prototype.trim);
8135
    const stringTrim = unapply(String.prototype.trim);
9254
    const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
8136
    const regExpTest = unapply(RegExp.prototype.test);
9255
    const regExpTest = unapply(RegExp.prototype.test);
-
 
9256
    const typeErrorCreate = unconstruct(TypeError);
-
 
9257
    /**
-
 
9258
     * Creates a new function that calls the given function with a specified thisArg and arguments.
-
 
9259
     *
-
 
9260
     * @param func - The function to be wrapped and called.
-
 
9261
     * @returns A new function that calls the given function with a specified thisArg and arguments.
8137
    const typeErrorCreate = unconstruct(TypeError);
9262
     */
8138
    function unapply(func) {
9263
    function unapply(func) {
8139
      return function (thisArg) {
9264
      return function (thisArg) {
8140
        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9265
        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
8141
          args[_key - 1] = arguments[_key];
9266
          args[_key - 1] = arguments[_key];
8142
        }
9267
        }
8143
        return apply(func, thisArg, args);
9268
        return apply(func, thisArg, args);
8144
      };
9269
      };
-
 
9270
    }
-
 
9271
    /**
-
 
9272
     * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
-
 
9273
     *
-
 
9274
     * @param func - The constructor function to be wrapped and called.
-
 
9275
     * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
8145
    }
9276
     */
8146
    function unconstruct(func) {
9277
    function unconstruct(func) {
8147
      return function () {
9278
      return function () {
8148
        for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
9279
        for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
8149
          args[_key2] = arguments[_key2];
9280
          args[_key2] = arguments[_key2];
8150
        }
9281
        }
8151
        return construct(func, args);
9282
        return construct(func, args);
8152
      };
9283
      };
-
 
9284
    }
-
 
9285
    /**
-
 
9286
     * Add properties to a lookup table
-
 
9287
     *
-
 
9288
     * @param set - The set to which elements will be added.
-
 
9289
     * @param array - The array containing elements to be added to the set.
8153
    }
9290
     * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
-
 
9291
     * @returns The modified set with added elements.
8154
    function addToSet(set, array, transformCaseFunc) {
9292
     */
8155
      var _transformCaseFunc;
9293
    function addToSet(set, array) {
8156
      transformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase;
9294
      let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
-
 
9295
      if (setPrototypeOf) {
-
 
9296
        // Make 'in' and truthy checks like Boolean(set.constructor)
-
 
9297
        // independent of any properties defined on Object.prototype.
8157
      if (setPrototypeOf) {
9298
        // Prevent prototype setters from intercepting set as a this value.
8158
        setPrototypeOf(set, null);
9299
        setPrototypeOf(set, null);
8159
      }
9300
      }
8160
      let l = array.length;
9301
      let l = array.length;
8161
      while (l--) {
9302
      while (l--) {
8162
        let element = array[l];
9303
        let element = array[l];
8163
        if (typeof element === 'string') {
9304
        if (typeof element === 'string') {
8164
          const lcElement = transformCaseFunc(element);
9305
          const lcElement = transformCaseFunc(element);
-
 
9306
          if (lcElement !== element) {
8165
          if (lcElement !== element) {
9307
            // Config presets (e.g. tags.js, attrs.js) are immutable.
8166
            if (!isFrozen(array)) {
9308
            if (!isFrozen(array)) {
8167
              array[l] = lcElement;
9309
              array[l] = lcElement;
8168
            }
9310
            }
8169
            element = lcElement;
9311
            element = lcElement;
8170
          }
9312
          }
8171
        }
9313
        }
8172
        set[element] = true;
9314
        set[element] = true;
8173
      }
9315
      }
8174
      return set;
9316
      return set;
-
 
9317
    }
-
 
9318
    /**
-
 
9319
     * Clean up an array to harden against CSPP
-
 
9320
     *
-
 
9321
     * @param array - The array to be cleaned.
-
 
9322
     * @returns The cleaned version of the array
-
 
9323
     */
-
 
9324
    function cleanArray(array) {
-
 
9325
      for (let index = 0; index < array.length; index++) {
-
 
9326
        const isPropertyExist = objectHasOwnProperty(array, index);
-
 
9327
        if (!isPropertyExist) {
-
 
9328
          array[index] = null;
-
 
9329
        }
-
 
9330
      }
-
 
9331
      return array;
-
 
9332
    }
-
 
9333
    /**
-
 
9334
     * Shallow clone an object
-
 
9335
     *
-
 
9336
     * @param object - The object to be cloned.
-
 
9337
     * @returns A new object that copies the original.
8175
    }
9338
     */
8176
    function clone(object) {
9339
    function clone(object) {
8177
      const newObject = create$1(null);
9340
      const newObject = create$1(null);
-
 
9341
      for (const [property, value] of entries(object)) {
-
 
9342
        const isPropertyExist = objectHasOwnProperty(object, property);
-
 
9343
        if (isPropertyExist) {
-
 
9344
          if (Array.isArray(value)) {
-
 
9345
            newObject[property] = cleanArray(value);
-
 
9346
          } else if (value && typeof value === 'object' && value.constructor === Object) {
-
 
9347
            newObject[property] = clone(value);
8178
      for (const [property, value] of entries(object)) {
9348
          } else {
-
 
9349
            newObject[property] = value;
-
 
9350
          }
8179
        newObject[property] = value;
9351
        }
8180
      }
9352
      }
8181
      return newObject;
9353
      return newObject;
-
 
9354
    }
-
 
9355
    /**
-
 
9356
     * This method automatically checks if the prop is function or getter and behaves accordingly.
-
 
9357
     *
-
 
9358
     * @param object - The object to look up the getter function in its prototype chain.
-
 
9359
     * @param prop - The property name for which to find the getter function.
-
 
9360
     * @returns The getter function found in the prototype chain or a fallback function.
8182
    }
9361
     */
8183
    function lookupGetter(object, prop) {
9362
    function lookupGetter(object, prop) {
8184
      while (object !== null) {
9363
      while (object !== null) {
8185
        const desc = getOwnPropertyDescriptor(object, prop);
9364
        const desc = getOwnPropertyDescriptor(object, prop);
8186
        if (desc) {
9365
        if (desc) {
Línea 8191... Línea 9370...
8191
            return unapply(desc.value);
9370
            return unapply(desc.value);
8192
          }
9371
          }
8193
        }
9372
        }
8194
        object = getPrototypeOf(object);
9373
        object = getPrototypeOf(object);
8195
      }
9374
      }
8196
      function fallbackValue(element) {
9375
      function fallbackValue() {
8197
        console.warn('fallback value for', element);
-
 
8198
        return null;
9376
        return null;
8199
      }
9377
      }
8200
      return fallbackValue;
9378
      return fallbackValue;
8201
    }
9379
    }
8202
    const html$1 = freeze([
-
 
8203
      'a',
-
 
8204
      'abbr',
-
 
8205
      'acronym',
-
 
8206
      'address',
-
 
8207
      'area',
-
 
8208
      'article',
-
 
8209
      'aside',
-
 
8210
      'audio',
-
 
8211
      'b',
-
 
8212
      'bdi',
-
 
8213
      'bdo',
-
 
8214
      'big',
-
 
8215
      'blink',
-
 
8216
      'blockquote',
-
 
8217
      'body',
-
 
8218
      'br',
-
 
8219
      'button',
-
 
8220
      'canvas',
-
 
8221
      'caption',
-
 
8222
      'center',
-
 
8223
      'cite',
-
 
8224
      'code',
-
 
8225
      'col',
-
 
8226
      'colgroup',
-
 
8227
      'content',
-
 
8228
      'data',
-
 
8229
      'datalist',
-
 
8230
      'dd',
-
 
8231
      'decorator',
-
 
8232
      'del',
-
 
8233
      'details',
-
 
8234
      'dfn',
-
 
8235
      'dialog',
-
 
8236
      'dir',
-
 
8237
      'div',
-
 
8238
      'dl',
-
 
8239
      'dt',
-
 
8240
      'element',
-
 
8241
      'em',
-
 
8242
      'fieldset',
-
 
8243
      'figcaption',
-
 
8244
      'figure',
-
 
8245
      'font',
-
 
8246
      'footer',
-
 
8247
      'form',
-
 
8248
      'h1',
-
 
8249
      'h2',
-
 
8250
      'h3',
-
 
8251
      'h4',
-
 
8252
      'h5',
-
 
8253
      'h6',
-
 
8254
      'head',
-
 
8255
      'header',
-
 
8256
      'hgroup',
-
 
8257
      'hr',
-
 
8258
      'html',
-
 
8259
      'i',
-
 
8260
      'img',
-
 
8261
      'input',
-
 
8262
      'ins',
-
 
8263
      'kbd',
-
 
8264
      'label',
-
 
8265
      'legend',
-
 
8266
      'li',
-
 
8267
      'main',
-
 
8268
      'map',
-
 
8269
      'mark',
-
 
8270
      'marquee',
-
 
8271
      'menu',
-
 
8272
      'menuitem',
-
 
8273
      'meter',
-
 
8274
      'nav',
-
 
8275
      'nobr',
-
 
8276
      'ol',
-
 
8277
      'optgroup',
-
 
8278
      'option',
-
 
8279
      'output',
-
 
8280
      'p',
-
 
8281
      'picture',
-
 
8282
      'pre',
-
 
8283
      'progress',
-
 
8284
      'q',
-
 
8285
      'rp',
-
 
8286
      'rt',
-
 
8287
      'ruby',
-
 
8288
      's',
-
 
8289
      'samp',
-
 
8290
      'section',
-
 
8291
      'select',
-
 
8292
      'shadow',
-
 
8293
      'small',
-
 
8294
      'source',
-
 
8295
      'spacer',
-
 
8296
      'span',
-
 
8297
      'strike',
-
 
8298
      'strong',
-
 
8299
      'style',
-
 
8300
      'sub',
-
 
8301
      'summary',
-
 
8302
      'sup',
-
 
8303
      'table',
-
 
8304
      'tbody',
-
 
8305
      'td',
-
 
8306
      'template',
-
 
8307
      'textarea',
-
 
8308
      'tfoot',
-
 
8309
      'th',
-
 
8310
      'thead',
-
 
8311
      'time',
-
 
8312
      'tr',
-
 
8313
      'track',
-
 
8314
      'tt',
-
 
8315
      'u',
-
 
8316
      'ul',
-
 
8317
      'var',
-
 
8318
      'video',
-
 
8319
      'wbr'
-
 
8320
    ]);
9380
 
8321
    const svg$1 = freeze([
9381
    const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
8322
      'svg',
-
 
8323
      'a',
-
 
8324
      'altglyph',
-
 
8325
      'altglyphdef',
-
 
8326
      'altglyphitem',
-
 
8327
      'animatecolor',
-
 
8328
      'animatemotion',
-
 
8329
      'animatetransform',
9382
    const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
8330
      'circle',
-
 
8331
      'clippath',
-
 
8332
      'defs',
-
 
8333
      'desc',
-
 
8334
      'ellipse',
-
 
8335
      'filter',
-
 
8336
      'font',
-
 
8337
      'g',
-
 
8338
      'glyph',
-
 
8339
      'glyphref',
-
 
8340
      'hkern',
-
 
8341
      'image',
-
 
8342
      'line',
-
 
8343
      'lineargradient',
9383
    const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
8344
      'marker',
-
 
8345
      'mask',
-
 
8346
      'metadata',
-
 
8347
      'mpath',
-
 
8348
      'path',
-
 
8349
      'pattern',
-
 
8350
      'polygon',
-
 
8351
      'polyline',
-
 
8352
      'radialgradient',
-
 
8353
      'rect',
-
 
8354
      'stop',
-
 
8355
      'style',
-
 
8356
      'switch',
-
 
8357
      'symbol',
-
 
8358
      'text',
-
 
8359
      'textpath',
-
 
8360
      'title',
-
 
8361
      'tref',
-
 
8362
      'tspan',
-
 
8363
      'view',
-
 
8364
      'vkern'
-
 
8365
    ]);
-
 
8366
    const svgFilters = freeze([
9384
    // List of SVG elements that are disallowed by default.
8367
      'feBlend',
-
 
8368
      'feColorMatrix',
-
 
8369
      'feComponentTransfer',
9385
    // We still need to know them so that we can do namespace
8370
      'feComposite',
-
 
8371
      'feConvolveMatrix',
-
 
8372
      'feDiffuseLighting',
-
 
8373
      'feDisplacementMap',
9386
    // checks properly in case one wants to add them to
8374
      'feDistantLight',
-
 
8375
      'feDropShadow',
-
 
8376
      'feFlood',
-
 
8377
      'feFuncA',
-
 
8378
      'feFuncB',
-
 
8379
      'feFuncG',
-
 
8380
      'feFuncR',
9387
    // allow-list.
8381
      'feGaussianBlur',
9388
    const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
8382
      'feImage',
-
 
8383
      'feMerge',
-
 
8384
      'feMergeNode',
-
 
8385
      'feMorphology',
-
 
8386
      'feOffset',
-
 
8387
      'fePointLight',
9389
    const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
8388
      'feSpecularLighting',
9390
    // Similarly to SVG, we want to know all MathML elements,
8389
      'feSpotLight',
-
 
8390
      'feTile',
-
 
8391
      'feTurbulence'
-
 
8392
    ]);
-
 
8393
    const svgDisallowed = freeze([
9391
    // even those that we disallow by default.
8394
      'animate',
-
 
8395
      'color-profile',
-
 
8396
      'cursor',
-
 
8397
      'discard',
-
 
8398
      'font-face',
-
 
8399
      'font-face-format',
-
 
8400
      'font-face-name',
-
 
8401
      'font-face-src',
-
 
8402
      'font-face-uri',
-
 
8403
      'foreignobject',
-
 
8404
      'hatch',
-
 
8405
      'hatchpath',
-
 
8406
      'mesh',
-
 
8407
      'meshgradient',
-
 
8408
      'meshpatch',
-
 
8409
      'meshrow',
-
 
8410
      'missing-glyph',
-
 
8411
      'script',
-
 
8412
      'set',
-
 
8413
      'solidcolor',
-
 
8414
      'unknown',
-
 
8415
      'use'
-
 
8416
    ]);
-
 
8417
    const mathMl$1 = freeze([
-
 
8418
      'math',
-
 
8419
      'menclose',
-
 
8420
      'merror',
-
 
8421
      'mfenced',
-
 
8422
      'mfrac',
-
 
8423
      'mglyph',
-
 
8424
      'mi',
-
 
8425
      'mlabeledtr',
-
 
8426
      'mmultiscripts',
-
 
8427
      'mn',
-
 
8428
      'mo',
-
 
8429
      'mover',
-
 
8430
      'mpadded',
-
 
8431
      'mphantom',
-
 
8432
      'mroot',
-
 
8433
      'mrow',
-
 
8434
      'ms',
-
 
8435
      'mspace',
-
 
8436
      'msqrt',
-
 
8437
      'mstyle',
-
 
8438
      'msub',
-
 
8439
      'msup',
-
 
8440
      'msubsup',
-
 
8441
      'mtable',
-
 
8442
      'mtd',
-
 
8443
      'mtext',
-
 
8444
      'mtr',
-
 
8445
      'munder',
-
 
8446
      'munderover',
-
 
8447
      'mprescripts'
-
 
8448
    ]);
-
 
8449
    const mathMlDisallowed = freeze([
9392
    const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
8450
      'maction',
-
 
8451
      'maligngroup',
-
 
8452
      'malignmark',
-
 
8453
      'mlongdiv',
-
 
8454
      'mscarries',
-
 
8455
      'mscarry',
-
 
8456
      'msgroup',
-
 
8457
      'mstack',
-
 
8458
      'msline',
-
 
8459
      'msrow',
-
 
8460
      'semantics',
-
 
8461
      'annotation',
-
 
8462
      'annotation-xml',
-
 
8463
      'mprescripts',
-
 
8464
      'none'
-
 
8465
    ]);
-
 
8466
    const text$1 = freeze(['#text']);
9393
    const text$1 = freeze(['#text']);
8467
    const html = freeze([
-
 
8468
      'accept',
-
 
8469
      'action',
-
 
8470
      'align',
-
 
8471
      'alt',
-
 
8472
      'autocapitalize',
-
 
8473
      'autocomplete',
-
 
8474
      'autopictureinpicture',
-
 
8475
      'autoplay',
-
 
8476
      'background',
-
 
8477
      'bgcolor',
-
 
8478
      'border',
-
 
8479
      'capture',
-
 
8480
      'cellpadding',
-
 
8481
      'cellspacing',
-
 
8482
      'checked',
-
 
8483
      'cite',
-
 
8484
      'class',
-
 
8485
      'clear',
-
 
8486
      'color',
-
 
8487
      'cols',
-
 
8488
      'colspan',
-
 
8489
      'controls',
-
 
8490
      'controlslist',
-
 
8491
      'coords',
-
 
8492
      'crossorigin',
-
 
8493
      'datetime',
-
 
8494
      'decoding',
-
 
8495
      'default',
-
 
8496
      'dir',
-
 
8497
      'disabled',
-
 
8498
      'disablepictureinpicture',
-
 
8499
      'disableremoteplayback',
-
 
8500
      'download',
-
 
8501
      'draggable',
-
 
8502
      'enctype',
-
 
8503
      'enterkeyhint',
-
 
8504
      'face',
-
 
8505
      'for',
-
 
8506
      'headers',
-
 
8507
      'height',
-
 
8508
      'hidden',
-
 
8509
      'high',
-
 
8510
      'href',
-
 
8511
      'hreflang',
-
 
8512
      'id',
-
 
8513
      'inputmode',
-
 
8514
      'integrity',
-
 
8515
      'ismap',
-
 
8516
      'kind',
-
 
8517
      'label',
-
 
8518
      'lang',
-
 
8519
      'list',
-
 
8520
      'loading',
-
 
8521
      'loop',
-
 
8522
      'low',
-
 
8523
      'max',
-
 
8524
      'maxlength',
-
 
8525
      'media',
-
 
8526
      'method',
-
 
8527
      'min',
-
 
8528
      'minlength',
-
 
8529
      'multiple',
-
 
8530
      'muted',
-
 
8531
      'name',
-
 
8532
      'nonce',
-
 
8533
      'noshade',
-
 
8534
      'novalidate',
-
 
8535
      'nowrap',
-
 
8536
      'open',
-
 
8537
      'optimum',
-
 
8538
      'pattern',
-
 
8539
      'placeholder',
-
 
8540
      'playsinline',
-
 
8541
      'poster',
-
 
8542
      'preload',
-
 
8543
      'pubdate',
-
 
8544
      'radiogroup',
-
 
8545
      'readonly',
-
 
8546
      'rel',
-
 
8547
      'required',
-
 
8548
      'rev',
-
 
8549
      'reversed',
-
 
8550
      'role',
-
 
8551
      'rows',
-
 
8552
      'rowspan',
-
 
8553
      'spellcheck',
-
 
8554
      'scope',
-
 
8555
      'selected',
-
 
8556
      'shape',
-
 
8557
      'size',
-
 
8558
      'sizes',
-
 
8559
      'span',
-
 
8560
      'srclang',
-
 
8561
      'start',
-
 
8562
      'src',
-
 
8563
      'srcset',
-
 
8564
      'step',
-
 
8565
      'style',
-
 
8566
      'summary',
-
 
8567
      'tabindex',
-
 
8568
      'title',
-
 
8569
      'translate',
-
 
8570
      'type',
-
 
8571
      'usemap',
-
 
8572
      'valign',
-
 
8573
      'value',
-
 
8574
      'width',
-
 
8575
      'xmlns',
-
 
8576
      'slot'
-
 
8577
    ]);
9394
 
8578
    const svg = freeze([
9395
    const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
8579
      'accent-height',
-
 
8580
      'accumulate',
-
 
8581
      'additive',
-
 
8582
      'alignment-baseline',
9396
    const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
8583
      'ascent',
-
 
8584
      'attributename',
-
 
8585
      'attributetype',
-
 
8586
      'azimuth',
-
 
8587
      'basefrequency',
-
 
8588
      'baseline-shift',
-
 
8589
      'begin',
-
 
8590
      'bias',
-
 
8591
      'by',
-
 
8592
      'class',
-
 
8593
      'clip',
-
 
8594
      'clippathunits',
-
 
8595
      'clip-path',
-
 
8596
      'clip-rule',
-
 
8597
      'color',
-
 
8598
      'color-interpolation',
9397
    const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
8599
      'color-interpolation-filters',
9398
    const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
8600
      'color-profile',
-
 
8601
      'color-rendering',
-
 
8602
      'cx',
-
 
8603
      'cy',
-
 
8604
      'd',
-
 
8605
      'dx',
-
 
8606
      'dy',
-
 
8607
      'diffuseconstant',
-
 
8608
      'direction',
-
 
8609
      'display',
-
 
8610
      'divisor',
-
 
8611
      'dur',
-
 
8612
      'edgemode',
-
 
8613
      'elevation',
-
 
8614
      'end',
-
 
8615
      'fill',
-
 
8616
      'fill-opacity',
-
 
8617
      'fill-rule',
-
 
8618
      'filter',
-
 
8619
      'filterunits',
-
 
8620
      'flood-color',
-
 
8621
      'flood-opacity',
-
 
8622
      'font-family',
-
 
8623
      'font-size',
-
 
8624
      'font-size-adjust',
-
 
8625
      'font-stretch',
-
 
8626
      'font-style',
-
 
8627
      'font-variant',
-
 
8628
      'font-weight',
-
 
8629
      'fx',
-
 
8630
      'fy',
-
 
8631
      'g1',
-
 
8632
      'g2',
-
 
8633
      'glyph-name',
-
 
8634
      'glyphref',
-
 
8635
      'gradientunits',
-
 
8636
      'gradienttransform',
-
 
8637
      'height',
-
 
8638
      'href',
-
 
8639
      'id',
-
 
8640
      'image-rendering',
-
 
8641
      'in',
-
 
8642
      'in2',
-
 
8643
      'k',
-
 
8644
      'k1',
-
 
8645
      'k2',
-
 
8646
      'k3',
-
 
8647
      'k4',
-
 
8648
      'kerning',
-
 
8649
      'keypoints',
-
 
8650
      'keysplines',
-
 
8651
      'keytimes',
-
 
8652
      'lang',
-
 
8653
      'lengthadjust',
-
 
8654
      'letter-spacing',
-
 
8655
      'kernelmatrix',
-
 
8656
      'kernelunitlength',
-
 
8657
      'lighting-color',
-
 
8658
      'local',
-
 
8659
      'marker-end',
-
 
8660
      'marker-mid',
-
 
8661
      'marker-start',
-
 
8662
      'markerheight',
-
 
8663
      'markerunits',
-
 
8664
      'markerwidth',
-
 
8665
      'maskcontentunits',
-
 
8666
      'maskunits',
-
 
8667
      'max',
-
 
8668
      'mask',
-
 
8669
      'media',
-
 
8670
      'method',
-
 
8671
      'mode',
-
 
8672
      'min',
-
 
8673
      'name',
-
 
8674
      'numoctaves',
-
 
8675
      'offset',
-
 
8676
      'operator',
-
 
8677
      'opacity',
-
 
8678
      'order',
-
 
8679
      'orient',
-
 
8680
      'orientation',
-
 
8681
      'origin',
-
 
8682
      'overflow',
-
 
8683
      'paint-order',
-
 
8684
      'path',
-
 
8685
      'pathlength',
-
 
8686
      'patterncontentunits',
-
 
8687
      'patterntransform',
-
 
8688
      'patternunits',
-
 
8689
      'points',
-
 
8690
      'preservealpha',
-
 
8691
      'preserveaspectratio',
-
 
8692
      'primitiveunits',
-
 
8693
      'r',
-
 
8694
      'rx',
-
 
8695
      'ry',
-
 
8696
      'radius',
-
 
8697
      'refx',
-
 
8698
      'refy',
-
 
8699
      'repeatcount',
-
 
8700
      'repeatdur',
-
 
8701
      'restart',
-
 
8702
      'result',
-
 
8703
      'rotate',
-
 
8704
      'scale',
-
 
8705
      'seed',
-
 
8706
      'shape-rendering',
-
 
8707
      'specularconstant',
-
 
8708
      'specularexponent',
-
 
8709
      'spreadmethod',
-
 
8710
      'startoffset',
-
 
8711
      'stddeviation',
-
 
8712
      'stitchtiles',
-
 
8713
      'stop-color',
-
 
8714
      'stop-opacity',
-
 
8715
      'stroke-dasharray',
-
 
8716
      'stroke-dashoffset',
-
 
8717
      'stroke-linecap',
-
 
8718
      'stroke-linejoin',
-
 
8719
      'stroke-miterlimit',
-
 
8720
      'stroke-opacity',
-
 
8721
      'stroke',
-
 
8722
      'stroke-width',
-
 
8723
      'style',
-
 
8724
      'surfacescale',
-
 
8725
      'systemlanguage',
-
 
8726
      'tabindex',
-
 
8727
      'targetx',
-
 
8728
      'targety',
-
 
8729
      'transform',
-
 
8730
      'transform-origin',
-
 
8731
      'text-anchor',
-
 
8732
      'text-decoration',
-
 
8733
      'text-rendering',
-
 
8734
      'textlength',
-
 
8735
      'type',
-
 
8736
      'u1',
-
 
8737
      'u2',
-
 
8738
      'unicode',
-
 
8739
      'values',
-
 
8740
      'viewbox',
-
 
8741
      'visibility',
-
 
8742
      'version',
-
 
8743
      'vert-adv-y',
-
 
8744
      'vert-origin-x',
-
 
8745
      'vert-origin-y',
-
 
8746
      'width',
-
 
8747
      'word-spacing',
-
 
8748
      'wrap',
-
 
8749
      'writing-mode',
-
 
8750
      'xchannelselector',
-
 
8751
      'ychannelselector',
-
 
8752
      'x',
-
 
8753
      'x1',
-
 
8754
      'x2',
-
 
8755
      'xmlns',
-
 
8756
      'y',
-
 
8757
      'y1',
-
 
8758
      'y2',
-
 
8759
      'z',
-
 
8760
      'zoomandpan'
-
 
8761
    ]);
9399
 
8762
    const mathMl = freeze([
-
 
8763
      'accent',
-
 
8764
      'accentunder',
-
 
8765
      'align',
-
 
8766
      'bevelled',
-
 
8767
      'close',
-
 
8768
      'columnsalign',
-
 
8769
      'columnlines',
-
 
8770
      'columnspan',
-
 
8771
      'denomalign',
-
 
8772
      'depth',
-
 
8773
      'dir',
-
 
8774
      'display',
-
 
8775
      'displaystyle',
-
 
8776
      'encoding',
-
 
8777
      'fence',
-
 
8778
      'frame',
-
 
8779
      'height',
-
 
8780
      'href',
-
 
8781
      'id',
-
 
8782
      'largeop',
-
 
8783
      'length',
-
 
8784
      'linethickness',
-
 
8785
      'lspace',
-
 
8786
      'lquote',
-
 
8787
      'mathbackground',
-
 
8788
      'mathcolor',
-
 
8789
      'mathsize',
-
 
8790
      'mathvariant',
-
 
8791
      'maxsize',
-
 
8792
      'minsize',
-
 
8793
      'movablelimits',
-
 
8794
      'notation',
-
 
8795
      'numalign',
-
 
8796
      'open',
-
 
8797
      'rowalign',
-
 
8798
      'rowlines',
-
 
8799
      'rowspacing',
-
 
8800
      'rowspan',
-
 
8801
      'rspace',
-
 
8802
      'rquote',
-
 
8803
      'scriptlevel',
-
 
8804
      'scriptminsize',
-
 
8805
      'scriptsizemultiplier',
9400
    // eslint-disable-next-line unicorn/better-regex
8806
      'selection',
-
 
8807
      'separator',
-
 
8808
      'separators',
-
 
8809
      'stretchy',
-
 
8810
      'subscriptshift',
-
 
8811
      'supscriptshift',
-
 
8812
      'symmetric',
-
 
8813
      'voffset',
-
 
8814
      'width',
-
 
8815
      'xmlns'
-
 
8816
    ]);
-
 
8817
    const xml = freeze([
-
 
8818
      'xlink:href',
-
 
8819
      'xml:id',
-
 
8820
      'xlink:title',
-
 
8821
      'xml:space',
-
 
8822
      'xmlns:xlink'
-
 
8823
    ]);
-
 
8824
    const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
9401
    const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
8825
    const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
9402
    const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
8826
    const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
9403
    const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
8827
    const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/);
9404
    const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
8828
    const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
9405
    const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
8829
    const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
9406
    const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
-
 
9407
    );
8830
    const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
9408
    const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
8831
    const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
9409
    const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
-
 
9410
    );
8832
    const DOCTYPE_NAME = seal(/^html$/i);
9411
    const DOCTYPE_NAME = seal(/^html$/i);
-
 
9412
    const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
-
 
9413
 
8833
    var EXPRESSIONS = Object.freeze({
9414
    var EXPRESSIONS = /*#__PURE__*/Object.freeze({
8834
      __proto__: null,
9415
      __proto__: null,
8835
      MUSTACHE_EXPR: MUSTACHE_EXPR,
-
 
8836
      ERB_EXPR: ERB_EXPR,
-
 
8837
      TMPLIT_EXPR: TMPLIT_EXPR,
-
 
8838
      DATA_ATTR: DATA_ATTR,
-
 
8839
      ARIA_ATTR: ARIA_ATTR,
9416
      ARIA_ATTR: ARIA_ATTR,
-
 
9417
      ATTR_WHITESPACE: ATTR_WHITESPACE,
-
 
9418
      CUSTOM_ELEMENT: CUSTOM_ELEMENT,
-
 
9419
      DATA_ATTR: DATA_ATTR,
-
 
9420
      DOCTYPE_NAME: DOCTYPE_NAME,
-
 
9421
      ERB_EXPR: ERB_EXPR,
8840
      IS_ALLOWED_URI: IS_ALLOWED_URI,
9422
      IS_ALLOWED_URI: IS_ALLOWED_URI,
8841
      IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
9423
      IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
8842
      ATTR_WHITESPACE: ATTR_WHITESPACE,
9424
      MUSTACHE_EXPR: MUSTACHE_EXPR,
8843
      DOCTYPE_NAME: DOCTYPE_NAME
9425
      TMPLIT_EXPR: TMPLIT_EXPR
8844
    });
9426
    });
-
 
9427
 
-
 
9428
    /* eslint-disable @typescript-eslint/indent */
-
 
9429
    // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
-
 
9430
    const NODE_TYPE = {
-
 
9431
      element: 1,
-
 
9432
      attribute: 2,
-
 
9433
      text: 3,
-
 
9434
      cdataSection: 4,
-
 
9435
      entityReference: 5,
-
 
9436
      // Deprecated
-
 
9437
      entityNode: 6,
-
 
9438
      // Deprecated
-
 
9439
      progressingInstruction: 7,
-
 
9440
      comment: 8,
-
 
9441
      document: 9,
-
 
9442
      documentType: 10,
-
 
9443
      documentFragment: 11,
-
 
9444
      notation: 12 // Deprecated
-
 
9445
    };
-
 
9446
    const getGlobal = function getGlobal() {
8845
    const getGlobal = () => typeof window === 'undefined' ? null : window;
9447
      return typeof window === 'undefined' ? null : window;
-
 
9448
    };
-
 
9449
    /**
-
 
9450
     * Creates a no-op policy for internal use only.
-
 
9451
     * Don't export this function outside this module!
-
 
9452
     * @param trustedTypes The policy factory.
-
 
9453
     * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
-
 
9454
     * @return The policy created (or null, if Trusted Types
-
 
9455
     * are not supported or creating the policy failed).
-
 
9456
     */
8846
    const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
9457
    const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
8847
      if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
9458
      if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
8848
        return null;
9459
        return null;
8849
      }
9460
      }
-
 
9461
      // Allow the callers to control the unique policy name
-
 
9462
      // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
-
 
9463
      // Policy creation with duplicate names throws in Trusted Types.
8850
      let suffix = null;
9464
      let suffix = null;
8851
      const ATTR_NAME = 'data-tt-policy-suffix';
9465
      const ATTR_NAME = 'data-tt-policy-suffix';
8852
      if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
9466
      if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
8853
        suffix = purifyHostElement.getAttribute(ATTR_NAME);
9467
        suffix = purifyHostElement.getAttribute(ATTR_NAME);
8854
      }
9468
      }
Línea 8861... Línea 9475...
8861
          createScriptURL(scriptUrl) {
9475
          createScriptURL(scriptUrl) {
8862
            return scriptUrl;
9476
            return scriptUrl;
8863
          }
9477
          }
8864
        });
9478
        });
8865
      } catch (_) {
9479
      } catch (_) {
-
 
9480
        // Policy creation failed (most likely another DOMPurify script has
-
 
9481
        // already run). Skip creating the policy, as this will only cause errors
-
 
9482
        // if TT are enforced.
8866
        console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
9483
        console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
8867
        return null;
9484
        return null;
8868
      }
9485
      }
8869
    };
9486
    };
-
 
9487
    const _createHooksMap = function _createHooksMap() {
-
 
9488
      return {
-
 
9489
        afterSanitizeAttributes: [],
-
 
9490
        afterSanitizeElements: [],
-
 
9491
        afterSanitizeShadowDOM: [],
-
 
9492
        beforeSanitizeAttributes: [],
-
 
9493
        beforeSanitizeElements: [],
-
 
9494
        beforeSanitizeShadowDOM: [],
-
 
9495
        uponSanitizeAttribute: [],
-
 
9496
        uponSanitizeElement: [],
-
 
9497
        uponSanitizeShadowNode: []
-
 
9498
      };
-
 
9499
    };
8870
    function createDOMPurify() {
9500
    function createDOMPurify() {
8871
      let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
9501
      let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
8872
      const DOMPurify = root => createDOMPurify(root);
9502
      const DOMPurify = root => createDOMPurify(root);
8873
      DOMPurify.version = '3.0.5';
9503
      DOMPurify.version = '3.2.4';
8874
      DOMPurify.removed = [];
9504
      DOMPurify.removed = [];
8875
      if (!window || !window.document || window.document.nodeType !== 9) {
9505
      if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
-
 
9506
        // Not running in a browser, provide a factory function
-
 
9507
        // so that you can pass your own Window
8876
        DOMPurify.isSupported = false;
9508
        DOMPurify.isSupported = false;
8877
        return DOMPurify;
9509
        return DOMPurify;
8878
      }
9510
      }
-
 
9511
      let {
-
 
9512
        document
-
 
9513
      } = window;
8879
      const originalDocument = window.document;
9514
      const originalDocument = document;
8880
      const currentScript = originalDocument.currentScript;
9515
      const currentScript = originalDocument.currentScript;
-
 
9516
      const {
8881
      let {document} = window;
9517
        DocumentFragment,
-
 
9518
        HTMLTemplateElement,
-
 
9519
        Node,
-
 
9520
        Element,
-
 
9521
        NodeFilter,
8882
      const {DocumentFragment, HTMLTemplateElement, Node, Element, NodeFilter, NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap, HTMLFormElement, DOMParser, trustedTypes} = window;
9522
        NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
-
 
9523
        HTMLFormElement,
-
 
9524
        DOMParser,
-
 
9525
        trustedTypes
-
 
9526
      } = window;
8883
      const ElementPrototype = Element.prototype;
9527
      const ElementPrototype = Element.prototype;
8884
      const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
9528
      const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
-
 
9529
      const remove = lookupGetter(ElementPrototype, 'remove');
8885
      const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
9530
      const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
8886
      const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
9531
      const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
8887
      const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
9532
      const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
-
 
9533
      // As per issue #47, the web-components registry is inherited by a
-
 
9534
      // new document created via createHTMLDocument. As per the spec
-
 
9535
      // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
-
 
9536
      // a new empty registry is used when creating a template contents owner
-
 
9537
      // document, so we use that as our parent document to ensure nothing
-
 
9538
      // is inherited.
8888
      if (typeof HTMLTemplateElement === 'function') {
9539
      if (typeof HTMLTemplateElement === 'function') {
8889
        const template = document.createElement('template');
9540
        const template = document.createElement('template');
8890
        if (template.content && template.content.ownerDocument) {
9541
        if (template.content && template.content.ownerDocument) {
8891
          document = template.content.ownerDocument;
9542
          document = template.content.ownerDocument;
8892
        }
9543
        }
8893
      }
9544
      }
8894
      let trustedTypesPolicy;
9545
      let trustedTypesPolicy;
8895
      let emptyHTML = '';
9546
      let emptyHTML = '';
-
 
9547
      const {
-
 
9548
        implementation,
-
 
9549
        createNodeIterator,
8896
      const {implementation, createNodeIterator, createDocumentFragment, getElementsByTagName} = document;
9550
        createDocumentFragment,
-
 
9551
        getElementsByTagName
-
 
9552
      } = document;
-
 
9553
      const {
-
 
9554
        importNode
8897
      const {importNode} = originalDocument;
9555
      } = originalDocument;
8898
      let hooks = {};
9556
      let hooks = _createHooksMap();
-
 
9557
      /**
-
 
9558
       * Expose whether this browser supports running the full DOMPurify.
-
 
9559
       */
8899
      DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
9560
      DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
-
 
9561
      const {
-
 
9562
        MUSTACHE_EXPR,
-
 
9563
        ERB_EXPR,
-
 
9564
        TMPLIT_EXPR,
-
 
9565
        DATA_ATTR,
-
 
9566
        ARIA_ATTR,
8900
      const {MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE} = EXPRESSIONS;
9567
        IS_SCRIPT_OR_DATA,
-
 
9568
        ATTR_WHITESPACE,
-
 
9569
        CUSTOM_ELEMENT
-
 
9570
      } = EXPRESSIONS;
-
 
9571
      let {
8901
      let {IS_ALLOWED_URI: IS_ALLOWED_URI$1} = EXPRESSIONS;
9572
        IS_ALLOWED_URI: IS_ALLOWED_URI$1
-
 
9573
      } = EXPRESSIONS;
-
 
9574
      /**
-
 
9575
       * We consider the elements and attributes below to be safe. Ideally
-
 
9576
       * don't add any new ones but feel free to remove unwanted ones.
-
 
9577
       */
-
 
9578
      /* allowed element names */
8902
      let ALLOWED_TAGS = null;
9579
      let ALLOWED_TAGS = null;
8903
      const DEFAULT_ALLOWED_TAGS = addToSet({}, [
9580
      const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text$1]);
8904
        ...html$1,
-
 
8905
        ...svg$1,
-
 
8906
        ...svgFilters,
9581
      /* Allowed attribute names */
8907
        ...mathMl$1,
-
 
8908
        ...text$1
-
 
8909
      ]);
-
 
8910
      let ALLOWED_ATTR = null;
9582
      let ALLOWED_ATTR = null;
8911
      const DEFAULT_ALLOWED_ATTR = addToSet({}, [
9583
      const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
8912
        ...html,
-
 
8913
        ...svg,
9584
      /*
8914
        ...mathMl,
9585
       * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
8915
        ...xml
-
 
-
 
9586
       * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
-
 
9587
       * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
-
 
9588
       * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
8916
      ]);
9589
       */
8917
      let CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
9590
      let CUSTOM_ELEMENT_HANDLING = Object.seal(create$1(null, {
8918
        tagNameCheck: {
9591
        tagNameCheck: {
8919
          writable: true,
9592
          writable: true,
8920
          configurable: false,
9593
          configurable: false,
8921
          enumerable: true,
9594
          enumerable: true,
8922
          value: null
9595
          value: null
Línea 8932... Línea 9605...
8932
          configurable: false,
9605
          configurable: false,
8933
          enumerable: true,
9606
          enumerable: true,
8934
          value: false
9607
          value: false
8935
        }
9608
        }
8936
      }));
9609
      }));
-
 
9610
      /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
8937
      let FORBID_TAGS = null;
9611
      let FORBID_TAGS = null;
-
 
9612
      /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
8938
      let FORBID_ATTR = null;
9613
      let FORBID_ATTR = null;
-
 
9614
      /* Decide if ARIA attributes are okay */
8939
      let ALLOW_ARIA_ATTR = true;
9615
      let ALLOW_ARIA_ATTR = true;
-
 
9616
      /* Decide if custom data attributes are okay */
8940
      let ALLOW_DATA_ATTR = true;
9617
      let ALLOW_DATA_ATTR = true;
-
 
9618
      /* Decide if unknown protocols are okay */
8941
      let ALLOW_UNKNOWN_PROTOCOLS = false;
9619
      let ALLOW_UNKNOWN_PROTOCOLS = false;
-
 
9620
      /* Decide if self-closing tags in attributes are allowed.
-
 
9621
       * Usually removed due to a mXSS issue in jQuery 3.0 */
8942
      let ALLOW_SELF_CLOSE_IN_ATTR = true;
9622
      let ALLOW_SELF_CLOSE_IN_ATTR = true;
-
 
9623
      /* Output should be safe for common template engines.
-
 
9624
       * This means, DOMPurify removes data attributes, mustaches and ERB
-
 
9625
       */
8943
      let SAFE_FOR_TEMPLATES = false;
9626
      let SAFE_FOR_TEMPLATES = false;
-
 
9627
      /* Output should be safe even for XML used within HTML and alike.
-
 
9628
       * This means, DOMPurify removes comments when containing risky content.
-
 
9629
       */
-
 
9630
      let SAFE_FOR_XML = true;
-
 
9631
      /* Decide if document with <html>... should be returned */
8944
      let WHOLE_DOCUMENT = false;
9632
      let WHOLE_DOCUMENT = false;
-
 
9633
      /* Track whether config is already set on this instance of DOMPurify. */
8945
      let SET_CONFIG = false;
9634
      let SET_CONFIG = false;
-
 
9635
      /* Decide if all elements (e.g. style, script) must be children of
-
 
9636
       * document.body. By default, browsers might move them to document.head */
8946
      let FORCE_BODY = false;
9637
      let FORCE_BODY = false;
-
 
9638
      /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
-
 
9639
       * string (or a TrustedHTML object if Trusted Types are supported).
-
 
9640
       * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
-
 
9641
       */
8947
      let RETURN_DOM = false;
9642
      let RETURN_DOM = false;
-
 
9643
      /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
-
 
9644
       * string  (or a TrustedHTML object if Trusted Types are supported) */
8948
      let RETURN_DOM_FRAGMENT = false;
9645
      let RETURN_DOM_FRAGMENT = false;
-
 
9646
      /* Try to return a Trusted Type object instead of a string, return a string in
-
 
9647
       * case Trusted Types are not supported  */
8949
      let RETURN_TRUSTED_TYPE = false;
9648
      let RETURN_TRUSTED_TYPE = false;
-
 
9649
      /* Output should be free from DOM clobbering attacks?
-
 
9650
       * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
-
 
9651
       */
8950
      let SANITIZE_DOM = true;
9652
      let SANITIZE_DOM = true;
-
 
9653
      /* Achieve full DOM Clobbering protection by isolating the namespace of named
-
 
9654
       * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
-
 
9655
       *
-
 
9656
       * HTML/DOM spec rules that enable DOM Clobbering:
-
 
9657
       *   - Named Access on Window (§7.3.3)
-
 
9658
       *   - DOM Tree Accessors (§3.1.5)
-
 
9659
       *   - Form Element Parent-Child Relations (§4.10.3)
-
 
9660
       *   - Iframe srcdoc / Nested WindowProxies (§4.8.5)
-
 
9661
       *   - HTMLCollection (§4.2.10.2)
-
 
9662
       *
-
 
9663
       * Namespace isolation is implemented by prefixing `id` and `name` attributes
-
 
9664
       * with a constant string, i.e., `user-content-`
-
 
9665
       */
8951
      let SANITIZE_NAMED_PROPS = false;
9666
      let SANITIZE_NAMED_PROPS = false;
8952
      const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
9667
      const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
-
 
9668
      /* Keep element content when removing element? */
8953
      let KEEP_CONTENT = true;
9669
      let KEEP_CONTENT = true;
-
 
9670
      /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
-
 
9671
       * of importing it into a new Document and returning a sanitized copy */
8954
      let IN_PLACE = false;
9672
      let IN_PLACE = false;
-
 
9673
      /* Allow usage of profiles like html, svg and mathMl */
8955
      let USE_PROFILES = {};
9674
      let USE_PROFILES = {};
-
 
9675
      /* Tags to ignore content of when KEEP_CONTENT is true */
8956
      let FORBID_CONTENTS = null;
9676
      let FORBID_CONTENTS = null;
8957
      const DEFAULT_FORBID_CONTENTS = addToSet({}, [
9677
      const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
8958
        'annotation-xml',
9678
      /* Tags that are safe for data: URIs */
8959
        'audio',
-
 
8960
        'colgroup',
-
 
8961
        'desc',
-
 
8962
        'foreignobject',
-
 
8963
        'head',
-
 
8964
        'iframe',
-
 
8965
        'math',
-
 
8966
        'mi',
-
 
8967
        'mn',
-
 
8968
        'mo',
-
 
8969
        'ms',
-
 
8970
        'mtext',
-
 
8971
        'noembed',
-
 
8972
        'noframes',
-
 
8973
        'noscript',
-
 
8974
        'plaintext',
-
 
8975
        'script',
-
 
8976
        'style',
-
 
8977
        'svg',
-
 
8978
        'template',
-
 
8979
        'thead',
-
 
8980
        'title',
-
 
8981
        'video',
-
 
8982
        'xmp'
-
 
8983
      ]);
-
 
8984
      let DATA_URI_TAGS = null;
9679
      let DATA_URI_TAGS = null;
8985
      const DEFAULT_DATA_URI_TAGS = addToSet({}, [
9680
      const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
8986
        'audio',
-
 
8987
        'video',
-
 
8988
        'img',
-
 
8989
        'source',
9681
      /* Attributes safe for values like "javascript:" */
8990
        'image',
-
 
8991
        'track'
-
 
8992
      ]);
-
 
8993
      let URI_SAFE_ATTRIBUTES = null;
9682
      let URI_SAFE_ATTRIBUTES = null;
8994
      const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
9683
      const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
8995
        'alt',
-
 
8996
        'class',
-
 
8997
        'for',
-
 
8998
        'id',
-
 
8999
        'label',
-
 
9000
        'name',
-
 
9001
        'pattern',
-
 
9002
        'placeholder',
-
 
9003
        'role',
-
 
9004
        'summary',
-
 
9005
        'title',
-
 
9006
        'value',
-
 
9007
        'style',
-
 
9008
        'xmlns'
-
 
9009
      ]);
-
 
9010
      const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
9684
      const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
9011
      const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
9685
      const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
9012
      const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
9686
      const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
-
 
9687
      /* Document namespace */
9013
      let NAMESPACE = HTML_NAMESPACE;
9688
      let NAMESPACE = HTML_NAMESPACE;
9014
      let IS_EMPTY_INPUT = false;
9689
      let IS_EMPTY_INPUT = false;
-
 
9690
      /* Allowed XHTML+XML namespaces */
9015
      let ALLOWED_NAMESPACES = null;
9691
      let ALLOWED_NAMESPACES = null;
-
 
9692
      const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
-
 
9693
      let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
9016
      const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
9694
      let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
9017
        MATHML_NAMESPACE,
9695
      // Certain elements are allowed in both SVG and HTML
9018
        SVG_NAMESPACE,
9696
      // namespace. We need to specify them explicitly
-
 
9697
      // so that they don't get erroneously deleted from
9019
        HTML_NAMESPACE
9698
      // HTML namespace.
-
 
9699
      const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
9020
      ], stringToString);
9700
      /* Parsing of strict XHTML documents */
9021
      let PARSER_MEDIA_TYPE;
9701
      let PARSER_MEDIA_TYPE = null;
9022
      const SUPPORTED_PARSER_MEDIA_TYPES = [
9702
      const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
9023
        'application/xhtml+xml',
-
 
9024
        'text/html'
-
 
9025
      ];
-
 
9026
      const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
9703
      const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
9027
      let transformCaseFunc;
9704
      let transformCaseFunc = null;
-
 
9705
      /* Keep a reference to config to pass to hooks */
9028
      let CONFIG = null;
9706
      let CONFIG = null;
-
 
9707
      /* Ideally, do not touch anything below this line */
-
 
9708
      /* ______________________________________________ */
9029
      const formElement = document.createElement('form');
9709
      const formElement = document.createElement('form');
9030
      const isRegexOrFunction = function isRegexOrFunction(testValue) {
9710
      const isRegexOrFunction = function isRegexOrFunction(testValue) {
9031
        return testValue instanceof RegExp || testValue instanceof Function;
9711
        return testValue instanceof RegExp || testValue instanceof Function;
9032
      };
9712
      };
-
 
9713
      /**
-
 
9714
       * _parseConfig
-
 
9715
       *
-
 
9716
       * @param cfg optional config literal
-
 
9717
       */
-
 
9718
      // eslint-disable-next-line complexity
9033
      const _parseConfig = function _parseConfig(cfg) {
9719
      const _parseConfig = function _parseConfig() {
-
 
9720
        let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9034
        if (CONFIG && CONFIG === cfg) {
9721
        if (CONFIG && CONFIG === cfg) {
9035
          return;
9722
          return;
9036
        }
9723
        }
-
 
9724
        /* Shield configuration object from tampering */
9037
        if (!cfg || typeof cfg !== 'object') {
9725
        if (!cfg || typeof cfg !== 'object') {
9038
          cfg = {};
9726
          cfg = {};
9039
        }
9727
        }
-
 
9728
        /* Shield configuration object from prototype pollution */
9040
        cfg = clone(cfg);
9729
        cfg = clone(cfg);
-
 
9730
        PARSER_MEDIA_TYPE =
-
 
9731
        // eslint-disable-next-line unicorn/prefer-includes
9041
        PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;
9732
        SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
-
 
9733
        // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
9042
        transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
9734
        transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
-
 
9735
        /* Set configuration parameters */
9043
        ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
9736
        ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
9044
        ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
9737
        ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
9045
        ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
9738
        ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
9046
        URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
9739
        URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
9047
        DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
9740
        DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
9048
        FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
9741
        FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
9049
        FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
9742
        FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
9050
        FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
9743
        FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
9051
        USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
9744
        USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
9052
        ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
9745
        ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
9053
        ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
9746
        ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
9054
        ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
9747
        ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
9055
        ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
9748
        ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
9056
        SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
9749
        SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
-
 
9750
        SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
9057
        WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
9751
        WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
9058
        RETURN_DOM = cfg.RETURN_DOM || false;
9752
        RETURN_DOM = cfg.RETURN_DOM || false; // Default false
9059
        RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
9753
        RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
9060
        RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
9754
        RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
9061
        FORCE_BODY = cfg.FORCE_BODY || false;
9755
        FORCE_BODY = cfg.FORCE_BODY || false; // Default false
9062
        SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
9756
        SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
9063
        SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
9757
        SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
9064
        KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
9758
        KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
9065
        IN_PLACE = cfg.IN_PLACE || false;
9759
        IN_PLACE = cfg.IN_PLACE || false; // Default false
9066
        IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
9760
        IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
9067
        NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
9761
        NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
-
 
9762
        MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
-
 
9763
        HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
9068
        CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
9764
        CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
9069
        if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
9765
        if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
9070
          CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
9766
          CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
9071
        }
9767
        }
9072
        if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
9768
        if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
Línea 9079... Línea 9775...
9079
          ALLOW_DATA_ATTR = false;
9775
          ALLOW_DATA_ATTR = false;
9080
        }
9776
        }
9081
        if (RETURN_DOM_FRAGMENT) {
9777
        if (RETURN_DOM_FRAGMENT) {
9082
          RETURN_DOM = true;
9778
          RETURN_DOM = true;
9083
        }
9779
        }
-
 
9780
        /* Parse profile info */
9084
        if (USE_PROFILES) {
9781
        if (USE_PROFILES) {
9085
          ALLOWED_TAGS = addToSet({}, [...text$1]);
9782
          ALLOWED_TAGS = addToSet({}, text$1);
9086
          ALLOWED_ATTR = [];
9783
          ALLOWED_ATTR = [];
9087
          if (USE_PROFILES.html === true) {
9784
          if (USE_PROFILES.html === true) {
9088
            addToSet(ALLOWED_TAGS, html$1);
9785
            addToSet(ALLOWED_TAGS, html$1);
9089
            addToSet(ALLOWED_ATTR, html);
9786
            addToSet(ALLOWED_ATTR, html);
9090
          }
9787
          }
Línea 9102... Línea 9799...
9102
            addToSet(ALLOWED_TAGS, mathMl$1);
9799
            addToSet(ALLOWED_TAGS, mathMl$1);
9103
            addToSet(ALLOWED_ATTR, mathMl);
9800
            addToSet(ALLOWED_ATTR, mathMl);
9104
            addToSet(ALLOWED_ATTR, xml);
9801
            addToSet(ALLOWED_ATTR, xml);
9105
          }
9802
          }
9106
        }
9803
        }
-
 
9804
        /* Merge configuration parameters */
9107
        if (cfg.ADD_TAGS) {
9805
        if (cfg.ADD_TAGS) {
9108
          if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
9806
          if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
9109
            ALLOWED_TAGS = clone(ALLOWED_TAGS);
9807
            ALLOWED_TAGS = clone(ALLOWED_TAGS);
9110
          }
9808
          }
9111
          addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
9809
          addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
Línea 9123... Línea 9821...
9123
          if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
9821
          if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
9124
            FORBID_CONTENTS = clone(FORBID_CONTENTS);
9822
            FORBID_CONTENTS = clone(FORBID_CONTENTS);
9125
          }
9823
          }
9126
          addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
9824
          addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
9127
        }
9825
        }
-
 
9826
        /* Add #text in case KEEP_CONTENT is set to true */
9128
        if (KEEP_CONTENT) {
9827
        if (KEEP_CONTENT) {
9129
          ALLOWED_TAGS['#text'] = true;
9828
          ALLOWED_TAGS['#text'] = true;
9130
        }
9829
        }
-
 
9830
        /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
9131
        if (WHOLE_DOCUMENT) {
9831
        if (WHOLE_DOCUMENT) {
9132
          addToSet(ALLOWED_TAGS, [
9832
          addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
9133
            'html',
-
 
9134
            'head',
-
 
9135
            'body'
-
 
9136
          ]);
-
 
9137
        }
9833
        }
-
 
9834
        /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
9138
        if (ALLOWED_TAGS.table) {
9835
        if (ALLOWED_TAGS.table) {
9139
          addToSet(ALLOWED_TAGS, ['tbody']);
9836
          addToSet(ALLOWED_TAGS, ['tbody']);
9140
          delete FORBID_TAGS.tbody;
9837
          delete FORBID_TAGS.tbody;
9141
        }
9838
        }
9142
        if (cfg.TRUSTED_TYPES_POLICY) {
9839
        if (cfg.TRUSTED_TYPES_POLICY) {
Línea 9144... Línea 9841...
9144
            throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
9841
            throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
9145
          }
9842
          }
9146
          if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
9843
          if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
9147
            throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
9844
            throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
9148
          }
9845
          }
-
 
9846
          // Overwrite existing TrustedTypes policy.
9149
          trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
9847
          trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
-
 
9848
          // Sign local variables required by `sanitize`.
9150
          emptyHTML = trustedTypesPolicy.createHTML('');
9849
          emptyHTML = trustedTypesPolicy.createHTML('');
9151
        } else {
9850
        } else {
-
 
9851
          // Uninitialized policy, attempt to initialize the internal dompurify policy.
9152
          if (trustedTypesPolicy === undefined) {
9852
          if (trustedTypesPolicy === undefined) {
9153
            trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
9853
            trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
9154
          }
9854
          }
-
 
9855
          // If creating the internal policy succeeded sign internal variables.
9155
          if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
9856
          if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
9156
            emptyHTML = trustedTypesPolicy.createHTML('');
9857
            emptyHTML = trustedTypesPolicy.createHTML('');
9157
          }
9858
          }
9158
        }
9859
        }
-
 
9860
        // Prevent further manipulation of configuration.
-
 
9861
        // Not available in IE8, Safari 5, etc.
9159
        if (freeze) {
9862
        if (freeze) {
9160
          freeze(cfg);
9863
          freeze(cfg);
9161
        }
9864
        }
9162
        CONFIG = cfg;
9865
        CONFIG = cfg;
9163
      };
9866
      };
9164
      const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [
9867
      /* Keep track of all possible SVG and MathML tags
9165
        'mi',
-
 
9166
        'mo',
-
 
9167
        'mn',
-
 
9168
        'ms',
-
 
9169
        'mtext'
-
 
9170
      ]);
-
 
9171
      const HTML_INTEGRATION_POINTS = addToSet({}, [
9868
       * so that we can perform the namespace checks
9172
        'foreignobject',
-
 
9173
        'desc',
-
 
9174
        'title',
9869
       * correctly. */
9175
        'annotation-xml'
9870
      const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
9176
      ]);
-
 
9177
      const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
9871
      const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
9178
        'title',
-
 
9179
        'style',
-
 
9180
        'font',
-
 
9181
        'a',
-
 
9182
        'script'
-
 
9183
      ]);
9872
      /**
9184
      const ALL_SVG_TAGS = addToSet({}, svg$1);
9873
       * @param element a DOM element whose namespace is being checked
9185
      addToSet(ALL_SVG_TAGS, svgFilters);
9874
       * @returns Return false if the element has a
9186
      addToSet(ALL_SVG_TAGS, svgDisallowed);
9875
       *  namespace that a spec-compliant parser would never
9187
      const ALL_MATHML_TAGS = addToSet({}, mathMl$1);
9876
       *  return. Return true otherwise.
9188
      addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
9877
       */
9189
      const _checkValidNamespace = function _checkValidNamespace(element) {
9878
      const _checkValidNamespace = function _checkValidNamespace(element) {
9190
        let parent = getParentNode(element);
9879
        let parent = getParentNode(element);
-
 
9880
        // In JSDOM, if we're inside shadow DOM, then parentNode
-
 
9881
        // can be null. We just simulate parent in this case.
9191
        if (!parent || !parent.tagName) {
9882
        if (!parent || !parent.tagName) {
9192
          parent = {
9883
          parent = {
9193
            namespaceURI: NAMESPACE,
9884
            namespaceURI: NAMESPACE,
9194
            tagName: 'template'
9885
            tagName: 'template'
9195
          };
9886
          };
Línea 9198... Línea 9889...
9198
        const parentTagName = stringToLowerCase(parent.tagName);
9889
        const parentTagName = stringToLowerCase(parent.tagName);
9199
        if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
9890
        if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
9200
          return false;
9891
          return false;
9201
        }
9892
        }
9202
        if (element.namespaceURI === SVG_NAMESPACE) {
9893
        if (element.namespaceURI === SVG_NAMESPACE) {
-
 
9894
          // The only way to switch from HTML namespace to SVG
-
 
9895
          // is via <svg>. If it happens via any other tag, then
-
 
9896
          // it should be killed.
9203
          if (parent.namespaceURI === HTML_NAMESPACE) {
9897
          if (parent.namespaceURI === HTML_NAMESPACE) {
9204
            return tagName === 'svg';
9898
            return tagName === 'svg';
9205
          }
9899
          }
-
 
9900
          // The only way to switch from MathML to SVG is via`
-
 
9901
          // svg if parent is either <annotation-xml> or MathML
-
 
9902
          // text integration points.
9206
          if (parent.namespaceURI === MATHML_NAMESPACE) {
9903
          if (parent.namespaceURI === MATHML_NAMESPACE) {
9207
            return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
9904
            return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
9208
          }
9905
          }
-
 
9906
          // We only allow elements that are defined in SVG
-
 
9907
          // spec. All others are disallowed in SVG namespace.
9209
          return Boolean(ALL_SVG_TAGS[tagName]);
9908
          return Boolean(ALL_SVG_TAGS[tagName]);
9210
        }
9909
        }
9211
        if (element.namespaceURI === MATHML_NAMESPACE) {
9910
        if (element.namespaceURI === MATHML_NAMESPACE) {
-
 
9911
          // The only way to switch from HTML namespace to MathML
-
 
9912
          // is via <math>. If it happens via any other tag, then
-
 
9913
          // it should be killed.
9212
          if (parent.namespaceURI === HTML_NAMESPACE) {
9914
          if (parent.namespaceURI === HTML_NAMESPACE) {
9213
            return tagName === 'math';
9915
            return tagName === 'math';
9214
          }
9916
          }
-
 
9917
          // The only way to switch from SVG to MathML is via
-
 
9918
          // <math> and HTML integration points
9215
          if (parent.namespaceURI === SVG_NAMESPACE) {
9919
          if (parent.namespaceURI === SVG_NAMESPACE) {
9216
            return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
9920
            return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
9217
          }
9921
          }
-
 
9922
          // We only allow elements that are defined in MathML
-
 
9923
          // spec. All others are disallowed in MathML namespace.
9218
          return Boolean(ALL_MATHML_TAGS[tagName]);
9924
          return Boolean(ALL_MATHML_TAGS[tagName]);
9219
        }
9925
        }
9220
        if (element.namespaceURI === HTML_NAMESPACE) {
9926
        if (element.namespaceURI === HTML_NAMESPACE) {
-
 
9927
          // The only way to switch from SVG to HTML is via
-
 
9928
          // HTML integration points, and from MathML to HTML
-
 
9929
          // is via MathML text integration points
9221
          if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
9930
          if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
9222
            return false;
9931
            return false;
9223
          }
9932
          }
9224
          if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
9933
          if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
9225
            return false;
9934
            return false;
9226
          }
9935
          }
-
 
9936
          // We disallow tags that are specific for MathML
-
 
9937
          // or SVG and should never appear in HTML namespace
9227
          return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
9938
          return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
9228
        }
9939
        }
-
 
9940
        // For XHTML and XML documents that support custom namespaces
9229
        if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
9941
        if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
9230
          return true;
9942
          return true;
9231
        }
9943
        }
-
 
9944
        // The code should never reach this place (this means
-
 
9945
        // that the element somehow got namespace that is not
-
 
9946
        // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
-
 
9947
        // Return false just in case.
9232
        return false;
9948
        return false;
9233
      };
9949
      };
-
 
9950
      /**
-
 
9951
       * _forceRemove
-
 
9952
       *
-
 
9953
       * @param node a DOM node
-
 
9954
       */
9234
      const _forceRemove = function _forceRemove(node) {
9955
      const _forceRemove = function _forceRemove(node) {
9235
        arrayPush(DOMPurify.removed, { element: node });
9956
        arrayPush(DOMPurify.removed, {
-
 
9957
          element: node
-
 
9958
        });
9236
        try {
9959
        try {
-
 
9960
          // eslint-disable-next-line unicorn/prefer-dom-node-remove
9237
          node.parentNode.removeChild(node);
9961
          getParentNode(node).removeChild(node);
9238
        } catch (_) {
9962
        } catch (_) {
9239
          node.remove();
9963
          remove(node);
9240
        }
9964
        }
9241
      };
9965
      };
-
 
9966
      /**
-
 
9967
       * _removeAttribute
-
 
9968
       *
-
 
9969
       * @param name an Attribute name
-
 
9970
       * @param element a DOM node
-
 
9971
       */
9242
      const _removeAttribute = function _removeAttribute(name, node) {
9972
      const _removeAttribute = function _removeAttribute(name, element) {
9243
        try {
9973
        try {
9244
          arrayPush(DOMPurify.removed, {
9974
          arrayPush(DOMPurify.removed, {
9245
            attribute: node.getAttributeNode(name),
9975
            attribute: element.getAttributeNode(name),
9246
            from: node
9976
            from: element
9247
          });
9977
          });
9248
        } catch (_) {
9978
        } catch (_) {
9249
          arrayPush(DOMPurify.removed, {
9979
          arrayPush(DOMPurify.removed, {
9250
            attribute: null,
9980
            attribute: null,
9251
            from: node
9981
            from: element
9252
          });
9982
          });
9253
        }
9983
        }
9254
        node.removeAttribute(name);
9984
        element.removeAttribute(name);
-
 
9985
        // We void attribute values for unremovable "is" attributes
9255
        if (name === 'is' && !ALLOWED_ATTR[name]) {
9986
        if (name === 'is') {
9256
          if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
9987
          if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
9257
            try {
9988
            try {
9258
              _forceRemove(node);
9989
              _forceRemove(element);
9259
            } catch (_) {
9990
            } catch (_) {}
9260
            }
-
 
9261
          } else {
9991
          } else {
9262
            try {
9992
            try {
9263
              node.setAttribute(name, '');
9993
              element.setAttribute(name, '');
9264
            } catch (_) {
9994
            } catch (_) {}
9265
            }
-
 
9266
          }
9995
          }
9267
        }
9996
        }
9268
      };
9997
      };
-
 
9998
      /**
-
 
9999
       * _initDocument
-
 
10000
       *
-
 
10001
       * @param dirty - a string of dirty markup
-
 
10002
       * @return a DOM, filled with the dirty markup
-
 
10003
       */
9269
      const _initDocument = function _initDocument(dirty) {
10004
      const _initDocument = function _initDocument(dirty) {
-
 
10005
        /* Create a HTML document */
9270
        let doc;
10006
        let doc = null;
9271
        let leadingWhitespace;
10007
        let leadingWhitespace = null;
9272
        if (FORCE_BODY) {
10008
        if (FORCE_BODY) {
9273
          dirty = '<remove></remove>' + dirty;
10009
          dirty = '<remove></remove>' + dirty;
9274
        } else {
10010
        } else {
-
 
10011
          /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
9275
          const matches = stringMatch(dirty, /^[\r\n\t ]+/);
10012
          const matches = stringMatch(dirty, /^[\r\n\t ]+/);
9276
          leadingWhitespace = matches && matches[0];
10013
          leadingWhitespace = matches && matches[0];
9277
        }
10014
        }
9278
        if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
10015
        if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
-
 
10016
          // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
9279
          dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
10017
          dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
9280
        }
10018
        }
9281
        const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
10019
        const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
-
 
10020
        /*
-
 
10021
         * Use the DOMParser API by default, fallback later if needs be
-
 
10022
         * DOMParser not work for svg when has multiple root element.
-
 
10023
         */
9282
        if (NAMESPACE === HTML_NAMESPACE) {
10024
        if (NAMESPACE === HTML_NAMESPACE) {
9283
          try {
10025
          try {
9284
            doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
10026
            doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
9285
          } catch (_) {
10027
          } catch (_) {}
9286
          }
-
 
9287
        }
10028
        }
-
 
10029
        /* Use createHTMLDocument in case DOMParser is not available */
9288
        if (!doc || !doc.documentElement) {
10030
        if (!doc || !doc.documentElement) {
9289
          doc = implementation.createDocument(NAMESPACE, 'template', null);
10031
          doc = implementation.createDocument(NAMESPACE, 'template', null);
9290
          try {
10032
          try {
9291
            doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
10033
            doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
9292
          } catch (_) {
10034
          } catch (_) {
-
 
10035
            // Syntax error if dirtyPayload is invalid xml
9293
          }
10036
          }
9294
        }
10037
        }
9295
        const body = doc.body || doc.documentElement;
10038
        const body = doc.body || doc.documentElement;
9296
        if (dirty && leadingWhitespace) {
10039
        if (dirty && leadingWhitespace) {
9297
          body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
10040
          body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
9298
        }
10041
        }
-
 
10042
        /* Work on whole document or just its body */
9299
        if (NAMESPACE === HTML_NAMESPACE) {
10043
        if (NAMESPACE === HTML_NAMESPACE) {
9300
          return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
10044
          return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
9301
        }
10045
        }
9302
        return WHOLE_DOCUMENT ? doc.documentElement : body;
10046
        return WHOLE_DOCUMENT ? doc.documentElement : body;
9303
      };
10047
      };
-
 
10048
      /**
-
 
10049
       * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
-
 
10050
       *
-
 
10051
       * @param root The root element or node to start traversing on.
-
 
10052
       * @return The created NodeIterator
-
 
10053
       */
9304
      const _createIterator = function _createIterator(root) {
10054
      const _createNodeIterator = function _createNodeIterator(root) {
-
 
10055
        return createNodeIterator.call(root.ownerDocument || root, root,
-
 
10056
        // eslint-disable-next-line no-bitwise
9305
        return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
10057
        NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
9306
      };
10058
      };
-
 
10059
      /**
-
 
10060
       * _isClobbered
-
 
10061
       *
-
 
10062
       * @param element element to check for clobbering attacks
-
 
10063
       * @return true if clobbered, false if safe
-
 
10064
       */
9307
      const _isClobbered = function _isClobbered(elm) {
10065
      const _isClobbered = function _isClobbered(element) {
9308
        return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
10066
        return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');
9309
      };
10067
      };
-
 
10068
      /**
-
 
10069
       * Checks whether the given object is a DOM node.
-
 
10070
       *
-
 
10071
       * @param value object to check whether it's a DOM node
-
 
10072
       * @return true is object is a DOM node
-
 
10073
       */
9310
      const _isNode = function _isNode(object) {
10074
      const _isNode = function _isNode(value) {
9311
        return typeof Node === 'object' ? object instanceof Node : object && typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
10075
        return typeof Node === 'function' && value instanceof Node;
9312
      };
10076
      };
9313
      const _executeHook = function _executeHook(entryPoint, currentNode, data) {
10077
      function _executeHooks(hooks, currentNode, data) {
9314
        if (!hooks[entryPoint]) {
-
 
9315
          return;
-
 
9316
        }
-
 
9317
        arrayForEach(hooks[entryPoint], hook => {
10078
        arrayForEach(hooks, hook => {
9318
          hook.call(DOMPurify, currentNode, data, CONFIG);
10079
          hook.call(DOMPurify, currentNode, data, CONFIG);
9319
        });
10080
        });
9320
      };
10081
      }
-
 
10082
      /**
-
 
10083
       * _sanitizeElements
-
 
10084
       *
-
 
10085
       * @protect nodeName
-
 
10086
       * @protect textContent
-
 
10087
       * @protect removeChild
-
 
10088
       * @param currentNode to check for permission to exist
-
 
10089
       * @return true if node was killed, false if left alive
-
 
10090
       */
9321
      const _sanitizeElements = function _sanitizeElements(currentNode) {
10091
      const _sanitizeElements = function _sanitizeElements(currentNode) {
9322
        let content;
10092
        let content = null;
-
 
10093
        /* Execute a hook if present */
9323
        _executeHook('beforeSanitizeElements', currentNode, null);
10094
        _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
-
 
10095
        /* Check if element is clobbered or can clobber */
9324
        if (_isClobbered(currentNode)) {
10096
        if (_isClobbered(currentNode)) {
9325
          _forceRemove(currentNode);
10097
          _forceRemove(currentNode);
9326
          return true;
10098
          return true;
9327
        }
10099
        }
-
 
10100
        /* Now let's check the element's type and name */
9328
        const tagName = transformCaseFunc(currentNode.nodeName);
10101
        const tagName = transformCaseFunc(currentNode.nodeName);
-
 
10102
        /* Execute a hook if present */
9329
        _executeHook('uponSanitizeElement', currentNode, {
10103
        _executeHooks(hooks.uponSanitizeElement, currentNode, {
9330
          tagName,
10104
          tagName,
9331
          allowedTags: ALLOWED_TAGS
10105
          allowedTags: ALLOWED_TAGS
9332
        });
10106
        });
-
 
10107
        /* Detect mXSS attempts abusing namespace confusion */
9333
        if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
10108
        if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
-
 
10109
          _forceRemove(currentNode);
-
 
10110
          return true;
-
 
10111
        }
-
 
10112
        /* Remove any occurrence of processing instructions */
-
 
10113
        if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
9334
          _forceRemove(currentNode);
10114
          _forceRemove(currentNode);
9335
          return true;
10115
          return true;
9336
        }
10116
        }
-
 
10117
        /* Remove any kind of possibly harmful comments */
-
 
10118
        if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
-
 
10119
          _forceRemove(currentNode);
-
 
10120
          return true;
-
 
10121
        }
-
 
10122
        /* Remove element if anything forbids its presence */
9337
        if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
10123
        if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
-
 
10124
          /* Check if we have a custom element to handle */
9338
          if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
10125
          if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
9339
            if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName))
10126
            if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
9340
              return false;
10127
              return false;
-
 
10128
            }
9341
            if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName))
10129
            if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
9342
              return false;
10130
              return false;
-
 
10131
            }
9343
          }
10132
          }
-
 
10133
          /* Keep content except for bad-listed elements */
9344
          if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
10134
          if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
9345
            const parentNode = getParentNode(currentNode) || currentNode.parentNode;
10135
            const parentNode = getParentNode(currentNode) || currentNode.parentNode;
9346
            const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
10136
            const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
9347
            if (childNodes && parentNode) {
10137
            if (childNodes && parentNode) {
9348
              const childCount = childNodes.length;
10138
              const childCount = childNodes.length;
9349
              for (let i = childCount - 1; i >= 0; --i) {
10139
              for (let i = childCount - 1; i >= 0; --i) {
-
 
10140
                const childClone = cloneNode(childNodes[i], true);
-
 
10141
                childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
9350
                parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
10142
                parentNode.insertBefore(childClone, getNextSibling(currentNode));
9351
              }
10143
              }
9352
            }
10144
            }
9353
          }
10145
          }
9354
          _forceRemove(currentNode);
10146
          _forceRemove(currentNode);
9355
          return true;
10147
          return true;
9356
        }
10148
        }
-
 
10149
        /* Check whether element has a valid namespace */
9357
        if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
10150
        if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
9358
          _forceRemove(currentNode);
10151
          _forceRemove(currentNode);
9359
          return true;
10152
          return true;
9360
        }
10153
        }
-
 
10154
        /* Make sure that older browsers don't get fallback-tag mXSS */
9361
        if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
10155
        if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
9362
          _forceRemove(currentNode);
10156
          _forceRemove(currentNode);
9363
          return true;
10157
          return true;
9364
        }
10158
        }
-
 
10159
        /* Sanitize element content to be template-safe */
9365
        if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
10160
        if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
-
 
10161
          /* Get the element's text content */
9366
          content = currentNode.textContent;
10162
          content = currentNode.textContent;
9367
          content = stringReplace(content, MUSTACHE_EXPR, ' ');
10163
          arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
9368
          content = stringReplace(content, ERB_EXPR, ' ');
10164
            content = stringReplace(content, expr, ' ');
9369
          content = stringReplace(content, TMPLIT_EXPR, ' ');
10165
          });
9370
          if (currentNode.textContent !== content) {
10166
          if (currentNode.textContent !== content) {
-
 
10167
            arrayPush(DOMPurify.removed, {
9371
            arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
10168
              element: currentNode.cloneNode()
-
 
10169
            });
9372
            currentNode.textContent = content;
10170
            currentNode.textContent = content;
9373
          }
10171
          }
9374
        }
10172
        }
-
 
10173
        /* Execute a hook if present */
9375
        _executeHook('afterSanitizeElements', currentNode, null);
10174
        _executeHooks(hooks.afterSanitizeElements, currentNode, null);
9376
        return false;
10175
        return false;
9377
      };
10176
      };
-
 
10177
      /**
-
 
10178
       * _isValidAttribute
-
 
10179
       *
-
 
10180
       * @param lcTag Lowercase tag name of containing element.
-
 
10181
       * @param lcName Lowercase attribute name.
-
 
10182
       * @param value Attribute value.
-
 
10183
       * @return Returns true if `value` is valid, otherwise false.
-
 
10184
       */
-
 
10185
      // eslint-disable-next-line complexity
9378
      const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
10186
      const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
-
 
10187
        /* Make sure attribute cannot clobber */
9379
        if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
10188
        if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
9380
          return false;
10189
          return false;
9381
        }
10190
        }
9382
        if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName));
10191
        /* Allow valid data-* attributes: At least one character after "-"
-
 
10192
            (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
-
 
10193
            XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
9383
        else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName));
10194
            We don't need to check the value; it's always URI safe. */
-
 
10195
        if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
-
 
10196
          if (
-
 
10197
          // First condition does a very basic check if a) it's basically a valid custom element tagname AND
-
 
10198
          // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
-
 
10199
          // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
9384
        else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
10200
          _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
-
 
10201
          // Alternative, second condition checks if it's an `is`-attribute, AND
9385
          if (_basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)));
10202
          // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
9386
          else {
10203
          lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
9387
            return false;
10204
            return false;
9388
          }
10205
          }
9389
        } else if (URI_SAFE_ATTRIBUTES[lcName]);
10206
          /* Check value is safe. First, is attr inert? If so, is safe */
9390
        else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, '')));
-
 
9391
        else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]);
10207
        } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
9392
        else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, '')));
-
 
9393
        else if (value) {
-
 
9394
          return false;
10208
          return false;
9395
        } else ;
10209
        } else ;
9396
        return true;
10210
        return true;
9397
      };
10211
      };
-
 
10212
      /**
-
 
10213
       * _isBasicCustomElement
-
 
10214
       * checks if at least one dash is included in tagName, and it's not the first char
-
 
10215
       * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
-
 
10216
       *
-
 
10217
       * @param tagName name of the tag of the node to sanitize
-
 
10218
       * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
-
 
10219
       */
9398
      const _basicCustomElementTest = function _basicCustomElementTest(tagName) {
10220
      const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
9399
        return tagName.indexOf('-') > 0;
10221
        return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
9400
      };
10222
      };
-
 
10223
      /**
-
 
10224
       * _sanitizeAttributes
-
 
10225
       *
-
 
10226
       * @protect attributes
-
 
10227
       * @protect nodeName
-
 
10228
       * @protect removeAttribute
-
 
10229
       * @protect setAttribute
-
 
10230
       *
-
 
10231
       * @param currentNode to sanitize
-
 
10232
       */
9401
      const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
10233
      const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
9402
        let attr;
10234
        /* Execute a hook if present */
-
 
10235
        _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
9403
        let value;
10236
        const {
9404
        let lcName;
10237
          attributes
9405
        let l;
10238
        } = currentNode;
9406
        _executeHook('beforeSanitizeAttributes', currentNode, null);
10239
        /* Check if we have attributes; if not we might have a text node */
9407
        const {attributes} = currentNode;
10240
        if (!attributes || _isClobbered(currentNode)) {
9408
        if (!attributes) {
-
 
9409
          return;
10241
          return;
9410
        }
10242
        }
9411
        const hookEvent = {
10243
        const hookEvent = {
9412
          attrName: '',
10244
          attrName: '',
9413
          attrValue: '',
10245
          attrValue: '',
9414
          keepAttr: true,
10246
          keepAttr: true,
9415
          allowedAttributes: ALLOWED_ATTR
10247
          allowedAttributes: ALLOWED_ATTR,
-
 
10248
          forceKeepAttr: undefined
9416
        };
10249
        };
9417
        l = attributes.length;
10250
        let l = attributes.length;
-
 
10251
        /* Go backwards over all attributes; safely remove bad ones */
9418
        while (l--) {
10252
        while (l--) {
9419
          attr = attributes[l];
10253
          const attr = attributes[l];
-
 
10254
          const {
-
 
10255
            name,
-
 
10256
            namespaceURI,
-
 
10257
            value: attrValue
-
 
10258
          } = attr;
9420
          const {name, namespaceURI} = attr;
10259
          const lcName = transformCaseFunc(name);
9421
          value = name === 'value' ? attr.value : stringTrim(attr.value);
10260
          let value = name === 'value' ? attrValue : stringTrim(attrValue);
9422
          const initValue = value;
10261
          const initValue = value;
9423
          lcName = transformCaseFunc(name);
10262
          /* Execute a hook if present */
9424
          hookEvent.attrName = lcName;
10263
          hookEvent.attrName = lcName;
9425
          hookEvent.attrValue = value;
10264
          hookEvent.attrValue = value;
9426
          hookEvent.keepAttr = true;
10265
          hookEvent.keepAttr = true;
9427
          hookEvent.forceKeepAttr = undefined;
10266
          hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
9428
          _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
10267
          _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
9429
          value = hookEvent.attrValue;
10268
          value = hookEvent.attrValue;
-
 
10269
          /* Full DOM Clobbering protection via namespace isolation,
-
 
10270
           * Prefix id and name attributes with `user-content-`
-
 
10271
           */
-
 
10272
          if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
-
 
10273
            // Remove the attribute with this value
-
 
10274
            _removeAttribute(name, currentNode);
-
 
10275
            // Prefix the value and later re-create the attribute with the sanitized value
-
 
10276
            value = SANITIZE_NAMED_PROPS_PREFIX + value;
-
 
10277
          }
-
 
10278
          /* Work around a security issue with comments inside attributes */
-
 
10279
          if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
-
 
10280
            _removeAttribute(name, currentNode);
-
 
10281
            continue;
-
 
10282
          }
-
 
10283
          /* Did the hooks approve of the attribute? */
9430
          if (hookEvent.forceKeepAttr) {
10284
          if (hookEvent.forceKeepAttr) {
9431
            continue;
10285
            continue;
9432
          }
10286
          }
-
 
10287
          /* Remove attribute */
-
 
10288
          /* Did the hooks approve of the attribute? */
9433
          if (!hookEvent.keepAttr) {
10289
          if (!hookEvent.keepAttr) {
9434
            _removeAttribute(name, currentNode);
10290
            _removeAttribute(name, currentNode);
9435
            continue;
10291
            continue;
9436
          }
10292
          }
-
 
10293
          /* Work around a security issue in jQuery 3.0 */
9437
          if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
10294
          if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
9438
            _removeAttribute(name, currentNode);
10295
            _removeAttribute(name, currentNode);
9439
            continue;
10296
            continue;
9440
          }
10297
          }
-
 
10298
          /* Sanitize attribute content to be template-safe */
9441
          if (SAFE_FOR_TEMPLATES) {
10299
          if (SAFE_FOR_TEMPLATES) {
9442
            value = stringReplace(value, MUSTACHE_EXPR, ' ');
10300
            arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
9443
            value = stringReplace(value, ERB_EXPR, ' ');
10301
              value = stringReplace(value, expr, ' ');
9444
            value = stringReplace(value, TMPLIT_EXPR, ' ');
10302
            });
9445
          }
10303
          }
-
 
10304
          /* Is `value` valid for this attribute? */
9446
          const lcTag = transformCaseFunc(currentNode.nodeName);
10305
          const lcTag = transformCaseFunc(currentNode.nodeName);
9447
          if (!_isValidAttribute(lcTag, lcName, value)) {
10306
          if (!_isValidAttribute(lcTag, lcName, value)) {
9448
            _removeAttribute(name, currentNode);
10307
            _removeAttribute(name, currentNode);
9449
            continue;
10308
            continue;
9450
          }
10309
          }
9451
          if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
-
 
9452
            _removeAttribute(name, currentNode);
10310
          /* Handle attributes that require Trusted Types */
9453
            value = SANITIZE_NAMED_PROPS_PREFIX + value;
-
 
9454
          }
-
 
9455
          if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
10311
          if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
9456
            if (namespaceURI);
10312
            if (namespaceURI) ; else {
9457
            else {
-
 
9458
              switch (trustedTypes.getAttributeType(lcTag, lcName)) {
10313
              switch (trustedTypes.getAttributeType(lcTag, lcName)) {
9459
              case 'TrustedHTML': {
10314
                case 'TrustedHTML':
-
 
10315
                  {
9460
                  value = trustedTypesPolicy.createHTML(value);
10316
                    value = trustedTypesPolicy.createHTML(value);
9461
                  break;
10317
                    break;
9462
                }
10318
                  }
9463
              case 'TrustedScriptURL': {
10319
                case 'TrustedScriptURL':
-
 
10320
                  {
9464
                  value = trustedTypesPolicy.createScriptURL(value);
10321
                    value = trustedTypesPolicy.createScriptURL(value);
9465
                  break;
10322
                    break;
9466
                }
10323
                  }
9467
              }
10324
              }
9468
            }
10325
            }
9469
          }
10326
          }
-
 
10327
          /* Handle invalid data-* attribute set by try-catching it */
9470
          if (value !== initValue) {
10328
          if (value !== initValue) {
9471
            try {
10329
            try {
9472
              if (namespaceURI) {
10330
              if (namespaceURI) {
9473
                currentNode.setAttributeNS(namespaceURI, name, value);
10331
                currentNode.setAttributeNS(namespaceURI, name, value);
9474
              } else {
10332
              } else {
-
 
10333
                /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
9475
                currentNode.setAttribute(name, value);
10334
                currentNode.setAttribute(name, value);
9476
              }
10335
              }
-
 
10336
              if (_isClobbered(currentNode)) {
-
 
10337
                _forceRemove(currentNode);
9477
            } catch (_) {
10338
              } else {
9478
              _removeAttribute(name, currentNode);
10339
                arrayPop(DOMPurify.removed);
9479
            }
10340
              }
-
 
10341
            } catch (_) {}
9480
          }
10342
          }
9481
        }
10343
        }
-
 
10344
        /* Execute a hook if present */
9482
        _executeHook('afterSanitizeAttributes', currentNode, null);
10345
        _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
9483
      };
10346
      };
-
 
10347
      /**
-
 
10348
       * _sanitizeShadowDOM
-
 
10349
       *
-
 
10350
       * @param fragment to iterate over recursively
-
 
10351
       */
9484
      const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
10352
      const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
9485
        let shadowNode;
10353
        let shadowNode = null;
9486
        const shadowIterator = _createIterator(fragment);
10354
        const shadowIterator = _createNodeIterator(fragment);
-
 
10355
        /* Execute a hook if present */
9487
        _executeHook('beforeSanitizeShadowDOM', fragment, null);
10356
        _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
9488
        while (shadowNode = shadowIterator.nextNode()) {
10357
        while (shadowNode = shadowIterator.nextNode()) {
-
 
10358
          /* Execute a hook if present */
9489
          _executeHook('uponSanitizeShadowNode', shadowNode, null);
10359
          _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
-
 
10360
          /* Sanitize tags and elements */
9490
          if (_sanitizeElements(shadowNode)) {
10361
          _sanitizeElements(shadowNode);
9491
            continue;
10362
          /* Check attributes next */
-
 
10363
          _sanitizeAttributes(shadowNode);
9492
          }
10364
          /* Deep shadow DOM detected */
9493
          if (shadowNode.content instanceof DocumentFragment) {
10365
          if (shadowNode.content instanceof DocumentFragment) {
9494
            _sanitizeShadowDOM(shadowNode.content);
10366
            _sanitizeShadowDOM(shadowNode.content);
9495
          }
10367
          }
9496
          _sanitizeAttributes(shadowNode);
-
 
9497
        }
10368
        }
-
 
10369
        /* Execute a hook if present */
9498
        _executeHook('afterSanitizeShadowDOM', fragment, null);
10370
        _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
9499
      };
10371
      };
-
 
10372
      // eslint-disable-next-line complexity
9500
      DOMPurify.sanitize = function (dirty) {
10373
      DOMPurify.sanitize = function (dirty) {
9501
        let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10374
        let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9502
        let body;
10375
        let body = null;
9503
        let importedNode;
10376
        let importedNode = null;
9504
        let currentNode;
10377
        let currentNode = null;
9505
        let returnNode;
10378
        let returnNode = null;
-
 
10379
        /* Make sure we have a string to sanitize.
-
 
10380
          DO NOT return early, as this will return the wrong type if
-
 
10381
          the user has requested a DOM object rather than a string */
9506
        IS_EMPTY_INPUT = !dirty;
10382
        IS_EMPTY_INPUT = !dirty;
9507
        if (IS_EMPTY_INPUT) {
10383
        if (IS_EMPTY_INPUT) {
9508
          dirty = '<!-->';
10384
          dirty = '<!-->';
9509
        }
10385
        }
-
 
10386
        /* Stringify, in case dirty is an object */
9510
        if (typeof dirty !== 'string' && !_isNode(dirty)) {
10387
        if (typeof dirty !== 'string' && !_isNode(dirty)) {
9511
          if (typeof dirty.toString === 'function') {
10388
          if (typeof dirty.toString === 'function') {
9512
            dirty = dirty.toString();
10389
            dirty = dirty.toString();
9513
            if (typeof dirty !== 'string') {
10390
            if (typeof dirty !== 'string') {
9514
              throw typeErrorCreate('dirty is not a string, aborting');
10391
              throw typeErrorCreate('dirty is not a string, aborting');
9515
            }
10392
            }
9516
          } else {
10393
          } else {
9517
            throw typeErrorCreate('toString is not a function');
10394
            throw typeErrorCreate('toString is not a function');
9518
          }
10395
          }
9519
        }
10396
        }
-
 
10397
        /* Return dirty HTML if DOMPurify cannot run */
9520
        if (!DOMPurify.isSupported) {
10398
        if (!DOMPurify.isSupported) {
9521
          return dirty;
10399
          return dirty;
9522
        }
10400
        }
-
 
10401
        /* Assign config vars */
9523
        if (!SET_CONFIG) {
10402
        if (!SET_CONFIG) {
9524
          _parseConfig(cfg);
10403
          _parseConfig(cfg);
9525
        }
10404
        }
-
 
10405
        /* Clean up removed elements */
9526
        DOMPurify.removed = [];
10406
        DOMPurify.removed = [];
-
 
10407
        /* Check if dirty is correctly typed for IN_PLACE */
9527
        if (typeof dirty === 'string') {
10408
        if (typeof dirty === 'string') {
9528
          IN_PLACE = false;
10409
          IN_PLACE = false;
9529
        }
10410
        }
9530
        if (IN_PLACE) {
10411
        if (IN_PLACE) {
-
 
10412
          /* Do some early pre-sanitization to avoid unsafe root nodes */
9531
          if (dirty.nodeName) {
10413
          if (dirty.nodeName) {
9532
            const tagName = transformCaseFunc(dirty.nodeName);
10414
            const tagName = transformCaseFunc(dirty.nodeName);
9533
            if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
10415
            if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
9534
              throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
10416
              throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
9535
            }
10417
            }
9536
          }
10418
          }
9537
        } else if (dirty instanceof Node) {
10419
        } else if (dirty instanceof Node) {
-
 
10420
          /* If dirty is a DOM element, append to an empty document to avoid
-
 
10421
             elements being stripped by the parser */
9538
          body = _initDocument('<!---->');
10422
          body = _initDocument('<!---->');
9539
          importedNode = body.ownerDocument.importNode(dirty, true);
10423
          importedNode = body.ownerDocument.importNode(dirty, true);
9540
          if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
10424
          if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
-
 
10425
            /* Node is already a body, use as is */
9541
            body = importedNode;
10426
            body = importedNode;
9542
          } else if (importedNode.nodeName === 'HTML') {
10427
          } else if (importedNode.nodeName === 'HTML') {
9543
            body = importedNode;
10428
            body = importedNode;
9544
          } else {
10429
          } else {
-
 
10430
            // eslint-disable-next-line unicorn/prefer-dom-node-append
9545
            body.appendChild(importedNode);
10431
            body.appendChild(importedNode);
9546
          }
10432
          }
9547
        } else {
10433
        } else {
-
 
10434
          /* Exit directly if we have nothing to do */
9548
          if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf('<') === -1) {
10435
          if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
-
 
10436
          // eslint-disable-next-line unicorn/prefer-includes
-
 
10437
          dirty.indexOf('<') === -1) {
9549
            return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
10438
            return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
9550
          }
10439
          }
-
 
10440
          /* Initialize the document to work on */
9551
          body = _initDocument(dirty);
10441
          body = _initDocument(dirty);
-
 
10442
          /* Check we have a DOM node from the data */
9552
          if (!body) {
10443
          if (!body) {
9553
            return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
10444
            return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
9554
          }
10445
          }
9555
        }
10446
        }
-
 
10447
        /* Remove first element node (ours) if FORCE_BODY is set */
9556
        if (body && FORCE_BODY) {
10448
        if (body && FORCE_BODY) {
9557
          _forceRemove(body.firstChild);
10449
          _forceRemove(body.firstChild);
9558
        }
10450
        }
-
 
10451
        /* Get node iterator */
9559
        const nodeIterator = _createIterator(IN_PLACE ? dirty : body);
10452
        const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
-
 
10453
        /* Now start iterating over the created document */
9560
        while (currentNode = nodeIterator.nextNode()) {
10454
        while (currentNode = nodeIterator.nextNode()) {
-
 
10455
          /* Sanitize tags and elements */
9561
          if (_sanitizeElements(currentNode)) {
10456
          _sanitizeElements(currentNode);
9562
            continue;
10457
          /* Check attributes next */
9563
          }
10458
          _sanitizeAttributes(currentNode);
-
 
10459
          /* Shadow DOM detected, sanitize it */
9564
          if (currentNode.content instanceof DocumentFragment) {
10460
          if (currentNode.content instanceof DocumentFragment) {
9565
            _sanitizeShadowDOM(currentNode.content);
10461
            _sanitizeShadowDOM(currentNode.content);
9566
          }
10462
          }
9567
          _sanitizeAttributes(currentNode);
-
 
9568
        }
10463
        }
-
 
10464
        /* If we sanitized `dirty` in-place, return it. */
9569
        if (IN_PLACE) {
10465
        if (IN_PLACE) {
9570
          return dirty;
10466
          return dirty;
9571
        }
10467
        }
-
 
10468
        /* Return sanitized string or DOM */
9572
        if (RETURN_DOM) {
10469
        if (RETURN_DOM) {
9573
          if (RETURN_DOM_FRAGMENT) {
10470
          if (RETURN_DOM_FRAGMENT) {
9574
            returnNode = createDocumentFragment.call(body.ownerDocument);
10471
            returnNode = createDocumentFragment.call(body.ownerDocument);
9575
            while (body.firstChild) {
10472
            while (body.firstChild) {
-
 
10473
              // eslint-disable-next-line unicorn/prefer-dom-node-append
9576
              returnNode.appendChild(body.firstChild);
10474
              returnNode.appendChild(body.firstChild);
9577
            }
10475
            }
9578
          } else {
10476
          } else {
9579
            returnNode = body;
10477
            returnNode = body;
9580
          }
10478
          }
9581
          if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
10479
          if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
-
 
10480
            /*
-
 
10481
              AdoptNode() is not used because internal state is not reset
-
 
10482
              (e.g. the past names map of a HTMLFormElement), this is safe
-
 
10483
              in theory but we would rather not risk another attack vector.
-
 
10484
              The state that is cloned by importNode() is explicitly defined
-
 
10485
              by the specs.
-
 
10486
            */
9582
            returnNode = importNode.call(originalDocument, returnNode, true);
10487
            returnNode = importNode.call(originalDocument, returnNode, true);
9583
          }
10488
          }
9584
          return returnNode;
10489
          return returnNode;
9585
        }
10490
        }
9586
        let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
10491
        let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
-
 
10492
        /* Serialize doctype if allowed */
9587
        if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
10493
        if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
9588
          serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
10494
          serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
9589
        }
10495
        }
-
 
10496
        /* Sanitize final string template-safe */
9590
        if (SAFE_FOR_TEMPLATES) {
10497
        if (SAFE_FOR_TEMPLATES) {
9591
          serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR, ' ');
10498
          arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
9592
          serializedHTML = stringReplace(serializedHTML, ERB_EXPR, ' ');
10499
            serializedHTML = stringReplace(serializedHTML, expr, ' ');
9593
          serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR, ' ');
10500
          });
9594
        }
10501
        }
9595
        return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
10502
        return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
9596
      };
10503
      };
9597
      DOMPurify.setConfig = function (cfg) {
10504
      DOMPurify.setConfig = function () {
-
 
10505
        let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9598
        _parseConfig(cfg);
10506
        _parseConfig(cfg);
9599
        SET_CONFIG = true;
10507
        SET_CONFIG = true;
9600
      };
10508
      };
9601
      DOMPurify.clearConfig = function () {
10509
      DOMPurify.clearConfig = function () {
9602
        CONFIG = null;
10510
        CONFIG = null;
9603
        SET_CONFIG = false;
10511
        SET_CONFIG = false;
9604
      };
10512
      };
9605
      DOMPurify.isValidAttribute = function (tag, attr, value) {
10513
      DOMPurify.isValidAttribute = function (tag, attr, value) {
-
 
10514
        /* Initialize shared config vars if necessary. */
9606
        if (!CONFIG) {
10515
        if (!CONFIG) {
9607
          _parseConfig({});
10516
          _parseConfig({});
9608
        }
10517
        }
9609
        const lcTag = transformCaseFunc(tag);
10518
        const lcTag = transformCaseFunc(tag);
9610
        const lcName = transformCaseFunc(attr);
10519
        const lcName = transformCaseFunc(attr);
Línea 9612... Línea 10521...
9612
      };
10521
      };
9613
      DOMPurify.addHook = function (entryPoint, hookFunction) {
10522
      DOMPurify.addHook = function (entryPoint, hookFunction) {
9614
        if (typeof hookFunction !== 'function') {
10523
        if (typeof hookFunction !== 'function') {
9615
          return;
10524
          return;
9616
        }
10525
        }
9617
        hooks[entryPoint] = hooks[entryPoint] || [];
-
 
9618
        arrayPush(hooks[entryPoint], hookFunction);
10526
        arrayPush(hooks[entryPoint], hookFunction);
9619
      };
10527
      };
9620
      DOMPurify.removeHook = function (entryPoint) {
10528
      DOMPurify.removeHook = function (entryPoint, hookFunction) {
9621
        if (hooks[entryPoint]) {
10529
        if (hookFunction !== undefined) {
9622
          return arrayPop(hooks[entryPoint]);
10530
          const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
-
 
10531
          return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
9623
        }
10532
        }
-
 
10533
        return arrayPop(hooks[entryPoint]);
9624
      };
10534
      };
9625
      DOMPurify.removeHooks = function (entryPoint) {
10535
      DOMPurify.removeHooks = function (entryPoint) {
9626
        if (hooks[entryPoint]) {
-
 
9627
          hooks[entryPoint] = [];
10536
        hooks[entryPoint] = [];
9628
        }
-
 
9629
      };
10537
      };
9630
      DOMPurify.removeAllHooks = function () {
10538
      DOMPurify.removeAllHooks = function () {
9631
        hooks = {};
10539
        hooks = _createHooksMap();
9632
      };
10540
      };
9633
      return DOMPurify;
10541
      return DOMPurify;
9634
    }
10542
    }
9635
    var purify = createDOMPurify();
10543
    var purify = createDOMPurify();
Línea 9636... Línea 10544...
9636
 
10544
 
Línea 9637... Línea 10545...
9637
    const sanitizeHtmlString = html => purify().sanitize(html);
10545
    const sanitizeHtmlString = html => purify().sanitize(html);
Línea 9638... Línea 10546...
9638
 
10546
 
9639
    var global$8 = tinymce.util.Tools.resolve('tinymce.util.I18n');
10547
    var global$5 = tinymce.util.Tools.resolve('tinymce.util.I18n');
9640
 
10548
 
9641
    const rtlTransform = {
10549
    const rtlTransform = {
Línea 9649... Línea 10557...
9649
      'list-bull-circle': true,
10557
      'list-bull-circle': true,
9650
      'list-bull-default': true,
10558
      'list-bull-default': true,
9651
      'list-bull-square': true
10559
      'list-bull-square': true
9652
    };
10560
    };
9653
    const defaultIconName = 'temporary-placeholder';
10561
    const defaultIconName = 'temporary-placeholder';
9654
    const defaultIcon = icons => () => get$g(icons, defaultIconName).getOr('!not found!');
10562
    const defaultIcon = icons => () => get$h(icons, defaultIconName).getOr('!not found!');
9655
    const getIconName = (name, icons) => {
10563
    const getIconName = (name, icons) => {
9656
      const lcName = name.toLowerCase();
10564
      const lcName = name.toLowerCase();
9657
      if (global$8.isRtl()) {
10565
      if (global$5.isRtl()) {
9658
        const rtlName = ensureTrailing(lcName, '-rtl');
10566
        const rtlName = ensureTrailing(lcName, '-rtl');
9659
        return has$2(icons, rtlName) ? rtlName : lcName;
10567
        return has$2(icons, rtlName) ? rtlName : lcName;
9660
      } else {
10568
      } else {
9661
        return lcName;
10569
        return lcName;
9662
      }
10570
      }
9663
    };
10571
    };
9664
    const lookupIcon = (name, icons) => get$g(icons, getIconName(name, icons));
10572
    const lookupIcon = (name, icons) => get$h(icons, getIconName(name, icons));
9665
    const get$2 = (name, iconProvider) => {
10573
    const get$3 = (name, iconProvider) => {
9666
      const icons = iconProvider();
10574
      const icons = iconProvider();
9667
      return lookupIcon(name, icons).getOrThunk(defaultIcon(icons));
10575
      return lookupIcon(name, icons).getOrThunk(defaultIcon(icons));
9668
    };
10576
    };
9669
    const getOr = (name, iconProvider, fallbackIcon) => {
10577
    const getOr = (name, iconProvider, fallbackIcon) => {
9670
      const icons = iconProvider();
10578
      const icons = iconProvider();
9671
      return lookupIcon(name, icons).or(fallbackIcon).getOrThunk(defaultIcon(icons));
10579
      return lookupIcon(name, icons).or(fallbackIcon).getOrThunk(defaultIcon(icons));
9672
    };
10580
    };
9673
    const needsRtlTransform = iconName => global$8.isRtl() ? has$2(rtlTransform, iconName) : false;
10581
    const needsRtlTransform = iconName => global$5.isRtl() ? has$2(rtlTransform, iconName) : false;
9674
    const addFocusableBehaviour = () => config('add-focusable', [runOnAttached(comp => {
10582
    const addFocusableBehaviour = () => config('add-focusable', [runOnAttached(comp => {
9675
        child(comp.element, 'svg').each(svg => set$9(svg, 'focusable', 'false'));
10583
        child(comp.element, 'svg').each(svg => set$9(svg, 'focusable', 'false'));
9676
      })]);
10584
      })]);
9677
    const renderIcon$3 = (spec, iconName, icons, fallbackIcon) => {
10585
    const renderIcon$3 = (spec, iconName, icons, fallbackIcon) => {
9678
      var _a, _b;
10586
      var _a, _b;
9679
      const rtlIconClasses = needsRtlTransform(iconName) ? ['tox-icon--flip'] : [];
10587
      const rtlIconClasses = needsRtlTransform(iconName) ? ['tox-icon--flip'] : [];
9680
      const iconHtml = get$g(icons, getIconName(iconName, icons)).or(fallbackIcon).getOrThunk(defaultIcon(icons));
10588
      const iconHtml = get$h(icons, getIconName(iconName, icons)).or(fallbackIcon).getOrThunk(defaultIcon(icons));
9681
      return {
10589
      return {
9682
        dom: {
10590
        dom: {
9683
          tag: spec.tag,
10591
          tag: spec.tag,
9684
          attributes: (_a = spec.attributes) !== null && _a !== void 0 ? _a : {},
10592
          attributes: (_a = spec.attributes) !== null && _a !== void 0 ? _a : {},
9685
          classes: spec.classes.concat(rtlIconClasses),
10593
          classes: spec.classes.concat(rtlIconClasses),
Línea 9705... Línea 10613...
9705
      warning: 'warning',
10613
      warning: 'warning',
9706
      warn: 'warning',
10614
      warn: 'warning',
9707
      info: 'info'
10615
      info: 'info'
9708
    };
10616
    };
9709
    const factory$m = detail => {
10617
    const factory$m = detail => {
-
 
10618
      const notificationTextId = generate$6('notification-text');
9710
      const memBannerText = record({
10619
      const memBannerText = record({
9711
        dom: fromHtml(`<p>${ sanitizeHtmlString(detail.translationProvider(detail.text)) }</p>`),
10620
        dom: fromHtml(`<p id=${ notificationTextId }>${ sanitizeHtmlString(detail.backstageProvider.translate(detail.text)) }</p>`),
9712
        behaviours: derive$1([Replacing.config({})])
10621
        behaviours: derive$1([Replacing.config({})])
9713
      });
10622
      });
9714
      const renderPercentBar = percent => ({
10623
      const renderPercentBar = percent => ({
9715
        dom: {
10624
        dom: {
9716
          tag: 'div',
10625
          tag: 'div',
Línea 9771... Línea 10680...
9771
        updateProgress,
10680
        updateProgress,
9772
        updateText
10681
        updateText
9773
      };
10682
      };
9774
      const iconChoices = flatten([
10683
      const iconChoices = flatten([
9775
        detail.icon.toArray(),
10684
        detail.icon.toArray(),
9776
        detail.level.toArray(),
10685
        [detail.level],
9777
        detail.level.bind(level => Optional.from(notificationIconMap[level])).toArray()
10686
        Optional.from(notificationIconMap[detail.level]).toArray()
9778
      ]);
10687
      ]);
9779
      const memButton = record(Button.sketch({
10688
      const memButton = record(Button.sketch({
9780
        dom: {
10689
        dom: {
9781
          tag: 'button',
10690
          tag: 'button',
9782
          classes: [
10691
          classes: [
9783
            'tox-notification__dismiss',
10692
            'tox-notification__dismiss',
9784
            'tox-button',
10693
            'tox-button',
9785
            'tox-button--naked',
10694
            'tox-button--naked',
9786
            'tox-button--icon'
10695
            'tox-button--icon'
9787
          ]
10696
          ],
-
 
10697
          attributes: { 'aria-label': detail.backstageProvider.translate('Close') }
9788
        },
10698
        },
9789
        components: [render$3('close', {
10699
        components: [render$3('close', {
9790
            tag: 'span',
10700
            tag: 'span',
9791
            classes: ['tox-icon'],
10701
            classes: ['tox-icon']
9792
            attributes: { 'aria-label': detail.translationProvider('Close') }
-
 
9793
          }, detail.iconProvider)],
10702
          }, detail.iconProvider)],
-
 
10703
        buttonBehaviours: derive$1([
-
 
10704
          Tabstopping.config({}),
-
 
10705
          Tooltipping.config({ ...detail.backstageProvider.tooltips.getConfig({ tooltipText: detail.backstageProvider.translate('Close') }) })
-
 
10706
        ]),
9794
        action: comp => {
10707
        action: comp => {
9795
          detail.onAction(comp);
10708
          detail.onAction(comp);
9796
        }
10709
        }
9797
      }));
10710
      }));
9798
      const notificationIconSpec = renderFirst(iconChoices, {
10711
      const notificationIconSpec = renderFirst(iconChoices, {
Línea 9813... Línea 10726...
9813
      ];
10726
      ];
9814
      return {
10727
      return {
9815
        uid: detail.uid,
10728
        uid: detail.uid,
9816
        dom: {
10729
        dom: {
9817
          tag: 'div',
10730
          tag: 'div',
-
 
10731
          attributes: {
9818
          attributes: { role: 'alert' },
10732
            'role': 'alert',
-
 
10733
            'aria-labelledby': notificationTextId
-
 
10734
          },
9819
          classes: detail.level.map(level => [
10735
          classes: [
9820
            'tox-notification',
10736
            'tox-notification',
9821
            'tox-notification--in',
10737
            'tox-notification--in',
9822
            `tox-notification--${ level }`
10738
            `tox-notification--${ detail.level }`
9823
          ]).getOr([
-
 
9824
            'tox-notification',
-
 
9825
            'tox-notification--in'
-
 
9826
          ])
10739
          ]
9827
        },
10740
        },
9828
        behaviours: derive$1([
10741
        behaviours: derive$1([
-
 
10742
          Tabstopping.config({}),
9829
          Focusing.config({}),
10743
          Focusing.config({}),
-
 
10744
          Keying.config({
-
 
10745
            mode: 'special',
-
 
10746
            onEscape: comp => {
9830
          config('notification-events', [run$1(focusin(), comp => {
10747
              detail.onAction(comp);
9831
              memButton.getOpt(comp).each(Focusing.focus);
10748
              return Optional.some(true);
9832
            })])
10749
            }
-
 
10750
          })
9833
        ]),
10751
        ]),
9834
        components: components.concat(detail.progress ? [memBannerProgress.asSpec()] : []).concat(!detail.closeButton ? [] : [memButton.asSpec()]),
10752
        components: components.concat(detail.progress ? [memBannerProgress.asSpec()] : []).concat([memButton.asSpec()]),
9835
        apis
10753
        apis
9836
      };
10754
      };
9837
    };
10755
    };
9838
    const Notification = single({
10756
    const Notification = single({
9839
      name: 'Notification',
10757
      name: 'Notification',
9840
      factory: factory$m,
10758
      factory: factory$m,
9841
      configFields: [
10759
      configFields: [
-
 
10760
        defaultedStringEnum('level', 'info', [
9842
        option$3('level'),
10761
          'success',
-
 
10762
          'error',
-
 
10763
          'warning',
-
 
10764
          'warn',
-
 
10765
          'info'
-
 
10766
        ]),
9843
        required$1('progress'),
10767
        required$1('progress'),
9844
        option$3('icon'),
10768
        option$3('icon'),
9845
        required$1('onAction'),
10769
        required$1('onAction'),
9846
        required$1('text'),
10770
        required$1('text'),
9847
        required$1('iconProvider'),
10771
        required$1('iconProvider'),
9848
        required$1('translationProvider'),
10772
        required$1('backstageProvider')
9849
        defaultedBoolean('closeButton', true)
-
 
9850
      ],
10773
      ],
9851
      apis: {
10774
      apis: {
9852
        updateProgress: (apis, comp, percent) => {
10775
        updateProgress: (apis, comp, percent) => {
9853
          apis.updateProgress(comp, percent);
10776
          apis.updateProgress(comp, percent);
9854
        },
10777
        },
Línea 9856... Línea 10779...
9856
          apis.updateText(comp, text);
10779
          apis.updateText(comp, text);
9857
        }
10780
        }
9858
      }
10781
      }
9859
    });
10782
    });
Línea 9860... Línea 10783...
9860
 
10783
 
9861
    var NotificationManagerImpl = (editor, extras, uiMothership) => {
10784
    var NotificationManagerImpl = (editor, extras, uiMothership, notificationRegion) => {
-
 
10785
      const sharedBackstage = extras.backstage.shared;
9862
      const sharedBackstage = extras.backstage.shared;
10786
      const getBoundsContainer = () => SugarElement.fromDom(editor.queryCommandValue('ToggleView') === '' ? editor.getContentAreaContainer() : editor.getContainer());
9863
      const getBounds = () => {
10787
      const getBounds = () => {
9864
        const contentArea = box$1(SugarElement.fromDom(editor.getContentAreaContainer()));
10788
        const contentArea = box$1(getBoundsContainer());
-
 
10789
        return Optional.some(contentArea);
9865
        const win$1 = win();
10790
      };
-
 
10791
      const clampComponentsToBounds = components => {
9866
        const x = clamp(win$1.x, contentArea.x, contentArea.right);
10792
        getBounds().each(bounds => {
9867
        const y = clamp(win$1.y, contentArea.y, contentArea.bottom);
10793
          each$1(components, comp => {
9868
        const right = Math.max(contentArea.right, win$1.right);
10794
            remove$7(comp.element, 'width');
9869
        const bottom = Math.max(contentArea.bottom, win$1.bottom);
10795
            if (get$d(comp.element) > bounds.width) {
-
 
10796
              set$8(comp.element, 'width', bounds.width + 'px');
-
 
10797
            }
-
 
10798
          });
9870
        return Optional.some(bounds(x, y, right - x, bottom - y));
10799
        });
9871
      };
10800
      };
9872
      const open = (settings, closeCallback) => {
10801
      const open = (settings, closeCallback, isEditorOrUIFocused) => {
-
 
10802
        const close = () => {
-
 
10803
          const removeNotificationAndReposition = region => {
-
 
10804
            Replacing.remove(region, notification);
-
 
10805
            reposition();
-
 
10806
          };
-
 
10807
          const manageRegionVisibility = (region, editorOrUiFocused) => {
-
 
10808
            if (children(region.element).length === 0) {
-
 
10809
              handleEmptyRegion(region, editorOrUiFocused);
-
 
10810
            } else {
-
 
10811
              handleRegionWithChildren(region, editorOrUiFocused);
-
 
10812
            }
-
 
10813
          };
-
 
10814
          const handleEmptyRegion = (region, editorOrUIFocused) => {
-
 
10815
            InlineView.hide(region);
-
 
10816
            notificationRegion.clear();
-
 
10817
            if (editorOrUIFocused) {
-
 
10818
              editor.focus();
-
 
10819
            }
-
 
10820
          };
-
 
10821
          const handleRegionWithChildren = (region, editorOrUIFocused) => {
-
 
10822
            if (editorOrUIFocused) {
-
 
10823
              Keying.focusIn(region);
-
 
10824
            }
-
 
10825
          };
9873
        const close = () => {
10826
          notificationRegion.on(region => {
-
 
10827
            closeCallback();
9874
          closeCallback();
10828
            const editorOrUIFocused = isEditorOrUIFocused();
-
 
10829
            removeNotificationAndReposition(region);
-
 
10830
            manageRegionVisibility(region, editorOrUIFocused);
9875
          InlineView.hide(notificationWrapper);
10831
          });
-
 
10832
        };
9876
        };
10833
        const shouldApplyDocking = () => !isStickyToolbar(editor) || !sharedBackstage.header.isPositionedAtTop();
9877
        const notification = build$1(Notification.sketch({
10834
        const notification = build$1(Notification.sketch({
9878
          text: settings.text,
10835
          text: settings.text,
9879
          level: contains$2([
10836
          level: contains$2([
9880
            'success',
10837
            'success',
Línea 9883... Línea 10840...
9883
            'warn',
10840
            'warn',
9884
            'info'
10841
            'info'
9885
          ], settings.type) ? settings.type : undefined,
10842
          ], settings.type) ? settings.type : undefined,
9886
          progress: settings.progressBar === true,
10843
          progress: settings.progressBar === true,
9887
          icon: settings.icon,
10844
          icon: settings.icon,
9888
          closeButton: settings.closeButton,
-
 
9889
          onAction: close,
10845
          onAction: close,
9890
          iconProvider: sharedBackstage.providers.icons,
10846
          iconProvider: sharedBackstage.providers.icons,
9891
          translationProvider: sharedBackstage.providers.translate
10847
          backstageProvider: sharedBackstage.providers
9892
        }));
-
 
9893
        const notificationWrapper = build$1(InlineView.sketch({
-
 
9894
          dom: {
-
 
9895
            tag: 'div',
-
 
9896
            classes: ['tox-notifications-container']
-
 
9897
          },
-
 
9898
          lazySink: sharedBackstage.getSink,
-
 
9899
          fireDismissalEventInstead: {},
-
 
9900
          ...sharedBackstage.header.isPositionedAtTop() ? {} : { fireRepositionEventInstead: {} }
-
 
9901
        }));
10848
        }));
-
 
10849
        if (!notificationRegion.isSet()) {
-
 
10850
          const notificationWrapper = build$1(InlineView.sketch({
-
 
10851
            dom: {
-
 
10852
              tag: 'div',
-
 
10853
              classes: ['tox-notifications-container'],
-
 
10854
              attributes: {
-
 
10855
                'aria-label': 'Notifications',
-
 
10856
                'role': 'region'
-
 
10857
              }
-
 
10858
            },
-
 
10859
            lazySink: sharedBackstage.getSink,
-
 
10860
            fireDismissalEventInstead: {},
-
 
10861
            ...sharedBackstage.header.isPositionedAtTop() ? {} : { fireRepositionEventInstead: {} },
-
 
10862
            inlineBehaviours: derive$1([
-
 
10863
              Keying.config({
-
 
10864
                mode: 'cyclic',
-
 
10865
                selector: '.tox-notification, .tox-notification a, .tox-notification button'
-
 
10866
              }),
-
 
10867
              Replacing.config({}),
-
 
10868
              ...shouldApplyDocking() ? [Docking.config({
-
 
10869
                  contextual: {
-
 
10870
                    lazyContext: () => Optional.some(box$1(getBoundsContainer())),
-
 
10871
                    fadeInClass: 'tox-notification-container-dock-fadein',
-
 
10872
                    fadeOutClass: 'tox-notification-container-dock-fadeout',
-
 
10873
                    transitionClass: 'tox-notification-container-dock-transition'
-
 
10874
                  },
-
 
10875
                  modes: ['top'],
-
 
10876
                  lazyViewport: comp => {
-
 
10877
                    const optScrollingContext = detectWhenSplitUiMode(editor, comp.element);
-
 
10878
                    return optScrollingContext.map(sc => {
-
 
10879
                      const combinedBounds = getBoundsFrom(sc);
-
 
10880
                      return {
-
 
10881
                        bounds: combinedBounds,
-
 
10882
                        optScrollEnv: Optional.some({
-
 
10883
                          currentScrollTop: sc.element.dom.scrollTop,
-
 
10884
                          scrollElmTop: absolute$3(sc.element).top
-
 
10885
                        })
-
 
10886
                      };
-
 
10887
                    }).getOrThunk(() => ({
-
 
10888
                      bounds: win(),
-
 
10889
                      optScrollEnv: Optional.none()
-
 
10890
                    }));
-
 
10891
                  }
-
 
10892
                })] : []
-
 
10893
            ])
-
 
10894
          }));
-
 
10895
          const notificationSpec = premade(notification);
-
 
10896
          const anchorOverrides = { maxHeightFunction: expandable$1() };
-
 
10897
          const anchor = {
-
 
10898
            ...sharedBackstage.anchors.banner(),
-
 
10899
            overrides: anchorOverrides
-
 
10900
          };
-
 
10901
          notificationRegion.set(notificationWrapper);
9902
        uiMothership.add(notificationWrapper);
10902
          uiMothership.add(notificationWrapper);
-
 
10903
          InlineView.showWithinBounds(notificationWrapper, notificationSpec, { anchor }, getBounds);
-
 
10904
        } else {
-
 
10905
          const notificationSpec = premade(notification);
-
 
10906
          notificationRegion.on(notificationWrapper => {
-
 
10907
            Replacing.append(notificationWrapper, notificationSpec);
-
 
10908
            InlineView.reposition(notificationWrapper);
-
 
10909
            if (notification.hasConfigured(Docking)) {
-
 
10910
              Docking.refresh(notificationWrapper);
-
 
10911
            }
-
 
10912
            clampComponentsToBounds(notificationWrapper.components());
-
 
10913
          });
-
 
10914
        }
9903
        if (isNumber(settings.timeout) && settings.timeout > 0) {
10915
        if (isNumber(settings.timeout) && settings.timeout > 0) {
9904
          global$9.setEditorTimeout(editor, () => {
10916
          global$9.setEditorTimeout(editor, () => {
9905
            close();
10917
            close();
9906
          }, settings.timeout);
10918
          }, settings.timeout);
9907
        }
10919
        }
9908
        const reposition = () => {
10920
        const reposition = () => {
9909
          const notificationSpec = premade(notification);
10921
          notificationRegion.on(region => {
9910
          const anchorOverrides = { maxHeightFunction: expandable$1() };
-
 
9911
          const allNotifications = editor.notificationManager.getNotifications();
-
 
9912
          if (allNotifications[0] === thisNotification) {
10922
            InlineView.reposition(region);
9913
            const anchor = {
-
 
9914
              ...sharedBackstage.anchors.banner(),
10923
            if (region.hasConfigured(Docking)) {
9915
              overrides: anchorOverrides
10924
              Docking.refresh(region);
9916
            };
10925
            }
9917
            InlineView.showWithinBounds(notificationWrapper, notificationSpec, { anchor }, getBounds);
-
 
9918
          } else {
-
 
9919
            indexOf(allNotifications, thisNotification).each(idx => {
10926
            clampComponentsToBounds(region.components());
9920
              const previousNotification = allNotifications[idx - 1].getEl();
-
 
9921
              const nodeAnchor = {
-
 
9922
                type: 'node',
-
 
9923
                root: body(),
-
 
9924
                node: Optional.some(SugarElement.fromDom(previousNotification)),
-
 
9925
                overrides: anchorOverrides,
-
 
9926
                layouts: {
-
 
9927
                  onRtl: () => [south$2],
-
 
9928
                  onLtr: () => [south$2]
-
 
9929
                }
-
 
9930
              };
-
 
9931
              InlineView.showWithinBounds(notificationWrapper, notificationSpec, { anchor: nodeAnchor }, getBounds);
-
 
9932
            });
10927
          });
9933
          }
-
 
9934
        };
10928
        };
9935
        const thisNotification = {
10929
        const thisNotification = {
9936
          close,
10930
          close,
9937
          reposition,
10931
          reposition,
9938
          text: nuText => {
10932
          text: nuText => {
Línea 9959... Línea 10953...
9959
        close,
10953
        close,
9960
        getArgs
10954
        getArgs
9961
      };
10955
      };
9962
    };
10956
    };
Línea 9963... Línea -...
9963
 
-
 
9964
    var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
-
 
9965
 
-
 
9966
    var global$6 = tinymce.util.Tools.resolve('tinymce.EditorManager');
-
 
9967
 
-
 
9968
    var global$5 = tinymce.util.Tools.resolve('tinymce.Env');
-
 
9969
 
-
 
9970
    var ToolbarMode$1;
-
 
9971
    (function (ToolbarMode) {
-
 
9972
      ToolbarMode['default'] = 'wrap';
-
 
9973
      ToolbarMode['floating'] = 'floating';
-
 
9974
      ToolbarMode['sliding'] = 'sliding';
-
 
9975
      ToolbarMode['scrolling'] = 'scrolling';
-
 
9976
    }(ToolbarMode$1 || (ToolbarMode$1 = {})));
-
 
9977
    var ToolbarLocation$1;
-
 
9978
    (function (ToolbarLocation) {
-
 
9979
      ToolbarLocation['auto'] = 'auto';
-
 
9980
      ToolbarLocation['top'] = 'top';
-
 
9981
      ToolbarLocation['bottom'] = 'bottom';
-
 
9982
    }(ToolbarLocation$1 || (ToolbarLocation$1 = {})));
-
 
9983
    const option$2 = name => editor => editor.options.get(name);
-
 
9984
    const wrapOptional = fn => editor => Optional.from(fn(editor));
-
 
9985
    const register$e = editor => {
-
 
9986
      const isPhone = global$5.deviceType.isPhone();
-
 
9987
      const isMobile = global$5.deviceType.isTablet() || isPhone;
-
 
9988
      const registerOption = editor.options.register;
-
 
9989
      const stringOrFalseProcessor = value => isString(value) || value === false;
-
 
9990
      const stringOrNumberProcessor = value => isString(value) || isNumber(value);
-
 
9991
      registerOption('skin', {
-
 
9992
        processor: value => isString(value) || value === false,
-
 
9993
        default: 'oxide'
-
 
9994
      });
-
 
9995
      registerOption('skin_url', { processor: 'string' });
-
 
9996
      registerOption('height', {
-
 
9997
        processor: stringOrNumberProcessor,
-
 
9998
        default: Math.max(editor.getElement().offsetHeight, 400)
-
 
9999
      });
-
 
10000
      registerOption('width', {
-
 
10001
        processor: stringOrNumberProcessor,
-
 
10002
        default: global$7.DOM.getStyle(editor.getElement(), 'width')
-
 
10003
      });
-
 
10004
      registerOption('min_height', {
-
 
10005
        processor: 'number',
-
 
10006
        default: 100
-
 
10007
      });
-
 
10008
      registerOption('min_width', { processor: 'number' });
-
 
10009
      registerOption('max_height', { processor: 'number' });
-
 
10010
      registerOption('max_width', { processor: 'number' });
-
 
10011
      registerOption('style_formats', { processor: 'object[]' });
-
 
10012
      registerOption('style_formats_merge', {
-
 
10013
        processor: 'boolean',
-
 
10014
        default: false
-
 
10015
      });
-
 
10016
      registerOption('style_formats_autohide', {
-
 
10017
        processor: 'boolean',
-
 
10018
        default: false
-
 
10019
      });
-
 
10020
      registerOption('line_height_formats', {
-
 
10021
        processor: 'string',
-
 
10022
        default: '1 1.1 1.2 1.3 1.4 1.5 2'
-
 
10023
      });
-
 
10024
      registerOption('font_family_formats', {
-
 
10025
        processor: 'string',
-
 
10026
        default: 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats'
-
 
10027
      });
-
 
10028
      registerOption('font_size_formats', {
-
 
10029
        processor: 'string',
-
 
10030
        default: '8pt 10pt 12pt 14pt 18pt 24pt 36pt'
-
 
10031
      });
-
 
10032
      registerOption('font_size_input_default_unit', {
-
 
10033
        processor: 'string',
-
 
10034
        default: 'pt'
-
 
10035
      });
-
 
10036
      registerOption('block_formats', {
-
 
10037
        processor: 'string',
-
 
10038
        default: 'Paragraph=p;' + 'Heading 1=h1;' + 'Heading 2=h2;' + 'Heading 3=h3;' + 'Heading 4=h4;' + 'Heading 5=h5;' + 'Heading 6=h6;' + 'Preformatted=pre'
-
 
10039
      });
-
 
10040
      registerOption('content_langs', { processor: 'object[]' });
-
 
10041
      registerOption('removed_menuitems', {
-
 
10042
        processor: 'string',
-
 
10043
        default: ''
-
 
10044
      });
-
 
10045
      registerOption('menubar', {
-
 
10046
        processor: value => isString(value) || isBoolean(value),
-
 
10047
        default: !isPhone
-
 
10048
      });
-
 
10049
      registerOption('menu', {
-
 
10050
        processor: 'object',
-
 
10051
        default: {}
-
 
10052
      });
-
 
10053
      registerOption('toolbar', {
-
 
10054
        processor: value => {
-
 
10055
          if (isBoolean(value) || isString(value) || isArray(value)) {
-
 
10056
            return {
-
 
10057
              value,
-
 
10058
              valid: true
-
 
10059
            };
-
 
10060
          } else {
-
 
10061
            return {
-
 
10062
              valid: false,
-
 
10063
              message: 'Must be a boolean, string or array.'
-
 
10064
            };
-
 
10065
          }
-
 
10066
        },
-
 
10067
        default: true
-
 
10068
      });
-
 
10069
      range$2(9, num => {
-
 
10070
        registerOption('toolbar' + (num + 1), { processor: 'string' });
-
 
10071
      });
-
 
10072
      registerOption('toolbar_mode', {
-
 
10073
        processor: 'string',
-
 
10074
        default: isMobile ? 'scrolling' : 'floating'
-
 
10075
      });
-
 
10076
      registerOption('toolbar_groups', {
-
 
10077
        processor: 'object',
-
 
10078
        default: {}
-
 
10079
      });
-
 
10080
      registerOption('toolbar_location', {
-
 
10081
        processor: 'string',
-
 
10082
        default: ToolbarLocation$1.auto
-
 
10083
      });
-
 
10084
      registerOption('toolbar_persist', {
-
 
10085
        processor: 'boolean',
-
 
10086
        default: false
-
 
10087
      });
-
 
10088
      registerOption('toolbar_sticky', {
-
 
10089
        processor: 'boolean',
-
 
10090
        default: editor.inline
-
 
10091
      });
-
 
10092
      registerOption('toolbar_sticky_offset', {
-
 
10093
        processor: 'number',
-
 
10094
        default: 0
-
 
10095
      });
-
 
10096
      registerOption('fixed_toolbar_container', {
-
 
10097
        processor: 'string',
-
 
10098
        default: ''
-
 
10099
      });
-
 
10100
      registerOption('fixed_toolbar_container_target', { processor: 'object' });
-
 
10101
      registerOption('ui_mode', {
-
 
10102
        processor: 'string',
-
 
10103
        default: 'combined'
-
 
10104
      });
-
 
10105
      registerOption('file_picker_callback', { processor: 'function' });
-
 
10106
      registerOption('file_picker_validator_handler', { processor: 'function' });
-
 
10107
      registerOption('file_picker_types', { processor: 'string' });
-
 
10108
      registerOption('typeahead_urls', {
-
 
10109
        processor: 'boolean',
-
 
10110
        default: true
-
 
10111
      });
-
 
10112
      registerOption('anchor_top', {
-
 
10113
        processor: stringOrFalseProcessor,
-
 
10114
        default: '#top'
-
 
10115
      });
-
 
10116
      registerOption('anchor_bottom', {
-
 
10117
        processor: stringOrFalseProcessor,
-
 
10118
        default: '#bottom'
-
 
10119
      });
-
 
10120
      registerOption('draggable_modal', {
-
 
10121
        processor: 'boolean',
-
 
10122
        default: false
-
 
10123
      });
-
 
10124
      registerOption('statusbar', {
-
 
10125
        processor: 'boolean',
-
 
10126
        default: true
-
 
10127
      });
-
 
10128
      registerOption('elementpath', {
-
 
10129
        processor: 'boolean',
-
 
10130
        default: true
-
 
10131
      });
-
 
10132
      registerOption('branding', {
-
 
10133
        processor: 'boolean',
-
 
10134
        default: true
-
 
10135
      });
-
 
10136
      registerOption('promotion', {
-
 
10137
        processor: 'boolean',
-
 
10138
        default: true
-
 
10139
      });
-
 
10140
      registerOption('resize', {
-
 
10141
        processor: value => value === 'both' || isBoolean(value),
-
 
10142
        default: !global$5.deviceType.isTouch()
-
 
10143
      });
-
 
10144
      registerOption('sidebar_show', { processor: 'string' });
-
 
10145
      registerOption('help_accessibility', {
-
 
10146
        processor: 'boolean',
-
 
10147
        default: editor.hasPlugin('help')
-
 
10148
      });
-
 
10149
      registerOption('default_font_stack', {
-
 
10150
        processor: 'string[]',
-
 
10151
        default: []
-
 
10152
      });
-
 
10153
    };
-
 
10154
    const isReadOnly = option$2('readonly');
-
 
10155
    const getHeightOption = option$2('height');
-
 
10156
    const getWidthOption = option$2('width');
-
 
10157
    const getMinWidthOption = wrapOptional(option$2('min_width'));
-
 
10158
    const getMinHeightOption = wrapOptional(option$2('min_height'));
-
 
10159
    const getMaxWidthOption = wrapOptional(option$2('max_width'));
-
 
10160
    const getMaxHeightOption = wrapOptional(option$2('max_height'));
-
 
10161
    const getUserStyleFormats = wrapOptional(option$2('style_formats'));
-
 
10162
    const shouldMergeStyleFormats = option$2('style_formats_merge');
-
 
10163
    const shouldAutoHideStyleFormats = option$2('style_formats_autohide');
-
 
10164
    const getContentLanguages = option$2('content_langs');
-
 
10165
    const getRemovedMenuItems = option$2('removed_menuitems');
-
 
10166
    const getToolbarMode = option$2('toolbar_mode');
-
 
10167
    const getToolbarGroups = option$2('toolbar_groups');
-
 
10168
    const getToolbarLocation = option$2('toolbar_location');
-
 
10169
    const fixedContainerSelector = option$2('fixed_toolbar_container');
-
 
10170
    const fixedToolbarContainerTarget = option$2('fixed_toolbar_container_target');
-
 
10171
    const isToolbarPersist = option$2('toolbar_persist');
-
 
10172
    const getStickyToolbarOffset = option$2('toolbar_sticky_offset');
-
 
10173
    const getMenubar = option$2('menubar');
-
 
10174
    const getToolbar = option$2('toolbar');
-
 
10175
    const getFilePickerCallback = option$2('file_picker_callback');
-
 
10176
    const getFilePickerValidatorHandler = option$2('file_picker_validator_handler');
-
 
10177
    const getFontSizeInputDefaultUnit = option$2('font_size_input_default_unit');
-
 
10178
    const getFilePickerTypes = option$2('file_picker_types');
-
 
10179
    const useTypeaheadUrls = option$2('typeahead_urls');
-
 
10180
    const getAnchorTop = option$2('anchor_top');
-
 
10181
    const getAnchorBottom = option$2('anchor_bottom');
-
 
10182
    const isDraggableModal$1 = option$2('draggable_modal');
-
 
10183
    const useStatusBar = option$2('statusbar');
-
 
10184
    const useElementPath = option$2('elementpath');
-
 
10185
    const useBranding = option$2('branding');
-
 
10186
    const getResize = option$2('resize');
-
 
10187
    const getPasteAsText = option$2('paste_as_text');
-
 
10188
    const getSidebarShow = option$2('sidebar_show');
-
 
10189
    const promotionEnabled = option$2('promotion');
-
 
10190
    const useHelpAccessibility = option$2('help_accessibility');
-
 
10191
    const getDefaultFontStack = option$2('default_font_stack');
-
 
10192
    const isSkinDisabled = editor => editor.options.get('skin') === false;
-
 
10193
    const isMenubarEnabled = editor => editor.options.get('menubar') !== false;
-
 
10194
    const getSkinUrl = editor => {
-
 
10195
      const skinUrl = editor.options.get('skin_url');
-
 
10196
      if (isSkinDisabled(editor)) {
-
 
10197
        return skinUrl;
-
 
10198
      } else {
-
 
10199
        if (skinUrl) {
-
 
10200
          return editor.documentBaseURI.toAbsolute(skinUrl);
-
 
10201
        } else {
-
 
10202
          const skin = editor.options.get('skin');
-
 
10203
          return global$6.baseURL + '/skins/ui/' + skin;
-
 
10204
        }
-
 
10205
      }
-
 
10206
    };
-
 
10207
    const getSkinUrlOption = editor => Optional.from(editor.options.get('skin_url'));
-
 
10208
    const getLineHeightFormats = editor => editor.options.get('line_height_formats').split(' ');
-
 
10209
    const isToolbarEnabled = editor => {
-
 
10210
      const toolbar = getToolbar(editor);
-
 
10211
      const isToolbarString = isString(toolbar);
-
 
10212
      const isToolbarObjectArray = isArray(toolbar) && toolbar.length > 0;
-
 
10213
      return !isMultipleToolbars(editor) && (isToolbarObjectArray || isToolbarString || toolbar === true);
-
 
10214
    };
-
 
10215
    const getMultipleToolbarsOption = editor => {
-
 
10216
      const toolbars = range$2(9, num => editor.options.get('toolbar' + (num + 1)));
-
 
10217
      const toolbarArray = filter$2(toolbars, isString);
-
 
10218
      return someIf(toolbarArray.length > 0, toolbarArray);
-
 
10219
    };
-
 
10220
    const isMultipleToolbars = editor => getMultipleToolbarsOption(editor).fold(() => {
-
 
10221
      const toolbar = getToolbar(editor);
-
 
10222
      return isArrayOf(toolbar, isString) && toolbar.length > 0;
-
 
10223
    }, always);
-
 
10224
    const isToolbarLocationBottom = editor => getToolbarLocation(editor) === ToolbarLocation$1.bottom;
-
 
10225
    const fixedContainerTarget = editor => {
-
 
10226
      var _a;
-
 
10227
      if (!editor.inline) {
-
 
10228
        return Optional.none();
-
 
10229
      }
-
 
10230
      const selector = (_a = fixedContainerSelector(editor)) !== null && _a !== void 0 ? _a : '';
-
 
10231
      if (selector.length > 0) {
-
 
10232
        return descendant(body(), selector);
-
 
10233
      }
-
 
10234
      const element = fixedToolbarContainerTarget(editor);
-
 
10235
      if (isNonNullable(element)) {
-
 
10236
        return Optional.some(SugarElement.fromDom(element));
-
 
10237
      }
-
 
10238
      return Optional.none();
-
 
10239
    };
-
 
10240
    const useFixedContainer = editor => editor.inline && fixedContainerTarget(editor).isSome();
-
 
10241
    const getUiContainer = editor => {
-
 
10242
      const fixedContainer = fixedContainerTarget(editor);
-
 
10243
      return fixedContainer.getOrThunk(() => getContentContainer(getRootNode(SugarElement.fromDom(editor.getElement()))));
-
 
10244
    };
-
 
10245
    const isDistractionFree = editor => editor.inline && !isMenubarEnabled(editor) && !isToolbarEnabled(editor) && !isMultipleToolbars(editor);
-
 
10246
    const isStickyToolbar = editor => {
-
 
10247
      const isStickyToolbar = editor.options.get('toolbar_sticky');
-
 
10248
      return (isStickyToolbar || editor.inline) && !useFixedContainer(editor) && !isDistractionFree(editor);
-
 
10249
    };
-
 
10250
    const isSplitUiMode = editor => !useFixedContainer(editor) && editor.options.get('ui_mode') === 'split';
-
 
10251
    const getMenus = editor => {
-
 
10252
      const menu = editor.options.get('menu');
-
 
10253
      return map$1(menu, menu => ({
-
 
10254
        ...menu,
-
 
10255
        items: menu.items
-
 
10256
      }));
-
 
10257
    };
-
 
10258
 
-
 
10259
    var Options = /*#__PURE__*/Object.freeze({
-
 
10260
        __proto__: null,
-
 
10261
        get ToolbarMode () { return ToolbarMode$1; },
-
 
10262
        get ToolbarLocation () { return ToolbarLocation$1; },
-
 
10263
        register: register$e,
-
 
10264
        getSkinUrl: getSkinUrl,
-
 
10265
        getSkinUrlOption: getSkinUrlOption,
-
 
10266
        isReadOnly: isReadOnly,
-
 
10267
        isSkinDisabled: isSkinDisabled,
-
 
10268
        getHeightOption: getHeightOption,
-
 
10269
        getWidthOption: getWidthOption,
-
 
10270
        getMinWidthOption: getMinWidthOption,
-
 
10271
        getMinHeightOption: getMinHeightOption,
-
 
10272
        getMaxWidthOption: getMaxWidthOption,
-
 
10273
        getMaxHeightOption: getMaxHeightOption,
-
 
10274
        getUserStyleFormats: getUserStyleFormats,
-
 
10275
        shouldMergeStyleFormats: shouldMergeStyleFormats,
-
 
10276
        shouldAutoHideStyleFormats: shouldAutoHideStyleFormats,
-
 
10277
        getLineHeightFormats: getLineHeightFormats,
-
 
10278
        getContentLanguages: getContentLanguages,
-
 
10279
        getRemovedMenuItems: getRemovedMenuItems,
-
 
10280
        isMenubarEnabled: isMenubarEnabled,
-
 
10281
        isMultipleToolbars: isMultipleToolbars,
-
 
10282
        isToolbarEnabled: isToolbarEnabled,
-
 
10283
        isToolbarPersist: isToolbarPersist,
-
 
10284
        getMultipleToolbarsOption: getMultipleToolbarsOption,
-
 
10285
        getUiContainer: getUiContainer,
-
 
10286
        useFixedContainer: useFixedContainer,
-
 
10287
        isSplitUiMode: isSplitUiMode,
-
 
10288
        getToolbarMode: getToolbarMode,
-
 
10289
        isDraggableModal: isDraggableModal$1,
-
 
10290
        isDistractionFree: isDistractionFree,
-
 
10291
        isStickyToolbar: isStickyToolbar,
-
 
10292
        getStickyToolbarOffset: getStickyToolbarOffset,
-
 
10293
        getToolbarLocation: getToolbarLocation,
-
 
10294
        isToolbarLocationBottom: isToolbarLocationBottom,
-
 
10295
        getToolbarGroups: getToolbarGroups,
-
 
10296
        getMenus: getMenus,
-
 
10297
        getMenubar: getMenubar,
-
 
10298
        getToolbar: getToolbar,
-
 
10299
        getFilePickerCallback: getFilePickerCallback,
-
 
10300
        getFilePickerTypes: getFilePickerTypes,
-
 
10301
        useTypeaheadUrls: useTypeaheadUrls,
-
 
10302
        getAnchorTop: getAnchorTop,
-
 
10303
        getAnchorBottom: getAnchorBottom,
-
 
10304
        getFilePickerValidatorHandler: getFilePickerValidatorHandler,
-
 
10305
        getFontSizeInputDefaultUnit: getFontSizeInputDefaultUnit,
-
 
10306
        useStatusBar: useStatusBar,
-
 
10307
        useElementPath: useElementPath,
-
 
10308
        promotionEnabled: promotionEnabled,
-
 
10309
        useBranding: useBranding,
-
 
10310
        getResize: getResize,
-
 
10311
        getPasteAsText: getPasteAsText,
-
 
10312
        getSidebarShow: getSidebarShow,
-
 
10313
        useHelpAccessibility: useHelpAccessibility,
-
 
10314
        getDefaultFontStack: getDefaultFontStack
-
 
10315
    });
-
 
10316
 
-
 
10317
    const autocompleteSelector = '[data-mce-autocompleter]';
-
 
10318
    const detect$1 = elm => closest$1(elm, autocompleteSelector);
-
 
10319
    const findIn = elm => descendant(elm, autocompleteSelector);
-
 
10320
 
10957
 
10321
    const setup$e = (api, editor) => {
10958
    const setup$e = (api, editor) => {
10322
      const redirectKeyToItem = (item, e) => {
10959
      const redirectKeyToItem = (item, e) => {
10323
        emitWith(item, keydown(), { raw: e });
10960
        emitWith(item, keydown(), { raw: e });
10324
      };
10961
      };
Línea 10351... Línea 10988...
10351
          if (keyCode === 13 || keyCode === 38 || keyCode === 40) {
10988
          if (keyCode === 13 || keyCode === 38 || keyCode === 40) {
10352
            api.cancelIfNecessary();
10989
            api.cancelIfNecessary();
10353
          }
10990
          }
10354
        }
10991
        }
10355
      });
10992
      });
10356
      editor.on('NodeChange', e => {
10993
      editor.on('NodeChange', () => {
10357
        if (api.isActive() && !api.isProcessingAction() && detect$1(SugarElement.fromDom(e.element)).isNone()) {
10994
        if (api.isActive() && !api.isProcessingAction() && !editor.queryCommandState('mceAutoCompleterInRange')) {
10358
          api.cancelIfNecessary();
10995
          api.cancelIfNecessary();
10359
        }
10996
        }
10360
      });
10997
      });
10361
    };
10998
    };
10362
    const AutocompleterEditorEvents = { setup: setup$e };
10999
    const AutocompleterEditorEvents = { setup: setup$e };
Línea 10389... Línea 11026...
10389
    const containerAlignRightClass = 'tox-collection__item-container--align-right';
11026
    const containerAlignRightClass = 'tox-collection__item-container--align-right';
10390
    const containerAlignLeftClass = 'tox-collection__item-container--align-left';
11027
    const containerAlignLeftClass = 'tox-collection__item-container--align-left';
10391
    const containerValignTopClass = 'tox-collection__item-container--valign-top';
11028
    const containerValignTopClass = 'tox-collection__item-container--valign-top';
10392
    const containerValignMiddleClass = 'tox-collection__item-container--valign-middle';
11029
    const containerValignMiddleClass = 'tox-collection__item-container--valign-middle';
10393
    const containerValignBottomClass = 'tox-collection__item-container--valign-bottom';
11030
    const containerValignBottomClass = 'tox-collection__item-container--valign-bottom';
10394
    const classForPreset = presets => get$g(presetClasses, presets).getOr(navClass);
11031
    const classForPreset = presets => get$h(presetClasses, presets).getOr(navClass);
Línea 10395... Línea 11032...
10395
 
11032
 
10396
    const forMenu = presets => {
11033
    const forMenu = presets => {
10397
      if (presets === 'color') {
11034
      if (presets === 'color') {
10398
        return 'tox-swatches';
11035
        return 'tox-swatches';
Línea 10444... Línea 11081...
10444
        markers: markers(presets)
11081
        markers: markers(presets)
10445
      };
11082
      };
10446
    };
11083
    };
Línea 10447... Línea 11084...
10447
 
11084
 
-
 
11085
    const schema$l = constant$1([
10448
    const schema$l = constant$1([
11086
      defaultedString('type', 'text'),
10449
      option$3('data'),
11087
      option$3('data'),
10450
      defaulted('inputAttributes', {}),
11088
      defaulted('inputAttributes', {}),
10451
      defaulted('inputStyles', {}),
11089
      defaulted('inputStyles', {}),
10452
      defaulted('tag', 'input'),
11090
      defaulted('tag', 'input'),
10453
      defaulted('inputClasses', []),
11091
      defaulted('inputClasses', []),
-
 
11092
      onHandler('onSetValue'),
-
 
11093
      defaultedFunction('fromInputValue', identity),
10454
      onHandler('onSetValue'),
11094
      defaultedFunction('toInputValue', identity),
10455
      defaulted('styles', {}),
11095
      defaulted('styles', {}),
10456
      defaulted('eventOrder', {}),
11096
      defaulted('eventOrder', {}),
10457
      field('inputBehaviours', [
11097
      field('inputBehaviours', [
10458
        Representing,
11098
        Representing,
Línea 10461... Línea 11101...
10461
      defaulted('selectOnFocus', true)
11101
      defaulted('selectOnFocus', true)
10462
    ]);
11102
    ]);
10463
    const focusBehaviours = detail => derive$1([Focusing.config({
11103
    const focusBehaviours = detail => derive$1([Focusing.config({
10464
        onFocus: !detail.selectOnFocus ? noop : component => {
11104
        onFocus: !detail.selectOnFocus ? noop : component => {
10465
          const input = component.element;
11105
          const input = component.element;
10466
          const value = get$6(input);
11106
          const value = get$7(input);
-
 
11107
          if (detail.type !== 'range') {
10467
          input.dom.setSelectionRange(0, value.length);
11108
            input.dom.setSelectionRange(0, value.length);
-
 
11109
          }
10468
        }
11110
        }
10469
      })]);
11111
      })]);
10470
    const behaviours = detail => ({
11112
    const behaviours = detail => ({
10471
      ...focusBehaviours(detail),
11113
      ...focusBehaviours(detail),
10472
      ...augment(detail.inputBehaviours, [Representing.config({
11114
      ...augment(detail.inputBehaviours, [Representing.config({
10473
          store: {
11115
          store: {
10474
            mode: 'manual',
11116
            mode: 'manual',
10475
            ...detail.data.map(data => ({ initialValue: data })).getOr({}),
11117
            ...detail.data.map(data => ({ initialValue: data })).getOr({}),
10476
            getValue: input => {
11118
            getValue: input => {
10477
              return get$6(input.element);
11119
              return detail.fromInputValue(get$7(input.element));
10478
            },
11120
            },
10479
            setValue: (input, data) => {
11121
            setValue: (input, data) => {
10480
              const current = get$6(input.element);
11122
              const current = get$7(input.element);
10481
              if (current !== data) {
11123
              if (current !== data) {
10482
                set$5(input.element, data);
11124
                set$5(input.element, detail.toInputValue(data));
10483
              }
11125
              }
10484
            }
11126
            }
10485
          },
11127
          },
10486
          onSetValue: detail.onSetValue
11128
          onSetValue: detail.onSetValue
10487
        })])
11129
        })])
10488
    });
11130
    });
10489
    const dom = detail => ({
11131
    const dom = detail => ({
10490
      tag: detail.tag,
11132
      tag: detail.tag,
10491
      attributes: {
11133
      attributes: {
10492
        type: 'text',
11134
        type: detail.type,
10493
        ...detail.inputAttributes
11135
        ...detail.inputAttributes
10494
      },
11136
      },
10495
      styles: detail.inputStyles,
11137
      styles: detail.inputStyles,
10496
      classes: detail.inputClasses
11138
      classes: detail.inputClasses
10497
    });
11139
    });
Línea 10738... Línea 11380...
10738
            'tox-collection'
11380
            'tox-collection'
10739
          ].concat(columns === 1 ? ['tox-collection--list'] : ['tox-collection--grid'])
11381
          ].concat(columns === 1 ? ['tox-collection--list'] : ['tox-collection--grid'])
10740
        },
11382
        },
10741
        components: [
11383
        components: [
10742
          renderMenuSearcher({
11384
          renderMenuSearcher({
10743
            i18n: global$8.translate,
11385
            i18n: global$5.translate,
10744
            placeholder: searchField.placeholder
11386
            placeholder: searchField.placeholder
10745
          }),
11387
          }),
10746
          {
11388
          {
10747
            dom: {
11389
            dom: {
10748
              tag: 'div',
11390
              tag: 'div',
Línea 10845... Línea 11487...
10845
    const onAction = requiredFunction('onAction');
11487
    const onAction = requiredFunction('onAction');
10846
    const onItemAction = requiredFunction('onItemAction');
11488
    const onItemAction = requiredFunction('onItemAction');
10847
    const onSetup = defaultedFunction('onSetup', () => noop);
11489
    const onSetup = defaultedFunction('onSetup', () => noop);
10848
    const optionalName = optionString('name');
11490
    const optionalName = optionString('name');
10849
    const optionalText = optionString('text');
11491
    const optionalText = optionString('text');
-
 
11492
    const optionalRole = optionString('role');
10850
    const optionalIcon = optionString('icon');
11493
    const optionalIcon = optionString('icon');
10851
    const optionalTooltip = optionString('tooltip');
11494
    const optionalTooltip = optionString('tooltip');
10852
    const optionalLabel = optionString('label');
11495
    const optionalLabel = optionString('label');
10853
    const optionalShortcut = optionString('shortcut');
11496
    const optionalShortcut = optionString('shortcut');
10854
    const optionalSelect = optionFunction('select');
11497
    const optionalSelect = optionFunction('select');
Línea 10884... Línea 11527...
10884
    const baseToolbarButtonFields = [
11527
    const baseToolbarButtonFields = [
10885
      enabled,
11528
      enabled,
10886
      optionalTooltip,
11529
      optionalTooltip,
10887
      optionalIcon,
11530
      optionalIcon,
10888
      optionalText,
11531
      optionalText,
10889
      onSetup
11532
      onSetup,
-
 
11533
      defaultedString('context', 'mode:design')
10890
    ];
11534
    ];
10891
    const toolbarButtonSchema = objOf([
11535
    const toolbarButtonSchema = objOf([
10892
      type,
11536
      type,
10893
      onAction
11537
      onAction,
-
 
11538
      optionalShortcut
10894
    ].concat(baseToolbarButtonFields));
11539
    ].concat(baseToolbarButtonFields));
10895
    const createToolbarButton = spec => asRaw('toolbarbutton', toolbarButtonSchema, spec);
11540
    const createToolbarButton = spec => asRaw('toolbarbutton', toolbarButtonSchema, spec);
Línea 10896... Línea 11541...
10896
 
11541
 
10897
    const baseToolbarToggleButtonFields = [active].concat(baseToolbarButtonFields);
11542
    const baseToolbarToggleButtonFields = [active].concat(baseToolbarButtonFields);
10898
    const toggleButtonSchema = objOf(baseToolbarToggleButtonFields.concat([
11543
    const toggleButtonSchema = objOf(baseToolbarToggleButtonFields.concat([
10899
      type,
11544
      type,
-
 
11545
      onAction,
10900
      onAction
11546
      optionalShortcut
10901
    ]));
11547
    ]));
Línea 10902... Línea 11548...
10902
    const createToggleButton = spec => asRaw('ToggleButton', toggleButtonSchema, spec);
11548
    const createToggleButton = spec => asRaw('ToggleButton', toggleButtonSchema, spec);
10903
 
11549
 
Línea 10914... Línea 11560...
10914
      ])
11560
      ])
10915
    ];
11561
    ];
Línea 10916... Línea 11562...
10916
 
11562
 
10917
    const contextButtonFields = baseToolbarButtonFields.concat([
11563
    const contextButtonFields = baseToolbarButtonFields.concat([
-
 
11564
      defaultedType('contextformbutton'),
10918
      defaultedType('contextformbutton'),
11565
      defaultedString('align', 'end'),
10919
      primary,
11566
      primary,
10920
      onAction,
11567
      onAction,
10921
      customField('original', identity)
11568
      customField('original', identity)
10922
    ]);
11569
    ]);
10923
    const contextToggleButtonFields = baseToolbarToggleButtonFields.concat([
11570
    const contextToggleButtonFields = baseToolbarToggleButtonFields.concat([
-
 
11571
      defaultedType('contextformbutton'),
10924
      defaultedType('contextformbutton'),
11572
      defaultedString('align', 'end'),
10925
      primary,
11573
      primary,
10926
      onAction,
11574
      onAction,
10927
      customField('original', identity)
11575
      customField('original', identity)
10928
    ]);
11576
    ]);
10929
    const launchButtonFields = baseToolbarButtonFields.concat([defaultedType('contextformbutton')]);
11577
    const launchButtonFields = baseToolbarButtonFields.concat([defaultedType('contextformbutton')]);
10930
    const launchToggleButtonFields = baseToolbarToggleButtonFields.concat([defaultedType('contextformtogglebutton')]);
11578
    const launchToggleButtonFields = baseToolbarToggleButtonFields.concat([defaultedType('contextformtogglebutton')]);
10931
    const toggleOrNormal = choose$1('type', {
11579
    const toggleOrNormal = choose$1('type', {
10932
      contextformbutton: contextButtonFields,
11580
      contextformbutton: contextButtonFields,
10933
      contextformtogglebutton: contextToggleButtonFields
11581
      contextformtogglebutton: contextToggleButtonFields
10934
    });
11582
    });
10935
    const contextFormSchema = objOf([
-
 
10936
      defaultedType('contextform'),
-
 
10937
      defaultedFunction('initValue', constant$1('')),
11583
    const baseContextFormFields = [
10938
      optionalLabel,
11584
      optionalLabel,
10939
      requiredArrayOf('commands', toggleOrNormal),
11585
      requiredArrayOf('commands', toggleOrNormal),
10940
      optionOf('launch', choose$1('type', {
11586
      optionOf('launch', choose$1('type', {
10941
        contextformbutton: launchButtonFields,
11587
        contextformbutton: launchButtonFields,
-
 
11588
        contextformtogglebutton: launchToggleButtonFields
-
 
11589
      })),
-
 
11590
      defaultedFunction('onInput', noop),
-
 
11591
      defaultedFunction('onSetup', noop)
-
 
11592
    ];
-
 
11593
    const contextFormFields = [
-
 
11594
      ...contextBarFields,
-
 
11595
      ...baseContextFormFields,
-
 
11596
      requiredStringEnum('type', ['contextform']),
-
 
11597
      defaultedFunction('initValue', constant$1('')),
-
 
11598
      optionString('placeholder')
-
 
11599
    ];
-
 
11600
    const contextSliderFormFields = [
-
 
11601
      ...contextBarFields,
-
 
11602
      ...baseContextFormFields,
-
 
11603
      requiredStringEnum('type', ['contextsliderform']),
-
 
11604
      defaultedFunction('initValue', constant$1(0)),
-
 
11605
      defaultedFunction('min', constant$1(0)),
-
 
11606
      defaultedFunction('max', constant$1(100))
-
 
11607
    ];
-
 
11608
    const contextSizeInputFormFields = [
-
 
11609
      ...contextBarFields,
-
 
11610
      ...baseContextFormFields,
-
 
11611
      requiredStringEnum('type', ['contextsizeinputform']),
-
 
11612
      defaultedFunction('initValue', constant$1({
-
 
11613
        width: '',
10942
        contextformtogglebutton: launchToggleButtonFields
11614
        height: ''
-
 
11615
      }))
-
 
11616
    ];
10943
      }))
11617
    const contextFormSchema = choose$1('type', {
-
 
11618
      contextform: contextFormFields,
-
 
11619
      contextsliderform: contextSliderFormFields,
-
 
11620
      contextsizeinputform: contextSizeInputFormFields
10944
    ].concat(contextBarFields));
11621
    });
Línea 10945... Línea 11622...
10945
    const createContextForm = spec => asRaw('ContextForm', contextFormSchema, spec);
11622
    const createContextForm = spec => asRaw('ContextForm', contextFormSchema, spec);
10946
 
11623
 
10947
    const contextToolbarSchema = objOf([
11624
    const contextToolbarSchema = objOf([
-
 
11625
      defaultedType('contexttoolbar'),
-
 
11626
      requiredOf('items', oneOf([
-
 
11627
        string,
-
 
11628
        arrOfObj([
-
 
11629
          optionString('name'),
-
 
11630
          optionString('label'),
-
 
11631
          requiredArrayOf('items', string)
10948
      defaultedType('contexttoolbar'),
11632
        ])
-
 
11633
      ]))
-
 
11634
    ].concat(contextBarFields));
-
 
11635
    const toolbarGroupBackToSpec = toolbarGroup => ({
-
 
11636
      name: toolbarGroup.name.getOrUndefined(),
-
 
11637
      label: toolbarGroup.label.getOrUndefined(),
-
 
11638
      items: toolbarGroup.items
-
 
11639
    });
-
 
11640
    const contextToolbarToSpec = contextToolbar => ({
-
 
11641
      ...contextToolbar,
10949
      requiredString('items')
11642
      items: isString(contextToolbar.items) ? contextToolbar.items : map$2(contextToolbar.items, toolbarGroupBackToSpec)
Línea 10950... Línea 11643...
10950
    ].concat(contextBarFields));
11643
    });
10951
    const createContextToolbar = spec => asRaw('ContextToolbar', contextToolbarSchema, spec);
11644
    const createContextToolbar = spec => asRaw('ContextToolbar', contextToolbarSchema, spec);
10952
 
11645
 
Línea 10980... Línea 11673...
10980
    ]);
11673
    ]);
Línea 10981... Línea 11674...
10981
 
11674
 
10982
    const commonMenuItemFields = [
11675
    const commonMenuItemFields = [
10983
      enabled,
11676
      enabled,
-
 
11677
      optionalText,
10984
      optionalText,
11678
      optionalRole,
10985
      optionalShortcut,
11679
      optionalShortcut,
10986
      generatedValue('menuitem'),
11680
      generatedValue('menuitem'),
-
 
11681
      defaultedMeta,
10987
      defaultedMeta
11682
      defaultedString('context', 'mode:design')
Línea 10988... Línea 11683...
10988
    ];
11683
    ];
10989
 
11684
 
10990
    const cardMenuItemSchema = objOf([
11685
    const cardMenuItemSchema = objOf([
Línea 11070... Línea 11765...
11070
    const SimpleBehaviours = {
11765
    const SimpleBehaviours = {
11071
      namedEvents,
11766
      namedEvents,
11072
      unnamedEvents
11767
      unnamedEvents
11073
    };
11768
    };
Línea 11074... Línea -...
11074
 
-
 
11075
    const ExclusivityChannel = generate$6('tooltip.exclusive');
-
 
11076
    const ShowTooltipEvent = generate$6('tooltip.show');
-
 
11077
    const HideTooltipEvent = generate$6('tooltip.hide');
-
 
11078
 
-
 
11079
    const hideAllExclusive = (component, _tConfig, _tState) => {
-
 
11080
      component.getSystem().broadcastOn([ExclusivityChannel], {});
-
 
11081
    };
-
 
11082
    const setComponents = (component, tConfig, tState, specs) => {
-
 
11083
      tState.getTooltip().each(tooltip => {
-
 
11084
        if (tooltip.getSystem().isConnected()) {
-
 
11085
          Replacing.set(tooltip, specs);
-
 
11086
        }
-
 
11087
      });
-
 
11088
    };
-
 
11089
 
-
 
11090
    var TooltippingApis = /*#__PURE__*/Object.freeze({
-
 
11091
        __proto__: null,
-
 
11092
        hideAllExclusive: hideAllExclusive,
-
 
11093
        setComponents: setComponents
-
 
11094
    });
-
 
11095
 
-
 
11096
    const events$9 = (tooltipConfig, state) => {
-
 
11097
      const hide = comp => {
-
 
11098
        state.getTooltip().each(p => {
-
 
11099
          detach(p);
-
 
11100
          tooltipConfig.onHide(comp, p);
-
 
11101
          state.clearTooltip();
-
 
11102
        });
-
 
11103
        state.clearTimer();
-
 
11104
      };
-
 
11105
      const show = comp => {
-
 
11106
        if (!state.isShowing()) {
-
 
11107
          hideAllExclusive(comp);
-
 
11108
          const sink = tooltipConfig.lazySink(comp).getOrDie();
-
 
11109
          const popup = comp.getSystem().build({
-
 
11110
            dom: tooltipConfig.tooltipDom,
-
 
11111
            components: tooltipConfig.tooltipComponents,
-
 
11112
            events: derive$2(tooltipConfig.mode === 'normal' ? [
-
 
11113
              run$1(mouseover(), _ => {
-
 
11114
                emit(comp, ShowTooltipEvent);
-
 
11115
              }),
-
 
11116
              run$1(mouseout(), _ => {
-
 
11117
                emit(comp, HideTooltipEvent);
-
 
11118
              })
-
 
11119
            ] : []),
-
 
11120
            behaviours: derive$1([Replacing.config({})])
-
 
11121
          });
-
 
11122
          state.setTooltip(popup);
-
 
11123
          attach(sink, popup);
-
 
11124
          tooltipConfig.onShow(comp, popup);
-
 
11125
          Positioning.position(sink, popup, { anchor: tooltipConfig.anchor(comp) });
-
 
11126
        }
-
 
11127
      };
-
 
11128
      return derive$2(flatten([
-
 
11129
        [
-
 
11130
          run$1(ShowTooltipEvent, comp => {
-
 
11131
            state.resetTimer(() => {
-
 
11132
              show(comp);
-
 
11133
            }, tooltipConfig.delay);
-
 
11134
          }),
-
 
11135
          run$1(HideTooltipEvent, comp => {
-
 
11136
            state.resetTimer(() => {
-
 
11137
              hide(comp);
-
 
11138
            }, tooltipConfig.delay);
-
 
11139
          }),
-
 
11140
          run$1(receive(), (comp, message) => {
-
 
11141
            const receivingData = message;
-
 
11142
            if (!receivingData.universal) {
-
 
11143
              if (contains$2(receivingData.channels, ExclusivityChannel)) {
-
 
11144
                hide(comp);
-
 
11145
              }
-
 
11146
            }
-
 
11147
          }),
-
 
11148
          runOnDetached(comp => {
-
 
11149
            hide(comp);
-
 
11150
          })
-
 
11151
        ],
-
 
11152
        tooltipConfig.mode === 'normal' ? [
-
 
11153
          run$1(focusin(), comp => {
-
 
11154
            emit(comp, ShowTooltipEvent);
-
 
11155
          }),
-
 
11156
          run$1(postBlur(), comp => {
-
 
11157
            emit(comp, HideTooltipEvent);
-
 
11158
          }),
-
 
11159
          run$1(mouseover(), comp => {
-
 
11160
            emit(comp, ShowTooltipEvent);
-
 
11161
          }),
-
 
11162
          run$1(mouseout(), comp => {
-
 
11163
            emit(comp, HideTooltipEvent);
-
 
11164
          })
-
 
11165
        ] : [
-
 
11166
          run$1(highlight$1(), (comp, _se) => {
-
 
11167
            emit(comp, ShowTooltipEvent);
-
 
11168
          }),
-
 
11169
          run$1(dehighlight$1(), comp => {
-
 
11170
            emit(comp, HideTooltipEvent);
-
 
11171
          })
-
 
11172
        ]
-
 
11173
      ]));
-
 
11174
    };
-
 
11175
 
-
 
11176
    var ActiveTooltipping = /*#__PURE__*/Object.freeze({
-
 
11177
        __proto__: null,
-
 
11178
        events: events$9
-
 
11179
    });
-
 
11180
 
-
 
11181
    var TooltippingSchema = [
-
 
11182
      required$1('lazySink'),
-
 
11183
      required$1('tooltipDom'),
-
 
11184
      defaulted('exclusive', true),
-
 
11185
      defaulted('tooltipComponents', []),
-
 
11186
      defaulted('delay', 300),
-
 
11187
      defaultedStringEnum('mode', 'normal', [
-
 
11188
        'normal',
-
 
11189
        'follow-highlight'
-
 
11190
      ]),
-
 
11191
      defaulted('anchor', comp => ({
-
 
11192
        type: 'hotspot',
-
 
11193
        hotspot: comp,
-
 
11194
        layouts: {
-
 
11195
          onLtr: constant$1([
-
 
11196
            south$2,
-
 
11197
            north$2,
-
 
11198
            southeast$2,
-
 
11199
            northeast$2,
-
 
11200
            southwest$2,
-
 
11201
            northwest$2
-
 
11202
          ]),
-
 
11203
          onRtl: constant$1([
-
 
11204
            south$2,
-
 
11205
            north$2,
-
 
11206
            southeast$2,
-
 
11207
            northeast$2,
-
 
11208
            southwest$2,
-
 
11209
            northwest$2
-
 
11210
          ])
-
 
11211
        }
-
 
11212
      })),
-
 
11213
      onHandler('onHide'),
-
 
11214
      onHandler('onShow')
-
 
11215
    ];
-
 
11216
 
-
 
11217
    const init$b = () => {
-
 
11218
      const timer = value$2();
-
 
11219
      const popup = value$2();
-
 
11220
      const clearTimer = () => {
-
 
11221
        timer.on(clearTimeout);
-
 
11222
      };
-
 
11223
      const resetTimer = (f, delay) => {
-
 
11224
        clearTimer();
-
 
11225
        timer.set(setTimeout(f, delay));
-
 
11226
      };
-
 
11227
      const readState = constant$1('not-implemented');
-
 
11228
      return nu$8({
-
 
11229
        getTooltip: popup.get,
-
 
11230
        isShowing: popup.isSet,
-
 
11231
        setTooltip: popup.set,
-
 
11232
        clearTooltip: popup.clear,
-
 
11233
        clearTimer,
-
 
11234
        resetTimer,
-
 
11235
        readState
-
 
11236
      });
-
 
11237
    };
-
 
11238
 
-
 
11239
    var TooltippingState = /*#__PURE__*/Object.freeze({
-
 
11240
        __proto__: null,
-
 
11241
        init: init$b
-
 
11242
    });
-
 
11243
 
-
 
11244
    const Tooltipping = create$4({
-
 
11245
      fields: TooltippingSchema,
-
 
11246
      name: 'tooltipping',
-
 
11247
      active: ActiveTooltipping,
-
 
11248
      state: TooltippingState,
-
 
11249
      apis: TooltippingApis
-
 
11250
    });
-
 
11251
 
11769
 
Línea 11252... Línea -...
11252
    const escape = text => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
-
 
11253
 
-
 
11254
    const ReadOnlyChannel = 'silver.readonly';
-
 
11255
    const ReadOnlyDataSchema = objOf([requiredBoolean('readonly')]);
-
 
11256
    const broadcastReadonly = (uiRefs, readonly) => {
-
 
11257
      const outerContainer = uiRefs.mainUi.outerContainer;
-
 
11258
      const target = outerContainer.element;
-
 
11259
      const motherships = [
-
 
11260
        uiRefs.mainUi.mothership,
-
 
11261
        ...uiRefs.uiMotherships
-
 
11262
      ];
-
 
11263
      if (readonly) {
-
 
11264
        each$1(motherships, m => {
-
 
11265
          m.broadcastOn([dismissPopups()], { target });
-
 
11266
        });
-
 
11267
      }
-
 
11268
      each$1(motherships, m => {
-
 
11269
        m.broadcastOn([ReadOnlyChannel], { readonly });
-
 
11270
      });
-
 
11271
    };
-
 
11272
    const setupReadonlyModeSwitch = (editor, uiRefs) => {
-
 
11273
      editor.on('init', () => {
-
 
11274
        if (editor.mode.isReadOnly()) {
-
 
11275
          broadcastReadonly(uiRefs, true);
-
 
11276
        }
-
 
11277
      });
-
 
11278
      editor.on('SwitchMode', () => broadcastReadonly(uiRefs, editor.mode.isReadOnly()));
-
 
11279
      if (isReadOnly(editor)) {
-
 
11280
        editor.mode.set('readonly');
-
 
11281
      }
-
 
11282
    };
-
 
11283
    const receivingConfig = () => Receiving.config({
-
 
11284
      channels: {
-
 
11285
        [ReadOnlyChannel]: {
-
 
11286
          schema: ReadOnlyDataSchema,
-
 
11287
          onReceive: (comp, data) => {
-
 
11288
            Disabling.set(comp, data.readonly);
-
 
11289
          }
-
 
11290
        }
-
 
11291
      }
-
 
11292
    });
11770
    const escape = text => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
11293
 
11771
 
11294
    const item = disabled => Disabling.config({
11772
    const item = disabled => Disabling.config({
11295
      disabled,
11773
      disabled,
11296
      disableClass: 'tox-collection__item--state-disabled'
11774
      disableClass: 'tox-collection__item--state-disabled'
Línea 11317... Línea 11795...
11317
      return f => {
11795
      return f => {
11318
        f(api);
11796
        f(api);
11319
      };
11797
      };
11320
    };
11798
    };
11321
    const onControlAttached = (info, editorOffCell) => runOnAttached(comp => {
11799
    const onControlAttached = (info, editorOffCell) => runOnAttached(comp => {
-
 
11800
      if (isFunction(info.onBeforeSetup)) {
-
 
11801
        info.onBeforeSetup(comp);
-
 
11802
      }
11322
      const run = runWithApi(info, comp);
11803
      const run = runWithApi(info, comp);
11323
      run(api => {
11804
      run(api => {
11324
        const onDestroy = info.onSetup(api);
11805
        const onDestroy = info.onSetup(api);
11325
        if (isFunction(onDestroy)) {
11806
        if (isFunction(onDestroy)) {
11326
          editorOffCell.set(onDestroy);
11807
          editorOffCell.set(onDestroy);
11327
        }
11808
        }
11328
      });
11809
      });
11329
    });
11810
    });
11330
    const onControlDetached = (getApi, editorOffCell) => runOnDetached(comp => runWithApi(getApi, comp)(editorOffCell.get()));
11811
    const onControlDetached = (getApi, editorOffCell) => runOnDetached(comp => runWithApi(getApi, comp)(editorOffCell.get()));
Línea -... Línea 11812...
-
 
11812
 
-
 
11813
    const UiStateChannel = 'silver.uistate';
-
 
11814
    const messageSetDisabled = 'setDisabled';
-
 
11815
    const messageSetEnabled = 'setEnabled';
-
 
11816
    const messageInit = 'init';
-
 
11817
    const messageSwitchMode = 'switchmode';
-
 
11818
    const modeContextMessages = [
-
 
11819
      messageSwitchMode,
-
 
11820
      messageInit
-
 
11821
    ];
-
 
11822
    const broadcastEvents = (uiRefs, messageType) => {
-
 
11823
      const outerContainer = uiRefs.mainUi.outerContainer;
-
 
11824
      const motherships = [
-
 
11825
        uiRefs.mainUi.mothership,
-
 
11826
        ...uiRefs.uiMotherships
-
 
11827
      ];
-
 
11828
      if (messageType === messageSetDisabled) {
-
 
11829
        each$1(motherships, m => {
-
 
11830
          m.broadcastOn([dismissPopups()], { target: outerContainer.element });
-
 
11831
        });
-
 
11832
      }
-
 
11833
      each$1(motherships, m => {
-
 
11834
        m.broadcastOn([UiStateChannel], messageType);
-
 
11835
      });
-
 
11836
    };
-
 
11837
    const setupEventsForUi = (editor, uiRefs) => {
-
 
11838
      editor.on('init SwitchMode', event => {
-
 
11839
        broadcastEvents(uiRefs, event.type);
-
 
11840
      });
-
 
11841
      editor.on('DisabledStateChange', event => {
-
 
11842
        if (!event.isDefaultPrevented()) {
-
 
11843
          const messageType = event.state ? messageSetDisabled : messageInit;
-
 
11844
          broadcastEvents(uiRefs, messageType);
-
 
11845
          if (!event.state) {
-
 
11846
            editor.nodeChanged();
-
 
11847
          }
-
 
11848
        }
-
 
11849
      });
-
 
11850
      editor.on('NodeChange', e => {
-
 
11851
        const messageType = editor.ui.isEnabled() ? e.type : messageSetDisabled;
-
 
11852
        broadcastEvents(uiRefs, messageType);
-
 
11853
      });
-
 
11854
      if (isReadOnly(editor)) {
-
 
11855
        editor.mode.set('readonly');
-
 
11856
      }
-
 
11857
    };
-
 
11858
    const toggleOnReceive = getContext => Receiving.config({
-
 
11859
      channels: {
-
 
11860
        [UiStateChannel]: {
-
 
11861
          onReceive: (comp, messageType) => {
-
 
11862
            if (messageType === messageSetDisabled || messageType === messageSetEnabled) {
-
 
11863
              Disabling.set(comp, messageType === messageSetDisabled);
-
 
11864
              return;
-
 
11865
            }
-
 
11866
            const {contextType, shouldDisable} = getContext();
-
 
11867
            if (contextType === 'mode' && !contains$2(modeContextMessages, messageType)) {
-
 
11868
              return;
-
 
11869
            }
-
 
11870
            Disabling.set(comp, shouldDisable);
-
 
11871
          }
-
 
11872
        }
-
 
11873
      }
-
 
11874
    });
11331
 
11875
 
11332
    const onMenuItemExecute = (info, itemResponse) => runOnExecute$1((comp, simulatedEvent) => {
11876
    const onMenuItemExecute = (info, itemResponse) => runOnExecute$1((comp, simulatedEvent) => {
11333
      runWithApi(info, comp)(info.onAction);
11877
      runWithApi(info, comp)(info.onAction);
11334
      if (!info.triggersSubmenu && itemResponse === ItemResponse$1.CLOSE_ON_EXECUTE) {
11878
      if (!info.triggersSubmenu && itemResponse === ItemResponse$1.CLOSE_ON_EXECUTE) {
11335
        if (comp.getSystem().isConnected()) {
11879
        if (comp.getSystem().isConnected()) {
Línea 11361... Línea 11905...
11361
          config('item-events', [
11905
          config('item-events', [
11362
            onMenuItemExecute(spec, itemResponse),
11906
            onMenuItemExecute(spec, itemResponse),
11363
            onControlAttached(spec, editorOffCell),
11907
            onControlAttached(spec, editorOffCell),
11364
            onControlDetached(spec, editorOffCell)
11908
            onControlDetached(spec, editorOffCell)
11365
          ]),
11909
          ]),
11366
          DisablingConfigs.item(() => !spec.enabled || providersBackstage.isDisabled()),
11910
          DisablingConfigs.item(() => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable),
11367
          receivingConfig(),
11911
          toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context)),
11368
          Replacing.config({})
11912
          Replacing.config({})
11369
        ].concat(spec.itemBehaviours))
11913
        ].concat(spec.itemBehaviours))
11370
      };
11914
      };
11371
    };
11915
    };
11372
    const buildData = source => ({
11916
    const buildData = source => ({
Línea 11376... Línea 11920...
11376
        ...source.meta
11920
        ...source.meta
11377
      }
11921
      }
11378
    });
11922
    });
Línea 11379... Línea 11923...
11379
 
11923
 
11380
    const convertText = source => {
11924
    const convertText = source => {
11381
      const isMac = global$5.os.isMacOS() || global$5.os.isiOS();
11925
      const isMac = global$6.os.isMacOS() || global$6.os.isiOS();
11382
      const mac = {
11926
      const mac = {
11383
        alt: '\u2325',
11927
        alt: '\u2325',
11384
        ctrl: '\u2303',
11928
        ctrl: '\u2303',
11385
        shift: '\u21E7',
11929
        shift: '\u21E7',
Línea 11406... Línea 11950...
11406
    const renderText = text => ({
11950
    const renderText = text => ({
11407
      dom: {
11951
      dom: {
11408
        tag: 'div',
11952
        tag: 'div',
11409
        classes: [textClass]
11953
        classes: [textClass]
11410
      },
11954
      },
11411
      components: [text$2(global$8.translate(text))]
11955
      components: [text$2(global$5.translate(text))]
11412
    });
11956
    });
11413
    const renderHtml = (html, classes) => ({
11957
    const renderHtml = (html, classes) => ({
11414
      dom: {
11958
      dom: {
11415
        tag: 'div',
11959
        tag: 'div',
11416
        classes,
11960
        classes,
Línea 11425... Línea 11969...
11425
      components: [{
11969
      components: [{
11426
          dom: {
11970
          dom: {
11427
            tag: style.tag,
11971
            tag: style.tag,
11428
            styles: style.styles
11972
            styles: style.styles
11429
          },
11973
          },
11430
          components: [text$2(global$8.translate(text))]
11974
          components: [text$2(global$5.translate(text))]
11431
        }]
11975
        }]
11432
    });
11976
    });
11433
    const renderShortcut = shortcut => ({
11977
    const renderShortcut = shortcut => ({
11434
      dom: {
11978
      dom: {
11435
        tag: 'div',
11979
        tag: 'div',
Línea 11478... Línea 12022...
11478
    });
12022
    });
Línea 11479... Línea 12023...
11479
 
12023
 
11480
    const renderColorStructure = (item, providerBackstage, fallbackIcon) => {
12024
    const renderColorStructure = (item, providerBackstage, fallbackIcon) => {
11481
      const colorPickerCommand = 'custom';
12025
      const colorPickerCommand = 'custom';
11482
      const removeColorCommand = 'remove';
-
 
11483
      const itemText = item.ariaLabel;
12026
      const removeColorCommand = 'remove';
11484
      const itemValue = item.value;
12027
      const itemValue = item.value;
-
 
12028
      const iconSvg = item.iconContent.map(name => getOr(name, providerBackstage.icons, fallbackIcon));
-
 
12029
      const attributes = item.ariaLabel.map(al => ({
-
 
12030
        'aria-label': providerBackstage.translate(al),
-
 
12031
        'data-mce-name': al
11485
      const iconSvg = item.iconContent.map(name => getOr(name, providerBackstage.icons, fallbackIcon));
12032
      })).getOr({});
11486
      const getDom = () => {
12033
      const getDom = () => {
11487
        const common = colorClass;
12034
        const common = colorClass;
11488
        const icon = iconSvg.getOr('');
-
 
11489
        const attributes = itemText.map(text => ({ title: providerBackstage.translate(text) })).getOr({});
12035
        const icon = iconSvg.getOr('');
11490
        const baseDom = {
12036
        const baseDom = {
11491
          tag: 'div',
12037
          tag: 'div',
11492
          attributes,
12038
          attributes,
11493
          classes: [common]
12039
          classes: [common]
Línea 11531... Línea 12077...
11531
      };
12077
      };
11532
    };
12078
    };
11533
    const renderItemDomStructure = ariaLabel => {
12079
    const renderItemDomStructure = ariaLabel => {
11534
      const domTitle = ariaLabel.map(label => ({
12080
      const domTitle = ariaLabel.map(label => ({
11535
        attributes: {
12081
        attributes: {
11536
          title: global$8.translate(label),
12082
          'id': generate$6('menu-item'),
11537
          id: generate$6('menu-item')
12083
          'aria-label': global$5.translate(label)
11538
        }
12084
        }
11539
      })).getOr({});
12085
      })).getOr({});
11540
      return {
12086
      return {
11541
        tag: 'div',
12087
        tag: 'div',
11542
        classes: [
12088
        classes: [
Línea 11575... Línea 12121...
11575
      } else {
12121
      } else {
11576
        return renderNormalItemStructure(info, providersBackstage, renderIcons, fallbackIcon);
12122
        return renderNormalItemStructure(info, providersBackstage, renderIcons, fallbackIcon);
11577
      }
12123
      }
11578
    };
12124
    };
Línea 11579... Línea 12125...
11579
 
12125
 
11580
    const tooltipBehaviour = (meta, sharedBackstage) => get$g(meta, 'tooltipWorker').map(tooltipWorker => [Tooltipping.config({
12126
    const tooltipBehaviour = (meta, sharedBackstage, tooltipText) => get$h(meta, 'tooltipWorker').map(tooltipWorker => [Tooltipping.config({
11581
        lazySink: sharedBackstage.getSink,
12127
        lazySink: sharedBackstage.getSink,
11582
        tooltipDom: {
12128
        tooltipDom: {
11583
          tag: 'div',
12129
          tag: 'div',
11584
          classes: ['tox-tooltip-worker-container']
12130
          classes: ['tox-tooltip-worker-container']
Línea 11593... Línea 12139...
11593
        onShow: (component, _tooltip) => {
12139
        onShow: (component, _tooltip) => {
11594
          tooltipWorker(elm => {
12140
          tooltipWorker(elm => {
11595
            Tooltipping.setComponents(component, [external$1({ element: SugarElement.fromDom(elm) })]);
12141
            Tooltipping.setComponents(component, [external$1({ element: SugarElement.fromDom(elm) })]);
11596
          });
12142
          });
11597
        }
12143
        }
-
 
12144
      })]).getOrThunk(() => {
-
 
12145
      return tooltipText.map(text => [Tooltipping.config({
-
 
12146
          ...sharedBackstage.providers.tooltips.getConfig({ tooltipText: text }),
-
 
12147
          mode: 'follow-highlight'
11598
      })]).getOr([]);
12148
        })]).getOr([]);
-
 
12149
    });
11599
    const encodeText = text => global$7.DOM.encode(text);
12150
    const encodeText = text => global$8.DOM.encode(text);
11600
    const replaceText = (text, matchText) => {
12151
    const replaceText = (text, matchText) => {
11601
      const translated = global$8.translate(text);
12152
      const translated = global$5.translate(text);
11602
      const encoded = encodeText(translated);
12153
      const encoded = encodeText(translated);
11603
      if (matchText.length > 0) {
12154
      if (matchText.length > 0) {
11604
        const escapedMatchRegex = new RegExp(escape(matchText), 'gi');
12155
        const escapedMatchRegex = new RegExp(escape(matchText), 'gi');
11605
        return encoded.replace(escapedMatchRegex, match => `<span class="tox-autocompleter-highlight">${ match }</span>`);
12156
        return encoded.replace(escapedMatchRegex, match => `<span class="tox-autocompleter-highlight">${ match }</span>`);
11606
      } else {
12157
      } else {
Línea 11617... Línea 12168...
11617
        shortcutContent: Optional.none(),
12168
        shortcutContent: Optional.none(),
11618
        checkMark: Optional.none(),
12169
        checkMark: Optional.none(),
11619
        caret: Optional.none(),
12170
        caret: Optional.none(),
11620
        value: spec.value
12171
        value: spec.value
11621
      }, sharedBackstage.providers, renderIcons, spec.icon);
12172
      }, sharedBackstage.providers, renderIcons, spec.icon);
-
 
12173
      const tooltipString = spec.text.filter(text => !useText && text !== '');
11622
      return renderCommonItem({
12174
      return renderCommonItem({
-
 
12175
        context: 'mode:design',
11623
        data: buildData(spec),
12176
        data: buildData(spec),
11624
        enabled: spec.enabled,
12177
        enabled: spec.enabled,
11625
        getApi: constant$1({}),
12178
        getApi: constant$1({}),
11626
        onAction: _api => onItemValueHandler(spec.value, spec.meta),
12179
        onAction: _api => onItemValueHandler(spec.value, spec.meta),
11627
        onSetup: constant$1(noop),
12180
        onSetup: constant$1(noop),
11628
        triggersSubmenu: false,
12181
        triggersSubmenu: false,
11629
        itemBehaviours: tooltipBehaviour(spec.meta, sharedBackstage)
12182
        itemBehaviours: tooltipBehaviour(spec, sharedBackstage, tooltipString)
11630
      }, structure, itemResponse, sharedBackstage.providers);
12183
      }, structure, itemResponse, sharedBackstage.providers);
11631
    };
12184
    };
Línea 11632... Línea 12185...
11632
 
12185
 
11633
    const render$2 = (items, extras) => map$2(items, item => {
12186
    const render$2 = (items, extras) => map$2(items, item => {
Línea 11668... Línea 12221...
11668
            },
12221
            },
11669
            components: render$2(spec.items, extras)
12222
            components: render$2(spec.items, extras)
11670
          })]
12223
          })]
11671
      };
12224
      };
11672
      return renderCommonItem({
12225
      return renderCommonItem({
-
 
12226
        context: 'mode:design',
11673
        data: buildData({
12227
        data: buildData({
11674
          text: Optional.none(),
12228
          text: Optional.none(),
11675
          ...spec
12229
          ...spec
11676
        }),
12230
        }),
11677
        enabled: spec.enabled,
12231
        enabled: spec.enabled,
Línea 11701... Línea 12255...
11701
        shortcutContent: useText ? spec.shortcut : Optional.none(),
12255
        shortcutContent: useText ? spec.shortcut : Optional.none(),
11702
        checkMark: useText ? Optional.some(renderCheckmark(providersBackstage.icons)) : Optional.none(),
12256
        checkMark: useText ? Optional.some(renderCheckmark(providersBackstage.icons)) : Optional.none(),
11703
        caret: Optional.none(),
12257
        caret: Optional.none(),
11704
        value: spec.value
12258
        value: spec.value
11705
      }, providersBackstage, renderIcons);
12259
      }, providersBackstage, renderIcons);
-
 
12260
      const optTooltipping = spec.text.filter(constant$1(!useText)).map(t => Tooltipping.config(providersBackstage.tooltips.getConfig({ tooltipText: providersBackstage.translate(t) })));
11706
      return deepMerge(renderCommonItem({
12261
      return deepMerge(renderCommonItem({
-
 
12262
        context: spec.context,
11707
        data: buildData(spec),
12263
        data: buildData(spec),
11708
        enabled: spec.enabled,
12264
        enabled: spec.enabled,
11709
        getApi,
12265
        getApi,
11710
        onAction: _api => onItemValueHandler(spec.value),
12266
        onAction: _api => onItemValueHandler(spec.value),
11711
        onSetup: api => {
12267
        onSetup: api => {
11712
          api.setActive(isSelected);
12268
          api.setActive(isSelected);
11713
          return noop;
12269
          return noop;
11714
        },
12270
        },
11715
        triggersSubmenu: false,
12271
        triggersSubmenu: false,
11716
        itemBehaviours: []
12272
        itemBehaviours: [...optTooltipping.toArray()]
11717
      }, structure, itemResponse, providersBackstage), {
12273
      }, structure, itemResponse, providersBackstage), {
11718
        toggling: {
12274
        toggling: {
11719
          toggleClass: tickedClass,
12275
          toggleClass: tickedClass,
11720
          toggleOnExecute: false,
12276
          toggleOnExecute: false,
11721
          selected: spec.active,
12277
          selected: spec.active,
Línea 11756... Línea 12312...
11756
    };
12312
    };
Línea 11757... Línea 12313...
11757
 
12313
 
11758
    const min = Math.min;
12314
    const min = Math.min;
11759
    const max = Math.max;
12315
    const max = Math.max;
11760
    const round$1 = Math.round;
12316
    const round$1 = Math.round;
11761
    const rgbRegex = /^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i;
12317
    const rgbRegex = /^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i;
11762
    const rgbaRegex = /^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i;
12318
    const rgbaRegex = /^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i;
11763
    const rgbaColour = (red, green, blue, alpha) => ({
12319
    const rgbaColour = (red, green, blue, alpha) => ({
11764
      red,
12320
      red,
11765
      green,
12321
      green,
11766
      blue,
12322
      blue,
Línea 11839... Línea 12395...
11839
      const b = parseInt(blue, 10);
12395
      const b = parseInt(blue, 10);
11840
      const a = parseFloat(alpha);
12396
      const a = parseFloat(alpha);
11841
      return rgbaColour(r, g, b, a);
12397
      return rgbaColour(r, g, b, a);
11842
    };
12398
    };
11843
    const fromString = rgbaString => {
12399
    const fromString = rgbaString => {
11844
      if (rgbaString === 'transparent') {
-
 
11845
        return Optional.some(rgbaColour(0, 0, 0, 0));
-
 
11846
      }
-
 
11847
      const rgbMatch = rgbRegex.exec(rgbaString);
12400
      const rgbMatch = rgbRegex.exec(rgbaString);
11848
      if (rgbMatch !== null) {
12401
      if (rgbMatch !== null) {
11849
        return Optional.some(fromStringValues(rgbMatch[1], rgbMatch[2], rgbMatch[3], '1'));
12402
        return Optional.some(fromStringValues(rgbMatch[1], rgbMatch[2], rgbMatch[3], '1'));
11850
      }
12403
      }
11851
      const rgbaMatch = rgbaRegex.exec(rgbaString);
12404
      const rgbaMatch = rgbaRegex.exec(rgbaString);
Línea 11901... Línea 12454...
11901
      editor.dispatch('BlocksTextUpdate', data);
12454
      editor.dispatch('BlocksTextUpdate', data);
11902
    };
12455
    };
11903
    const fireFontFamilyTextUpdate = (editor, data) => {
12456
    const fireFontFamilyTextUpdate = (editor, data) => {
11904
      editor.dispatch('FontFamilyTextUpdate', data);
12457
      editor.dispatch('FontFamilyTextUpdate', data);
11905
    };
12458
    };
-
 
12459
    const fireToggleSidebar = editor => {
-
 
12460
      editor.dispatch('ToggleSidebar');
-
 
12461
    };
-
 
12462
    const fireToggleView = editor => {
-
 
12463
      editor.dispatch('ToggleView');
-
 
12464
    };
-
 
12465
    const fireContextToolbarClose = editor => {
-
 
12466
      editor.dispatch('ContextToolbarClose');
-
 
12467
    };
-
 
12468
    const fireContextFormSlideBack = editor => {
-
 
12469
      editor.dispatch('ContextFormSlideBack');
-
 
12470
    };
Línea 11906... Línea 12471...
11906
 
12471
 
11907
    const composeUnbinders = (f, g) => () => {
12472
    const composeUnbinders = (f, g) => () => {
11908
      f();
12473
      f();
11909
      g();
12474
      g();
Línea 11978... Línea 12543...
11978
      return {
12543
      return {
11979
        add,
12544
        add,
11980
        state
12545
        state
11981
      };
12546
      };
11982
    };
12547
    };
11983
    const getCacheForId = id => get$g(cacheStorage, id).getOrThunk(() => {
12548
    const getCacheForId = id => get$h(cacheStorage, id).getOrThunk(() => {
11984
      const storageId = `tinymce-custom-colors-${ id }`;
12549
      const storageId = `tinymce-custom-colors-${ id }`;
11985
      const currentData = global$4.getItem(storageId);
12550
      const currentData = global$4.getItem(storageId);
11986
      if (isNullable(currentData)) {
12551
      if (isNullable(currentData)) {
11987
        const legacyDefault = global$4.getItem('tinymce-custom-colors');
12552
        const legacyDefault = global$4.getItem('tinymce-custom-colors');
11988
        global$4.setItem(storageId, isNonNullable(legacyDefault) ? legacyDefault : '[]');
12553
        global$4.setItem(storageId, isNonNullable(legacyDefault) ? legacyDefault : '[]');
Línea 12047... Línea 12612...
12047
    });
12612
    });
Línea 12048... Línea 12613...
12048
 
12613
 
12049
    const foregroundId = 'forecolor';
12614
    const foregroundId = 'forecolor';
12050
    const backgroundId = 'hilitecolor';
12615
    const backgroundId = 'hilitecolor';
-
 
12616
    const fallbackCols = 5;
-
 
12617
    const mapColors = colorMap => mapColorsRaw(colorMap.map((color, index) => {
-
 
12618
      if (index % 2 === 0) {
-
 
12619
        return '#' + anyToHex(color).value;
-
 
12620
      }
-
 
12621
      return color;
12051
    const fallbackCols = 5;
12622
    }));
12052
    const mapColors = colorMap => {
12623
    const mapColorsRaw = colorMap => {
12053
      const colors = [];
12624
      const colors = [];
12054
      for (let i = 0; i < colorMap.length; i += 2) {
12625
      for (let i = 0; i < colorMap.length; i += 2) {
12055
        colors.push({
12626
        colors.push({
12056
          text: colorMap[i + 1],
12627
          text: colorMap[i + 1],
12057
          value: '#' + anyToHex(colorMap[i]).value,
12628
          value: colorMap[i],
12058
          icon: 'checkmark',
12629
          icon: 'checkmark',
12059
          type: 'choiceitem'
12630
          type: 'choiceitem'
12060
        });
12631
        });
12061
      }
12632
      }
12062
      return colors;
12633
      return colors;
12063
    };
12634
    };
12064
    const option$1 = name => editor => editor.options.get(name);
12635
    const option$1 = name => editor => editor.options.get(name);
12065
    const fallbackColor = '#000000';
12636
    const fallbackColor = '#000000';
12066
    const register$d = editor => {
12637
    const register$e = editor => {
12067
      const registerOption = editor.options.register;
12638
      const registerOption = editor.options.register;
12068
      const colorProcessor = value => {
12639
      const colorProcessor = value => {
12069
        if (isArrayOf(value, isString)) {
12640
        if (isArrayOf(value, isString)) {
12070
          return {
12641
          return {
Línea 12076... Línea 12647...
12076
            valid: false,
12647
            valid: false,
12077
            message: 'Must be an array of strings.'
12648
            message: 'Must be an array of strings.'
12078
          };
12649
          };
12079
        }
12650
        }
12080
      };
12651
      };
-
 
12652
      const colorProcessorRaw = value => {
-
 
12653
        if (isArrayOf(value, isString)) {
-
 
12654
          return {
-
 
12655
            value: mapColorsRaw(value),
-
 
12656
            valid: true
-
 
12657
          };
-
 
12658
        } else {
-
 
12659
          return {
-
 
12660
            valid: false,
-
 
12661
            message: 'Must be an array of strings.'
-
 
12662
          };
-
 
12663
        }
-
 
12664
      };
12081
      const colorColsProcessor = value => {
12665
      const colorColsProcessor = value => {
12082
        if (isNumber(value) && value > 0) {
12666
        if (isNumber(value) && value > 0) {
12083
          return {
12667
          return {
12084
            value,
12668
            value,
12085
            valid: true
12669
            valid: true
Línea 12138... Línea 12722...
12138
          'Black',
12722
          'Black',
12139
          '#ffffff',
12723
          '#ffffff',
12140
          'White'
12724
          'White'
12141
        ]
12725
        ]
12142
      });
12726
      });
-
 
12727
      registerOption('color_map_raw', { processor: colorProcessorRaw });
12143
      registerOption('color_map_background', { processor: colorProcessor });
12728
      registerOption('color_map_background', { processor: colorProcessor });
12144
      registerOption('color_map_foreground', { processor: colorProcessor });
12729
      registerOption('color_map_foreground', { processor: colorProcessor });
12145
      registerOption('color_cols', {
12730
      registerOption('color_cols', {
12146
        processor: colorColsProcessor,
12731
        processor: colorColsProcessor,
12147
        default: calcCols(editor)
12732
        default: calcCols(editor)
Línea 12170... Línea 12755...
12170
    const getColors$2 = (editor, id) => {
12755
    const getColors$2 = (editor, id) => {
12171
      if (id === foregroundId && editor.options.isSet('color_map_foreground')) {
12756
      if (id === foregroundId && editor.options.isSet('color_map_foreground')) {
12172
        return option$1('color_map_foreground')(editor);
12757
        return option$1('color_map_foreground')(editor);
12173
      } else if (id === backgroundId && editor.options.isSet('color_map_background')) {
12758
      } else if (id === backgroundId && editor.options.isSet('color_map_background')) {
12174
        return option$1('color_map_background')(editor);
12759
        return option$1('color_map_background')(editor);
-
 
12760
      } else if (editor.options.isSet('color_map_raw')) {
-
 
12761
        return option$1('color_map_raw')(editor);
12175
      } else {
12762
      } else {
12176
        return option$1('color_map')(editor);
12763
        return option$1('color_map')(editor);
12177
      }
12764
      }
12178
    };
12765
    };
12179
    const calcCols = (editor, id = 'default') => Math.max(fallbackCols, Math.ceil(Math.sqrt(getColors$2(editor, id).length)));
12766
    const calcCols = (editor, id = 'default') => Math.max(fallbackCols, Math.ceil(Math.sqrt(getColors$2(editor, id).length)));
Línea 12205... Línea 12792...
12205
    const defaultBackgroundColor = 'rgba(0, 0, 0, 0)';
12792
    const defaultBackgroundColor = 'rgba(0, 0, 0, 0)';
12206
    const isValidBackgroundColor = value => fromString(value).exists(c => c.alpha !== 0);
12793
    const isValidBackgroundColor = value => fromString(value).exists(c => c.alpha !== 0);
12207
    const getClosestCssBackgroundColorValue = scope => {
12794
    const getClosestCssBackgroundColorValue = scope => {
12208
      return closest$4(scope, node => {
12795
      return closest$4(scope, node => {
12209
        if (isElement$1(node)) {
12796
        if (isElement$1(node)) {
12210
          const color = get$e(node, 'background-color');
12797
          const color = get$f(node, 'background-color');
12211
          return someIf(isValidBackgroundColor(color), color);
12798
          return someIf(isValidBackgroundColor(color), color);
12212
        } else {
12799
        } else {
12213
          return Optional.none();
12800
          return Optional.none();
12214
        }
12801
        }
12215
      }).getOr(defaultBackgroundColor);
12802
      }).getOr(defaultBackgroundColor);
12216
    };
12803
    };
12217
    const getCurrentColor = (editor, format) => {
12804
    const getCurrentColor = (editor, format) => {
12218
      const node = SugarElement.fromDom(editor.selection.getStart());
12805
      const node = SugarElement.fromDom(editor.selection.getStart());
12219
      const cssRgbValue = format === 'hilitecolor' ? getClosestCssBackgroundColorValue(node) : get$e(node, 'color');
12806
      const cssRgbValue = format === 'hilitecolor' ? getClosestCssBackgroundColorValue(node) : get$f(node, 'color');
12220
      return fromString(cssRgbValue).map(rgba => '#' + fromRgba(rgba).value);
12807
      return fromString(cssRgbValue).map(rgba => '#' + fromRgba(rgba).value);
12221
    };
12808
    };
12222
    const applyFormat = (editor, format, value) => {
12809
    const applyFormat = (editor, format, value) => {
12223
      editor.undoManager.transact(() => {
12810
      editor.undoManager.transact(() => {
12224
        editor.focus();
12811
        editor.focus();
Línea 12418... Línea 13005...
12418
        onCancel: () => {
13005
        onCancel: () => {
12419
          callback(Optional.none());
13006
          callback(Optional.none());
12420
        }
13007
        }
12421
      });
13008
      });
12422
    };
13009
    };
12423
    const register$c = editor => {
13010
    const register$d = editor => {
12424
      registerCommands(editor);
13011
      registerCommands(editor);
12425
      const fallbackColorForeground = getDefaultForegroundColor(editor);
13012
      const fallbackColorForeground = getDefaultForegroundColor(editor);
12426
      const fallbackColorBackground = getDefaultBackgroundColor(editor);
13013
      const fallbackColorBackground = getDefaultBackgroundColor(editor);
12427
      const lastForeColor = Cell(fallbackColorForeground);
13014
      const lastForeColor = Cell(fallbackColorForeground);
12428
      const lastBackColor = Cell(fallbackColorBackground);
13015
      const lastBackColor = Cell(fallbackColorBackground);
Línea 12509... Línea 13096...
12509
        spec.onAction({ value });
13096
        spec.onAction({ value });
12510
      }, columns, presets, ItemResponse$1.CLOSE_ON_EXECUTE, spec.select.getOr(never), backstage.shared.providers);
13097
      }, columns, presets, ItemResponse$1.CLOSE_ON_EXECUTE, spec.select.getOr(never), backstage.shared.providers);
12511
      const widgetSpec = {
13098
      const widgetSpec = {
12512
        ...menuSpec,
13099
        ...menuSpec,
12513
        markers: markers(presets),
13100
        markers: markers(presets),
12514
        movement: deriveMenuMovement(columns, presets)
13101
        movement: deriveMenuMovement(columns, presets),
-
 
13102
        showMenuRole: false
12515
      };
13103
      };
12516
      return {
13104
      return {
12517
        type: 'widget',
13105
        type: 'widget',
12518
        data: { value: generate$6('widget-id') },
13106
        data: { value: generate$6('widget-id') },
12519
        dom: {
13107
        dom: {
Línea 12631... Línea 13219...
12631
                  selectCells(cells, row, col, numRows, numColumns);
13219
                  selectCells(cells, row, col, numRows, numColumns);
12632
                  Replacing.set(memLabel.get(c), [makeLabelText(row + 1, col + 1)]);
13220
                  Replacing.set(memLabel.get(c), [makeLabelText(row + 1, col + 1)]);
12633
                }),
13221
                }),
12634
                runWithTarget(cellExecuteEvent, (c, _, e) => {
13222
                runWithTarget(cellExecuteEvent, (c, _, e) => {
12635
                  const {row, col} = e.event;
13223
                  const {row, col} = e.event;
-
 
13224
                  emit(c, sandboxClose());
12636
                  spec.onAction({
13225
                  spec.onAction({
12637
                    numRows: row + 1,
13226
                    numRows: row + 1,
12638
                    numColumns: col + 1
13227
                    numColumns: col + 1
12639
                  });
13228
                  });
12640
                  emit(c, sandboxClose());
-
 
12641
                })
13229
                })
12642
              ]),
13230
              ]),
12643
              Keying.config({
13231
              Keying.config({
12644
                initSize: {
13232
                initSize: {
12645
                  numRows,
13233
                  numRows,
Línea 12655... Línea 13243...
12655
 
13243
 
12656
    const fancyMenuItems = {
13244
    const fancyMenuItems = {
12657
      inserttable: renderInsertTableMenuItem,
13245
      inserttable: renderInsertTableMenuItem,
12658
      colorswatch: renderColorSwatchItem
13246
      colorswatch: renderColorSwatchItem
12659
    };
13247
    };
Línea 12660... Línea 13248...
12660
    const renderFancyMenuItem = (spec, backstage) => get$g(fancyMenuItems, spec.fancytype).map(render => render(spec, backstage));
13248
    const renderFancyMenuItem = (spec, backstage) => get$h(fancyMenuItems, spec.fancytype).map(render => render(spec, backstage));
12661
 
13249
 
12662
    const renderNestedItem = (spec, itemResponse, providersBackstage, renderIcons = true, downwardsCaret = false) => {
13250
    const renderNestedItem = (spec, itemResponse, providersBackstage, renderIcons = true, downwardsCaret = false) => {
12663
      const caret = downwardsCaret ? renderDownwardsCaret(providersBackstage.icons) : renderSubmenuCaret(providersBackstage.icons);
13251
      const caret = downwardsCaret ? renderDownwardsCaret(providersBackstage.icons) : renderSubmenuCaret(providersBackstage.icons);
Línea 12669... Línea 13257...
12669
            set$9(underlinePath, 'fill', value);
13257
            set$9(underlinePath, 'fill', value);
12670
          });
13258
          });
12671
        },
13259
        },
12672
        setTooltip: tooltip => {
13260
        setTooltip: tooltip => {
12673
          const translatedTooltip = providersBackstage.translate(tooltip);
13261
          const translatedTooltip = providersBackstage.translate(tooltip);
12674
          setAll$1(component.element, {
-
 
12675
            'aria-label': translatedTooltip,
13262
          set$9(component.element, 'aria-label', translatedTooltip);
12676
            'title': translatedTooltip
-
 
12677
          });
-
 
12678
        }
13263
        }
12679
      });
13264
      });
12680
      const structure = renderItemStructure({
13265
      const structure = renderItemStructure({
12681
        presets: 'normal',
13266
        presets: 'normal',
12682
        iconContent: spec.icon,
13267
        iconContent: spec.icon,
Línea 12686... Línea 13271...
12686
        caret: Optional.some(caret),
13271
        caret: Optional.some(caret),
12687
        checkMark: Optional.none(),
13272
        checkMark: Optional.none(),
12688
        shortcutContent: spec.shortcut
13273
        shortcutContent: spec.shortcut
12689
      }, providersBackstage, renderIcons);
13274
      }, providersBackstage, renderIcons);
12690
      return renderCommonItem({
13275
      return renderCommonItem({
-
 
13276
        context: spec.context,
12691
        data: buildData(spec),
13277
        data: buildData(spec),
12692
        getApi,
13278
        getApi,
12693
        enabled: spec.enabled,
13279
        enabled: spec.enabled,
12694
        onAction: noop,
13280
        onAction: noop,
12695
        onSetup: spec.onSetup,
13281
        onSetup: spec.onSetup,
Línea 12712... Línea 13298...
12712
        caret: Optional.none(),
13298
        caret: Optional.none(),
12713
        checkMark: Optional.none(),
13299
        checkMark: Optional.none(),
12714
        shortcutContent: spec.shortcut
13300
        shortcutContent: spec.shortcut
12715
      }, providersBackstage, renderIcons);
13301
      }, providersBackstage, renderIcons);
12716
      return renderCommonItem({
13302
      return renderCommonItem({
-
 
13303
        context: spec.context,
12717
        data: buildData(spec),
13304
        data: buildData(spec),
12718
        getApi,
13305
        getApi,
12719
        enabled: spec.enabled,
13306
        enabled: spec.enabled,
12720
        onAction: spec.onAction,
13307
        onAction: spec.onAction,
12721
        onSetup: spec.onSetup,
13308
        onSetup: spec.onSetup,
Línea 12755... Línea 13342...
12755
        shortcutContent: spec.shortcut,
13342
        shortcutContent: spec.shortcut,
12756
        presets: 'normal',
13343
        presets: 'normal',
12757
        meta: spec.meta
13344
        meta: spec.meta
12758
      }, providersBackstage, renderIcons);
13345
      }, providersBackstage, renderIcons);
12759
      return deepMerge(renderCommonItem({
13346
      return deepMerge(renderCommonItem({
-
 
13347
        context: spec.context,
12760
        data: buildData(spec),
13348
        data: buildData(spec),
12761
        enabled: spec.enabled,
13349
        enabled: spec.enabled,
12762
        getApi,
13350
        getApi,
12763
        onAction: spec.onAction,
13351
        onAction: spec.onAction,
12764
        onSetup: spec.onSetup,
13352
        onSetup: spec.onSetup,
Línea 12767... Línea 13355...
12767
      }, structure, itemResponse, providersBackstage), {
13355
      }, structure, itemResponse, providersBackstage), {
12768
        toggling: {
13356
        toggling: {
12769
          toggleClass: tickedClass,
13357
          toggleClass: tickedClass,
12770
          toggleOnExecute: false,
13358
          toggleOnExecute: false,
12771
          selected: spec.active
13359
          selected: spec.active
12772
        }
13360
        },
-
 
13361
        role: spec.role.getOrUndefined()
12773
      });
13362
      });
12774
    };
13363
    };
Línea 12775... Línea 13364...
12775
 
13364
 
12776
    const autocomplete = renderAutocompleteItem;
13365
    const autocomplete = renderAutocompleteItem;
Línea 12790... Línea 13379...
12790
        getExistingCoupled: getExistingCoupled
13379
        getExistingCoupled: getExistingCoupled
12791
    });
13380
    });
Línea 12792... Línea 13381...
12792
 
13381
 
Línea 12793... Línea 13382...
12793
    var CouplingSchema = [requiredOf('others', setOf(Result.value, anyValue()))];
13382
    var CouplingSchema = [requiredOf('others', setOf(Result.value, anyValue()))];
12794
 
13383
 
12795
    const init$a = () => {
13384
    const init$9 = () => {
12796
      const coupled = {};
13385
      const coupled = {};
12797
      const lookupCoupled = (coupleConfig, coupledName) => {
13386
      const lookupCoupled = (coupleConfig, coupledName) => {
12798
        const available = keys(coupleConfig.others);
13387
        const available = keys(coupleConfig.others);
12799
        if (available.length === 0) {
13388
        if (available.length === 0) {
12800
          throw new Error('Cannot find any known coupled components');
13389
          throw new Error('Cannot find any known coupled components');
12801
        } else {
13390
        } else {
12802
          return get$g(coupled, coupledName);
13391
          return get$h(coupled, coupledName);
12803
        }
13392
        }
12804
      };
13393
      };
12805
      const getOrCreate = (component, coupleConfig, name) => {
13394
      const getOrCreate = (component, coupleConfig, name) => {
12806
        return lookupCoupled(coupleConfig, name).getOrThunk(() => {
13395
        return lookupCoupled(coupleConfig, name).getOrThunk(() => {
12807
          const builder = get$g(coupleConfig.others, name).getOrDie('No information found for coupled component: ' + name);
13396
          const builder = get$h(coupleConfig.others, name).getOrDie('No information found for coupled component: ' + name);
12808
          const spec = builder(component);
13397
          const spec = builder(component);
12809
          const built = component.getSystem().build(spec);
13398
          const built = component.getSystem().build(spec);
12810
          coupled[name] = built;
13399
          coupled[name] = built;
12811
          return built;
13400
          return built;
12812
        });
13401
        });
12813
      };
13402
      };
12814
      const getExisting = (component, coupleConfig, name) => {
13403
      const getExisting = (component, coupleConfig, name) => {
12815
        return lookupCoupled(coupleConfig, name).orThunk(() => {
13404
        return lookupCoupled(coupleConfig, name).orThunk(() => {
12816
          get$g(coupleConfig.others, name).getOrDie('No information found for coupled component: ' + name);
13405
          get$h(coupleConfig.others, name).getOrDie('No information found for coupled component: ' + name);
12817
          return Optional.none();
13406
          return Optional.none();
12818
        });
13407
        });
12819
      };
13408
      };
12820
      const readState = constant$1({});
13409
      const readState = constant$1({});
12821
      return nu$8({
13410
      return nu$7({
12822
        readState,
13411
        readState,
12823
        getExisting,
13412
        getExisting,
12824
        getOrCreate
13413
        getOrCreate
Línea 12825... Línea 13414...
12825
      });
13414
      });
12826
    };
13415
    };
12827
 
13416
 
12828
    var CouplingState = /*#__PURE__*/Object.freeze({
13417
    var CouplingState = /*#__PURE__*/Object.freeze({
Línea 12829... Línea 13418...
12829
        __proto__: null,
13418
        __proto__: null,
12830
        init: init$a
13419
        init: init$9
12831
    });
13420
    });
Línea 12971... Línea 13560...
12971
      return fetcher(component).map(mapFetch);
13560
      return fetcher(component).map(mapFetch);
12972
    };
13561
    };
12973
    const openF = (detail, mapFetch, anchor, component, sandbox, externals, highlightOnOpen) => {
13562
    const openF = (detail, mapFetch, anchor, component, sandbox, externals, highlightOnOpen) => {
12974
      const futureData = fetch(detail, mapFetch, component);
13563
      const futureData = fetch(detail, mapFetch, component);
12975
      const getLazySink = getSink(component, detail);
13564
      const getLazySink = getSink(component, detail);
12976
      return futureData.map(tdata => tdata.bind(data => Optional.from(tieredMenu.sketch({
13565
      return futureData.map(tdata => tdata.bind(data => {
12977
        ...externals.menu(),
-
 
12978
        uid: generate$5(''),
-
 
12979
        data,
-
 
12980
        highlightOnOpen,
-
 
12981
        onOpenMenu: (tmenu, menu) => {
-
 
12982
          const sink = getLazySink().getOrDie();
13566
        const primaryMenu = data.menus[data.primary];
12983
          Positioning.position(sink, menu, { anchor });
-
 
12984
          Sandboxing.decloak(sandbox);
-
 
12985
        },
-
 
12986
        onOpenSubmenu: (tmenu, item, submenu) => {
13567
        Optional.from(primaryMenu).each(menu => {
12987
          const sink = getLazySink().getOrDie();
-
 
12988
          Positioning.position(sink, submenu, {
13568
          detail.listRole.each(listRole => {
12989
            anchor: {
-
 
12990
              type: 'submenu',
-
 
12991
              item
13569
            menu.role = listRole;
12992
            }
-
 
12993
          });
13570
          });
-
 
13571
        });
-
 
13572
        return Optional.from(tieredMenu.sketch({
-
 
13573
          ...externals.menu(),
12994
          Sandboxing.decloak(sandbox);
13574
          uid: generate$5(''),
12995
        },
13575
          data,
-
 
13576
          highlightOnOpen,
12996
        onRepositionMenu: (tmenu, primaryMenu, submenuTriggers) => {
13577
          onOpenMenu: (tmenu, menu) => {
12997
          const sink = getLazySink().getOrDie();
13578
            const sink = getLazySink().getOrDie();
12998
          Positioning.position(sink, primaryMenu, { anchor });
13579
            Positioning.position(sink, menu, { anchor });
-
 
13580
            Sandboxing.decloak(sandbox);
-
 
13581
          },
12999
          each$1(submenuTriggers, st => {
13582
          onOpenSubmenu: (tmenu, item, submenu) => {
-
 
13583
            const sink = getLazySink().getOrDie();
13000
            Positioning.position(sink, st.triggeredMenu, {
13584
            Positioning.position(sink, submenu, {
13001
              anchor: {
13585
              anchor: {
13002
                type: 'submenu',
13586
                type: 'submenu',
13003
                item: st.triggeringItem
13587
                item
13004
              }
13588
              }
13005
            });
13589
            });
-
 
13590
            Sandboxing.decloak(sandbox);
-
 
13591
          },
-
 
13592
          onRepositionMenu: (tmenu, primaryMenu, submenuTriggers) => {
-
 
13593
            const sink = getLazySink().getOrDie();
-
 
13594
            Positioning.position(sink, primaryMenu, { anchor });
-
 
13595
            each$1(submenuTriggers, st => {
-
 
13596
              Positioning.position(sink, st.triggeredMenu, {
-
 
13597
                anchor: {
-
 
13598
                  type: 'submenu',
-
 
13599
                  item: st.triggeringItem
-
 
13600
                }
-
 
13601
              });
13006
          });
13602
            });
13007
        },
13603
          },
13008
        onEscape: () => {
13604
          onEscape: () => {
13009
          Focusing.focus(component);
13605
            Focusing.focus(component);
13010
          Sandboxing.close(sandbox);
13606
            Sandboxing.close(sandbox);
13011
          return Optional.some(true);
13607
            return Optional.some(true);
13012
        }
13608
          }
-
 
13609
        }));
13013
      }))));
13610
      }));
13014
    };
13611
    };
13015
    const open = (detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen) => {
13612
    const open = (detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen) => {
13016
      const anchor = getAnchor(detail, hotspot);
13613
      const anchor = getAnchor(detail, hotspot);
13017
      const processed = openF(detail, mapFetch, anchor, hotspot, sandbox, externals, highlightOnOpen);
13614
      const processed = openF(detail, mapFetch, anchor, hotspot, sandbox, externals, highlightOnOpen);
13018
      return processed.map(tdata => {
13615
      return processed.map(tdata => {
Línea 13038... Línea 13635...
13038
      const action = showing ? close : open;
13635
      const action = showing ? close : open;
13039
      return action(detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen);
13636
      return action(detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen);
13040
    };
13637
    };
13041
    const matchWidth = (hotspot, container, useMinWidth) => {
13638
    const matchWidth = (hotspot, container, useMinWidth) => {
13042
      const menu = Composing.getCurrent(container).getOr(container);
13639
      const menu = Composing.getCurrent(container).getOr(container);
13043
      const buttonWidth = get$c(hotspot.element);
13640
      const buttonWidth = get$d(hotspot.element);
13044
      if (useMinWidth) {
13641
      if (useMinWidth) {
13045
        set$8(menu.element, 'min-width', buttonWidth + 'px');
13642
        set$8(menu.element, 'min-width', buttonWidth + 'px');
13046
      } else {
13643
      } else {
13047
        set$7(menu.element, buttonWidth);
13644
        set$7(menu.element, buttonWidth);
13048
      }
13645
      }
Línea 13066... Línea 13663...
13066
          extras.onOpen(component, menu);
13663
          extras.onOpen(component, menu);
13067
        }
13664
        }
13068
      };
13665
      };
13069
      const onClose = (component, menu) => {
13666
      const onClose = (component, menu) => {
13070
        ariaControls.unlink(hotspot.element);
13667
        ariaControls.unlink(hotspot.element);
-
 
13668
        lazySink().getOr(menu).element.dom.dispatchEvent(new window.FocusEvent('focusout'));
13071
        if (extras !== undefined && extras.onClose !== undefined) {
13669
        if (extras !== undefined && extras.onClose !== undefined) {
13072
          extras.onClose(component, menu);
13670
          extras.onClose(component, menu);
13073
        }
13671
        }
13074
      };
13672
      };
13075
      const lazySink = getSink(hotspot, detail);
13673
      const lazySink = getSink(hotspot, detail);
13076
      return {
13674
      return {
13077
        dom: {
13675
        dom: {
13078
          tag: 'div',
13676
          tag: 'div',
13079
          classes: detail.sandboxClasses,
13677
          classes: detail.sandboxClasses,
13080
          attributes: {
-
 
13081
            id: ariaControls.id,
13678
          attributes: { id: ariaControls.id }
13082
            role: 'listbox'
-
 
13083
          }
-
 
13084
        },
13679
        },
13085
        behaviours: SketchBehaviours.augment(detail.sandboxBehaviours, [
13680
        behaviours: SketchBehaviours.augment(detail.sandboxBehaviours, [
13086
          Representing.config({
13681
          Representing.config({
13087
            store: {
13682
            store: {
13088
              mode: 'memory',
13683
              mode: 'memory',
Línea 13145... Línea 13740...
13145
      required$1('toggleClass'),
13740
      required$1('toggleClass'),
13146
      defaulted('eventOrder', {}),
13741
      defaulted('eventOrder', {}),
13147
      option$3('lazySink'),
13742
      option$3('lazySink'),
13148
      defaulted('matchWidth', false),
13743
      defaulted('matchWidth', false),
13149
      defaulted('useMinWidth', false),
13744
      defaulted('useMinWidth', false),
13150
      option$3('role')
13745
      option$3('role'),
-
 
13746
      option$3('listRole')
13151
    ].concat(sandboxFields()));
13747
    ].concat(sandboxFields()));
13152
    const parts$e = constant$1([
13748
    const parts$e = constant$1([
13153
      external({
13749
      external({
13154
        schema: [
13750
        schema: [
13155
          tieredMenuMarkers(),
13751
          tieredMenuMarkers(),
Línea 13162... Línea 13758...
13162
      }),
13758
      }),
13163
      partType$1()
13759
      partType$1()
13164
    ]);
13760
    ]);
Línea 13165... Línea 13761...
13165
 
13761
 
13166
    const factory$k = (detail, components, _spec, externals) => {
13762
    const factory$k = (detail, components, _spec, externals) => {
13167
      const lookupAttr = attr => get$g(detail.dom, 'attributes').bind(attrs => get$g(attrs, attr));
13763
      const lookupAttr = attr => get$h(detail.dom, 'attributes').bind(attrs => get$h(attrs, attr));
13168
      const switchToMenu = sandbox => {
13764
      const switchToMenu = sandbox => {
13169
        Sandboxing.getState(sandbox).each(tmenu => {
13765
        Sandboxing.getState(sandbox).each(tmenu => {
13170
          tieredMenu.highlightPrimary(tmenu);
13766
          tieredMenu.highlightPrimary(tmenu);
13171
        });
13767
        });
Línea 13253... Línea 13849...
13253
              }
13849
              }
13254
            }
13850
            }
13255
          }),
13851
          }),
13256
          Focusing.config({})
13852
          Focusing.config({})
13257
        ]),
13853
        ]),
13258
        events: events$a(Optional.some(action)),
13854
        events: events$9(Optional.some(action)),
13259
        eventOrder: {
13855
        eventOrder: {
13260
          ...detail.eventOrder,
13856
          ...detail.eventOrder,
13261
          [execute$5()]: [
13857
          [execute$5()]: [
13262
            'disabling',
13858
            'disabling',
13263
            'toggling',
13859
            'toggling',
Línea 13265... Línea 13861...
13265
          ]
13861
          ]
13266
        },
13862
        },
13267
        apis,
13863
        apis,
13268
        domModification: {
13864
        domModification: {
13269
          attributes: {
13865
          attributes: {
13270
            'aria-haspopup': 'true',
13866
            'aria-haspopup': detail.listRole.getOr('true'),
13271
            ...detail.role.fold(() => ({}), role => ({ role })),
13867
            ...detail.role.fold(() => ({}), role => ({ role })),
13272
            ...detail.dom.tag === 'button' ? { type: lookupAttr('type').getOr('button') } : {}
13868
            ...detail.dom.tag === 'button' ? { type: lookupAttr('type').getOr('button') } : {}
13273
          }
13869
          }
13274
        }
13870
        }
13275
      };
13871
      };
Línea 13384... Línea 13980...
13384
            onAction: api => {
13980
            onAction: api => {
13385
              d.onAction(api);
13981
              d.onAction(api);
13386
              onItemValueHandler(d.value, d.meta);
13982
              onItemValueHandler(d.value, d.meta);
13387
            }
13983
            }
13388
          }, itemResponse, sharedBackstage, {
13984
          }, itemResponse, sharedBackstage, {
13389
            itemBehaviours: tooltipBehaviour(d.meta, sharedBackstage),
13985
            itemBehaviours: tooltipBehaviour(d.meta, sharedBackstage, Optional.none()),
13390
            cardText: {
13986
            cardText: {
13391
              matchText,
13987
              matchText,
13392
              highlightOn
13988
              highlightOn
13393
            }
13989
            }
13394
          })));
13990
          })));
Línea 13435... Línea 14031...
13435
          fakeFocus: focusMode === FocusMode.ContentFocus
14031
          fakeFocus: focusMode === FocusMode.ContentFocus
13436
        }
14032
        }
13437
      };
14033
      };
13438
    };
14034
    };
Línea 13439... Línea -...
13439
 
-
 
13440
    const getAutocompleterRange = (dom, initRange) => {
14035
 
13441
      return detect$1(SugarElement.fromDom(initRange.startContainer)).map(elm => {
-
 
13442
        const range = dom.createRng();
-
 
13443
        range.selectNode(elm.dom);
-
 
13444
        return range;
-
 
13445
      });
-
 
13446
    };
14036
    const rangeToSimRange = r => SimRange.create(SugarElement.fromDom(r.startContainer), r.startOffset, SugarElement.fromDom(r.endContainer), r.endOffset);
13447
    const register$b = (editor, sharedBackstage) => {
14037
    const register$c = (editor, sharedBackstage) => {
13448
      const autocompleterId = generate$6('autocompleter');
14038
      const autocompleterId = generate$6('autocompleter');
13449
      const processingAction = Cell(false);
14039
      const processingAction = Cell(false);
-
 
14040
      const activeState = Cell(false);
13450
      const activeState = Cell(false);
14041
      const activeRange = value$4();
13451
      const autocompleter = build$1(InlineView.sketch({
14042
      const autocompleter = build$1(InlineView.sketch({
13452
        dom: {
14043
        dom: {
13453
          tag: 'div',
14044
          tag: 'div',
13454
          classes: ['tox-autocompleter'],
14045
          classes: ['tox-autocompleter'],
Línea 13470... Línea 14061...
13470
        if (isMenuOpen()) {
14061
        if (isMenuOpen()) {
13471
          InlineView.hide(autocompleter);
14062
          InlineView.hide(autocompleter);
13472
          editor.dom.remove(autocompleterId, false);
14063
          editor.dom.remove(autocompleterId, false);
13473
          const editorBody = SugarElement.fromDom(editor.getBody());
14064
          const editorBody = SugarElement.fromDom(editor.getBody());
13474
          getOpt(editorBody, 'aria-owns').filter(ariaOwnsAttr => ariaOwnsAttr === autocompleterId).each(() => {
14065
          getOpt(editorBody, 'aria-owns').filter(ariaOwnsAttr => ariaOwnsAttr === autocompleterId).each(() => {
13475
            remove$7(editorBody, 'aria-owns');
14066
            remove$8(editorBody, 'aria-owns');
13476
            remove$7(editorBody, 'aria-activedescendant');
14067
            remove$8(editorBody, 'aria-activedescendant');
13477
          });
14068
          });
13478
        }
14069
        }
13479
      };
14070
      };
13480
      const getMenu = () => InlineView.getContent(autocompleter).bind(tmenu => {
14071
      const getMenu = () => InlineView.getContent(autocompleter).bind(tmenu => {
13481
        return get$h(tmenu.components(), 0);
14072
        return get$i(tmenu.components(), 0);
13482
      });
14073
      });
13483
      const cancelIfNecessary = () => editor.execCommand('mceAutocompleterClose');
14074
      const cancelIfNecessary = () => editor.execCommand('mceAutocompleterClose');
13484
      const getCombinedItems = matches => {
14075
      const getCombinedItems = matches => {
13485
        const columns = findMap(matches, m => Optional.from(m.columns)).getOr(1);
14076
        const columns = findMap(matches, m => Optional.from(m.columns)).getOr(1);
13486
        return bind$3(matches, match => {
14077
        return bind$3(matches, match => {
13487
          const choices = match.items;
14078
          const choices = match.items;
13488
          return createAutocompleteItems(choices, match.matchText, (itemValue, itemMeta) => {
14079
          return createAutocompleteItems(choices, match.matchText, (itemValue, itemMeta) => {
13489
            const nr = editor.selection.getRng();
-
 
13490
            getAutocompleterRange(editor.dom, nr).each(range => {
-
 
13491
              const autocompleterApi = {
14080
            const autocompleterApi = {
13492
                hide: () => cancelIfNecessary(),
14081
              hide: () => cancelIfNecessary(),
13493
                reload: fetchOptions => {
14082
              reload: fetchOptions => {
13494
                  hideIfNecessary();
14083
                hideIfNecessary();
13495
                  editor.execCommand('mceAutocompleterReload', false, { fetchOptions });
14084
                editor.execCommand('mceAutocompleterReload', false, { fetchOptions });
13496
                }
14085
              }
13497
              };
14086
            };
-
 
14087
            editor.execCommand('mceAutocompleterRefreshActiveRange');
-
 
14088
            activeRange.get().each(range => {
13498
              processingAction.set(true);
14089
              processingAction.set(true);
13499
              match.onAction(autocompleterApi, range, itemValue, itemMeta);
14090
              match.onAction(autocompleterApi, range, itemValue, itemMeta);
13500
              processingAction.set(false);
14091
              processingAction.set(false);
13501
            });
14092
            });
13502
          }, columns, ItemResponse$1.BUBBLE_TO_SANDBOX, sharedBackstage, match.highlightOn);
14093
          }, columns, ItemResponse$1.BUBBLE_TO_SANDBOX, sharedBackstage, match.highlightOn);
13503
        });
14094
        });
13504
      };
14095
      };
13505
      const display = (lookupData, items) => {
14096
      const display = (lookupData, items) => {
13506
        findIn(SugarElement.fromDom(editor.getBody())).each(element => {
-
 
13507
          const columns = findMap(lookupData, ld => Optional.from(ld.columns)).getOr(1);
14097
        const columns = findMap(lookupData, ld => Optional.from(ld.columns)).getOr(1);
13508
          InlineView.showMenuAt(autocompleter, {
14098
        InlineView.showMenuAt(autocompleter, {
13509
            anchor: {
14099
          anchor: {
13510
              type: 'node',
14100
            type: 'selection',
13511
              root: SugarElement.fromDom(editor.getBody()),
14101
            getSelection: () => activeRange.get().map(rangeToSimRange),
13512
              node: Optional.from(element)
14102
            root: SugarElement.fromDom(editor.getBody())
13513
            }
14103
          }
13514
          }, createInlineMenuFrom(createPartialMenuWithAlloyItems('autocompleter-value', true, items, columns, { menuType: 'normal' }), columns, FocusMode.ContentFocus, 'normal'));
14104
        }, createInlineMenuFrom(createPartialMenuWithAlloyItems('autocompleter-value', true, items, columns, { menuType: 'normal' }), columns, FocusMode.ContentFocus, 'normal'));
13515
        });
-
 
13516
        getMenu().each(Highlighting.highlightFirst);
14105
        getMenu().each(Highlighting.highlightFirst);
13517
      };
14106
      };
13518
      const updateDisplay = lookupData => {
14107
      const updateDisplay = lookupData => {
13519
        const combinedItems = getCombinedItems(lookupData);
14108
        const combinedItems = getCombinedItems(lookupData);
13520
        if (combinedItems.length > 0) {
14109
        if (combinedItems.length > 0) {
Línea 13546... Línea 14135...
13546
          top: `${ selection.offsetTop }px`,
14135
          top: `${ selection.offsetTop }px`,
13547
          left: `${ selection.offsetLeft }px`
14136
          left: `${ selection.offsetLeft }px`
13548
        });
14137
        });
13549
        editor.dom.add(docElm, newElm.dom);
14138
        editor.dom.add(docElm, newElm.dom);
13550
        descendant(newElm, '[role="menu"]').each(child => {
14139
        descendant(newElm, '[role="menu"]').each(child => {
13551
          remove$6(child, 'position');
14140
          remove$7(child, 'position');
13552
          remove$6(child, 'max-height');
14141
          remove$7(child, 'max-height');
13553
        });
14142
        });
13554
      };
14143
      };
13555
      editor.on('AutocompleterStart', ({lookupData}) => {
14144
      editor.on('AutocompleterStart', ({lookupData}) => {
13556
        activeState.set(true);
14145
        activeState.set(true);
13557
        processingAction.set(false);
14146
        processingAction.set(false);
13558
        updateDisplay(lookupData);
14147
        updateDisplay(lookupData);
13559
      });
14148
      });
13560
      editor.on('AutocompleterUpdate', ({lookupData}) => updateDisplay(lookupData));
14149
      editor.on('AutocompleterUpdate', ({lookupData}) => updateDisplay(lookupData));
-
 
14150
      editor.on('AutocompleterUpdateActiveRange', ({range}) => activeRange.set(range));
13561
      editor.on('AutocompleterEnd', () => {
14151
      editor.on('AutocompleterEnd', () => {
13562
        hideIfNecessary();
14152
        hideIfNecessary();
13563
        activeState.set(false);
14153
        activeState.set(false);
13564
        processingAction.set(false);
14154
        processingAction.set(false);
-
 
14155
        activeRange.clear();
13565
      });
14156
      });
13566
      const autocompleterUiApi = {
14157
      const autocompleterUiApi = {
13567
        cancelIfNecessary,
14158
        cancelIfNecessary,
13568
        isMenuOpen,
14159
        isMenuOpen,
13569
        isActive,
14160
        isActive,
13570
        isProcessingAction: processingAction.get,
14161
        isProcessingAction: processingAction.get,
13571
        getMenu
14162
        getMenu
13572
      };
14163
      };
13573
      AutocompleterEditorEvents.setup(autocompleterUiApi, editor);
14164
      AutocompleterEditorEvents.setup(autocompleterUiApi, editor);
13574
    };
14165
    };
13575
    const Autocompleter = { register: register$b };
14166
    const Autocompleter = { register: register$c };
13576
 
-
 
13577
    const nonScrollingOverflows = [
-
 
13578
      'visible',
-
 
13579
      'hidden',
-
 
13580
      'clip'
-
 
13581
    ];
-
 
13582
    const isScrollingOverflowValue = value => trim$1(value).length > 0 && !contains$2(nonScrollingOverflows, value);
-
 
13583
    const isScroller = elem => {
-
 
13584
      if (isHTMLElement(elem)) {
-
 
13585
        const overflowX = get$e(elem, 'overflow-x');
-
 
13586
        const overflowY = get$e(elem, 'overflow-y');
-
 
13587
        return isScrollingOverflowValue(overflowX) || isScrollingOverflowValue(overflowY);
-
 
13588
      } else {
-
 
13589
        return false;
-
 
13590
      }
-
 
13591
    };
-
 
13592
    const detect = popupSinkElem => {
-
 
13593
      const ancestorsScrollers = ancestors(popupSinkElem, isScroller);
-
 
13594
      const scrollers = ancestorsScrollers.length === 0 ? getShadowRoot(popupSinkElem).map(getShadowHost).map(x => ancestors(x, isScroller)).getOr([]) : ancestorsScrollers;
-
 
13595
      return head(scrollers).map(element => ({
-
 
13596
        element,
-
 
13597
        others: scrollers.slice(1)
-
 
13598
      }));
-
 
13599
    };
-
 
13600
    const detectWhenSplitUiMode = (editor, popupSinkElem) => isSplitUiMode(editor) ? detect(popupSinkElem) : Optional.none();
-
 
13601
    const getBoundsFrom = sc => {
-
 
13602
      const scrollableBoxes = [
-
 
13603
        ...map$2(sc.others, box$1),
-
 
13604
        win()
-
 
13605
      ];
-
 
13606
      return constrainByMany(box$1(sc.element), scrollableBoxes);
-
 
13607
    };
-
 
Línea 13608... Línea 14167...
13608
 
14167
 
Línea 13609... Línea 14168...
13609
    const closest = (scope, selector, isRoot) => closest$1(scope, selector, isRoot).isSome();
14168
    const closest = (scope, selector, isRoot) => closest$1(scope, selector, isRoot).isSome();
13610
 
14169
 
Línea 13641... Línea 14200...
13641
      const distX = Math.abs(touch.clientX - data.x);
14200
      const distX = Math.abs(touch.clientX - data.x);
13642
      const distY = Math.abs(touch.clientY - data.y);
14201
      const distY = Math.abs(touch.clientY - data.y);
13643
      return distX > SIGNIFICANT_MOVE || distY > SIGNIFICANT_MOVE;
14202
      return distX > SIGNIFICANT_MOVE || distY > SIGNIFICANT_MOVE;
13644
    };
14203
    };
13645
    const monitor = settings => {
14204
    const monitor = settings => {
13646
      const startData = value$2();
14205
      const startData = value$4();
13647
      const longpressFired = Cell(false);
14206
      const longpressFired = Cell(false);
13648
      const longpress$1 = DelayedFunction(event => {
14207
      const longpress$1 = DelayedFunction(event => {
13649
        settings.triggerEvent(longpress(), event);
14208
        settings.triggerEvent(longpress(), event);
13650
        longpressFired.set(true);
14209
        longpressFired.set(true);
13651
      }, LONGPRESS_DELAY);
14210
      }, LONGPRESS_DELAY);
Línea 13698... Línea 14257...
13698
        {
14257
        {
13699
          key: touchend(),
14258
          key: touchend(),
13700
          value: handleTouchend
14259
          value: handleTouchend
13701
        }
14260
        }
13702
      ]);
14261
      ]);
13703
      const fireIfReady = (event, type) => get$g(handlers, type).bind(handler => handler(event));
14262
      const fireIfReady = (event, type) => get$h(handlers, type).bind(handler => handler(event));
13704
      return { fireIfReady };
14263
      return { fireIfReady };
13705
    };
14264
    };
Línea 13706... Línea 14265...
13706
 
14265
 
13707
    const isDangerous = event => {
14266
    const isDangerous = event => {
Línea 13754... Línea 14313...
13754
        const stopped = settings.triggerEvent(type, event);
14313
        const stopped = settings.triggerEvent(type, event);
13755
        if (stopped) {
14314
        if (stopped) {
13756
          event.kill();
14315
          event.kill();
13757
        }
14316
        }
13758
      }));
14317
      }));
13759
      const pasteTimeout = value$2();
14318
      const pasteTimeout = value$4();
13760
      const onPaste = bind(container, 'paste', event => {
14319
      const onPaste = bind(container, 'paste', event => {
13761
        tapEvent.fireIfReady(event, 'paste').each(tapStopped => {
14320
        tapEvent.fireIfReady(event, 'paste').each(tapStopped => {
13762
          if (tapStopped) {
14321
          if (tapStopped) {
13763
            event.kill();
14322
            event.kill();
13764
          }
14323
          }
Línea 13783... Línea 14342...
13783
        const stopped = settings.triggerEvent('focusin', event);
14342
        const stopped = settings.triggerEvent('focusin', event);
13784
        if (stopped) {
14343
        if (stopped) {
13785
          event.kill();
14344
          event.kill();
13786
        }
14345
        }
13787
      });
14346
      });
13788
      const focusoutTimeout = value$2();
14347
      const focusoutTimeout = value$4();
13789
      const onFocusOut = bind(container, 'focusout', event => {
14348
      const onFocusOut = bind(container, 'focusout', event => {
13790
        const stopped = settings.triggerEvent('focusout', event);
14349
        const stopped = settings.triggerEvent('focusout', event);
13791
        if (stopped) {
14350
        if (stopped) {
13792
          event.kill();
14351
          event.kill();
13793
        }
14352
        }
Línea 13808... Línea 14367...
13808
      };
14367
      };
13809
      return { unbind };
14368
      return { unbind };
13810
    };
14369
    };
Línea 13811... Línea 14370...
13811
 
14370
 
13812
    const derive = (rawEvent, rawTarget) => {
14371
    const derive = (rawEvent, rawTarget) => {
13813
      const source = get$g(rawEvent, 'target').getOr(rawTarget);
14372
      const source = get$h(rawEvent, 'target').getOr(rawTarget);
13814
      return Cell(source);
14373
      return Cell(source);
Línea 13815... Línea 14374...
13815
    };
14374
    };
13816
 
14375
 
Línea 13916... Línea 14475...
13916
          const handlers = registry[k] !== undefined ? registry[k] : {};
14475
          const handlers = registry[k] !== undefined ? registry[k] : {};
13917
          handlers[id] = curryArgs(v, extraArgs);
14476
          handlers[id] = curryArgs(v, extraArgs);
13918
          registry[k] = handlers;
14477
          registry[k] = handlers;
13919
        });
14478
        });
13920
      };
14479
      };
13921
      const findHandler = (handlers, elem) => read$1(elem).bind(id => get$g(handlers, id)).map(descHandler => eventHandler(elem, descHandler));
14480
      const findHandler = (handlers, elem) => read(elem).bind(id => get$h(handlers, id)).map(descHandler => eventHandler(elem, descHandler));
13922
      const filterByType = type => get$g(registry, type).map(handlers => mapToArray(handlers, (f, id) => broadcastHandler(id, f))).getOr([]);
14481
      const filterByType = type => get$h(registry, type).map(handlers => mapToArray(handlers, (f, id) => broadcastHandler(id, f))).getOr([]);
13923
      const find = (isAboveRoot, type, target) => get$g(registry, type).bind(handlers => closest$4(target, elem => findHandler(handlers, elem), isAboveRoot));
14482
      const find = (isAboveRoot, type, target) => get$h(registry, type).bind(handlers => closest$4(target, elem => findHandler(handlers, elem), isAboveRoot));
13924
      const unregisterId = id => {
14483
      const unregisterId = id => {
13925
        each(registry, (handlersById, _eventName) => {
14484
        each(registry, (handlersById, _eventName) => {
13926
          if (has$2(handlersById, id)) {
14485
          if (has$2(handlersById, id)) {
13927
            delete handlersById[id];
14486
            delete handlersById[id];
13928
          }
14487
          }
Línea 13939... Línea 14498...
13939
    const Registry = () => {
14498
    const Registry = () => {
13940
      const events = EventRegistry();
14499
      const events = EventRegistry();
13941
      const components = {};
14500
      const components = {};
13942
      const readOrTag = component => {
14501
      const readOrTag = component => {
13943
        const elem = component.element;
14502
        const elem = component.element;
13944
        return read$1(elem).getOrThunk(() => write('uid-', component.element));
14503
        return read(elem).getOrThunk(() => write('uid-', component.element));
13945
      };
14504
      };
13946
      const failOnDuplicate = (component, tagId) => {
14505
      const failOnDuplicate = (component, tagId) => {
13947
        const conflict = components[tagId];
14506
        const conflict = components[tagId];
13948
        if (conflict === component) {
14507
        if (conflict === component) {
13949
          unregister(component);
14508
          unregister(component);
Línea 13959... Línea 14518...
13959
        const extraArgs = [component];
14518
        const extraArgs = [component];
13960
        events.registerId(extraArgs, tagId, component.events);
14519
        events.registerId(extraArgs, tagId, component.events);
13961
        components[tagId] = component;
14520
        components[tagId] = component;
13962
      };
14521
      };
13963
      const unregister = component => {
14522
      const unregister = component => {
13964
        read$1(component.element).each(tagId => {
14523
        read(component.element).each(tagId => {
13965
          delete components[tagId];
14524
          delete components[tagId];
13966
          events.unregisterId(tagId);
14525
          events.unregisterId(tagId);
13967
        });
14526
        });
13968
      };
14527
      };
13969
      const filter = type => events.filterByType(type);
14528
      const filter = type => events.filterByType(type);
13970
      const find = (isAboveRoot, type, target) => events.find(isAboveRoot, type, target);
14529
      const find = (isAboveRoot, type, target) => events.find(isAboveRoot, type, target);
13971
      const getById = id => get$g(components, id);
14530
      const getById = id => get$h(components, id);
13972
      return {
14531
      return {
13973
        find,
14532
        find,
13974
        filter,
14533
        filter,
13975
        register,
14534
        register,
13976
        unregister,
14535
        unregister,
Línea 13989... Línea 14548...
13989
            ...attributes
14548
            ...attributes
13990
          },
14549
          },
13991
          ...domWithoutAttributes
14550
          ...domWithoutAttributes
13992
        },
14551
        },
13993
        components: detail.components,
14552
        components: detail.components,
13994
        behaviours: get$3(detail.containerBehaviours),
14553
        behaviours: get$4(detail.containerBehaviours),
13995
        events: detail.events,
14554
        events: detail.events,
13996
        domModification: detail.domModification,
14555
        domModification: detail.domModification,
13997
        eventOrder: detail.eventOrder
14556
        eventOrder: detail.eventOrder
13998
      };
14557
      };
13999
    };
14558
    };
Línea 14022... Línea 14581...
14022
        debugInfo: constant$1('real'),
14581
        debugInfo: constant$1('real'),
14023
        triggerEvent: (eventName, target, data) => {
14582
        triggerEvent: (eventName, target, data) => {
14024
          monitorEvent(eventName, target, logger => triggerOnUntilStopped(lookup, eventName, data, target, logger));
14583
          monitorEvent(eventName, target, logger => triggerOnUntilStopped(lookup, eventName, data, target, logger));
14025
        },
14584
        },
14026
        triggerFocus: (target, originator) => {
14585
        triggerFocus: (target, originator) => {
14027
          read$1(target).fold(() => {
14586
          read(target).fold(() => {
14028
            focus$3(target);
14587
            focus$3(target);
14029
          }, _alloyId => {
14588
          }, _alloyId => {
14030
            monitorEvent(focus$4(), target, logger => {
14589
            monitorEvent(focus$4(), target, logger => {
14031
              triggerHandler(lookup, focus$4(), {
14590
              triggerHandler(lookup, focus$4(), {
14032
                originator,
14591
                originator,
Línea 14093... Línea 14652...
14093
      const remove = component => {
14652
      const remove = component => {
14094
        detach(component);
14653
        detach(component);
14095
      };
14654
      };
14096
      const destroy = () => {
14655
      const destroy = () => {
14097
        domEvents.unbind();
14656
        domEvents.unbind();
14098
        remove$5(root.element);
14657
        remove$6(root.element);
14099
      };
14658
      };
14100
      const broadcastData = data => {
14659
      const broadcastData = data => {
14101
        const receivers = registry.filter(receive());
14660
        const receivers = registry.filter(receive());
14102
        each$1(receivers, receiver => {
14661
        each$1(receivers, receiver => {
14103
          const descHandler = receiver.descHandler;
14662
          const descHandler = receiver.descHandler;
Línea 14122... Línea 14681...
14122
        const listeners = registry.filter(eventName);
14681
        const listeners = registry.filter(eventName);
14123
        return broadcast(listeners, event);
14682
        return broadcast(listeners, event);
14124
      };
14683
      };
14125
      const getByUid = uid => registry.getById(uid).fold(() => Result.error(new Error('Could not find component with uid: "' + uid + '" in system.')), Result.value);
14684
      const getByUid = uid => registry.getById(uid).fold(() => Result.error(new Error('Could not find component with uid: "' + uid + '" in system.')), Result.value);
14126
      const getByDom = elem => {
14685
      const getByDom = elem => {
14127
        const uid = read$1(elem).getOr('not found');
14686
        const uid = read(elem).getOr('not found');
14128
        return getByUid(uid);
14687
        return getByUid(uid);
14129
      };
14688
      };
14130
      addToWorld(root);
14689
      addToWorld(root);
14131
      return {
14690
      return {
14132
        root,
14691
        root,
Línea 14258... Línea 14817...
14258
        getField: (apis, comp) => apis.getField(comp),
14817
        getField: (apis, comp) => apis.getField(comp),
14259
        getLabel: (apis, comp) => apis.getLabel(comp)
14818
        getLabel: (apis, comp) => apis.getLabel(comp)
14260
      }
14819
      }
14261
    });
14820
    });
Línea 14262... Línea -...
14262
 
-
 
14263
    const exhibit$2 = (base, tabConfig) => nu$7({
-
 
14264
      attributes: wrapAll([{
-
 
14265
          key: tabConfig.tabAttr,
-
 
14266
          value: 'true'
-
 
14267
        }])
-
 
14268
    });
-
 
14269
 
-
 
14270
    var ActiveTabstopping = /*#__PURE__*/Object.freeze({
-
 
14271
        __proto__: null,
-
 
14272
        exhibit: exhibit$2
-
 
14273
    });
-
 
14274
 
-
 
14275
    var TabstopSchema = [defaulted('tabAttr', 'data-alloy-tabstop')];
-
 
14276
 
-
 
14277
    const Tabstopping = create$4({
-
 
14278
      fields: TabstopSchema,
-
 
14279
      name: 'tabstopping',
-
 
14280
      active: ActiveTabstopping
-
 
14281
    });
-
 
14282
 
14821
 
Línea 14283... Línea 14822...
14283
    var global$3 = tinymce.util.Tools.resolve('tinymce.html.Entities');
14822
    var global$3 = tinymce.util.Tools.resolve('tinymce.html.Entities');
14284
 
14823
 
14285
    const renderFormFieldWith = (pLabel, pField, extraClasses, extraBehaviours) => {
14824
    const renderFormFieldWith = (pLabel, pField, extraClasses, extraBehaviours) => {
Línea 14304... Línea 14843...
14304
      },
14843
      },
14305
      components: [text$2(providersBackstage.translate(label))]
14844
      components: [text$2(providersBackstage.translate(label))]
14306
    });
14845
    });
Línea 14307... Línea 14846...
14307
 
14846
 
-
 
14847
    const formChangeEvent = generate$6('form-component-change');
14308
    const formChangeEvent = generate$6('form-component-change');
14848
    const formInputEvent = generate$6('form-component-input');
14309
    const formCloseEvent = generate$6('form-close');
14849
    const formCloseEvent = generate$6('form-close');
14310
    const formCancelEvent = generate$6('form-cancel');
14850
    const formCancelEvent = generate$6('form-cancel');
14311
    const formActionEvent = generate$6('form-action');
14851
    const formActionEvent = generate$6('form-action');
14312
    const formSubmitEvent = generate$6('form-submit');
14852
    const formSubmitEvent = generate$6('form-submit');
Línea 14322... Línea 14862...
14322
        var _a;
14862
        var _a;
14323
        return (_a = icons[icon]) !== null && _a !== void 0 ? _a : icon;
14863
        return (_a = icons[icon]) !== null && _a !== void 0 ? _a : icon;
14324
      };
14864
      };
14325
      const runOnItem = f => (comp, se) => {
14865
      const runOnItem = f => (comp, se) => {
14326
        closest$1(se.event.target, '[data-collection-item-value]').each(target => {
14866
        closest$1(se.event.target, '[data-collection-item-value]').each(target => {
14327
          f(comp, se, target, get$f(target, 'data-collection-item-value'));
14867
          f(comp, se, target, get$g(target, 'data-collection-item-value'));
14328
        });
14868
        });
14329
      };
14869
      };
14330
      const setContents = (comp, items) => {
14870
      const setContents = (comp, items) => {
-
 
14871
        const disabled = providersBackstage.checkUiComponentContext('mode:design').shouldDisable || providersBackstage.isDisabled();
-
 
14872
        const disabledClass = disabled ? ' tox-collection__item--state-disabled' : '';
14331
        const htmlLines = map$2(items, item => {
14873
        const htmlLines = map$2(items, item => {
14332
          const itemText = global$8.translate(item.text);
14874
          const itemText = global$5.translate(item.text);
14333
          const textContent = spec.columns === 1 ? `<div class="tox-collection__item-label">${ itemText }</div>` : '';
14875
          const textContent = spec.columns === 1 ? `<div class="tox-collection__item-label">${ itemText }</div>` : '';
14334
          const iconContent = `<div class="tox-collection__item-icon">${ getIcon(item.icon) }</div>`;
14876
          const iconContent = `<div class="tox-collection__item-icon">${ getIcon(item.icon) }</div>`;
14335
          const mapItemName = {
14877
          const mapItemName = {
14336
            '_': ' ',
14878
            '_': ' ',
14337
            ' - ': ' ',
14879
            ' - ': ' ',
14338
            '-': ' '
14880
            '-': ' '
14339
          };
14881
          };
14340
          const ariaLabel = itemText.replace(/\_| \- |\-/g, match => mapItemName[match]);
14882
          const ariaLabel = itemText.replace(/\_| \- |\-/g, match => mapItemName[match]);
14341
          const disabledClass = providersBackstage.isDisabled() ? ' tox-collection__item--state-disabled' : '';
-
 
14342
          return `<div class="tox-collection__item${ disabledClass }" tabindex="-1" data-collection-item-value="${ global$3.encodeAllRaw(item.value) }" title="${ ariaLabel }" aria-label="${ ariaLabel }">${ iconContent }${ textContent }</div>`;
14883
          return `<div data-mce-tooltip="${ ariaLabel }" class="tox-collection__item${ disabledClass }" tabindex="-1" data-collection-item-value="${ global$3.encodeAllRaw(item.value) }" aria-label="${ ariaLabel }">${ iconContent }${ textContent }</div>`;
14343
        });
14884
        });
14344
        const chunks = spec.columns !== 'auto' && spec.columns > 1 ? chunk$1(htmlLines, spec.columns) : [htmlLines];
14885
        const chunks = spec.columns !== 'auto' && spec.columns > 1 ? chunk$1(htmlLines, spec.columns) : [htmlLines];
14345
        const html = map$2(chunks, ch => `<div class="tox-collection__group">${ ch.join('') }</div>`);
14886
        const html = map$2(chunks, ch => `<div class="tox-collection__group">${ ch.join('') }</div>`);
14346
        set$6(comp.element, html.join(''));
14887
        set$6(comp.element, html.join(''));
14347
      };
14888
      };
14348
      const onClick = runOnItem((comp, se, tgt, itemValue) => {
14889
      const onClick = runOnItem((comp, se, tgt, itemValue) => {
14349
        se.stop();
14890
        se.stop();
14350
        if (!providersBackstage.isDisabled()) {
14891
        if (!(providersBackstage.checkUiComponentContext('mode:design').shouldDisable || providersBackstage.isDisabled())) {
14351
          emitWith(comp, formActionEvent, {
14892
          emitWith(comp, formActionEvent, {
14352
            name: spec.name,
14893
            name: spec.name,
14353
            value: itemValue
14894
            value: itemValue
14354
          });
14895
          });
14355
        }
14896
        }
14356
      });
14897
      });
14357
      const collectionEvents = [
14898
      const collectionEvents = [
14358
        run$1(mouseover(), runOnItem((comp, se, tgt) => {
14899
        run$1(mouseover(), runOnItem((comp, se, tgt) => {
14359
          focus$3(tgt);
14900
          focus$3(tgt, true);
14360
        })),
14901
        })),
14361
        run$1(click(), onClick),
14902
        run$1(click(), onClick),
14362
        run$1(tap(), onClick),
14903
        run$1(tap(), onClick),
14363
        run$1(focusin(), runOnItem((comp, se, tgt) => {
14904
        run$1(focusin(), runOnItem((comp, se, tgt) => {
14364
          descendant(comp.element, '.' + activeClass).each(currentActive => {
14905
          descendant(comp.element, '.' + activeClass).each(currentActive => {
14365
            remove$2(currentActive, activeClass);
14906
            remove$3(currentActive, activeClass);
14366
          });
14907
          });
14367
          add$2(tgt, activeClass);
14908
          add$2(tgt, activeClass);
14368
        })),
14909
        })),
14369
        run$1(focusout(), runOnItem(comp => {
14910
        run$1(focusout(), runOnItem(comp => {
14370
          descendant(comp.element, '.' + activeClass).each(currentActive => {
14911
          descendant(comp.element, '.' + activeClass).each(currentActive => {
14371
            remove$2(currentActive, activeClass);
14912
            remove$3(currentActive, activeClass);
-
 
14913
            blur$1(currentActive);
14372
          });
14914
          });
14373
        })),
14915
        })),
14374
        runOnExecute$1(runOnItem((comp, se, tgt, itemValue) => {
14916
        runOnExecute$1(runOnItem((comp, se, tgt, itemValue) => {
14375
          emitWith(comp, formActionEvent, {
14917
          emitWith(comp, formActionEvent, {
14376
            name: spec.name,
14918
            name: spec.name,
Línea 14386... Línea 14928...
14386
        },
14928
        },
14387
        components: [],
14929
        components: [],
14388
        factory: { sketch: identity },
14930
        factory: { sketch: identity },
14389
        behaviours: derive$1([
14931
        behaviours: derive$1([
14390
          Disabling.config({
14932
          Disabling.config({
14391
            disabled: providersBackstage.isDisabled,
14933
            disabled: () => providersBackstage.checkUiComponentContext(spec.context).shouldDisable,
14392
            onDisabled: comp => {
14934
            onDisabled: comp => {
14393
              iterCollectionItems(comp, childElm => {
14935
              iterCollectionItems(comp, childElm => {
14394
                add$2(childElm, 'tox-collection__item--state-disabled');
14936
                add$2(childElm, 'tox-collection__item--state-disabled');
14395
                set$9(childElm, 'aria-disabled', true);
14937
                set$9(childElm, 'aria-disabled', true);
14396
              });
14938
              });
14397
            },
14939
            },
14398
            onEnabled: comp => {
14940
            onEnabled: comp => {
14399
              iterCollectionItems(comp, childElm => {
14941
              iterCollectionItems(comp, childElm => {
14400
                remove$2(childElm, 'tox-collection__item--state-disabled');
14942
                remove$3(childElm, 'tox-collection__item--state-disabled');
14401
                remove$7(childElm, 'aria-disabled');
14943
                remove$8(childElm, 'aria-disabled');
14402
              });
14944
              });
14403
            }
14945
            }
14404
          }),
14946
          }),
14405
          receivingConfig(),
14947
          toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context)),
14406
          Replacing.config({}),
14948
          Replacing.config({}),
-
 
14949
          Tooltipping.config({
-
 
14950
            ...providersBackstage.tooltips.getConfig({
-
 
14951
              tooltipText: '',
-
 
14952
              onShow: comp => {
-
 
14953
                descendant(comp.element, '.' + activeClass + '[data-mce-tooltip]').each(current => {
-
 
14954
                  getOpt(current, 'data-mce-tooltip').each(text => {
-
 
14955
                    Tooltipping.setComponents(comp, providersBackstage.tooltips.getComponents({ tooltipText: text }));
-
 
14956
                  });
-
 
14957
                });
-
 
14958
              }
-
 
14959
            }),
-
 
14960
            mode: 'children-keyboard-focus',
-
 
14961
            anchor: comp => ({
-
 
14962
              type: 'node',
-
 
14963
              node: descendant(comp.element, '.' + activeClass).orThunk(() => first$1('.tox-collection__item')),
-
 
14964
              root: comp.element,
-
 
14965
              layouts: {
-
 
14966
                onLtr: constant$1([
-
 
14967
                  south$2,
-
 
14968
                  north$2,
-
 
14969
                  southeast$2,
-
 
14970
                  northeast$2,
-
 
14971
                  southwest$2,
-
 
14972
                  northwest$2
-
 
14973
                ]),
-
 
14974
                onRtl: constant$1([
-
 
14975
                  south$2,
-
 
14976
                  north$2,
-
 
14977
                  southeast$2,
-
 
14978
                  northeast$2,
-
 
14979
                  southwest$2,
-
 
14980
                  northwest$2
-
 
14981
                ])
-
 
14982
              },
-
 
14983
              bubble: nu$5(0, -2, {})
-
 
14984
            })
-
 
14985
          }),
14407
          Representing.config({
14986
          Representing.config({
14408
            store: {
14987
            store: {
14409
              mode: 'memory',
14988
              mode: 'memory',
14410
              initialValue: initialData.getOr([])
14989
              initialValue: initialData.getOr([])
14411
            },
14990
            },
Línea 14426... Línea 15005...
14426
        eventOrder: {
15005
        eventOrder: {
14427
          [execute$5()]: [
15006
          [execute$5()]: [
14428
            'disabling',
15007
            'disabling',
14429
            'alloy.base.behaviour',
15008
            'alloy.base.behaviour',
14430
            'collection-events'
15009
            'collection-events'
-
 
15010
          ],
-
 
15011
          [focusin()]: [
-
 
15012
            'collection-events',
-
 
15013
            'tooltipping'
14431
          ]
15014
          ]
14432
        }
15015
        }
14433
      });
15016
      });
14434
      const extraClasses = ['tox-form__group--collection'];
15017
      const extraClasses = ['tox-form__group--collection'];
14435
      return renderFormFieldWith(pLabel, pField, extraClasses, []);
15018
      return renderFormFieldWith(pLabel, pField, extraClasses, []);
Línea 14443... Línea 15026...
14443
      const name = name$3(elem);
15026
      const name = name$3(elem);
14444
      return contains$2(ariaElements, name);
15027
      return contains$2(ariaElements, name);
14445
    };
15028
    };
14446
    const markValid = (component, invalidConfig) => {
15029
    const markValid = (component, invalidConfig) => {
14447
      const elem = invalidConfig.getRoot(component).getOr(component.element);
15030
      const elem = invalidConfig.getRoot(component).getOr(component.element);
14448
      remove$2(elem, invalidConfig.invalidClass);
15031
      remove$3(elem, invalidConfig.invalidClass);
14449
      invalidConfig.notify.each(notifyInfo => {
15032
      invalidConfig.notify.each(notifyInfo => {
14450
        if (isAriaElement(component.element)) {
15033
        if (isAriaElement(component.element)) {
14451
          set$9(component.element, 'aria-invalid', false);
15034
          set$9(component.element, 'aria-invalid', false);
14452
        }
15035
        }
14453
        notifyInfo.getContainer(component).each(container => {
15036
        notifyInfo.getContainer(component).each(container => {
Línea 14500... Línea 15083...
14500
        query: query,
15083
        query: query,
14501
        run: run,
15084
        run: run,
14502
        isInvalid: isInvalid
15085
        isInvalid: isInvalid
14503
    });
15086
    });
Línea 14504... Línea 15087...
14504
 
15087
 
14505
    const events$8 = (invalidConfig, invalidState) => invalidConfig.validator.map(validatorInfo => derive$2([run$1(validatorInfo.onEvent, component => {
15088
    const events$7 = (invalidConfig, invalidState) => invalidConfig.validator.map(validatorInfo => derive$2([run$1(validatorInfo.onEvent, component => {
14506
        run(component, invalidConfig, invalidState).get(identity);
15089
        run(component, invalidConfig, invalidState).get(identity);
14507
      })].concat(validatorInfo.validateOnLoad ? [runOnAttached(component => {
15090
      })].concat(validatorInfo.validateOnLoad ? [runOnAttached(component => {
14508
        run(component, invalidConfig, invalidState).get(noop);
15091
        run(component, invalidConfig, invalidState).get(noop);
Línea 14509... Línea 15092...
14509
      })] : []))).getOr({});
15092
      })] : []))).getOr({});
14510
 
15093
 
14511
    var ActiveInvalidate = /*#__PURE__*/Object.freeze({
15094
    var ActiveInvalidate = /*#__PURE__*/Object.freeze({
14512
        __proto__: null,
15095
        __proto__: null,
Línea 14513... Línea 15096...
14513
        events: events$8
15096
        events: events$7
14514
    });
15097
    });
14515
 
15098
 
Línea 14544... Línea 15127...
14544
          };
15127
          };
14545
        }
15128
        }
14546
      }
15129
      }
14547
    });
15130
    });
Línea 14548... Línea 15131...
14548
 
15131
 
14549
    const exhibit$1 = () => nu$7({
15132
    const exhibit$1 = () => nu$8({
14550
      styles: {
15133
      styles: {
14551
        '-webkit-user-select': 'none',
15134
        '-webkit-user-select': 'none',
14552
        'user-select': 'none',
15135
        'user-select': 'none',
14553
        '-ms-user-select': 'none',
15136
        '-ms-user-select': 'none',
14554
        '-moz-user-select': '-moz-none'
15137
        '-moz-user-select': '-moz-none'
14555
      },
15138
      },
14556
      attributes: { unselectable: 'on' }
15139
      attributes: { unselectable: 'on' }
14557
    });
15140
    });
Línea 14558... Línea 15141...
14558
    const events$7 = () => derive$2([abort(selectstart(), always)]);
15141
    const events$6 = () => derive$2([abort(selectstart(), always)]);
14559
 
15142
 
14560
    var ActiveUnselecting = /*#__PURE__*/Object.freeze({
15143
    var ActiveUnselecting = /*#__PURE__*/Object.freeze({
14561
        __proto__: null,
15144
        __proto__: null,
14562
        events: events$7,
15145
        events: events$6,
Línea 14563... Línea 15146...
14563
        exhibit: exhibit$1
15146
        exhibit: exhibit$1
14564
    });
15147
    });
Línea 14572... Línea 15155...
14572
    const renderPanelButton = (spec, sharedBackstage) => Dropdown.sketch({
15155
    const renderPanelButton = (spec, sharedBackstage) => Dropdown.sketch({
14573
      dom: spec.dom,
15156
      dom: spec.dom,
14574
      components: spec.components,
15157
      components: spec.components,
14575
      toggleClass: 'mce-active',
15158
      toggleClass: 'mce-active',
14576
      dropdownBehaviours: derive$1([
15159
      dropdownBehaviours: derive$1([
14577
        DisablingConfigs.button(sharedBackstage.providers.isDisabled),
15160
        DisablingConfigs.button(() => sharedBackstage.providers.isDisabled() || sharedBackstage.providers.checkUiComponentContext(spec.context).shouldDisable),
14578
        receivingConfig(),
15161
        toggleOnReceive(() => sharedBackstage.providers.checkUiComponentContext(spec.context)),
14579
        Unselecting.config({}),
15162
        Unselecting.config({}),
14580
        Tabstopping.config({})
15163
        Tabstopping.config({})
14581
      ]),
15164
      ]),
14582
      layouts: spec.layouts,
15165
      layouts: spec.layouts,
14583
      sandboxClasses: ['tox-dialog__popups'],
15166
      sandboxClasses: ['tox-dialog__popups'],
Línea 14596... Línea 15179...
14596
        factory: Input,
15179
        factory: Input,
14597
        inputClasses: ['tox-textfield'],
15180
        inputClasses: ['tox-textfield'],
14598
        data: initialData,
15181
        data: initialData,
14599
        onSetValue: c => Invalidating.run(c).get(noop),
15182
        onSetValue: c => Invalidating.run(c).get(noop),
14600
        inputBehaviours: derive$1([
15183
        inputBehaviours: derive$1([
14601
          Disabling.config({ disabled: sharedBackstage.providers.isDisabled }),
15184
          Disabling.config({ disabled: () => sharedBackstage.providers.isDisabled() || sharedBackstage.providers.checkUiComponentContext(spec.context).shouldDisable }),
14602
          receivingConfig(),
15185
          toggleOnReceive(() => sharedBackstage.providers.checkUiComponentContext(spec.context)),
14603
          Tabstopping.config({}),
15186
          Tabstopping.config({}),
14604
          Invalidating.config({
15187
          Invalidating.config({
14605
            invalidClass: 'tox-textbox-field-invalid',
15188
            invalidClass: 'tox-textbox-field-invalid',
14606
            getRoot: comp => parentElement(comp.element),
15189
            getRoot: comp => parentElement(comp.element),
14607
            notify: {
15190
            notify: {
Línea 14667... Línea 15250...
14667
        },
15250
        },
14668
        components: [],
15251
        components: [],
14669
        fetch: getFetch$1(colorInputBackstage.getColors(spec.storageKey), spec.storageKey, colorInputBackstage.hasCustomColors()),
15252
        fetch: getFetch$1(colorInputBackstage.getColors(spec.storageKey), spec.storageKey, colorInputBackstage.hasCustomColors()),
14670
        columns: colorInputBackstage.getColorCols(spec.storageKey),
15253
        columns: colorInputBackstage.getColorCols(spec.storageKey),
14671
        presets: 'color',
15254
        presets: 'color',
14672
        onItemAction
15255
        onItemAction,
-
 
15256
        context: spec.context
14673
      }, sharedBackstage));
15257
      }, sharedBackstage));
14674
      return FormField.sketch({
15258
      return FormField.sketch({
14675
        dom: {
15259
        dom: {
14676
          tag: 'div',
15260
          tag: 'div',
14677
          classes: ['tox-form__group']
15261
          classes: ['tox-form__group']
Línea 15068... Línea 15652...
15068
      return getMinXBounds(spectrum) - getMinXBounds(slider) + offset;
15652
      return getMinXBounds(spectrum) - getMinXBounds(slider) + offset;
15069
    };
15653
    };
15070
    const setPositionFromValue$2 = (slider, thumb, detail, edges) => {
15654
    const setPositionFromValue$2 = (slider, thumb, detail, edges) => {
15071
      const value = currentValue(detail);
15655
      const value = currentValue(detail);
15072
      const pos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);
15656
      const pos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);
15073
      const thumbRadius = get$c(thumb.element) / 2;
15657
      const thumbRadius = get$d(thumb.element) / 2;
15074
      set$8(thumb.element, 'left', pos - thumbRadius + 'px');
15658
      set$8(thumb.element, 'left', pos - thumbRadius + 'px');
15075
    };
15659
    };
15076
    const onLeft$2 = handleMovement$2(-1);
15660
    const onLeft$2 = handleMovement$2(-1);
15077
    const onRight$2 = handleMovement$2(1);
15661
    const onRight$2 = handleMovement$2(1);
15078
    const onUp$2 = Optional.none;
15662
    const onUp$2 = Optional.none;
Línea 15178... Línea 15762...
15178
      return getMinYBounds(spectrum) - getMinYBounds(slider) + offset;
15762
      return getMinYBounds(spectrum) - getMinYBounds(slider) + offset;
15179
    };
15763
    };
15180
    const setPositionFromValue$1 = (slider, thumb, detail, edges) => {
15764
    const setPositionFromValue$1 = (slider, thumb, detail, edges) => {
15181
      const value = currentValue(detail);
15765
      const value = currentValue(detail);
15182
      const pos = findPositionOfValue(slider, edges.getSpectrum(slider), value, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);
15766
      const pos = findPositionOfValue(slider, edges.getSpectrum(slider), value, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);
15183
      const thumbRadius = get$d(thumb.element) / 2;
15767
      const thumbRadius = get$e(thumb.element) / 2;
15184
      set$8(thumb.element, 'top', pos - thumbRadius + 'px');
15768
      set$8(thumb.element, 'top', pos - thumbRadius + 'px');
15185
    };
15769
    };
15186
    const onLeft$1 = Optional.none;
15770
    const onLeft$1 = Optional.none;
15187
    const onRight$1 = Optional.none;
15771
    const onRight$1 = Optional.none;
15188
    const onUp$1 = handleMovement$1(-1);
15772
    const onUp$1 = handleMovement$1(-1);
Línea 15249... Línea 15833...
15249
    const getValueFromEvent = simulatedEvent => getEventSource(simulatedEvent);
15833
    const getValueFromEvent = simulatedEvent => getEventSource(simulatedEvent);
15250
    const setPositionFromValue = (slider, thumb, detail, edges) => {
15834
    const setPositionFromValue = (slider, thumb, detail, edges) => {
15251
      const value = currentValue(detail);
15835
      const value = currentValue(detail);
15252
      const xPos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);
15836
      const xPos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);
15253
      const yPos = findPositionOfValue(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);
15837
      const yPos = findPositionOfValue(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);
15254
      const thumbXRadius = get$c(thumb.element) / 2;
15838
      const thumbXRadius = get$d(thumb.element) / 2;
15255
      const thumbYRadius = get$d(thumb.element) / 2;
15839
      const thumbYRadius = get$e(thumb.element) / 2;
15256
      set$8(thumb.element, 'left', xPos - thumbXRadius + 'px');
15840
      set$8(thumb.element, 'left', xPos - thumbXRadius + 'px');
15257
      set$8(thumb.element, 'top', yPos - thumbYRadius + 'px');
15841
      set$8(thumb.element, 'top', yPos - thumbYRadius + 'px');
15258
    };
15842
    };
15259
    const onLeft = handleMovement(-1, false);
15843
    const onLeft = handleMovement(-1, false);
15260
    const onRight = handleMovement(1, false);
15844
    const onRight = handleMovement(1, false);
Línea 15572... Línea 16156...
15572
 
16156
 
15573
    const validInput = generate$6('valid-input');
16157
    const validInput = generate$6('valid-input');
15574
    const invalidInput = generate$6('invalid-input');
16158
    const invalidInput = generate$6('invalid-input');
15575
    const validatingInput = generate$6('validating-input');
16159
    const validatingInput = generate$6('validating-input');
-
 
16160
    const translatePrefix = 'colorcustom.rgb.';
-
 
16161
    const uninitiatedTooltipApi = {
-
 
16162
      isEnabled: always,
-
 
16163
      setEnabled: noop,
-
 
16164
      immediatelyShow: noop,
-
 
16165
      immediatelyHide: noop
15576
    const translatePrefix = 'colorcustom.rgb.';
16166
    };
-
 
16167
    const rgbFormFactory = (translate, getClass, onValidHexx, onInvalidHexx, tooltipGetConfig, makeIcon) => {
-
 
16168
      const setTooltipEnabled = (enabled, tooltipApi) => {
-
 
16169
        const api = tooltipApi.get();
-
 
16170
        if (enabled === api.isEnabled()) {
-
 
16171
          return;
-
 
16172
        }
-
 
16173
        api.setEnabled(enabled);
-
 
16174
        if (enabled) {
-
 
16175
          api.immediatelyShow();
-
 
16176
        } else {
-
 
16177
          api.immediatelyHide();
-
 
16178
        }
15577
    const rgbFormFactory = (translate, getClass, onValidHexx, onInvalidHexx) => {
16179
      };
15578
      const invalidation = (label, isValid) => Invalidating.config({
16180
      const invalidation = (label, isValid, tooltipApi) => Invalidating.config({
15579
        invalidClass: getClass('invalid'),
16181
        invalidClass: getClass('invalid'),
15580
        notify: {
16182
        notify: {
15581
          onValidate: comp => {
16183
          onValidate: comp => {
15582
            emitWith(comp, validatingInput, { type: label });
16184
            emitWith(comp, validatingInput, { type: label });
15583
          },
16185
          },
-
 
16186
          onValid: comp => {
15584
          onValid: comp => {
16187
            setTooltipEnabled(false, tooltipApi);
15585
            emitWith(comp, validInput, {
16188
            emitWith(comp, validInput, {
15586
              type: label,
16189
              type: label,
15587
              value: Representing.getValue(comp)
16190
              value: Representing.getValue(comp)
15588
            });
16191
            });
15589
          },
16192
          },
-
 
16193
          onInvalid: comp => {
15590
          onInvalid: comp => {
16194
            setTooltipEnabled(true, tooltipApi);
15591
            emitWith(comp, invalidInput, {
16195
            emitWith(comp, invalidInput, {
15592
              type: label,
16196
              type: label,
15593
              value: Representing.getValue(comp)
16197
              value: Representing.getValue(comp)
15594
            });
16198
            });
Línea 15602... Línea 16206...
15602
          },
16206
          },
15603
          validateOnLoad: false
16207
          validateOnLoad: false
15604
        }
16208
        }
15605
      });
16209
      });
15606
      const renderTextField = (isValid, name, label, description, data) => {
16210
      const renderTextField = (isValid, name, label, description, data) => {
-
 
16211
        const tooltipApi = Cell(uninitiatedTooltipApi);
15607
        const helptext = translate(translatePrefix + 'range');
16212
        const helptext = translate(translatePrefix + 'range');
15608
        const pLabel = FormField.parts.label({
16213
        const pLabel = FormField.parts.label({
15609
          dom: {
-
 
15610
            tag: 'label',
16214
          dom: { tag: 'label' },
15611
            attributes: { 'aria-label': description }
-
 
15612
          },
-
 
15613
          components: [text$2(label)]
16215
          components: [text$2(label)]
15614
        });
16216
        });
15615
        const pField = FormField.parts.field({
16217
        const pField = FormField.parts.field({
15616
          data,
16218
          data,
15617
          factory: Input,
16219
          factory: Input,
15618
          inputAttributes: {
16220
          inputAttributes: {
15619
            type: 'text',
16221
            'type': 'text',
-
 
16222
            'aria-label': description,
15620
            ...name === 'hex' ? { 'aria-live': 'polite' } : {}
16223
            ...name === 'hex' ? { 'aria-live': 'polite' } : {}
15621
          },
16224
          },
15622
          inputClasses: [getClass('textfield')],
16225
          inputClasses: [getClass('textfield')],
15623
          inputBehaviours: derive$1([
16226
          inputBehaviours: derive$1([
15624
            invalidation(name, isValid),
16227
            invalidation(name, isValid, tooltipApi),
15625
            Tabstopping.config({})
16228
            Tabstopping.config({}),
-
 
16229
            Tooltipping.config({
-
 
16230
              ...tooltipGetConfig({
-
 
16231
                tooltipText: '',
-
 
16232
                onSetup: comp => {
-
 
16233
                  tooltipApi.set({
-
 
16234
                    isEnabled: () => {
-
 
16235
                      return Tooltipping.isEnabled(comp);
-
 
16236
                    },
-
 
16237
                    setEnabled: enabled => {
-
 
16238
                      return Tooltipping.setEnabled(comp, enabled);
-
 
16239
                    },
-
 
16240
                    immediatelyShow: () => {
-
 
16241
                      return Tooltipping.immediateOpenClose(comp, true);
-
 
16242
                    },
-
 
16243
                    immediatelyHide: () => {
-
 
16244
                      return Tooltipping.immediateOpenClose(comp, false);
-
 
16245
                    }
-
 
16246
                  });
-
 
16247
                  Tooltipping.setEnabled(comp, false);
-
 
16248
                },
-
 
16249
                onShow: (component, _tooltip) => {
-
 
16250
                  Tooltipping.setComponents(component, [{
-
 
16251
                      dom: {
-
 
16252
                        tag: 'p',
-
 
16253
                        classes: [getClass('rgb-warning-note')]
-
 
16254
                      },
-
 
16255
                      components: [text$2(translate(name === 'hex' ? 'colorcustom.rgb.invalidHex' : 'colorcustom.rgb.invalid'))]
-
 
16256
                    }]);
-
 
16257
                }
-
 
16258
              })
-
 
16259
            })
15626
          ]),
16260
          ]),
15627
          onSetValue: input => {
16261
          onSetValue: input => {
15628
            if (Invalidating.isInvalid(input)) {
16262
            if (Invalidating.isInvalid(input)) {
15629
              const run = Invalidating.run(input);
16263
              const run = Invalidating.run(input);
15630
              run.get(noop);
16264
              run.get(noop);
15631
            }
16265
            }
15632
          }
16266
          }
15633
        });
16267
        });
-
 
16268
        const errorId = generate$6('aria-invalid');
-
 
16269
        const memInvalidIcon = record(makeIcon('invalid', Optional.some(errorId), 'warning'));
-
 
16270
        const memStatus = record({
-
 
16271
          dom: {
-
 
16272
            tag: 'div',
-
 
16273
            classes: [getClass('invalid-icon')]
-
 
16274
          },
-
 
16275
          components: [memInvalidIcon.asSpec()]
-
 
16276
        });
15634
        const comps = [
16277
        const comps = [
15635
          pLabel,
16278
          pLabel,
15636
          pField
16279
          pField,
-
 
16280
          memStatus.asSpec()
15637
        ];
16281
        ];
15638
        const concats = name !== 'hex' ? [FormField.parts['aria-descriptor']({ text: helptext })] : [];
16282
        const concats = name !== 'hex' ? [FormField.parts['aria-descriptor']({ text: helptext })] : [];
15639
        const components = comps.concat(concats);
16283
        const components = comps.concat(concats);
15640
        return {
16284
        return {
15641
          dom: {
16285
          dom: {
15642
            tag: 'div',
16286
            tag: 'div',
15643
            attributes: { role: 'presentation' }
16287
            attributes: { role: 'presentation' },
-
 
16288
            classes: [getClass('rgb-container')]
15644
          },
16289
          },
15645
          components
16290
          components
15646
        };
16291
        };
15647
      };
16292
      };
15648
      const copyRgbToHex = (form, rgba) => {
16293
      const copyRgbToHex = (form, rgba) => {
Línea 15908... Línea 16553...
15908
        extraApis: {}
16553
        extraApis: {}
15909
      });
16554
      });
15910
      return saturationBrightnessPaletteSketcher;
16555
      return saturationBrightnessPaletteSketcher;
15911
    };
16556
    };
Línea 15912... Línea 16557...
15912
 
16557
 
15913
    const makeFactory = (translate, getClass) => {
16558
    const makeFactory = (translate, getClass, tooltipConfig, makeIcon) => {
15914
      const factory = detail => {
16559
      const factory = detail => {
15915
        const rgbForm = rgbFormFactory(translate, getClass, detail.onValidHex, detail.onInvalidHex);
16560
        const rgbForm = rgbFormFactory(translate, getClass, detail.onValidHex, detail.onInvalidHex, tooltipConfig, makeIcon);
15916
        const sbPalette = paletteFactory(translate, getClass);
16561
        const sbPalette = paletteFactory(translate, getClass);
15917
        const hueSliderToDegrees = hue => (100 - hue) / 100 * 360;
16562
        const hueSliderToDegrees = hue => (100 - hue) / 100 * 360;
15918
        const hueDegreesToSlider = hue => 100 - hue / 360 * 100;
16563
        const hueDegreesToSlider = hue => 100 - hue / 360 * 100;
15919
        const state = {
16564
        const state = {
Línea 16059... Línea 16704...
16059
        getValue: getter,
16704
        getValue: getter,
16060
        setValue: setter
16705
        setValue: setter
16061
      }
16706
      }
16062
    });
16707
    });
16063
    const withElement = (initialValue, getter, setter) => withComp(initialValue, c => getter(c.element), (c, v) => setter(c.element, v));
16708
    const withElement = (initialValue, getter, setter) => withComp(initialValue, c => getter(c.element), (c, v) => setter(c.element, v));
16064
    const domHtml = optInitialValue => withElement(optInitialValue, get$9, set$6);
16709
    const domHtml = optInitialValue => withElement(optInitialValue, get$8, set$6);
16065
    const memory = initialValue => Representing.config({
16710
    const memory = initialValue => Representing.config({
16066
      store: {
16711
      store: {
16067
        mode: 'memory',
16712
        mode: 'memory',
16068
        initialValue
16713
        initialValue
16069
      }
16714
      }
16070
    });
16715
    });
Línea 16071... Línea 16716...
16071
 
16716
 
16072
    const english = {
16717
    const english = {
16073
      'colorcustom.rgb.red.label': 'R',
16718
      'colorcustom.rgb.red.label': 'R',
16074
      'colorcustom.rgb.red.description': 'Red component',
16719
      'colorcustom.rgb.red.description': 'Red channel',
16075
      'colorcustom.rgb.green.label': 'G',
16720
      'colorcustom.rgb.green.label': 'G',
16076
      'colorcustom.rgb.green.description': 'Green component',
16721
      'colorcustom.rgb.green.description': 'Green channel',
16077
      'colorcustom.rgb.blue.label': 'B',
16722
      'colorcustom.rgb.blue.label': 'B',
16078
      'colorcustom.rgb.blue.description': 'Blue component',
16723
      'colorcustom.rgb.blue.description': 'Blue channel',
16079
      'colorcustom.rgb.hex.label': '#',
16724
      'colorcustom.rgb.hex.label': '#',
16080
      'colorcustom.rgb.hex.description': 'Hex color code',
16725
      'colorcustom.rgb.hex.description': 'Hex color code',
-
 
16726
      'colorcustom.rgb.range': 'Range 0 to 255',
-
 
16727
      'colorcustom.rgb.invalid': 'Numbers only, 0 to 255',
16081
      'colorcustom.rgb.range': 'Range 0 to 255',
16728
      'colorcustom.rgb.invalidHex': 'Hexadecimal only, 000000 to FFFFFF',
16082
      'aria.color.picker': 'Color Picker',
16729
      'aria.color.picker': 'Color Picker',
16083
      'aria.input.invalid': 'Invalid input'
16730
      'aria.input.invalid': 'Invalid input'
16084
    };
16731
    };
16085
    const translate$1 = providerBackstage => key => {
16732
    const translate$1 = providerBackstage => key => {
Línea 16089... Línea 16736...
16089
        return providerBackstage.translate(key);
16736
        return providerBackstage.translate(key);
16090
      }
16737
      }
16091
    };
16738
    };
16092
    const renderColorPicker = (_spec, providerBackstage, initialData) => {
16739
    const renderColorPicker = (_spec, providerBackstage, initialData) => {
16093
      const getClass = key => 'tox-' + key;
16740
      const getClass = key => 'tox-' + key;
-
 
16741
      const renderIcon = (name, errId, icon = name, label = name) => render$3(icon, {
-
 
16742
        tag: 'div',
-
 
16743
        classes: [
-
 
16744
          'tox-icon',
-
 
16745
          'tox-control-wrap__status-icon-' + name
-
 
16746
        ],
-
 
16747
        attributes: {
-
 
16748
          'title': providerBackstage.translate(label),
-
 
16749
          'aria-live': 'polite',
-
 
16750
          ...errId.fold(() => ({}), id => ({ id }))
-
 
16751
        }
-
 
16752
      }, providerBackstage.icons);
16094
      const colourPickerFactory = makeFactory(translate$1(providerBackstage), getClass);
16753
      const colourPickerFactory = makeFactory(translate$1(providerBackstage), getClass, providerBackstage.tooltips.getConfig, renderIcon);
16095
      const onValidHex = form => {
16754
      const onValidHex = form => {
16096
        emitWith(form, formActionEvent, {
16755
        emitWith(form, formActionEvent, {
16097
          name: 'hex-valid',
16756
          name: 'hex-valid',
16098
          value: true
16757
          value: true
16099
        });
16758
        });
Línea 16125... Línea 16784...
16125
              return formValues.hex;
16784
              return formValues.hex;
16126
            });
16785
            });
16127
            return optHex.map(hex => '#' + removeLeading(hex, '#')).getOr('');
16786
            return optHex.map(hex => '#' + removeLeading(hex, '#')).getOr('');
16128
          }, (comp, newValue) => {
16787
          }, (comp, newValue) => {
16129
            const pattern = /^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/;
16788
            const pattern = /^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/;
16130
            const valOpt = Optional.from(pattern.exec(newValue)).bind(matches => get$h(matches, 1));
16789
            const valOpt = Optional.from(pattern.exec(newValue)).bind(matches => get$i(matches, 1));
16131
            const picker = memPicker.get(comp);
16790
            const picker = memPicker.get(comp);
16132
            const optRgbForm = Composing.getCurrent(picker);
16791
            const optRgbForm = Composing.getCurrent(picker);
16133
            optRgbForm.fold(() => {
16792
            optRgbForm.fold(() => {
16134
              console.log('Can not find form');
16793
              console.log('Can not find form');
16135
            }, rgbForm => {
16794
            }, rgbForm => {
Línea 16146... Línea 16805...
16146
 
16805
 
Línea 16147... Línea 16806...
16147
    var global$2 = tinymce.util.Tools.resolve('tinymce.Resource');
16806
    var global$2 = tinymce.util.Tools.resolve('tinymce.Resource');
16148
 
16807
 
16149
    const isOldCustomEditor = spec => has$2(spec, 'init');
16808
    const isOldCustomEditor = spec => has$2(spec, 'init');
16150
    const renderCustomEditor = spec => {
16809
    const renderCustomEditor = spec => {
16151
      const editorApi = value$2();
16810
      const editorApi = value$4();
-
 
16811
      const memReplaced = record({ dom: { tag: spec.tag } });
-
 
16812
      const initialValue = value$4();
-
 
16813
      const focusBehaviour = !isOldCustomEditor(spec) && spec.onFocus.isSome() ? [
-
 
16814
        Focusing.config({
-
 
16815
          onFocus: comp => {
-
 
16816
            spec.onFocus.each(onFocusFn => {
-
 
16817
              onFocusFn(comp.element.dom);
-
 
16818
            });
-
 
16819
          }
-
 
16820
        }),
16152
      const memReplaced = record({ dom: { tag: spec.tag } });
16821
        Tabstopping.config({})
16153
      const initialValue = value$2();
16822
      ] : [];
16154
      return {
16823
      return {
16155
        dom: {
16824
        dom: {
16156
          tag: 'div',
16825
          tag: 'div',
Línea 16166... Línea 16835...
16166
                  initialValue.clear();
16835
                  initialValue.clear();
16167
                  editorApi.set(ea);
16836
                  editorApi.set(ea);
16168
                });
16837
                });
16169
              });
16838
              });
16170
            })]),
16839
            })]),
16171
          withComp(Optional.none(), () => editorApi.get().fold(() => initialValue.get().getOr(''), ed => ed.getValue()), (component, value) => {
16840
          withComp(Optional.none(), () => editorApi.get().fold(() => initialValue.get().getOr(''), ed => ed.getValue()), (_component, value) => {
16172
            editorApi.get().fold(() => initialValue.set(value), ed => ed.setValue(value));
16841
            editorApi.get().fold(() => initialValue.set(value), ed => ed.setValue(value));
16173
          }),
16842
          }),
16174
          ComposingConfigs.self()
16843
          ComposingConfigs.self()
16175
        ]),
16844
        ].concat(focusBehaviour)),
16176
        components: [memReplaced.asSpec()]
16845
        components: [memReplaced.asSpec()]
16177
      };
16846
      };
16178
    };
16847
    };
Línea 16179... Línea 16848...
16179
 
16848
 
Línea -... Línea 16849...
-
 
16849
    var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
16180
    var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
16850
 
16181
 
16851
    const browseFilesEvent = generate$6('browse.files.event');
16182
    const filterByExtension = (files, providersBackstage) => {
16852
    const filterByExtension = (files, providersBackstage) => {
16183
      const allowedImageFileTypes = global$1.explode(providersBackstage.getOption('images_file_types'));
16853
      const allowedImageFileTypes = global$1.explode(providersBackstage.getOption('images_file_types'));
16184
      const isFileInAllowedTypes = file => exists(allowedImageFileTypes, type => endsWith(file.name.toLowerCase(), `.${ type.toLowerCase() }`));
16854
      const isFileInAllowedTypes = file => exists(allowedImageFileTypes, type => endsWith(file.name.toLowerCase(), `.${ type.toLowerCase() }`));
Línea 16195... Línea 16865...
16195
      };
16865
      };
16196
      const onDrop = (comp, se) => {
16866
      const onDrop = (comp, se) => {
16197
        var _a;
16867
        var _a;
16198
        if (!Disabling.isDisabled(comp)) {
16868
        if (!Disabling.isDisabled(comp)) {
16199
          const transferEvent = se.event.raw;
16869
          const transferEvent = se.event.raw;
16200
          handleFiles(comp, (_a = transferEvent.dataTransfer) === null || _a === void 0 ? void 0 : _a.files);
16870
          emitWith(comp, browseFilesEvent, { files: (_a = transferEvent.dataTransfer) === null || _a === void 0 ? void 0 : _a.files });
16201
        }
16871
        }
16202
      };
16872
      };
16203
      const onSelect = (component, simulatedEvent) => {
16873
      const onSelect = (component, simulatedEvent) => {
16204
        const input = simulatedEvent.event.raw.target;
16874
        const input = simulatedEvent.event.raw.target;
16205
        handleFiles(component, input.files);
16875
        emitWith(component, browseFilesEvent, { files: input.files });
16206
      };
16876
      };
16207
      const handleFiles = (component, files) => {
16877
      const handleFiles = (component, files) => {
16208
        if (files) {
16878
        if (files) {
16209
          Representing.setValue(component, filterByExtension(files, providersBackstage));
16879
          Representing.setValue(component, filterByExtension(files, providersBackstage));
16210
          emitWith(component, formChangeEvent, { name: spec.name });
16880
          emitWith(component, formChangeEvent, { name: spec.name });
Línea 16222... Línea 16892...
16222
        behaviours: derive$1([config('input-file-events', [
16892
        behaviours: derive$1([config('input-file-events', [
16223
            cutter(click()),
16893
            cutter(click()),
16224
            cutter(tap())
16894
            cutter(tap())
16225
          ])])
16895
          ])])
16226
      });
16896
      });
-
 
16897
      const pLabel = spec.label.map(label => renderLabel$3(label, providersBackstage));
16227
      const renderField = s => ({
16898
      const pField = FormField.parts.field({
-
 
16899
        factory: Button,
16228
        uid: s.uid,
16900
        dom: {
-
 
16901
          tag: 'button',
-
 
16902
          styles: { position: 'relative' },
-
 
16903
          classes: [
-
 
16904
            'tox-button',
-
 
16905
            'tox-button--secondary'
-
 
16906
          ]
-
 
16907
        },
-
 
16908
        components: [
-
 
16909
          text$2(providersBackstage.translate('Browse for an image')),
-
 
16910
          memInput.asSpec()
-
 
16911
        ],
-
 
16912
        action: comp => {
-
 
16913
          const inputComp = memInput.get(comp);
-
 
16914
          inputComp.element.dom.click();
-
 
16915
        },
-
 
16916
        buttonBehaviours: derive$1([
-
 
16917
          ComposingConfigs.self(),
-
 
16918
          memory(initialData.getOr([])),
-
 
16919
          Tabstopping.config({}),
-
 
16920
          DisablingConfigs.button(() => providersBackstage.checkUiComponentContext(spec.context).shouldDisable),
-
 
16921
          toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context))
-
 
16922
        ])
-
 
16923
      });
-
 
16924
      const wrapper = {
16229
        dom: {
16925
        dom: {
16230
          tag: 'div',
16926
          tag: 'div',
16231
          classes: ['tox-dropzone-container']
16927
          classes: ['tox-dropzone-container']
16232
        },
16928
        },
16233
        behaviours: derive$1([
16929
        behaviours: derive$1([
16234
          memory(initialData.getOr([])),
16930
          Disabling.config({ disabled: () => providersBackstage.checkUiComponentContext(spec.context).shouldDisable }),
16235
          ComposingConfigs.self(),
16931
          toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context)),
16236
          Disabling.config({}),
-
 
16237
          Toggling.config({
16932
          Toggling.config({
16238
            toggleClass: 'dragenter',
16933
            toggleClass: 'dragenter',
16239
            toggleOnExecute: false
16934
            toggleOnExecute: false
16240
          }),
16935
          }),
16241
          config('dropzone-events', [
16936
          config('dropzone-events', [
Línea 16264... Línea 16959...
16264
            components: [
16959
            components: [
16265
              {
16960
              {
16266
                dom: { tag: 'p' },
16961
                dom: { tag: 'p' },
16267
                components: [text$2(providersBackstage.translate('Drop an image here'))]
16962
                components: [text$2(providersBackstage.translate('Drop an image here'))]
16268
              },
16963
              },
16269
              Button.sketch({
-
 
16270
                dom: {
-
 
16271
                  tag: 'button',
-
 
16272
                  styles: { position: 'relative' },
-
 
16273
                  classes: [
-
 
16274
                    'tox-button',
-
 
16275
                    'tox-button--secondary'
-
 
16276
                  ]
16964
              pField
16277
                },
-
 
16278
                components: [
-
 
16279
                  text$2(providersBackstage.translate('Browse for an image')),
-
 
16280
                  memInput.asSpec()
-
 
16281
                ],
-
 
16282
                action: comp => {
-
 
16283
                  const inputComp = memInput.get(comp);
-
 
16284
                  inputComp.element.dom.click();
-
 
16285
                },
-
 
16286
                buttonBehaviours: derive$1([
-
 
16287
                  Tabstopping.config({}),
-
 
16288
                  DisablingConfigs.button(providersBackstage.isDisabled),
-
 
16289
                  receivingConfig()
-
 
16290
                ])
-
 
16291
              })
-
 
16292
            ]
16965
            ]
16293
          }]
16966
          }]
16294
      });
16967
      };
16295
      const pLabel = spec.label.map(label => renderLabel$3(label, providersBackstage));
16968
      return renderFormFieldWith(pLabel, wrapper, ['tox-form__group--stretched'], [config('handle-files', [run$1(browseFilesEvent, (comp, se) => {
16296
      const pField = FormField.parts.field({ factory: { sketch: renderField } });
16969
            FormField.getField(comp).each(field => {
16297
      return renderFormFieldWith(pLabel, pField, ['tox-form__group--stretched'], []);
16970
              handleFiles(field, se.event.files);
-
 
16971
            });
-
 
16972
          })])]);
16298
    };
16973
    };
Línea 16299... Línea 16974...
16299
 
16974
 
16300
    const renderGrid = (spec, backstage) => ({
16975
    const renderGrid = (spec, backstage) => ({
16301
      dom: {
16976
      dom: {
Línea 16441... Línea 17116...
16441
    const bodyChannel = generate$6('update-body');
17116
    const bodyChannel = generate$6('update-body');
16442
    const footerChannel = generate$6('update-footer');
17117
    const footerChannel = generate$6('update-footer');
16443
    const bodySendMessageChannel = generate$6('body-send-message');
17118
    const bodySendMessageChannel = generate$6('body-send-message');
16444
    const dialogFocusShiftedChannel = generate$6('dialog-focus-shifted');
17119
    const dialogFocusShiftedChannel = generate$6('dialog-focus-shifted');
Línea 16445... Línea 17120...
16445
 
17120
 
16446
    const browser = detect$2().browser;
17121
    const browser = detect$1().browser;
16447
    const isSafari = browser.isSafari();
17122
    const isSafari = browser.isSafari();
16448
    const isFirefox = browser.isFirefox();
17123
    const isFirefox = browser.isFirefox();
16449
    const isSafariOrFirefox = isSafari || isFirefox;
17124
    const isSafariOrFirefox = isSafari || isFirefox;
16450
    const isChromium = browser.isChromium();
17125
    const isChromium = browser.isChromium();
Línea 16532... Línea 17207...
16532
            channels: {
17207
            channels: {
16533
              [dialogFocusShiftedChannel]: {
17208
              [dialogFocusShiftedChannel]: {
16534
                onReceive: (comp, message) => {
17209
                onReceive: (comp, message) => {
16535
                  message.newFocus.each(newFocus => {
17210
                  message.newFocus.each(newFocus => {
16536
                    parentElement(comp.element).each(parent => {
17211
                    parentElement(comp.element).each(parent => {
16537
                      const f = eq(comp.element, newFocus) ? add$2 : remove$2;
17212
                      const f = eq(comp.element, newFocus) ? add$2 : remove$3;
16538
                      f(parent, 'tox-navobj-bordered-focus');
17213
                      f(parent, 'tox-navobj-bordered-focus');
16539
                    });
17214
                    });
16540
                  });
17215
                  });
16541
                }
17216
                }
16542
              }
17217
              }
Línea 16577... Línea 17252...
16577
        width: width.toString() + 'px',
17252
        width: width.toString() + 'px',
16578
        height: height.toString() + 'px'
17253
        height: height.toString() + 'px'
16579
      };
17254
      };
16580
    };
17255
    };
16581
    const zoomToFit = (panel, width, height) => {
17256
    const zoomToFit = (panel, width, height) => {
16582
      const panelW = get$c(panel);
17257
      const panelW = get$d(panel);
16583
      const panelH = get$d(panel);
17258
      const panelH = get$e(panel);
16584
      return Math.min(panelW / width, panelH / height, 1);
17259
      return Math.min(panelW / width, panelH / height, 1);
16585
    };
17260
    };
16586
    const renderImagePreview = (spec, initialData) => {
17261
    const renderImagePreview = (spec, initialData) => {
16587
      const cachedData = Cell(initialData.getOr({ url: '' }));
17262
      const cachedData = Cell(initialData.getOr({ url: '' }));
16588
      const memImage = record({
17263
      const memImage = record({
Línea 16611... Línea 17286...
16611
          if (!isUndefined(cachedWidth) && !isUndefined(cachedHeight)) {
17286
          if (!isUndefined(cachedWidth) && !isUndefined(cachedHeight)) {
16612
            if (isUndefined(zoom)) {
17287
            if (isUndefined(zoom)) {
16613
              const z = zoomToFit(frameComponent.element, cachedWidth, cachedHeight);
17288
              const z = zoomToFit(frameComponent.element, cachedWidth, cachedHeight);
16614
              translatedData.zoom = z;
17289
              translatedData.zoom = z;
16615
            }
17290
            }
16616
            const position = calculateImagePosition(get$c(frameComponent.element), get$d(frameComponent.element), cachedWidth, cachedHeight, translatedData.zoom);
17291
            const position = calculateImagePosition(get$d(frameComponent.element), get$e(frameComponent.element), cachedWidth, cachedHeight, translatedData.zoom);
16617
            memContainer.getOpt(frameComponent).each(container => {
17292
            memContainer.getOpt(frameComponent).each(container => {
16618
              setAll(container.element, position);
17293
              setAll(container.element, position);
16619
            });
17294
            });
16620
          }
17295
          }
16621
        };
17296
        };
16622
        memImage.getOpt(frameComponent).each(imageComponent => {
17297
        memImage.getOpt(frameComponent).each(imageComponent => {
16623
          const img = imageComponent.element;
17298
          const img = imageComponent.element;
16624
          if (data.url !== get$f(img, 'src')) {
17299
          if (data.url !== get$g(img, 'src')) {
16625
            set$9(img, 'src', data.url);
17300
            set$9(img, 'src', data.url);
16626
            remove$2(frameComponent.element, 'tox-imagepreview__loaded');
17301
            remove$3(frameComponent.element, 'tox-imagepreview__loaded');
16627
          }
17302
          }
16628
          applyFramePositioning();
17303
          applyFramePositioning();
16629
          image(img).then(img => {
17304
          image(img).then(img => {
16630
            if (frameComponent.getSystem().isConnected()) {
17305
            if (frameComponent.getSystem().isConnected()) {
16631
              add$2(frameComponent.element, 'tox-imagepreview__loaded');
17306
              add$2(frameComponent.element, 'tox-imagepreview__loaded');
Línea 16657... Línea 17332...
16657
          withComp(fakeValidatedData, () => cachedData.get(), setValue)
17332
          withComp(fakeValidatedData, () => cachedData.get(), setValue)
16658
        ])
17333
        ])
16659
      };
17334
      };
16660
    };
17335
    };
Línea 16661... Línea 17336...
16661
 
17336
 
16662
    const renderLabel$2 = (spec, backstageShared) => {
17337
    const renderLabel$2 = (spec, backstageShared, getCompByName) => {
16663
      const baseClass = 'tox-label';
17338
      const baseClass = 'tox-label';
16664
      const centerClass = spec.align === 'center' ? [`${ baseClass }--center`] : [];
17339
      const centerClass = spec.align === 'center' ? [`${ baseClass }--center`] : [];
16665
      const endClass = spec.align === 'end' ? [`${ baseClass }--end`] : [];
17340
      const endClass = spec.align === 'end' ? [`${ baseClass }--end`] : [];
16666
      const label = {
17341
      const label = record({
16667
        dom: {
17342
        dom: {
16668
          tag: 'label',
17343
          tag: 'label',
16669
          classes: [
17344
          classes: [
16670
            baseClass,
17345
            baseClass,
16671
            ...centerClass,
17346
            ...centerClass,
16672
            ...endClass
17347
            ...endClass
16673
          ]
17348
          ]
16674
        },
17349
        },
16675
        components: [text$2(backstageShared.providers.translate(spec.label))]
17350
        components: [text$2(backstageShared.providers.translate(spec.label))]
16676
      };
17351
      });
16677
      const comps = map$2(spec.items, backstageShared.interpreter);
17352
      const comps = map$2(spec.items, backstageShared.interpreter);
16678
      return {
17353
      return {
16679
        dom: {
17354
        dom: {
16680
          tag: 'div',
17355
          tag: 'div',
16681
          classes: ['tox-form__group']
17356
          classes: ['tox-form__group']
16682
        },
17357
        },
16683
        components: [
17358
        components: [
16684
          label,
17359
          label.asSpec(),
16685
          ...comps
17360
          ...comps
16686
        ],
17361
        ],
16687
        behaviours: derive$1([
17362
        behaviours: derive$1([
16688
          ComposingConfigs.self(),
17363
          ComposingConfigs.self(),
16689
          Replacing.config({}),
17364
          Replacing.config({}),
16690
          domHtml(Optional.none()),
17365
          domHtml(Optional.none()),
-
 
17366
          Keying.config({ mode: 'acyclic' }),
-
 
17367
          config('label', [runOnAttached(comp => {
-
 
17368
              spec.for.each(name => {
-
 
17369
                getCompByName(name).each(target => {
-
 
17370
                  label.getOpt(comp).each(labelComp => {
-
 
17371
                    var _a;
-
 
17372
                    const id = (_a = get$g(target.element, 'id')) !== null && _a !== void 0 ? _a : generate$6('form-field');
-
 
17373
                    set$9(target.element, 'id', id);
-
 
17374
                    set$9(labelComp.element, 'for', id);
-
 
17375
                  });
-
 
17376
                });
-
 
17377
              });
16691
          Keying.config({ mode: 'acyclic' })
17378
            })])
16692
        ])
17379
        ])
16693
      };
17380
      };
Línea 16694... Línea 17381...
16694
    };
17381
    };
Línea 16704... Línea 17391...
16704
    const toolbarButtonEventOrder = {
17391
    const toolbarButtonEventOrder = {
16705
      [execute$5()]: [
17392
      [execute$5()]: [
16706
        'disabling',
17393
        'disabling',
16707
        'alloy.base.behaviour',
17394
        'alloy.base.behaviour',
16708
        'toggling',
17395
        'toggling',
16709
        'toolbar-button-events'
17396
        'toolbar-button-events',
-
 
17397
        'tooltipping'
16710
      ],
17398
      ],
16711
      [attachedToDom()]: [
17399
      [attachedToDom()]: [
16712
        'toolbar-button-events',
17400
        'toolbar-button-events',
16713
        commonButtonDisplayEvent
17401
        commonButtonDisplayEvent
16714
      ],
17402
      ],
-
 
17403
      [detachedFromDom()]: [
-
 
17404
        'toolbar-button-events',
-
 
17405
        'dropdown-events',
-
 
17406
        'tooltipping'
-
 
17407
      ],
16715
      [mousedown()]: [
17408
      [mousedown()]: [
16716
        'focusing',
17409
        'focusing',
16717
        'alloy.base.behaviour',
17410
        'alloy.base.behaviour',
16718
        commonButtonDisplayEvent
17411
        commonButtonDisplayEvent
16719
      ]
17412
      ]
16720
    };
17413
    };
Línea 16721... Línea 17414...
16721
 
17414
 
Línea 16722... Línea 17415...
16722
    const forceInitialSize = comp => set$8(comp.element, 'width', get$e(comp.element, 'width'));
17415
    const forceInitialSize = comp => set$8(comp.element, 'width', get$f(comp.element, 'width'));
16723
 
17416
 
16724
    const renderIcon$1 = (iconName, iconsProvider, behaviours) => render$3(iconName, {
17417
    const renderIcon$1 = (iconName, iconsProvider, behaviours) => render$3(iconName, {
16725
      tag: 'span',
17418
      tag: 'span',
Línea 16740... Línea 17433...
16740
      behaviours: derive$1([Replacing.config({})])
17433
      behaviours: derive$1([Replacing.config({})])
16741
    });
17434
    });
Línea 16742... Línea 17435...
16742
 
17435
 
16743
    const updateMenuText = generate$6('update-menu-text');
17436
    const updateMenuText = generate$6('update-menu-text');
16744
    const updateMenuIcon = generate$6('update-menu-icon');
17437
    const updateMenuIcon = generate$6('update-menu-icon');
16745
    const renderCommonDropdown = (spec, prefix, sharedBackstage) => {
17438
    const renderCommonDropdown = (spec, prefix, sharedBackstage, btnName) => {
16746
      const editorOffCell = Cell(noop);
17439
      const editorOffCell = Cell(noop);
16747
      const optMemDisplayText = spec.text.map(text => record(renderLabel$1(text, prefix, sharedBackstage.providers)));
17440
      const optMemDisplayText = spec.text.map(text => record(renderLabel$1(text, prefix, sharedBackstage.providers)));
16748
      const optMemDisplayIcon = spec.icon.map(iconName => record(renderReplaceableIconFromPack(iconName, sharedBackstage.providers.icons)));
17441
      const optMemDisplayIcon = spec.icon.map(iconName => record(renderReplaceableIconFromPack(iconName, sharedBackstage.providers.icons)));
16749
      const onLeftOrRightInMenu = (comp, se) => {
17442
      const onLeftOrRightInMenu = (comp, se) => {
Línea 16752... Línea 17445...
16752
        emitWith(dropdown, 'keydown', { raw: se.event.raw });
17445
        emitWith(dropdown, 'keydown', { raw: se.event.raw });
16753
        Dropdown.close(dropdown);
17446
        Dropdown.close(dropdown);
16754
        return Optional.some(true);
17447
        return Optional.some(true);
16755
      };
17448
      };
16756
      const role = spec.role.fold(() => ({}), role => ({ role }));
17449
      const role = spec.role.fold(() => ({}), role => ({ role }));
-
 
17450
      const listRole = Optional.from(spec.listRole).map(listRole => ({ listRole })).getOr({});
16757
      const tooltipAttributes = spec.tooltip.fold(() => ({}), tooltip => {
17451
      const ariaLabelAttribute = spec.ariaLabel.fold(() => ({}), ariaLabel => {
16758
        const translatedTooltip = sharedBackstage.providers.translate(tooltip);
17452
        const translatedAriaLabel = sharedBackstage.providers.translate(ariaLabel);
16759
        return {
-
 
16760
          'title': translatedTooltip,
-
 
16761
          'aria-label': translatedTooltip
17453
        return { 'aria-label': translatedAriaLabel };
16762
        };
-
 
16763
      });
17454
      });
16764
      const iconSpec = render$3('chevron-down', {
17455
      const iconSpec = render$3('chevron-down', {
16765
        tag: 'div',
17456
        tag: 'div',
16766
        classes: [`${ prefix }__select-chevron`]
17457
        classes: [`${ prefix }__select-chevron`]
16767
      }, sharedBackstage.providers.icons);
17458
      }, sharedBackstage.providers.icons);
16768
      const fixWidthBehaviourName = generate$6('common-button-display-events');
17459
      const fixWidthBehaviourName = generate$6('common-button-display-events');
-
 
17460
      const customEventsName = 'dropdown-events';
16769
      const memDropdown = record(Dropdown.sketch({
17461
      const memDropdown = record(Dropdown.sketch({
16770
        ...spec.uid ? { uid: spec.uid } : {},
17462
        ...spec.uid ? { uid: spec.uid } : {},
16771
        ...role,
17463
        ...role,
-
 
17464
        ...listRole,
16772
        dom: {
17465
        dom: {
16773
          tag: 'button',
17466
          tag: 'button',
16774
          classes: [
17467
          classes: [
16775
            prefix,
17468
            prefix,
16776
            `${ prefix }--select`
17469
            `${ prefix }--select`
16777
          ].concat(map$2(spec.classes, c => `${ prefix }--${ c }`)),
17470
          ].concat(map$2(spec.classes, c => `${ prefix }--${ c }`)),
-
 
17471
          attributes: {
16778
          attributes: { ...tooltipAttributes }
17472
            ...ariaLabelAttribute,
-
 
17473
            ...isNonNullable(btnName) ? { 'data-mce-name': btnName } : {}
-
 
17474
          }
16779
        },
17475
        },
16780
        components: componentRenderPipeline([
17476
        components: componentRenderPipeline([
16781
          optMemDisplayIcon.map(mem => mem.asSpec()),
17477
          optMemDisplayIcon.map(mem => mem.asSpec()),
16782
          optMemDisplayText.map(mem => mem.asSpec()),
17478
          optMemDisplayText.map(mem => mem.asSpec()),
16783
          Optional.some(iconSpec)
17479
          Optional.some(iconSpec)
Línea 16789... Línea 17485...
16789
            focusSearchField(tmenuComp);
17485
            focusSearchField(tmenuComp);
16790
          }
17486
          }
16791
        },
17487
        },
16792
        dropdownBehaviours: derive$1([
17488
        dropdownBehaviours: derive$1([
16793
          ...spec.dropdownBehaviours,
17489
          ...spec.dropdownBehaviours,
16794
          DisablingConfigs.button(() => spec.disabled || sharedBackstage.providers.isDisabled()),
17490
          DisablingConfigs.button(() => spec.disabled || sharedBackstage.providers.checkUiComponentContext(spec.context).shouldDisable),
16795
          receivingConfig(),
17491
          toggleOnReceive(() => sharedBackstage.providers.checkUiComponentContext(spec.context)),
16796
          Unselecting.config({}),
17492
          Unselecting.config({}),
16797
          Replacing.config({}),
17493
          Replacing.config({}),
-
 
17494
          ...spec.tooltip.map(t => Tooltipping.config(sharedBackstage.providers.tooltips.getConfig({ tooltipText: sharedBackstage.providers.translate(t) }))).toArray(),
16798
          config('dropdown-events', [
17495
          config(customEventsName, [
16799
            onControlAttached(spec, editorOffCell),
17496
            onControlAttached(spec, editorOffCell),
16800
            onControlDetached(spec, editorOffCell)
17497
            onControlDetached(spec, editorOffCell)
16801
          ]),
17498
          ]),
16802
          config(fixWidthBehaviourName, [runOnAttached((comp, _se) => forceInitialSize(comp))]),
17499
          config(fixWidthBehaviourName, [runOnAttached((comp, _se) => {
-
 
17500
              if (spec.listRole !== 'listbox') {
-
 
17501
                forceInitialSize(comp);
-
 
17502
              }
-
 
17503
            })]),
-
 
17504
          config('update-dropdown-width-variable', [run$1(windowResize(), (comp, _se) => Dropdown.close(comp))]),
16803
          config('menubutton-update-display-text', [
17505
          config('menubutton-update-display-text', [
16804
            run$1(updateMenuText, (comp, se) => {
17506
            run$1(updateMenuText, (comp, se) => {
16805
              optMemDisplayText.bind(mem => mem.getOpt(comp)).each(displayText => {
17507
              optMemDisplayText.bind(mem => mem.getOpt(comp)).each(displayText => {
16806
                Replacing.set(displayText, [text$2(sharedBackstage.providers.translate(se.event.text))]);
17508
                Replacing.set(displayText, [text$2(sharedBackstage.providers.translate(se.event.text))]);
16807
              });
17509
              });
Línea 16812... Línea 17514...
16812
              });
17514
              });
16813
            })
17515
            })
16814
          ])
17516
          ])
16815
        ]),
17517
        ]),
16816
        eventOrder: deepMerge(toolbarButtonEventOrder, {
17518
        eventOrder: deepMerge(toolbarButtonEventOrder, {
16817
          mousedown: [
17519
          [mousedown()]: [
16818
            'focusing',
17520
            'focusing',
16819
            'alloy.base.behaviour',
17521
            'alloy.base.behaviour',
16820
            'item-type-events',
17522
            'item-type-events',
16821
            'normal-dropdown-events'
17523
            'normal-dropdown-events'
16822
          ],
17524
          ],
16823
          [attachedToDom()]: [
17525
          [attachedToDom()]: [
16824
            'toolbar-button-events',
17526
            'toolbar-button-events',
-
 
17527
            Tooltipping.name(),
16825
            'dropdown-events',
17528
            customEventsName,
16826
            fixWidthBehaviourName
17529
            fixWidthBehaviourName
16827
          ]
17530
          ]
16828
        }),
17531
        }),
16829
        sandboxBehaviours: derive$1([
17532
        sandboxBehaviours: derive$1([
16830
          Keying.config({
17533
          Keying.config({
Línea 16847... Línea 17550...
16847
        toggleClass: `${ prefix }--active`,
17550
        toggleClass: `${ prefix }--active`,
16848
        parts: {
17551
        parts: {
16849
          menu: {
17552
          menu: {
16850
            ...part(false, spec.columns, spec.presets),
17553
            ...part(false, spec.columns, spec.presets),
16851
            fakeFocus: spec.searchable,
17554
            fakeFocus: spec.searchable,
-
 
17555
            ...spec.listRole === 'listbox' ? {} : {
16852
            onHighlightItem: updateAriaOnHighlight,
17556
              onHighlightItem: updateAriaOnHighlight,
16853
            onCollapseMenu: (tmenuComp, itemCompCausingCollapse, nowActiveMenuComp) => {
17557
              onCollapseMenu: (tmenuComp, itemCompCausingCollapse, nowActiveMenuComp) => {
16854
              Highlighting.getHighlighted(nowActiveMenuComp).each(itemComp => {
17558
                Highlighting.getHighlighted(nowActiveMenuComp).each(itemComp => {
16855
                updateAriaOnHighlight(tmenuComp, nowActiveMenuComp, itemComp);
17559
                  updateAriaOnHighlight(tmenuComp, nowActiveMenuComp, itemComp);
16856
              });
17560
                });
16857
            },
17561
              },
16858
            onDehighlightItem: updateAriaOnDehighlight
17562
              onDehighlightItem: updateAriaOnDehighlight
-
 
17563
            }
16859
          }
17564
          }
16860
        },
17565
        },
16861
        getAnchorOverrides: () => {
17566
        getAnchorOverrides: () => {
16862
          return {
17567
          return {
16863
            maxHeightFunction: (element, available) => {
17568
            maxHeightFunction: (element, available) => {
Línea 16905... Línea 17610...
16905
        menus: newMenus,
17610
        menus: newMenus,
16906
        expansions: newExpansions
17611
        expansions: newExpansions
16907
      };
17612
      };
16908
    };
17613
    };
16909
    const generateValueIfRequired = item => {
17614
    const generateValueIfRequired = item => {
16910
      const itemValue = get$g(item, 'value').getOrThunk(() => generate$6('generated-menu-item'));
17615
      const itemValue = get$h(item, 'value').getOrThunk(() => generate$6('generated-menu-item'));
16911
      return deepMerge({ value: itemValue }, item);
17616
      return deepMerge({ value: itemValue }, item);
16912
    };
17617
    };
16913
    const expand = (items, menuItems) => {
17618
    const expand = (items, menuItems) => {
16914
      const realItems = unwrapReferences(isString(items) ? items.split(' ') : items, menuItems);
17619
      const realItems = unwrapReferences(isString(items) ? items.split(' ') : items, menuItems);
16915
      return foldr(realItems, (acc, item) => {
17620
      return foldr(realItems, (acc, item) => {
Línea 16963... Línea 17668...
16963
      return Optional.from(tieredMenu.tieredData(primary, menus, data.expansions));
17668
      return Optional.from(tieredMenu.tieredData(primary, menus, data.expansions));
16964
    };
17669
    };
Línea 16965... Línea 17670...
16965
 
17670
 
16966
    const isSingleListItem = item => !has$2(item, 'items');
17671
    const isSingleListItem = item => !has$2(item, 'items');
16967
    const dataAttribute = 'data-value';
17672
    const dataAttribute = 'data-value';
16968
    const fetchItems = (dropdownComp, name, items, selectedValue) => map$2(items, item => {
17673
    const fetchItems = (dropdownComp, name, items, selectedValue, hasNestedItems) => map$2(items, item => {
16969
      if (!isSingleListItem(item)) {
17674
      if (!isSingleListItem(item)) {
16970
        return {
17675
        return {
16971
          type: 'nestedmenuitem',
17676
          type: 'nestedmenuitem',
16972
          text: item.text,
17677
          text: item.text,
16973
          getSubmenuItems: () => fetchItems(dropdownComp, name, item.items, selectedValue)
17678
          getSubmenuItems: () => fetchItems(dropdownComp, name, item.items, selectedValue, hasNestedItems)
16974
        };
17679
        };
16975
      } else {
17680
      } else {
16976
        return {
17681
        return {
-
 
17682
          type: 'togglemenuitem',
16977
          type: 'togglemenuitem',
17683
          ...hasNestedItems ? {} : { role: 'option' },
16978
          text: item.text,
17684
          text: item.text,
16979
          value: item.value,
17685
          value: item.value,
16980
          active: item.value === selectedValue,
17686
          active: item.value === selectedValue,
16981
          onAction: () => {
17687
          onAction: () => {
Línea 16992... Línea 17698...
16992
      } else {
17698
      } else {
16993
        return someIf(item.value === value, item);
17699
        return someIf(item.value === value, item);
16994
      }
17700
      }
16995
    });
17701
    });
16996
    const renderListBox = (spec, backstage, initialData) => {
17702
    const renderListBox = (spec, backstage, initialData) => {
-
 
17703
      const hasNestedItems = exists(spec.items, item => !isSingleListItem(item));
16997
      const providersBackstage = backstage.shared.providers;
17704
      const providersBackstage = backstage.shared.providers;
16998
      const initialItem = initialData.bind(value => findItemByValue(spec.items, value)).orThunk(() => head(spec.items).filter(isSingleListItem));
17705
      const initialItem = initialData.bind(value => findItemByValue(spec.items, value)).orThunk(() => head(spec.items).filter(isSingleListItem));
16999
      const pLabel = spec.label.map(label => renderLabel$3(label, providersBackstage));
17706
      const pLabel = spec.label.map(label => renderLabel$3(label, providersBackstage));
17000
      const pField = FormField.parts.field({
17707
      const pField = FormField.parts.field({
17001
        dom: {},
17708
        dom: {},
17002
        factory: {
17709
        factory: {
17003
          sketch: sketchSpec => renderCommonDropdown({
17710
          sketch: sketchSpec => renderCommonDropdown({
-
 
17711
            context: spec.context,
17004
            uid: sketchSpec.uid,
17712
            uid: sketchSpec.uid,
17005
            text: initialItem.map(item => item.text),
17713
            text: initialItem.map(item => item.text),
17006
            icon: Optional.none(),
17714
            icon: Optional.none(),
17007
            tooltip: spec.label,
17715
            tooltip: Optional.none(),
-
 
17716
            role: someIf(!hasNestedItems, 'combobox'),
-
 
17717
            ...hasNestedItems ? {} : { listRole: 'listbox' },
17008
            role: Optional.none(),
17718
            ariaLabel: spec.label,
17009
            fetch: (comp, callback) => {
17719
            fetch: (comp, callback) => {
17010
              const items = fetchItems(comp, spec.name, spec.items, Representing.getValue(comp));
17720
              const items = fetchItems(comp, spec.name, spec.items, Representing.getValue(comp), hasNestedItems);
17011
              callback(build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, {
17721
              callback(build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, {
17012
                isHorizontalMenu: false,
17722
                isHorizontalMenu: false,
17013
                search: Optional.none()
17723
                search: Optional.none()
17014
              }));
17724
              }));
17015
            },
17725
            },
Línea 17018... Línea 17728...
17018
            columns: 1,
17728
            columns: 1,
17019
            presets: 'normal',
17729
            presets: 'normal',
17020
            classes: [],
17730
            classes: [],
17021
            dropdownBehaviours: [
17731
            dropdownBehaviours: [
17022
              Tabstopping.config({}),
17732
              Tabstopping.config({}),
17023
              withComp(initialItem.map(item => item.value), comp => get$f(comp.element, dataAttribute), (comp, data) => {
17733
              withComp(initialItem.map(item => item.value), comp => get$g(comp.element, dataAttribute), (comp, data) => {
17024
                findItemByValue(spec.items, data).each(item => {
17734
                findItemByValue(spec.items, data).each(item => {
17025
                  set$9(comp.element, dataAttribute, item.value);
17735
                  set$9(comp.element, dataAttribute, item.value);
17026
                  emitWith(comp, updateMenuText, { text: item.text });
17736
                  emitWith(comp, updateMenuText, { text: item.text });
17027
                });
17737
                });
17028
              })
17738
              })
Línea 17045... Línea 17755...
17045
        components: flatten([
17755
        components: flatten([
17046
          pLabel.toArray(),
17756
          pLabel.toArray(),
17047
          [listBoxWrap]
17757
          [listBoxWrap]
17048
        ]),
17758
        ]),
17049
        fieldBehaviours: derive$1([Disabling.config({
17759
        fieldBehaviours: derive$1([Disabling.config({
17050
            disabled: constant$1(!spec.enabled),
17760
            disabled: () => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable,
17051
            onDisabled: comp => {
17761
            onDisabled: comp => {
17052
              FormField.getField(comp).each(Disabling.disable);
17762
              FormField.getField(comp).each(Disabling.disable);
17053
            },
17763
            },
17054
            onEnabled: comp => {
17764
            onEnabled: comp => {
17055
              FormField.getField(comp).each(Disabling.enable);
17765
              FormField.getField(comp).each(Disabling.enable);
Línea 17087... Línea 17797...
17087
          Focusing.config({}),
17797
          Focusing.config({}),
17088
          Representing.config({
17798
          Representing.config({
17089
            store: {
17799
            store: {
17090
              mode: 'manual',
17800
              mode: 'manual',
17091
              getValue: select => {
17801
              getValue: select => {
17092
                return get$6(select.element);
17802
                return get$7(select.element);
17093
              },
17803
              },
17094
              setValue: (select, newValue) => {
17804
              setValue: (select, newValue) => {
17095
                const firstOption = head(detail.options);
17805
                const firstOption = head(detail.options);
17096
                const found = find$5(detail.options, opt => opt.value === newValue);
17806
                const found = find$5(detail.options, opt => opt.value === newValue);
17097
                if (found.isSome()) {
17807
                if (found.isSome()) {
Línea 17132... Línea 17842...
17132
        ...initialData.map(data => ({ data })).getOr({}),
17842
        ...initialData.map(data => ({ data })).getOr({}),
17133
        selectAttributes: { size: spec.size },
17843
        selectAttributes: { size: spec.size },
17134
        options: translatedOptions,
17844
        options: translatedOptions,
17135
        factory: HtmlSelect,
17845
        factory: HtmlSelect,
17136
        selectBehaviours: derive$1([
17846
        selectBehaviours: derive$1([
17137
          Disabling.config({ disabled: () => !spec.enabled || providersBackstage.isDisabled() }),
17847
          Disabling.config({ disabled: () => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable }),
17138
          Tabstopping.config({}),
17848
          Tabstopping.config({}),
17139
          config('selectbox-change', [run$1(change(), (component, _) => {
17849
          config('selectbox-change', [run$1(change(), (component, _) => {
17140
              emitWith(component, formChangeEvent, { name: spec.name });
17850
              emitWith(component, formChangeEvent, { name: spec.name });
17141
            })])
17851
            })])
17142
        ])
17852
        ])
Línea 17164... Línea 17874...
17164
          pLabel.toArray(),
17874
          pLabel.toArray(),
17165
          [selectWrap]
17875
          [selectWrap]
17166
        ]),
17876
        ]),
17167
        fieldBehaviours: derive$1([
17877
        fieldBehaviours: derive$1([
17168
          Disabling.config({
17878
          Disabling.config({
17169
            disabled: () => !spec.enabled || providersBackstage.isDisabled(),
17879
            disabled: () => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable,
17170
            onDisabled: comp => {
17880
            onDisabled: comp => {
17171
              FormField.getField(comp).each(Disabling.disable);
17881
              FormField.getField(comp).each(Disabling.disable);
17172
            },
17882
            },
17173
            onEnabled: comp => {
17883
            onEnabled: comp => {
17174
              FormField.getField(comp).each(Disabling.enable);
17884
              FormField.getField(comp).each(Disabling.enable);
17175
            }
17885
            }
17176
          }),
17886
          }),
17177
          receivingConfig()
17887
          toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context))
17178
        ])
17888
        ])
17179
      });
17889
      });
17180
    };
17890
    };
Línea 17181... Línea 17891...
17181
 
17891
 
Línea 17186... Línea 17896...
17186
      markers$1(['lockClass']),
17896
      markers$1(['lockClass']),
17187
      defaulted('locked', false),
17897
      defaulted('locked', false),
17188
      SketchBehaviours.field('coupledFieldBehaviours', [
17898
      SketchBehaviours.field('coupledFieldBehaviours', [
17189
        Composing,
17899
        Composing,
17190
        Representing
17900
        Representing
17191
      ])
17901
      ]),
-
 
17902
      defaultedFunction('onInput', noop)
17192
    ]);
17903
    ]);
17193
    const getField = (comp, detail, partName) => getPart(comp, detail, partName).bind(Composing.getCurrent);
17904
    const getField = (comp, detail, partName) => getPart(comp, detail, partName).bind(Composing.getCurrent);
17194
    const coupledPart = (selfName, otherName) => required({
17905
    const coupledPart = (selfName, otherName) => required({
17195
      factory: FormField,
17906
      factory: FormField,
17196
      name: selfName,
17907
      name: selfName,
Línea 17200... Línea 17911...
17200
                getField(me, detail, otherName).each(other => {
17911
                getField(me, detail, otherName).each(other => {
17201
                  getPart(me, detail, 'lock').each(lock => {
17912
                  getPart(me, detail, 'lock').each(lock => {
17202
                    if (Toggling.isOn(lock)) {
17913
                    if (Toggling.isOn(lock)) {
17203
                      detail.onLockedChange(me, other, lock);
17914
                      detail.onLockedChange(me, other, lock);
17204
                    }
17915
                    }
-
 
17916
                    detail.onInput(me);
17205
                  });
17917
                  });
17206
                });
17918
                });
17207
              })])])
17919
              })])])
17208
        };
17920
        };
17209
      }
17921
      }
Línea 17357... Línea 18069...
17357
        classes: [
18069
        classes: [
17358
          'tox-icon',
18070
          'tox-icon',
17359
          'tox-lock-icon__' + iconName
18071
          'tox-lock-icon__' + iconName
17360
        ]
18072
        ]
17361
      }, providersBackstage.icons);
18073
      }, providersBackstage.icons);
-
 
18074
      const disabled = () => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable;
-
 
18075
      const toggleOnReceive$1 = toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context));
-
 
18076
      const label = spec.label.getOr('Constrain proportions');
-
 
18077
      const translatedLabel = providersBackstage.translate(label);
17362
      const pLock = FormCoupledInputs.parts.lock({
18078
      const pLock = FormCoupledInputs.parts.lock({
17363
        dom: {
18079
        dom: {
17364
          tag: 'button',
18080
          tag: 'button',
17365
          classes: [
18081
          classes: [
17366
            'tox-lock',
18082
            'tox-lock',
17367
            'tox-button',
18083
            'tox-button',
17368
            'tox-button--naked',
18084
            'tox-button--naked',
17369
            'tox-button--icon'
18085
            'tox-button--icon'
17370
          ],
18086
          ],
-
 
18087
          attributes: {
17371
          attributes: { title: providersBackstage.translate(spec.label.getOr('Constrain proportions')) }
18088
            'aria-label': translatedLabel,
-
 
18089
            'data-mce-name': label
-
 
18090
          }
17372
        },
18091
        },
17373
        components: [
18092
        components: [
17374
          makeIcon('lock'),
18093
          makeIcon('lock'),
17375
          makeIcon('unlock')
18094
          makeIcon('unlock')
17376
        ],
18095
        ],
17377
        buttonBehaviours: derive$1([
18096
        buttonBehaviours: derive$1([
17378
          Disabling.config({ disabled: () => !spec.enabled || providersBackstage.isDisabled() }),
18097
          Disabling.config({ disabled }),
17379
          receivingConfig(),
18098
          toggleOnReceive$1,
17380
          Tabstopping.config({})
18099
          Tabstopping.config({}),
-
 
18100
          Tooltipping.config(providersBackstage.tooltips.getConfig({ tooltipText: translatedLabel }))
17381
        ])
18101
        ])
17382
      });
18102
      });
17383
      const formGroup = components => ({
18103
      const formGroup = components => ({
17384
        dom: {
18104
        dom: {
17385
          tag: 'div',
18105
          tag: 'div',
Línea 17389... Línea 18109...
17389
      });
18109
      });
17390
      const getFieldPart = isField1 => FormField.parts.field({
18110
      const getFieldPart = isField1 => FormField.parts.field({
17391
        factory: Input,
18111
        factory: Input,
17392
        inputClasses: ['tox-textfield'],
18112
        inputClasses: ['tox-textfield'],
17393
        inputBehaviours: derive$1([
18113
        inputBehaviours: derive$1([
17394
          Disabling.config({ disabled: () => !spec.enabled || providersBackstage.isDisabled() }),
18114
          Disabling.config({ disabled }),
17395
          receivingConfig(),
18115
          toggleOnReceive$1,
17396
          Tabstopping.config({}),
18116
          Tabstopping.config({}),
17397
          config('size-input-events', [
18117
          config('size-input-events', [
17398
            run$1(focusin(), (component, _simulatedEvent) => {
18118
            run$1(focusin(), (component, _simulatedEvent) => {
17399
              emitWith(component, ratioEvent, { isField1 });
18119
              emitWith(component, ratioEvent, { isField1 });
17400
            }),
18120
            }),
Línea 17450... Línea 18170...
17450
            });
18170
            });
17451
          });
18171
          });
17452
        },
18172
        },
17453
        coupledFieldBehaviours: derive$1([
18173
        coupledFieldBehaviours: derive$1([
17454
          Disabling.config({
18174
          Disabling.config({
17455
            disabled: () => !spec.enabled || providersBackstage.isDisabled(),
18175
            disabled,
17456
            onDisabled: comp => {
18176
            onDisabled: comp => {
17457
              FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.disable);
18177
              FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.disable);
17458
              FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.disable);
18178
              FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.disable);
17459
              FormCoupledInputs.getLock(comp).each(Disabling.disable);
18179
              FormCoupledInputs.getLock(comp).each(Disabling.disable);
17460
            },
18180
            },
Línea 17462... Línea 18182...
17462
              FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.enable);
18182
              FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.enable);
17463
              FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.enable);
18183
              FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.enable);
17464
              FormCoupledInputs.getLock(comp).each(Disabling.enable);
18184
              FormCoupledInputs.getLock(comp).each(Disabling.enable);
17465
            }
18185
            }
17466
          }),
18186
          }),
17467
          receivingConfig(),
18187
          toggleOnReceive(() => providersBackstage.checkUiComponentContext('mode:design')),
17468
          config('size-input-events2', [run$1(ratioEvent, (component, simulatedEvent) => {
18188
          config('size-input-events2', [run$1(ratioEvent, (component, simulatedEvent) => {
17469
              const isField1 = simulatedEvent.event.isField1;
18189
              const isField1 = simulatedEvent.event.isField1;
17470
              const optCurrent = isField1 ? FormCoupledInputs.getField1(component) : FormCoupledInputs.getField2(component);
18190
              const optCurrent = isField1 ? FormCoupledInputs.getField1(component) : FormCoupledInputs.getField2(component);
17471
              const optOther = isField1 ? FormCoupledInputs.getField2(component) : FormCoupledInputs.getField1(component);
18191
              const optOther = isField1 ? FormCoupledInputs.getField2(component) : FormCoupledInputs.getField1(component);
17472
              const value1 = optCurrent.map(Representing.getValue).getOr('');
18192
              const value1 = optCurrent.map(Representing.getValue).getOr('');
Línea 17523... Línea 18243...
17523
        onChoose: (component, thumb, value) => {
18243
        onChoose: (component, thumb, value) => {
17524
          emitWith(component, formChangeEvent, {
18244
          emitWith(component, formChangeEvent, {
17525
            name: spec.name,
18245
            name: spec.name,
17526
            value
18246
            value
17527
          });
18247
          });
-
 
18248
        },
-
 
18249
        onChange: (component, thumb, value) => {
-
 
18250
          emitWith(component, formChangeEvent, {
-
 
18251
            name: spec.name,
-
 
18252
            value
-
 
18253
          });
17528
        }
18254
        }
17529
      });
18255
      });
17530
    };
18256
    };
Línea 17531... Línea 18257...
17531
 
18257
 
Línea 17574... Línea 18300...
17574
    };
18300
    };
Línea 17575... Línea 18301...
17575
 
18301
 
17576
    const renderTextField = (spec, providersBackstage) => {
18302
    const renderTextField = (spec, providersBackstage) => {
17577
      const pLabel = spec.label.map(label => renderLabel$3(label, providersBackstage));
18303
      const pLabel = spec.label.map(label => renderLabel$3(label, providersBackstage));
17578
      const baseInputBehaviours = [
18304
      const baseInputBehaviours = [
17579
        Disabling.config({ disabled: () => spec.disabled || providersBackstage.isDisabled() }),
18305
        Disabling.config({ disabled: () => spec.disabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable }),
17580
        receivingConfig(),
18306
        toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context)),
17581
        Keying.config({
18307
        Keying.config({
17582
          mode: 'execution',
18308
          mode: 'execution',
17583
          useEnter: spec.multiline !== true,
18309
          useEnter: spec.multiline !== true,
17584
          useControlEnter: spec.multiline === true,
18310
          useControlEnter: spec.multiline === true,
Línea 17613... Línea 18339...
17613
      })).toArray();
18339
      })).toArray();
17614
      const placeholder = spec.placeholder.fold(constant$1({}), p => ({ placeholder: providersBackstage.translate(p) }));
18340
      const placeholder = spec.placeholder.fold(constant$1({}), p => ({ placeholder: providersBackstage.translate(p) }));
17615
      const inputMode = spec.inputMode.fold(constant$1({}), mode => ({ inputmode: mode }));
18341
      const inputMode = spec.inputMode.fold(constant$1({}), mode => ({ inputmode: mode }));
17616
      const inputAttributes = {
18342
      const inputAttributes = {
17617
        ...placeholder,
18343
        ...placeholder,
17618
        ...inputMode
18344
        ...inputMode,
-
 
18345
        'data-mce-name': spec.name
17619
      };
18346
      };
17620
      const pField = FormField.parts.field({
18347
      const pField = FormField.parts.field({
17621
        tag: spec.multiline === true ? 'textarea' : 'input',
18348
        tag: spec.multiline === true ? 'textarea' : 'input',
17622
        ...spec.data.map(data => ({ data })).getOr({}),
18349
        ...spec.data.map(data => ({ data })).getOr({}),
17623
        inputAttributes,
18350
        inputAttributes,
Línea 17638... Línea 18365...
17638
      } : pField;
18365
      } : pField;
17639
      const extraClasses = spec.flex ? ['tox-form__group--stretched'] : [];
18366
      const extraClasses = spec.flex ? ['tox-form__group--stretched'] : [];
17640
      const extraClasses2 = extraClasses.concat(spec.maximized ? ['tox-form-group--maximize'] : []);
18367
      const extraClasses2 = extraClasses.concat(spec.maximized ? ['tox-form-group--maximize'] : []);
17641
      const extraBehaviours = [
18368
      const extraBehaviours = [
17642
        Disabling.config({
18369
        Disabling.config({
17643
          disabled: () => spec.disabled || providersBackstage.isDisabled(),
18370
          disabled: () => spec.disabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable,
17644
          onDisabled: comp => {
18371
          onDisabled: comp => {
17645
            FormField.getField(comp).each(Disabling.disable);
18372
            FormField.getField(comp).each(Disabling.disable);
17646
          },
18373
          },
17647
          onEnabled: comp => {
18374
          onEnabled: comp => {
17648
            FormField.getField(comp).each(Disabling.enable);
18375
            FormField.getField(comp).each(Disabling.enable);
17649
          }
18376
          }
17650
        }),
18377
        }),
17651
        receivingConfig()
18378
        toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context))
17652
      ];
18379
      ];
17653
      return renderFormFieldWith(pLabel, pTextField, extraClasses2, extraBehaviours);
18380
      return renderFormFieldWith(pLabel, pTextField, extraClasses2, extraBehaviours);
17654
    };
18381
    };
17655
    const renderInput = (spec, providersBackstage, initialData) => renderTextField({
18382
    const renderInput = (spec, providersBackstage, initialData) => renderTextField({
17656
      name: spec.name,
18383
      name: spec.name,
Línea 17661... Línea 18388...
17661
      flex: false,
18388
      flex: false,
17662
      disabled: !spec.enabled,
18389
      disabled: !spec.enabled,
17663
      classname: 'tox-textfield',
18390
      classname: 'tox-textfield',
17664
      validation: Optional.none(),
18391
      validation: Optional.none(),
17665
      maximized: spec.maximized,
18392
      maximized: spec.maximized,
17666
      data: initialData
18393
      data: initialData,
-
 
18394
      context: spec.context
17667
    }, providersBackstage);
18395
    }, providersBackstage);
17668
    const renderTextarea = (spec, providersBackstage, initialData) => renderTextField({
18396
    const renderTextarea = (spec, providersBackstage, initialData) => renderTextField({
17669
      name: spec.name,
18397
      name: spec.name,
17670
      multiline: true,
18398
      multiline: true,
17671
      label: spec.label,
18399
      label: spec.label,
Línea 17674... Línea 18402...
17674
      flex: true,
18402
      flex: true,
17675
      disabled: !spec.enabled,
18403
      disabled: !spec.enabled,
17676
      classname: 'tox-textarea',
18404
      classname: 'tox-textarea',
17677
      validation: Optional.none(),
18405
      validation: Optional.none(),
17678
      maximized: spec.maximized,
18406
      maximized: spec.maximized,
17679
      data: initialData
18407
      data: initialData,
-
 
18408
      context: spec.context
17680
    }, providersBackstage);
18409
    }, providersBackstage);
Línea 17681... Línea 18410...
17681
 
18410
 
Línea 17682... Línea 18411...
17682
    const getAnimationRoot = (component, slideConfig) => slideConfig.getAnimationRoot.fold(() => component.element, get => get(component));
18411
    const getAnimationRoot = (component, slideConfig) => slideConfig.getAnimationRoot.fold(() => component.element, get => get(component));
17683
 
18412
 
17684
    const getDimensionProperty = slideConfig => slideConfig.dimension.property;
18413
    const getDimensionProperty = slideConfig => slideConfig.dimension.property;
17685
    const getDimension = (slideConfig, elem) => slideConfig.dimension.getDimension(elem);
18414
    const getDimension = (slideConfig, elem) => slideConfig.dimension.getDimension(elem);
17686
    const disableTransitions = (component, slideConfig) => {
18415
    const disableTransitions = (component, slideConfig) => {
17687
      const root = getAnimationRoot(component, slideConfig);
18416
      const root = getAnimationRoot(component, slideConfig);
17688
      remove$1(root, [
18417
      remove$2(root, [
17689
        slideConfig.shrinkingClass,
18418
        slideConfig.shrinkingClass,
17690
        slideConfig.growingClass
18419
        slideConfig.growingClass
17691
      ]);
18420
      ]);
17692
    };
18421
    };
17693
    const setShrunk = (component, slideConfig) => {
18422
    const setShrunk = (component, slideConfig) => {
17694
      remove$2(component.element, slideConfig.openClass);
18423
      remove$3(component.element, slideConfig.openClass);
17695
      add$2(component.element, slideConfig.closedClass);
18424
      add$2(component.element, slideConfig.closedClass);
17696
      set$8(component.element, getDimensionProperty(slideConfig), '0px');
18425
      set$8(component.element, getDimensionProperty(slideConfig), '0px');
17697
      reflow(component.element);
18426
      reflow(component.element);
17698
    };
18427
    };
17699
    const setGrown = (component, slideConfig) => {
18428
    const setGrown = (component, slideConfig) => {
17700
      remove$2(component.element, slideConfig.closedClass);
18429
      remove$3(component.element, slideConfig.closedClass);
17701
      add$2(component.element, slideConfig.openClass);
18430
      add$2(component.element, slideConfig.openClass);
17702
      remove$6(component.element, getDimensionProperty(slideConfig));
18431
      remove$7(component.element, getDimensionProperty(slideConfig));
17703
    };
18432
    };
17704
    const doImmediateShrink = (component, slideConfig, slideState, _calculatedSize) => {
18433
    const doImmediateShrink = (component, slideConfig, slideState, _calculatedSize) => {
17705
      slideState.setCollapsed();
18434
      slideState.setCollapsed();
Línea 17713... Línea 18442...
17713
      const size = calculatedSize.getOrThunk(() => getDimension(slideConfig, component.element));
18442
      const size = calculatedSize.getOrThunk(() => getDimension(slideConfig, component.element));
17714
      slideState.setCollapsed();
18443
      slideState.setCollapsed();
17715
      set$8(component.element, getDimensionProperty(slideConfig), size);
18444
      set$8(component.element, getDimensionProperty(slideConfig), size);
17716
      reflow(component.element);
18445
      reflow(component.element);
17717
      const root = getAnimationRoot(component, slideConfig);
18446
      const root = getAnimationRoot(component, slideConfig);
17718
      remove$2(root, slideConfig.growingClass);
18447
      remove$3(root, slideConfig.growingClass);
17719
      add$2(root, slideConfig.shrinkingClass);
18448
      add$2(root, slideConfig.shrinkingClass);
17720
      setShrunk(component, slideConfig);
18449
      setShrunk(component, slideConfig);
17721
      slideConfig.onStartShrink(component);
18450
      slideConfig.onStartShrink(component);
17722
    };
18451
    };
17723
    const doStartSmartShrink = (component, slideConfig, slideState) => {
18452
    const doStartSmartShrink = (component, slideConfig, slideState) => {
Línea 17738... Línea 18467...
17738
      const startCompleteGrow = () => {
18467
      const startCompleteGrow = () => {
17739
        setShrunk(component, slideConfig);
18468
        setShrunk(component, slideConfig);
17740
      };
18469
      };
17741
      const setStartSize = wasShrinking ? startPartialGrow : startCompleteGrow;
18470
      const setStartSize = wasShrinking ? startPartialGrow : startCompleteGrow;
17742
      setStartSize();
18471
      setStartSize();
17743
      remove$2(root, slideConfig.shrinkingClass);
18472
      remove$3(root, slideConfig.shrinkingClass);
17744
      add$2(root, slideConfig.growingClass);
18473
      add$2(root, slideConfig.growingClass);
17745
      setGrown(component, slideConfig);
18474
      setGrown(component, slideConfig);
17746
      set$8(component.element, getDimensionProperty(slideConfig), fullSize);
18475
      set$8(component.element, getDimensionProperty(slideConfig), fullSize);
17747
      slideState.setExpanded();
18476
      slideState.setExpanded();
17748
      slideConfig.onStartGrow(component);
18477
      slideConfig.onStartGrow(component);
17749
    };
18478
    };
17750
    const refresh$4 = (component, slideConfig, slideState) => {
18479
    const refresh$3 = (component, slideConfig, slideState) => {
17751
      if (slideState.isExpanded()) {
18480
      if (slideState.isExpanded()) {
17752
        remove$6(component.element, getDimensionProperty(slideConfig));
18481
        remove$7(component.element, getDimensionProperty(slideConfig));
17753
        const fullSize = getDimension(slideConfig, component.element);
18482
        const fullSize = getDimension(slideConfig, component.element);
17754
        set$8(component.element, getDimensionProperty(slideConfig), fullSize);
18483
        set$8(component.element, getDimensionProperty(slideConfig), fullSize);
17755
      }
18484
      }
17756
    };
18485
    };
17757
    const grow = (component, slideConfig, slideState) => {
18486
    const grow = (component, slideConfig, slideState) => {
Línea 17795... Línea 18524...
17795
      }
18524
      }
17796
    };
18525
    };
Línea 17797... Línea 18526...
17797
 
18526
 
17798
    var SlidingApis = /*#__PURE__*/Object.freeze({
18527
    var SlidingApis = /*#__PURE__*/Object.freeze({
17799
        __proto__: null,
18528
        __proto__: null,
17800
        refresh: refresh$4,
18529
        refresh: refresh$3,
17801
        grow: grow,
18530
        grow: grow,
17802
        shrink: shrink,
18531
        shrink: shrink,
17803
        immediateShrink: immediateShrink,
18532
        immediateShrink: immediateShrink,
17804
        hasGrown: hasGrown,
18533
        hasGrown: hasGrown,
Línea 17811... Línea 18540...
17811
        immediateGrow: immediateGrow
18540
        immediateGrow: immediateGrow
17812
    });
18541
    });
Línea 17813... Línea 18542...
17813
 
18542
 
17814
    const exhibit = (base, slideConfig, _slideState) => {
18543
    const exhibit = (base, slideConfig, _slideState) => {
17815
      const expanded = slideConfig.expanded;
18544
      const expanded = slideConfig.expanded;
17816
      return expanded ? nu$7({
18545
      return expanded ? nu$8({
17817
        classes: [slideConfig.openClass],
18546
        classes: [slideConfig.openClass],
17818
        styles: {}
18547
        styles: {}
17819
      }) : nu$7({
18548
      }) : nu$8({
17820
        classes: [slideConfig.closedClass],
18549
        classes: [slideConfig.closedClass],
17821
        styles: wrap$1(slideConfig.dimension.property, '0px')
18550
        styles: wrap$1(slideConfig.dimension.property, '0px')
17822
      });
18551
      });
17823
    };
18552
    };
17824
    const events$6 = (slideConfig, slideState) => derive$2([runOnSource(transitionend(), (component, simulatedEvent) => {
18553
    const events$5 = (slideConfig, slideState) => derive$2([runOnSource(transitionend(), (component, simulatedEvent) => {
17825
        const raw = simulatedEvent.event.raw;
18554
        const raw = simulatedEvent.event.raw;
17826
        if (raw.propertyName === slideConfig.dimension.property) {
18555
        if (raw.propertyName === slideConfig.dimension.property) {
17827
          disableTransitions(component, slideConfig);
18556
          disableTransitions(component, slideConfig);
17828
          if (slideState.isExpanded()) {
18557
          if (slideState.isExpanded()) {
17829
            remove$6(component.element, slideConfig.dimension.property);
18558
            remove$7(component.element, slideConfig.dimension.property);
17830
          }
18559
          }
17831
          const notify = slideState.isExpanded() ? slideConfig.onGrown : slideConfig.onShrunk;
18560
          const notify = slideState.isExpanded() ? slideConfig.onGrown : slideConfig.onShrunk;
17832
          notify(component);
18561
          notify(component);
17833
        }
18562
        }
Línea 17834... Línea 18563...
17834
      })]);
18563
      })]);
17835
 
18564
 
17836
    var ActiveSliding = /*#__PURE__*/Object.freeze({
18565
    var ActiveSliding = /*#__PURE__*/Object.freeze({
17837
        __proto__: null,
18566
        __proto__: null,
17838
        exhibit: exhibit,
18567
        exhibit: exhibit,
Línea 17839... Línea 18568...
17839
        events: events$6
18568
        events: events$5
17840
    });
18569
    });
17841
 
18570
 
Línea 17851... Línea 18580...
17851
      onHandler('onStartGrow'),
18580
      onHandler('onStartGrow'),
17852
      defaulted('expanded', false),
18581
      defaulted('expanded', false),
17853
      requiredOf('dimension', choose$1('property', {
18582
      requiredOf('dimension', choose$1('property', {
17854
        width: [
18583
        width: [
17855
          output$1('property', 'width'),
18584
          output$1('property', 'width'),
17856
          output$1('getDimension', elem => get$c(elem) + 'px')
18585
          output$1('getDimension', elem => get$d(elem) + 'px')
17857
        ],
18586
        ],
17858
        height: [
18587
        height: [
17859
          output$1('property', 'height'),
18588
          output$1('property', 'height'),
17860
          output$1('getDimension', elem => get$d(elem) + 'px')
18589
          output$1('getDimension', elem => get$e(elem) + 'px')
17861
        ]
18590
        ]
17862
      }))
18591
      }))
17863
    ];
18592
    ];
Línea 17864... Línea 18593...
17864
 
18593
 
17865
    const init$9 = spec => {
18594
    const init$8 = spec => {
17866
      const state = Cell(spec.expanded);
18595
      const state = Cell(spec.expanded);
17867
      const readState = () => 'expanded: ' + state.get();
18596
      const readState = () => 'expanded: ' + state.get();
17868
      return nu$8({
18597
      return nu$7({
17869
        isExpanded: () => state.get() === true,
18598
        isExpanded: () => state.get() === true,
17870
        isCollapsed: () => state.get() === false,
18599
        isCollapsed: () => state.get() === false,
17871
        setCollapsed: curry(state.set, false),
18600
        setCollapsed: curry(state.set, false),
17872
        setExpanded: curry(state.set, true),
18601
        setExpanded: curry(state.set, true),
17873
        readState
18602
        readState
17874
      });
18603
      });
Línea 17875... Línea 18604...
17875
    };
18604
    };
17876
 
18605
 
17877
    var SlidingState = /*#__PURE__*/Object.freeze({
18606
    var SlidingState = /*#__PURE__*/Object.freeze({
17878
        __proto__: null,
18607
        __proto__: null,
Línea 17879... Línea 18608...
17879
        init: init$9
18608
        init: init$8
17880
    });
18609
    });
17881
 
18610
 
Línea 17894... Línea 18623...
17894
        const elm = component.element;
18623
        const elm = component.element;
17895
        if (state) {
18624
        if (state) {
17896
          add$2(elm, 'tox-tbtn--enabled');
18625
          add$2(elm, 'tox-tbtn--enabled');
17897
          set$9(elm, 'aria-pressed', true);
18626
          set$9(elm, 'aria-pressed', true);
17898
        } else {
18627
        } else {
17899
          remove$2(elm, 'tox-tbtn--enabled');
18628
          remove$3(elm, 'tox-tbtn--enabled');
17900
          remove$7(elm, 'aria-pressed');
18629
          remove$8(elm, 'aria-pressed');
17901
        }
18630
        }
17902
      },
18631
      },
17903
      isActive: () => has(component.element, 'tox-tbtn--enabled'),
18632
      isActive: () => has(component.element, 'tox-tbtn--enabled'),
17904
      setText: text => {
18633
      setText: text => {
17905
        emitWith(component, updateMenuText, { text });
18634
        emitWith(component, updateMenuText, { text });
17906
      },
18635
      },
17907
      setIcon: icon => emitWith(component, updateMenuIcon, { icon })
18636
      setIcon: icon => emitWith(component, updateMenuIcon, { icon })
17908
    });
18637
    });
17909
    const renderMenuButton = (spec, prefix, backstage, role, tabstopping = true) => {
18638
    const renderMenuButton = (spec, prefix, backstage, role, tabstopping = true, btnName) => {
17910
      return renderCommonDropdown({
18639
      return renderCommonDropdown({
17911
        text: spec.text,
18640
        text: spec.text,
17912
        icon: spec.icon,
18641
        icon: spec.icon,
17913
        tooltip: spec.tooltip,
18642
        tooltip: spec.tooltip,
-
 
18643
        ariaLabel: spec.tooltip,
17914
        searchable: spec.search.isSome(),
18644
        searchable: spec.search.isSome(),
17915
        role,
18645
        role,
17916
        fetch: (dropdownComp, callback) => {
18646
        fetch: (dropdownComp, callback) => {
17917
          const fetchContext = { pattern: spec.search.isSome() ? getSearchPattern(dropdownComp) : '' };
18647
          const fetchContext = { pattern: spec.search.isSome() ? getSearchPattern(dropdownComp) : '' };
17918
          spec.fetch(items => {
18648
          spec.fetch(items => {
Línea 17925... Línea 18655...
17925
        onSetup: spec.onSetup,
18655
        onSetup: spec.onSetup,
17926
        getApi: getMenuButtonApi,
18656
        getApi: getMenuButtonApi,
17927
        columns: 1,
18657
        columns: 1,
17928
        presets: 'normal',
18658
        presets: 'normal',
17929
        classes: [],
18659
        classes: [],
17930
        dropdownBehaviours: [...tabstopping ? [Tabstopping.config({})] : []]
18660
        dropdownBehaviours: [...tabstopping ? [Tabstopping.config({})] : []],
-
 
18661
        context: spec.context
17931
      }, prefix, backstage.shared);
18662
      }, prefix, backstage.shared, btnName);
17932
    };
18663
    };
17933
    const getFetch = (items, getButton, backstage) => {
18664
    const getFetch = (items, getButton, backstage) => {
17934
      const getMenuItemAction = item => api => {
18665
      const getMenuItemAction = item => api => {
17935
        const newValue = !api.isActive();
18666
        const newValue = !api.isActive();
17936
        api.setActive(newValue);
18667
        api.setActive(newValue);
Línea 17953... Línea 18684...
17953
          const text = item.text.fold(() => ({}), text => ({ text }));
18684
          const text = item.text.fold(() => ({}), text => ({ text }));
17954
          return {
18685
          return {
17955
            type: item.type,
18686
            type: item.type,
17956
            active: false,
18687
            active: false,
17957
            ...text,
18688
            ...text,
-
 
18689
            context: item.context,
17958
            onAction: getMenuItemAction(item),
18690
            onAction: getMenuItemAction(item),
17959
            onSetup: getMenuItemSetup(item)
18691
            onSetup: getMenuItemSetup(item)
17960
          };
18692
          };
17961
        }));
18693
        }));
17962
      };
18694
      };
Línea 17964... Línea 18696...
17964
 
18696
 
17965
    const renderLabel = text => ({
18697
    const renderLabel = text => ({
17966
      dom: {
18698
      dom: {
17967
        tag: 'span',
18699
        tag: 'span',
17968
        classes: ['tox-tree__label'],
-
 
17969
        attributes: {
-
 
17970
          'title': text,
18700
        classes: ['tox-tree__label'],
17971
          'aria-label': text
-
 
17972
        }
18701
        attributes: { 'aria-label': text }
17973
      },
18702
      },
17974
      components: [text$2(text)]
18703
      components: [text$2(text)]
-
 
18704
    });
-
 
18705
    const renderCustomStateIcon = (container, components, backstage) => {
-
 
18706
      container.customStateIcon.each(icon => components.push(renderIcon(icon, backstage.shared.providers.icons, container.customStateIconTooltip.fold(() => [], tooltip => [Tooltipping.config(backstage.shared.providers.tooltips.getConfig({ tooltipText: tooltip }))]), ['tox-icon-custom-state'])));
17975
    });
18707
    };
17976
    const leafLabelEventsId = generate$6('leaf-label-event-id');
18708
    const leafLabelEventsId = generate$6('leaf-label-event-id');
17977
    const renderLeafLabel = ({leaf, onLeafAction, visible, treeId, selectedId, backstage}) => {
18709
    const renderLeafLabel = ({leaf, onLeafAction, visible, treeId, selectedId, backstage}) => {
17978
      const internalMenuButton = leaf.menu.map(btn => renderMenuButton(btn, 'tox-mbtn', backstage, Optional.none(), visible));
18710
      const internalMenuButton = leaf.menu.map(btn => renderMenuButton(btn, 'tox-mbtn', backstage, Optional.none(), visible));
-
 
18711
      const components = [renderLabel(leaf.title)];
17979
      const components = [renderLabel(leaf.title)];
18712
      renderCustomStateIcon(leaf, components, backstage);
17980
      internalMenuButton.each(btn => components.push(btn));
18713
      internalMenuButton.each(btn => components.push(btn));
17981
      return Button.sketch({
18714
      return Button.sketch({
17982
        dom: {
18715
        dom: {
17983
          tag: 'div',
18716
          tag: 'div',
Línea 18039... Línea 18772...
18039
            })
18772
            })
18040
          ])
18773
          ])
18041
        ])
18774
        ])
18042
      });
18775
      });
18043
    };
18776
    };
18044
    const renderIcon = (iconName, iconsProvider, behaviours) => render$3(iconName, {
18777
    const renderIcon = (iconName, iconsProvider, behaviours, extraClasses, extraAttributes) => render$3(iconName, {
18045
      tag: 'span',
18778
      tag: 'span',
18046
      classes: [
18779
      classes: [
18047
        'tox-tree__icon-wrap',
18780
        'tox-tree__icon-wrap',
18048
        'tox-icon'
18781
        'tox-icon'
18049
      ],
18782
      ].concat(extraClasses || []),
18050
      behaviours
18783
      behaviours,
-
 
18784
      attributes: extraAttributes
18051
    }, iconsProvider);
18785
    }, iconsProvider);
18052
    const renderIconFromPack = (iconName, iconsProvider) => renderIcon(iconName, iconsProvider, []);
18786
    const renderIconFromPack = (iconName, iconsProvider) => renderIcon(iconName, iconsProvider, []);
18053
    const directoryLabelEventsId = generate$6('directory-label-event-id');
18787
    const directoryLabelEventsId = generate$6('directory-label-event-id');
18054
    const renderDirectoryLabel = ({directory, visible, noChildren, backstage}) => {
18788
    const renderDirectoryLabel = ({directory, visible, noChildren, backstage}) => {
18055
      const internalMenuButton = directory.menu.map(btn => renderMenuButton(btn, 'tox-mbtn', backstage, Optional.none()));
18789
      const internalMenuButton = directory.menu.map(btn => renderMenuButton(btn, 'tox-mbtn', backstage, Optional.none()));
Línea 18061... Línea 18795...
18061
          },
18795
          },
18062
          components: [renderIconFromPack('chevron-right', backstage.shared.providers.icons)]
18796
          components: [renderIconFromPack('chevron-right', backstage.shared.providers.icons)]
18063
        },
18797
        },
18064
        renderLabel(directory.title)
18798
        renderLabel(directory.title)
18065
      ];
18799
      ];
-
 
18800
      renderCustomStateIcon(directory, components, backstage);
18066
      internalMenuButton.each(btn => {
18801
      internalMenuButton.each(btn => {
18067
        components.push(btn);
18802
        components.push(btn);
18068
      });
18803
      });
18069
      const toggleExpandChildren = button => {
18804
      const toggleExpandChildren = button => {
18070
        ancestor(button.element, '.tox-tree--directory').each(directoryEle => {
18805
        ancestor(button.element, '.tox-tree--directory').each(directoryEle => {
Línea 18299... Línea 19034...
18299
          Replacing.config({})
19034
          Replacing.config({})
18300
        ])
19035
        ])
18301
      };
19036
      };
18302
    };
19037
    };
Línea 18303... Línea 19038...
18303
 
19038
 
18304
    const events$5 = (streamConfig, streamState) => {
19039
    const events$4 = (streamConfig, streamState) => {
18305
      const streams = streamConfig.stream.streams;
19040
      const streams = streamConfig.stream.streams;
18306
      const processor = streams.setup(streamConfig, streamState);
19041
      const processor = streams.setup(streamConfig, streamState);
18307
      return derive$2([
19042
      return derive$2([
18308
        run$1(streamConfig.event, processor),
19043
        run$1(streamConfig.event, processor),
18309
        runOnDetached(() => streamState.cancel())
19044
        runOnDetached(() => streamState.cancel())
18310
      ].concat(streamConfig.cancelEvent.map(e => [run$1(e, () => streamState.cancel())]).getOr([])));
19045
      ].concat(streamConfig.cancelEvent.map(e => [run$1(e, () => streamState.cancel())]).getOr([])));
Línea 18311... Línea 19046...
18311
    };
19046
    };
18312
 
19047
 
18313
    var ActiveStreaming = /*#__PURE__*/Object.freeze({
19048
    var ActiveStreaming = /*#__PURE__*/Object.freeze({
18314
        __proto__: null,
19049
        __proto__: null,
Línea 18315... Línea 19050...
18315
        events: events$5
19050
        events: events$4
18316
    });
19051
    });
18317
 
19052
 
Línea 18325... Línea 19060...
18325
        const t = state.get();
19060
        const t = state.get();
18326
        if (t !== null) {
19061
        if (t !== null) {
18327
          t.cancel();
19062
          t.cancel();
18328
        }
19063
        }
18329
      };
19064
      };
18330
      return nu$8({
19065
      return nu$7({
18331
        readState,
19066
        readState,
18332
        setTimer,
19067
        setTimer,
18333
        cancel
19068
        cancel
18334
      });
19069
      });
18335
    };
19070
    };
18336
    const init$8 = spec => spec.stream.streams.state(spec);
19071
    const init$7 = spec => spec.stream.streams.state(spec);
Línea 18337... Línea 19072...
18337
 
19072
 
18338
    var StreamingState = /*#__PURE__*/Object.freeze({
19073
    var StreamingState = /*#__PURE__*/Object.freeze({
18339
        __proto__: null,
19074
        __proto__: null,
18340
        throttle: throttle,
19075
        throttle: throttle,
18341
        init: init$8
19076
        init: init$7
Línea 18342... Línea 19077...
18342
    });
19077
    });
18343
 
19078
 
18344
    const setup$c = (streamInfo, streamState) => {
19079
    const setup$c = (streamInfo, streamState) => {
Línea 18380... Línea 19115...
18380
      Representing.setValue(input, itemData);
19115
      Representing.setValue(input, itemData);
18381
      setCursorAtEnd(input);
19116
      setCursorAtEnd(input);
18382
    };
19117
    };
18383
    const setSelectionOn = (input, f) => {
19118
    const setSelectionOn = (input, f) => {
18384
      const el = input.element;
19119
      const el = input.element;
18385
      const value = get$6(el);
19120
      const value = get$7(el);
18386
      const node = el.dom;
19121
      const node = el.dom;
18387
      if (get$f(el, 'type') !== 'number') {
19122
      if (get$g(el, 'type') !== 'number') {
18388
        f(node, value);
19123
        f(node, value);
18389
      }
19124
      }
18390
    };
19125
    };
18391
    const setCursorAtEnd = input => {
19126
    const setCursorAtEnd = input => {
18392
      setSelectionOn(input, (node, value) => node.setSelectionRange(value.length, value.length));
19127
      setSelectionOn(input, (node, value) => node.setSelectionRange(value.length, value.length));
Línea 18444... Línea 19179...
18444
        Focusing.config({}),
19179
        Focusing.config({}),
18445
        Representing.config({
19180
        Representing.config({
18446
          onSetValue: detail.onSetValue,
19181
          onSetValue: detail.onSetValue,
18447
          store: {
19182
          store: {
18448
            mode: 'dataset',
19183
            mode: 'dataset',
18449
            getDataKey: comp => get$6(comp.element),
19184
            getDataKey: comp => get$7(comp.element),
18450
            getFallbackEntry: itemString => ({
19185
            getFallbackEntry: itemString => ({
18451
              value: itemString,
19186
              value: itemString,
18452
              meta: {}
19187
              meta: {}
18453
            }),
19188
            }),
18454
            setValue: (comp, data) => {
19189
            setValue: (comp, data) => {
Línea 18465... Línea 19200...
18465
          },
19200
          },
18466
          onStream: (component, _simulatedEvent) => {
19201
          onStream: (component, _simulatedEvent) => {
18467
            const sandbox = Coupling.getCoupled(component, 'sandbox');
19202
            const sandbox = Coupling.getCoupled(component, 'sandbox');
18468
            const focusInInput = Focusing.isFocused(component);
19203
            const focusInInput = Focusing.isFocused(component);
18469
            if (focusInInput) {
19204
            if (focusInInput) {
18470
              if (get$6(component.element).length >= detail.minChars) {
19205
              if (get$7(component.element).length >= detail.minChars) {
18471
                const previousValue = getActiveMenu(sandbox).bind(activeMenu => Highlighting.getHighlighted(activeMenu).map(Representing.getValue));
19206
                const previousValue = getActiveMenu(sandbox).bind(activeMenu => Highlighting.getHighlighted(activeMenu).map(Representing.getValue));
18472
                detail.previewing.set(true);
19207
                detail.previewing.set(true);
18473
                const onOpenSync = _sandbox => {
19208
                const onOpenSync = _sandbox => {
18474
                  getActiveMenu(sandbox).each(activeMenu => {
19209
                  getActiveMenu(sandbox).each(activeMenu => {
18475
                    previousValue.fold(() => {
19210
                    previousValue.fold(() => {
Línea 18539... Línea 19274...
18539
          others: {
19274
          others: {
18540
            sandbox: hotspot => {
19275
            sandbox: hotspot => {
18541
              return makeSandbox$1(detail, hotspot, {
19276
              return makeSandbox$1(detail, hotspot, {
18542
                onOpen: () => Toggling.on(hotspot),
19277
                onOpen: () => Toggling.on(hotspot),
18543
                onClose: () => {
19278
                onClose: () => {
18544
                  detail.lazyTypeaheadComp.get().each(input => remove$7(input.element, 'aria-activedescendant'));
19279
                  detail.lazyTypeaheadComp.get().each(input => remove$8(input.element, 'aria-activedescendant'));
18545
                  Toggling.off(hotspot);
19280
                  Toggling.off(hotspot);
18546
                }
19281
                }
18547
              });
19282
              });
18548
            }
19283
            }
18549
          }
19284
          }
Línea 18623... Línea 19358...
18623
      defaulted('matchWidth', true),
19358
      defaulted('matchWidth', true),
18624
      defaulted('useMinWidth', false),
19359
      defaulted('useMinWidth', false),
18625
      defaulted('dismissOnBlur', true),
19360
      defaulted('dismissOnBlur', true),
18626
      markers$1(['openClass']),
19361
      markers$1(['openClass']),
18627
      option$3('initialData'),
19362
      option$3('initialData'),
-
 
19363
      option$3('listRole'),
18628
      field('typeaheadBehaviours', [
19364
      field('typeaheadBehaviours', [
18629
        Focusing,
19365
        Focusing,
18630
        Representing,
19366
        Representing,
18631
        Streaming,
19367
        Streaming,
18632
        Keying,
19368
        Keying,
Línea 18769... Línea 19505...
18769
      fromResult,
19505
      fromResult,
18770
      fromFuture,
19506
      fromFuture,
18771
      fromPromise
19507
      fromPromise
18772
    };
19508
    };
Línea 18773... Línea 19509...
18773
 
19509
 
18774
    const renderCommonSpec = (spec, actionOpt, extraBehaviours = [], dom, components, providersBackstage) => {
19510
    const renderCommonSpec = (spec, actionOpt, extraBehaviours = [], dom, components, tooltip, providersBackstage) => {
18775
      const action = actionOpt.fold(() => ({}), action => ({ action }));
19511
      const action = actionOpt.fold(() => ({}), action => ({ action }));
18776
      const common = {
19512
      const common = {
18777
        buttonBehaviours: derive$1([
19513
        buttonBehaviours: derive$1([
18778
          DisablingConfigs.button(() => !spec.enabled || providersBackstage.isDisabled()),
19514
          DisablingConfigs.item(() => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable),
18779
          receivingConfig(),
19515
          toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context)),
18780
          Tabstopping.config({}),
19516
          Tabstopping.config({}),
18781
          config('button press', [
19517
          ...tooltip.map(t => Tooltipping.config(providersBackstage.tooltips.getConfig({ tooltipText: providersBackstage.translate(t) }))).toArray(),
18782
            preventDefault('click'),
-
 
18783
            preventDefault('mousedown')
-
 
18784
          ])
19518
          config('button press', [preventDefault('click')])
18785
        ].concat(extraBehaviours)),
19519
        ].concat(extraBehaviours)),
18786
        eventOrder: {
19520
        eventOrder: {
18787
          click: [
19521
          click: [
18788
            'button press',
19522
            'button press',
Línea 18796... Línea 19530...
18796
        ...action
19530
        ...action
18797
      };
19531
      };
18798
      const domFinal = deepMerge(common, { dom });
19532
      const domFinal = deepMerge(common, { dom });
18799
      return deepMerge(domFinal, { components });
19533
      return deepMerge(domFinal, { components });
18800
    };
19534
    };
18801
    const renderIconButtonSpec = (spec, action, providersBackstage, extraBehaviours = []) => {
19535
    const renderIconButtonSpec = (spec, action, providersBackstage, extraBehaviours = [], btnName) => {
18802
      const tooltipAttributes = spec.tooltip.map(tooltip => ({
19536
      const tooltipAttributes = spec.tooltip.map(tooltip => ({ 'aria-label': providersBackstage.translate(tooltip) })).getOr({});
18803
        'aria-label': providersBackstage.translate(tooltip),
-
 
18804
        'title': providersBackstage.translate(tooltip)
-
 
18805
      })).getOr({});
-
 
18806
      const dom = {
19537
      const dom = {
18807
        tag: 'button',
19538
        tag: 'button',
18808
        classes: ['tox-tbtn'],
19539
        classes: ['tox-tbtn'],
-
 
19540
        attributes: {
18809
        attributes: tooltipAttributes
19541
          ...tooltipAttributes,
-
 
19542
          'data-mce-name': btnName
-
 
19543
        }
18810
      };
19544
      };
18811
      const icon = spec.icon.map(iconName => renderIconFromPack$1(iconName, providersBackstage.icons));
19545
      const icon = spec.icon.map(iconName => renderIconFromPack$1(iconName, providersBackstage.icons));
18812
      const components = componentRenderPipeline([icon]);
19546
      const components = componentRenderPipeline([icon]);
18813
      return renderCommonSpec(spec, action, extraBehaviours, dom, components, providersBackstage);
19547
      return renderCommonSpec(spec, action, extraBehaviours, dom, components, spec.tooltip, providersBackstage);
18814
    };
19548
    };
18815
    const calculateClassesFromButtonType = buttonType => {
19549
    const calculateClassesFromButtonType = buttonType => {
18816
      switch (buttonType) {
19550
      switch (buttonType) {
18817
      case 'primary':
19551
      case 'primary':
18818
        return ['tox-button'];
19552
        return ['tox-button'];
Línea 18839... Línea 19573...
18839
        ...extraClasses
19573
        ...extraClasses
18840
      ];
19574
      ];
18841
      const dom = {
19575
      const dom = {
18842
        tag: 'button',
19576
        tag: 'button',
18843
        classes,
19577
        classes,
-
 
19578
        attributes: {
18844
        attributes: { title: translatedText }
19579
          'aria-label': translatedText,
-
 
19580
          'data-mce-name': spec.text
-
 
19581
        }
18845
      };
19582
      };
-
 
19583
      const optTooltip = spec.icon.map(constant$1(translatedText));
18846
      return renderCommonSpec(spec, action, extraBehaviours, dom, components, providersBackstage);
19584
      return renderCommonSpec(spec, action, extraBehaviours, dom, components, optTooltip, providersBackstage);
18847
    };
19585
    };
18848
    const renderButton$1 = (spec, action, providersBackstage, extraBehaviours = [], extraClasses = []) => {
19586
    const renderButton$1 = (spec, action, providersBackstage, extraBehaviours = [], extraClasses = []) => {
18849
      const buttonSpec = renderButtonSpec(spec, Optional.some(action), providersBackstage, extraBehaviours, extraClasses);
19587
      const buttonSpec = renderButtonSpec(spec, Optional.some(action), providersBackstage, extraBehaviours, extraClasses);
18850
      return Button.sketch(buttonSpec);
19588
      return Button.sketch(buttonSpec);
18851
    };
19589
    };
Línea 18864... Línea 19602...
18864
      }
19602
      }
18865
    };
19603
    };
18866
    const isMenuFooterButtonSpec = (spec, buttonType) => buttonType === 'menu';
19604
    const isMenuFooterButtonSpec = (spec, buttonType) => buttonType === 'menu';
18867
    const isNormalFooterButtonSpec = (spec, buttonType) => buttonType === 'custom' || buttonType === 'cancel' || buttonType === 'submit';
19605
    const isNormalFooterButtonSpec = (spec, buttonType) => buttonType === 'custom' || buttonType === 'cancel' || buttonType === 'submit';
18868
    const isToggleButtonSpec = (spec, buttonType) => buttonType === 'togglebutton';
19606
    const isToggleButtonSpec = (spec, buttonType) => buttonType === 'togglebutton';
18869
    const renderToggleButton = (spec, providers) => {
19607
    const renderToggleButton = (spec, providers, btnName) => {
18870
      var _a, _b;
19608
      var _a, _b;
18871
      const optMemIcon = spec.icon.map(memIcon => renderReplaceableIconFromPack(memIcon, providers.icons)).map(record);
19609
      const optMemIcon = spec.icon.map(memIcon => renderReplaceableIconFromPack(memIcon, providers.icons)).map(record);
18872
      const action = comp => {
19610
      const action = comp => {
18873
        emitWith(comp, formActionEvent, {
19611
        emitWith(comp, formActionEvent, {
18874
          name: spec.name,
19612
          name: spec.name,
Línea 18884... Línea 19622...
18884
      const buttonType = spec.buttonType.getOr(!spec.primary ? 'secondary' : 'primary');
19622
      const buttonType = spec.buttonType.getOr(!spec.primary ? 'secondary' : 'primary');
18885
      const buttonSpec = {
19623
      const buttonSpec = {
18886
        ...spec,
19624
        ...spec,
18887
        name: (_a = spec.name) !== null && _a !== void 0 ? _a : '',
19625
        name: (_a = spec.name) !== null && _a !== void 0 ? _a : '',
18888
        primary: buttonType === 'primary',
19626
        primary: buttonType === 'primary',
18889
        tooltip: Optional.from(spec.tooltip),
19627
        tooltip: spec.tooltip,
18890
        enabled: (_b = spec.enabled) !== null && _b !== void 0 ? _b : false,
19628
        enabled: (_b = spec.enabled) !== null && _b !== void 0 ? _b : false,
18891
        borderless: false
19629
        borderless: false
18892
      };
19630
      };
18893
      const tooltipAttributes = buttonSpec.tooltip.map(tooltip => ({
19631
      const tooltipAttributes = buttonSpec.tooltip.or(spec.text).map(tooltip => ({ 'aria-label': providers.translate(tooltip) })).getOr({});
18894
        'aria-label': providers.translate(tooltip),
-
 
18895
        'title': providers.translate(tooltip)
-
 
18896
      })).getOr({});
-
 
18897
      const buttonTypeClasses = calculateClassesFromButtonType(buttonType !== null && buttonType !== void 0 ? buttonType : 'secondary');
19632
      const buttonTypeClasses = calculateClassesFromButtonType(buttonType !== null && buttonType !== void 0 ? buttonType : 'secondary');
18898
      const showIconAndText = spec.icon.isSome() && spec.text.isSome();
19633
      const showIconAndText = spec.icon.isSome() && spec.text.isSome();
18899
      const dom = {
19634
      const dom = {
18900
        tag: 'button',
19635
        tag: 'button',
18901
        classes: [
19636
        classes: [
18902
          ...buttonTypeClasses.concat(spec.icon.isSome() ? ['tox-button--icon'] : []),
19637
          ...buttonTypeClasses.concat(spec.icon.isSome() ? ['tox-button--icon'] : []),
18903
          ...spec.active ? ['tox-button--enabled'] : [],
19638
          ...spec.active ? ['tox-button--enabled'] : [],
18904
          ...showIconAndText ? ['tox-button--icon-and-text'] : []
19639
          ...showIconAndText ? ['tox-button--icon-and-text'] : []
18905
        ],
19640
        ],
-
 
19641
        attributes: {
18906
        attributes: tooltipAttributes
19642
          ...tooltipAttributes,
-
 
19643
          ...isNonNullable(btnName) ? { 'data-mce-name': btnName } : {}
-
 
19644
        }
18907
      };
19645
      };
18908
      const extraBehaviours = [];
19646
      const extraBehaviours = [];
18909
      const translatedText = providers.translate(spec.text.getOr(''));
19647
      const translatedText = providers.translate(spec.text.getOr(''));
18910
      const translatedTextComponed = text$2(translatedText);
19648
      const translatedTextComponed = text$2(translatedText);
18911
      const iconComp = componentRenderPipeline([optMemIcon.map(memIcon => memIcon.asSpec())]);
19649
      const iconComp = componentRenderPipeline([optMemIcon.map(memIcon => memIcon.asSpec())]);
18912
      const components = [
19650
      const components = [
18913
        ...iconComp,
19651
        ...iconComp,
18914
        ...spec.text.isSome() ? [translatedTextComponed] : []
19652
        ...spec.text.isSome() ? [translatedTextComponed] : []
18915
      ];
19653
      ];
18916
      const iconButtonSpec = renderCommonSpec(buttonSpec, Optional.some(action), extraBehaviours, dom, components, providers);
19654
      const iconButtonSpec = renderCommonSpec(buttonSpec, Optional.some(action), extraBehaviours, dom, components, spec.tooltip, providers);
18917
      return Button.sketch(iconButtonSpec);
19655
      return Button.sketch(iconButtonSpec);
18918
    };
19656
    };
18919
    const renderFooterButton = (spec, buttonType, backstage) => {
19657
    const renderFooterButton = (spec, buttonType, backstage) => {
18920
      if (isMenuFooterButtonSpec(spec, buttonType)) {
19658
      if (isMenuFooterButtonSpec(spec, buttonType)) {
18921
        const getButton = () => memButton;
19659
        const getButton = () => memButton;
Línea 18928... Línea 19666...
18928
            api.setEnabled(spec.enabled);
19666
            api.setEnabled(spec.enabled);
18929
            return noop;
19667
            return noop;
18930
          },
19668
          },
18931
          fetch: getFetch(menuButtonSpec.items, getButton, backstage)
19669
          fetch: getFetch(menuButtonSpec.items, getButton, backstage)
18932
        };
19670
        };
18933
        const memButton = record(renderMenuButton(fixedSpec, 'tox-tbtn', backstage, Optional.none()));
19671
        const memButton = record(renderMenuButton(fixedSpec, 'tox-tbtn', backstage, Optional.none(), true, spec.text.or(spec.tooltip).getOrUndefined()));
18934
        return memButton.asSpec();
19672
        return memButton.asSpec();
18935
      } else if (isNormalFooterButtonSpec(spec, buttonType)) {
19673
      } else if (isNormalFooterButtonSpec(spec, buttonType)) {
18936
        const action = getAction(spec.name, buttonType);
19674
        const action = getAction(spec.name, buttonType);
18937
        const buttonSpec = {
19675
        const buttonSpec = {
18938
          ...spec,
19676
          ...spec,
-
 
19677
          context: buttonType === 'cancel' ? 'any' : spec.context,
18939
          borderless: false
19678
          borderless: false
18940
        };
19679
        };
18941
        return renderButton$1(buttonSpec, action, backstage.shared.providers, []);
19680
        return renderButton$1(buttonSpec, action, backstage.shared.providers, []);
18942
      } else if (isToggleButtonSpec(spec, buttonType)) {
19681
      } else if (isToggleButtonSpec(spec, buttonType)) {
18943
        return renderToggleButton(spec, backstage.shared.providers);
19682
        return renderToggleButton(spec, backstage.shared.providers, spec.text.or(spec.tooltip).getOrUndefined());
18944
      } else {
19683
      } else {
18945
        console.error('Unknown footer button type: ', buttonType);
19684
        console.error('Unknown footer button type: ', buttonType);
18946
        throw new Error('Unknown footer button type');
19685
        throw new Error('Unknown footer button type');
18947
      }
19686
      }
18948
    };
19687
    };
Línea 19076... Línea 19815...
19076
                });
19815
                });
19077
              },
19816
              },
19078
              validateOnLoad: false
19817
              validateOnLoad: false
19079
            }
19818
            }
19080
          })).toArray(),
19819
          })).toArray(),
19081
          Disabling.config({ disabled: () => !spec.enabled || providersBackstage.isDisabled() }),
19820
          Disabling.config({ disabled: () => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable }),
19082
          Tabstopping.config({}),
19821
          Tabstopping.config({}),
19083
          config('urlinput-events', [
19822
          config('urlinput-events', [
19084
            run$1(input(), comp => {
19823
            run$1(input(), comp => {
19085
              const currentValue = get$6(comp.element);
19824
              const currentValue = get$7(comp.element);
19086
              const trimmedValue = currentValue.trim();
19825
              const trimmedValue = currentValue.trim();
19087
              if (trimmedValue !== currentValue) {
19826
              if (trimmedValue !== currentValue) {
19088
                set$5(comp.element, trimmedValue);
19827
                set$5(comp.element, trimmedValue);
19089
              }
19828
              }
19090
              if (spec.filetype === 'file') {
19829
              if (spec.filetype === 'file') {
Línea 19158... Línea 19897...
19158
        },
19897
        },
19159
        components: [
19898
        components: [
19160
          pField,
19899
          pField,
19161
          memStatus.asSpec()
19900
          memStatus.asSpec()
19162
        ],
19901
        ],
19163
        behaviours: derive$1([Disabling.config({ disabled: () => !spec.enabled || providersBackstage.isDisabled() })])
19902
        behaviours: derive$1([Disabling.config({ disabled: () => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable })])
19164
      });
19903
      });
19165
      const memUrlPickerButton = record(renderButton$1({
19904
      const memUrlPickerButton = record(renderButton$1({
-
 
19905
        context: spec.context,
19166
        name: spec.name,
19906
        name: spec.name,
19167
        icon: Optional.some('browse'),
19907
        icon: Optional.some('browse'),
19168
        text: spec.picker_text.or(spec.label).getOr(''),
19908
        text: spec.picker_text.or(spec.label).getOr(''),
19169
        enabled: spec.enabled,
19909
        enabled: spec.enabled,
19170
        primary: false,
19910
        primary: false,
Línea 19199... Línea 19939...
19199
      return FormField.sketch({
19939
      return FormField.sketch({
19200
        dom: renderFormFieldDom(),
19940
        dom: renderFormFieldDom(),
19201
        components: pLabel.toArray().concat([controlHWrapper()]),
19941
        components: pLabel.toArray().concat([controlHWrapper()]),
19202
        fieldBehaviours: derive$1([
19942
        fieldBehaviours: derive$1([
19203
          Disabling.config({
19943
          Disabling.config({
19204
            disabled: () => !spec.enabled || providersBackstage.isDisabled(),
19944
            disabled: () => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable,
19205
            onDisabled: comp => {
19945
            onDisabled: comp => {
19206
              FormField.getField(comp).each(Disabling.disable);
19946
              FormField.getField(comp).each(Disabling.disable);
19207
              memUrlPickerButton.getOpt(comp).each(Disabling.disable);
19947
              memUrlPickerButton.getOpt(comp).each(Disabling.disable);
19208
            },
19948
            },
19209
            onEnabled: comp => {
19949
            onEnabled: comp => {
19210
              FormField.getField(comp).each(Disabling.enable);
19950
              FormField.getField(comp).each(Disabling.enable);
19211
              memUrlPickerButton.getOpt(comp).each(Disabling.enable);
19951
              memUrlPickerButton.getOpt(comp).each(Disabling.enable);
19212
            }
19952
            }
19213
          }),
19953
          }),
19214
          receivingConfig(),
19954
          toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context)),
19215
          config('url-input-events', [run$1(browseUrlEvent, openUrlPicker)])
19955
          config('url-input-events', [run$1(browseUrlEvent, openUrlPicker)])
19216
        ])
19956
        ])
19217
      });
19957
      });
19218
    };
19958
    };
Línea 19219... Línea 19959...
19219
 
19959
 
19220
    const renderAlertBanner = (spec, providersBackstage) => {
19960
    const renderAlertBanner = (spec, providersBackstage) => {
19221
      const icon = get$2(spec.icon, providersBackstage.icons);
19961
      const icon = get$3(spec.icon, providersBackstage.icons);
19222
      return Container.sketch({
19962
      return Container.sketch({
19223
        dom: {
19963
        dom: {
19224
          tag: 'div',
19964
          tag: 'div',
19225
          attributes: { role: 'alert' },
19965
          attributes: { role: 'alert' },
Línea 19266... Línea 20006...
19266
    };
20006
    };
Línea 19267... Línea 20007...
19267
 
20007
 
19268
    const set$1 = (element, status) => {
20008
    const set$1 = (element, status) => {
19269
      element.dom.checked = status;
20009
      element.dom.checked = status;
19270
    };
20010
    };
Línea 19271... Línea 20011...
19271
    const get$1 = element => element.dom.checked;
20011
    const get$2 = element => element.dom.checked;
19272
 
20012
 
19273
    const renderCheckbox = (spec, providerBackstage, initialData) => {
20013
    const renderCheckbox = (spec, providerBackstage, initialData) => {
19274
      const toggleCheckboxHandler = comp => {
20014
      const toggleCheckboxHandler = comp => {
Línea 19283... Línea 20023...
19283
          attributes: { type: 'checkbox' }
20023
          attributes: { type: 'checkbox' }
19284
        },
20024
        },
19285
        behaviours: derive$1([
20025
        behaviours: derive$1([
19286
          ComposingConfigs.self(),
20026
          ComposingConfigs.self(),
19287
          Disabling.config({
20027
          Disabling.config({
19288
            disabled: () => !spec.enabled || providerBackstage.isDisabled(),
20028
            disabled: () => !spec.enabled || providerBackstage.checkUiComponentContext(spec.context).shouldDisable,
19289
            onDisabled: component => {
20029
            onDisabled: component => {
19290
              parentElement(component.element).each(element => add$2(element, 'tox-checkbox--disabled'));
20030
              parentElement(component.element).each(element => add$2(element, 'tox-checkbox--disabled'));
19291
            },
20031
            },
19292
            onEnabled: component => {
20032
            onEnabled: component => {
19293
              parentElement(component.element).each(element => remove$2(element, 'tox-checkbox--disabled'));
20033
              parentElement(component.element).each(element => remove$3(element, 'tox-checkbox--disabled'));
19294
            }
20034
            }
19295
          }),
20035
          }),
19296
          Tabstopping.config({}),
20036
          Tabstopping.config({}),
19297
          Focusing.config({}),
20037
          Focusing.config({}),
19298
          withElement(initialData, get$1, set$1),
20038
          withElement(initialData, get$2, set$1),
19299
          Keying.config({
20039
          Keying.config({
19300
            mode: 'special',
20040
            mode: 'special',
19301
            onEnter: toggleCheckboxHandler,
20041
            onEnter: toggleCheckboxHandler,
19302
            onSpace: toggleCheckboxHandler,
20042
            onSpace: toggleCheckboxHandler,
19303
            stopSpaceKeyup: true
20043
            stopSpaceKeyup: true
Línea 19344... Línea 20084...
19344
          pField,
20084
          pField,
19345
          memIcons.asSpec(),
20085
          memIcons.asSpec(),
19346
          pLabel
20086
          pLabel
19347
        ],
20087
        ],
19348
        fieldBehaviours: derive$1([
20088
        fieldBehaviours: derive$1([
19349
          Disabling.config({ disabled: () => !spec.enabled || providerBackstage.isDisabled() }),
20089
          Disabling.config({ disabled: () => !spec.enabled || providerBackstage.checkUiComponentContext(spec.context).shouldDisable }),
19350
          receivingConfig()
20090
          toggleOnReceive(() => providerBackstage.checkUiComponentContext(spec.context))
19351
        ])
20091
        ])
19352
      });
20092
      });
19353
    };
20093
    };
Línea 19354... Línea 20094...
19354
 
20094
 
-
 
20095
    const renderHtmlPanel = (spec, providersBackstage) => {
-
 
20096
      const classes = [
-
 
20097
        'tox-form__group',
-
 
20098
        ...spec.stretched ? ['tox-form__group--stretched'] : []
-
 
20099
      ];
-
 
20100
      const init = config('htmlpanel', [runOnAttached(comp => {
-
 
20101
          spec.onInit(comp.element.dom);
19355
    const renderHtmlPanel = spec => {
20102
        })]);
19356
      if (spec.presets === 'presentation') {
20103
      if (spec.presets === 'presentation') {
19357
        return Container.sketch({
20104
        return Container.sketch({
19358
          dom: {
20105
          dom: {
19359
            tag: 'div',
20106
            tag: 'div',
19360
            classes: ['tox-form__group'],
20107
            classes,
19361
            innerHtml: spec.html
20108
            innerHtml: spec.html
-
 
20109
          },
-
 
20110
          containerBehaviours: derive$1([
-
 
20111
            Tooltipping.config({
-
 
20112
              ...providersBackstage.tooltips.getConfig({
-
 
20113
                tooltipText: '',
-
 
20114
                onShow: comp => {
-
 
20115
                  descendant(comp.element, '[data-mce-tooltip]:hover').orThunk(() => search(comp.element)).each(current => {
-
 
20116
                    getOpt(current, 'data-mce-tooltip').each(text => {
-
 
20117
                      Tooltipping.setComponents(comp, providersBackstage.tooltips.getComponents({ tooltipText: text }));
-
 
20118
                    });
-
 
20119
                  });
-
 
20120
                }
-
 
20121
              }),
-
 
20122
              mode: 'children-normal',
-
 
20123
              anchor: comp => ({
-
 
20124
                type: 'node',
-
 
20125
                node: descendant(comp.element, '[data-mce-tooltip]:hover').orThunk(() => search(comp.element).filter(current => getOpt(current, 'data-mce-tooltip').isSome())),
-
 
20126
                root: comp.element,
-
 
20127
                layouts: {
-
 
20128
                  onLtr: constant$1([
-
 
20129
                    south$2,
-
 
20130
                    north$2,
-
 
20131
                    southeast$2,
-
 
20132
                    northeast$2,
-
 
20133
                    southwest$2,
-
 
20134
                    northwest$2
-
 
20135
                  ]),
-
 
20136
                  onRtl: constant$1([
-
 
20137
                    south$2,
-
 
20138
                    north$2,
-
 
20139
                    southeast$2,
-
 
20140
                    northeast$2,
-
 
20141
                    southwest$2,
-
 
20142
                    northwest$2
-
 
20143
                  ])
-
 
20144
                },
-
 
20145
                bubble: nu$5(0, -2, {})
-
 
20146
              })
-
 
20147
            }),
-
 
20148
            init
19362
          }
20149
          ])
19363
        });
20150
        });
19364
      } else {
20151
      } else {
19365
        return Container.sketch({
20152
        return Container.sketch({
19366
          dom: {
20153
          dom: {
19367
            tag: 'div',
20154
            tag: 'div',
19368
            classes: ['tox-form__group'],
20155
            classes,
19369
            innerHtml: spec.html,
20156
            innerHtml: spec.html,
19370
            attributes: { role: 'document' }
20157
            attributes: { role: 'document' }
19371
          },
20158
          },
19372
          containerBehaviours: derive$1([
20159
          containerBehaviours: derive$1([
19373
            Tabstopping.config({}),
20160
            Tabstopping.config({}),
-
 
20161
            Focusing.config({}),
19374
            Focusing.config({})
20162
            init
19375
          ])
20163
          ])
19376
        });
20164
        });
19377
      }
20165
      }
Línea 19378... Línea 20166...
19378
    };
20166
    };
19379
 
20167
 
19380
    const make$2 = render => {
20168
    const make$2 = render => {
19381
      return (parts, spec, dialogData, backstage) => get$g(spec, 'name').fold(() => render(spec, backstage, Optional.none()), fieldName => parts.field(fieldName, render(spec, backstage, get$g(dialogData, fieldName))));
20169
      return (parts, spec, dialogData, backstage, getCompByName) => get$h(spec, 'name').fold(() => render(spec, backstage, Optional.none(), getCompByName), fieldName => parts.field(fieldName, render(spec, backstage, get$h(dialogData, fieldName), getCompByName)));
19382
    };
20170
    };
19383
    const makeIframe = render => (parts, spec, dialogData, backstage) => {
20171
    const makeIframe = render => (parts, spec, dialogData, backstage, getCompByName) => {
19384
      const iframeSpec = deepMerge(spec, { source: 'dynamic' });
20172
      const iframeSpec = deepMerge(spec, { source: 'dynamic' });
19385
      return make$2(render)(parts, iframeSpec, dialogData, backstage);
20173
      return make$2(render)(parts, iframeSpec, dialogData, backstage, getCompByName);
19386
    };
20174
    };
19387
    const factories = {
20175
    const factories = {
19388
      bar: make$2((spec, backstage) => renderBar(spec, backstage.shared)),
20176
      bar: make$2((spec, backstage) => renderBar(spec, backstage.shared)),
19389
      collection: make$2((spec, backstage, data) => renderCollection(spec, backstage.shared.providers, data)),
20177
      collection: make$2((spec, backstage, data) => renderCollection(spec, backstage.shared.providers, data)),
19390
      alertbanner: make$2((spec, backstage) => renderAlertBanner(spec, backstage.shared.providers)),
20178
      alertbanner: make$2((spec, backstage) => renderAlertBanner(spec, backstage.shared.providers)),
19391
      input: make$2((spec, backstage, data) => renderInput(spec, backstage.shared.providers, data)),
20179
      input: make$2((spec, backstage, data) => renderInput(spec, backstage.shared.providers, data)),
19392
      textarea: make$2((spec, backstage, data) => renderTextarea(spec, backstage.shared.providers, data)),
20180
      textarea: make$2((spec, backstage, data) => renderTextarea(spec, backstage.shared.providers, data)),
19393
      label: make$2((spec, backstage) => renderLabel$2(spec, backstage.shared)),
20181
      label: make$2((spec, backstage, _data, getCompByName) => renderLabel$2(spec, backstage.shared, getCompByName)),
19394
      iframe: makeIframe((spec, backstage, data) => renderIFrame(spec, backstage.shared.providers, data)),
20182
      iframe: makeIframe((spec, backstage, data) => renderIFrame(spec, backstage.shared.providers, data)),
19395
      button: make$2((spec, backstage) => renderDialogButton(spec, backstage.shared.providers)),
20183
      button: make$2((spec, backstage) => renderDialogButton(spec, backstage.shared.providers)),
19396
      checkbox: make$2((spec, backstage, data) => renderCheckbox(spec, backstage.shared.providers, data)),
20184
      checkbox: make$2((spec, backstage, data) => renderCheckbox(spec, backstage.shared.providers, data)),
Línea 19402... Línea 20190...
19402
      selectbox: make$2((spec, backstage, data) => renderSelectBox(spec, backstage.shared.providers, data)),
20190
      selectbox: make$2((spec, backstage, data) => renderSelectBox(spec, backstage.shared.providers, data)),
19403
      sizeinput: make$2((spec, backstage) => renderSizeInput(spec, backstage.shared.providers)),
20191
      sizeinput: make$2((spec, backstage) => renderSizeInput(spec, backstage.shared.providers)),
19404
      slider: make$2((spec, backstage, data) => renderSlider(spec, backstage.shared.providers, data)),
20192
      slider: make$2((spec, backstage, data) => renderSlider(spec, backstage.shared.providers, data)),
19405
      urlinput: make$2((spec, backstage, data) => renderUrlInput(spec, backstage, backstage.urlinput, data)),
20193
      urlinput: make$2((spec, backstage, data) => renderUrlInput(spec, backstage, backstage.urlinput, data)),
19406
      customeditor: make$2(renderCustomEditor),
20194
      customeditor: make$2(renderCustomEditor),
19407
      htmlpanel: make$2(renderHtmlPanel),
20195
      htmlpanel: make$2((spec, backstage) => renderHtmlPanel(spec, backstage.shared.providers)),
19408
      imagepreview: make$2((spec, _, data) => renderImagePreview(spec, data)),
20196
      imagepreview: make$2((spec, _, data) => renderImagePreview(spec, data)),
19409
      table: make$2((spec, backstage) => renderTable(spec, backstage.shared.providers)),
20197
      table: make$2((spec, backstage) => renderTable(spec, backstage.shared.providers)),
19410
      tree: make$2((spec, backstage) => renderTree(spec, backstage)),
20198
      tree: make$2((spec, backstage) => renderTree(spec, backstage)),
19411
      panel: make$2((spec, backstage) => renderPanel(spec, backstage))
20199
      panel: make$2((spec, backstage) => renderPanel(spec, backstage))
19412
    };
20200
    };
19413
    const noFormParts = {
20201
    const noFormParts = {
19414
      field: (_name, spec) => spec,
20202
      field: (_name, spec) => spec,
19415
      record: constant$1([])
20203
      record: constant$1([])
19416
    };
20204
    };
19417
    const interpretInForm = (parts, spec, dialogData, oldBackstage) => {
20205
    const interpretInForm = (parts, spec, dialogData, oldBackstage, getCompByName) => {
19418
      const newBackstage = deepMerge(oldBackstage, { shared: { interpreter: childSpec => interpretParts(parts, childSpec, dialogData, newBackstage) } });
20206
      const newBackstage = deepMerge(oldBackstage, { shared: { interpreter: childSpec => interpretParts(parts, childSpec, dialogData, newBackstage, getCompByName) } });
19419
      return interpretParts(parts, spec, dialogData, newBackstage);
20207
      return interpretParts(parts, spec, dialogData, newBackstage, getCompByName);
19420
    };
20208
    };
19421
    const interpretParts = (parts, spec, dialogData, backstage) => get$g(factories, spec.type).fold(() => {
20209
    const interpretParts = (parts, spec, dialogData, backstage, getCompByName) => get$h(factories, spec.type).fold(() => {
19422
      console.error(`Unknown factory type "${ spec.type }", defaulting to container: `, spec);
20210
      console.error(`Unknown factory type "${ spec.type }", defaulting to container: `, spec);
19423
      return spec;
20211
      return spec;
19424
    }, factory => factory(parts, spec, dialogData, backstage));
20212
    }, factory => factory(parts, spec, dialogData, backstage, getCompByName));
19425
    const interpretWithoutForm = (spec, dialogData, backstage) => interpretParts(noFormParts, spec, dialogData, backstage);
20213
    const interpretWithoutForm = (spec, dialogData, backstage, getCompByName) => interpretParts(noFormParts, spec, dialogData, backstage, getCompByName);
Línea 19426... Línea 20214...
19426
 
20214
 
19427
    const labelPrefix = 'layout-inset';
20215
    const labelPrefix = 'layout-inset';
19428
    const westEdgeX = anchor => anchor.x;
20216
    const westEdgeX = anchor => anchor.x;
19429
    const middleX = (anchor, element) => anchor.x + anchor.width / 2 - element.width / 2;
20217
    const middleX = (anchor, element) => anchor.x + anchor.width / 2 - element.width / 2;
Línea 19840... Línea 20628...
19840
      ...item,
20628
      ...item,
19841
      type: 'formatter',
20629
      type: 'formatter',
19842
      isSelected: isSelectedFor(item.format),
20630
      isSelected: isSelectedFor(item.format),
19843
      getStylePreview: getPreviewFor(item.format)
20631
      getStylePreview: getPreviewFor(item.format)
19844
    });
20632
    });
19845
    const register$a = (editor, formats, isSelectedFor, getPreviewFor) => {
20633
    const register$b = (editor, formats, isSelectedFor, getPreviewFor) => {
19846
      const enrichSupported = item => processBasic(item, isSelectedFor, getPreviewFor);
20634
      const enrichSupported = item => processBasic(item, isSelectedFor, getPreviewFor);
19847
      const enrichMenu = item => {
20635
      const enrichMenu = item => {
19848
        const newItems = doEnrich(item.items);
20636
        const newItems = doEnrich(item.items);
19849
        return {
20637
        return {
19850
          ...item,
20638
          ...item,
Línea 19880... Línea 20668...
19880
        }
20668
        }
19881
      });
20669
      });
19882
      return doEnrich(formats);
20670
      return doEnrich(formats);
19883
    };
20671
    };
Línea 19884... Línea 20672...
19884
 
20672
 
19885
    const init$7 = editor => {
20673
    const init$6 = editor => {
19886
      const isSelectedFor = format => () => editor.formatter.match(format);
20674
      const isSelectedFor = format => () => editor.formatter.match(format);
19887
      const getPreviewFor = format => () => {
20675
      const getPreviewFor = format => () => {
19888
        const fmt = editor.formatter.get(format);
20676
        const fmt = editor.formatter.get(format);
19889
        return fmt !== undefined ? Optional.some({
20677
        return fmt !== undefined ? Optional.some({
Línea 19894... Línea 20682...
19894
      const settingsFormats = Cell([]);
20682
      const settingsFormats = Cell([]);
19895
      const eventsFormats = Cell([]);
20683
      const eventsFormats = Cell([]);
19896
      const replaceSettings = Cell(false);
20684
      const replaceSettings = Cell(false);
19897
      editor.on('PreInit', _e => {
20685
      editor.on('PreInit', _e => {
19898
        const formats = getStyleFormats(editor);
20686
        const formats = getStyleFormats(editor);
19899
        const enriched = register$a(editor, formats, isSelectedFor, getPreviewFor);
20687
        const enriched = register$b(editor, formats, isSelectedFor, getPreviewFor);
19900
        settingsFormats.set(enriched);
20688
        settingsFormats.set(enriched);
19901
      });
20689
      });
19902
      editor.on('addStyleModifications', e => {
20690
      editor.on('addStyleModifications', e => {
19903
        const modifications = register$a(editor, e.items, isSelectedFor, getPreviewFor);
20691
        const modifications = register$b(editor, e.items, isSelectedFor, getPreviewFor);
19904
        eventsFormats.set(modifications);
20692
        eventsFormats.set(modifications);
19905
        replaceSettings.set(e.replace);
20693
        replaceSettings.set(e.replace);
19906
      });
20694
      });
19907
      const getData = () => {
20695
      const getData = () => {
19908
        const fromSettings = replaceSettings.get() ? [] : settingsFormats.get();
20696
        const fromSettings = replaceSettings.get() ? [] : settingsFormats.get();
Línea 19910... Línea 20698...
19910
        return fromSettings.concat(fromEvents);
20698
        return fromSettings.concat(fromEvents);
19911
      };
20699
      };
19912
      return { getData };
20700
      return { getData };
19913
    };
20701
    };
Línea -... Línea 20702...
-
 
20702
 
-
 
20703
    const TooltipsBackstage = getSink => {
-
 
20704
      const tooltipDelay = 300;
-
 
20705
      const intervalDelay = tooltipDelay * 0.2;
-
 
20706
      let numActiveTooltips = 0;
-
 
20707
      const alreadyShowingTooltips = () => numActiveTooltips > 0;
-
 
20708
      const getComponents = spec => {
-
 
20709
        return [{
-
 
20710
            dom: {
-
 
20711
              tag: 'div',
-
 
20712
              classes: ['tox-tooltip__body']
-
 
20713
            },
-
 
20714
            components: [text$2(spec.tooltipText)]
-
 
20715
          }];
-
 
20716
      };
-
 
20717
      const getConfig = spec => {
-
 
20718
        return {
-
 
20719
          delayForShow: () => alreadyShowingTooltips() ? intervalDelay : tooltipDelay,
-
 
20720
          delayForHide: constant$1(tooltipDelay),
-
 
20721
          exclusive: true,
-
 
20722
          lazySink: getSink,
-
 
20723
          tooltipDom: {
-
 
20724
            tag: 'div',
-
 
20725
            classes: [
-
 
20726
              'tox-tooltip',
-
 
20727
              'tox-tooltip--up'
-
 
20728
            ]
-
 
20729
          },
-
 
20730
          tooltipComponents: getComponents(spec),
-
 
20731
          onShow: (comp, tooltip) => {
-
 
20732
            numActiveTooltips++;
-
 
20733
            if (spec.onShow) {
-
 
20734
              spec.onShow(comp, tooltip);
-
 
20735
            }
-
 
20736
          },
-
 
20737
          onHide: (comp, tooltip) => {
-
 
20738
            numActiveTooltips--;
-
 
20739
            if (spec.onHide) {
-
 
20740
              spec.onHide(comp, tooltip);
-
 
20741
            }
-
 
20742
          },
-
 
20743
          onSetup: spec.onSetup
-
 
20744
        };
-
 
20745
      };
-
 
20746
      return {
-
 
20747
        getConfig,
-
 
20748
        getComponents
-
 
20749
      };
-
 
20750
    };
19914
 
20751
 
19915
    const isElement = node => isNonNullable(node) && node.nodeType === 1;
20752
    const isElement = node => isNonNullable(node) && node.nodeType === 1;
19916
    const trim = global$1.trim;
20753
    const trim = global$1.trim;
19917
    const hasContentEditableState = value => {
20754
    const hasContentEditableState = value => {
19918
      return node => {
20755
      return node => {
Línea 20039... Línea 20876...
20039
      }
20876
      }
20040
      global$4.setItem(STORAGE_KEY, JSON.stringify(history));
20877
      global$4.setItem(STORAGE_KEY, JSON.stringify(history));
20041
    };
20878
    };
20042
    const getHistory = fileType => {
20879
    const getHistory = fileType => {
20043
      const history = getAllHistory();
20880
      const history = getAllHistory();
20044
      return get$g(history, fileType).getOr([]);
20881
      return get$h(history, fileType).getOr([]);
20045
    };
20882
    };
20046
    const addToHistory = (url, fileType) => {
20883
    const addToHistory = (url, fileType) => {
20047
      if (!isHttpUrl(url)) {
20884
      if (!isHttpUrl(url)) {
20048
        return;
20885
        return;
20049
      }
20886
      }
20050
      const history = getAllHistory();
20887
      const history = getAllHistory();
20051
      const items = get$g(history, fileType).getOr([]);
20888
      const items = get$h(history, fileType).getOr([]);
20052
      const itemsWithoutUrl = filter$2(items, item => item !== url);
20889
      const itemsWithoutUrl = filter$2(items, item => item !== url);
20053
      history[fileType] = [url].concat(itemsWithoutUrl).slice(0, HISTORY_LENGTH);
20890
      history[fileType] = [url].concat(itemsWithoutUrl).slice(0, HISTORY_LENGTH);
20054
      setAllHistory(history);
20891
      setAllHistory(history);
20055
    };
20892
    };
Línea 20108... Línea 20945...
20108
      getLinkInformation: () => getLinkInformation(editor),
20945
      getLinkInformation: () => getLinkInformation(editor),
20109
      getValidationHandler: () => getValidationHandler(editor),
20946
      getValidationHandler: () => getValidationHandler(editor),
20110
      getUrlPicker: filetype => getUrlPicker(editor, filetype)
20947
      getUrlPicker: filetype => getUrlPicker(editor, filetype)
20111
    });
20948
    });
Línea 20112... Línea 20949...
20112
 
20949
 
20113
    const init$6 = (lazySinks, editor, lazyAnchorbar, lazyBottomAnchorBar) => {
20950
    const init$5 = (lazySinks, editor, lazyAnchorbar, lazyBottomAnchorBar) => {
20114
      const contextMenuState = Cell(false);
20951
      const contextMenuState = Cell(false);
20115
      const toolbar = HeaderBackstage(editor);
20952
      const toolbar = HeaderBackstage(editor);
20116
      const providers = {
20953
      const providers = {
20117
        icons: () => editor.ui.registry.getAll().icons,
20954
        icons: () => editor.ui.registry.getAll().icons,
20118
        menuItems: () => editor.ui.registry.getAll().menuItems,
20955
        menuItems: () => editor.ui.registry.getAll().menuItems,
20119
        translate: global$8.translate,
20956
        translate: global$5.translate,
20120
        isDisabled: () => editor.mode.isReadOnly() || !editor.ui.isEnabled(),
20957
        isDisabled: () => !editor.ui.isEnabled(),
-
 
20958
        getOption: editor.options.get,
-
 
20959
        tooltips: TooltipsBackstage(lazySinks.dialog),
-
 
20960
        checkUiComponentContext: specContext => {
-
 
20961
          if (isDisabled(editor)) {
-
 
20962
            return {
-
 
20963
              contextType: 'disabled',
-
 
20964
              shouldDisable: true
-
 
20965
            };
-
 
20966
          }
-
 
20967
          const [key, value = ''] = specContext.split(':');
-
 
20968
          const contexts = editor.ui.registry.getAll().contexts;
-
 
20969
          const enabledInContext = get$h(contexts, key).fold(() => get$h(contexts, 'mode').map(pred => pred('design')).getOr(false), pred => value.charAt(0) === '!' ? !pred(value.slice(1)) : pred(value));
-
 
20970
          return {
-
 
20971
            contextType: key,
-
 
20972
            shouldDisable: !enabledInContext
-
 
20973
          };
20121
        getOption: editor.options.get
20974
        }
20122
      };
20975
      };
20123
      const urlinput = UrlInputBackstage(editor);
20976
      const urlinput = UrlInputBackstage(editor);
20124
      const styles = init$7(editor);
20977
      const styles = init$6(editor);
20125
      const colorinput = ColorInputBackstage(editor);
20978
      const colorinput = ColorInputBackstage(editor);
20126
      const dialogSettings = DialogBackstage(editor);
20979
      const dialogSettings = DialogBackstage(editor);
20127
      const isContextMenuOpen = () => contextMenuState.get();
20980
      const isContextMenuOpen = () => contextMenuState.get();
20128
      const setContextMenuState = state => contextMenuState.set(state);
20981
      const setContextMenuState = state => contextMenuState.set(state);
Línea 20137... Línea 20990...
20137
        colorinput,
20990
        colorinput,
20138
        dialog: dialogSettings,
20991
        dialog: dialogSettings,
20139
        isContextMenuOpen,
20992
        isContextMenuOpen,
20140
        setContextMenuState
20993
        setContextMenuState
20141
      };
20994
      };
-
 
20995
      const getCompByName = _name => Optional.none();
20142
      const popupBackstage = {
20996
      const popupBackstage = {
20143
        ...commonBackstage,
20997
        ...commonBackstage,
20144
        shared: {
20998
        shared: {
20145
          ...commonBackstage.shared,
20999
          ...commonBackstage.shared,
20146
          interpreter: s => interpretWithoutForm(s, {}, popupBackstage),
21000
          interpreter: s => interpretWithoutForm(s, {}, popupBackstage, getCompByName),
20147
          getSink: lazySinks.popup
21001
          getSink: lazySinks.popup
20148
        }
21002
        }
20149
      };
21003
      };
20150
      const dialogBackstage = {
21004
      const dialogBackstage = {
20151
        ...commonBackstage,
21005
        ...commonBackstage,
20152
        shared: {
21006
        shared: {
20153
          ...commonBackstage.shared,
21007
          ...commonBackstage.shared,
20154
          interpreter: s => interpretWithoutForm(s, {}, dialogBackstage),
21008
          interpreter: s => interpretWithoutForm(s, {}, dialogBackstage, getCompByName),
20155
          getSink: lazySinks.dialog
21009
          getSink: lazySinks.dialog
20156
        }
21010
        }
20157
      };
21011
      };
20158
      return {
21012
      return {
20159
        popup: popupBackstage,
21013
        popup: popupBackstage,
Línea 20231... Línea 21085...
20231
        }
21085
        }
20232
      };
21086
      };
20233
      const onDismissPopups = event => {
21087
      const onDismissPopups = event => {
20234
        broadcastOn(dismissPopups(), { target: SugarElement.fromDom(event.relatedTarget.getContainer()) });
21088
        broadcastOn(dismissPopups(), { target: SugarElement.fromDom(event.relatedTarget.getContainer()) });
20235
      };
21089
      };
-
 
21090
      const onFocusIn = event => editor.dispatch('focusin', event);
-
 
21091
      const onFocusOut = event => editor.dispatch('focusout', event);
20236
      editor.on('PostRender', () => {
21092
      editor.on('PostRender', () => {
20237
        editor.on('click', onContentClick);
21093
        editor.on('click', onContentClick);
20238
        editor.on('tap', onContentClick);
21094
        editor.on('tap', onContentClick);
20239
        editor.on('mouseup', onContentMouseup);
21095
        editor.on('mouseup', onContentMouseup);
20240
        editor.on('mousedown', onContentMousedown);
21096
        editor.on('mousedown', onContentMousedown);
20241
        editor.on('ScrollWindow', onWindowScroll);
21097
        editor.on('ScrollWindow', onWindowScroll);
20242
        editor.on('ResizeWindow', onWindowResize);
21098
        editor.on('ResizeWindow', onWindowResize);
20243
        editor.on('ResizeEditor', onEditorResize);
21099
        editor.on('ResizeEditor', onEditorResize);
20244
        editor.on('AfterProgressState', onEditorProgress);
21100
        editor.on('AfterProgressState', onEditorProgress);
20245
        editor.on('DismissPopups', onDismissPopups);
21101
        editor.on('DismissPopups', onDismissPopups);
-
 
21102
        each$1([
-
 
21103
          mothership,
-
 
21104
          ...uiMotherships
-
 
21105
        ], gui => {
-
 
21106
          gui.element.dom.addEventListener('focusin', onFocusIn);
-
 
21107
          gui.element.dom.addEventListener('focusout', onFocusOut);
-
 
21108
        });
20246
      });
21109
      });
20247
      editor.on('remove', () => {
21110
      editor.on('remove', () => {
20248
        editor.off('click', onContentClick);
21111
        editor.off('click', onContentClick);
20249
        editor.off('tap', onContentClick);
21112
        editor.off('tap', onContentClick);
20250
        editor.off('mouseup', onContentMouseup);
21113
        editor.off('mouseup', onContentMouseup);
Línea 20252... Línea 21115...
20252
        editor.off('ScrollWindow', onWindowScroll);
21115
        editor.off('ScrollWindow', onWindowScroll);
20253
        editor.off('ResizeWindow', onWindowResize);
21116
        editor.off('ResizeWindow', onWindowResize);
20254
        editor.off('ResizeEditor', onEditorResize);
21117
        editor.off('ResizeEditor', onEditorResize);
20255
        editor.off('AfterProgressState', onEditorProgress);
21118
        editor.off('AfterProgressState', onEditorProgress);
20256
        editor.off('DismissPopups', onDismissPopups);
21119
        editor.off('DismissPopups', onDismissPopups);
-
 
21120
        each$1([
-
 
21121
          mothership,
-
 
21122
          ...uiMotherships
-
 
21123
        ], gui => {
-
 
21124
          gui.element.dom.removeEventListener('focusin', onFocusIn);
-
 
21125
          gui.element.dom.removeEventListener('focusout', onFocusOut);
-
 
21126
        });
20257
        onMousedown.unbind();
21127
        onMousedown.unbind();
20258
        onTouchstart.unbind();
21128
        onTouchstart.unbind();
20259
        onTouchmove.unbind();
21129
        onTouchmove.unbind();
20260
        onTouchend.unbind();
21130
        onTouchend.unbind();
20261
        onMouseup.unbind();
21131
        onMouseup.unbind();
Línea 20388... Línea 21258...
20388
        }
21258
        }
20389
      }
21259
      }
20390
    });
21260
    });
Línea 20391... Línea 21261...
20391
 
21261
 
20392
    const setup$a = noop;
21262
    const setup$a = noop;
20393
    const isDocked$2 = never;
21263
    const isDocked$1 = never;
Línea 20394... Línea 21264...
20394
    const getBehaviours$1 = constant$1([]);
21264
    const getBehaviours$1 = constant$1([]);
20395
 
21265
 
20396
    var StaticHeader = /*#__PURE__*/Object.freeze({
21266
    var StaticHeader = /*#__PURE__*/Object.freeze({
20397
        __proto__: null,
-
 
20398
        setup: setup$a,
-
 
20399
        isDocked: isDocked$2,
-
 
20400
        getBehaviours: getBehaviours$1
-
 
20401
    });
-
 
20402
 
-
 
20403
    const getOffsetParent = element => {
-
 
20404
      const isFixed = is$1(getRaw(element, 'position'), 'fixed');
-
 
20405
      const offsetParent$1 = isFixed ? Optional.none() : offsetParent(element);
-
 
20406
      return offsetParent$1.orThunk(() => {
-
 
20407
        const marker = SugarElement.fromTag('span');
-
 
20408
        return parent(element).bind(parent => {
-
 
20409
          append$2(parent, marker);
-
 
20410
          const offsetParent$1 = offsetParent(marker);
-
 
20411
          remove$5(marker);
-
 
20412
          return offsetParent$1;
-
 
20413
        });
-
 
20414
      });
-
 
20415
    };
-
 
20416
    const getOrigin = element => getOffsetParent(element).map(absolute$3).getOrThunk(() => SugarPosition(0, 0));
-
 
20417
 
-
 
20418
    const appear = (component, contextualInfo) => {
-
 
20419
      const elem = component.element;
-
 
20420
      add$2(elem, contextualInfo.transitionClass);
-
 
20421
      remove$2(elem, contextualInfo.fadeOutClass);
-
 
20422
      add$2(elem, contextualInfo.fadeInClass);
-
 
20423
      contextualInfo.onShow(component);
-
 
20424
    };
-
 
20425
    const disappear = (component, contextualInfo) => {
-
 
20426
      const elem = component.element;
-
 
20427
      add$2(elem, contextualInfo.transitionClass);
-
 
20428
      remove$2(elem, contextualInfo.fadeInClass);
-
 
20429
      add$2(elem, contextualInfo.fadeOutClass);
-
 
20430
      contextualInfo.onHide(component);
-
 
20431
    };
-
 
20432
    const isPartiallyVisible = (box, bounds) => box.y < bounds.bottom && box.bottom > bounds.y;
-
 
20433
    const isTopCompletelyVisible = (box, bounds) => box.y >= bounds.y;
-
 
20434
    const isBottomCompletelyVisible = (box, bounds) => box.bottom <= bounds.bottom;
-
 
20435
    const forceTopPosition = (winBox, leftX, viewport) => ({
-
 
20436
      location: 'top',
-
 
20437
      leftX,
-
 
20438
      topY: viewport.bounds.y - winBox.y
-
 
20439
    });
-
 
20440
    const forceBottomPosition = (winBox, leftX, viewport) => ({
-
 
20441
      location: 'bottom',
-
 
20442
      leftX,
-
 
20443
      bottomY: winBox.bottom - viewport.bounds.bottom
-
 
20444
    });
-
 
20445
    const getDockedLeftPosition = bounds => {
-
 
20446
      return bounds.box.x - bounds.win.x;
-
 
20447
    };
-
 
20448
    const tryDockingPosition = (modes, bounds, viewport) => {
-
 
20449
      const winBox = bounds.win;
-
 
20450
      const box = bounds.box;
-
 
20451
      const leftX = getDockedLeftPosition(bounds);
-
 
20452
      return findMap(modes, mode => {
-
 
20453
        switch (mode) {
-
 
20454
        case 'bottom':
-
 
20455
          return !isBottomCompletelyVisible(box, viewport.bounds) ? Optional.some(forceBottomPosition(winBox, leftX, viewport)) : Optional.none();
-
 
20456
        case 'top':
-
 
20457
          return !isTopCompletelyVisible(box, viewport.bounds) ? Optional.some(forceTopPosition(winBox, leftX, viewport)) : Optional.none();
-
 
20458
        default:
-
 
20459
          return Optional.none();
-
 
20460
        }
-
 
20461
      }).getOr({ location: 'no-dock' });
-
 
20462
    };
-
 
20463
    const isVisibleForModes = (modes, box, viewport) => forall(modes, mode => {
-
 
20464
      switch (mode) {
-
 
20465
      case 'bottom':
-
 
20466
        return isBottomCompletelyVisible(box, viewport.bounds);
-
 
20467
      case 'top':
-
 
20468
        return isTopCompletelyVisible(box, viewport.bounds);
-
 
20469
      }
-
 
20470
    });
-
 
20471
    const getXYForRestoring = (pos, viewport) => {
-
 
20472
      const priorY = viewport.optScrollEnv.fold(constant$1(pos.bounds.y), scrollEnv => scrollEnv.scrollElmTop + (pos.bounds.y - scrollEnv.currentScrollTop));
-
 
20473
      return SugarPosition(pos.bounds.x, priorY);
-
 
20474
    };
-
 
20475
    const getXYForSaving = (box, viewport) => {
-
 
20476
      const priorY = viewport.optScrollEnv.fold(constant$1(box.y), scrollEnv => box.y + scrollEnv.currentScrollTop - scrollEnv.scrollElmTop);
-
 
20477
      return SugarPosition(box.x, priorY);
-
 
20478
    };
-
 
20479
    const getPrior = (elem, viewport, state) => state.getInitialPos().map(pos => {
-
 
20480
      const xy = getXYForRestoring(pos, viewport);
-
 
20481
      return {
-
 
20482
        box: bounds(xy.left, xy.top, get$c(elem), get$d(elem)),
-
 
20483
        location: pos.location
-
 
20484
      };
-
 
20485
    });
-
 
20486
    const storePrior = (elem, box, viewport, state, decision) => {
-
 
20487
      const xy = getXYForSaving(box, viewport);
-
 
20488
      const bounds$1 = bounds(xy.left, xy.top, box.width, box.height);
-
 
20489
      state.setInitialPos({
-
 
20490
        style: getAllRaw(elem),
-
 
20491
        position: get$e(elem, 'position') || 'static',
-
 
20492
        bounds: bounds$1,
-
 
20493
        location: decision.location
-
 
20494
      });
-
 
20495
    };
-
 
20496
    const storePriorIfNone = (elem, box, viewport, state, decision) => {
-
 
20497
      state.getInitialPos().fold(() => storePrior(elem, box, viewport, state, decision), () => noop);
-
 
20498
    };
-
 
20499
    const revertToOriginal = (elem, box, state) => state.getInitialPos().bind(position => {
-
 
20500
      var _a;
-
 
20501
      state.clearInitialPos();
-
 
20502
      switch (position.position) {
-
 
20503
      case 'static':
-
 
20504
        return Optional.some({ morph: 'static' });
-
 
20505
      case 'absolute':
-
 
20506
        const offsetParent = getOffsetParent(elem).getOr(body());
-
 
20507
        const offsetBox = box$1(offsetParent);
-
 
20508
        const scrollDelta = (_a = offsetParent.dom.scrollTop) !== null && _a !== void 0 ? _a : 0;
-
 
20509
        return Optional.some({
-
 
20510
          morph: 'absolute',
-
 
20511
          positionCss: NuPositionCss('absolute', get$g(position.style, 'left').map(_left => box.x - offsetBox.x), get$g(position.style, 'top').map(_top => box.y - offsetBox.y + scrollDelta), get$g(position.style, 'right').map(_right => offsetBox.right - box.right), get$g(position.style, 'bottom').map(_bottom => offsetBox.bottom - box.bottom))
-
 
20512
        });
-
 
20513
      default:
-
 
20514
        return Optional.none();
-
 
20515
      }
-
 
20516
    });
-
 
20517
    const tryMorphToOriginal = (elem, viewport, state) => getPrior(elem, viewport, state).filter(({box}) => isVisibleForModes(state.getModes(), box, viewport)).bind(({box}) => revertToOriginal(elem, box, state));
-
 
20518
    const tryDecisionToFixedMorph = decision => {
-
 
20519
      switch (decision.location) {
-
 
20520
      case 'top': {
-
 
20521
          return Optional.some({
-
 
20522
            morph: 'fixed',
-
 
20523
            positionCss: NuPositionCss('fixed', Optional.some(decision.leftX), Optional.some(decision.topY), Optional.none(), Optional.none())
-
 
20524
          });
-
 
20525
        }
-
 
20526
      case 'bottom': {
-
 
20527
          return Optional.some({
-
 
20528
            morph: 'fixed',
-
 
20529
            positionCss: NuPositionCss('fixed', Optional.some(decision.leftX), Optional.none(), Optional.none(), Optional.some(decision.bottomY))
-
 
20530
          });
-
 
20531
        }
-
 
20532
      default:
-
 
20533
        return Optional.none();
-
 
20534
      }
-
 
20535
    };
-
 
20536
    const tryMorphToFixed = (elem, viewport, state) => {
-
 
20537
      const box = box$1(elem);
-
 
20538
      const winBox = win();
-
 
20539
      const decision = tryDockingPosition(state.getModes(), {
-
 
20540
        win: winBox,
-
 
20541
        box
-
 
20542
      }, viewport);
-
 
20543
      if (decision.location === 'top' || decision.location === 'bottom') {
-
 
20544
        storePrior(elem, box, viewport, state, decision);
-
 
20545
        return tryDecisionToFixedMorph(decision);
-
 
20546
      } else {
-
 
20547
        return Optional.none();
-
 
20548
      }
-
 
20549
    };
-
 
20550
    const tryMorphToOriginalOrUpdateFixed = (elem, viewport, state) => {
-
 
20551
      return tryMorphToOriginal(elem, viewport, state).orThunk(() => {
-
 
20552
        return viewport.optScrollEnv.bind(_ => getPrior(elem, viewport, state)).bind(({box, location}) => {
-
 
20553
          const winBox = win();
-
 
20554
          const leftX = getDockedLeftPosition({
-
 
20555
            win: winBox,
-
 
20556
            box
-
 
20557
          });
-
 
20558
          const decision = location === 'top' ? forceTopPosition(winBox, leftX, viewport) : forceBottomPosition(winBox, leftX, viewport);
-
 
20559
          return tryDecisionToFixedMorph(decision);
-
 
20560
        });
-
 
20561
      });
-
 
20562
    };
-
 
20563
    const tryMorph = (component, viewport, state) => {
-
 
20564
      const elem = component.element;
-
 
20565
      const isDocked = is$1(getRaw(elem, 'position'), 'fixed');
-
 
20566
      return isDocked ? tryMorphToOriginalOrUpdateFixed(elem, viewport, state) : tryMorphToFixed(elem, viewport, state);
-
 
20567
    };
-
 
20568
    const calculateMorphToOriginal = (component, viewport, state) => {
-
 
20569
      const elem = component.element;
-
 
20570
      return getPrior(elem, viewport, state).bind(({box}) => revertToOriginal(elem, box, state));
-
 
20571
    };
-
 
20572
    const forceDockWith = (elem, viewport, state, getDecision) => {
-
 
20573
      const box = box$1(elem);
-
 
20574
      const winBox = win();
-
 
20575
      const leftX = getDockedLeftPosition({
-
 
20576
        win: winBox,
-
 
20577
        box
-
 
20578
      });
-
 
20579
      const decision = getDecision(winBox, leftX, viewport);
-
 
20580
      if (decision.location === 'bottom' || decision.location === 'top') {
-
 
20581
        storePriorIfNone(elem, box, viewport, state, decision);
-
 
20582
        return tryDecisionToFixedMorph(decision);
-
 
20583
      } else {
-
 
20584
        return Optional.none();
-
 
20585
      }
-
 
20586
    };
-
 
20587
 
-
 
20588
    const morphToStatic = (component, config, state) => {
-
 
20589
      state.setDocked(false);
-
 
20590
      each$1([
-
 
20591
        'left',
-
 
20592
        'right',
-
 
20593
        'top',
-
 
20594
        'bottom',
-
 
20595
        'position'
-
 
20596
      ], prop => remove$6(component.element, prop));
-
 
20597
      config.onUndocked(component);
-
 
20598
    };
-
 
20599
    const morphToCoord = (component, config, state, position) => {
-
 
20600
      const isDocked = position.position === 'fixed';
-
 
20601
      state.setDocked(isDocked);
-
 
20602
      applyPositionCss(component.element, position);
-
 
20603
      const method = isDocked ? config.onDocked : config.onUndocked;
-
 
20604
      method(component);
-
 
20605
    };
-
 
20606
    const updateVisibility = (component, config, state, viewport, morphToDocked = false) => {
-
 
20607
      config.contextual.each(contextInfo => {
-
 
20608
        contextInfo.lazyContext(component).each(box => {
-
 
20609
          const isVisible = isPartiallyVisible(box, viewport.bounds);
-
 
20610
          if (isVisible !== state.isVisible()) {
-
 
20611
            state.setVisible(isVisible);
-
 
20612
            if (morphToDocked && !isVisible) {
-
 
20613
              add$1(component.element, [contextInfo.fadeOutClass]);
-
 
20614
              contextInfo.onHide(component);
-
 
20615
            } else {
-
 
20616
              const method = isVisible ? appear : disappear;
-
 
20617
              method(component, contextInfo);
-
 
20618
            }
-
 
20619
          }
-
 
20620
        });
-
 
20621
      });
-
 
20622
    };
-
 
20623
    const applyFixedMorph = (component, config, state, viewport, morph) => {
-
 
20624
      updateVisibility(component, config, state, viewport, true);
-
 
20625
      morphToCoord(component, config, state, morph.positionCss);
-
 
20626
    };
-
 
20627
    const applyMorph = (component, config, state, viewport, morph) => {
-
 
20628
      switch (morph.morph) {
-
 
20629
      case 'static': {
-
 
20630
          return morphToStatic(component, config, state);
-
 
20631
        }
-
 
20632
      case 'absolute': {
-
 
20633
          return morphToCoord(component, config, state, morph.positionCss);
-
 
20634
        }
-
 
20635
      case 'fixed': {
-
 
20636
          return applyFixedMorph(component, config, state, viewport, morph);
-
 
20637
        }
-
 
20638
      }
-
 
20639
    };
-
 
20640
    const refreshInternal = (component, config, state) => {
-
 
20641
      const viewport = config.lazyViewport(component);
-
 
20642
      updateVisibility(component, config, state, viewport);
-
 
20643
      tryMorph(component, viewport, state).each(morph => {
-
 
20644
        applyMorph(component, config, state, viewport, morph);
-
 
20645
      });
-
 
20646
    };
-
 
20647
    const resetInternal = (component, config, state) => {
-
 
20648
      const elem = component.element;
-
 
20649
      state.setDocked(false);
-
 
20650
      const viewport = config.lazyViewport(component);
-
 
20651
      calculateMorphToOriginal(component, viewport, state).each(staticOrAbsoluteMorph => {
-
 
20652
        switch (staticOrAbsoluteMorph.morph) {
-
 
20653
        case 'static': {
-
 
20654
            morphToStatic(component, config, state);
-
 
20655
            break;
-
 
20656
          }
-
 
20657
        case 'absolute': {
-
 
20658
            morphToCoord(component, config, state, staticOrAbsoluteMorph.positionCss);
-
 
20659
            break;
-
 
20660
          }
-
 
20661
        }
-
 
20662
      });
-
 
20663
      state.setVisible(true);
-
 
20664
      config.contextual.each(contextInfo => {
-
 
20665
        remove$1(elem, [
-
 
20666
          contextInfo.fadeInClass,
-
 
20667
          contextInfo.fadeOutClass,
-
 
20668
          contextInfo.transitionClass
-
 
20669
        ]);
-
 
20670
        contextInfo.onShow(component);
-
 
20671
      });
-
 
20672
      refresh$3(component, config, state);
-
 
20673
    };
-
 
20674
    const refresh$3 = (component, config, state) => {
-
 
20675
      if (component.getSystem().isConnected()) {
-
 
20676
        refreshInternal(component, config, state);
-
 
20677
      }
-
 
20678
    };
-
 
20679
    const reset = (component, config, state) => {
-
 
20680
      if (state.isDocked()) {
-
 
20681
        resetInternal(component, config, state);
-
 
20682
      }
-
 
20683
    };
-
 
20684
    const forceDockWithDecision = getDecision => (component, config, state) => {
-
 
20685
      const viewport = config.lazyViewport(component);
-
 
20686
      const optMorph = forceDockWith(component.element, viewport, state, getDecision);
-
 
20687
      optMorph.each(morph => {
-
 
20688
        applyFixedMorph(component, config, state, viewport, morph);
-
 
20689
      });
-
 
20690
    };
-
 
20691
    const forceDockToTop = forceDockWithDecision(forceTopPosition);
-
 
20692
    const forceDockToBottom = forceDockWithDecision(forceBottomPosition);
-
 
20693
    const isDocked$1 = (component, config, state) => state.isDocked();
-
 
20694
    const setModes = (component, config, state, modes) => state.setModes(modes);
-
 
20695
    const getModes = (component, config, state) => state.getModes();
-
 
20696
 
-
 
20697
    var DockingApis = /*#__PURE__*/Object.freeze({
-
 
20698
        __proto__: null,
-
 
20699
        refresh: refresh$3,
21267
        __proto__: null,
20700
        reset: reset,
21268
        setup: setup$a,
20701
        isDocked: isDocked$1,
-
 
20702
        getModes: getModes,
-
 
20703
        setModes: setModes,
-
 
20704
        forceDockToTop: forceDockToTop,
-
 
20705
        forceDockToBottom: forceDockToBottom
-
 
20706
    });
-
 
20707
 
-
 
20708
    const events$4 = (dockInfo, dockState) => derive$2([
-
 
20709
      runOnSource(transitionend(), (component, simulatedEvent) => {
-
 
20710
        dockInfo.contextual.each(contextInfo => {
-
 
20711
          if (has(component.element, contextInfo.transitionClass)) {
-
 
20712
            remove$1(component.element, [
-
 
20713
              contextInfo.transitionClass,
-
 
20714
              contextInfo.fadeInClass
-
 
20715
            ]);
-
 
20716
            const notify = dockState.isVisible() ? contextInfo.onShown : contextInfo.onHidden;
-
 
20717
            notify(component);
-
 
20718
          }
-
 
20719
          simulatedEvent.stop();
-
 
20720
        });
-
 
20721
      }),
-
 
20722
      run$1(windowScroll(), (component, _) => {
-
 
20723
        refresh$3(component, dockInfo, dockState);
-
 
20724
      }),
-
 
20725
      run$1(externalElementScroll(), (component, _) => {
-
 
20726
        refresh$3(component, dockInfo, dockState);
-
 
20727
      }),
-
 
20728
      run$1(windowResize(), (component, _) => {
-
 
20729
        reset(component, dockInfo, dockState);
-
 
20730
      })
-
 
20731
    ]);
-
 
20732
 
-
 
20733
    var ActiveDocking = /*#__PURE__*/Object.freeze({
-
 
20734
        __proto__: null,
-
 
20735
        events: events$4
-
 
20736
    });
-
 
20737
 
-
 
20738
    var DockingSchema = [
-
 
20739
      optionObjOf('contextual', [
-
 
20740
        requiredString('fadeInClass'),
-
 
20741
        requiredString('fadeOutClass'),
-
 
20742
        requiredString('transitionClass'),
-
 
20743
        requiredFunction('lazyContext'),
-
 
20744
        onHandler('onShow'),
-
 
20745
        onHandler('onShown'),
-
 
20746
        onHandler('onHide'),
-
 
20747
        onHandler('onHidden')
-
 
20748
      ]),
-
 
20749
      defaultedFunction('lazyViewport', () => ({
-
 
20750
        bounds: win(),
-
 
20751
        optScrollEnv: Optional.none()
-
 
20752
      })),
-
 
20753
      defaultedArrayOf('modes', [
-
 
20754
        'top',
-
 
20755
        'bottom'
-
 
20756
      ], string),
-
 
20757
      onHandler('onDocked'),
-
 
20758
      onHandler('onUndocked')
-
 
20759
    ];
-
 
20760
 
-
 
20761
    const init$5 = spec => {
-
 
20762
      const docked = Cell(false);
-
 
20763
      const visible = Cell(true);
-
 
20764
      const initialBounds = value$2();
-
 
20765
      const modes = Cell(spec.modes);
-
 
20766
      const readState = () => `docked:  ${ docked.get() }, visible: ${ visible.get() }, modes: ${ modes.get().join(',') }`;
-
 
20767
      return nu$8({
-
 
20768
        isDocked: docked.get,
-
 
20769
        setDocked: docked.set,
-
 
20770
        getInitialPos: initialBounds.get,
-
 
20771
        setInitialPos: initialBounds.set,
-
 
20772
        clearInitialPos: initialBounds.clear,
-
 
20773
        isVisible: visible.get,
-
 
20774
        setVisible: visible.set,
-
 
20775
        getModes: modes.get,
-
 
20776
        setModes: modes.set,
-
 
20777
        readState
-
 
20778
      });
-
 
20779
    };
-
 
20780
 
-
 
20781
    var DockingState = /*#__PURE__*/Object.freeze({
-
 
20782
        __proto__: null,
-
 
20783
        init: init$5
-
 
20784
    });
-
 
20785
 
-
 
20786
    const Docking = create$4({
-
 
20787
      fields: DockingSchema,
-
 
20788
      name: 'docking',
-
 
20789
      active: ActiveDocking,
-
 
20790
      apis: DockingApis,
21269
        isDocked: isDocked$1,
Línea 20791... Línea 21270...
20791
      state: DockingState
21270
        getBehaviours: getBehaviours$1
Línea 20792... Línea 21271...
20792
    });
21271
    });
Línea 20802... Línea 21281...
20802
    const editorStickyOffClass = 'tox-tinymce--toolbar-sticky-off';
21281
    const editorStickyOffClass = 'tox-tinymce--toolbar-sticky-off';
20803
    const scrollFromBehindHeader = (e, containerHeader) => {
21282
    const scrollFromBehindHeader = (e, containerHeader) => {
20804
      const doc = owner$4(containerHeader);
21283
      const doc = owner$4(containerHeader);
20805
      const win = defaultView(containerHeader);
21284
      const win = defaultView(containerHeader);
20806
      const viewHeight = win.dom.innerHeight;
21285
      const viewHeight = win.dom.innerHeight;
20807
      const scrollPos = get$b(doc);
21286
      const scrollPos = get$c(doc);
20808
      const markerElement = SugarElement.fromDom(e.elm);
21287
      const markerElement = SugarElement.fromDom(e.elm);
20809
      const markerPos = absolute$2(markerElement);
21288
      const markerPos = absolute$2(markerElement);
20810
      const markerHeight = get$d(markerElement);
21289
      const markerHeight = get$e(markerElement);
20811
      const markerTop = markerPos.y;
21290
      const markerTop = markerPos.y;
20812
      const markerBottom = markerTop + markerHeight;
21291
      const markerBottom = markerTop + markerHeight;
20813
      const editorHeaderPos = absolute$3(containerHeader);
21292
      const editorHeaderPos = absolute$3(containerHeader);
20814
      const editorHeaderHeight = get$d(containerHeader);
21293
      const editorHeaderHeight = get$e(containerHeader);
20815
      const editorHeaderTop = editorHeaderPos.top;
21294
      const editorHeaderTop = editorHeaderPos.top;
20816
      const editorHeaderBottom = editorHeaderTop + editorHeaderHeight;
21295
      const editorHeaderBottom = editorHeaderTop + editorHeaderHeight;
20817
      const editorHeaderDockedAtTop = Math.abs(editorHeaderTop - scrollPos.top) < 2;
21296
      const editorHeaderDockedAtTop = Math.abs(editorHeaderTop - scrollPos.top) < 2;
20818
      const editorHeaderDockedAtBottom = Math.abs(editorHeaderBottom - (scrollPos.top + viewHeight)) < 2;
21297
      const editorHeaderDockedAtBottom = Math.abs(editorHeaderBottom - (scrollPos.top + viewHeight)) < 2;
20819
      if (editorHeaderDockedAtTop && markerTop < editorHeaderBottom) {
21298
      if (editorHeaderDockedAtTop && markerTop < editorHeaderBottom) {
Línea 20823... Línea 21302...
20823
        to(scrollPos.left, y, doc);
21302
        to(scrollPos.left, y, doc);
20824
      }
21303
      }
20825
    };
21304
    };
20826
    const isDockedMode = (header, mode) => contains$2(Docking.getModes(header), mode);
21305
    const isDockedMode = (header, mode) => contains$2(Docking.getModes(header), mode);
20827
    const updateIframeContentFlow = header => {
21306
    const updateIframeContentFlow = header => {
20828
      const getOccupiedHeight = elm => getOuter$2(elm) + (parseInt(get$e(elm, 'margin-top'), 10) || 0) + (parseInt(get$e(elm, 'margin-bottom'), 10) || 0);
21307
      const getOccupiedHeight = elm => getOuter$2(elm) + (parseInt(get$f(elm, 'margin-top'), 10) || 0) + (parseInt(get$f(elm, 'margin-bottom'), 10) || 0);
20829
      const elm = header.element;
21308
      const elm = header.element;
20830
      parentElement(elm).each(parentElem => {
21309
      parentElement(elm).each(parentElem => {
20831
        const padding = 'padding-' + Docking.getModes(header)[0];
21310
        const padding = 'padding-' + Docking.getModes(header)[0];
20832
        if (Docking.isDocked(header)) {
21311
        if (Docking.isDocked(header)) {
20833
          const parentWidth = get$c(parentElem);
21312
          const parentWidth = get$d(parentElem);
20834
          set$8(elm, 'width', parentWidth + 'px');
21313
          set$8(elm, 'width', parentWidth + 'px');
20835
          set$8(parentElem, padding, getOccupiedHeight(elm) + 'px');
21314
          set$8(parentElem, padding, getOccupiedHeight(elm) + 'px');
20836
        } else {
21315
        } else {
20837
          remove$6(elm, 'width');
21316
          remove$7(elm, 'width');
20838
          remove$6(parentElem, padding);
21317
          remove$7(parentElem, padding);
20839
        }
21318
        }
20840
      });
21319
      });
20841
    };
21320
    };
20842
    const updateSinkVisibility = (sinkElem, visible) => {
21321
    const updateSinkVisibility = (sinkElem, visible) => {
20843
      if (visible) {
21322
      if (visible) {
20844
        remove$2(sinkElem, visibility.fadeOutClass);
21323
        remove$3(sinkElem, visibility.fadeOutClass);
20845
        add$1(sinkElem, [
21324
        add$1(sinkElem, [
20846
          visibility.transitionClass,
21325
          visibility.transitionClass,
20847
          visibility.fadeInClass
21326
          visibility.fadeInClass
20848
        ]);
21327
        ]);
20849
      } else {
21328
      } else {
20850
        remove$2(sinkElem, visibility.fadeInClass);
21329
        remove$3(sinkElem, visibility.fadeInClass);
20851
        add$1(sinkElem, [
21330
        add$1(sinkElem, [
20852
          visibility.fadeOutClass,
21331
          visibility.fadeOutClass,
20853
          visibility.transitionClass
21332
          visibility.transitionClass
20854
        ]);
21333
        ]);
20855
      }
21334
      }
20856
    };
21335
    };
20857
    const updateEditorClasses = (editor, docked) => {
21336
    const updateEditorClasses = (editor, docked) => {
20858
      const editorContainer = SugarElement.fromDom(editor.getContainer());
21337
      const editorContainer = SugarElement.fromDom(editor.getContainer());
20859
      if (docked) {
21338
      if (docked) {
20860
        add$2(editorContainer, editorStickyOnClass);
21339
        add$2(editorContainer, editorStickyOnClass);
20861
        remove$2(editorContainer, editorStickyOffClass);
21340
        remove$3(editorContainer, editorStickyOffClass);
20862
      } else {
21341
      } else {
20863
        add$2(editorContainer, editorStickyOffClass);
21342
        add$2(editorContainer, editorStickyOffClass);
20864
        remove$2(editorContainer, editorStickyOnClass);
21343
        remove$3(editorContainer, editorStickyOnClass);
20865
      }
21344
      }
20866
    };
21345
    };
20867
    const restoreFocus = (headerElem, focusedElem) => {
21346
    const restoreFocus = (headerElem, focusedElem) => {
20868
      const ownerDoc = owner$4(focusedElem);
21347
      const ownerDoc = owner$4(focusedElem);
20869
      active$1(ownerDoc).filter(activeElm => !eq(focusedElem, activeElm)).filter(activeElm => eq(activeElm, SugarElement.fromDom(ownerDoc.dom.body)) || contains(headerElem, activeElm)).each(() => focus$3(focusedElem));
21348
      active$1(ownerDoc).filter(activeElm => !eq(focusedElem, activeElm)).filter(activeElm => eq(activeElm, SugarElement.fromDom(ownerDoc.dom.body)) || contains(headerElem, activeElm)).each(() => focus$3(focusedElem));
Línea 20902... Línea 21381...
20902
      });
21381
      });
20903
    };
21382
    };
20904
    const isDocked = lazyHeader => lazyHeader().map(Docking.isDocked).getOr(false);
21383
    const isDocked = lazyHeader => lazyHeader().map(Docking.isDocked).getOr(false);
20905
    const getIframeBehaviours = () => [Receiving.config({ channels: { [toolbarHeightChange()]: { onReceive: updateIframeContentFlow } } })];
21384
    const getIframeBehaviours = () => [Receiving.config({ channels: { [toolbarHeightChange()]: { onReceive: updateIframeContentFlow } } })];
20906
    const getBehaviours = (editor, sharedBackstage) => {
21385
    const getBehaviours = (editor, sharedBackstage) => {
20907
      const focusedElm = value$2();
21386
      const focusedElm = value$4();
20908
      const lazySink = sharedBackstage.getSink;
21387
      const lazySink = sharedBackstage.getSink;
20909
      const runOnSinkElement = f => {
21388
      const runOnSinkElement = f => {
20910
        lazySink().each(sink => f(sink.element));
21389
        lazySink().each(sink => f(sink.element));
20911
      };
21390
      };
20912
      const onDockingSwitch = comp => {
21391
      const onDockingSwitch = comp => {
Línea 20941... Línea 21420...
20941
            },
21420
            },
20942
            onShow: () => {
21421
            onShow: () => {
20943
              runOnSinkElement(elem => updateSinkVisibility(elem, true));
21422
              runOnSinkElement(elem => updateSinkVisibility(elem, true));
20944
            },
21423
            },
20945
            onShown: comp => {
21424
            onShown: comp => {
20946
              runOnSinkElement(elem => remove$1(elem, [
21425
              runOnSinkElement(elem => remove$2(elem, [
20947
                visibility.transitionClass,
21426
                visibility.transitionClass,
20948
                visibility.fadeInClass
21427
                visibility.fadeInClass
20949
              ]));
21428
              ]));
20950
              focusedElm.get().each(elem => {
21429
              focusedElm.get().each(elem => {
20951
                restoreFocus(comp.element, elem);
21430
                restoreFocus(comp.element, elem);
Línea 20955... Línea 21434...
20955
            onHide: comp => {
21434
            onHide: comp => {
20956
              findFocusedElem(comp.element, lazySink).fold(focusedElm.clear, focusedElm.set);
21435
              findFocusedElem(comp.element, lazySink).fold(focusedElm.clear, focusedElm.set);
20957
              runOnSinkElement(elem => updateSinkVisibility(elem, false));
21436
              runOnSinkElement(elem => updateSinkVisibility(elem, false));
20958
            },
21437
            },
20959
            onHidden: () => {
21438
            onHidden: () => {
20960
              runOnSinkElement(elem => remove$1(elem, [visibility.transitionClass]));
21439
              runOnSinkElement(elem => remove$2(elem, [visibility.transitionClass]));
20961
            },
21440
            },
20962
            ...visibility
21441
            ...visibility
20963
          },
21442
          },
20964
          lazyViewport: comp => {
21443
          lazyViewport: comp => {
20965
            const optScrollingContext = detectWhenSplitUiMode(editor, comp.element);
21444
            const optScrollingContext = detectWhenSplitUiMode(editor, comp.element);
20966
            return optScrollingContext.fold(() => {
21445
            return optScrollingContext.fold(() => {
20967
              const boundsWithoutOffset = win();
21446
              const boundsWithoutOffset = win();
20968
              const offset = getStickyToolbarOffset(editor);
21447
              const offset = getStickyToolbarOffset(editor);
20969
              const top = boundsWithoutOffset.y + (isDockedMode(comp, 'top') ? offset : 0);
21448
              const top = boundsWithoutOffset.y + (isDockedMode(comp, 'top') && !isFullscreen(editor) ? offset : 0);
20970
              const height = boundsWithoutOffset.height - (isDockedMode(comp, 'bottom') ? offset : 0);
21449
              const height = boundsWithoutOffset.height - (isDockedMode(comp, 'bottom') ? offset : 0);
20971
              return {
21450
              return {
20972
                bounds: bounds(boundsWithoutOffset.x, top, boundsWithoutOffset.width, height),
21451
                bounds: bounds(boundsWithoutOffset.x, top, boundsWithoutOffset.width, height),
20973
                optScrollEnv: Optional.none()
21452
                optScrollEnv: Optional.none()
20974
              };
21453
              };
Línea 21034... Línea 21513...
21034
        } else {
21513
        } else {
21035
          return Optional.some(x);
21514
          return Optional.some(x);
21036
        }
21515
        }
21037
      })),
21516
      })),
21038
      requiredFunction('fetch'),
21517
      requiredFunction('fetch'),
21039
      defaultedFunction('onSetup', () => noop)
21518
      defaultedFunction('onSetup', () => noop),
-
 
21519
      defaultedString('context', 'mode:design')
21040
    ];
21520
    ];
Línea 21041... Línea 21521...
21041
 
21521
 
21042
    const MenuButtonSchema = objOf([
21522
    const MenuButtonSchema = objOf([
21043
      type,
21523
      type,
Línea 21058... Línea 21538...
21058
        'color',
21538
        'color',
21059
        'listpreview'
21539
        'listpreview'
21060
      ]),
21540
      ]),
21061
      defaultedColumns(1),
21541
      defaultedColumns(1),
21062
      onAction,
21542
      onAction,
21063
      onItemAction
21543
      onItemAction,
-
 
21544
      defaultedString('context', 'mode:design')
21064
    ]);
21545
    ]);
21065
    const createSplitButton = spec => asRaw('SplitButton', splitButtonSchema, spec);
21546
    const createSplitButton = spec => asRaw('SplitButton', splitButtonSchema, spec);
Línea 21066... Línea 21547...
21066
 
21547
 
21067
    const factory$d = (detail, spec) => {
21548
    const factory$d = (detail, spec) => {
Línea 21070... Línea 21551...
21070
          const buttonSpec = {
21551
          const buttonSpec = {
21071
            type: 'menubutton',
21552
            type: 'menubutton',
21072
            text: m.text,
21553
            text: m.text,
21073
            fetch: callback => {
21554
            fetch: callback => {
21074
              callback(m.getItems());
21555
              callback(m.getItems());
21075
            }
21556
            },
-
 
21557
            context: 'any'
21076
          };
21558
          };
21077
          const internal = createMenuButton(buttonSpec).mapError(errInfo => formatError(errInfo)).getOrDie();
21559
          const internal = createMenuButton(buttonSpec).mapError(errInfo => formatError(errInfo)).getOrDie();
21078
          return renderMenuButton(internal, 'tox-mbtn', spec.backstage, Optional.some('menuitem'));
21560
          return renderMenuButton(internal, 'tox-mbtn', spec.backstage, Optional.some('menuitem'));
21079
        });
21561
        });
21080
        Replacing.set(comp, newMenus);
21562
        Replacing.set(comp, newMenus);
Línea 21203... Línea 21685...
21203
      const getSlot = (container, key) => getPart(container, detail, key);
21685
      const getSlot = (container, key) => getPart(container, detail, key);
21204
      const onSlot = (f, def) => (container, key) => getPart(container, detail, key).map(slot => f(slot, key)).getOr(def);
21686
      const onSlot = (f, def) => (container, key) => getPart(container, detail, key).map(slot => f(slot, key)).getOr(def);
21205
      const onSlots = f => (container, keys) => {
21687
      const onSlots = f => (container, keys) => {
21206
        each$1(keys, key => f(container, key));
21688
        each$1(keys, key => f(container, key));
21207
      };
21689
      };
21208
      const doShowing = (comp, _key) => get$f(comp.element, 'aria-hidden') !== 'true';
21690
      const doShowing = (comp, _key) => get$g(comp.element, 'aria-hidden') !== 'true';
21209
      const doShow = (comp, key) => {
21691
      const doShow = (comp, key) => {
21210
        if (!doShowing(comp)) {
21692
        if (!doShowing(comp)) {
21211
          const element = comp.element;
21693
          const element = comp.element;
21212
          remove$6(element, 'display');
21694
          remove$7(element, 'display');
21213
          remove$7(element, 'aria-hidden');
21695
          remove$8(element, 'aria-hidden');
21214
          emitWith(comp, slotVisibility(), {
21696
          emitWith(comp, slotVisibility(), {
21215
            name: key,
21697
            name: key,
21216
            visible: true
21698
            visible: true
21217
          });
21699
          });
21218
        }
21700
        }
Línea 21243... Línea 21725...
21243
      };
21725
      };
21244
      return {
21726
      return {
21245
        uid: detail.uid,
21727
        uid: detail.uid,
21246
        dom: detail.dom,
21728
        dom: detail.dom,
21247
        components,
21729
        components,
21248
        behaviours: get$3(detail.slotBehaviours),
21730
        behaviours: get$4(detail.slotBehaviours),
21249
        apis
21731
        apis
21250
      };
21732
      };
21251
    };
21733
    };
21252
    const slotApis = map$1({
21734
    const slotApis = map$1({
21253
      getSlotNames: (apis, c) => apis.getSlotNames(c),
21735
      getSlotNames: (apis, c) => apis.getSlotNames(c),
Línea 21288... Línea 21770...
21288
            const handleToggle = () => buttonApi.setActive(isActive());
21770
            const handleToggle = () => buttonApi.setActive(isActive());
21289
            editor.on('ToggleSidebar', handleToggle);
21771
            editor.on('ToggleSidebar', handleToggle);
21290
            return () => {
21772
            return () => {
21291
              editor.off('ToggleSidebar', handleToggle);
21773
              editor.off('ToggleSidebar', handleToggle);
21292
            };
21774
            };
21293
          }
21775
          },
-
 
21776
          context: 'any'
21294
        });
21777
        });
21295
      });
21778
      });
21296
    };
21779
    };
21297
    const getApi = comp => ({ element: () => comp.element.dom });
21780
    const getApi = comp => ({ element: () => comp.element.dom });
21298
    const makePanels = (parts, panelConfigs) => {
21781
    const makePanels = (parts, panelConfigs) => {
Línea 21344... Línea 21827...
21344
        const configKey = showSidebar === null || showSidebar === void 0 ? void 0 : showSidebar.toLowerCase();
21827
        const configKey = showSidebar === null || showSidebar === void 0 ? void 0 : showSidebar.toLowerCase();
21345
        if (isString(configKey) && has$2(panelConfigs, configKey)) {
21828
        if (isString(configKey) && has$2(panelConfigs, configKey)) {
21346
          Composing.getCurrent(slider).each(slotContainer => {
21829
          Composing.getCurrent(slider).each(slotContainer => {
21347
            SlotContainer.showSlot(slotContainer, configKey);
21830
            SlotContainer.showSlot(slotContainer, configKey);
21348
            Sliding.immediateGrow(slider);
21831
            Sliding.immediateGrow(slider);
21349
            remove$6(slider.element, 'width');
21832
            remove$7(slider.element, 'width');
21350
            updateSidebarRoleOnToggle(sidebar.element, 'region');
21833
            updateSidebarRoleOnToggle(sidebar.element, 'region');
21351
          });
21834
          });
21352
        }
21835
        }
21353
      });
21836
      });
21354
    };
21837
    };
Línea 21424... Línea 21907...
21424
              },
21907
              },
21425
              onStartGrow: slider => {
21908
              onStartGrow: slider => {
21426
                emitWith(slider, fixSize, { width: getRaw(slider.element, 'width').getOr('') });
21909
                emitWith(slider, fixSize, { width: getRaw(slider.element, 'width').getOr('') });
21427
              },
21910
              },
21428
              onStartShrink: slider => {
21911
              onStartShrink: slider => {
21429
                emitWith(slider, fixSize, { width: get$c(slider.element) + 'px' });
21912
                emitWith(slider, fixSize, { width: get$d(slider.element) + 'px' });
21430
              }
21913
              }
21431
            }),
21914
            }),
21432
            Replacing.config({}),
21915
            Replacing.config({}),
21433
            Composing.config({
21916
            Composing.config({
21434
              find: comp => {
21917
              find: comp => {
Línea 21443... Línea 21926...
21443
        config('sidebar-sliding-events', [
21926
        config('sidebar-sliding-events', [
21444
          run$1(fixSize, (comp, se) => {
21927
          run$1(fixSize, (comp, se) => {
21445
            set$8(comp.element, 'width', se.event.width);
21928
            set$8(comp.element, 'width', se.event.width);
21446
          }),
21929
          }),
21447
          run$1(autoSize, (comp, _se) => {
21930
          run$1(autoSize, (comp, _se) => {
21448
            remove$6(comp.element, 'width');
21931
            remove$7(comp.element, 'width');
21449
          })
21932
          })
21450
        ])
21933
        ])
21451
      ])
21934
      ])
21452
    });
21935
    });
Línea 21472... Línea 21955...
21472
        config.onBlock(component);
21955
        config.onBlock(component);
21473
      }
21956
      }
21474
      state.blockWith(() => Replacing.remove(root, blocker));
21957
      state.blockWith(() => Replacing.remove(root, blocker));
21475
    };
21958
    };
21476
    const unblock = (component, config, state) => {
21959
    const unblock = (component, config, state) => {
21477
      remove$7(component.element, 'aria-busy');
21960
      remove$8(component.element, 'aria-busy');
21478
      if (state.isBlocked()) {
21961
      if (state.isBlocked()) {
21479
        config.onUnblock(component);
21962
        config.onUnblock(component);
21480
      }
21963
      }
21481
      state.clear();
21964
      state.clear();
21482
    };
21965
    };
Línea 21499... Línea 21982...
21499
    const init$4 = () => {
21982
    const init$4 = () => {
21500
      const blocker = destroyable();
21983
      const blocker = destroyable();
21501
      const blockWith = destroy => {
21984
      const blockWith = destroy => {
21502
        blocker.set({ destroy });
21985
        blocker.set({ destroy });
21503
      };
21986
      };
21504
      return nu$8({
21987
      return nu$7({
21505
        readState: blocker.isSet,
21988
        readState: blocker.isSet,
21506
        blockWith,
21989
        blockWith,
21507
        clear: blocker.clear,
21990
        clear: blocker.clear,
21508
        isBlocked: blocker.isSet
21991
        isBlocked: blocker.isSet
21509
      });
21992
      });
Línea 21539... Línea 22022...
21539
      Optional.from(editor.iframeElement).map(SugarElement.fromDom).each(iframe => {
22022
      Optional.from(editor.iframeElement).map(SugarElement.fromDom).each(iframe => {
21540
        if (state) {
22023
        if (state) {
21541
          getOpt(iframe, tabIndexAttr).each(tabIndex => set$9(iframe, dataTabIndexAttr, tabIndex));
22024
          getOpt(iframe, tabIndexAttr).each(tabIndex => set$9(iframe, dataTabIndexAttr, tabIndex));
21542
          set$9(iframe, tabIndexAttr, -1);
22025
          set$9(iframe, tabIndexAttr, -1);
21543
        } else {
22026
        } else {
21544
          remove$7(iframe, tabIndexAttr);
22027
          remove$8(iframe, tabIndexAttr);
21545
          getOpt(iframe, dataTabIndexAttr).each(tabIndex => {
22028
          getOpt(iframe, dataTabIndexAttr).each(tabIndex => {
21546
            set$9(iframe, tabIndexAttr, tabIndex);
22029
            set$9(iframe, tabIndexAttr, tabIndex);
21547
            remove$7(iframe, dataTabIndexAttr);
22030
            remove$8(iframe, dataTabIndexAttr);
21548
          });
22031
          });
21549
        }
22032
        }
21550
      });
22033
      });
21551
    };
22034
    };
21552
    const toggleThrobber = (editor, comp, state, providerBackstage) => {
22035
    const toggleThrobber = (editor, comp, state, providerBackstage) => {
21553
      const element = comp.element;
22036
      const element = comp.element;
21554
      toggleEditorTabIndex(editor, state);
22037
      toggleEditorTabIndex(editor, state);
21555
      if (state) {
22038
      if (state) {
21556
        Blocking.block(comp, getBusySpec$1(providerBackstage));
22039
        Blocking.block(comp, getBusySpec$1(providerBackstage));
21557
        remove$6(element, 'display');
22040
        remove$7(element, 'display');
21558
        remove$7(element, 'aria-hidden');
22041
        remove$8(element, 'aria-hidden');
21559
        if (editor.hasFocus()) {
22042
        if (editor.hasFocus()) {
21560
          focusBusyComponent(comp);
22043
          focusBusyComponent(comp);
21561
        }
22044
        }
21562
      } else {
22045
      } else {
21563
        const throbberFocus = Composing.getCurrent(comp).exists(busyComp => hasFocus(busyComp.element));
22046
        const throbberFocus = Composing.getCurrent(comp).exists(busyComp => hasFocus(busyComp.element));
Línea 21593... Línea 22076...
21593
        return false;
22076
        return false;
21594
      }
22077
      }
21595
    };
22078
    };
21596
    const setup$7 = (editor, lazyThrobber, sharedBackstage) => {
22079
    const setup$7 = (editor, lazyThrobber, sharedBackstage) => {
21597
      const throbberState = Cell(false);
22080
      const throbberState = Cell(false);
21598
      const timer = value$2();
22081
      const timer = value$4();
21599
      const stealFocus = e => {
22082
      const stealFocus = e => {
21600
        if (throbberState.get() && !isPasteBinTarget(e)) {
22083
        if (throbberState.get() && !isPasteBinTarget(e)) {
21601
          e.preventDefault();
22084
          e.preventDefault();
21602
          focusBusyComponent(lazyThrobber());
22085
          focusBusyComponent(lazyThrobber());
21603
          editor.editorManager.setActive(editor);
22086
          editor.editorManager.setActive(editor);
Línea 21714... Línea 22197...
21714
      set$8(primary.element, 'visibility', 'hidden');
22197
      set$8(primary.element, 'visibility', 'hidden');
21715
      const groups = builtGroups.concat([overflowGroup]);
22198
      const groups = builtGroups.concat([overflowGroup]);
21716
      const focusedComp = findFocusedComp(groups);
22199
      const focusedComp = findFocusedComp(groups);
21717
      setOverflow([]);
22200
      setOverflow([]);
21718
      setGroups$1(primary, groups);
22201
      setGroups$1(primary, groups);
21719
      const availableWidth = get$c(primary.element);
22202
      const availableWidth = get$d(primary.element);
21720
      const overflows = partition(availableWidth, detail.builtGroups.get(), comp => get$c(comp.element), overflowGroup);
22203
      const overflows = partition(availableWidth, detail.builtGroups.get(), comp => Math.ceil(comp.element.dom.getBoundingClientRect().width), overflowGroup);
21721
      if (overflows.extra.length === 0) {
22204
      if (overflows.extra.length === 0) {
21722
        Replacing.remove(primary, overflowGroup);
22205
        Replacing.remove(primary, overflowGroup);
21723
        setOverflow([]);
22206
        setOverflow([]);
21724
      } else {
22207
      } else {
21725
        setGroups$1(primary, overflows.within);
22208
        setGroups$1(primary, overflows.within);
21726
        setOverflow(overflows.extra);
22209
        setOverflow(overflows.extra);
21727
      }
22210
      }
21728
      remove$6(primary.element, 'visibility');
22211
      remove$7(primary.element, 'visibility');
21729
      reflow(primary.element);
22212
      reflow(primary.element);
21730
      focusedComp.each(Focusing.focus);
22213
      focusedComp.each(Focusing.focus);
21731
    };
22214
    };
Línea 21732... Línea 22215...
21732
 
22215
 
Línea 21799... Línea 22282...
21799
          };
22282
          };
21800
        }
22283
        }
21801
      })
22284
      })
21802
    ]);
22285
    ]);
Línea 21803... Línea 22286...
21803
 
22286
 
21804
    const shouldSkipFocus = value$2();
22287
    const shouldSkipFocus = value$4();
21805
    const toggleWithoutFocusing = (button, externals) => {
22288
    const toggleWithoutFocusing = (button, externals) => {
21806
      shouldSkipFocus.set(true);
22289
      shouldSkipFocus.set(true);
21807
      toggle(button, externals);
22290
      toggle(button, externals);
21808
      shouldSkipFocus.clear();
22291
      shouldSkipFocus.clear();
Línea 22119... Línea 22602...
22119
                shrinkingClass: detail.markers.shrinkingClass,
22602
                shrinkingClass: detail.markers.shrinkingClass,
22120
                growingClass: detail.markers.growingClass,
22603
                growingClass: detail.markers.growingClass,
22121
                onShrunk: comp => {
22604
                onShrunk: comp => {
22122
                  getPart(comp, detail, 'overflow-button').each(button => {
22605
                  getPart(comp, detail, 'overflow-button').each(button => {
22123
                    Toggling.off(button);
22606
                    Toggling.off(button);
22124
                    Focusing.focus(button);
-
 
22125
                  });
22607
                  });
22126
                  detail.onClosed(comp);
22608
                  detail.onClosed(comp);
22127
                },
22609
                },
22128
                onGrown: comp => {
22610
                onGrown: comp => {
22129
                  Keying.focusIn(comp);
-
 
22130
                  detail.onOpened(comp);
22611
                  detail.onOpened(comp);
22131
                },
22612
                },
22132
                onStartGrow: comp => {
22613
                onStartGrow: comp => {
22133
                  getPart(comp, detail, 'overflow-button').each(Toggling.on);
22614
                  getPart(comp, detail, 'overflow-button').each(Toggling.on);
22134
                }
22615
                }
Línea 22147... Línea 22628...
22147
      external({
22628
      external({
22148
        name: 'overflow-button',
22629
        name: 'overflow-button',
22149
        overrides: detail => ({
22630
        overrides: detail => ({
22150
          buttonBehaviours: derive$1([Toggling.config({
22631
          buttonBehaviours: derive$1([Toggling.config({
22151
              toggleClass: detail.markers.overflowToggledClass,
22632
              toggleClass: detail.markers.overflowToggledClass,
22152
              aria: { mode: 'pressed' },
22633
              aria: { mode: 'expanded' },
22153
              toggleOnExecute: false
22634
              toggleOnExecute: false
22154
            })])
22635
            })])
22155
        })
22636
        })
22156
      }),
22637
      }),
22157
      external({ name: 'overflow-group' })
22638
      external({ name: 'overflow-group' })
22158
    ]);
22639
    ]);
Línea 22159... Línea 22640...
22159
 
22640
 
22160
    const isOpen = (toolbar, detail) => getPart(toolbar, detail, 'overflow').map(Sliding.hasGrown).getOr(false);
22641
    const isOpen = (toolbar, detail) => getPart(toolbar, detail, 'overflow').map(Sliding.hasGrown).getOr(false);
22161
    const toggleToolbar = (toolbar, detail) => {
22642
    const toggleToolbar = (toolbar, detail, skipFocus) => {
-
 
22643
      getPart(toolbar, detail, 'overflow-button').each(oveflowButton => {
22162
      getPart(toolbar, detail, 'overflow-button').bind(() => getPart(toolbar, detail, 'overflow')).each(overf => {
22644
        getPart(toolbar, detail, 'overflow').each(overf => {
-
 
22645
          refresh(toolbar, detail);
-
 
22646
          if (Sliding.hasShrunk(overf)) {
-
 
22647
            const fn = detail.onOpened;
-
 
22648
            detail.onOpened = comp => {
-
 
22649
              if (!skipFocus) {
-
 
22650
                Keying.focusIn(overf);
-
 
22651
              }
-
 
22652
              fn(comp);
-
 
22653
              detail.onOpened = fn;
-
 
22654
            };
-
 
22655
          } else {
-
 
22656
            const fn = detail.onClosed;
-
 
22657
            detail.onClosed = comp => {
-
 
22658
              if (!skipFocus) {
-
 
22659
                Focusing.focus(oveflowButton);
-
 
22660
              }
-
 
22661
              fn(comp);
-
 
22662
              detail.onClosed = fn;
-
 
22663
            };
22163
        refresh(toolbar, detail);
22664
          }
-
 
22665
          Sliding.toggleGrow(overf);
22164
        Sliding.toggleGrow(overf);
22666
        });
22165
      });
22667
      });
22166
    };
22668
    };
22167
    const refresh = (toolbar, detail) => {
22669
    const refresh = (toolbar, detail) => {
22168
      getPart(toolbar, detail, 'overflow').each(overflow => {
22670
      getPart(toolbar, detail, 'overflow').each(overflow => {
Línea 22203... Línea 22705...
22203
                });
22705
                });
22204
              }
22706
              }
22205
            }
22707
            }
22206
          }),
22708
          }),
22207
          config('toolbar-toggle-events', [run$1(toolbarToggleEvent, toolbar => {
22709
          config('toolbar-toggle-events', [run$1(toolbarToggleEvent, toolbar => {
22208
              toggleToolbar(toolbar, detail);
22710
              toggleToolbar(toolbar, detail, false);
22209
            })])
22711
            })])
22210
        ]),
22712
        ]),
22211
        apis: {
22713
        apis: {
22212
          setGroups: (toolbar, groups) => {
22714
          setGroups: (toolbar, groups) => {
22213
            doSetGroups(toolbar, groups);
22715
            doSetGroups(toolbar, groups);
22214
            refresh(toolbar, detail);
22716
            refresh(toolbar, detail);
22215
          },
22717
          },
22216
          refresh: toolbar => refresh(toolbar, detail),
22718
          refresh: toolbar => refresh(toolbar, detail),
-
 
22719
          toggle: toolbar => {
-
 
22720
            toggleToolbar(toolbar, detail, false);
-
 
22721
          },
-
 
22722
          toggleWithoutFocusing: toolbar => {
22217
          toggle: toolbar => toggleToolbar(toolbar, detail),
22723
            toggleToolbar(toolbar, detail, true);
-
 
22724
          },
22218
          isOpen: toolbar => isOpen(toolbar, detail)
22725
          isOpen: toolbar => isOpen(toolbar, detail)
22219
        },
22726
        },
22220
        domModification: { attributes: { role: 'group' } }
22727
        domModification: { attributes: { role: 'group' } }
22221
      };
22728
      };
22222
    };
22729
    };
Línea 22238... Línea 22745...
22238
        isOpen: (apis, toolbar) => apis.isOpen(toolbar)
22745
        isOpen: (apis, toolbar) => apis.isOpen(toolbar)
22239
      }
22746
      }
22240
    });
22747
    });
Línea 22241... Línea 22748...
22241
 
22748
 
22242
    const renderToolbarGroupCommon = toolbarGroup => {
22749
    const renderToolbarGroupCommon = toolbarGroup => {
22243
      const attributes = toolbarGroup.title.fold(() => ({}), title => ({ attributes: { title } }));
22750
      const attributes = toolbarGroup.label.isNone() ? toolbarGroup.title.fold(() => ({}), title => ({ attributes: { 'aria-label': title } })) : toolbarGroup.label.fold(() => ({}), label => ({ attributes: { 'aria-label': label } }));
22244
      return {
22751
      return {
22245
        dom: {
22752
        dom: {
22246
          tag: 'div',
22753
          tag: 'div',
22247
          classes: ['tox-toolbar__group'],
22754
          classes: ['tox-toolbar__group'].concat(toolbarGroup.label.isSome() ? ['tox-toolbar__group_with_label'] : []),
22248
          ...attributes
22755
          ...attributes
-
 
22756
        },
-
 
22757
        components: [
-
 
22758
          ...toolbarGroup.label.map(label => {
-
 
22759
            return {
-
 
22760
              dom: {
-
 
22761
                tag: 'span',
-
 
22762
                classes: [
-
 
22763
                  'tox-label',
-
 
22764
                  'tox-label--context-toolbar'
-
 
22765
                ]
-
 
22766
              },
-
 
22767
              components: [text$2(label)]
-
 
22768
            };
22249
        },
22769
          }).toArray(),
-
 
22770
          ToolbarGroup.parts.items({})
22250
        components: [ToolbarGroup.parts.items({})],
22771
        ],
22251
        items: toolbarGroup.items,
22772
        items: toolbarGroup.items,
22252
        markers: { itemSelector: '*:not(.tox-split-button) > .tox-tbtn:not([disabled]), ' + '.tox-split-button:not([disabled]), ' + '.tox-toolbar-nav-js:not([disabled]), ' + '.tox-number-input:not([disabled])' },
22773
        markers: { itemSelector: '*:not(.tox-split-button) > .tox-tbtn:not([disabled]), ' + '.tox-split-button:not([disabled]), ' + '.tox-toolbar-nav-item:not([disabled]), ' + '.tox-number-input:not([disabled])' },
22253
        tgroupBehaviours: derive$1([
22774
        tgroupBehaviours: derive$1([
22254
          Tabstopping.config({}),
22775
          Tabstopping.config({}),
22255
          Focusing.config({})
22776
          Focusing.config({ ignore: true })
22256
        ])
22777
        ])
22257
      };
22778
      };
22258
    };
22779
    };
22259
    const renderToolbarGroup = toolbarGroup => ToolbarGroup.sketch(renderToolbarGroupCommon(toolbarGroup));
22780
    const renderToolbarGroup = toolbarGroup => ToolbarGroup.sketch(renderToolbarGroupCommon(toolbarGroup));
22260
    const getToolbarBehaviours = (toolbarSpec, modeName) => {
22781
    const getToolbarBehaviours = (toolbarSpec, modeName) => {
22261
      const onAttached = runOnAttached(component => {
22782
      const onAttached = runOnAttached(component => {
22262
        const groups = map$2(toolbarSpec.initGroups, renderToolbarGroup);
22783
        const groups = map$2(toolbarSpec.initGroups, renderToolbarGroup);
22263
        Toolbar.setGroups(component, groups);
22784
        Toolbar.setGroups(component, groups);
22264
      });
22785
      });
22265
      return derive$1([
22786
      return derive$1([
22266
        DisablingConfigs.toolbarButton(toolbarSpec.providers.isDisabled),
22787
        DisablingConfigs.toolbarButton(() => toolbarSpec.providers.checkUiComponentContext('any').shouldDisable),
22267
        receivingConfig(),
22788
        toggleOnReceive(() => toolbarSpec.providers.checkUiComponentContext('any')),
22268
        Keying.config({
22789
        Keying.config({
22269
          mode: modeName,
22790
          mode: modeName,
-
 
22791
          onEscape: toolbarSpec.onEscape,
22270
          onEscape: toolbarSpec.onEscape,
22792
          visibilitySelector: '.tox-toolbar__overflow',
22271
          selector: '.tox-toolbar__group'
22793
          selector: '.tox-toolbar__group'
22272
        }),
22794
        }),
22273
        config('toolbar-events', [onAttached])
22795
        config('toolbar-events', [onAttached])
22274
      ]);
22796
      ]);
Línea 22282... Línea 22804...
22282
          classes: ['tox-toolbar-overlord']
22804
          classes: ['tox-toolbar-overlord']
22283
        },
22805
        },
22284
        parts: {
22806
        parts: {
22285
          'overflow-group': renderToolbarGroupCommon({
22807
          'overflow-group': renderToolbarGroupCommon({
22286
            title: Optional.none(),
22808
            title: Optional.none(),
-
 
22809
            label: Optional.none(),
22287
            items: []
22810
            items: []
22288
          }),
22811
          }),
22289
          'overflow-button': renderIconButtonSpec({
22812
          'overflow-button': renderIconButtonSpec({
-
 
22813
            context: 'any',
22290
            name: 'more',
22814
            name: 'more',
22291
            icon: Optional.some('more-drawer'),
22815
            icon: Optional.some('more-drawer'),
22292
            enabled: true,
22816
            enabled: true,
22293
            tooltip: Optional.some('Reveal or hide additional toolbar items'),
22817
            tooltip: Optional.some('Reveal or hide additional toolbar items'),
22294
            primary: false,
22818
            primary: false,
22295
            buttonType: Optional.none(),
22819
            buttonType: Optional.none(),
22296
            borderless: false
22820
            borderless: false
22297
          }, Optional.none(), toolbarSpec.providers)
22821
          }, Optional.none(), toolbarSpec.providers, [], 'overflow-button')
22298
        },
22822
        },
22299
        splitToolbarBehaviours: getToolbarBehaviours(toolbarSpec, modeName)
22823
        splitToolbarBehaviours: getToolbarBehaviours(toolbarSpec, modeName)
22300
      };
22824
      };
22301
    };
22825
    };
22302
    const renderFloatingMoreToolbar = toolbarSpec => {
22826
    const renderFloatingMoreToolbar = toolbarSpec => {
Línea 22392... Línea 22916...
22392
      defaultedStringEnum('buttonType', 'secondary', [
22916
      defaultedStringEnum('buttonType', 'secondary', [
22393
        'primary',
22917
        'primary',
22394
        'secondary'
22918
        'secondary'
22395
      ]),
22919
      ]),
22396
      defaultedBoolean('borderless', false),
22920
      defaultedBoolean('borderless', false),
22397
      requiredFunction('onAction')
22921
      requiredFunction('onAction'),
-
 
22922
      defaultedString('context', 'mode:design')
22398
    ];
22923
    ];
22399
    const normalButtonFields = [
22924
    const normalButtonFields = [
22400
      ...baseButtonFields,
22925
      ...baseButtonFields,
22401
      text,
22926
      text,
22402
      requiredStringEnum('type', ['button'])
22927
      requiredStringEnum('type', ['button'])
Línea 22440... Línea 22965...
22440
          const elm = comp.element;
22965
          const elm = comp.element;
22441
          if (state) {
22966
          if (state) {
22442
            add$2(elm, 'tox-button--enabled');
22967
            add$2(elm, 'tox-button--enabled');
22443
            set$9(elm, 'aria-pressed', true);
22968
            set$9(elm, 'aria-pressed', true);
22444
          } else {
22969
          } else {
22445
            remove$2(elm, 'tox-button--enabled');
22970
            remove$3(elm, 'tox-button--enabled');
22446
            remove$7(elm, 'aria-pressed');
22971
            remove$8(elm, 'aria-pressed');
22447
          }
22972
          }
22448
        };
22973
        };
22449
        const isActive = () => has(comp.element, 'tox-button--enabled');
22974
        const isActive = () => has(comp.element, 'tox-button--enabled');
-
 
22975
        const focus = () => focus$3(comp.element);
22450
        if (isToggleButton) {
22976
        if (isToggleButton) {
22451
          return spec.onAction({
22977
          return spec.onAction({
22452
            setIcon,
22978
            setIcon,
22453
            setActive,
22979
            setActive,
22454
            isActive
22980
            isActive,
-
 
22981
            focus
22455
          });
22982
          });
22456
        }
22983
        }
22457
        if (spec.type === 'button') {
22984
        if (spec.type === 'button') {
22458
          return spec.onAction({ setIcon });
22985
          return spec.onAction({ setIcon });
22459
        }
22986
        }
Línea 22470... Línea 22997...
22470
        borderless: spec.borderless
22997
        borderless: spec.borderless
22471
      };
22998
      };
22472
      const buttonTypeClasses = calculateClassesFromButtonType((_b = spec.buttonType) !== null && _b !== void 0 ? _b : 'secondary');
22999
      const buttonTypeClasses = calculateClassesFromButtonType((_b = spec.buttonType) !== null && _b !== void 0 ? _b : 'secondary');
22473
      const optTranslatedText = isToggleButton ? spec.text.map(providers.translate) : Optional.some(providers.translate(spec.text));
23000
      const optTranslatedText = isToggleButton ? spec.text.map(providers.translate) : Optional.some(providers.translate(spec.text));
22474
      const optTranslatedTextComponed = optTranslatedText.map(text$2);
23001
      const optTranslatedTextComponed = optTranslatedText.map(text$2);
22475
      const tooltipAttributes = buttonSpec.tooltip.or(optTranslatedText).map(tooltip => ({
23002
      const ariaLabelAttributes = buttonSpec.tooltip.or(optTranslatedText).map(al => ({ 'aria-label': providers.translate(al) })).getOr({});
22476
        'aria-label': providers.translate(tooltip),
-
 
22477
        'title': providers.translate(tooltip)
-
 
22478
      })).getOr({});
-
 
22479
      const optIconSpec = optMemIcon.map(memIcon => memIcon.asSpec());
23003
      const optIconSpec = optMemIcon.map(memIcon => memIcon.asSpec());
22480
      const components = componentRenderPipeline([
23004
      const components = componentRenderPipeline([
22481
        optIconSpec,
23005
        optIconSpec,
22482
        optTranslatedTextComponed
23006
        optTranslatedTextComponed
22483
      ]);
23007
      ]);
22484
      const hasIconAndText = spec.icon.isSome() && optTranslatedTextComponed.isSome();
23008
      const hasIconAndText = spec.icon.isSome() && optTranslatedTextComponed.isSome();
22485
      const dom = {
23009
      const dom = {
22486
        tag: 'button',
23010
        tag: 'button',
22487
        classes: buttonTypeClasses.concat(...spec.icon.isSome() && !hasIconAndText ? ['tox-button--icon'] : []).concat(...hasIconAndText ? ['tox-button--icon-and-text'] : []).concat(...spec.borderless ? ['tox-button--naked'] : []).concat(...spec.type === 'togglebutton' && spec.active ? ['tox-button--enabled'] : []),
23011
        classes: buttonTypeClasses.concat(...spec.icon.isSome() && !hasIconAndText ? ['tox-button--icon'] : []).concat(...hasIconAndText ? ['tox-button--icon-and-text'] : []).concat(...spec.borderless ? ['tox-button--naked'] : []).concat(...spec.type === 'togglebutton' && spec.active ? ['tox-button--enabled'] : []),
22488
        attributes: tooltipAttributes
23012
        attributes: ariaLabelAttributes
22489
      };
23013
      };
22490
      const extraBehaviours = [];
23014
      const extraBehaviours = [];
22491
      const iconButtonSpec = renderCommonSpec(buttonSpec, Optional.some(action), extraBehaviours, dom, components, providers);
23015
      const iconButtonSpec = renderCommonSpec(buttonSpec, Optional.some(action), extraBehaviours, dom, components, spec.tooltip, providers);
22492
      return Button.sketch(iconButtonSpec);
23016
      return Button.sketch(iconButtonSpec);
22493
    };
23017
    };
Línea 22494... Línea 23018...
22494
 
23018
 
22495
    const renderViewButton = (spec, providers) => renderButton(spec, providers);
23019
    const renderViewButton = (spec, providers) => renderButton(spec, providers);
Línea 22500... Línea 23024...
22500
          classes: ['tox-view__toolbar__group']
23024
          classes: ['tox-view__toolbar__group']
22501
        },
23025
        },
22502
        components: map$2(spec.buttons, button => renderViewButton(button, providers))
23026
        components: map$2(spec.buttons, button => renderViewButton(button, providers))
22503
      };
23027
      };
22504
    };
23028
    };
22505
    const deviceDetection = detect$2().deviceType;
23029
    const deviceDetection = detect$1().deviceType;
22506
    const isPhone = deviceDetection.isPhone();
23030
    const isPhone = deviceDetection.isPhone();
22507
    const isTablet = deviceDetection.isTablet();
23031
    const isTablet = deviceDetection.isTablet();
22508
    const renderViewHeader = spec => {
23032
    const renderViewHeader = spec => {
22509
      let hasGroups = false;
23033
      let hasGroups = false;
22510
      const endButtons = map$2(spec.buttons, btnspec => {
23034
      const endButtons = map$2(spec.buttons, btnspec => {
Línea 22554... Línea 23078...
22554
      };
23078
      };
22555
    };
23079
    };
22556
    const renderViewPane = spec => {
23080
    const renderViewPane = spec => {
22557
      return {
23081
      return {
22558
        uid: spec.uid,
23082
        uid: spec.uid,
-
 
23083
        behaviours: derive$1([
-
 
23084
          Focusing.config({}),
-
 
23085
          Tabstopping.config({})
-
 
23086
        ]),
22559
        dom: {
23087
        dom: {
22560
          tag: 'div',
23088
          tag: 'div',
22561
          classes: ['tox-view__pane']
23089
          classes: ['tox-view__pane']
22562
        }
23090
        }
22563
      };
23091
      };
Línea 22570... Línea 23098...
22570
      };
23098
      };
22571
      return {
23099
      return {
22572
        uid: detail.uid,
23100
        uid: detail.uid,
22573
        dom: detail.dom,
23101
        dom: detail.dom,
22574
        components,
23102
        components,
-
 
23103
        behaviours: derive$1([
-
 
23104
          Focusing.config({}),
-
 
23105
          Keying.config({
-
 
23106
            mode: 'cyclic',
-
 
23107
            focusInside: FocusInsideModes.OnEnterOrSpaceMode
-
 
23108
          })
-
 
23109
        ]),
22575
        apis
23110
        apis
22576
      };
23111
      };
22577
    };
23112
    };
22578
    var View = composite({
23113
    var View = composite({
22579
      name: 'silver.View',
23114
      name: 'silver.View',
Línea 22636... Línea 23171...
22636
      set$8(element, 'display', 'none');
23171
      set$8(element, 'display', 'none');
22637
      set$9(element, 'aria-hidden', 'true');
23172
      set$9(element, 'aria-hidden', 'true');
22638
    };
23173
    };
22639
    const showContainer = comp => {
23174
    const showContainer = comp => {
22640
      const element = comp.element;
23175
      const element = comp.element;
22641
      remove$6(element, 'display');
23176
      remove$7(element, 'display');
22642
      remove$7(element, 'aria-hidden');
23177
      remove$8(element, 'aria-hidden');
22643
    };
23178
    };
22644
    const makeViewInstanceApi = slot => ({ getContainer: constant$1(slot) });
23179
    const makeViewInstanceApi = slot => ({ getContainer: constant$1(slot) });
22645
    const runOnPaneWithInstanceApi = (slotContainer, name, get) => {
23180
    const runOnPaneWithInstanceApi = (slotContainer, name, get) => {
22646
      SlotContainer.getSlot(slotContainer, name).each(view => {
23181
      SlotContainer.getSlot(slotContainer, name).each(view => {
22647
        View.getPane(view).each(pane => {
23182
        View.getPane(view).each(pane => {
Línea 22717... Línea 23252...
22717
      }
23252
      }
22718
    });
23253
    });
Línea 22719... Línea 23254...
22719
 
23254
 
22720
    const factory$6 = (detail, components, _spec) => {
23255
    const factory$6 = (detail, components, _spec) => {
-
 
23256
      let toolbarDrawerOpenState = false;
-
 
23257
      const toggleStatusbar = editorContainer => {
-
 
23258
        sibling(editorContainer, '.tox-statusbar').each(statusBar => {
-
 
23259
          if (get$f(statusBar, 'display') === 'none' && get$g(statusBar, 'aria-hidden') === 'true') {
-
 
23260
            remove$7(statusBar, 'display');
-
 
23261
            remove$8(statusBar, 'aria-hidden');
-
 
23262
          } else {
-
 
23263
            set$8(statusBar, 'display', 'none');
-
 
23264
            set$9(statusBar, 'aria-hidden', 'true');
-
 
23265
          }
-
 
23266
        });
22721
      let toolbarDrawerOpenState = false;
23267
      };
22722
      const apis = {
23268
      const apis = {
22723
        getSocket: comp => {
23269
        getSocket: comp => {
22724
          return parts$a.getPart(comp, detail, 'socket');
23270
          return parts$a.getPart(comp, detail, 'socket');
22725
        },
23271
        },
Línea 22802... Línea 23348...
22802
          if (toolbarDrawerOpenState) {
23348
          if (toolbarDrawerOpenState) {
22803
            apis.toggleToolbarDrawer(comp);
23349
            apis.toggleToolbarDrawer(comp);
22804
          }
23350
          }
22805
          parts$a.getPart(comp, detail, 'editorContainer').each(editorContainer => {
23351
          parts$a.getPart(comp, detail, 'editorContainer').each(editorContainer => {
22806
            const element = editorContainer.element;
23352
            const element = editorContainer.element;
-
 
23353
            toggleStatusbar(element);
22807
            set$8(element, 'display', 'none');
23354
            set$8(element, 'display', 'none');
22808
            set$9(element, 'aria-hidden', 'true');
23355
            set$9(element, 'aria-hidden', 'true');
22809
          });
23356
          });
22810
        },
23357
        },
22811
        showMainView: comp => {
23358
        showMainView: comp => {
22812
          if (toolbarDrawerOpenState) {
23359
          if (toolbarDrawerOpenState) {
22813
            apis.toggleToolbarDrawer(comp);
23360
            apis.toggleToolbarDrawer(comp);
22814
          }
23361
          }
22815
          parts$a.getPart(comp, detail, 'editorContainer').each(editorContainer => {
23362
          parts$a.getPart(comp, detail, 'editorContainer').each(editorContainer => {
22816
            const element = editorContainer.element;
23363
            const element = editorContainer.element;
-
 
23364
            toggleStatusbar(element);
22817
            remove$6(element, 'display');
23365
            remove$7(element, 'display');
22818
            remove$7(element, 'aria-hidden');
23366
            remove$8(element, 'aria-hidden');
22819
          });
23367
          });
22820
        }
23368
        }
22821
      };
23369
      };
22822
      return {
23370
      return {
22823
        uid: detail.uid,
23371
        uid: detail.uid,
Línea 23030... Línea 23578...
23030
 
23578
 
23031
    const defaultMenubar = 'file edit view insert format tools table help';
23579
    const defaultMenubar = 'file edit view insert format tools table help';
23032
    const defaultMenus = {
23580
    const defaultMenus = {
23033
      file: {
23581
      file: {
23034
        title: 'File',
23582
        title: 'File',
23035
        items: 'newdocument restoredraft | preview | export print | deleteallconversations'
23583
        items: 'newdocument restoredraft | preview | importword exportpdf exportword | export print | deleteallconversations'
23036
      },
23584
      },
23037
      edit: {
23585
      edit: {
23038
        title: 'Edit',
23586
        title: 'Edit',
23039
        items: 'undo redo | cut copy paste pastetext | selectall | searchreplace'
23587
        items: 'undo redo | cut copy paste pastetext | selectall | searchreplace'
23040
      },
23588
      },
23041
      view: {
23589
      view: {
23042
        title: 'View',
23590
        title: 'View',
23043
        items: 'code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments'
23591
        items: 'code revisionhistory | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments'
23044
      },
23592
      },
23045
      insert: {
23593
      insert: {
23046
        title: 'Insert',
23594
        title: 'Insert',
23047
        items: 'image link media addcomment pageembed template inserttemplate codesample inserttable accordion | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents footnotes | mergetags | insertdatetime'
23595
        items: 'image link media addcomment pageembed inserttemplate codesample inserttable accordion math | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents footnotes | mergetags | insertdatetime'
23048
      },
23596
      },
23049
      format: {
23597
      format: {
23050
        title: 'Format',
23598
        title: 'Format',
23051
        items: 'bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | language | removeformat'
23599
        items: 'bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | language | removeformat'
Línea 23094... Línea 23642...
23094
      const userDefinedMenus = keys(registry.menus).length > 0;
23642
      const userDefinedMenus = keys(registry.menus).length > 0;
23095
      const menubar = registry.menubar === undefined || registry.menubar === true ? parseItemsString(defaultMenubar) : parseItemsString(registry.menubar === false ? '' : registry.menubar);
23643
      const menubar = registry.menubar === undefined || registry.menubar === true ? parseItemsString(defaultMenubar) : parseItemsString(registry.menubar === false ? '' : registry.menubar);
23096
      const validMenus = filter$2(menubar, menuName => {
23644
      const validMenus = filter$2(menubar, menuName => {
23097
        const isDefaultMenu = has$2(defaultMenus, menuName);
23645
        const isDefaultMenu = has$2(defaultMenus, menuName);
23098
        if (userDefinedMenus) {
23646
        if (userDefinedMenus) {
23099
          return isDefaultMenu || get$g(registry.menus, menuName).exists(menu => has$2(menu, 'items'));
23647
          return isDefaultMenu || get$h(registry.menus, menuName).exists(menu => has$2(menu, 'items'));
23100
        } else {
23648
        } else {
23101
          return isDefaultMenu;
23649
          return isDefaultMenu;
23102
        }
23650
        }
23103
      });
23651
      });
23104
      const menus = map$2(validMenus, menuName => {
23652
      const menus = map$2(validMenus, menuName => {
Línea 23127... Línea 23675...
23127
        }
23675
        }
23128
      };
23676
      };
23129
    };
23677
    };
23130
    const fireSkinLoadError = (editor, err) => () => fireSkinLoadError$1(editor, { message: err });
23678
    const fireSkinLoadError = (editor, err) => () => fireSkinLoadError$1(editor, { message: err });
Línea -... Línea 23679...
-
 
23679
 
-
 
23680
    const getSkinResourceIdentifier = editor => {
-
 
23681
      const skin = getSkin(editor);
-
 
23682
      if (!skin) {
-
 
23683
        return Optional.none();
-
 
23684
      } else {
-
 
23685
        return Optional.from(skin);
-
 
23686
      }
23131
 
23687
    };
23132
    const loadStylesheet = (editor, stylesheetUrl, styleSheetLoader) => {
23688
    const loadStylesheet = (editor, stylesheetUrl, styleSheetLoader) => {
23133
      editor.on('remove', () => styleSheetLoader.unload(stylesheetUrl));
23689
      editor.on('remove', () => styleSheetLoader.unload(stylesheetUrl));
23134
      return styleSheetLoader.load(stylesheetUrl);
23690
      return styleSheetLoader.load(stylesheetUrl);
23135
    };
23691
    };
23136
    const loadRawCss = (editor, key, css, styleSheetLoader) => {
23692
    const loadRawCss = (editor, key, css, styleSheetLoader) => {
23137
      editor.on('remove', () => styleSheetLoader.unloadRawCss(key));
23693
      editor.on('remove', () => styleSheetLoader.unloadRawCss(key));
23138
      return styleSheetLoader.loadRawCss(key, css);
23694
      return styleSheetLoader.loadRawCss(key, css);
-
 
23695
    };
-
 
23696
    const skinIdentifierToResourceKey = (identifier, filename) => 'ui/' + identifier + '/' + filename;
23139
    };
23697
    const getResourceValue = resourceKey => Optional.from(tinymce.Resource.get(resourceKey)).filter(isString);
23140
    const loadUiSkins = async (editor, skinUrl) => {
23698
    const determineCSSDecision = (editor, filenameBase, skinUrl = '') => {
23141
      const skinResourceIdentifier = getSkinUrlOption(editor).getOr('default');
23699
      const resourceKey = getSkinResourceIdentifier(editor).map(identifier => skinIdentifierToResourceKey(identifier, `${ filenameBase }.css`));
23142
      const skinUiCss = 'ui/' + skinResourceIdentifier + '/skin.css';
23700
      const resourceValue = resourceKey.bind(getResourceValue);
-
 
23701
      return lift2(resourceKey, resourceValue, (key, css) => {
-
 
23702
        return {
-
 
23703
          _kind: 'load-raw',
-
 
23704
          key,
-
 
23705
          css
23143
      const css = tinymce.Resource.get(skinUiCss);
23706
        };
-
 
23707
      }).getOrThunk(() => {
23144
      if (isString(css)) {
23708
        const suffix = editor.editorManager.suffix;
23145
        return Promise.resolve(loadRawCss(editor, skinUiCss, css, editor.ui.styleSheetLoader));
23709
        const skinUiCssUrl = skinUrl + `/${ filenameBase }${ suffix }.css`;
-
 
23710
        return {
-
 
23711
          _kind: 'load-stylesheet',
-
 
23712
          url: skinUiCssUrl
-
 
23713
        };
-
 
23714
      });
23146
      } else {
23715
    };
-
 
23716
    const loadUiSkins = (editor, skinUrl) => {
-
 
23717
      const loader = editor.ui.styleSheetLoader;
-
 
23718
      const decision = determineCSSDecision(editor, 'skin', skinUrl);
-
 
23719
      switch (decision._kind) {
-
 
23720
      case 'load-raw':
-
 
23721
        const {key, css} = decision;
-
 
23722
        loadRawCss(editor, key, css, loader);
-
 
23723
        return Promise.resolve();
-
 
23724
      case 'load-stylesheet':
23147
        const skinUiCss = skinUrl + '/skin.min.css';
23725
        const {url} = decision;
-
 
23726
        return loadStylesheet(editor, url, loader);
-
 
23727
      default:
23148
        return loadStylesheet(editor, skinUiCss, editor.ui.styleSheetLoader);
23728
        return Promise.resolve();
23149
      }
23729
      }
23150
    };
23730
    };
23151
    const loadShadowDomUiSkins = async (editor, skinUrl) => {
23731
    const loadShadowDomUiSkins = (editor, skinUrl) => {
23152
      const isInShadowRoot$1 = isInShadowRoot(SugarElement.fromDom(editor.getElement()));
23732
      const isInShadowRoot$1 = isInShadowRoot(SugarElement.fromDom(editor.getElement()));
-
 
23733
      if (!isInShadowRoot$1) {
-
 
23734
        return Promise.resolve();
23153
      if (isInShadowRoot$1) {
23735
      } else {
23154
        const skinResourceIdentifier = getSkinUrlOption(editor).getOr('default');
23736
        const loader = global$8.DOM.styleSheetLoader;
23155
        const shadowDomSkinCss = 'ui/' + skinResourceIdentifier + '/skin.shadowdom.css';
23737
        const decision = determineCSSDecision(editor, 'skin.shadowdom', skinUrl);
23156
        const css = tinymce.Resource.get(shadowDomSkinCss);
23738
        switch (decision._kind) {
-
 
23739
        case 'load-raw':
23157
        if (isString(css)) {
23740
          const {key, css} = decision;
23158
          loadRawCss(editor, shadowDomSkinCss, css, global$7.DOM.styleSheetLoader);
23741
          loadRawCss(editor, key, css, loader);
-
 
23742
          return Promise.resolve();
-
 
23743
        case 'load-stylesheet':
-
 
23744
          const {url} = decision;
-
 
23745
          return loadStylesheet(editor, url, loader);
-
 
23746
        default:
-
 
23747
          return Promise.resolve();
-
 
23748
        }
-
 
23749
      }
-
 
23750
    };
-
 
23751
    const loadUiContentCSS = (editor, isInline, skinUrl) => {
-
 
23752
      const filenameBase = isInline ? 'content.inline' : 'content';
-
 
23753
      const decision = determineCSSDecision(editor, filenameBase, skinUrl);
-
 
23754
      switch (decision._kind) {
-
 
23755
      case 'load-raw':
-
 
23756
        const {key, css} = decision;
-
 
23757
        if (isInline) {
23159
          return Promise.resolve();
23758
          loadRawCss(editor, key, css, editor.ui.styleSheetLoader);
23160
        } else {
23759
        } else {
23161
          const shadowDomSkinCss = skinUrl + '/skin.shadowdom.min.css';
23760
          editor.on('PostRender', () => {
-
 
23761
            loadRawCss(editor, key, css, editor.dom.styleSheetLoader);
23162
          return loadStylesheet(editor, shadowDomSkinCss, global$7.DOM.styleSheetLoader);
23762
          });
-
 
23763
        }
-
 
23764
        return Promise.resolve();
-
 
23765
      case 'load-stylesheet':
-
 
23766
        const {url} = decision;
-
 
23767
        if (skinUrl) {
-
 
23768
          editor.contentCSS.push(url);
-
 
23769
        }
-
 
23770
        return Promise.resolve();
-
 
23771
      default:
23163
        }
23772
        return Promise.resolve();
23164
      }
23773
      }
23165
    };
23774
    };
23166
    const loadUrlSkin = async (isInline, editor) => {
-
 
23167
      getSkinUrlOption(editor).fold(() => {
-
 
23168
        const skinResourceIdentifier = getSkinUrl(editor);
-
 
23169
        if (skinResourceIdentifier) {
-
 
23170
          editor.contentCSS.push(skinResourceIdentifier + (isInline ? '/content.inline' : '/content') + '.min.css');
-
 
23171
        }
-
 
23172
      }, skinUrl => {
-
 
23173
        const skinContentCss = 'ui/' + skinUrl + (isInline ? '/content.inline' : '/content') + '.css';
-
 
23174
        const css = tinymce.Resource.get(skinContentCss);
-
 
23175
        if (isString(css)) {
-
 
23176
          loadRawCss(editor, skinContentCss, css, editor.ui.styleSheetLoader);
-
 
23177
        } else {
-
 
23178
          const skinResourceIdentifier = getSkinUrl(editor);
-
 
23179
          if (skinResourceIdentifier) {
-
 
23180
            editor.contentCSS.push(skinResourceIdentifier + (isInline ? '/content.inline' : '/content') + '.min.css');
-
 
23181
          }
-
 
23182
        }
-
 
23183
      });
23775
    const loadUrlSkin = async (isInline, editor) => {
-
 
23776
      const skinUrl = getSkinUrl(editor);
23184
      const skinUrl = getSkinUrl(editor);
23777
      await loadUiContentCSS(editor, isInline, skinUrl);
23185
      if (!isSkinDisabled(editor) && isString(skinUrl)) {
23778
      if (!isSkinDisabled(editor) && isString(skinUrl)) {
23186
        return Promise.all([
23779
        return Promise.all([
23187
          loadUiSkins(editor, skinUrl),
23780
          loadUiSkins(editor, skinUrl),
23188
          loadShadowDomUiSkins(editor, skinUrl)
23781
          loadShadowDomUiSkins(editor, skinUrl)
Línea 23193... Línea 23786...
23193
      return loadUrlSkin(isInline, editor).then(fireSkinLoaded(editor), fireSkinLoadError(editor, 'Skin could not be loaded'));
23786
      return loadUrlSkin(isInline, editor).then(fireSkinLoaded(editor), fireSkinLoadError(editor, 'Skin could not be loaded'));
23194
    };
23787
    };
23195
    const iframe = curry(loadSkin, false);
23788
    const iframe = curry(loadSkin, false);
23196
    const inline = curry(loadSkin, true);
23789
    const inline = curry(loadSkin, true);
Línea 23197... Línea 23790...
23197
 
23790
 
23198
    const makeTooltipText = (editor, labelWithPlaceholder, value) => editor.translate([
23791
    const makeTooltipText = (editor, labelWithPlaceholder, value) => isEmpty(value) ? editor.translate(labelWithPlaceholder) : editor.translate([
23199
      labelWithPlaceholder,
23792
      labelWithPlaceholder,
23200
      editor.translate(value)
23793
      editor.translate(value)
Línea 23201... Línea 23794...
23201
    ]);
23794
    ]);
Línea 23257... Línea 23850...
23257
      return {
23850
      return {
23258
        validateItems,
23851
        validateItems,
23259
        getFetch
23852
        getFetch
23260
      };
23853
      };
23261
    };
23854
    };
23262
    const createMenuItems = (editor, backstage, spec) => {
23855
    const createMenuItems = (backstage, spec) => {
23263
      const dataset = spec.dataset;
23856
      const dataset = spec.dataset;
23264
      const getStyleItems = dataset.type === 'basic' ? () => map$2(dataset.data, d => processBasic(d, spec.isSelectedFor, spec.getPreviewFor)) : dataset.getData;
23857
      const getStyleItems = dataset.type === 'basic' ? () => map$2(dataset.data, d => processBasic(d, spec.isSelectedFor, spec.getPreviewFor)) : dataset.getData;
23265
      return {
23858
      return {
23266
        items: generateSelectItems(backstage, spec),
23859
        items: generateSelectItems(backstage, spec),
23267
        getStyleItems
23860
        getStyleItems
23268
      };
23861
      };
23269
    };
23862
    };
23270
    const createSelectButton = (editor, backstage, spec, tooltipWithPlaceholder, textUpdateEventName) => {
23863
    const createSelectButton = (editor, backstage, spec, getTooltip, textUpdateEventName, btnName) => {
23271
      const {items, getStyleItems} = createMenuItems(editor, backstage, spec);
23864
      const {items, getStyleItems} = createMenuItems(backstage, spec);
-
 
23865
      const tooltipString = Cell(spec.tooltip);
23272
      const getApi = comp => ({
23866
      const getApi = comp => ({
23273
        getComponent: constant$1(comp),
23867
        getComponent: constant$1(comp),
23274
        setTooltip: tooltip => {
23868
        setTooltip: tooltip => {
23275
          const translatedTooltip = backstage.shared.providers.translate(tooltip);
23869
          const translatedTooltip = backstage.shared.providers.translate(tooltip);
23276
          setAll$1(comp.element, {
-
 
23277
            'aria-label': translatedTooltip,
23870
          set$9(comp.element, 'aria-label', translatedTooltip);
23278
            'title': translatedTooltip
23871
          tooltipString.set(tooltip);
23279
          });
-
 
23280
        }
23872
        }
23281
      });
23873
      });
23282
      const onSetup = api => {
23874
      const onSetup = api => {
23283
        const handler = e => api.setTooltip(makeTooltipText(editor, tooltipWithPlaceholder, e.value));
23875
        const handler = e => api.setTooltip(makeTooltipText(editor, getTooltip(e.value), e.value));
23284
        editor.on(textUpdateEventName, handler);
23876
        editor.on(textUpdateEventName, handler);
23285
        return composeUnbinders(onSetupEvent(editor, 'NodeChange', api => {
23877
        return composeUnbinders(onSetupEvent(editor, 'NodeChange', api => {
23286
          const comp = api.getComponent();
23878
          const comp = api.getComponent();
23287
          spec.updateText(comp);
23879
          spec.updateText(comp);
23288
          Disabling.set(api.getComponent(), !editor.selection.isEditable());
23880
          Disabling.set(api.getComponent(), !editor.selection.isEditable());
23289
        })(api), () => editor.off(textUpdateEventName, handler));
23881
        })(api), () => editor.off(textUpdateEventName, handler));
23290
      };
23882
      };
23291
      return renderCommonDropdown({
23883
      return renderCommonDropdown({
-
 
23884
        context: 'mode:design',
23292
        text: spec.icon.isSome() ? Optional.none() : spec.text,
23885
        text: spec.icon.isSome() ? Optional.none() : spec.text,
23293
        icon: spec.icon,
23886
        icon: spec.icon,
23294
        tooltip: Optional.from(spec.tooltip),
23887
        ariaLabel: Optional.some(spec.tooltip),
-
 
23888
        tooltip: Optional.none(),
23295
        role: Optional.none(),
23889
        role: Optional.none(),
23296
        fetch: items.getFetch(backstage, getStyleItems),
23890
        fetch: items.getFetch(backstage, getStyleItems),
23297
        onSetup,
23891
        onSetup,
23298
        getApi,
23892
        getApi,
23299
        columns: 1,
23893
        columns: 1,
23300
        presets: 'normal',
23894
        presets: 'normal',
23301
        classes: spec.icon.isSome() ? [] : ['bespoke'],
23895
        classes: spec.icon.isSome() ? [] : ['bespoke'],
23302
        dropdownBehaviours: []
23896
        dropdownBehaviours: [Tooltipping.config({
-
 
23897
            ...backstage.shared.providers.tooltips.getConfig({
-
 
23898
              tooltipText: backstage.shared.providers.translate(spec.tooltip),
-
 
23899
              onShow: comp => {
-
 
23900
                if (spec.tooltip !== tooltipString.get()) {
-
 
23901
                  const translatedTooltip = backstage.shared.providers.translate(tooltipString.get());
-
 
23902
                  Tooltipping.setComponents(comp, backstage.shared.providers.tooltips.getComponents({ tooltipText: translatedTooltip }));
-
 
23903
                }
-
 
23904
              }
-
 
23905
            })
-
 
23906
          })]
23303
      }, 'tox-tbtn', backstage.shared);
23907
      }, 'tox-tbtn', backstage.shared, btnName);
23304
    };
23908
    };
Línea 23305... Línea 23909...
23305
 
23909
 
23306
    const process = rawFormats => map$2(rawFormats, item => {
23910
    const process = rawFormats => map$2(rawFormats, item => {
23307
      let title = item, format = item;
23911
      let title = item, format = item;
Línea 23339... Línea 23943...
23339
        data
23943
        data
23340
      };
23944
      };
23341
    };
23945
    };
Línea 23342... Línea 23946...
23342
 
23946
 
23343
    const menuTitle$4 = 'Align';
23947
    const menuTitle$4 = 'Align';
23344
    const btnTooltip$4 = 'Alignment {0}';
23948
    const getTooltipPlaceholder$4 = constant$1('Alignment {0}');
23345
    const fallbackAlignment = 'left';
23949
    const fallbackAlignment = 'left';
23346
    const alignMenuItems = [
23950
    const alignMenuItems = [
23347
      {
23951
      {
23348
        title: 'Left',
23952
        title: 'Left',
Línea 23380... Línea 23984...
23380
        fireAlignTextUpdate(editor, { value: alignment });
23984
        fireAlignTextUpdate(editor, { value: alignment });
23381
      };
23985
      };
23382
      const dataset = buildBasicStaticDataset(alignMenuItems);
23986
      const dataset = buildBasicStaticDataset(alignMenuItems);
23383
      const onAction = rawItem => () => find$5(alignMenuItems, item => item.format === rawItem.format).each(item => editor.execCommand(item.command));
23987
      const onAction = rawItem => () => find$5(alignMenuItems, item => item.format === rawItem.format).each(item => editor.execCommand(item.command));
23384
      return {
23988
      return {
23385
        tooltip: makeTooltipText(editor, btnTooltip$4, fallbackAlignment),
23989
        tooltip: makeTooltipText(editor, getTooltipPlaceholder$4(), fallbackAlignment),
23386
        text: Optional.none(),
23990
        text: Optional.none(),
23387
        icon: Optional.some('align-left'),
23991
        icon: Optional.some('align-left'),
23388
        isSelectedFor,
23992
        isSelectedFor,
23389
        getCurrentValue: Optional.none,
23993
        getCurrentValue: Optional.none,
23390
        getPreviewFor,
23994
        getPreviewFor,
Línea 23393... Línea 23997...
23393
        dataset,
23997
        dataset,
23394
        shouldHide: false,
23998
        shouldHide: false,
23395
        isInvalid: item => !editor.formatter.canApply(item.format)
23999
        isInvalid: item => !editor.formatter.canApply(item.format)
23396
      };
24000
      };
23397
    };
24001
    };
23398
    const createAlignButton = (editor, backstage) => createSelectButton(editor, backstage, getSpec$4(editor), btnTooltip$4, 'AlignTextUpdate');
24002
    const createAlignButton = (editor, backstage) => createSelectButton(editor, backstage, getSpec$4(editor), getTooltipPlaceholder$4, 'AlignTextUpdate', 'align');
23399
    const createAlignMenu = (editor, backstage) => {
24003
    const createAlignMenu = (editor, backstage) => {
23400
      const menuItems = createMenuItems(editor, backstage, getSpec$4(editor));
24004
      const menuItems = createMenuItems(backstage, getSpec$4(editor));
23401
      editor.ui.registry.addNestedMenuItem('align', {
24005
      editor.ui.registry.addNestedMenuItem('align', {
23402
        text: backstage.shared.providers.translate(menuTitle$4),
24006
        text: backstage.shared.providers.translate(menuTitle$4),
23403
        onSetup: onSetupEditableToggle(editor),
24007
        onSetup: onSetupEditableToggle(editor),
23404
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
24008
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
23405
      });
24009
      });
23406
    };
24010
    };
Línea 23407... Línea 24011...
23407
 
24011
 
23408
    const findNearest = (editor, getStyles) => {
24012
    const findNearest = (editor, getStyles) => {
23409
      const styles = getStyles();
24013
      const styles = getStyles();
23410
      const formats = map$2(styles, style => style.format);
24014
      const formats = map$2(styles, style => style.format);
23411
      return Optional.from(editor.formatter.closest(formats)).bind(fmt => find$5(styles, data => data.format === fmt)).orThunk(() => someIf(editor.formatter.match('p'), {
-
 
23412
        title: 'Paragraph',
-
 
23413
        format: 'p'
-
 
23414
      }));
24015
      return Optional.from(editor.formatter.closest(formats)).bind(fmt => find$5(styles, data => data.format === fmt));
Línea 23415... Línea 24016...
23415
    };
24016
    };
23416
 
24017
 
23417
    const menuTitle$3 = 'Blocks';
24018
    const menuTitle$3 = 'Blocks';
23418
    const btnTooltip$3 = 'Block {0}';
24019
    const getTooltipPlaceholder$3 = constant$1('Block {0}');
23419
    const fallbackFormat = 'Paragraph';
24020
    const fallbackFormat = 'Paragraph';
23420
    const getSpec$3 = editor => {
24021
    const getSpec$3 = editor => {
23421
      const isSelectedFor = format => () => editor.formatter.match(format);
24022
      const isSelectedFor = format => () => editor.formatter.match(format);
Línea 23436... Línea 24037...
23436
        emitWith(comp, updateMenuText, { text });
24037
        emitWith(comp, updateMenuText, { text });
23437
        fireBlocksTextUpdate(editor, { value: text });
24038
        fireBlocksTextUpdate(editor, { value: text });
23438
      };
24039
      };
23439
      const dataset = buildBasicSettingsDataset(editor, 'block_formats', Delimiter.SemiColon);
24040
      const dataset = buildBasicSettingsDataset(editor, 'block_formats', Delimiter.SemiColon);
23440
      return {
24041
      return {
23441
        tooltip: makeTooltipText(editor, btnTooltip$3, fallbackFormat),
24042
        tooltip: makeTooltipText(editor, getTooltipPlaceholder$3(), fallbackFormat),
23442
        text: Optional.some(fallbackFormat),
24043
        text: Optional.some(fallbackFormat),
23443
        icon: Optional.none(),
24044
        icon: Optional.none(),
23444
        isSelectedFor,
24045
        isSelectedFor,
23445
        getCurrentValue: Optional.none,
24046
        getCurrentValue: Optional.none,
23446
        getPreviewFor,
24047
        getPreviewFor,
Línea 23449... Línea 24050...
23449
        dataset,
24050
        dataset,
23450
        shouldHide: false,
24051
        shouldHide: false,
23451
        isInvalid: item => !editor.formatter.canApply(item.format)
24052
        isInvalid: item => !editor.formatter.canApply(item.format)
23452
      };
24053
      };
23453
    };
24054
    };
23454
    const createBlocksButton = (editor, backstage) => createSelectButton(editor, backstage, getSpec$3(editor), btnTooltip$3, 'BlocksTextUpdate');
24055
    const createBlocksButton = (editor, backstage) => createSelectButton(editor, backstage, getSpec$3(editor), getTooltipPlaceholder$3, 'BlocksTextUpdate', 'blocks');
23455
    const createBlocksMenu = (editor, backstage) => {
24056
    const createBlocksMenu = (editor, backstage) => {
23456
      const menuItems = createMenuItems(editor, backstage, getSpec$3(editor));
24057
      const menuItems = createMenuItems(backstage, getSpec$3(editor));
23457
      editor.ui.registry.addNestedMenuItem('blocks', {
24058
      editor.ui.registry.addNestedMenuItem('blocks', {
23458
        text: menuTitle$3,
24059
        text: menuTitle$3,
23459
        onSetup: onSetupEditableToggle(editor),
24060
        onSetup: onSetupEditableToggle(editor),
23460
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
24061
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
23461
      });
24062
      });
23462
    };
24063
    };
Línea 23463... Línea 24064...
23463
 
24064
 
23464
    const menuTitle$2 = 'Fonts';
24065
    const menuTitle$2 = 'Fonts';
23465
    const btnTooltip$2 = 'Font {0}';
24066
    const getTooltipPlaceholder$2 = constant$1('Font {0}');
23466
    const systemFont = 'System Font';
24067
    const systemFont = 'System Font';
23467
    const systemStackFonts = [
24068
    const systemStackFonts = [
23468
      '-apple-system',
24069
      '-apple-system',
23469
      'Segoe UI',
24070
      'Segoe UI',
Línea 23526... Línea 24127...
23526
        emitWith(comp, updateMenuText, { text });
24127
        emitWith(comp, updateMenuText, { text });
23527
        fireFontFamilyTextUpdate(editor, { value: text });
24128
        fireFontFamilyTextUpdate(editor, { value: text });
23528
      };
24129
      };
23529
      const dataset = buildBasicSettingsDataset(editor, 'font_family_formats', Delimiter.SemiColon);
24130
      const dataset = buildBasicSettingsDataset(editor, 'font_family_formats', Delimiter.SemiColon);
23530
      return {
24131
      return {
23531
        tooltip: makeTooltipText(editor, btnTooltip$2, systemFont),
24132
        tooltip: makeTooltipText(editor, getTooltipPlaceholder$2(), systemFont),
23532
        text: Optional.some(systemFont),
24133
        text: Optional.some(systemFont),
23533
        icon: Optional.none(),
24134
        icon: Optional.none(),
23534
        isSelectedFor,
24135
        isSelectedFor,
23535
        getCurrentValue,
24136
        getCurrentValue,
23536
        getPreviewFor,
24137
        getPreviewFor,
Línea 23539... Línea 24140...
23539
        dataset,
24140
        dataset,
23540
        shouldHide: false,
24141
        shouldHide: false,
23541
        isInvalid: never
24142
        isInvalid: never
23542
      };
24143
      };
23543
    };
24144
    };
23544
    const createFontFamilyButton = (editor, backstage) => createSelectButton(editor, backstage, getSpec$2(editor), btnTooltip$2, 'FontFamilyTextUpdate');
24145
    const createFontFamilyButton = (editor, backstage) => createSelectButton(editor, backstage, getSpec$2(editor), getTooltipPlaceholder$2, 'FontFamilyTextUpdate', 'fontfamily');
23545
    const createFontFamilyMenu = (editor, backstage) => {
24146
    const createFontFamilyMenu = (editor, backstage) => {
23546
      const menuItems = createMenuItems(editor, backstage, getSpec$2(editor));
24147
      const menuItems = createMenuItems(backstage, getSpec$2(editor));
23547
      editor.ui.registry.addNestedMenuItem('fontfamily', {
24148
      editor.ui.registry.addNestedMenuItem('fontfamily', {
23548
        text: backstage.shared.providers.translate(menuTitle$2),
24149
        text: backstage.shared.providers.translate(menuTitle$2),
23549
        onSetup: onSetupEditableToggle(editor),
24150
        onSetup: onSetupEditableToggle(editor),
23550
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
24151
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
23551
      });
24152
      });
Línea 23630... Línea 24231...
23630
      end: constant$1(35),
24231
      end: constant$1(35),
23631
      pageUp: constant$1(33),
24232
      pageUp: constant$1(33),
23632
      pageDown: constant$1(34)
24233
      pageDown: constant$1(34)
23633
    };
24234
    };
Línea 23634... Línea 24235...
23634
 
24235
 
23635
    const createBespokeNumberInput = (editor, backstage, spec) => {
24236
    const createBespokeNumberInput = (editor, backstage, spec, btnName) => {
23636
      let currentComp = Optional.none();
24237
      let currentComp = Optional.none();
23637
      const getValueFromCurrentComp = comp => comp.map(alloyComp => Representing.getValue(alloyComp)).getOr('');
24238
      const getValueFromCurrentComp = comp => comp.map(alloyComp => Representing.getValue(alloyComp)).getOr('');
23638
      const onSetup = onSetupEvent(editor, 'NodeChange SwitchMode', api => {
24239
      const onSetup = onSetupEvent(editor, 'NodeChange SwitchMode DisabledStateChange', api => {
23639
        const comp = api.getComponent();
24240
        const comp = api.getComponent();
23640
        currentComp = Optional.some(comp);
24241
        currentComp = Optional.some(comp);
23641
        spec.updateInputValue(comp);
24242
        spec.updateInputValue(comp);
23642
        Disabling.set(comp, !editor.selection.isEditable());
24243
        Disabling.set(comp, !editor.selection.isEditable() || isDisabled(editor));
23643
      });
24244
      });
23644
      const getApi = comp => ({ getComponent: constant$1(comp) });
24245
      const getApi = comp => ({ getComponent: constant$1(comp) });
23645
      const editorOffCell = Cell(noop);
24246
      const editorOffCell = Cell(noop);
23646
      const customEvents = generate$6('custom-number-input-events');
24247
      const customEvents = generate$6('custom-number-input-events');
Línea 23675... Línea 24276...
23675
      };
24276
      };
23676
      const makeStepperButton = (action, title, tooltip, classes) => {
24277
      const makeStepperButton = (action, title, tooltip, classes) => {
23677
        const editorOffCellStepButton = Cell(noop);
24278
        const editorOffCellStepButton = Cell(noop);
23678
        const translatedTooltip = backstage.shared.providers.translate(tooltip);
24279
        const translatedTooltip = backstage.shared.providers.translate(tooltip);
23679
        const altExecuting = generate$6('altExecuting');
24280
        const altExecuting = generate$6('altExecuting');
23680
        const onSetup = onSetupEvent(editor, 'NodeChange SwitchMode', api => {
24281
        const onSetup = onSetupEvent(editor, 'NodeChange SwitchMode DisabledStateChange', api => {
23681
          Disabling.set(api.getComponent(), !editor.selection.isEditable());
24282
          Disabling.set(api.getComponent(), !editor.selection.isEditable() || isDisabled(editor));
23682
        });
24283
        });
23683
        const onClick = comp => {
24284
        const onClick = comp => {
23684
          if (!Disabling.isDisabled(comp)) {
24285
          if (!Disabling.isDisabled(comp)) {
23685
            action(true);
24286
            action(true);
23686
          }
24287
          }
23687
        };
24288
        };
23688
        return Button.sketch({
24289
        return Button.sketch({
23689
          dom: {
24290
          dom: {
23690
            tag: 'button',
24291
            tag: 'button',
23691
            attributes: {
24292
            attributes: {
23692
              'title': translatedTooltip,
24293
              'aria-label': translatedTooltip,
23693
              'aria-label': translatedTooltip
24294
              'data-mce-name': title
23694
            },
24295
            },
23695
            classes: classes.concat(title)
24296
            classes: classes.concat(title)
23696
          },
24297
          },
23697
          components: [renderIconFromPack$1(title, backstage.shared.providers.icons)],
24298
          components: [renderIconFromPack$1(title, backstage.shared.providers.icons)],
23698
          buttonBehaviours: derive$1([
24299
          buttonBehaviours: derive$1([
23699
            Disabling.config({}),
24300
            Disabling.config({}),
-
 
24301
            Tooltipping.config(backstage.shared.providers.tooltips.getConfig({ tooltipText: translatedTooltip })),
23700
            config(altExecuting, [
24302
            config(altExecuting, [
23701
              onControlAttached({
24303
              onControlAttached({
23702
                onSetup,
24304
                onSetup,
23703
                getApi
24305
                getApi
23704
              }, editorOffCellStepButton),
24306
              }, editorOffCellStepButton),
Línea 23724... Línea 24326...
23724
              'alloy.base.behaviour'
24326
              'alloy.base.behaviour'
23725
            ],
24327
            ],
23726
            [touchend()]: [
24328
            [touchend()]: [
23727
              altExecuting,
24329
              altExecuting,
23728
              'alloy.base.behaviour'
24330
              'alloy.base.behaviour'
-
 
24331
            ],
-
 
24332
            [attachedToDom()]: [
-
 
24333
              'alloy.base.behaviour',
-
 
24334
              altExecuting,
-
 
24335
              'tooltipping'
-
 
24336
            ],
-
 
24337
            [detachedFromDom()]: [
-
 
24338
              altExecuting,
-
 
24339
              'tooltipping'
23729
            ]
24340
            ]
23730
          }
24341
          }
23731
        });
24342
        });
23732
      };
24343
      };
23733
      const memMinus = record(makeStepperButton(focusBack => decrease(false, focusBack), 'minus', 'Decrease font size', []));
24344
      const memMinus = record(makeStepperButton(focusBack => decrease(false, focusBack), 'minus', 'Decrease font size', []));
Línea 23806... Línea 24417...
23806
        ])
24417
        ])
23807
      });
24418
      });
23808
      return {
24419
      return {
23809
        dom: {
24420
        dom: {
23810
          tag: 'div',
24421
          tag: 'div',
23811
          classes: ['tox-number-input']
24422
          classes: ['tox-number-input'],
-
 
24423
          attributes: { ...isNonNullable(btnName) ? { 'data-mce-name': btnName } : {} }
23812
        },
24424
        },
23813
        components: [
24425
        components: [
23814
          memMinus.asSpec(),
24426
          memMinus.asSpec(),
23815
          memInput.asSpec(),
24427
          memInput.asSpec(),
23816
          memPlus.asSpec()
24428
          memPlus.asSpec()
Línea 23834... Línea 24446...
23834
        ])
24446
        ])
23835
      };
24447
      };
23836
    };
24448
    };
Línea 23837... Línea 24449...
23837
 
24449
 
23838
    const menuTitle$1 = 'Font sizes';
24450
    const menuTitle$1 = 'Font sizes';
23839
    const btnTooltip$1 = 'Font size {0}';
24451
    const getTooltipPlaceholder$1 = constant$1('Font size {0}');
23840
    const fallbackFontSize = '12pt';
24452
    const fallbackFontSize = '12pt';
23841
    const legacyFontSizes = {
24453
    const legacyFontSizes = {
23842
      '8pt': '1',
24454
      '8pt': '1',
23843
      '10pt': '2',
24455
      '10pt': '2',
Línea 23862... Línea 24474...
23862
    };
24474
    };
23863
    const toPt = (fontSize, precision) => {
24475
    const toPt = (fontSize, precision) => {
23864
      if (/[0-9.]+px$/.test(fontSize)) {
24476
      if (/[0-9.]+px$/.test(fontSize)) {
23865
        return round(parseInt(fontSize, 10) * 72 / 96, precision || 0) + 'pt';
24477
        return round(parseInt(fontSize, 10) * 72 / 96, precision || 0) + 'pt';
23866
      } else {
24478
      } else {
23867
        return get$g(keywordFontSizes, fontSize).getOr(fontSize);
24479
        return get$h(keywordFontSizes, fontSize).getOr(fontSize);
23868
      }
24480
      }
23869
    };
24481
    };
23870
    const toLegacy = fontSize => get$g(legacyFontSizes, fontSize).getOr('');
24482
    const toLegacy = fontSize => get$h(legacyFontSizes, fontSize).getOr('');
23871
    const getSpec$1 = editor => {
24483
    const getSpec$1 = editor => {
23872
      const getMatchingValue = () => {
24484
      const getMatchingValue = () => {
23873
        let matchOpt = Optional.none();
24485
        let matchOpt = Optional.none();
23874
        const items = dataset.data;
24486
        const items = dataset.data;
23875
        const fontSize = editor.queryCommandValue('FontSize');
24487
        const fontSize = editor.queryCommandValue('FontSize');
Línea 23903... Línea 24515...
23903
        emitWith(comp, updateMenuText, { text });
24515
        emitWith(comp, updateMenuText, { text });
23904
        fireFontSizeTextUpdate(editor, { value: text });
24516
        fireFontSizeTextUpdate(editor, { value: text });
23905
      };
24517
      };
23906
      const dataset = buildBasicSettingsDataset(editor, 'font_size_formats', Delimiter.Space);
24518
      const dataset = buildBasicSettingsDataset(editor, 'font_size_formats', Delimiter.Space);
23907
      return {
24519
      return {
23908
        tooltip: makeTooltipText(editor, btnTooltip$1, fallbackFontSize),
24520
        tooltip: makeTooltipText(editor, getTooltipPlaceholder$1(), fallbackFontSize),
23909
        text: Optional.some(fallbackFontSize),
24521
        text: Optional.some(fallbackFontSize),
23910
        icon: Optional.none(),
24522
        icon: Optional.none(),
23911
        isSelectedFor,
24523
        isSelectedFor,
23912
        getPreviewFor,
24524
        getPreviewFor,
23913
        getCurrentValue,
24525
        getCurrentValue,
Línea 23916... Línea 24528...
23916
        dataset,
24528
        dataset,
23917
        shouldHide: false,
24529
        shouldHide: false,
23918
        isInvalid: never
24530
        isInvalid: never
23919
      };
24531
      };
23920
    };
24532
    };
23921
    const createFontSizeButton = (editor, backstage) => createSelectButton(editor, backstage, getSpec$1(editor), btnTooltip$1, 'FontSizeTextUpdate');
24533
    const createFontSizeButton = (editor, backstage) => createSelectButton(editor, backstage, getSpec$1(editor), getTooltipPlaceholder$1, 'FontSizeTextUpdate', 'fontsize');
23922
    const getConfigFromUnit = unit => {
24534
    const getConfigFromUnit = unit => {
23923
      var _a;
24535
      var _a;
23924
      const baseConfig = { step: 1 };
24536
      const baseConfig = { step: 1 };
23925
      const configs = {
24537
      const configs = {
23926
        em: { step: 0.1 },
24538
        em: { step: 0.1 },
Línea 23963... Línea 24575...
23963
          }
24575
          }
23964
          return res;
24576
          return res;
23965
        }
24577
        }
23966
      };
24578
      };
23967
    };
24579
    };
23968
    const createFontSizeInputButton = (editor, backstage) => createBespokeNumberInput(editor, backstage, getNumberInputSpec(editor));
24580
    const createFontSizeInputButton = (editor, backstage) => createBespokeNumberInput(editor, backstage, getNumberInputSpec(editor), 'fontsizeinput');
23969
    const createFontSizeMenu = (editor, backstage) => {
24581
    const createFontSizeMenu = (editor, backstage) => {
23970
      const menuItems = createMenuItems(editor, backstage, getSpec$1(editor));
24582
      const menuItems = createMenuItems(backstage, getSpec$1(editor));
23971
      editor.ui.registry.addNestedMenuItem('fontsize', {
24583
      editor.ui.registry.addNestedMenuItem('fontsize', {
23972
        text: menuTitle$1,
24584
        text: menuTitle$1,
23973
        onSetup: onSetupEditableToggle(editor),
24585
        onSetup: onSetupEditableToggle(editor),
23974
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
24586
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
23975
      });
24587
      });
23976
    };
24588
    };
Línea 23977... Línea 24589...
23977
 
24589
 
23978
    const menuTitle = 'Formats';
24590
    const menuTitle = 'Formats';
23979
    const btnTooltip = 'Format {0}';
24591
    const getTooltipPlaceholder = value => isEmpty(value) ? 'Formats' : 'Format {0}';
23980
    const getSpec = (editor, dataset) => {
24592
    const getSpec = (editor, dataset) => {
23981
      const fallbackFormat = 'Paragraph';
24593
      const fallbackFormat = 'Formats';
23982
      const isSelectedFor = format => () => editor.formatter.match(format);
24594
      const isSelectedFor = format => () => editor.formatter.match(format);
23983
      const getPreviewFor = format => () => {
24595
      const getPreviewFor = format => () => {
23984
        const fmt = editor.formatter.get(format);
24596
        const fmt = editor.formatter.get(format);
23985
        return fmt !== undefined ? Optional.some({
24597
        return fmt !== undefined ? Optional.some({
Línea 24000... Línea 24612...
24000
            return [];
24612
            return [];
24001
          }
24613
          }
24002
        };
24614
        };
24003
        const flattenedItems = bind$3(getStyleFormats(editor), getFormatItems);
24615
        const flattenedItems = bind$3(getStyleFormats(editor), getFormatItems);
24004
        const detectedFormat = findNearest(editor, constant$1(flattenedItems));
24616
        const detectedFormat = findNearest(editor, constant$1(flattenedItems));
24005
        const text = detectedFormat.fold(constant$1(fallbackFormat), fmt => fmt.title);
24617
        const text = detectedFormat.fold(constant$1({
-
 
24618
          title: fallbackFormat,
-
 
24619
          tooltipLabel: ''
-
 
24620
        }), fmt => ({
-
 
24621
          title: fmt.title,
-
 
24622
          tooltipLabel: fmt.title
-
 
24623
        }));
24006
        emitWith(comp, updateMenuText, { text });
24624
        emitWith(comp, updateMenuText, { text: text.title });
24007
        fireStylesTextUpdate(editor, { value: text });
24625
        fireStylesTextUpdate(editor, { value: text.tooltipLabel });
24008
      };
24626
      };
24009
      return {
24627
      return {
24010
        tooltip: makeTooltipText(editor, btnTooltip, fallbackFormat),
24628
        tooltip: makeTooltipText(editor, getTooltipPlaceholder(''), ''),
24011
        text: Optional.some(fallbackFormat),
24629
        text: Optional.some(fallbackFormat),
24012
        icon: Optional.none(),
24630
        icon: Optional.none(),
24013
        isSelectedFor,
24631
        isSelectedFor,
24014
        getCurrentValue: Optional.none,
24632
        getCurrentValue: Optional.none,
24015
        getPreviewFor,
24633
        getPreviewFor,
Línea 24023... Línea 24641...
24023
    const createStylesButton = (editor, backstage) => {
24641
    const createStylesButton = (editor, backstage) => {
24024
      const dataset = {
24642
      const dataset = {
24025
        type: 'advanced',
24643
        type: 'advanced',
24026
        ...backstage.styles
24644
        ...backstage.styles
24027
      };
24645
      };
24028
      return createSelectButton(editor, backstage, getSpec(editor, dataset), btnTooltip, 'StylesTextUpdate');
24646
      return createSelectButton(editor, backstage, getSpec(editor, dataset), getTooltipPlaceholder, 'StylesTextUpdate', 'styles');
24029
    };
24647
    };
24030
    const createStylesMenu = (editor, backstage) => {
24648
    const createStylesMenu = (editor, backstage) => {
24031
      const dataset = {
24649
      const dataset = {
24032
        type: 'advanced',
24650
        type: 'advanced',
24033
        ...backstage.styles
24651
        ...backstage.styles
24034
      };
24652
      };
24035
      const menuItems = createMenuItems(editor, backstage, getSpec(editor, dataset));
24653
      const menuItems = createMenuItems(backstage, getSpec(editor, dataset));
24036
      editor.ui.registry.addNestedMenuItem('styles', {
24654
      editor.ui.registry.addNestedMenuItem('styles', {
24037
        text: menuTitle,
24655
        text: menuTitle,
24038
        onSetup: onSetupEditableToggle(editor),
24656
        onSetup: onSetupEditableToggle(editor),
24039
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
24657
        getSubmenuItems: () => menuItems.items.validateItems(menuItems.getStyleItems())
24040
      });
24658
      });
Línea 24057... Línea 24675...
24057
        Focusing
24675
        Focusing
24058
      ]),
24676
      ]),
24059
      defaulted('matchWidth', false),
24677
      defaulted('matchWidth', false),
24060
      defaulted('useMinWidth', false),
24678
      defaulted('useMinWidth', false),
24061
      defaulted('eventOrder', {}),
24679
      defaulted('eventOrder', {}),
24062
      option$3('role')
24680
      option$3('role'),
-
 
24681
      option$3('listRole')
24063
    ].concat(sandboxFields()));
24682
    ].concat(sandboxFields()));
24064
    const arrowPart = required({
24683
    const arrowPart = required({
24065
      factory: Button,
24684
      factory: Button,
24066
      schema: [required$1('dom')],
24685
      schema: [required$1('dom')],
24067
      name: 'arrow',
24686
      name: 'arrow',
Línea 24168... Línea 24787...
24168
              const descriptorId = generate$6('aria');
24787
              const descriptorId = generate$6('aria');
24169
              set$9(descriptor.element, 'id', descriptorId);
24788
              set$9(descriptor.element, 'id', descriptorId);
24170
              set$9(component.element, 'aria-describedby', descriptorId);
24789
              set$9(component.element, 'aria-describedby', descriptorId);
24171
            });
24790
            });
24172
          })]),
24791
          })]),
24173
        ...events$a(Optional.some(action))
24792
        ...events$9(Optional.some(action))
24174
      };
24793
      };
24175
      const apis = {
24794
      const apis = {
24176
        repositionMenus: comp => {
24795
        repositionMenus: comp => {
24177
          if (Toggling.isOn(comp)) {
24796
          if (Toggling.isOn(comp)) {
24178
            repositionMenus(comp);
24797
            repositionMenus(comp);
Línea 24254... Línea 24873...
24254
      isEnabled: () => !Disabling.isDisabled(component),
24873
      isEnabled: () => !Disabling.isDisabled(component),
24255
      setEnabled: state => Disabling.set(component, !state),
24874
      setEnabled: state => Disabling.set(component, !state),
24256
      setText: text => emitWith(component, updateMenuText, { text }),
24875
      setText: text => emitWith(component, updateMenuText, { text }),
24257
      setIcon: icon => emitWith(component, updateMenuIcon, { icon })
24876
      setIcon: icon => emitWith(component, updateMenuIcon, { icon })
24258
    });
24877
    });
24259
    const getTooltipAttributes = (tooltip, providersBackstage) => tooltip.map(tooltip => ({
24878
    const getTooltipAttributes = (tooltip, providersBackstage) => tooltip.map(tooltip => ({ 'aria-label': providersBackstage.translate(tooltip) })).getOr({});
24260
      'aria-label': providersBackstage.translate(tooltip),
-
 
24261
      'title': providersBackstage.translate(tooltip)
-
 
24262
    })).getOr({});
-
 
24263
    const focusButtonEvent = generate$6('focus-button');
24879
    const focusButtonEvent = generate$6('focus-button');
24264
    const renderCommonStructure = (optIcon, optText, tooltip, behaviours, providersBackstage) => {
24880
    const renderCommonStructure = (optIcon, optText, tooltip, behaviours, providersBackstage, context, btnName) => {
24265
      const optMemDisplayText = optText.map(text => record(renderLabel$1(text, 'tox-tbtn', providersBackstage)));
24881
      const optMemDisplayText = optText.map(text => record(renderLabel$1(text, 'tox-tbtn', providersBackstage)));
24266
      const optMemDisplayIcon = optIcon.map(icon => record(renderReplaceableIconFromPack(icon, providersBackstage.icons)));
24882
      const optMemDisplayIcon = optIcon.map(icon => record(renderReplaceableIconFromPack(icon, providersBackstage.icons)));
24267
      return {
24883
      return {
24268
        dom: {
24884
        dom: {
24269
          tag: 'button',
24885
          tag: 'button',
24270
          classes: ['tox-tbtn'].concat(optText.isSome() ? ['tox-tbtn--select'] : []),
24886
          classes: ['tox-tbtn'].concat(optText.isSome() ? ['tox-tbtn--select'] : []),
-
 
24887
          attributes: {
24271
          attributes: getTooltipAttributes(tooltip, providersBackstage)
24888
            ...getTooltipAttributes(tooltip, providersBackstage),
-
 
24889
            ...isNonNullable(btnName) ? { 'data-mce-name': btnName } : {}
-
 
24890
          }
24272
        },
24891
        },
24273
        components: componentRenderPipeline([
24892
        components: componentRenderPipeline([
24274
          optMemDisplayIcon.map(mem => mem.asSpec()),
24893
          optMemDisplayIcon.map(mem => mem.asSpec()),
24275
          optMemDisplayText.map(mem => mem.asSpec())
24894
          optMemDisplayText.map(mem => mem.asSpec())
24276
        ]),
24895
        ]),
Línea 24281... Línea 24900...
24281
            commonButtonDisplayEvent
24900
            commonButtonDisplayEvent
24282
          ],
24901
          ],
24283
          [attachedToDom()]: [
24902
          [attachedToDom()]: [
24284
            commonButtonDisplayEvent,
24903
            commonButtonDisplayEvent,
24285
            'toolbar-group-button-events'
24904
            'toolbar-group-button-events'
-
 
24905
          ],
-
 
24906
          [detachedFromDom()]: [
-
 
24907
            commonButtonDisplayEvent,
-
 
24908
            'toolbar-group-button-events',
-
 
24909
            'tooltipping'
24286
          ]
24910
          ]
24287
        },
24911
        },
24288
        buttonBehaviours: derive$1([
24912
        buttonBehaviours: derive$1([
24289
          DisablingConfigs.toolbarButton(providersBackstage.isDisabled),
24913
          DisablingConfigs.toolbarButton(() => providersBackstage.checkUiComponentContext(context).shouldDisable),
24290
          receivingConfig(),
24914
          toggleOnReceive(() => providersBackstage.checkUiComponentContext(context)),
24291
          config(commonButtonDisplayEvent, [
24915
          config(commonButtonDisplayEvent, [
24292
            runOnAttached((comp, _se) => forceInitialSize(comp)),
24916
            runOnAttached((comp, _se) => forceInitialSize(comp)),
24293
            run$1(updateMenuText, (comp, se) => {
24917
            run$1(updateMenuText, (comp, se) => {
24294
              optMemDisplayText.bind(mem => mem.getOpt(comp)).each(displayText => {
24918
              optMemDisplayText.bind(mem => mem.getOpt(comp)).each(displayText => {
24295
                Replacing.set(displayText, [text$2(providersBackstage.translate(se.event.text))]);
24919
                Replacing.set(displayText, [text$2(providersBackstage.translate(se.event.text))]);
Línea 24306... Línea 24930...
24306
            })
24930
            })
24307
          ])
24931
          ])
24308
        ].concat(behaviours.getOr([])))
24932
        ].concat(behaviours.getOr([])))
24309
      };
24933
      };
24310
    };
24934
    };
24311
    const renderFloatingToolbarButton = (spec, backstage, identifyButtons, attributes) => {
24935
    const renderFloatingToolbarButton = (spec, backstage, identifyButtons, attributes, btnName) => {
24312
      const sharedBackstage = backstage.shared;
24936
      const sharedBackstage = backstage.shared;
24313
      const editorOffCell = Cell(noop);
24937
      const editorOffCell = Cell(noop);
24314
      const specialisation = {
24938
      const specialisation = {
24315
        toolbarButtonBehaviours: [],
24939
        toolbarButtonBehaviours: [],
24316
        getApi: getButtonApi,
24940
        getApi: getButtonApi,
24317
        onSetup: spec.onSetup
24941
        onSetup: spec.onSetup
24318
      };
24942
      };
-
 
24943
      const behaviours = [
24319
      const behaviours = [config('toolbar-group-button-events', [
24944
        config('toolbar-group-button-events', [
24320
          onControlAttached(specialisation, editorOffCell),
24945
          onControlAttached(specialisation, editorOffCell),
24321
          onControlDetached(specialisation, editorOffCell)
24946
          onControlDetached(specialisation, editorOffCell)
24322
        ])];
24947
        ]),
-
 
24948
        ...spec.tooltip.map(t => Tooltipping.config(backstage.shared.providers.tooltips.getConfig({ tooltipText: backstage.shared.providers.translate(t) }))).toArray()
-
 
24949
      ];
24323
      return FloatingToolbarButton.sketch({
24950
      return FloatingToolbarButton.sketch({
24324
        lazySink: sharedBackstage.getSink,
24951
        lazySink: sharedBackstage.getSink,
24325
        fetch: () => Future.nu(resolve => {
24952
        fetch: () => Future.nu(resolve => {
24326
          resolve(map$2(identifyButtons(spec.items), renderToolbarGroup));
24953
          resolve(map$2(identifyButtons(spec.items), renderToolbarGroup));
24327
        }),
24954
        }),
24328
        markers: { toggledClass: 'tox-tbtn--enabled' },
24955
        markers: { toggledClass: 'tox-tbtn--enabled' },
24329
        parts: {
24956
        parts: {
24330
          button: renderCommonStructure(spec.icon, spec.text, spec.tooltip, Optional.some(behaviours), sharedBackstage.providers),
24957
          button: renderCommonStructure(spec.icon, spec.text, spec.tooltip, Optional.some(behaviours), sharedBackstage.providers, spec.context, btnName),
24331
          toolbar: {
24958
          toolbar: {
24332
            dom: {
24959
            dom: {
24333
              tag: 'div',
24960
              tag: 'div',
24334
              classes: ['tox-toolbar__overflow'],
24961
              classes: ['tox-toolbar__overflow'],
24335
              attributes
24962
              attributes
24336
            }
24963
            }
24337
          }
24964
          }
24338
        }
24965
        }
24339
      });
24966
      });
24340
    };
24967
    };
24341
    const renderCommonToolbarButton = (spec, specialisation, providersBackstage) => {
24968
    const renderCommonToolbarButton = (spec, specialisation, providersBackstage, btnName) => {
24342
      var _d;
24969
      var _d;
24343
      const editorOffCell = Cell(noop);
24970
      const editorOffCell = Cell(noop);
24344
      const structure = renderCommonStructure(spec.icon, spec.text, spec.tooltip, Optional.none(), providersBackstage);
24971
      const structure = renderCommonStructure(spec.icon, spec.text, spec.tooltip, Optional.none(), providersBackstage, spec.context, btnName);
24345
      return Button.sketch({
24972
      return Button.sketch({
24346
        dom: structure.dom,
24973
        dom: structure.dom,
24347
        components: structure.components,
24974
        components: structure.components,
24348
        eventOrder: toolbarButtonEventOrder,
24975
        eventOrder: toolbarButtonEventOrder,
24349
        buttonBehaviours: {
24976
        buttonBehaviours: {
Línea 24354... Línea 24981...
24354
                getApi: specialisation.getApi
24981
                getApi: specialisation.getApi
24355
              }),
24982
              }),
24356
              onControlAttached(specialisation, editorOffCell),
24983
              onControlAttached(specialisation, editorOffCell),
24357
              onControlDetached(specialisation, editorOffCell)
24984
              onControlDetached(specialisation, editorOffCell)
24358
            ]),
24985
            ]),
-
 
24986
            ...spec.tooltip.map(t => Tooltipping.config(providersBackstage.tooltips.getConfig({ tooltipText: providersBackstage.translate(t) + spec.shortcut.map(shortcut => ` (${ convertText(shortcut) })`).getOr('') }))).toArray(),
24359
            DisablingConfigs.toolbarButton(() => !spec.enabled || providersBackstage.isDisabled()),
24987
            DisablingConfigs.toolbarButton(() => !spec.enabled || providersBackstage.checkUiComponentContext(spec.context).shouldDisable),
24360
            receivingConfig()
24988
            toggleOnReceive(() => providersBackstage.checkUiComponentContext(spec.context))
24361
          ].concat(specialisation.toolbarButtonBehaviours)),
24989
          ].concat(specialisation.toolbarButtonBehaviours)),
24362
          [commonButtonDisplayEvent]: (_d = structure.buttonBehaviours) === null || _d === void 0 ? void 0 : _d[commonButtonDisplayEvent]
24990
          [commonButtonDisplayEvent]: (_d = structure.buttonBehaviours) === null || _d === void 0 ? void 0 : _d[commonButtonDisplayEvent]
24363
        }
24991
        }
24364
      });
24992
      });
24365
    };
24993
    };
24366
    const renderToolbarButton = (spec, providersBackstage) => renderToolbarButtonWith(spec, providersBackstage, []);
24994
    const renderToolbarButton = (spec, providersBackstage, btnName) => renderToolbarButtonWith(spec, providersBackstage, [], btnName);
24367
    const renderToolbarButtonWith = (spec, providersBackstage, bonusEvents) => renderCommonToolbarButton(spec, {
24995
    const renderToolbarButtonWith = (spec, providersBackstage, bonusEvents, btnName) => renderCommonToolbarButton(spec, {
24368
      toolbarButtonBehaviours: bonusEvents.length > 0 ? [config('toolbarButtonWith', bonusEvents)] : [],
24996
      toolbarButtonBehaviours: bonusEvents.length > 0 ? [config('toolbarButtonWith', bonusEvents)] : [],
24369
      getApi: getButtonApi,
24997
      getApi: getButtonApi,
24370
      onSetup: spec.onSetup
24998
      onSetup: spec.onSetup
24371
    }, providersBackstage);
24999
    }, providersBackstage, btnName);
24372
    const renderToolbarToggleButton = (spec, providersBackstage) => renderToolbarToggleButtonWith(spec, providersBackstage, []);
25000
    const renderToolbarToggleButton = (spec, providersBackstage, btnName) => renderToolbarToggleButtonWith(spec, providersBackstage, [], btnName);
24373
    const renderToolbarToggleButtonWith = (spec, providersBackstage, bonusEvents) => renderCommonToolbarButton(spec, {
25001
    const renderToolbarToggleButtonWith = (spec, providersBackstage, bonusEvents, btnName) => renderCommonToolbarButton(spec, {
24374
      toolbarButtonBehaviours: [
25002
      toolbarButtonBehaviours: [
24375
        Replacing.config({}),
25003
        Replacing.config({}),
24376
        Toggling.config({
25004
        Toggling.config({
24377
          toggleClass: 'tox-tbtn--enabled',
25005
          toggleClass: 'tox-tbtn--enabled',
24378
          aria: { mode: 'pressed' },
25006
          aria: { mode: 'pressed' },
24379
          toggleOnExecute: false
25007
          toggleOnExecute: false
24380
        })
25008
        })
24381
      ].concat(bonusEvents.length > 0 ? [config('toolbarToggleButtonWith', bonusEvents)] : []),
25009
      ].concat(bonusEvents.length > 0 ? [config('toolbarToggleButtonWith', bonusEvents)] : []),
24382
      getApi: getToggleApi,
25010
      getApi: getToggleApi,
24383
      onSetup: spec.onSetup
25011
      onSetup: spec.onSetup
24384
    }, providersBackstage);
25012
    }, providersBackstage, btnName);
24385
    const fetchChoices = (getApi, spec, providersBackstage) => comp => Future.nu(callback => spec.fetch(callback)).map(items => Optional.from(createTieredDataFrom(deepMerge(createPartialChoiceMenu(generate$6('menu-value'), items, value => {
25013
    const fetchChoices = (getApi, spec, providersBackstage) => comp => Future.nu(callback => spec.fetch(callback)).map(items => Optional.from(createTieredDataFrom(deepMerge(createPartialChoiceMenu(generate$6('menu-value'), items, value => {
24386
      spec.onItemAction(getApi(comp), value);
25014
      spec.onItemAction(getApi(comp), value);
24387
    }, spec.columns, spec.presets, ItemResponse$1.CLOSE_ON_EXECUTE, spec.select.getOr(never), providersBackstage), {
25015
    }, spec.columns, spec.presets, ItemResponse$1.CLOSE_ON_EXECUTE, spec.select.getOr(never), providersBackstage), {
24388
      movement: deriveMenuMovement(spec.columns, spec.presets),
25016
      movement: deriveMenuMovement(spec.columns, spec.presets),
24389
      menuBehaviours: SimpleBehaviours.unnamedEvents(spec.columns !== 'auto' ? [] : [runOnAttached((comp, _se) => {
25017
      menuBehaviours: SimpleBehaviours.unnamedEvents(spec.columns !== 'auto' ? [] : [runOnAttached((comp, _se) => {
24390
          detectSize(comp, 4, classForPreset(spec.presets)).each(({numRows, numColumns}) => {
25018
          detectSize(comp, 4, classForPreset(spec.presets)).each(({numRows, numColumns}) => {
24391
            Keying.setGridSize(comp, numRows, numColumns);
25019
            Keying.setGridSize(comp, numRows, numColumns);
24392
          });
25020
          });
24393
        })])
25021
        })])
24394
    }))));
25022
    }))));
24395
    const renderSplitButton = (spec, sharedBackstage) => {
25023
    const renderSplitButton = (spec, sharedBackstage, btnName) => {
-
 
25024
      const tooltipString = Cell(spec.tooltip.getOr(''));
24396
      const getApi = comp => ({
25025
      const getApi = comp => ({
24397
        isEnabled: () => !Disabling.isDisabled(comp),
25026
        isEnabled: () => !Disabling.isDisabled(comp),
24398
        setEnabled: state => Disabling.set(comp, !state),
25027
        setEnabled: state => Disabling.set(comp, !state),
24399
        setIconFill: (id, value) => {
25028
        setIconFill: (id, value) => {
24400
          descendant(comp.element, `svg path[class="${ id }"], rect[class="${ id }"]`).each(underlinePath => {
25029
          descendant(comp.element, `svg path[class="${ id }"], rect[class="${ id }"]`).each(underlinePath => {
Línea 24410... Línea 25039...
24410
        isActive: () => descendant(comp.element, 'span').exists(button => comp.getSystem().getByDom(button).exists(Toggling.isOn)),
25039
        isActive: () => descendant(comp.element, 'span').exists(button => comp.getSystem().getByDom(button).exists(Toggling.isOn)),
24411
        setText: text => descendant(comp.element, 'span').each(button => comp.getSystem().getByDom(button).each(buttonComp => emitWith(buttonComp, updateMenuText, { text }))),
25040
        setText: text => descendant(comp.element, 'span').each(button => comp.getSystem().getByDom(button).each(buttonComp => emitWith(buttonComp, updateMenuText, { text }))),
24412
        setIcon: icon => descendant(comp.element, 'span').each(button => comp.getSystem().getByDom(button).each(buttonComp => emitWith(buttonComp, updateMenuIcon, { icon }))),
25041
        setIcon: icon => descendant(comp.element, 'span').each(button => comp.getSystem().getByDom(button).each(buttonComp => emitWith(buttonComp, updateMenuIcon, { icon }))),
24413
        setTooltip: tooltip => {
25042
        setTooltip: tooltip => {
24414
          const translatedTooltip = sharedBackstage.providers.translate(tooltip);
25043
          const translatedTooltip = sharedBackstage.providers.translate(tooltip);
24415
          setAll$1(comp.element, {
-
 
24416
            'aria-label': translatedTooltip,
25044
          set$9(comp.element, 'aria-label', translatedTooltip);
24417
            'title': translatedTooltip
25045
          tooltipString.set(tooltip);
24418
          });
-
 
24419
        }
25046
        }
24420
      });
25047
      });
24421
      const editorOffCell = Cell(noop);
25048
      const editorOffCell = Cell(noop);
24422
      const specialisation = {
25049
      const specialisation = {
24423
        getApi,
25050
        getApi,
Línea 24427... Línea 25054...
24427
        dom: {
25054
        dom: {
24428
          tag: 'div',
25055
          tag: 'div',
24429
          classes: ['tox-split-button'],
25056
          classes: ['tox-split-button'],
24430
          attributes: {
25057
          attributes: {
24431
            'aria-pressed': false,
25058
            'aria-pressed': false,
24432
            ...getTooltipAttributes(spec.tooltip, sharedBackstage.providers)
25059
            ...getTooltipAttributes(spec.tooltip, sharedBackstage.providers),
-
 
25060
            ...isNonNullable(btnName) ? { 'data-mce-name': btnName } : {}
24433
          }
25061
          }
24434
        },
25062
        },
24435
        onExecute: button => {
25063
        onExecute: button => {
24436
          const api = getApi(button);
25064
          const api = getApi(button);
24437
          if (api.isEnabled()) {
25065
          if (api.isEnabled()) {
Línea 24439... Línea 25067...
24439
          }
25067
          }
24440
        },
25068
        },
24441
        onItemExecute: (_a, _b, _c) => {
25069
        onItemExecute: (_a, _b, _c) => {
24442
        },
25070
        },
24443
        splitDropdownBehaviours: derive$1([
25071
        splitDropdownBehaviours: derive$1([
24444
          DisablingConfigs.splitButton(sharedBackstage.providers.isDisabled),
-
 
24445
          receivingConfig(),
-
 
24446
          config('split-dropdown-events', [
25072
          config('split-dropdown-events', [
24447
            runOnAttached((comp, _se) => forceInitialSize(comp)),
25073
            runOnAttached((comp, _se) => forceInitialSize(comp)),
24448
            run$1(focusButtonEvent, Focusing.focus),
25074
            run$1(focusButtonEvent, Focusing.focus),
24449
            onControlAttached(specialisation, editorOffCell),
25075
            onControlAttached(specialisation, editorOffCell),
24450
            onControlDetached(specialisation, editorOffCell)
25076
            onControlDetached(specialisation, editorOffCell)
24451
          ]),
25077
          ]),
-
 
25078
          DisablingConfigs.splitButton(() => sharedBackstage.providers.isDisabled() || sharedBackstage.providers.checkUiComponentContext(spec.context).shouldDisable),
-
 
25079
          toggleOnReceive(() => sharedBackstage.providers.checkUiComponentContext(spec.context)),
24452
          Unselecting.config({})
25080
          Unselecting.config({}),
-
 
25081
          ...spec.tooltip.map(tooltip => {
-
 
25082
            return Tooltipping.config({
-
 
25083
              ...sharedBackstage.providers.tooltips.getConfig({
-
 
25084
                tooltipText: sharedBackstage.providers.translate(tooltip),
-
 
25085
                onShow: comp => {
-
 
25086
                  if (tooltipString.get() !== tooltip) {
-
 
25087
                    const translatedTooltip = sharedBackstage.providers.translate(tooltipString.get());
-
 
25088
                    Tooltipping.setComponents(comp, sharedBackstage.providers.tooltips.getComponents({ tooltipText: translatedTooltip }));
-
 
25089
                  }
-
 
25090
                }
-
 
25091
              })
-
 
25092
            });
-
 
25093
          }).toArray()
24453
        ]),
25094
        ]),
24454
        eventOrder: {
25095
        eventOrder: {
24455
          [attachedToDom()]: [
25096
          [attachedToDom()]: [
24456
            'alloy.base.behaviour',
25097
            'alloy.base.behaviour',
24457
            'split-dropdown-events'
25098
            'split-dropdown-events',
-
 
25099
            'tooltipping'
-
 
25100
          ],
-
 
25101
          [detachedFromDom()]: [
-
 
25102
            'split-dropdown-events',
-
 
25103
            'tooltipping'
24458
          ]
25104
          ]
24459
        },
25105
        },
24460
        toggleClass: 'tox-tbtn--enabled',
25106
        toggleClass: 'tox-tbtn--enabled',
24461
        lazySink: sharedBackstage.getSink,
25107
        lazySink: sharedBackstage.getSink,
24462
        fetch: fetchChoices(getApi, spec, sharedBackstage.providers),
25108
        fetch: fetchChoices(getApi, spec, sharedBackstage.providers),
24463
        parts: { menu: part(false, spec.columns, spec.presets) },
25109
        parts: { menu: part(false, spec.columns, spec.presets) },
24464
        components: [
25110
        components: [
24465
          SplitDropdown.parts.button(renderCommonStructure(spec.icon, spec.text, Optional.none(), Optional.some([Toggling.config({
25111
          SplitDropdown.parts.button(renderCommonStructure(spec.icon, spec.text, Optional.none(), Optional.some([
-
 
25112
            Toggling.config({
24466
              toggleClass: 'tox-tbtn--enabled',
25113
              toggleClass: 'tox-tbtn--enabled',
24467
              toggleOnExecute: false
25114
              toggleOnExecute: false
-
 
25115
            }),
-
 
25116
            DisablingConfigs.toolbarButton(never),
-
 
25117
            toggleOnReceive(constant$1({
-
 
25118
              contextType: 'any',
-
 
25119
              shouldDisable: false
-
 
25120
            }))
24468
            })]), sharedBackstage.providers)),
25121
          ]), sharedBackstage.providers, spec.context)),
24469
          SplitDropdown.parts.arrow({
25122
          SplitDropdown.parts.arrow({
24470
            dom: {
25123
            dom: {
24471
              tag: 'button',
25124
              tag: 'button',
24472
              classes: [
25125
              classes: [
24473
                'tox-tbtn',
25126
                'tox-tbtn',
24474
                'tox-split-button__chevron'
25127
                'tox-split-button__chevron'
24475
              ],
25128
              ],
24476
              innerHtml: get$2('chevron-down', sharedBackstage.providers.icons)
25129
              innerHtml: get$3('chevron-down', sharedBackstage.providers.icons)
24477
            },
25130
            },
24478
            buttonBehaviours: derive$1([
25131
            buttonBehaviours: derive$1([
24479
              DisablingConfigs.splitButton(sharedBackstage.providers.isDisabled),
25132
              DisablingConfigs.splitButton(never),
-
 
25133
              toggleOnReceive(constant$1({
24480
              receivingConfig(),
25134
                contextType: 'any',
24481
              addFocusableBehaviour()
25135
                shouldDisable: false
-
 
25136
              }))
24482
            ])
25137
            ])
24483
          }),
25138
          }),
24484
          SplitDropdown.parts['aria-descriptor']({ text: sharedBackstage.providers.translate('To open the popup, press Shift+Enter') })
25139
          SplitDropdown.parts['aria-descriptor']({ text: sharedBackstage.providers.translate('To open the popup, press Shift+Enter') })
24485
        ]
25140
        ]
24486
      });
25141
      });
Línea 24535... Línea 25190...
24535
      {
25190
      {
24536
        name: 'comments',
25191
        name: 'comments',
24537
        items: ['addcomment']
25192
        items: ['addcomment']
24538
      }
25193
      }
24539
    ];
25194
    ];
24540
    const renderFromBridge = (bridgeBuilder, render) => (spec, backstage, editor) => {
25195
    const renderFromBridge = (bridgeBuilder, render) => (spec, backstage, editor, btnName) => {
24541
      const internal = bridgeBuilder(spec).mapError(errInfo => formatError(errInfo)).getOrDie();
25196
      const internal = bridgeBuilder(spec).mapError(errInfo => formatError(errInfo)).getOrDie();
24542
      return render(internal, backstage, editor);
25197
      return render(internal, backstage, editor, btnName);
24543
    };
25198
    };
24544
    const types = {
25199
    const types = {
24545
      button: renderFromBridge(createToolbarButton, (s, backstage) => renderToolbarButton(s, backstage.shared.providers)),
25200
      button: renderFromBridge(createToolbarButton, (s, backstage, _, btnName) => renderToolbarButton(s, backstage.shared.providers, btnName)),
24546
      togglebutton: renderFromBridge(createToggleButton, (s, backstage) => renderToolbarToggleButton(s, backstage.shared.providers)),
25201
      togglebutton: renderFromBridge(createToggleButton, (s, backstage, _, btnName) => renderToolbarToggleButton(s, backstage.shared.providers, btnName)),
24547
      menubutton: renderFromBridge(createMenuButton, (s, backstage) => renderMenuButton(s, 'tox-tbtn', backstage, Optional.none(), false)),
25202
      menubutton: renderFromBridge(createMenuButton, (s, backstage, _, btnName) => renderMenuButton(s, 'tox-tbtn', backstage, Optional.none(), false, btnName)),
24548
      splitbutton: renderFromBridge(createSplitButton, (s, backstage) => renderSplitButton(s, backstage.shared)),
25203
      splitbutton: renderFromBridge(createSplitButton, (s, backstage, _, btnName) => renderSplitButton(s, backstage.shared, btnName)),
24549
      grouptoolbarbutton: renderFromBridge(createGroupToolbarButton, (s, backstage, editor) => {
25204
      grouptoolbarbutton: renderFromBridge(createGroupToolbarButton, (s, backstage, editor, btnName) => {
24550
        const buttons = editor.ui.registry.getAll().buttons;
25205
        const buttons = editor.ui.registry.getAll().buttons;
24551
        const identify = toolbar => identifyButtons(editor, {
25206
        const identify = toolbar => identifyButtons(editor, {
24552
          buttons,
25207
          buttons,
24553
          toolbar,
25208
          toolbar,
24554
          allowToolbarGroups: false
25209
          allowToolbarGroups: false
24555
        }, backstage, Optional.none());
25210
        }, backstage, Optional.none());
24556
        const attributes = { [Attribute]: backstage.shared.header.isPositionedAtTop() ? AttributeValue.TopToBottom : AttributeValue.BottomToTop };
25211
        const attributes = { [Attribute]: backstage.shared.header.isPositionedAtTop() ? AttributeValue.TopToBottom : AttributeValue.BottomToTop };
24557
        switch (getToolbarMode(editor)) {
25212
        switch (getToolbarMode(editor)) {
24558
        case ToolbarMode$1.floating:
25213
        case ToolbarMode$1.floating:
24559
          return renderFloatingToolbarButton(s, backstage, identify, attributes);
25214
          return renderFloatingToolbarButton(s, backstage, identify, attributes, btnName);
24560
        default:
25215
        default:
24561
          throw new Error('Toolbar groups are only supported when using floating toolbar mode');
25216
          throw new Error('Toolbar groups are only supported when using floating toolbar mode');
24562
        }
25217
        }
24563
      })
25218
      })
24564
    };
25219
    };
24565
    const extractFrom = (spec, backstage, editor) => get$g(types, spec.type).fold(() => {
25220
    const extractFrom = (spec, backstage, editor, btnName) => get$h(types, spec.type).fold(() => {
24566
      console.error('skipping button defined by', spec);
25221
      console.error('skipping button defined by', spec);
24567
      return Optional.none();
25222
      return Optional.none();
24568
    }, render => Optional.some(render(spec, backstage, editor)));
25223
    }, render => Optional.some(render(spec, backstage, editor, btnName)));
24569
    const bespokeButtons = {
25224
    const bespokeButtons = {
24570
      styles: createStylesButton,
25225
      styles: createStylesButton,
24571
      fontsize: createFontSizeButton,
25226
      fontsize: createFontSizeButton,
24572
      fontsizeinput: createFontSizeInputButton,
25227
      fontsizeinput: createFontSizeInputButton,
24573
      fontfamily: createFontFamilyButton,
25228
      fontfamily: createFontFamilyButton,
Línea 24586... Línea 25241...
24586
    };
25241
    };
24587
    const convertStringToolbar = strToolbar => {
25242
    const convertStringToolbar = strToolbar => {
24588
      const groupsStrings = strToolbar.split('|');
25243
      const groupsStrings = strToolbar.split('|');
24589
      return map$2(groupsStrings, g => ({ items: g.trim().split(' ') }));
25244
      return map$2(groupsStrings, g => ({ items: g.trim().split(' ') }));
24590
    };
25245
    };
24591
    const isToolbarGroupSettingArray = toolbar => isArrayOf(toolbar, t => has$2(t, 'name') && has$2(t, 'items'));
25246
    const isToolbarGroupSettingArray = toolbar => isArrayOf(toolbar, t => (has$2(t, 'name') || has$2(t, 'label')) && has$2(t, 'items'));
24592
    const createToolbar = toolbarConfig => {
25247
    const createToolbar = toolbarConfig => {
24593
      const toolbar = toolbarConfig.toolbar;
25248
      const toolbar = toolbarConfig.toolbar;
24594
      const buttons = toolbarConfig.buttons;
25249
      const buttons = toolbarConfig.buttons;
24595
      if (toolbar === false) {
25250
      if (toolbar === false) {
24596
        return [];
25251
        return [];
Línea 24603... Línea 25258...
24603
      } else {
25258
      } else {
24604
        console.error('Toolbar type should be string, string[], boolean or ToolbarGroup[]');
25259
        console.error('Toolbar type should be string, string[], boolean or ToolbarGroup[]');
24605
        return [];
25260
        return [];
24606
      }
25261
      }
24607
    };
25262
    };
24608
    const lookupButton = (editor, buttons, toolbarItem, allowToolbarGroups, backstage, prefixes) => get$g(buttons, toolbarItem.toLowerCase()).orThunk(() => prefixes.bind(ps => findMap(ps, prefix => get$g(buttons, prefix + toolbarItem.toLowerCase())))).fold(() => get$g(bespokeButtons, toolbarItem.toLowerCase()).map(r => r(editor, backstage)), spec => {
25263
    const lookupButton = (editor, buttons, toolbarItem, allowToolbarGroups, backstage, prefixes) => get$h(buttons, toolbarItem.toLowerCase()).orThunk(() => prefixes.bind(ps => findMap(ps, prefix => get$h(buttons, prefix + toolbarItem.toLowerCase())))).fold(() => get$h(bespokeButtons, toolbarItem.toLowerCase()).map(r => r(editor, backstage)), spec => {
24609
      if (spec.type === 'grouptoolbarbutton' && !allowToolbarGroups) {
25264
      if (spec.type === 'grouptoolbarbutton' && !allowToolbarGroups) {
24610
        console.warn(`Ignoring the '${ toolbarItem }' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`);
25265
        console.warn(`Ignoring the '${ toolbarItem }' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`);
24611
        return Optional.none();
25266
        return Optional.none();
24612
      } else {
25267
      } else {
24613
        return extractFrom(spec, backstage, editor);
25268
        return extractFrom(spec, backstage, editor, toolbarItem.toLowerCase());
24614
      }
25269
      }
24615
    });
25270
    });
24616
    const identifyButtons = (editor, toolbarConfig, backstage, prefixes) => {
25271
    const identifyButtons = (editor, toolbarConfig, backstage, prefixes) => {
24617
      const toolbarGroups = createToolbar(toolbarConfig);
25272
      const toolbarGroups = createToolbar(toolbarConfig);
24618
      const groups = map$2(toolbarGroups, group => {
25273
      const groups = map$2(toolbarGroups, group => {
24619
        const items = bind$3(group.items, toolbarItem => {
25274
        const items = bind$3(group.items, toolbarItem => {
24620
          return toolbarItem.trim().length === 0 ? [] : lookupButton(editor, toolbarConfig.buttons, toolbarItem, toolbarConfig.allowToolbarGroups, backstage, prefixes).toArray();
25275
          return toolbarItem.trim().length === 0 ? [] : lookupButton(editor, toolbarConfig.buttons, toolbarItem, toolbarConfig.allowToolbarGroups, backstage, prefixes).toArray();
24621
        });
25276
        });
24622
        return {
25277
        return {
24623
          title: Optional.from(editor.translate(group.name)),
25278
          title: Optional.from(editor.translate(group.name)),
-
 
25279
          label: someIf(group.label !== undefined, editor.translate(group.label)),
24624
          items
25280
          items
24625
        };
25281
        };
24626
      });
25282
      });
24627
      return filter$2(groups, group => group.items.length > 0);
25283
      return filter$2(groups, group => group.items.length > 0);
24628
    };
25284
    };
Línea 24644... Línea 25300...
24644
      } else {
25300
      } else {
24645
        OuterContainer.setToolbar(outerContainer, identifyButtons(editor, rawUiConfig, backstage, Optional.none()));
25301
        OuterContainer.setToolbar(outerContainer, identifyButtons(editor, rawUiConfig, backstage, Optional.none()));
24646
      }
25302
      }
24647
    };
25303
    };
Línea 24648... Línea 25304...
24648
 
25304
 
24649
    const detection = detect$2();
25305
    const detection = detect$1();
24650
    const isiOS12 = detection.os.isiOS() && detection.os.version.major <= 12;
25306
    const isiOS12 = detection.os.isiOS() && detection.os.version.major <= 12;
24651
    const setupEvents$1 = (editor, uiRefs) => {
25307
    const setupEvents$1 = (editor, uiRefs) => {
24652
      const {uiMotherships} = uiRefs;
25308
      const {uiMotherships} = uiRefs;
24653
      const dom = editor.dom;
25309
      const dom = editor.dom;
Línea 24681... Línea 25337...
24681
          set$8(m.element, 'display', 'none');
25337
          set$8(m.element, 'display', 'none');
24682
        });
25338
        });
24683
      });
25339
      });
24684
      editor.on('show', () => {
25340
      editor.on('show', () => {
24685
        each$1(uiMotherships, m => {
25341
        each$1(uiMotherships, m => {
24686
          remove$6(m.element, 'display');
25342
          remove$7(m.element, 'display');
24687
        });
25343
        });
24688
      });
25344
      });
24689
      editor.on('NodeChange', resizeDocument);
25345
      editor.on('NodeChange', resizeDocument);
24690
      editor.on('remove', () => {
25346
      editor.on('remove', () => {
24691
        elementLoad.unbind();
25347
        elementLoad.unbind();
Línea 24707... Línea 25363...
24707
      iframe(editor);
25363
      iframe(editor);
24708
      const eTargetNode = SugarElement.fromDom(args.targetNode);
25364
      const eTargetNode = SugarElement.fromDom(args.targetNode);
24709
      const uiRoot = getContentContainer(getRootNode(eTargetNode));
25365
      const uiRoot = getContentContainer(getRootNode(eTargetNode));
24710
      attachSystemAfter(eTargetNode, mainUi.mothership);
25366
      attachSystemAfter(eTargetNode, mainUi.mothership);
24711
      attachUiMotherships(editor, uiRoot, uiRefs);
25367
      attachUiMotherships(editor, uiRoot, uiRefs);
24712
      editor.on('SkinLoaded', () => {
25368
      editor.on('PostRender', () => {
24713
        OuterContainer.setSidebar(outerContainer, rawUiConfig.sidebar, getSidebarShow(editor));
25369
        OuterContainer.setSidebar(outerContainer, rawUiConfig.sidebar, getSidebarShow(editor));
-
 
25370
      });
-
 
25371
      editor.on('SkinLoaded', () => {
24714
        setToolbar(editor, uiRefs, rawUiConfig, backstage);
25372
        setToolbar(editor, uiRefs, rawUiConfig, backstage);
24715
        lastToolbarWidth.set(editor.getWin().innerWidth);
25373
        lastToolbarWidth.set(editor.getWin().innerWidth);
24716
        OuterContainer.setMenubar(outerContainer, identifyMenus(editor, rawUiConfig));
25374
        OuterContainer.setMenubar(outerContainer, identifyMenus(editor, rawUiConfig));
24717
        OuterContainer.setViews(outerContainer, rawUiConfig.views);
25375
        OuterContainer.setViews(outerContainer, rawUiConfig.views);
24718
        setupEvents$1(editor, uiRefs);
25376
        setupEvents$1(editor, uiRefs);
Línea 24727... Línea 25385...
24727
          editor.dispatch('ScrollContent');
25385
          editor.dispatch('ScrollContent');
24728
        }, 20);
25386
        }, 20);
24729
        const unbinder = bind(socket.element, 'scroll', limit.throttle);
25387
        const unbinder = bind(socket.element, 'scroll', limit.throttle);
24730
        editor.on('remove', unbinder.unbind);
25388
        editor.on('remove', unbinder.unbind);
24731
      }
25389
      }
24732
      setupReadonlyModeSwitch(editor, uiRefs);
25390
      setupEventsForUi(editor, uiRefs);
24733
      editor.addCommand('ToggleSidebar', (_ui, value) => {
25391
      editor.addCommand('ToggleSidebar', (_ui, value) => {
24734
        OuterContainer.toggleSidebar(outerContainer, value);
25392
        OuterContainer.toggleSidebar(outerContainer, value);
24735
        editor.dispatch('ToggleSidebar');
25393
        fireToggleSidebar(editor);
24736
      });
25394
      });
24737
      editor.addQueryValueHandler('ToggleSidebar', () => {
25395
      editor.addQueryValueHandler('ToggleSidebar', () => {
24738
        var _a;
25396
        var _a;
24739
        return (_a = OuterContainer.whichSidebar(outerContainer)) !== null && _a !== void 0 ? _a : '';
25397
        return (_a = OuterContainer.whichSidebar(outerContainer)) !== null && _a !== void 0 ? _a : '';
24740
      });
25398
      });
Línea 24748... Línea 25406...
24748
          if (isNull(OuterContainer.whichView(outerContainer))) {
25406
          if (isNull(OuterContainer.whichView(outerContainer))) {
24749
            editor.focus();
25407
            editor.focus();
24750
            editor.nodeChanged();
25408
            editor.nodeChanged();
24751
            OuterContainer.refreshToolbar(outerContainer);
25409
            OuterContainer.refreshToolbar(outerContainer);
24752
          }
25410
          }
-
 
25411
          fireToggleView(editor);
24753
        }
25412
        }
24754
      });
25413
      });
24755
      editor.addQueryValueHandler('ToggleView', () => {
25414
      editor.addQueryValueHandler('ToggleView', () => {
24756
        var _a;
25415
        var _a;
24757
        return (_a = OuterContainer.whichView(outerContainer)) !== null && _a !== void 0 ? _a : '';
25416
        return (_a = OuterContainer.whichView(outerContainer)) !== null && _a !== void 0 ? _a : '';
Línea 24769... Línea 25428...
24769
          }
25428
          }
24770
        });
25429
        });
24771
      }
25430
      }
24772
      const api = {
25431
      const api = {
24773
        setEnabled: state => {
25432
        setEnabled: state => {
-
 
25433
          const eventType = state ? 'setEnabled' : 'setDisabled';
24774
          broadcastReadonly(uiRefs, !state);
25434
          broadcastEvents(uiRefs, eventType);
24775
        },
25435
        },
24776
        isEnabled: () => !Disabling.isDisabled(outerContainer)
25436
        isEnabled: () => !Disabling.isDisabled(outerContainer)
24777
      };
25437
      };
24778
      return {
25438
      return {
24779
        iframeContainer: socket.element.dom,
25439
        iframeContainer: socket.element.dom,
Línea 24824... Línea 25484...
24824
 
25484
 
24825
    const {ToolbarLocation, ToolbarMode} = Options;
25485
    const {ToolbarLocation, ToolbarMode} = Options;
24826
    const maximumDistanceToEdge = 40;
25486
    const maximumDistanceToEdge = 40;
24827
    const InlineHeader = (editor, targetElm, uiRefs, backstage, floatContainer) => {
25487
    const InlineHeader = (editor, targetElm, uiRefs, backstage, floatContainer) => {
24828
      const {mainUi, uiMotherships} = uiRefs;
25488
      const {mainUi, uiMotherships} = uiRefs;
24829
      const DOM = global$7.DOM;
25489
      const DOM = global$8.DOM;
24830
      const useFixedToolbarContainer = useFixedContainer(editor);
25490
      const useFixedToolbarContainer = useFixedContainer(editor);
24831
      const isSticky = isStickyToolbar(editor);
25491
      const isSticky = isStickyToolbar(editor);
24832
      const editorMaxWidthOpt = getMaxWidthOption(editor).or(getWidth(editor));
25492
      const editorMaxWidthOpt = getMaxWidthOption(editor).or(getWidth(editor));
24833
      const headerBackstage = backstage.shared.header;
25493
      const headerBackstage = backstage.shared.header;
-
 
25494
      const isPositionedAtTop = headerBackstage.isPositionedAtTop;
24834
      const isPositionedAtTop = headerBackstage.isPositionedAtTop;
25495
      const minimumToolbarWidth = 150;
24835
      const toolbarMode = getToolbarMode(editor);
25496
      const toolbarMode = getToolbarMode(editor);
24836
      const isSplitToolbar = toolbarMode === ToolbarMode.sliding || toolbarMode === ToolbarMode.floating;
25497
      const isSplitToolbar = toolbarMode === ToolbarMode.sliding || toolbarMode === ToolbarMode.floating;
24837
      const visible = Cell(false);
25498
      const visible = Cell(false);
24838
      const isVisible = () => visible.get() && !editor.removed;
25499
      const isVisible = () => visible.get() && !editor.removed;
24839
      const calcToolbarOffset = toolbar => isSplitToolbar ? toolbar.fold(constant$1(0), tbar => tbar.components().length > 1 ? get$d(tbar.components()[1].element) : 0) : 0;
25500
      const calcToolbarOffset = toolbar => isSplitToolbar ? toolbar.fold(constant$1(0), tbar => tbar.components().length > 1 ? get$e(tbar.components()[1].element) : 0) : 0;
24840
      const calcMode = container => {
25501
      const calcMode = container => {
24841
        switch (getToolbarLocation(editor)) {
25502
        switch (getToolbarLocation(editor)) {
24842
        case ToolbarLocation.auto:
25503
        case ToolbarLocation.auto:
24843
          const toolbar = OuterContainer.getToolbar(mainUi.outerContainer);
25504
          const toolbar = OuterContainer.getToolbar(mainUi.outerContainer);
24844
          const offset = calcToolbarOffset(toolbar);
25505
          const offset = calcToolbarOffset(toolbar);
24845
          const toolbarHeight = get$d(container.element) - offset;
25506
          const toolbarHeight = get$e(container.element) - offset;
24846
          const targetBounds = box$1(targetElm);
25507
          const targetBounds = box$1(targetElm);
24847
          const roomAtTop = targetBounds.y > toolbarHeight;
25508
          const roomAtTop = targetBounds.y > toolbarHeight;
24848
          if (roomAtTop) {
25509
          if (roomAtTop) {
24849
            return 'top';
25510
            return 'top';
24850
          } else {
25511
          } else {
24851
            const doc = documentElement(targetElm);
25512
            const doc = documentElement(targetElm);
24852
            const docHeight = Math.max(doc.dom.scrollHeight, get$d(doc));
25513
            const docHeight = Math.max(doc.dom.scrollHeight, get$e(doc));
24853
            const roomAtBottom = targetBounds.bottom < docHeight - toolbarHeight;
25514
            const roomAtBottom = targetBounds.bottom < docHeight - toolbarHeight;
24854
            if (roomAtBottom) {
25515
            if (roomAtBottom) {
24855
              return 'bottom';
25516
              return 'bottom';
24856
            } else {
25517
            } else {
Línea 24875... Línea 25536...
24875
        });
25536
        });
24876
      };
25537
      };
24877
      const updateChromeWidth = () => {
25538
      const updateChromeWidth = () => {
24878
        floatContainer.on(container => {
25539
        floatContainer.on(container => {
24879
          const maxWidth = editorMaxWidthOpt.getOrThunk(() => {
25540
          const maxWidth = editorMaxWidthOpt.getOrThunk(() => {
24880
            const bodyMargin = parseToInt(get$e(body(), 'margin-left')).getOr(0);
-
 
24881
            return get$c(body()) - absolute$3(targetElm).left + bodyMargin;
25541
            return getBounds$3().width - viewport$1(targetElm).left - 10;
24882
          });
25542
          });
24883
          set$8(container.element, 'max-width', maxWidth + 'px');
25543
          set$8(container.element, 'max-width', maxWidth + 'px');
24884
        });
25544
        });
24885
      };
25545
      };
24886
      const updateChromePosition = optToolbarWidth => {
25546
      const updateChromePosition = (isOuterContainerWidthRestored, prevScroll) => {
24887
        floatContainer.on(container => {
25547
        floatContainer.on(container => {
24888
          const toolbar = OuterContainer.getToolbar(mainUi.outerContainer);
25548
          const toolbar = OuterContainer.getToolbar(mainUi.outerContainer);
24889
          const offset = calcToolbarOffset(toolbar);
25549
          const offset = calcToolbarOffset(toolbar);
24890
          const targetBounds = box$1(targetElm);
25550
          const targetBounds = box$1(targetElm);
24891
          const {top, left} = getOffsetParent$1(editor, mainUi.outerContainer.element).fold(() => {
25551
          const offsetParent = getOffsetParent$1(editor, mainUi.outerContainer.element);
-
 
25552
          const getLeft = () => offsetParent.fold(() => targetBounds.x, offsetParent => {
24892
            return {
25553
            const offsetBox = box$1(offsetParent);
24893
              top: isPositionedAtTop() ? Math.max(targetBounds.y - get$d(container.element) + offset, 0) : targetBounds.bottom,
25554
            const isOffsetParentBody = eq(offsetParent, body());
24894
              left: targetBounds.x
25555
            return isOffsetParentBody ? targetBounds.x : targetBounds.x - offsetBox.x;
24895
            };
25556
          });
24896
          }, offsetParent => {
25557
          const getTop = () => offsetParent.fold(() => isPositionedAtTop() ? Math.max(targetBounds.y - get$e(container.element) + offset, 0) : targetBounds.bottom, offsetParent => {
24897
            var _a;
25558
            var _a;
24898
            const offsetBox = box$1(offsetParent);
25559
            const offsetBox = box$1(offsetParent);
24899
            const scrollDelta = (_a = offsetParent.dom.scrollTop) !== null && _a !== void 0 ? _a : 0;
25560
            const scrollDelta = (_a = offsetParent.dom.scrollTop) !== null && _a !== void 0 ? _a : 0;
24900
            const isOffsetParentBody = eq(offsetParent, body());
25561
            const isOffsetParentBody = eq(offsetParent, body());
24901
            const topValue = isOffsetParentBody ? Math.max(targetBounds.y - get$d(container.element) + offset, 0) : targetBounds.y - offsetBox.y + scrollDelta - get$d(container.element) + offset;
25562
            const topValue = isOffsetParentBody ? Math.max(targetBounds.y - get$e(container.element) + offset, 0) : targetBounds.y - offsetBox.y + scrollDelta - get$e(container.element) + offset;
24902
            return {
-
 
24903
              top: isPositionedAtTop() ? topValue : targetBounds.bottom,
25563
            return isPositionedAtTop() ? topValue : targetBounds.bottom;
24904
              left: isOffsetParentBody ? targetBounds.x : targetBounds.x - offsetBox.x
-
 
24905
            };
-
 
24906
          });
25564
          });
-
 
25565
          const left = getLeft();
-
 
25566
          const widthProperties = someIf(isOuterContainerWidthRestored, Math.ceil(mainUi.outerContainer.element.dom.getBoundingClientRect().width)).filter(w => w > minimumToolbarWidth).map(toolbarWidth => {
-
 
25567
            const scroll = prevScroll.getOr(get$c());
-
 
25568
            const availableWidth = window.innerWidth - (left - scroll.left);
-
 
25569
            const width = Math.max(Math.min(toolbarWidth, availableWidth), minimumToolbarWidth);
-
 
25570
            if (availableWidth < toolbarWidth) {
-
 
25571
              set$8(mainUi.outerContainer.element, 'width', width + 'px');
-
 
25572
            }
-
 
25573
            return { width: width + 'px' };
-
 
25574
          }).getOr({ width: 'max-content' });
24907
          const baseProperties = {
25575
          const baseProperties = {
24908
            position: 'absolute',
25576
            position: 'absolute',
24909
            left: Math.round(left) + 'px',
25577
            left: Math.round(left) + 'px',
24910
            top: Math.round(top) + 'px'
25578
            top: getTop() + 'px'
24911
          };
25579
          };
24912
          const widthProperties = optToolbarWidth.map(toolbarWidth => {
-
 
24913
            const scroll = get$b();
-
 
24914
            const minimumToolbarWidth = 150;
-
 
24915
            const availableWidth = window.innerWidth - (left - scroll.left);
-
 
24916
            const width = Math.max(Math.min(toolbarWidth, availableWidth), minimumToolbarWidth);
-
 
24917
            return { width: width + 'px' };
-
 
24918
          }).getOr({});
-
 
24919
          setAll(mainUi.outerContainer.element, {
25580
          setAll(mainUi.outerContainer.element, {
24920
            ...baseProperties,
25581
            ...baseProperties,
24921
            ...widthProperties
25582
            ...widthProperties
24922
          });
25583
          });
24923
        });
25584
        });
Línea 24926... Línea 25587...
24926
      const repositionPopups$1 = () => {
25587
      const repositionPopups$1 = () => {
24927
        each$1(uiMotherships, m => {
25588
        each$1(uiMotherships, m => {
24928
          m.broadcastOn([repositionPopups()], {});
25589
          m.broadcastOn([repositionPopups()], {});
24929
        });
25590
        });
24930
      };
25591
      };
24931
      const restoreAndGetCompleteOuterContainerWidth = () => {
25592
      const restoreOuterContainerWidth = () => {
24932
        if (!useFixedToolbarContainer) {
25593
        if (!useFixedToolbarContainer) {
24933
          const toolbarCurrentRightsidePosition = absolute$3(mainUi.outerContainer.element).left + getOuter$1(mainUi.outerContainer.element);
25594
          const toolbarCurrentRightsidePosition = absolute$3(mainUi.outerContainer.element).left + getOuter$1(mainUi.outerContainer.element);
24934
          if (toolbarCurrentRightsidePosition >= window.innerWidth - maximumDistanceToEdge || getRaw(mainUi.outerContainer.element, 'width').isSome()) {
25595
          if (toolbarCurrentRightsidePosition >= window.innerWidth - maximumDistanceToEdge || getRaw(mainUi.outerContainer.element, 'width').isSome()) {
24935
            set$8(mainUi.outerContainer.element, 'position', 'absolute');
25596
            set$8(mainUi.outerContainer.element, 'position', 'absolute');
24936
            set$8(mainUi.outerContainer.element, 'left', '0px');
25597
            set$8(mainUi.outerContainer.element, 'left', '0px');
24937
            remove$6(mainUi.outerContainer.element, 'width');
25598
            remove$7(mainUi.outerContainer.element, 'width');
24938
            const w = getOuter$1(mainUi.outerContainer.element);
-
 
24939
            return Optional.some(w);
-
 
24940
          } else {
-
 
24941
            return Optional.none();
25599
            return true;
24942
          }
25600
          }
24943
        } else {
-
 
24944
          return Optional.none();
-
 
24945
        }
25601
        }
-
 
25602
        return false;
24946
      };
25603
      };
24947
      const update = stickyAction => {
25604
      const update = stickyAction => {
24948
        if (!isVisible()) {
25605
        if (!isVisible()) {
24949
          return;
25606
          return;
24950
        }
25607
        }
24951
        if (!useFixedToolbarContainer) {
25608
        if (!useFixedToolbarContainer) {
24952
          updateChromeWidth();
25609
          updateChromeWidth();
24953
        }
25610
        }
-
 
25611
        const prevScroll = get$c();
24954
        const optToolbarWidth = useFixedToolbarContainer ? Optional.none() : restoreAndGetCompleteOuterContainerWidth();
25612
        const isOuterContainerWidthRestored = useFixedToolbarContainer ? false : restoreOuterContainerWidth();
24955
        if (isSplitToolbar) {
25613
        if (isSplitToolbar) {
24956
          OuterContainer.refreshToolbar(mainUi.outerContainer);
25614
          OuterContainer.refreshToolbar(mainUi.outerContainer);
24957
        }
25615
        }
24958
        if (!useFixedToolbarContainer) {
25616
        if (!useFixedToolbarContainer) {
-
 
25617
          const currentScroll = get$c();
-
 
25618
          const optScroll = someIf(prevScroll.left !== currentScroll.left, prevScroll);
24959
          updateChromePosition(optToolbarWidth);
25619
          updateChromePosition(isOuterContainerWidthRestored, optScroll);
-
 
25620
          optScroll.each(scroll => {
-
 
25621
            to(scroll.left, currentScroll.top);
-
 
25622
          });
24960
        }
25623
        }
24961
        if (isSticky) {
25624
        if (isSticky) {
24962
          floatContainer.on(stickyAction);
25625
          floatContainer.on(stickyAction);
24963
        }
25626
        }
24964
        repositionPopups$1();
25627
        repositionPopups$1();
Línea 24981... Línea 25644...
24981
      const show = () => {
25644
      const show = () => {
24982
        visible.set(true);
25645
        visible.set(true);
24983
        set$8(mainUi.outerContainer.element, 'display', 'flex');
25646
        set$8(mainUi.outerContainer.element, 'display', 'flex');
24984
        DOM.addClass(editor.getBody(), 'mce-edit-focus');
25647
        DOM.addClass(editor.getBody(), 'mce-edit-focus');
24985
        each$1(uiMotherships, m => {
25648
        each$1(uiMotherships, m => {
24986
          remove$6(m.element, 'display');
25649
          remove$7(m.element, 'display');
24987
        });
25650
        });
24988
        doUpdateMode();
25651
        doUpdateMode();
24989
        if (isSplitUiMode(editor)) {
25652
        if (isSplitUiMode(editor)) {
24990
          update(elem => Docking.isDocked(elem) ? Docking.reset(elem) : Docking.refresh(elem));
25653
          update(elem => Docking.isDocked(elem) ? Docking.reset(elem) : Docking.refresh(elem));
24991
        } else {
25654
        } else {
Línea 25058... Línea 25721...
25058
        requestAnimationFrame(() => resizeContent(e));
25721
        requestAnimationFrame(() => resizeContent(e));
25059
      });
25722
      });
25060
      let lastScrollX = 0;
25723
      let lastScrollX = 0;
25061
      const updateUi = last(() => ui.update(Docking.refresh), 33);
25724
      const updateUi = last(() => ui.update(Docking.refresh), 33);
25062
      editor.on('ScrollWindow', () => {
25725
      editor.on('ScrollWindow', () => {
25063
        const newScrollX = get$b().left;
25726
        const newScrollX = get$c().left;
25064
        if (newScrollX !== lastScrollX) {
25727
        if (newScrollX !== lastScrollX) {
25065
          lastScrollX = newScrollX;
25728
          lastScrollX = newScrollX;
25066
          updateUi.throttle();
25729
          updateUi.throttle();
25067
        }
25730
        }
25068
        ui.updateMode();
25731
        ui.updateMode();
Línea 25078... Línea 25741...
25078
        elementLoad.clear();
25741
        elementLoad.clear();
25079
      });
25742
      });
25080
    };
25743
    };
25081
    const render = (editor, uiRefs, rawUiConfig, backstage, args) => {
25744
    const render = (editor, uiRefs, rawUiConfig, backstage, args) => {
25082
      const {mainUi} = uiRefs;
25745
      const {mainUi} = uiRefs;
25083
      const floatContainer = value$2();
25746
      const floatContainer = value$4();
25084
      const targetElm = SugarElement.fromDom(args.targetNode);
25747
      const targetElm = SugarElement.fromDom(args.targetNode);
25085
      const ui = InlineHeader(editor, targetElm, uiRefs, backstage, floatContainer);
25748
      const ui = InlineHeader(editor, targetElm, uiRefs, backstage, floatContainer);
25086
      const toolbarPersist = isToolbarPersist(editor);
25749
      const toolbarPersist = isToolbarPersist(editor);
25087
      inline(editor);
25750
      inline(editor);
25088
      const render = () => {
25751
      const render = () => {
Línea 25097... Línea 25760...
25097
          attachSystemAfter(targetElm, uiRefs.popupUi.mothership);
25760
          attachSystemAfter(targetElm, uiRefs.popupUi.mothership);
25098
        } else {
25761
        } else {
25099
          attachSystem(uiContainer, mainUi.mothership);
25762
          attachSystem(uiContainer, mainUi.mothership);
25100
        }
25763
        }
25101
        attachSystem(uiContainer, uiRefs.dialogUi.mothership);
25764
        attachSystem(uiContainer, uiRefs.dialogUi.mothership);
-
 
25765
        const setup = () => {
25102
        setToolbar(editor, uiRefs, rawUiConfig, backstage);
25766
          setToolbar(editor, uiRefs, rawUiConfig, backstage);
25103
        OuterContainer.setMenubar(mainUi.outerContainer, identifyMenus(editor, rawUiConfig));
25767
          OuterContainer.setMenubar(mainUi.outerContainer, identifyMenus(editor, rawUiConfig));
25104
        ui.show();
25768
          ui.show();
25105
        setupEvents(editor, targetElm, ui, toolbarPersist);
25769
          setupEvents(editor, targetElm, ui, toolbarPersist);
25106
        editor.nodeChanged();
25770
          editor.nodeChanged();
-
 
25771
        };
-
 
25772
        if (toolbarPersist) {
-
 
25773
          editor.once('SkinLoaded', setup);
-
 
25774
        } else {
-
 
25775
          setup();
-
 
25776
        }
25107
      };
25777
      };
25108
      editor.on('show', render);
25778
      editor.on('show', render);
25109
      editor.on('hide', ui.hide);
25779
      editor.on('hide', ui.hide);
25110
      if (!toolbarPersist) {
25780
      if (!toolbarPersist) {
25111
        editor.on('focus', render);
25781
        editor.on('focus', render);
Línea 25114... Línea 25784...
25114
      editor.on('init', () => {
25784
      editor.on('init', () => {
25115
        if (editor.hasFocus() || toolbarPersist) {
25785
        if (editor.hasFocus() || toolbarPersist) {
25116
          render();
25786
          render();
25117
        }
25787
        }
25118
      });
25788
      });
25119
      setupReadonlyModeSwitch(editor, uiRefs);
25789
      setupEventsForUi(editor, uiRefs);
25120
      const api = {
25790
      const api = {
25121
        show: render,
25791
        show: render,
25122
        hide: ui.hide,
25792
        hide: ui.hide,
25123
        setEnabled: state => {
25793
        setEnabled: state => {
-
 
25794
          const eventType = state ? 'setEnabled' : 'setDisabled';
25124
          broadcastReadonly(uiRefs, !state);
25795
          broadcastEvents(uiRefs, eventType);
25125
        },
25796
        },
25126
        isEnabled: () => !Disabling.isDisabled(mainUi.outerContainer)
25797
        isEnabled: () => !Disabling.isDisabled(mainUi.outerContainer)
25127
      };
25798
      };
25128
      return {
25799
      return {
25129
        editorContainer: mainUi.outerContainer.element.dom,
25800
        editorContainer: mainUi.outerContainer.element.dom,
Línea 25135... Línea 25806...
25135
        __proto__: null,
25806
        __proto__: null,
25136
        render: render
25807
        render: render
25137
    });
25808
    });
Línea 25138... Línea 25809...
25138
 
25809
 
25139
    const LazyUiReferences = () => {
25810
    const LazyUiReferences = () => {
25140
      const dialogUi = value$2();
25811
      const dialogUi = value$4();
25141
      const popupUi = value$2();
25812
      const popupUi = value$4();
25142
      const mainUi = value$2();
25813
      const mainUi = value$4();
25143
      const lazyGetInOuterOrDie = (label, f) => () => mainUi.get().bind(oc => f(oc.outerContainer)).getOrDie(`Could not find ${ label } element in OuterContainer`);
25814
      const lazyGetInOuterOrDie = (label, f) => () => mainUi.get().bind(oc => f(oc.outerContainer)).getOrDie(`Could not find ${ label } element in OuterContainer`);
25144
      const getUiMotherships = () => {
25815
      const getUiMotherships = () => {
25145
        const optDialogMothership = dialogUi.get().map(ui => ui.mothership);
25816
        const optDialogMothership = dialogUi.get().map(ui => ui.mothership);
25146
        const optPopupMothership = popupUi.get().map(ui => ui.mothership);
25817
        const optPopupMothership = popupUi.get().map(ui => ui.mothership);
Línea 25159... Línea 25830...
25159
    };
25830
    };
Línea 25160... Línea 25831...
25160
 
25831
 
25161
    const showContextToolbarEvent = 'contexttoolbar-show';
25832
    const showContextToolbarEvent = 'contexttoolbar-show';
Línea -... Línea 25833...
-
 
25833
    const hideContextToolbarEvent = 'contexttoolbar-hide';
25162
    const hideContextToolbarEvent = 'contexttoolbar-hide';
25834
 
25163
 
25835
    const contextFormInputSelector = '.tox-toolbar-slider__input,.tox-toolbar-textfield';
-
 
25836
    const focusIn = contextbar => {
-
 
25837
      InlineView.getContent(contextbar).each(comp => {
-
 
25838
        descendant(comp.element, contextFormInputSelector).fold(() => Keying.focusIn(comp), focus$3);
-
 
25839
      });
25164
    const getFormApi = input => ({
25840
    };
-
 
25841
    const focusParent = comp => search(comp.element).each(focus => {
-
 
25842
      ancestor(focus, '[tabindex="-1"]').each(parent => {
25165
      hide: () => emit(input, sandboxClose()),
25843
        focus$3(parent);
-
 
25844
      });
-
 
25845
    });
-
 
25846
 
-
 
25847
    const forwardSlideEvent = generate$6('forward-slide');
-
 
25848
    const backSlideEvent = generate$6('backward-slide');
-
 
25849
    const changeSlideEvent = generate$6('change-slide-event');
-
 
25850
    const resizingClass = 'tox-pop--resizing';
-
 
25851
    const renderContextToolbar = spec => {
-
 
25852
      const stack = Cell([]);
-
 
25853
      return InlineView.sketch({
-
 
25854
        dom: {
-
 
25855
          tag: 'div',
-
 
25856
          classes: ['tox-pop']
-
 
25857
        },
-
 
25858
        fireDismissalEventInstead: { event: 'doNotDismissYet' },
-
 
25859
        onShow: comp => {
-
 
25860
          stack.set([]);
-
 
25861
          InlineView.getContent(comp).each(c => {
-
 
25862
            remove$7(c.element, 'visibility');
-
 
25863
          });
-
 
25864
          remove$3(comp.element, resizingClass);
-
 
25865
          remove$7(comp.element, 'width');
-
 
25866
        },
-
 
25867
        onHide: () => {
-
 
25868
          spec.onHide();
-
 
25869
        },
-
 
25870
        inlineBehaviours: derive$1([
-
 
25871
          config('context-toolbar-events', [
-
 
25872
            runOnSource(transitionend(), (comp, se) => {
-
 
25873
              if (se.event.raw.propertyName === 'width') {
-
 
25874
                remove$3(comp.element, resizingClass);
-
 
25875
                remove$7(comp.element, 'width');
-
 
25876
              }
-
 
25877
            }),
-
 
25878
            run$1(changeSlideEvent, (comp, se) => {
-
 
25879
              const elem = comp.element;
-
 
25880
              remove$7(elem, 'width');
-
 
25881
              const currentWidth = get$d(elem);
-
 
25882
              remove$7(elem, 'left');
-
 
25883
              remove$7(elem, 'right');
-
 
25884
              remove$7(elem, 'max-width');
-
 
25885
              InlineView.setContent(comp, se.event.contents);
-
 
25886
              add$2(elem, resizingClass);
-
 
25887
              const newWidth = get$d(elem);
-
 
25888
              set$8(elem, 'transition', 'none');
-
 
25889
              InlineView.reposition(comp);
-
 
25890
              remove$7(elem, 'transition');
-
 
25891
              set$8(elem, 'width', currentWidth + 'px');
-
 
25892
              se.event.focus.fold(() => focusIn(comp), f => {
-
 
25893
                focus$3(f);
-
 
25894
                if (search(elem).isNone()) {
-
 
25895
                  focusIn(comp);
-
 
25896
                }
-
 
25897
              });
-
 
25898
              setTimeout(() => {
-
 
25899
                set$8(comp.element, 'width', newWidth + 'px');
-
 
25900
              }, 0);
-
 
25901
            }),
-
 
25902
            run$1(forwardSlideEvent, (comp, se) => {
-
 
25903
              InlineView.getContent(comp).each(oldContents => {
-
 
25904
                stack.set(stack.get().concat([{
-
 
25905
                    bar: oldContents,
-
 
25906
                    focus: active$1(getRootNode(comp.element))
-
 
25907
                  }]));
-
 
25908
              });
-
 
25909
              emitWith(comp, changeSlideEvent, {
-
 
25910
                contents: se.event.forwardContents,
-
 
25911
                focus: Optional.none()
-
 
25912
              });
-
 
25913
            }),
-
 
25914
            run$1(backSlideEvent, (comp, _se) => {
-
 
25915
              spec.onBack();
-
 
25916
              last$1(stack.get()).each(last => {
-
 
25917
                stack.set(stack.get().slice(0, stack.get().length - 1));
-
 
25918
                emitWith(comp, changeSlideEvent, {
-
 
25919
                  contents: premade(last.bar),
-
 
25920
                  focus: last.focus
-
 
25921
                });
-
 
25922
              });
-
 
25923
            })
-
 
25924
          ]),
-
 
25925
          Keying.config({
-
 
25926
            mode: 'special',
-
 
25927
            onEscape: comp => last$1(stack.get()).fold(() => spec.onEscape(), _ => {
-
 
25928
              emit(comp, backSlideEvent);
-
 
25929
              return Optional.some(true);
-
 
25930
            })
-
 
25931
          })
-
 
25932
        ]),
-
 
25933
        lazySink: () => Result.value(spec.sink)
-
 
25934
      });
-
 
25935
    };
-
 
25936
 
-
 
25937
    const getFormApi = (input, focusfallbackElement) => {
-
 
25938
      const valueState = value$4();
-
 
25939
      return {
-
 
25940
        setInputEnabled: state => {
-
 
25941
          if (!state && focusfallbackElement) {
-
 
25942
            focus$3(focusfallbackElement);
-
 
25943
          }
-
 
25944
          Disabling.set(input, !state);
-
 
25945
        },
-
 
25946
        isInputEnabled: () => !Disabling.isDisabled(input),
-
 
25947
        hide: () => {
-
 
25948
          if (!valueState.isSet()) {
-
 
25949
            valueState.set(Representing.getValue(input));
-
 
25950
          }
-
 
25951
          emit(input, sandboxClose());
-
 
25952
        },
-
 
25953
        back: () => {
-
 
25954
          if (!valueState.isSet()) {
-
 
25955
            valueState.set(Representing.getValue(input));
-
 
25956
          }
-
 
25957
          emit(input, backSlideEvent);
-
 
25958
        },
-
 
25959
        getValue: () => {
-
 
25960
          return valueState.get().getOrThunk(() => Representing.getValue(input));
-
 
25961
        },
-
 
25962
        setValue: value => {
-
 
25963
          if (valueState.isSet()) {
-
 
25964
            valueState.set(value);
-
 
25965
          } else {
-
 
25966
            Representing.setValue(input, value);
-
 
25967
          }
-
 
25968
        }
-
 
25969
      };
25166
      getValue: () => Representing.getValue(input)
25970
    };
25167
    });
25971
 
25168
    const runOnExecute = (memInput, original) => run$1(internalToolbarButtonExecute, (comp, se) => {
25972
    const runOnExecute = (memInput, original) => run$1(internalToolbarButtonExecute, (comp, se) => {
25169
      const input = memInput.get(comp);
25973
      const input = memInput.get(comp);
25170
      const formApi = getFormApi(input);
25974
      const formApi = getFormApi(input, comp.element);
25171
      original.onAction(formApi, se.event.buttonApi);
25975
      original.onAction(formApi, se.event.buttonApi);
25172
    });
25976
    });
25173
    const renderContextButton = (memInput, button, providers) => {
25977
    const renderContextButton = (memInput, button, providers) => {
Línea 25210... Línea 26014...
25210
        asSpecs,
26014
        asSpecs,
25211
        findPrimary
26015
        findPrimary
25212
      };
26016
      };
25213
    };
26017
    };
Línea 25214... Línea 26018...
25214
 
26018
 
-
 
26019
    const renderContextFormSizeInput = (ctx, providersBackstage, onEnter) => {
-
 
26020
      const {width, height} = ctx.initValue();
-
 
26021
      let converter = noSizeConversion;
-
 
26022
      const enabled = true;
-
 
26023
      const ratioEvent = generate$6('ratio-event');
-
 
26024
      const getApi = getFormApi;
-
 
26025
      const makeIcon = iconName => render$3(iconName, {
-
 
26026
        tag: 'span',
-
 
26027
        classes: [
-
 
26028
          'tox-icon',
-
 
26029
          'tox-lock-icon__' + iconName
-
 
26030
        ]
-
 
26031
      }, providersBackstage.icons);
-
 
26032
      const disabled = () => !enabled;
25215
    const buildInitGroups = (ctx, providers) => {
26033
      const label = ctx.label.getOr('Constrain proportions');
-
 
26034
      const translatedLabel = providersBackstage.translate(label);
-
 
26035
      const pLock = FormCoupledInputs.parts.lock({
-
 
26036
        dom: {
-
 
26037
          tag: 'button',
-
 
26038
          classes: [
-
 
26039
            'tox-lock',
-
 
26040
            'tox-button',
-
 
26041
            'tox-button--naked',
-
 
26042
            'tox-button--icon'
-
 
26043
          ],
-
 
26044
          attributes: {
-
 
26045
            'aria-label': translatedLabel,
-
 
26046
            'data-mce-name': label
-
 
26047
          }
-
 
26048
        },
-
 
26049
        components: [
-
 
26050
          makeIcon('lock'),
-
 
26051
          makeIcon('unlock')
-
 
26052
        ],
-
 
26053
        buttonBehaviours: derive$1([
-
 
26054
          Disabling.config({ disabled }),
-
 
26055
          Tabstopping.config({}),
-
 
26056
          Tooltipping.config(providersBackstage.tooltips.getConfig({ tooltipText: translatedLabel }))
-
 
26057
        ])
25216
      const inputAttributes = ctx.label.fold(() => ({}), label => ({ 'aria-label': label }));
26058
      });
-
 
26059
      const formGroup = components => ({
-
 
26060
        dom: {
-
 
26061
          tag: 'div',
-
 
26062
          classes: ['tox-context-form__group']
-
 
26063
        },
-
 
26064
        components
-
 
26065
      });
-
 
26066
      const goToParent = comp => {
-
 
26067
        const focussableWrapperOpt = ancestor(comp.element, 'div.tox-focusable-wrapper');
-
 
26068
        return focussableWrapperOpt.fold(Optional.none, focussableWrapper => {
-
 
26069
          focus$3(focussableWrapper);
-
 
26070
          return Optional.some(true);
-
 
26071
        });
-
 
26072
      };
-
 
26073
      const getFieldPart = isField1 => FormField.parts.field({
25217
      const memInput = record(Input.sketch({
26074
        factory: Input,
-
 
26075
        inputClasses: [
25218
        inputClasses: [
26076
          'tox-textfield',
25219
          'tox-toolbar-textfield',
26077
          'tox-toolbar-textfield',
25220
          'tox-toolbar-nav-js'
26078
          'tox-textfield-size'
-
 
26079
        ],
-
 
26080
        data: isField1 ? width : height,
-
 
26081
        inputBehaviours: derive$1([
25221
        ],
26082
          Disabling.config({ disabled }),
-
 
26083
          Tabstopping.config({}),
-
 
26084
          config('size-input-toolbar-events', [run$1(focusin(), (component, _simulatedEvent) => {
-
 
26085
              emitWith(component, ratioEvent, { isField1 });
-
 
26086
            })]),
-
 
26087
          Keying.config({
25222
        data: ctx.initValue(),
26088
            mode: 'special',
-
 
26089
            onEnter,
-
 
26090
            onEscape: goToParent
-
 
26091
          })
25223
        inputAttributes,
26092
        ]),
-
 
26093
        selectOnFocus: false
-
 
26094
      });
-
 
26095
      const getLabel = label => ({
-
 
26096
        dom: {
-
 
26097
          tag: 'label',
-
 
26098
          classes: ['tox-label']
-
 
26099
        },
-
 
26100
        components: [text$2(providersBackstage.translate(label))]
-
 
26101
      });
-
 
26102
      const focusableWrapper = field => ({
-
 
26103
        dom: {
-
 
26104
          tag: 'div',
-
 
26105
          classes: [
-
 
26106
            'tox-focusable-wrapper',
-
 
26107
            'tox-toolbar-nav-item'
-
 
26108
          ]
-
 
26109
        },
25224
        selectOnFocus: true,
26110
        components: [field],
-
 
26111
        behaviours: derive$1([
-
 
26112
          Tabstopping.config({}),
-
 
26113
          Focusing.config({}),
25225
        inputBehaviours: derive$1([Keying.config({
26114
          Keying.config({
-
 
26115
            mode: 'special',
-
 
26116
            onEnter: comp => {
25226
            mode: 'special',
26117
              const focussableInputOpt = descendant(comp.element, 'input');
-
 
26118
              return focussableInputOpt.fold(Optional.none, focussableInput => {
25227
            onEnter: input => commands.findPrimary(input).map(primary => {
26119
                focus$3(focussableInput);
-
 
26120
                return Optional.some(true);
-
 
26121
              });
-
 
26122
            }
-
 
26123
          })
-
 
26124
        ])
-
 
26125
      });
-
 
26126
      const widthField = focusableWrapper(FormCoupledInputs.parts.field1(formGroup([
-
 
26127
        FormField.parts.label(getLabel('Width:')),
-
 
26128
        getFieldPart(true)
-
 
26129
      ])));
-
 
26130
      const heightField = focusableWrapper(FormCoupledInputs.parts.field2(formGroup([
-
 
26131
        FormField.parts.label(getLabel('Height:')),
-
 
26132
        getFieldPart(false)
-
 
26133
      ])));
-
 
26134
      const editorOffCell = Cell(noop);
-
 
26135
      const controlLifecycleHandlers = [
-
 
26136
        onControlAttached({
-
 
26137
          onSetup: ctx.onSetup,
-
 
26138
          getApi
-
 
26139
        }, editorOffCell),
-
 
26140
        onControlDetached({ getApi }, editorOffCell)
-
 
26141
      ];
-
 
26142
      return FormCoupledInputs.sketch({
-
 
26143
        dom: {
-
 
26144
          tag: 'div',
-
 
26145
          classes: ['tox-context-form__group']
-
 
26146
        },
-
 
26147
        components: [
-
 
26148
          widthField,
-
 
26149
          heightField,
-
 
26150
          formGroup([
-
 
26151
            getLabel(nbsp),
-
 
26152
            pLock
-
 
26153
          ])
-
 
26154
        ],
-
 
26155
        field1Name: 'width',
-
 
26156
        field2Name: 'height',
-
 
26157
        locked: true,
-
 
26158
        markers: { lockClass: 'tox-locked' },
-
 
26159
        onLockedChange: (current, other, _lock) => {
-
 
26160
          parseSize(Representing.getValue(current)).each(size => {
-
 
26161
            converter(size).each(newSize => {
-
 
26162
              Representing.setValue(other, formatSize(newSize));
-
 
26163
            });
-
 
26164
          });
-
 
26165
        },
-
 
26166
        onInput: current => emit(current, formInputEvent),
-
 
26167
        coupledFieldBehaviours: derive$1([
-
 
26168
          Focusing.config({}),
-
 
26169
          Keying.config({
-
 
26170
            mode: 'flow',
25228
              emitExecute(primary);
26171
            focusInside: FocusInsideModes.OnEnterOrSpaceMode,
-
 
26172
            cycles: false,
-
 
26173
            selector: 'button, .tox-focusable-wrapper'
-
 
26174
          }),
-
 
26175
          Disabling.config({
-
 
26176
            disabled,
-
 
26177
            onDisabled: comp => {
-
 
26178
              FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.disable);
-
 
26179
              FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.disable);
-
 
26180
              FormCoupledInputs.getLock(comp).each(Disabling.disable);
-
 
26181
            },
-
 
26182
            onEnabled: comp => {
-
 
26183
              FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.enable);
-
 
26184
              FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.enable);
-
 
26185
              FormCoupledInputs.getLock(comp).each(Disabling.enable);
-
 
26186
            }
-
 
26187
          }),
-
 
26188
          toggleOnReceive(() => providersBackstage.checkUiComponentContext('mode:design')),
-
 
26189
          config('size-input-toolbar-events2', [
-
 
26190
            run$1(ratioEvent, (component, simulatedEvent) => {
-
 
26191
              const isField1 = simulatedEvent.event.isField1;
-
 
26192
              const optCurrent = isField1 ? FormCoupledInputs.getField1(component) : FormCoupledInputs.getField2(component);
-
 
26193
              const optOther = isField1 ? FormCoupledInputs.getField2(component) : FormCoupledInputs.getField1(component);
-
 
26194
              const value1 = optCurrent.map(Representing.getValue).getOr('');
-
 
26195
              const value2 = optOther.map(Representing.getValue).getOr('');
25229
              return true;
26196
              converter = makeRatioConverter(value1, value2);
-
 
26197
            }),
-
 
26198
            run$1(formInputEvent, input => ctx.onInput(getFormApi(input))),
-
 
26199
            ...controlLifecycleHandlers
-
 
26200
          ])
-
 
26201
        ])
-
 
26202
      });
-
 
26203
    };
-
 
26204
 
-
 
26205
    const createContextFormFieldFromParts = (pLabel, pField, providers) => FormField.sketch({
-
 
26206
      dom: {
-
 
26207
        tag: 'div',
-
 
26208
        classes: ['tox-context-form__group']
-
 
26209
      },
-
 
26210
      components: [
-
 
26211
        ...pLabel.toArray(),
-
 
26212
        pField
-
 
26213
      ],
-
 
26214
      fieldBehaviours: derive$1([Disabling.config({
-
 
26215
          disabled: () => providers.checkUiComponentContext('mode:design').shouldDisable,
-
 
26216
          onDisabled: comp => {
-
 
26217
            focusParent(comp);
-
 
26218
            FormField.getField(comp).each(Disabling.disable);
-
 
26219
          },
-
 
26220
          onEnabled: comp => {
-
 
26221
            FormField.getField(comp).each(Disabling.enable);
-
 
26222
          }
-
 
26223
        })])
-
 
26224
    });
-
 
26225
 
-
 
26226
    const renderContextFormSliderInput = (ctx, providers, onEnter) => {
-
 
26227
      const editorOffCell = Cell(noop);
-
 
26228
      const pLabel = ctx.label.map(label => FormField.parts.label({
-
 
26229
        dom: {
-
 
26230
          tag: 'label',
-
 
26231
          classes: ['tox-label']
-
 
26232
        },
-
 
26233
        components: [text$2(providers.translate(label))]
-
 
26234
      }));
-
 
26235
      const pField = FormField.parts.field({
-
 
26236
        factory: Input,
-
 
26237
        type: 'range',
-
 
26238
        inputClasses: [
-
 
26239
          'tox-toolbar-slider__input',
-
 
26240
          'tox-toolbar-nav-item'
-
 
26241
        ],
-
 
26242
        inputAttributes: {
-
 
26243
          min: String(ctx.min()),
-
 
26244
          max: String(ctx.max())
-
 
26245
        },
-
 
26246
        data: ctx.initValue().toString(),
-
 
26247
        fromInputValue: value => toFloat(value).getOr(ctx.min()),
-
 
26248
        toInputValue: value => String(value),
-
 
26249
        inputBehaviours: derive$1([
-
 
26250
          Disabling.config({ disabled: () => providers.checkUiComponentContext('mode:design').shouldDisable }),
-
 
26251
          toggleOnReceive(() => providers.checkUiComponentContext('mode:design')),
-
 
26252
          Keying.config({
-
 
26253
            mode: 'special',
25230
            }),
26254
            onEnter,
25231
            onLeft: (comp, se) => {
26255
            onLeft: (comp, se) => {
25232
              se.cut();
26256
              se.cut();
25233
              return Optional.none();
26257
              return Optional.none();
25234
            },
26258
            },
25235
            onRight: (comp, se) => {
26259
            onRight: (comp, se) => {
25236
              se.cut();
26260
              se.cut();
25237
              return Optional.none();
26261
              return Optional.none();
25238
            }
26262
            }
-
 
26263
          }),
-
 
26264
          config('slider-events', [
-
 
26265
            onControlAttached({
-
 
26266
              onSetup: ctx.onSetup,
-
 
26267
              getApi: getFormApi,
-
 
26268
              onBeforeSetup: Keying.focusIn
-
 
26269
            }, editorOffCell),
-
 
26270
            onControlDetached({ getApi: getFormApi }, editorOffCell),
-
 
26271
            run$1(input(), comp => {
-
 
26272
              ctx.onInput(getFormApi(comp));
-
 
26273
            })
-
 
26274
          ])
-
 
26275
        ])
-
 
26276
      });
-
 
26277
      return createContextFormFieldFromParts(pLabel, pField, providers);
-
 
26278
    };
-
 
26279
 
-
 
26280
    const renderContextFormTextInput = (ctx, providers, onEnter) => {
-
 
26281
      const editorOffCell = Cell(noop);
-
 
26282
      const pLabel = ctx.label.map(label => FormField.parts.label({
-
 
26283
        dom: {
-
 
26284
          tag: 'label',
-
 
26285
          classes: ['tox-label']
-
 
26286
        },
25239
          })])
26287
        components: [text$2(providers.translate(label))]
-
 
26288
      }));
-
 
26289
      const placeholder = ctx.placeholder.map(p => ({ placeholder: providers.translate(p) })).getOr({});
-
 
26290
      const inputAttributes = { ...placeholder };
-
 
26291
      const pField = FormField.parts.field({
-
 
26292
        factory: Input,
-
 
26293
        inputClasses: [
-
 
26294
          'tox-toolbar-textfield',
-
 
26295
          'tox-toolbar-nav-item'
-
 
26296
        ],
-
 
26297
        inputAttributes,
-
 
26298
        data: ctx.initValue(),
-
 
26299
        selectOnFocus: true,
-
 
26300
        inputBehaviours: derive$1([
-
 
26301
          Disabling.config({ disabled: () => providers.checkUiComponentContext('mode:design').shouldDisable }),
-
 
26302
          toggleOnReceive(() => providers.checkUiComponentContext('mode:design')),
-
 
26303
          Keying.config({
-
 
26304
            mode: 'special',
-
 
26305
            onEnter,
-
 
26306
            onLeft: (comp, se) => {
-
 
26307
              se.cut();
-
 
26308
              return Optional.none();
-
 
26309
            },
-
 
26310
            onRight: (comp, se) => {
-
 
26311
              se.cut();
-
 
26312
              return Optional.none();
-
 
26313
            }
-
 
26314
          }),
-
 
26315
          config('input-events', [
-
 
26316
            onControlAttached({
-
 
26317
              onSetup: ctx.onSetup,
-
 
26318
              getApi: comp => {
-
 
26319
                const closestFocussableOpt = ancestor(comp.element, '.tox-toolbar').bind(toolbar => descendant(toolbar, 'button:enabled'));
-
 
26320
                return closestFocussableOpt.fold(() => getFormApi(comp), closestFocussable => getFormApi(comp, closestFocussable));
-
 
26321
              },
-
 
26322
              onBeforeSetup: Keying.focusIn
-
 
26323
            }, editorOffCell),
-
 
26324
            onControlDetached({ getApi: getFormApi }, editorOffCell),
-
 
26325
            run$1(input(), comp => {
-
 
26326
              ctx.onInput(getFormApi(comp));
-
 
26327
            })
-
 
26328
          ])
-
 
26329
        ])
-
 
26330
      });
-
 
26331
      return createContextFormFieldFromParts(pLabel, pField, providers);
-
 
26332
    };
-
 
26333
 
-
 
26334
    const buildInitGroup = (f, ctx, providers) => {
-
 
26335
      const onEnter = input => {
-
 
26336
        return startCommands.findPrimary(input).orThunk(() => endCommands.findPrimary(input)).map(primary => {
-
 
26337
          emitExecute(primary);
-
 
26338
          return true;
-
 
26339
        });
-
 
26340
      };
-
 
26341
      const memInput = record(f(providers, onEnter));
-
 
26342
      const commandParts = partition$3(ctx.commands, command => command.align === 'start');
25240
      }));
26343
      const startCommands = generate(memInput, commandParts.pass, providers);
25241
      const commands = generate(memInput, ctx.commands, providers);
26344
      const endCommands = generate(memInput, commandParts.fail, providers);
-
 
26345
      return filter$2([
-
 
26346
        {
-
 
26347
          title: Optional.none(),
-
 
26348
          label: Optional.none(),
-
 
26349
          items: startCommands.asSpecs()
25242
      return [
26350
        },
25243
        {
26351
        {
-
 
26352
          title: Optional.none(),
25244
          title: Optional.none(),
26353
          label: Optional.none(),
25245
          items: [memInput.asSpec()]
26354
          items: [memInput.asSpec()]
25246
        },
26355
        },
25247
        {
26356
        {
-
 
26357
          title: Optional.none(),
25248
          title: Optional.none(),
26358
          label: Optional.none(),
25249
          items: commands.asSpecs()
26359
          items: endCommands.asSpecs()
-
 
26360
        }
-
 
26361
      ], group => group.items.length > 0);
-
 
26362
    };
-
 
26363
    const buildInitGroups = (ctx, providers) => {
-
 
26364
      switch (ctx.type) {
-
 
26365
      case 'contextform':
-
 
26366
        return buildInitGroup(curry(renderContextFormTextInput, ctx), ctx, providers);
-
 
26367
      case 'contextsliderform':
-
 
26368
        return buildInitGroup(curry(renderContextFormSliderInput, ctx), ctx, providers);
-
 
26369
      case 'contextsizeinputform':
25250
        }
26370
        return buildInitGroup(curry(renderContextFormSizeInput, ctx), ctx, providers);
25251
      ];
26371
      }
25252
    };
26372
    };
25253
    const renderContextForm = (toolbarType, ctx, providers) => renderToolbar({
26373
    const renderContextForm = (toolbarType, ctx, providers) => renderToolbar({
25254
      type: toolbarType,
26374
      type: toolbarType,
25255
      uid: generate$6('context-toolbar'),
26375
      uid: generate$6('context-toolbar'),
Línea 25276... Línea 26396...
25276
    };
26396
    };
25277
    const getSelectionBounds = editor => {
26397
    const getSelectionBounds = editor => {
25278
      const rng = editor.selection.getRng();
26398
      const rng = editor.selection.getRng();
25279
      const rect = getRangeRect(rng);
26399
      const rect = getRangeRect(rng);
25280
      if (editor.inline) {
26400
      if (editor.inline) {
25281
        const scroll = get$b();
26401
        const scroll = get$c();
25282
        return bounds(scroll.left + rect.left, scroll.top + rect.top, rect.width, rect.height);
26402
        return bounds(scroll.left + rect.left, scroll.top + rect.top, rect.width, rect.height);
25283
      } else {
26403
      } else {
25284
        const bodyPos = absolute$2(SugarElement.fromDom(editor.getBody()));
26404
        const bodyPos = absolute$2(SugarElement.fromDom(editor.getBody()));
25285
        return bounds(bodyPos.x + rect.left, bodyPos.y + rect.top, rect.width, rect.height);
26405
        return bounds(bodyPos.x + rect.left, bodyPos.y + rect.top, rect.width, rect.height);
25286
      }
26406
      }
Línea 25376... Línea 26496...
25376
        return preservePosition(contextbar, data.getMode(), () => {
26496
        return preservePosition(contextbar, data.getMode(), () => {
25377
          const isOverlapping = isVerticalOverlap(selectionBounds, box$1(contextbar), -20);
26497
          const isOverlapping = isVerticalOverlap(selectionBounds, box$1(contextbar), -20);
25378
          return isOverlapping && !data.isReposition() ? flip : preserve;
26498
          return isOverlapping && !data.isReposition() ? flip : preserve;
25379
        });
26499
        });
25380
      } else {
26500
      } else {
25381
        const yBounds = data.getMode() === 'fixed' ? bounds.y + get$b().top : bounds.y;
26501
        const yBounds = data.getMode() === 'fixed' ? bounds.y + get$c().top : bounds.y;
25382
        const contextbarHeight = get$d(contextbar) + bubbleSize$1;
26502
        const contextbarHeight = get$e(contextbar) + bubbleSize$1;
25383
        return yBounds + contextbarHeight <= selectionBounds.y ? north : south;
26503
        return yBounds + contextbarHeight <= selectionBounds.y ? north : south;
25384
      }
26504
      }
25385
    };
26505
    };
25386
    const getAnchorSpec$2 = (editor, mobile, data, position) => {
26506
    const getAnchorSpec$2 = (editor, mobile, data, position) => {
25387
      const smartInsetLayout = elem => (anchor, element, bubbles, placee, bounds) => {
26507
      const smartInsetLayout = elem => (anchor, element, bubbles, placee, bounds) => {
Línea 25585... Línea 26705...
25585
        });
26705
        });
25586
      };
26706
      };
25587
      const keys$1 = keys(contextToolbars);
26707
      const keys$1 = keys(contextToolbars);
25588
      each$1(keys$1, key => {
26708
      each$1(keys$1, key => {
25589
        const toolbarApi = contextToolbars[key];
26709
        const toolbarApi = contextToolbars[key];
25590
        if (toolbarApi.type === 'contextform') {
26710
        if (toolbarApi.type === 'contextform' || toolbarApi.type === 'contextsliderform' || toolbarApi.type === 'contextsizeinputform') {
25591
          registerForm(key, toolbarApi);
26711
          registerForm(key, toolbarApi);
25592
        } else if (toolbarApi.type === 'contexttoolbar') {
26712
        } else if (toolbarApi.type === 'contexttoolbar') {
25593
          registerToolbar(key, toolbarApi);
26713
          registerToolbar(key, toolbarApi);
25594
        }
26714
        }
25595
      });
26715
      });
Línea 25600... Línea 26720...
25600
        lookupTable,
26720
        lookupTable,
25601
        formNavigators
26721
        formNavigators
25602
      };
26722
      };
25603
    };
26723
    };
Línea 25604... Línea -...
25604
 
-
 
25605
    const forwardSlideEvent = generate$6('forward-slide');
-
 
25606
    const backSlideEvent = generate$6('backward-slide');
-
 
25607
    const changeSlideEvent = generate$6('change-slide-event');
-
 
25608
    const resizingClass = 'tox-pop--resizing';
-
 
25609
    const renderContextToolbar = spec => {
-
 
25610
      const stack = Cell([]);
-
 
25611
      return InlineView.sketch({
-
 
25612
        dom: {
-
 
25613
          tag: 'div',
-
 
25614
          classes: ['tox-pop']
-
 
25615
        },
-
 
25616
        fireDismissalEventInstead: { event: 'doNotDismissYet' },
-
 
25617
        onShow: comp => {
-
 
25618
          stack.set([]);
-
 
25619
          InlineView.getContent(comp).each(c => {
-
 
25620
            remove$6(c.element, 'visibility');
-
 
25621
          });
-
 
25622
          remove$2(comp.element, resizingClass);
-
 
25623
          remove$6(comp.element, 'width');
-
 
25624
        },
-
 
25625
        inlineBehaviours: derive$1([
-
 
25626
          config('context-toolbar-events', [
-
 
25627
            runOnSource(transitionend(), (comp, se) => {
-
 
25628
              if (se.event.raw.propertyName === 'width') {
-
 
25629
                remove$2(comp.element, resizingClass);
-
 
25630
                remove$6(comp.element, 'width');
-
 
25631
              }
-
 
25632
            }),
-
 
25633
            run$1(changeSlideEvent, (comp, se) => {
-
 
25634
              const elem = comp.element;
-
 
25635
              remove$6(elem, 'width');
-
 
25636
              const currentWidth = get$c(elem);
-
 
25637
              InlineView.setContent(comp, se.event.contents);
-
 
25638
              add$2(elem, resizingClass);
-
 
25639
              const newWidth = get$c(elem);
-
 
25640
              set$8(elem, 'width', currentWidth + 'px');
-
 
25641
              InlineView.getContent(comp).each(newContents => {
-
 
25642
                se.event.focus.bind(f => {
-
 
25643
                  focus$3(f);
-
 
25644
                  return search(elem);
-
 
25645
                }).orThunk(() => {
-
 
25646
                  Keying.focusIn(newContents);
-
 
25647
                  return active$1(getRootNode(elem));
-
 
25648
                });
-
 
25649
              });
-
 
25650
              setTimeout(() => {
-
 
25651
                set$8(comp.element, 'width', newWidth + 'px');
-
 
25652
              }, 0);
-
 
25653
            }),
-
 
25654
            run$1(forwardSlideEvent, (comp, se) => {
-
 
25655
              InlineView.getContent(comp).each(oldContents => {
-
 
25656
                stack.set(stack.get().concat([{
-
 
25657
                    bar: oldContents,
-
 
25658
                    focus: active$1(getRootNode(comp.element))
-
 
25659
                  }]));
-
 
25660
              });
-
 
25661
              emitWith(comp, changeSlideEvent, {
-
 
25662
                contents: se.event.forwardContents,
-
 
25663
                focus: Optional.none()
-
 
25664
              });
-
 
25665
            }),
-
 
25666
            run$1(backSlideEvent, (comp, _se) => {
-
 
25667
              last$1(stack.get()).each(last => {
-
 
25668
                stack.set(stack.get().slice(0, stack.get().length - 1));
-
 
25669
                emitWith(comp, changeSlideEvent, {
-
 
25670
                  contents: premade(last.bar),
-
 
25671
                  focus: last.focus
-
 
25672
                });
-
 
25673
              });
-
 
25674
            })
-
 
25675
          ]),
-
 
25676
          Keying.config({
-
 
25677
            mode: 'special',
-
 
25678
            onEscape: comp => last$1(stack.get()).fold(() => spec.onEscape(), _ => {
-
 
25679
              emit(comp, backSlideEvent);
-
 
25680
              return Optional.some(true);
-
 
25681
            })
-
 
25682
          })
-
 
25683
        ]),
-
 
25684
        lazySink: () => Result.value(spec.sink)
-
 
25685
      });
-
 
25686
    };
-
 
25687
 
26724
 
25688
    const transitionClass = 'tox-pop--transition';
26725
    const transitionClass = 'tox-pop--transition';
25689
    const register$9 = (editor, registryContextToolbars, sink, extras) => {
26726
    const register$a = (editor, registryContextToolbars, sink, extras) => {
25690
      const backstage = extras.backstage;
26727
      const backstage = extras.backstage;
25691
      const sharedBackstage = backstage.shared;
26728
      const sharedBackstage = backstage.shared;
25692
      const isTouch = detect$2().deviceType.isTouch;
26729
      const isTouch = detect$1().deviceType.isTouch;
25693
      const lastElement = value$2();
26730
      const lastElement = value$4();
25694
      const lastTrigger = value$2();
26731
      const lastTrigger = value$4();
25695
      const lastContextPosition = value$2();
26732
      const lastContextPosition = value$4();
25696
      const contextbar = build$1(renderContextToolbar({
26733
      const contextbar = build$1(renderContextToolbar({
25697
        sink,
26734
        sink,
25698
        onEscape: () => {
26735
        onEscape: () => {
-
 
26736
          editor.focus();
25699
          editor.focus();
26737
          fireContextToolbarClose(editor);
-
 
26738
          return Optional.some(true);
-
 
26739
        },
-
 
26740
        onHide: () => {
-
 
26741
          fireContextToolbarClose(editor);
-
 
26742
        },
-
 
26743
        onBack: () => {
25700
          return Optional.some(true);
26744
          fireContextFormSlideBack(editor);
25701
        }
26745
        }
25702
      }));
26746
      }));
25703
      const getBounds = () => {
26747
      const getBounds = () => {
25704
        const position = lastContextPosition.get().getOr('node');
26748
        const position = lastContextPosition.get().getOr('node');
Línea 25725... Línea 26769...
25725
        InlineView.hide(contextbar);
26769
        InlineView.hide(contextbar);
25726
      };
26770
      };
25727
      const hideOrRepositionIfNecessary = () => {
26771
      const hideOrRepositionIfNecessary = () => {
25728
        if (InlineView.isOpen(contextbar)) {
26772
        if (InlineView.isOpen(contextbar)) {
25729
          const contextBarEle = contextbar.element;
26773
          const contextBarEle = contextbar.element;
25730
          remove$6(contextBarEle, 'display');
26774
          remove$7(contextBarEle, 'display');
25731
          if (shouldContextToolbarHide()) {
26775
          if (shouldContextToolbarHide()) {
25732
            set$8(contextBarEle, 'display', 'none');
26776
            set$8(contextBarEle, 'display', 'none');
25733
          } else {
26777
          } else {
25734
            lastTrigger.set(0);
26778
            lastTrigger.set(0);
25735
            InlineView.reposition(contextbar);
26779
            InlineView.reposition(contextbar);
Línea 25756... Línea 26800...
25756
      });
26800
      });
25757
      const getScopes = cached(() => categorise(registryContextToolbars, toolbarApi => {
26801
      const getScopes = cached(() => categorise(registryContextToolbars, toolbarApi => {
25758
        const alloySpec = buildToolbar([toolbarApi]);
26802
        const alloySpec = buildToolbar([toolbarApi]);
25759
        emitWith(contextbar, forwardSlideEvent, { forwardContents: wrapInPopDialog(alloySpec) });
26803
        emitWith(contextbar, forwardSlideEvent, { forwardContents: wrapInPopDialog(alloySpec) });
25760
      }));
26804
      }));
25761
      const buildContextToolbarGroups = (allButtons, ctx) => identifyButtons(editor, {
26805
      const buildContextToolbarGroups = (allButtons, ctx) => {
-
 
26806
        return identifyButtons(editor, {
25762
        buttons: allButtons,
26807
          buttons: allButtons,
25763
        toolbar: ctx.items,
26808
          toolbar: ctx.items,
25764
        allowToolbarGroups: false
26809
          allowToolbarGroups: false
25765
      }, extras.backstage, Optional.some(['form:']));
26810
        }, extras.backstage, Optional.some(['form:']));
-
 
26811
      };
25766
      const buildContextFormGroups = (ctx, providers) => ContextForm.buildInitGroups(ctx, providers);
26812
      const buildContextFormGroups = (ctx, providers) => ContextForm.buildInitGroups(ctx, providers);
25767
      const buildToolbar = toolbars => {
26813
      const buildToolbar = toolbars => {
25768
        const {buttons} = editor.ui.registry.getAll();
26814
        const {buttons} = editor.ui.registry.getAll();
25769
        const scopes = getScopes();
26815
        const scopes = getScopes();
25770
        const allButtons = {
26816
        const allButtons = {
25771
          ...buttons,
26817
          ...buttons,
25772
          ...scopes.formNavigators
26818
          ...scopes.formNavigators
25773
        };
26819
        };
25774
        const toolbarType = getToolbarMode(editor) === ToolbarMode$1.scrolling ? ToolbarMode$1.scrolling : ToolbarMode$1.default;
26820
        const toolbarType = getToolbarMode(editor) === ToolbarMode$1.scrolling ? ToolbarMode$1.scrolling : ToolbarMode$1.default;
25775
        const initGroups = flatten(map$2(toolbars, ctx => ctx.type === 'contexttoolbar' ? buildContextToolbarGroups(allButtons, ctx) : buildContextFormGroups(ctx, sharedBackstage.providers)));
26821
        const initGroups = flatten(map$2(toolbars, ctx => ctx.type === 'contexttoolbar' ? buildContextToolbarGroups(allButtons, contextToolbarToSpec(ctx)) : buildContextFormGroups(ctx, sharedBackstage.providers)));
25776
        return renderToolbar({
26822
        return renderToolbar({
25777
          type: toolbarType,
26823
          type: toolbarType,
25778
          uid: generate$6('context-toolbar'),
26824
          uid: generate$6('context-toolbar'),
25779
          initGroups,
26825
          initGroups,
25780
          onEscape: Optional.none,
26826
          onEscape: Optional.none,
Línea 25800... Línea 26846...
25800
        const position = toolbarApi[0].position;
26846
        const position = toolbarApi[0].position;
25801
        const anchor = getAnchor(position, elem);
26847
        const anchor = getAnchor(position, elem);
25802
        lastContextPosition.set(position);
26848
        lastContextPosition.set(position);
25803
        lastTrigger.set(1);
26849
        lastTrigger.set(1);
25804
        const contextBarEle = contextbar.element;
26850
        const contextBarEle = contextbar.element;
25805
        remove$6(contextBarEle, 'display');
26851
        remove$7(contextBarEle, 'display');
25806
        if (!isSameLaunchElement(elem)) {
26852
        if (!isSameLaunchElement(elem)) {
25807
          remove$2(contextBarEle, transitionClass);
26853
          remove$3(contextBarEle, transitionClass);
25808
          Positioning.reset(sink, contextbar);
26854
          Positioning.reset(sink, contextbar);
25809
        }
26855
        }
25810
        InlineView.showWithinBounds(contextbar, wrapInPopDialog(toolbarSpec), {
26856
        InlineView.showWithinBounds(contextbar, wrapInPopDialog(toolbarSpec), {
25811
          anchor,
26857
          anchor,
25812
          transition: {
26858
          transition: {
Línea 25838... Línea 26884...
25838
        editor.on('ScrollContent ScrollWindow ObjectResized ResizeEditor longpress', hideOrRepositionIfNecessary);
26884
        editor.on('ScrollContent ScrollWindow ObjectResized ResizeEditor longpress', hideOrRepositionIfNecessary);
25839
        editor.on('click keyup focus SetContent', launchContextToolbar.throttle);
26885
        editor.on('click keyup focus SetContent', launchContextToolbar.throttle);
25840
        editor.on(hideContextToolbarEvent, close);
26886
        editor.on(hideContextToolbarEvent, close);
25841
        editor.on(showContextToolbarEvent, e => {
26887
        editor.on(showContextToolbarEvent, e => {
25842
          const scopes = getScopes();
26888
          const scopes = getScopes();
25843
          get$g(scopes.lookupTable, e.toolbarKey).each(ctx => {
26889
          get$h(scopes.lookupTable, e.toolbarKey).each(ctx => {
25844
            launchContext([ctx], someIf(e.target !== editor, e.target));
26890
            launchContext([ctx], someIf(e.target !== editor, e.target));
25845
            InlineView.getContent(contextbar).each(Keying.focusIn);
26891
            focusIn(contextbar);
25846
          });
26892
          });
25847
        });
26893
        });
25848
        editor.on('focusout', _e => {
26894
        editor.on('focusout', _e => {
25849
          global$9.setEditorTimeout(editor, () => {
26895
          global$9.setEditorTimeout(editor, () => {
25850
            if (search(sink.element).isNone() && search(contextbar.element).isNone()) {
26896
            if (search(sink.element).isNone() && search(contextbar.element).isNone()) {
Línea 25855... Línea 26901...
25855
        editor.on('SwitchMode', () => {
26901
        editor.on('SwitchMode', () => {
25856
          if (editor.mode.isReadOnly()) {
26902
          if (editor.mode.isReadOnly()) {
25857
            close();
26903
            close();
25858
          }
26904
          }
25859
        });
26905
        });
-
 
26906
        editor.on('DisabledStateChange', e => {
-
 
26907
          if (e.state) {
-
 
26908
            close();
-
 
26909
          }
-
 
26910
        });
-
 
26911
        editor.on('ExecCommand', ({command}) => {
-
 
26912
          if (command.toLowerCase() === 'toggleview') {
-
 
26913
            close();
-
 
26914
          }
-
 
26915
        });
25860
        editor.on('AfterProgressState', event => {
26916
        editor.on('AfterProgressState', event => {
25861
          if (event.state) {
26917
          if (event.state) {
25862
            close();
26918
            close();
25863
          } else if (editor.hasFocus()) {
26919
          } else if (editor.hasFocus()) {
25864
            launchContextToolbar.throttle();
26920
            launchContextToolbar.throttle();
Línea 25874... Línea 26930...
25874
          search(contextbar.element).fold(launchContextToolbar.throttle, noop);
26930
          search(contextbar.element).fold(launchContextToolbar.throttle, noop);
25875
        });
26931
        });
25876
      });
26932
      });
25877
    };
26933
    };
Línea 25878... Línea 26934...
25878
 
26934
 
25879
    const register$8 = editor => {
26935
    const register$9 = editor => {
25880
      const alignToolbarButtons = [
26936
      const alignToolbarButtons = [
25881
        {
26937
        {
25882
          name: 'alignleft',
26938
          name: 'alignleft',
25883
          text: 'Align left',
26939
          text: 'Align left',
Línea 25921... Línea 26977...
25921
 
26977
 
25922
    const registerController = (editor, spec) => {
26978
    const registerController = (editor, spec) => {
25923
      const getMenuItems = () => {
26979
      const getMenuItems = () => {
25924
        const options = spec.getOptions(editor);
26980
        const options = spec.getOptions(editor);
25925
        const initial = spec.getCurrent(editor).map(spec.hash);
26981
        const initial = spec.getCurrent(editor).map(spec.hash);
25926
        const current = value$2();
26982
        const current = value$4();
25927
        return map$2(options, value => ({
26983
        return map$2(options, value => ({
25928
          type: 'togglemenuitem',
26984
          type: 'togglemenuitem',
25929
          text: spec.display(value),
26985
          text: spec.display(value),
25930
          onSetup: api => {
26986
          onSetup: api => {
Línea 26013... Línea 27069...
26013
          return composeUnbinders(unbinder.clear, onSetupEditableToggle(editor)(api));
27069
          return composeUnbinders(unbinder.clear, onSetupEditableToggle(editor)(api));
26014
        },
27070
        },
26015
        onMenuSetup: onSetupEditableToggle(editor)
27071
        onMenuSetup: onSetupEditableToggle(editor)
26016
      }));
27072
      }));
26017
    };
27073
    };
26018
    const register$7 = editor => {
27074
    const register$8 = editor => {
26019
      registerController(editor, lineHeightSpec(editor));
27075
      registerController(editor, lineHeightSpec(editor));
26020
      languageSpec(editor).each(spec => registerController(editor, spec));
27076
      languageSpec(editor).each(spec => registerController(editor, spec));
26021
    };
27077
    };
Línea 26022... Línea 27078...
26022
 
27078
 
26023
    const register$6 = (editor, backstage) => {
27079
    const register$7 = (editor, backstage) => {
26024
      createAlignMenu(editor, backstage);
27080
      createAlignMenu(editor, backstage);
26025
      createFontFamilyMenu(editor, backstage);
27081
      createFontFamilyMenu(editor, backstage);
26026
      createStylesMenu(editor, backstage);
27082
      createStylesMenu(editor, backstage);
26027
      createBlocksMenu(editor, backstage);
27083
      createBlocksMenu(editor, backstage);
26028
      createFontSizeMenu(editor, backstage);
27084
      createFontSizeMenu(editor, backstage);
Línea -... Línea 27085...
-
 
27085
    };
-
 
27086
 
-
 
27087
    const register$6 = editor => {
-
 
27088
      editor.ui.registry.addContext('editable', () => {
-
 
27089
        return editor.selection.isEditable();
-
 
27090
      });
-
 
27091
      editor.ui.registry.addContext('mode', mode => {
-
 
27092
        return editor.mode.get() === mode;
-
 
27093
      });
-
 
27094
      editor.ui.registry.addContext('any', always);
-
 
27095
      editor.ui.registry.addContext('formatting', format => {
-
 
27096
        return editor.formatter.canApply(format);
-
 
27097
      });
-
 
27098
      editor.ui.registry.addContext('insert', child => {
-
 
27099
        return editor.schema.isValidChild(editor.selection.getNode().tagName, child);
-
 
27100
      });
26029
    };
27101
    };
26030
 
27102
 
26031
    const onSetupOutdentState = editor => onSetupEvent(editor, 'NodeChange', api => {
27103
    const onSetupOutdentState = editor => onSetupEvent(editor, 'NodeChange', api => {
26032
      api.setEnabled(editor.queryCommandState('outdent') && editor.selection.isEditable());
27104
      api.setEnabled(editor.queryCommandState('outdent') && editor.selection.isEditable());
26033
    });
27105
    });
Línea 26082... Línea 27154...
26082
    const registerFormatButtons = editor => {
27154
    const registerFormatButtons = editor => {
26083
      global$1.each([
27155
      global$1.each([
26084
        {
27156
        {
26085
          name: 'bold',
27157
          name: 'bold',
26086
          text: 'Bold',
27158
          text: 'Bold',
26087
          icon: 'bold'
27159
          icon: 'bold',
-
 
27160
          shortcut: 'Meta+B'
26088
        },
27161
        },
26089
        {
27162
        {
26090
          name: 'italic',
27163
          name: 'italic',
26091
          text: 'Italic',
27164
          text: 'Italic',
26092
          icon: 'italic'
27165
          icon: 'italic',
-
 
27166
          shortcut: 'Meta+I'
26093
        },
27167
        },
26094
        {
27168
        {
26095
          name: 'underline',
27169
          name: 'underline',
26096
          text: 'Underline',
27170
          text: 'Underline',
26097
          icon: 'underline'
27171
          icon: 'underline',
-
 
27172
          shortcut: 'Meta+U'
26098
        },
27173
        },
26099
        {
27174
        {
26100
          name: 'strikethrough',
27175
          name: 'strikethrough',
26101
          text: 'Strikethrough',
27176
          text: 'Strikethrough',
26102
          icon: 'strike-through'
27177
          icon: 'strike-through'
Línea 26114... Línea 27189...
26114
      ], (btn, _idx) => {
27189
      ], (btn, _idx) => {
26115
        editor.ui.registry.addToggleButton(btn.name, {
27190
        editor.ui.registry.addToggleButton(btn.name, {
26116
          tooltip: btn.text,
27191
          tooltip: btn.text,
26117
          icon: btn.icon,
27192
          icon: btn.icon,
26118
          onSetup: onSetupStateToggle(editor, btn.name),
27193
          onSetup: onSetupStateToggle(editor, btn.name),
26119
          onAction: onActionToggleFormat(editor, btn.name)
27194
          onAction: onActionToggleFormat(editor, btn.name),
-
 
27195
          shortcut: btn.shortcut
26120
        });
27196
        });
26121
      });
27197
      });
26122
      for (let i = 1; i <= 6; i++) {
27198
      for (let i = 1; i <= 6; i++) {
26123
        const name = 'h' + i;
27199
        const name = 'h' + i;
-
 
27200
        const shortcut = `Access+${ i }`;
26124
        editor.ui.registry.addToggleButton(name, {
27201
        editor.ui.registry.addToggleButton(name, {
26125
          text: name.toUpperCase(),
27202
          text: name.toUpperCase(),
26126
          tooltip: 'Heading ' + i,
27203
          tooltip: 'Heading ' + i,
26127
          onSetup: onSetupStateToggle(editor, name),
27204
          onSetup: onSetupStateToggle(editor, name),
26128
          onAction: onActionToggleFormat(editor, name)
27205
          onAction: onActionToggleFormat(editor, name),
-
 
27206
          shortcut
26129
        });
27207
        });
26130
      }
27208
      }
26131
    };
27209
    };
26132
    const registerCommandButtons = editor => {
27210
    const registerCommandButtons = editor => {
26133
      global$1.each([
27211
      global$1.each([
26134
        {
27212
        {
26135
          name: 'copy',
27213
          name: 'copy',
26136
          text: 'Copy',
27214
          text: 'Copy',
26137
          action: 'Copy',
27215
          action: 'Copy',
26138
          icon: 'copy'
27216
          icon: 'copy',
-
 
27217
          context: 'any'
26139
        },
27218
        },
26140
        {
27219
        {
26141
          name: 'help',
27220
          name: 'help',
26142
          text: 'Help',
27221
          text: 'Help',
26143
          action: 'mceHelp',
27222
          action: 'mceHelp',
26144
          icon: 'help'
27223
          icon: 'help',
-
 
27224
          shortcut: 'Alt+0',
-
 
27225
          context: 'any'
26145
        },
27226
        },
26146
        {
27227
        {
26147
          name: 'selectall',
27228
          name: 'selectall',
26148
          text: 'Select all',
27229
          text: 'Select all',
26149
          action: 'SelectAll',
27230
          action: 'SelectAll',
26150
          icon: 'select-all'
27231
          icon: 'select-all',
-
 
27232
          shortcut: 'Meta+A',
-
 
27233
          context: 'any'
26151
        },
27234
        },
26152
        {
27235
        {
26153
          name: 'newdocument',
27236
          name: 'newdocument',
26154
          text: 'New document',
27237
          text: 'New document',
26155
          action: 'mceNewDocument',
27238
          action: 'mceNewDocument',
Línea 26157... Línea 27240...
26157
        },
27240
        },
26158
        {
27241
        {
26159
          name: 'print',
27242
          name: 'print',
26160
          text: 'Print',
27243
          text: 'Print',
26161
          action: 'mcePrint',
27244
          action: 'mcePrint',
26162
          icon: 'print'
27245
          icon: 'print',
-
 
27246
          shortcut: 'Meta+P',
-
 
27247
          context: 'any'
26163
        }
27248
        }
26164
      ], btn => {
27249
      ], btn => {
26165
        editor.ui.registry.addButton(btn.name, {
27250
        editor.ui.registry.addButton(btn.name, {
26166
          tooltip: btn.text,
27251
          tooltip: btn.text,
26167
          icon: btn.icon,
27252
          icon: btn.icon,
26168
          onAction: onActionExecCommand(editor, btn.action)
27253
          onAction: onActionExecCommand(editor, btn.action),
-
 
27254
          shortcut: btn.shortcut,
-
 
27255
          context: btn.context
26169
        });
27256
        });
26170
      });
27257
      });
26171
      global$1.each([
27258
      global$1.each([
26172
        {
27259
        {
26173
          name: 'cut',
27260
          name: 'cut',
Línea 26239... Línea 27326...
26239
        {
27326
        {
26240
          name: 'copy',
27327
          name: 'copy',
26241
          text: 'Copy',
27328
          text: 'Copy',
26242
          action: 'Copy',
27329
          action: 'Copy',
26243
          icon: 'copy',
27330
          icon: 'copy',
26244
          shortcut: 'Meta+C'
27331
          shortcut: 'Meta+C',
-
 
27332
          context: 'any'
26245
        },
27333
        },
26246
        {
27334
        {
26247
          name: 'selectall',
27335
          name: 'selectall',
26248
          text: 'Select all',
27336
          text: 'Select all',
26249
          action: 'SelectAll',
27337
          action: 'SelectAll',
26250
          icon: 'select-all',
27338
          icon: 'select-all',
26251
          shortcut: 'Meta+A'
27339
          shortcut: 'Meta+A',
-
 
27340
          context: 'any'
26252
        },
27341
        },
26253
        {
27342
        {
26254
          name: 'print',
27343
          name: 'print',
26255
          text: 'Print...',
27344
          text: 'Print...',
26256
          action: 'mcePrint',
27345
          action: 'mcePrint',
26257
          icon: 'print',
27346
          icon: 'print',
26258
          shortcut: 'Meta+P'
27347
          shortcut: 'Meta+P',
-
 
27348
          context: 'any'
26259
        }
27349
        }
26260
      ], menuitem => {
27350
      ], menuitem => {
26261
        editor.ui.registry.addMenuItem(menuitem.name, {
27351
        editor.ui.registry.addMenuItem(menuitem.name, {
26262
          text: menuitem.text,
27352
          text: menuitem.text,
26263
          icon: menuitem.icon,
27353
          icon: menuitem.icon,
26264
          shortcut: menuitem.shortcut,
27354
          shortcut: menuitem.shortcut,
26265
          onAction: onActionExecCommand(editor, menuitem.action)
27355
          onAction: onActionExecCommand(editor, menuitem.action),
-
 
27356
          context: menuitem.context
26266
        });
27357
        });
26267
      });
27358
      });
26268
      global$1.each([
27359
      global$1.each([
26269
        {
27360
        {
26270
          name: 'bold',
27361
          name: 'bold',
Línea 26375... Línea 27466...
26375
      editor.ui.registry.addButton('undo', {
27466
      editor.ui.registry.addButton('undo', {
26376
        tooltip: 'Undo',
27467
        tooltip: 'Undo',
26377
        icon: 'undo',
27468
        icon: 'undo',
26378
        enabled: false,
27469
        enabled: false,
26379
        onSetup: onSetupUndoRedoState(editor, 'hasUndo'),
27470
        onSetup: onSetupUndoRedoState(editor, 'hasUndo'),
26380
        onAction: onActionExecCommand(editor, 'undo')
27471
        onAction: onActionExecCommand(editor, 'undo'),
-
 
27472
        shortcut: 'Meta+Z'
26381
      });
27473
      });
26382
      editor.ui.registry.addButton('redo', {
27474
      editor.ui.registry.addButton('redo', {
26383
        tooltip: 'Redo',
27475
        tooltip: 'Redo',
26384
        icon: 'redo',
27476
        icon: 'redo',
26385
        enabled: false,
27477
        enabled: false,
26386
        onSetup: onSetupUndoRedoState(editor, 'hasRedo'),
27478
        onSetup: onSetupUndoRedoState(editor, 'hasRedo'),
26387
        onAction: onActionExecCommand(editor, 'redo')
27479
        onAction: onActionExecCommand(editor, 'redo'),
-
 
27480
        shortcut: 'Meta+Y'
26388
      });
27481
      });
26389
    };
27482
    };
26390
    const register$2 = editor => {
27483
    const register$2 = editor => {
26391
      registerMenuItems$1(editor);
27484
      registerMenuItems$1(editor);
26392
      registerButtons(editor);
27485
      registerButtons(editor);
Línea 26397... Línea 27490...
26397
    });
27490
    });
26398
    const registerMenuItems = editor => {
27491
    const registerMenuItems = editor => {
26399
      editor.ui.registry.addToggleMenuItem('visualaid', {
27492
      editor.ui.registry.addToggleMenuItem('visualaid', {
26400
        text: 'Visual aids',
27493
        text: 'Visual aids',
26401
        onSetup: onSetupVisualAidState(editor),
27494
        onSetup: onSetupVisualAidState(editor),
26402
        onAction: onActionExecCommand(editor, 'mceToggleVisualAid')
27495
        onAction: onActionExecCommand(editor, 'mceToggleVisualAid'),
-
 
27496
        context: 'any'
26403
      });
27497
      });
26404
    };
27498
    };
26405
    const registerToolbarButton = editor => {
27499
    const registerToolbarButton = editor => {
26406
      editor.ui.registry.addButton('visualaid', {
27500
      editor.ui.registry.addButton('visualaid', {
26407
        tooltip: 'Visual aids',
27501
        tooltip: 'Visual aids',
26408
        text: 'Visual aids',
27502
        text: 'Visual aids',
26409
        onAction: onActionExecCommand(editor, 'mceToggleVisualAid')
27503
        onAction: onActionExecCommand(editor, 'mceToggleVisualAid'),
-
 
27504
        context: 'any'
26410
      });
27505
      });
26411
    };
27506
    };
26412
    const register$1 = editor => {
27507
    const register$1 = editor => {
26413
      registerToolbarButton(editor);
27508
      registerToolbarButton(editor);
26414
      registerMenuItems(editor);
27509
      registerMenuItems(editor);
26415
    };
27510
    };
Línea 26416... Línea 27511...
26416
 
27511
 
26417
    const setup$6 = (editor, backstage) => {
27512
    const setup$6 = (editor, backstage) => {
26418
      register$8(editor);
27513
      register$9(editor);
26419
      register$3(editor);
27514
      register$3(editor);
26420
      register$6(editor, backstage);
27515
      register$7(editor, backstage);
26421
      register$2(editor);
27516
      register$2(editor);
26422
      register$c(editor);
27517
      register$d(editor);
26423
      register$1(editor);
27518
      register$1(editor);
26424
      register$5(editor);
27519
      register$5(editor);
26425
      register$7(editor);
27520
      register$8(editor);
-
 
27521
      register$4(editor);
26426
      register$4(editor);
27522
      register$6(editor);
Línea 26427... Línea 27523...
26427
    };
27523
    };
26428
 
27524
 
26429
    const patchPipeConfig = config => isString(config) ? config.split(/[ ,]/) : config;
27525
    const patchPipeConfig = config => isString(config) ? config.split(/[ ,]/) : config;
Línea 26497... Línea 27593...
26497
      } else {
27593
      } else {
26498
        return nu(e.clientX, e.clientY);
27594
        return nu(e.clientX, e.clientY);
26499
      }
27595
      }
26500
    };
27596
    };
26501
    const transposeContentAreaContainer = (element, pos) => {
27597
    const transposeContentAreaContainer = (element, pos) => {
26502
      const containerPos = global$7.DOM.getPos(element);
27598
      const containerPos = global$8.DOM.getPos(element);
26503
      return transpose(pos, containerPos.x, containerPos.y);
27599
      return transpose(pos, containerPos.x, containerPos.y);
26504
    };
27600
    };
26505
    const getPointAnchor = (editor, e) => {
27601
    const getPointAnchor = (editor, e) => {
26506
      if (e.type === 'contextmenu' || e.type === 'longpress') {
27602
      if (e.type === 'contextmenu' || e.type === 'longpress') {
26507
        if (editor.inline) {
27603
        if (editor.inline) {
Línea 26655... Línea 27751...
26655
        }, () => Optional.some(getContextToolbarBounds(editor, backstage.shared, anchorType === 'node' ? 'node' : 'selection')));
27751
        }, () => Optional.some(getContextToolbarBounds(editor, backstage.shared, anchorType === 'node' ? 'node' : 'selection')));
26656
        editor.dispatch(hideContextToolbarEvent);
27752
        editor.dispatch(hideContextToolbarEvent);
26657
      });
27753
      });
26658
    };
27754
    };
26659
    const initAndShow = (editor, e, buildMenu, backstage, contextmenu, anchorType) => {
27755
    const initAndShow = (editor, e, buildMenu, backstage, contextmenu, anchorType) => {
26660
      const detection = detect$2();
27756
      const detection = detect$1();
26661
      const isiOS = detection.os.isiOS();
27757
      const isiOS = detection.os.isiOS();
26662
      const isMacOS = detection.os.isMacOS();
27758
      const isMacOS = detection.os.isMacOS();
26663
      const isAndroid = detection.os.isAndroid();
27759
      const isAndroid = detection.os.isAndroid();
26664
      const isTouch = detection.deviceType.isTouch();
27760
      const isTouch = detection.deviceType.isTouch();
26665
      const shouldHighlightImmediately = () => !(isAndroid || isiOS || isMacOS && isTouch);
27761
      const shouldHighlightImmediately = () => !(isAndroid || isiOS || isMacOS && isTouch);
Línea 26729... Línea 27825...
26729
      const before = lastMenuItem.fold(() => [], _ => [separator]);
27825
      const before = lastMenuItem.fold(() => [], _ => [separator]);
26730
      return xs.concat(before).concat(groupItems).concat([separator]);
27826
      return xs.concat(before).concat(groupItems).concat([separator]);
26731
    };
27827
    };
26732
    const generateContextMenu = (contextMenus, menuConfig, selectedElement) => {
27828
    const generateContextMenu = (contextMenus, menuConfig, selectedElement) => {
26733
      const sections = foldl(menuConfig, (acc, name) => {
27829
      const sections = foldl(menuConfig, (acc, name) => {
26734
        return get$g(contextMenus, name.toLowerCase()).map(menu => {
27830
        return get$h(contextMenus, name.toLowerCase()).map(menu => {
26735
          const items = menu.update(selectedElement);
27831
          const items = menu.update(selectedElement);
26736
          if (isString(items) && isNotEmpty(trim$1(items))) {
27832
          if (isString(items) && isNotEmpty(trim$1(items))) {
26737
            return addContextMenuGroup(acc, items.split(' '));
27833
            return addContextMenuGroup(acc, items.split(' '));
26738
          } else if (isArray(items) && items.length > 0) {
27834
          } else if (isArray(items) && items.length > 0) {
26739
            const allItems = map$2(items, makeContextItem);
27835
            const allItems = map$2(items, makeContextItem);
Línea 26762... Línea 27858...
26762
      } else {
27858
      } else {
26763
        return anchorType;
27859
        return anchorType;
26764
      }
27860
      }
26765
    };
27861
    };
26766
    const setup$5 = (editor, lazySink, backstage) => {
27862
    const setup$5 = (editor, lazySink, backstage) => {
26767
      const detection = detect$2();
27863
      const detection = detect$1();
26768
      const isTouch = detection.deviceType.isTouch;
27864
      const isTouch = detection.deviceType.isTouch;
26769
      const contextmenu = build$1(InlineView.sketch({
27865
      const contextmenu = build$1(InlineView.sketch({
26770
        dom: { tag: 'div' },
27866
        dom: { tag: 'div' },
26771
        lazySink,
27867
        lazySink,
26772
        onEscape: () => editor.focus(),
27868
        onEscape: () => editor.focus(),
Línea 26878... Línea 27974...
26878
    const offset = adt.offset;
27974
    const offset = adt.offset;
26879
    const absolute = adt.absolute;
27975
    const absolute = adt.absolute;
26880
    const fixed = adt.fixed;
27976
    const fixed = adt.fixed;
Línea 26881... Línea 27977...
26881
 
27977
 
26882
    const parseAttrToInt = (element, name) => {
27978
    const parseAttrToInt = (element, name) => {
26883
      const value = get$f(element, name);
27979
      const value = get$g(element, name);
26884
      return isUndefined(value) ? NaN : parseInt(value, 10);
27980
      return isUndefined(value) ? NaN : parseInt(value, 10);
26885
    };
27981
    };
26886
    const get = (component, snapsInfo) => {
27982
    const get$1 = (component, snapsInfo) => {
26887
      const element = component.element;
27983
      const element = component.element;
26888
      const x = parseAttrToInt(element, snapsInfo.leftAttr);
27984
      const x = parseAttrToInt(element, snapsInfo.leftAttr);
26889
      const y = parseAttrToInt(element, snapsInfo.topAttr);
27985
      const y = parseAttrToInt(element, snapsInfo.topAttr);
26890
      return isNaN(x) || isNaN(y) ? Optional.none() : Optional.some(SugarPosition(x, y));
27986
      return isNaN(x) || isNaN(y) ? Optional.none() : Optional.some(SugarPosition(x, y));
Línea 26894... Línea 27990...
26894
      set$9(element, snapsInfo.leftAttr, pt.left + 'px');
27990
      set$9(element, snapsInfo.leftAttr, pt.left + 'px');
26895
      set$9(element, snapsInfo.topAttr, pt.top + 'px');
27991
      set$9(element, snapsInfo.topAttr, pt.top + 'px');
26896
    };
27992
    };
26897
    const clear = (component, snapsInfo) => {
27993
    const clear = (component, snapsInfo) => {
26898
      const element = component.element;
27994
      const element = component.element;
26899
      remove$7(element, snapsInfo.leftAttr);
27995
      remove$8(element, snapsInfo.leftAttr);
26900
      remove$7(element, snapsInfo.topAttr);
27996
      remove$8(element, snapsInfo.topAttr);
26901
    };
27997
    };
Línea 26902... Línea 27998...
26902
 
27998
 
26903
    const getCoords = (component, snapInfo, coord, delta) => get(component, snapInfo).fold(() => coord, fixed$1 => fixed(fixed$1.left + delta.left, fixed$1.top + delta.top));
27999
    const getCoords = (component, snapInfo, coord, delta) => get$1(component, snapInfo).fold(() => coord, fixed$1 => fixed(fixed$1.left + delta.left, fixed$1.top + delta.top));
26904
    const moveOrSnap = (component, snapInfo, coord, delta, scroll, origin) => {
28000
    const moveOrSnap = (component, snapInfo, coord, delta, scroll, origin) => {
26905
      const newCoord = getCoords(component, snapInfo, coord, delta);
28001
      const newCoord = getCoords(component, snapInfo, coord, delta);
26906
      const snap = snapInfo.mustSnap ? findClosestSnap(component, snapInfo, newCoord, scroll, origin) : findSnap(component, snapInfo, newCoord, scroll, origin);
28002
      const snap = snapInfo.mustSnap ? findClosestSnap(component, snapInfo, newCoord, scroll, origin) : findSnap(component, snapInfo, newCoord, scroll, origin);
26907
      const fixedCoord = asFixed(newCoord, scroll, origin);
28003
      const fixedCoord = asFixed(newCoord, scroll, origin);
Línea 26968... Línea 28064...
26968
 
28064
 
26969
    const snapTo = (component, dragConfig, _state, snap) => {
28065
    const snapTo = (component, dragConfig, _state, snap) => {
26970
      const target = dragConfig.getTarget(component.element);
28066
      const target = dragConfig.getTarget(component.element);
26971
      if (dragConfig.repositionTarget) {
28067
      if (dragConfig.repositionTarget) {
26972
        const doc = owner$4(component.element);
28068
        const doc = owner$4(component.element);
26973
        const scroll = get$b(doc);
28069
        const scroll = get$c(doc);
26974
        const origin = getOrigin(target);
28070
        const origin = getOrigin(target);
26975
        const snapPin = snapTo$1(snap, scroll, origin);
28071
        const snapPin = snapTo$1(snap, scroll, origin);
26976
        const styles = toStyles(snapPin.coord, scroll, origin);
28072
        const styles = toStyles(snapPin.coord, scroll, origin);
26977
        setOptions(target, styles);
28073
        setOptions(target, styles);
Línea 26984... Línea 28080...
26984
    });
28080
    });
Línea 26985... Línea 28081...
26985
 
28081
 
26986
    const initialAttribute = 'data-initial-z-index';
28082
    const initialAttribute = 'data-initial-z-index';
26987
    const resetZIndex = blocker => {
28083
    const resetZIndex = blocker => {
26988
      parent(blocker.element).filter(isElement$1).each(root => {
28084
      parent(blocker.element).filter(isElement$1).each(root => {
26989
        getOpt(root, initialAttribute).fold(() => remove$6(root, 'z-index'), zIndex => set$8(root, 'z-index', zIndex));
28085
        getOpt(root, initialAttribute).fold(() => remove$7(root, 'z-index'), zIndex => set$8(root, 'z-index', zIndex));
26990
        remove$7(root, initialAttribute);
28086
        remove$8(root, initialAttribute);
26991
      });
28087
      });
26992
    };
28088
    };
26993
    const changeZIndex = blocker => {
28089
    const changeZIndex = blocker => {
26994
      parent(blocker.element).filter(isElement$1).each(root => {
28090
      parent(blocker.element).filter(isElement$1).each(root => {
26995
        getRaw(root, 'z-index').each(zindex => {
28091
        getRaw(root, 'z-index').each(zindex => {
26996
          set$9(root, initialAttribute, zindex);
28092
          set$9(root, initialAttribute, zindex);
26997
        });
28093
        });
26998
        set$8(root, 'z-index', get$e(blocker.element, 'z-index'));
28094
        set$8(root, 'z-index', get$f(blocker.element, 'z-index'));
26999
      });
28095
      });
27000
    };
28096
    };
27001
    const instigate = (anyComponent, blocker) => {
28097
    const instigate = (anyComponent, blocker) => {
27002
      anyComponent.getSystem().addToGui(blocker);
28098
      anyComponent.getSystem().addToGui(blocker);
Línea 27078... Línea 28174...
27078
    };
28174
    };
27079
    const dragBy = (component, dragConfig, startData, delta) => {
28175
    const dragBy = (component, dragConfig, startData, delta) => {
27080
      const target = dragConfig.getTarget(component.element);
28176
      const target = dragConfig.getTarget(component.element);
27081
      if (dragConfig.repositionTarget) {
28177
      if (dragConfig.repositionTarget) {
27082
        const doc = owner$4(component.element);
28178
        const doc = owner$4(component.element);
27083
        const scroll = get$b(doc);
28179
        const scroll = get$c(doc);
27084
        const origin = getOrigin(target);
28180
        const origin = getOrigin(target);
27085
        const currentCoord = getCurrentCoord(target);
28181
        const currentCoord = getCurrentCoord(target);
27086
        const newCoord = calcNewCoord(component, dragConfig.snaps, currentCoord, scroll, origin, delta, startData);
28182
        const newCoord = calcNewCoord(component, dragConfig.snaps, currentCoord, scroll, origin, delta, startData);
27087
        const styles = toStyles(newCoord, scroll, origin);
28183
        const styles = toStyles(newCoord, scroll, origin);
27088
        setOptions(target, styles);
28184
        setOptions(target, styles);
Línea 27195... Línea 28291...
27195
        getData: getData,
28291
        getData: getData,
27196
        getDelta: getDelta
28292
        getDelta: getDelta
27197
    });
28293
    });
Línea 27198... Línea 28294...
27198
 
28294
 
27199
    const events$2 = (dragConfig, dragState, updateStartState) => {
28295
    const events$2 = (dragConfig, dragState, updateStartState) => {
27200
      const blockerSingleton = value$2();
28296
      const blockerSingleton = value$4();
27201
      const stopBlocking = component => {
28297
      const stopBlocking = component => {
27202
        stop(component, blockerSingleton.get(), dragConfig, dragState);
28298
        stop(component, blockerSingleton.get(), dragConfig, dragState);
27203
        blockerSingleton.clear();
28299
        blockerSingleton.clear();
27204
      };
28300
      };
Línea 27274... Línea 28370...
27274
      const setStartData = data => {
28370
      const setStartData = data => {
27275
        startData = Optional.some(data);
28371
        startData = Optional.some(data);
27276
      };
28372
      };
27277
      const getStartData = () => startData;
28373
      const getStartData = () => startData;
27278
      const readState = constant$1({});
28374
      const readState = constant$1({});
27279
      return nu$8({
28375
      return nu$7({
27280
        readState,
28376
        readState,
27281
        reset,
28377
        reset,
27282
        update,
28378
        update,
27283
        getStartData,
28379
        getStartData,
27284
        setStartData
28380
        setStartData
Línea 27374... Línea 28470...
27374
    }));
28470
    }));
27375
    const setup$4 = (editor, sink) => {
28471
    const setup$4 = (editor, sink) => {
27376
      const tlTds = Cell([]);
28472
      const tlTds = Cell([]);
27377
      const brTds = Cell([]);
28473
      const brTds = Cell([]);
27378
      const isVisible = Cell(false);
28474
      const isVisible = Cell(false);
27379
      const startCell = value$2();
28475
      const startCell = value$4();
27380
      const finishCell = value$2();
28476
      const finishCell = value$4();
27381
      const getTopLeftSnap = td => {
28477
      const getTopLeftSnap = td => {
27382
        const box = absolute$2(td);
28478
        const box = absolute$2(td);
27383
        return calcSnap(memTopLeft.getOpt(sink), td, box.x, box.y, box.width, box.height);
28479
        return calcSnap(memTopLeft.getOpt(sink), td, box.x, box.y, box.width, box.height);
27384
      };
28480
      };
27385
      const getTopLeftSnaps = () => map$2(tlTds.get(), td => getTopLeftSnap(td));
28481
      const getTopLeftSnaps = () => map$2(tlTds.get(), td => getTopLeftSnap(td));
Línea 27408... Línea 28504...
27408
      const memBottomRight = createSelector(bottomRightSnaps);
28504
      const memBottomRight = createSelector(bottomRightSnaps);
27409
      const topLeft = build$1(memTopLeft.asSpec());
28505
      const topLeft = build$1(memTopLeft.asSpec());
27410
      const bottomRight = build$1(memBottomRight.asSpec());
28506
      const bottomRight = build$1(memBottomRight.asSpec());
27411
      const showOrHideHandle = (selector, cell, isAbove, isBelow) => {
28507
      const showOrHideHandle = (selector, cell, isAbove, isBelow) => {
27412
        const cellRect = cell.dom.getBoundingClientRect();
28508
        const cellRect = cell.dom.getBoundingClientRect();
27413
        remove$6(selector.element, 'display');
28509
        remove$7(selector.element, 'display');
27414
        const viewportHeight = defaultView(SugarElement.fromDom(editor.getBody())).dom.innerHeight;
28510
        const viewportHeight = defaultView(SugarElement.fromDom(editor.getBody())).dom.innerHeight;
27415
        const aboveViewport = isAbove(cellRect);
28511
        const aboveViewport = isAbove(cellRect);
27416
        const belowViewport = isBelow(cellRect, viewportHeight);
28512
        const belowViewport = isBelow(cellRect, viewportHeight);
27417
        if (aboveViewport || belowViewport) {
28513
        if (aboveViewport || belowViewport) {
27418
          set$8(selector.element, 'display', 'none');
28514
          set$8(selector.element, 'display', 'none');
Línea 27427... Línea 28523...
27427
      };
28523
      };
27428
      const snapTopLeft = cell => snapTo(topLeft, cell, getTopLeftSnap, 'top');
28524
      const snapTopLeft = cell => snapTo(topLeft, cell, getTopLeftSnap, 'top');
27429
      const snapLastTopLeft = () => startCell.get().each(snapTopLeft);
28525
      const snapLastTopLeft = () => startCell.get().each(snapTopLeft);
27430
      const snapBottomRight = cell => snapTo(bottomRight, cell, getBottomRightSnap, 'bottom');
28526
      const snapBottomRight = cell => snapTo(bottomRight, cell, getBottomRightSnap, 'bottom');
27431
      const snapLastBottomRight = () => finishCell.get().each(snapBottomRight);
28527
      const snapLastBottomRight = () => finishCell.get().each(snapBottomRight);
27432
      if (detect$2().deviceType.isTouch()) {
28528
      if (detect$1().deviceType.isTouch()) {
-
 
28529
        const domToSugar = arr => map$2(arr, SugarElement.fromDom);
27433
        editor.on('TableSelectionChange', e => {
28530
        editor.on('TableSelectionChange', e => {
27434
          if (!isVisible.get()) {
28531
          if (!isVisible.get()) {
27435
            attach(sink, topLeft);
28532
            attach(sink, topLeft);
27436
            attach(sink, bottomRight);
28533
            attach(sink, bottomRight);
27437
            isVisible.set(true);
28534
            isVisible.set(true);
27438
          }
28535
          }
-
 
28536
          const start = SugarElement.fromDom(e.start);
-
 
28537
          const finish = SugarElement.fromDom(e.finish);
27439
          startCell.set(e.start);
28538
          startCell.set(start);
27440
          finishCell.set(e.finish);
28539
          finishCell.set(finish);
27441
          e.otherCells.each(otherCells => {
28540
          Optional.from(e.otherCells).each(otherCells => {
27442
            tlTds.set(otherCells.upOrLeftCells);
28541
            tlTds.set(domToSugar(otherCells.upOrLeftCells));
27443
            brTds.set(otherCells.downOrRightCells);
28542
            brTds.set(domToSugar(otherCells.downOrRightCells));
27444
            snapTopLeft(e.start);
28543
            snapTopLeft(start);
27445
            snapBottomRight(e.finish);
28544
            snapBottomRight(finish);
27446
          });
28545
          });
27447
        });
28546
        });
27448
        editor.on('ResizeEditor ResizeWindow ScrollContent', () => {
28547
        editor.on('ResizeEditor ResizeWindow ScrollContent', () => {
27449
          snapLastTopLeft();
28548
          snapLastTopLeft();
27450
          snapLastBottomRight();
28549
          snapLastBottomRight();
Línea 27459... Línea 28558...
27459
          finishCell.clear();
28558
          finishCell.clear();
27460
        });
28559
        });
27461
      }
28560
      }
27462
    };
28561
    };
Línea 27463... Línea 28562...
27463
 
28562
 
-
 
28563
    var Logo = "<svg height=\"16\" viewBox=\"0 0 80 16\" width=\"80\" xmlns=\"http://www.w3.org/2000/svg\"><g opacity=\".8\"><path d=\"m80 3.537v-2.202h-7.976v11.585h7.976v-2.25h-5.474v-2.621h4.812v-2.069h-4.812v-2.443zm-10.647 6.929c-.493.217-1.13.337-1.864.337s-1.276-.156-1.805-.47a3.732 3.732 0 0 1 -1.3-1.298c-.324-.554-.48-1.191-.48-1.877s.156-1.335.48-1.877a3.635 3.635 0 0 1 1.3-1.299 3.466 3.466 0 0 1 1.805-.481c.65 0 .914.06 1.263.18.36.12.698.277.986.47.289.192.578.384.842.6l.12.085v-2.586l-.023-.024c-.385-.35-.855-.614-1.384-.818-.53-.205-1.155-.313-1.877-.313-.721 0-1.6.144-2.333.445a5.773 5.773 0 0 0 -1.937 1.251 5.929 5.929 0 0 0 -1.324 1.9c-.324.735-.48 1.565-.48 2.455s.156 1.72.48 2.454c.325.734.758 1.383 1.324 1.913.553.53 1.215.938 1.937 1.25a6.286 6.286 0 0 0 2.333.434c.819 0 1.384-.108 1.961-.313.59-.216 1.083-.505 1.468-.866l.024-.024v-2.49l-.12.096c-.41.337-.878.626-1.396.866zm-14.869-4.15-4.8-5.04-.024-.025h-.902v11.67h2.502v-6.847l2.827 3.08.385.409.397-.41 2.791-3.067v6.845h2.502v-11.679h-.902l-4.788 5.052z\"/><path clip-rule=\"evenodd\" d=\"m15.543 5.137c0-3.032-2.466-5.113-4.957-5.137-.36 0-.745.024-1.094.096-.157.024-3.85.758-3.85.758-3.032.602-4.62 2.466-4.704 4.788-.024.89-.024 4.27-.024 4.27.036 3.165 2.406 5.138 5.017 5.126.337 0 1.119-.109 1.287-.145.144-.024.385-.084.746-.144.661-.12 1.684-.325 3.067-.602 2.37-.409 4.103-2.009 4.44-4.33.156-1.023.084-4.692.084-4.692zm-3.213 3.308-2.346.457v2.31l-5.859 1.143v-5.75l2.346-.458v3.441l3.513-.686v-3.44l-3.513.685v-2.297l5.859-1.143v5.75zm20.09-3.296-.083-1.023h-2.13v8.794h2.346v-4.884c0-1.107.95-1.985 2.057-1.997 1.095 0 1.901.89 1.901 1.997v4.884h2.346v-5.245c-.012-2.105-1.588-3.777-3.67-3.765a3.764 3.764 0 0 0 -2.778 1.25l.012-.011zm-6.014-4.102 2.346-.458v2.298l-2.346.457z\" fill-rule=\"evenodd\"/><path d=\"m28.752 4.126h-2.346v8.794h2.346z\"/><path clip-rule=\"evenodd\" d=\"m43.777 15.483 4.043-11.357h-2.418l-1.54 4.355-.445 1.324-.36-1.324-1.54-4.355h-2.418l3.151 8.794-1.083 3.08zm-21.028-5.51c0 .722.541 1.034.878 1.034s.638-.048.95-.144l.518 1.708c-.217.145-.879.518-2.13.518a2.565 2.565 0 0 1 -2.562-2.587c-.024-1.082-.024-2.49 0-4.21h-1.54v-2.142h1.54v-1.912l2.346-.458v2.37h2.201v2.142h-2.2v3.693-.012z\" fill-rule=\"evenodd\"/></g></svg>\n";
-
 
28564
 
-
 
28565
    const describedBy = (describedElement, describeElement) => {
-
 
28566
      const describeId = Optional.from(get$g(describedElement, 'id')).getOrThunk(() => {
-
 
28567
        const id = generate$6('aria');
-
 
28568
        set$9(describeElement, 'id', id);
-
 
28569
        return id;
-
 
28570
      });
-
 
28571
      set$9(describedElement, 'aria-describedby', describeId);
-
 
28572
    };
-
 
28573
    const remove = describedElement => {
-
 
28574
      remove$8(describedElement, 'aria-describedby');
Línea 27464... Línea 28575...
27464
    var Logo = "<svg width=\"50px\" height=\"16px\" viewBox=\"0 0 50 16\" xmlns=\"http://www.w3.org/2000/svg\">\n  <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.143 0c2.608.015 5.186 2.178 5.186 5.331 0 0 .077 3.812-.084 4.87-.361 2.41-2.164 4.074-4.65 4.496-1.453.284-2.523.49-3.212.623-.373.071-.634.122-.785.152-.184.038-.997.145-1.35.145-2.732 0-5.21-2.04-5.248-5.33 0 0 0-3.514.03-4.442.093-2.4 1.758-4.342 4.926-4.963 0 0 3.875-.752 4.036-.782.368-.07.775-.1 1.15-.1Zm1.826 2.8L5.83 3.989v2.393l-2.455.475v5.968l6.137-1.189V9.243l2.456-.476V2.8ZM5.83 6.382l3.682-.713v3.574l-3.682.713V6.382Zm27.173-1.64-.084-1.066h-2.226v9.132h2.456V7.743c-.008-1.151.998-2.064 2.149-2.072 1.15-.008 1.987.92 1.995 2.072v5.065h2.455V7.359c-.015-2.18-1.657-3.929-3.837-3.913a3.993 3.993 0 0 0-2.908 1.296Zm-6.3-4.266L29.16 0v2.387l-2.456.475V.476Zm0 3.2v9.132h2.456V3.676h-2.456Zm18.179 11.787L49.11 3.676H46.58l-1.612 4.527-.46 1.382-.384-1.382-1.611-4.527H39.98l3.3 9.132L42.15 16l2.732-.537ZM22.867 9.738c0 .752.568 1.075.921 1.075.353 0 .668-.047.998-.154l.537 1.765c-.23.154-.92.537-2.225.537-1.305 0-2.655-.997-2.686-2.686a136.877 136.877 0 0 1 0-4.374H18.8V3.676h1.612v-1.98l2.455-.476v2.456h2.302V5.9h-2.302v3.837Z\"/>\n</svg>\n";
28575
    };
27465
 
28576
 
27466
    const isHidden = elm => elm.nodeName === 'BR' || !!elm.getAttribute('data-mce-bogus') || elm.getAttribute('data-mce-type') === 'bookmark';
28577
    const isHidden = elm => elm.nodeName === 'BR' || !!elm.getAttribute('data-mce-bogus') || elm.getAttribute('data-mce-type') === 'bookmark';
27467
    const renderElementPath = (editor, settings, providersBackstage) => {
28578
    const renderElementPath = (editor, settings, providersBackstage) => {
27468
      var _a;
28579
      var _a;
27469
      const delimiter = (_a = settings.delimiter) !== null && _a !== void 0 ? _a : '\u203A';
28580
      const delimiter = (_a = settings.delimiter) !== null && _a !== void 0 ? _a : '\u203A';
27470
      const renderElement = (name, element, index) => Button.sketch({
28581
      const renderElement = (name, element, index) => Button.sketch({
27471
        dom: {
28582
        dom: {
27472
          tag: 'div',
-
 
27473
          classes: ['tox-statusbar__path-item'],
28583
          tag: 'div',
27474
          attributes: {
-
 
27475
            'data-index': index,
-
 
27476
            'aria-level': index + 1
28584
          classes: ['tox-statusbar__path-item'],
27477
          }
28585
          attributes: { 'data-index': index }
27478
        },
28586
        },
27479
        components: [text$2(name)],
28587
        components: [text$2(name)],
27480
        action: _btn => {
28588
        action: _btn => {
27481
          editor.focus();
28589
          editor.focus();
27482
          editor.selection.select(element);
28590
          editor.selection.select(element);
27483
          editor.nodeChanged();
28591
          editor.nodeChanged();
-
 
28592
        },
-
 
28593
        buttonBehaviours: derive$1([
-
 
28594
          Tooltipping.config({
-
 
28595
            ...providersBackstage.tooltips.getConfig({
-
 
28596
              tooltipText: providersBackstage.translate([
-
 
28597
                'Select the {0} element',
-
 
28598
                element.nodeName.toLowerCase()
-
 
28599
              ]),
-
 
28600
              onShow: (comp, tooltip) => {
-
 
28601
                describedBy(comp.element, tooltip.element);
-
 
28602
              },
-
 
28603
              onHide: comp => {
-
 
28604
                remove(comp.element);
-
 
28605
              }
27484
        },
28606
            })
27485
        buttonBehaviours: derive$1([
28607
          }),
27486
          DisablingConfigs.button(providersBackstage.isDisabled),
28608
          DisablingConfigs.button(providersBackstage.isDisabled),
27487
          receivingConfig()
28609
          toggleOnReceive(() => providersBackstage.checkUiComponentContext('any'))
27488
        ])
28610
        ])
27489
      });
28611
      });
27490
      const renderDivider = () => ({
28612
      const renderDivider = () => ({
Línea 27536... Línea 28658...
27536
          Keying.config({
28658
          Keying.config({
27537
            mode: 'flow',
28659
            mode: 'flow',
27538
            selector: 'div[role=button]'
28660
            selector: 'div[role=button]'
27539
          }),
28661
          }),
27540
          Disabling.config({ disabled: providersBackstage.isDisabled }),
28662
          Disabling.config({ disabled: providersBackstage.isDisabled }),
27541
          receivingConfig(),
28663
          toggleOnReceive(() => providersBackstage.checkUiComponentContext('any')),
27542
          Tabstopping.config({}),
28664
          Tabstopping.config({}),
27543
          Replacing.config({}),
28665
          Replacing.config({}),
27544
          config('elementPathEvents', [runOnAttached((comp, _e) => {
28666
          config('elementPathEvents', [runOnAttached((comp, _e) => {
27545
              editor.shortcuts.add('alt+F11', 'focus statusbar elementpath', () => Keying.focusIn(comp));
28667
              editor.shortcuts.add('alt+F11', 'focus statusbar elementpath', () => Keying.focusIn(comp));
27546
              editor.on('NodeChange', e => {
28668
              editor.on('NodeChange', e => {
Línea 27567... Línea 28689...
27567
      }
28689
      }
27568
      return dimensions;
28690
      return dimensions;
27569
    };
28691
    };
27570
    const resize = (editor, deltas, resizeType) => {
28692
    const resize = (editor, deltas, resizeType) => {
27571
      const container = SugarElement.fromDom(editor.getContainer());
28693
      const container = SugarElement.fromDom(editor.getContainer());
27572
      const dimensions = getDimensions(editor, deltas, resizeType, get$d(container), get$c(container));
28694
      const dimensions = getDimensions(editor, deltas, resizeType, get$e(container), get$d(container));
27573
      each(dimensions, (val, dim) => {
28695
      each(dimensions, (val, dim) => {
27574
        if (isNumber(val)) {
28696
        if (isNumber(val)) {
27575
          set$8(container, dim, numToPx(val));
28697
          set$8(container, dim, numToPx(val));
27576
        }
28698
        }
27577
      });
28699
      });
Línea 27602... Línea 28724...
27602
      const resizeLabel = resizeType === ResizeTypes.Both ? 'Press the arrow keys to resize the editor.' : 'Press the Up and Down arrow keys to resize the editor.';
28724
      const resizeLabel = resizeType === ResizeTypes.Both ? 'Press the arrow keys to resize the editor.' : 'Press the Up and Down arrow keys to resize the editor.';
27603
      return Optional.some(render$3('resize-handle', {
28725
      return Optional.some(render$3('resize-handle', {
27604
        tag: 'div',
28726
        tag: 'div',
27605
        classes: ['tox-statusbar__resize-handle'],
28727
        classes: ['tox-statusbar__resize-handle'],
27606
        attributes: {
28728
        attributes: {
27607
          'title': providersBackstage.translate('Resize'),
28729
          'aria-label': providersBackstage.translate(resizeLabel),
27608
          'aria-label': providersBackstage.translate(resizeLabel)
28730
          'data-mce-name': 'resize-handle'
27609
        },
28731
        },
27610
        behaviours: [
28732
        behaviours: [
27611
          Dragging.config({
28733
          Dragging.config({
27612
            mode: 'mouse',
28734
            mode: 'mouse',
27613
            repositionTarget: false,
28735
            repositionTarget: false,
Línea 27620... Línea 28742...
27620
            onRight: () => keyboardHandler(editor, resizeType, 1, 0),
28742
            onRight: () => keyboardHandler(editor, resizeType, 1, 0),
27621
            onUp: () => keyboardHandler(editor, resizeType, 0, -1),
28743
            onUp: () => keyboardHandler(editor, resizeType, 0, -1),
27622
            onDown: () => keyboardHandler(editor, resizeType, 0, 1)
28744
            onDown: () => keyboardHandler(editor, resizeType, 0, 1)
27623
          }),
28745
          }),
27624
          Tabstopping.config({}),
28746
          Tabstopping.config({}),
27625
          Focusing.config({})
28747
          Focusing.config({}),
-
 
28748
          Tooltipping.config(providersBackstage.tooltips.getConfig({ tooltipText: providersBackstage.translate('Resize') }))
27626
        ]
28749
        ]
27627
      }, providersBackstage.icons));
28750
      }, providersBackstage.icons));
27628
    };
28751
    };
Línea 27629... Línea 28752...
27629
 
28752
 
Línea 27638... Línea 28761...
27638
          classes: ['tox-statusbar__wordcount']
28761
          classes: ['tox-statusbar__wordcount']
27639
        },
28762
        },
27640
        components: [],
28763
        components: [],
27641
        buttonBehaviours: derive$1([
28764
        buttonBehaviours: derive$1([
27642
          DisablingConfigs.button(providersBackstage.isDisabled),
28765
          DisablingConfigs.button(providersBackstage.isDisabled),
27643
          receivingConfig(),
28766
          toggleOnReceive(() => providersBackstage.checkUiComponentContext('any')),
27644
          Tabstopping.config({}),
28767
          Tabstopping.config({}),
27645
          Replacing.config({}),
28768
          Replacing.config({}),
27646
          Representing.config({
28769
          Representing.config({
27647
            store: {
28770
            store: {
27648
              mode: 'memory',
28771
              mode: 'memory',
Línea 27696... Línea 28819...
27696
          },
28819
          },
27697
          components: [{
28820
          components: [{
27698
              dom: {
28821
              dom: {
27699
                tag: 'a',
28822
                tag: 'a',
27700
                attributes: {
28823
                attributes: {
27701
                  'href': 'https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v6',
28824
                  'href': 'https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v7',
27702
                  'rel': 'noopener',
28825
                  'rel': 'noopener',
27703
                  'target': '_blank',
28826
                  'target': '_blank',
27704
                  'aria-label': global$8.translate([
28827
                  'aria-label': editor.translate([
27705
                    'Powered by {0}',
28828
                    'Build with {0}',
27706
                    'Tiny'
28829
                    'TinyMCE'
27707
                  ])
28830
                  ])
27708
                },
28831
                },
-
 
28832
                innerHtml: editor.translate([
-
 
28833
                  'Build with {0}',
27709
                innerHtml: Logo.trim()
28834
                  Logo.trim()
-
 
28835
                ])
27710
              },
28836
              },
27711
              behaviours: derive$1([Focusing.config({})])
28837
              behaviours: derive$1([Focusing.config({})])
27712
            }]
28838
            }]
27713
        };
28839
        };
27714
      };
28840
      };
Línea 27718... Línea 28844...
27718
        return {
28844
        return {
27719
          dom: {
28845
          dom: {
27720
            tag: 'div',
28846
            tag: 'div',
27721
            classes: ['tox-statusbar__help-text']
28847
            classes: ['tox-statusbar__help-text']
27722
          },
28848
          },
27723
          components: [text$2(global$8.translate([
28849
          components: [text$2(global$5.translate([
27724
              text,
28850
              text,
27725
              shortcutText
28851
              shortcutText
27726
            ]))]
28852
            ]))]
27727
        };
28853
        };
27728
      };
28854
      };
Línea 27813... Línea 28939...
27813
    const setup$3 = (editor, setupForTheme) => {
28939
    const setup$3 = (editor, setupForTheme) => {
27814
      const isInline = editor.inline;
28940
      const isInline = editor.inline;
27815
      const mode = isInline ? Inline : Iframe;
28941
      const mode = isInline ? Inline : Iframe;
27816
      const header = isStickyToolbar(editor) ? StickyHeader : StaticHeader;
28942
      const header = isStickyToolbar(editor) ? StickyHeader : StaticHeader;
27817
      const lazyUiRefs = LazyUiReferences();
28943
      const lazyUiRefs = LazyUiReferences();
27818
      const lazyMothership = value$2();
28944
      const lazyMothership = value$4();
27819
      const lazyDialogMothership = value$2();
28945
      const lazyDialogMothership = value$4();
27820
      const lazyPopupMothership = value$2();
28946
      const lazyPopupMothership = value$4();
27821
      const platform = detect$2();
28947
      const platform = detect$1();
27822
      const isTouch = platform.deviceType.isTouch();
28948
      const isTouch = platform.deviceType.isTouch();
27823
      const touchPlatformClass = 'tox-platform-touch';
28949
      const touchPlatformClass = 'tox-platform-touch';
27824
      const deviceClasses = isTouch ? [touchPlatformClass] : [];
28950
      const deviceClasses = isTouch ? [touchPlatformClass] : [];
27825
      const isToolbarBottom = isToolbarLocationBottom(editor);
28951
      const isToolbarBottom = isToolbarLocationBottom(editor);
27826
      const toolbarMode = getToolbarMode(editor);
28952
      const toolbarMode = getToolbarMode(editor);
Línea 27841... Línea 28967...
27841
      const lazyPopupSinkResult = () => Result.fromOption(lazyUiRefs.popupUi.get().map(ui => ui.sink), '(popup) UI has not been rendered');
28967
      const lazyPopupSinkResult = () => Result.fromOption(lazyUiRefs.popupUi.get().map(ui => ui.sink), '(popup) UI has not been rendered');
27842
      const lazyAnchorBar = lazyUiRefs.lazyGetInOuterOrDie('anchor bar', memAnchorBar.getOpt);
28968
      const lazyAnchorBar = lazyUiRefs.lazyGetInOuterOrDie('anchor bar', memAnchorBar.getOpt);
27843
      const lazyBottomAnchorBar = lazyUiRefs.lazyGetInOuterOrDie('bottom anchor bar', memBottomAnchorBar.getOpt);
28969
      const lazyBottomAnchorBar = lazyUiRefs.lazyGetInOuterOrDie('bottom anchor bar', memBottomAnchorBar.getOpt);
27844
      const lazyToolbar = lazyUiRefs.lazyGetInOuterOrDie('toolbar', OuterContainer.getToolbar);
28970
      const lazyToolbar = lazyUiRefs.lazyGetInOuterOrDie('toolbar', OuterContainer.getToolbar);
27845
      const lazyThrobber = lazyUiRefs.lazyGetInOuterOrDie('throbber', OuterContainer.getThrobber);
28971
      const lazyThrobber = lazyUiRefs.lazyGetInOuterOrDie('throbber', OuterContainer.getThrobber);
27846
      const backstages = init$6({
28972
      const backstages = init$5({
27847
        popup: lazyPopupSinkResult,
28973
        popup: lazyPopupSinkResult,
27848
        dialog: lazyDialogSinkResult
28974
        dialog: lazyDialogSinkResult
27849
      }, editor, lazyAnchorBar, lazyBottomAnchorBar);
28975
      }, editor, lazyAnchorBar, lazyBottomAnchorBar);
27850
      const makeHeaderPart = () => {
28976
      const makeHeaderPart = () => {
27851
        const verticalDirAttributes = { attributes: { [Attribute]: isToolbarBottom ? AttributeValue.BottomToTop : AttributeValue.TopToBottom } };
28977
        const verticalDirAttributes = { attributes: { [Attribute]: isToolbarBottom ? AttributeValue.BottomToTop : AttributeValue.TopToBottom } };
Línea 27955... Línea 29081...
27955
          ]
29081
          ]
27956
        };
29082
        };
27957
      };
29083
      };
27958
      const renderDialogUi = () => {
29084
      const renderDialogUi = () => {
27959
        const uiContainer = getUiContainer(editor);
29085
        const uiContainer = getUiContainer(editor);
27960
        const isGridUiContainer = eq(body(), uiContainer) && get$e(uiContainer, 'display') === 'grid';
29086
        const isGridUiContainer = eq(body(), uiContainer) && get$f(uiContainer, 'display') === 'grid';
27961
        const sinkSpec = {
29087
        const sinkSpec = {
27962
          dom: {
29088
          dom: {
27963
            tag: 'div',
29089
            tag: 'div',
27964
            classes: [
29090
            classes: [
27965
              'tox',
29091
              'tox',
27966
              'tox-silver-sink',
29092
              'tox-silver-sink',
27967
              'tox-tinymce-aux'
29093
              'tox-tinymce-aux'
27968
            ].concat(deviceClasses),
29094
            ].concat(deviceClasses),
27969
            attributes: { ...global$8.isRtl() ? { dir: 'rtl' } : {} }
29095
            attributes: { ...global$5.isRtl() ? { dir: 'rtl' } : {} }
27970
          },
29096
          },
27971
          behaviours: derive$1([Positioning.config({ useFixed: () => header.isDocked(lazyHeader) })])
29097
          behaviours: derive$1([Positioning.config({ useFixed: () => header.isDocked(lazyHeader) })])
27972
        };
29098
        };
27973
        const reactiveWidthSpec = {
29099
        const reactiveWidthSpec = {
27974
          dom: { styles: { width: document.body.clientWidth + 'px' } },
29100
          dom: { styles: { width: document.body.clientWidth + 'px' } },
Línea 27992... Línea 29118...
27992
              'tox',
29118
              'tox',
27993
              'tox-silver-sink',
29119
              'tox-silver-sink',
27994
              'tox-silver-popup-sink',
29120
              'tox-silver-popup-sink',
27995
              'tox-tinymce-aux'
29121
              'tox-tinymce-aux'
27996
            ].concat(deviceClasses),
29122
            ].concat(deviceClasses),
27997
            attributes: { ...global$8.isRtl() ? { dir: 'rtl' } : {} }
29123
            attributes: { ...global$5.isRtl() ? { dir: 'rtl' } : {} }
27998
          },
29124
          },
27999
          behaviours: derive$1([Positioning.config({
29125
          behaviours: derive$1([Positioning.config({
28000
              useFixed: () => header.isDocked(lazyHeader),
29126
              useFixed: () => header.isDocked(lazyHeader),
28001
              getBounds: () => setupForTheme.getPopupSinkBounds()
29127
              getBounds: () => setupForTheme.getPopupSinkBounds()
28002
            })])
29128
            })])
Línea 28027... Línea 29153...
28027
          isToolbarBottom ? [partHeader] : []
29153
          isToolbarBottom ? [partHeader] : []
28028
        ]);
29154
        ]);
28029
        const editorContainer = OuterContainer.parts.editorContainer({
29155
        const editorContainer = OuterContainer.parts.editorContainer({
28030
          components: flatten([
29156
          components: flatten([
28031
            editorComponents,
29157
            editorComponents,
28032
            isInline ? [] : [
-
 
28033
              memBottomAnchorBar.asSpec(),
29158
            isInline ? [] : [memBottomAnchorBar.asSpec()]
28034
              ...statusbar.toArray()
-
 
28035
            ]
-
 
28036
          ])
29159
          ])
28037
        });
29160
        });
28038
        const isHidden = isDistractionFree(editor);
29161
        const isHidden = isDistractionFree(editor);
28039
        const attributes = {
29162
        const attributes = {
28040
          role: 'application',
29163
          role: 'application',
28041
          ...global$8.isRtl() ? { dir: 'rtl' } : {},
29164
          ...global$5.isRtl() ? { dir: 'rtl' } : {},
28042
          ...isHidden ? { 'aria-hidden': 'true' } : {}
29165
          ...isHidden ? { 'aria-hidden': 'true' } : {}
28043
        };
29166
        };
28044
        const outerContainer = build$1(OuterContainer.sketch({
29167
        const outerContainer = build$1(OuterContainer.sketch({
28045
          dom: {
29168
          dom: {
28046
            tag: 'div',
29169
            tag: 'div',
Línea 28057... Línea 29180...
28057
            },
29180
            },
28058
            attributes
29181
            attributes
28059
          },
29182
          },
28060
          components: [
29183
          components: [
28061
            editorContainer,
29184
            editorContainer,
28062
            ...isInline ? [] : [partViewWrapper],
29185
            ...isInline ? [] : [
-
 
29186
              partViewWrapper,
-
 
29187
              ...statusbar.toArray()
-
 
29188
            ],
28063
            partThrobber
29189
            partThrobber
28064
          ],
29190
          ],
28065
          behaviours: derive$1([
29191
          behaviours: derive$1([
28066
            receivingConfig(),
29192
            toggleOnReceive(() => backstages.popup.shared.providers.checkUiComponentContext('any')),
28067
            Disabling.config({ disableClass: 'tox-tinymce--disabled' }),
29193
            Disabling.config({ disableClass: 'tox-tinymce--disabled' }),
28068
            Keying.config({
29194
            Keying.config({
28069
              mode: 'cyclic',
29195
              mode: 'cyclic',
28070
              selector: '.tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle'
29196
              selector: '.tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle'
28071
            })
29197
            })
Línea 28131... Línea 29257...
28131
        header.setup(editor, backstages.popup.shared, lazyHeader);
29257
        header.setup(editor, backstages.popup.shared, lazyHeader);
28132
        setup$6(editor, backstages.popup);
29258
        setup$6(editor, backstages.popup);
28133
        setup$5(editor, backstages.popup.shared.getSink, backstages.popup);
29259
        setup$5(editor, backstages.popup.shared.getSink, backstages.popup);
28134
        setup$8(editor);
29260
        setup$8(editor);
28135
        setup$7(editor, lazyThrobber, backstages.popup.shared);
29261
        setup$7(editor, lazyThrobber, backstages.popup.shared);
28136
        register$9(editor, contextToolbars, popupUi.sink, { backstage: backstages.popup });
29262
        register$a(editor, contextToolbars, popupUi.sink, { backstage: backstages.popup });
28137
        setup$4(editor, popupUi.sink);
29263
        setup$4(editor, popupUi.sink);
28138
        const elm = editor.getElement();
29264
        const elm = editor.getElement();
28139
        const height = setEditorSize(mainUi.outerContainer);
29265
        const height = setEditorSize(mainUi.outerContainer);
28140
        const args = {
29266
        const args = {
28141
          targetNode: elm,
29267
          targetNode: elm,
Línea 28173... Línea 29299...
28173
        },
29299
        },
28174
        renderUI
29300
        renderUI
28175
      };
29301
      };
28176
    };
29302
    };
Línea -... Línea 29303...
-
 
29303
 
-
 
29304
    const get = element => element.dom.textContent;
28177
 
29305
 
28178
    const labelledBy = (labelledElement, labelElement) => {
29306
    const labelledBy = (labelledElement, labelElement) => {
28179
      const labelId = getOpt(labelledElement, 'id').fold(() => {
29307
      const labelId = getOpt(labelledElement, 'id').fold(() => {
28180
        const id = generate$6('dialog-label');
29308
        const id = generate$6('dialog-label');
28181
        set$9(labelElement, 'id', id);
29309
        set$9(labelElement, 'id', id);
Línea 28255... Línea 29383...
28255
        name: 'blocker'
29383
        name: 'blocker'
28256
      })
29384
      })
28257
    ]);
29385
    ]);
Línea 28258... Línea 29386...
28258
 
29386
 
28259
    const factory$4 = (detail, components, spec, externals) => {
29387
    const factory$4 = (detail, components, spec, externals) => {
28260
      const dialogComp = value$2();
29388
      const dialogComp = value$4();
28261
      const showDialog = dialog => {
29389
      const showDialog = dialog => {
28262
        dialogComp.set(dialog);
29390
        dialogComp.set(dialog);
28263
        const sink = detail.lazySink(dialog).getOrDie();
29391
        const sink = detail.lazySink(dialog).getOrDie();
28264
        const externalBlocker = externals.blocker();
29392
        const externalBlocker = externals.blocker();
Línea 28294... Línea 29422...
28294
      const modalEventsId = generate$6('modal-events');
29422
      const modalEventsId = generate$6('modal-events');
28295
      const eventOrder = {
29423
      const eventOrder = {
28296
        ...detail.eventOrder,
29424
        ...detail.eventOrder,
28297
        [attachedToDom()]: [modalEventsId].concat(detail.eventOrder['alloy.system.attached'] || [])
29425
        [attachedToDom()]: [modalEventsId].concat(detail.eventOrder['alloy.system.attached'] || [])
28298
      };
29426
      };
-
 
29427
      const browser = detect$1();
28299
      return {
29428
      return {
28300
        uid: detail.uid,
29429
        uid: detail.uid,
28301
        dom: detail.dom,
29430
        dom: detail.dom,
28302
        components,
29431
        components,
28303
        apis: {
29432
        apis: {
Línea 28324... Línea 29453...
28324
            useTabstopAt: detail.useTabstopAt,
29453
            useTabstopAt: detail.useTabstopAt,
28325
            firstTabstop: detail.firstTabstop
29454
            firstTabstop: detail.firstTabstop
28326
          }),
29455
          }),
28327
          Blocking.config({ getRoot: dialogComp.get }),
29456
          Blocking.config({ getRoot: dialogComp.get }),
28328
          config(modalEventsId, [runOnAttached(c => {
29457
          config(modalEventsId, [runOnAttached(c => {
28329
              labelledBy(c.element, getPartOrDie(c, detail, 'title').element);
29458
              const titleElm = getPartOrDie(c, detail, 'title').element;
-
 
29459
              const title = get(titleElm);
-
 
29460
              if (browser.os.isMacOS() && isNonNullable(title)) {
-
 
29461
                set$9(c.element, 'aria-label', title);
-
 
29462
              } else {
-
 
29463
                labelledBy(c.element, titleElm);
-
 
29464
              }
28330
            })])
29465
            })])
28331
        ])
29466
        ])
28332
      };
29467
      };
28333
    };
29468
    };
28334
    const ModalDialog = composite({
29469
    const ModalDialog = composite({
Línea 28370... Línea 29505...
28370
      primary,
29505
      primary,
28371
      enabled,
29506
      enabled,
28372
      optionStringEnum('buttonType', [
29507
      optionStringEnum('buttonType', [
28373
        'primary',
29508
        'primary',
28374
        'secondary'
29509
        'secondary'
28375
      ])
29510
      ]),
-
 
29511
      defaultedString('context', 'mode:design')
28376
    ];
29512
    ];
28377
    const dialogFooterButtonFields = [
29513
    const dialogFooterButtonFields = [
28378
      ...baseFooterButtonFields,
29514
      ...baseFooterButtonFields,
28379
      text
29515
      text
28380
    ];
29516
    ];
Línea 28395... Línea 29531...
28395
      ...baseFooterButtonFields
29531
      ...baseFooterButtonFields
28396
    ];
29532
    ];
28397
    const toggleButtonSpecFields = [
29533
    const toggleButtonSpecFields = [
28398
      ...baseFooterButtonFields,
29534
      ...baseFooterButtonFields,
28399
      requiredStringEnum('type', ['togglebutton']),
29535
      requiredStringEnum('type', ['togglebutton']),
28400
      requiredString('tooltip'),
29536
      optionalTooltip,
28401
      optionalIcon,
29537
      optionalIcon,
28402
      optionalText,
29538
      optionalText,
28403
      defaultedBoolean('active', false)
29539
      defaultedBoolean('active', false)
28404
    ];
29540
    ];
28405
    const dialogFooterButtonSchema = choose$1('type', {
29541
    const dialogFooterButtonSchema = choose$1('type', {
Línea 28439... Línea 29575...
28439
      optionStringEnum('buttonType', [
29575
      optionStringEnum('buttonType', [
28440
        'primary',
29576
        'primary',
28441
        'secondary',
29577
        'secondary',
28442
        'toolbar'
29578
        'toolbar'
28443
      ]),
29579
      ]),
28444
      primary
29580
      primary,
-
 
29581
      defaultedString('context', 'mode:design')
28445
    ];
29582
    ];
28446
    const buttonSchema = objOf(buttonFields);
29583
    const buttonSchema = objOf(buttonFields);
Línea 28447... Línea 29584...
28447
 
29584
 
28448
    const formComponentFields = [
29585
    const formComponentFields = [
Línea 28451... Línea 29588...
28451
    ];
29588
    ];
28452
    const formComponentWithLabelFields = formComponentFields.concat([optionalLabel]);
29589
    const formComponentWithLabelFields = formComponentFields.concat([optionalLabel]);
Línea 28453... Línea 29590...
28453
 
29590
 
28454
    const checkboxFields = formComponentFields.concat([
29591
    const checkboxFields = formComponentFields.concat([
28455
      label,
29592
      label,
-
 
29593
      enabled,
28456
      enabled
29594
      defaultedString('context', 'mode:design')
28457
    ]);
29595
    ]);
28458
    const checkboxSchema = objOf(checkboxFields);
29596
    const checkboxSchema = objOf(checkboxFields);
Línea 28459... Línea 29597...
28459
    const checkboxDataProcessor = boolean;
29597
    const checkboxDataProcessor = boolean;
-
 
29598
 
-
 
29599
    const collectionFields = formComponentWithLabelFields.concat([
-
 
29600
      defaultedColumns('auto'),
28460
 
29601
      defaultedString('context', 'mode:design')
28461
    const collectionFields = formComponentWithLabelFields.concat([defaultedColumns('auto')]);
29602
    ]);
28462
    const collectionSchema = objOf(collectionFields);
29603
    const collectionSchema = objOf(collectionFields);
28463
    const collectionDataProcessor = arrOfObj([
29604
    const collectionDataProcessor = arrOfObj([
28464
      value$1,
29605
      value$1,
28465
      text,
29606
      text,
Línea 28466... Línea 29607...
28466
      icon
29607
      icon
-
 
29608
    ]);
-
 
29609
 
-
 
29610
    const colorInputFields = formComponentWithLabelFields.concat([
28467
    ]);
29611
      defaultedString('storageKey', 'default'),
28468
 
29612
      defaultedString('context', 'mode:design')
Línea 28469... Línea 29613...
28469
    const colorInputFields = formComponentWithLabelFields.concat([defaultedString('storageKey', 'default')]);
29613
    ]);
28470
    const colorInputSchema = objOf(colorInputFields);
29614
    const colorInputSchema = objOf(colorInputFields);
Línea 28476... Línea 29620...
28476
 
29620
 
28477
    const customEditorFields = formComponentFields.concat([
29621
    const customEditorFields = formComponentFields.concat([
28478
      defaultedString('tag', 'textarea'),
29622
      defaultedString('tag', 'textarea'),
28479
      requiredString('scriptId'),
29623
      requiredString('scriptId'),
-
 
29624
      requiredString('scriptUrl'),
28480
      requiredString('scriptUrl'),
29625
      optionFunction('onFocus'),
28481
      defaultedPostMsg('settings', undefined)
29626
      defaultedPostMsg('settings', undefined)
28482
    ]);
29627
    ]);
28483
    const customEditorFieldsOld = formComponentFields.concat([
29628
    const customEditorFieldsOld = formComponentFields.concat([
28484
      defaultedString('tag', 'textarea'),
29629
      defaultedString('tag', 'textarea'),
28485
      requiredFunction('init')
29630
      requiredFunction('init')
28486
    ]);
29631
    ]);
28487
    const customEditorSchema = valueOf(v => asRaw('customeditor.old', objOfOnly(customEditorFieldsOld), v).orThunk(() => asRaw('customeditor.new', objOfOnly(customEditorFields), v)));
29632
    const customEditorSchema = valueOf(v => asRaw('customeditor.old', objOfOnly(customEditorFieldsOld), v).orThunk(() => asRaw('customeditor.new', objOfOnly(customEditorFields), v)));
Línea 28488... Línea 29633...
28488
    const customEditorDataProcessor = string;
29633
    const customEditorDataProcessor = string;
28489
 
29634
 
28490
    const dropZoneFields = formComponentWithLabelFields;
29635
    const dropZoneFields = formComponentWithLabelFields.concat([defaultedString('context', 'mode:design')]);
Línea 28491... Línea 29636...
28491
    const dropZoneSchema = objOf(dropZoneFields);
29636
    const dropZoneSchema = objOf(dropZoneFields);
28492
    const dropZoneDataProcessor = arrOfVal();
29637
    const dropZoneDataProcessor = arrOfVal();
Línea 28501... Línea 29646...
28501
      type,
29646
      type,
28502
      requiredString('html'),
29647
      requiredString('html'),
28503
      defaultedStringEnum('presets', 'presentation', [
29648
      defaultedStringEnum('presets', 'presentation', [
28504
        'presentation',
29649
        'presentation',
28505
        'document'
29650
        'document'
28506
      ])
29651
      ]),
-
 
29652
      defaultedFunction('onInit', noop),
-
 
29653
      defaultedBoolean('stretched', false)
28507
    ];
29654
    ];
28508
    const htmlPanelSchema = objOf(htmlPanelFields);
29655
    const htmlPanelSchema = objOf(htmlPanelFields);
Línea 28509... Línea 29656...
28509
 
29656
 
28510
    const iframeFields = formComponentWithLabelFields.concat([
29657
    const iframeFields = formComponentWithLabelFields.concat([
Línea 28526... Línea 29673...
28526
 
29673
 
28527
    const inputFields = formComponentWithLabelFields.concat([
29674
    const inputFields = formComponentWithLabelFields.concat([
28528
      optionString('inputMode'),
29675
      optionString('inputMode'),
28529
      optionString('placeholder'),
29676
      optionString('placeholder'),
28530
      defaultedBoolean('maximized', false),
29677
      defaultedBoolean('maximized', false),
-
 
29678
      enabled,
28531
      enabled
29679
      defaultedString('context', 'mode:design')
28532
    ]);
29680
    ]);
28533
    const inputSchema = objOf(inputFields);
29681
    const inputSchema = objOf(inputFields);
Línea 28534... Línea 29682...
28534
    const inputDataProcessor = string;
29682
    const inputDataProcessor = string;
Línea 28539... Línea 29687...
28539
      itemsField,
29687
      itemsField,
28540
      defaultedStringEnum('align', 'start', [
29688
      defaultedStringEnum('align', 'start', [
28541
        'start',
29689
        'start',
28542
        'center',
29690
        'center',
28543
        'end'
29691
        'end'
28544
      ])
29692
      ]),
-
 
29693
      optionString('for')
28545
    ];
29694
    ];
Línea 28546... Línea 29695...
28546
 
29695
 
28547
    const listBoxSingleItemFields = [
29696
    const listBoxSingleItemFields = [
28548
      text,
29697
      text,
Línea 28556... Línea 29705...
28556
      objOf(listBoxSingleItemFields),
29705
      objOf(listBoxSingleItemFields),
28557
      objOf(listBoxNestedItemFields)
29706
      objOf(listBoxNestedItemFields)
28558
    ]);
29707
    ]);
28559
    const listBoxFields = formComponentWithLabelFields.concat([
29708
    const listBoxFields = formComponentWithLabelFields.concat([
28560
      requiredArrayOf('items', listBoxItemSchema),
29709
      requiredArrayOf('items', listBoxItemSchema),
28561
      enabled
29710
      enabled,
-
 
29711
      defaultedString('context', 'mode:design')
28562
    ]);
29712
    ]);
28563
    const listBoxSchema = objOf(listBoxFields);
29713
    const listBoxSchema = objOf(listBoxFields);
28564
    const listBoxDataProcessor = string;
29714
    const listBoxDataProcessor = string;
Línea 28565... Línea 29715...
28565
 
29715
 
28566
    const selectBoxFields = formComponentWithLabelFields.concat([
29716
    const selectBoxFields = formComponentWithLabelFields.concat([
28567
      requiredArrayOfObj('items', [
29717
      requiredArrayOfObj('items', [
28568
        text,
29718
        text,
28569
        value$1
29719
        value$1
28570
      ]),
29720
      ]),
28571
      defaultedNumber('size', 1),
29721
      defaultedNumber('size', 1),
-
 
29722
      enabled,
28572
      enabled
29723
      defaultedString('context', 'mode:design')
28573
    ]);
29724
    ]);
28574
    const selectBoxSchema = objOf(selectBoxFields);
29725
    const selectBoxSchema = objOf(selectBoxFields);
Línea 28575... Línea 29726...
28575
    const selectBoxDataProcessor = string;
29726
    const selectBoxDataProcessor = string;
28576
 
29727
 
28577
    const sizeInputFields = formComponentWithLabelFields.concat([
29728
    const sizeInputFields = formComponentWithLabelFields.concat([
-
 
29729
      defaultedBoolean('constrain', true),
28578
      defaultedBoolean('constrain', true),
29730
      enabled,
28579
      enabled
29731
      defaultedString('context', 'mode:design')
28580
    ]);
29732
    ]);
28581
    const sizeInputSchema = objOf(sizeInputFields);
29733
    const sizeInputSchema = objOf(sizeInputFields);
28582
    const sizeInputDataProcessor = objOf([
29734
    const sizeInputDataProcessor = objOf([
Línea 28600... Línea 29752...
28600
    const tableSchema = objOf(tableFields);
29752
    const tableSchema = objOf(tableFields);
Línea 28601... Línea 29753...
28601
 
29753
 
28602
    const textAreaFields = formComponentWithLabelFields.concat([
29754
    const textAreaFields = formComponentWithLabelFields.concat([
28603
      optionString('placeholder'),
29755
      optionString('placeholder'),
28604
      defaultedBoolean('maximized', false),
29756
      defaultedBoolean('maximized', false),
-
 
29757
      enabled,
28605
      enabled
29758
      defaultedString('context', 'mode:design')
28606
    ]);
29759
    ]);
28607
    const textAreaSchema = objOf(textAreaFields);
29760
    const textAreaSchema = objOf(textAreaFields);
Línea 28608... Línea 29761...
28608
    const textAreaDataProcessor = string;
29761
    const textAreaDataProcessor = string;
Línea 28612... Línea 29765...
28612
        'directory',
29765
        'directory',
28613
        'leaf'
29766
        'leaf'
28614
      ]),
29767
      ]),
28615
      title,
29768
      title,
28616
      requiredString('id'),
29769
      requiredString('id'),
28617
      optionOf('menu', MenuButtonSchema)
29770
      optionOf('menu', MenuButtonSchema),
-
 
29771
      optionString('customStateIcon'),
-
 
29772
      optionString('customStateIconTooltip')
28618
    ];
29773
    ];
28619
    const treeItemLeafFields = baseTreeItemFields;
29774
    const treeItemLeafFields = baseTreeItemFields;
28620
    const treeItemLeafSchema = objOf(treeItemLeafFields);
29775
    const treeItemLeafSchema = objOf(treeItemLeafFields);
28621
    const treeItemDirectoryFields = baseTreeItemFields.concat([requiredArrayOf('children', thunkOf('children', () => {
29776
    const treeItemDirectoryFields = baseTreeItemFields.concat([requiredArrayOf('children', thunkOf('children', () => {
28622
        return choose$2('type', {
29777
        return choose$2('type', {
Línea 28644... Línea 29799...
28644
        'image',
29799
        'image',
28645
        'media',
29800
        'media',
28646
        'file'
29801
        'file'
28647
      ]),
29802
      ]),
28648
      enabled,
29803
      enabled,
28649
      optionString('picker_text')
29804
      optionString('picker_text'),
-
 
29805
      defaultedString('context', 'mode:design')
28650
    ]);
29806
    ]);
28651
    const urlInputSchema = objOf(urlInputFields);
29807
    const urlInputSchema = objOf(urlInputFields);
28652
    const urlInputDataProcessor = objOf([
29808
    const urlInputDataProcessor = objOf([
28653
      value$1,
29809
      value$1,
28654
      defaultedMeta
29810
      defaultedMeta
Línea 28887... Línea 30043...
28887
        });
30043
        });
28888
      });
30044
      });
28889
      return errors.length > 0 ? Result.error(errors) : Result.value(result);
30045
      return errors.length > 0 ? Result.error(errors) : Result.value(result);
28890
    };
30046
    };
Línea 28891... Línea 30047...
28891
 
30047
 
28892
    const renderBodyPanel = (spec, dialogData, backstage) => {
30048
    const renderBodyPanel = (spec, dialogData, backstage, getCompByName) => {
28893
      const memForm = record(Form.sketch(parts => ({
30049
      const memForm = record(Form.sketch(parts => ({
28894
        dom: {
30050
        dom: {
28895
          tag: 'div',
30051
          tag: 'div',
28896
          classes: ['tox-form'].concat(spec.classes)
30052
          classes: ['tox-form'].concat(spec.classes)
28897
        },
30053
        },
28898
        components: map$2(spec.items, item => interpretInForm(parts, item, dialogData, backstage))
30054
        components: map$2(spec.items, item => interpretInForm(parts, item, dialogData, backstage, getCompByName))
28899
      })));
30055
      })));
28900
      return {
30056
      return {
28901
        dom: {
30057
        dom: {
28902
          tag: 'div',
30058
          tag: 'div',
Línea 28930... Línea 30086...
28930
 
30086
 
28931
    const factory$3 = (detail, _spec) => ({
30087
    const factory$3 = (detail, _spec) => ({
28932
      uid: detail.uid,
30088
      uid: detail.uid,
28933
      dom: detail.dom,
30089
      dom: detail.dom,
28934
      components: detail.components,
30090
      components: detail.components,
28935
      events: events$a(detail.action),
30091
      events: events$9(detail.action),
28936
      behaviours: augment(detail.tabButtonBehaviours, [
30092
      behaviours: augment(detail.tabButtonBehaviours, [
28937
        Focusing.config({}),
30093
        Focusing.config({}),
28938
        Keying.config({
30094
        Keying.config({
28939
          mode: 'execution',
30095
          mode: 'execution',
Línea 29124... Línea 30280...
29124
      };
30280
      };
29125
      return {
30281
      return {
29126
        uid: detail.uid,
30282
        uid: detail.uid,
29127
        dom: detail.dom,
30283
        dom: detail.dom,
29128
        components,
30284
        components,
29129
        behaviours: get$3(detail.tabSectionBehaviours),
30285
        behaviours: get$4(detail.tabSectionBehaviours),
29130
        events: derive$2(flatten([
30286
        events: derive$2(flatten([
29131
          detail.selectFirst ? [runOnAttached((section, _simulatedEvent) => {
30287
          detail.selectFirst ? [runOnAttached((section, _simulatedEvent) => {
29132
              changeTabBy(section, Highlighting.getFirst);
30288
              changeTabBy(section, Highlighting.getFirst);
29133
            })] : [],
30289
            })] : [],
29134
          [
30290
          [
Línea 29186... Línea 30342...
29186
      }
30342
      }
29187
    }));
30343
    }));
29188
    const getMaxTabviewHeight = (dialog, tabview, tablist) => {
30344
    const getMaxTabviewHeight = (dialog, tabview, tablist) => {
29189
      const documentElement$1 = documentElement(dialog).dom;
30345
      const documentElement$1 = documentElement(dialog).dom;
29190
      const rootElm = ancestor(dialog, '.tox-dialog-wrap').getOr(dialog);
30346
      const rootElm = ancestor(dialog, '.tox-dialog-wrap').getOr(dialog);
29191
      const isFixed = get$e(rootElm, 'position') === 'fixed';
30347
      const isFixed = get$f(rootElm, 'position') === 'fixed';
29192
      let maxHeight;
30348
      let maxHeight;
29193
      if (isFixed) {
30349
      if (isFixed) {
29194
        maxHeight = Math.max(documentElement$1.clientHeight, window.innerHeight);
30350
        maxHeight = Math.max(documentElement$1.clientHeight, window.innerHeight);
29195
      } else {
30351
      } else {
29196
        maxHeight = Math.max(documentElement$1.offsetHeight, documentElement$1.scrollHeight);
30352
        maxHeight = Math.max(documentElement$1.offsetHeight, documentElement$1.scrollHeight);
29197
      }
30353
      }
29198
      const tabviewHeight = get$d(tabview);
30354
      const tabviewHeight = get$e(tabview);
29199
      const isTabListBeside = tabview.dom.offsetLeft >= tablist.dom.offsetLeft + get$c(tablist);
30355
      const isTabListBeside = tabview.dom.offsetLeft >= tablist.dom.offsetLeft + get$d(tablist);
29200
      const currentTabHeight = isTabListBeside ? Math.max(get$d(tablist), tabviewHeight) : tabviewHeight;
30356
      const currentTabHeight = isTabListBeside ? Math.max(get$e(tablist), tabviewHeight) : tabviewHeight;
29201
      const dialogTopMargin = parseInt(get$e(dialog, 'margin-top'), 10) || 0;
30357
      const dialogTopMargin = parseInt(get$f(dialog, 'margin-top'), 10) || 0;
29202
      const dialogBottomMargin = parseInt(get$e(dialog, 'margin-bottom'), 10) || 0;
30358
      const dialogBottomMargin = parseInt(get$f(dialog, 'margin-bottom'), 10) || 0;
29203
      const dialogHeight = get$d(dialog) + dialogTopMargin + dialogBottomMargin;
30359
      const dialogHeight = get$e(dialog) + dialogTopMargin + dialogBottomMargin;
29204
      const chromeHeight = dialogHeight - currentTabHeight;
30360
      const chromeHeight = dialogHeight - currentTabHeight;
29205
      return maxHeight - chromeHeight;
30361
      return maxHeight - chromeHeight;
29206
    };
30362
    };
29207
    const showTab = (allTabs, comp) => {
30363
    const showTab = (allTabs, comp) => {
29208
      head(allTabs).each(tab => TabSection.showTab(comp, tab.value));
30364
      head(allTabs).each(tab => TabSection.showTab(comp, tab.value));
Línea 29224... Línea 30380...
29224
        });
30380
        });
29225
      });
30381
      });
29226
    };
30382
    };
29227
    const getTabview = dialog => descendant(dialog, '[role="tabpanel"]');
30383
    const getTabview = dialog => descendant(dialog, '[role="tabpanel"]');
29228
    const smartMode = allTabs => {
30384
    const smartMode = allTabs => {
29229
      const maxTabHeight = value$2();
30385
      const maxTabHeight = value$4();
29230
      const extraEvents = [
30386
      const extraEvents = [
29231
        runOnAttached(comp => {
30387
        runOnAttached(comp => {
29232
          const dialog = comp.element;
30388
          const dialog = comp.element;
29233
          getTabview(dialog).each(tabview => {
30389
          getTabview(dialog).each(tabview => {
29234
            set$8(tabview, 'visibility', 'hidden');
30390
            set$8(tabview, 'visibility', 'hidden');
Línea 29236... Línea 30392...
29236
              const heights = measureHeights(allTabs, tabview, tabviewComp);
30392
              const heights = measureHeights(allTabs, tabview, tabviewComp);
29237
              const maxTabHeightOpt = getMaxHeight(heights);
30393
              const maxTabHeightOpt = getMaxHeight(heights);
29238
              maxTabHeightOpt.fold(maxTabHeight.clear, maxTabHeight.set);
30394
              maxTabHeightOpt.fold(maxTabHeight.clear, maxTabHeight.set);
29239
            });
30395
            });
29240
            updateTabviewHeight(dialog, tabview, maxTabHeight);
30396
            updateTabviewHeight(dialog, tabview, maxTabHeight);
29241
            remove$6(tabview, 'visibility');
30397
            remove$7(tabview, 'visibility');
29242
            showTab(allTabs, comp);
30398
            showTab(allTabs, comp);
29243
            requestAnimationFrame(() => {
30399
            requestAnimationFrame(() => {
29244
              updateTabviewHeight(dialog, tabview, maxTabHeight);
30400
              updateTabviewHeight(dialog, tabview, maxTabHeight);
29245
            });
30401
            });
29246
          });
30402
          });
Línea 29255... Línea 30411...
29255
          const dialog = comp.element;
30411
          const dialog = comp.element;
29256
          getTabview(dialog).each(tabview => {
30412
          getTabview(dialog).each(tabview => {
29257
            const oldFocus = active$1(getRootNode(tabview));
30413
            const oldFocus = active$1(getRootNode(tabview));
29258
            set$8(tabview, 'visibility', 'hidden');
30414
            set$8(tabview, 'visibility', 'hidden');
29259
            const oldHeight = getRaw(tabview, 'height').map(h => parseInt(h, 10));
30415
            const oldHeight = getRaw(tabview, 'height').map(h => parseInt(h, 10));
29260
            remove$6(tabview, 'height');
30416
            remove$7(tabview, 'height');
29261
            remove$6(tabview, 'flex-basis');
30417
            remove$7(tabview, 'flex-basis');
29262
            const newHeight = tabview.dom.getBoundingClientRect().height;
30418
            const newHeight = tabview.dom.getBoundingClientRect().height;
29263
            const hasGrown = oldHeight.forall(h => newHeight > h);
30419
            const hasGrown = oldHeight.forall(h => newHeight > h);
29264
            if (hasGrown) {
30420
            if (hasGrown) {
29265
              maxTabHeight.set(newHeight);
30421
              maxTabHeight.set(newHeight);
29266
              updateTabviewHeight(dialog, tabview, maxTabHeight);
30422
              updateTabviewHeight(dialog, tabview, maxTabHeight);
29267
            } else {
30423
            } else {
29268
              oldHeight.each(h => {
30424
              oldHeight.each(h => {
29269
                setTabviewHeight(tabview, h);
30425
                setTabviewHeight(tabview, h);
29270
              });
30426
              });
29271
            }
30427
            }
29272
            remove$6(tabview, 'visibility');
30428
            remove$7(tabview, 'visibility');
29273
            oldFocus.each(focus$3);
30429
            oldFocus.each(focus$3);
29274
          });
30430
          });
29275
        })
30431
        })
29276
      ];
30432
      ];
29277
      const selectFirst = false;
30433
      const selectFirst = false;
Línea 29281... Línea 30437...
29281
      };
30437
      };
29282
    };
30438
    };
Línea 29283... Línea 30439...
29283
 
30439
 
29284
    const SendDataToSectionChannel = 'send-data-to-section';
30440
    const SendDataToSectionChannel = 'send-data-to-section';
29285
    const SendDataToViewChannel = 'send-data-to-view';
30441
    const SendDataToViewChannel = 'send-data-to-view';
29286
    const renderTabPanel = (spec, dialogData, backstage) => {
30442
    const renderTabPanel = (spec, dialogData, backstage, getCompByName) => {
29287
      const storedValue = Cell({});
30443
      const storedValue = Cell({});
29288
      const updateDataWithForm = form => {
30444
      const updateDataWithForm = form => {
29289
        const formData = Representing.getValue(form);
30445
        const formData = Representing.getValue(form);
29290
        const validData = toValidValues(formData).getOr({});
30446
        const validData = toValidValues(formData).getOr({});
Línea 29309... Línea 30465...
29309
            return [Form.sketch(parts => ({
30465
            return [Form.sketch(parts => ({
29310
                dom: {
30466
                dom: {
29311
                  tag: 'div',
30467
                  tag: 'div',
29312
                  classes: ['tox-form']
30468
                  classes: ['tox-form']
29313
                },
30469
                },
29314
                components: map$2(tab.items, item => interpretInForm(parts, item, dialogData, backstage)),
30470
                components: map$2(tab.items, item => interpretInForm(parts, item, dialogData, backstage, getCompByName)),
29315
                formBehaviours: derive$1([
30471
                formBehaviours: derive$1([
29316
                  Keying.config({
30472
                  Keying.config({
29317
                    mode: 'acyclic',
30473
                    mode: 'acyclic',
29318
                    useTabstopAt: not(isPseudoStop)
30474
                    useTabstopAt: not(isPseudoStop)
29319
                  }),
30475
                  }),
Línea 29387... Línea 30543...
29387
          })
30543
          })
29388
        ])
30544
        ])
29389
      });
30545
      });
29390
    };
30546
    };
Línea 29391... Línea 30547...
29391
 
30547
 
29392
    const renderBody = (spec, dialogId, contentId, backstage, ariaAttrs) => {
30548
    const renderBody = (spec, dialogId, contentId, backstage, ariaAttrs, getCompByName) => {
29393
      const renderComponents = incoming => {
30549
      const renderComponents = incoming => {
29394
        const body = incoming.body;
30550
        const body = incoming.body;
29395
        switch (body.type) {
30551
        switch (body.type) {
29396
        case 'tabpanel': {
30552
        case 'tabpanel': {
29397
            return [renderTabPanel(body, incoming.initialData, backstage)];
30553
            return [renderTabPanel(body, incoming.initialData, backstage, getCompByName)];
29398
          }
30554
          }
29399
        default: {
30555
        default: {
29400
            return [renderBodyPanel(body, incoming.initialData, backstage)];
30556
            return [renderBodyPanel(body, incoming.initialData, backstage, getCompByName)];
29401
          }
30557
          }
29402
        }
30558
        }
29403
      };
30559
      };
29404
      const updateState = (_comp, incoming) => Optional.some({ isTabPanel: () => incoming.body.type === 'tabpanel' });
30560
      const updateState = (_comp, incoming) => Optional.some({ isTabPanel: () => incoming.body.type === 'tabpanel' });
Línea 29422... Línea 30578...
29422
            initialData: spec
30578
            initialData: spec
29423
          })
30579
          })
29424
        ])
30580
        ])
29425
      };
30581
      };
29426
    };
30582
    };
29427
    const renderInlineBody = (spec, dialogId, contentId, backstage, ariaAttrs) => renderBody(spec, dialogId, Optional.some(contentId), backstage, ariaAttrs);
30583
    const renderInlineBody = (spec, dialogId, contentId, backstage, ariaAttrs, getCompByName) => renderBody(spec, dialogId, Optional.some(contentId), backstage, ariaAttrs, getCompByName);
29428
    const renderModalBody = (spec, dialogId, backstage) => {
30584
    const renderModalBody = (spec, dialogId, backstage, getCompByName) => {
29429
      const bodySpec = renderBody(spec, dialogId, Optional.none(), backstage, false);
30585
      const bodySpec = renderBody(spec, dialogId, Optional.none(), backstage, false, getCompByName);
29430
      return ModalDialog.parts.body(bodySpec);
30586
      return ModalDialog.parts.body(bodySpec);
29431
    };
30587
    };
29432
    const renderIframeBody = spec => {
30588
    const renderIframeBody = spec => {
29433
      const bodySpec = {
30589
      const bodySpec = {
29434
        dom: {
30590
        dom: {
Línea 29457... Línea 30613...
29457
          })])
30613
          })])
29458
      };
30614
      };
29459
      return ModalDialog.parts.body(bodySpec);
30615
      return ModalDialog.parts.body(bodySpec);
29460
    };
30616
    };
Línea 29461... Línea 30617...
29461
 
30617
 
29462
    const isTouch = global$5.deviceType.isTouch();
30618
    const isTouch = global$6.deviceType.isTouch();
29463
    const hiddenHeader = (title, close) => ({
30619
    const hiddenHeader = (title, close) => ({
29464
      dom: {
30620
      dom: {
29465
        tag: 'div',
30621
        tag: 'div',
29466
        styles: { display: 'none' },
30622
        styles: { display: 'none' },
Línea 29585... Línea 30741...
29585
          config('scroll-lock', [
30741
          config('scroll-lock', [
29586
            runOnAttached(() => {
30742
            runOnAttached(() => {
29587
              add$2(body(), scrollLockClass);
30743
              add$2(body(), scrollLockClass);
29588
            }),
30744
            }),
29589
            runOnDetached(() => {
30745
            runOnDetached(() => {
29590
              remove$2(body(), scrollLockClass);
30746
              remove$3(body(), scrollLockClass);
29591
            })
30747
            })
29592
          ]),
30748
          ]),
29593
          ...spec.extraBehaviours
30749
          ...spec.extraBehaviours
29594
        ]),
30750
        ]),
29595
        eventOrder: {
30751
        eventOrder: {
Línea 29618... Línea 30774...
29618
          'tox-button--naked'
30774
          'tox-button--naked'
29619
        ],
30775
        ],
29620
        attributes: {
30776
        attributes: {
29621
          'type': 'button',
30777
          'type': 'button',
29622
          'aria-label': providersBackstage.translate('Close'),
30778
          'aria-label': providersBackstage.translate('Close'),
29623
          'title': providersBackstage.translate('Close')
30779
          'data-mce-name': 'close'
29624
        }
30780
        }
29625
      },
30781
      },
29626
      buttonBehaviours: derive$1([Tabstopping.config({})]),
30782
      buttonBehaviours: derive$1([
-
 
30783
        Tabstopping.config({}),
-
 
30784
        Tooltipping.config(providersBackstage.tooltips.getConfig({ tooltipText: providersBackstage.translate('Close') }))
-
 
30785
      ]),
29627
      components: [render$3('close', {
30786
      components: [render$3('close', {
29628
          tag: 'span',
30787
          tag: 'span',
29629
          classes: ['tox-icon']
30788
          classes: ['tox-icon']
29630
        }, providersBackstage.icons)],
30789
        }, providersBackstage.icons)],
29631
      action: comp => {
30790
      action: comp => {
Línea 29634... Línea 30793...
29634
    });
30793
    });
29635
    const renderTitle = (spec, dialogId, titleId, providersBackstage) => {
30794
    const renderTitle = (spec, dialogId, titleId, providersBackstage) => {
29636
      const renderComponents = data => [text$2(providersBackstage.translate(data.title))];
30795
      const renderComponents = data => [text$2(providersBackstage.translate(data.title))];
29637
      return {
30796
      return {
29638
        dom: {
30797
        dom: {
29639
          tag: 'div',
30798
          tag: 'h1',
29640
          classes: ['tox-dialog__title'],
30799
          classes: ['tox-dialog__title'],
29641
          attributes: { ...titleId.map(x => ({ id: x })).getOr({}) }
30800
          attributes: { ...titleId.map(x => ({ id: x })).getOr({}) }
29642
        },
30801
        },
29643
        components: [],
30802
        components: [],
29644
        behaviours: derive$1([Reflecting.config({
30803
        behaviours: derive$1([Reflecting.config({
Línea 29701... Línea 30860...
29701
      components: [{ dom: fromHtml('<div class="tox-spinner"><div></div><div></div><div></div></div>') }]
30860
      components: [{ dom: fromHtml('<div class="tox-spinner"><div></div><div></div><div></div></div>') }]
29702
    });
30861
    });
29703
    const getEventExtras = (lazyDialog, providers, extra) => ({
30862
    const getEventExtras = (lazyDialog, providers, extra) => ({
29704
      onClose: () => extra.closeWindow(),
30863
      onClose: () => extra.closeWindow(),
29705
      onBlock: blockEvent => {
30864
      onBlock: blockEvent => {
29706
        const headerHeight = descendant(lazyDialog().element, '.tox-dialog__header').map(header => get$d(header));
30865
        const headerHeight = descendant(lazyDialog().element, '.tox-dialog__header').map(header => get$e(header));
29707
        ModalDialog.setBusy(lazyDialog(), (_comp, bs) => getBusySpec(blockEvent.message, bs, providers, headerHeight));
30866
        ModalDialog.setBusy(lazyDialog(), (_comp, bs) => getBusySpec(blockEvent.message, bs, providers, headerHeight));
29708
      },
30867
      },
29709
      onUnblock: () => {
30868
      onUnblock: () => {
29710
        ModalDialog.setIdle(lazyDialog());
30869
        ModalDialog.setIdle(lazyDialog());
29711
      }
30870
      }
Línea 29724... Línea 30883...
29724
      }
30883
      }
29725
    };
30884
    };
29726
    const updateDialogSizeClass = (size, component) => {
30885
    const updateDialogSizeClass = (size, component) => {
29727
      const dialogBody = SugarElement.fromDom(component.element.dom);
30886
      const dialogBody = SugarElement.fromDom(component.element.dom);
29728
      if (!has(dialogBody, fullscreenClass)) {
30887
      if (!has(dialogBody, fullscreenClass)) {
29729
        remove$1(dialogBody, [
30888
        remove$2(dialogBody, [
29730
          largeDialogClass,
30889
          largeDialogClass,
29731
          mediumDialogClass
30890
          mediumDialogClass
29732
        ]);
30891
        ]);
29733
        getDialogSizeClass(size).each(dialogSizeClass => add$2(dialogBody, dialogSizeClass));
30892
        getDialogSizeClass(size).each(dialogSizeClass => add$2(dialogBody, dialogSizeClass));
29734
      }
30893
      }
29735
    };
30894
    };
29736
    const toggleFullscreen = (comp, currentSize) => {
30895
    const toggleFullscreen = (comp, currentSize) => {
29737
      const dialogBody = SugarElement.fromDom(comp.element.dom);
30896
      const dialogBody = SugarElement.fromDom(comp.element.dom);
29738
      const classes = get$7(dialogBody);
30897
      const classes = get$9(dialogBody);
29739
      const currentSizeClass = find$5(classes, c => c === largeDialogClass || c === mediumDialogClass).or(getDialogSizeClass(currentSize));
30898
      const currentSizeClass = find$5(classes, c => c === largeDialogClass || c === mediumDialogClass).or(getDialogSizeClass(currentSize));
29740
      toggle$3(dialogBody, [
30899
      toggle$3(dialogBody, [
29741
        fullscreenClass,
30900
        fullscreenClass,
29742
        ...currentSizeClass.toArray()
30901
        ...currentSizeClass.toArray()
29743
      ]);
30902
      ]);
Línea 29776... Línea 30935...
29776
      }
30935
      }
29777
    }));
30936
    }));
29778
    const mapMenuButtons = (buttons, menuItemStates = {}) => {
30937
    const mapMenuButtons = (buttons, menuItemStates = {}) => {
29779
      const mapItems = button => {
30938
      const mapItems = button => {
29780
        const items = map$2(button.items, item => {
30939
        const items = map$2(button.items, item => {
29781
          const cell = get$g(menuItemStates, item.name).getOr(Cell(false));
30940
          const cell = get$h(menuItemStates, item.name).getOr(Cell(false));
29782
          return {
30941
          return {
29783
            ...item,
30942
            ...item,
29784
            storage: cell
30943
            storage: cell
29785
          };
30944
          };
29786
        });
30945
        });
Línea 29805... Línea 30964...
29805
    }, {});
30964
    }, {});
Línea 29806... Línea 30965...
29806
 
30965
 
29807
    const initCommonEvents = (fireApiEvent, extras) => [
30966
    const initCommonEvents = (fireApiEvent, extras) => [
29808
      runWithTarget(focusin(), onFocus),
30967
      runWithTarget(focusin(), onFocus),
-
 
30968
      fireApiEvent(formCloseEvent, (_api, spec, _event, self) => {
29809
      fireApiEvent(formCloseEvent, (_api, spec, _event, self) => {
30969
        if (hasFocus(self.element)) {
-
 
30970
          active$1(getRootNode(self.element)).each(blur$1);
29810
        active$1(getRootNode(self.element)).fold(noop, blur$1);
30971
        }
29811
        extras.onClose();
30972
        extras.onClose();
29812
        spec.onClose();
30973
        spec.onClose();
29813
      }),
30974
      }),
29814
      fireApiEvent(formCancelEvent, (api, spec, _event, self) => {
30975
      fireApiEvent(formCancelEvent, (api, spec, _event, self) => {
Línea 30050... Línea 31211...
30050
    const renderDialog = (dialogInit, extra, backstage) => {
31211
    const renderDialog = (dialogInit, extra, backstage) => {
30051
      const dialogId = generate$6('dialog');
31212
      const dialogId = generate$6('dialog');
30052
      const internalDialog = dialogInit.internalDialog;
31213
      const internalDialog = dialogInit.internalDialog;
30053
      const header = getHeader(internalDialog.title, dialogId, backstage);
31214
      const header = getHeader(internalDialog.title, dialogId, backstage);
30054
      const dialogSize = Cell(internalDialog.size);
31215
      const dialogSize = Cell(internalDialog.size);
-
 
31216
      const getCompByName$1 = name => getCompByName(modalAccess, name);
30055
      const dialogSizeClasses = getDialogSizeClass(dialogSize.get()).toArray();
31217
      const dialogSizeClasses = getDialogSizeClass(dialogSize.get()).toArray();
30056
      const updateState = (comp, incoming) => {
31218
      const updateState = (comp, incoming) => {
30057
        dialogSize.set(incoming.internalDialog.size);
31219
        dialogSize.set(incoming.internalDialog.size);
30058
        updateDialogSizeClass(incoming.internalDialog.size, comp);
31220
        updateDialogSizeClass(incoming.internalDialog.size, comp);
30059
        return Optional.some(incoming);
31221
        return Optional.some(incoming);
30060
      };
31222
      };
30061
      const body = renderModalBody({
31223
      const body = renderModalBody({
30062
        body: internalDialog.body,
31224
        body: internalDialog.body,
30063
        initialData: internalDialog.initialData
31225
        initialData: internalDialog.initialData
30064
      }, dialogId, backstage);
31226
      }, dialogId, backstage, getCompByName$1);
30065
      const storedMenuButtons = mapMenuButtons(internalDialog.buttons);
31227
      const storedMenuButtons = mapMenuButtons(internalDialog.buttons);
30066
      const objOfCells = extractCellsToObject(storedMenuButtons);
31228
      const objOfCells = extractCellsToObject(storedMenuButtons);
30067
      const footer = someIf(storedMenuButtons.length !== 0, renderModalFooter({ buttons: storedMenuButtons }, dialogId, backstage));
31229
      const footer = someIf(storedMenuButtons.length !== 0, renderModalFooter({ buttons: storedMenuButtons }, dialogId, backstage));
30068
      const dialogEvents = initDialog(() => instanceApi, getEventExtras(() => dialog, backstage.shared.providers, extra), backstage.shared.getSink);
31230
      const dialogEvents = initDialog(() => instanceApi, getEventExtras(() => dialog, backstage.shared.providers, extra), backstage.shared.getSink);
30069
      const spec = {
31231
      const spec = {
Línea 30107... Línea 31269...
30107
    const renderInlineDialog = (dialogInit, extra, backstage, ariaAttrs = false, refreshDocking) => {
31269
    const renderInlineDialog = (dialogInit, extra, backstage, ariaAttrs = false, refreshDocking) => {
30108
      const dialogId = generate$6('dialog');
31270
      const dialogId = generate$6('dialog');
30109
      const dialogLabelId = generate$6('dialog-label');
31271
      const dialogLabelId = generate$6('dialog-label');
30110
      const dialogContentId = generate$6('dialog-content');
31272
      const dialogContentId = generate$6('dialog-content');
30111
      const internalDialog = dialogInit.internalDialog;
31273
      const internalDialog = dialogInit.internalDialog;
-
 
31274
      const getCompByName$1 = name => getCompByName(modalAccess, name);
30112
      const dialogSize = Cell(internalDialog.size);
31275
      const dialogSize = Cell(internalDialog.size);
30113
      const dialogSizeClass = getDialogSizeClass(dialogSize.get()).toArray();
31276
      const dialogSizeClass = getDialogSizeClass(dialogSize.get()).toArray();
30114
      const updateState = (comp, incoming) => {
31277
      const updateState = (comp, incoming) => {
30115
        dialogSize.set(incoming.internalDialog.size);
31278
        dialogSize.set(incoming.internalDialog.size);
30116
        updateDialogSizeClass(incoming.internalDialog.size, comp);
31279
        updateDialogSizeClass(incoming.internalDialog.size, comp);
Línea 30122... Línea 31285...
30122
        draggable: true
31285
        draggable: true
30123
      }, dialogId, dialogLabelId, backstage.shared.providers));
31286
      }, dialogId, dialogLabelId, backstage.shared.providers));
30124
      const memBody = record(renderInlineBody({
31287
      const memBody = record(renderInlineBody({
30125
        body: internalDialog.body,
31288
        body: internalDialog.body,
30126
        initialData: internalDialog.initialData
31289
        initialData: internalDialog.initialData
30127
      }, dialogId, dialogContentId, backstage, ariaAttrs));
31290
      }, dialogId, dialogContentId, backstage, ariaAttrs, getCompByName$1));
30128
      const storagedMenuButtons = mapMenuButtons(internalDialog.buttons);
31291
      const storagedMenuButtons = mapMenuButtons(internalDialog.buttons);
30129
      const objOfCells = extractCellsToObject(storagedMenuButtons);
31292
      const objOfCells = extractCellsToObject(storagedMenuButtons);
30130
      const optMemFooter = someIf(storagedMenuButtons.length !== 0, record(renderInlineFooter({ buttons: storagedMenuButtons }, dialogId, backstage)));
31293
      const optMemFooter = someIf(storagedMenuButtons.length !== 0, record(renderInlineFooter({ buttons: storagedMenuButtons }, dialogId, backstage)));
30131
      const dialogEvents = initDialog(() => instanceApi, {
31294
      const dialogEvents = initDialog(() => instanceApi, {
30132
        onBlock: event => {
31295
        onBlock: event => {
30133
          Blocking.block(dialog, (_comp, bs) => {
31296
          Blocking.block(dialog, (_comp, bs) => {
30134
            const headerHeight = memHeader.getOpt(dialog).map(dialog => get$d(dialog.element));
31297
            const headerHeight = memHeader.getOpt(dialog).map(dialog => get$e(dialog.element));
30135
            return getBusySpec(event.message, bs, backstage.shared.providers, headerHeight);
31298
            return getBusySpec(event.message, bs, backstage.shared.providers, headerHeight);
30136
          });
31299
          });
30137
        },
31300
        },
30138
        onUnblock: () => {
31301
        onUnblock: () => {
30139
          Blocking.unblock(dialog);
31302
          Blocking.unblock(dialog);
30140
        },
31303
        },
30141
        onClose: () => extra.closeWindow()
31304
        onClose: () => extra.closeWindow()
30142
      }, backstage.shared.getSink);
31305
      }, backstage.shared.getSink);
30143
      const inlineClass = 'tox-dialog-inline';
31306
      const inlineClass = 'tox-dialog-inline';
-
 
31307
      const os = detect$1().os;
30144
      const dialog = build$1({
31308
      const dialog = build$1({
30145
        dom: {
31309
        dom: {
30146
          tag: 'div',
31310
          tag: 'div',
30147
          classes: [
31311
          classes: [
30148
            'tox-dialog',
31312
            'tox-dialog',
30149
            inlineClass,
31313
            inlineClass,
30150
            ...dialogSizeClass
31314
            ...dialogSizeClass
30151
          ],
31315
          ],
30152
          attributes: {
31316
          attributes: {
30153
            role: 'dialog',
31317
            role: 'dialog',
30154
            ['aria-labelledby']: dialogLabelId
31318
            ...os.isMacOS() ? { 'aria-label': internalDialog.title } : { 'aria-labelledby': dialogLabelId }
30155
          }
31319
          }
30156
        },
31320
        },
30157
        eventOrder: {
31321
        eventOrder: {
30158
          [receive()]: [
31322
          [receive()]: [
30159
            Reflecting.name(),
31323
            Reflecting.name(),
Línea 30170... Línea 31334...
30170
            mode: 'cyclic',
31334
            mode: 'cyclic',
30171
            onEscape: c => {
31335
            onEscape: c => {
30172
              emit(c, formCloseEvent);
31336
              emit(c, formCloseEvent);
30173
              return Optional.some(true);
31337
              return Optional.some(true);
30174
            },
31338
            },
30175
            useTabstopAt: elem => !isPseudoStop(elem) && (name$3(elem) !== 'button' || get$f(elem, 'disabled') !== 'disabled'),
31339
            useTabstopAt: elem => !isPseudoStop(elem) && (name$3(elem) !== 'button' || get$g(elem, 'disabled') !== 'disabled'),
30176
            firstTabstop: 1
31340
            firstTabstop: 1
30177
          }),
31341
          }),
30178
          Reflecting.config({
31342
          Reflecting.config({
30179
            channel: `${ dialogChannel }-${ dialogId }`,
31343
            channel: `${ dialogChannel }-${ dialogId }`,
30180
            updateState,
31344
            updateState,
Línea 30200... Línea 31364...
30200
        ]
31364
        ]
30201
      });
31365
      });
30202
      const toggleFullscreen$1 = () => {
31366
      const toggleFullscreen$1 = () => {
30203
        toggleFullscreen(dialog, dialogSize.get());
31367
        toggleFullscreen(dialog, dialogSize.get());
30204
      };
31368
      };
30205
      const instanceApi = getDialogApi({
31369
      const modalAccess = {
30206
        getId: constant$1(dialogId),
31370
        getId: constant$1(dialogId),
30207
        getRoot: constant$1(dialog),
31371
        getRoot: constant$1(dialog),
30208
        getFooter: () => optMemFooter.map(memFooter => memFooter.get(dialog)),
31372
        getFooter: () => optMemFooter.map(memFooter => memFooter.get(dialog)),
30209
        getBody: () => memBody.get(dialog),
31373
        getBody: () => memBody.get(dialog),
30210
        getFormWrapper: () => {
31374
        getFormWrapper: () => {
30211
          const body = memBody.get(dialog);
31375
          const body = memBody.get(dialog);
30212
          return Composing.getCurrent(body).getOr(body);
31376
          return Composing.getCurrent(body).getOr(body);
30213
        },
31377
        },
30214
        toggleFullscreen: toggleFullscreen$1
31378
        toggleFullscreen: toggleFullscreen$1
-
 
31379
      };
30215
      }, extra.redial, objOfCells);
31380
      const instanceApi = getDialogApi(modalAccess, extra.redial, objOfCells);
30216
      return {
31381
      return {
30217
        dialog,
31382
        dialog,
30218
        instanceApi
31383
        instanceApi
30219
      };
31384
      };
30220
    };
31385
    };
Línea 30378... Línea 31543...
30378
        const closeDialog = () => {
31543
        const closeDialog = () => {
30379
          ModalDialog.hide(alertDialog);
31544
          ModalDialog.hide(alertDialog);
30380
          callback();
31545
          callback();
30381
        };
31546
        };
30382
        const memFooterClose = record(renderFooterButton({
31547
        const memFooterClose = record(renderFooterButton({
-
 
31548
          context: 'any',
30383
          name: 'close-alert',
31549
          name: 'close-alert',
30384
          text: 'OK',
31550
          text: 'OK',
30385
          primary: true,
31551
          primary: true,
30386
          buttonType: Optional.some('primary'),
31552
          buttonType: Optional.some('primary'),
30387
          align: 'end',
31553
          align: 'end',
Línea 30415... Línea 31581...
30415
        const closeDialog = state => {
31581
        const closeDialog = state => {
30416
          ModalDialog.hide(confirmDialog);
31582
          ModalDialog.hide(confirmDialog);
30417
          callback(state);
31583
          callback(state);
30418
        };
31584
        };
30419
        const memFooterYes = record(renderFooterButton({
31585
        const memFooterYes = record(renderFooterButton({
-
 
31586
          context: 'any',
30420
          name: 'yes',
31587
          name: 'yes',
30421
          text: 'Yes',
31588
          text: 'Yes',
30422
          primary: true,
31589
          primary: true,
30423
          buttonType: Optional.some('primary'),
31590
          buttonType: Optional.some('primary'),
30424
          align: 'end',
31591
          align: 'end',
30425
          enabled: true,
31592
          enabled: true,
30426
          icon: Optional.none()
31593
          icon: Optional.none()
30427
        }, 'submit', backstage));
31594
        }, 'submit', backstage));
30428
        const footerNo = renderFooterButton({
31595
        const footerNo = renderFooterButton({
-
 
31596
          context: 'any',
30429
          name: 'no',
31597
          name: 'no',
30430
          text: 'No',
31598
          text: 'No',
30431
          primary: false,
31599
          primary: false,
30432
          buttonType: Optional.some('secondary'),
31600
          buttonType: Optional.some('secondary'),
30433
          align: 'end',
31601
          align: 'end',
Línea 30547... Línea 31715...
30547
        return DialogManager.open(factory, config);
31715
        return DialogManager.open(factory, config);
30548
      };
31716
      };
30549
      const openInlineDialog = (config$1, anchor, closeWindow, windowParams) => {
31717
      const openInlineDialog = (config$1, anchor, closeWindow, windowParams) => {
30550
        const factory = (contents, internalInitialData, dataValidator) => {
31718
        const factory = (contents, internalInitialData, dataValidator) => {
30551
          const initialData = validateData(internalInitialData, dataValidator);
31719
          const initialData = validateData(internalInitialData, dataValidator);
30552
          const inlineDialog = value$2();
31720
          const inlineDialog = value$4();
30553
          const isToolbarLocationTop = extras.backstages.popup.shared.header.isPositionedAtTop();
31721
          const isToolbarLocationTop = extras.backstages.popup.shared.header.isPositionedAtTop();
30554
          const dialogInit = {
31722
          const dialogInit = {
30555
            dataValidator,
31723
            dataValidator,
30556
            initialData,
31724
            initialData,
30557
            internalDialog: contents
31725
            internalDialog: contents
Línea 30605... Línea 31773...
30605
        return DialogManager.open(factory, config$1);
31773
        return DialogManager.open(factory, config$1);
30606
      };
31774
      };
30607
      const openBottomInlineDialog = (config$1, anchor, closeWindow, windowParams) => {
31775
      const openBottomInlineDialog = (config$1, anchor, closeWindow, windowParams) => {
30608
        const factory = (contents, internalInitialData, dataValidator) => {
31776
        const factory = (contents, internalInitialData, dataValidator) => {
30609
          const initialData = validateData(internalInitialData, dataValidator);
31777
          const initialData = validateData(internalInitialData, dataValidator);
30610
          const inlineDialog = value$2();
31778
          const inlineDialog = value$4();
30611
          const isToolbarLocationTop = extras.backstages.popup.shared.header.isPositionedAtTop();
31779
          const isToolbarLocationTop = extras.backstages.popup.shared.header.isPositionedAtTop();
30612
          const dialogInit = {
31780
          const dialogInit = {
30613
            dataValidator,
31781
            dataValidator,
30614
            initialData,
31782
            initialData,
30615
            internalDialog: contents
31783
            internalDialog: contents
Línea 30707... Línea 31875...
30707
        confirm
31875
        confirm
30708
      };
31876
      };
30709
    };
31877
    };
Línea 30710... Línea 31878...
30710
 
31878
 
-
 
31879
    const registerOptions = editor => {
30711
    const registerOptions = editor => {
31880
      register$f(editor);
30712
      register$e(editor);
-
 
30713
      register$d(editor);
31881
      register$e(editor);
30714
      register(editor);
31882
      register(editor);
30715
    };
31883
    };
30716
    var Theme = () => {
31884
    var Theme = () => {
30717
      global$a.add('silver', editor => {
31885
      global$a.add('silver', editor => {
Línea 30738... Línea 31906...
30738
          backstages: {
31906
          backstages: {
30739
            popup: popups.backstage,
31907
            popup: popups.backstage,
30740
            dialog: dialogs.backstage
31908
            dialog: dialogs.backstage
30741
          }
31909
          }
30742
        });
31910
        });
-
 
31911
        const notificationRegion = value$4();
30743
        const getNotificationManagerImpl = () => NotificationManagerImpl(editor, { backstage: popups.backstage }, popups.getMothership());
31912
        const getNotificationManagerImpl = () => NotificationManagerImpl(editor, { backstage: popups.backstage }, popups.getMothership(), notificationRegion);
30744
        return {
31913
        return {
30745
          renderUI,
31914
          renderUI,
30746
          getWindowManagerImpl: constant$1(windowMgr),
31915
          getWindowManagerImpl: constant$1(windowMgr),
30747
          getNotificationManagerImpl
31916
          getNotificationManagerImpl
30748
        };
31917
        };