@ckeditor/ckeditor5-uploadcare 48.5.0-alpha.3 → 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.
- package/dist/index.js +3 -3
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as _0x2d908d,Plugin as _0x1594fc}from'@ckeditor/ckeditor5-core';import{IconDropbox as _0xd39baa,IconError as _0xb8adc0,IconFacebook as _0x20e493,IconGoogleDrive as _0x416b49,IconGooglePhotos as _0x422914,IconOneDrive as _0x4755ad,IconUploadcareImageEdit as _0x32e80d,IconUploadcareImageUpload as _0x3b153f,IconUploadcareLink as _0x39d534}from'@ckeditor/ckeditor5-icons';import{ButtonView as _0x26e63d,Dialog as _0x531a28,DialogViewPosition as _0x5742fb,FocusCycler as _0x105754,IconView as _0x3e6674,MenuBarMenuListItemButtonView as _0x40efc3,Notification as _0xe18045,SpinnerView as _0x1d9f35,View as _0x2aa73e}from'@ckeditor/ckeditor5-ui';import{DomEmitterMixin as _0x4de12d,FocusTracker as _0x289570,ObservableMixin as _0x3f9395,createElement as _0x5826df,getAncestors as _0x51f3a4,global as _0x453ce0,uid as _0x567d01}from'@ckeditor/ckeditor5-utils';import{ImageEditing as _0x24949a,ImageUploadEditing as _0x51b74d,ImageUploadProgress as _0x67328a,ImageUtils as _0x5b6677,PictureEditing as _0xa8ed96}from'@ckeditor/ckeditor5-image';import{FileRepository as _0x3aa330}from'@ckeditor/ckeditor5-upload';import{info as _0x56a459,uploadFile as _0x311fc6}from'@uploadcare/upload-client';import*as _0x2c4d4c from'@uploadcare/file-uploader/web/file-uploader.min.js';function T(_0x58e7d6,_0x2c7365,_0xf4fdcd){const t=_0x58e7d6['t'],_0x1a7217=_0x58e7d6['t'];switch(_0x2c7365){case'local':return{'text':_0x1a7217('Insert'===_0xf4fdcd?'Upload\x20from\x20computer':'Replace\x20from\x20computer'),'shortText':_0x1a7217('From\x20computer')};case'url':return{'text':'Insert'===_0xf4fdcd?_0x1a7217('Insert\x20via\x20URL'):t('Replace\x20via\x20URL'),'shortText':_0x1a7217('Via\x20URL')};case'dropbox':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20Dropbox':'Replace\x20with\x20Dropbox'),'shortText':t('With\x20Dropbox')};case'facebook':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20Facebook':'Replace\x20with\x20Facebook'),'shortText':t('With\x20Facebook')};case'gdrive':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20Google\x20Drive':'Replace\x20with\x20Google\x20Drive'),'shortText':t('With\x20Google\x20Drive')};case'gphotos':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20Google\x20Photos':'Replace\x20with\x20Google\x20Photos'),'shortText':t('With\x20Google\x20Photos')};case'onedrive':return{'text':t('Insert'===_0xf4fdcd?'Insert\x20with\x20OneDrive':'Replace\x20with\x20OneDrive'),'shortText':t('With\x20OneDrive')};default:return _0x2c7365;}}var V=class extends _0x1594fc{['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 _0x288c45=[this['editor']];for(const _0x3611b1 of _0x288c45){let _0xe875f0;for(const _0x33a00f in _0x3611b1){const _0x25b93a=_0x33a00f,_0x5f02be=_0x3611b1[_0x25b93a];if('uploadcareLicenseKeyValid'==_0x5f02be||'uploadcareLicenseKeyInvalid'==_0x5f02be||'uploadcareLicenseKeyExpired'==_0x5f02be||'uploadcareLicenseKeyDomainLimit'==_0x5f02be||'uploadcareLicenseKeyNotAllowed'==_0x5f02be||'uploadcareLicenseKeyEvaluationLimit'==_0x5f02be||'uploadcareLicenseKeyUsageLimit'==_0x5f02be){delete _0x3611b1[_0x25b93a],_0xe875f0=_0x5f02be,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'uploadcareLicenseKeyInvalid'==_0xe875f0&&_0x3611b1['_showLicenseError']('invalid'),'uploadcareLicenseKeyExpired'==_0xe875f0&&_0x3611b1['_showLicenseError']('expired'),'uploadcareLicenseKeyDomainLimit'==_0xe875f0&&_0x3611b1['_showLicenseError']('domainLimit'),'uploadcareLicenseKeyNotAllowed'==_0xe875f0&&_0x3611b1['_showLicenseError']('featureNotAllowed','Uploadcare'),'uploadcareLicenseKeyEvaluationLimit'==_0xe875f0&&_0x3611b1['_showLicenseError']('evaluationLimit'),'uploadcareLicenseKeyUsageLimit'==_0xe875f0&&_0x3611b1['_showLicenseError']('usageLimit');}},0x3e8);}afterInit(){const {editor:_0x27c109}=this,_0x5bf107=_0x27c109['commands']['get']('uploadcare');if(!_0x5bf107)return;const _0x5ea2f1=this['_normalizeConfigSourceList'](_0x27c109['config']['get']('uploadcare.uploader.sourceList'))['reduce']((_0x39cbd1,_0x383af8)=>{const _0x34d0d2=this['_getIntegrationKey'](_0x383af8['type']);return _0x39cbd1[_0x34d0d2]||(_0x39cbd1[_0x34d0d2]=[]),_0x39cbd1[_0x34d0d2]['push'](_0x383af8),_0x39cbd1;},{});_0x27c109['plugins']['has']('ImageInsertUI')&&_0x27c109['commands']['get']('uploadcare')&&Object['entries'](_0x5ea2f1)['forEach'](([_0x2193c9,_0x4a0344])=>{_0x27c109['plugins']['get']('ImageInsertUI')['registerIntegration']({'name':_0x2193c9,'observable':()=>_0x5bf107,'buttonViewCreator':()=>this['_createToolbarButton'](_0x4a0344),'formViewCreator':()=>this['_createDropdownButtons'](_0x4a0344),'menuBarButtonViewCreator':()=>this['_createMenuBarButtons'](_0x4a0344),'override':'assetManager'!==_0x2193c9});});}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}_normalizeConfigSourceList(_0x42b789){const {locale:_0x28e707}=this['editor'];return _0x42b789['map'](_0x546fa7=>{const _0x2c5fe8=T(_0x28e707,_0x546fa7,'Insert');switch(_0x546fa7){case'local':return{'icon':_0x3b153f,'type':'local',..._0x2c5fe8};case'url':return{'icon':_0x39d534,'type':'url',..._0x2c5fe8};case'dropbox':return{'icon':_0xd39baa,'type':'dropbox',..._0x2c5fe8};case'facebook':return{'icon':_0x20e493,'type':'facebook',..._0x2c5fe8};case'gdrive':return{'icon':_0x416b49,'type':'gdrive',..._0x2c5fe8};case'gphotos':return{'icon':_0x422914,'type':'gphotos',..._0x2c5fe8};case'onedrive':return{'icon':_0x4755ad,'type':'onedrive',..._0x2c5fe8};}});}_getIntegrationKey(_0x49a73a){switch(_0x49a73a){case'local':return'upload';case'url':return'url';default:return'assetManager';}}_createButton(_0x406a37,_0x1bcc48){const _0x71d368=this['editor'],_0x35a3b8=new _0x406a37(_0x71d368['locale']),_0x68476d=_0x71d368['commands']['get']('uploadcare');return _0x35a3b8['bind']('isEnabled')['to'](_0x68476d),_0x35a3b8['on']('execute',()=>{_0x68476d['execute'](_0x1bcc48);}),_0x35a3b8;}_createToolbarButton(_0x3583b2){const {locale:_0x4a657b}=this['editor'],_0x438e3f=this['editor']['plugins']['get']('ImageInsertUI'),_0x3b79f3=_0x3583b2[0x0],_0x1636bf=this['_createButton'](_0x26e63d,_0x3b79f3['type']);return _0x1636bf['icon']=_0x3b79f3['icon'],_0x1636bf['bind']('label')['to'](_0x438e3f,'isImageSelected',_0x34e5f8=>T(_0x4a657b,_0x3b79f3['type'],_0x34e5f8?'Replace':'Insert')['text']),_0x1636bf['tooltip']=!0x0,_0x1636bf;}_createDropdownButtons(_0x496483){const {locale:_0x589d91}=this['editor'],_0x4fa7be=this['editor']['plugins']['get']('ImageInsertUI');return _0x496483['map'](_0x531dd3=>{const _0x2d36b7=this['_createButton'](_0x26e63d,_0x531dd3['type']);return _0x2d36b7['withText']=!0x0,_0x2d36b7['icon']=_0x531dd3['icon'],_0x2d36b7['bind']('label')['to'](_0x4fa7be,'isImageSelected',_0x12a049=>T(_0x589d91,_0x531dd3['type'],_0x12a049?'Replace':'Insert')['text']),_0x2d36b7;});}_createMenuBarButtons(_0x4ccdc3){return _0x4ccdc3['map'](_0x4c743a=>{const _0x267088=this['_createButton'](_0x40efc3,_0x4c743a['type']);return _0x267088['icon']=_0x4c743a['icon'],_0x267088['label']=_0x4c743a['shortText'],_0x267088;});}},F=class extends _0x2aa73e{['focusTracker'];['focusCycler'];constructor(_0x54d45a){super(_0x54d45a),this['focusTracker']=new _0x289570(),this['focusCycler']=new _0x105754({'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(_0x3a1deb,_0x1a26a7){super(_0x3a1deb),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-'+_0x1a26a7}},this['getFocusableElement']()]});}['focus'](){this['element']['focus']();}};function B(_0x164445,_0x1911a4){const _0x2a383a=_0x164445['replace'](/\/$/,'');return{'imageFallbackUrl':_0x164445,'imageSources':[{'srcset':[...[0x140,0x1e0,0x300,0x400,0x4b0,0x640,0x780,0x960]['filter'](_0x19ab65=>_0x19ab65<_0x1911a4)['map'](_0xa8223d=>_0x2a383a+'/-/resize/'+_0xa8223d+'x/\x20'+_0xa8223d+'w'),_0x164445+'\x20'+_0x1911a4+'w']['join'](',\x20'),'sizes':'(max-width:\x20'+_0x1911a4+'px)\x20100vw,\x20'+_0x1911a4+'px','type':'image/webp'}]};}function j(_0x1c07c3,_0x2316c1,_0x132d39){const _0xee5fa=_0x1c07c3['match'](/\/crop\/(\d+)x(\d+)\//);return{'width':_0xee5fa?parseInt(_0xee5fa[0x1],0xa):_0x2316c1,'height':_0xee5fa?parseInt(_0xee5fa[0x2],0xa):_0x132d39};}function q(_0x4c3b5f,_0x2655bb){const _0x1d273e=new(_0x4de12d())(),_0x53ea17=_0x4c3b5f['plugins']['get']('ImageUtils'),_0x38fb94=_0x4c3b5f['editing']['mapper']['toViewElement'](_0x2655bb),_0x592ef1=_0x53ea17['findViewImgElement'](_0x38fb94),_0x4adc49=_0x4c3b5f['editing']['view']['domConverter']['viewToDom'](_0x592ef1),_0x38a495=_0x2655bb['getAttribute']('width'),_0x52205b=_0x2655bb['getAttribute']('height'),_0x2ecd09='image-processing';_0x4c3b5f['editing']['view']['change'](_0x1093e8=>{_0x1093e8['addClass'](_0x2ecd09,_0x38fb94),_0x1093e8['setStyle']('aspect-ratio',_0x38a495+'/'+_0x52205b,_0x592ef1);}),_0x1d273e['listenTo'](_0x4adc49,'load',()=>{_0x1d273e['stopListening'](_0x4adc49,'load'),_0x4c3b5f['editing']['view']['change'](_0xe1ff90=>{_0xe1ff90['removeClass'](_0x2ecd09,_0x38fb94),_0xe1ff90['removeStyle']('aspect-ratio',_0x592ef1);});});}function M(_0x14d7e5){if(Array['isArray'](_0x14d7e5)){const _0x4e7182=_0x14d7e5['map'](M);return _0x5024ad=>_0x4e7182['some'](_0x1019ba=>_0x1019ba(_0x5024ad));}if('origin'==_0x14d7e5){const _0x22b7bc=_0x453ce0['window']['location']['origin'];return _0x5f5475=>new URL(_0x5f5475,_0x453ce0['document']['baseURI'])['origin']==_0x22b7bc;}return'function'==typeof _0x14d7e5?_0x14d7e5:_0x14d7e5 instanceof RegExp?_0x4e76b5=>!(!_0x4e76b5['match'](_0x14d7e5)&&!_0x4e76b5['replace'](/^https?:\/\//,'')['match'](_0x14d7e5)):()=>!0x1;}function H(_0x3a4b4d,_0x5724d1){return _0x51f3a4(_0x3a4b4d['target'])['includes'](_0x5724d1);}const W=/* #__PURE__ -- @preserve */
|
|
24
|
-
_0x3f9395();var G=class extends W{_editor;['_dialog'];_editing;['_api'];_type=null;['_formView']=null;constructor(_0x50523e,_0x324a7b,_0x19753b){super(),this['_editor']=_0x50523e,this['_editing']=_0x324a7b,this['_dialog']=_0x50523e['plugins']['get'](_0x531a28),this['_api']=_0x324a7b['ctxElement']['getAPI'](),this['_type']=_0x19753b,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:_0x542f38,model:_0x2ff382}=this['_editor'],_0x4fd7e7=_0x2ff382['document']['selection']['getSelectedElement'](),_0x76bbbe=_0x4fd7e7&&(_0x4fd7e7['is']('element','imageBlock')||_0x4fd7e7['is']('element','imageInline'));this['_formView']=new $(_0x542f38,this['_editing']['ucContextId']),this['_dialog']['show']({'id':'uploadCare','icon':_0x3b153f,'title':T(_0x542f38,this['_type'],_0x76bbbe?'Replace':'Insert')['text'],'content':this['_formView'],'position':_0x5742fb['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_api']['removeAllFiles'](),this['_editor']['editing']['view']['focus'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0x22ecf5=>!H(_0x22ecf5,this['_formView']['element'])}});}_initListeners(){this['_editing']['ctxElement']['addEventListener']('done-click',()=>{const {allEntries:_0x48cc52}=this['_api']['getOutputCollectionState']();this['_editor']['model']['change'](_0x1ab0e8=>{const _0xdb85=_0x48cc52['length'];for(const _0xaf19cb of _0x48cc52){const _0x37e3a0=_0xaf19cb===_0x48cc52[_0xdb85-0x1],{cdnUrl:_0x370c23,fileInfo:_0x1bf8fe}=_0xaf19cb;if(!_0x370c23||!_0x1bf8fe)continue;const {width:_0x1b385c,height:_0x1e7d47}=_0x1bf8fe['imageInfo'],_0x5db448=j(_0x370c23,_0x1b385c,_0x1e7d47),_0x186b06=B(_0x370c23,_0x5db448['width']),_0x5d707c={'id':_0x1bf8fe['uuid'],'type':'image','attributes':{'imageDimension':_0x5db448,..._0x186b06}};this['_insertAsset'](_0x5d707c,_0x37e3a0,_0x1ab0e8);}}),this['_dialog']['hide']();}),this['_editing']['ctxElement']['addEventListener']('change',_0x1c51a4=>{'idle'===_0x1c51a4['detail']['status']&&!_0x1c51a4['detail']['allEntries']['length']&&this['_dialog']['isOpen']&&('local'===this['_type']?this['_api']['setCurrentActivity']('start-from'):this['_api']['initFlow']());});}_insertAsset(_0x21c164,_0x58dc57,_0x4a5048){const _0x53c43b=this['_editor']['model']['document']['selection'],_0x9e3abb=_0x53c43b['getSelectedElement'](),_0x284c63=!(!_0x9e3abb||!_0x9e3abb['is']('element','imageInline'));_0x4a5048['removeSelectionAttribute']('linkHref'),this['_insertImage'](_0x21c164,_0x284c63),_0x58dc57||_0x4a5048['setSelection'](_0x53c43b['getLastPosition']());}_insertImage(_0x47f07a,_0x537387){const _0x21a1fd=this['_editor'],{imageDimension:_0x3bb4fa,imageFallbackUrl:_0x24a15,imageSources:_0x5ed030}=_0x47f07a['attributes'];_0x21a1fd['execute']('insertImage',{'imageType':_0x537387?'imageInline':null,'source':{'uploadcareImageId':_0x47f07a['id'],'src':_0x24a15,'sources':_0x5ed030,..._0x3bb4fa}});}},z=class extends _0x2d908d{_editing;_controller=null;static get requires(){return[_0x531a28,Z];}constructor(_0x58e7a6){super(_0x58e7a6),this['_editing']=_0x58e7a6['plugins']['get'](Z);}['refresh'](){this['isEnabled']=this['_checkEnabled']();}execute(_0x38cb33){this['_controller']&&(this['_controller']['destroy'](),this['_controller']=null),this['_controller']=new G(this['editor'],this['_editing'],_0x38cb33);}['_checkEnabled'](){return this['editor']['commands']['get']('insertImage')['isEnabled'];}},Q=class{static['upload']({file:_0x2a32b6,..._0x35df36}){return _0x311fc6(_0x2a32b6,_0x35df36);}static getInfo(_0x68ae8a,_0x3b2313){return _0x56a459(_0x68ae8a,_0x3b2313);}},J=class extends _0x1594fc{static get requires(){return[_0x51b74d,_0x67328a,_0x3aa330,Z];}static get['pluginName'](){return'UploadcareUploadAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async afterInit(){const _0x995d84=this['editor'];if(!_0x995d84['config']['get']('uploadcare'))return;_0x995d84['plugins']['get'](_0x3aa330)['createUploadAdapter']=_0x1dcf45=>new X(_0x1dcf45,_0x995d84),_0x995d84['plugins']['get'](_0x51b74d)['on']('uploadComplete',(_0x1b67d7,{imageElement:_0x59aeec,data:_0x333ee7})=>{_0x995d84['model']['change'](_0x5971e4=>{_0x5971e4['setAttribute']('uploadcareImageId',_0x333ee7['uploadcareImageId'],_0x59aeec);});});}},X=class{['loader'];editor;controller;constructor(_0x51e7aa,_0x4c264f){this['loader']=_0x51e7aa,this['editor']=_0x4c264f,this['controller']=new AbortController();}async['upload'](){const t=this['editor']['t'],_0x44beaf=await this['loader']['file'];return Q['upload']({'file':_0x44beaf,'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':_0x545bff=>{_0x545bff&&_0x545bff['isComputable']&&(this['loader']['uploadTotal']=0x1,this['loader']['uploaded']=_0x545bff['value']);}})['then'](async _0xba1719=>{const {imageFallbackUrl:_0x689981,imageSources:_0x1ab018}=B(_0xba1719['cdnUrl'],_0xba1719['imageInfo']['width']);return{'uploadcareImageId':_0xba1719['uuid'],'default':_0x689981,'sources':_0x1ab018};})['catch'](()=>{const _0x389214=t('Cannot\x20upload\x20file:')+('\x20'+_0x44beaf['name']+'.');return Promise['reject'](_0x389214);});}abort(){this['controller']['abort']();}},Z=class extends _0x1594fc{_configElement=null;_ctxElement=null;static get['pluginName'](){return'UploadcareEditing';}static get requires(){return[_0xa8ed96,J,_0x531a28];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}ucContextId;get configElement(){return this['_configElement'];}get ctxElement(){return this['_ctxElement'];}constructor(_0x21900f){super(_0x21900f),this['ucContextId']=_0x567d01();}init(){const _0x2c2183=this['editor'];_0x2c2183['commands']['add']('uploadcare',new z(_0x2c2183));}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 _0x15922a=_0x453ce0['document']['querySelector']('input[uploadcare-file-input]');_0x15922a&&_0x15922a['remove']();}),async function(_0x332149){const _0x2feeae='4wieLj6qmWZnpxGN9QYyFhU15kOfCBAHt2slISMXP3vErub8za07VTRoKcdDgJ',_0x1a83df=0x79410,_0x1d8b11={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x2899f6(_0x3048ba){const _0x142acf=new window['Promise'](_0x2f1e99=>{_0x3048ba['once']('ready',_0x2f1e99);}),_0x3760aa=window['Date']['now'](),_0xab435d=_0x3048ba['config']['get']('licenseKey');async function _0x5e0874(){let _0x2d7112,_0x466ab3=null,_0x54df0a=null;try{return'GPL'==_0xab435d?'NotAllowed':(_0x2d7112=_0x275563(),_0x2d7112?(_0x2d7112['usageEndpoint']&&(_0x54df0a=_0x4a53fc(_0x2d7112['usageEndpoint'],_0x2d7112['jti'])),await _0x5eb163()?_0x26611c()?_0x2c2521()?'Expired':_0xc76363()?('evaluation'==_0x2d7112['licenseType']&&(_0x466ab3=_0x6a76ad('EvaluationLimit')),await _0x4bef9b()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x2c2521(){const _0x22ad8e=['evaluation','trial']['includes'](_0x2d7112['licenseType'])?_0x3760aa/0x3e8:0xe10*_0x1a83df;return _0x2d7112['exp']<_0x22ad8e;}function _0x26611c(){const _0x4f8e4c=_0x2d7112['features'];return!!_0x4f8e4c&&(!!_0x4f8e4c['includes']('*')||!!_0x4f8e4c['includes']('UPLC'));}function _0xc76363(){const _0x13b1fe=_0x2d7112['licensedHosts'];if(!_0x13b1fe||0x0==_0x13b1fe['length'])return!0x0;const {hostname:_0x182324}=new URL(window['location']['href']);if(_0x13b1fe['includes'](_0x182324))return!0x0;const _0x2cd053=_0x182324['split']('.');return _0x13b1fe['filter'](_0x4edb30=>_0x4edb30['includes']('*'))['map'](_0x270123=>_0x270123['split']('.'))['filter'](_0x444e4e=>_0x444e4e['length']<=_0x2cd053['length'])['map'](_0x17869d=>Array(_0x2cd053['length']-_0x17869d['length'])['fill']('*'===_0x17869d[0x0]?'*':'')['concat'](_0x17869d))['some'](_0x42f74c=>_0x2cd053['every']((_0x60e52d,_0x2f3894)=>_0x42f74c[_0x2f3894]===_0x60e52d||'*'===_0x42f74c[_0x2f3894]));}function _0x4bef9b(){return _0x466ab3&&_0x54df0a?new window['Promise']((_0x2671d8,_0x33acb0)=>{_0x466ab3['then'](_0x2671d8,_0x33acb0),_0x54df0a['then'](_0x2a22a5=>{'Valid'!=_0x2a22a5&&_0x2671d8(_0x2a22a5);},_0x33acb0);}):_0x466ab3||_0x54df0a||'Valid';}}function _0x4a53fc(_0x358934,_0x2a93a4){return new window['Promise'](_0x52fdd5=>{if(_0x558772())return _0x52fdd5('Valid');_0x45b5ee(),_0x3048ba['decorate']('_sendUsageRequest');let _0x55f092=!0x1;const _0x155341=_0x567d01();function _0x3e8e43(_0x7d3734){return!!_0x7d3734&&('object'==typeof _0x7d3734||'function'==typeof _0x7d3734)&&'function'==typeof _0x7d3734['then']&&'function'==typeof _0x7d3734['catch'];}function _0x320178(_0x4ff9d0){_0x479785(_0x4ff9d0)['then'](_0x2d872c=>_0x2d872c&&'ok'==_0x2d872c['status']?_0xab485b(_0x3ee3c9(_0x155341+_0x2a93a4))!=_0x2d872c['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0xb1cb24=>(_0x35565e(),_0xb1cb24),()=>{const _0x45ff5e=_0x52edd0();return null==_0x45ff5e?(_0x35565e(),'Valid'):_0x3760aa-_0x45ff5e>0x240c8400?'UsageLimit':'Valid';})['then'](_0x52fdd5)['catch'](()=>{_0x52fdd5('UsageLimit');});const _0x3e3ec3=0x36ee80;function _0x35565e(){const _0x29a5cc='llct-'+_0xab485b(_0x3ee3c9(_0x358934)),_0xdbcd74=_0x38ccfb(_0xab485b(window['Math']['ceil'](_0x3760aa/_0x3e3ec3)));window['localStorage']['setItem'](_0x29a5cc,_0xdbcd74);}function _0x52edd0(){const _0x566fe0='llct-'+_0xab485b(_0x3ee3c9(_0x358934)),_0x3c8fab=window['localStorage']['getItem'](_0x566fe0);return _0x3c8fab?window['parseInt'](_0x38ccfb(_0x3c8fab),0x10)*_0x3e3ec3:null;}function _0x479785(_0x13cb40){return new window['Promise']((_0x22216c,_0x4a94d0)=>{_0x13cb40['then'](_0x22216c,_0x4a94d0),window['setTimeout'](_0x4a94d0,0x1d4c0);});}}_0x3048ba['on']('_sendUsageRequest',(_0x4bd8eb,_0x53785f)=>{if(_0x53785f[0x0]!=_0x358934)return _0x52fdd5('UsageLimit');_0x53785f[0x1]={..._0x53785f[0x1],'requestId':_0x155341};},{'priority':'high'}),_0x3048ba['on']('_sendUsageRequest',_0x4cf11b=>{_0x3e8e43(_0x4cf11b['return'])&&(_0x55f092=!0x0,_0x320178(_0x4cf11b['return']));},{'priority':'low'}),_0x142acf['then'](()=>{_0x55f092||_0x52fdd5('UsageLimit');});});function _0x558772(){return'auto'==_0x3048ba['editing']['view']['_overlayModeHint'];}function _0x45b5ee(){_0x3048ba['editing']['view']['_overlayModeHint']='auto';}}function _0x6a76ad(_0x457cf8){const _0x7205ea=[new window['Promise'](_0x27c2f2=>setTimeout(_0x27c2f2,0x93ecc)),_0x142acf['then'](()=>new window['Promise'](_0x220786=>{let _0x4d134d=0x0;_0x3048ba['model']['on']('applyOperation',(_0xe9037c,_0x39a1a9)=>{_0x39a1a9[0x0]['isDocumentOperation']&&_0x4d134d++,0x5e8==_0x4d134d&&(_0x220786(),_0xe9037c['off']());});}))];return window['Promise']['race'](_0x7205ea)['then'](()=>_0x457cf8);}async function _0x31e80c(){await _0x142acf,_0x3048ba['model']['change']=_0x3ba162,_0x3048ba['model']['enqueueChange']=_0x3ba162,_0x3048ba['enableReadOnlyMode']('model');}function _0x2cb9e5(_0x5bd659){const _0x4732d0=_0x3274e6();_0x3048ba[_0x4732d0]='uploadcareLicenseKey'+_0x5bd659,'Valid'!=_0x5bd659&&_0x31e80c();}function _0x3274e6(){const _0x43fdee=window['String'](window['performance']['now']())['replace']('.','');let _0x582e89='w';for(let _0x582dc7=0x0;_0x582dc7<_0x43fdee['length'];_0x582dc7+=0x2){let _0x4ab231=window['parseInt'](_0x43fdee['substring'](_0x582dc7,_0x582dc7+0x2));_0x4ab231>=0x3e&&(_0x4ab231-=0x3e),_0x582e89+=_0x2feeae[_0x4ab231];}return _0x582e89;}function _0x275563(){const _0x21f619=_0xab435d['split']('.');if(0x3!=_0x21f619['length'])return null;return _0x48c427(_0x21f619[0x1]);function _0x48c427(_0x5bd968){const _0x412497=_0x848a2f(_0x5bd968);return _0x412497&&_0x4bd73e()?_0x412497:null;function _0x4bd73e(){const _0x54e649=_0x412497['jti'],_0x2addc6=window['parseInt'](_0x54e649['substring'](_0x54e649['length']-0x8),0x10),_0x127ac3={..._0x412497,'jti':_0x54e649['substring'](0x0,_0x54e649['length']-0x8)};return delete _0x127ac3['vc'],_0x3ee3c9(_0x127ac3)==_0x2addc6;}}}async function _0x5eb163(){let _0x4b2845=!0x0;try{const [_0xf25769,_0x328b90,_0x3c7afe]=_0xab435d['split']('.');return _0x53d3ae(_0xf25769),await _0x1870d4(_0xf25769,_0x328b90,_0x3c7afe),_0x4b2845;}catch{return!0x1;}function _0x53d3ae(_0xf92512){const _0x3494a3=_0x848a2f(_0xf92512);_0x3494a3&&'ES256'==_0x3494a3['alg']||(_0x4b2845=!0x1);}async function _0x1870d4(_0x2ad7d0,_0x5b9f6d,_0x59c8d7){const _0x14db82=window['Uint8Array']['from'](_0x58577f(_0x59c8d7),_0x1bf694=>_0x1bf694['charCodeAt'](0x0)),_0x43f8c5=new window['TextEncoder']()['encode'](_0x2ad7d0+'.'+_0x5b9f6d),_0xbff50=window['crypto']['subtle'];if(!_0xbff50)return;const _0x5540de=await _0xbff50['importKey']('jwk',_0x1d8b11,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0xbff50['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x5540de,_0x14db82,_0x43f8c5)||(_0x4b2845=!0x1);}}function _0x848a2f(_0x356756){return _0x356756['startsWith']('ey')?JSON['parse'](_0x58577f(_0x356756)):null;}function _0x58577f(_0x57e075){return window['atob'](_0x57e075['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x3ee3c9(_0x59e97b){let _0x4d03d2=0x1505;function _0x5ecb24(_0x7716f1){for(let _0xc13167=0x0;_0xc13167<_0x7716f1['length'];_0xc13167++){const _0x38c553=_0x7716f1['charCodeAt'](_0xc13167);_0x4d03d2=(_0x4d03d2<<0x5)+_0x4d03d2+_0x38c553,_0x4d03d2&=_0x4d03d2;}}function _0x2bd818(_0x5c236e){Array['isArray'](_0x5c236e)?_0x5c236e['forEach'](_0x2bd818):_0x5c236e&&'object'==typeof _0x5c236e?Object['entries'](_0x5c236e)['sort']()['forEach'](([_0x3ca0ef,_0x2fe14f])=>{_0x5ecb24(_0x3ca0ef),_0x2bd818(_0x2fe14f);}):_0x5ecb24(window['String'](_0x5c236e));}return _0x2bd818(_0x59e97b),_0x4d03d2>>>0x0;}function _0xab485b(_0xf0f892){return _0xf0f892['toString'](0x10)['padStart'](0x8,'0');}function _0x38ccfb(_0x5aad4c){return _0x5aad4c['split']('')['reverse']()['join']('');}function _0x3ba162(){}_0x2cb9e5(await _0x5e0874());}_0x2899f6(_0x332149['editor']);}(this);}_initSchema(){const _0x52dbdf=this['editor']['model']['schema'];_0x52dbdf['isRegistered']('imageBlock')&&_0x52dbdf['extend']('imageBlock',{'allowAttributes':['uploadcareImageId']}),_0x52dbdf['isRegistered']('imageInline')&&_0x52dbdf['extend']('imageInline',{'allowAttributes':['uploadcareImageId']});}_initConversion(){const _0x5451bc=this['editor'];_0x5451bc['conversion']['for']('downcast')['attributeToAttribute']({'model':'uploadcareImageId','view':'data-uc-image-id'}),_0x5451bc['conversion']['for']('upcast')['elementToAttribute']({'model':{'key':'uploadcareImageId','value':_0x34966e=>_0x34966e['getAttribute']('data-uc-image-id')},'view':{'attributes':{'data-uc-image-id':/[a-zA-Z0-9\\-]+/}}});const _0x539eb9=_0x5451bc['commands']['get']('replaceImageSource');_0x539eb9&&this['listenTo'](_0x539eb9,'cleanupImage',(_0x590912,[_0x15d703,_0x4fa669])=>{_0x15d703['removeAttribute']('uploadcareImageId',_0x4fa669);});}_initConfig(){const _0x408fb9=this['editor']['config']['get']('uploadcare.uploader')||{},_0x5bf186=this['editor']['config']['get']('uploadcare.pubkey')||'';this['_configElement']=_0x5826df(_0x453ce0['document'],'uc-config',{..._0x408fb9,'pubkey':_0x5bf186,'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']=_0x4e72f8=>{if('closeMax'==_0x4e72f8)return'#uc-icon-arrow-down';},_0x453ce0['document']['body']['appendChild'](this['_configElement']);}_initCtx(){this['_ctxElement']=_0x5826df(_0x453ce0['document'],'uc-upload-ctx-provider',{'ctx-name':'uploader-'+this['ucContextId']}),_0x453ce0['document']['body']['appendChild'](this['_ctxElement']);}_initImageProcessingIndicator(){const _0x59ded9=this['editor']['commands']['get']('insertImage');_0x59ded9&&this['listenTo'](_0x59ded9,'execute',()=>{const _0x279ab9=this['editor']['model']['document']['selection']['getSelectedElement']();_0x279ab9&&_0x279ab9['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0x279ab9);});});const _0x4e8c87=this['editor']['commands']['get']('uploadcareImageReplace');_0x4e8c87&&this['listenTo'](_0x4e8c87,'execute',()=>{const _0x24fb74=this['editor']['model']['document']['selection']['getSelectedElement']();_0x24fb74&&_0x24fb74['getAttribute']('uploadcareImageId')&&this['editor']['editing']['view']['once']('render',()=>{q(this['editor'],_0x24fb74);});});}},Y=class extends _0x1594fc{static get requires(){return[Z,V];}static get['pluginName'](){return'Uploadcare';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xf1e5da){super(_0xf1e5da),_0xf1e5da['config']['define']('uploadcare.uploader.sourceList',['local','url']),_0x2c4d4c['defineComponents'](_0x2c4d4c),this['_defineLocale']();}['_defineLocale'](){const _0x2b83e9=this['editor']['config']['get']('uploadcare.locale'),_0x16dfa2=this['editor']['locale']['contentLanguage'];_0x2b83e9&&_0x2c4d4c['defineLocale'](_0x16dfa2,_0x2b83e9);}},tt=class extends _0x2aa73e{constructor(_0xc9abc9){super(_0xc9abc9);const t=_0xc9abc9['t'],_0x10825d=this['bindTemplate'],_0x451883=new _0x1d9f35();_0x451883['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':[_0x451883,{'text':_0x10825d['to']('imageUploadProgress',_0x2fa8c1=>t('Loading\x20image...')+'\x20('+(_0x2fa8c1||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 _0x2aa73e{constructor(_0x2b8815){super(_0x2b8815);const t=_0x2b8815['t'];this['set']('errorType',null);const _0x3de88e=new _0x26e63d(_0x2b8815);_0x3de88e['label']=t({'id':'Try\x20again\x20(Uploadcare)','string':'Try\x20again'}),_0x3de88e['withText']=!0x0,_0x3de88e['class']='ck-button-action',_0x3de88e['on']('execute',()=>{this['fire']('retry');}),_0x3de88e['bind']('isVisible')['to'](this,'errorType',_0x4ba674=>'NotFound'!==_0x4ba674);const _0x301bce=new _0x3e6674();_0x301bce['content']=_0xb8adc0,_0x301bce['extendTemplate']({'attributes':{'style':{'width':'50px','height':'50px'}}});const _0x393e2b=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':[_0x301bce,{'tag':'h3','attributes':{'style':{'fontWeight':'bold'}},'children':[{'text':t('Unable\x20to\x20load')}]},{'text':_0x393e2b['to']('errorType',_0xfb20cf=>t('NotFound'!==_0xfb20cf?'We\x20were\x20unable\x20to\x20load\x20the\x20image\x20due\x20to\x20network\x20connection\x20issues.':'The\x20image\x20was\x20not\x20found.\x20Its\x20source\x20may\x20have\x20been\x20removed.'))},_0x3de88e]},{'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 _0x2aa73e{constructor(_0x46304f,_0x4f5ada){super(_0x46304f);const _0x3dc22a=this['bindTemplate'];this['set']('imageSrc',''),this['setTemplate']({'tag':'uc-cloud-image-editor','attributes':{..._0x4f5ada,'class':['uc-light','ck-uploadcare-theme'],'ctx-name':'image-edit','cdn-url':_0x3dc22a['to']('imageSrc')}});}},st=class extends F{_items;['_loadingView'];['_errorView'];_editingView;['_focusableView'];constructor(_0xce09b5,_0x3b5297,_0x3a6a50){super(_0xce09b5),this['_items']=this['createCollection'](),this['_loadingView']=new tt(_0xce09b5),this['_errorView']=new et(_0xce09b5),this['_editingView']=new it(_0xce09b5,_0x3a6a50),this['_focusableView']=new _0x2aa73e(_0xce09b5),this['_focusableView']['setTemplate'](this['getFocusableElement']()),this['set']('status',_0x3b5297),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'],_0x2fea12=>{this['_addUploadcareImageEditorListeners'](_0x2fea12);});}),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(_0x244090,_0x3eac1e){const _0x52961d='uc-cloud-image-editor',_0x2f72b3=_0x244090['querySelector'](_0x52961d);if(_0x2f72b3)return _0x3eac1e(_0x2f72b3);const _0x3aae54=new MutationObserver(_0x4f1a0c=>{const _0x5c16d7=_0x4f1a0c['filter'](_0x1cdabd=>_0x1cdabd['target']===_0x244090&&_0x1cdabd['addedNodes']['length']>0x0&&_0x1cdabd['addedNodes'][0x0]['nodeName']['toLowerCase']()===_0x52961d);_0x5c16d7['length']&&(_0x3aae54['disconnect'](),_0x3eac1e(_0x5c16d7[0x0]['addedNodes'][0x0]));});_0x3aae54['observe'](_0x244090,{'childList':!0x0,'subtree':!0x0});}_addUploadcareImageEditorListeners(_0x168a3a){_0x168a3a['addEventListener']('apply',_0x1362b8=>{this['fire']('apply',{'imageSrc':_0x1362b8['detail']['cdnUrl']});}),_0x168a3a['addEventListener']('cancel',()=>{this['fire']('cancel');});}_addErrorViewListeners(){this['_errorView']['on']('retry',()=>{this['fire']('retry');});}};const nt=/* #__PURE__ -- @preserve */
|
|
25
|
-
_0x3f9395();var rt=class extends nt{_editor;['_dialog'];_imageElement;['_imageCache'];_controller;_attributes;constructor(_0x59cdce,_0x38cc61,_0x1b3036){super(),this['_editor']=_0x59cdce,this['_dialog']=_0x38cc61,this['_imageElement']=_0x1b3036,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 _0x16af33=this['_imageElement'],_0x163d51=_0x16af33['getAttribute']('uploadcareImageId'),_0x2f4f6b=_0x16af33['getAttribute']('src');if(_0x163d51)await this['_loadImageInfo'](_0x163d51,_0x2f4f6b);else{if(this['_imageCache']['has'](_0x2f4f6b)){const _0x5acc1d=this['_imageCache']['get'](_0x2f4f6b);this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x5acc1d['url'],this['imageDimension']=_0x5acc1d['dimension'],this['imageId']=_0x5acc1d['id'];}else this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),await this['_uploadImage'](this['_imageElement'],this['_controller']);}}['_showDialog'](){const {locale:_0x409730}=this['_editor'],t=_0x409730['t'],_0x467ba2=new st(_0x409730,this['imageStatus'],this['_attributes']);_0x467ba2['bind']('status')['to'](this,'imageStatus'),_0x467ba2['_loadingView']['bind']('imageUploadProgress')['to'](this,'imageUploadProgress'),_0x467ba2['_editingView']['bind']('imageSrc')['to'](this,'imageSrc'),_0x467ba2['_errorView']['bind']('errorType')['to'](this,'imageErrorType'),this['_addEditViewListeners'](_0x467ba2,this['_imageElement']),this['_dialog']['show']({'id':'uploadcareImageEdit','icon':_0x32e80d,'title':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'}),'content':_0x467ba2,'position':_0x5742fb['EDITOR_TOP_CENTER'],'isModal':!0x0,'onShow':()=>{_0x467ba2['focus']();},'onHide':()=>{_0x467ba2['destroy'](),this['destroy']();},'keystrokeHandlerOptions':{'filter':_0xdbb3f5=>!H(_0xdbb3f5,_0x467ba2['element'])}});}['_loadImageInfo'](_0xd140a9,_0x3de96e){return Q['getInfo'](_0xd140a9,{'publicKey':this['_editor']['config']['get']('uploadcare.pubkey'),'baseURL':this['_editor']['config']['get']('uploadcare.uploader.baseUrl')})['then'](_0x59efa4=>{const {width:_0x5aa136,height:_0x4d30aa}=_0x59efa4['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x3de96e,this['imageDimension']={'width':_0x5aa136,'height':_0x4d30aa},this['imageId']=_0xd140a9;})['catch'](_0x11a3e9=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x11a3e9['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}['_uploadImage'](_0x24658a,_0x4f31a1){return this['_getImageAsFile'](_0x24658a)['then'](_0x652132=>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':_0x4f31a1['signal'],'file':_0x652132,'onProgress':_0x26b66d=>{_0x26b66d&&_0x26b66d['isComputable']&&(this['imageUploadProgress']=Math['ceil'](0x64*_0x26b66d['value']));}}))['then'](_0x4561e8=>{const {width:_0x1c992b,height:_0x67d5a2}=_0x4561e8['imageInfo'];this['imageStatus']='ready',this['imageErrorType']=null,this['imageSrc']=_0x4561e8['cdnUrl'],this['imageDimension']={'width':_0x1c992b,'height':_0x67d5a2},this['imageId']=_0x4561e8['uuid'],this['imageUploadProgress']=null;const _0x3a2bc5=_0x24658a['getAttribute']('src');this['_imageCache']['set'](_0x3a2bc5,{'id':_0x4561e8['uuid'],'url':_0x4561e8['cdnUrl'],'dimension':this['imageDimension']});})['catch'](_0x43c4d0=>{this['imageStatus']='error',this['imageErrorType']='FileNotFoundError'===_0x43c4d0['code']?'NotFound':'Network',this['imageSrc']=null,this['imageDimension']=null,this['imageId']=null,this['imageUploadProgress']=null;});}_addEditViewListeners(_0x3ba259,_0x5ad5e7){_0x3ba259['on']('apply',(_0x516b3a,_0x4b13b0)=>{this['_replaceImage'](_0x5ad5e7,_0x4b13b0['imageSrc'],this['imageId']),this['_dialog']['hide']();}),_0x3ba259['on']('retry',()=>{this['imageStatus']='uploading',this['imageUploadProgress']=0x0,this['_controller']=new AbortController(),this['_uploadImage'](this['_imageElement'],this['_controller']);}),_0x3ba259['on']('cancel',()=>{this['_dialog']['hide']();});}['_replaceImage'](_0x22e31a,_0x175ed1,_0x1212c9){const _0x3fa8f7=this['_editor'],{width:_0x5caa8c,height:_0x3df3a6}=j(_0x175ed1,this['imageDimension']['width'],this['imageDimension']['height']),{imageFallbackUrl:_0x35c8a0,imageSources:_0x569ff0}=B(_0x175ed1,_0x5caa8c);_0x3fa8f7['model']['change'](_0x16e61f=>{if('$graveyard'!==_0x22e31a['root']['rootName'])_0x16e61f['setSelection'](_0x22e31a,'on'),_0x3fa8f7['execute']('uploadcareImageReplace',{...Object['fromEntries'](_0x22e31a['getAttributes']()),'uploadcareImageId':_0x1212c9,'src':_0x35c8a0,'sources':_0x569ff0,'width':_0x5caa8c,'height':_0x3df3a6},_0x22e31a);else{_0x3fa8f7['execute']('insertImage',{'imageType':_0x22e31a['is']('element','imageInline')?'imageInline':null,'source':{...Object['fromEntries'](_0x22e31a['getAttributes']()),'uploadcareImageId':_0x1212c9,'src':_0x35c8a0,'sources':_0x569ff0,'width':_0x5caa8c,'height':_0x3df3a6}});const _0x212c24=_0x22e31a['getChildren']();_0x22e31a=_0x3fa8f7['model']['document']['selection']['getSelectedElement']();for(const _0x39053a of _0x212c24)_0x16e61f['append'](_0x16e61f['cloneElement'](_0x39053a),_0x22e31a);}_0x16e61f['setSelection'](_0x22e31a,'on');});}async _getImageAsFile(_0x1e2998){const _0x4e052e=_0x453ce0['window'],_0x41887c=_0x453ce0['document']['location']['href'],_0x4628c1=new _0x4e052e['URL'](_0x1e2998['getAttribute']('src'),_0x41887c);if('data:'===_0x4628c1['protocol']){const _0x47523e=_0x4628c1['href']['split'](','),_0x283da3=_0x47523e[0x0]['match'](/:(.*?);/)[0x1],_0x1b73cb=_0x283da3['split']('/')[0x1],_0x4be325=_0x4e052e['atob'](_0x47523e[_0x47523e['length']-0x1]);let _0x3c30e3=_0x4be325['length'];const _0x112f21=new _0x4e052e['Uint8Array'](_0x3c30e3);for(;_0x3c30e3--;)_0x112f21[_0x3c30e3]=_0x4be325['charCodeAt'](_0x3c30e3);return new _0x4e052e['File']([_0x112f21],'image.'+_0x1b73cb,{'type':_0x283da3});}const _0x5f2843=_0x4628c1['href']['split']('/'),_0x3a6ac9=_0x5f2843[_0x5f2843['length']-0x1],_0x7dec3f=_0x3a6ac9['split']('.')[0x1];return _0x4e052e['fetch'](_0x4628c1['href'])['then'](_0x44feb1=>_0x44feb1['clone']()['blob']())['then'](_0x5007e0=>new _0x4e052e['File']([_0x5007e0],_0x3a6ac9,{'type':'image/'+_0x7dec3f}));}},at=class extends _0x2d908d{imageEditController;static get requires(){return[_0x531a28];}_isEditable;constructor(_0xe7aef2){super(_0xe7aef2),this['imageEditController']=void 0x0,this['_isEditable']=function(_0x514e0d){const _0x15f0bd=M(_0x514e0d);return _0x281ca4=>!(!_0x281ca4||!_0x281ca4['is']('element','imageBlock')&&!_0x281ca4['is']('element','imageInline'))&&(!!_0x281ca4['hasAttribute']('uploadcareImageId')||!!_0x281ca4['hasAttribute']('src')&&_0x15f0bd(_0x281ca4['getAttribute']('src')));}(_0xe7aef2['config']['get']('uploadcare.allowExternalImagesEditing')||[]),this['set']({'isActive':!0x1});}['refresh'](){const _0x332722=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=this['_isEditable'](_0x332722);}execute(){this['imageEditController']&&(this['unbind']('isActive'),this['imageEditController']=void 0x0);const _0x1041ec=this['editor']['model']['document']['selection']['getSelectedElement']();_0x1041ec&&(_0x1041ec['is']('element','imageBlock')||_0x1041ec['is']('element','imageInline'))&&(this['imageEditController']=new rt(this['editor'],this['editor']['plugins']['get'](_0x531a28),_0x1041ec),this['bind']('isActive')['to'](this['imageEditController'],'isActive'));}},ot=class extends _0x2d908d{['refresh'](){const _0xc8b125=this['editor']['model']['document']['selection']['getSelectedElement']();this['isEnabled']=Boolean(_0xc8b125&&(_0xc8b125['is']('element','imageBlock')||_0xc8b125['is']('element','imageInline')));}execute(_0x1cacc5){const _0x169cd6=this['editor']['model']['document']['selection']['getSelectedElement']();this['editor']['model']['change'](_0x3b6a96=>{_0x3b6a96['setAttributes'](_0x1cacc5,_0x169cd6),_0x3b6a96['removeAttribute']('srcset',_0x169cd6),_0x3b6a96['removeAttribute']('sizes',_0x169cd6);});}},ct=class extends _0x1594fc{static get['pluginName'](){return'UploadcareImageEditEditing';}static get requires(){return[Z,_0xe18045,_0x5b6677,_0x24949a];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x3e0994}=this;_0x3e0994['commands']['add']('uploadcareImageEdit',new at(_0x3e0994)),_0x3e0994['commands']['add']('uploadcareImageReplace',new ot(_0x3e0994));}},lt=class extends _0x1594fc{['_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 _0x2d8ee2=this['editor'];_0x2d8ee2['ui']['componentFactory']['add']('uploadcareImageEdit',_0x2e4ad2=>{const _0x343f10=_0x2d8ee2['commands']['get']('uploadcareImageEdit'),_0x1c0a74=new _0x26e63d(_0x2e4ad2),t=_0x2e4ad2['t'];return _0x1c0a74['set']({'icon':_0x32e80d,'tooltip':!0x0,'label':t({'id':'Edit\x20Image\x20(Uploadcare)','string':'Edit\x20image'})}),_0x1c0a74['bind']('isEnabled')['to'](_0x343f10),_0x1c0a74['bind']('isOn')['to'](_0x343f10,'isActive'),this['listenTo'](_0x1c0a74,'execute',()=>{_0x2d8ee2['execute']('uploadcareImageEdit'),_0x2d8ee2['editing']['view']['focus']();}),_0x1c0a74;}),this['_initConfig']();}_initConfig(){const _0x15beec=_0x5826df(document,'uc-config',{'ctx-name':'image-edit','removeCopyright':'true','localeName':this['editor']['locale']['contentLanguage']});document['body']['appendChild'](_0x15beec),this['listenTo'](this['editor'],'destroy',()=>{_0x15beec['remove']();});}},ut=class extends _0x1594fc{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.
|
|
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.
|
|
42
|
-
"@ckeditor/ckeditor5-engine": "48.5.0-alpha.
|
|
43
|
-
"@ckeditor/ckeditor5-icons": "48.5.0-alpha.
|
|
44
|
-
"@ckeditor/ckeditor5-image": "48.5.0-alpha.
|
|
45
|
-
"@ckeditor/ckeditor5-ui": "48.5.0-alpha.
|
|
46
|
-
"@ckeditor/ckeditor5-upload": "48.5.0-alpha.
|
|
47
|
-
"@ckeditor/ckeditor5-utils": "48.5.0-alpha.
|
|
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
|
},
|