Liferay.Loader.define("dynamic-data-mapping-form-field-type$liferay-ckeditor@4.16.2-liferay.1/ckeditor/plugins/codemirror/dialogs/codemirrordialog", ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    CKEDITOR.dialog.add("codemirrordialog", function (e) {
      var g = CKEDITOR.document.getWindow(),
          f = g.getViewPaneSize(),
          h = .7 * f.height,
          f = .9 * f.width;e.window || (e.window = g);return { _createCodeMirrorEditor: function () {
          var a = this.dialog,
              b = a.getSize(),
              c = a.getContentElement("main", "data").getInputElement().$,
              c = this.codeMirrorEditor = CodeMirror.fromTextArea(c, { lineNumbers: !0, lineWrapping: !0, mode: "text/html" }),
              b = b.width / 2 - 40,
              d = this._getTabPanel(),
              e = this._getTabPanelPadding(),
              d = d.getSize("height") - (e.bottom + e.top);c.setSize(b, d);d = a.getParentEditor();c.setValue(d.getData());a = a.getContentElement("main", "preview").getElement();a.setSize("width", b);this._createContentIframe(a);c.on("change", this._handleCodeMirrorChange.bind(this));
        }, _createContentIframe: function (a) {
          this.dialog.getParentEditor();var b = this._getTabPanel(),
              c = this._getTabPanelPadding(),
              b = b.getSize("height") - (c.bottom + c.top),
              c = new CKEDITOR.dom.element("iframe");c.on("load", this._handleIframeLoaded.bind(this));a.append(c);c.setAttribute("frameborder", 0);c.setStyles({ height: b + "px", width: "99%" });return c;
        }, _handleCodeMirrorChange: function () {
          var a = this.codeMirrorEditor.getValue(),
              b = this.dialog.getContentElement("main", "preview").getElement().findOne("iframe");b && b.$ && (b.$.contentDocument.body.innerHTML = a);
        }, _handleIframeLoaded: function (a) {
          var b = this.codeMirrorEditor.getValue();a = a.sender;a.addClass("cke_wysiwyg_frame");a.addClass("cke_reset");var c = a.$.contentDocument.body;c.innerHTML = b;var d = a.$.contentDocument,
              f = d.head,
              b = e.config.contentsCss;Array.isArray(b) ? b.forEach(function (a) {
            var b = d.createElement("link");b.setAttribute("href", a);b.setAttribute("rel", "stylesheet");f.appendChild(b);
          }) : (c = d.createElement("link"), c.setAttribute("href", b), c.setAttribute("rel", "stylesheet"), f.appendChild(c));b = e.config.contentsLangDirection;c = d.documentElement;c.setAttribute("dir", b);c.setAttribute("lang", e.config.defaultLanguage);c = d.body;c.classList.add("cke_editable");c.classList.add("cke_editable_themed");c.classList.add("cke_contents_" + b);c.setAttribute("contenteditable", !1);c.setAttribute("spellcheck", !1);c.style.background = "#fff";return a;
        }, _getTabPanel: function () {
          return this.dialog.getContentElement("main").getElement().getAscendant(function (a) {
            return "div" === a.getName() && "tabpanel" === a.getAttribute("role");
          });
        }, _getTabPanelPadding: function () {
          var a = this._getTabPanel().getParent();return { bottom: parseInt(a.getComputedStyle("padding-bottom"), 10) || 0, top: parseInt(a.getComputedStyle("padding-top"), 10) || 0 };
        }, _handleCodeMirrorChange: function () {
          var a = this.codeMirrorEditor.getValue(),
              b = this.dialog.getContentElement("main", "preview").getElement().findOne("iframe");b && b.$ && (b.$.contentDocument.body.innerHTML = a);
        }, contents: [{ id: "main", elements: [{ align: "top", children: [{ id: "data", type: "textarea" }, { html: '\x3cdiv class\x3d"code_preview"\x3e\x26nbsp;\x3c/div\x3e', id: "preview", type: "html" }], type: "hbox" }] }], height: h, title: e.lang.codemirror.source, width: f, onLoad: function () {
          this.definition._createCodeMirrorEditor();
        }, onOk: function () {
          var a = this.definition,
              b = this.getParentEditor(),
              a = a.codeMirrorEditor.getValue(),
              c = b.getData();a !== c && b.setData(a);b.setMode("wysiwyg");
        }, onShow: function () {
          var a = this.definition.codeMirrorEditor,
              b = this.getParentEditor().getData();a && a.getValue() !== b && a.setValue(b);
        } };
    });
  }
});
//# sourceMappingURL=codemirrordialog.js.map