From 5a8fe95c8b9b5250867affbcddf65b1416375283 Mon Sep 17 00:00:00 2001 From: Anthony Blackshaw Date: Mon, 21 May 2018 18:03:42 +0100 Subject: [PATCH] - Fix for #501. - Fix for using when with conditionals (not allowed) --- build/content-tools.js | 55 +++++++++++++++++++++-------------- build/content-tools.min.css | 2 +- build/content-tools.min.js | 14 ++++----- package.json | 2 +- spec/content-tools-spec.js | 2 +- src/scripts/editor.coffee | 2 +- src/scripts/ui/toolbox.coffee | 35 ++++++++++++---------- src/spec/ui/toolbox.coffee | 2 +- 8 files changed, 64 insertions(+), 50 deletions(-) diff --git a/build/content-tools.js b/build/content-tools.js index 56639459..7ea2966e 100644 --- a/build/content-tools.js +++ b/build/content-tools.js @@ -6589,24 +6589,30 @@ redo = false; undo = false; switch (os) { - case 'linux' && !ev.altKey: - if (ev.keyCode === 90 && ev.ctrlKey) { - redo = ev.shiftKey; - undo = !redo; + case 'linux': + if (!ev.altKey) { + if (ev.keyCode === 90 && ev.ctrlKey) { + redo = ev.shiftKey; + undo = !redo; + } } break; - case 'mac' && !(ev.altKey || ev.ctrlKey): - if (ev.keyCode === 90 && ev.metaKey) { - redo = ev.shiftKey; - undo = !redo; + case 'mac': + if (!(ev.altKey || ev.ctrlKey)) { + if (ev.keyCode === 90 && ev.metaKey) { + redo = ev.shiftKey; + undo = !redo; + } } break; - case 'windows' && !ev.altKey || ev.shiftKey: - if (ev.keyCode === 89 && ev.ctrlKey) { - redo = true; - } - if (ev.keyCode === 90 && ev.ctrlKey) { - undo = true; + case 'windows': + if (!ev.altKey || ev.shiftKey) { + if (ev.keyCode === 89 && ev.ctrlKey) { + redo = true; + } + if (ev.keyCode === 90 && ev.ctrlKey) { + undo = true; + } } } if (undo && ContentTools.Tools.Undo.canApply(null, null)) { @@ -8661,7 +8667,7 @@ if (!node) { continue; } - if (node.nodeName = '#text' && node.textContent.trim() === '') { + if (node.nodeName === '#text' && node.textContent.trim() === '') { continue; } elementCls = tagNames.match(node.nodeName); @@ -8813,14 +8819,19 @@ child = _ref1[_i]; child.unmount(); } - if (region.children.length === 1 && region.children[0].isFixed()) { - wrapper = this.constructor.createDiv(); - wrapper.innerHTML = snapshot.regions[name]; - domRegions.push(wrapper.firstElementChild); - region.domElement().parentNode.replaceChild(wrapper.firstElementChild, region.domElement()); + if (snapshot.regions[name] !== void 0) { + if (region.children.length === 1 && region.children[0].isFixed()) { + wrapper = this.constructor.createDiv(); + wrapper.innerHTML = snapshot.regions[name]; + domRegions.push(wrapper.firstElementChild); + region.domElement().parentNode.replaceChild(wrapper.firstElementChild, region.domElement()); + } else { + domRegions.push(region.domElement()); + region.domElement().innerHTML = snapshot.regions[name]; + } } else { - domRegions.push(region.domElement()); - region.domElement().innerHTML = snapshot.regions[name]; + region.domElement().remove(); + delete this._regions[name]; } } this._domRegions = domRegions; diff --git a/build/content-tools.min.css b/build/content-tools.min.css index 06cdc743..67319234 100644 --- a/build/content-tools.min.css +++ b/build/content-tools.min.css @@ -1 +1 @@ -/*! ContentTools v1.6.4 by Anthony Blackshaw (https://github.com/anthonyjb) */.ce--dragging,.ce--resizing{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce--dragging{cursor:move!important}.ce--resizing{cursor:nwse-resize!important}.ce-element--type-image,.ce-element--type-video{background-repeat:no-repeat;position:relative;cursor:pointer;z-index:1}.ce-element--type-image:after,.ce-element--type-image:before,.ce-element--type-video:after,.ce-element--type-video:before{background:rgba(0,0,0,.5);border-radius:2px;color:#fff;display:none;font-family:arial,sans-serif;font-size:10px;line-height:10px;padding:4px 4px 3px;position:absolute}.ce-element--type-image:before,.ce-element--type-video:before{content:attr(data-ce-size);right:10px;top:10px}.ce-element--type-image.ce-element--over:before,.ce-element--type-image.ce-element--resizing:before,.ce-element--type-video.ce-element--over:before,.ce-element--type-video.ce-element--resizing:before{display:block}.ce-element--type-image{background-position:0 0;background-size:cover}.ce-element--type-image:after{background:transparent;content:'';display:block;left:0;position:relative;top:0;height:100%;width:100%}.ce-element--type-video{background:#333 url(images/video.svg) 50%/auto 48px no-repeat}.ce-element--type-video:after{bottom:10px;content:attr(data-ce-title);display:block;left:10px}.ce-element--empty:after{content:'...';display:inline-block;font-style:italic;opacity:.5}.ce-element--empty[data-ce-placeholder]:after{content:attr(data-ce-placeholder)}.ce-element--dragging{background-color:rgba(51,51,51,.1)!important;opacity:.5;z-index:-1}.ce-element--dragging.ce-element--type-image,.ce-element--dragging.ce-element--type-video{background-color:#333!important;opacity:1;outline-color:rgba(51,51,51,.1)!important}.ce-element--drop{position:relative!important}.ce-element--drop:before{background:#f39c12 url(images/drop-vert-above.svg) 50%/auto 32px repeat;bottom:0;content:''!important;left:0;opacity:.8;position:absolute;right:0;top:0;z-index:9}.ce-element--drop-below:before{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.ce-element--drop-left:before{background-image:url(images/drop-horz.svg);-webkit-transform:rotate(0deg);transform:rotate(0deg)}.ce-element--drop-right:before{background-image:url(images/drop-horz.svg);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.ce-element--drop.ce-element--type-table-row{background:#f39c12 url(images/drop-vert-above.svg) 50%/auto 32px repeat}.ce-element--drop.ce-element--type-table-row:before{display:none}.ce-element--drop.ce-element--type-table-row.ce-element--drop-below{background:#f39c12 url(images/drop-vert-below.svg) 50%/auto 32px repeat}.ce-element--focused,.ce-element--over{background-color:rgba(243,156,18,.1);outline:none}.ce-element--focused.ce-element--type-image,.ce-element--focused.ce-element--type-image-fixture,.ce-element--focused.ce-element--type-video,.ce-element--over.ce-element--type-image,.ce-element--over.ce-element--type-image-fixture,.ce-element--over.ce-element--type-video{background-color:#333;outline:4px solid rgba(243,156,18,.35)}.ce-element--resize-top-left{cursor:nw-resize}.ce-element--resize-top-right{cursor:ne-resize}.ce-element--resize-bottom-right{cursor:se-resize}.ce-element--resize-bottom-left{cursor:sw-resize}.ce-drag-helper{background:#fff;border-radius:2px;box-shadow:0 3px 3px rgba(0,0,0,.25);color:#4e4e4e;font:arial,sans-serif;font-size:12px;height:120px;left:0;line-height:135%;margin:5px 0 0 5px;overflow:hidden;padding:15px;position:absolute;top:0;width:120px;word-wrap:break-word;z-index:9}.ce-drag-helper:before{background:#2980b9;color:#fff;content:attr(data-ce-type);display:block;font-family:arial,sans-serif;font-size:10px;line-height:10px;padding:4px 4px 3px;position:absolute;right:0;top:0}.ce-drag-helper--type-list-item-text:after,.ce-drag-helper--type-list:after,.ce-drag-helper--type-pre-text:after,.ce-drag-helper--type-table-row:after,.ce-drag-helper--type-table:after,.ce-drag-helper--type-text:after{background-image:linear-gradient(hsla(0,0%,100%,0),#fff 66%);bottom:0;content:'';display:block;height:40px;left:0;position:absolute;width:100%}.ce-drag-helper--type-image{background-repeat:no-repeat;background-size:cover}.ce-element--type-image,.ce-element--type-video{display:block;margin-left:auto;margin-right:auto}.ce-element--type-image.align-left,.ce-element--type-video.align-left{clear:none;float:left}.ce-element--type-image.align-right,.ce-element--type-video.align-right{clear:none;float:right}.ce-measure{display:block!important}@font-face{font-family:icon;src:url(images/icons.woff);font-weight:400;font-style:normal}.ct-widget,.ct-widget *{box-sizing:border-box}.ct-widget * a,.ct-widget * b,.ct-widget * caption,.ct-widget * div,.ct-widget * form,.ct-widget * i fieldset,.ct-widget * iframe,.ct-widget * label,.ct-widget * legend,.ct-widget * span,.ct-widget * table,.ct-widget * tbody,.ct-widget * td,.ct-widget * tfoot,.ct-widget * th,.ct-widget * thead,.ct-widget * tr,.ct-widget a,.ct-widget b,.ct-widget caption,.ct-widget div,.ct-widget form,.ct-widget i fieldset,.ct-widget iframe,.ct-widget label,.ct-widget legend,.ct-widget span,.ct-widget table,.ct-widget tbody,.ct-widget td,.ct-widget tfoot,.ct-widget th,.ct-widget thead,.ct-widget tr{border:0;font-size:100%;font:inherit;margin:0;padding:0;vertical-align:baseline}.ct-widget * ol,.ct-widget * ul,.ct-widget ol,.ct-widget ul{list-style:none}.ct-widget * table,.ct-widget table{border-collapse:collapse;border-spacing:0}.ct-widget{opacity:0;font-family:arial,sans-serif;font-size:14px;line-height:18px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;z-index:9999}.ct-widget,.ct-widget--active{-webkit-transition-property:opacity;transition-property:opacity;-webkit-transition-duration:.25s;transition-duration:.25s;-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}.ct-widget--active{opacity:1}.ct-widget .ct-attribute{border-bottom:1px solid #eee;height:48px;vertical-align:top}.ct-widget .ct-attribute:after{clear:both;content:"";display:table}.ct-widget .ct-attribute__name{background:#f6f6f6;border:none;color:#646464;float:left;height:47px;outline:none;padding:0 16px;font-family:arial,sans-serif;font-size:14px;line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:25%}.ct-widget .ct-attribute__name--invalid{color:#e74c3c}.ct-widget .ct-attribute__value{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;border:none;color:#646464;float:right;height:47px;outline:none;padding:0 16px;font-family:arial,sans-serif;font-size:14px;line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:75%}.ct-widget .ct-crop-marks{height:320px;left:73px;position:absolute;top:0;width:427px}.ct-widget .ct-crop-marks__clipper{height:100%;overflow:hidden;position:relative;width:100%}.ct-widget .ct-crop-marks__ruler--top-left{position:absolute}.ct-widget .ct-crop-marks__ruler--top-left:after{border:1px solid hsla(0,0%,100%,.5);border-bottom:none;border-right:none;box-shadow:-1px -1px 1px rgba(0,0,0,.25),inset 1px 1px 1px rgba(0,0,0,.25);content:'';height:999px;left:0;position:absolute;top:0;width:999px}.ct-widget .ct-crop-marks__ruler--bottom-right{position:absolute}.ct-widget .ct-crop-marks__ruler--bottom-right:after{border:1px solid hsla(0,0%,100%,.5);border-top:none;border-left:none;bottom:0;box-shadow:1px 1px 1px rgba(0,0,0,.25),inset -1px -1px 1px rgba(0,0,0,.25);content:'';height:999px;position:absolute;right:0;width:999px}.ct-widget .ct-crop-marks__handle{background:#2980b9;border:1px solid #409ad5;border-radius:7px;cursor:pointer;height:15px;margin-left:-7px;margin-top:-7px;position:absolute;width:15px}.ct-widget .ct-crop-marks__handle--bottom-right{margin-left:-8px;margin-top:-8px}.ct-widget .ct-crop-marks__handle:hover{background:#2e8ece}@-webkit-keyframes a{0%{transform:translate(-50%,-50%) rotate(0deg);-webkit-transform:transform}to{transform:translate(-50%,-50%) rotate(359deg);-webkit-transform:transform}}@keyframes a{0%{transform:translate(-50%,-50%) rotate(0deg);-webkit-transform:transform;transform:transform}to{transform:translate(-50%,-50%) rotate(359deg);-webkit-transform:transform;transform:transform}}.ct-widget.ct-dialog{background:#fff;box-shadow:0 8px 8px rgba(0,0,0,.35);border-radius:2px;height:480px;left:50%;margin-left:-350px;margin-top:-240px;position:fixed;top:50%;width:700px;z-index:10099}.ct-widget.ct-dialog--busy .ct-dialog__busy{display:block}.ct-widget.ct-dialog--busy .ct-dialog__body{opacity:.1}.ct-widget .ct-dialog__header{color:#a4a4a4;border-bottom:1px solid #eee;height:48px;padding:0 16px;position:relative}.ct-widget .ct-dialog__caption{font-family:arial,sans-serif;font-size:18px}.ct-widget .ct-dialog__caption,.ct-widget .ct-dialog__close{line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-dialog__close{border-left:1px solid #eee;cursor:pointer;height:48px;position:absolute;right:0;text-align:center;top:0;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;width:48px}.ct-widget .ct-dialog__close:before{content:'\ea0f'}.ct-widget .ct-dialog__close:hover:before{color:#646464}.ct-widget .ct-dialog__body{margin:auto;width:572px}.ct-widget .ct-dialog__view{height:320px;margin-top:32px}.ct-widget .ct-dialog__controls{margin-top:16px}.ct-widget .ct-dialog__controls:after{clear:both;content:"";display:table}.ct-widget .ct-dialog__busy{display:none;position:absolute}.ct-widget .ct-dialog__busy:before{-webkit-animation:a 5s linear;animation:a 5s linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;color:#a4a4a4;content:"\e994";left:50%;position:fixed;top:50%;font-family:icon;font-size:80px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-control-group{font-size:0}.ct-widget .ct-control-group--center{text-align:center}.ct-widget .ct-control-group--left{float:left}.ct-widget .ct-control-group--right{float:right}.ct-widget .ct-control{margin-left:16px;position:relative}.ct-widget .ct-control:first-child{margin-left:0}.ct-widget .ct-control--icon{color:#a4a4a4;cursor:pointer;display:inline-block;height:32px;line-height:32px;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;width:32px}.ct-widget .ct-control--icon,.ct-widget .ct-control--icon:after{border-radius:2px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-control--icon:after{background:#000;color:#fff;content:attr(data-ct-tooltip);display:block;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;left:-26.5px;opacity:0;padding:0 8px;position:absolute;bottom:37px;font-family:arial,sans-serif;font-size:12px;line-height:20px;visibility:hidden;width:85px;word-break:break-word}.ct-widget .ct-control--icon:hover:after{opacity:.8;visibility:visible;-webkit-transition-property:opacity;transition-property:opacity;-webkit-transition-duration:0s;transition-duration:0s;-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in;-webkit-transition-delay:2s;transition-delay:2s}.ct-widget .ct-control--icon:before{content:''}.ct-widget .ct-control--icon:hover{background:#eee;color:#646464}.ct-widget .ct-control--active,.ct-widget .ct-control--on{background:#a4a4a4;color:#fff}.ct-widget .ct-control--active:hover,.ct-widget .ct-control--on:hover{background:#646464;color:#fff}.ct-widget .ct-control--rotate-ccw:before{content:'\e965'}.ct-widget .ct-control--rotate-cw:before{content:'\e966'}.ct-widget .ct-control--crop:before{content:'\ea57'}.ct-widget .ct-control--remove:before{content:'\e9ac'}.ct-widget .ct-control--styles:before{content:'\e90b'}.ct-widget .ct-control--attributes:before{content:'\e994'}.ct-widget .ct-control--code:before{content:'\ea80'}.ct-widget .ct-control--icon.ct-control--muted{cursor:default}.ct-widget .ct-control--icon.ct-control--muted:before{opacity:.5}.ct-widget .ct-control--icon.ct-control--muted:hover{color:#a4a4a4;background:transparent}.ct-widget .ct-control--text{background:#2980b9;border-radius:2px;color:#fff;cursor:pointer;display:inline-block;font-weight:700;height:32px;overflow:hidden;padding:0 8px;text-align:center;text-overflow:ellipsis;font-family:arial,sans-serif;font-size:14px;line-height:32px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top;width:100px}.ct-widget .ct-control--text:hover{background:#2e8ece}.ct-widget .ct-control--apply,.ct-widget .ct-control--insert,.ct-widget .ct-control--ok{background:#27ae60}.ct-widget .ct-control--apply:hover,.ct-widget .ct-control--insert:hover,.ct-widget .ct-control--ok:hover{background:#2cc36b}.ct-widget .ct-control--cancel,.ct-widget .ct-control--clear{background:#e74c3c}.ct-widget .ct-control--cancel:hover,.ct-widget .ct-control--clear:hover{background:#ea6153}.ct-widget .ct-control--text.ct-control--muted{background:#ccc;cursor:default}.ct-widget .ct-control--text.ct-control--muted:hover{background:#ccc}.ct-widget .ct-control--upload{overflow:hidden}.ct-widget.ct-image-dialog--empty .ct-control--cancel,.ct-widget.ct-image-dialog--empty .ct-control--clear,.ct-widget.ct-image-dialog--empty .ct-control--crop,.ct-widget.ct-image-dialog--empty .ct-control--insert,.ct-widget.ct-image-dialog--empty .ct-control--rotate-ccw,.ct-widget.ct-image-dialog--empty .ct-control--rotate-cw,.ct-widget.ct-image-dialog--empty .ct-progress-bar,.ct-widget.ct-image-dialog--populated .ct-control--cancel,.ct-widget.ct-image-dialog--populated .ct-control--upload,.ct-widget.ct-image-dialog--populated .ct-progress-bar,.ct-widget.ct-image-dialog--uploading .ct-control--clear,.ct-widget.ct-image-dialog--uploading .ct-control--crop,.ct-widget.ct-image-dialog--uploading .ct-control--insert,.ct-widget.ct-image-dialog--uploading .ct-control--rotate-ccw,.ct-widget.ct-image-dialog--uploading .ct-control--rotate-cw,.ct-widget.ct-image-dialog--uploading .ct-control--upload{display:none}.ct-widget .ct-image-dialog__view{background:#eee;position:relative}.ct-widget .ct-image-dialog__view:empty{font-family:icon;font-size:80px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:320px;text-align:center}.ct-widget .ct-image-dialog__view:empty:before{color:#fff;content:'\e90d'}.ct-widget .ct-image-dialog__image{background-color:transparent;background-position:50%;background-repeat:no-repeat;background-size:contain;height:100%;width:100%}.ct-widget .ct-image-dialog__file-upload{cursor:pointer;font-size:400px;left:0;opacity:0;position:absolute;top:0}.ct-widget.ct-properties-dialog--attributes .ct-properties-dialog__attributes,.ct-widget.ct-properties-dialog--styles .ct-properties-dialog__styles{display:block}.ct-widget.ct-properties-dialog--styles .ct-properties-dialog__styles:empty:before{color:#a4a4a4;content:attr(data-ct-empty);display:block;font-style:italic;margin-top:20px;text-align:center}.ct-widget.ct-properties-dialog--code .ct-properties-dialog__code{display:block}.ct-widget .ct-properties-dialog__view{border:1px solid #ddd;overflow:auto}.ct-widget .ct-properties-dialog__attributes,.ct-widget .ct-properties-dialog__code,.ct-widget .ct-properties-dialog__styles{display:none}.ct-widget .ct-properties-dialog__inner-html{border:none;display:block;font-family:courier,Bitstream Vera Sans Mono,Consolas,Courier,monospace;height:318px;padding:16px;outline:none;resize:none;width:100%}.ct-widget .ct-properties-dialog__inner-html--invalid{color:#e74c3c}.ct-widget .ct-table-dialog__view{border:1px solid #ddd;overflow:auto}.ct-widget .ct-video-dialog__preview:empty{background:#eee;font-family:icon;font-size:80px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:320px;text-align:center}.ct-widget .ct-video-dialog__preview:empty:before{color:#fff;content:'\ea98'}.ct-widget .ct-video-dialog__input{border:none;border-bottom:1px solid #eee;height:32px;line-height:32px;outline:none;padding:0 4px;font-family:arial,sans-serif;font-size:14px;line-height:18px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top;width:456px}.ct-widget .ct-video-dialog__input:focus{border-bottom:1px solid #e1e1e1}.ct-widget.ct-anchored-dialog{border-bottom:2px solid #27ae60;box-shadow:0 3px 3px rgba(0,0,0,.35);font-size:0;height:34px;left:0;margin-left:-160px;margin-top:-48px;position:absolute;top:0;width:320px;z-index:10099}.ct-widget.ct-anchored-dialog:after{border:16px solid hsla(0,0%,100%,0);border-top-color:#27ae60;content:'';left:144px;position:absolute;top:34px}.ct-widget .ct-anchored-dialog__input{border:none;color:#646464;outline:none;font-family:arial,sans-serif;font-size:14px;padding:0 8px 0 16px;vertical-align:top;width:256px}.ct-widget .ct-anchored-dialog__button,.ct-widget .ct-anchored-dialog__input{height:32px;line-height:32px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-anchored-dialog__button{background:#27ae60;cursor:pointer;display:inline-block;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;width:32px}.ct-widget .ct-anchored-dialog__button:before{color:#fff;content:'\ea10'}.ct-widget .ct-anchored-dialog__button:hover{background:#2cc36b}.ct-widget .ct-anchored-dialog__target-button{background:#fff;cursor:pointer;display:inline-block;height:32px;line-height:32px;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:32px}.ct-widget .ct-anchored-dialog__target-button:before{color:#a4a4a4;content:'\ea7d'}.ct-widget .ct-anchored-dialog__target-button:hover:before{color:#b1b1b1}.ct-widget .ct-anchored-dialog__target-button--active:before{color:#27ae60}.ct-widget .ct-anchored-dialog__target-button--active:hover:before{color:#2cc36b}@-webkit-keyframes b{0%{opacity:0;font-size:32px;-webkit-transform:font-size}25%{font-size:320px;opacity:1;-webkit-transform:all}50%{font-size:320px;opacity:1;-webkit-transform:all}75%{font-size:320px;opacity:1;-webkit-transform:all}to{opacity:0;-webkit-transform:all}}@keyframes b{0%{opacity:0;font-size:32px;-webkit-transform:font-size;transform:font-size}25%{font-size:320px;opacity:1;-webkit-transform:all;transform:all}50%{font-size:320px;opacity:1;-webkit-transform:all;transform:all}75%{font-size:320px;opacity:1;-webkit-transform:all;transform:all}to{opacity:0;-webkit-transform:all;transform:all}}@-webkit-keyframes c{0%{opacity:1;-webkit-transform:opacity}99%{opacity:1;-webkit-transform:opacity}to{opacity:0;-webkit-transform:opacity}}@keyframes c{0%{opacity:1;-webkit-transform:opacity;transform:opacity}99%{opacity:1;-webkit-transform:opacity;transform:opacity}to{opacity:0;-webkit-transform:opacity;transform:opacity}}.ct-widget.ct-flash{color:hsla(0,0%,100%,.9);height:0;left:0;position:fixed;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;top:0;width:0;z-index:10999}.ct-widget.ct-flash:before{left:50%;opacity:0;position:fixed;text-shadow:0 0 20px rgba(0,0,0,.5);top:50%;transform:translate(-50%,-50%)}.ct-widget.ct-flash--active{-webkit-animation:c 2s ease-in;animation:c 2s ease-in;-webkit-animation-iteration-count:1;animation-iteration-count:1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ct-widget.ct-flash--active:before{-webkit-animation:b 2s ease-in;animation:b 2s ease-in;-webkit-animation-iteration-count:1;animation-iteration-count:1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;font-size:320px;opacity:1}.ct-widget.ct-flash--ok:before{content:'\ea10'}.ct-widget.ct-flash--no:before{content:'\ea0f'}.ct-widget .ct-grip{cursor:move;font-size:0;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ct-widget .ct-grip__bump{background:rgba(70,70,70,.15);border-radius:12px;display:inline-block;height:12px;margin-left:12px;width:12px}.ct-widget .ct-grip__bump:first-child{margin-left:0}@-webkit-keyframes d{0%{transform:rotate(0deg);-webkit-transform:transform}to{transform:rotate(359deg);-webkit-transform:transform}}@keyframes d{0%{transform:rotate(0deg);-webkit-transform:transform;transform:transform}to{transform:rotate(359deg);-webkit-transform:transform;transform:transform}}.ct-widget.ct-ignition{left:16px;position:fixed;top:16px}.ct-widget.ct-ignition .ct-ignition__button{display:none}.ct-widget.ct-ignition--editing .ct-ignition__button--cancel,.ct-widget.ct-ignition--editing .ct-ignition__button--confirm,.ct-widget.ct-ignition--ready .ct-ignition__button--edit{display:block}.ct-widget.ct-ignition--busy .ct-ignition__button{display:none}.ct-widget.ct-ignition--busy .ct-ignition__button--busy{display:block}.ct-widget .ct-ignition__button{border-radius:24px;content:'';cursor:pointer;display:block;height:48px;line-height:48px;opacity:.9;position:absolute;text-align:center;font-family:icon;font-size:24px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:48px}.ct-widget .ct-ignition__button:before{color:#fff}.ct-widget .ct-ignition__button--busy{-webkit-animation:d 5s linear;animation:d 5s linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;background:#646464;cursor:default}.ct-widget .ct-ignition__button--busy:before{content:'\e994'}.ct-widget .ct-ignition__button--busy:hover{background:#646464}.ct-widget .ct-ignition__button--confirm{background:#27ae60}.ct-widget .ct-ignition__button--confirm:before{content:'\ea10'}.ct-widget .ct-ignition__button--confirm:hover{background:#2cc36b}.ct-widget .ct-ignition__button--cancel{background:#e74c3c;left:64px}.ct-widget .ct-ignition__button--cancel:before{content:'\ea0f'}.ct-widget .ct-ignition__button--cancel:hover{background:#ea6153}.ct-widget .ct-ignition__button--edit{background:#2980b9}.ct-widget .ct-ignition__button--edit:before{content:'\e905';-webkit-transition-property:-webkit-transform;transition-property:transform;-webkit-transition-duration:.1s;transition-duration:.1s;-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}.ct-widget .ct-ignition__button--edit:hover{background:#2e8ece}.ct-widget .ct-ignition__button--edit:hover:before{display:inline-block;-webkit-transform:rotate(-15deg);transform:rotate(-15deg)}.ct-widget.ct-inspector{background:hsla(0,0%,91%,.2);border-top:1px solid hsla(0,0%,100%,.1);bottom:0;height:32px;left:0;overflow:hidden;padding:3px 16px 0;position:fixed;width:100%}.ct-widget .ct-inspector__tags{width:calc(100% - 128px)}.ct-widget .ct-inspector__tags:after{clear:both;content:"";display:table}.ct-widget .ct-inspector__tags:before{color:#464646;content:'\ea80';display:block;float:left;height:24px;line-height:24px;margin-right:16px;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:24px}.ct-widget .ct-inspector__counter{border-left:1px solid rgba(0,0,0,.1);height:24px;line-height:24px;margin-right:16px;position:absolute;right:0;text-align:right;top:3px;width:128px}.ct-widget .ct-tag{background-color:#2980b9;border-radius:2px 0 0 2px;color:#fff;cursor:pointer;float:left;font-weight:700;height:24px;line-height:24px;margin-left:24px;padding:0 8px;position:relative;text-shadow:0 1px 0 rgba(0,0,0,.35)}.ct-widget .ct-tag:after{border-style:solid;border-bottom:12px solid rgba(255,0,0,0);border-left:12px solid #2980b9;border-right:none;border-top:12px solid rgba(255,0,0,0);content:'';display:block;height:24px;bottom:0;right:-24px;position:absolute;width:24px;-moz-transform:scale(.9999)}.ct-widget .ct-tag:first-child{margin-left:0}.ct-widget .ct-tag:hover{background-color:#4aa3df}.ct-widget .ct-tag:hover:after{border-left-color:#4aa3df}.ct-widget .ct-tag:nth-child(1){background-color:#8e44ad}.ct-widget .ct-tag:nth-child(1):after{border-left-color:#8e44ad}.ct-widget .ct-tag:nth-child(1):hover{background-color:#9b50ba}.ct-widget .ct-tag:nth-child(1):hover:after{border-left-color:#9b50ba}.ct-widget .ct-tag:nth-child(2){background-color:#2980b9}.ct-widget .ct-tag:nth-child(2):after{border-left-color:#2980b9}.ct-widget .ct-tag:nth-child(2):hover{background-color:#2e8ece}.ct-widget .ct-tag:nth-child(2):hover:after{border-left-color:#2e8ece}.ct-widget .ct-tag:nth-child(3){background-color:#27ae60}.ct-widget .ct-tag:nth-child(3):after{border-left-color:#27ae60}.ct-widget .ct-tag:nth-child(3):hover{background-color:#2cc36b}.ct-widget .ct-tag:nth-child(3):hover:after{border-left-color:#2cc36b}.ct-widget .ct-tag:nth-child(4){background-color:#d35400}.ct-widget .ct-tag:nth-child(4):after{border-left-color:#d35400}.ct-widget .ct-tag:nth-child(4):hover{background-color:#ed5e00}.ct-widget .ct-tag:nth-child(4):hover:after{border-left-color:#ed5e00}.ct-widget .ct-tag:nth-child(5){background-color:#f39c12}.ct-widget .ct-tag:nth-child(5):after{border-left-color:#f39c12}.ct-widget .ct-tag:nth-child(5):hover{background-color:#f4a62a}.ct-widget .ct-tag:nth-child(5):hover:after{border-left-color:#f4a62a}.ct-widget .ct-tag:nth-child(6){background-color:#16a085}.ct-widget .ct-tag:nth-child(6):after{border-left-color:#16a085}.ct-widget .ct-tag:nth-child(6):hover{background-color:#19b698}.ct-widget .ct-tag:nth-child(6):hover:after{border-left-color:#19b698}.ct-widget.ct-modal{background:rgba(0,0,0,.7);height:0;left:0;position:fixed;top:0;width:0;z-index:10009}.ct-widget.ct-modal--transparent{background:transparent}.ct-widget--active.ct-modal{height:100%;width:100%}.ct-widget .ct-progress-bar{border:1px solid #eee;height:32px;line-height:32px;padding:1px;width:456px}.ct-widget .ct-progress-bar__progress{background:#2980b9;height:28px}.ct-widget .ct-section{border-bottom:1px solid #eee;color:#bdbdbd;cursor:pointer;font-style:italic;height:48px;padding:0 16px;font-family:arial,sans-serif;font-size:16px;line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-section:after{clear:both;content:"";display:table}.ct-widget .ct-section:hover{background:#f6f6f6}.ct-widget .ct-section--applied{color:#646464;font-style:normal}.ct-widget .ct-section--applied .ct-section__switch{background-color:#27ae60;border:1px solid #1e8449}.ct-widget .ct-section--applied .ct-section__switch:before{left:25px;-webkit-transition-property:left;transition-property:left;-webkit-transition-duration:.1s;transition-duration:.1s;-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in}.ct-widget .ct-section--contains-input .ct-section__label{width:75%}.ct-widget .ct-section__label{float:left;overflow:hidden;text-overflow:ellipsis;width:472px;white-space:nowrap}.ct-widget .ct-section__switch{background-color:#ccc;border:1px solid #b3b3b3;border-radius:12px;box-shadow:inset 0 0 2px rgba(0,0,0,.1);float:right;height:24px;margin-top:12px;position:relative;width:48px}.ct-widget .ct-section__switch:before{background:#fff;border-radius:10px;content:'';height:20px;left:1px;position:absolute;top:1px;-webkit-transition-property:left;transition-property:left;-webkit-transition-duration:.1s;transition-duration:.1s;-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in;width:20px}.ct-widget .ct-section__input{background:#fff;border:none;color:#646464;float:right;height:47px;outline:none;padding:0 16px;text-align:right;font-family:arial,sans-serif;font-size:14px;line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:25%}.ct-widget .ct-section__input--invalid{color:#e74c3c}.ct-widget.ct-toolbox{background:hsla(0,0%,91%,.9);border:1px solid hsla(0,0%,100%,.5);box-shadow:0 3px 3px rgba(0,0,0,.35);left:128px;padding:8px;position:fixed;top:128px;width:138px}.ct-widget.ct-toolbox--dragging{opacity:.5}.ct-widget .ct-toolbox__grip{padding:8px 0}.ct-widget .ct-tool-group{padding:4px 0}.ct-widget .ct-tool-group:after{clear:both;content:"";display:table}.ct-widget .ct-tool-group:first-child{padding-top:0}.ct-widget .ct-tool{color:#464646;cursor:pointer;float:left;height:32px;margin:4px;margin-right:4px;position:relative;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;width:32px}.ct-widget .ct-tool,.ct-widget .ct-tool:after{border-radius:2px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-tool:after{background:#000;color:#fff;content:attr(data-ct-tooltip);display:block;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;left:-26.5px;opacity:0;padding:0 8px;position:absolute;bottom:37px;font-family:arial,sans-serif;font-size:12px;line-height:20px;visibility:hidden;width:85px;word-break:break-word}.ct-widget .ct-tool:hover:after{opacity:.8;visibility:visible;-webkit-transition-property:opacity;transition-property:opacity;-webkit-transition-duration:0s;transition-duration:0s;-webkit-transition-timing-function:ease-in;transition-timing-function:ease-in;-webkit-transition-delay:2s;transition-delay:2s}.ct-widget .ct-tool:before{line-height:32px}.ct-widget .ct-tool:nth-child(3n){margin-right:0}.ct-widget .ct-tool:hover{background:hsla(0,0%,100%,.5)}.ct-widget .ct-tool--disabled{color:rgba(70,70,70,.33)}.ct-widget .ct-tool--disabled:hover{background:transparent}.ct-widget .ct-tool--down{box-shadow:inset 0 1px 3px rgba(0,0,0,.25);line-height:34px}.ct-widget .ct-tool--down,.ct-widget .ct-tool--down:hover{background:rgba(0,0,0,.025)}.ct-widget .ct-tool--applied{background:rgba(0,0,0,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.25)}.ct-widget .ct-tool--applied:hover{background:rgba(0,0,0,.15)}.ct-widget .ct-tool--bold:before{content:"\ea62"}.ct-widget .ct-tool--heading:before{content:"H";font-weight:700}.ct-widget .ct-tool--subheading:before{content:"H"}.ct-widget .ct-tool--paragraph:before{content:"P"}.ct-widget .ct-tool--preformatted:before{content:"\ea80"}.ct-widget .ct-tool--italic:before{content:"\ea64"}.ct-widget .ct-tool--link:before{content:"\e9cb"}.ct-widget .ct-tool--align-left:before{content:"\ea77"}.ct-widget .ct-tool--align-center:before{content:"\ea78"}.ct-widget .ct-tool--align-right:before{content:"\ea79"}.ct-widget .ct-tool--unordered-list:before{content:"\e9ba"}.ct-widget .ct-tool--ordered-list:before{content:"\e9b9"}.ct-widget .ct-tool--table:before{content:"\ea71"}.ct-widget .ct-tool--indent:before{content:"\ea7b"}.ct-widget .ct-tool--unindent:before{content:"\ea7c"}.ct-widget .ct-tool--line-break:before{content:"\ea6e"}.ct-widget .ct-tool--image:before{content:"\e90d"}.ct-widget .ct-tool--video:before{content:"\ea98"}.ct-widget .ct-tool--undo:before{content:"\e965"}.ct-widget .ct-tool--redo:before{content:"\e966"}.ct-widget .ct-tool--remove:before{content:"\e9ac"}@-webkit-keyframes e{0%{outline-color:hsla(0,0%,100%,0);-webkit-transform:background-color}25%{outline-color:#f39c12;-webkit-transform:background-color}50%{outline-color:#f39c12;-webkit-transform:background-color}to{outline-color:hsla(0,0%,100%,0);-webkit-transform:background-color}}@keyframes e{0%{outline-color:hsla(0,0%,100%,0);-webkit-transform:background-color;transform:background-color}25%{outline-color:#f39c12;-webkit-transform:background-color;transform:background-color}50%{outline-color:#f39c12;-webkit-transform:background-color;transform:background-color}to{outline-color:hsla(0,0%,100%,0);-webkit-transform:background-color;transform:background-color}}.ct-app,.ct-app *,.ct-app :after,.ct-app :before{box-sizing:border-box}.ct--highlight{outline:4px solid #f39c12;-webkit-animation:e .5s ease-in;animation:e .5s ease-in;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ct--no-scroll{overflow:hidden}.ct--puesdo-select{background:rgba(0,0,0,.1)} \ No newline at end of file +/*! ContentTools v1.6.5 by Anthony Blackshaw (https://github.com/anthonyjb) */.ce--dragging,.ce--resizing{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce--dragging{cursor:move!important}.ce--resizing{cursor:nwse-resize!important}.ce-element--type-image,.ce-element--type-video{background-repeat:no-repeat;position:relative;cursor:pointer;z-index:1}.ce-element--type-image:after,.ce-element--type-image:before,.ce-element--type-video:after,.ce-element--type-video:before{background:rgba(0,0,0,.5);border-radius:2px;color:#fff;display:none;font-family:arial,sans-serif;font-size:10px;line-height:10px;padding:4px 4px 3px;position:absolute}.ce-element--type-image:before,.ce-element--type-video:before{content:attr(data-ce-size);right:10px;top:10px}.ce-element--type-image.ce-element--over:before,.ce-element--type-image.ce-element--resizing:before,.ce-element--type-video.ce-element--over:before,.ce-element--type-video.ce-element--resizing:before{display:block}.ce-element--type-image{background-position:0 0;background-size:cover}.ce-element--type-image:after{background:transparent;content:"";display:block;left:0;position:relative;top:0;height:100%;width:100%}.ce-element--type-video{background:#333 url(images/video.svg) 50%/auto 48px no-repeat}.ce-element--type-video:after{bottom:10px;content:attr(data-ce-title);display:block;left:10px}.ce-element--empty:after{content:"...";display:inline-block;font-style:italic;opacity:.5}.ce-element--empty[data-ce-placeholder]:after{content:attr(data-ce-placeholder)}.ce-element--dragging{background-color:rgba(51,51,51,.1)!important;opacity:.5;z-index:-1}.ce-element--dragging.ce-element--type-image,.ce-element--dragging.ce-element--type-video{background-color:#333!important;opacity:1;outline-color:rgba(51,51,51,.1)!important}.ce-element--drop{position:relative!important}.ce-element--drop:before{background:#f39c12 url(images/drop-vert-above.svg) 50%/auto 32px repeat;bottom:0;content:""!important;left:0;opacity:.8;position:absolute;right:0;top:0;z-index:9}.ce-element--drop-below:before{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.ce-element--drop-left:before{background-image:url(images/drop-horz.svg);-webkit-transform:rotate(0deg);transform:rotate(0deg)}.ce-element--drop-right:before{background-image:url(images/drop-horz.svg);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.ce-element--drop.ce-element--type-table-row{background:#f39c12 url(images/drop-vert-above.svg) 50%/auto 32px repeat}.ce-element--drop.ce-element--type-table-row:before{display:none}.ce-element--drop.ce-element--type-table-row.ce-element--drop-below{background:#f39c12 url(images/drop-vert-below.svg) 50%/auto 32px repeat}.ce-element--focused,.ce-element--over{background-color:rgba(243,156,18,.1);outline:none}.ce-element--focused.ce-element--type-image,.ce-element--focused.ce-element--type-image-fixture,.ce-element--focused.ce-element--type-video,.ce-element--over.ce-element--type-image,.ce-element--over.ce-element--type-image-fixture,.ce-element--over.ce-element--type-video{background-color:#333;outline:4px solid rgba(243,156,18,.35)}.ce-element--resize-top-left{cursor:nw-resize}.ce-element--resize-top-right{cursor:ne-resize}.ce-element--resize-bottom-right{cursor:se-resize}.ce-element--resize-bottom-left{cursor:sw-resize}.ce-drag-helper{background:#fff;border-radius:2px;box-shadow:0 3px 3px rgba(0,0,0,.25);color:#4e4e4e;font:arial,sans-serif;font-size:12px;height:120px;left:0;line-height:135%;margin:5px 0 0 5px;overflow:hidden;padding:15px;position:absolute;top:0;width:120px;word-wrap:break-word;z-index:9}.ce-drag-helper:before{background:#2980b9;color:#fff;content:attr(data-ce-type);display:block;font-family:arial,sans-serif;font-size:10px;line-height:10px;padding:4px 4px 3px;position:absolute;right:0;top:0}.ce-drag-helper--type-list-item-text:after,.ce-drag-helper--type-list:after,.ce-drag-helper--type-pre-text:after,.ce-drag-helper--type-table-row:after,.ce-drag-helper--type-table:after,.ce-drag-helper--type-text:after{background-image:linear-gradient(hsla(0,0%,100%,0),#fff 66%);bottom:0;content:"";display:block;height:40px;left:0;position:absolute;width:100%}.ce-drag-helper--type-image{background-repeat:no-repeat;background-size:cover}.ce-element--type-image,.ce-element--type-video{display:block;margin-left:auto;margin-right:auto}.ce-element--type-image.align-left,.ce-element--type-video.align-left{clear:none;float:left}.ce-element--type-image.align-right,.ce-element--type-video.align-right{clear:none;float:right}.ce-measure{display:block!important}@font-face{font-family:icon;src:url(images/icons.woff);font-weight:400;font-style:normal}.ct-widget,.ct-widget *{box-sizing:border-box}.ct-widget * a,.ct-widget * b,.ct-widget * caption,.ct-widget * div,.ct-widget * form,.ct-widget * i fieldset,.ct-widget * iframe,.ct-widget * label,.ct-widget * legend,.ct-widget * span,.ct-widget * table,.ct-widget * tbody,.ct-widget * td,.ct-widget * tfoot,.ct-widget * th,.ct-widget * thead,.ct-widget * tr,.ct-widget a,.ct-widget b,.ct-widget caption,.ct-widget div,.ct-widget form,.ct-widget i fieldset,.ct-widget iframe,.ct-widget label,.ct-widget legend,.ct-widget span,.ct-widget table,.ct-widget tbody,.ct-widget td,.ct-widget tfoot,.ct-widget th,.ct-widget thead,.ct-widget tr{border:0;font-size:100%;font:inherit;margin:0;padding:0;vertical-align:baseline}.ct-widget * ol,.ct-widget * ul,.ct-widget ol,.ct-widget ul{list-style:none}.ct-widget * table,.ct-widget table{border-collapse:collapse;border-spacing:0}.ct-widget{opacity:0;font-family:arial,sans-serif;font-size:14px;line-height:18px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;z-index:9999}.ct-widget,.ct-widget--active{transition-property:opacity;transition-duration:.25s;transition-timing-function:ease-in}.ct-widget--active{opacity:1}.ct-widget .ct-attribute{border-bottom:1px solid #eee;height:48px;vertical-align:top}.ct-widget .ct-attribute:after{clear:both;content:"";display:table}.ct-widget .ct-attribute__name{background:#f6f6f6;border:none;color:#646464;float:left;height:47px;outline:none;padding:0 16px;font-family:arial,sans-serif;font-size:14px;line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:25%}.ct-widget .ct-attribute__name--invalid{color:#e74c3c}.ct-widget .ct-attribute__value{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;border:none;color:#646464;float:right;height:47px;outline:none;padding:0 16px;font-family:arial,sans-serif;font-size:14px;line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:75%}.ct-widget .ct-crop-marks{height:320px;left:73px;position:absolute;top:0;width:427px}.ct-widget .ct-crop-marks__clipper{height:100%;overflow:hidden;position:relative;width:100%}.ct-widget .ct-crop-marks__ruler--top-left{position:absolute}.ct-widget .ct-crop-marks__ruler--top-left:after{border:1px solid hsla(0,0%,100%,.5);border-bottom:none;border-right:none;box-shadow:-1px -1px 1px rgba(0,0,0,.25),inset 1px 1px 1px rgba(0,0,0,.25);content:"";height:999px;left:0;position:absolute;top:0;width:999px}.ct-widget .ct-crop-marks__ruler--bottom-right{position:absolute}.ct-widget .ct-crop-marks__ruler--bottom-right:after{border:1px solid hsla(0,0%,100%,.5);border-top:none;border-left:none;bottom:0;box-shadow:1px 1px 1px rgba(0,0,0,.25),inset -1px -1px 1px rgba(0,0,0,.25);content:"";height:999px;position:absolute;right:0;width:999px}.ct-widget .ct-crop-marks__handle{background:#2980b9;border:1px solid #409ad5;border-radius:7px;cursor:pointer;height:15px;margin-left:-7px;margin-top:-7px;position:absolute;width:15px}.ct-widget .ct-crop-marks__handle--bottom-right{margin-left:-8px;margin-top:-8px}.ct-widget .ct-crop-marks__handle:hover{background:#2e8ece}@-webkit-keyframes a{0%{transform:translate(-50%,-50%) rotate(0deg);-webkit-transform:transform}to{transform:translate(-50%,-50%) rotate(359deg);-webkit-transform:transform}}@keyframes a{0%{transform:translate(-50%,-50%) rotate(0deg);-webkit-transform:transform;transform:transform}to{transform:translate(-50%,-50%) rotate(359deg);-webkit-transform:transform;transform:transform}}.ct-widget.ct-dialog{background:#fff;box-shadow:0 8px 8px rgba(0,0,0,.35);border-radius:2px;height:480px;left:50%;margin-left:-350px;margin-top:-240px;position:fixed;top:50%;width:700px;z-index:10099}.ct-widget.ct-dialog--busy .ct-dialog__busy{display:block}.ct-widget.ct-dialog--busy .ct-dialog__body{opacity:.1}.ct-widget .ct-dialog__header{color:#a4a4a4;border-bottom:1px solid #eee;height:48px;padding:0 16px;position:relative}.ct-widget .ct-dialog__caption{font-family:arial,sans-serif;font-size:18px}.ct-widget .ct-dialog__caption,.ct-widget .ct-dialog__close{line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-dialog__close{border-left:1px solid #eee;cursor:pointer;height:48px;position:absolute;right:0;text-align:center;top:0;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;width:48px}.ct-widget .ct-dialog__close:before{content:"\ea0f"}.ct-widget .ct-dialog__close:hover:before{color:#646464}.ct-widget .ct-dialog__body{margin:auto;width:572px}.ct-widget .ct-dialog__view{height:320px;margin-top:32px}.ct-widget .ct-dialog__controls{margin-top:16px}.ct-widget .ct-dialog__controls:after{clear:both;content:"";display:table}.ct-widget .ct-dialog__busy{display:none;position:absolute}.ct-widget .ct-dialog__busy:before{-webkit-animation:a 5s linear;animation:a 5s linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;color:#a4a4a4;content:"\e994";left:50%;position:fixed;top:50%;font-family:icon;font-size:80px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-control-group{font-size:0}.ct-widget .ct-control-group--center{text-align:center}.ct-widget .ct-control-group--left{float:left}.ct-widget .ct-control-group--right{float:right}.ct-widget .ct-control{margin-left:16px;position:relative}.ct-widget .ct-control:first-child{margin-left:0}.ct-widget .ct-control--icon{color:#a4a4a4;cursor:pointer;display:inline-block;height:32px;line-height:32px;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;width:32px}.ct-widget .ct-control--icon,.ct-widget .ct-control--icon:after{border-radius:2px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-control--icon:after{background:#000;color:#fff;content:attr(data-ct-tooltip);display:block;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;left:-26.5px;opacity:0;padding:0 8px;position:absolute;bottom:37px;font-family:arial,sans-serif;font-size:12px;line-height:20px;visibility:hidden;width:85px;word-break:break-word}.ct-widget .ct-control--icon:hover:after{opacity:.8;visibility:visible;transition-property:opacity;transition-duration:0s;transition-timing-function:ease-in;transition-delay:2s}.ct-widget .ct-control--icon:before{content:""}.ct-widget .ct-control--icon:hover{background:#eee;color:#646464}.ct-widget .ct-control--active,.ct-widget .ct-control--on{background:#a4a4a4;color:#fff}.ct-widget .ct-control--active:hover,.ct-widget .ct-control--on:hover{background:#646464;color:#fff}.ct-widget .ct-control--rotate-ccw:before{content:"\e965"}.ct-widget .ct-control--rotate-cw:before{content:"\e966"}.ct-widget .ct-control--crop:before{content:"\ea57"}.ct-widget .ct-control--remove:before{content:"\e9ac"}.ct-widget .ct-control--styles:before{content:"\e90b"}.ct-widget .ct-control--attributes:before{content:"\e994"}.ct-widget .ct-control--code:before{content:"\ea80"}.ct-widget .ct-control--icon.ct-control--muted{cursor:default}.ct-widget .ct-control--icon.ct-control--muted:before{opacity:.5}.ct-widget .ct-control--icon.ct-control--muted:hover{color:#a4a4a4;background:transparent}.ct-widget .ct-control--text{background:#2980b9;border-radius:2px;color:#fff;cursor:pointer;display:inline-block;font-weight:700;height:32px;overflow:hidden;padding:0 8px;text-align:center;text-overflow:ellipsis;font-family:arial,sans-serif;font-size:14px;line-height:32px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top;width:100px}.ct-widget .ct-control--text:hover{background:#2e8ece}.ct-widget .ct-control--apply,.ct-widget .ct-control--insert,.ct-widget .ct-control--ok{background:#27ae60}.ct-widget .ct-control--apply:hover,.ct-widget .ct-control--insert:hover,.ct-widget .ct-control--ok:hover{background:#2cc36b}.ct-widget .ct-control--cancel,.ct-widget .ct-control--clear{background:#e74c3c}.ct-widget .ct-control--cancel:hover,.ct-widget .ct-control--clear:hover{background:#ea6153}.ct-widget .ct-control--text.ct-control--muted{background:#ccc;cursor:default}.ct-widget .ct-control--text.ct-control--muted:hover{background:#ccc}.ct-widget .ct-control--upload{overflow:hidden}.ct-widget.ct-image-dialog--empty .ct-control--cancel,.ct-widget.ct-image-dialog--empty .ct-control--clear,.ct-widget.ct-image-dialog--empty .ct-control--crop,.ct-widget.ct-image-dialog--empty .ct-control--insert,.ct-widget.ct-image-dialog--empty .ct-control--rotate-ccw,.ct-widget.ct-image-dialog--empty .ct-control--rotate-cw,.ct-widget.ct-image-dialog--empty .ct-progress-bar,.ct-widget.ct-image-dialog--populated .ct-control--cancel,.ct-widget.ct-image-dialog--populated .ct-control--upload,.ct-widget.ct-image-dialog--populated .ct-progress-bar,.ct-widget.ct-image-dialog--uploading .ct-control--clear,.ct-widget.ct-image-dialog--uploading .ct-control--crop,.ct-widget.ct-image-dialog--uploading .ct-control--insert,.ct-widget.ct-image-dialog--uploading .ct-control--rotate-ccw,.ct-widget.ct-image-dialog--uploading .ct-control--rotate-cw,.ct-widget.ct-image-dialog--uploading .ct-control--upload{display:none}.ct-widget .ct-image-dialog__view{background:#eee;position:relative}.ct-widget .ct-image-dialog__view:empty{font-family:icon;font-size:80px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:320px;text-align:center}.ct-widget .ct-image-dialog__view:empty:before{color:#fff;content:"\e90d"}.ct-widget .ct-image-dialog__image{background-color:transparent;background-position:50%;background-repeat:no-repeat;background-size:contain;height:100%;width:100%}.ct-widget .ct-image-dialog__file-upload{cursor:pointer;font-size:400px;left:0;opacity:0;position:absolute;top:0}.ct-widget.ct-properties-dialog--attributes .ct-properties-dialog__attributes,.ct-widget.ct-properties-dialog--styles .ct-properties-dialog__styles{display:block}.ct-widget.ct-properties-dialog--styles .ct-properties-dialog__styles:empty:before{color:#a4a4a4;content:attr(data-ct-empty);display:block;font-style:italic;margin-top:20px;text-align:center}.ct-widget.ct-properties-dialog--code .ct-properties-dialog__code{display:block}.ct-widget .ct-properties-dialog__view{border:1px solid #ddd;overflow:auto}.ct-widget .ct-properties-dialog__attributes,.ct-widget .ct-properties-dialog__code,.ct-widget .ct-properties-dialog__styles{display:none}.ct-widget .ct-properties-dialog__inner-html{border:none;display:block;font-family:courier,Bitstream Vera Sans Mono,Consolas,Courier,monospace;height:318px;padding:16px;outline:none;resize:none;width:100%}.ct-widget .ct-properties-dialog__inner-html--invalid{color:#e74c3c}.ct-widget .ct-table-dialog__view{border:1px solid #ddd;overflow:auto}.ct-widget .ct-video-dialog__preview:empty{background:#eee;font-family:icon;font-size:80px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:320px;text-align:center}.ct-widget .ct-video-dialog__preview:empty:before{color:#fff;content:"\ea98"}.ct-widget .ct-video-dialog__input{border:none;border-bottom:1px solid #eee;height:32px;line-height:32px;outline:none;padding:0 4px;font-family:arial,sans-serif;font-size:14px;line-height:18px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top;width:456px}.ct-widget .ct-video-dialog__input:focus{border-bottom:1px solid #e1e1e1}.ct-widget.ct-anchored-dialog{border-bottom:2px solid #27ae60;box-shadow:0 3px 3px rgba(0,0,0,.35);font-size:0;height:34px;left:0;margin-left:-160px;margin-top:-48px;position:absolute;top:0;width:320px;z-index:10099}.ct-widget.ct-anchored-dialog:after{border:16px solid hsla(0,0%,100%,0);border-top-color:#27ae60;content:"";left:144px;position:absolute;top:34px}.ct-widget .ct-anchored-dialog__input{border:none;color:#646464;outline:none;font-family:arial,sans-serif;font-size:14px;padding:0 8px 0 16px;vertical-align:top;width:256px}.ct-widget .ct-anchored-dialog__button,.ct-widget .ct-anchored-dialog__input{height:32px;line-height:32px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-anchored-dialog__button{background:#27ae60;cursor:pointer;display:inline-block;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;width:32px}.ct-widget .ct-anchored-dialog__button:before{color:#fff;content:"\ea10"}.ct-widget .ct-anchored-dialog__button:hover{background:#2cc36b}.ct-widget .ct-anchored-dialog__target-button{background:#fff;cursor:pointer;display:inline-block;height:32px;line-height:32px;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:32px}.ct-widget .ct-anchored-dialog__target-button:before{color:#a4a4a4;content:"\ea7d"}.ct-widget .ct-anchored-dialog__target-button:hover:before{color:#b1b1b1}.ct-widget .ct-anchored-dialog__target-button--active:before{color:#27ae60}.ct-widget .ct-anchored-dialog__target-button--active:hover:before{color:#2cc36b}@-webkit-keyframes b{0%{opacity:0;font-size:32px;-webkit-transform:font-size}25%{font-size:320px;opacity:1;-webkit-transform:all}50%{font-size:320px;opacity:1;-webkit-transform:all}75%{font-size:320px;opacity:1;-webkit-transform:all}to{opacity:0;-webkit-transform:all}}@keyframes b{0%{opacity:0;font-size:32px;-webkit-transform:font-size;transform:font-size}25%{font-size:320px;opacity:1;-webkit-transform:all;transform:all}50%{font-size:320px;opacity:1;-webkit-transform:all;transform:all}75%{font-size:320px;opacity:1;-webkit-transform:all;transform:all}to{opacity:0;-webkit-transform:all;transform:all}}@-webkit-keyframes c{0%{opacity:1;-webkit-transform:opacity}99%{opacity:1;-webkit-transform:opacity}to{opacity:0;-webkit-transform:opacity}}@keyframes c{0%{opacity:1;-webkit-transform:opacity;transform:opacity}99%{opacity:1;-webkit-transform:opacity;transform:opacity}to{opacity:0;-webkit-transform:opacity;transform:opacity}}.ct-widget.ct-flash{color:hsla(0,0%,100%,.9);height:0;left:0;position:fixed;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;top:0;width:0;z-index:10999}.ct-widget.ct-flash:before{left:50%;opacity:0;position:fixed;text-shadow:0 0 20px rgba(0,0,0,.5);top:50%;transform:translate(-50%,-50%)}.ct-widget.ct-flash--active{-webkit-animation:c 2s ease-in;animation:c 2s ease-in;-webkit-animation-iteration-count:1;animation-iteration-count:1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ct-widget.ct-flash--active:before{-webkit-animation:b 2s ease-in;animation:b 2s ease-in;-webkit-animation-iteration-count:1;animation-iteration-count:1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;font-size:320px;opacity:1}.ct-widget.ct-flash--ok:before{content:"\ea10"}.ct-widget.ct-flash--no:before{content:"\ea0f"}.ct-widget .ct-grip{cursor:move;font-size:0;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ct-widget .ct-grip__bump{background:rgba(70,70,70,.15);border-radius:12px;display:inline-block;height:12px;margin-left:12px;width:12px}.ct-widget .ct-grip__bump:first-child{margin-left:0}@-webkit-keyframes d{0%{transform:rotate(0deg);-webkit-transform:transform}to{transform:rotate(359deg);-webkit-transform:transform}}@keyframes d{0%{transform:rotate(0deg);-webkit-transform:transform;transform:transform}to{transform:rotate(359deg);-webkit-transform:transform;transform:transform}}.ct-widget.ct-ignition{left:16px;position:fixed;top:16px}.ct-widget.ct-ignition .ct-ignition__button{display:none}.ct-widget.ct-ignition--editing .ct-ignition__button--cancel,.ct-widget.ct-ignition--editing .ct-ignition__button--confirm,.ct-widget.ct-ignition--ready .ct-ignition__button--edit{display:block}.ct-widget.ct-ignition--busy .ct-ignition__button{display:none}.ct-widget.ct-ignition--busy .ct-ignition__button--busy{display:block}.ct-widget .ct-ignition__button{border-radius:24px;content:"";cursor:pointer;display:block;height:48px;line-height:48px;opacity:.9;position:absolute;text-align:center;font-family:icon;font-size:24px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:48px}.ct-widget .ct-ignition__button:before{color:#fff}.ct-widget .ct-ignition__button--busy{-webkit-animation:d 5s linear;animation:d 5s linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;background:#646464;cursor:default}.ct-widget .ct-ignition__button--busy:before{content:"\e994"}.ct-widget .ct-ignition__button--busy:hover{background:#646464}.ct-widget .ct-ignition__button--confirm{background:#27ae60}.ct-widget .ct-ignition__button--confirm:before{content:"\ea10"}.ct-widget .ct-ignition__button--confirm:hover{background:#2cc36b}.ct-widget .ct-ignition__button--cancel{background:#e74c3c;left:64px}.ct-widget .ct-ignition__button--cancel:before{content:"\ea0f"}.ct-widget .ct-ignition__button--cancel:hover{background:#ea6153}.ct-widget .ct-ignition__button--edit{background:#2980b9}.ct-widget .ct-ignition__button--edit:before{content:"\e905";transition-property:transform;transition-duration:.1s;transition-timing-function:ease-in}.ct-widget .ct-ignition__button--edit:hover{background:#2e8ece}.ct-widget .ct-ignition__button--edit:hover:before{display:inline-block;-webkit-transform:rotate(-15deg);transform:rotate(-15deg)}.ct-widget.ct-inspector{background:hsla(0,0%,91%,.2);border-top:1px solid hsla(0,0%,100%,.1);bottom:0;height:32px;left:0;overflow:hidden;padding:3px 16px 0;position:fixed;width:100%}.ct-widget .ct-inspector__tags{width:calc(100% - 128px)}.ct-widget .ct-inspector__tags:after{clear:both;content:"";display:table}.ct-widget .ct-inspector__tags:before{color:#464646;content:"\ea80";display:block;float:left;height:24px;line-height:24px;margin-right:16px;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:24px}.ct-widget .ct-inspector__counter{border-left:1px solid rgba(0,0,0,.1);height:24px;line-height:24px;margin-right:16px;position:absolute;right:0;text-align:right;top:3px;width:128px}.ct-widget .ct-tag{background-color:#2980b9;border-radius:2px 0 0 2px;color:#fff;cursor:pointer;float:left;font-weight:700;height:24px;line-height:24px;margin-left:24px;padding:0 8px;position:relative;text-shadow:0 1px 0 rgba(0,0,0,.35)}.ct-widget .ct-tag:after{border-style:solid;border-bottom:12px solid rgba(255,0,0,0);border-left:12px solid #2980b9;border-right:none;border-top:12px solid rgba(255,0,0,0);content:"";display:block;height:24px;bottom:0;right:-24px;position:absolute;width:24px;-moz-transform:scale(.9999)}.ct-widget .ct-tag:first-child{margin-left:0}.ct-widget .ct-tag:hover{background-color:#4aa3df}.ct-widget .ct-tag:hover:after{border-left-color:#4aa3df}.ct-widget .ct-tag:first-child{background-color:#8e44ad}.ct-widget .ct-tag:first-child:after{border-left-color:#8e44ad}.ct-widget .ct-tag:first-child:hover{background-color:#9b50ba}.ct-widget .ct-tag:first-child:hover:after{border-left-color:#9b50ba}.ct-widget .ct-tag:nth-child(2){background-color:#2980b9}.ct-widget .ct-tag:nth-child(2):after{border-left-color:#2980b9}.ct-widget .ct-tag:nth-child(2):hover{background-color:#2e8ece}.ct-widget .ct-tag:nth-child(2):hover:after{border-left-color:#2e8ece}.ct-widget .ct-tag:nth-child(3){background-color:#27ae60}.ct-widget .ct-tag:nth-child(3):after{border-left-color:#27ae60}.ct-widget .ct-tag:nth-child(3):hover{background-color:#2cc36b}.ct-widget .ct-tag:nth-child(3):hover:after{border-left-color:#2cc36b}.ct-widget .ct-tag:nth-child(4){background-color:#d35400}.ct-widget .ct-tag:nth-child(4):after{border-left-color:#d35400}.ct-widget .ct-tag:nth-child(4):hover{background-color:#ed5e00}.ct-widget .ct-tag:nth-child(4):hover:after{border-left-color:#ed5e00}.ct-widget .ct-tag:nth-child(5){background-color:#f39c12}.ct-widget .ct-tag:nth-child(5):after{border-left-color:#f39c12}.ct-widget .ct-tag:nth-child(5):hover{background-color:#f4a62a}.ct-widget .ct-tag:nth-child(5):hover:after{border-left-color:#f4a62a}.ct-widget .ct-tag:nth-child(6){background-color:#16a085}.ct-widget .ct-tag:nth-child(6):after{border-left-color:#16a085}.ct-widget .ct-tag:nth-child(6):hover{background-color:#19b698}.ct-widget .ct-tag:nth-child(6):hover:after{border-left-color:#19b698}.ct-widget.ct-modal{background:rgba(0,0,0,.7);height:0;left:0;position:fixed;top:0;width:0;z-index:10009}.ct-widget.ct-modal--transparent{background:transparent}.ct-widget--active.ct-modal{height:100%;width:100%}.ct-widget .ct-progress-bar{border:1px solid #eee;height:32px;line-height:32px;padding:1px;width:456px}.ct-widget .ct-progress-bar__progress{background:#2980b9;height:28px}.ct-widget .ct-section{border-bottom:1px solid #eee;color:#bdbdbd;cursor:pointer;font-style:italic;height:48px;padding:0 16px;font-family:arial,sans-serif;font-size:16px;line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-section:after{clear:both;content:"";display:table}.ct-widget .ct-section:hover{background:#f6f6f6}.ct-widget .ct-section--applied{color:#646464;font-style:normal}.ct-widget .ct-section--applied .ct-section__switch{background-color:#27ae60;border:1px solid #1e8449}.ct-widget .ct-section--applied .ct-section__switch:before{left:25px;transition-property:left;transition-duration:.1s;transition-timing-function:ease-in}.ct-widget .ct-section--contains-input .ct-section__label{width:75%}.ct-widget .ct-section__label{float:left;overflow:hidden;text-overflow:ellipsis;width:472px;white-space:nowrap}.ct-widget .ct-section__switch{background-color:#ccc;border:1px solid #b3b3b3;border-radius:12px;box-shadow:inset 0 0 2px rgba(0,0,0,.1);float:right;height:24px;margin-top:12px;position:relative;width:48px}.ct-widget .ct-section__switch:before{background:#fff;border-radius:10px;content:"";height:20px;left:1px;position:absolute;top:1px;transition-property:left;transition-duration:.1s;transition-timing-function:ease-in;width:20px}.ct-widget .ct-section__input{background:#fff;border:none;color:#646464;float:right;height:47px;outline:none;padding:0 16px;text-align:right;font-family:arial,sans-serif;font-size:14px;line-height:48px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:25%}.ct-widget .ct-section__input--invalid{color:#e74c3c}.ct-widget.ct-toolbox{background:hsla(0,0%,91%,.9);border:1px solid hsla(0,0%,100%,.5);box-shadow:0 3px 3px rgba(0,0,0,.35);left:128px;padding:8px;position:fixed;top:128px;width:138px}.ct-widget.ct-toolbox--dragging{opacity:.5}.ct-widget .ct-toolbox__grip{padding:8px 0}.ct-widget .ct-tool-group{padding:4px 0}.ct-widget .ct-tool-group:after{clear:both;content:"";display:table}.ct-widget .ct-tool-group:first-child{padding-top:0}.ct-widget .ct-tool{color:#464646;cursor:pointer;float:left;height:32px;margin:4px;margin-right:4px;position:relative;text-align:center;font-family:icon;font-size:16px;font-style:normal;font-weight:400;font-variant:normal;speak:none;text-transform:none;width:32px}.ct-widget .ct-tool,.ct-widget .ct-tool:after{border-radius:2px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ct-widget .ct-tool:after{background:#000;color:#fff;content:attr(data-ct-tooltip);display:block;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;left:-26.5px;opacity:0;padding:0 8px;position:absolute;bottom:37px;font-family:arial,sans-serif;font-size:12px;line-height:20px;visibility:hidden;width:85px;word-break:break-word}.ct-widget .ct-tool:hover:after{opacity:.8;visibility:visible;transition-property:opacity;transition-duration:0s;transition-timing-function:ease-in;transition-delay:2s}.ct-widget .ct-tool:before{line-height:32px}.ct-widget .ct-tool:nth-child(3n){margin-right:0}.ct-widget .ct-tool:hover{background:hsla(0,0%,100%,.5)}.ct-widget .ct-tool--disabled{color:rgba(70,70,70,.33)}.ct-widget .ct-tool--disabled:hover{background:transparent}.ct-widget .ct-tool--down{box-shadow:inset 0 1px 3px rgba(0,0,0,.25);line-height:34px}.ct-widget .ct-tool--down,.ct-widget .ct-tool--down:hover{background:rgba(0,0,0,.025)}.ct-widget .ct-tool--applied{background:rgba(0,0,0,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.25)}.ct-widget .ct-tool--applied:hover{background:rgba(0,0,0,.15)}.ct-widget .ct-tool--bold:before{content:"\ea62"}.ct-widget .ct-tool--heading:before{content:"H";font-weight:700}.ct-widget .ct-tool--subheading:before{content:"H"}.ct-widget .ct-tool--paragraph:before{content:"P"}.ct-widget .ct-tool--preformatted:before{content:"\ea80"}.ct-widget .ct-tool--italic:before{content:"\ea64"}.ct-widget .ct-tool--link:before{content:"\e9cb"}.ct-widget .ct-tool--align-left:before{content:"\ea77"}.ct-widget .ct-tool--align-center:before{content:"\ea78"}.ct-widget .ct-tool--align-right:before{content:"\ea79"}.ct-widget .ct-tool--unordered-list:before{content:"\e9ba"}.ct-widget .ct-tool--ordered-list:before{content:"\e9b9"}.ct-widget .ct-tool--table:before{content:"\ea71"}.ct-widget .ct-tool--indent:before{content:"\ea7b"}.ct-widget .ct-tool--unindent:before{content:"\ea7c"}.ct-widget .ct-tool--line-break:before{content:"\ea6e"}.ct-widget .ct-tool--image:before{content:"\e90d"}.ct-widget .ct-tool--video:before{content:"\ea98"}.ct-widget .ct-tool--undo:before{content:"\e965"}.ct-widget .ct-tool--redo:before{content:"\e966"}.ct-widget .ct-tool--remove:before{content:"\e9ac"}@-webkit-keyframes e{0%{outline-color:hsla(0,0%,100%,0);-webkit-transform:background-color}25%{outline-color:#f39c12;-webkit-transform:background-color}50%{outline-color:#f39c12;-webkit-transform:background-color}to{outline-color:hsla(0,0%,100%,0);-webkit-transform:background-color}}@keyframes e{0%{outline-color:hsla(0,0%,100%,0);-webkit-transform:background-color;transform:background-color}25%{outline-color:#f39c12;-webkit-transform:background-color;transform:background-color}50%{outline-color:#f39c12;-webkit-transform:background-color;transform:background-color}to{outline-color:hsla(0,0%,100%,0);-webkit-transform:background-color;transform:background-color}}.ct-app,.ct-app *,.ct-app :after,.ct-app :before{box-sizing:border-box}.ct--highlight{outline:4px solid #f39c12;-webkit-animation:e .5s ease-in;animation:e .5s ease-in;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ct--no-scroll{overflow:hidden}.ct--puesdo-select{background:rgba(0,0,0,.1)} \ No newline at end of file diff --git a/build/content-tools.min.js b/build/content-tools.min.js index b537a6f1..b7d3626b 100644 --- a/build/content-tools.min.js +++ b/build/content-tools.min.js @@ -1,7 +1,7 @@ -/*! ContentTools v1.6.4 by Anthony Blackshaw (https://github.com/anthonyjb) */ -(function(){var a,b;a={},a.Machine=function(){function a(a){this.context=a,this._stateTransitions={},this._stateTransitionsAny={},this._defaultTransition=null,this._initialState=null,this._currentState=null}return a.prototype.addTransition=function(a,b,c,d){return c||(c=b),this._stateTransitions[[a,b]]=[c,d]},a.prototype.addTransitions=function(a,b,c,d){var e,f,g,h;for(c||(c=b),h=[],f=0,g=a.length;g>f;f++)e=a[f],h.push(this.addTransition(e,b,c,d));return h},a.prototype.addTransitionAny=function(a,b,c){return b||(b=a),this._stateTransitionsAny[a]=[b,c]},a.prototype.setDefaultTransition=function(a,b){return this._defaultTransition=[a,b]},a.prototype.getTransition=function(a,b){if(this._stateTransitions[[a,b]])return this._stateTransitions[[a,b]];if(this._stateTransitionsAny[b])return this._stateTransitionsAny[b];if(this._defaultTransition)return this._defaultTransition;throw new Error("Transition is undefined: ("+a+", "+b+")")},a.prototype.getCurrentState=function(){return this._currentState},a.prototype.setInitialState=function(a){return this._initialState=a,this._currentState?void 0:this.reset()},a.prototype.reset=function(){return this._currentState=this._initialState},a.prototype.process=function(a){var b;return b=this.getTransition(a,this._currentState),b[1]&&b[1].call(this.context||(this.context=this),a),this._currentState=b[0]},a}(),"undefined"!=typeof window&&(window.FSM=a),"undefined"!=typeof module&&module.exports&&(b=module.exports=a)}).call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=[].slice,C=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};r={},"undefined"!=typeof window&&(window.HTMLString=r),"undefined"!=typeof module&&module.exports&&(z=module.exports=r),r.String=function(){function a(a,b){null==b&&(b=!1),this._preserveWhitespace=b,a?(null===r.String._parser&&(r.String._parser=new A),this.characters=r.String._parser.parse(a,this._preserveWhitespace).characters):this.characters=[]}return a._parser=null,a.prototype.isWhitespace=function(){var a,b,c,d;for(d=this.characters,b=0,c=d.length;c>b;b++)if(a=d[b],!a.isWhitespace())return!1;return!0},a.prototype.length=function(){return this.characters.length},a.prototype.preserveWhitespace=function(){return this._preserveWhitespace},a.prototype.capitalize=function(){var a,b;return b=this.copy(),b.length()&&(a=b.characters[0]._c.toUpperCase(),b.characters[0]._c=a),b},a.prototype.charAt=function(a){return this.characters[a].copy()},a.prototype.concat=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(g=2<=arguments.length?B.call(arguments,0,i=arguments.length-1):(i=0,[]),c=arguments[i++],"undefined"!=typeof c&&"boolean"!=typeof c&&(g.push(c),c=!0),e=this.copy(),j=0,m=g.length;m>j;j++)if(f=g[j],0!==f.length){if(h=f,"string"==typeof f&&(h=new r.String(f,this._preserveWhitespace)),c&&e.length())for(b=e.charAt(e.length()-1),d=b.tags(),b.isTag()&&d.shift(),"string"!=typeof f&&(h=h.copy()),p=h.characters,k=0,n=p.length;n>k;k++)a=p[k],a.addTags.apply(a,d);for(q=h.characters,l=0,o=q.length;o>l;l++)a=q[l],e.characters.push(a)}return e},a.prototype.contains=function(a){var b,c,d,e,f,g,h;if("string"==typeof a)return this.text().indexOf(a)>-1;for(d=0;d<=this.length()-a.length();){for(c=!0,h=a.characters,e=f=0,g=h.length;g>f;e=++f)if(b=h[e],!b.eq(this.characters[e+d])){c=!1;break}if(c)return!0;d++}return!1},a.prototype.endsWith=function(a){var b,c,d,e,f,g;if("string"==typeof a)return""===a||this.text().slice(-a.length)===a;for(c=this.characters.slice().reverse(),g=a.characters.slice().reverse(),d=e=0,f=g.length;f>e;d=++e)if(b=g[d],!b.eq(c[d]))return!1;return!0},a.prototype.format=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?B.call(arguments,2):[],0>f&&(f=this.length()+f+1),0>b&&(b=this.length()+b),d=this.copy(),c=g=b;f>=b?f>g:g>f;c=f>=b?++g:--g)a=d.characters[c],a.addTags.apply(a,e);return d},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h;for(d=2<=arguments.length?B.call(arguments,0,e=arguments.length-1):(e=0,[]),c=arguments[e++],"undefined"!=typeof c&&"boolean"!=typeof c&&(d.push(c),c=!1),b=!1,h=this.characters,f=0,g=h.length;g>f;f++)if(a=h[f],a.hasTags.apply(a,d))b=!0;else if(c)return!1;return b},a.prototype.html=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;for(e="",h=[],f=[],c=[],t=this.characters,j=0,n=t.length;n>j;j++){for(a=t[j],c=[],u=h.slice().reverse(),k=0,o=u.length;o>k;k++)if(g=u[k],c.push(g),!a.hasTags(g)){for(l=0,p=c.length;p>l;l++)b=c[l],e+=b.tail(),h.pop(),f.pop();c=[]}for(v=a._tags,m=0,q=v.length;q>m;m++)i=v[m],-1===f.indexOf(i.head())&&(i.selfClosing()||(d=i.head(),e+=d,h.push(i),f.push(d)));a._tags.length>0&&a._tags[0].selfClosing()&&(e+=a._tags[0].head()),e+=a.c()}for(w=h.reverse(),s=0,r=w.length;r>s;s++)i=w[s],e+=i.tail();return e},a.prototype.indexOf=function(a,b){var c,d,e,f,g,h;if(null==b&&(b=0),0>b&&(b=0),"string"==typeof a)return this.text().indexOf(a,b);for(;b<=this.length()-a.length();){for(d=!0,h=a.characters,e=f=0,g=h.length;g>f;e=++f)if(c=h[e],!c.eq(this.characters[e+b])){d=!1;break}if(d)return b;b++}return-1},a.prototype.insert=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t;if(null==c&&(c=!0),e=this.slice(0,a),j=this.slice(a),0>a&&(a=this.length()+a),h=b,"string"==typeof b&&(h=new r.String(b,this._preserveWhitespace)),c&&a>0)for(f=this.charAt(a-1),g=f.tags(),f.isTag()&&g.shift(),"string"!=typeof b&&(h=h.copy()),q=h.characters,k=0,n=q.length;n>k;k++)d=q[k],d.addTags.apply(d,g);for(i=e,s=h.characters,l=0,o=s.length;o>l;l++)d=s[l],i.characters.push(d);for(t=j.characters,m=0,p=t.length;p>m;m++)d=t[m],i.characters.push(d);return i},a.prototype.lastIndexOf=function(a,b){var c,d,e,f,g,h,i,j,k;if(null==b&&(b=0),0>b&&(b=0),d=this.characters.slice(b).reverse(),b=0,"string"==typeof a){if(!this.contains(a))return-1;for(a=a.split("").reverse();b<=d.length-a.length;){for(e=!0,g=0,f=h=0,j=a.length;j>h;f=++h)if(c=a[f],d[f+b].isTag()&&(g+=1),c!==d[g+f+b].c()){e=!1;break}if(e)return b;b++}return-1}for(a=a.characters.slice().reverse();b<=d.length-a.length;){for(e=!0,f=i=0,k=a.length;k>i;f=++i)if(c=a[f],!c.eq(d[f+b])){e=!1;break}if(e)return b;b++}return-1},a.prototype.optimize=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J;for(i=[],g=[],e=null,D=this.characters.slice().reverse(),p=0,t=D.length;t>p;p++){for(a=D[p],a._runLengthMap={},a._runLengthMapSize=0,c=[],E=i.slice().reverse(),q=0,u=E.length;u>q;q++)if(h=E[q],c.push(h),!a.hasTags(h)){for(r=0,v=c.length;v>r;r++)b=c[r],i.pop(),g.pop();c=[]}for(F=a._tags,s=0,w=F.length;w>s;s++)o=F[s],-1===g.indexOf(o.head())&&(o.selfClosing()||(i.push(o),g.push(o.head())));for(A=0,x=i.length;x>A;A++)o=i[A],d=o.head(),e?(a._runLengthMap[d]||(a._runLengthMap[d]=[o,0]),m=0,e._runLengthMap[d]&&(m=e._runLengthMap[d][1]),a._runLengthMap[d][1]=m+1):a._runLengthMap[d]=[o,1];e=a}for(k=function(a,b){return b[1]-a[1]},G=this.characters,J=[],B=0,y=G.length;y>B;B++)if(a=G[B],f=a._tags.length,!(f>0&&a._tags[0].selfClosing()&&3>f||2>f)){l=[],H=a._runLengthMap;for(o in H)j=H[o],l.push(j);for(l.sort(k),I=a._tags.slice(),C=0,z=I.length;z>C;C++)o=I[C],o.selfClosing()||a.removeTags(o);J.push(a.addTags.apply(a,function(){var a,b,c;for(c=[],b=0,a=l.length;a>b;b++)n=l[b],c.push(n[0]);return c}()))}return J},a.prototype.slice=function(a,b){var c,d;return d=new r.String("",this._preserveWhitespace),d.characters=function(){var d,e,f,g;for(f=this.characters.slice(a,b),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.copy());return g}.call(this),d},a.prototype.split=function(a,b){var c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=""),null==b&&(b=0),h=0,c=0,g=[0];;){if(b>0&&c>b)break;if(f=this.indexOf(a,h),-1===f)break;g.push(f),h=f+1}for(g.push(this.length()),j=[],e=k=0,l=g.length-2;l>=0?l>=k:k>=l;e=l>=0?++k:--k)i=g[e],e>0&&(i+=1),d=g[e+1],j.push(this.slice(i,d));return j},a.prototype.startsWith=function(a){var b,c,d,e,f;if("string"==typeof a)return this.text().slice(0,a.length)===a;for(f=a.characters,c=d=0,e=f.length;e>d;c=++d)if(b=f[c],!b.eq(this.characters[c]))return!1;return!0},a.prototype.substr=function(a,b){return 0>=b?new r.String("",this._preserveWhitespace):(0>a&&(a=this.length()+a),void 0===b&&(b=this.length()-a),this.slice(a,a+b))},a.prototype.substring=function(a,b){return void 0===b&&(b=this.length()),this.slice(a,b)},a.prototype.text=function(){var a,b,c,d,e;for(b="",e=this.characters,c=0,d=e.length;d>c;c++)a=e[c],a.isTag()?a.isTag("br")&&(b+="\n"):b+=(" "!==a.c(),a.c());return this.constructor.decode(b)},a.prototype.toLowerCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;d>c;c++)a=e[c],1===a._c.length&&(a._c=a._c.toLowerCase());return b},a.prototype.toUpperCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;d>c;c++)a=e[c],1===a._c.length&&(a._c=a._c.toUpperCase());return b},a.prototype.trim=function(){var a,b,c,d,e,f,g,h,i,j;for(i=this.characters,b=e=0,g=i.length;g>e&&(a=i[b],a.isWhitespace());b=++e);for(j=this.characters.slice().reverse(),d=f=0,h=j.length;h>f&&(a=j[d],a.isWhitespace());d=++f);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;e>c;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimLeft=function(){var a,b,c,d,e,f,g;for(d=this.length()-1,g=this.characters,b=e=0,f=g.length;f>e&&(a=g[b],a.isWhitespace());b=++e);return c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;e>c;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimRight=function(){var a,b,c,d,e,f,g;for(b=0,g=this.characters.slice().reverse(),d=e=0,f=g.length;f>e&&(a=g[d],a.isWhitespace());d=++e);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;e>c;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.unformat=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?B.call(arguments,2):[],0>f&&(f=this.length()+f+1),0>b&&(b=this.length()+b),d=this.copy(),c=g=b;f>=b?f>g:g>f;c=f>=b?++g:--g)a=d.characters[c],a.removeTags.apply(a,e);return d},a.prototype.copy=function(){var a,b;return b=new r.String("",this._preserveWhitespace),b.characters=function(){var b,c,d,e;for(d=this.characters,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.copy());return e}.call(this),b},a.decode=function(a){var b;return b=document.createElement("textarea"),b.innerHTML=a,b.textContent},a.encode=function(a){var b;return b=document.createElement("textarea"),b.textContent=a,b.innerHTML},a.join=function(a,b){var c,d,e,f;for(c=b.shift(),e=0,f=b.length;f>e;e++)d=b[e],c=c.concat(a,d);return c},a}(),a="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_$".split(""),b=a.concat("1234567890".split("")),h=b.concat([":"]),q=b.concat(["#"]),u=b.concat([":"]),n=1,p=2,t=3,s=4,o=5,x=6,v=7,y=8,w=9,j=10,g=11,i=12,c=13,m=14,k=15,l=16,e=17,f=18,d=19,A=function(){function z(){this.fsm=new FSM.Machine(this),this.fsm.setInitialState(n),this.fsm.addTransitionAny(n,null,function(a){return this._pushChar(a)}),this.fsm.addTransition("<",n,t),this.fsm.addTransition("&",n,p),this.fsm.addTransitions(q,p,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",p,n,function(){return this._pushChar("&"+this.entity+";"),this.entity=""}),this.fsm.addTransitions([" ","\n"],t),this.fsm.addTransitions(a,t,s,function(){return this._back()}),this.fsm.addTransition("/",t,o),this.fsm.addTransitions([" ","\n"],s),this.fsm.addTransitions(a,s,x,function(){return this._back()}),this.fsm.addTransitions([" ","\n"],o),this.fsm.addTransitions(a,o,v,function(){return this._back()}),this.fsm.addTransitions(u,x,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],x,j),this.fsm.addTransition("/",x,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",x,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],y),this.fsm.addTransition(">",y,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],j),this.fsm.addTransition("/",j,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",j,n,function(){return this._pushTag()}),this.fsm.addTransitions(a,j,g,function(){return this._back()}),this.fsm.addTransitions(u,v,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],v,w),this.fsm.addTransition(">",v,n,function(){return this._popTag()}),this.fsm.addTransitions([" ","\n"],w),this.fsm.addTransition(">",w,n,function(){return this._popTag()}),this.fsm.addTransitions(h,g,null,function(a){return this.attributeName+=a}),this.fsm.addTransitions([" ","\n"],g,i),this.fsm.addTransition("=",g,c),this.fsm.addTransitions([" ","\n"],i),this.fsm.addTransition("=",i,c),this.fsm.addTransitions(">",g,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitionAny(i,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitions([" ","\n"],c),this.fsm.addTransition("'",c,m),this.fsm.addTransition('"',c,k),this.fsm.addTransitions(b.concat(["&"],c,l,function(){return this._back()})),this.fsm.addTransition(" ",l,j,function(){return this._pushAttribute()}),this.fsm.addTransitions(["/",">"],l,j,function(){return this._back(),this._pushAttribute()}),this.fsm.addTransition("&",l,e),this.fsm.addTransitionAny(l,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition("'",m,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",m,f),this.fsm.addTransitionAny(m,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition('"',k,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",k,d),this.fsm.addTransitionAny(k,null,function(a){return this.attributeValue+=a}),this.fsm.addTransitions(q,e,null,function(a){return this.entity+=a}),this.fsm.addTransitions(q,f,function(a){return this.entity+=a}),this.fsm.addTransitions(q,d,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",e,l,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",f,m,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",d,k,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""})}return z.prototype._back=function(){return this.head--},z.prototype._pushAttribute=function(){return this.attributes[this.attributeName]=this.attributeValue,this.attributeName="",this.attributeValue=""},z.prototype._pushChar=function(a){var b,c;return b=new r.Character(a,this.tags),this._preserveWhitespace?void this.string.characters.push(b):!this.string.length()||b.isTag()||b.isEntity()||!b.isWhitespace()||(c=this.string.characters[this.string.length()-1],!c.isWhitespace()||c.isTag()||c.isEntity())?this.string.characters.push(b):void 0},z.prototype._pushTag=function(){var a,b;return a=new r.Tag(this.tagName,this.attributes),this.tags.push(a),a.selfClosing()&&(this._pushChar(""),this.tags.pop(),!this.selfClosed&&(b=this.tagName,C.call(r.Tag.SELF_CLOSING,b)>=0)&&this.fsm.reset()),this.tagName="",this.selfClosed=!1,this.attributes={}},z.prototype._popTag=function(){for(var a,b;;)if(b=this.tags.pop(),this.string.length()&&(a=this.string.characters[this.string.length()-1],a.isTag()||a.isEntity()||!a.isWhitespace()||a.removeTags(b)),b.name()===this.tagName.toLowerCase())break;return this.tagName=""},z.prototype.parse=function(a,b){var c,d;for(this._preserveWhitespace=b,this.reset(),a=this.preprocess(a),this.fsm.parser=this;this.head> "+d)}this.head++}return this.string},z.prototype.preprocess=function(a){return a=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),a=a.replace(//g,""),this._preserveWhitespace||(a=a.replace(/\s+/g," ")),a},z.prototype.reset=function(){return this.fsm.reset(),this.head=0,this.string=new r.String,this.entity="",this.tags=[],this.tagName="",this.selfClosing=!1,this.attributes={},this.attributeName="",this.attributeValue=""},z}(),r.Tag=function(){function a(a,b){var c,d;this._name=a.toLowerCase(),this._selfClosing=r.Tag.SELF_CLOSING[this._name]===!0,this._head=null,this._attributes={};for(c in b)d=b[c],this._attributes[c]=d}return a.SELF_CLOSING={area:!0,base:!0,br:!0,hr:!0,img:!0,input:!0,"link meta":!0,wbr:!0},a.prototype.head=function(){var a,b,c,d;if(!this._head){a=[],d=this._attributes;for(b in d)c=d[b],a.push(c?""+b+'="'+c+'"':""+b);a.sort(),a.unshift(this._name),this._head="<"+a.join(" ")+">"}return this._head},a.prototype.name=function(){return this._name},a.prototype.selfClosing=function(){return this._selfClosing},a.prototype.tail=function(){return this._selfClosing?"":""},a.prototype.attr=function(a,b){return void 0===b?this._attributes[a]:(this._attributes[a]=b,this._head=null)},a.prototype.removeAttr=function(a){return void 0!==this._attributes[a]?(delete this._attributes[a],this._head=null):void 0},a.prototype.copy=function(){return new r.Tag(this._name,this._attributes)},a}(),r.Character=function(){function a(a,b){this._c=a,a.length>1&&(this._c=a.toLowerCase()),this._tags=[],this.addTags.apply(this,b)}return a.prototype.c=function(){return this._c},a.prototype.isEntity=function(){return this._c.length>1},a.prototype.isTag=function(a){return 0!==this._tags.length&&this._tags[0].selfClosing()?a&&this._tags[0].name()!==a?!1:!0:!1},a.prototype.isWhitespace=function(){var a;return" "===(a=this._c)||"\n"===a||" "===a||this.isTag("br")},a.prototype.tags=function(){var a;return function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.copy());return e}.call(this)},a.prototype.addTags=function(){var a,b,c,d,e;for(b=1<=arguments.length?B.call(arguments,0):[],e=[],c=0,d=b.length;d>c;c++)a=b[c],Array.isArray(a)||(a.selfClosing()?this.isTag()||this._tags.unshift(a.copy()):e.push(this._tags.push(a.copy())));return e},a.prototype.eq=function(a){var b,c,d,e,f,g,h,i;if(this.c()!==a.c())return!1;if(this._tags.length!==a._tags.length)return!1;for(c={},h=this._tags,d=0,f=h.length;f>d;d++)b=h[d],c[b.head()]=!0;for(i=a._tags,e=0,g=i.length;g>e;e++)if(b=i[e],!c[b.head()])return!1;return!0},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h,i;for(d=1<=arguments.length?B.call(arguments,0):[],c={},b={},i=this._tags,e=0,g=i.length;g>e;e++)a=i[e],c[a.name()]=!0,b[a.head()]=!0;for(f=0,h=d.length;h>f;f++)if(a=d[f],"string"==typeof a){if(void 0===c[a])return!1}else if(void 0===b[a.head()])return!1;return!0},a.prototype.removeTags=function(){var a,b,c,d,e,f,g;if(e=1<=arguments.length?B.call(arguments,0):[],0===e.length)return void(this._tags=[]);for(b={},a={},f=0,g=e.length;g>f;f++)d=e[f],"string"==typeof d?b[d]=d:a[d.head()]=d;return c=[],this._tags=this._tags.filter(function(c){return a[c.head()]||b[c.name()]?void 0:c})},a.prototype.copy=function(){var a;return new r.Character(this._c,function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.copy());return e}.call(this))},a}()}.call(this),function(){var a,b,c,d,e,f,g,h=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};a={},a.Range=function(){function c(a,b){this.set(a,b)}return c.prototype.isCollapsed=function(){return this._from===this._to},c.prototype.span=function(){return this._to-this._from},c.prototype.collapse=function(){return this._to=this._from},c.prototype.eq=function(a){return this.get()[0]===a.get()[0]&&this.get()[1]===a.get()[1]},c.prototype.get=function(){return[this._from,this._to]},c.prototype.select=function(b){var c,d,f,g,h,i,j,k,l;return a.Range.unselectAll(),c=document.createRange(),k=e(b,this._from),h=k[0],j=k[1],l=e(b,this._to),d=l[0],g=l[1],i=h.length||0,f=d.length||0,c.setStart(h,Math.min(j,i)),c.setEnd(d,Math.min(g,f)),window.getSelection().addRange(c)},c.prototype.set=function(a,b){return a=Math.max(0,a),b=Math.max(0,b),this._from=Math.min(a,b),this._to=Math.max(a,b)},c.prepareElement=function(a){var c,d,e,f,g,h;for(e=a.querySelectorAll(b.join(", ")),h=[],c=f=0,g=e.length;g>f;c=++f)d=e[c],d.parentNode.insertBefore(document.createTextNode(""),d),h.push(cb;b++)g=d[b],e.push(g);return e}();f.length>0;)switch(d=f.shift(),d.nodeType){case Node.TEXT_NODE:if(d.textContent.length>=e)return[d,e];e-=d.textContent.length;break;case Node.ELEMENT_NODE:if(i=d.nodeName.toLowerCase(),h.call(b,i)>=0){if(0===e)return[d,0];e=Math.max(0,e-1)}else d.childNodes&&Array.prototype.unshift.apply(f,function(){var a,b,c,e;for(c=d.childNodes,e=[],a=0,b=c.length;b>a;a++)g=c[a],e.push(g);return e}())}return[d,e]},g=function(a,c){var d,e,f,g,i,j;if(0===a.childNodes.length)return 0;for(f=0,d=function(){var b,c,d,f;for(d=a.childNodes,f=[],b=0,c=d.length;c>b;b++)e=d[b],f.push(e);return f}();d.length>0;){if(g=d.shift(),g===c)return i=g.nodeName.toLowerCase(),h.call(b,i)>=0?f+1:f;switch(g.nodeType){case Node.TEXT_NODE:f+=g.textContent.length;break;case Node.ELEMENT_NODE:j=g.nodeName.toLowerCase(),h.call(b,j)>=0?f+=1:g.childNodes&&Array.prototype.unshift.apply(d,function(){var a,b,c,d;for(c=g.childNodes,d=[],a=0,b=c.length;b>a;a++)e=c[a],d.push(e);return d}())}}return f},f=function(a,c){var d,e,f,g,i,j,k,l,m,n,o,p,q,r;if(e=a.childNodes,m=c.cloneRange(),m.collapse(!0),i=c.cloneRange(),i.collapse(!1),k=m.startContainer,l=m.startOffset,f=i.endContainer,g=i.endOffset,!m.comparePoint)return[k,l,f,g];if(k===a)for(k=e[e.length-1],l=k.textContent.length,j=n=0,p=e.length;p>n;j=++n)if(d=e[j],1===m.comparePoint(d,0)){0===j?(k=d,l=0):(k=e[j-1],l=d.textContent.length),r=k.nodeName.toLowerCase,h.call(b,r)>=0&&(l=1);break}if(c.collapsed)return[k,l,k,l];if(f===a)for(f=e[e.length-1],g=f.textContent.length,j=o=0,q=e.length;q>o;j=++o)d=e[j],1===i.comparePoint(d,0)&&(f=0===j?d:e[j-1],g=d.textContent.length+1);return[k,l,f,g]},"undefined"!=typeof window&&(window.ContentSelect=a),"undefined"!=typeof module&&module.exports&&(c=module.exports=a)}.call(this),function(){var a,b,c,d,e,f=[].slice,g=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},j=function(a,b){return function(){return a.apply(b,arguments)}};a={ALIGNMENT_CLASS_NAMES:{left:"align-left",right:"align-right"},DEFAULT_MAX_ELEMENT_WIDTH:800,DEFAULT_MIN_ELEMENT_WIDTH:80,DRAG_HOLD_DURATION:500,DROP_EDGE_SIZE:50,HELPER_CHAR_LIMIT:250,INDENT:" ",LANGUAGE:"en",LINE_ENDINGS:"\n",PREFER_LINE_BREAKS:!1,RESIZE_CORNER_SIZE:15,TRIM_WHITESPACE:!0,_translations:{},_:function(b){var c;return c=a.LANGUAGE,a._translations[c]&&a._translations[c][b]?a._translations[c][b]:b},addTranslations:function(b,c){return a._translations[b]=c},addCSSClass:function(a,b){var c,d,e;return a.classList?void a.classList.add(b):(d=a.getAttribute("class"),d?(e=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;b>a;a++)c=e[a],f.push(c);return f}(),-1===e.indexOf(b)?a.setAttribute("class",""+d+" "+b):void 0):a.setAttribute("class",b))},attributesToString:function(a){var b,c,d,e,f,g;if(!a)return"";for(d=function(){var b;b=[];for(c in a)b.push(c);return b}(),d.sort(),b=[],f=0,g=d.length;g>f;f++)c=d[f],e=a[c],""===e?b.push(c):(e=HTMLString.String.encode(e),e=e.replace(/"/g,"""),b.push(""+c+'="'+e+'"'));return b.join(" ")},removeCSSClass:function(a,b){var c,d,e,f;return a.classList?(a.classList.remove(b),void(0===a.classList.length&&a.removeAttribute("class"))):(d=a.getAttribute("class"),d&&(f=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;b>a;a++)c=e[a],f.push(c);return f}(),e=f.indexOf(b),e>-1)?(f.splice(e,1),f.length?a.setAttribute("class",f.join(" ")):a.removeAttribute("class")):void 0)}},"undefined"!=typeof window&&(window.ContentEdit=a),"undefined"!=typeof module&&module.exports&&(b=module.exports=a),d=function(){function b(){this._tagNames={}}return b.prototype.register=function(){var a,b,c,d,e,g;for(a=arguments[0],c=2<=arguments.length?f.call(arguments,1):[],g=[],d=0,e=c.length;e>d;d++)b=c[d],g.push(this._tagNames[b.toLowerCase()]=a);return g},b.prototype.match=function(b){return b=b.toLowerCase(),this._tagNames[b]?this._tagNames[b]:a.Static},b}(),a.TagNames=function(){function a(){}var b;return b=null,a.get=function(){return null!=b?b:b=new d},a}(),a.Node=function(){function b(){this._bindings={},this._parent=null,this._modified=null}return b.prototype.lastModified=function(){return this._modified},b.prototype.parent=function(){return this._parent},b.prototype.parents=function(){var a,b;for(b=[],a=this._parent;a;)b.push(a),a=a._parent;return b},b.prototype.type=function(){return"Node"},b.prototype.html=function(a){throw null==a&&(a=""),new Error("`html` not implemented")},b.prototype.bind=function(a,b){return void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b),b},b.prototype.trigger=function(){var a,b,c,d,e,g,h;if(c=arguments[0],a=2<=arguments.length?f.call(arguments,1):[],this._bindings[c]){for(g=this._bindings[c],h=[],d=0,e=g.length;e>d;d++)b=g[d],b&&h.push(b.call.apply(b,[this].concat(f.call(a))));return h}},b.prototype.unbind=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;f>e;c=++e)d=g[c],h.push(d===b?this._bindings[a].splice(c,1):void 0);return h}},b.prototype.commit=function(){return this._modified=null,a.Root.get().trigger("commit",this)},b.prototype.taint=function(){var b,c,d,e,f,g;for(b=Date.now(),this._modified=b,g=this.parents(),e=0,f=g.length;f>e;e++)c=g[e],c._modified=b;return d=a.Root.get(),d._modified=b,d.trigger("taint",this)},b.prototype.closest=function(a){var b;for(b=this.parent();b&&!a(b);)b=b.parent?b.parent():null;return b},b.prototype.next=function(){var a,b,c,d,e,f;if(this.children&&this.children.length>0)return this.children[0];for(f=[this].concat(this.parents()),d=0,e=f.length;e>d;d++){if(c=f[d],!c.parent())return null;if(a=c.parent().children,b=a.indexOf(c),b=0||(this.prototype[b]=c);return this},b.fromDOMElement=function(){throw new Error("`fromDOMElement` not implemented")},b}(),a.NodeCollection=function(b){function c(){c.__super__.constructor.call(this),this.children=[]}return i(c,b),c.prototype.descendants=function(){var a,b,c;for(a=[],c=this.children.slice();c.length>0;)b=c.shift(),a.push(b),b.children&&b.children.length>0&&(c=b.children.slice().concat(c));return a},c.prototype.isMounted=function(){return!1},c.prototype.type=function(){return"NodeCollection"},c.prototype.attach=function(b,c){return b.parent()&&b.parent().detach(b),b._parent=this,void 0!==c?this.children.splice(c,0,b):this.children.push(b),b.mount&&this.isMounted()&&b.mount(),this.taint(),a.Root.get().trigger("attach",this,b)},c.prototype.commit=function(){var b,c,d,e;for(e=this.descendants(),c=0,d=e.length;d>c;c++)b=e[c],b._modified=null;return this._modified=null,a.Root.get().trigger("commit",this)},c.prototype.detach=function(b){var c;return c=this.children.indexOf(b),-1!==c?(b.unmount&&this.isMounted()&&b.isMounted()&&b.unmount(),this.children.splice(c,1),b._parent=null,this.taint(),a.Root.get().trigger("detach",this,b)):void 0},c}(a.Node),a.Element=function(b){function c(a,b){c.__super__.constructor.call(this),this._tagName=a.toLowerCase(),this._attributes=b?b:{},this._domElement=null,this._behaviours={drag:!0,drop:!0,merge:!0,remove:!0,resize:!0,spawn:!0}}return i(c,b),c.prototype.attributes=function(){var a,b,c,d;a={},d=this._attributes;for(b in d)c=d[b],a[b]=c;return a},c.prototype.cssTypeName=function(){return"element"},c.prototype.domElement=function(){return this._domElement},c.prototype.isFixed=function(){return this.parent()&&"Fixture"===this.parent().type()},c.prototype.isFocused=function(){return a.Root.get().focused()===this},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"Element"},c.prototype.typeName=function(){return"Element"},c.prototype.addCSSClass=function(a){var b;return b=!1,this.hasCSSClass(a)||(b=!0,this.attr("class")?this.attr("class",""+this.attr("class")+" "+a):this.attr("class",a)),this._addCSSClass(a),b?this.taint():void 0},c.prototype.attr=function(a,b){return a=a.toLowerCase(),void 0===b?this._attributes[a]:(this._attributes[a]=b,this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.setAttribute(a,b),this.taint())},c.prototype.blur=function(){var b;return b=a.Root.get(),this.isFocused()?(this._removeCSSClass("ce-element--focused"),b._focused=null,b.trigger("blur",this)):void 0},c.prototype.can=function(a,b){return void 0===b?!this.isFixed()&&this._behaviours[a]:this._behaviours[a]=b},c.prototype.createDraggingDOMElement=function(){var b;if(this.isMounted())return b=document.createElement("div"),b.setAttribute("class","ce-drag-helper ce-drag-helper--type-"+this.cssTypeName()),b.setAttribute("data-ce-type",a._(this.typeName())),b},c.prototype.drag=function(b,c){var d;if(this.isMounted()&&this.can("drag"))return d=a.Root.get(),d.startDragging(this,b,c),d.trigger("drag",this)},c.prototype.drop=function(b,c){var d;if(this.can("drop")){if(d=a.Root.get(),b){if(b._removeCSSClass("ce-element--drop"),b._removeCSSClass("ce-element--drop-"+c[0]),b._removeCSSClass("ce-element--drop-"+c[1]),this.constructor.droppers[b.type()])return this.constructor.droppers[b.type()](this,b,c),void d.trigger("drop",this,b,c);if(b.constructor.droppers[this.type()])return b.constructor.droppers[this.type()](this,b,c),void d.trigger("drop",this,b,c)}return d.trigger("drop",this,null,null)}},c.prototype.focus=function(b){var c;return c=a.Root.get(),this.isFocused()?void 0:(c.focused()&&c.focused().blur(),this._addCSSClass("ce-element--focused"),c._focused=this,this.isMounted()&&!b&&this.domElement().focus(),c.trigger("focus",this)) -},c.prototype.hasCSSClass=function(a){var b,c;return this.attr("class")&&(c=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),c.indexOf(a)>-1)?!0:!1},c.prototype.merge=function(a){return this.can("merge")&&this.can("remove")?this.constructor.mergers[a.type()]?this.constructor.mergers[a.type()](a,this):a.constructor.mergers[this.type()]?a.constructor.mergers[this.type()](a,this):void 0:!1},c.prototype.mount=function(){var b;return this._domElement||(this._domElement=document.createElement(this.tagName())),b=this.nextSibling(),b?this.parent().domElement().insertBefore(this._domElement,b.domElement()):this.isFixed()?(this.parent().domElement().parentNode.replaceChild(this._domElement,this.parent().domElement()),this.parent()._domElement=this._domElement):this.parent().domElement().appendChild(this._domElement),this._addDOMEventListeners(),this._addCSSClass("ce-element"),this._addCSSClass("ce-element--type-"+this.cssTypeName()),this.isFocused()&&this._addCSSClass("ce-element--focused"),a.Root.get().trigger("mount",this)},c.prototype.removeAttr=function(a){return a=a.toLowerCase(),this._attributes[a]?(delete this._attributes[a],this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.removeAttribute(a),this.taint()):void 0},c.prototype.removeCSSClass=function(a){var b,c,d;if(this.hasCSSClass(a))return d=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),c=d.indexOf(a),c>-1&&d.splice(c,1),d.length?this.attr("class",d.join(" ")):this.removeAttr("class"),this._removeCSSClass(a),this.taint()},c.prototype.tagName=function(a){return void 0===a?this._tagName:(this._tagName=a.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){return this._removeDOMEventListeners(),this.isFixed()?(this._removeCSSClass("ce-element"),this._removeCSSClass("ce-element--type-"+this.cssTypeName()),void this._removeCSSClass("ce-element--focused")):(this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,a.Root.get().trigger("unmount",this))},c.prototype._addDOMEventListeners=function(){var a,b,c,d;this._domEventHandlers={dragstart:function(){return function(a){return a.preventDefault()}}(this),focus:function(){return function(a){return a.preventDefault()}}(this),keydown:function(a){return function(b){return a._onKeyDown(b)}}(this),keyup:function(a){return function(b){return a._onKeyUp(b)}}(this),mousedown:function(a){return function(b){return 0===b.button?a._onMouseDown(b):void 0}}(this),mousemove:function(a){return function(b){return a._onMouseMove(b)}}(this),mouseover:function(a){return function(b){return a._onMouseOver(b)}}(this),mouseout:function(a){return function(b){return a._onMouseOut(b)}}(this),mouseup:function(a){return function(b){return 0===b.button?a._onMouseUp(b):void 0}}(this),dragover:function(){return function(a){return a.preventDefault()}}(this),drop:function(a){return function(b){return a._onNativeDrop(b)}}(this),paste:function(a){return function(b){return a._onPaste(b)}}(this)},c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.addEventListener(b,a));return d},c.prototype._onKeyDown=function(){},c.prototype._onKeyUp=function(){},c.prototype._onMouseDown=function(){return this.focus?this.focus(!0):void 0},c.prototype._onMouseMove=function(a){return this._onOver(a)},c.prototype._onMouseOver=function(a){return this._onOver(a)},c.prototype._onMouseOut=function(){var b,c;return this._removeCSSClass("ce-element--over"),c=a.Root.get(),b=c.dragging(),b?(this._removeCSSClass("ce-element--drop"),this._removeCSSClass("ce-element--drop-above"),this._removeCSSClass("ce-element--drop-below"),this._removeCSSClass("ce-element--drop-center"),this._removeCSSClass("ce-element--drop-left"),this._removeCSSClass("ce-element--drop-right"),c._dropTarget=null):void 0},c.prototype._onMouseUp=function(){return this._ieMouseDownEchoed=!1},c.prototype._onNativeDrop=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("native-drop",this,b)},c.prototype._onPaste=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("paste",this,b)},c.prototype._onOver=function(){var b,c;return this._addCSSClass("ce-element--over"),c=a.Root.get(),b=c.dragging(),b&&b!==this&&!c._dropTarget&&this.can("drop")&&(this.constructor.droppers[b.type()]||b.constructor.droppers[this.type()])?(this._addCSSClass("ce-element--drop"),c._dropTarget=this):void 0},c.prototype._removeDOMEventListeners=function(){var a,b,c,d;c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.removeEventListener(b,a));return d},c.prototype._addCSSClass=function(b){return this.isMounted()?a.addCSSClass(this._domElement,b):void 0},c.prototype._attributesToString=function(){return Object.getOwnPropertyNames(this._attributes).length>0?" "+a.attributesToString(this._attributes):""},c.prototype._removeCSSClass=function(b){return this.isMounted()?a.removeCSSClass(this._domElement,b):void 0},c.droppers={},c.mergers={},c.placements=["above","below"],c.getDOMElementAttributes=function(a){var b,c,d,e,f;if(!a.hasAttributes())return{};for(c={},f=a.attributes,d=0,e=f.length;e>d;d++)b=f[d],c[b.name.toLowerCase()]=b.value;return c},c._dropVert=function(a,b,c){var d;return a.parent().detach(a),d=b.parent().children.indexOf(b),"below"===c[0]&&(d+=1),b.parent().attach(a,d)},c._dropBoth=function(b,c,d){var e,f,g,h,i,j,k,l;if(b.parent().detach(b),i=c.parent().children.indexOf(c),"below"===d[0]&&"center"===d[1]&&(i+=1),f=a.ALIGNMENT_CLASS_NAMES.left,g=a.ALIGNMENT_CLASS_NAMES.right,b.a){if(b._removeCSSClass(f),b._removeCSSClass(g),b.a["class"]){for(e=[],l=b.a["class"].split(" "),j=0,k=l.length;k>j;j++)h=l[j],h!==f&&h!==g&&e.push(h);e.length?b.a["class"]=e.join(" "):delete b.a["class"]}}else b.removeCSSClass(f),b.removeCSSClass(g);return"left"===d[1]&&(b.a?(b.a["class"]?b.a["class"]+=" "+f:b.a["class"]=f,b._addCSSClass(f)):b.addCSSClass(f)),"right"===d[1]&&(b.a?(b.a["class"]?b.a["class"]+=" "+g:b.a["class"]=g,b._addCSSClass(g)):b.addCSSClass(g)),c.parent().attach(b,i)},c}(a.Node),a.ElementCollection=function(b){function c(b,d){c.__super__.constructor.call(this,b,d),a.NodeCollection.prototype.constructor.call(this)}return i(c,b),c.extend(a.NodeCollection),c.prototype.cssTypeName=function(){return"element-collection"},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"ElementCollection"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.detach=function(b){return a.NodeCollection.prototype.detach.call(this,b),0===this.children.length&&this.parent()?this.parent().detach(this):void 0},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),e=function(){var c,e,f,g;for(f=this.children,g=[],c=0,e=f.length;e>c;c++)d=f[c],g.push(d.html(b+a.INDENT));return g}.call(this),f=a.LINE_ENDINGS,this.isFixed()?e.join(f):(c=this._attributesToString(),""+b+"<"+this.tagName()+c+">"+f+(""+e.join(f)+f)+(""+b+""))},c.prototype.mount=function(){var a,b,d,e,f,g,h,i;this._domElement=document.createElement(this._tagName),g=this._attributes;for(b in g)d=g[b],this._domElement.setAttribute(b,d);for(c.__super__.mount.call(this),h=this.children,i=[],e=0,f=h.length;f>e;e++)a=h[e],i.push(a.mount());return i},c.prototype.unmount=function(){var a,b,d,e;for(e=this.children,b=0,d=e.length;d>b;b++)a=e[b],a.unmount();return c.__super__.unmount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c}(a.Element),a.ResizableElement=function(b){function c(a,b){c.__super__.constructor.call(this,a,b),this._domSizeInfoElement=null,this._aspectRatio=1}return i(c,b),c.prototype.aspectRatio=function(){return this._aspectRatio},c.prototype.maxSize=function(){var b;return b=parseInt(this.attr("data-ce-max-width")||0),b||(b=a.DEFAULT_MAX_ELEMENT_WIDTH),b=Math.max(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.minSize=function(){var b;return b=parseInt(this.attr("data-ce-min-width")||0),b||(b=a.DEFAULT_MIN_ELEMENT_WIDTH),b=Math.min(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.type=function(){return"ResizableElement"},c.prototype.mount=function(){return c.__super__.mount.call(this),this._domElement.setAttribute("data-ce-size",this._getSizeInfo())},c.prototype.resize=function(b,c,d){return this.isMounted()&&this.can("resize")?a.Root.get().startResizing(this,b,c,d,!0):void 0},c.prototype.size=function(a){var b,c,d,e;return a?(a[0]=parseInt(a[0]),a[1]=parseInt(a[1]),d=this.minSize(),a[0]=Math.max(a[0],d[0]),a[1]=Math.max(a[1],d[1]),c=this.maxSize(),a[0]=Math.min(a[0],c[0]),a[1]=Math.min(a[1],c[1]),this.attr("width",parseInt(a[0])),this.attr("height",parseInt(a[1])),this.isMounted()?(this._domElement.style.width=""+a[0]+"px",this._domElement.style.height=""+a[1]+"px",this._domElement.setAttribute("data-ce-size",this._getSizeInfo())):void 0):(e=parseInt(this.attr("width")||1),b=parseInt(this.attr("height")||1),[e,b])},c.prototype._onMouseDown=function(a){var b;return c.__super__._onMouseDown.call(this,a),b=this._getResizeCorner(a.clientX,a.clientY),b?this.resize(b,a.clientX,a.clientY):(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150))},c.prototype._onMouseMove=function(a){var b;return c.__super__._onMouseMove.call(this),this.can("resize")?(this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right"),b=this._getResizeCorner(a.clientX,a.clientY),b?this._addCSSClass("ce-element--resize-"+b[0]+"-"+b[1]):void 0):void 0},c.prototype._onMouseOut=function(){return c.__super__._onMouseOut.call(this),this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right")},c.prototype._onMouseUp=function(){return c.__super__._onMouseUp.call(this),this._dragTimeout?clearTimeout(this._dragTimeout):void 0},c.prototype._getResizeCorner=function(b,c){var d,e,f,g,h;return f=this._domElement.getBoundingClientRect(),h=[b-f.left,c-f.top],b=h[0],c=h[1],g=this.size(),e=a.RESIZE_CORNER_SIZE,e=Math.min(e,Math.max(parseInt(g[0]/4),1)),e=Math.min(e,Math.max(parseInt(g[1]/4),1)),d=null,e>b?e>c?d=["top","left"]:c>f.height-e&&(d=["bottom","left"]):b>f.width-e&&(e>c?d=["top","right"]:c>f.height-e&&(d=["bottom","right"])),d},c.prototype._getSizeInfo=function(){var a;return a=this.size(),"w "+a[0]+" × h "+a[1]},c}(a.Element),a.Region=function(b){function c(a){c.__super__.constructor.call(this),this._domElement=a,this.setContent(a)}return i(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Region"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c.prototype.setContent=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(h=b,void 0===b.childNodes&&(k=document.createElement("div"),k.innerHTML=b,h=k),p=this.children.slice(),l=0,n=p.length;n>l;l++)d=p[l],this.detach(d);for(j=a.TagNames.get(),f=function(){var a,b,d,e;for(d=h.childNodes,e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(c);return e}(),m=0,o=f.length;o>m;m++)e=f[m],1===e.nodeType&&(g=j.match(e.getAttribute("data-ce-tag")?e.getAttribute("data-ce-tag"):e.tagName),i=g.fromDOMElement(e),h.removeChild(e),i&&this.attach(i));return a.Root.get().trigger("ready",this)},c}(a.NodeCollection),a.Fixture=function(b){function c(b){var d,e,f;c.__super__.constructor.call(this),this._domElement=b,f=a.TagNames.get(),d=f.match(this._domElement.getAttribute("data-ce-tag")?this._domElement.getAttribute("data-ce-tag"):this._domElement.tagName),e=d.fromDOMElement(this._domElement),this.children=[e],e._parent=this,e.mount(),a.Root.get().trigger("ready",this)}return i(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Fixture"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c}(a.NodeCollection),c=function(b){function c(){this._onStopResizing=j(this._onStopResizing,this),this._onResize=j(this._onResize,this),this._onStopDragging=j(this._onStopDragging,this),this._onDrag=j(this._onDrag,this),c.__super__.constructor.call(this),this._focused=null,this._dragging=null,this._dropTarget=null,this._draggingDOMElement=null,this._resizing=null,this._resizingInit=null}return i(c,b),c.prototype.dragging=function(){return this._dragging},c.prototype.dropTarget=function(){return this._dropTarget},c.prototype.focused=function(){return this._focused},c.prototype.resizing=function(){return this._resizing},c.prototype.type=function(){return"Root"},c.prototype.cancelDragging=function(){return this._dragging?(document.body.removeChild(this._draggingDOMElement),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._dragging._removeCSSClass("ce-element--dragging"),this._dragging=null,this._dropTarget=null,a.removeCSSClass(document.body,"ce--dragging")):void 0},c.prototype.startDragging=function(b,c,d){return this._dragging?void 0:(this._dragging=b,this._dragging._addCSSClass("ce-element--dragging"),this._draggingDOMElement=this._dragging.createDraggingDOMElement(),document.body.appendChild(this._draggingDOMElement),this._draggingDOMElement.style.left=""+c+"px",this._draggingDOMElement.style.top=""+d+"px",document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),a.addCSSClass(document.body,"ce--dragging"))},c.prototype._getDropPlacement=function(b,c){var d,e,f,g;return this._dropTarget?(e=this._dropTarget.domElement().getBoundingClientRect(),g=[b-e.left,c-e.top],b=g[0],c=g[1],d="center",be.width-a.DROP_EDGE_SIZE&&(d="right"),f="above",c>e.height/2&&(f="below"),[f,d]):null},c.prototype._onDrag=function(a){var b,c,d;return ContentSelect.Range.unselectAll(),this._draggingDOMElement.style.left=""+a.pageX+"px",this._draggingDOMElement.style.top=""+a.pageY+"px",this._dropTarget&&(b=this._getDropPlacement(a.clientX,a.clientY),this._dropTarget._removeCSSClass("ce-element--drop-above"),this._dropTarget._removeCSSClass("ce-element--drop-below"),this._dropTarget._removeCSSClass("ce-element--drop-center"),this._dropTarget._removeCSSClass("ce-element--drop-left"),this._dropTarget._removeCSSClass("ce-element--drop-right"),c=b[0],g.call(this._dragging.constructor.placements,c)>=0&&this._dropTarget._addCSSClass("ce-element--drop-"+b[0]),d=b[1],g.call(this._dragging.constructor.placements,d)>=0)?this._dropTarget._addCSSClass("ce-element--drop-"+b[1]):void 0},c.prototype._onStopDragging=function(a){var b;return b=this._getDropPlacement(a.clientX,a.clientY),this._dragging.drop(this._dropTarget,b),this.cancelDragging()},c.prototype.startResizing=function(b,c,d,e,f){var g,h;if(!this._resizing)return this._resizing=b,this._resizingInit={corner:c,fixed:f,origin:[d,e],size:b.size()},this._resizing._addCSSClass("ce-element--resizing"),h=this._resizing.parent().domElement(),g=document.createElement("div"),g.setAttribute("class","ce-measure"),h.appendChild(g),this._resizingParentWidth=g.getBoundingClientRect().width,h.removeChild(g),document.addEventListener("mousemove",this._onResize),document.addEventListener("mouseup",this._onStopResizing),a.addCSSClass(document.body,"ce--resizing")},c.prototype._onResize=function(a){var b,c,d,e;return ContentSelect.Range.unselectAll(),d=this._resizingInit.origin[0]-a.clientX,"right"===this._resizingInit.corner[1]&&(d=-d),c=this._resizingInit.size[0]+d,c=Math.min(c,this._resizingParentWidth),this._resizingInit.fixed?b=c*this._resizing.aspectRatio():(e=this._resizingInit.origin[1]-a.clientY,"bottom"===this._resizingInit.corner[0]&&(e=-e),b=this._resizingInit.size[1]+e),this._resizing.size([c,b])},c.prototype._onStopResizing=function(){return document.removeEventListener("mousemove",this._onResize),document.removeEventListener("mouseup",this._onStopResizing),this._resizing._removeCSSClass("ce-element--resizing"),this._resizing=null,this._resizingInit=null,this._resizingParentWidth=null,a.removeCSSClass(document.body,"ce--resizing")},c}(a.Node),a.Root=function(){function a(){}var b;return b=null,a.get=function(){return null!=b?b:b=new c},a}(),a.Static=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._content=d}return i(c,b),c.prototype.cssTypeName=function(){return"static"},c.prototype.type=function(){return"Static"},c.prototype.typeName=function(){return"Static"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.html=function(a){return null==a&&(a=""),HTMLString.Tag.SELF_CLOSING[this._tagName]?""+a+"<"+this._tagName+this._attributesToString()+">":""+a+"<"+this._tagName+this._attributesToString()+">"+this._content+(""+a+"")},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this._domElement.innerHTML=this._content,c.__super__.mount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c.prototype._onMouseDown=function(a){return c.__super__._onMouseDown.call(this,a),void 0!==this.attr("data-ce-moveable")?(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150)):void 0},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._onMouseUp=function(a){return c.__super__._onMouseUp.call(this,a),this._dragTimeout?clearTimeout(this._dragTimeout):void 0},c.droppers={Static:a.Element._dropVert},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Element),a.TagNames.get().register(a.Static,"static"),a.Text=function(b){function c(b,d,e){c.__super__.constructor.call(this,b,d),this.content=e instanceof HTMLString.String?e:a.TRIM_WHITESPACE?new HTMLString.String(e).trim():new HTMLString.String(e,!0)}return i(c,b),c.prototype.cssTypeName=function(){return"text"},c.prototype.type=function(){return"Text"},c.prototype.typeName=function(){return"Text"},c.prototype.blur=function(){return this.isMounted()&&this._syncContent(),this.content.isWhitespace()&&this.can("remove")?this.parent()&&this.parent().detach(this):this.isMounted()&&(document.documentMode||/Edge/.test(navigator.userAgent)||this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.__super__.blur.call(this)},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=HTMLString.String.encode(this._domElement.textContent),d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.drag=function(a,b){return this.storeState(),this._domElement.removeAttribute("contenteditable"),c.__super__.drag.call(this,a,b)},c.prototype.drop=function(a,b){return c.__super__.drop.call(this,a,b),this.restoreState()},c.prototype.focus=function(a){return this.isMounted()&&this._domElement.setAttribute("contenteditable",""),c.__super__.focus.call(this,a)},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),(!this._lastCached||this._lastCached"+e+(""+b+a.INDENT+this._cached+e)+(""+b+"")},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this.updateInnerHTML(),c.__super__.mount.call(this)},c.prototype.restoreState=function(){return this._savedSelection?this.isMounted()&&this.isFocused()?(this._domElement.setAttribute("contenteditable",""),this._addCSSClass("ce-element--focused"),document.activeElement!==this.domElement()&&this.domElement().focus(),this._savedSelection.select(this._domElement),this._savedSelection=void 0):void(this._savedSelection=void 0):void 0},c.prototype.selection=function(a){return void 0===a?this.isMounted()?ContentSelect.Range.query(this._domElement):new ContentSelect.Range(0,0):a.select(this._domElement)},c.prototype.storeState=function(){return this.isMounted()&&this.isFocused()?this._savedSelection=ContentSelect.Range.query(this._domElement):void 0},c.prototype.unmount=function(){return this._domElement.removeAttribute("contenteditable"),c.__super__.unmount.call(this)},c.prototype.updateInnerHTML=function(){return this._domElement.innerHTML=this.content.html(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._onKeyDown=function(a){switch(a.keyCode){case 40:return this._keyDown(a);case 37:return this._keyLeft(a);case 39:return this._keyRight(a);case 38:return this._keyUp(a);case 9:return this._keyTab(a);case 8:return this._keyBack(a);case 46:return this._keyDelete(a);case 13:return this._keyReturn(a)}},c.prototype._onKeyUp=function(a){return c.__super__._onKeyUp.call(this,a),this._syncContent()},c.prototype._onMouseDown=function(b){return c.__super__._onMouseDown.call(this,b),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(a){return function(){return a.drag(b.pageX,b.pageY)}}(this),a.DRAG_HOLD_DURATION),0===this.content.length()&&a.Root.get().focused()===this?(b.preventDefault(),document.activeElement!==this._domElement&&this._domElement.focus(),new ContentSelect.Range(0,0).select(this._domElement)):void 0},c.prototype._onMouseMove=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseMove.call(this,a)},c.prototype._onMouseOut=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseOut.call(this,a)},c.prototype._onMouseUp=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseUp.call(this,a)},c.prototype._keyBack=function(a){var b,c;return c=ContentSelect.Range.query(this._domElement),0===c.get()[0]&&c.isCollapsed()?(a.preventDefault(),b=this.previousContent(),this._syncContent(),b?b.merge(this):void 0):void 0},c.prototype._keyDelete=function(a){var b,c;return c=ContentSelect.Range.query(this._domElement),this._atEnd(c)&&c.isCollapsed()?(a.preventDefault(),b=this.nextContent(),b?this.merge(b):void 0):void 0},c.prototype._keyDown=function(a){return this._keyRight(a)},c.prototype._keyLeft=function(b){var c,d;return d=ContentSelect.Range.query(this._domElement),0===d.get()[0]&&d.isCollapsed()?(b.preventDefault(),c=this.previousContent(),c?(c.focus(),d=new ContentSelect.Range(c.content.length(),c.content.length()),d.select(c.domElement())):a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):void 0},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;if(b.preventDefault(),!(this.content.isWhitespace()&&!b.shiftKey^a.PREFER_LINE_BREAKS)){if(f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),b.shiftKey^a.PREFER_LINE_BREAKS)return d=f.get()[0],e="
",this.content.length()===d&&(0!==this.content.length()&&this.content.characters[d-1].isTag("br")||(e="

")),this.content=this.content.insert(d,new HTMLString.String(e,!0),!0),this.updateInnerHTML(),d+=1,f=new ContentSelect.Range(d,d),f.select(this.domElement()),void this.taint();if(this.can("spawn"))return this.content=h.trim(),this.updateInnerHTML(),c=new this.constructor("p",{},g.trim()),this.parent().attach(c,this.parent().children.indexOf(this)+1),h.length()?(c.focus(),f=new ContentSelect.Range(0,0),f.select(c.domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint()}},c.prototype._keyRight=function(b){var c,d;return d=ContentSelect.Range.query(this._domElement),this._atEnd(d)&&d.isCollapsed()?(b.preventDefault(),c=this.nextContent(),c?(c.focus(),d=new ContentSelect.Range(0,0),d.select(c.domElement())):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):void 0},c.prototype._keyTab=function(b){return b.preventDefault(),this.isFixed()?b.shiftKey?a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()})):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()})):void 0},c.prototype._keyUp=function(a){return this._keyLeft(a)},c.prototype._atEnd=function(a){return a.get()[0]>=this.content.length()},c.prototype._flagIfEmpty=function(){return 0===this.content.length()?this._addCSSClass("ce-element--empty"):this._removeCSSClass("ce-element--empty")},c.prototype._syncContent=function(){var a,b;return b=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML,this.content.preserveWhitespace()),a=this.content.html(),b!==a&&this.taint(),this._flagIfEmpty()},c.droppers={Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={Text:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&b.updateInnerHTML(),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),a.parent()&&a.parent().detach(a),b.taint()}},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML.replace(/^\s+|\s+$/g,""))},c}(a.Element),a.TagNames.get().register(a.Text,"address","blockquote","h1","h2","h3","h4","h5","h6","p"),a.PreText=function(b){function c(b,c,d){this.content=d instanceof HTMLString.String?d:new HTMLString.String(d,!0),a.Element.call(this,b,c)}return i(c,b),c.TAB_INDENT=" ",c.prototype.cssTypeName=function(){return"pre-text"},c.prototype.type=function(){return"PreText"},c.prototype.typeName=function(){return"Preformatted"},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.innerHTML=this.content.html()),c.__super__.blur.call(this)},c.prototype.html=function(a){var b;return null==a&&(a=""),(!this._lastCached||this._lastCached"+(""+this._cached+"")},c.prototype.updateInnerHTML=function(){var a;return a=this.content.html(),this._domElement.innerHTML=a,this._ensureEndZWS(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._keyBack=function(a){var b;return b=ContentSelect.Range.query(this._domElement),b.get()[0]<=this.content.length()?c.__super__._keyBack.call(this,a):(b.set(this.content.length(),this.content.length()),b.select(this._domElement))},c.prototype._keyReturn=function(a){var b,c,d,e;return a.preventDefault(),c=ContentSelect.Range.query(this._domElement),b=c.get()[0]+1,0===c.get()[0]&&c.isCollapsed()?this.content=new HTMLString.String("\n",!0).concat(this.content):this._atEnd(c)&&c.isCollapsed()?this.content=this.content.concat(new HTMLString.String("\n",!0)):0===c.get()[0]&&c.get()[1]===this.content.length()?(this.content=new HTMLString.String("\n",!0),b=0):(e=this.content.substring(0,c.get()[0]),d=this.content.substring(c.get()[1]),this.content=e.concat(new HTMLString.String("\n",!0),d)),this.updateInnerHTML(),c.set(b,b),c.select(this._domElement),this.taint()},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;for(b.preventDefault(),c=this.content.length(),k=a.PreText.TAB_INDENT,j=k.length,o=this.content.split("\n"),p=this.selection().get(),p[0]=Math.min(p[0],c),p[1]=Math.min(p[1],c),e=0,s=-1,f=-1,h=v=0,z=o.length;z>v&&(m=o[h],n=m.length()+1,p[0]-1&&f>-1));h=++v)e+=n;if(s===f)j-=(p[0]-e)%j,i=new HTMLString.String(Array(j+1).join(" "),!0),u=o[s].substring(0,p[0]-e),t=o[s].substring(p[1]-e),o[s]=u.concat(i,t),r=j;else if(b.shiftKey){for(g=0,h=w=s;f>=s?f>=w:w>=f;h=f>=s?++w:--w){for(B=o[h].characters.slice(),l=x=0,A=B.length;A>x&&(d=B[l],!(l>j-1))&&d.isWhitespace();l=++x)o[h].characters.shift();h===s&&(g=l)}r=Math.max(-j,-g)}else{for(i=new HTMLString.String(k,!0),h=y=s;f>=s?f>=y:y>=f;h=f>=s?++y:--y)o[h]=i.concat(o[h]);r=j}return this.content=HTMLString.String.join(new HTMLString.String("\n",!0),o),this.updateInnerHTML(),q=this.content.length()-c,new ContentSelect.Range(p[0]+r,p[1]+q).select(this._domElement)},c.prototype._syncContent=function(){var a,b;return this._ensureEndZWS(),b=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g,""),this.content.preserveWhitespace()),a=this.content.html(),b!==a&&this.taint(),this._flagIfEmpty()},c.prototype._ensureEndZWS=function(){var a,b;if(this._domElement.lastChild&&(a=this._domElement.innerHTML,!("​"===a[a.length-1]&&a.indexOf("​")-1&&(b._domElement.innerHTML=a.replace(/\u200B/g,"")),b._domElement.lastChild.textContent+="​"}}(this),this._savedSelection?b():(this.storeState(),b(),this.restoreState())},c.droppers={PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Text),a.TagNames.get().register(a.PreText,"pre"),a.Image=function(b){function c(a,b){var d;c.__super__.constructor.call(this,"img",a),this.a=b?b:null,d=this.size(),this._aspectRatio=d[1]/d[0]}return i(c,b),c.prototype.cssTypeName=function(){return"image"},c.prototype.type=function(){return"Image"},c.prototype.typeName=function(){return"Image"},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.style.backgroundImage="url('"+this._attributes.src+"')",a},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),d=""+b+"",this.a?(e=a.LINE_ENDINGS,c=a.attributesToString(this.a),c=""+c+' data-ce-tag="img"',""+b+""+e+(""+a.INDENT+d+e)+(""+b+"")):d},c.prototype.mount=function(){var a,b;return this._domElement=document.createElement("div"),a="",this.a&&this.a["class"]&&(a+=" "+this.a["class"]),this._attributes["class"]&&(a+=" "+this._attributes["class"]),this._domElement.setAttribute("class",a),b=this._attributes.style?this._attributes.style:"",b+="background-image:url('"+this._attributes.src+"');",this._attributes.width&&(b+="width:"+this._attributes.width+"px;"),this._attributes.height&&(b+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",b),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("a, img"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i,j; -if(b=null,"a"===a.tagName.toLowerCase()){for(b=this.getDOMElementAttributes(a),f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;c>b;b++)d=e[b],f.push(d);return f}(),i=0,j=f.length;j>i;i++)if(e=f[i],1===e.nodeType&&"img"===e.tagName.toLowerCase()){a=e;break}"a"===a.tagName.toLowerCase()&&(a=document.createElement("img"))}return c=this.getDOMElementAttributes(a),h=c.width,g=c.height,void 0===c.width&&(h=void 0===c.height?a.naturalWidth:a.clientWidth),void 0===c.height&&(g=void 0===c.width?a.naturalHeight:a.clientHeight),c.width=h,c.height=g,new this(c,b)},c}(a.ResizableElement),a.TagNames.get().register(a.Image,"img"),a.ImageFixture=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._src=d}return i(c,b),c.prototype.cssTypeName=function(){return"image-fixture"},c.prototype.type=function(){return"ImageFixture"},c.prototype.typeName=function(){return"ImageFixture"},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),f=a.LINE_ENDINGS,d=this._attributesToString(),c="",void 0!==this._attributes.alt&&(c='alt="'+this._attributes.alt+'"'),e=""+b+'",""+b+"<"+this.tagName()+" "+d+">"+f+(""+a.INDENT+e+f)+(""+b+"")},c.prototype.mount=function(){var a,b,d,e,f;this._domElement=document.createElement(this.tagName()),f=this._attributes;for(b in f)e=f[b],"alt"!==b&&"style"!==b&&this._domElement.setAttribute(b,e);return a="",this.a&&this.a["class"]&&(a+=" "+this.a["class"]),this._attributes["class"]&&(a+=" "+this._attributes["class"]),this._domElement.setAttribute("class",a),d=this._attributes.style?this._attributes.style:"",d=d.replace(/background-image:.+?(;|$)/i,""),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._domElement.setAttribute("style",d.trim()),c.__super__.mount.call(this)},c.prototype.src=function(a){return void 0===a?this._src:(this._src=a.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){var a,b;return this.isFixed()?(b=document.createElement("div"),b.innerHTML=this.html(),a=b.firstElementChild,this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a,this.parent()._domElement=this._domElement):c.__super__.unmount.call(this)},c.prototype._attributesToString=function(){var b,c,d,e,f;this._attributes.style?(d=this._attributes.style?this._attributes.style:"",d=d.replace(/background-image:.+?(;|$)/i,""),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._attributes.style=d.trim()):this._attributes.style="background-image:url('"+this.src()+"');",b={},f=this._attributes;for(c in f)e=f[c],"alt"!==c&&(b[c]=e);return" "+a.attributesToString(b)},c.droppers={ImageFixture:a.Element._dropVert,Image:a.Element._dropVert,PreText:a.Element._dropVert,Text:a.Element._dropVert},c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i,j;for(h=a.tagName,c=this.getDOMElementAttributes(a),g="",b="",f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;c>b;b++)d=e[b],f.push(d);return f}(),i=0,j=f.length;j>i;i++)if(e=f[i],1===e.nodeType&&"img"===e.tagName.toLowerCase()){g=e.getAttribute("src")||"",b=e.getAttribute("alt")||"";break}return c=this.getDOMElementAttributes(a),c.alt=b,new this(a.tagName,c,g)},c}(a.Element),a.TagNames.get().register(a.ImageFixture,"img-fixture"),a.Video=function(b){function c(a,b,d){var e;null==d&&(d=[]),c.__super__.constructor.call(this,a,b),this.sources=d,e=this.size(),this._aspectRatio=e[1]/e[0]}return i(c,b),c.prototype.cssTypeName=function(){return"video"},c.prototype.type=function(){return"Video"},c.prototype.typeName=function(){return"Video"},c.prototype._title=function(){var a;return a="",this.attr("src")?a=this.attr("src"):this.sources.length&&(a=this.sources[0].src),a||(a="No video source set"),a.length>80&&(a=a.substr(0,80)+"..."),a},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.innerHTML=this._title(),a},c.prototype.html=function(b){var c,d,e,f,g,h,i;if(null==b&&(b=""),d=a.LINE_ENDINGS,"video"===this.tagName()){for(f=[],i=this.sources,g=0,h=i.length;h>g;g++)e=i[g],c=a.attributesToString(e),f.push(""+b+a.INDENT+"");return""+b+""+d+f.join(d)+(""+d+b+"")}return""+b+"<"+this._tagName+this._attributesToString()+">"+("")},c.prototype.mount=function(){var a;return this._domElement=document.createElement("div"),this.a&&this.a["class"]?this._domElement.setAttribute("class",this.a["class"]):this._attributes["class"]&&this._domElement.setAttribute("class",this._attributes["class"]),a=this._attributes.style?this._attributes.style:"",this._attributes.width&&(a+="width:"+this._attributes.width+"px;"),this._attributes.height&&(a+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",a),this._domElement.setAttribute("data-ce-title",this._title()),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("iframe"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth,Video:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g;for(d=function(){var c,d,e,f;for(e=a.childNodes,f=[],c=0,d=e.length;d>c;c++)b=e[c],f.push(b);return f}(),e=[],f=0,g=d.length;g>f;f++)c=d[f],1===c.nodeType&&"source"===c.tagName.toLowerCase()&&e.push(this.getDOMElementAttributes(c));return new this(a.tagName,this.getDOMElementAttributes(a),e)},c}(a.ResizableElement),a.TagNames.get().register(a.Video,"iframe","video"),a.List=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return i(c,b),c.prototype.cssTypeName=function(){return"list"},c.prototype.type=function(){return"List"},c.prototype.typeName=function(){return"List"},c.prototype._onMouseOver=function(a){return"ListItem"!==this.parent().type()?(c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")):void 0},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;h>g;g++)d=e[g],1===d.nodeType&&"li"===d.tagName.toLowerCase()&&f.attach(a.ListItem.fromDOMElement(d));return 0===f.children.length?null:f},c}(a.ElementCollection),a.TagNames.get().register(a.List,"ol","ul"),a.ListItem=function(b){function c(a){c.__super__.constructor.call(this,"li",a),this._behaviours.indent=!0}return i(c,b),c.prototype.cssTypeName=function(){return"list-item"},c.prototype.list=function(){return 2===this.children.length?this.children[1]:null},c.prototype.listItemText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"ListItem"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[""+b+""],this.listItemText()&&c.push(this.listItemText().html(b+a.INDENT)),this.list()&&c.push(this.list().html(b+a.INDENT)),c.push(""+b+""),c.join(a.LINE_ENDINGS)},c.prototype.indent=function(){var b;if(this.can("indent")&&0!==this.parent().children.indexOf(this))return b=this.previousSibling(),b.list()||b.attach(new a.List(b.parent().tagName())),this.listItemText().storeState(),this.parent().detach(this),b.list().attach(this),this.listItemText().restoreState()},c.prototype.remove=function(){var a,b,c,d,e,f;if(this.parent()){if(c=this.parent().children.indexOf(this),this.list())for(f=this.list().children.slice(),b=d=0,e=f.length;e>d;b=++d)a=f[b],a.parent().detach(a),this.parent().attach(a,b+c);return this.parent().detach(this)}},c.prototype.unindent=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(this.can("indent")){if(g=this.parent(),c=g.parent(),k=g.children.slice(g.children.indexOf(this)+1,g.children.length),"ListItem"===c.type()){for(this.listItemText().storeState(),g.detach(this),c.parent().attach(this,c.parent().children.indexOf(c)+1),k.length&&!this.list()&&this.attach(new a.List(g.tagName())),m=0,q=k.length;q>m;m++)j=k[m],j.parent().detach(j),this.list().attach(j);return this.listItemText().restoreState()}if(l=new a.Text("p",this.attr("class")?{"class":this.attr("class")}:{},this.listItemText().content),i=null,this.listItemText().isFocused()&&(i=ContentSelect.Range.query(this.listItemText().domElement())),h=c.children.indexOf(g),e=g.children.indexOf(this),0===e){if(f=null,1===g.children.length?(this.list()&&(f=new a.List(g.tagName())),c.detach(g)):g.detach(this),c.attach(l,h),f&&c.attach(f,h+1),this.list())for(u=this.list().children.slice(),d=n=0,r=u.length;r>n;d=++n)b=u[d],b.parent().detach(b),f?f.attach(b):g.attach(b,d)}else if(e===g.children.length-1)g.detach(this),c.attach(l,h+1),this.list()&&c.attach(this.list(),h+2);else{if(g.detach(this),c.attach(l,h+1),f=new a.List(g.tagName()),c.attach(f,h+2),this.list())for(v=this.list().children.slice(),o=0,s=v.length;s>o;o++)b=v[o],b.parent().detach(b),f.attach(b);for(p=0,t=k.length;t>p;p++)j=k[p],j.parent().detach(j),f.attach(j)}return i?(l.focus(),i.select(l.domElement())):void 0}},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l;for(g=new this(this.getDOMElementAttributes(b)),d="",e=null,k=b.childNodes,i=0,j=k.length;j>i;i++)c=k[i],1===c.nodeType?"ul"===(l=c.tagName.toLowerCase())||"ol"===l||"li"===l?e||(e=c):d+=c.outerHTML:d+=HTMLString.String.encode(c.textContent);return d=d.replace(/^\s+|\s+$/g,""),h=new a.ListItemText(d),g.attach(h),e&&(f=a.List.fromDOMElement(e),g.attach(f)),g},c}(a.ElementCollection),a.ListItemText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return i(c,b),c.prototype.cssTypeName=function(){return"list-item-text"},c.prototype.type=function(){return"ListItemText"},c.prototype.typeName=function(){return"List item"},c.prototype.blur=function(){return this.content.isWhitespace()&&this.can("remove")?this.parent().remove():this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCachedc;c++)if(b=e[c],b.tagName()===a)return b;return null},c.droppers={Image:a.Element._dropBoth,ImageFixture:a.Element._dropVert,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Table:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l,m,n;for(i=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c);return f}(),f=[],k=0,m=e.length;m>k;k++)if(d=e[k],1===d.nodeType&&(j=d.tagName.toLowerCase(),!i._getChild(j)))switch(j){case"tbody":case"tfoot":case"thead":h=a.TableSection.fromDOMElement(d),i.attach(h);break;case"tr":f.push(a.TableRow.fromDOMElement(d))}if(f.length>0)for(i._getChild("tbody")||i.attach(new a.TableSection("tbody")),l=0,n=f.length;n>l;l++)g=f[l],i.tbody().attach(g);return 0===i.children.length?null:i},c}(a.ElementCollection),a.TagNames.get().register(a.Table,"table"),a.TableSection=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return i(c,b),c.prototype.cssTypeName=function(){return"table-section"},c.prototype.type=function(){return"TableSection"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;h>g;g++)d=e[g],1===d.nodeType&&"tr"===d.tagName.toLowerCase()&&f.attach(a.TableRow.fromDOMElement(d));return f},c}(a.ElementCollection),a.TableRow=function(b){function c(a){c.__super__.constructor.call(this,"tr",a)}return i(c,b),c.prototype.cssTypeName=function(){return"table-row"},c.prototype.isEmpty=function(){var a,b,c,d,e;for(e=this.children,c=0,d=e.length;d>c;c++)if(a=e[c],b=a.tableCellText(),b&&b.content.length()>0)return!1;return!0},c.prototype.type=function(){return"TableRow"},c.prototype.typeName=function(){return"Table row"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={TableRow:a.Element._dropVert},c.fromDOMElement=function(b){var c,d,e,f,g,h,i;for(f=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c);return f}(),h=0,i=e.length;i>h;h++)d=e[h],1===d.nodeType&&(g=d.tagName.toLowerCase(),("td"===g||"th"===g)&&f.attach(a.TableCell.fromDOMElement(d)));return f},c}(a.ElementCollection),a.TableCell=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return i(c,b),c.prototype.cssTypeName=function(){return"table-cell"},c.prototype.tableCellText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"TableCell"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[""+b+"<"+this.tagName()+this._attributesToString()+">"],this.tableCellText()&&c.push(this.tableCellText().html(b+a.INDENT)),c.push(""+b+""),c.join(a.LINE_ENDINGS)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d;return c=new this(b.tagName,this.getDOMElementAttributes(b)),d=new a.TableCellText(b.innerHTML.replace(/^\s+|\s+$/g,"")),c.attach(d),c},c}(a.ElementCollection),a.TableCellText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return i(c,b),c.prototype.cssTypeName=function(){return"table-cell-text"},c.prototype.type=function(){return"TableCellText"},c.prototype._isInFirstRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c!==d.firstSection()?!1:b===c.children[0]},c.prototype._isInLastRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c!==d.lastSection()?!1:b===c.children[c.children.length-1]},c.prototype._isLastInSection=function(){var a,b,c;return a=this.parent(),b=a.parent(),c=b.parent(),b!==c.children[c.children.length-1]?!1:a===b.children[b.children.length-1]},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCachedj;j++)d=l[j],f=new a.TableCell(d.tagName(),d._attributes),g=new a.TableCellText(""),f.attach(g),h.attach(f);return i=this.closest(function(a){return"TableSection"===a.type()}),i.attach(h),h.children[0].tableCellText().focus()}return this.nextContent().focus()}},c.prototype._keyUp=function(b){var c,d,e,f,g,h;return h=ContentSelect.Range.query(this._domElement),0===h.get()[0]&&h.isCollapsed()?(b.preventDefault(),c=this.parent(),this._isInFirstRow()?(g=c.parent(),e=g.children[0].previousContent(),e?e.focus():a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(f=c.parent().previousWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,f.children.length),f.children[d].tableCellText().focus())):void 0},c.droppers={},c.mergers={},c}(a.Text)}.call(this),function(){var a,b,c,d,e,f,g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=function(a,b){return function(){return a.apply(b,arguments)}},j=[].slice;b={Tools:{},CANCEL_MESSAGE:"Your changes have not been saved, do you really want to lose them?".trim(),DEFAULT_TOOLS:[["bold","italic","link","align-left","align-center","align-right"],["heading","subheading","paragraph","unordered-list","ordered-list","table","indent","unindent","line-break"],["image","video","preformatted"],["undo","redo","remove"]],DEFAULT_VIDEO_HEIGHT:300,DEFAULT_VIDEO_WIDTH:400,HIGHLIGHT_HOLD_DURATION:2e3,IMAGE_UPLOADER:null,INLINE_TAGS:["a","address","b","code","del","em","i","ins","span","strong","sup","u"],INSPECTOR_IGNORED_ELEMENTS:["Fixture","ListItemText","Region","TableCellText"],MIN_CROP:10,RESTRICTED_ATTRIBUTES:{"*":["style"],img:["height","src","width","data-ce-max-width","data-ce-min-width"],iframe:["height","width"]},getEmbedVideoURL:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(b={"www.youtube.com":"youtube","youtu.be":"youtube","vimeo.com":"vimeo","player.vimeo.com":"vimeo"},k=document.createElement("a"),k.href=a,g=k.hostname.toLowerCase(),l=k.pathname,null!==l&&"/"!==l.substr(0,1)&&(l="/"+l),i={},j=k.search.slice(1),p=j.split("&"),n=0,o=p.length;o>n;n++)e=p[n],e=e.split("="),e[0]&&(i[e[0]]=e[1]);switch(b[g]){case"youtube":if("/watch"===l.toLowerCase()){if(!i.v)return null;c=i.v,delete i.v}else{if(f=l.match(/\/([A-Za-z0-9_-]+)$/i),!f)return null;c=f[1]}return a="https://www.youtube.com/embed/"+c,h=function(){var a;a=[];for(d in i)m=i[d],a.push(""+d+"="+m);return a}().join("&"),h&&(a+="?"+h),a;case"vimeo":return(f=l.match(/\/(\w+\/\w+\/){0,1}(\d+)/i))?(a="https://player.vimeo.com/video/"+f[2],h=function(){var a;a=[];for(d in i)m=i[d],a.push(""+d+"="+m);return a}().join("&"),h&&(a+="?"+h),a):null}return null},getHTMLCleaner:function(){return new b.HTMLCleaner},getRestrictedAtributes:function(a){var c;return c=[],b.RESTRICTED_ATTRIBUTES[a]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES[a])),b.RESTRICTED_ATTRIBUTES["*"]&&(c=c.concat(b.RESTRICTED_ATTRIBUTES["*"])),c},getScrollPosition:function(){var a,b;return b=void 0!==window.pageXOffset,a=4===(document.compatMode||4),b?[window.pageXOffset,window.pageYOffset]:a?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[document.body.scrollLeft,document.body.scrollTop]}},"undefined"!=typeof window&&(window.ContentTools=b),"undefined"!=typeof module&&module.exports&&(e=module.exports=b),b.ComponentUI=function(){function a(){this._bindings={},this._parent=null,this._children=[],this._domElement=null}return a.prototype.children=function(){return this._children.slice()},a.prototype.domElement=function(){return this._domElement},a.prototype.isMounted=function(){return null!==this._domElement},a.prototype.parent=function(){return this._parent},a.prototype.attach=function(a,b){return a.parent()&&a.parent().detach(a),a._parent=this,void 0!==b?this._children.splice(b,0,a):this._children.push(a)},a.prototype.addCSSClass=function(a){return this.isMounted()?ContentEdit.addCSSClass(this._domElement,a):void 0},a.prototype.detach=function(a){var b;return b=this._children.indexOf(a),-1!==b?this._children.splice(b,1):void 0},a.prototype.mount=function(){},a.prototype.removeCSSClass=function(a){return this.isMounted()?ContentEdit.removeCSSClass(this._domElement,a):void 0},a.prototype.unmount=function(){return this.isMounted()?(this._removeDOMEventListeners(),this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null):void 0},a.prototype.addEventListener=function(a,b){void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b)},a.prototype.createEvent=function(a,c){return new b.Event(a,c)},a.prototype.dispatchEvent=function(a){var b,c,d,e;if(!this._bindings[a.name()])return!a.defaultPrevented();for(e=this._bindings[a.name()],c=0,d=e.length;d>c&&(b=e[c],!a.propagationStopped());c++)b&&b.call(this,a);return!a.defaultPrevented()},a.prototype.removeEventListener=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;f>e;c=++e)d=g[c],h.push(d===b?this._bindings[a].splice(c,1):void 0);return h}},a.prototype._addDOMEventListeners=function(){},a.prototype._removeDOMEventListeners=function(){},a.createDiv=function(a,b,c){var d,e,f;if(d=document.createElement("div"),a&&a.length>0&&d.setAttribute("class",a.join(" ")),b)for(e in b)f=b[e],d.setAttribute(e,f);return c&&(d.innerHTML=c),d},a}(),b.WidgetUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return h(b,a),b.prototype.attach=function(a,c){return b.__super__.attach.call(this,a,c),this.isMounted()?void 0:a.mount()},b.prototype.detach=function(a){return b.__super__.detach.call(this,a),this.isMounted()?a.unmount():void 0},b.prototype.detatch=function(a){return console.log("Please call detach, detatch will be removed in release 1.4.x"),this.detach(a)},b.prototype.show=function(){var a;return this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null,this.unmount()),this.isMounted()||this.mount(),a=function(a){return function(){return a.addCSSClass("ct-widget--active"),a._showTimeout=null}}(this),this._showTimeout=setTimeout(a,100)},b.prototype.hide=function(){var a;return this._showTimeout&&(clearTimeout(this._showTimeout),this._showTimeout=null),this.removeCSSClass("ct-widget--active"),a=function(b){return function(){return b._hideTimeout=null,window.getComputedStyle?parseFloat(window.getComputedStyle(b._domElement).opacity)<.01?b.unmount():b._hideTimeout=setTimeout(a,250):void b.unmount()}}(this),this.isMounted()?this._hideTimeout=setTimeout(a,250):void 0},b}(b.ComponentUI),b.AnchoredComponentUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return h(b,a),b.prototype.mount=function(a,b){return null==b&&(b=null),a.insertBefore(this._domElement,b),this._addDOMEventListeners()},b}(b.ComponentUI),b.Event=function(){function a(a,b){this._name=a,this._detail=b,this._timeStamp=Date.now(),this._defaultPrevented=!1,this._propagationStopped=!1}return a.prototype.defaultPrevented=function(){return this._defaultPrevented},a.prototype.detail=function(){return this._detail},a.prototype.name=function(){return this._name},a.prototype.propagationStopped=function(){return this._propagationStopped},a.prototype.timeStamp=function(){return this._timeStamp},a.prototype.preventDefault=function(){return this._defaultPrevented=!0},a.prototype.stopImmediatePropagation=function(){return this._propagationStopped=!0},a}(),b.FlashUI=function(a){function c(a){c.__super__.constructor.call(this),this.mount(a)}return h(c,a),c.prototype.mount=function(a){var d;return this._domElement=this.constructor.createDiv(["ct-flash","ct-flash--active","ct-flash--"+a,"ct-widget","ct-widget--active"]),c.__super__.mount.call(this,b.EditorApp.get().domElement()),d=function(a){return function(){return window.getComputedStyle?parseFloat(window.getComputedStyle(a._domElement).opacity)<.01?a.unmount():setTimeout(d,250):void a.unmount()}}(this),setTimeout(d,250)},c}(b.AnchoredComponentUI),b.IgnitionUI=function(a){function b(){b.__super__.constructor.call(this),this._revertToState="ready",this._state="ready"}return h(b,a),b.prototype.busy=function(a){if(this.dispatchEvent(this.createEvent("busy",{busy:a}))){if(a===("busy"===this._state))return;return a?(this._revertToState=this._state,this.state("busy")):this.state(this._revertToState)}},b.prototype.cancel=function(){return this.dispatchEvent(this.createEvent("cancel"))?this.state("ready"):void 0},b.prototype.confirm=function(){return this.dispatchEvent(this.createEvent("confirm"))?this.state("ready"):void 0},b.prototype.edit=function(){return this.dispatchEvent(this.createEvent("edit"))?this.state("editing"):void 0},b.prototype.mount=function(){return b.__super__.mount.call(this),this._domElement=this.constructor.createDiv(["ct-widget","ct-ignition","ct-ignition--ready"]),this.parent().domElement().appendChild(this._domElement),this._domEdit=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--edit"]),this._domElement.appendChild(this._domEdit),this._domConfirm=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--confirm"]),this._domElement.appendChild(this._domConfirm),this._domCancel=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--cancel"]),this._domElement.appendChild(this._domCancel),this._domBusy=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--busy"]),this._domElement.appendChild(this._domBusy),this._addDOMEventListeners()},b.prototype.state=function(a){if(void 0===a)return this._state;if(this._state!==a&&this.dispatchEvent(this.createEvent("statechange",{state:a})))return this._state=a,this.removeCSSClass("ct-ignition--busy"),this.removeCSSClass("ct-ignition--editing"),this.removeCSSClass("ct-ignition--ready"),"busy"===this._state?this.addCSSClass("ct-ignition--busy"):"editing"===this._state?this.addCSSClass("ct-ignition--editing"):"ready"===this._state?this.addCSSClass("ct-ignition--ready"):void 0 -},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domEdit=null,this._domConfirm=null,this._domCancel=null},b.prototype._addDOMEventListeners=function(){return this._domEdit.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.edit()}}(this)),this._domConfirm.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.confirm()}}(this)),this._domCancel.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.cancel()}}(this))},b}(b.WidgetUI),b.InspectorUI=function(a){function c(){c.__super__.constructor.call(this),this._tagUIs=[]}return h(c,a),c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-inspector"]),this.parent().domElement().appendChild(this._domElement),this._domTags=this.constructor.createDiv(["ct-inspector__tags","ct-tags"]),this._domElement.appendChild(this._domTags),this._domCounter=this.constructor.createDiv(["ct-inspector__counter"]),this._domElement.appendChild(this._domCounter),this.updateCounter(),this._addDOMEventListeners(),this._handleFocusChange=function(a){return function(){return a.updateTags()}}(this),ContentEdit.Root.get().bind("blur",this._handleFocusChange),ContentEdit.Root.get().bind("focus",this._handleFocusChange),ContentEdit.Root.get().bind("mount",this._handleFocusChange)},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domTags=null,ContentEdit.Root.get().unbind("blur",this._handleFocusChange),ContentEdit.Root.get().unbind("focus",this._handleFocusChange),ContentEdit.Root.get().unbind("mount",this._handleFocusChange)},c.prototype.updateCounter=function(){var a,c,d,e,f,g,h,i,j,k,l;if(this.isMounted()){for(c="",l=b.EditorApp.get().orderedRegions(),j=0,k=l.length;k>j;j++)g=l[j],g&&(c+=g.domElement().textContent);return c=c.trim(),c=c.replace(/<\/?[a-z][^>]*>/gi,""),c=c.replace(/[\u200B]+/,""),c=c.replace(/['";:,.?¿\-!¡]+/g,""),i=(c.match(/\S+/g)||[]).length,i=i.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),d=ContentEdit.Root.get().focused(),d&&"PreText"===d.type()&&d.selection().isCollapsed()?(e=0,a=1,h=d.content.substring(0,d.selection().get()[0]),f=h.text().split("\n"),e=f.length,a=f[f.length-1].length+1,e=e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),a=a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),this._domCounter.textContent=""+i+" / "+e+":"+a):void(this._domCounter.textContent=i)}},c.prototype.updateTags=function(){var a,c,d,e,f,g,h,i,j;for(a=ContentEdit.Root.get().focused(),i=this._tagUIs,e=0,g=i.length;g>e;e++)d=i[e],d.unmount();if(this._tagUIs=[],a){for(c=a.parents(),c.reverse(),c.push(a),j=[],f=0,h=c.length;h>f;f++)a=c[f],-1===b.INSPECTOR_IGNORED_ELEMENTS.indexOf(a.type())&&(d=new b.TagUI(a),this._tagUIs.push(d),j.push(d.mount(this._domTags)));return j}},c.prototype._addDOMEventListeners=function(){return this._updateCounterInterval=setInterval(function(a){return function(){return a.updateCounter()}}(this),250)},c.prototype._removeDOMEventListeners=function(){return clearInterval(this._updateCounterInterval)},c}(b.WidgetUI),b.TagUI=function(a){function c(a){this.element=a,this._onMouseDown=i(this._onMouseDown,this),c.__super__.constructor.call(this)}return h(c,a),c.prototype.mount=function(a,b){return null==b&&(b=null),this._domElement=this.constructor.createDiv(["ct-tag"]),this._domElement.textContent=this.element.tagName(),c.__super__.mount.call(this,a,b)},c.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown)},c.prototype._onMouseDown=function(a){var c,d,e;return a.preventDefault(),this.element.storeState&&this.element.storeState(),c=b.EditorApp.get(),e=new b.ModalUI,d=new b.PropertiesDialog(this.element),d.addEventListener("cancel",function(a){return function(){return e.hide(),d.hide(),a.element.restoreState?a.element.restoreState():void 0}}(this)),d.addEventListener("save",function(a){return function(b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;j=b.detail(),f=j.changedAttributes,n=j.changedStyles,l=j.innerHTML;for(m in f)if(o=f[m],"class"===m){for(null===o&&(o=""),h={},t=o.split(" "),p=0,r=t.length;r>p;p++)g=t[p],g=g.trim(),g&&(h[g]=!0,a.element.hasCSSClass(g)||a.element.addCSSClass(g));for(u=a.element.attr("class").split(" "),q=0,s=u.length;s>q;q++)g=u[q],g=g.trim(),void 0===h[g]&&a.element.removeCSSClass(g)}else null===o?a.element.removeAttr(m):a.element.attr(m,o);for(i in n)c=n[i],c?a.element.addCSSClass(i):a.element.removeCSSClass(i);return null!==l&&l!==d.getElementInnerHTML()&&(k=a.element,k.content||(k=k.children[0]),k.content=new HTMLString.String(l,k.content.preserveWhitespace()),k.updateInnerHTML(),k.taint(),k.selection(new ContentSelect.Range(0,0)),k.storeState()),e.hide(),d.hide(),a.element.restoreState?a.element.restoreState():void 0}}(this)),c.attach(e),c.attach(d),e.show(),d.show()},c}(b.AnchoredComponentUI),b.ModalUI=function(a){function b(a,c){b.__super__.constructor.call(this),this._transparent=a,this._allowScrolling=c}return h(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-modal"]),this.parent().domElement().appendChild(this._domElement),this._transparent&&this.addCSSClass("ct-modal--transparent"),this._allowScrolling||ContentEdit.addCSSClass(document.body,"ct--no-scroll"),this._addDOMEventListeners()},b.prototype.unmount=function(){return this._allowScrolling||ContentEdit.removeCSSClass(document.body,"ct--no-scroll"),b.__super__.unmount.call(this)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("click",function(a){return function(){return a.dispatchEvent(a.createEvent("click"))}}(this))},b}(b.WidgetUI),b.ToolboxUI=function(a){function c(a){this._onStopDragging=i(this._onStopDragging,this),this._onStartDragging=i(this._onStartDragging,this),this._onDrag=i(this._onDrag,this),c.__super__.constructor.call(this),this._tools=a,this._dragging=!1,this._draggingOffset=null,this._domGrip=null,this._toolUIs={}}return h(c,a),c.prototype.isDragging=function(){return this._dragging},c.prototype.hide=function(){return this._removeDOMEventListeners(),c.__super__.hide.call(this)},c.prototype.mount=function(){var a,b,c;return this._domElement=this.constructor.createDiv(["ct-widget","ct-toolbox"]),this.parent().domElement().appendChild(this._domElement),this._domGrip=this.constructor.createDiv(["ct-toolbox__grip","ct-grip"]),this._domElement.appendChild(this._domGrip),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domToolGroups=this.constructor.createDiv(["ct-tool-groups"]),this._domElement.appendChild(this._domToolGroups),this.tools(this._tools),c=window.localStorage.getItem("ct-toolbox-position"),c&&/^\d+,\d+$/.test(c)&&(b=function(){var b,d,e,f;for(e=c.split(","),f=[],b=0,d=e.length;d>b;b++)a=e[b],f.push(parseInt(a));return f}(),this._domElement.style.left=""+b[0]+"px",this._domElement.style.top=""+b[1]+"px",this._contain()),this._addDOMEventListeners()},c.prototype.tools=function(a){var c,d,e,f,g,h,i,j,k,l,m;if(void 0===a)return this._tools;if(this._tools=a,this.isMounted()){k=this._toolUIs;for(g in k)h=k[g],h.unmount();for(this._toolUIs={};this._domToolGroups.lastChild;)this._domToolGroups.removeChild(this._domToolGroups.lastChild);for(l=this._tools,m=[],d=i=0,j=l.length;j>i;d=++i)f=l[d],c=this.constructor.createDiv(["ct-tool-group"]),this._domToolGroups.appendChild(c),m.push(function(){var a,d,h;for(h=[],a=0,d=f.length;d>a;a++)g=f[a],e=b.ToolShelf.fetch(g),this._toolUIs[g]=new b.ToolUI(e),this._toolUIs[g].mount(c),this._toolUIs[g].disabled(!0),h.push(this._toolUIs[g].addEventListener("applied",function(a){return function(){return a.updateTools()}}(this)));return h}.call(this));return m}},c.prototype.updateTools=function(){var a,b,c,d,e,f;a=ContentEdit.Root.get().focused(),c=null,a&&a.selection&&(c=a.selection()),e=this._toolUIs,f=[];for(b in e)d=e[b],f.push(d.update(a,c));return f},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domGrip=null},c.prototype._addDOMEventListeners=function(){return this._domGrip.addEventListener("mousedown",this._onStartDragging),this._handleResize=function(a){return function(){var b;return a._resizeTimeout&&clearTimeout(a._resizeTimeout),b=function(){return a._contain()},a._resizeTimeout=setTimeout(b,250)}}(this),window.addEventListener("resize",this._handleResize),this._updateTools=function(a){return function(){var c,d,e,f,g,h,i,j;if(c=b.EditorApp.get(),h=!1,d=ContentEdit.Root.get().focused(),f=null,d===a._lastUpdateElement?d&&d.selection&&(f=d.selection(),a._lastUpdateSelection?f.eq(a._lastUpdateSelection)||(h=!0):h=!0):h=!0,c.history&&(a._lastUpdateHistoryLength!==c.history.length()&&(h=!0),a._lastUpdateHistoryLength=c.history.length(),a._lastUpdateHistoryIndex!==c.history.index()&&(h=!0),a._lastUpdateHistoryIndex=c.history.index()),a._lastUpdateElement=d,a._lastUpdateSelection=f,h){i=a._toolUIs,j=[];for(e in i)g=i[e],j.push(g.update(d,f));return j}}}(this),this._updateToolsInterval=setInterval(this._updateTools,100),this._handleKeyDown=function(){return function(a){var c,d,e,f,g,h;if(d=ContentEdit.Root.get().focused(),d&&!d.content){if(46===a.keyCode)return a.preventDefault(),b.Tools.Remove.apply(d,null,function(){});if(13===a.keyCode)return a.preventDefault(),c=b.Tools.Paragraph,c.apply(d,null,function(){})}switch(h=navigator.appVersion,e="linux",-1!==h.indexOf("Mac")?e="mac":-1!==h.indexOf("Win")&&(e="windows"),f=!1,g=!1,e){case"linux"&&!a.altKey:90===a.keyCode&&a.ctrlKey&&(f=a.shiftKey,g=!f);break;case"mac"&&!(a.altKey||a.ctrlKey):90===a.keyCode&&a.metaKey&&(f=a.shiftKey,g=!f);break;case"windows"&&!a.altKey||a.shiftKey:89===a.keyCode&&a.ctrlKey&&(f=!0),90===a.keyCode&&a.ctrlKey&&(g=!0)}return g&&b.Tools.Undo.canApply(null,null)&&b.Tools.Undo.apply(null,null,function(){}),f&&b.Tools.Redo.canApply(null,null)?b.Tools.Redo.apply(null,null,function(){}):void 0}}(this),window.addEventListener("keydown",this._handleKeyDown)},c.prototype._contain=function(){var a;if(this.isMounted())return a=this._domElement.getBoundingClientRect(),a.left+a.width>window.innerWidth&&(this._domElement.style.left=""+(window.innerWidth-a.width)+"px"),a.top+a.height>window.innerHeight&&(this._domElement.style.top=""+(window.innerHeight-a.height)+"px"),a.left<0&&(this._domElement.style.left="0px"),a.top<0&&(this._domElement.style.top="0px"),a=this._domElement.getBoundingClientRect(),window.localStorage.setItem("ct-toolbox-position",""+a.left+","+a.top)},c.prototype._removeDOMEventListeners=function(){return this.isMounted()&&this._domGrip.removeEventListener("mousedown",this._onStartDragging),window.removeEventListener("keydown",this._handleKeyDown),window.removeEventListener("resize",this._handleResize),clearInterval(this._updateToolsInterval)},c.prototype._onDrag=function(a){return ContentSelect.Range.unselectAll(),this._domElement.style.left=""+(a.clientX-this._draggingOffset.x)+"px",this._domElement.style.top=""+(a.clientY-this._draggingOffset.y)+"px"},c.prototype._onStartDragging=function(a){var b;return a.preventDefault(),this.isDragging()?void 0:(this._dragging=!0,this.addCSSClass("ct-toolbox--dragging"),b=this._domElement.getBoundingClientRect(),this._draggingOffset={x:a.clientX-b.left,y:a.clientY-b.top},document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),ContentEdit.addCSSClass(document.body,"ce--dragging"))},c.prototype._onStopDragging=function(){return this.isDragging()?(this._contain(),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._draggingOffset=null,this._dragging=!1,this.removeCSSClass("ct-toolbox--dragging"),ContentEdit.removeCSSClass(document.body,"ce--dragging")):void 0},c}(b.WidgetUI),b.ToolUI=function(a){function b(a){this._onMouseUp=i(this._onMouseUp,this),this._onMouseLeave=i(this._onMouseLeave,this),this._onMouseDown=i(this._onMouseDown,this),this._addDOMEventListeners=i(this._addDOMEventListeners,this),b.__super__.constructor.call(this),this.tool=a,this._mouseDown=!1,this._disabled=!1}return h(b,a),b.prototype.apply=function(a,b){var c,d;if(this.tool.canApply(a,b))return d={element:a,selection:b},c=function(a){return function(b){return b?a.dispatchEvent(a.createEvent("applied",d)):void 0}}(this),this.dispatchEvent(this.createEvent("apply",d))?this.tool.apply(a,b,c):void 0},b.prototype.disabled=function(a){if(void 0===a)return this._disabled;if(this._disabled!==a)return this._disabled=a,a?(this._mouseDown=!1,this.addCSSClass("ct-tool--disabled"),this.removeCSSClass("ct-tool--applied")):this.removeCSSClass("ct-tool--disabled")},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-tool","ct-tool--"+this.tool.icon]),this._domElement.setAttribute("data-ct-tooltip",ContentEdit._(this.tool.label)),b.__super__.mount.call(this,a,c)},b.prototype.update=function(a,b){return(!this.tool.requiresElement||a&&a.isMounted())&&this.tool.canApply(a,b)?(this.disabled(!1),this.tool.isApplied(a,b)?this.addCSSClass("ct-tool--applied"):this.removeCSSClass("ct-tool--applied")):void this.disabled(!0)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown),this._domElement.addEventListener("mouseleave",this._onMouseLeave),this._domElement.addEventListener("mouseup",this._onMouseUp)},b.prototype._onMouseDown=function(a){return a.preventDefault(),this.disabled()?void 0:(this._mouseDown=!0,this.addCSSClass("ct-tool--down"))},b.prototype._onMouseLeave=function(){return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b.prototype._onMouseUp=function(){var a,b;if(this._mouseDown){if(a=ContentEdit.Root.get().focused(),this.tool.requiresElement&&(!a||!a.isMounted()))return;b=null,a&&a.selection&&(b=a.selection()),this.apply(a,b)}return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b}(b.AnchoredComponentUI),b.AnchoredDialogUI=function(a){function b(){b.__super__.constructor.call(this),this._position=[0,0]}return h(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-anchored-dialog"]),this.parent().domElement().appendChild(this._domElement),this._contain(),this._domElement.style.top=""+this._position[1]+"px",this._domElement.style.left=""+this._position[0]+"px"},b.prototype.position=function(a){return void 0===a?this._position.slice():(this._position=a.slice(),this.isMounted()?(this._contain(),this._domElement.style.top=""+this._position[1]+"px",this._domElement.style.left=""+this._position[0]+"px"):void 0)},b.prototype._contain=function(){var a,b,c;if(this.isMounted())return c=this._domElement.getBoundingClientRect(),a=c.width/2+5,b=document.documentElement.clientWidth||document.body.clientWidth,this._position[0]+a>b&&(this._position[0]=b-a),this._position[0]h;h++)a=j[h],e=a.name(),g=a.value(),""!==e&&(c[e.toLowerCase()]=!0,this.element.attr(e)!==g&&(d[e]=g));f=b.getRestrictedAtributes(this.element.tagName()),k=this.element.attributes();for(e in k)g=k[e],f&&-1!==f.indexOf(e.toLowerCase())||void 0===c[e]&&(d[e]=null);return d},e.prototype.changedStyles=function(){var a,b,c,d,e,f;for(c={},f=this._styleUIs,d=0,e=f.length;e>d;d++)b=f[d],a=b.style.cssClass(),this.element.hasCSSClass(a)!==b.applied()&&(c[a]=b.applied());return c},e.prototype.getElementInnerHTML=function(){return this._supportsCoding?this.element.content?this.element.content.html():this.element.children[0].content.html():null},e.prototype.mount=function(){var a,c,f,g,h,i,j,k,l,m,n,o,p,q,r;for(e.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog"),ContentEdit.addCSSClass(this._domView,"ct-properties-dialog__view"),this._domStyles=this.constructor.createDiv(["ct-properties-dialog__styles"]),this._domStyles.setAttribute("data-ct-empty",ContentEdit._("No styles available for this tag")),this._domView.appendChild(this._domStyles),r=b.StylePalette.styles(this.element),n=0,p=r.length;p>n;n++)k=r[n],l=new d(k,this.element.hasCSSClass(k.cssClass())),this._styleUIs.push(l),l.mount(this._domStyles);this._domAttributes=this.constructor.createDiv(["ct-properties-dialog__attributes"]),this._domView.appendChild(this._domAttributes),j=b.getRestrictedAtributes(this.element.tagName()),c=this.element.attributes(),a=[];for(i in c)m=c[i],j&&-1!==j.indexOf(i.toLowerCase())||a.push(i);for(a.sort(),o=0,q=a.length;q>o;o++)i=a[o],m=c[i],this._addAttributeUI(i,m);return this._addAttributeUI("",""),this._domCode=this.constructor.createDiv(["ct-properties-dialog__code"]),this._domView.appendChild(this._domCode),this._domInnerHTML=document.createElement("textarea"),this._domInnerHTML.setAttribute("class","ct-properties-dialog__inner-html"),this._domInnerHTML.setAttribute("name","code"),this._domInnerHTML.value=this.getElementInnerHTML(),this._domCode.appendChild(this._domInnerHTML),g=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(g),this._domStylesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--styles"]),this._domStylesTab.setAttribute("data-ct-tooltip",ContentEdit._("Styles")),g.appendChild(this._domStylesTab),this._domAttributesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--attributes"]),this._domAttributesTab.setAttribute("data-ct-tooltip",ContentEdit._("Attributes")),g.appendChild(this._domAttributesTab),this._domCodeTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--code"]),this._domCodeTab.setAttribute("data-ct-tooltip",ContentEdit._("Code")),g.appendChild(this._domCodeTab),this._supportsCoding||ContentEdit.addCSSClass(this._domCodeTab,"ct-control--muted"),this._domRemoveAttribute=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--remove","ct-control--muted"]),this._domRemoveAttribute.setAttribute("data-ct-tooltip",ContentEdit._("Remove")),g.appendChild(this._domRemoveAttribute),f=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(f),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent=ContentEdit._("Apply"),f.appendChild(this._domApply),h=window.localStorage.getItem("ct-properties-dialog-tab"),"attributes"===h?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--attributes"),ContentEdit.addCSSClass(this._domAttributesTab,"ct-control--active")):"code"===h&&this._supportsCoding?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--code"),ContentEdit.addCSSClass(this._domCodeTab,"ct-control--active")):(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--styles"),ContentEdit.addCSSClass(this._domStylesTab,"ct-control--active")),this._addDOMEventListeners() -},e.prototype.save=function(){var a,b;return b=null,this._supportsCoding&&(b=this._domInnerHTML.value),a={changedAttributes:this.changedAttributes(),changedStyles:this.changedStyles(),innerHTML:b},this.dispatchEvent(this.createEvent("save",a))},e.prototype._addAttributeUI=function(c,d){var e,f;return f=this,e=new a(c,d),this._attributeUIs.push(e),e.addEventListener("blur",function(){var a,b,c;return f._focusedAttributeUI=null,ContentEdit.addCSSClass(f._domRemoveAttribute,"ct-control--muted"),a=f._attributeUIs.indexOf(this),c=f._attributeUIs.length,""===this.name()&&c-1>a&&(this.unmount(),f._attributeUIs.splice(a,1)),b=f._attributeUIs[c-1],b&&b.name()&&b.value()?f._addAttributeUI("",""):void 0}),e.addEventListener("focus",function(){return f._focusedAttributeUI=this,ContentEdit.removeCSSClass(f._domRemoveAttribute,"ct-control--muted")}),e.addEventListener("namechange",function(){var a,d,e,g,h,i,j;for(a=f.element,c=this.name().toLowerCase(),e=b.getRestrictedAtributes(a.tagName()),g=!0,e&&-1!==e.indexOf(c)&&(g=!1),j=f._attributeUIs,h=0,i=j.length;i>h;h++)d=j[h],""!==c&&d!==this&&d.name().toLowerCase()===c&&(g=!1);return this.valid(g),g?ContentEdit.removeCSSClass(f._domApply,"ct-control--muted"):ContentEdit.addCSSClass(f._domApply,"ct-control--muted")}),e.mount(this._domAttributes),e},e.prototype._addDOMEventListeners=function(){var a,b;return e.__super__._addDOMEventListeners.call(this),a=function(a){return function(b){var c,d,e,f,g,h;for(f=["attributes","code","styles"],g=0,h=f.length;h>g;g++)d=f[g],d!==b&&(e=d.charAt(0).toUpperCase()+d.slice(1),ContentEdit.removeCSSClass(a._domElement,"ct-properties-dialog--"+d),ContentEdit.removeCSSClass(a["_dom"+e+"Tab"],"ct-control--active"));return c=b.charAt(0).toUpperCase()+b.slice(1),ContentEdit.addCSSClass(a._domElement,"ct-properties-dialog--"+b),ContentEdit.addCSSClass(a["_dom"+c+"Tab"],"ct-control--active"),window.localStorage.setItem("ct-properties-dialog-tab",b)}}(this),this._domStylesTab.addEventListener("mousedown",function(){return function(){return a("styles")}}(this)),this._domAttributesTab.addEventListener("mousedown",function(){return function(){return a("attributes")}}(this)),this._supportsCoding&&this._domCodeTab.addEventListener("mousedown",function(){return function(){return a("code")}}(this)),this._domRemoveAttribute.addEventListener("mousedown",function(a){return function(b){var c,d;return b.preventDefault(),a._focusedAttributeUI&&(c=a._attributeUIs.indexOf(a._focusedAttributeUI),d=c===a._attributeUIs.length-1,a._focusedAttributeUI.unmount(),a._attributeUIs.splice(c,1),d)?a._addAttributeUI("",""):void 0}}(this)),b=function(a){return function(){var b;try{return b=new HTMLString.String(a._domInnerHTML.value),ContentEdit.removeCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")}catch(c){return ContentEdit.addCSSClass(a._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted")}}}(this),this._domInnerHTML.addEventListener("input",b),this._domInnerHTML.addEventListener("propertychange",b),this._domApply.addEventListener("click",function(a){return function(b){var c;return b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted")?a.save():void 0}}(this))},e}(b.DialogUI),d=function(a){function b(a,c){this.style=a,b.__super__.constructor.call(this),this._applied=c}return h(b,a),b.prototype.applied=function(a){if(void 0===a)return this._applied;if(this._applied!==a)return this._applied=a,this._applied?ContentEdit.addCSSClass(this._domElement,"ct-section--applied"):ContentEdit.removeCSSClass(this._domElement,"ct-section--applied")},b.prototype.mount=function(a,c){var d;return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-section"]),this._applied&&ContentEdit.addCSSClass(this._domElement,"ct-section--applied"),d=this.constructor.createDiv(["ct-section__label"]),d.textContent=this.style.name(),this._domElement.appendChild(d),this._domElement.appendChild(this.constructor.createDiv(["ct-section__switch"])),b.__super__.mount.call(this,a,c)},b.prototype._addDOMEventListeners=function(){var a;return a=function(a){return function(b){return b.preventDefault(),a.applied(a.applied()?!1:!0)}}(this),this._domElement.addEventListener("click",a)},b}(b.AnchoredComponentUI),a=function(a){function b(a,c){b.__super__.constructor.call(this),this._initialName=a,this._initialValue=c}return h(b,a),b.prototype.name=function(){return this._domName.value.trim()},b.prototype.value=function(){return this._domValue.value.trim()},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-attribute"]),this._domName=document.createElement("input"),this._domName.setAttribute("class","ct-attribute__name"),this._domName.setAttribute("name","name"),this._domName.setAttribute("placeholder",ContentEdit._("Name")),this._domName.setAttribute("type","text"),this._domName.setAttribute("value",this._initialName),this._domElement.appendChild(this._domName),this._domValue=document.createElement("input"),this._domValue.setAttribute("class","ct-attribute__value"),this._domValue.setAttribute("name","value"),this._domValue.setAttribute("placeholder",ContentEdit._("Value")),this._domValue.setAttribute("type","text"),this._domValue.setAttribute("value",this._initialValue),this._domElement.appendChild(this._domValue),b.__super__.mount.call(this,a,c)},b.prototype.valid=function(a){return a?ContentEdit.removeCSSClass(this._domName,"ct-attribute__name--invalid"):ContentEdit.addCSSClass(this._domName,"ct-attribute__name--invalid")},b.prototype._addDOMEventListeners=function(){return this._domName.addEventListener("blur",function(a){return function(){var b,c,d;return b=a.name(),c=a._domElement.nextSibling,a.dispatchEvent(a.createEvent("blur")),""===b&&c?(d=c.querySelector(".ct-attribute__name"),d.focus()):void 0}}(this)),this._domName.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domName.addEventListener("input",function(a){return function(){return a.dispatchEvent(a.createEvent("namechange"))}}(this)),this._domName.addEventListener("keydown",function(a){return function(b){return 13===b.keyCode?a._domValue.focus():void 0}}(this)),this._domValue.addEventListener("blur",function(a){return function(){return a.dispatchEvent(a.createEvent("blur"))}}(this)),this._domValue.addEventListener("focus",function(a){return function(){return a.dispatchEvent(a.createEvent("focus"))}}(this)),this._domValue.addEventListener("keydown",function(a){return function(b){var c,d;if(13===b.keyCode||9===b.keyCode&&!b.shiftKey)return b.preventDefault(),c=a._domElement.nextSibling,c||(a._domValue.blur(),c=a._domElement.nextSibling),c?(d=c.querySelector(".ct-attribute__name"),d.focus()):void 0}}(this))},b}(b.AnchoredComponentUI),b.TableDialog=function(a){function b(a){this.table=a,this.table?b.__super__.constructor.call(this,"Update table"):b.__super__.constructor.call(this,"Insert table")}return h(b,a),b.prototype.mount=function(){var a,c,d,e,f,g,h;return b.__super__.mount.call(this),a={columns:3,foot:!1,head:!0},this.table&&(a={columns:this.table.firstSection().children[0].children.length,foot:this.table.tfoot(),head:this.table.thead()}),ContentEdit.addCSSClass(this._domElement,"ct-table-dialog"),ContentEdit.addCSSClass(this._domView,"ct-table-dialog__view"),h=["ct-section"],a.head&&h.push("ct-section--applied"),this._domHeadSection=this.constructor.createDiv(h),this._domView.appendChild(this._domHeadSection),f=this.constructor.createDiv(["ct-section__label"]),f.textContent=ContentEdit._("Table head"),this._domHeadSection.appendChild(f),this._domHeadSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domHeadSection.appendChild(this._domHeadSwitch),this._domBodySection=this.constructor.createDiv(["ct-section","ct-section--applied","ct-section--contains-input"]),this._domView.appendChild(this._domBodySection),c=this.constructor.createDiv(["ct-section__label"]),c.textContent=ContentEdit._("Table body (columns)"),this._domBodySection.appendChild(c),this._domBodyInput=document.createElement("input"),this._domBodyInput.setAttribute("class","ct-section__input"),this._domBodyInput.setAttribute("maxlength","2"),this._domBodyInput.setAttribute("name","columns"),this._domBodyInput.setAttribute("type","text"),this._domBodyInput.setAttribute("value",a.columns),this._domBodySection.appendChild(this._domBodyInput),g=["ct-section"],a.foot&&g.push("ct-section--applied"),this._domFootSection=this.constructor.createDiv(g),this._domView.appendChild(this._domFootSection),e=this.constructor.createDiv(["ct-section__label"]),e.textContent=ContentEdit._("Table foot"),this._domFootSection.appendChild(e),this._domFootSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domFootSection.appendChild(this._domFootSwitch),d=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(d),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent="Apply",d.appendChild(this._domApply),this._addDOMEventListeners()},b.prototype.save=function(){var a,b,c;return b=this._domFootSection.getAttribute("class"),c=this._domHeadSection.getAttribute("class"),a={columns:parseInt(this._domBodyInput.value),foot:b.indexOf("ct-section--applied")>-1,head:c.indexOf("ct-section--applied")>-1},this.dispatchEvent(this.createEvent("save",a))},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBodyInput=null,this._domBodySection=null,this._domApply=null,this._domHeadSection=null,this._domHeadSwitch=null,this._domFootSection=null,this._domFootSwitch=null},b.prototype._addDOMEventListeners=function(){var a;return b.__super__._addDOMEventListeners.call(this),a=function(a){return a.preventDefault(),this.getAttribute("class").indexOf("ct-section--applied")>-1?ContentEdit.removeCSSClass(this,"ct-section--applied"):ContentEdit.addCSSClass(this,"ct-section--applied")},this._domHeadSection.addEventListener("click",a),this._domFootSection.addEventListener("click",a),this._domBodySection.addEventListener("click",function(a){return function(){return a._domBodyInput.focus()}}(this)),this._domBodyInput.addEventListener("input",function(a){return function(b){var c;return c=/^[1-9]\d{0,1}$/.test(b.target.value),c?(ContentEdit.removeCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")):(ContentEdit.addCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted"))}}(this)),this._domApply.addEventListener("click",function(a){return function(b){var c;return b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted")?a.save():void 0}}(this))},b}(b.DialogUI),b.VideoDialog=function(a){function c(){c.__super__.constructor.call(this,"Insert video")}return h(c,a),c.prototype.clearPreview=function(){return this._domPreview?(this._domPreview.parentNode.removeChild(this._domPreview),this._domPreview=void 0):void 0},c.prototype.mount=function(){var a;return c.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-video-dialog"),ContentEdit.addCSSClass(this._domView,"ct-video-dialog__preview"),a=this.constructor.createDiv(["ct-control-group"]),this._domControls.appendChild(a),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-video-dialog__input"),this._domInput.setAttribute("name","url"),this._domInput.setAttribute("placeholder",ContentEdit._("Paste YouTube or Vimeo URL")+"..."),this._domInput.setAttribute("type","text"),a.appendChild(this._domInput),this._domButton=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert","ct-control--muted"]),this._domButton.textContent=ContentEdit._("Insert"),a.appendChild(this._domButton),this._addDOMEventListeners()},c.prototype.preview=function(a){return this.clearPreview(),this._domPreview=document.createElement("iframe"),this._domPreview.setAttribute("frameborder","0"),this._domPreview.setAttribute("height","100%"),this._domPreview.setAttribute("src",a),this._domPreview.setAttribute("width","100%"),this._domView.appendChild(this._domPreview)},c.prototype.save=function(){var a,c;return c=this._domInput.value.trim(),a=b.getEmbedVideoURL(c),this.dispatchEvent(a?this.createEvent("save",{url:a}):this.createEvent("save",{url:c}))},c.prototype.show=function(){return c.__super__.show.call(this),this._domInput.focus()},c.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),c.__super__.unmount.call(this),this._domButton=null,this._domInput=null,this._domPreview=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("input",function(a){return function(c){var d;return c.target.value?ContentEdit.removeCSSClass(a._domButton,"ct-control--muted"):ContentEdit.addCSSClass(a._domButton,"ct-control--muted"),a._updatePreviewTimeout&&clearTimeout(a._updatePreviewTimeout),d=function(){var c,d;return d=a._domInput.value.trim(),c=b.getEmbedVideoURL(d),c?a.preview(c):a.clearPreview()},a._updatePreviewTimeout=setTimeout(d,500)}}(this)),this._domInput.addEventListener("keypress",function(a){return function(b){return 13===b.keyCode?a.save():void 0}}(this)),this._domButton.addEventListener("click",function(a){return function(b){var c;return b.preventDefault(),c=a._domButton.getAttribute("class"),-1===c.indexOf("ct-control--muted")?a.save():void 0}}(this))},c}(b.DialogUI),b.HTMLCleaner=function(){function a(a,b){this.tagWhitelist=a||this.constructor.DEFAULT_TAG_WHITELIST,this.attributeWhitelist=b||this.constructor.DEFAULT_ATTRIBUTE_WHITELIST}return a.DEFAULT_ATTRIBUTE_WHITELIST={a:["href"],td:["colspan"]},a.DEFAULT_TAG_WHITELIST=["a","address","b","blockquote","code","del","em","h1","h2","h3","h4","h5","h6","i","ins","li","ol","p","pre","strong","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","#text"],a.NO_CONTENT_TAGS=["head","meta","style","script","title"],a.prototype.clean=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;for(k=document.implementation.createHTMLDocument(),n=k.createElement("div"),n.innerHTML=a,l=function(){var a,b,c,e;for(c=n.childNodes,e=[],a=0,b=c.length;b>a;a++)d=c[a],e.push(d);return e}();l.length>0;)if(g=l.shift(),h=g.nodeName.toLowerCase(),this.tagWhitelist.indexOf(h)<0){if(this.constructor.NO_CONTENT_TAGS.indexOf(h)>-1){g.remove();continue}for(s=g.childNodes,o=0,q=s.length;q>o;o++)e=s[o],e&&(e=e.cloneNode(!0),f=e.nodeName.toLowerCase(),g.parentNode.insertBefore(e,g),l.push(e));g.remove()}else if("#text"===h||""!==g.textContent.trim()){if(("td"===h||"th"===h||"li"===h)&&g.querySelector("p")&&(g.innerHTML=g.textContent),g.attributes)for(j=this.attributeWhitelist[h]||[],i=function(){var a,c,d,e;for(d=g.attributes,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}(),p=0,r=i.length;r>p;p++)c=i[p],j.indexOf(c.name.toLowerCase())<0?g.removeAttribute(c.name):"href"===c.name.toLowerCase()&&(m=g.getAttribute(c.name),m.startsWith("javascript:"))&&g.removeAttribute(c.name);l.push.apply(l,function(){var a,b,c,e;for(c=g.childNodes,e=[],a=0,b=c.length;b>a;a++)d=c[a],e.push(d);return e}())}else""===g.textContent||g.parentNode===n?g.remove():g.parentNode.replaceChild(k.createTextNode(" "),g);return n.innerHTML},a}(),f=function(a){function c(){c.__super__.constructor.call(this),this.history=null,this._state="dormant",this._busy=!1,this._namingProp=null,this._fixtureTest=function(a){return a.hasAttribute("data-fixture")},this._regionQuery=null,this._domRegions=null,this._regions={},this._orderedRegions=[],this._rootLastModified=null,this._regionsLastModified={},this._ignition=null,this._inspector=null,this._toolbox=null,this._emptyRegionsAllowed=!1}return h(c,a),c.prototype.ctrlDown=function(){return this._ctrlDown},c.prototype.domRegions=function(){return this._domRegions},c.prototype.getState=function(){return this._state},c.prototype.ignition=function(){return this._ignition},c.prototype.inspector=function(){return this._inspector},c.prototype.isDormant=function(){return"dormant"===this._state},c.prototype.isReady=function(){return"ready"===this._state},c.prototype.isEditing=function(){return"editing"===this._state},c.prototype.orderedRegions=function(){var a;return function(){var b,c,d,e;for(d=this._orderedRegions,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(this._regions[a]);return e}.call(this)},c.prototype.regions=function(){return this._regions},c.prototype.shiftDown=function(){return this._shiftDown},c.prototype.toolbox=function(){return this._toolbox},c.prototype.busy=function(a){return void 0===a?this._busy:(this._busy=a,this._ignition?this._ignition.busy(a):void 0)},c.prototype.createPlaceholderElement=function(){return new ContentEdit.Text("p",{},"")},c.prototype.init=function(a,c,d,e){return null==c&&(c="id"),null==d&&(d=null),null==e&&(e=!0),this._namingProp=c,d&&(this._fixtureTest=d),this.mount(),e&&(this._ignition=new b.IgnitionUI,this.attach(this._ignition),this._ignition.addEventListener("edit",function(a){return function(b){return b.preventDefault(),a.start(),a._ignition.state("editing")}}(this)),this._ignition.addEventListener("confirm",function(a){return function(b){return b.preventDefault(),"editing"===a._ignition.state()?(a._ignition.state("ready"),a.stop(!0)):void 0}}(this)),this._ignition.addEventListener("cancel",function(a){return function(b){return b.preventDefault(),"editing"===a._ignition.state()?(a.stop(!1),a._ignition.state(a.isEditing()?"editing":"ready")):void 0}}(this))),this._toolbox=new b.ToolboxUI(b.DEFAULT_TOOLS),this.attach(this._toolbox),this._inspector=new b.InspectorUI,this.attach(this._inspector),this._state="ready",this._handleDetach=function(a){return function(){return a._preventEmptyRegions()}}(this),this._handleClipboardPaste=function(a){return function(b,c){var d;return d=null,c.clipboardData?void(c.clipboardData.getData("text/html")&&"PreText"!==b.type()?a.pasteHTML(b,c.clipboardData.getData("text/html")):a.pasteText(b,c.clipboardData.getData("text/plain"))):window.clipboardData?(d=window.clipboardData.getData("TEXT"),a.pasteText(b,window.clipboardData.getData("TEXT"))):void 0}}(this),this._handleNextRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i;if(f=a.orderedRegions(),e=f.indexOf(b),!(e>=f.length-1)){for(b=f[e+1],d=null,i=b.descendants(),g=0,h=i.length;h>g;g++)if(c=i[g],void 0!==c.content){d=c;break}return d?(d.focus(),void d.selection(new ContentSelect.Range(0,0))):ContentEdit.Root.get().trigger("next-region",b)}}}(this),this._handlePreviousRegionTransition=function(a){return function(b){var c,d,e,f,g,h,i,j;if(h=a.orderedRegions(),f=h.indexOf(b),!(0>=f)){for(b=h[f-1],e=null,d=b.descendants(),d.reverse(),i=0,j=d.length;j>i;i++)if(c=d[i],void 0!==c.content){e=c;break}return e?(g=e.content.length(),e.focus(),void e.selection(new ContentSelect.Range(g,g))):ContentEdit.Root.get().trigger("previous-region",b)}}}(this),ContentEdit.Root.get().bind("detach",this._handleDetach),ContentEdit.Root.get().bind("paste",this._handleClipboardPaste),ContentEdit.Root.get().bind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().bind("previous-region",this._handlePreviousRegionTransition),this.syncRegions(a)},c.prototype.destroy=function(){return ContentEdit.Root.get().unbind("detach",this._handleDetach),ContentEdit.Root.get().unbind("paste",this._handleClipboardPaste),ContentEdit.Root.get().unbind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().unbind("previous-region",this._handlePreviousRegionTransition),this.removeEventListener(),this.unmount(),this._children=[]},c.prototype.highlightRegions=function(a){var b,c,d,e,f;for(e=this._domRegions,f=[],c=0,d=e.length;d>c;c++)b=e[c],f.push(a?ContentEdit.addCSSClass(b,"ct--highlight"):ContentEdit.removeCSSClass(b,"ct--highlight"));return f},c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-app"]),document.body.insertBefore(this._domElement,null),this._addDOMEventListeners()},c.prototype.unmount=function(){var a,b,c,d;if(this.isMounted()){for(d=this._children,b=0,c=d.length;c>b;b++)a=d[b],a.unmount();return this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,this._removeDOMEventListeners(),this._ignition=null,this._inspector=null,this._toolbox=null}},c.prototype.pasteHTML=function(a,c){var d,e,f,g,h,i,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G;for(w=ContentEdit.TagNames.get(),u=document.implementation.createHTMLDocument(),A=u.createElement("div"),A.innerHTML=b.getHTMLCleaner().clean(c.trim()),f=[],F=A.childNodes,B=0,D=F.length;D>B;B++)e=F[B],e&&("#text"!==e.nodeName.toLowerCase()||""!==e.textContent.trim())&&f.push(e);if(f.length){if(l=b.INLINE_TAGS.slice(),l.push("#text"),i=f[0].nodeName.toLowerCase(),n=f[f.length-1].nodeName.toLowerCase(),a.isFixed()||l.indexOf(i)>-1&&l.indexOf(n)>-1){if(l.indexOf(i)>-1&&l.indexOf(n)>-1?c=new HTMLString.String(A.innerHTML):(console.log(A.textContent),c=new HTMLString.String(HTMLString.String.encode(A.textContent))),a.content)return v=a.selection(),g=v.get()[0]+c.length(),z=a.content.substring(0,v.get()[0]),y=a.content.substring(v.get()[1]),t=a.content.substring(v.get()[0],v.get()[1]),t.length()&&(d=t.characters[0],x=d.tags(),d.isTag()&&x.shift(),x.length>=1&&(c=c.format.apply(c,[0,c.length()].concat(j.call(x))))),a.content=z.concat(c),a.content=a.content.concat(y,!1),a.updateInnerHTML(),a.taint(),v.set(g,g),void a.selection(v);A.innerHTML="

"+c.html()+"

"}if(q=a,"Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),s=a.parent(),l.indexOf(i)>-1&&l.indexOf(n)>-1){for(m=A.createElement("p");A.childNodes.length>0;)m.appendChild(A.childNodes[0]);A.appendChild(m)}for(k=0,o=q,G=A.childNodes,C=0,E=G.length;E>C;C++)p=G[C],p&&((p.nodeName="#text"&&""===p.textContent.trim())||(h=w.match(p.nodeName),h===ContentEdit.Static&&(r=document.createElement("p"),r.appendChild(p),p=r,h=ContentEdit.Text),o=h.fromDOMElement(p),s.attach(o,s.children.indexOf(a)+(1+k)),k+=1));return o.focus?o.focus():o.nextSibling()?(o=o.nextSibling().previousWithTest(function(a){return a.focus?a:void 0}))?o.focus():void 0:(o=o.nextWithTest(function(a){return a.focus?a:void 0}),o?o.focus():q.focus())}},c.prototype.pasteText=function(a,b){var c,d,e,f,g,h,i,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;if(p="PreText"!==a.type()?b.split("\n"):[b],p=p.filter(function(a){return""!==a.trim()})){if(e=HTMLString.String.encode,s=!0,w=a.type(),1===p.length&&(s=!1),"PreText"===w&&(s=!1),a.can("spawn")||(s=!1),s){for("ListItemText"===w?(i=a.parent(),h=a.parent().parent(),g=h.children.indexOf(i)+1):(i=a,"Region"!==i.parent().type()&&(i=a.closest(function(a){return"Region"===a.parent().type()})),h=i.parent(),g=h.children.indexOf(i)+1),f=x=0,y=p.length;y>x;f=++x)n=p[f],n=e(n),"ListItemText"===w?(k=new ContentEdit.ListItem,l=new ContentEdit.ListItemText(n),k.attach(l),m=l):(k=new ContentEdit.Text("p",{},n),m=k),h.attach(k,g+f);return o=m.content.length(),m.focus(),m.selection(new ContentSelect.Range(o,o))}return b=e(b),b=new HTMLString.String(b,"PreText"===w),r=a.selection(),d=r.get()[0]+b.length(),v=a.content.substring(0,r.get()[0]),u=a.content.substring(r.get()[1]),q=a.content.substring(r.get()[0],r.get()[1]),q.length()&&(c=q.characters[0],t=c.tags(),c.isTag()&&t.shift(),t.length>=1&&(b=b.format.apply(b,[0,b.length()].concat(j.call(t))))),a.content=v.concat(b),a.content=a.content.concat(u,!1),a.updateInnerHTML(),a.taint(),r.set(d,d),a.selection(r)}},c.prototype.revert=function(){var a;if(this.dispatchEvent(this.createEvent("revert")))return b.CANCEL_MESSAGE&&(a=ContentEdit._(b.CANCEL_MESSAGE),ContentEdit.Root.get().lastModified()>this._rootLastModified&&!window.confirm(a))?!1:(this.revertToSnapshot(this.history.goTo(0),!1),!0)},c.prototype.revertToSnapshot=function(a,b){var c,d,e,f,g,h,i,j,k,l;null==b&&(b=!0),d=[],j=this._regions;for(e in j){for(f=j[e],k=f.children,h=0,i=k.length;i>h;h++)c=k[h],c.unmount();1===f.children.length&&f.children[0].isFixed()?(g=this.constructor.createDiv(),g.innerHTML=a.regions[e],d.push(g.firstElementChild),f.domElement().parentNode.replaceChild(g.firstElementChild,f.domElement())):(d.push(f.domElement()),f.domElement().innerHTML=a.regions[e])}if(this._domRegions=d,b){ContentEdit.Root.get().focused()&&ContentEdit.Root.get().focused().blur(),this._regions={},this.syncRegions(null,!0),ContentEdit.Root.get()._modified=a.rootModified,l=this._regions;for(e in l)f=l[e],a.regionModifieds[e]&&(f._modified=a.regionModifieds[e]);return this.history.replaceRegions(this._regions),this.history.restoreSelection(a),this._inspector.updateTags()}},c.prototype.save=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;if(this.dispatchEvent(this.createEvent("save",{passive:a}))){if(h=ContentEdit.Root.get(),h.focused()&&!a&&h.focused().blur(),h.lastModified()===this._rootLastModified&&a)return void this.dispatchEvent(this.createEvent("saved",{regions:{},passive:a}));c=[],e={},l=this._regions;for(f in l){if(g=l[f],d=g.html(),1===g.children.length&&"Fixture"===!g.type()&&(b=g.children[0],b.content&&!b.content.html()&&(d="")),!a){for(m=g.children,j=0,k=m.length;k>j;j++)b=m[j],b.unmount();1===g.children.length&&g.children[0].isFixed()?(i=this.constructor.createDiv(),i.innerHTML=d,c.push(i.firstElementChild),g.domElement().parentNode.replaceChild(i.firstElementChild,g.domElement())):(c.push(g.domElement()),g.domElement().innerHTML=d)}g.lastModified()!==this._regionsLastModified[f]&&(e[f]=d,this._regionsLastModified[f]=g.lastModified())}return this._domRegions=c,this.dispatchEvent(this.createEvent("saved",{regions:e,passive:a}))}},c.prototype.setRegionOrder=function(a){return this._orderedRegions=a.slice()},c.prototype.start=function(){return this.dispatchEvent(this.createEvent("start"))?(this.busy(!0),this.syncRegions(),this._initRegions(),this._preventEmptyRegions(),this._rootLastModified=ContentEdit.Root.get().lastModified(),this.history=new b.History(this._regions),this.history.watch(),this._state="editing",this._toolbox.show(),this._inspector.show(),this.busy(!1),this.dispatchEvent(this.createEvent("started"))):void 0},c.prototype.stop=function(a){var b;if(this.dispatchEvent(this.createEvent("stop",{save:a}))){if(b=ContentEdit.Root.get().focused(),b&&b.isMounted()&&void 0!==b._syncContent&&b._syncContent(),a)this.save();else if(!this.revert())return;return this.history.stopWatching(),this.history=null,this._toolbox.hide(),this._inspector.hide(),this._regions={},this._state="ready",ContentEdit.Root.get().focused()&&this._allowEmptyRegions(function(){return function(){return ContentEdit.Root.get().focused().blur()}}(this)),this.dispatchEvent(this.createEvent("stopped"))}},c.prototype.syncRegions=function(a,b){return a&&(this._regionQuery=a),this._domRegions=[],this._regionQuery&&(this._domRegions="string"==typeof this._regionQuery||this._regionQuery instanceof String?document.querySelectorAll(this._regionQuery):this._regionQuery),"editing"===this._state&&(this._initRegions(b),this._preventEmptyRegions()),this._ignition?this._domRegions.length?this._ignition.show():this._ignition.hide():void 0},c.prototype._addDOMEventListeners=function(){return this._handleHighlightOn=function(a){return function(c){var d;if((17===(d=c.keyCode)||224===d||91===d||93===d)&&(a._ctrlDown=!0),16===c.keyCode&&!a._ctrlDown){if(a._highlightTimeout)return;return a._shiftDown=!0,void(a._highlightTimeout=setTimeout(function(){return a.highlightRegions(!0)},b.HIGHLIGHT_HOLD_DURATION))}return clearTimeout(a._highlightTimeout),a.highlightRegions(!1)}}(this),this._handleHighlightOff=function(a){return function(b){var c;return 17===(c=b.keyCode)||224===c?void(a._ctrlDown=!1):16===b.keyCode?(a._shiftDown=!1,a._highlightTimeout&&(clearTimeout(a._highlightTimeout),a._highlightTimeout=null),a.highlightRegions(!1)):void 0}}(this),this._handleVisibility=function(a){return function(){return document.hasFocus()?void 0:(clearTimeout(a._highlightTimeout),a.highlightRegions(!1))}}(this),document.addEventListener("keydown",this._handleHighlightOn),document.addEventListener("keyup",this._handleHighlightOff),document.addEventListener("visibilitychange",this._handleVisibility),this._handleBeforeUnload=function(a){return function(c){var d;return"editing"===a._state&&b.CANCEL_MESSAGE?(d=ContentEdit._(b.CANCEL_MESSAGE),(c||window.event).returnValue=d,d):void 0}}(this),window.addEventListener("beforeunload",this._handleBeforeUnload),this._handleUnload=function(a){return function(){return a.destroy()}}(this),window.addEventListener("unload",this._handleUnload)},c.prototype._allowEmptyRegions=function(a){return this._emptyRegionsAllowed=!0,a(),this._emptyRegionsAllowed=!1},c.prototype._preventEmptyRegions=function(){var a,b,c,d,e,f,g,h,i,j,k;if(!this._emptyRegionsAllowed){i=this._regions,k=[];for(d in i){for(f=i[d],c=f.lastModified(),b=!1,j=f.children,g=0,h=j.length;h>g;g++)if(a=j[g],"Static"!==a.type()){b=!0;break}b||(e=this.createPlaceholderElement(f),f.attach(e),k.push(f._modified=c))}return k}},c.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keydown",this._handleHighlightOn),document.removeEventListener("keyup",this._handleHighlightOff),window.removeEventListener("beforeunload",this._handleBeforeUnload),window.removeEventListener("unload",this._handleUnload)},c.prototype._initRegions=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;for(null==a&&(a=!1),d={},c=[],this._orderedRegions=[],k=this._domRegions,e=i=0,j=k.length;j>i;e=++i)b=k[e],g=b.getAttribute(this._namingProp),g||(g=e),d[g]=!0,this._orderedRegions.push(g),this._regions[g]&&this._regions[g].domElement()===b||(this._regions[g]=this._fixtureTest(b)?new ContentEdit.Fixture(b):new ContentEdit.Region(b),c.push(this._regions[g].domElement()),a||(this._regionsLastModified[g]=this._regions[g].lastModified()));this._domRegions=c,l=this._regions,m=[];for(g in l)h=l[g],d[g]||(delete this._regions[g],delete this._regionsLastModified[g],f=this._orderedRegions.indexOf(g),m.push(f>-1?this._orderedRegions.splice(f,1):void 0));return m},c}(b.ComponentUI),b.EditorApp=function(){function a(){}var c;return c=null,a.get=function(){var a;return a=b.EditorApp.getCls(),null!=c?c:c=new a},a.getCls=function(){return f},a}(),b.History=function(){function a(a){this._lastSnapshotTaken=null,this._regions={},this.replaceRegions(a),this._snapshotIndex=-1,this._snapshots=[],this._store()}return a.prototype.canRedo=function(){return this._snapshotIndex0},a.prototype.index=function(){return this._snapshotIndex},a.prototype.length=function(){return this._snapshots.length},a.prototype.snapshot=function(){return this._snapshots[this._snapshotIndex]},a.prototype.goTo=function(a){return this._snapshotIndex=Math.min(this._snapshots.length-1,Math.max(0,a)),this.snapshot()},a.prototype.redo=function(){return this.goTo(this._snapshotIndex+1)},a.prototype.replaceRegions=function(a){var b,c,d;this._regions={},d=[];for(b in a)c=a[b],d.push(this._regions[b]=c);return d},a.prototype.restoreSelection=function(a){var b,c;if(a.selected)return c=this._regions[a.selected.region],b=c.descendants()[a.selected.element],b.focus(),b.selection&&a.selected.selection?b.selection(a.selected.selection):void 0},a.prototype.stopWatching=function(){return this._watchInterval&&clearInterval(this._watchInterval),this._delayedStoreTimeout?clearTimeout(this._delayedStoreTimeout):void 0},a.prototype.undo=function(){return this.goTo(this._snapshotIndex-1)},a.prototype.watch=function(){var a;return this._lastSnapshotTaken=Date.now(),a=function(a){return function(){var b,c;if(c=ContentEdit.Root.get().lastModified(),null!==c&&c>a._lastSnapshotTaken){if(a._delayedStoreRequested===c)return;return a._delayedStoreTimeout&&clearTimeout(a._delayedStoreTimeout),b=function(){return a._lastSnapshotTaken=c,a._store() -},a._delayedStoreRequested=c,a._delayedStoreTimeout=setTimeout(b,500)}}}(this),this._watchInterval=setInterval(a,50)},a.prototype._store=function(){var a,b,c,d,e,f,g;e={regions:{},regionModifieds:{},rootModified:ContentEdit.Root.get().lastModified(),selected:null},f=this._regions;for(b in f)d=f[b],e.regions[b]=d.html(),e.regionModifieds[b]=d.lastModified();if(a=ContentEdit.Root.get().focused()){if(e.selected={},d=a.closest(function(a){return"Region"===a.type()||"Fixture"===a.type()}),!d)return;g=this._regions;for(b in g)if(c=g[b],d===c){e.selected.region=b;break}e.selected.element=d.descendants().indexOf(a),a.selection&&(e.selected.selection=a.selection())}return this._snapshotIndexi;i++)if(d=n[i],d.hasTags("a"))for(o=d.tags(),j=0,l=o.length;l>j;j++)if(g=o[j],"a"===g.name())return g.attr(a)}return""},c.canApply=function(a,b){var c;return"Image"===a.type()?!0:a.isFixed()&&"a"===a.tagName()?!0:a.content&&b&&(!b.isCollapsed()||(c=a.content.characters[b.get()[0]],c&&c.hasTags("a")))?!0:!1},c.isApplied=function(a,b){return"Image"===a.type()?a.a:a.isFixed()&&"a"===a.tagName()?!0:c.__super__.constructor.isApplied.call(this,a,b)},c.apply=function(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;if(u={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",u)){if(g=!1,"Image"===a.type())o=a.domElement().getBoundingClientRect();else if(a.isFixed()&&"a"===a.tagName())o=a.domElement().getBoundingClientRect();else{if(c.isCollapsed()){for(h=a.content.characters,s=c.get(0)[0],k=s;s>0&&h[s-1].hasTags("a");)s-=1;for(;ki;i++)if(e=d[i],a.hasCSSClass(e)){a.removeCSSClass(e),a.a["class"]=e;break}}else{for(h=[],a.a["class"]&&(h=a.a["class"].split(" ")),j=0,m=d.length;m>j;j++)if(e=d[j],h.indexOf(e)>-1){a.addCSSClass(e);break}a.a=null}a.unmount(),a.mount()}else a.isFixed()&&"a"===a.tagName()?a.attr("href",f.href):(a.content=a.content.unformat(l,t,"a"),f.href&&(c=new HTMLString.Tag("a",f),a.content=a.content.format(l,t,c),a.content.optimize()),a.updateInnerHTML());return a.taint(),n.dispatchEvent(n.createEvent("click"))}),f.attach(n),f.attach(i),n.show(),i.show()}},c}(b.Tools.Bold),b.Tools.Heading=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"heading"),c.label="Heading",c.icon="heading",c.tagName="h1",c.canApply=function(a){return a.isFixed()?!1:void 0!==a.content&&-1!==["Text","PreText"].indexOf(a.type())},c.isApplied=function(a){return a.content?-1===["Text","PreText"].indexOf(a.type())?!1:a.tagName()===this.tagName:!1},c.apply=function(a,b,c){var d,e,f,g,h;return h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h)?(a.storeState(),"PreText"===a.type()?(d=a.content.html().replace(/ /g," "),g=new ContentEdit.Text(this.tagName,{},d),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(b)):(a.removeAttr("class"),a.tagName(a.tagName()===this.tagName?"p":this.tagName),a.restoreState()),this.dispatchEditorEvent("tool-applied",h),c(!0)):void 0},c}(b.Tool),b.Tools.Subheading=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"subheading"),c.label="Subheading",c.icon="subheading",c.tagName="h2",c}(b.Tools.Heading),b.Tools.Paragraph=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"paragraph"),c.label="Paragraph",c.icon="paragraph",c.tagName="p",c.canApply=function(a){return a.isFixed()?!1:void 0!==a},c.apply=function(a,d,e){var f,g,h,i;return f=this.editor().ctrlDown(),b.Tools.Heading.canApply(a)&&!f?c.__super__.constructor.apply.call(this,a,d,e):(i={tool:this,element:a,selection:d},this.dispatchEditorEvent("tool-apply",i)?("Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),h=a.parent(),g=new ContentEdit.Text("p"),h.attach(g,h.children.indexOf(a)+1),g.focus(),e(!0),this.dispatchEditorEvent("tool-applied",i)):void 0)},c}(b.Tools.Heading),b.Tools.Preformatted=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"preformatted"),c.label="Preformatted",c.icon="preformatted",c.tagName="pre",c.apply=function(a,c,d){var e,f,g,h,i;return i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i)?"PreText"===a.type()?void b.Tools.Paragraph.apply(a,c,d):(h=a.content.text(),g=new ContentEdit.PreText("pre",{},HTMLString.String.encode(h)),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(c),d(!0),this.dispatchEditorEvent("tool-applied",i)):void 0},c}(b.Tools.Heading),b.Tools.AlignLeft=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"align-left"),c.label="Align left",c.icon="align-left",c.className="text-left",c.canApply=function(a){return void 0!==a.content},c.isApplied=function(a){var b;return this.canApply(a)?(("ListItemText"===(b=a.type())||"TableCellText"===b)&&(a=a.parent()),a.hasCSSClass(this.className)):!1},c.apply=function(a,c,d){var e,f,g,h,i,j;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g)){for(("ListItemText"===(j=a.type())||"TableCellText"===j)&&(a=a.parent()),e=[b.Tools.AlignLeft.className,b.Tools.AlignCenter.className,b.Tools.AlignRight.className],h=0,i=e.length;i>h;h++)if(f=e[h],a.hasCSSClass(f)&&(a.removeCSSClass(f),f===this.className))return d(!0);return a.addCSSClass(this.className),d(!0),this.dispatchEditorEvent("tool-applied",g)}},c}(b.Tool),b.Tools.AlignCenter=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"align-center"),c.label="Align center",c.icon="align-center",c.className="text-center",c}(b.Tools.AlignLeft),b.Tools.AlignRight=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"align-right"),c.label="Align right",c.icon="align-right",c.className="text-right",c}(b.Tools.AlignLeft),b.Tools.UnorderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"unordered-list"),c.label="Bullet list",c.icon="unordered-list",c.listTag="ul",c.canApply=function(a){var b;return a.isFixed()?!1:void 0!==a.content&&("Region"===(b=a.parent().type())||"ListItem"===b)},c.apply=function(a,b,c){var d,e,f,g,h,i;return i={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",i)?("ListItem"===a.parent().type()?(a.storeState(),e=a.closest(function(a){return"List"===a.type()}),e.tagName(this.listTag),a.restoreState()):(g=new ContentEdit.ListItemText(a.content.copy()),f=new ContentEdit.ListItem,f.attach(g),e=new ContentEdit.List(this.listTag,{}),e.attach(f),h=a.parent(),d=h.children.indexOf(a),h.detach(a),h.attach(e,d),g.focus(),g.selection(b)),c(!0),this.dispatchEditorEvent("tool-applied",i)):void 0},c}(b.Tool),b.Tools.OrderedList=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"ordered-list"),c.label="Numbers list",c.icon="ordered-list",c.listTag="ol",c}(b.Tools.UnorderedList),b.Tools.Table=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"table"),c.label="Table",c.icon="table",c.canApply=function(a){return a.isFixed()?!1:void 0!==a},c.apply=function(a,c,d){var e,f,g,h,i;return i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i)?(a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,h=a.closest(function(a){return a&&"Table"===a.type()}),f=new b.TableDialog(h),f.addEventListener("cancel",function(){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}(this)),f.addEventListener("save",function(b){return function(c){var e,j,k,l,m;return l=c.detail(),j=!0,h?(b._updateTable(l,h),j=a.closest(function(a){return a&&"Table"===a.type()})):(h=b._createTable(l),m=b._insertAt(a),k=m[0],e=m[1],k.parent().attach(h,e),j=!1),j?a.restoreState():h.firstSection().children[0].children[0].children[0].focus(),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",i)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()):void 0},c._adjustColumns=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;for(l=a.children,m=[],j=0,k=l.length;k>j;j++)i=l[j],d=i.children[0].tagName(),f=i.children.length,g=b-f,m.push(0>g?function(){var a,b;for(b=[],h=a=g;0>=g?0>a:a>0;h=0>=g?++a:--a)c=i.children[i.children.length-1],b.push(i.detach(c));return b}():g>0?function(){var a,b;for(b=[],h=a=0;g>=0?g>a:a>g;h=g>=0?++a:--a)c=new ContentEdit.TableCell(d),i.attach(c),e=new ContentEdit.TableCellText(""),b.push(c.attach(e));return b}():void 0);return m},c._createTable=function(a){var b,c,d,e;return e=new ContentEdit.Table,a.head&&(d=this._createTableSection("thead","th",a.columns),e.attach(d)),b=this._createTableSection("tbody","td",a.columns),e.attach(b),a.foot&&(c=this._createTableSection("tfoot","td",a.columns),e.attach(c)),e},c._createTableSection=function(a,b,c){var d,e,f,g,h,i;for(h=new ContentEdit.TableSection(a),g=new ContentEdit.TableRow,h.attach(g),f=i=0;c>=0?c>i:i>c;f=c>=0?++i:--i)d=new ContentEdit.TableCell(b),g.attach(d),e=new ContentEdit.TableCellText(""),d.attach(e);return h},c._updateTable=function(a,b){var c,d,e,f,g,h,i;if(!a.head&&b.thead()&&b.detach(b.thead()),!a.foot&&b.tfoot()&&b.detach(b.tfoot()),c=b.firstSection().children[0].children.length,a.columns!==c)for(i=b.children,g=0,h=i.length;h>g;g++)f=i[g],this._adjustColumns(f,a.columns);return a.head&&!b.thead()&&(e=this._createTableSection("thead","th",a.columns),b.attach(e,0)),a.foot&&!b.tfoot()?(d=this._createTableSection("tfoot","td",a.columns),b.attach(d)):void 0},c}(b.Tool),b.Tools.Indent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"indent"),c.label="Indent",c.icon="indent",c.canApply=function(a){return"ListItem"===a.parent().type()&&a.parent().parent().children.indexOf(a.parent())>0},c.apply=function(a,b,c){var d;return d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d)?(a.parent().indent(),c(!0),this.dispatchEditorEvent("tool-applied",d)):void 0},c}(b.Tool),b.Tools.Unindent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"unindent"),c.label="Unindent",c.icon="unindent",c.canApply=function(a){return"ListItem"===a.parent().type()},c.apply=function(a,b,c){var d;return d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d)?(a.parent().unindent(),c(!0),this.dispatchEditorEvent("tool-applied",d)):void 0},c}(b.Tool),b.Tools.LineBreak=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"line-break"),c.label="Line break",c.icon="line-break",c.canApply=function(a){return a.content},c.apply=function(a,b,c){var d,e,f,g,h;return h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h)?(e=b.get()[0]+1,g=a.content.substring(0,b.get()[0]),f=a.content.substring(b.get()[1]),d=new HTMLString.String("
",a.content.preserveWhitespace()),a.content=g.concat(d,f),a.updateInnerHTML(),a.taint(),b.set(e,e),a.selection(b),c(!0),this.dispatchEditorEvent("tool-applied",h)):void 0},c}(b.Tool),b.Tools.Image=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"image"),c.label="Image",c.icon="image",c.canApply=function(a){return a.isFixed()&&"ImageFixture"!==a.type()?!1:!0},c.apply=function(a,c,d){var e,f,g,h;return h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h)?(a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.ImageDialog,f.addEventListener("cancel",function(){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}(this)),f.addEventListener("save",function(b){return function(c){var e,i,j,k,l,m,n,o;return e=c.detail(),l=e.imageURL,k=e.imageSize,j=e.imageAttrs,j||(j={}),j.height=k[1],j.src=l,j.width=k[0],"ImageFixture"===a.type()?a.src(l):(i=new ContentEdit.Image(j),o=b._insertAt(a),n=o[0],m=o[1],n.parent().attach(i,m),i.focus()),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()):void 0},c}(b.Tool),b.Tools.Video=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"video"),c.label="Video",c.icon="video",c.canApply=function(a){return!a.isFixed()},c.apply=function(a,c,d){var e,f,g,h;return h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h)?(a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.VideoDialog,f.addEventListener("cancel",function(){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}(this)),f.addEventListener("save",function(c){return function(e){var i,j,k,l,m,n;return l=e.detail().url,l?(m=new ContentEdit.Video("iframe",{frameborder:0,height:b.DEFAULT_VIDEO_HEIGHT,src:l,width:b.DEFAULT_VIDEO_WIDTH}),n=c._insertAt(a),k=n[0],j=n[1],k.parent().attach(m,j),m.focus()):a.restoreState&&a.restoreState(),g.hide(),f.hide(),i=""!==l,d(i),i?c.dispatchEditorEvent("tool-applied",h):void 0}}(this)),e.attach(g),e.attach(f),g.show(),f.show()):void 0},c}(b.Tool),b.Tools.Undo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"undo"),c.label="Undo",c.icon="undo",c.requiresElement=!1,c.canApply=function(){var a;return a=b.EditorApp.get(),a.history&&a.history.canUndo()},c.apply=function(a,b){var c,d,e;return e={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",e)?(c=this.editor(),c.history.stopWatching(),d=c.history.undo(),c.revertToSnapshot(d),c.history.watch(),this.dispatchEditorEvent("tool-applied",e)):void 0},c}(b.Tool),b.Tools.Redo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"redo"),c.label="Redo",c.icon="redo",c.requiresElement=!1,c.canApply=function(){var a;return a=b.EditorApp.get(),a.history&&a.history.canRedo()},c.apply=function(a,c){var d,e,f;return f={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",f)?(d=b.EditorApp.get(),d.history.stopWatching(),e=d.history.redo(),d.revertToSnapshot(e),d.history.watch(),this.dispatchEditorEvent("tool-applied",f)):void 0},c}(b.Tool),b.Tools.Remove=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return h(c,a),b.ToolShelf.stow(c,"remove"),c.label="Remove",c.icon="remove",c.canApply=function(a){return!a.isFixed()},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h)){if(d=this.editor(),a.blur(),a.nextContent()?a.nextContent().focus():a.previousContent()&&a.previousContent().focus(),!a.isMounted())return c(!0),void this.dispatchEditorEvent("tool-applied",h);switch(a.type()){case"ListItemText":d.ctrlDown()?(e=a.closest(function(a){return"Region"===a.parent().type()}),e.parent().detach(e)):a.parent().parent().detach(a.parent());break;case"TableCellText":d.ctrlDown()?(g=a.closest(function(a){return"Table"===a.type()}),g.parent().detach(g)):(f=a.parent().parent(),f.parent().detach(f));break;default:a.parent().detach(a)}return c(!0),this.dispatchEditorEvent("tool-applied",h)}},c}(b.Tool)}.call(this); \ No newline at end of file +/*! ContentTools v1.6.5 by Anthony Blackshaw (https://github.com/anthonyjb) */ +(function(){var a;a={},a.Machine=function(){function a(a){this.context=a,this._stateTransitions={},this._stateTransitionsAny={},this._defaultTransition=null,this._initialState=null,this._currentState=null}return a.prototype.addTransition=function(a,b,c,d){return c||(c=b),this._stateTransitions[[a,b]]=[c,d]},a.prototype.addTransitions=function(a,b,c,d){var e,f,g,h;for(c||(c=b),h=[],f=0,g=a.length;f-1;for(d=0;d<=this.length()-a.length();){for(c=!0,h=a.characters,e=f=0,g=h.length;ff;c=b<=f?++g:--g)a=d.characters[c],a.addTags.apply(a,e);return d},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h;for(d=2<=arguments.length?A.call(arguments,0,e=arguments.length-1):(e=0,[]),c=arguments[e++],void 0!==c&&"boolean"!=typeof c&&(d.push(c),c=!1),b=!1,h=this.characters,f=0,g=h.length;f0&&a._tags[0].selfClosing()&&(e+=a._tags[0].head()),e+=a.c()}for(w=h.reverse(),s=0,r=w.length;s0)for(f=this.charAt(a-1),g=f.tags(),f.isTag()&&g.shift(),"string"!=typeof b&&(h=h.copy()),q=h.characters,k=0,n=q.length;k0&&a._tags[0].selfClosing()&&e<3||e<2)){k=[],G=a._runLengthMap;for(n in G)i=G[n],k.push(i);for(k.sort(j),H=a._tags.slice(),B=0,y=H.length;B0&&c>b)break;if(-1===(f=this.indexOf(a,h)))break;g.push(f),h=f+1}for(g.push(this.length()),j=[],e=k=0,l=g.length-2;0<=l?k<=l:k>=l;e=0<=l?++k:--k)i=g[e],e>0&&(i+=1),d=g[e+1],j.push(this.slice(i,d));return j},a.prototype.startsWith=function(a){var b,c,d,e,f;if("string"==typeof a)return this.text().slice(0,a.length)===a;for(f=a.characters,c=d=0,e=f.length;df;c=b<=f?++g:--g)a=d.characters[c],a.removeTags.apply(a,e);return d},a.prototype.copy=function(){var a,b;return b=new r.String("",this._preserveWhitespace),b.characters=function(){var b,c,d,e;for(d=this.characters,e=[],b=0,c=d.length;b",x,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],y),this.fsm.addTransition(">",y,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],j),this.fsm.addTransition("/",j,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",j,n,function(){return this._pushTag()}),this.fsm.addTransitions(a,j,g,function(){return this._back()}),this.fsm.addTransitions(u,v,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],v,w),this.fsm.addTransition(">",v,n,function(){return this._popTag()}),this.fsm.addTransitions([" ","\n"],w),this.fsm.addTransition(">",w,n,function(){return this._popTag()}),this.fsm.addTransitions(h,g,null,function(a){return this.attributeName+=a}),this.fsm.addTransitions([" ","\n"],g,i),this.fsm.addTransition("=",g,c),this.fsm.addTransitions([" ","\n"],i),this.fsm.addTransition("=",i,c),this.fsm.addTransitions(">",g,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitionAny(i,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitions([" ","\n"],c),this.fsm.addTransition("'",c,m),this.fsm.addTransition('"',c,k),this.fsm.addTransitions(b.concat(["&"],c,l,function(){return this._back()})),this.fsm.addTransition(" ",l,j,function(){return this._pushAttribute()}),this.fsm.addTransitions(["/",">"],l,j,function(){return this._back(),this._pushAttribute()}),this.fsm.addTransition("&",l,e),this.fsm.addTransitionAny(l,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition("'",m,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",m,f),this.fsm.addTransitionAny(m,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition('"',k,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",k,d),this.fsm.addTransitionAny(k,null,function(a){return this.attributeValue+=a}),this.fsm.addTransitions(q,e,null,function(a){return this.entity+=a}),this.fsm.addTransitions(q,f,function(a){return this.entity+=a}),this.fsm.addTransitions(q,d,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",e,l,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",f,m,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",d,k,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""})}return z.prototype._back=function(){return this.head--},z.prototype._pushAttribute=function(){return this.attributes[this.attributeName]=this.attributeValue,this.attributeName="",this.attributeValue=""},z.prototype._pushChar=function(a){var b,c;return b=new r.Character(a,this.tags),this._preserveWhitespace?void this.string.characters.push(b):!this.string.length()||b.isTag()||b.isEntity()||!b.isWhitespace()||(c=this.string.characters[this.string.length()-1],!c.isWhitespace()||c.isTag()||c.isEntity())?this.string.characters.push(b):void 0},z.prototype._pushTag=function(){var a,b;return a=new r.Tag(this.tagName,this.attributes),this.tags.push(a),a.selfClosing()&&(this._pushChar(""),this.tags.pop(),!this.selfClosed&&(b=this.tagName,B.call(r.Tag.SELF_CLOSING,b)>=0)&&this.fsm.reset()),this.tagName="",this.selfClosed=!1,this.attributes={}},z.prototype._popTag=function(){for(var a,b;;)if(b=this.tags.pop(),this.string.length()&&(a=this.string.characters[this.string.length()-1],a.isTag()||a.isEntity()||!a.isWhitespace()||a.removeTags(b)),b.name()===this.tagName.toLowerCase())break;return this.tagName=""},z.prototype.parse=function(a,b){var c,d;for(this._preserveWhitespace=b,this.reset(),a=this.preprocess(a),this.fsm.parser=this;this.head> "+d)}this.head++}return this.string},z.prototype.preprocess=function(a){return a=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),a=a.replace(//g,""),this._preserveWhitespace||(a=a.replace(/\s+/g," ")),a},z.prototype.reset=function(){return this.fsm.reset(),this.head=0,this.string=new r.String,this.entity="",this.tags=[],this.tagName="",this.selfClosing=!1,this.attributes={},this.attributeName="",this.attributeValue=""},z}(),r.Tag=function(){function a(a,b){var c,d;this._name=a.toLowerCase(),this._selfClosing=!0===r.Tag.SELF_CLOSING[this._name],this._head=null,this._attributes={};for(c in b)d=b[c],this._attributes[c]=d}return a.SELF_CLOSING={area:!0,base:!0,br:!0,hr:!0,img:!0,input:!0,"link meta":!0,wbr:!0},a.prototype.head=function(){var a,b,c,d;if(!this._head){a=[],d=this._attributes;for(b in d)c=d[b],c?a.push(b+'="'+c+'"'):a.push(""+b);a.sort(),a.unshift(this._name),this._head="<"+a.join(" ")+">"}return this._head},a.prototype.name=function(){return this._name},a.prototype.selfClosing=function(){return this._selfClosing},a.prototype.tail=function(){return this._selfClosing?"":""},a.prototype.attr=function(a,b){return void 0===b?this._attributes[a]:(this._attributes[a]=b,this._head=null)},a.prototype.removeAttr=function(a){if(void 0!==this._attributes[a])return delete this._attributes[a],this._head=null},a.prototype.copy=function(){return new r.Tag(this._name,this._attributes)},a}(),r.Character=function(){function a(a,b){this._c=a,a.length>1&&(this._c=a.toLowerCase()),this._tags=[],this.addTags.apply(this,b)}return a.prototype.c=function(){return this._c},a.prototype.isEntity=function(){return this._c.length>1},a.prototype.isTag=function(a){return!(0===this._tags.length||!this._tags[0].selfClosing())&&(!a||this._tags[0].name()===a)},a.prototype.isWhitespace=function(){var a;return" "===(a=this._c)||"\n"===a||" "===a||this.isTag("br")},a.prototype.tags=function(){var a;return function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;b0;)switch(d=f.shift(),d.nodeType){case Node.TEXT_NODE:if(d.textContent.length>=e)return[d,e];e-=d.textContent.length;break;case Node.ELEMENT_NODE:if(i=d.nodeName.toLowerCase(),g.call(b,i)>=0){if(0===e)return[d,0];e=Math.max(0,e-1)}else d.childNodes&&Array.prototype.unshift.apply(f,function(){var a,b,c,e;for(c=d.childNodes,e=[],a=0,b=c.length;a0;){if((h=d.shift())===c)return i=h.nodeName.toLowerCase(),g.call(b,i)>=0?f+1:f;switch(h.nodeType){case Node.TEXT_NODE:f+=h.textContent.length;break;case Node.ELEMENT_NODE:j=h.nodeName.toLowerCase(),g.call(b,j)>=0?f+=1:h.childNodes&&Array.prototype.unshift.apply(d,function(){var a,b,c,d;for(c=h.childNodes,d=[],a=0,b=c.length;a=0&&(l=1);break}if(c.collapsed)return[k,l,k,l];if(f===a)for(f=e[e.length-1],h=f.textContent.length,j=o=0,q=e.length;o-1)?(f.splice(e,1),f.length?a.setAttribute("class",f.join(" ")):a.removeAttribute("class")):void 0)}},"undefined"!=typeof window&&(window.ContentEdit=a),"undefined"!=typeof module&&module.exports&&(module.exports=a),c=function(){function b(){this._tagNames={}}return b.prototype.register=function(){var a,b,c,d,f,g;for(a=arguments[0],c=2<=arguments.length?e.call(arguments,1):[],g=[],d=0,f=c.length;d0)return this.children[0];for(f=[this].concat(this.parents()),d=0,e=f.length;d=0||(this.prototype[b]=c);return this},b.fromDOMElement=function(a){throw new Error("`fromDOMElement` not implemented")},b}(),a.NodeCollection=function(b){function c(){c.__super__.constructor.call(this),this.children=[]}return h(c,b),c.prototype.descendants=function(){var a,b,c;for(a=[],c=this.children.slice();c.length>0;)b=c.shift(),a.push(b),b.children&&b.children.length>0&&(c=b.children.slice().concat(c));return a},c.prototype.isMounted=function(){return!1},c.prototype.type=function(){return"NodeCollection"},c.prototype.attach=function(b,c){return b.parent()&&b.parent().detach(b),b._parent=this,void 0!==c?this.children.splice(c,0,b):this.children.push(b),b.mount&&this.isMounted()&&b.mount(),this.taint(),a.Root.get().trigger("attach",this,b)},c.prototype.commit=function(){var b,c,d,e;for(e=this.descendants(),c=0,d=e.length;c-1))},c.prototype.merge=function(a){return!(!this.can("merge")||!this.can("remove"))&&(this.constructor.mergers[a.type()]?this.constructor.mergers[a.type()](a,this):a.constructor.mergers[this.type()]?a.constructor.mergers[this.type()](a,this):void 0)},c.prototype.mount=function(){var b;return this._domElement||(this._domElement=document.createElement(this.tagName())),b=this.nextSibling(),b?this.parent().domElement().insertBefore(this._domElement,b.domElement()):this.isFixed()?(this.parent().domElement().parentNode.replaceChild(this._domElement,this.parent().domElement()),this.parent()._domElement=this._domElement):this.parent().domElement().appendChild(this._domElement),this._addDOMEventListeners(),this._addCSSClass("ce-element"),this._addCSSClass("ce-element--type-"+this.cssTypeName()),this.isFocused()&&this._addCSSClass("ce-element--focused"),a.Root.get().trigger("mount",this)},c.prototype.removeAttr=function(a){if(a=a.toLowerCase(),this._attributes[a])return delete this._attributes[a],this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.removeAttribute(a),this.taint()},c.prototype.removeCSSClass=function(a){var b,c,d;if(this.hasCSSClass(a))return d=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;a-1&&d.splice(c,1),d.length?this.attr("class",d.join(" ")):this.removeAttr("class"),this._removeCSSClass(a),this.taint()},c.prototype.tagName=function(a){return void 0===a?this._tagName:(this._tagName=a.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){return this._removeDOMEventListeners(),this.isFixed()?(this._removeCSSClass("ce-element"),this._removeCSSClass("ce-element--type-"+this.cssTypeName()),void this._removeCSSClass("ce-element--focused")):(this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,a.Root.get().trigger("unmount",this))},c.prototype._addDOMEventListeners=function(){var a,b,c,d;this._domEventHandlers={dragstart:function(a){return function(a){return a.preventDefault()}}(),focus:function(a){return function(a){return a.preventDefault()}}(),keydown:function(a){return function(b){return a._onKeyDown(b)}}(this),keyup:function(a){return function(b){return a._onKeyUp(b)}}(this),mousedown:function(a){return function(b){if(0===b.button)return a._onMouseDown(b)}}(this),mousemove:function(a){return function(b){return a._onMouseMove(b)}}(this),mouseover:function(a){return function(b){return a._onMouseOver(b)}}(this),mouseout:function(a){return function(b){return a._onMouseOut(b)}}(this),mouseup:function(a){return function(b){if(0===b.button)return a._onMouseUp(b)}}(this),dragover:function(a){return function(a){return a.preventDefault()}}(),drop:function(a){return function(b){return a._onNativeDrop(b)}}(this),paste:function(a){return function(b){return a._onPaste(b)}}(this)},c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.addEventListener(b,a));return d},c.prototype._onKeyDown=function(a){},c.prototype._onKeyUp=function(a){},c.prototype._onMouseDown=function(a){if(this.focus)return this.focus(!0)},c.prototype._onMouseMove=function(a){return this._onOver(a)},c.prototype._onMouseOver=function(a){return this._onOver(a)},c.prototype._onMouseOut=function(b){var c;if(this._removeCSSClass("ce-element--over"),c=a.Root.get(),c.dragging())return this._removeCSSClass("ce-element--drop"),this._removeCSSClass("ce-element--drop-above"),this._removeCSSClass("ce-element--drop-below"),this._removeCSSClass("ce-element--drop-center"),this._removeCSSClass("ce-element--drop-left"),this._removeCSSClass("ce-element--drop-right"),c._dropTarget=null},c.prototype._onMouseUp=function(a){return this._ieMouseDownEchoed=!1},c.prototype._onNativeDrop=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("native-drop",this,b)},c.prototype._onPaste=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("paste",this,b)},c.prototype._onOver=function(b){var c,d;if(this._addCSSClass("ce-element--over"),d=a.Root.get(),(c=d.dragging())&&c!==this&&!d._dropTarget&&this.can("drop")&&(this.constructor.droppers[c.type()]||c.constructor.droppers[this.type()]))return this._addCSSClass("ce-element--drop"),d._dropTarget=this},c.prototype._removeDOMEventListeners=function(){var a,b,c,d;c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.removeEventListener(b,a));return d},c.prototype._addCSSClass=function(b){if(this.isMounted())return a.addCSSClass(this._domElement,b)},c.prototype._attributesToString=function(){return Object.getOwnPropertyNames(this._attributes).length>0?" "+a.attributesToString(this._attributes):""},c.prototype._removeCSSClass=function(b){if(this.isMounted())return a.removeCSSClass(this._domElement,b)},c.droppers={},c.mergers={},c.placements=["above","below"],c.getDOMElementAttributes=function(a){var b,c,d,e,f;if(!a.hasAttributes())return{};for(c={},f=a.attributes,d=0,e=f.length;da.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.detach=function(b){if(a.NodeCollection.prototype.detach.call(this,b),0===this.children.length&&this.parent())return this.parent().detach(this)},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),e=function(){var c,e,f,g;for(f=this.children,g=[],c=0,e=f.length;c"+f+e.join(f)+f+b+"")},c.prototype.mount=function(){var a,b,d,e,f,g,h,i;this._domElement=document.createElement(this._tagName),g=this._attributes;for(b in g)d=g[b],this._domElement.setAttribute(b,d);for(c.__super__.mount.call(this),h=this.children,i=[],e=0,f=h.length;ef.height-e&&(d=["bottom","left"]):b>f.width-e&&(cf.height-e&&(d=["bottom","right"])),d},c.prototype._getSizeInfo=function(){var a;return a=this.size(),"w "+a[0]+" × h "+a[1]},c}(a.Element),a.Region=function(b){function c(a){c.__super__.constructor.call(this),this._domElement=a,this.setContent(a)}return h(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Region"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;ae.width-a.DROP_EDGE_SIZE&&(d="right"),f="above",c>e.height/2&&(f="below"),[f,d]):null},c.prototype._onDrag=function(a){var b,c,d;if(ContentSelect.Range.unselectAll(),this._draggingDOMElement.style.left=a.pageX+"px",this._draggingDOMElement.style.top=a.pageY+"px",this._dropTarget&&(b=this._getDropPlacement(a.clientX,a.clientY),this._dropTarget._removeCSSClass("ce-element--drop-above"),this._dropTarget._removeCSSClass("ce-element--drop-below"),this._dropTarget._removeCSSClass("ce-element--drop-center"),this._dropTarget._removeCSSClass("ce-element--drop-left"),this._dropTarget._removeCSSClass("ce-element--drop-right"),c=b[0],f.call(this._dragging.constructor.placements,c)>=0&&this._dropTarget._addCSSClass("ce-element--drop-"+b[0]),d=b[1],f.call(this._dragging.constructor.placements,d)>=0))return this._dropTarget._addCSSClass("ce-element--drop-"+b[1])},c.prototype._onStopDragging=function(a){var b;return b=this._getDropPlacement(a.clientX,a.clientY),this._dragging.drop(this._dropTarget,b),this.cancelDragging()},c.prototype.startResizing=function(b,c,d,e,f){var g,h;if(!this._resizing)return this._resizing=b,this._resizingInit={corner:c,fixed:f,origin:[d,e],size:b.size()},this._resizing._addCSSClass("ce-element--resizing"),h=this._resizing.parent().domElement(),g=document.createElement("div"),g.setAttribute("class","ce-measure"),h.appendChild(g),this._resizingParentWidth=g.getBoundingClientRect().width,h.removeChild(g),document.addEventListener("mousemove",this._onResize),document.addEventListener("mouseup",this._onStopResizing),a.addCSSClass(document.body,"ce--resizing")},c.prototype._onResize=function(a){var b,c,d,e;return ContentSelect.Range.unselectAll(),d=this._resizingInit.origin[0]-a.clientX,"right"===this._resizingInit.corner[1]&&(d=-d),c=this._resizingInit.size[0]+d,c=Math.min(c,this._resizingParentWidth),this._resizingInit.fixed?b=c*this._resizing.aspectRatio():(e=this._resizingInit.origin[1]-a.clientY,"bottom"===this._resizingInit.corner[0]&&(e=-e),b=this._resizingInit.size[1]+e),this._resizing.size([c,b])},c.prototype._onStopResizing=function(b){return document.removeEventListener("mousemove",this._onResize),document.removeEventListener("mouseup",this._onStopResizing),this._resizing._removeCSSClass("ce-element--resizing"),this._resizing=null,this._resizingInit=null,this._resizingParentWidth=null,a.removeCSSClass(document.body,"ce--resizing")},c}(a.Node),a.Root=function(){function a(){}var c;return c=null,a.get=function(){return null!=c?c:c=new b},a}(),a.Static=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._content=d}return h(c,b),c.prototype.cssTypeName=function(){return"static"},c.prototype.type=function(){return"Static"},c.prototype.typeName=function(){return"Static"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.html=function(a){return null==a&&(a=""),HTMLString.Tag.SELF_CLOSING[this._tagName]?a+"<"+this._tagName+this._attributesToString()+">":a+"<"+this._tagName+this._attributesToString()+">"+this._content+a+""},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this._domElement.innerHTML=this._content,c.__super__.mount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c.prototype._onMouseDown=function(a){if(c.__super__._onMouseDown.call(this,a),void 0!==this.attr("data-ce-moveable"))return clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._onMouseUp=function(a){if(c.__super__._onMouseUp.call(this,a),this._dragTimeout)return clearTimeout(this._dragTimeout)},c.droppers={Static:a.Element._dropVert},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Element),a.TagNames.get().register(a.Static,"static"),a.Text=function(b){function c(b,d,e){c.__super__.constructor.call(this,b,d),e instanceof HTMLString.String?this.content=e:a.TRIM_WHITESPACE?this.content=new HTMLString.String(e).trim():this.content=new HTMLString.String(e,!0)}return h(c,b),c.prototype.cssTypeName=function(){return"text"},c.prototype.type=function(){return"Text"},c.prototype.typeName=function(){return"Text"},c.prototype.blur=function(){return this.isMounted()&&this._syncContent(),this.content.isWhitespace()&&this.can("remove")?this.parent()&&this.parent().detach(this):this.isMounted()&&(document.documentMode||/Edge/.test(navigator.userAgent)||this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.__super__.blur.call(this)},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=HTMLString.String.encode(this._domElement.textContent),d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.drag=function(a,b){return this.storeState(),this._domElement.removeAttribute("contenteditable"),c.__super__.drag.call(this,a,b)},c.prototype.drop=function(a,b){return c.__super__.drop.call(this,a,b),this.restoreState()},c.prototype.focus=function(a){return this.isMounted()&&this._domElement.setAttribute("contenteditable",""),c.__super__.focus.call(this,a)},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),(!this._lastCached||this._lastCached"+e+b+a.INDENT+this._cached+e+b+""},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this.updateInnerHTML(),c.__super__.mount.call(this)},c.prototype.restoreState=function(){if(this._savedSelection)return this.isMounted()&&this.isFocused()?(this._domElement.setAttribute("contenteditable",""),this._addCSSClass("ce-element--focused"),document.activeElement!==this.domElement()&&this.domElement().focus(),this._savedSelection.select(this._domElement),this._savedSelection=void 0):void(this._savedSelection=void 0)},c.prototype.selection=function(a){return void 0===a?this.isMounted()?ContentSelect.Range.query(this._domElement):new ContentSelect.Range(0,0):a.select(this._domElement)},c.prototype.storeState=function(){if(this.isMounted()&&this.isFocused())return this._savedSelection=ContentSelect.Range.query(this._domElement)},c.prototype.unmount=function(){return this._domElement.removeAttribute("contenteditable"),c.__super__.unmount.call(this)},c.prototype.updateInnerHTML=function(){return this._domElement.innerHTML=this.content.html(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._onKeyDown=function(a){switch(a.keyCode){case 40:return this._keyDown(a);case 37:return this._keyLeft(a);case 39:return this._keyRight(a);case 38:return this._keyUp(a);case 9:return this._keyTab(a);case 8:return this._keyBack(a);case 46:return this._keyDelete(a);case 13:return this._keyReturn(a)}},c.prototype._onKeyUp=function(a){return c.__super__._onKeyUp.call(this,a),this._syncContent()},c.prototype._onMouseDown=function(b){if(c.__super__._onMouseDown.call(this,b),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(a){return function(){return a.drag(b.pageX,b.pageY)}}(this),a.DRAG_HOLD_DURATION),0===this.content.length()&&a.Root.get().focused()===this)return b.preventDefault(),document.activeElement!==this._domElement&&this._domElement.focus(),new ContentSelect.Range(0,0).select(this._domElement)},c.prototype._onMouseMove=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseMove.call(this,a)},c.prototype._onMouseOut=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseOut.call(this,a)},c.prototype._onMouseUp=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseUp.call(this,a)},c.prototype._keyBack=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),0===c.get()[0]&&c.isCollapsed())return a.preventDefault(),b=this.previousContent(),this._syncContent(),b?b.merge(this):void 0},c.prototype._keyDelete=function(a){var b,c;if(c=ContentSelect.Range.query(this._domElement),this._atEnd(c)&&c.isCollapsed())return a.preventDefault(),b=this.nextContent(),b?this.merge(b):void 0},c.prototype._keyDown=function(a){return this._keyRight(a)},c.prototype._keyLeft=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),0===d.get()[0]&&d.isCollapsed())return b.preventDefault(),c=this.previousContent(),c?(c.focus(),d=new ContentSelect.Range(c.content.length(),c.content.length()),d.select(c.domElement())):a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;if(b.preventDefault(),!(this.content.isWhitespace()&&!b.shiftKey^a.PREFER_LINE_BREAKS)){if(f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),b.shiftKey^a.PREFER_LINE_BREAKS)return d=f.get()[0],e="
",this.content.length()===d&&(0!==this.content.length()&&this.content.characters[d-1].isTag("br")||(e="

")),this.content=this.content.insert(d,new HTMLString.String(e,!0),!0),this.updateInnerHTML(),d+=1,f=new ContentSelect.Range(d,d),f.select(this.domElement()),void this.taint();if(this.can("spawn"))return this.content=h.trim(),this.updateInnerHTML(),c=new this.constructor("p",{},g.trim()),this.parent().attach(c,this.parent().children.indexOf(this)+1),h.length()?(c.focus(),f=new ContentSelect.Range(0,0),f.select(c.domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint()}},c.prototype._keyRight=function(b){var c,d;if(d=ContentSelect.Range.query(this._domElement),this._atEnd(d)&&d.isCollapsed())return b.preventDefault(),c=this.nextContent(),c?(c.focus(),d=new ContentSelect.Range(0,0),d.select(c.domElement())):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyTab=function(b){if(b.preventDefault(),this.isFixed())return b.shiftKey?a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()})):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))},c.prototype._keyUp=function(a){return this._keyLeft(a)},c.prototype._atEnd=function(a){return a.get()[0]>=this.content.length()},c.prototype._flagIfEmpty=function(){return 0===this.content.length()?this._addCSSClass("ce-element--empty"):this._removeCSSClass("ce-element--empty")},c.prototype._syncContent=function(a){var b,c;return c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML,this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.droppers={Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={Text:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&b.updateInnerHTML(),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),a.parent()&&a.parent().detach(a),b.taint()}},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML.replace(/^\s+|\s+$/g,""))},c}(a.Element),a.TagNames.get().register(a.Text,"address","blockquote","h1","h2","h3","h4","h5","h6","p"),a.PreText=function(b){function c(b,c,d){d instanceof HTMLString.String?this.content=d:this.content=new HTMLString.String(d,!0),a.Element.call(this,b,c)}return h(c,b),c.TAB_INDENT=" ",c.prototype.cssTypeName=function(){return"pre-text"},c.prototype.type=function(){return"PreText"},c.prototype.typeName=function(){return"Preformatted"},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.innerHTML=this.content.html()),c.__super__.blur.call(this)},c.prototype.html=function(a){var b;return null==a&&(a=""),(!this._lastCached||this._lastCached"+this._cached+""},c.prototype.updateInnerHTML=function(){var a;return a=this.content.html(),this._domElement.innerHTML=a,this._ensureEndZWS(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._keyBack=function(a){var b;return b=ContentSelect.Range.query(this._domElement),b.get()[0]<=this.content.length()?c.__super__._keyBack.call(this,a):(b.set(this.content.length(),this.content.length()),b.select(this._domElement))},c.prototype._keyReturn=function(a){var b,c,d,e;return a.preventDefault(),c=ContentSelect.Range.query(this._domElement),b=c.get()[0]+1,0===c.get()[0]&&c.isCollapsed()?this.content=new HTMLString.String("\n",!0).concat(this.content):this._atEnd(c)&&c.isCollapsed()?this.content=this.content.concat(new HTMLString.String("\n",!0)):0===c.get()[0]&&c.get()[1]===this.content.length()?(this.content=new HTMLString.String("\n",!0),b=0):(e=this.content.substring(0,c.get()[0]),d=this.content.substring(c.get()[1]),this.content=e.concat(new HTMLString.String("\n",!0),d)),this.updateInnerHTML(),c.set(b,b),c.select(this._domElement),this.taint()},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;for(b.preventDefault(),c=this.content.length(),k=a.PreText.TAB_INDENT,j=k.length,o=this.content.split("\n"),p=this.selection().get(),p[0]=Math.min(p[0],c),p[1]=Math.min(p[1],c),e=0,s=-1,f=-1,h=v=0,z=o.length;v-1&&f>-1));h=++v)e+=n;if(s===f)j-=(p[0]-e)%j,i=new HTMLString.String(Array(j+1).join(" "),!0),u=o[s].substring(0,p[0]-e),t=o[s].substring(p[1]-e),o[s]=u.concat(i,t),r=j;else if(b.shiftKey){for(g=0,h=w=s;s<=f?w<=f:w>=f;h=s<=f?++w:--w){for(B=o[h].characters.slice(),l=x=0,A=B.length;xj-1))&&d.isWhitespace();l=++x)o[h].characters.shift();h===s&&(g=l)}r=Math.max(-j,-g)}else{for(i=new HTMLString.String(k,!0),h=y=s;s<=f?y<=f:y>=f;h=s<=f?++y:--y)o[h]=i.concat(o[h]);r=j}return this.content=HTMLString.String.join(new HTMLString.String("\n",!0),o),this.updateInnerHTML(),q=this.content.length()-c,new ContentSelect.Range(p[0]+r,p[1]+q).select(this._domElement)},c.prototype._syncContent=function(a){var b,c;return this._ensureEndZWS(),c=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g,""),this.content.preserveWhitespace()),b=this.content.html(),c!==b&&this.taint(),this._flagIfEmpty()},c.prototype._ensureEndZWS=function(){var a,b;if(this._domElement.lastChild&&(a=this._domElement.innerHTML,!("​"===a[a.length-1]&&a.indexOf("​")-1&&(b._domElement.innerHTML=a.replace(/\u200B/g,"")),b._domElement.lastChild.textContent+="​"}}(this),this._savedSelection?b():(this.storeState(),b(),this.restoreState())},c.droppers={PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Text),a.TagNames.get().register(a.PreText,"pre"),a.Image=function(b){function c(a,b){var d;c.__super__.constructor.call(this,"img",a),this.a=b||null,d=this.size(),this._aspectRatio=d[1]/d[0]}return h(c,b),c.prototype.cssTypeName=function(){return"image"},c.prototype.type=function(){return"Image"},c.prototype.typeName=function(){return"Image"},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.style.backgroundImage="url('"+this._attributes.src+"')",a},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),d=b+"",this.a?(e=a.LINE_ENDINGS,c=a.attributesToString(this.a),c+=' data-ce-tag="img"',b+""+e+a.INDENT+d+e+b+""):d},c.prototype.mount=function(){var a,b;return this._domElement=document.createElement("div"),a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),b=this._attributes.style?this._attributes.style:"",b+="background-image:url('"+this._attributes.src+"');",this._attributes.width&&(b+="width:"+this._attributes.width+"px;"),this._attributes.height&&(b+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",b),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("a, img"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i,j;if(b=null,"a"===a.tagName.toLowerCase()){ +for(b=this.getDOMElementAttributes(a),f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b",b+"<"+this.tagName()+" "+d+">"+f+a.INDENT+e+f+b+""},c.prototype.mount=function(){var a,b,d,e,f;this._domElement=document.createElement(this.tagName()),f=this._attributes;for(b in f)e=f[b],"alt"!==b&&"style"!==b&&this._domElement.setAttribute(b,e);return a="",this.a&&this.a.class&&(a+=" "+this.a.class),this._attributes.class&&(a+=" "+this._attributes.class),this._domElement.setAttribute("class",a),d=this._attributes.style?this._attributes.style:"",d=d.replace(/background-image:.+?(;|$)/i,""),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._domElement.setAttribute("style",d.trim()),c.__super__.mount.call(this)},c.prototype.src=function(a){return void 0===a?this._src:(this._src=a.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){var a,b;return this.isFixed()?(b=document.createElement("div"),b.innerHTML=this.html(),a=b.firstElementChild,this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a,this.parent()._domElement=this._domElement):c.__super__.unmount.call(this)},c.prototype._attributesToString=function(){var b,c,d,e,f;this._attributes.style?(d=this._attributes.style?this._attributes.style:"",d=d.replace(/background-image:.+?(;|$)/i,""),d=[d.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._attributes.style=d.trim()):this._attributes.style="background-image:url('"+this.src()+"');",b={},f=this._attributes;for(c in f)e=f[c],"alt"!==c&&(b[c]=e);return" "+a.attributesToString(b)},c.droppers={ImageFixture:a.Element._dropVert,Image:a.Element._dropVert,PreText:a.Element._dropVert,Text:a.Element._dropVert},c.fromDOMElement=function(a){var b,c,d,e,f,g,h,i;for(a.tagName,c=this.getDOMElementAttributes(a),g="",b="",f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;b80&&(a=a.substr(0,80)+"..."),a},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.innerHTML=this._title(),a},c.prototype.html=function(b){var c,d,e,f,g,h,i;if(null==b&&(b=""),d=a.LINE_ENDINGS,"video"===this.tagName()){for(f=[],i=this.sources,g=0,h=i.length;g");return b+""+d+f.join(d)+d+b+""}return b+"<"+this._tagName+this._attributesToString()+">"},c.prototype.mount=function(){var a;return this._domElement=document.createElement("div"),this.a&&this.a.class?this._domElement.setAttribute("class",this.a.class):this._attributes.class&&this._domElement.setAttribute("class",this._attributes.class),a=this._attributes.style?this._attributes.style:"",this._attributes.width&&(a+="width:"+this._attributes.width+"px;"),this._attributes.height&&(a+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",a),this._domElement.setAttribute("data-ce-title",this._title()),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("iframe"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth,Video:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g;for(d=function(){var c,d,e,f;for(e=a.childNodes,f=[],c=0,d=e.length;c0?this.children[0]:null},c.prototype.type=function(){return"ListItem"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+""],this.listItemText()&&c.push(this.listItemText().html(b+a.INDENT)),this.list()&&c.push(this.list().html(b+a.INDENT)),c.push(b+""),c.join(a.LINE_ENDINGS)},c.prototype.indent=function(){var b;if(this.can("indent")&&0!==this.parent().children.indexOf(this))return b=this.previousSibling(),b.list()||b.attach(new a.List(b.parent().tagName())),this.listItemText().storeState(),this.parent().detach(this),b.list().attach(this),this.listItemText().restoreState()},c.prototype.remove=function(){var a,b,c,d,e,f;if(this.parent()){if(c=this.parent().children.indexOf(this),this.list())for(f=this.list().children.slice(),b=d=0,e=f.length;d0)for(i._getChild("tbody")||i.attach(new a.TableSection("tbody")),l=0,n=f.length;l0)return!1;return!0},c.prototype.type=function(){return"TableRow"},c.prototype.typeName=function(){return"Table row"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={TableRow:a.Element._dropVert},c.fromDOMElement=function(b){var c,d,e,f,g,h,i;for(f=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;a0?this.children[0]:null},c.prototype.type=function(){return"TableCell"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[b+"<"+this.tagName()+this._attributesToString()+">"],this.tableCellText()&&c.push(this.tableCellText().html(b+a.INDENT)),c.push(b+""),c.join(a.LINE_ENDINGS)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d;return c=new this(b.tagName,this.getDOMElementAttributes(b)),d=new a.TableCellText(b.innerHTML.replace(/^\s+|\s+$/g,"")),c.attach(d),c},c}(a.ElementCollection),a.TableCellText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return h(c,b),c.prototype.cssTypeName=function(){return"table-cell-text"},c.prototype.type=function(){return"TableCellText"},c.prototype._isInFirstRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.firstSection()&&b===c.children[0]},c.prototype._isInLastRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c===d.lastSection()&&b===c.children[c.children.length-1]},c.prototype._isLastInSection=function(){var a,b,c;return a=this.parent(),b=a.parent(),c=b.parent(),b===c.children[c.children.length-1]&&a===b.children[b.children.length-1]},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCached0&&d.setAttribute("class",a.join(" ")),b)for(e in b)f=b[e],d.setAttribute(e,f);return c&&(d.innerHTML=c),d},a}(),b.WidgetUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.attach=function(a,c){if(b.__super__.attach.call(this,a,c),!this.isMounted())return a.mount()},b.prototype.detach=function(a){if(b.__super__.detach.call(this,a),this.isMounted())return a.unmount()},b.prototype.detatch=function(a){return console.log("Please call detach, detatch will be removed in release 1.4.x"),this.detach(a)},b.prototype.show=function(){var a;return this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null,this.unmount()),this.isMounted()||this.mount(),a=function(a){return function(){return a.addCSSClass("ct-widget--active"),a._showTimeout=null}}(this),this._showTimeout=setTimeout(a,100)},b.prototype.hide=function(){var a;if(this._showTimeout&&(clearTimeout(this._showTimeout),this._showTimeout=null),this.removeCSSClass("ct-widget--active"),a=function(b){return function(){return b._hideTimeout=null,window.getComputedStyle?parseFloat(window.getComputedStyle(b._domElement).opacity)<.01?b.unmount():b._hideTimeout=setTimeout(a,250):void b.unmount()}}(this),this.isMounted())return this._hideTimeout=setTimeout(a,250)},b}(b.ComponentUI),b.AnchoredComponentUI=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.mount=function(a,b){return null==b&&(b=null),a.insertBefore(this._domElement,b),this._addDOMEventListeners()},b}(b.ComponentUI),b.Event=function(){function a(a,b){this._name=a,this._detail=b,this._timeStamp=Date.now(),this._defaultPrevented=!1,this._propagationStopped=!1}return a.prototype.defaultPrevented=function(){return this._defaultPrevented},a.prototype.detail=function(){return this._detail},a.prototype.name=function(){return this._name},a.prototype.propagationStopped=function(){return this._propagationStopped},a.prototype.timeStamp=function(){return this._timeStamp},a.prototype.preventDefault=function(){return this._defaultPrevented=!0},a.prototype.stopImmediatePropagation=function(){return this._propagationStopped=!0},a}(),b.FlashUI=function(a){function c(a){c.__super__.constructor.call(this),this.mount(a)}return g(c,a),c.prototype.mount=function(a){var d;return this._domElement=this.constructor.createDiv(["ct-flash","ct-flash--active","ct-flash--"+a,"ct-widget","ct-widget--active"]),c.__super__.mount.call(this,b.EditorApp.get().domElement()),d=function(a){return function(){return window.getComputedStyle?parseFloat(window.getComputedStyle(a._domElement).opacity)<.01?a.unmount():setTimeout(d,250):void a.unmount()}}(this),setTimeout(d,250)},c}(b.AnchoredComponentUI),b.IgnitionUI=function(a){function b(){b.__super__.constructor.call(this),this._revertToState="ready",this._state="ready"}return g(b,a),b.prototype.busy=function(a){if(this.dispatchEvent(this.createEvent("busy",{busy:a}))){if(a===("busy"===this._state))return;return a?(this._revertToState=this._state,this.state("busy")):this.state(this._revertToState)}},b.prototype.cancel=function(){if(this.dispatchEvent(this.createEvent("cancel")))return this.state("ready")},b.prototype.confirm=function(){if(this.dispatchEvent(this.createEvent("confirm")))return this.state("ready")},b.prototype.edit=function(){if(this.dispatchEvent(this.createEvent("edit")))return this.state("editing")},b.prototype.mount=function(){return b.__super__.mount.call(this),this._domElement=this.constructor.createDiv(["ct-widget","ct-ignition","ct-ignition--ready"]),this.parent().domElement().appendChild(this._domElement),this._domEdit=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--edit"]),this._domElement.appendChild(this._domEdit),this._domConfirm=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--confirm"]),this._domElement.appendChild(this._domConfirm),this._domCancel=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--cancel"]),this._domElement.appendChild(this._domCancel),this._domBusy=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--busy"]),this._domElement.appendChild(this._domBusy),this._addDOMEventListeners()},b.prototype.state=function(a){if(void 0===a)return this._state;if(this._state!==a&&this.dispatchEvent(this.createEvent("statechange",{state:a})))return this._state=a,this.removeCSSClass("ct-ignition--busy"),this.removeCSSClass("ct-ignition--editing"),this.removeCSSClass("ct-ignition--ready"), +"busy"===this._state?this.addCSSClass("ct-ignition--busy"):"editing"===this._state?this.addCSSClass("ct-ignition--editing"):"ready"===this._state?this.addCSSClass("ct-ignition--ready"):void 0},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domEdit=null,this._domConfirm=null,this._domCancel=null},b.prototype._addDOMEventListeners=function(){return this._domEdit.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.edit()}}(this)),this._domConfirm.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.confirm()}}(this)),this._domCancel.addEventListener("click",function(a){return function(b){return b.preventDefault(),a.cancel()}}(this))},b}(b.WidgetUI),b.InspectorUI=function(a){function c(){c.__super__.constructor.call(this),this._tagUIs=[]}return g(c,a),c.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-inspector"]),this.parent().domElement().appendChild(this._domElement),this._domTags=this.constructor.createDiv(["ct-inspector__tags","ct-tags"]),this._domElement.appendChild(this._domTags),this._domCounter=this.constructor.createDiv(["ct-inspector__counter"]),this._domElement.appendChild(this._domCounter),this.updateCounter(),this._addDOMEventListeners(),this._handleFocusChange=function(a){return function(){return a.updateTags()}}(this),ContentEdit.Root.get().bind("blur",this._handleFocusChange),ContentEdit.Root.get().bind("focus",this._handleFocusChange),ContentEdit.Root.get().bind("mount",this._handleFocusChange)},c.prototype.unmount=function(){return c.__super__.unmount.call(this),this._domTags=null,ContentEdit.Root.get().unbind("blur",this._handleFocusChange),ContentEdit.Root.get().unbind("focus",this._handleFocusChange),ContentEdit.Root.get().unbind("mount",this._handleFocusChange)},c.prototype.updateCounter=function(){var a,c,d,e,f,g,h,i,j,k,l;if(this.isMounted()){for(c="",l=b.EditorApp.get().orderedRegions(),j=0,k=l.length;j]*>/gi,""),c=c.replace(/[\u200B]+/,""),c=c.replace(/['";:,.?¿\-!¡]+/g,""),i=(c.match(/\S+/g)||[]).length,i=i.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),(d=ContentEdit.Root.get().focused())&&"PreText"===d.type()&&d.selection().isCollapsed())?(e=0,a=1,h=d.content.substring(0,d.selection().get()[0]),f=h.text().split("\n"),e=f.length,a=f[f.length-1].length+1,e=e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),a=a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),this._domCounter.textContent=i+" / "+e+":"+a):void(this._domCounter.textContent=i)}},c.prototype.updateTags=function(){var a,c,d,e,f,g,h,i,j;for(a=ContentEdit.Root.get().focused(),i=this._tagUIs,e=0,g=i.length;ewindow.innerWidth&&(this._domElement.style.left=window.innerWidth-a.width+"px"),a.top+a.height>window.innerHeight&&(this._domElement.style.top=window.innerHeight-a.height+"px"),a.left<0&&(this._domElement.style.left="0px"),a.top<0&&(this._domElement.style.top="0px"),a=this._domElement.getBoundingClientRect(),window.localStorage.setItem("ct-toolbox-position",a.left+","+a.top)},c.prototype._removeDOMEventListeners=function(){return this.isMounted()&&this._domGrip.removeEventListener("mousedown",this._onStartDragging),window.removeEventListener("keydown",this._handleKeyDown),window.removeEventListener("resize",this._handleResize),clearInterval(this._updateToolsInterval)},c.prototype._onDrag=function(a){return ContentSelect.Range.unselectAll(),this._domElement.style.left=a.clientX-this._draggingOffset.x+"px",this._domElement.style.top=a.clientY-this._draggingOffset.y+"px"},c.prototype._onStartDragging=function(a){var b;if(a.preventDefault(),!this.isDragging())return this._dragging=!0,this.addCSSClass("ct-toolbox--dragging"),b=this._domElement.getBoundingClientRect(),this._draggingOffset={x:a.clientX-b.left,y:a.clientY-b.top},document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),ContentEdit.addCSSClass(document.body,"ce--dragging")},c.prototype._onStopDragging=function(a){if(this.isDragging())return this._contain(),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._draggingOffset=null,this._dragging=!1,this.removeCSSClass("ct-toolbox--dragging"),ContentEdit.removeCSSClass(document.body,"ce--dragging")},c}(b.WidgetUI),b.ToolUI=function(a){function b(a){this._onMouseUp=h(this._onMouseUp,this),this._onMouseLeave=h(this._onMouseLeave,this),this._onMouseDown=h(this._onMouseDown,this),this._addDOMEventListeners=h(this._addDOMEventListeners,this),b.__super__.constructor.call(this),this.tool=a,this._mouseDown=!1,this._disabled=!1}return g(b,a),b.prototype.apply=function(a,b){var c,d;if(this.tool.canApply(a,b))return d={element:a,selection:b},c=function(a){return function(b){if(b)return a.dispatchEvent(a.createEvent("applied",d))}}(this),this.dispatchEvent(this.createEvent("apply",d))?this.tool.apply(a,b,c):void 0},b.prototype.disabled=function(a){if(void 0===a)return this._disabled;if(this._disabled!==a)return this._disabled=a,a?(this._mouseDown=!1,this.addCSSClass("ct-tool--disabled"),this.removeCSSClass("ct-tool--applied")):this.removeCSSClass("ct-tool--disabled")},b.prototype.mount=function(a,c){return null==c&&(c=null),this._domElement=this.constructor.createDiv(["ct-tool","ct-tool--"+this.tool.icon]),this._domElement.setAttribute("data-ct-tooltip",ContentEdit._(this.tool.label)),b.__super__.mount.call(this,a,c)},b.prototype.update=function(a,b){return(!this.tool.requiresElement||a&&a.isMounted())&&this.tool.canApply(a,b)?(this.disabled(!1),this.tool.isApplied(a,b)?this.addCSSClass("ct-tool--applied"):this.removeCSSClass("ct-tool--applied")):void this.disabled(!0)},b.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown),this._domElement.addEventListener("mouseleave",this._onMouseLeave),this._domElement.addEventListener("mouseup",this._onMouseUp)},b.prototype._onMouseDown=function(a){if(a.preventDefault(),!this.disabled())return this._mouseDown=!0,this.addCSSClass("ct-tool--down")},b.prototype._onMouseLeave=function(a){return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b.prototype._onMouseUp=function(a){var b,c;if(this._mouseDown){if(b=ContentEdit.Root.get().focused(),this.tool.requiresElement&&(!b||!b.isMounted()))return;c=null,b&&b.selection&&(c=b.selection()),this.apply(b,c)}return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},b}(b.AnchoredComponentUI),b.AnchoredDialogUI=function(a){function b(){b.__super__.constructor.call(this),this._position=[0,0]}return g(b,a),b.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-anchored-dialog"]),this.parent().domElement().appendChild(this._domElement),this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"},b.prototype.position=function(a){return void 0===a?this._position.slice():(this._position=a.slice(),this.isMounted()?(this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"):void 0)},b.prototype._contain=function(){var a,b,c;if(this.isMounted())return c=this._domElement.getBoundingClientRect(),a=c.width/2+5,b=document.documentElement.clientWidth||document.body.clientWidth,this._position[0]+a>b&&(this._position[0]=b-a),this._position[0]-1,head:c.indexOf("ct-section--applied")>-1},this.dispatchEvent(this.createEvent("save",a))},b.prototype.unmount=function(){return b.__super__.unmount.call(this),this._domBodyInput=null,this._domBodySection=null,this._domApply=null,this._domHeadSection=null,this._domHeadSwitch=null,this._domFootSection=null,this._domFootSwitch=null},b.prototype._addDOMEventListeners=function(){var a;return b.__super__._addDOMEventListeners.call(this),a=function(a){return a.preventDefault(),this.getAttribute("class").indexOf("ct-section--applied")>-1?ContentEdit.removeCSSClass(this,"ct-section--applied"):ContentEdit.addCSSClass(this,"ct-section--applied")},this._domHeadSection.addEventListener("click",a),this._domFootSection.addEventListener("click",a),this._domBodySection.addEventListener("click",function(a){return function(b){return a._domBodyInput.focus()}}(this)),this._domBodyInput.addEventListener("input",function(a){return function(b){var c;return c=/^[1-9]\d{0,1}$/.test(b.target.value),c?(ContentEdit.removeCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.removeCSSClass(a._domApply,"ct-control--muted")):(ContentEdit.addCSSClass(a._domBodyInput,"ct-section__input--invalid"),ContentEdit.addCSSClass(a._domApply,"ct-control--muted"))}}(this)),this._domApply.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domApply.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},b}(b.DialogUI),b.VideoDialog=function(a){function c(){c.__super__.constructor.call(this,"Insert video")}return g(c,a),c.prototype.clearPreview=function(){if(this._domPreview)return this._domPreview.parentNode.removeChild(this._domPreview),this._domPreview=void 0},c.prototype.mount=function(){var a;return c.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-video-dialog"),ContentEdit.addCSSClass(this._domView,"ct-video-dialog__preview"),a=this.constructor.createDiv(["ct-control-group"]),this._domControls.appendChild(a),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-video-dialog__input"),this._domInput.setAttribute("name","url"),this._domInput.setAttribute("placeholder",ContentEdit._("Paste YouTube or Vimeo URL")+"..."),this._domInput.setAttribute("type","text"),a.appendChild(this._domInput),this._domButton=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert","ct-control--muted"]),this._domButton.textContent=ContentEdit._("Insert"),a.appendChild(this._domButton),this._addDOMEventListeners()},c.prototype.preview=function(a){return this.clearPreview(),this._domPreview=document.createElement("iframe"),this._domPreview.setAttribute("frameborder","0"),this._domPreview.setAttribute("height","100%"),this._domPreview.setAttribute("src",a),this._domPreview.setAttribute("width","100%"),this._domView.appendChild(this._domPreview)},c.prototype.save=function(){var a,c;return c=this._domInput.value.trim(),a=b.getEmbedVideoURL(c),a?this.dispatchEvent(this.createEvent("save",{url:a})):this.dispatchEvent(this.createEvent("save",{url:c}))},c.prototype.show=function(){return c.__super__.show.call(this),this._domInput.focus()},c.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),c.__super__.unmount.call(this),this._domButton=null,this._domInput=null,this._domPreview=null},c.prototype._addDOMEventListeners=function(){return c.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("input",function(a){return function(c){var d;return c.target.value?ContentEdit.removeCSSClass(a._domButton,"ct-control--muted"):ContentEdit.addCSSClass(a._domButton,"ct-control--muted"),a._updatePreviewTimeout&&clearTimeout(a._updatePreviewTimeout),d=function(){var c,d;return d=a._domInput.value.trim(),c=b.getEmbedVideoURL(d),c?a.preview(c):a.clearPreview()},a._updatePreviewTimeout=setTimeout(d,500)}}(this)),this._domInput.addEventListener("keypress",function(a){return function(b){if(13===b.keyCode)return a.save()}}(this)),this._domButton.addEventListener("click",function(a){return function(b){var c;if(b.preventDefault(),c=a._domButton.getAttribute("class"),-1===c.indexOf("ct-control--muted"))return a.save()}}(this))},c}(b.DialogUI),b.HTMLCleaner=function(){function a(a,b){this.tagWhitelist=a||this.constructor.DEFAULT_TAG_WHITELIST,this.attributeWhitelist=b||this.constructor.DEFAULT_ATTRIBUTE_WHITELIST}return a.DEFAULT_ATTRIBUTE_WHITELIST={a:["href"],td:["colspan"]},a.DEFAULT_TAG_WHITELIST=["a","address","b","blockquote","code","del","em","h1","h2","h3","h4","h5","h6","i","ins","li","ol","p","pre","strong","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","#text"],a.NO_CONTENT_TAGS=["head","meta","style","script","title"],a.prototype.clean=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;for(j=document.implementation.createHTMLDocument(),m=j.createElement("div"),m.innerHTML=a,k=function(){var a,b,c,e;for(c=m.childNodes,e=[],a=0,b=c.length;a0;)if(f=k.shift(),g=f.nodeName.toLowerCase(),this.tagWhitelist.indexOf(g)<0){if(this.constructor.NO_CONTENT_TAGS.indexOf(g)>-1){f.remove();continue}for(r=f.childNodes,n=0,p=r.length;n=f.length-1)){for(b=f[e+1],d=null,i=b.descendants(),g=0,h=i.length;g-1&&l.indexOf(n)>-1){if(l.indexOf(j)>-1&&l.indexOf(n)>-1?c=new HTMLString.String(A.innerHTML):(console.log(A.textContent),c=new HTMLString.String(HTMLString.String.encode(A.textContent))),a.content)return v=a.selection(),g=v.get()[0]+c.length(),z=a.content.substring(0,v.get()[0]),y=a.content.substring(v.get()[1]),t=a.content.substring(v.get()[0],v.get()[1]),t.length()&&(d=t.characters[0],x=d.tags(),d.isTag()&&x.shift(),x.length>=1&&(c=c.format.apply(c,[0,c.length()].concat(i.call(x))))),a.content=z.concat(c),a.content=a.content.concat(y,!1),a.updateInnerHTML(),a.taint(),v.set(g,g),void a.selection(v);A.innerHTML="

"+c.html()+"

"}if(q=a,"Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),s=a.parent(),l.indexOf(j)>-1&&l.indexOf(n)>-1){for(m=A.createElement("p");A.childNodes.length>0;)m.appendChild(A.childNodes[0]);A.appendChild(m)}for(k=0,o=q,G=A.childNodes,C=0,E=G.length;C=1&&(b=b.format.apply(b,[0,b.length()].concat(i.call(t))))),a.content=v.concat(b),a.content=a.content.concat(u,!1),a.updateInnerHTML(),a.taint(),r.set(d,d),a.selection(r)}},c.prototype.revert=function(){var a;if(this.dispatchEvent(this.createEvent("revert")))return!(b.CANCEL_MESSAGE&&(a=ContentEdit._(b.CANCEL_MESSAGE),ContentEdit.Root.get().lastModified()>this._rootLastModified&&!window.confirm(a)))&&(this.revertToSnapshot(this.history.goTo(0),!1),!0)},c.prototype.revertToSnapshot=function(a,b){var c,d,e,f,g,h,i,j,k,l;null==b&&(b=!0),d=[],j=this._regions;for(e in j){for(f=j[e],k=f.children,h=0,i=k.length;h-1?l.push(this._orderedRegions.splice(f,1)):l.push(void 0));return l},c}(b.ComponentUI),b.EditorApp=function(){function a(){}var c;return c=null,a.get=function(){var a;return a=b.EditorApp.getCls(),null!=c?c:c=new a},a.getCls=function(){return e},a}(),b.History=function(){function a(a){this._lastSnapshotTaken=null,this._regions={},this.replaceRegions(a),this._snapshotIndex=-1,this._snapshots=[],this._store()}return a.prototype.canRedo=function(){return this._snapshotIndex0},a.prototype.index=function(){return this._snapshotIndex},a.prototype.length=function(){return this._snapshots.length},a.prototype.snapshot=function(){return this._snapshots[this._snapshotIndex]},a.prototype.goTo=function(a){return this._snapshotIndex=Math.min(this._snapshots.length-1,Math.max(0,a)),this.snapshot()},a.prototype.redo=function(){return this.goTo(this._snapshotIndex+1)},a.prototype.replaceRegions=function(a){var b,c,d;this._regions={},d=[];for(b in a)c=a[b],d.push(this._regions[b]=c);return d},a.prototype.restoreSelection=function(a){var b,c;if(a.selected)return c=this._regions[a.selected.region],b=c.descendants()[a.selected.element],b.focus(),b.selection&&a.selected.selection?b.selection(a.selected.selection):void 0},a.prototype.stopWatching=function(){if(this._watchInterval&&clearInterval(this._watchInterval),this._delayedStoreTimeout)return clearTimeout(this._delayedStoreTimeout)},a.prototype.undo=function(){return this.goTo(this._snapshotIndex-1)},a.prototype.watch=function(){var a;return this._lastSnapshotTaken=Date.now(),a=function(a){return function(){var b,c;if(null!==(c=ContentEdit.Root.get().lastModified())&&c>a._lastSnapshotTaken){if(a._delayedStoreRequested===c)return;return a._delayedStoreTimeout&&clearTimeout(a._delayedStoreTimeout),b=function(){return a._lastSnapshotTaken=c,a._store()},a._delayedStoreRequested=c,a._delayedStoreTimeout=setTimeout(b,500)}}}(this),this._watchInterval=setInterval(a,50)},a.prototype._store=function(){var a,b,c,d,e,f,g;e={regions:{},regionModifieds:{},rootModified:ContentEdit.Root.get().lastModified(),selected:null},f=this._regions;for(b in f)d=f[b],e.regions[b]=d.html(),e.regionModifieds[b]=d.lastModified();if(a=ContentEdit.Root.get().focused()){if(e.selected={},!(d=a.closest(function(a){return"Region"===a.type()||"Fixture"===a.type()})))return;g=this._regions;for(b in g)if(c=g[b],d===c){e.selected.region=b;break}e.selected.element=d.descendants().indexOf(a),a.selection&&(e.selected.selection=a.selection())}return this._snapshotIndex0&&g[r-1].hasTags("a");)r-=1;for(;j-1){a.addCSSClass(e);break}a.a=null}a.unmount(),a.mount()}else a.isFixed()&&"a"===a.tagName()?a.attr("href",g.href):(a.content=a.content.unformat(k,s,"a"),g.href&&(c=new HTMLString.Tag("a",g),a.content=a.content.format(k,s,c),a.content.optimize()),a.updateInnerHTML());return a.taint(),m.dispatchEvent(m.createEvent("click"))}),e.attach(m),e.attach(h),m.show(),h.show()}},c}(b.Tools.Bold),b.Tools.Heading=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"heading"),c.label="Heading",c.icon="heading",c.tagName="h1",c.canApply=function(a,b){return!a.isFixed()&&(void 0!==a.content&&-1!==["Text","PreText"].indexOf(a.type()))},c.isApplied=function(a,b){return!!a.content&&(-1!==["Text","PreText"].indexOf(a.type())&&a.tagName()===this.tagName)},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return a.storeState(),"PreText"===a.type()?(d=a.content.html().replace(/ /g," "),g=new ContentEdit.Text(this.tagName,{},d),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(b)):(a.removeAttr("class"),a.tagName()===this.tagName?a.tagName("p"):a.tagName(this.tagName),a.restoreState()),this.dispatchEditorEvent("tool-applied",h),c(!0)},c}(b.Tool),b.Tools.Subheading=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"subheading"),c.label="Subheading",c.icon="subheading",c.tagName="h2",c}(b.Tools.Heading),b.Tools.Paragraph=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"paragraph"),c.label="Paragraph",c.icon="paragraph",c.tagName="p",c.canApply=function(a,b){return!a.isFixed()&&void 0!==a},c.apply=function(a,d,e){var f,g,h,i;return f=this.editor().ctrlDown(),b.Tools.Heading.canApply(a)&&!f?c.__super__.constructor.apply.call(this,a,d,e):(i={tool:this,element:a,selection:d},this.dispatchEditorEvent("tool-apply",i)?("Region"!==a.parent().type()&&(a=a.closest(function(a){return"Region"===a.parent().type()})),h=a.parent(),g=new ContentEdit.Text("p"),h.attach(g,h.children.indexOf(a)+1),g.focus(),e(!0),this.dispatchEditorEvent("tool-applied",i)):void 0)},c}(b.Tools.Heading),b.Tools.Preformatted=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"preformatted"),c.label="Preformatted",c.icon="preformatted",c.tagName="pre",c.apply=function(a,c,d){var e,f,g,h,i;if(i={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",i))return"PreText"===a.type()?void b.Tools.Paragraph.apply(a,c,d):(h=a.content.text(),g=new ContentEdit.PreText("pre",{},HTMLString.String.encode(h)),f=a.parent(),e=f.children.indexOf(a),f.detach(a),f.attach(g,e),a.blur(),g.focus(),g.selection(c),d(!0),this.dispatchEditorEvent("tool-applied",i))},c}(b.Tools.Heading),b.Tools.AlignLeft=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"align-left"),c.label="Align left",c.icon="align-left",c.className="text-left",c.canApply=function(a,b){return void 0!==a.content},c.isApplied=function(a,b){var c;return!!this.canApply(a)&&("ListItemText"!==(c=a.type())&&"TableCellText"!==c||(a=a.parent()),a.hasCSSClass(this.className))},c.apply=function(a,c,d){var e,f,g,h,i,j;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g)){for("ListItemText"!==(j=a.type())&&"TableCellText"!==j||(a=a.parent()),e=[b.Tools.AlignLeft.className,b.Tools.AlignCenter.className,b.Tools.AlignRight.className],h=0,i=e.length;h0;h=g<=0?++a:--a)c=i.children[i.children.length-1],b.push(i.detach(c));return b}()):g>0?m.push(function(){var a,b;for(b=[],h=a=0;0<=g?ag;h=0<=g?++a:--a)c=new ContentEdit.TableCell(d),i.attach(c),e=new ContentEdit.TableCellText(""),b.push(c.attach(e));return b}()):m.push(void 0);return m},c._createTable=function(a){var b,c,d,e;return e=new ContentEdit.Table,a.head&&(d=this._createTableSection("thead","th",a.columns),e.attach(d)),b=this._createTableSection("tbody","td",a.columns),e.attach(b),a.foot&&(c=this._createTableSection("tfoot","td",a.columns),e.attach(c)),e},c._createTableSection=function(a,b,c){var d,e,f,g,h;for(g=new ContentEdit.TableSection(a),f=new ContentEdit.TableRow,g.attach(f),h=0;0<=c?hc;0<=c?++h:--h)d=new ContentEdit.TableCell(b),f.attach(d),e=new ContentEdit.TableCellText(""),d.attach(e);return g},c._updateTable=function(a,b){var c,d,e,f,g,h,i;if(!a.head&&b.thead()&&b.detach(b.thead()),!a.foot&&b.tfoot()&&b.detach(b.tfoot()),c=b.firstSection().children[0].children.length,a.columns!==c)for(i=b.children,g=0,h=i.length;g0},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().indent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.Unindent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"unindent"),c.label="Unindent",c.icon="unindent",c.canApply=function(a,b){return"ListItem"===a.parent().type()},c.apply=function(a,b,c){var d;if(d={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",d))return a.parent().unindent(),c(!0),this.dispatchEditorEvent("tool-applied",d)},c}(b.Tool),b.Tools.LineBreak=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"line-break"),c.label="Line break",c.icon="line-break",c.canApply=function(a,b){return a.content},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h))return e=b.get()[0]+1,g=a.content.substring(0,b.get()[0]),f=a.content.substring(b.get()[1]),d=new HTMLString.String("
",a.content.preserveWhitespace()),a.content=g.concat(d,f),a.updateInnerHTML(),a.taint(),b.set(e,e),a.selection(b),c(!0),this.dispatchEditorEvent("tool-applied",h)},c}(b.Tool),b.Tools.Image=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"image"),c.label="Image",c.icon="image",c.canApply=function(a,b){return!a.isFixed()||"ImageFixture"===a.type()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.ImageDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(b){return function(c){var e,i,j,k,l,m,n,o;return e=c.detail(),l=e.imageURL,k=e.imageSize,j=e.imageAttrs,j||(j={}),j.height=k[1],j.src=l,j.width=k[0],"ImageFixture"===a.type()?a.src(l):(i=new ContentEdit.Image(j),o=b._insertAt(a),n=o[0],m=o[1],n.parent().attach(i,m),i.focus()),g.hide(),f.hide(),d(!0),b.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Video=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"video"),c.label="Video",c.icon="video",c.canApply=function(a,b){return!a.isFixed()},c.apply=function(a,c,d){var e,f,g,h;if(h={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",h))return a.storeState&&a.storeState(),e=b.EditorApp.get(),g=new b.ModalUI,f=new b.VideoDialog,f.addEventListener("cancel",function(b){return function(){return g.hide(),f.hide(),a.restoreState&&a.restoreState(),d(!1)}}()),f.addEventListener("save",function(c){return function(e){var i,j,k,l,m,n;if(l=e.detail().url,l?(m=new ContentEdit.Video("iframe",{frameborder:0,height:b.DEFAULT_VIDEO_HEIGHT,src:l,width:b.DEFAULT_VIDEO_WIDTH}),n=c._insertAt(a),k=n[0],j=n[1],k.parent().attach(m,j),m.focus()):a.restoreState&&a.restoreState(),g.hide(),f.hide(),i=""!==l,d(i),i)return c.dispatchEditorEvent("tool-applied",h)}}(this)),e.attach(g),e.attach(f),g.show(),f.show()},c}(b.Tool),b.Tools.Undo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"undo"),c.label="Undo",c.icon="undo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canUndo()},c.apply=function(a,b,c){var d,e,f;if(f={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",f))return d=this.editor(),d.history.stopWatching(),e=d.history.undo(),d.revertToSnapshot(e),d.history.watch(),this.dispatchEditorEvent("tool-applied",f)},c}(b.Tool),b.Tools.Redo=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"redo"),c.label="Redo",c.icon="redo",c.requiresElement=!1,c.canApply=function(a,c){var d;return d=b.EditorApp.get(),d.history&&d.history.canRedo()},c.apply=function(a,c,d){var e,f,g;if(g={tool:this,element:a,selection:c},this.dispatchEditorEvent("tool-apply",g))return e=b.EditorApp.get(),e.history.stopWatching(),f=e.history.redo(),e.revertToSnapshot(f),e.history.watch(),this.dispatchEditorEvent("tool-applied",g)},c}(b.Tool),b.Tools.Remove=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return g(c,a),b.ToolShelf.stow(c,"remove"),c.label="Remove",c.icon="remove",c.canApply=function(a,b){return!a.isFixed()},c.apply=function(a,b,c){var d,e,f,g,h;if(h={tool:this,element:a,selection:b},this.dispatchEditorEvent("tool-apply",h)){if(d=this.editor(),a.blur(),a.nextContent()?a.nextContent().focus():a.previousContent()&&a.previousContent().focus(),!a.isMounted())return c(!0),void this.dispatchEditorEvent("tool-applied",h);switch(a.type()){case"ListItemText":d.ctrlDown()?(e=a.closest(function(a){return"Region"===a.parent().type()}),e.parent().detach(e)):a.parent().parent().detach(a.parent());break;case"TableCellText":d.ctrlDown()?(g=a.closest(function(a){return"Table"===a.type()}),g.parent().detach(g)):(f=a.parent().parent(),f.parent().detach(f));break;default:a.parent().detach(a)}return c(!0),this.dispatchEditorEvent("tool-applied",h)}},c}(b.Tool)}.call(this); \ No newline at end of file diff --git a/package.json b/package.json index 7ddd1da9..10fd482b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ContentTools", "description": "A JS library for building WYSIWYG editors for HTML content", - "version": "1.6.4", + "version": "1.6.5", "keywords": [ "wysiwyg", "inline", diff --git a/spec/content-tools-spec.js b/spec/content-tools-spec.js index 864f0fd2..a1b5a36e 100644 --- a/spec/content-tools-spec.js +++ b/spec/content-tools-spec.js @@ -333,7 +333,7 @@ }); describe('ContentTools.WidgetUI.detach()', function() { - return fit('should detach a child widget and unmount it', function() { + return it('should detach a child widget and unmount it', function() { var child, domElement, parent; parent = new ContentTools.WidgetUI(); child = new ContentTools.WidgetUI(); diff --git a/src/scripts/editor.coffee b/src/scripts/editor.coffee index 6678c5a5..6bef1d85 100644 --- a/src/scripts/editor.coffee +++ b/src/scripts/editor.coffee @@ -477,7 +477,7 @@ class _EditorApp extends ContentTools.ComponentUI continue # Skip whitespace text elements - if node.nodeName = '#text' and node.textContent.trim() == '' + if node.nodeName == '#text' and node.textContent.trim() == '' continue # Attempt to convert the node to a ContentEdit element diff --git a/src/scripts/ui/toolbox.coffee b/src/scripts/ui/toolbox.coffee index 6eaf8f3b..32fd6405 100644 --- a/src/scripts/ui/toolbox.coffee +++ b/src/scripts/ui/toolbox.coffee @@ -275,21 +275,24 @@ class ContentTools.ToolboxUI extends ContentTools.WidgetUI undo = false switch os - when 'linux' and not ev.altKey - if ev.keyCode is 90 and ev.ctrlKey - redo = ev.shiftKey - undo = not redo - - when 'mac' and not (ev.altKey or ev.ctrlKey) - if ev.keyCode is 90 and ev.metaKey - redo = ev.shiftKey - undo = not redo - - when 'windows' and not ev.altKey or ev.shiftKey - if ev.keyCode is 89 and ev.ctrlKey - redo = true - if ev.keyCode is 90 and ev.ctrlKey - undo = true + when 'linux' + if not ev.altKey + if ev.keyCode is 90 and ev.ctrlKey + redo = ev.shiftKey + undo = not redo + + when 'mac' + if not (ev.altKey or ev.ctrlKey) + if ev.keyCode is 90 and ev.metaKey + redo = ev.shiftKey + undo = not redo + + when 'windows' + if not ev.altKey or ev.shiftKey + if ev.keyCode is 89 and ev.ctrlKey + redo = true + if ev.keyCode is 90 and ev.ctrlKey + undo = true # Perform undo/redo if undo and ContentTools.Tools.Undo.canApply(null, null) @@ -554,4 +557,4 @@ class ContentTools.ToolUI extends ContentTools.AnchoredComponentUI # Reset the mouse down flag @_mouseDown = false - @removeCSSClass('ct-tool--down') \ No newline at end of file + @removeCSSClass('ct-tool--down') diff --git a/src/spec/ui/toolbox.coffee b/src/spec/ui/toolbox.coffee index 71cf9620..f4452595 100644 --- a/src/spec/ui/toolbox.coffee +++ b/src/spec/ui/toolbox.coffee @@ -315,4 +315,4 @@ describe 'ContentTools.ToolboxUI', () -> # Check the tool is enabled after an update if an element is # provided. tool.update(element) - expect(tool.disabled()).toBe false \ No newline at end of file + expect(tool.disabled()).toBe false