@ckeditor/ckeditor5-ckbox 44.1.0 → 44.2.0-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +1 -1
- package/build/ckbox.js +2 -2
- package/dist/index-content.css +2 -2
- package/dist/index-editor.css +2 -2
- package/dist/index.css +3 -3
- package/dist/index.css.map +1 -1
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/dist/translations/af.d.ts +2 -2
- package/dist/translations/af.js +2 -2
- package/dist/translations/af.umd.js +2 -2
- package/dist/translations/ar.d.ts +2 -2
- package/dist/translations/ar.js +2 -2
- package/dist/translations/ar.umd.js +2 -2
- package/dist/translations/ast.d.ts +2 -2
- package/dist/translations/ast.js +2 -2
- package/dist/translations/ast.umd.js +2 -2
- package/dist/translations/az.d.ts +2 -2
- package/dist/translations/az.js +2 -2
- package/dist/translations/az.umd.js +2 -2
- package/dist/translations/bg.d.ts +2 -2
- package/dist/translations/bg.js +2 -2
- package/dist/translations/bg.umd.js +2 -2
- package/dist/translations/bn.d.ts +2 -2
- package/dist/translations/bn.js +2 -2
- package/dist/translations/bn.umd.js +2 -2
- package/dist/translations/bs.d.ts +2 -2
- package/dist/translations/bs.js +2 -2
- package/dist/translations/bs.umd.js +2 -2
- package/dist/translations/ca.d.ts +2 -2
- package/dist/translations/ca.js +2 -2
- package/dist/translations/ca.umd.js +2 -2
- package/dist/translations/cs.d.ts +2 -2
- package/dist/translations/cs.js +2 -2
- package/dist/translations/cs.umd.js +2 -2
- package/dist/translations/da.d.ts +2 -2
- package/dist/translations/da.js +2 -2
- package/dist/translations/da.umd.js +2 -2
- package/dist/translations/de-ch.d.ts +2 -2
- package/dist/translations/de-ch.js +2 -2
- package/dist/translations/de-ch.umd.js +2 -2
- package/dist/translations/de.d.ts +2 -2
- package/dist/translations/de.js +2 -2
- package/dist/translations/de.umd.js +2 -2
- package/dist/translations/el.d.ts +2 -2
- package/dist/translations/el.js +2 -2
- package/dist/translations/el.umd.js +2 -2
- package/dist/translations/en-au.d.ts +2 -2
- package/dist/translations/en-au.js +2 -2
- package/dist/translations/en-au.umd.js +2 -2
- package/dist/translations/en-gb.d.ts +2 -2
- package/dist/translations/en-gb.js +2 -2
- package/dist/translations/en-gb.umd.js +2 -2
- package/dist/translations/en.d.ts +2 -2
- package/dist/translations/en.js +2 -2
- package/dist/translations/en.umd.js +2 -2
- package/dist/translations/eo.d.ts +2 -2
- package/dist/translations/eo.js +2 -2
- package/dist/translations/eo.umd.js +2 -2
- package/dist/translations/es-co.d.ts +2 -2
- package/dist/translations/es-co.js +2 -2
- package/dist/translations/es-co.umd.js +2 -2
- package/dist/translations/es.d.ts +2 -2
- package/dist/translations/es.js +2 -2
- package/dist/translations/es.umd.js +2 -2
- package/dist/translations/et.d.ts +2 -2
- package/dist/translations/et.js +2 -2
- package/dist/translations/et.umd.js +2 -2
- package/dist/translations/eu.d.ts +2 -2
- package/dist/translations/eu.js +2 -2
- package/dist/translations/eu.umd.js +2 -2
- package/dist/translations/fa.d.ts +2 -2
- package/dist/translations/fa.js +2 -2
- package/dist/translations/fa.umd.js +2 -2
- package/dist/translations/fi.d.ts +2 -2
- package/dist/translations/fi.js +2 -2
- package/dist/translations/fi.umd.js +2 -2
- package/dist/translations/fr.d.ts +2 -2
- package/dist/translations/fr.js +2 -2
- package/dist/translations/fr.umd.js +2 -2
- package/dist/translations/gl.d.ts +2 -2
- package/dist/translations/gl.js +2 -2
- package/dist/translations/gl.umd.js +2 -2
- package/dist/translations/gu.d.ts +2 -2
- package/dist/translations/gu.js +2 -2
- package/dist/translations/gu.umd.js +2 -2
- package/dist/translations/he.d.ts +2 -2
- package/dist/translations/he.js +2 -2
- package/dist/translations/he.umd.js +2 -2
- package/dist/translations/hi.d.ts +2 -2
- package/dist/translations/hi.js +2 -2
- package/dist/translations/hi.umd.js +2 -2
- package/dist/translations/hr.d.ts +2 -2
- package/dist/translations/hr.js +2 -2
- package/dist/translations/hr.umd.js +2 -2
- package/dist/translations/hu.d.ts +2 -2
- package/dist/translations/hu.js +2 -2
- package/dist/translations/hu.umd.js +2 -2
- package/dist/translations/hy.d.ts +2 -2
- package/dist/translations/hy.js +2 -2
- package/dist/translations/hy.umd.js +2 -2
- package/dist/translations/id.d.ts +2 -2
- package/dist/translations/id.js +2 -2
- package/dist/translations/id.umd.js +2 -2
- package/dist/translations/it.d.ts +2 -2
- package/dist/translations/it.js +2 -2
- package/dist/translations/it.umd.js +2 -2
- package/dist/translations/ja.d.ts +2 -2
- package/dist/translations/ja.js +2 -2
- package/dist/translations/ja.umd.js +2 -2
- package/dist/translations/jv.d.ts +2 -2
- package/dist/translations/jv.js +2 -2
- package/dist/translations/jv.umd.js +2 -2
- package/dist/translations/kk.d.ts +2 -2
- package/dist/translations/kk.js +2 -2
- package/dist/translations/kk.umd.js +2 -2
- package/dist/translations/km.d.ts +2 -2
- package/dist/translations/km.js +2 -2
- package/dist/translations/km.umd.js +2 -2
- package/dist/translations/kn.d.ts +2 -2
- package/dist/translations/kn.js +2 -2
- package/dist/translations/kn.umd.js +2 -2
- package/dist/translations/ko.d.ts +2 -2
- package/dist/translations/ko.js +2 -2
- package/dist/translations/ko.umd.js +2 -2
- package/dist/translations/ku.d.ts +2 -2
- package/dist/translations/ku.js +2 -2
- package/dist/translations/ku.umd.js +2 -2
- package/dist/translations/lt.d.ts +2 -2
- package/dist/translations/lt.js +2 -2
- package/dist/translations/lt.umd.js +2 -2
- package/dist/translations/lv.d.ts +2 -2
- package/dist/translations/lv.js +2 -2
- package/dist/translations/lv.umd.js +2 -2
- package/dist/translations/ms.d.ts +2 -2
- package/dist/translations/ms.js +2 -2
- package/dist/translations/ms.umd.js +2 -2
- package/dist/translations/nb.d.ts +2 -2
- package/dist/translations/nb.js +2 -2
- package/dist/translations/nb.umd.js +2 -2
- package/dist/translations/ne.d.ts +2 -2
- package/dist/translations/ne.js +2 -2
- package/dist/translations/ne.umd.js +2 -2
- package/dist/translations/nl.d.ts +2 -2
- package/dist/translations/nl.js +2 -2
- package/dist/translations/nl.umd.js +2 -2
- package/dist/translations/no.d.ts +2 -2
- package/dist/translations/no.js +2 -2
- package/dist/translations/no.umd.js +2 -2
- package/dist/translations/oc.d.ts +2 -2
- package/dist/translations/oc.js +2 -2
- package/dist/translations/oc.umd.js +2 -2
- package/dist/translations/pl.d.ts +2 -2
- package/dist/translations/pl.js +2 -2
- package/dist/translations/pl.umd.js +2 -2
- package/dist/translations/pt-br.d.ts +2 -2
- package/dist/translations/pt-br.js +2 -2
- package/dist/translations/pt-br.umd.js +2 -2
- package/dist/translations/pt.d.ts +2 -2
- package/dist/translations/pt.js +2 -2
- package/dist/translations/pt.umd.js +2 -2
- package/dist/translations/ro.d.ts +2 -2
- package/dist/translations/ro.js +2 -2
- package/dist/translations/ro.umd.js +2 -2
- package/dist/translations/ru.d.ts +2 -2
- package/dist/translations/ru.js +2 -2
- package/dist/translations/ru.umd.js +2 -2
- package/dist/translations/si.d.ts +2 -2
- package/dist/translations/si.js +2 -2
- package/dist/translations/si.umd.js +2 -2
- package/dist/translations/sk.d.ts +2 -2
- package/dist/translations/sk.js +2 -2
- package/dist/translations/sk.umd.js +2 -2
- package/dist/translations/sl.d.ts +2 -2
- package/dist/translations/sl.js +2 -2
- package/dist/translations/sl.umd.js +2 -2
- package/dist/translations/sq.d.ts +2 -2
- package/dist/translations/sq.js +2 -2
- package/dist/translations/sq.umd.js +2 -2
- package/dist/translations/sr-latn.d.ts +2 -2
- package/dist/translations/sr-latn.js +2 -2
- package/dist/translations/sr-latn.umd.js +2 -2
- package/dist/translations/sr.d.ts +2 -2
- package/dist/translations/sr.js +2 -2
- package/dist/translations/sr.umd.js +2 -2
- package/dist/translations/sv.d.ts +2 -2
- package/dist/translations/sv.js +2 -2
- package/dist/translations/sv.umd.js +2 -2
- package/dist/translations/th.d.ts +2 -2
- package/dist/translations/th.js +2 -2
- package/dist/translations/th.umd.js +2 -2
- package/dist/translations/ti.d.ts +2 -2
- package/dist/translations/ti.js +2 -2
- package/dist/translations/ti.umd.js +2 -2
- package/dist/translations/tk.d.ts +2 -2
- package/dist/translations/tk.js +2 -2
- package/dist/translations/tk.umd.js +2 -2
- package/dist/translations/tr.d.ts +2 -2
- package/dist/translations/tr.js +2 -2
- package/dist/translations/tr.umd.js +2 -2
- package/dist/translations/tt.d.ts +2 -2
- package/dist/translations/tt.js +2 -2
- package/dist/translations/tt.umd.js +2 -2
- package/dist/translations/ug.d.ts +2 -2
- package/dist/translations/ug.js +2 -2
- package/dist/translations/ug.umd.js +2 -2
- package/dist/translations/uk.d.ts +2 -2
- package/dist/translations/uk.js +2 -2
- package/dist/translations/uk.umd.js +2 -2
- package/dist/translations/ur.d.ts +2 -2
- package/dist/translations/ur.js +2 -2
- package/dist/translations/ur.umd.js +2 -2
- package/dist/translations/uz.d.ts +2 -2
- package/dist/translations/uz.js +2 -2
- package/dist/translations/uz.umd.js +2 -2
- package/dist/translations/vi.d.ts +2 -2
- package/dist/translations/vi.js +2 -2
- package/dist/translations/vi.umd.js +2 -2
- package/dist/translations/zh-cn.d.ts +2 -2
- package/dist/translations/zh-cn.js +2 -2
- package/dist/translations/zh-cn.umd.js +2 -2
- package/dist/translations/zh.d.ts +2 -2
- package/dist/translations/zh.js +2 -2
- package/dist/translations/zh.umd.js +2 -2
- package/lang/translations/af.po +1 -1
- package/lang/translations/ar.po +1 -1
- package/lang/translations/ast.po +1 -1
- package/lang/translations/az.po +1 -1
- package/lang/translations/bg.po +1 -1
- package/lang/translations/bn.po +1 -1
- package/lang/translations/bs.po +1 -1
- package/lang/translations/ca.po +1 -1
- package/lang/translations/cs.po +1 -1
- package/lang/translations/da.po +1 -1
- package/lang/translations/de-ch.po +1 -1
- package/lang/translations/de.po +1 -1
- package/lang/translations/el.po +1 -1
- package/lang/translations/en-au.po +1 -1
- package/lang/translations/en-gb.po +1 -1
- package/lang/translations/en.po +1 -1
- package/lang/translations/eo.po +1 -1
- package/lang/translations/es-co.po +1 -1
- package/lang/translations/es.po +1 -1
- package/lang/translations/et.po +1 -1
- package/lang/translations/eu.po +1 -1
- package/lang/translations/fa.po +1 -1
- package/lang/translations/fi.po +1 -1
- package/lang/translations/fr.po +1 -1
- package/lang/translations/gl.po +1 -1
- package/lang/translations/gu.po +1 -1
- package/lang/translations/he.po +1 -1
- package/lang/translations/hi.po +1 -1
- package/lang/translations/hr.po +1 -1
- package/lang/translations/hu.po +1 -1
- package/lang/translations/hy.po +1 -1
- package/lang/translations/id.po +1 -1
- package/lang/translations/it.po +1 -1
- package/lang/translations/ja.po +1 -1
- package/lang/translations/jv.po +1 -1
- package/lang/translations/kk.po +1 -1
- package/lang/translations/km.po +1 -1
- package/lang/translations/kn.po +1 -1
- package/lang/translations/ko.po +1 -1
- package/lang/translations/ku.po +1 -1
- package/lang/translations/lt.po +1 -1
- package/lang/translations/lv.po +1 -1
- package/lang/translations/ms.po +1 -1
- package/lang/translations/nb.po +1 -1
- package/lang/translations/ne.po +1 -1
- package/lang/translations/nl.po +1 -1
- package/lang/translations/no.po +1 -1
- package/lang/translations/oc.po +1 -1
- package/lang/translations/pl.po +1 -1
- package/lang/translations/pt-br.po +1 -1
- package/lang/translations/pt.po +1 -1
- package/lang/translations/ro.po +1 -1
- package/lang/translations/ru.po +1 -1
- package/lang/translations/si.po +1 -1
- package/lang/translations/sk.po +1 -1
- package/lang/translations/sl.po +1 -1
- package/lang/translations/sq.po +1 -1
- package/lang/translations/sr-latn.po +1 -1
- package/lang/translations/sr.po +1 -1
- package/lang/translations/sv.po +1 -1
- package/lang/translations/th.po +1 -1
- package/lang/translations/ti.po +1 -1
- package/lang/translations/tk.po +1 -1
- package/lang/translations/tr.po +1 -1
- package/lang/translations/tt.po +1 -1
- package/lang/translations/ug.po +1 -1
- package/lang/translations/uk.po +1 -1
- package/lang/translations/ur.po +1 -1
- package/lang/translations/uz.po +1 -1
- package/lang/translations/vi.po +1 -1
- package/lang/translations/zh-cn.po +1 -1
- package/lang/translations/zh.po +1 -1
- package/package.json +32 -8
- package/src/augmentation.d.ts +1 -1
- package/src/augmentation.js +1 -1
- package/src/ckbox.d.ts +1 -1
- package/src/ckbox.js +1 -1
- package/src/ckboxcommand.d.ts +1 -1
- package/src/ckboxcommand.js +27 -9
- package/src/ckboxconfig.d.ts +17 -1
- package/src/ckboxconfig.js +1 -1
- package/src/ckboxediting.d.ts +1 -1
- package/src/ckboxediting.js +1 -1
- package/src/ckboximageedit/ckboximageeditcommand.d.ts +1 -1
- package/src/ckboximageedit/ckboximageeditcommand.js +1 -1
- package/src/ckboximageedit/ckboximageeditediting.d.ts +1 -1
- package/src/ckboximageedit/ckboximageeditediting.js +1 -1
- package/src/ckboximageedit/ckboximageeditui.d.ts +1 -1
- package/src/ckboximageedit/ckboximageeditui.js +1 -1
- package/src/ckboximageedit/utils.d.ts +1 -1
- package/src/ckboximageedit/utils.js +1 -1
- package/src/ckboximageedit.d.ts +1 -1
- package/src/ckboximageedit.js +1 -1
- package/src/ckboxui.d.ts +1 -1
- package/src/ckboxui.js +1 -1
- package/src/ckboxuploadadapter.d.ts +1 -1
- package/src/ckboxuploadadapter.js +1 -1
- package/src/ckboxutils.d.ts +1 -1
- package/src/ckboxutils.js +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/utils.d.ts +1 -1
- package/src/utils.js +1 -1
- package/theme/ckboximageedit.css +1 -1
- package/dist/augmentation.d.ts +0 -36
- package/dist/ckbox.d.ts +0 -41
- package/dist/ckboxcommand.d.ts +0 -130
- package/dist/ckboxconfig.d.ts +0 -434
- package/dist/ckboxediting.d.ts +0 -65
- package/dist/ckboximageedit/ckboximageeditcommand.d.ts +0 -109
- package/dist/ckboximageedit/ckboximageeditediting.d.ts +0 -36
- package/dist/ckboximageedit/ckboximageeditui.d.ts +0 -32
- package/dist/ckboximageedit/utils.d.ts +0 -14
- package/dist/ckboximageedit.d.ts +0 -32
- package/dist/ckboxui.d.ts +0 -60
- package/dist/ckboxuploadadapter.d.ts +0 -41
- package/dist/ckboxutils.d.ts +0 -58
- package/dist/index.d.ts +0 -21
- package/dist/utils.d.ts +0 -67
package/LICENSE.md
CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
|
|
2
2
|
==========================
|
3
3
|
|
4
4
|
**CKEditor 5 CKBox feature** (https://github.com/ckeditor/ckeditor5)<br>
|
5
|
-
Copyright (c) 2003–
|
5
|
+
Copyright (c) 2003–2025, [CKSource Holding sp. z o.o.](http://cksource.com) All rights reserved.
|
6
6
|
|
7
7
|
Licensed under a dual-license model, this software is available under:
|
8
8
|
|
package/build/ckbox.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"Cannot access default workspace.":"Cannot access default workspace.","Cannot determine a category for the uploaded file.":"Cannot determine a category for the uploaded file.","Edit image":"Edit image","Failed to determine category of edited image.":"Failed to determine category of edited image.","Open file manager":"Open file manager","Processing the edited image.":"Processing the edited image.","Server failed to process the image.":"Server failed to process the image.","You have no image editing permissions.":"You have no image editing permissions."})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
|
2
2
|
/*!
|
3
|
-
* @license Copyright (c) 2003-
|
3
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
4
4
|
* For licensing, see LICENSE.md.
|
5
|
-
*/(()=>{var e={957:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(758),o=r.n(n),i=r(935),s=r.n(i)()(o());s.push([e.id,':root{--ck-image-processing-highlight-color:#f9fafa;--ck-image-processing-background-color:#e3e5e8}.ck.ck-editor__editable .image.image-processing{position:relative}.ck.ck-editor__editable .image.image-processing:before{animation:ck-image-processing-animation 2s linear infinite;background:linear-gradient(90deg,var(--ck-image-processing-background-color),var(--ck-image-processing-highlight-color),var(--ck-image-processing-background-color));background-size:200% 100%;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ck.ck-editor__editable .image.image-processing img{height:100%}@keyframes ck-image-processing-animation{0%{background-position:200% 0}to{background-position:-200% 0}}',""]);const a=s},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,n,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(s[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);n&&s[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),r&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=r):u[2]=r),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},758:e=>{"use strict";e.exports=function(e){return e[1]}},591:e=>{"use strict";var t=[];function r(e){for(var r=-1,n=0;n<t.length;n++)if(t[n].identifier===e){r=n;break}return r}function n(e,n){for(var i={},s=[],a=0;a<e.length;a++){var c=e[a],l=n.base?c[0]+n.base:c[0],u=i[l]||0,d="".concat(l," ").concat(u);i[l]=u+1;var g=r(d),h={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==g)t[g].references++,t[g].updater(h);else{var p=o(h,n);n.byIndex=a,t.splice(a,0,{identifier:d,updater:p,references:1})}s.push(d)}return s}function o(e,t){var r=t.domAPI(t);r.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;r.update(e=t)}else r.remove()}}e.exports=function(e,o){var i=n(e=e||[],o=o||{});return function(e){e=e||[];for(var s=0;s<i.length;s++){var a=r(i[s]);t[a].references--}for(var c=n(e,o),l=0;l<i.length;l++){var u=r(i[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}i=c}}},128:e=>{"use strict";var t={};e.exports=function(e,r){var n=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},51:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(r){e.setAttribute(r,t[r])}))}},639:e=>{"use strict";var t,r=(t=[],function(e,r){return t[e]=r,t.filter(Boolean).join("\n")});function n(e,t,n,o){var i;if(n)i="";else{i="",o.supports&&(i+="@supports (".concat(o.supports,") {")),o.media&&(i+="@media ".concat(o.media," {"));var s=void 0!==o.layer;s&&(i+="@layer".concat(o.layer.length>0?" ".concat(o.layer):""," {")),i+=o.css,s&&(i+="}"),o.media&&(i+="}"),o.supports&&(i+="}")}if(e.styleSheet)e.styleSheet.cssText=r(t,i);else{var a=document.createTextNode(i),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(a,c[t]):e.appendChild(a)}}var o={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=o.singletonCounter++,r=o.singleton||(o.singleton=e.insertStyleElement(e));return{update:function(e){n(r,t,!1,e)},remove:function(e){n(r,t,!0,e)}}}},782:(e,t,r)=>{e.exports=r(237)("./src/core.js")},783:(e,t,r)=>{e.exports=r(237)("./src/engine.js")},311:(e,t,r)=>{e.exports=r(237)("./src/ui.js")},260:(e,t,r)=>{e.exports=r(237)("./src/upload.js")},584:(e,t,r)=>{e.exports=r(237)("./src/utils.js")},237:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{CKBox:()=>U,CKBoxEditing:()=>O,CKBoxImageEdit:()=>Tr,CKBoxImageEditEditing:()=>kr,CKBoxImageEditUI:()=>xr,CKBoxUI:()=>o});var e=r(782),t=r(311);class o extends e.Plugin{static get pluginName(){return"CKBoxUI"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor;e.commands.get("ckbox")&&(e.ui.componentFactory.add("ckbox",(()=>this._createFileToolbarButton())),e.ui.componentFactory.add("menuBar:ckbox",(()=>this._createFileMenuBarButton())),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"assetManager",observable:()=>e.commands.get("ckbox"),buttonViewCreator:()=>this._createImageToolbarButton(),formViewCreator:()=>this._createImageDropdownButton(),menuBarButtonViewCreator:e=>this._createImageMenuBarButton(e?"insertOnly":"insertNested")}))}_createButton(e){const t=this.editor,r=new e(t.locale),n=t.commands.get("ckbox");return r.bind("isOn","isEnabled").to(n,"value","isEnabled"),r.on("execute",(()=>{t.execute("ckbox")})),r}_createFileToolbarButton(){const r=this.editor.locale.t,n=this._createButton(t.ButtonView);return n.icon=e.icons.browseFiles,n.label=r("Open file manager"),n.tooltip=!0,n}_createImageToolbarButton(){const r=this.editor.locale.t,n=this.editor.plugins.get("ImageInsertUI"),o=this._createButton(t.ButtonView);return o.icon=e.icons.imageAssetManager,o.bind("label").to(n,"isImageSelected",(e=>r(e?"Replace image with file manager":"Insert image with file manager"))),o.tooltip=!0,o}_createImageDropdownButton(){const r=this.editor.locale.t,n=this.editor.plugins.get("ImageInsertUI"),o=this._createButton(t.ButtonView);return o.icon=e.icons.imageAssetManager,o.withText=!0,o.bind("label").to(n,"isImageSelected",(e=>r(e?"Replace with file manager":"Insert with file manager"))),o.on("execute",(()=>{n.dropdownView.isOpen=!1})),o}_createFileMenuBarButton(){const r=this.editor.locale.t,n=this._createButton(t.MenuBarMenuListItemButtonView);return n.icon=e.icons.browseFiles,n.withText=!0,n.label=r("File"),n}_createImageMenuBarButton(r){const n=this.editor.locale.t,o=this.editor.locale.t,i=this._createButton(t.MenuBarMenuListItemButtonView);switch(i.icon=e.icons.imageAssetManager,i.withText=!0,r){case"insertOnly":i.label=n("Image");break;case"insertNested":i.label=o("With file manager")}return i}}var i=r(783),s=r(584),a=["0","1","2","3","4","5","6","7","8","9","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","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],c=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];t=83*t+a.indexOf(n)}return t},l=e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},u=e=>{let t=Math.max(0,Math.min(1,e));return t<=.0031308?Math.trunc(12.92*t*255+.5):Math.trunc(255*(1.055*Math.pow(t,.4166666666666667)-.055)+.5)},d=(e,t)=>(e=>e<0?-1:1)(e)*Math.pow(Math.abs(e),t),g=class extends Error{constructor(e){super(e),this.name="ValidationError",this.message=e}},h=e=>{if(!e||e.length<6)throw new g("The blurhash string must be at least 6 characters");let t=c(e[0]),r=Math.floor(t/9)+1,n=t%9+1;if(e.length!==4+2*n*r)throw new g(`blurhash length mismatch: length is ${e.length} but it should be ${4+2*n*r}`)},p=e=>{let t=e>>8&255,r=255&e;return[l(e>>16),l(t),l(r)]},m=(e,t)=>{let r=Math.floor(e/361),n=Math.floor(e/19)%19,o=e%19;return[d((r-9)/9,2)*t,d((n-9)/9,2)*t,d((o-9)/9,2)*t]},f=(e,t,r,n)=>{h(e),n|=1;let o=c(e[0]),i=Math.floor(o/9)+1,s=o%9+1,a=(c(e[1])+1)/166,l=new Array(s*i);for(let t=0;t<l.length;t++)if(0===t){let r=c(e.substring(2,6));l[t]=p(r)}else{let r=c(e.substring(4+2*t,6+2*t));l[t]=m(r,a*n)}let d=4*t,g=new Uint8ClampedArray(d*r);for(let e=0;e<r;e++)for(let n=0;n<t;n++){let o=0,a=0,c=0;for(let u=0;u<i;u++)for(let i=0;i<s;i++){let d=Math.cos(Math.PI*n*i/t)*Math.cos(Math.PI*e*u/r),g=l[i+u*s];o+=g[0]*d,a+=g[1]*d,c+=g[2]*d}let h=u(o),p=u(a),m=u(c);g[4*n+0+e*d]=h,g[4*n+1+e*d]=p,g[4*n+2+e*d]=m,g[4*n+3+e*d]=255}return g};function b(e){const t=[];let r=0;for(const n in e){const o=parseInt(n,10);isNaN(o)||(o>r&&(r=o),t.push(`${e[n]} ${n}w`))}const n=[{srcset:t.join(","),sizes:`(max-width: ${r}px) 100vw, ${r}px`,type:"image/webp"}];return{imageFallbackUrl:e.default,imageSources:n}}function v({url:e,method:t="GET",data:r,onUploadProgress:n,signal:o,authorization:i}){const s=new XMLHttpRequest;s.open(t,e.toString()),s.setRequestHeader("Authorization",i),s.setRequestHeader("CKBox-Version","CKEditor 5"),s.responseType="json";const a=()=>{s.abort()};return new Promise(((e,t)=>{o.throwIfAborted(),o.addEventListener("abort",a),s.addEventListener("loadstart",(()=>{o.addEventListener("abort",a)})),s.addEventListener("loadend",(()=>{o.removeEventListener("abort",a)})),s.addEventListener("error",(()=>{t()})),s.addEventListener("abort",(()=>{t()})),s.addEventListener("load",(()=>{const r=s.response;if(!r||r.statusCode>=400)return t(r&&r.message);e(r)})),n&&s.upload.addEventListener("progress",(e=>{n(e)})),s.send(r)}))}const w={"image/gif":"gif","image/jpeg":"jpg","image/png":"png","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"};class _ extends e.Command{constructor(e){super(e),this._chosenAssets=new Set,this._wrapper=null,this._initListeners()}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){this.fire("ckbox:open")}_getValue(){return null!==this._wrapper}_checkEnabled(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");return!(!e.isEnabled&&!t.isEnabled)}_prepareOptions(){const e=this.editor.config.get("ckbox"),t=e.dialog,r=e.categories,n=e.view,o=e.upload;return{theme:e.theme,language:e.language,tokenUrl:e.tokenUrl,serviceOrigin:e.serviceOrigin,forceDemoLabel:e.forceDemoLabel,choosableFileExtensions:e.choosableFileExtensions,assets:{onChoose:e=>this.fire("ckbox:choose",e)},dialog:{onClose:()=>this.fire("ckbox:close"),width:t&&t.width,height:t&&t.height},categories:r&&{icons:r.icons},view:n&&{openLastView:n.openLastView,startupFolderId:n.startupFolderId,startupCategoryId:n.startupCategoryId,hideMaximizeButton:n.hideMaximizeButton},upload:o&&{componentsHideTimeout:o.componentsHideTimeout,dialogMinimizeTimeout:o.dialogMinimizeTimeout}}}_initListeners(){const e=this.editor,t=e.model,r=!e.config.get("ckbox.ignoreDataId");this.on("ckbox",(()=>{this.refresh()}),{priority:"low"}),this.on("ckbox:open",(()=>{this.isEnabled&&!this.value&&(this._wrapper=(0,s.createElement)(document,"div",{class:"ck ckbox-wrapper"}),document.body.appendChild(this._wrapper),window.CKBox.mount(this._wrapper,this._prepareOptions()))})),this.on("ckbox:close",(()=>{this.value&&(this._wrapper.remove(),this._wrapper=null,e.editing.view.focus())})),this.on("ckbox:choose",((n,o)=>{if(!this.isEnabled)return;const i=e.commands.get("insertImage"),s=e.commands.get("link"),a=function({assets:e,isImageAllowed:t,isLinkAllowed:r}){return e.map((e=>function(e){const t=e.data.metadata;if(!t)return!1;return t.width&&t.height}(e)?{id:e.data.id,type:"image",attributes:y(e)}:{id:e.data.id,type:"link",attributes:k(e)})).filter((e=>"image"===e.type?t:r))}({assets:o,isImageAllowed:i.isEnabled,isLinkAllowed:s.isEnabled}),c=a.length;0!==c&&(t.change((e=>{for(const t of a){const n=t===a[c-1],o=1===c;this._insertAsset(t,n,e,o),r&&(setTimeout((()=>this._chosenAssets.delete(t)),1e3),this._chosenAssets.add(t))}})),e.editing.view.focus())})),this.listenTo(e,"destroy",(()=>{this.fire("ckbox:close"),this._chosenAssets.clear()}))}_insertAsset(e,t,r,n){const o=this.editor.model.document.selection;r.removeSelectionAttribute("linkHref"),"image"===e.type?this._insertImage(e):this._insertLink(e,r,n),t||r.setSelection(o.getLastPosition())}_insertImage(e){const t=this.editor,{imageFallbackUrl:r,imageSources:n,imageTextAlternative:o,imageWidth:i,imageHeight:s,imagePlaceholder:a}=e.attributes;t.execute("insertImage",{source:{src:r,sources:n,alt:o,width:i,height:s,...a?{placeholder:a}:null}})}_insertLink(e,t,r){const n=this.editor,o=n.model,i=o.document.selection,{linkName:a,linkHref:c}=e.attributes;if(i.isCollapsed){const e=(0,s.toMap)(i.getAttributes()),l=t.createText(a,e);if(!r){const e=i.getLastPosition(),r=e.parent;"paragraph"===r.name&&r.isEmpty||n.execute("insertParagraph",{position:e});const s=o.insertContent(l);return t.setSelection(s),void n.execute("link",c)}const u=o.insertContent(l);t.setSelection(u)}n.execute("link",c)}}function y(e){const{imageFallbackUrl:t,imageSources:r}=b(e.data.imageUrls),{description:n,width:o,height:i,blurHash:s}=e.data.metadata,a=function(e){if(e)try{const t="32px",r=document.createElement("canvas");r.setAttribute("width",t),r.setAttribute("height",t);const n=r.getContext("2d");if(!n)return;const o=n.createImageData(32,32),i=f(e,32,32);return o.data.set(i),n.putImageData(o,0,0),r.toDataURL()}catch(e){return}}(s);return{imageFallbackUrl:t,imageSources:r,imageTextAlternative:n||"",imageWidth:o,imageHeight:i,...a?{imagePlaceholder:a}:null}}function k(e){return{linkName:e.data.name,linkHref:x(e)}}function x(e){const t=new URL(e.data.url);return t.searchParams.set("download","true"),t.toString()}var I=r(260);class A extends e.Plugin{static get pluginName(){return"CKBoxUtils"}static get isOfficialPlugin(){return!0}static get requires(){return["CloudServices"]}init(){const e=this.editor,t=!!e.config.get("ckbox"),r=!!window.CKBox;if(!t&&!r)return;e.config.define("ckbox",{serviceOrigin:"https://api.ckbox.io",defaultUploadCategories:null,ignoreDataId:!1,language:e.locale.uiLanguage,theme:"lark",tokenUrl:e.config.get("cloudServices.tokenUrl")});const n=e.plugins.get("CloudServices"),o=e.config.get("cloudServices.tokenUrl"),i=e.config.get("ckbox.tokenUrl");if(!i)throw new s.CKEditorError("ckbox-plugin-missing-token-url",this);this._token=i==o?Promise.resolve(n.token):n.registerTokenUrl(i)}getToken(){return this._token}async getWorkspaceId(){const e=(0,this.editor.t)("Cannot access default workspace."),t=this.editor.config.get("ckbox.defaultUploadWorkspaceId"),r=function(e,t){const[,r]=e.value.split("."),n=JSON.parse(atob(r)),o=n.auth&&n.auth.ckbox&&n.auth.ckbox.workspaces||[n.aud];return t?"superadmin"==(n.auth&&n.auth.ckbox&&n.auth.ckbox.role)||o.includes(t)?t:null:o[0]}(await this._token,t);if(null==r)throw(0,s.logError)("ckbox-access-default-workspace-error"),e;return r}async getCategoryIdForFile(e,t){const r=(0,this.editor.t)("Cannot determine a category for the uploaded file."),n=this.editor.config.get("ckbox.defaultUploadCategories"),o=this._getAvailableCategories(t),i="string"==typeof e?(s=await async function(e,t){try{const r=await fetch(e,{method:"HEAD",cache:"force-cache",...t});return r.ok&&r.headers.get("content-type")||""}catch{return""}}(e,t),w[s]):e.name.match(/\.(?<ext>[^.]+)$/).groups.ext.toLowerCase();var s;const a=await o;if(!a)throw r;if(n){const e=Object.keys(n).find((e=>n[e].find((e=>e.toLowerCase()==i))));if(e){const t=a.find((t=>t.id===e||t.name===e));if(!t)throw r;return t.id}}const c=a.find((e=>e.extensions.find((e=>e.toLowerCase()==i))));if(!c)throw r;return c.id}async _getAvailableCategories(e){const t=this.editor,r=this._token,{signal:n}=e,o=t.config.get("ckbox.serviceOrigin"),i=await this.getWorkspaceId();try{const e=[];let t,r=0;do{const n=await a(r);e.push(...n.items),t=n.totalCount-(r+50),r+=50}while(t>0);return e}catch{return n.throwIfAborted(),void(0,s.logError)("ckbox-fetch-category-http-error")}async function a(e){const t=new URL("categories",o);return t.searchParams.set("limit",String(50)),t.searchParams.set("offset",String(e)),t.searchParams.set("workspaceId",i),v({url:t,signal:n,authorization:(await r).value})}}}class E extends e.Plugin{static get requires(){return["ImageUploadEditing","ImageUploadProgress",I.FileRepository,O]}static get pluginName(){return"CKBoxUploadAdapter"}static get isOfficialPlugin(){return!0}async afterInit(){const e=this.editor,t=!!e.config.get("ckbox"),r=!!window.CKBox;if(!t&&!r)return;const n=e.plugins.get(I.FileRepository),o=e.plugins.get(A);n.createUploadAdapter=t=>new j(t,e,o);const i=!e.config.get("ckbox.ignoreDataId"),s=e.plugins.get("ImageUploadEditing");i&&s.on("uploadComplete",((t,{imageElement:r,data:n})=>{e.model.change((e=>{e.setAttribute("ckboxImageId",n.ckboxImageId,r)}))}))}}class j{constructor(e,t,r){this.loader=e,this.token=r.getToken(),this.ckboxUtils=r,this.editor=t,this.controller=new AbortController,this.serviceOrigin=t.config.get("ckbox.serviceOrigin")}async upload(){const e=this.ckboxUtils,t=this.editor.t,r=await this.loader.file,n=await e.getCategoryIdForFile(r,{signal:this.controller.signal}),o=new URL("assets",this.serviceOrigin),i=new FormData;o.searchParams.set("workspaceId",await e.getWorkspaceId()),i.append("categoryId",n),i.append("file",r);return v({method:"POST",url:o,data:i,onUploadProgress:e=>{e.lengthComputable&&(this.loader.uploadTotal=e.total,this.loader.uploaded=e.loaded)},signal:this.controller.signal,authorization:(await this.token).value}).then((async e=>{const t=b(e.imageUrls);return{ckboxImageId:e.id,default:t.imageFallbackUrl,sources:t.imageSources}})).catch((()=>{const e=t("Cannot upload file:")+` ${r.name}.`;return Promise.reject(e)}))}abort(){this.controller.abort()}}const C="NoPermission";class O extends e.Plugin{static get pluginName(){return"CKBoxEditing"}static get isOfficialPlugin(){return!0}static get requires(){return["LinkEditing","PictureEditing",E,A]}init(){const e=this.editor;this._shouldBeInitialised()&&(this._checkImagePlugins(),L()&&e.commands.add("ckbox",new _(e)),async function(e){const t=e.plugins.get(A),r=e.config.get("ckbox.serviceOrigin"),n=new URL("permissions",r),{value:o}=await t.getToken(),i=await v({url:n,authorization:o,signal:(new AbortController).signal});return Object.values(i).some((e=>e["asset:create"]))}(e).then((e=>{e||this._blockImageCommands()})))}afterInit(){const e=this.editor;this._shouldBeInitialised()&&(e.config.get("ckbox.ignoreDataId")||(this._initSchema(),this._initConversion(),this._initFixers()))}_shouldBeInitialised(){return!!this.editor.config.get("ckbox")||L()}_blockImageCommands(){const e=this.editor,t=e.commands.get("uploadImage"),r=e.commands.get("ckboxImageEdit");t&&(t.isAccessAllowed=!1,t.forceDisabled(C)),r&&r.forceDisabled(C)}_checkImagePlugins(){const e=this.editor;e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||(0,s.logError)("ckbox-plugin-image-feature-missing",e)}_initSchema(){const e=this.editor.model.schema;e.extend("$text",{allowAttributes:"ckboxLinkId"}),e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.addAttributeCheck((e=>{if(!e.last.getAttribute("linkHref"))return!1}),"ckboxLinkId")}_initConversion(){const e=this.editor;e.conversion.for("downcast").add((e=>{e.on("attribute:ckboxLinkId:imageBlock",((e,t,r)=>{const{writer:n,mapper:o,consumable:i}=r;if(!i.consume(t.item,e.name))return;const s=[...o.toViewElement(t.item).getChildren()].find((e=>"a"===e.name));s&&(t.item.hasAttribute("ckboxLinkId")?n.setAttribute("data-ckbox-resource-id",t.item.getAttribute("ckboxLinkId"),s):n.removeAttribute("data-ckbox-resource-id",s))}),{priority:"low"}),e.on("attribute:ckboxLinkId",((e,t,r)=>{const{writer:n,mapper:o,consumable:i}=r;if(i.consume(t.item,e.name)){if(t.attributeOldValue){const e=S(n,t.attributeOldValue);n.unwrap(o.toViewRange(t.range),e)}if(t.attributeNewValue){const e=S(n,t.attributeNewValue);if(t.item.is("selection")){const t=n.document.selection;n.wrap(t.getFirstRange(),e)}else n.wrap(o.toViewRange(t.range),e)}}}),{priority:"low"})})),e.conversion.for("upcast").add((e=>{e.on("element:a",((e,t,r)=>{const{writer:n,consumable:o}=r;if(!t.viewItem.getAttribute("href"))return;if(!o.consume(t.viewItem,{attributes:["data-ckbox-resource-id"]}))return;const i=t.viewItem.getAttribute("data-ckbox-resource-id");if(i)if(t.modelRange)for(let e of t.modelRange.getItems())e.is("$textProxy")&&(e=e.textNode),B(e)&&n.setAttribute("ckboxLinkId",i,e);else{const e=t.modelCursor.nodeBefore||t.modelCursor.parent;n.setAttribute("ckboxLinkId",i,e)}}),{priority:"low"})})),e.conversion.for("downcast").attributeToAttribute({model:"ckboxImageId",view:"data-ckbox-resource-id"}),e.conversion.for("upcast").elementToAttribute({model:{key:"ckboxImageId",value:e=>e.getAttribute("data-ckbox-resource-id")},view:{attributes:{"data-ckbox-resource-id":/[\s\S]+/}}});const t=e.commands.get("replaceImageSource");t&&this.listenTo(t,"cleanupImage",((e,[t,r])=>{t.removeAttribute("ckboxImageId",r)}))}_initFixers(){const e=this.editor,t=e.model,r=t.document.selection;t.document.registerPostFixer(function(e){return t=>{let r=!1;const n=e.model,o=e.commands.get("ckbox");if(!o)return r;for(const e of n.document.differ.getChanges()){if("insert"!==e.type&&"attribute"!==e.type)continue;const n="insert"===e.type?new i.Range(e.position,e.position.getShiftedBy(e.length)):e.range,s="attribute"===e.type&&"linkHref"===e.attributeKey&&null===e.attributeNewValue;for(const e of n.getItems()){if(s&&e.hasAttribute("ckboxLinkId")){t.removeAttribute("ckboxLinkId",e),r=!0;continue}const n=P(e,o._chosenAssets);for(const o of n){const n="image"===o.type?"ckboxImageId":"ckboxLinkId";o.id!==e.getAttribute(n)&&(t.setAttribute(n,o.id,e),r=!0)}}}return r}}(e)),t.document.registerPostFixer(function(e){return t=>!(e.hasAttribute("linkHref")||!e.hasAttribute("ckboxLinkId"))&&(t.removeSelectionAttribute("ckboxLinkId"),!0)}(r))}}function P(e,t){const r=e.is("element","imageInline")||e.is("element","imageBlock"),n=e.hasAttribute("linkHref");return[...t].filter((t=>"image"===t.type&&r?t.attributes.imageFallbackUrl===e.getAttribute("src"):"link"===t.type&&n?t.attributes.linkHref===e.getAttribute("linkHref"):void 0))}function S(e,t){const r=e.createAttributeElement("a",{"data-ckbox-resource-id":t},{priority:5});return e.setCustomProperty("link",!0,r),r}function B(e){return!!e.is("$text")||!(!e.is("element","imageInline")&&!e.is("element","imageBlock"))}function L(){return!!window.CKBox}class U extends e.Plugin{static get pluginName(){return"CKBox"}static get isOfficialPlugin(){return!0}static get requires(){return[O,o]}}const F=function(){this.__data__=[],this.size=0};const T=function(e,t){return e===t||e!=e&&t!=t};const M=function(e,t){for(var r=e.length;r--;)if(T(e[r][0],t))return r;return-1};var z=Array.prototype.splice;const R=function(e){var t=this.__data__,r=M(t,e);return!(r<0)&&(r==t.length-1?t.pop():z.call(t,r,1),--this.size,!0)};const V=function(e){var t=this.__data__,r=M(t,e);return r<0?void 0:t[r][1]};const N=function(e){return M(this.__data__,e)>-1};const K=function(e,t){var r=this.__data__,n=M(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function D(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}D.prototype.clear=F,D.prototype.delete=R,D.prototype.get=V,D.prototype.has=N,D.prototype.set=K;const H=D;const $=function(){this.__data__=new H,this.size=0};const q=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};const W=function(e){return this.__data__.get(e)};const Z=function(e){return this.__data__.has(e)};const Y="object"==typeof global&&global&&global.Object===Object&&global;var G="object"==typeof self&&self&&self.Object===Object&&self;const J=Y||G||Function("return this")();const X=J.Symbol;var Q=Object.prototype,ee=Q.hasOwnProperty,te=Q.toString,re=X?X.toStringTag:void 0;const ne=function(e){var t=ee.call(e,re),r=e[re];try{e[re]=void 0;var n=!0}catch(e){}var o=te.call(e);return n&&(t?e[re]=r:delete e[re]),o};var oe=Object.prototype.toString;const ie=function(e){return oe.call(e)};var se=X?X.toStringTag:void 0;const ae=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":se&&se in Object(e)?ne(e):ie(e)};const ce=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const le=function(e){if(!ce(e))return!1;var t=ae(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const ue=J["__core-js_shared__"];var de,ge=(de=/[^.]+$/.exec(ue&&ue.keys&&ue.keys.IE_PROTO||""))?"Symbol(src)_1."+de:"";const he=function(e){return!!ge&&ge in e};var pe=Function.prototype.toString;const me=function(e){if(null!=e){try{return pe.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var fe=/^\[object .+?Constructor\]$/,be=Function.prototype,ve=Object.prototype,we=be.toString,_e=ve.hasOwnProperty,ye=RegExp("^"+we.call(_e).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const ke=function(e){return!(!ce(e)||he(e))&&(le(e)?ye:fe).test(me(e))};const xe=function(e,t){return null==e?void 0:e[t]};const Ie=function(e,t){var r=xe(e,t);return ke(r)?r:void 0};const Ae=Ie(J,"Map");const Ee=Ie(Object,"create");const je=function(){this.__data__=Ee?Ee(null):{},this.size=0};const Ce=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var Oe=Object.prototype.hasOwnProperty;const Pe=function(e){var t=this.__data__;if(Ee){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Oe.call(t,e)?t[e]:void 0};var Se=Object.prototype.hasOwnProperty;const Be=function(e){var t=this.__data__;return Ee?void 0!==t[e]:Se.call(t,e)};const Le=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ee&&void 0===t?"__lodash_hash_undefined__":t,this};function Ue(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ue.prototype.clear=je,Ue.prototype.delete=Ce,Ue.prototype.get=Pe,Ue.prototype.has=Be,Ue.prototype.set=Le;const Fe=Ue;const Te=function(){this.size=0,this.__data__={hash:new Fe,map:new(Ae||H),string:new Fe}};const Me=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const ze=function(e,t){var r=e.__data__;return Me(t)?r["string"==typeof t?"string":"hash"]:r.map};const Re=function(e){var t=ze(this,e).delete(e);return this.size-=t?1:0,t};const Ve=function(e){return ze(this,e).get(e)};const Ne=function(e){return ze(this,e).has(e)};const Ke=function(e,t){var r=ze(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function De(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}De.prototype.clear=Te,De.prototype.delete=Re,De.prototype.get=Ve,De.prototype.has=Ne,De.prototype.set=Ke;const He=De;const $e=function(e,t){var r=this.__data__;if(r instanceof H){var n=r.__data__;if(!Ae||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new He(n)}return r.set(e,t),this.size=r.size,this};function qe(e){var t=this.__data__=new H(e);this.size=t.size}qe.prototype.clear=$,qe.prototype.delete=q,qe.prototype.get=W,qe.prototype.has=Z,qe.prototype.set=$e;const We=qe;const Ze=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const Ye=function(e){return this.__data__.has(e)};function Ge(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new He;++t<r;)this.add(e[t])}Ge.prototype.add=Ge.prototype.push=Ze,Ge.prototype.has=Ye;const Je=Ge;const Xe=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1};const Qe=function(e,t){return e.has(t)};const et=function(e,t,r,n,o,i){var s=1&r,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=i.get(e),u=i.get(t);if(l&&u)return l==t&&u==e;var d=-1,g=!0,h=2&r?new Je:void 0;for(i.set(e,t),i.set(t,e);++d<a;){var p=e[d],m=t[d];if(n)var f=s?n(m,p,d,t,e,i):n(p,m,d,e,t,i);if(void 0!==f){if(f)continue;g=!1;break}if(h){if(!Xe(t,(function(e,t){if(!Qe(h,t)&&(p===e||o(p,e,r,n,i)))return h.push(t)}))){g=!1;break}}else if(p!==m&&!o(p,m,r,n,i)){g=!1;break}}return i.delete(e),i.delete(t),g};const tt=J.Uint8Array;const rt=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};const nt=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r};var ot=X?X.prototype:void 0,it=ot?ot.valueOf:void 0;const st=function(e,t,r,n,o,i,s){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new tt(e),new tt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return T(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=rt;case"[object Set]":var c=1&n;if(a||(a=nt),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;n|=2,s.set(e,t);var u=et(a(e),a(t),n,o,i,s);return s.delete(e),u;case"[object Symbol]":if(it)return it.call(e)==it.call(t)}return!1};const at=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e};const ct=Array.isArray;const lt=function(e,t,r){var n=t(e);return ct(e)?n:at(n,r(e))};const ut=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,i=[];++r<n;){var s=e[r];t(s,r,e)&&(i[o++]=s)}return i};const dt=function(){return[]};var gt=Object.prototype.propertyIsEnumerable,ht=Object.getOwnPropertySymbols;const pt=ht?function(e){return null==e?[]:(e=Object(e),ut(ht(e),(function(t){return gt.call(e,t)})))}:dt;const mt=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};const ft=function(e){return null!=e&&"object"==typeof e};const bt=function(e){return ft(e)&&"[object Arguments]"==ae(e)};var vt=Object.prototype,wt=vt.hasOwnProperty,_t=vt.propertyIsEnumerable;const yt=bt(function(){return arguments}())?bt:function(e){return ft(e)&&wt.call(e,"callee")&&!_t.call(e,"callee")};const kt=function(){return!1};var xt="object"==typeof exports&&exports&&!exports.nodeType&&exports,It=xt&&"object"==typeof module&&module&&!module.nodeType&&module,At=It&&It.exports===xt?J.Buffer:void 0;const Et=(At?At.isBuffer:void 0)||kt;var jt=/^(?:0|[1-9]\d*)$/;const Ct=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&jt.test(e))&&e>-1&&e%1==0&&e<t};const Ot=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Pt={};Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object Boolean]"]=Pt["[object DataView]"]=Pt["[object Date]"]=Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object WeakMap]"]=!1;const St=function(e){return ft(e)&&Ot(e.length)&&!!Pt[ae(e)]};const Bt=function(e){return function(t){return e(t)}};var Lt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ut=Lt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=Ut&&Ut.exports===Lt&&Y.process,Tt=function(){try{var e=Ut&&Ut.require&&Ut.require("util").types;return e||Ft&&Ft.binding&&Ft.binding("util")}catch(e){}}();var Mt=Tt&&Tt.isTypedArray;const zt=Mt?Bt(Mt):St;var Rt=Object.prototype.hasOwnProperty;const Vt=function(e,t){var r=ct(e),n=!r&&yt(e),o=!r&&!n&&Et(e),i=!r&&!n&&!o&&zt(e),s=r||n||o||i,a=s?mt(e.length,String):[],c=a.length;for(var l in e)!t&&!Rt.call(e,l)||s&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Ct(l,c))||a.push(l);return a};var Nt=Object.prototype;const Kt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Nt)};const Dt=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object);var Ht=Object.prototype.hasOwnProperty;const $t=function(e){if(!Kt(e))return Dt(e);var t=[];for(var r in Object(e))Ht.call(e,r)&&"constructor"!=r&&t.push(r);return t};const qt=function(e){return null!=e&&Ot(e.length)&&!le(e)};const Wt=function(e){return qt(e)?Vt(e):$t(e)};const Zt=function(e){return lt(e,Wt,pt)};var Yt=Object.prototype.hasOwnProperty;const Gt=function(e,t,r,n,o,i){var s=1&r,a=Zt(e),c=a.length;if(c!=Zt(t).length&&!s)return!1;for(var l=c;l--;){var u=a[l];if(!(s?u in t:Yt.call(t,u)))return!1}var d=i.get(e),g=i.get(t);if(d&&g)return d==t&&g==e;var h=!0;i.set(e,t),i.set(t,e);for(var p=s;++l<c;){var m=e[u=a[l]],f=t[u];if(n)var b=s?n(f,m,u,t,e,i):n(m,f,u,e,t,i);if(!(void 0===b?m===f||o(m,f,r,n,i):b)){h=!1;break}p||(p="constructor"==u)}if(h&&!p){var v=e.constructor,w=t.constructor;v==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof w&&w instanceof w||(h=!1)}return i.delete(e),i.delete(t),h};const Jt=Ie(J,"DataView");const Xt=Ie(J,"Promise");const Qt=Ie(J,"Set");const er=Ie(J,"WeakMap");var tr="[object Map]",rr="[object Promise]",nr="[object Set]",or="[object WeakMap]",ir="[object DataView]",sr=me(Jt),ar=me(Ae),cr=me(Xt),lr=me(Qt),ur=me(er),dr=ae;(Jt&&dr(new Jt(new ArrayBuffer(1)))!=ir||Ae&&dr(new Ae)!=tr||Xt&&dr(Xt.resolve())!=rr||Qt&&dr(new Qt)!=nr||er&&dr(new er)!=or)&&(dr=function(e){var t=ae(e),r="[object Object]"==t?e.constructor:void 0,n=r?me(r):"";if(n)switch(n){case sr:return ir;case ar:return tr;case cr:return rr;case lr:return nr;case ur:return or}return t});const gr=dr;var hr="[object Arguments]",pr="[object Array]",mr="[object Object]",fr=Object.prototype.hasOwnProperty;const br=function(e,t,r,n,o,i){var s=ct(e),a=ct(t),c=s?pr:gr(e),l=a?pr:gr(t),u=(c=c==hr?mr:c)==mr,d=(l=l==hr?mr:l)==mr,g=c==l;if(g&&Et(e)){if(!Et(t))return!1;s=!0,u=!1}if(g&&!u)return i||(i=new We),s||zt(e)?et(e,t,r,n,o,i):st(e,t,c,r,n,o,i);if(!(1&r)){var h=u&&fr.call(e,"__wrapped__"),p=d&&fr.call(t,"__wrapped__");if(h||p){var m=h?e.value():e,f=p?t.value():t;return i||(i=new We),o(m,f,r,n,i)}}return!!g&&(i||(i=new We),Gt(e,t,r,n,o,i))};const vr=function e(t,r,n,o,i){return t===r||(null==t||null==r||!ft(t)&&!ft(r)?t!=t&&r!=r:br(t,r,n,o,e,i))};const wr=function(e,t){return vr(e,t)};function _r(e){if(Array.isArray(e)){const t=e.map(_r);return e=>t.some((t=>t(e)))}if("origin"==e){const e=s.global.window.location.origin;return t=>new URL(t,s.global.document.baseURI).origin==e}if("function"==typeof e)return e;if(e instanceof RegExp)return t=>!(!t.match(e)&&!t.replace(/^https?:\/\//,"").match(e));return()=>!1}class yr extends e.Command{constructor(e){super(e),this._wrapper=null,this._processInProgress=new Set,this._updateUiDelayed=(0,s.delay)((()=>this.editor.ui.update()),0),this.value=!1,this._canEdit=function(e){const t=_r(e);return e=>!(!e.is("element","imageInline")&&!e.is("element","imageBlock"))&&(!!e.hasAttribute("ckboxImageId")||!!e.hasAttribute("src")&&t(e.getAttribute("src")))}(e.config.get("ckbox.allowExternalImagesEditing")),this._prepareOptions=(0,s.abortableDebounce)(((e,t)=>this._prepareOptionsAbortable(e,t))),this._prepareListeners()}refresh(){const e=this.editor;this.value=this._getValue();const t=e.model.document.selection.getSelectedElement();this.isEnabled=!!t&&this._canEdit(t)&&!this._checkIfElementIsBeingProcessed(t)}execute(){if(this._getValue())return;const e=(0,s.createElement)(document,"div",{class:"ck ckbox-wrapper"});this._wrapper=e,this.value=!0,document.body.appendChild(this._wrapper);const r={element:this.editor.model.document.selection.getSelectedElement(),controller:new AbortController};this._prepareOptions(r).then((t=>window.CKBox.mountImageEditor(e,t)),(e=>{const r=this.editor,n=r.t;r.plugins.get(t.Notification).showWarning(n("Failed to determine category of edited image."),{namespace:"ckbox"}),console.error(e),this._handleImageEditorClose()}))}destroy(){this._handleImageEditorClose(),this._prepareOptions.abort(),this._updateUiDelayed.cancel();for(const e of this._processInProgress.values())e.controller.abort();super.destroy()}_getValue(){return null!==this._wrapper}async _prepareOptionsAbortable(e,t){const r=this.editor,n=r.config.get("ckbox"),o=r.plugins.get(A),{element:i}=t;let s;const a=i.getAttribute("ckboxImageId");if(a)s={assetId:a};else{const t=new URL(i.getAttribute("src"),document.baseURI).href;s={imageUrl:t,uploadCategoryId:await o.getCategoryIdForFile(t,{signal:e})}}return{...s,imageEditing:{allowOverwrite:!1},tokenUrl:n.tokenUrl,...n.serviceOrigin&&{serviceOrigin:n.serviceOrigin},onClose:()=>this._handleImageEditorClose(),onSave:e=>this._handleImageEditorSave(t,e)}}_prepareListeners(){this.listenTo(this.editor.model.document,"change:data",(()=>{this._getProcessingStatesOfDeletedImages().forEach((e=>{e.controller.abort()}))}))}_getProcessingStatesOfDeletedImages(){const e=[];for(const t of this._processInProgress.values())"$graveyard"==t.element.root.rootName&&e.push(t);return e}_checkIfElementIsBeingProcessed(e){for(const{element:t}of this._processInProgress)if(wr(t,e))return!0;return!1}_handleImageEditorClose(){this._wrapper&&(this._wrapper.remove(),this._wrapper=null,this.editor.editing.view.focus(),this._updateUiDelayed(),this.refresh())}_handleImageEditorSave(r,n){const o=this.editor.locale.t,i=this.editor.plugins.get(t.Notification),a=this.editor.plugins.get(e.PendingActions),c=a.add(o("Processing the edited image."));this._processInProgress.add(r),this._showImageProcessingIndicator(r.element,n),this.refresh(),this._waitForAssetProcessed(n.data.id,r.controller.signal).then((e=>{this._replaceImage(r.element,e)}),(e=>{this.editor.editing.reconvertItem(r.element),r.controller.signal.aborted||(!e||e instanceof s.CKEditorError?i.showWarning(o("Server failed to process the image."),{namespace:"ckbox"}):console.error(e))})).finally((()=>{this._processInProgress.delete(r),a.remove(c),this.refresh()}))}async _getAssetStatusFromServer(e,t){const r=this.editor.plugins.get(A),n=new URL("assets/"+e,this.editor.config.get("ckbox.serviceOrigin")),o=await v({url:n,signal:t,authorization:(await r.getToken()).value}),i=o.metadata.metadataProcessingStatus;if(!i||"queued"==i)throw new s.CKEditorError("ckbox-image-not-processed");return{data:{...o}}}async _waitForAssetProcessed(e,t){const r=await(0,s.retry)((()=>this._getAssetStatusFromServer(e,t)),{signal:t,maxAttempts:5});if("success"!=r.data.metadata.metadataProcessingStatus)throw new s.CKEditorError("ckbox-image-processing-failed");return r}_showImageProcessingIndicator(e,t){const r=this.editor;r.editing.view.change((n=>{const o=r.editing.mapper.toViewElement(e),i=this.editor.plugins.get("ImageUtils").findViewImgElement(o);n.removeStyle("aspect-ratio",i),n.setAttribute("width",t.data.metadata.width,i),n.setAttribute("height",t.data.metadata.height,i),n.setStyle("width",`${t.data.metadata.width}px`,i),n.setStyle("height",`${t.data.metadata.height}px`,i),n.addClass("image-processing",o)}))}_replaceImage(e,t){const r=this.editor,{imageFallbackUrl:n,imageSources:o,imageWidth:i,imageHeight:s,imagePlaceholder:a}=y(t),c=Array.from(r.model.document.selection.getRanges());r.model.change((l=>{l.setSelection(e,"on"),r.execute("insertImage",{imageType:e.is("element","imageInline")?"imageInline":null,source:{src:n,sources:o,width:i,height:s,...a?{placeholder:a}:null,...e.hasAttribute("alt")?{alt:e.getAttribute("alt")}:null}});const u=e.getChildren();e=r.model.document.selection.getSelectedElement();for(const t of u)l.append(l.cloneElement(t),e);l.setAttribute("ckboxImageId",t.data.id,e),l.setSelection(c)}))}}class kr extends e.Plugin{static get pluginName(){return"CKBoxImageEditEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[O,A,e.PendingActions,t.Notification,"ImageUtils","ImageEditing"]}init(){const{editor:e}=this;e.commands.add("ckboxImageEdit",new yr(e))}}class xr extends e.Plugin{static get pluginName(){return"CKBoxImageEditUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("ckboxImageEdit",(r=>{const n=e.commands.get("ckboxImageEdit"),o=e.commands.get("uploadImage"),i=new t.ButtonView(r),s=r.t;return i.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037H5.06l5.058-5.078L6.617 9.15a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v4.354a3.478 3.478 0 0 1 1.5.049V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.147 2.147 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.642-3.11 2.129 2.129 0 0 0-1.873-.978ZM8.089 17.635v2.388h2.389l7.046-7.046-2.39-2.39-7.045 7.048Zm11.282-6.507a.637.637 0 0 0 .139-.692.603.603 0 0 0-.139-.205l-1.49-1.488a.63.63 0 0 0-.899 0l-1.166 1.163 2.39 2.39 1.165-1.168Z"/></svg>',tooltip:!0}),i.bind("label").to(o,"isAccessAllowed",(e=>s(e?"Edit image":"You have no image editing permissions."))),i.bind("isOn").to(n,"value",n,"isEnabled",((e,t)=>e&&t)),i.bind("isEnabled").to(n),this.listenTo(i,"execute",(()=>{e.execute("ckboxImageEdit"),e.editing.view.focus()})),i}))}}var Ir=r(591),Ar=r.n(Ir),Er=r(639),jr=r.n(Er),Cr=r(128),Or=r.n(Cr),Pr=r(21),Sr=r.n(Pr),Br=r(51),Lr=r.n(Br),Ur=r(957),Fr={attributes:{"data-cke":!0}};Fr.setAttributes=Sr(),Fr.insert=Or().bind(null,"head"),Fr.domAPI=jr(),Fr.insertStyleElement=Lr();Ar()(Ur.A,Fr);Ur.A&&Ur.A.locals&&Ur.A.locals;class Tr extends e.Plugin{static get pluginName(){return"CKBoxImageEdit"}static get isOfficialPlugin(){return!0}static get requires(){return[kr,xr]}}})(),(window.CKEditor5=window.CKEditor5||{}).ckbox=n})();
|
5
|
+
*/(()=>{var e={957:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(758),o=n.n(r),i=n(935),s=n.n(i)()(o());s.push([e.id,':root{--ck-image-processing-highlight-color:#f9fafa;--ck-image-processing-background-color:#e3e5e8}.ck.ck-editor__editable .image.image-processing{position:relative}.ck.ck-editor__editable .image.image-processing:before{animation:ck-image-processing-animation 2s linear infinite;background:linear-gradient(90deg,var(--ck-image-processing-background-color),var(--ck-image-processing-highlight-color),var(--ck-image-processing-background-color));background-size:200% 100%;content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ck.ck-editor__editable .image.image-processing img{height:100%}@keyframes ck-image-processing-animation{0%{background-position:200% 0}to{background-position:-200% 0}}',""]);const a=s},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(s[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&s[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},758:e=>{"use strict";e.exports=function(e){return e[1]}},591:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var i={},s=[],a=0;a<e.length;a++){var c=e[a],l=r.base?c[0]+r.base:c[0],u=i[l]||0,d="".concat(l," ").concat(u);i[l]=u+1;var g=n(d),h={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==g)t[g].references++,t[g].updater(h);else{var p=o(h,r);r.byIndex=a,t.splice(a,0,{identifier:d,updater:p,references:1})}s.push(d)}return s}function o(e,t){var n=t.domAPI(t);n.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var i=r(e=e||[],o=o||{});return function(e){e=e||[];for(var s=0;s<i.length;s++){var a=n(i[s]);t[a].references--}for(var c=r(e,o),l=0;l<i.length;l++){var u=n(i[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}i=c}}},128:e=>{"use strict";var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},51:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}},639:e=>{"use strict";var t,n=(t=[],function(e,n){return t[e]=n,t.filter(Boolean).join("\n")});function r(e,t,r,o){var i;if(r)i="";else{i="",o.supports&&(i+="@supports (".concat(o.supports,") {")),o.media&&(i+="@media ".concat(o.media," {"));var s=void 0!==o.layer;s&&(i+="@layer".concat(o.layer.length>0?" ".concat(o.layer):""," {")),i+=o.css,s&&(i+="}"),o.media&&(i+="}"),o.supports&&(i+="}")}if(e.styleSheet)e.styleSheet.cssText=n(t,i);else{var a=document.createTextNode(i),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(a,c[t]):e.appendChild(a)}}var o={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=o.singletonCounter++,n=o.singleton||(o.singleton=e.insertStyleElement(e));return{update:function(e){r(n,t,!1,e)},remove:function(e){r(n,t,!0,e)}}}},782:(e,t,n)=>{e.exports=n(237)("./src/core.js")},783:(e,t,n)=>{e.exports=n(237)("./src/engine.js")},311:(e,t,n)=>{e.exports=n(237)("./src/ui.js")},260:(e,t,n)=>{e.exports=n(237)("./src/upload.js")},584:(e,t,n)=>{e.exports=n(237)("./src/utils.js")},237:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{CKBox:()=>U,CKBoxEditing:()=>O,CKBoxImageEdit:()=>Mn,CKBoxImageEditEditing:()=>xn,CKBoxImageEditUI:()=>In,CKBoxUI:()=>o});var e=n(782),t=n(311);class o extends e.Plugin{static get pluginName(){return"CKBoxUI"}static get isOfficialPlugin(){return!0}afterInit(){const e=this.editor;e.commands.get("ckbox")&&(e.ui.componentFactory.add("ckbox",(()=>this._createFileToolbarButton())),e.ui.componentFactory.add("menuBar:ckbox",(()=>this._createFileMenuBarButton())),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"assetManager",observable:()=>e.commands.get("ckbox"),buttonViewCreator:()=>this._createImageToolbarButton(),formViewCreator:()=>this._createImageDropdownButton(),menuBarButtonViewCreator:e=>this._createImageMenuBarButton(e?"insertOnly":"insertNested")}))}_createButton(e){const t=this.editor,n=new e(t.locale),r=t.commands.get("ckbox");return n.bind("isOn","isEnabled").to(r,"value","isEnabled"),n.on("execute",(()=>{t.execute("ckbox")})),n}_createFileToolbarButton(){const n=this.editor.locale.t,r=this._createButton(t.ButtonView);return r.icon=e.icons.browseFiles,r.label=n("Open file manager"),r.tooltip=!0,r}_createImageToolbarButton(){const n=this.editor.locale.t,r=this.editor.plugins.get("ImageInsertUI"),o=this._createButton(t.ButtonView);return o.icon=e.icons.imageAssetManager,o.bind("label").to(r,"isImageSelected",(e=>n(e?"Replace image with file manager":"Insert image with file manager"))),o.tooltip=!0,o}_createImageDropdownButton(){const n=this.editor.locale.t,r=this.editor.plugins.get("ImageInsertUI"),o=this._createButton(t.ButtonView);return o.icon=e.icons.imageAssetManager,o.withText=!0,o.bind("label").to(r,"isImageSelected",(e=>n(e?"Replace with file manager":"Insert with file manager"))),o.on("execute",(()=>{r.dropdownView.isOpen=!1})),o}_createFileMenuBarButton(){const n=this.editor.locale.t,r=this._createButton(t.MenuBarMenuListItemButtonView);return r.icon=e.icons.browseFiles,r.withText=!0,r.label=n("File"),r}_createImageMenuBarButton(n){const r=this.editor.locale.t,o=this.editor.locale.t,i=this._createButton(t.MenuBarMenuListItemButtonView);switch(i.icon=e.icons.imageAssetManager,i.withText=!0,n){case"insertOnly":i.label=r("Image");break;case"insertNested":i.label=o("With file manager")}return i}}var i=n(783),s=n(584),a=["0","1","2","3","4","5","6","7","8","9","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","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],c=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e[n];t=83*t+a.indexOf(r)}return t},l=e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},u=e=>{let t=Math.max(0,Math.min(1,e));return t<=.0031308?Math.trunc(12.92*t*255+.5):Math.trunc(255*(1.055*Math.pow(t,.4166666666666667)-.055)+.5)},d=(e,t)=>(e=>e<0?-1:1)(e)*Math.pow(Math.abs(e),t),g=class extends Error{constructor(e){super(e),this.name="ValidationError",this.message=e}},h=e=>{if(!e||e.length<6)throw new g("The blurhash string must be at least 6 characters");let t=c(e[0]),n=Math.floor(t/9)+1,r=t%9+1;if(e.length!==4+2*r*n)throw new g(`blurhash length mismatch: length is ${e.length} but it should be ${4+2*r*n}`)},p=e=>{let t=e>>8&255,n=255&e;return[l(e>>16),l(t),l(n)]},m=(e,t)=>{let n=Math.floor(e/361),r=Math.floor(e/19)%19,o=e%19;return[d((n-9)/9,2)*t,d((r-9)/9,2)*t,d((o-9)/9,2)*t]},f=(e,t,n,r)=>{h(e),r|=1;let o=c(e[0]),i=Math.floor(o/9)+1,s=o%9+1,a=(c(e[1])+1)/166,l=new Array(s*i);for(let t=0;t<l.length;t++)if(0===t){let n=c(e.substring(2,6));l[t]=p(n)}else{let n=c(e.substring(4+2*t,6+2*t));l[t]=m(n,a*r)}let d=4*t,g=new Uint8ClampedArray(d*n);for(let e=0;e<n;e++)for(let r=0;r<t;r++){let o=0,a=0,c=0;for(let u=0;u<i;u++)for(let i=0;i<s;i++){let d=Math.cos(Math.PI*r*i/t)*Math.cos(Math.PI*e*u/n),g=l[i+u*s];o+=g[0]*d,a+=g[1]*d,c+=g[2]*d}let h=u(o),p=u(a),m=u(c);g[4*r+0+e*d]=h,g[4*r+1+e*d]=p,g[4*r+2+e*d]=m,g[4*r+3+e*d]=255}return g};function b(e){const t=[];let n=0;for(const r in e){const o=parseInt(r,10);isNaN(o)||(o>n&&(n=o),t.push(`${e[r]} ${r}w`))}const r=[{srcset:t.join(","),sizes:`(max-width: ${n}px) 100vw, ${n}px`,type:"image/webp"}];return{imageFallbackUrl:e.default,imageSources:r}}function v({url:e,method:t="GET",data:n,onUploadProgress:r,signal:o,authorization:i}){const s=new XMLHttpRequest;s.open(t,e.toString()),s.setRequestHeader("Authorization",i),s.setRequestHeader("CKBox-Version","CKEditor 5"),s.responseType="json";const a=()=>{s.abort()};return new Promise(((e,t)=>{o.throwIfAborted(),o.addEventListener("abort",a),s.addEventListener("loadstart",(()=>{o.addEventListener("abort",a)})),s.addEventListener("loadend",(()=>{o.removeEventListener("abort",a)})),s.addEventListener("error",(()=>{t()})),s.addEventListener("abort",(()=>{t()})),s.addEventListener("load",(()=>{const n=s.response;if(!n||n.statusCode>=400)return t(n&&n.message);e(n)})),r&&s.upload.addEventListener("progress",(e=>{r(e)})),s.send(n)}))}const w={"image/gif":"gif","image/jpeg":"jpg","image/png":"png","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"};class _ extends e.Command{constructor(e){super(e),this._chosenAssets=new Set,this._wrapper=null,this._initListeners()}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){this.fire("ckbox:open")}_getValue(){return null!==this._wrapper}_checkEnabled(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");return!(!e.isEnabled&&!t.isEnabled)}_prepareOptions(){const e=this.editor.config.get("ckbox"),t=e.dialog,n=e.categories,r=e.view,o=e.upload;return{theme:e.theme,language:e.language,tokenUrl:e.tokenUrl,serviceOrigin:e.serviceOrigin,forceDemoLabel:e.forceDemoLabel,choosableFileExtensions:e.choosableFileExtensions,assets:{onChoose:e=>this.fire("ckbox:choose",e)},dialog:{onClose:()=>this.fire("ckbox:close"),width:t&&t.width,height:t&&t.height},categories:n&&{icons:n.icons},view:r&&{openLastView:r.openLastView,startupFolderId:r.startupFolderId,startupCategoryId:r.startupCategoryId,hideMaximizeButton:r.hideMaximizeButton},upload:o&&{componentsHideTimeout:o.componentsHideTimeout,dialogMinimizeTimeout:o.dialogMinimizeTimeout}}}_initListeners(){const e=this.editor,t=e.model,n=!e.config.get("ckbox.ignoreDataId"),r=e.config.get("ckbox.downloadableFiles");this.on("ckbox",(()=>{this.refresh()}),{priority:"low"}),this.on("ckbox:open",(()=>{this.isEnabled&&!this.value&&(this._wrapper=(0,s.createElement)(document,"div",{class:"ck ckbox-wrapper"}),document.body.appendChild(this._wrapper),window.CKBox.mount(this._wrapper,this._prepareOptions()))})),this.on("ckbox:close",(()=>{this.value&&(this._wrapper.remove(),this._wrapper=null,e.editing.view.focus())})),this.on("ckbox:choose",((o,i)=>{if(!this.isEnabled)return;const s=e.commands.get("insertImage"),a=e.commands.get("link"),c=function({downloadableFilesConfig:e,assets:t,isImageAllowed:n,isLinkAllowed:r}){return t.map((t=>function(e){const t=e.data.metadata;if(!t)return!1;return t.width&&t.height}(t)?{id:t.data.id,type:"image",attributes:y(t)}:{id:t.data.id,type:"link",attributes:k(t,e)})).filter((e=>"image"===e.type?n:r))}({assets:i,downloadableFilesConfig:r,isImageAllowed:s.isEnabled,isLinkAllowed:a.isEnabled}),l=c.length;0!==l&&(t.change((e=>{for(const t of c){const r=t===c[l-1],o=1===l;this._insertAsset(t,r,e,o),n&&(setTimeout((()=>this._chosenAssets.delete(t)),1e3),this._chosenAssets.add(t))}})),e.editing.view.focus())})),this.listenTo(e,"destroy",(()=>{this.fire("ckbox:close"),this._chosenAssets.clear()}))}_insertAsset(e,t,n,r){const o=this.editor.model.document.selection;n.removeSelectionAttribute("linkHref"),"image"===e.type?this._insertImage(e):this._insertLink(e,n,r),t||n.setSelection(o.getLastPosition())}_insertImage(e){const t=this.editor,{imageFallbackUrl:n,imageSources:r,imageTextAlternative:o,imageWidth:i,imageHeight:s,imagePlaceholder:a}=e.attributes;t.execute("insertImage",{source:{src:n,sources:r,alt:o,width:i,height:s,...a?{placeholder:a}:null}})}_insertLink(e,t,n){const r=this.editor,o=r.model,i=o.document.selection,{linkName:a,linkHref:c}=e.attributes;if(i.isCollapsed){const e=(0,s.toMap)(i.getAttributes()),l=t.createText(a,e);if(!n){const e=i.getLastPosition(),n=e.parent;"paragraph"===n.name&&n.isEmpty||r.execute("insertParagraph",{position:e});const s=o.insertContent(l);return t.setSelection(s),void r.execute("link",c)}const u=o.insertContent(l);t.setSelection(u)}r.execute("link",c)}}function y(e){const{imageFallbackUrl:t,imageSources:n}=b(e.data.imageUrls),{description:r,width:o,height:i,blurHash:s}=e.data.metadata,a=function(e){if(e)try{const t="32px",n=document.createElement("canvas");n.setAttribute("width",t),n.setAttribute("height",t);const r=n.getContext("2d");if(!r)return;const o=r.createImageData(32,32),i=f(e,32,32);return o.data.set(i),r.putImageData(o,0,0),n.toDataURL()}catch(e){return}}(s);return{imageFallbackUrl:t,imageSources:n,imageTextAlternative:r||"",imageWidth:o,imageHeight:i,...a?{imagePlaceholder:a}:null}}function k(e,t){return{linkName:e.data.name,linkHref:x(e,t)}}function x(e,t){const n=new URL(e.data.url);return function(e,t){if("function"==typeof t)return t(e);return!0}(e,t)&&n.searchParams.set("download","true"),n.toString()}var I=n(260);class A extends e.Plugin{static get pluginName(){return"CKBoxUtils"}static get isOfficialPlugin(){return!0}static get requires(){return["CloudServices"]}init(){const e=this.editor,t=!!e.config.get("ckbox"),n=!!window.CKBox;if(!t&&!n)return;e.config.define("ckbox",{serviceOrigin:"https://api.ckbox.io",defaultUploadCategories:null,ignoreDataId:!1,language:e.locale.uiLanguage,theme:"lark",tokenUrl:e.config.get("cloudServices.tokenUrl")});const r=e.plugins.get("CloudServices"),o=e.config.get("cloudServices.tokenUrl"),i=e.config.get("ckbox.tokenUrl");if(!i)throw new s.CKEditorError("ckbox-plugin-missing-token-url",this);this._token=i==o?Promise.resolve(r.token):r.registerTokenUrl(i)}getToken(){return this._token}async getWorkspaceId(){const e=(0,this.editor.t)("Cannot access default workspace."),t=this.editor.config.get("ckbox.defaultUploadWorkspaceId"),n=function(e,t){const[,n]=e.value.split("."),r=JSON.parse(atob(n)),o=r.auth&&r.auth.ckbox&&r.auth.ckbox.workspaces||[r.aud];return t?"superadmin"==(r.auth&&r.auth.ckbox&&r.auth.ckbox.role)||o.includes(t)?t:null:o[0]}(await this._token,t);if(null==n)throw(0,s.logError)("ckbox-access-default-workspace-error"),e;return n}async getCategoryIdForFile(e,t){const n=(0,this.editor.t)("Cannot determine a category for the uploaded file."),r=this.editor.config.get("ckbox.defaultUploadCategories"),o=this._getAvailableCategories(t),i="string"==typeof e?(s=await async function(e,t){try{const n=await fetch(e,{method:"HEAD",cache:"force-cache",...t});return n.ok&&n.headers.get("content-type")||""}catch{return""}}(e,t),w[s]):e.name.match(/\.(?<ext>[^.]+)$/).groups.ext.toLowerCase();var s;const a=await o;if(!a)throw n;if(r){const e=Object.keys(r).find((e=>r[e].find((e=>e.toLowerCase()==i))));if(e){const t=a.find((t=>t.id===e||t.name===e));if(!t)throw n;return t.id}}const c=a.find((e=>e.extensions.find((e=>e.toLowerCase()==i))));if(!c)throw n;return c.id}async _getAvailableCategories(e){const t=this.editor,n=this._token,{signal:r}=e,o=t.config.get("ckbox.serviceOrigin"),i=await this.getWorkspaceId();try{const e=[];let t,n=0;do{const r=await a(n);e.push(...r.items),t=r.totalCount-(n+50),n+=50}while(t>0);return e}catch{return r.throwIfAborted(),void(0,s.logError)("ckbox-fetch-category-http-error")}async function a(e){const t=new URL("categories",o);return t.searchParams.set("limit",String(50)),t.searchParams.set("offset",String(e)),t.searchParams.set("workspaceId",i),v({url:t,signal:r,authorization:(await n).value})}}}class E extends e.Plugin{static get requires(){return["ImageUploadEditing","ImageUploadProgress",I.FileRepository,O]}static get pluginName(){return"CKBoxUploadAdapter"}static get isOfficialPlugin(){return!0}async afterInit(){const e=this.editor,t=!!e.config.get("ckbox"),n=!!window.CKBox;if(!t&&!n)return;const r=e.plugins.get(I.FileRepository),o=e.plugins.get(A);r.createUploadAdapter=t=>new j(t,e,o);const i=!e.config.get("ckbox.ignoreDataId"),s=e.plugins.get("ImageUploadEditing");i&&s.on("uploadComplete",((t,{imageElement:n,data:r})=>{e.model.change((e=>{e.setAttribute("ckboxImageId",r.ckboxImageId,n)}))}))}}class j{constructor(e,t,n){this.loader=e,this.token=n.getToken(),this.ckboxUtils=n,this.editor=t,this.controller=new AbortController,this.serviceOrigin=t.config.get("ckbox.serviceOrigin")}async upload(){const e=this.ckboxUtils,t=this.editor.t,n=await this.loader.file,r=await e.getCategoryIdForFile(n,{signal:this.controller.signal}),o=new URL("assets",this.serviceOrigin),i=new FormData;o.searchParams.set("workspaceId",await e.getWorkspaceId()),i.append("categoryId",r),i.append("file",n);return v({method:"POST",url:o,data:i,onUploadProgress:e=>{e.lengthComputable&&(this.loader.uploadTotal=e.total,this.loader.uploaded=e.loaded)},signal:this.controller.signal,authorization:(await this.token).value}).then((async e=>{const t=b(e.imageUrls);return{ckboxImageId:e.id,default:t.imageFallbackUrl,sources:t.imageSources}})).catch((()=>{const e=t("Cannot upload file:")+` ${n.name}.`;return Promise.reject(e)}))}abort(){this.controller.abort()}}const C="NoPermission";class O extends e.Plugin{static get pluginName(){return"CKBoxEditing"}static get isOfficialPlugin(){return!0}static get requires(){return["LinkEditing","PictureEditing",E,A]}init(){const e=this.editor;this._shouldBeInitialised()&&(this._checkImagePlugins(),L()&&e.commands.add("ckbox",new _(e)),async function(e){const t=e.plugins.get(A),n=e.config.get("ckbox.serviceOrigin"),r=new URL("permissions",n),{value:o}=await t.getToken(),i=await v({url:r,authorization:o,signal:(new AbortController).signal});return Object.values(i).some((e=>e["asset:create"]))}(e).then((e=>{e||this._blockImageCommands()})))}afterInit(){const e=this.editor;this._shouldBeInitialised()&&(e.config.get("ckbox.ignoreDataId")||(this._initSchema(),this._initConversion(),this._initFixers()))}_shouldBeInitialised(){return!!this.editor.config.get("ckbox")||L()}_blockImageCommands(){const e=this.editor,t=e.commands.get("uploadImage"),n=e.commands.get("ckboxImageEdit");t&&(t.isAccessAllowed=!1,t.forceDisabled(C)),n&&n.forceDisabled(C)}_checkImagePlugins(){const e=this.editor;e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||(0,s.logError)("ckbox-plugin-image-feature-missing",e)}_initSchema(){const e=this.editor.model.schema;e.extend("$text",{allowAttributes:"ckboxLinkId"}),e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.addAttributeCheck((e=>{if(!e.last.getAttribute("linkHref"))return!1}),"ckboxLinkId")}_initConversion(){const e=this.editor;e.conversion.for("downcast").add((e=>{e.on("attribute:ckboxLinkId:imageBlock",((e,t,n)=>{const{writer:r,mapper:o,consumable:i}=n;if(!i.consume(t.item,e.name))return;const s=[...o.toViewElement(t.item).getChildren()].find((e=>"a"===e.name));s&&(t.item.hasAttribute("ckboxLinkId")?r.setAttribute("data-ckbox-resource-id",t.item.getAttribute("ckboxLinkId"),s):r.removeAttribute("data-ckbox-resource-id",s))}),{priority:"low"}),e.on("attribute:ckboxLinkId",((e,t,n)=>{const{writer:r,mapper:o,consumable:i}=n;if(i.consume(t.item,e.name)){if(t.attributeOldValue){const e=S(r,t.attributeOldValue);r.unwrap(o.toViewRange(t.range),e)}if(t.attributeNewValue){const e=S(r,t.attributeNewValue);if(t.item.is("selection")){const t=r.document.selection;r.wrap(t.getFirstRange(),e)}else r.wrap(o.toViewRange(t.range),e)}}}),{priority:"low"})})),e.conversion.for("upcast").add((e=>{e.on("element:a",((e,t,n)=>{const{writer:r,consumable:o}=n;if(!t.viewItem.getAttribute("href"))return;if(!o.consume(t.viewItem,{attributes:["data-ckbox-resource-id"]}))return;const i=t.viewItem.getAttribute("data-ckbox-resource-id");if(i)if(t.modelRange)for(let e of t.modelRange.getItems())e.is("$textProxy")&&(e=e.textNode),B(e)&&r.setAttribute("ckboxLinkId",i,e);else{const e=t.modelCursor.nodeBefore||t.modelCursor.parent;r.setAttribute("ckboxLinkId",i,e)}}),{priority:"low"})})),e.conversion.for("downcast").attributeToAttribute({model:"ckboxImageId",view:"data-ckbox-resource-id"}),e.conversion.for("upcast").elementToAttribute({model:{key:"ckboxImageId",value:e=>e.getAttribute("data-ckbox-resource-id")},view:{attributes:{"data-ckbox-resource-id":/[\s\S]+/}}});const t=e.commands.get("replaceImageSource");t&&this.listenTo(t,"cleanupImage",((e,[t,n])=>{t.removeAttribute("ckboxImageId",n)}))}_initFixers(){const e=this.editor,t=e.model,n=t.document.selection;t.document.registerPostFixer(function(e){return t=>{let n=!1;const r=e.model,o=e.commands.get("ckbox");if(!o)return n;for(const e of r.document.differ.getChanges()){if("insert"!==e.type&&"attribute"!==e.type)continue;const r="insert"===e.type?new i.Range(e.position,e.position.getShiftedBy(e.length)):e.range,s="attribute"===e.type&&"linkHref"===e.attributeKey&&null===e.attributeNewValue;for(const e of r.getItems()){if(s&&e.hasAttribute("ckboxLinkId")){t.removeAttribute("ckboxLinkId",e),n=!0;continue}const r=P(e,o._chosenAssets);for(const o of r){const r="image"===o.type?"ckboxImageId":"ckboxLinkId";o.id!==e.getAttribute(r)&&(t.setAttribute(r,o.id,e),n=!0)}}}return n}}(e)),t.document.registerPostFixer(function(e){return t=>!(e.hasAttribute("linkHref")||!e.hasAttribute("ckboxLinkId"))&&(t.removeSelectionAttribute("ckboxLinkId"),!0)}(n))}}function P(e,t){const n=e.is("element","imageInline")||e.is("element","imageBlock"),r=e.hasAttribute("linkHref");return[...t].filter((t=>"image"===t.type&&n?t.attributes.imageFallbackUrl===e.getAttribute("src"):"link"===t.type&&r?t.attributes.linkHref===e.getAttribute("linkHref"):void 0))}function S(e,t){const n=e.createAttributeElement("a",{"data-ckbox-resource-id":t},{priority:5});return e.setCustomProperty("link",!0,n),n}function B(e){return!!e.is("$text")||!(!e.is("element","imageInline")&&!e.is("element","imageBlock"))}function L(){return!!window.CKBox}class U extends e.Plugin{static get pluginName(){return"CKBox"}static get isOfficialPlugin(){return!0}static get requires(){return[O,o]}}const F=function(){this.__data__=[],this.size=0};const T=function(e,t){return e===t||e!=e&&t!=t};const M=function(e,t){for(var n=e.length;n--;)if(T(e[n][0],t))return n;return-1};var z=Array.prototype.splice;const R=function(e){var t=this.__data__,n=M(t,e);return!(n<0)&&(n==t.length-1?t.pop():z.call(t,n,1),--this.size,!0)};const V=function(e){var t=this.__data__,n=M(t,e);return n<0?void 0:t[n][1]};const N=function(e){return M(this.__data__,e)>-1};const K=function(e,t){var n=this.__data__,r=M(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function D(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}D.prototype.clear=F,D.prototype.delete=R,D.prototype.get=V,D.prototype.has=N,D.prototype.set=K;const H=D;const $=function(){this.__data__=new H,this.size=0};const q=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};const W=function(e){return this.__data__.get(e)};const Z=function(e){return this.__data__.has(e)};const Y="object"==typeof global&&global&&global.Object===Object&&global;var G="object"==typeof self&&self&&self.Object===Object&&self;const J=Y||G||Function("return this")();const X=J.Symbol;var Q=Object.prototype,ee=Q.hasOwnProperty,te=Q.toString,ne=X?X.toStringTag:void 0;const re=function(e){var t=ee.call(e,ne),n=e[ne];try{e[ne]=void 0;var r=!0}catch(e){}var o=te.call(e);return r&&(t?e[ne]=n:delete e[ne]),o};var oe=Object.prototype.toString;const ie=function(e){return oe.call(e)};var se=X?X.toStringTag:void 0;const ae=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":se&&se in Object(e)?re(e):ie(e)};const ce=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const le=function(e){if(!ce(e))return!1;var t=ae(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const ue=J["__core-js_shared__"];var de,ge=(de=/[^.]+$/.exec(ue&&ue.keys&&ue.keys.IE_PROTO||""))?"Symbol(src)_1."+de:"";const he=function(e){return!!ge&&ge in e};var pe=Function.prototype.toString;const me=function(e){if(null!=e){try{return pe.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var fe=/^\[object .+?Constructor\]$/,be=Function.prototype,ve=Object.prototype,we=be.toString,_e=ve.hasOwnProperty,ye=RegExp("^"+we.call(_e).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const ke=function(e){return!(!ce(e)||he(e))&&(le(e)?ye:fe).test(me(e))};const xe=function(e,t){return null==e?void 0:e[t]};const Ie=function(e,t){var n=xe(e,t);return ke(n)?n:void 0};const Ae=Ie(J,"Map");const Ee=Ie(Object,"create");const je=function(){this.__data__=Ee?Ee(null):{},this.size=0};const Ce=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var Oe=Object.prototype.hasOwnProperty;const Pe=function(e){var t=this.__data__;if(Ee){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Oe.call(t,e)?t[e]:void 0};var Se=Object.prototype.hasOwnProperty;const Be=function(e){var t=this.__data__;return Ee?void 0!==t[e]:Se.call(t,e)};const Le=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ee&&void 0===t?"__lodash_hash_undefined__":t,this};function Ue(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ue.prototype.clear=je,Ue.prototype.delete=Ce,Ue.prototype.get=Pe,Ue.prototype.has=Be,Ue.prototype.set=Le;const Fe=Ue;const Te=function(){this.size=0,this.__data__={hash:new Fe,map:new(Ae||H),string:new Fe}};const Me=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const ze=function(e,t){var n=e.__data__;return Me(t)?n["string"==typeof t?"string":"hash"]:n.map};const Re=function(e){var t=ze(this,e).delete(e);return this.size-=t?1:0,t};const Ve=function(e){return ze(this,e).get(e)};const Ne=function(e){return ze(this,e).has(e)};const Ke=function(e,t){var n=ze(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function De(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}De.prototype.clear=Te,De.prototype.delete=Re,De.prototype.get=Ve,De.prototype.has=Ne,De.prototype.set=Ke;const He=De;const $e=function(e,t){var n=this.__data__;if(n instanceof H){var r=n.__data__;if(!Ae||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new He(r)}return n.set(e,t),this.size=n.size,this};function qe(e){var t=this.__data__=new H(e);this.size=t.size}qe.prototype.clear=$,qe.prototype.delete=q,qe.prototype.get=W,qe.prototype.has=Z,qe.prototype.set=$e;const We=qe;const Ze=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const Ye=function(e){return this.__data__.has(e)};function Ge(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new He;++t<n;)this.add(e[t])}Ge.prototype.add=Ge.prototype.push=Ze,Ge.prototype.has=Ye;const Je=Ge;const Xe=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1};const Qe=function(e,t){return e.has(t)};const et=function(e,t,n,r,o,i){var s=1&n,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=i.get(e),u=i.get(t);if(l&&u)return l==t&&u==e;var d=-1,g=!0,h=2&n?new Je:void 0;for(i.set(e,t),i.set(t,e);++d<a;){var p=e[d],m=t[d];if(r)var f=s?r(m,p,d,t,e,i):r(p,m,d,e,t,i);if(void 0!==f){if(f)continue;g=!1;break}if(h){if(!Xe(t,(function(e,t){if(!Qe(h,t)&&(p===e||o(p,e,n,r,i)))return h.push(t)}))){g=!1;break}}else if(p!==m&&!o(p,m,n,r,i)){g=!1;break}}return i.delete(e),i.delete(t),g};const tt=J.Uint8Array;const nt=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n};const rt=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var ot=X?X.prototype:void 0,it=ot?ot.valueOf:void 0;const st=function(e,t,n,r,o,i,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new tt(e),new tt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return T(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=nt;case"[object Set]":var c=1&r;if(a||(a=rt),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;r|=2,s.set(e,t);var u=et(a(e),a(t),r,o,i,s);return s.delete(e),u;case"[object Symbol]":if(it)return it.call(e)==it.call(t)}return!1};const at=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e};const ct=Array.isArray;const lt=function(e,t,n){var r=t(e);return ct(e)?r:at(r,n(e))};const ut=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i};const dt=function(){return[]};var gt=Object.prototype.propertyIsEnumerable,ht=Object.getOwnPropertySymbols;const pt=ht?function(e){return null==e?[]:(e=Object(e),ut(ht(e),(function(t){return gt.call(e,t)})))}:dt;const mt=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};const ft=function(e){return null!=e&&"object"==typeof e};const bt=function(e){return ft(e)&&"[object Arguments]"==ae(e)};var vt=Object.prototype,wt=vt.hasOwnProperty,_t=vt.propertyIsEnumerable;const yt=bt(function(){return arguments}())?bt:function(e){return ft(e)&&wt.call(e,"callee")&&!_t.call(e,"callee")};const kt=function(){return!1};var xt="object"==typeof exports&&exports&&!exports.nodeType&&exports,It=xt&&"object"==typeof module&&module&&!module.nodeType&&module,At=It&&It.exports===xt?J.Buffer:void 0;const Et=(At?At.isBuffer:void 0)||kt;var jt=/^(?:0|[1-9]\d*)$/;const Ct=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&jt.test(e))&&e>-1&&e%1==0&&e<t};const Ot=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Pt={};Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object Boolean]"]=Pt["[object DataView]"]=Pt["[object Date]"]=Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object WeakMap]"]=!1;const St=function(e){return ft(e)&&Ot(e.length)&&!!Pt[ae(e)]};const Bt=function(e){return function(t){return e(t)}};var Lt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ut=Lt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=Ut&&Ut.exports===Lt&&Y.process,Tt=function(){try{var e=Ut&&Ut.require&&Ut.require("util").types;return e||Ft&&Ft.binding&&Ft.binding("util")}catch(e){}}();var Mt=Tt&&Tt.isTypedArray;const zt=Mt?Bt(Mt):St;var Rt=Object.prototype.hasOwnProperty;const Vt=function(e,t){var n=ct(e),r=!n&&yt(e),o=!n&&!r&&Et(e),i=!n&&!r&&!o&&zt(e),s=n||r||o||i,a=s?mt(e.length,String):[],c=a.length;for(var l in e)!t&&!Rt.call(e,l)||s&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Ct(l,c))||a.push(l);return a};var Nt=Object.prototype;const Kt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Nt)};const Dt=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object);var Ht=Object.prototype.hasOwnProperty;const $t=function(e){if(!Kt(e))return Dt(e);var t=[];for(var n in Object(e))Ht.call(e,n)&&"constructor"!=n&&t.push(n);return t};const qt=function(e){return null!=e&&Ot(e.length)&&!le(e)};const Wt=function(e){return qt(e)?Vt(e):$t(e)};const Zt=function(e){return lt(e,Wt,pt)};var Yt=Object.prototype.hasOwnProperty;const Gt=function(e,t,n,r,o,i){var s=1&n,a=Zt(e),c=a.length;if(c!=Zt(t).length&&!s)return!1;for(var l=c;l--;){var u=a[l];if(!(s?u in t:Yt.call(t,u)))return!1}var d=i.get(e),g=i.get(t);if(d&&g)return d==t&&g==e;var h=!0;i.set(e,t),i.set(t,e);for(var p=s;++l<c;){var m=e[u=a[l]],f=t[u];if(r)var b=s?r(f,m,u,t,e,i):r(m,f,u,e,t,i);if(!(void 0===b?m===f||o(m,f,n,r,i):b)){h=!1;break}p||(p="constructor"==u)}if(h&&!p){var v=e.constructor,w=t.constructor;v==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof w&&w instanceof w||(h=!1)}return i.delete(e),i.delete(t),h};const Jt=Ie(J,"DataView");const Xt=Ie(J,"Promise");const Qt=Ie(J,"Set");const en=Ie(J,"WeakMap");var tn="[object Map]",nn="[object Promise]",rn="[object Set]",on="[object WeakMap]",sn="[object DataView]",an=me(Jt),cn=me(Ae),ln=me(Xt),un=me(Qt),dn=me(en),gn=ae;(Jt&&gn(new Jt(new ArrayBuffer(1)))!=sn||Ae&&gn(new Ae)!=tn||Xt&&gn(Xt.resolve())!=nn||Qt&&gn(new Qt)!=rn||en&&gn(new en)!=on)&&(gn=function(e){var t=ae(e),n="[object Object]"==t?e.constructor:void 0,r=n?me(n):"";if(r)switch(r){case an:return sn;case cn:return tn;case ln:return nn;case un:return rn;case dn:return on}return t});const hn=gn;var pn="[object Arguments]",mn="[object Array]",fn="[object Object]",bn=Object.prototype.hasOwnProperty;const vn=function(e,t,n,r,o,i){var s=ct(e),a=ct(t),c=s?mn:hn(e),l=a?mn:hn(t),u=(c=c==pn?fn:c)==fn,d=(l=l==pn?fn:l)==fn,g=c==l;if(g&&Et(e)){if(!Et(t))return!1;s=!0,u=!1}if(g&&!u)return i||(i=new We),s||zt(e)?et(e,t,n,r,o,i):st(e,t,c,n,r,o,i);if(!(1&n)){var h=u&&bn.call(e,"__wrapped__"),p=d&&bn.call(t,"__wrapped__");if(h||p){var m=h?e.value():e,f=p?t.value():t;return i||(i=new We),o(m,f,n,r,i)}}return!!g&&(i||(i=new We),Gt(e,t,n,r,o,i))};const wn=function e(t,n,r,o,i){return t===n||(null==t||null==n||!ft(t)&&!ft(n)?t!=t&&n!=n:vn(t,n,r,o,e,i))};const _n=function(e,t){return wn(e,t)};function yn(e){if(Array.isArray(e)){const t=e.map(yn);return e=>t.some((t=>t(e)))}if("origin"==e){const e=s.global.window.location.origin;return t=>new URL(t,s.global.document.baseURI).origin==e}if("function"==typeof e)return e;if(e instanceof RegExp)return t=>!(!t.match(e)&&!t.replace(/^https?:\/\//,"").match(e));return()=>!1}class kn extends e.Command{constructor(e){super(e),this._wrapper=null,this._processInProgress=new Set,this._updateUiDelayed=(0,s.delay)((()=>this.editor.ui.update()),0),this.value=!1,this._canEdit=function(e){const t=yn(e);return e=>!(!e.is("element","imageInline")&&!e.is("element","imageBlock"))&&(!!e.hasAttribute("ckboxImageId")||!!e.hasAttribute("src")&&t(e.getAttribute("src")))}(e.config.get("ckbox.allowExternalImagesEditing")),this._prepareOptions=(0,s.abortableDebounce)(((e,t)=>this._prepareOptionsAbortable(e,t))),this._prepareListeners()}refresh(){const e=this.editor;this.value=this._getValue();const t=e.model.document.selection.getSelectedElement();this.isEnabled=!!t&&this._canEdit(t)&&!this._checkIfElementIsBeingProcessed(t)}execute(){if(this._getValue())return;const e=(0,s.createElement)(document,"div",{class:"ck ckbox-wrapper"});this._wrapper=e,this.value=!0,document.body.appendChild(this._wrapper);const n={element:this.editor.model.document.selection.getSelectedElement(),controller:new AbortController};this._prepareOptions(n).then((t=>window.CKBox.mountImageEditor(e,t)),(e=>{const n=this.editor,r=n.t;n.plugins.get(t.Notification).showWarning(r("Failed to determine category of edited image."),{namespace:"ckbox"}),console.error(e),this._handleImageEditorClose()}))}destroy(){this._handleImageEditorClose(),this._prepareOptions.abort(),this._updateUiDelayed.cancel();for(const e of this._processInProgress.values())e.controller.abort();super.destroy()}_getValue(){return null!==this._wrapper}async _prepareOptionsAbortable(e,t){const n=this.editor,r=n.config.get("ckbox"),o=n.plugins.get(A),{element:i}=t;let s;const a=i.getAttribute("ckboxImageId");if(a)s={assetId:a};else{const t=new URL(i.getAttribute("src"),document.baseURI).href;s={imageUrl:t,uploadCategoryId:await o.getCategoryIdForFile(t,{signal:e})}}return{...s,imageEditing:{allowOverwrite:!1},tokenUrl:r.tokenUrl,...r.serviceOrigin&&{serviceOrigin:r.serviceOrigin},onClose:()=>this._handleImageEditorClose(),onSave:e=>this._handleImageEditorSave(t,e)}}_prepareListeners(){this.listenTo(this.editor.model.document,"change:data",(()=>{this._getProcessingStatesOfDeletedImages().forEach((e=>{e.controller.abort()}))}))}_getProcessingStatesOfDeletedImages(){const e=[];for(const t of this._processInProgress.values())"$graveyard"==t.element.root.rootName&&e.push(t);return e}_checkIfElementIsBeingProcessed(e){for(const{element:t}of this._processInProgress)if(_n(t,e))return!0;return!1}_handleImageEditorClose(){this._wrapper&&(this._wrapper.remove(),this._wrapper=null,this.editor.editing.view.focus(),this._updateUiDelayed(),this.refresh())}_handleImageEditorSave(n,r){const o=this.editor.locale.t,i=this.editor.plugins.get(t.Notification),a=this.editor.plugins.get(e.PendingActions),c=a.add(o("Processing the edited image."));this._processInProgress.add(n),this._showImageProcessingIndicator(n.element,r),this.refresh(),this._waitForAssetProcessed(r.data.id,n.controller.signal).then((e=>{this._replaceImage(n.element,e)}),(e=>{this.editor.editing.reconvertItem(n.element),n.controller.signal.aborted||(!e||e instanceof s.CKEditorError?i.showWarning(o("Server failed to process the image."),{namespace:"ckbox"}):console.error(e))})).finally((()=>{this._processInProgress.delete(n),a.remove(c),this.refresh()}))}async _getAssetStatusFromServer(e,t){const n=this.editor.plugins.get(A),r=new URL("assets/"+e,this.editor.config.get("ckbox.serviceOrigin")),o=await v({url:r,signal:t,authorization:(await n.getToken()).value}),i=o.metadata.metadataProcessingStatus;if(!i||"queued"==i)throw new s.CKEditorError("ckbox-image-not-processed");return{data:{...o}}}async _waitForAssetProcessed(e,t){const n=await(0,s.retry)((()=>this._getAssetStatusFromServer(e,t)),{signal:t,maxAttempts:5});if("success"!=n.data.metadata.metadataProcessingStatus)throw new s.CKEditorError("ckbox-image-processing-failed");return n}_showImageProcessingIndicator(e,t){const n=this.editor;n.editing.view.change((r=>{const o=n.editing.mapper.toViewElement(e),i=this.editor.plugins.get("ImageUtils").findViewImgElement(o);r.removeStyle("aspect-ratio",i),r.setAttribute("width",t.data.metadata.width,i),r.setAttribute("height",t.data.metadata.height,i),r.setStyle("width",`${t.data.metadata.width}px`,i),r.setStyle("height",`${t.data.metadata.height}px`,i),r.addClass("image-processing",o)}))}_replaceImage(e,t){const n=this.editor,{imageFallbackUrl:r,imageSources:o,imageWidth:i,imageHeight:s,imagePlaceholder:a}=y(t),c=Array.from(n.model.document.selection.getRanges());n.model.change((l=>{l.setSelection(e,"on"),n.execute("insertImage",{imageType:e.is("element","imageInline")?"imageInline":null,source:{src:r,sources:o,width:i,height:s,...a?{placeholder:a}:null,...e.hasAttribute("alt")?{alt:e.getAttribute("alt")}:null}});const u=e.getChildren();e=n.model.document.selection.getSelectedElement();for(const t of u)l.append(l.cloneElement(t),e);l.setAttribute("ckboxImageId",t.data.id,e),l.setSelection(c)}))}}class xn extends e.Plugin{static get pluginName(){return"CKBoxImageEditEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[O,A,e.PendingActions,t.Notification,"ImageUtils","ImageEditing"]}init(){const{editor:e}=this;e.commands.add("ckboxImageEdit",new kn(e))}}class In extends e.Plugin{static get pluginName(){return"CKBoxImageEditUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("ckboxImageEdit",(n=>{const r=e.commands.get("ckboxImageEdit"),o=e.commands.get("uploadImage"),i=new t.ButtonView(n),s=n.t;return i.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037H5.06l5.058-5.078L6.617 9.15a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v4.354a3.478 3.478 0 0 1 1.5.049V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.147 2.147 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.642-3.11 2.129 2.129 0 0 0-1.873-.978ZM8.089 17.635v2.388h2.389l7.046-7.046-2.39-2.39-7.045 7.048Zm11.282-6.507a.637.637 0 0 0 .139-.692.603.603 0 0 0-.139-.205l-1.49-1.488a.63.63 0 0 0-.899 0l-1.166 1.163 2.39 2.39 1.165-1.168Z"/></svg>',tooltip:!0}),i.bind("label").to(o,"isAccessAllowed",(e=>s(e?"Edit image":"You have no image editing permissions."))),i.bind("isOn").to(r,"value",r,"isEnabled",((e,t)=>e&&t)),i.bind("isEnabled").to(r),this.listenTo(i,"execute",(()=>{e.execute("ckboxImageEdit"),e.editing.view.focus()})),i}))}}var An=n(591),En=n.n(An),jn=n(639),Cn=n.n(jn),On=n(128),Pn=n.n(On),Sn=n(21),Bn=n.n(Sn),Ln=n(51),Un=n.n(Ln),Fn=n(957),Tn={attributes:{"data-cke":!0}};Tn.setAttributes=Bn(),Tn.insert=Pn().bind(null,"head"),Tn.domAPI=Cn(),Tn.insertStyleElement=Un();En()(Fn.A,Tn);Fn.A&&Fn.A.locals&&Fn.A.locals;class Mn extends e.Plugin{static get pluginName(){return"CKBoxImageEdit"}static get isOfficialPlugin(){return!0}static get requires(){return[xn,In]}}})(),(window.CKEditor5=window.CKEditor5||{}).ckbox=r})();
|
package/dist/index-content.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
4
4
|
*/
|
package/dist/index-editor.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
4
4
|
*/
|
5
5
|
:root{
|
6
6
|
--ck-image-processing-highlight-color:hsl(220, 10%, 98%);
|
package/dist/index.css
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
4
4
|
*/
|
5
5
|
/*
|
6
|
-
* Copyright (c) 2003-
|
6
|
+
* Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
7
7
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
8
8
|
*/
|
9
9
|
|
package/dist/index.css.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../theme/ckboximageedit.css","index.css"],"names":[],"mappings":"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","file":"index.css.map","sourcesContent":["/*\n * Copyright (c) 2003-
|
1
|
+
{"version":3,"sources":["../theme/ckboximageedit.css","index.css"],"names":[],"mappings":"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","file":"index.css.map","sourcesContent":["/*\n * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n\n:root {\n\t/* Based on default CKBox theme colors */\n\t--ck-image-processing-highlight-color: hsl(220, 10%, 98%);\n\t--ck-image-processing-background-color: hsl(220, 10%, 90%);\n}\n\n.ck.ck-editor__editable {\n\t& .image {\n\t\t&.image-processing {\n\t\t\tposition: relative;\n\n\t\t\t&:before {\n\t\t\t\tcontent: '';\n\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: 0;\n\t\t\t\tleft: 0;\n\t\t\t\tz-index: 1;\n\n\t\t\t\theight: 100%;\n\t\t\t\twidth: 100%;\n\n\t\t\t\tbackground: linear-gradient(\n\t\t\t\t\t90deg,\n\t\t\t\t\tvar(--ck-image-processing-background-color),\n\t\t\t\t\tvar(--ck-image-processing-highlight-color),\n\t\t\t\t\tvar(--ck-image-processing-background-color)\n\t\t\t\t);\n\t\t\t\tbackground-size: 200% 100%;\n\n\t\t\t\tanimation: ck-image-processing-animation 2s linear infinite;\n\t\t\t}\n\n\t\t\t& img {\n\t\t\t\theight: 100%;\n\t\t\t}\n\t\t}\n\t}\n}\n\n@keyframes ck-image-processing-animation {\n\t0% {\n\t\tbackground-position: 200% 0;\n\t}\n\t100% {\n\t\tbackground-position: -200% 0;\n\t}\n}\n","/*\n * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n\n:root {\n\t/* Based on default CKBox theme colors */\n\t--ck-image-processing-highlight-color: hsl(220, 10%, 98%);\n\t--ck-image-processing-background-color: hsl(220, 10%, 90%);\n}\n\n.ck.ck-editor__editable .image.image-processing {\n\t\t\tposition: relative;\n\t\t}\n\n.ck.ck-editor__editable .image.image-processing:before {\n\t\t\t\tcontent: '';\n\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: 0;\n\t\t\t\tleft: 0;\n\t\t\t\tz-index: 1;\n\n\t\t\t\theight: 100%;\n\t\t\t\twidth: 100%;\n\n\t\t\t\tbackground: linear-gradient(\n\t\t\t\t\t90deg,\n\t\t\t\t\tvar(--ck-image-processing-background-color),\n\t\t\t\t\tvar(--ck-image-processing-highlight-color),\n\t\t\t\t\tvar(--ck-image-processing-background-color)\n\t\t\t\t);\n\t\t\t\tbackground-size: 200% 100%;\n\n\t\t\t\tanimation: ck-image-processing-animation 2s linear infinite;\n\t\t\t}\n\n.ck.ck-editor__editable .image.image-processing img {\n\t\t\t\theight: 100%;\n\t\t\t}\n\n@keyframes ck-image-processing-animation {\n\t0% {\n\t\tbackground-position: 200% 0;\n\t}\n\t100% {\n\t\tbackground-position: -200% 0;\n\t}\n}\n\n/*# sourceMappingURL=index.css.map */"]}
|
package/dist/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
4
4
|
*/
|
5
5
|
import { Plugin, icons, Command, PendingActions } from '@ckeditor/ckeditor5-core/dist/index.js';
|
6
6
|
import { ButtonView, MenuBarMenuListItemButtonView, Notification } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
@@ -432,6 +432,7 @@ const ASSET_INSERTION_WAIT_TIMEOUT = 1000;
|
|
432
432
|
const editor = this.editor;
|
433
433
|
const model = editor.model;
|
434
434
|
const shouldInsertDataId = !editor.config.get('ckbox.ignoreDataId');
|
435
|
+
const downloadableFilesConfig = editor.config.get('ckbox.downloadableFiles');
|
435
436
|
// Refresh the command after firing the `ckbox:*` event.
|
436
437
|
this.on('ckbox', ()=>{
|
437
438
|
this.refresh();
|
@@ -467,6 +468,7 @@ const ASSET_INSERTION_WAIT_TIMEOUT = 1000;
|
|
467
468
|
const linkCommand = editor.commands.get('link');
|
468
469
|
const assetsToProcess = prepareAssets({
|
469
470
|
assets,
|
471
|
+
downloadableFilesConfig,
|
470
472
|
isImageAllowed: imageCommand.isEnabled,
|
471
473
|
isLinkAllowed: linkCommand.isEnabled
|
472
474
|
});
|
@@ -577,7 +579,7 @@ const ASSET_INSERTION_WAIT_TIMEOUT = 1000;
|
|
577
579
|
}
|
578
580
|
/**
|
579
581
|
* Parses the chosen assets into the internal data format. Filters out chosen assets that are not allowed.
|
580
|
-
*/ function prepareAssets({ assets, isImageAllowed, isLinkAllowed }) {
|
582
|
+
*/ function prepareAssets({ downloadableFilesConfig, assets, isImageAllowed, isLinkAllowed }) {
|
581
583
|
return assets.map((asset)=>isImage(asset) ? {
|
582
584
|
id: asset.data.id,
|
583
585
|
type: 'image',
|
@@ -585,7 +587,7 @@ const ASSET_INSERTION_WAIT_TIMEOUT = 1000;
|
|
585
587
|
} : {
|
586
588
|
id: asset.data.id,
|
587
589
|
type: 'link',
|
588
|
-
attributes: prepareLinkAssetAttributes(asset)
|
590
|
+
attributes: prepareLinkAssetAttributes(asset, downloadableFilesConfig)
|
589
591
|
}).filter((asset)=>asset.type === 'image' ? isImageAllowed : isLinkAllowed);
|
590
592
|
}
|
591
593
|
/**
|
@@ -610,11 +612,12 @@ const ASSET_INSERTION_WAIT_TIMEOUT = 1000;
|
|
610
612
|
/**
|
611
613
|
* Parses the assets attributes into the internal data format.
|
612
614
|
*
|
613
|
-
* @param
|
614
|
-
|
615
|
+
* @param asset The asset to prepare the attributes for.
|
616
|
+
* @param config The CKBox download asset configuration.
|
617
|
+
*/ function prepareLinkAssetAttributes(asset, config) {
|
615
618
|
return {
|
616
619
|
linkName: asset.data.name,
|
617
|
-
linkHref: getAssetUrl(asset)
|
620
|
+
linkHref: getAssetUrl(asset, config)
|
618
621
|
};
|
619
622
|
}
|
620
623
|
/**
|
@@ -629,12 +632,26 @@ const ASSET_INSERTION_WAIT_TIMEOUT = 1000;
|
|
629
632
|
/**
|
630
633
|
* Creates the URL for the asset.
|
631
634
|
*
|
632
|
-
* @param
|
633
|
-
|
635
|
+
* @param asset The asset to create the URL for.
|
636
|
+
* @param config The CKBox download asset configuration.
|
637
|
+
*/ function getAssetUrl(asset, config) {
|
634
638
|
const url = new URL(asset.data.url);
|
635
|
-
|
639
|
+
if (isDownloadableAsset(asset, config)) {
|
640
|
+
url.searchParams.set('download', 'true');
|
641
|
+
}
|
636
642
|
return url.toString();
|
637
643
|
}
|
644
|
+
/**
|
645
|
+
* Determines if download should be enabled for given asset based on configuration.
|
646
|
+
*
|
647
|
+
* @param asset The asset to check.
|
648
|
+
* @param config The CKBox download asset configuration.
|
649
|
+
*/ function isDownloadableAsset(asset, config) {
|
650
|
+
if (typeof config === 'function') {
|
651
|
+
return config(asset);
|
652
|
+
}
|
653
|
+
return true;
|
654
|
+
}
|
638
655
|
|
639
656
|
const DEFAULT_CKBOX_THEME_NAME = 'lark';
|
640
657
|
/**
|