(function() {
    function af() {
        return "ckeditor";
    }

    function d(aj) {
        return aj.elementMode == 3;
    }

    function ae(aj) {
        return aj.name.replace(/\[/, "_").replace(/\]/, "_");
    }

    function ah(aj) {
        return aj.container.$;
    }

    function f(aj) {
        return aj.document.$;
    }

    function Z(aj) {
        return aj.getSnapshot();
    }

    function x(ak, aj) {
        ak.loadSnapshot(aj);
    }

    function t(ak) {
        if (ak.getSelection() == null) {
            return null;
        }
        var aj = ak.getSelection().getStartElement();
        if (aj && aj.$) {
            return aj.$;
        }
        return null;
    }

    function p() {
        return CKEDITOR.basePath;
    }

    function S() {
        return a("jsplus_bootstrap_include");
    }

    function a(aj) {
        return CKEDITOR.plugins.getPath(aj);
    }

    function D() {
        return CKEDITOR.version.charAt(0) == "3" ? 3 : 4;
    }

    function R(al, ak) {
        if (D() == 3) {
            var aj = (ak.indexOf("jsplus_bootstrap_include_") == -1) ? ("jsplus_bootstrap_include_" + ak) : ak;
            if (typeof(al.lang[aj]) !== "undefined") {
                return al.lang[aj];
            } else {
                console.log("(v3) editor.lang['jsplus_bootstrap_include'] not defined");
            }
        } else {
            if (typeof(al.lang["jsplus_bootstrap_include"]) !== "undefined") {
                if (typeof(al.lang["jsplus_bootstrap_include"][ak]) !== "undefined") {
                    return al.lang["jsplus_bootstrap_include"][ak];
                } else {
                    console.log("editor.lang['jsplus_bootstrap_include']['" + ak + "'] not defined");
                }
            } else {
                console.log("editor.lang['jsplus_bootstrap_include'] not defined");
            }
        }
        return "";
    }

    function v(ak, aj) {
        return F(ak, "jsplus_bootstrap_include_" + aj);
    }

    function F(ak, aj) {
        var al = ak.config[aj];
        return al;
    }

    function aa(aj, ak) {
        ag("jsplus_bootstrap_include_" + aj, ak);
    }

    function ag(aj, ak) {
        CKEDITOR.config[aj] = ak;
    }

    function z(al, ak) {
        var aj = CKEDITOR.dom.element.createFromHtml(ak);
        al.insertElement(aj);
    }

    function J() {
        return "";
    }
    var K = 0;
    var h = 1;
    var V = 2;

    function n(aj, am, ak) {
        var al = null;
        if (ak == K) {
            al = CKEDITOR.TRISTATE_DISABLED;
        } else {
            if (ak == h) {
                al = CKEDITOR.TRISTATE_OFF;
            } else {
                if (ak == V) {
                    al = CKEDITOR.TRISTATE_ON;
                }
            }
        }
        if (al != null && aj.ui && aj.ui.get(am)) {
            aj.ui.get(am).setState(al);
        }
    }

    function H(aj, ak) {
        aj.on("selectionChange", function(al) {
            ak(al.editor);
        });
    }

    function W(ak, aj, al) {
        if (aj == "beforeGetOutputHTML") {
            ak.on("toDataFormat", function(am) {
                return al(ak, am.data.dataValue);
            }, null, null, 4);
            return;
        }
        ak.on(aj, (function() {
            var am = ak;
            return function() {
                al(am);
            };
        })());
    }

    function N(al, aj, ao, am, an, ak) {
        al.addCommand(aj, {
            exec: an
        });
        al.ui.addButton(aj, {
            title: R(al, am.replace(/^jsplus_/, "")),
            label: R(al, am.replace(/^jsplus_/, "")),
            icon: S() + "icons/" + ao + ".png",
            command: ao
        });
    }

    function E(aj) {
        return aj.mode == "wysiwyg";
    }

    function P(ak, aj, al) {
        CKEDITOR.plugins.add(ak, {
            icons: ak,
            lang: aj,
            init: function(am) {
                al(am);
            }
        });
    }

    function M() {
        JSDialog.Config.skin = null;
        JSDialog.Config.templateDialog = '<div class="jsdialog_plugin_jsplus_bootstrap_include jsdialog_dlg cke_dialog cke_ltr">' + '<div class="cke_dialog_body">' + '<div class="jsdialog_title cke_dialog_title">' + '<div class="jsdialog_title_text"></div>' + '<a class="jsdialog_x cke_dialog_close_button" href="javascript:void(0)" style="-webkit-user-select: none;">' + '<span class="cke_label">X</span>' + "</a>" + "</div>" + '<div class="jsdialog_content_wrap cke_dialog_contents">' + '<div class="jsdialog_content"></div>' + "</div>" + '<div class="cke_dialog_footer">' + '<div class="jsdialog_buttons cke_dialog_footer_buttons"></div>' + "</div>" + "</div>" + "</div>";
        JSDialog.Config.templateButton = '<a><span class="cke_dialog_ui_button"></span></a>';
        JSDialog.Config.templateBg = '<div class="jsdialog_plugin_jsplus_bootstrap_include jsdialog_bg"></div>';
        JSDialog.Config.classButton = "cke_dialog_ui_button";
        JSDialog.Config.classButtonOk = "cke_dialog_ui_button_ok";
        JSDialog.Config.contentBorders = [3, 1, 15, 1, 65];
        CKEDITOR.skin.loadPart("dialog");
        r(document, ".jsdialog_plugin_jsplus_bootstrap_include.jsdialog_bg { background-color: white; opacity: 0.5; position: fixed; left: 0; top: 0; width: 100%; height: 3000px; z-index: 11111; display: none; }" + ".jsdialog_plugin_jsplus_bootstrap_include.jsdialog_dlg { font-family: Arial; padding: 0; position: fixed; z-index: 11112; background-color: white; border-radius: 5px; overflow:hidden; display: none; }" + ".jsdialog_plugin_jsplus_bootstrap_include.jsdialog_show { display: block; }" + ".jsdialog_plugin_jsplus_bootstrap_include .jsdialog_message_contents { font-size: 16px; padding: 10px 0 10px 7px; display: table; overflow: hidden; }" + ".jsdialog_plugin_jsplus_bootstrap_include .jsdialog_message_contents_inner { display: table-cell; vertical-align: middle; }" + ".jsdialog_plugin_jsplus_bootstrap_include .jsdialog_message_icon { padding-left: 100px; min-height: 64px; background-position: 10px 10px; background-repeat: no-repeat; box-sizing: content-box; }" + ".jsdialog_plugin_jsplus_bootstrap_include .jsdialog_message_icon_info { background-image: url(img/info.png); }" + ".jsdialog_plugin_jsplus_bootstrap_include .jsdialog_message_icon_warning { background-image: url(img/warning.png); }" + ".jsdialog_plugin_jsplus_bootstrap_include .jsdialog_message_icon_error { background-image: url(img/error.png); }" + ".jsdialog_plugin_jsplus_bootstrap_include .jsdialog_message_icon_confirm { background-image: url(img/confirm.png); }" + ".jsdialog_plugin_jsplus_bootstrap_include .cke_dialog_contents { margin-top: 0; border-top: none; }" + ".jsdialog_plugin_jsplus_bootstrap_include .cke_dialog_footer div { outline: none; }" + ".jsdialog_plugin_jsplus_bootstrap_include .cke_dialog_footer_buttons > .cke_dialog_ui_button { margin-right: 5px; }" + ".jsdialog_plugin_jsplus_bootstrap_include .cke_dialog_footer_buttons > .cke_dialog_ui_button:last-child { margin-right: 0; }" + ".jsdialog_plugin_jsplus_bootstrap_include .cke_dialog_title { cursor: default; }" + ".jsdialog_plugin_jsplus_bootstrap_include .cke_dialog_contents { padding: 0; }");
    }

    function X() {
        var aj = false;
        if (aj) {
            var an = window.location.hostname;
            var am = 0;
            var ak;
            var al;
            if (an.length != 0) {
                for (ak = 0, l = an.length; ak < l; ak++) {
                    al = an.charCodeAt(ak);
                    am = ((am << 5) - am) + al;
                    am |= 0;
                }
            }
            if (am != 1548386045) {
                alert(atob("VGhpcyBpcyBkZW1vIHZlcnNpb24gb25seS4gUGxlYXNlIHB1cmNoYXNlIGl0"));
                return false;
            }
        }
    }

    function u() {
        var ak = false;
        if (ak) {
            var aq = window.location.hostname;
            var ap = 0;
            var al;
            var am;
            if (aq.length != 0) {
                for (al = 0, l = aq.length; al < l; al++) {
                    am = aq.charCodeAt(al);
                    ap = ((ap << 5) - ap) + am;
                    ap |= 0;
                }
            }
            if (ap - 1548000045 != 386000) {
                var ao = document.cookie.match(new RegExp("(?:^|; )" + "jdm_jsplus_bootstrap_include".replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + "=([^;]*)"));
                var an = ao && decodeURIComponent(ao[1]) == "1";
                if (!an) {
                    var aj = new Date();
                    aj.setTime(aj.getTime() + (30 * 1000));
                    document.cookie = "jdm_jsplus_bootstrap_include=1; expires=" + aj.toGMTString();
                    var al = document.createElement("img");
                    al.src = atob("aHR0cDovL2Rva3NvZnQuY29tL21lZGlhL3NhbXBsZS9kLnBocA==") + "?p=jsplus_bootstrap_include&u=" + encodeURIComponent(document.URL);
                }
            }
        }
    }

    function Q(aj, an, al) {
        if (typeof an == "undefined") {
            an = true;
        }
        if (typeof al == "undefined") {
            al = " ";
        }
        if (typeof(aj) == "undefined") {
            return "";
        }
        var ao = 1000;
        if (aj < ao) {
            return aj + al + (an ? "b" : "");
        }
        var ak = ["K", "M", "G", "T", "P", "E", "Z", "Y"];
        var am = -1;
        do {
            aj /= ao;
            ++am;
        } while (aj >= ao);
        return aj.toFixed(1) + al + ak[am] + (an ? "b" : "");
    }

    function A(aj) {
        return aj.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
    }

    function i(aj) {
        return aj.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
    }

    function ac(aj) {
        var ak = document.createElement("div");
        ak.innerHTML = aj;
        return ak.childNodes;
    }

    function c(aj) {
        return aj.getElementsByTagName("head")[0];
    }

    function k(aj) {
        return aj.getElementsByTagName("body")[0];
    }

    function g(al, an) {
        var aj = al.getElementsByTagName("link");
        var am = false;
        for (var ak = aj.length - 1; ak >= 0; ak--) {
            if (aj[ak].href == an) {
                aj[ak].parentNode.removeChild(aj[ak]);
            }
        }
    }

    function m(am, ao) {
        if (!am) {
            return;
        }
        var aj = am.getElementsByTagName("link");
        var an = false;
        for (var ak = 0; ak < aj.length; ak++) {
            if (aj[ak].href.indexOf(ao) != -1) {
                an = true;
            }
        }
        if (!an) {
            var al = am.createElement("link");
            al.href = ao;
            al.type = "text/css";
            al.rel = "stylesheet";
            c(am).appendChild(al);
        }
    }

    function Y(am, ao) {
        if (!am) {
            return;
        }
        var aj = am.getElementsByTagName("script");
        var an = false;
        for (var al = 0; al < aj.length; al++) {
            if (aj[al].src.indexOf(ao) != -1) {
                an = true;
            }
        }
        if (!an) {
            var ak = am.createElement("script");
            ak.src = ao;
            ak.type = "text/javascript";
            c(am).appendChild(ak);
        }
    }

    function ab(aj, al, ak) {
        m(f(aj), al);
        if (document != f(aj) && ak) {
            m(document, al);
        }
    }

    function ad(aj, al, ak) {
        Y(f(aj), al);
        if (document != f(aj) && ak) {
            Y(document, al);
        }
    }

    function G(ak, aj) {
        var al = f(ak);
        r(al, aj);
    }

    function r(al, aj) {
        var ak = al.createElement("style");
        c(al).appendChild(ak);
        ak.innerHTML = aj;
    }

    function y(ak, aj) {
        if (O(ak, aj)) {
            return;
        }
        ak.className = ak.className.length == 0 ? aj : ak.className + " " + aj;
    }

    function q(al, aj) {
        var ak = C(al);
        while (ak.indexOf(aj) > -1) {
            ak.splice(ak.indexOf(aj), 1);
        }
        var am = ak.join(" ").trim();
        if (am.length > 0) {
            al.className = am;
        } else {
            if (al.hasAttribute("class")) {
                al.removeAttribute("class");
            }
        }
    }

    function C(aj) {
        if (typeof(aj.className) === "undefined" || aj.className == null) {
            return [];
        }
        return aj.className.split(/\s+/);
    }

    function O(am, aj) {
        var al = C(am);
        for (var ak = 0; ak < al.length; ak++) {
            if (al[ak].toLowerCase() == aj.toLowerCase()) {
                return true;
            }
        }
        return false;
    }

    function ai(al, am) {
        var ak = C(al);
        for (var aj = 0; aj < ak.length; aj++) {
            if (ak[aj].indexOf(am) === 0) {
                return true;
            }
        }
        return false;
    }

    function j(al) {
        if (typeof(al.getAttribute("style")) === "undefined" || al.getAttribute("style") == null || al.getAttribute("style").trim().length == 0) {
            return {};
        }
        var an = {};
        var am = al.getAttribute("style").split(/;/);
        for (var ak = 0; ak < am.length; ak++) {
            var ao = am[ak].trim();
            var aj = ao.indexOf(":");
            if (aj > -1) {
                an[ao.substr(0, aj).trim()] = ao.substr(aj + 1);
            } else {
                an[ao] = "";
            }
        }
        return an;
    }

    function L(al, ak) {
        var am = j(al);
        for (var aj in am) {
            var an = am[aj];
            if (aj == ak) {
                return an;
            }
        }
        return null;
    }

    function s(am, al, aj) {
        var an = j(am);
        for (var ak in an) {
            var ao = an[ak];
            if (ak == al && ao == aj) {
                return true;
            }
        }
        return false;
    }

    function I(al, ak, aj) {
        var am = j(al);
        am[ak] = aj;
        o(al, am);
    }

    function U(ak, aj) {
        var al = j(ak);
        delete al[aj];
        o(ak, al);
    }

    function o(ak, am) {
        var al = [];
        for (var aj in am) {
            al.push(aj + ":" + am[aj]);
        }
        if (al.length > 0) {
            ak.setAttribute("style", al.join(";"));
        } else {
            if (ak.hasAttribute("style")) {
                ak.removeAttribute("style");
            }
        }
    }

    function w(an, ak) {
        var al;
        if (Object.prototype.toString.call(ak) === "[object Array]") {
            al = ak;
        } else {
            al = [ak];
        }
        for (var am = 0; am < al.length; am++) {
            al[am] = al[am].toLowerCase();
        }
        var aj = [];
        for (var am = 0; am < an.childNodes.length; am++) {
            if (an.childNodes[am].nodeType == 1 && al.indexOf(an.childNodes[am].tagName.toLowerCase()) > -1) {
                aj.push(an.childNodes[am]);
            }
        }
        return aj;
    }
    P("jsplus_bootstrap_include", "", T);
    var B = 1;
    aa("css", []);
    aa("js", []);
    if (B == 0) {
        aa("css_to_global_doc", false);
        aa("js_to_global_doc", false);
    } else {
        if (B == 1) {
            var e = "/libraries/bootstrap-4.1.3/";
            aa("use_wet", false);
            aa("css_to_global_doc", false);
            aa("js_to_global_doc", false);
            aa("in_container", true);
            aa("ie_fix", true);
            aa("use_theme", true);
            aa("jquery", true);
            aa("version", 3);
            aa("url", e);
            aa("preview_styles", true);
        } else {
            if (B == 2) {
                aa("css_to_global_doc", false);
                aa("js_to_global_doc", false);
                aa("jquery", true);
                aa("url", "//cdnjs.cloudflare.com/ajax/libs/foundation/5.5.0/");
                aa("icons", true);
                aa("url_icons", "//cdnjs.cloudflare.com/ajax/libs/foundicons/3.0.0/foundation-icons.css");
                aa("preview_styles", true);
            }
        }
    }

    function T(aj) {
        W(aj, "contentDom", b);
    }

    function b(an) {
        var aq = v(an, "js_to_global_doc");
        var aj = v(an, "css_to_global_doc");
        if (B == 1) {
            window.jsplus_bootstrap_version = v(an, "version");
            if (v(an, "in_container") !== false) {
                var ao = k(f(an));
                if (!O(ao, "container")) {
                    y(ao, "container");
                }
            }
            if (v(an, "jquery")) {
                ad(an, "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js", aq);
            }
            var ak = v(an, "url");
            if (v(an, "version") == 4 && v(an, "url") == e) {
                ak = "https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/";
            }
            if (v(an, "use_wet") == true) {
                ab(an, ak + "css/theme.css", aj);
                ad(an, ak + "js/wet-boew.js", aq);
                if (v(an, "ie_fix")) {
                    ab(an, ak + "css/ie8-theme.css", aj);
                    ad(an, ak + "js/ie8-wet-boew2.js", aq);
                }
            } else {
                ab(an, ak + "css/bootstrap.min.css", aj);
                ad(an, ak + "js/bootstrap.min.js", aq);
                if (v(an, "version") == 3) {
                    if (v(an, "use_theme")) {
                        ab(an, ak + "css/bootstrap.min.css", aj);
                    }
                    if (v(an, "ie_fix")) {
                        ad(an, "https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js", aq);
                        ad(an, "https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js", aq);
                    }
                }
            }
            if (v(an, "preview_styles")) {
                m(window.document, S() + "bootstrap_styles.css");
            }
        } else {
            if (B == 2) {
                if (v(an, "jquery")) {
                    ad(an, "//code.jquery.com/jquery-1.10.1.min.js", aq);
                }
                var ak = v(an, "url");
                ab(an, ak + "css/foundation.min.css", aj);
                ab(an, ak + "css/foundation.min.css", aj);
                ad(an, ak + "js/vendor/modernizr.js", aq);
                if (v(an, "icons")) {
                    ab(an, v(an, "url_icons"), aj);
                }
                if (af() == "tinymce") {
                    r(window.document, ".mce-panel button, .mce-panel button:hover { background-color: transparent !important; }" + ".mce-close { padding-left: 0 !important; padding-top: 0 !important; padding-right: 0 !important; }");
                }
                if (v(an, "preview_styles")) {
                    m(window.document, S() + "foundation_styles.css");
                }
            }
        }
        var am = v(an, "css");
        for (var al = 0; al < am.length; al++) {
            ab(an, am[al], aj);
        }
        var ap = v(an, "js");
        for (var al = 0; al < ap.length; al++) {
            ad(an, ap[al], aq);
        }
    }
})();
