!function(){function e(e){function t(e){return"string"!=typeof e?-1:NEW_CKEDITOR.tools.array.indexOf(n,(function(t){return t.id===e}))}function a(e){var t=e.match(/\\blipuid (\w+)\}/);return e=e.match(/\\bliptag(-?\d+)/),t?t[1]:e?e[1]:null}var i=NEW_CKEDITOR.plugins.pastetools.filters.common.rtf,n=[];if(e=i.removeGroups(e,"(?:(?:header|footer)[lrf]?|nonshppict|shprslt)"),!(e=i.getGroups(e,"pict")))return n;for(var o=0;o<e.length;o++){var s=e[o].content,p=a(s),l=r(s),g=t(p),u=(E=-1!==g&&n[g].hex)&&n[g].type===l,E=E&&n[g].type!==l&&g===n.length-1,f=-1!==s.indexOf("\\defshp"),m=-1!==NEW_CKEDITOR.tools.array.indexOf(NEW_CKEDITOR.pasteFilters.image.supportedImageTypes,l),c=-1!==NEW_CKEDITOR.tools.indexOf(s,"fHorizRule");u?n.push(n[g]):E||f||c||(s={id:p,hex:m?i.extractGroupContent(s).replace(/\s/g,""):null,type:l},-1!==g?n.splice(g,1,s):n.push(s))}return n}function t(e){for(var t,r=/<img[^>]+src="([^"]+)[^>]+/g,a=[];t=r.exec(e);)a.push(t[1]);return a}function r(e){var t=NEW_CKEDITOR.tools.array.find(NEW_CKEDITOR.pasteFilters.image.recognizableImageTypes,(function(t){return t.marker.test(e)}));return t?t.type:"unknown"}function a(e){var t=-1!==NEW_CKEDITOR.tools.array.indexOf(NEW_CKEDITOR.pasteFilters.image.supportedImageTypes,e.type),r=e.hex;return t?("string"==typeof r&&(r=NEW_CKEDITOR.tools.convertHexStringToBytes(e.hex)),e.type?"data:"+e.type+";base64,"+NEW_CKEDITOR.tools.convertBytesToBase64(r):null):null}function i(e){return new NEW_CKEDITOR.tools.promise((function(t){NEW_CKEDITOR.ajax.load(e,(function(e){e=a({type:n(e=new Uint8Array(e)),hex:e}),t(e)}),"arraybuffer")}))}function n(e){e=e.subarray(0,4);var t=NEW_CKEDITOR.tools.array.map(e,(function(e){return e.toString(16)})).join("");return(e=NEW_CKEDITOR.tools.array.find(NEW_CKEDITOR.pasteFilters.image.recognizableImageSignatures,(function(e){return 0===t.indexOf(e.signature)})))?e.type:null}NEW_CKEDITOR.pasteFilters.image=function(r,n,o){var s;return n.activeFilter&&!n.activeFilter.check("img[src]")||0===(s=t(r)).length?r:o?function(t,r,i){var n,o;if(0===(r=e(r)).length)return t;if(n=NEW_CKEDITOR.tools.array.map(r,(function(e){return a(e)}),this),i.length!==n.length)return NEW_CKEDITOR.error("pastetools-failed-image-extraction",{rtf:r.length,html:i.length}),t;for(o=0;o<i.length;o++)if(0===i[o].indexOf("file://"))if(n[o]){var s=i[o].replace(/\\/g,"\\\\");t=t.replace(new RegExp("(<img [^>]*src=[\"']?)"+s),"$1"+n[o])}else NEW_CKEDITOR.error("pastetools-unsupported-image",{type:r[o].type,index:o});return t}(r,o,s):function(e,t,r){var a=NEW_CKEDITOR.tools.array.unique(NEW_CKEDITOR.tools.array.filter(r,(function(e){return e.match(/^blob:/i)})));return r=NEW_CKEDITOR.tools.array.map(a,i),NEW_CKEDITOR.tools.promise.all(r).then((function(t){NEW_CKEDITOR.tools.array.forEach(t,(function(t,r){if(t){var i=a[r];i=e.editable().find('img[src="'+i+'"]').toArray(),NEW_CKEDITOR.tools.array.forEach(i,(function(e){e.setAttribute("src",t),e.setAttribute("data-edi-saved-src",t)}),this)}else NEW_CKEDITOR.error("pastetools-unsupported-image",{type:"blob",index:r})}))})),t}(n,r,s)},NEW_CKEDITOR.pasteFilters.image.extractFromRtf=e,NEW_CKEDITOR.pasteFilters.image.extractTagsFromHtml=t,NEW_CKEDITOR.pasteFilters.image.getImageType=r,NEW_CKEDITOR.pasteFilters.image.createSrcWithBase64=a,NEW_CKEDITOR.pasteFilters.image.convertBlobUrlToBase64=i,NEW_CKEDITOR.pasteFilters.image.getImageTypeFromSignature=n,NEW_CKEDITOR.pasteFilters.image.supportedImageTypes=["image/png","image/jpeg","image/gif"],NEW_CKEDITOR.pasteFilters.image.recognizableImageTypes=[{marker:/\\pngblip/,type:"image/png"},{marker:/\\jpegblip/,type:"image/jpeg"},{marker:/\\emfblip/,type:"image/emf"},{marker:/\\wmetafile\d/,type:"image/wmf"}],NEW_CKEDITOR.pasteFilters.image.recognizableImageSignatures=[{signature:"ffd8ff",type:"image/jpeg"},{signature:"47494638",type:"image/gif"},{signature:"89504e47",type:"image/png"}]}();