Liferay.Loader.define("dynamic-data-mapping-form-field-type$liferay-ckeditor@4.21.0-liferay.1/ckeditor/plugins/uploadimage/plugin", ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    /*
    Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
    For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
    */
    (function () {
      function l(a) {
        9 >= a && (a = "0" + a);return String(a);
      }function n(a) {
        var b = new Date(),
            b = [b.getFullYear(), b.getMonth() + 1, b.getDate(), b.getHours(), b.getMinutes(), b.getSeconds()];d += 1;return "image-" + CKEDITOR.tools.array.map(b, l).join("") + "-" + d + "." + a;
      }var d = 0;CKEDITOR.plugins.add("uploadimage", { requires: "uploadwidget", onLoad: function () {
          CKEDITOR.addCss(".cke_upload_uploading img{opacity: 0.3}");
        }, isSupportedEnvironment: function () {
          return CKEDITOR.plugins.clipboard.isFileApiSupported;
        }, init: function (a) {
          if (this.isSupportedEnvironment()) {
            var b = CKEDITOR.fileTools,
                d = b.getUploadUrl(a.config, "image");d && (a.config.clipboard_handleImages && (a.config.clipboard_handleImages = !1, CKEDITOR.warn("clipboard-image-handling-disabled", { editor: a.name, plugin: "uploadimage" })), b.addUploadWidget(a, "uploadimage", { supportedTypes: a.config.uploadImage_supportedTypes, uploadUrl: d, fileToElement: function () {
                var a = new CKEDITOR.dom.element("img");a.setAttribute("src", "data:image/gif;base64,R0lGODlhDgAOAIAAAAAAAP///yH5BAAAAAAALAAAAAAOAA4AAAIMhI+py+0Po5y02qsKADs\x3d");return a;
              },
              parts: { img: "img" }, onUploading: function (a) {
                this.parts.img.setAttribute("src", a.data);
              }, onUploaded: function (a) {
                var b = this.parts.img.$;this.replaceWith('\x3cimg src\x3d"' + a.url + '" width\x3d"' + (a.responseData.width || b.naturalWidth) + '" height\x3d"' + (a.responseData.height || b.naturalHeight) + '"\x3e');
              } }), a.on("paste", function (g) {
              if (g.data.dataValue.match(/<img[\s\S]+data:/i)) {
                g = g.data;var e = document.implementation.createHTMLDocument(""),
                    e = new CKEDITOR.dom.element(e.body),
                    m,
                    f,
                    k;e.data("cke-editable", 1);e.appendHtml(g.dataValue);
                m = e.find("img");for (k = 0; k < m.count(); k++) {
                  f = m.getItem(k);var c = f.getAttribute("src"),
                      h = c && "data:" == c.substring(0, 5),
                      l = null === f.data("cke-realelement");h && l && !f.data("cke-upload-id") && !f.isReadOnly(1) && (h = (h = c.match(/image\/([a-z]+?);/i)) && h[1] || "jpg", c = a.uploadRepository.create(c, n(h)), c.upload(d), b.markElement(f, "uploadimage", c.id), b.bindNotifications(a, c));
                }g.dataValue = e.getHtml();
              }
            }));
          }
        } });CKEDITOR.config.uploadImage_supportedTypes = /image\/(jpeg|png|gif|bmp)/;
    })();
  }
});
//# sourceMappingURL=plugin.js.map