@ckeditor/ckeditor5-uploadcare 48.5.0-alpha.2 → 48.5.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -20,6 +20,6 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x156dc2,Plugin as _0x34daf5}from'@ckeditor/ckeditor5-core';import{IconDropbox as _0x171b08,IconError as _0x510b2d,IconFacebook as _0x2f8874,IconGoogleDrive as _0x444904,IconGooglePhotos as _0x3a66c8,IconOneDrive as _0x240be7,IconUploadcareImageEdit as _0x40ecc3,IconUploadcareImageUpload as _0xe3a25d,IconUploadcareLink as _0x2f7360}from'@ckeditor/ckeditor5-icons';import{ButtonView as _0x132e37,Dialog as _0x19e9a8,DialogViewPosition as _0x1d4d33,FocusCycler as _0x1d4657,IconView as _0x589907,MenuBarMenuListItemButtonView as _0x21f668,Notification as _0x2b28a9,SpinnerView as _0x2cc1bd,View as _0x4fdd4a}from'@ckeditor/ckeditor5-ui';import{DomEmitterMixin as _0x1bc89a,FocusTracker as _0x42896a,ObservableMixin as _0x3fae10,createElement as _0x1f0b24,getAncestors as _0x190a9c,global as _0x9ae635,uid as _0xd84b24}from'@ckeditor/ckeditor5-utils';import{ImageEditing as _0x42cebf,ImageUploadEditing as _0x39c9e2,ImageUploadProgress as _0x431de7,ImageUtils as _0x187a9d,PictureEditing as _0x2ae5bf}from'@ckeditor/ckeditor5-image';import{FileRepository as _0x4499f5}from'@ckeditor/ckeditor5-upload';import{info as _0x1a29af,uploadFile as _0x18029c}from'@uploadcare/upload-client';import*as _0x4d6e90 from'@uploadcare/file-uploader/web/file-uploader.min.js';function T(_0x2bf331,_0x1e0106,_0x3e28a3){const t=_0x2bf331['t'],_0x2369eb=_0x2bf331['t'];switch(_0x1e0106){case'local':return{'text':_0x2369eb('Insert'===_0x3e28a3?'Upload\x20from\x20computer':'Replace\x20from\x20computer'),'shortText':_0x2369eb('From\x20computer')};case'url':return{'text':'Insert'===_0x3e28a3?_0x2369eb('Insert\x20via\x20URL'):t('Replace\x20via\x20URL'),'shortText':_0x2369eb('Via\x20URL')};case'dropbox':return{'text':t('Insert'===_0x3e28a3?'Insert\x20with\x20Dropbox':'Replace\x20with\x20Dropbox'),'shortText':t('With\x20Dropbox')};case'facebook':return{'text':t('Insert'===_0x3e28a3?'Insert\x20with\x20Facebook':'Replace\x20with\x20Facebook'),'shortText':t('With\x20Facebook')};case'gdrive':return{'text':t('Insert'===_0x3e28a3?'Insert\x20with\x20Google\x20Drive':'Replace\x20with\x20Google\x20Drive'),'shortText':t('With\x20Google\x20Drive')};case'gphotos':return{'text':t('Insert'===_0x3e28a3?'Insert\x20with\x20Google\x20Photos':'Replace\x20with\x20Google\x20Photos'),'shortText':t('With\x20Google\x20Photos')};case'onedrive':return{'text':t('Insert'===_0x3e28a3?'Insert\x20with\x20OneDrive':'Replace\x20with\x20OneDrive'),'shortText':t('With\x20OneDrive')};default:return _0x1e0106;}}var V=class extends _0x34daf5{['licenseKey'];_licenseKeyCheckInterval;static get['pluginName'](){return'UploadcareUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['licenseKey']=this['editor']['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{const _0x7bf3b=[this['editor']];for(const _0x140ad2 of _0x7bf3b){let _0x1ed91f;for(const _0x575661 in _0x140ad2){const _0x2befc3=_0x575661,_0x4bad4f=_0x140ad2[_0x2befc3];if('uploadcareLicenseKeyValid'==_0x4bad4f||'uploadcareLicenseKeyInvalid'==_0x4bad4f||'uploadcareLicenseKeyExpired'==_0x4bad4f||'uploadcareLicenseKeyDomainLimit'==_0x4bad4f||'uploadcareLicenseKeyNotAllowed'==_0x4bad4f||'uploadcareLicenseKeyEvaluationLimit'==_0x4bad4f||'uploadcareLicenseKeyUsageLimit'==_0x4bad4f){delete _0x140ad2[_0x2befc3],_0x1ed91f=_0x4bad4f,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'uploadcareLicenseKeyInvalid'==_0x1ed91f&&_0x140ad2['_showLicenseError']('invalid'),'uploadcareLicenseKeyExpired'==_0x1ed91f&&_0x140ad2['_showLicenseError']('expired'),'uploadcareLicenseKeyDomainLimit'==_0x1ed91f&&_0x140ad2['_showLicenseError']('domainLimit'),'uploadcareLicenseKeyNotAllowed'==_0x1ed91f&&_0x140ad2['_showLicenseError']('featureNotAllowed','Uploadcare'),'uploadcareLicenseKeyEvaluationLimit'==_0x1ed91f&&_0x140ad2['_showLicenseError']('evaluationLimit'),'uploadcareLicenseKeyUsageLimit'==_0x1ed91f&&_0x140ad2['_showLicenseError']('usageLimit');}},0x3e8);}afterInit(){const {editor:_0x2f353b}=this,_0x167a13=_0x2f353b['commands']['get']('uploadcare');if(!_0x167a13)return;const _0xb2e5c8=this['_normalizeConfigSourceList'](_0x2f353b['config']['get']('uploadcare.uploader.sourceList'))['reduce']((_0x7f7ed8,_0x4de951)=>{const _0x349f17=this['_getIntegrationKey'](_0x4de951['type']);return _0x7f7ed8[_0x349f17]||(_0x7f7ed8[_0x349f17]=[]),_0x7f7ed8[_0x349f17]['push'](_0x4de951),_0x7f7ed8;},{});_0x2f353b['plugins']['has']('ImageInsertUI')&&_0x2f353b['commands']['get']('uploadcare')&&Object['entries'](_0xb2e5c8)['forEach'](([_0x3fe708,_0x1cfec4])=>{_0x2f353b['plugins']['get']('ImageInsertUI')['registerIntegration']({'name':_0x3fe708,'observable':()=>_0x167a13,'buttonViewCreator':()=>this['_createToolbarButton'](_0x1cfec4),'formViewCreator':()=>this['_createDropdownButtons'](_0x1cfec4),'menuBarButtonViewCreator':()=>this['_createMenuBarButtons'](_0x1cfec4),'override':'assetManager'!==_0x3fe708});});}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}_normalizeConfigSourceList(_0x345dc8){const {locale:_0x277513}=this['editor'];return _0x345dc8['map'](_0x4895e9=>{const _0x2eda95=T(_0x277513,_0x4895e9,'Insert');switch(_0x4895e9){case'local':return{'icon':_0xe3a25d,'type':'local',..._0x2eda95};case'url':return{'icon':_0x2f7360,'type':'url',..._0x2eda95};case'dropbox':return{'icon':_0x171b08,'type':'dropbox',..._0x2eda95};case'facebook':return{'icon':_0x2f8874,'type':'facebook',..._0x2eda95};case'gdrive':return{'icon':_0x444904,'type':'gdrive',..._0x2eda95};case'gphotos':return{'icon':_0x3a66c8,'type':'gphotos',..._0x2eda95};case'onedrive':return{'icon':_0x240be7,'type':'onedrive',..._0x2eda95};}});}_getIntegrationKey(_0x5925d7){switch(_0x5925d7){case'local':return'upload';case'url':return'url';default:return'assetManager';}}_createButton(_0x299472,_0x219b67){const _0x8db635=this['editor'],_0x541195=new _0x299472(_0x8db635['locale']),_0x2fe29e=_0x8db635['commands']['get']('uploadcare');return _0x541195['bind']('isEnabled')['to'](_0x2fe29e),_0x541195['on']('execute',()=>{_0x2fe29e['execute'](_0x219b67);}),_0x541195;}_createToolbarButton(_0x2e28dd){const {locale:_0x31dc6f}=this['editor'],_0x1394a5=this['editor']['plugins']['get']('ImageInsertUI'),_0x19ead8=_0x2e28dd[0x0],_0x50953d=this['_createButton'](_0x132e37,_0x19ead8['type']);return _0x50953d['icon']=_0x19ead8['icon'],_0x50953d['bind']('label')['to'](_0x1394a5,'isImageSelected',_0x48220a=>T(_0x31dc6f,_0x19ead8['type'],_0x48220a?'Replace':'Insert')['text']),_0x50953d['tooltip']=!0x0,_0x50953d;}_createDropdownButtons(_0x3fdec9){const {locale:_0x529f89}=this['editor'],_0x55ad3f=this['editor']['plugins']['get']('ImageInsertUI');return _0x3fdec9['map'](_0x4d4da5=>{const _0x454625=this['_createButton'](_0x132e37,_0x4d4da5['type']);return _0x454625['withText']=!0x0,_0x454625['icon']=_0x4d4da5['icon'],_0x454625['bind']('label')['to'](_0x55ad3f,'isImageSelected',_0x3f0079=>T(_0x529f89,_0x4d4da5['type'],_0x3f0079?'Replace':'Insert')['text']),_0x454625;});}_createMenuBarButtons(_0x42141e){return _0x42141e['map'](_0x41934d=>{const _0xe3a80b=this['_createButton'](_0x21f668,_0x41934d['type']);return _0xe3a80b['icon']=_0x41934d['icon'],_0xe3a80b['label']=_0x41934d['shortText'],_0xe3a80b;});}},F=class extends _0x4fdd4a{['focusTracker'];['focusCycler'];constructor(_0x2248d4){super(_0x2248d4),this['focusTracker']=new _0x42896a(),this['focusCycler']=new _0x1d4657({'focusables':this['createCollection'](),'focusTracker':this['focusTracker']});}getFocusableElement(){return{'tag':'div','attributes':{'aria-hidden':'true','tabindex':'0'},'on':{'focus':this['bindTemplate']['to'](()=>{this['focusCycler']['fire']('forwardCycle');})}};}},$=class extends F{constructor(_0x308af8,_0x1dadb6){super(_0x308af8),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-uploadcare-form'],'tabindex':'-1'},'children':[{'tag':'uc-file-uploader-inline','attributes':{'class':['uc-light','ck-uploadcare-theme'],'ctx-name':'uploader-'+_0x1dadb6}},this['getFocusableElement']()]});}['focus'](){this['element']['focus']();}};function B(_0x5de3f1,_0x286e60){const _0x1d8672=_0x5de3f1['replace'](/\/$/,'');return{'imageFallbackUrl':_0x5de3f1,'imageSources':[{'srcset':[...[0x140,0x1e0,0x300,0x400,0x4b0,0x640,0x780,0x960]['filter'](_0x472312=>_0x472312<_0x286e60)['map'](_0x3e3d5c=>_0x1d8672+'/-/resize/'+_0x3e3d5c+'x/\x20'+_0x3e3d5c+'w'),_0x5de3f1+'\x20'+_0x286e60+'w']['join'](',\x20'),'sizes':'(max-width:\x20'+_0x286e60+'px)\x20100vw,\x20'+_0x286e60+'px','type':'image/webp'}]};}function j(_0x4e1d15,_0x3e17,_0x4644af){const _0x1bcfa3=_0x4e1d15['match'](/\/crop\/(\d+)x(\d+)\//);return{'width':_0x1bcfa3?parseInt(_0x1bcfa3[0x1],0xa):_0x3e17,'height':_0x1bcfa3?parseInt(_0x1bcfa3[0x2],0xa):_0x4644af};}function q(_0x14ff03,_0x103167){const _0x5b6697=new(_0x1bc89a())(),_0xd2a515=_0x14ff03['plugins']['get']('ImageUtils'),_0x127ddb=_0x14ff03['editing']['mapper']['toViewElement'](_0x103167),_0x5bb407=_0xd2a515['findViewImgElement'](_0x127ddb),_0x1f7883=_0x14ff03['editing']['view']['domConverter']['viewToDom'](_0x5bb407),_0x59d2fb=_0x103167['getAttribute']('width'),_0xda9513=_0x103167['getAttribute']('height'),_0x14f6ff='image-processing';_0x14ff03['editing']['view']['change'](_0x2dd210=>{_0x2dd210['addClass'](_0x14f6ff,_0x127ddb),_0x2dd210['setStyle']('aspect-ratio',_0x59d2fb+'/'+_0xda9513,_0x5bb407);}),_0x5b6697['listenTo'](_0x1f7883,'load',()=>{_0x5b6697['stopListening'](_0x1f7883,'load'),_0x14ff03['editing']['view']['change'](_0x2f54db=>{_0x2f54db['removeClass'](_0x14f6ff,_0x127ddb),_0x2f54db['removeStyle']('aspect-ratio',_0x5bb407);});});}function M(_0x3679ee){if(Array['isArray'](_0x3679ee)){const _0x1a580f=_0x3679ee['map'](M);return _0xd69ca2=>_0x1a580f['some'](_0x3cff60=>_0x3cff60(_0xd69ca2));}if('origin'==_0x3679ee){const _0x3a604=_0x9ae635['window']['location']['origin'];return _0x26c2a4=>new URL(_0x26c2a4,_0x9ae635['document']['baseURI'])['origin']==_0x3a604;}return'function'==typeof _0x3679ee?_0x3679ee:_0x3679ee instanceof RegExp?_0xf379a1=>!(!_0xf379a1['match'](_0x3679ee)&&!_0xf379a1['replace'](/^https?:\/\//,'')['match'](_0x3679ee)):()=>!0x1;}function H(_0x55f36d,_0x68e1c4){return _0x190a9c(_0x55f36d['target'])['includes'](_0x68e1c4);}const W=/* #__PURE__ -- @preserve */
24
- _0x3fae10();var G=class extends W{_editor;['_dialog'];_editing;['_api'];_type=null;['_formView']=null;constructor(_0x217d74,_0x2bfdf7,_0x330e02){super(),this['_editor']=_0x217d74,this['_editing']=_0x2bfdf7,this['_dialog']=_0x217d74['plugins']['get'](_0x19e9a8),this['_api']=_0x2bfdf7['ctxElement']['getAPI'](),this['_type']=_0x330e02,this['_editing']['configElement']['setAttribute']('source-list',this['_type']),this['_initDialog'](),this['_initListeners'](),this['_api']['initFlow']();}destroy(){this['_formView']&&(this['_formView']['destroy'](),this['_formView']=null),this['_api']&&this['_api']['doneFlow'](),this['stopListening'](),this['stopDelegating']();}_initDialog(){const {locale:_0x3ecc35,model:_0x1fa1bd}=this['_editor'],_0x466241=_0x1fa1bd['document']['selection']['getSelectedElement'](),_0x49cc52=_0x466241&&(_0x466241['is']('element','imageBlock')||_0x466241['is']('element','imageInline'));this['_formView']=new $(_0x3ecc35,this['_editing']['ucContextId']),this['_dialog']['show']({'id':'uploadCare','icon':_0xe3a25d,'title':T(_0x3ecc35,this['_type'],_0x49cc52?'Replace':'Insert')['text'],'content':this['_formView'],'position':_0x1d4d33['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_api']['removeAllFiles'](),this['_editor']['editing']['view']['focus'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0x41fab6=>!H(_0x41fab6,this['_formView']['element'])}});}_initListeners(){this['_editing']['ctxElement']['addEventListener']('done-click',()=>{const {allEntries:_0x2ffce6}=this['_api']['getOutputCollectionState']();this['_editor']['model']['change'](_0x1b63d1=>{const _0xd63765=_0x2ffce6['length'];for(const _0x52e048 of _0x2ffce6){const _0x2e0995=_0x52e048===_0x2ffce6[_0xd63765-0x1],{cdnUrl:_0xd1475a,fileInfo:_0x1aca8f}=_0x52e048;if(!_0xd1475a||!_0x1aca8f)continue;const {width:_0x5ea7ec,height:_0x275abd}=_0x1aca8f['imageInfo'],_0x152db7=j(_0xd1475a,_0x5ea7ec,_0x275abd),_0xd1950f=B(_0xd1475a,_0x152db7['width']),_0x3a2683={'id':_0x1aca8f['uuid'],'type':'image','attributes':{'imageDimension':_0x152db7,..._0xd1950f}};this['_insertAsset'](_0x3a2683,_0x2e0995,_0x1b63d1);}}),this['_dialog']['hide']();}),this['_editing']['ctxElement']['addEventListener']('change',_0x3a4edd=>{'idle'===_0x3a4edd['detail']['status']&&!_0x3a4edd['detail']['allEntries']['length']&&this['_dialog']['isOpen']&&('local'===this['_type']?this['_api']['setCurrentActivity']('start-from'):this['_api']['initFlow']());});}_insertAsset(_0x40b44a,_0x1861a6,_0x43261d){const _0x16ffd8=this['_editor']['model']['document']['selection'],_0x288cc8=_0x16ffd8['getSelectedElement'](),_0x36da05=!(!_0x288cc8||!_0x288cc8['is']('element','imageInline'));_0x43261d['removeSelectionAttribute']('linkHref'),this['_insertImage'](_0x40b44a,_0x36da05),_0x1861a6||_0x43261d['setSelection'](_0x16ffd8['getLastPosition']());}_insertImage(_0x56daba,_0x11be94){const _0x4d0052=this['_editor'],{imageDimension:_0x3e3dce,imageFallbackUrl:_0xf828b8,imageSources:_0xd82ffb}=_0x56daba['attributes'];_0x4d0052['execute']('insertImage',{'imageType':_0x11be94?'imageInline':null,'source':{'uploadcareImageId':_0x56daba['id'],'src':_0xf828b8,'sources':_0xd82ffb,..._0x3e3dce}});}},z=class extends _0x156dc2{_editing;_controller=null;static get requires(){return[_0x19e9a8,Z];}constructor(_0x2364e6){super(_0x2364e6),this['_editing']=_0x2364e6['plugins']['get'](Z);}['refresh'](){this['isEnabled']=this['_checkEnabled']();}execute(_0x31bbb9){this['_controller']&&(this['_controller']['destroy'](),this['_controller']=null),this['_controller']=new G(this['editor'],this['_editing'],_0x31bbb9);}['_checkEnabled'](){return this['editor']['commands']['get']('insertImage')['isEnabled'];}},Q=class{static['upload']({file:_0x2d7174,..._0x145cbc}){return _0x18029c(_0x2d7174,_0x145cbc);}static getInfo(_0x27b32f,_0x20b313){return _0x1a29af(_0x27b32f,_0x20b313);}},J=class extends _0x34daf5{static get requires(){return[_0x39c9e2,_0x431de7,_0x4499f5,Z];}static get['pluginName'](){return'UploadcareUploadAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async afterInit(){const _0x51a6f6=this['editor'];if(!_0x51a6f6['config']['get']('uploadcare'))return;_0x51a6f6['plugins']['get'](_0x4499f5)['createUploadAdapter']=_0x1ac610=>new X(_0x1ac610,_0x51a6f6),_0x51a6f6['plugins']['get'](_0x39c9e2)['on']('uploadComplete',(_0x1d517f,{imageElement:_0x54621d,data:_0x18340c})=>{_0x51a6f6['model']['change'](_0x25fe35=>{_0x25fe35['setAttribute']('uploadcareImageId',_0x18340c['uploadcareImageId'],_0x54621d);});});}},X=class{['loader'];editor;controller;constructor(_0x26e18a,_0x4beb6e){this['loader']=_0x26e18a,this['editor']=_0x4beb6e,this['controller']=new AbortController();}async['upload'](){const t=this['editor']['t'],_0x36dc39=await this['loader']['file'];return Q['upload']({'file':_0x36dc39,'publicKey':this['editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['editor']['config']['get']('uploadcare.uploader.baseUrl'),'baseCDN':this['editor']['config']['get']('uploadcare.uploader.cdnCname'),'signal':this['controller']['signal'],'onProgress':_0x14b789=>{_0x14b789&&_0x14b789['isComputable']&&(this['loader']['uploadTotal']=0x1,this['loader']['uploaded']=_0x14b789['value']);}})['then'](async _0x1e98e=>{const {imageFallbackUrl:_0x53bae6,imageSources:_0x4375b0}=B(_0x1e98e['cdnUrl'],_0x1e98e['imageInfo']['width']);return{'uploadcareImageId':_0x1e98e['uuid'],'default':_0x53bae6,'sources':_0x4375b0};})['catch'](()=>{const _0xc41218=t('Cannot\x20upload\x20file:')+('\x20'+_0x36dc39['name']+'.');return Promise['reject'](_0xc41218);});}abort(){this['controller']['abort']();}},Z=class extends _0x34daf5{_configElement=null;_ctxElement=null;static get['pluginName'](){return'UploadcareEditing';}static get requires(){return[_0x2ae5bf,J,_0x19e9a8];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}ucContextId;get configElement(){return this['_configElement'];}get ctxElement(){return this['_ctxElement'];}constructor(_0x17705e){super(_0x17705e),this['ucContextId']=_0xd84b24();}init(){const _0x278d57=this['editor'];_0x278d57['commands']['add']('uploadcare',new z(_0x278d57));}afterInit(){this['_initSchema'](),this['_initConversion'](),this['_initConfig'](),this['_initCtx'](),this['_initImageProcessingIndicator'](),this['listenTo'](this['editor'],'destroy',()=>{this['_configElement']&&(this['_configElement']['remove'](),this['_configElement']=null),this['_ctxElement']&&(this['_ctxElement']['remove'](),this['_ctxElement']=null);const _0x56ddea=_0x9ae635['document']['querySelector']('input[uploadcare-file-input]');_0x56ddea&&_0x56ddea['remove']();}),async function(_0x4c5d46){const _0x20570f='4wieLj6qmWZnpxGN9QYyFhU15kOfCBAHt2slISMXP3vErub8za07VTRoKcdDgJ',_0x146991=0x793f8,_0x3d175c={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x377e3a(_0xb11664){const _0x233136=new window['Promise'](_0x3a8313=>{_0xb11664['once']('ready',_0x3a8313);}),_0xe60845=window['Date']['now'](),_0x35fef0=_0xb11664['config']['get']('licenseKey');async function _0x1d534a(){let _0x25ddd6,_0x3ca374=null,_0x343d87=null;try{return'GPL'==_0x35fef0?'NotAllowed':(_0x25ddd6=_0x307e95(),_0x25ddd6?(_0x25ddd6['usageEndpoint']&&(_0x343d87=_0x257f25(_0x25ddd6['usageEndpoint'],_0x25ddd6['jti'])),await _0x22733d()?_0x559dfb()?_0x45f60e()?'Expired':_0x49020e()?('evaluation'==_0x25ddd6['licenseType']&&(_0x3ca374=_0x556413('EvaluationLimit')),await _0x310c71()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x45f60e(){const _0x32354c=['evaluation','trial']['includes'](_0x25ddd6['licenseType'])?_0xe60845/0x3e8:0xe10*_0x146991;return _0x25ddd6['exp']<_0x32354c;}function _0x559dfb(){const _0x294ae1=_0x25ddd6['features'];return!!_0x294ae1&&(!!_0x294ae1['includes']('*')||!!_0x294ae1['includes']('UPLC'));}function _0x49020e(){const _0x5bab4d=_0x25ddd6['licensedHosts'];if(!_0x5bab4d||0x0==_0x5bab4d['length'])return!0x0;const {hostname:_0x1a1fc4}=new URL(window['location']['href']);if(_0x5bab4d['includes'](_0x1a1fc4))return!0x0;const _0x5dc553=_0x1a1fc4['split']('.');return _0x5bab4d['filter'](_0x4bbc0e=>_0x4bbc0e['includes']('*'))['map'](_0x4c16e0=>_0x4c16e0['split']('.'))['filter'](_0x58666d=>_0x58666d['length']<=_0x5dc553['length'])['map'](_0x8d33f3=>Array(_0x5dc553['length']-_0x8d33f3['length'])['fill']('*'===_0x8d33f3[0x0]?'*':'')['concat'](_0x8d33f3))['some'](_0x5ac9b6=>_0x5dc553['every']((_0x239ce1,_0x235999)=>_0x5ac9b6[_0x235999]===_0x239ce1||'*'===_0x5ac9b6[_0x235999]));}function _0x310c71(){return _0x3ca374&&_0x343d87?new window['Promise']((_0x2b6351,_0x366c9b)=>{_0x3ca374['then'](_0x2b6351,_0x366c9b),_0x343d87['then'](_0x271f1b=>{'Valid'!=_0x271f1b&&_0x2b6351(_0x271f1b);},_0x366c9b);}):_0x3ca374||_0x343d87||'Valid';}}function _0x257f25(_0x365403,_0x345c44){return new window['Promise'](_0x2e5bb3=>{if(_0x298d37())return _0x2e5bb3('Valid');_0x3e3631(),_0xb11664['decorate']('_sendUsageRequest');let _0x5d343d=!0x1;const _0x22d143=_0xd84b24();function _0x2dcf39(_0xb25ad5){return!!_0xb25ad5&&('object'==typeof _0xb25ad5||'function'==typeof _0xb25ad5)&&'function'==typeof _0xb25ad5['then']&&'function'==typeof _0xb25ad5['catch'];}function _0x53a22a(_0x4b56c4){_0x5cc804(_0x4b56c4)['then'](_0x392f91=>_0x392f91&&'ok'==_0x392f91['status']?_0x41118a(_0x19571a(_0x22d143+_0x345c44))!=_0x392f91['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x418350=>(_0x1f6e11(),_0x418350),()=>{const _0x32410a=_0x39cb4e();return null==_0x32410a?(_0x1f6e11(),'Valid'):_0xe60845-_0x32410a>0x240c8400?'UsageLimit':'Valid';})['then'](_0x2e5bb3)['catch'](()=>{_0x2e5bb3('UsageLimit');});const _0x1010d7=0x36ee80;function _0x1f6e11(){const _0x537c89='llct-'+_0x41118a(_0x19571a(_0x365403)),_0x306b5b=_0x200d7e(_0x41118a(window['Math']['ceil'](_0xe60845/_0x1010d7)));window['localStorage']['setItem'](_0x537c89,_0x306b5b);}function _0x39cb4e(){const _0x5ec9cb='llct-'+_0x41118a(_0x19571a(_0x365403)),_0x2f3673=window['localStorage']['getItem'](_0x5ec9cb);return _0x2f3673?window['parseInt'](_0x200d7e(_0x2f3673),0x10)*_0x1010d7:null;}function _0x5cc804(_0x124f23){return new window['Promise']((_0x2b369b,_0x399f1e)=>{_0x124f23['then'](_0x2b369b,_0x399f1e),window['setTimeout'](_0x399f1e,0x1d4c0);});}}_0xb11664['on']('_sendUsageRequest',(_0x181b6a,_0x1dd0f1)=>{if(_0x1dd0f1[0x0]!=_0x365403)return _0x2e5bb3('UsageLimit');_0x1dd0f1[0x1]={..._0x1dd0f1[0x1],'requestId':_0x22d143};},{'priority':'high'}),_0xb11664['on']('_sendUsageRequest',_0xbd5a19=>{_0x2dcf39(_0xbd5a19['return'])&&(_0x5d343d=!0x0,_0x53a22a(_0xbd5a19['return']));},{'priority':'low'}),_0x233136['then'](()=>{_0x5d343d||_0x2e5bb3('UsageLimit');});});function _0x298d37(){return'auto'==_0xb11664['editing']['view']['_overlayModeHint'];}function _0x3e3631(){_0xb11664['editing']['view']['_overlayModeHint']='auto';}}function _0x556413(_0x3c2a7d){const _0x14bd6c=[new window['Promise'](_0xd0e102=>setTimeout(_0xd0e102,0x93ecc)),_0x233136['then'](()=>new window['Promise'](_0x13fedf=>{let _0x2291c5=0x0;_0xb11664['model']['on']('applyOperation',(_0x128fbb,_0x1b79e8)=>{_0x1b79e8[0x0]['isDocumentOperation']&&_0x2291c5++,0x5e8==_0x2291c5&&(_0x13fedf(),_0x128fbb['off']());});}))];return window['Promise']['race'](_0x14bd6c)['then'](()=>_0x3c2a7d);}async function _0x373248(){await _0x233136,_0xb11664['model']['change']=_0x38e5d9,_0xb11664['model']['enqueueChange']=_0x38e5d9,_0xb11664['enableReadOnlyMode']('model');}function _0x4e7576(_0x5552fe){const _0x249afb=_0x3240ab();_0xb11664[_0x249afb]='uploadcareLicenseKey'+_0x5552fe,'Valid'!=_0x5552fe&&_0x373248();}function _0x3240ab(){const _0x41b883=window['String'](window['performance']['now']())['replace']('.','');let _0x34a48e='w';for(let _0x4d6c99=0x0;_0x4d6c99<_0x41b883['length'];_0x4d6c99+=0x2){let _0x3f5f88=window['parseInt'](_0x41b883['substring'](_0x4d6c99,_0x4d6c99+0x2));_0x3f5f88>=0x3e&&(_0x3f5f88-=0x3e),_0x34a48e+=_0x20570f[_0x3f5f88];}return _0x34a48e;}function _0x307e95(){const _0x4a9daf=_0x35fef0['split']('.');if(0x3!=_0x4a9daf['length'])return null;return _0x3186bf(_0x4a9daf[0x1]);function _0x3186bf(_0x23133e){const _0x384319=_0x4cbd48(_0x23133e);return _0x384319&&_0x3e50c7()?_0x384319:null;function _0x3e50c7(){const _0x36c49e=_0x384319['jti'],_0x311209=window['parseInt'](_0x36c49e['substring'](_0x36c49e['length']-0x8),0x10),_0x2bdf07={..._0x384319,'jti':_0x36c49e['substring'](0x0,_0x36c49e['length']-0x8)};return delete _0x2bdf07['vc'],_0x19571a(_0x2bdf07)==_0x311209;}}}async function _0x22733d(){let _0x4fab83=!0x0;try{const [_0x4e3d1c,_0x20298f,_0x42c6ce]=_0x35fef0['split']('.');return _0x12e059(_0x4e3d1c),await _0x27552c(_0x4e3d1c,_0x20298f,_0x42c6ce),_0x4fab83;}catch{return!0x1;}function _0x12e059(_0x42ae79){const _0x3458c3=_0x4cbd48(_0x42ae79);_0x3458c3&&'ES256'==_0x3458c3['alg']||(_0x4fab83=!0x1);}async function _0x27552c(_0x31eb76,_0x552369,_0x19e6aa){const _0x46b593=window['Uint8Array']['from'](_0x3a9cd6(_0x19e6aa),_0x22bf0a=>_0x22bf0a['charCodeAt'](0x0)),_0x5423c4=new window['TextEncoder']()['encode'](_0x31eb76+'.'+_0x552369),_0x2498e7=window['crypto']['subtle'];if(!_0x2498e7)return;const _0x13e05d=await _0x2498e7['importKey']('jwk',_0x3d175c,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x2498e7['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x13e05d,_0x46b593,_0x5423c4)||(_0x4fab83=!0x1);}}function _0x4cbd48(_0x41fa18){return _0x41fa18['startsWith']('ey')?JSON['parse'](_0x3a9cd6(_0x41fa18)):null;}function _0x3a9cd6(_0xf32f2c){return window['atob'](_0xf32f2c['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x19571a(_0x4dbb57){let _0x272ec9=0x1505;function _0x589830(_0x49ef5c){for(let _0xfecc03=0x0;_0xfecc03<_0x49ef5c['length'];_0xfecc03++){const _0x167b13=_0x49ef5c['charCodeAt'](_0xfecc03);_0x272ec9=(_0x272ec9<<0x5)+_0x272ec9+_0x167b13,_0x272ec9&=_0x272ec9;}}function _0x4e6473(_0x480893){Array['isArray'](_0x480893)?_0x480893['forEach'](_0x4e6473):_0x480893&&'object'==typeof _0x480893?Object['entries'](_0x480893)['sort']()['forEach'](([_0x16bd40,_0x9aa7d5])=>{_0x589830(_0x16bd40),_0x4e6473(_0x9aa7d5);}):_0x589830(window['String'](_0x480893));}return _0x4e6473(_0x4dbb57),_0x272ec9>>>0x0;}function _0x41118a(_0x1a7837){return _0x1a7837['toString'](0x10)['padStart'](0x8,'0');}function _0x200d7e(_0xdda905){return _0xdda905['split']('')['reverse']()['join']('');}function _0x38e5d9(){}_0x4e7576(await _0x1d534a());}_0x377e3a(_0x4c5d46['editor']);}(this);}_initSchema(){const _0x367348=this['editor']['model']['schema'];_0x367348['isRegistered']('imageBlock')&&_0x367348['extend']('imageBlock',{'allowAttributes':['uploadcareImageId']}),_0x367348['isRegistered']('imageInline')&&_0x367348['extend']('imageInline',{'allowAttributes':['uploadcareImageId']});}_initConversion(){const _0x1d4d5a=this['editor'];_0x1d4d5a['conversion']['for']('downcast')['attributeToAttribute']({'model':'uploadcareImageId','view':'data-uc-image-id'}),_0x1d4d5a['conversion']['for']('upcast')['elementToAttribute']({'model':{'key':'uploadcareImageId','value':_0x53119b=>_0x53119b['getAttribute']('data-uc-image-id')},'view':{'attributes':{'data-uc-image-id':/[a-zA-Z0-9\\-]+/}}});const _0x3e309d=_0x1d4d5a['commands']['get']('replaceImageSource');_0x3e309d&&this['listenTo'](_0x3e309d,'cleanupImage',(_0x585322,[_0x393aff,_0x3d4c98])=>{_0x393aff['removeAttribute']('uploadcareImageId',_0x3d4c98);});}_initConfig(){const _0x5e2db3=this['editor']['config']['get']('uploadcare.uploader')||{},_0x748881=this['editor']['config']['get']('uploadcare.pubkey')||'';this['_configElement']=_0x1f0b24(_0x9ae635['document'],'uc-config',{..._0x5e2db3,'pubkey':_0x748881,'ctx-name':'uploader-'+this['ucContextId'],'sourceList':'','imgOnly':'true','removeCopyright':'true','localeName':this['editor']['locale']['contentLanguage'],'externalSourcesEmbedCss':'\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup\x20{\x20padding:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup-menu\x20{\x20gap:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup-footer\x20{\x20padding-top:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__separator\x20{\x20margin:\x200;\x20}\x0a\x09\x09\x09'}),this['_configElement']['iconHrefResolver']=_0x43fba4=>{if('closeMax'==_0x43fba4)return'#uc-icon-arrow-down';},_0x9ae635['document']['body']['appendChild'](this['_configElement']);}_initCtx(){this['_ctxElement']=_0x1f0b24(_0x9ae635['document'],'uc-upload-ctx-provider',{'ctx-name':'uploader-'+this['ucContextId']}),_0x9ae635['document']['body']['appendChild'](this['_ctxElement']);}_initImageProcessingIndicator(){const _0x17b446=this['editor']['commands']['get']('insertImage');_0x17b446&&this['listenTo'](_0x17b446,'execute',()=>{const _0x155846=this['editor']['model']['document']['selection']['getSelectedElement']();_0x155846&&_0x155846['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0x155846);});});const _0x1cc9be=this['editor']['commands']['get']('uploadcareImageReplace');_0x1cc9be&&this['listenTo'](_0x1cc9be,'execute',()=>{const _0x43ff46=this['editor']['model']['document']['selection']['getSelectedElement']();_0x43ff46&&_0x43ff46['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0x43ff46);});});}},Y=class extends _0x34daf5{static get requires(){return[Z,V];}static get['pluginName'](){return'Uploadcare';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2fcda1){super(_0x2fcda1),_0x2fcda1['config']['define']('uploadcare.uploader.sourceList',['local','url']),_0x4d6e90['defineComponents'](_0x4d6e90),this['_defineLocale']();}['_defineLocale'](){const _0xc4e3bb=this['editor']['config']['get']('uploadcare.locale'),_0x3b01a3=this['editor']['locale']['contentLanguage'];_0xc4e3bb&&_0x4d6e90['defineLocale'](_0x3b01a3,_0xc4e3bb);}},tt=class extends _0x4fdd4a{constructor(_0x51b340){super(_0x51b340);const t=_0x51b340['t'],_0x195c1d=this['bindTemplate'],_0x3801fd=new _0x2cc1bd();_0x3801fd['isVisible']=!0x0,this['setTemplate']({'tag':'div','attributes':{'class':['ck-uploadcare-form__loading'],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck-uploadcare-form__loading-spinner']},'children':[_0x3801fd,{'text':_0x195c1d['to']('imageUploadProgress',_0x3acc97=>t('Loading\x20image...')+'\x20('+(_0x3acc97||0x0)+'%)')}]},{'tag':'div','attributes':{'class':['ck-uploadcare-form__skeleton']},'children':[{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'}]},{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'}]}]}]});}},et=class extends _0x4fdd4a{constructor(_0x48b262){super(_0x48b262);const t=_0x48b262['t'];this['set']('errorType',null);const _0x51eaf9=new _0x132e37(_0x48b262);_0x51eaf9['label']=t({'id':'Try\x20again\x20(Uploadcare)','string':'Try\x20again'}),_0x51eaf9['withText']=!0x0,_0x51eaf9['class']='ck-button-action',_0x51eaf9['on']('execute',()=>{this['fire']('retry');}),_0x51eaf9['bind']('isVisible')['to'](this,'errorType',_0x4dd3d8=>'NotFound'!==_0x4dd3d8);const _0x25368e=new _0x589907();_0x25368e['content']=_0x510b2d,_0x25368e['extendTemplate']({'attributes':{'style':{'width':'50px','height':'50px'}}});const _0x337ba2=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-uploadcare-form__error'],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck-uploadcare-form__error-contents']},'children':[_0x25368e,{'tag':'h3','attributes':{'style':{'fontWeight':'bold'}},'children':[{'text':t('Unable\x20to\x20load')}]},{'text':_0x337ba2['to']('errorType',_0x2d1ab7=>t('NotFound'!==_0x2d1ab7?'We\x20were\x20unable\x20to\x20load\x20the\x20image\x20due\x20to\x20network\x20connection\x20issues.':'The\x20image\x20was\x20not\x20found.\x20Its\x20source\x20may\x20have\x20been\x20removed.'))},_0x51eaf9]},{'tag':'div','attributes':{'class':['ck-uploadcare-form__skeleton']},'children':[{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'}]},{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'}]}]}]});}},it=class extends _0x4fdd4a{constructor(_0x35b1d8,_0x2ec0fa){super(_0x35b1d8);const _0x163809=this['bindTemplate'];this['set']('imageSrc',''),this['setTemplate']({'tag':'uc-cloud-image-editor','attributes':{..._0x2ec0fa,'class':['uc-light','ck-uploadcare-theme'],'ctx-name':'image-edit','cdn-url':_0x163809['to']('imageSrc')}});}},st=class extends F{_items;['_loadingView'];['_errorView'];_editingView;['_focusableView'];constructor(_0x4bb77f,_0x12b283,_0x5806ef){super(_0x4bb77f),this['_items']=this['createCollection'](),this['_loadingView']=new tt(_0x4bb77f),this['_errorView']=new et(_0x4bb77f),this['_editingView']=new it(_0x4bb77f,_0x5806ef),this['_focusableView']=new _0x4fdd4a(_0x4bb77f),this['_focusableView']['setTemplate'](this['getFocusableElement']()),this['set']('status',_0x12b283),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-uploadcare-form'],'tabindex':'-1'},'children':this['_items']}),this['_setView'](),this['once']('render',()=>{this['_waitForImageEditorComponent'](this['element'],_0x124c4f=>{this['_addUploadcareImageEditorListeners'](_0x124c4f);});}),this['on']('change:status',()=>{this['_setView']();}),this['_addErrorViewListeners']();}['focus'](){this['element']['focus']();}_setView(){switch(this['_items']['clear'](),this['status']){case'uploading':this['_items']['add'](this['_loadingView']);break;case'error':this['_items']['add'](this['_errorView']);break;case'ready':this['_items']['addMany']([this['_editingView'],this['_focusableView']]);}}_waitForImageEditorComponent(_0x558d71,_0x445648){const _0x1a69bd='uc-cloud-image-editor',_0x432055=_0x558d71['querySelector'](_0x1a69bd);if(_0x432055)return _0x445648(_0x432055);const _0x2d3b19=new MutationObserver(_0xca27f4=>{const _0x2e36d1=_0xca27f4['filter'](_0x54ed85=>_0x54ed85['target']===_0x558d71&&_0x54ed85['addedNodes']['length']>0x0&&_0x54ed85['addedNodes'][0x0]['nodeName']['toLowerCase']()===_0x1a69bd);_0x2e36d1['length']&&(_0x2d3b19['disconnect'](),_0x445648(_0x2e36d1[0x0]['addedNodes'][0x0]));});_0x2d3b19['observe'](_0x558d71,{'childList':!0x0,'subtree':!0x0});}_addUploadcareImageEditorListeners(_0x3aa144){_0x3aa144['addEventListener']('apply',_0x4087bf=>{this['fire']('apply',{'imageSrc':_0x4087bf['detail']['cdnUrl']});}),_0x3aa144['addEventListener']('cancel',()=>{this['fire']('cancel');});}_addErrorViewListeners(){this['_errorView']['on']('retry',()=>{this['fire']('retry');});}};const nt=/* #__PURE__ -- @preserve */
25
- _0x3fae10();var rt=class extends nt{_editor;['_dialog'];_imageElement;['_imageCache'];_controller;_attributes;constructor(_0x4078e2,_0x35e627,_0x5815a2){super(),this['_editor']=_0x4078e2,this['_dialog']=_0x35e627,this['_imageElement']=_0x5815a2,this['_imageCache']=this['_editor']['plugins']['get']('UploadcareImageEditUI')['imageCache'],this['_attributes']=this['_editor']['config']['get']('uploadcare.editor')||{},this['set']({'isActive':!0x0,'imageStatus':'ready','imageErrorType':null,'imageId':null,'imageSrc':null,'imageDimension':null,'imageUploadProgress':null}),this['_prepareImage'](),this['_showDialog']();}destroy(){this['isActive']=!0x1,this['stopListening'](),this['stopDelegating'](),'uploading'===this['imageStatus']&&this['_controller']&&this['_controller']['abort']();}async['_prepareImage'](){const _0x47c86a=this['_imageElement'],_0x398b11=_0x47c86a['getAttribute']('uploadcareImageId'),_0x1cb43f=_0x47c86a['getAttribute']('src');if(_0x398b11)await this['_loadImageInfo'](_0x398b11,_0x1cb43f);else{if(this['_imageCache']['has'](_0x1cb43f)){const _0x1c6d4f=this['_imageCache']['get'](_0x1cb43f);this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x1c6d4f['url'],this['imageDimension']=_0x1c6d4f['dimension'],this['imageId']=_0x1c6d4f['id'];}else this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),await this['_uploadImage'](this['_imageElement'],this['_controller']);}}['_showDialog'](){const {locale:_0x5164b4}=this['_editor'],t=_0x5164b4['t'],_0xc6b5d8=new st(_0x5164b4,this['imageStatus'],this['_attributes']);_0xc6b5d8['bind']('status')['to'](this,'imageStatus'),_0xc6b5d8['_loadingView']['bind']('imageUploadProgress')['to'](this,'imageUploadProgress'),_0xc6b5d8['_editingView']['bind']('imageSrc')['to'](this,'imageSrc'),_0xc6b5d8['_errorView']['bind']('errorType')['to'](this,'imageErrorType'),this['_addEditViewListeners'](_0xc6b5d8,this['_imageElement']),this['_dialog']['show']({'id':'uploadcareImageEdit','icon':_0x40ecc3,'title':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'}),'content':_0xc6b5d8,'position':_0x1d4d33['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{_0xc6b5d8['focus']();},'onHide':()=>{_0xc6b5d8['destroy'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0x3c5863=>!H(_0x3c5863,_0xc6b5d8['element'])}});}['_loadImageInfo'](_0xfe8be9,_0x489e1e){return Q['getInfo'](_0xfe8be9,{'publicKey':this['_editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['_editor']['config']['get']('uploadcare.uploader.baseUrl')})['then'](_0x284d4a=>{const {width:_0x1227f2,height:_0x46f5a4}=_0x284d4a['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x489e1e,this['imageDimension']={'width':_0x1227f2,'height':_0x46f5a4},this['imageId']=_0xfe8be9;})['catch'](_0x1d637a=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x1d637a['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}['_uploadImage'](_0x1314fd,_0x3ee4c3){return this['_getImageAsFile'](_0x1314fd)['then'](_0x2da71c=>Q['upload']({'publicKey':this['_editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['_editor']['config']['get']('uploadcare.uploader.baseUrl'),'baseCDN':this['_editor']['config']['get']('uploadcare.uploader.cdnCname'),'signal':_0x3ee4c3['signal'],'file':_0x2da71c,'onProgress':_0xe217b7=>{_0xe217b7&&_0xe217b7['isComputable']&&(this['imageUploadProgress']=Math['ceil'](0x64*_0xe217b7['value']));}}))['then'](_0x59a163=>{const {width:_0x1a9882,height:_0x42830a}=_0x59a163['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x59a163['cdnUrl'],this['imageDimension']={'width':_0x1a9882,'height':_0x42830a},this['imageId']=_0x59a163['uuid'],this['imageUploadProgress']=null;const _0x84d172=_0x1314fd['getAttribute']('src');this['_imageCache']['set'](_0x84d172,{'id':_0x59a163['uuid'],'url':_0x59a163['cdnUrl'],'dimension':this['imageDimension']});})['catch'](_0x2c4e7a=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x2c4e7a['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}_addEditViewListeners(_0x2bdff6,_0x47136f){_0x2bdff6['on']('apply',(_0xfa00ed,_0x5ac7cc)=>{this['_replaceImage'](_0x47136f,_0x5ac7cc['imageSrc'],this['imageId']),this['_dialog']['hide']();}),_0x2bdff6['on']('retry',()=>{this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),this['_uploadImage'](this['_imageElement'],this['_controller']);}),_0x2bdff6['on']('cancel',()=>{this['_dialog']['hide']();});}['_replaceImage'](_0x2591bb,_0x3179cf,_0x534200){const _0x5a99d7=this['_editor'],{width:_0x2d95e4,height:_0x3db802}=j(_0x3179cf,this['imageDimension']['width'],this['imageDimension']['height']),{imageFallbackUrl:_0x1c4ca6,imageSources:_0x4500ab}=B(_0x3179cf,_0x2d95e4);_0x5a99d7['model']['change'](_0x191a3e=>{if('$graveyard'!==_0x2591bb['root']['rootName'])_0x191a3e['setSelection'](_0x2591bb,'on'),_0x5a99d7['execute']('uploadcareImageReplace',{...Object['fromEntries'](_0x2591bb['getAttributes']()),'uploadcareImageId':_0x534200,'src':_0x1c4ca6,'sources':_0x4500ab,'width':_0x2d95e4,'height':_0x3db802},_0x2591bb);else{_0x5a99d7['execute']('insertImage',{'imageType':_0x2591bb['is']('element','imageInline')?'imageInline':null,'source':{...Object['fromEntries'](_0x2591bb['getAttributes']()),'uploadcareImageId':_0x534200,'src':_0x1c4ca6,'sources':_0x4500ab,'width':_0x2d95e4,'height':_0x3db802}});const _0x452f7b=_0x2591bb['getChildren']();_0x2591bb=_0x5a99d7['model']['document']['selection']['getSelectedElement']();for(const _0x2501e3 of _0x452f7b)_0x191a3e['append'](_0x191a3e['cloneElement'](_0x2501e3),_0x2591bb);}_0x191a3e['setSelection'](_0x2591bb,'on');});}async _getImageAsFile(_0x564679){const _0x15eaee=_0x9ae635['window'],_0x16075e=_0x9ae635['document']['location']['href'],_0x28e566=new _0x15eaee['URL'](_0x564679['getAttribute']('src'),_0x16075e);if('data:'===_0x28e566['protocol']){const _0x11eb89=_0x28e566['href']['split'](','),_0x1aca55=_0x11eb89[0x0]['match'](/:(.*?);/)[0x1],_0x262838=_0x1aca55['split']('/')[0x1],_0x1992d5=_0x15eaee['atob'](_0x11eb89[_0x11eb89['length']-0x1]);let _0xc7e6c9=_0x1992d5['length'];const _0x25deaf=new _0x15eaee['Uint8Array'](_0xc7e6c9);for(;_0xc7e6c9--;)_0x25deaf[_0xc7e6c9]=_0x1992d5['charCodeAt'](_0xc7e6c9);return new _0x15eaee['File']([_0x25deaf],'image.'+_0x262838,{'type':_0x1aca55});}const _0xb225b3=_0x28e566['href']['split']('/'),_0x3449a0=_0xb225b3[_0xb225b3['length']-0x1],_0x36e958=_0x3449a0['split']('.')[0x1];return _0x15eaee['fetch'](_0x28e566['href'])['then'](_0x5161a7=>_0x5161a7['clone']()['blob']())['then'](_0x230d00=>new _0x15eaee['File']([_0x230d00],_0x3449a0,{'type':'image/'+_0x36e958}));}},at=class extends _0x156dc2{imageEditController;static get requires(){return[_0x19e9a8];}_isEditable;constructor(_0xbc3c84){super(_0xbc3c84),this['imageEditController']=void 0x0,this['_isEditable']=function(_0x6c5f48){const _0x54f023=M(_0x6c5f48);return _0x20e7b3=>!(!_0x20e7b3||!_0x20e7b3['is']('element','imageBlock')&&!_0x20e7b3['is']('element','imageInline'))&&(!!_0x20e7b3['hasAttribute']('uploadcareImageId')||!!_0x20e7b3['hasAttribute']('src')&&_0x54f023(_0x20e7b3['getAttribute']('src')));}(_0xbc3c84['config']['get']('uploadcare.allowExternalImagesEditing')||[]),this['set']({'isActive':!0x1});}['refresh'](){const _0x18b234=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=this['_isEditable'](_0x18b234);}execute(){this['imageEditController']&&(this['unbind']('isActive'),this['imageEditController']=void 0x0);const _0x14b87a=this['editor']['model']['document']['selection']['getSelectedElement']();_0x14b87a&&(_0x14b87a['is']('element','imageBlock')||_0x14b87a['is']('element','imageInline'))&&(this['imageEditController']=new rt(this['editor'],this['editor']['plugins']['get'](_0x19e9a8),_0x14b87a),this['bind']('isActive')['to'](this['imageEditController'],'isActive'));}},ot=class extends _0x156dc2{['refresh'](){const _0x6600ed=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=Boolean(_0x6600ed&&(_0x6600ed['is']('element','imageBlock')||_0x6600ed['is']('element','imageInline')));}execute(_0x39b59b){const _0x25f155=this['editor']['model']['document']['selection']['getSelectedElement']();this['editor']['model']['change'](_0x2c1e9c=>{_0x2c1e9c['setAttributes'](_0x39b59b,_0x25f155),_0x2c1e9c['removeAttribute']('srcset',_0x25f155),_0x2c1e9c['removeAttribute']('sizes',_0x25f155);});}},ct=class extends _0x34daf5{static get['pluginName'](){return'UploadcareImageEditEditing';}static get requires(){return[Z,_0x2b28a9,_0x187a9d,_0x42cebf];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x218f1a}=this;_0x218f1a['commands']['add']('uploadcareImageEdit',new at(_0x218f1a)),_0x218f1a['commands']['add']('uploadcareImageReplace',new ot(_0x218f1a));}},lt=class extends _0x34daf5{['_imageCache']=new Map();static get['pluginName'](){return'UploadcareImageEditUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}get['imageCache'](){return this['_imageCache'];}init(){const _0x4b4832=this['editor'];_0x4b4832['ui']['componentFactory']['add']('uploadcareImageEdit',_0x28b926=>{const _0x34d774=_0x4b4832['commands']['get']('uploadcareImageEdit'),_0x3ed5c2=new _0x132e37(_0x28b926),t=_0x28b926['t'];return _0x3ed5c2['set']({'icon':_0x40ecc3,'tooltip':!0x0,'label':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'})}),_0x3ed5c2['bind']('isEnabled')['to'](_0x34d774),_0x3ed5c2['bind']('isOn')['to'](_0x34d774,'isActive'),this['listenTo'](_0x3ed5c2,'execute',()=>{_0x4b4832['execute']('uploadcareImageEdit'),_0x4b4832['editing']['view']['focus']();}),_0x3ed5c2;}),this['_initConfig']();}_initConfig(){const _0xac1af7=_0x1f0b24(document,'uc-config',{'ctx-name':'image-edit','removeCopyright':'true','localeName':this['editor']['locale']['contentLanguage']});document['body']['appendChild'](_0xac1af7),this['listenTo'](this['editor'],'destroy',()=>{_0xac1af7['remove']();});}},ut=class extends _0x34daf5{static get['pluginName'](){return'UploadcareImageEdit';}static get requires(){return[ct,lt];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{Y as Uploadcare,z as UploadcareCommand,Z as UploadcareEditing,ut as UploadcareImageEdit,at as UploadcareImageEditCommand,ct as UploadcareImageEditEditing,lt as UploadcareImageEditUI,V as UploadcareUI,J as UploadcareUploadAdapter};
23
+ import{Command as _0x32b870,Plugin as _0x332116}from'@ckeditor/ckeditor5-core';import{IconDropbox as _0x54c38b,IconError as _0x5ca71f,IconFacebook as _0x535595,IconGoogleDrive as _0x356158,IconGooglePhotos as _0x5683fd,IconOneDrive as _0x472fc5,IconUploadcareImageEdit as _0x1cc061,IconUploadcareImageUpload as _0x16c199,IconUploadcareLink as _0x2f9434}from'@ckeditor/ckeditor5-icons';import{ButtonView as _0x4e4190,Dialog as _0x57a16d,DialogViewPosition as _0xfb0bc,FocusCycler as _0x40ff80,IconView as _0x4ec8e0,MenuBarMenuListItemButtonView as _0x31c406,Notification as _0x4ba2bb,SpinnerView as _0x127fcf,View as _0x2e46a2}from'@ckeditor/ckeditor5-ui';import{DomEmitterMixin as _0x1c416c,FocusTracker as _0x27f76f,ObservableMixin as _0x14e46e,createElement as _0x34725c,getAncestors as _0x3755a1,global as _0x355bce,uid as _0x2f57e7}from'@ckeditor/ckeditor5-utils';import{ImageEditing as _0x246923,ImageUploadEditing as _0x2d04e6,ImageUploadProgress as _0x42903e,ImageUtils as _0xca79ac,PictureEditing as _0x2beec8}from'@ckeditor/ckeditor5-image';import{FileRepository as _0x48c14e}from'@ckeditor/ckeditor5-upload';import{info as _0x2a3a14,uploadFile as _0x246001}from'@uploadcare/upload-client';import*as _0x3394b2 from'@uploadcare/file-uploader/web/file-uploader.min.js';function T(_0x152587,_0x5f1e70,_0x59f70b){const t=_0x152587['t'],_0x1154d9=_0x152587['t'];switch(_0x5f1e70){case'local':return{'text':_0x1154d9('Insert'===_0x59f70b?'Upload\x20from\x20computer':'Replace\x20from\x20computer'),'shortText':_0x1154d9('From\x20computer')};case'url':return{'text':'Insert'===_0x59f70b?_0x1154d9('Insert\x20via\x20URL'):t('Replace\x20via\x20URL'),'shortText':_0x1154d9('Via\x20URL')};case'dropbox':return{'text':t('Insert'===_0x59f70b?'Insert\x20with\x20Dropbox':'Replace\x20with\x20Dropbox'),'shortText':t('With\x20Dropbox')};case'facebook':return{'text':t('Insert'===_0x59f70b?'Insert\x20with\x20Facebook':'Replace\x20with\x20Facebook'),'shortText':t('With\x20Facebook')};case'gdrive':return{'text':t('Insert'===_0x59f70b?'Insert\x20with\x20Google\x20Drive':'Replace\x20with\x20Google\x20Drive'),'shortText':t('With\x20Google\x20Drive')};case'gphotos':return{'text':t('Insert'===_0x59f70b?'Insert\x20with\x20Google\x20Photos':'Replace\x20with\x20Google\x20Photos'),'shortText':t('With\x20Google\x20Photos')};case'onedrive':return{'text':t('Insert'===_0x59f70b?'Insert\x20with\x20OneDrive':'Replace\x20with\x20OneDrive'),'shortText':t('With\x20OneDrive')};default:return _0x5f1e70;}}var V=class extends _0x332116{['licenseKey'];_licenseKeyCheckInterval;static get['pluginName'](){return'UploadcareUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['licenseKey']=this['editor']['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{const _0x30d2aa=[this['editor']];for(const _0x44aa10 of _0x30d2aa){let _0x106fd4;for(const _0xe3ba7e in _0x44aa10){const _0x1facfa=_0xe3ba7e,_0x4098d9=_0x44aa10[_0x1facfa];if('uploadcareLicenseKeyValid'==_0x4098d9||'uploadcareLicenseKeyInvalid'==_0x4098d9||'uploadcareLicenseKeyExpired'==_0x4098d9||'uploadcareLicenseKeyDomainLimit'==_0x4098d9||'uploadcareLicenseKeyNotAllowed'==_0x4098d9||'uploadcareLicenseKeyEvaluationLimit'==_0x4098d9||'uploadcareLicenseKeyUsageLimit'==_0x4098d9){delete _0x44aa10[_0x1facfa],_0x106fd4=_0x4098d9,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'uploadcareLicenseKeyInvalid'==_0x106fd4&&_0x44aa10['_showLicenseError']('invalid'),'uploadcareLicenseKeyExpired'==_0x106fd4&&_0x44aa10['_showLicenseError']('expired'),'uploadcareLicenseKeyDomainLimit'==_0x106fd4&&_0x44aa10['_showLicenseError']('domainLimit'),'uploadcareLicenseKeyNotAllowed'==_0x106fd4&&_0x44aa10['_showLicenseError']('featureNotAllowed','Uploadcare'),'uploadcareLicenseKeyEvaluationLimit'==_0x106fd4&&_0x44aa10['_showLicenseError']('evaluationLimit'),'uploadcareLicenseKeyUsageLimit'==_0x106fd4&&_0x44aa10['_showLicenseError']('usageLimit');}},0x3e8);}afterInit(){const {editor:_0x97689a}=this,_0x4ddd35=_0x97689a['commands']['get']('uploadcare');if(!_0x4ddd35)return;const _0xd4ad09=this['_normalizeConfigSourceList'](_0x97689a['config']['get']('uploadcare.uploader.sourceList'))['reduce']((_0x467a22,_0x56e1c0)=>{const _0x5428f3=this['_getIntegrationKey'](_0x56e1c0['type']);return _0x467a22[_0x5428f3]||(_0x467a22[_0x5428f3]=[]),_0x467a22[_0x5428f3]['push'](_0x56e1c0),_0x467a22;},{});_0x97689a['plugins']['has']('ImageInsertUI')&&_0x97689a['commands']['get']('uploadcare')&&Object['entries'](_0xd4ad09)['forEach'](([_0x19516b,_0x4278ac])=>{_0x97689a['plugins']['get']('ImageInsertUI')['registerIntegration']({'name':_0x19516b,'observable':()=>_0x4ddd35,'buttonViewCreator':()=>this['_createToolbarButton'](_0x4278ac),'formViewCreator':()=>this['_createDropdownButtons'](_0x4278ac),'menuBarButtonViewCreator':()=>this['_createMenuBarButtons'](_0x4278ac),'override':'assetManager'!==_0x19516b});});}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}_normalizeConfigSourceList(_0x1938d6){const {locale:_0x3a3996}=this['editor'];return _0x1938d6['map'](_0x4dea17=>{const _0x5df467=T(_0x3a3996,_0x4dea17,'Insert');switch(_0x4dea17){case'local':return{'icon':_0x16c199,'type':'local',..._0x5df467};case'url':return{'icon':_0x2f9434,'type':'url',..._0x5df467};case'dropbox':return{'icon':_0x54c38b,'type':'dropbox',..._0x5df467};case'facebook':return{'icon':_0x535595,'type':'facebook',..._0x5df467};case'gdrive':return{'icon':_0x356158,'type':'gdrive',..._0x5df467};case'gphotos':return{'icon':_0x5683fd,'type':'gphotos',..._0x5df467};case'onedrive':return{'icon':_0x472fc5,'type':'onedrive',..._0x5df467};}});}_getIntegrationKey(_0xe86248){switch(_0xe86248){case'local':return'upload';case'url':return'url';default:return'assetManager';}}_createButton(_0x174bc2,_0x161db9){const _0x546983=this['editor'],_0x1eb122=new _0x174bc2(_0x546983['locale']),_0x2a775a=_0x546983['commands']['get']('uploadcare');return _0x1eb122['bind']('isEnabled')['to'](_0x2a775a),_0x1eb122['on']('execute',()=>{_0x2a775a['execute'](_0x161db9);}),_0x1eb122;}_createToolbarButton(_0x28d923){const {locale:_0x68726b}=this['editor'],_0x2459ba=this['editor']['plugins']['get']('ImageInsertUI'),_0x385076=_0x28d923[0x0],_0x4cbd03=this['_createButton'](_0x4e4190,_0x385076['type']);return _0x4cbd03['icon']=_0x385076['icon'],_0x4cbd03['bind']('label')['to'](_0x2459ba,'isImageSelected',_0x13fcd1=>T(_0x68726b,_0x385076['type'],_0x13fcd1?'Replace':'Insert')['text']),_0x4cbd03['tooltip']=!0x0,_0x4cbd03;}_createDropdownButtons(_0x3a7029){const {locale:_0x9cdc05}=this['editor'],_0x4ff441=this['editor']['plugins']['get']('ImageInsertUI');return _0x3a7029['map'](_0x1da1ec=>{const _0x3eced2=this['_createButton'](_0x4e4190,_0x1da1ec['type']);return _0x3eced2['withText']=!0x0,_0x3eced2['icon']=_0x1da1ec['icon'],_0x3eced2['bind']('label')['to'](_0x4ff441,'isImageSelected',_0x3e5e21=>T(_0x9cdc05,_0x1da1ec['type'],_0x3e5e21?'Replace':'Insert')['text']),_0x3eced2;});}_createMenuBarButtons(_0x8a3eaf){return _0x8a3eaf['map'](_0x275da7=>{const _0x3fda99=this['_createButton'](_0x31c406,_0x275da7['type']);return _0x3fda99['icon']=_0x275da7['icon'],_0x3fda99['label']=_0x275da7['shortText'],_0x3fda99;});}},F=class extends _0x2e46a2{['focusTracker'];['focusCycler'];constructor(_0xe8a0cf){super(_0xe8a0cf),this['focusTracker']=new _0x27f76f(),this['focusCycler']=new _0x40ff80({'focusables':this['createCollection'](),'focusTracker':this['focusTracker']});}getFocusableElement(){return{'tag':'div','attributes':{'aria-hidden':'true','tabindex':'0'},'on':{'focus':this['bindTemplate']['to'](()=>{this['focusCycler']['fire']('forwardCycle');})}};}},$=class extends F{constructor(_0x5b975b,_0x22374c){super(_0x5b975b),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-uploadcare-form'],'tabindex':'-1'},'children':[{'tag':'uc-file-uploader-inline','attributes':{'class':['uc-light','ck-uploadcare-theme'],'ctx-name':'uploader-'+_0x22374c}},this['getFocusableElement']()]});}['focus'](){this['element']['focus']();}};function B(_0x44f830,_0x16aff8){const _0x8e3091=_0x44f830['replace'](/\/$/,'');return{'imageFallbackUrl':_0x44f830,'imageSources':[{'srcset':[...[0x140,0x1e0,0x300,0x400,0x4b0,0x640,0x780,0x960]['filter'](_0x315c89=>_0x315c89<_0x16aff8)['map'](_0xc8d05a=>_0x8e3091+'/-/resize/'+_0xc8d05a+'x/\x20'+_0xc8d05a+'w'),_0x44f830+'\x20'+_0x16aff8+'w']['join'](',\x20'),'sizes':'(max-width:\x20'+_0x16aff8+'px)\x20100vw,\x20'+_0x16aff8+'px','type':'image/webp'}]};}function j(_0xd2c4e8,_0x3957f0,_0x1f8409){const _0x38276b=_0xd2c4e8['match'](/\/crop\/(\d+)x(\d+)\//);return{'width':_0x38276b?parseInt(_0x38276b[0x1],0xa):_0x3957f0,'height':_0x38276b?parseInt(_0x38276b[0x2],0xa):_0x1f8409};}function q(_0x20de75,_0xecb768){const _0x4dce60=new(_0x1c416c())(),_0x38e60c=_0x20de75['plugins']['get']('ImageUtils'),_0x922296=_0x20de75['editing']['mapper']['toViewElement'](_0xecb768),_0x1e584d=_0x38e60c['findViewImgElement'](_0x922296),_0x5058f2=_0x20de75['editing']['view']['domConverter']['viewToDom'](_0x1e584d),_0x50411b=_0xecb768['getAttribute']('width'),_0x5050e7=_0xecb768['getAttribute']('height'),_0x213767='image-processing';_0x20de75['editing']['view']['change'](_0x5232d6=>{_0x5232d6['addClass'](_0x213767,_0x922296),_0x5232d6['setStyle']('aspect-ratio',_0x50411b+'/'+_0x5050e7,_0x1e584d);}),_0x4dce60['listenTo'](_0x5058f2,'load',()=>{_0x4dce60['stopListening'](_0x5058f2,'load'),_0x20de75['editing']['view']['change'](_0x58e1fa=>{_0x58e1fa['removeClass'](_0x213767,_0x922296),_0x58e1fa['removeStyle']('aspect-ratio',_0x1e584d);});});}function M(_0x20ff38){if(Array['isArray'](_0x20ff38)){const _0x21ec1f=_0x20ff38['map'](M);return _0x5144de=>_0x21ec1f['some'](_0xde8e6d=>_0xde8e6d(_0x5144de));}if('origin'==_0x20ff38){const _0x3331d6=_0x355bce['window']['location']['origin'];return _0x21cff8=>new URL(_0x21cff8,_0x355bce['document']['baseURI'])['origin']==_0x3331d6;}return'function'==typeof _0x20ff38?_0x20ff38:_0x20ff38 instanceof RegExp?_0x262c1f=>!(!_0x262c1f['match'](_0x20ff38)&&!_0x262c1f['replace'](/^https?:\/\//,'')['match'](_0x20ff38)):()=>!0x1;}function H(_0x303146,_0x195fa5){return _0x3755a1(_0x303146['target'])['includes'](_0x195fa5);}const W=/* #__PURE__ -- @preserve */
24
+ _0x14e46e();var G=class extends W{_editor;['_dialog'];_editing;['_api'];_type=null;['_formView']=null;constructor(_0x3aec06,_0x3eeb20,_0x342e60){super(),this['_editor']=_0x3aec06,this['_editing']=_0x3eeb20,this['_dialog']=_0x3aec06['plugins']['get'](_0x57a16d),this['_api']=_0x3eeb20['ctxElement']['getAPI'](),this['_type']=_0x342e60,this['_editing']['configElement']['setAttribute']('source-list',this['_type']),this['_initDialog'](),this['_initListeners'](),this['_api']['initFlow']();}destroy(){this['_formView']&&(this['_formView']['destroy'](),this['_formView']=null),this['_api']&&this['_api']['doneFlow'](),this['stopListening'](),this['stopDelegating']();}_initDialog(){const {locale:_0x5389f7,model:_0x40ce06}=this['_editor'],_0x4b88a4=_0x40ce06['document']['selection']['getSelectedElement'](),_0x5ce925=_0x4b88a4&&(_0x4b88a4['is']('element','imageBlock')||_0x4b88a4['is']('element','imageInline'));this['_formView']=new $(_0x5389f7,this['_editing']['ucContextId']),this['_dialog']['show']({'id':'uploadCare','icon':_0x16c199,'title':T(_0x5389f7,this['_type'],_0x5ce925?'Replace':'Insert')['text'],'content':this['_formView'],'position':_0xfb0bc['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_api']['removeAllFiles'](),this['_editor']['editing']['view']['focus'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0x288a61=>!H(_0x288a61,this['_formView']['element'])}});}_initListeners(){this['_editing']['ctxElement']['addEventListener']('done-click',()=>{const {allEntries:_0x1b19c0}=this['_api']['getOutputCollectionState']();this['_editor']['model']['change'](_0x303ca9=>{const _0x5dbeb1=_0x1b19c0['length'];for(const _0x204cb0 of _0x1b19c0){const _0x1bdcb0=_0x204cb0===_0x1b19c0[_0x5dbeb1-0x1],{cdnUrl:_0x55ffd3,fileInfo:_0x3ae2e9}=_0x204cb0;if(!_0x55ffd3||!_0x3ae2e9)continue;const {width:_0x5e6385,height:_0x19e946}=_0x3ae2e9['imageInfo'],_0x23f4ec=j(_0x55ffd3,_0x5e6385,_0x19e946),_0x1c1b80=B(_0x55ffd3,_0x23f4ec['width']),_0x33c54a={'id':_0x3ae2e9['uuid'],'type':'image','attributes':{'imageDimension':_0x23f4ec,..._0x1c1b80}};this['_insertAsset'](_0x33c54a,_0x1bdcb0,_0x303ca9);}}),this['_dialog']['hide']();}),this['_editing']['ctxElement']['addEventListener']('change',_0x160503=>{'idle'===_0x160503['detail']['status']&&!_0x160503['detail']['allEntries']['length']&&this['_dialog']['isOpen']&&('local'===this['_type']?this['_api']['setCurrentActivity']('start-from'):this['_api']['initFlow']());});}_insertAsset(_0x5b1cf6,_0x3f7ac2,_0x3aaaaa){const _0x295fbc=this['_editor']['model']['document']['selection'],_0x4a1de5=_0x295fbc['getSelectedElement'](),_0x2f599c=!(!_0x4a1de5||!_0x4a1de5['is']('element','imageInline'));_0x3aaaaa['removeSelectionAttribute']('linkHref'),this['_insertImage'](_0x5b1cf6,_0x2f599c),_0x3f7ac2||_0x3aaaaa['setSelection'](_0x295fbc['getLastPosition']());}_insertImage(_0x14f327,_0x40e6df){const _0x4e36a3=this['_editor'],{imageDimension:_0x5a1946,imageFallbackUrl:_0x2d5b95,imageSources:_0x42234f}=_0x14f327['attributes'];_0x4e36a3['execute']('insertImage',{'imageType':_0x40e6df?'imageInline':null,'source':{'uploadcareImageId':_0x14f327['id'],'src':_0x2d5b95,'sources':_0x42234f,..._0x5a1946}});}},z=class extends _0x32b870{_editing;_controller=null;static get requires(){return[_0x57a16d,Z];}constructor(_0x75baed){super(_0x75baed),this['_editing']=_0x75baed['plugins']['get'](Z);}['refresh'](){this['isEnabled']=this['_checkEnabled']();}execute(_0x3e44c4){this['_controller']&&(this['_controller']['destroy'](),this['_controller']=null),this['_controller']=new G(this['editor'],this['_editing'],_0x3e44c4);}['_checkEnabled'](){return this['editor']['commands']['get']('insertImage')['isEnabled'];}},Q=class{static['upload']({file:_0x20f6e3,..._0x3d9fc7}){return _0x246001(_0x20f6e3,_0x3d9fc7);}static getInfo(_0x1c11e6,_0x52f76d){return _0x2a3a14(_0x1c11e6,_0x52f76d);}},J=class extends _0x332116{static get requires(){return[_0x2d04e6,_0x42903e,_0x48c14e,Z];}static get['pluginName'](){return'UploadcareUploadAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async afterInit(){const _0x255606=this['editor'];if(!_0x255606['config']['get']('uploadcare'))return;_0x255606['plugins']['get'](_0x48c14e)['createUploadAdapter']=_0x261eb6=>new X(_0x261eb6,_0x255606),_0x255606['plugins']['get'](_0x2d04e6)['on']('uploadComplete',(_0x2a3124,{imageElement:_0x44798c,data:_0x2aa0e6})=>{_0x255606['model']['change'](_0x379cc4=>{_0x379cc4['setAttribute']('uploadcareImageId',_0x2aa0e6['uploadcareImageId'],_0x44798c);});});}},X=class{['loader'];editor;controller;constructor(_0x34e3fe,_0x347dcd){this['loader']=_0x34e3fe,this['editor']=_0x347dcd,this['controller']=new AbortController();}async['upload'](){const t=this['editor']['t'],_0x556b0a=await this['loader']['file'];return Q['upload']({'file':_0x556b0a,'publicKey':this['editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['editor']['config']['get']('uploadcare.uploader.baseUrl'),'baseCDN':this['editor']['config']['get']('uploadcare.uploader.cdnCname'),'signal':this['controller']['signal'],'onProgress':_0x2a2ec5=>{_0x2a2ec5&&_0x2a2ec5['isComputable']&&(this['loader']['uploadTotal']=0x1,this['loader']['uploaded']=_0x2a2ec5['value']);}})['then'](async _0xff3963=>{const {imageFallbackUrl:_0x4bf04d,imageSources:_0x4c37da}=B(_0xff3963['cdnUrl'],_0xff3963['imageInfo']['width']);return{'uploadcareImageId':_0xff3963['uuid'],'default':_0x4bf04d,'sources':_0x4c37da};})['catch'](()=>{const _0x5230aa=t('Cannot\x20upload\x20file:')+('\x20'+_0x556b0a['name']+'.');return Promise['reject'](_0x5230aa);});}abort(){this['controller']['abort']();}},Z=class extends _0x332116{_configElement=null;_ctxElement=null;static get['pluginName'](){return'UploadcareEditing';}static get requires(){return[_0x2beec8,J,_0x57a16d];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}ucContextId;get configElement(){return this['_configElement'];}get ctxElement(){return this['_ctxElement'];}constructor(_0x1a06e2){super(_0x1a06e2),this['ucContextId']=_0x2f57e7();}init(){const _0x5e863f=this['editor'];_0x5e863f['commands']['add']('uploadcare',new z(_0x5e863f));}afterInit(){this['_initSchema'](),this['_initConversion'](),this['_initConfig'](),this['_initCtx'](),this['_initImageProcessingIndicator'](),this['listenTo'](this['editor'],'destroy',()=>{this['_configElement']&&(this['_configElement']['remove'](),this['_configElement']=null),this['_ctxElement']&&(this['_ctxElement']['remove'](),this['_ctxElement']=null);const _0x2d543b=_0x355bce['document']['querySelector']('input[uploadcare-file-input]');_0x2d543b&&_0x2d543b['remove']();}),async function(_0x39d991){const _0x5ca364='4wieLj6qmWZnpxGN9QYyFhU15kOfCBAHt2slISMXP3vErub8za07VTRoKcdDgJ',_0x3a2482=0x79428,_0x4b6621={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x5d463f(_0x6f9b8c){const _0x3d2a6a=new window['Promise'](_0x29c089=>{_0x6f9b8c['once']('ready',_0x29c089);}),_0x4a0448=window['Date']['now'](),_0x170b1d=_0x6f9b8c['config']['get']('licenseKey');async function _0x196565(){let _0x42b457,_0x3cc862=null,_0x4312f2=null;try{return'GPL'==_0x170b1d?'NotAllowed':(_0x42b457=_0x31f386(),_0x42b457?(_0x42b457['usageEndpoint']&&(_0x4312f2=_0x1e442f(_0x42b457['usageEndpoint'],_0x42b457['jti'])),await _0x17e94b()?_0x41070f()?_0x4480e1()?'Expired':_0x26f9ac()?('evaluation'==_0x42b457['licenseType']&&(_0x3cc862=_0x5d3017('EvaluationLimit')),await _0x3ae289()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x4480e1(){const _0x5d2110=['evaluation','trial']['includes'](_0x42b457['licenseType'])?_0x4a0448/0x3e8:0xe10*_0x3a2482;return _0x42b457['exp']<_0x5d2110;}function _0x41070f(){const _0x3d8f77=_0x42b457['features'];return!!_0x3d8f77&&(!!_0x3d8f77['includes']('*')||!!_0x3d8f77['includes']('UPLC'));}function _0x26f9ac(){const _0x323783=_0x42b457['licensedHosts'];if(!_0x323783||0x0==_0x323783['length'])return!0x0;const {hostname:_0x498940}=new URL(window['location']['href']);if(_0x323783['includes'](_0x498940))return!0x0;const _0x26f33f=_0x498940['split']('.');return _0x323783['filter'](_0x80a17d=>_0x80a17d['includes']('*'))['map'](_0x3ff6f8=>_0x3ff6f8['split']('.'))['filter'](_0x47e121=>_0x47e121['length']<=_0x26f33f['length'])['map'](_0x139f14=>Array(_0x26f33f['length']-_0x139f14['length'])['fill']('*'===_0x139f14[0x0]?'*':'')['concat'](_0x139f14))['some'](_0x574f47=>_0x26f33f['every']((_0x2bb500,_0x24da51)=>_0x574f47[_0x24da51]===_0x2bb500||'*'===_0x574f47[_0x24da51]));}function _0x3ae289(){return _0x3cc862&&_0x4312f2?new window['Promise']((_0x32b3e0,_0x1ea8d4)=>{_0x3cc862['then'](_0x32b3e0,_0x1ea8d4),_0x4312f2['then'](_0x411f72=>{'Valid'!=_0x411f72&&_0x32b3e0(_0x411f72);},_0x1ea8d4);}):_0x3cc862||_0x4312f2||'Valid';}}function _0x1e442f(_0x1c646a,_0x269ea){return new window['Promise'](_0x3315eb=>{if(_0x33f468())return _0x3315eb('Valid');_0x1cdfae(),_0x6f9b8c['decorate']('_sendUsageRequest');let _0xfc3f6f=!0x1;const _0x3c7acc=_0x2f57e7();function _0x5acf70(_0x347798){return!!_0x347798&&('object'==typeof _0x347798||'function'==typeof _0x347798)&&'function'==typeof _0x347798['then']&&'function'==typeof _0x347798['catch'];}function _0x890b35(_0x12c690){_0x489e30(_0x12c690)['then'](_0x45e9c1=>_0x45e9c1&&'ok'==_0x45e9c1['status']?_0x41a779(_0x376247(_0x3c7acc+_0x269ea))!=_0x45e9c1['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0xd48b8e=>(_0x55dc72(),_0xd48b8e),()=>{const _0x382dc4=_0x32ea11();return null==_0x382dc4?(_0x55dc72(),'Valid'):_0x4a0448-_0x382dc4>0x240c8400?'UsageLimit':'Valid';})['then'](_0x3315eb)['catch'](()=>{_0x3315eb('UsageLimit');});const _0xef17ab=0x36ee80;function _0x55dc72(){const _0x258dc3='llct-'+_0x41a779(_0x376247(_0x1c646a)),_0x169f2c=_0x446aee(_0x41a779(window['Math']['ceil'](_0x4a0448/_0xef17ab)));window['localStorage']['setItem'](_0x258dc3,_0x169f2c);}function _0x32ea11(){const _0x52b7b4='llct-'+_0x41a779(_0x376247(_0x1c646a)),_0x32a929=window['localStorage']['getItem'](_0x52b7b4);return _0x32a929?window['parseInt'](_0x446aee(_0x32a929),0x10)*_0xef17ab:null;}function _0x489e30(_0x50cf9c){return new window['Promise']((_0xf7e59f,_0x44cf84)=>{_0x50cf9c['then'](_0xf7e59f,_0x44cf84),window['setTimeout'](_0x44cf84,0x1d4c0);});}}_0x6f9b8c['on']('_sendUsageRequest',(_0x2c58fc,_0x5d5984)=>{if(_0x5d5984[0x0]!=_0x1c646a)return _0x3315eb('UsageLimit');_0x5d5984[0x1]={..._0x5d5984[0x1],'requestId':_0x3c7acc};},{'priority':'high'}),_0x6f9b8c['on']('_sendUsageRequest',_0x1b9019=>{_0x5acf70(_0x1b9019['return'])&&(_0xfc3f6f=!0x0,_0x890b35(_0x1b9019['return']));},{'priority':'low'}),_0x3d2a6a['then'](()=>{_0xfc3f6f||_0x3315eb('UsageLimit');});});function _0x33f468(){return'auto'==_0x6f9b8c['editing']['view']['_overlayModeHint'];}function _0x1cdfae(){_0x6f9b8c['editing']['view']['_overlayModeHint']='auto';}}function _0x5d3017(_0x2a5aae){const _0x25e660=[new window['Promise'](_0xa33807=>setTimeout(_0xa33807,0x93ecc)),_0x3d2a6a['then'](()=>new window['Promise'](_0x38f295=>{let _0xfe3f84=0x0;_0x6f9b8c['model']['on']('applyOperation',(_0x5138c9,_0x2d15b1)=>{_0x2d15b1[0x0]['isDocumentOperation']&&_0xfe3f84++,0x5e8==_0xfe3f84&&(_0x38f295(),_0x5138c9['off']());});}))];return window['Promise']['race'](_0x25e660)['then'](()=>_0x2a5aae);}async function _0x90579a(){await _0x3d2a6a,_0x6f9b8c['model']['change']=_0x9f3bc1,_0x6f9b8c['model']['enqueueChange']=_0x9f3bc1,_0x6f9b8c['enableReadOnlyMode']('model');}function _0x23f81e(_0x37fc5f){const _0x3b9c74=_0x201c24();_0x6f9b8c[_0x3b9c74]='uploadcareLicenseKey'+_0x37fc5f,'Valid'!=_0x37fc5f&&_0x90579a();}function _0x201c24(){const _0x1b470f=window['String'](window['performance']['now']())['replace']('.','');let _0x2cfb3b='w';for(let _0x58c32e=0x0;_0x58c32e<_0x1b470f['length'];_0x58c32e+=0x2){let _0x56debe=window['parseInt'](_0x1b470f['substring'](_0x58c32e,_0x58c32e+0x2));_0x56debe>=0x3e&&(_0x56debe-=0x3e),_0x2cfb3b+=_0x5ca364[_0x56debe];}return _0x2cfb3b;}function _0x31f386(){const _0x232ee1=_0x170b1d['split']('.');if(0x3!=_0x232ee1['length'])return null;return _0x25de67(_0x232ee1[0x1]);function _0x25de67(_0x38c6f0){const _0x4d3372=_0x461346(_0x38c6f0);return _0x4d3372&&_0x10798b()?_0x4d3372:null;function _0x10798b(){const _0x1debbb=_0x4d3372['jti'],_0x8804b4=window['parseInt'](_0x1debbb['substring'](_0x1debbb['length']-0x8),0x10),_0x5ee728={..._0x4d3372,'jti':_0x1debbb['substring'](0x0,_0x1debbb['length']-0x8)};return delete _0x5ee728['vc'],_0x376247(_0x5ee728)==_0x8804b4;}}}async function _0x17e94b(){let _0x214586=!0x0;try{const [_0x274ade,_0x5748e5,_0x515059]=_0x170b1d['split']('.');return _0xfcfdb3(_0x274ade),await _0x3cac51(_0x274ade,_0x5748e5,_0x515059),_0x214586;}catch{return!0x1;}function _0xfcfdb3(_0x330697){const _0x591bbe=_0x461346(_0x330697);_0x591bbe&&'ES256'==_0x591bbe['alg']||(_0x214586=!0x1);}async function _0x3cac51(_0x722fda,_0x30ecfe,_0x331179){const _0x2eb167=window['Uint8Array']['from'](_0x27ff76(_0x331179),_0x316fa9=>_0x316fa9['charCodeAt'](0x0)),_0x51fda5=new window['TextEncoder']()['encode'](_0x722fda+'.'+_0x30ecfe),_0x974005=window['crypto']['subtle'];if(!_0x974005)return;const _0x582f6e=await _0x974005['importKey']('jwk',_0x4b6621,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x974005['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x582f6e,_0x2eb167,_0x51fda5)||(_0x214586=!0x1);}}function _0x461346(_0x411ee9){return _0x411ee9['startsWith']('ey')?JSON['parse'](_0x27ff76(_0x411ee9)):null;}function _0x27ff76(_0x129f5e){return window['atob'](_0x129f5e['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x376247(_0x2f5861){let _0x313351=0x1505;function _0x4be6d4(_0x3d7ad3){for(let _0x298c61=0x0;_0x298c61<_0x3d7ad3['length'];_0x298c61++){const _0x444db1=_0x3d7ad3['charCodeAt'](_0x298c61);_0x313351=(_0x313351<<0x5)+_0x313351+_0x444db1,_0x313351&=_0x313351;}}function _0x12aa54(_0x32bd56){Array['isArray'](_0x32bd56)?_0x32bd56['forEach'](_0x12aa54):_0x32bd56&&'object'==typeof _0x32bd56?Object['entries'](_0x32bd56)['sort']()['forEach'](([_0x180143,_0x12e6dd])=>{_0x4be6d4(_0x180143),_0x12aa54(_0x12e6dd);}):_0x4be6d4(window['String'](_0x32bd56));}return _0x12aa54(_0x2f5861),_0x313351>>>0x0;}function _0x41a779(_0x5e21f5){return _0x5e21f5['toString'](0x10)['padStart'](0x8,'0');}function _0x446aee(_0x46020c){return _0x46020c['split']('')['reverse']()['join']('');}function _0x9f3bc1(){}_0x23f81e(await _0x196565());}_0x5d463f(_0x39d991['editor']);}(this);}_initSchema(){const _0x4c5b16=this['editor']['model']['schema'];_0x4c5b16['isRegistered']('imageBlock')&&_0x4c5b16['extend']('imageBlock',{'allowAttributes':['uploadcareImageId']}),_0x4c5b16['isRegistered']('imageInline')&&_0x4c5b16['extend']('imageInline',{'allowAttributes':['uploadcareImageId']});}_initConversion(){const _0x1ba780=this['editor'];_0x1ba780['conversion']['for']('downcast')['attributeToAttribute']({'model':'uploadcareImageId','view':'data-uc-image-id'}),_0x1ba780['conversion']['for']('upcast')['elementToAttribute']({'model':{'key':'uploadcareImageId','value':_0x2579a5=>_0x2579a5['getAttribute']('data-uc-image-id')},'view':{'attributes':{'data-uc-image-id':/[a-zA-Z0-9\\-]+/}}});const _0x1e9582=_0x1ba780['commands']['get']('replaceImageSource');_0x1e9582&&this['listenTo'](_0x1e9582,'cleanupImage',(_0x1327cc,[_0x1b0c91,_0x427d46])=>{_0x1b0c91['removeAttribute']('uploadcareImageId',_0x427d46);});}_initConfig(){const _0x20befd=this['editor']['config']['get']('uploadcare.uploader')||{},_0x24a8a5=this['editor']['config']['get']('uploadcare.pubkey')||'';this['_configElement']=_0x34725c(_0x355bce['document'],'uc-config',{..._0x20befd,'pubkey':_0x24a8a5,'ctx-name':'uploader-'+this['ucContextId'],'sourceList':'','imgOnly':'true','removeCopyright':'true','localeName':this['editor']['locale']['contentLanguage'],'externalSourcesEmbedCss':'\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup\x20{\x20padding:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup-menu\x20{\x20gap:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__popup-footer\x20{\x20padding-top:\x200;\x20}\x0a\x09\x09\x09\x09.uc-dropdown-menu__separator\x20{\x20margin:\x200;\x20}\x0a\x09\x09\x09'}),this['_configElement']['iconHrefResolver']=_0x310ad5=>{if('closeMax'==_0x310ad5)return'#uc-icon-arrow-down';},_0x355bce['document']['body']['appendChild'](this['_configElement']);}_initCtx(){this['_ctxElement']=_0x34725c(_0x355bce['document'],'uc-upload-ctx-provider',{'ctx-name':'uploader-'+this['ucContextId']}),_0x355bce['document']['body']['appendChild'](this['_ctxElement']);}_initImageProcessingIndicator(){const _0x4f3c83=this['editor']['commands']['get']('insertImage');_0x4f3c83&&this['listenTo'](_0x4f3c83,'execute',()=>{const _0x14d1c3=this['editor']['model']['document']['selection']['getSelectedElement']();_0x14d1c3&&_0x14d1c3['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0x14d1c3);});});const _0x4b8d6b=this['editor']['commands']['get']('uploadcareImageReplace');_0x4b8d6b&&this['listenTo'](_0x4b8d6b,'execute',()=>{const _0xab9e01=this['editor']['model']['document']['selection']['getSelectedElement']();_0xab9e01&&_0xab9e01['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0xab9e01);});});}},Y=class extends _0x332116{static get requires(){return[Z,V];}static get['pluginName'](){return'Uploadcare';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x29e0b3){super(_0x29e0b3),_0x29e0b3['config']['define']('uploadcare.uploader.sourceList',['local','url']),_0x3394b2['defineComponents'](_0x3394b2),this['_defineLocale']();}['_defineLocale'](){const _0x2a45ab=this['editor']['config']['get']('uploadcare.locale'),_0x262ca9=this['editor']['locale']['contentLanguage'];_0x2a45ab&&_0x3394b2['defineLocale'](_0x262ca9,_0x2a45ab);}},tt=class extends _0x2e46a2{constructor(_0x3e63b5){super(_0x3e63b5);const t=_0x3e63b5['t'],_0x327273=this['bindTemplate'],_0x14fc0f=new _0x127fcf();_0x14fc0f['isVisible']=!0x0,this['setTemplate']({'tag':'div','attributes':{'class':['ck-uploadcare-form__loading'],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck-uploadcare-form__loading-spinner']},'children':[_0x14fc0f,{'text':_0x327273['to']('imageUploadProgress',_0x21c274=>t('Loading\x20image...')+'\x20('+(_0x21c274||0x0)+'%)')}]},{'tag':'div','attributes':{'class':['ck-uploadcare-form__skeleton']},'children':[{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'}]},{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'}]}]}]});}},et=class extends _0x2e46a2{constructor(_0x5761d0){super(_0x5761d0);const t=_0x5761d0['t'];this['set']('errorType',null);const _0x3c33b0=new _0x4e4190(_0x5761d0);_0x3c33b0['label']=t({'id':'Try\x20again\x20(Uploadcare)','string':'Try\x20again'}),_0x3c33b0['withText']=!0x0,_0x3c33b0['class']='ck-button-action',_0x3c33b0['on']('execute',()=>{this['fire']('retry');}),_0x3c33b0['bind']('isVisible')['to'](this,'errorType',_0x4d3eba=>'NotFound'!==_0x4d3eba);const _0x5ee53e=new _0x4ec8e0();_0x5ee53e['content']=_0x5ca71f,_0x5ee53e['extendTemplate']({'attributes':{'style':{'width':'50px','height':'50px'}}});const _0x4d7b5e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-uploadcare-form__error'],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck-uploadcare-form__error-contents']},'children':[_0x5ee53e,{'tag':'h3','attributes':{'style':{'fontWeight':'bold'}},'children':[{'text':t('Unable\x20to\x20load')}]},{'text':_0x4d7b5e['to']('errorType',_0x172fe3=>t('NotFound'!==_0x172fe3?'We\x20were\x20unable\x20to\x20load\x20the\x20image\x20due\x20to\x20network\x20connection\x20issues.':'The\x20image\x20was\x20not\x20found.\x20Its\x20source\x20may\x20have\x20been\x20removed.'))},_0x3c33b0]},{'tag':'div','attributes':{'class':['ck-uploadcare-form__skeleton']},'children':[{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'}]},{'tag':'div','children':[{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'},{'tag':'span'}]}]}]});}},it=class extends _0x2e46a2{constructor(_0x494399,_0x401f79){super(_0x494399);const _0x417dd0=this['bindTemplate'];this['set']('imageSrc',''),this['setTemplate']({'tag':'uc-cloud-image-editor','attributes':{..._0x401f79,'class':['uc-light','ck-uploadcare-theme'],'ctx-name':'image-edit','cdn-url':_0x417dd0['to']('imageSrc')}});}},st=class extends F{_items;['_loadingView'];['_errorView'];_editingView;['_focusableView'];constructor(_0x526b10,_0x1f12a0,_0x3f8b30){super(_0x526b10),this['_items']=this['createCollection'](),this['_loadingView']=new tt(_0x526b10),this['_errorView']=new et(_0x526b10),this['_editingView']=new it(_0x526b10,_0x3f8b30),this['_focusableView']=new _0x2e46a2(_0x526b10),this['_focusableView']['setTemplate'](this['getFocusableElement']()),this['set']('status',_0x1f12a0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-uploadcare-form'],'tabindex':'-1'},'children':this['_items']}),this['_setView'](),this['once']('render',()=>{this['_waitForImageEditorComponent'](this['element'],_0x1f4a2a=>{this['_addUploadcareImageEditorListeners'](_0x1f4a2a);});}),this['on']('change:status',()=>{this['_setView']();}),this['_addErrorViewListeners']();}['focus'](){this['element']['focus']();}_setView(){switch(this['_items']['clear'](),this['status']){case'uploading':this['_items']['add'](this['_loadingView']);break;case'error':this['_items']['add'](this['_errorView']);break;case'ready':this['_items']['addMany']([this['_editingView'],this['_focusableView']]);}}_waitForImageEditorComponent(_0x3e9ff5,_0xa06c76){const _0x13c4a3='uc-cloud-image-editor',_0x1289db=_0x3e9ff5['querySelector'](_0x13c4a3);if(_0x1289db)return _0xa06c76(_0x1289db);const _0x19cbef=new MutationObserver(_0x53a0ef=>{const _0x5845a0=_0x53a0ef['filter'](_0x534979=>_0x534979['target']===_0x3e9ff5&&_0x534979['addedNodes']['length']>0x0&&_0x534979['addedNodes'][0x0]['nodeName']['toLowerCase']()===_0x13c4a3);_0x5845a0['length']&&(_0x19cbef['disconnect'](),_0xa06c76(_0x5845a0[0x0]['addedNodes'][0x0]));});_0x19cbef['observe'](_0x3e9ff5,{'childList':!0x0,'subtree':!0x0});}_addUploadcareImageEditorListeners(_0x578fe9){_0x578fe9['addEventListener']('apply',_0x239f46=>{this['fire']('apply',{'imageSrc':_0x239f46['detail']['cdnUrl']});}),_0x578fe9['addEventListener']('cancel',()=>{this['fire']('cancel');});}_addErrorViewListeners(){this['_errorView']['on']('retry',()=>{this['fire']('retry');});}};const nt=/* #__PURE__ -- @preserve */
25
+ _0x14e46e();var rt=class extends nt{_editor;['_dialog'];_imageElement;['_imageCache'];_controller;_attributes;constructor(_0x19fe13,_0x4f8bab,_0x58d664){super(),this['_editor']=_0x19fe13,this['_dialog']=_0x4f8bab,this['_imageElement']=_0x58d664,this['_imageCache']=this['_editor']['plugins']['get']('UploadcareImageEditUI')['imageCache'],this['_attributes']=this['_editor']['config']['get']('uploadcare.editor')||{},this['set']({'isActive':!0x0,'imageStatus':'ready','imageErrorType':null,'imageId':null,'imageSrc':null,'imageDimension':null,'imageUploadProgress':null}),this['_prepareImage'](),this['_showDialog']();}destroy(){this['isActive']=!0x1,this['stopListening'](),this['stopDelegating'](),'uploading'===this['imageStatus']&&this['_controller']&&this['_controller']['abort']();}async['_prepareImage'](){const _0x1f8154=this['_imageElement'],_0x21abf9=_0x1f8154['getAttribute']('uploadcareImageId'),_0x4611d0=_0x1f8154['getAttribute']('src');if(_0x21abf9)await this['_loadImageInfo'](_0x21abf9,_0x4611d0);else{if(this['_imageCache']['has'](_0x4611d0)){const _0x4b8519=this['_imageCache']['get'](_0x4611d0);this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x4b8519['url'],this['imageDimension']=_0x4b8519['dimension'],this['imageId']=_0x4b8519['id'];}else this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),await this['_uploadImage'](this['_imageElement'],this['_controller']);}}['_showDialog'](){const {locale:_0x2101a8}=this['_editor'],t=_0x2101a8['t'],_0x4711f4=new st(_0x2101a8,this['imageStatus'],this['_attributes']);_0x4711f4['bind']('status')['to'](this,'imageStatus'),_0x4711f4['_loadingView']['bind']('imageUploadProgress')['to'](this,'imageUploadProgress'),_0x4711f4['_editingView']['bind']('imageSrc')['to'](this,'imageSrc'),_0x4711f4['_errorView']['bind']('errorType')['to'](this,'imageErrorType'),this['_addEditViewListeners'](_0x4711f4,this['_imageElement']),this['_dialog']['show']({'id':'uploadcareImageEdit','icon':_0x1cc061,'title':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'}),'content':_0x4711f4,'position':_0xfb0bc['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{_0x4711f4['focus']();},'onHide':()=>{_0x4711f4['destroy'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0x854e24=>!H(_0x854e24,_0x4711f4['element'])}});}['_loadImageInfo'](_0x5908d8,_0x43b550){return Q['getInfo'](_0x5908d8,{'publicKey':this['_editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['_editor']['config']['get']('uploadcare.uploader.baseUrl')})['then'](_0x1eb621=>{const {width:_0x4e991a,height:_0xd6e5ed}=_0x1eb621['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x43b550,this['imageDimension']={'width':_0x4e991a,'height':_0xd6e5ed},this['imageId']=_0x5908d8;})['catch'](_0x3b5fcb=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x3b5fcb['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}['_uploadImage'](_0x263d14,_0xd12071){return this['_getImageAsFile'](_0x263d14)['then'](_0x52a03d=>Q['upload']({'publicKey':this['_editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['_editor']['config']['get']('uploadcare.uploader.baseUrl'),'baseCDN':this['_editor']['config']['get']('uploadcare.uploader.cdnCname'),'signal':_0xd12071['signal'],'file':_0x52a03d,'onProgress':_0x4aa73e=>{_0x4aa73e&&_0x4aa73e['isComputable']&&(this['imageUploadProgress']=Math['ceil'](0x64*_0x4aa73e['value']));}}))['then'](_0x301b56=>{const {width:_0x274a53,height:_0x29291d}=_0x301b56['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x301b56['cdnUrl'],this['imageDimension']={'width':_0x274a53,'height':_0x29291d},this['imageId']=_0x301b56['uuid'],this['imageUploadProgress']=null;const _0x482efb=_0x263d14['getAttribute']('src');this['_imageCache']['set'](_0x482efb,{'id':_0x301b56['uuid'],'url':_0x301b56['cdnUrl'],'dimension':this['imageDimension']});})['catch'](_0x25788b=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x25788b['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}_addEditViewListeners(_0x59daed,_0x2e1731){_0x59daed['on']('apply',(_0x240eef,_0x216d58)=>{this['_replaceImage'](_0x2e1731,_0x216d58['imageSrc'],this['imageId']),this['_dialog']['hide']();}),_0x59daed['on']('retry',()=>{this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),this['_uploadImage'](this['_imageElement'],this['_controller']);}),_0x59daed['on']('cancel',()=>{this['_dialog']['hide']();});}['_replaceImage'](_0x31a9d6,_0x37ae14,_0x5337f0){const _0x1ef88d=this['_editor'],{width:_0x52afd4,height:_0x328ef6}=j(_0x37ae14,this['imageDimension']['width'],this['imageDimension']['height']),{imageFallbackUrl:_0xf1d990,imageSources:_0xa9257b}=B(_0x37ae14,_0x52afd4);_0x1ef88d['model']['change'](_0x5d4c91=>{if('$graveyard'!==_0x31a9d6['root']['rootName'])_0x5d4c91['setSelection'](_0x31a9d6,'on'),_0x1ef88d['execute']('uploadcareImageReplace',{...Object['fromEntries'](_0x31a9d6['getAttributes']()),'uploadcareImageId':_0x5337f0,'src':_0xf1d990,'sources':_0xa9257b,'width':_0x52afd4,'height':_0x328ef6},_0x31a9d6);else{_0x1ef88d['execute']('insertImage',{'imageType':_0x31a9d6['is']('element','imageInline')?'imageInline':null,'source':{...Object['fromEntries'](_0x31a9d6['getAttributes']()),'uploadcareImageId':_0x5337f0,'src':_0xf1d990,'sources':_0xa9257b,'width':_0x52afd4,'height':_0x328ef6}});const _0x4fe21f=_0x31a9d6['getChildren']();_0x31a9d6=_0x1ef88d['model']['document']['selection']['getSelectedElement']();for(const _0x5d9ed9 of _0x4fe21f)_0x5d4c91['append'](_0x5d4c91['cloneElement'](_0x5d9ed9),_0x31a9d6);}_0x5d4c91['setSelection'](_0x31a9d6,'on');});}async _getImageAsFile(_0x5c10c6){const _0x472f71=_0x355bce['window'],_0x9f64c4=_0x355bce['document']['location']['href'],_0x4ed95f=new _0x472f71['URL'](_0x5c10c6['getAttribute']('src'),_0x9f64c4);if('data:'===_0x4ed95f['protocol']){const _0x23c39f=_0x4ed95f['href']['split'](','),_0x3c0d0e=_0x23c39f[0x0]['match'](/:(.*?);/)[0x1],_0x2ba1a9=_0x3c0d0e['split']('/')[0x1],_0xeffd45=_0x472f71['atob'](_0x23c39f[_0x23c39f['length']-0x1]);let _0x3307c2=_0xeffd45['length'];const _0x1ea8f7=new _0x472f71['Uint8Array'](_0x3307c2);for(;_0x3307c2--;)_0x1ea8f7[_0x3307c2]=_0xeffd45['charCodeAt'](_0x3307c2);return new _0x472f71['File']([_0x1ea8f7],'image.'+_0x2ba1a9,{'type':_0x3c0d0e});}const _0x51bbc5=_0x4ed95f['href']['split']('/'),_0x587d5f=_0x51bbc5[_0x51bbc5['length']-0x1],_0x3c23c0=_0x587d5f['split']('.')[0x1];return _0x472f71['fetch'](_0x4ed95f['href'])['then'](_0x2557e7=>_0x2557e7['clone']()['blob']())['then'](_0x4c42e8=>new _0x472f71['File']([_0x4c42e8],_0x587d5f,{'type':'image/'+_0x3c23c0}));}},at=class extends _0x32b870{imageEditController;static get requires(){return[_0x57a16d];}_isEditable;constructor(_0xcd27fd){super(_0xcd27fd),this['imageEditController']=void 0x0,this['_isEditable']=function(_0x8d26a0){const _0x2952d8=M(_0x8d26a0);return _0x33e830=>!(!_0x33e830||!_0x33e830['is']('element','imageBlock')&&!_0x33e830['is']('element','imageInline'))&&(!!_0x33e830['hasAttribute']('uploadcareImageId')||!!_0x33e830['hasAttribute']('src')&&_0x2952d8(_0x33e830['getAttribute']('src')));}(_0xcd27fd['config']['get']('uploadcare.allowExternalImagesEditing')||[]),this['set']({'isActive':!0x1});}['refresh'](){const _0x225d31=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=this['_isEditable'](_0x225d31);}execute(){this['imageEditController']&&(this['unbind']('isActive'),this['imageEditController']=void 0x0);const _0x471a2a=this['editor']['model']['document']['selection']['getSelectedElement']();_0x471a2a&&(_0x471a2a['is']('element','imageBlock')||_0x471a2a['is']('element','imageInline'))&&(this['imageEditController']=new rt(this['editor'],this['editor']['plugins']['get'](_0x57a16d),_0x471a2a),this['bind']('isActive')['to'](this['imageEditController'],'isActive'));}},ot=class extends _0x32b870{['refresh'](){const _0x430d38=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=Boolean(_0x430d38&&(_0x430d38['is']('element','imageBlock')||_0x430d38['is']('element','imageInline')));}execute(_0x5df510){const _0xcc4932=this['editor']['model']['document']['selection']['getSelectedElement']();this['editor']['model']['change'](_0x2bcc77=>{_0x2bcc77['setAttributes'](_0x5df510,_0xcc4932),_0x2bcc77['removeAttribute']('srcset',_0xcc4932),_0x2bcc77['removeAttribute']('sizes',_0xcc4932);});}},ct=class extends _0x332116{static get['pluginName'](){return'UploadcareImageEditEditing';}static get requires(){return[Z,_0x4ba2bb,_0xca79ac,_0x246923];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x19979c}=this;_0x19979c['commands']['add']('uploadcareImageEdit',new at(_0x19979c)),_0x19979c['commands']['add']('uploadcareImageReplace',new ot(_0x19979c));}},lt=class extends _0x332116{['_imageCache']=new Map();static get['pluginName'](){return'UploadcareImageEditUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}get['imageCache'](){return this['_imageCache'];}init(){const _0x2607db=this['editor'];_0x2607db['ui']['componentFactory']['add']('uploadcareImageEdit',_0x4033de=>{const _0x40244b=_0x2607db['commands']['get']('uploadcareImageEdit'),_0x4e3a4a=new _0x4e4190(_0x4033de),t=_0x4033de['t'];return _0x4e3a4a['set']({'icon':_0x1cc061,'tooltip':!0x0,'label':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'})}),_0x4e3a4a['bind']('isEnabled')['to'](_0x40244b),_0x4e3a4a['bind']('isOn')['to'](_0x40244b,'isActive'),this['listenTo'](_0x4e3a4a,'execute',()=>{_0x2607db['execute']('uploadcareImageEdit'),_0x2607db['editing']['view']['focus']();}),_0x4e3a4a;}),this['_initConfig']();}_initConfig(){const _0x3fcb28=_0x34725c(document,'uc-config',{'ctx-name':'image-edit','removeCopyright':'true','localeName':this['editor']['locale']['contentLanguage']});document['body']['appendChild'](_0x3fcb28),this['listenTo'](this['editor'],'destroy',()=>{_0x3fcb28['remove']();});}},ut=class extends _0x332116{static get['pluginName'](){return'UploadcareImageEdit';}static get requires(){return[ct,lt];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{Y as Uploadcare,z as UploadcareCommand,Z as UploadcareEditing,ut as UploadcareImageEdit,at as UploadcareImageEditCommand,ct as UploadcareImageEditEditing,lt as UploadcareImageEditUI,V as UploadcareUI,J as UploadcareUploadAdapter};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-uploadcare",
3
- "version": "48.5.0-alpha.2",
3
+ "version": "48.5.0-alpha.4",
4
4
  "description": "Uploadcare feature for CKEditor 5.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -38,13 +38,13 @@
38
38
  "dist/translations/*.umd.js"
39
39
  ],
40
40
  "dependencies": {
41
- "@ckeditor/ckeditor5-core": "48.5.0-alpha.2",
42
- "@ckeditor/ckeditor5-engine": "48.5.0-alpha.2",
43
- "@ckeditor/ckeditor5-icons": "48.5.0-alpha.2",
44
- "@ckeditor/ckeditor5-image": "48.5.0-alpha.2",
45
- "@ckeditor/ckeditor5-ui": "48.5.0-alpha.2",
46
- "@ckeditor/ckeditor5-upload": "48.5.0-alpha.2",
47
- "@ckeditor/ckeditor5-utils": "48.5.0-alpha.2",
41
+ "@ckeditor/ckeditor5-core": "48.5.0-alpha.4",
42
+ "@ckeditor/ckeditor5-engine": "48.5.0-alpha.4",
43
+ "@ckeditor/ckeditor5-icons": "48.5.0-alpha.4",
44
+ "@ckeditor/ckeditor5-image": "48.5.0-alpha.4",
45
+ "@ckeditor/ckeditor5-ui": "48.5.0-alpha.4",
46
+ "@ckeditor/ckeditor5-upload": "48.5.0-alpha.4",
47
+ "@ckeditor/ckeditor5-utils": "48.5.0-alpha.4",
48
48
  "@uploadcare/file-uploader": "1.29.0",
49
49
  "@uploadcare/upload-client": "6.14.3"
50
50
  },