froala-editor
Version:
The next generation Javascript WYSIWYG HTML rich text editor made by devs for devs. High performance and modern design make it easy to use for developers and loved by users.
7 lines (6 loc) • 95.5 kB
JavaScript
/*!
* froala_editor v4.5.0 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2025 Froala Labs
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(It){"use strict";function Lt(e){return(Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}It=It&&It.hasOwnProperty("default")?It["default"]:It,Object.assign(It.POPUP_TEMPLATES,{"filesManager.insert":"[_BUTTONS_][_UPLOAD_LAYER_][_BY_URL_LAYER_][_EMBED_LAYER_][_UPLOAD_PROGRESS_LAYER_][_PROGRESS_BAR_]","image.edit":"[_BUTTONS_]","image.alt":"[_BUTTONS_][_ALT_LAYER_]","image.size":"[_BUTTONS_][_SIZE_LAYER_]"}),Object.assign(It.DEFAULTS,{filesInsertButtons:["imageBack","|","filesUpload","filesByURL","filesEmbed"],filesInsertButtons2:["deleteAll","insertAll","cancel","minimize"],imageEditButtons:["imageReplace","imageAlign","imageCaption","imageRemove","imageLink","linkOpen","linkEdit","linkRemove","-","imageDisplay","imageStyle","imageAlt","imageSize"],imageAltButtons:["imageBack","|"],imageSizeButtons:["imageBack","|"],imageUpload:!0,filesManagerUploadURL:null,imageCORSProxy:"https://cors-anywhere.froala.com",imageUploadRemoteUrls:!0,filesManagerUploadParam:"file",filesManagerUploadParams:{},googleOptions:{},filesManagerUploadToS3:!1,filesManagerUploadToAzure:!1,filesManagerUploadMethod:"POST",filesManagerMaxSize:10485760,filesManagerAllowedTypes:["*"],imageResize:!0,imageResizeWithPercent:!1,imageRoundPercent:!1,imageDefaultWidth:300,imageDefaultAlign:"center",imageDefaultDisplay:"block",imageSplitHTML:!1,imageStyles:{"fr-rounded":"Rounded","fr-bordered":"Bordered","fr-shadow":"Shadow"},imageMove:!0,imageMultipleStyles:!0,imageTextNear:!0,imagePaste:!0,imagePasteProcess:!1,imageMinWidth:16,imageOutputSize:!1,imageDefaultMargin:5,imageAddNewLine:!1}),It.VIDEO_PROVIDERS=[{test_regex:/^.*((youtu.be)|(youtube.com))\/((v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))?\??v?=?([^#\&\?]*).*/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=|embed\/)?([0-9a-zA-Z_\-]+)(.+)?/g,url_text:"https://www.youtube.com/embed/$1?$2",html:'<iframe width="640" height="360" src="{url}&wmode=opaque" frameborder="0" allowfullscreen></iframe>',provider:"youtube"},{test_regex:/^.*(?:vimeo.com)\/(?:channels(\/\w+\/)?|groups\/*\/videos\/\u200b\d+\/|video\/|)(\d+)(?:$|\/|\?)/,url_regex:/(?:https?:\/\/)?(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?(\/[a-zA-Z0-9_\-]+)?/i,url_text:"https://player.vimeo.com/video/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"vimeo"},{test_regex:/^.+(dailymotion.com|dai.ly)\/(video|hub)?\/?([^_]+)[^#]*(#video=([^_&]+))?/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:dailymotion\.com|dai\.ly)\/(?:video|hub)?\/?(.+)/g,url_text:"https://www.dailymotion.com/embed/video/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"dailymotion"},{test_regex:/^.+(screen.yahoo.com)\/[^_&]+/,url_regex:"",url_text:"",html:'<iframe width="640" height="360" src="{url}?format=embed" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"yahoo"},{test_regex:/^.+(rutube.ru)\/[^_&]+/,url_regex:/(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru)\/(?:video)?\/?(.+)/g,url_text:"https://rutube.ru/play/embed/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',provider:"rutube"},{test_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/,url_regex:/^(?:.+)vidyard.com\/(?:watch)?\/?([^.&/]+)\/?(?:[^_.&]+)?/g,url_text:"https://play.vidyard.com/$1",html:'<iframe width="640" height="360" src="{url}" frameborder="0" allowfullscreen></iframe>',provider:"vidyard"}],It.VIDEO_EMBED_REGEX=/^\W*((<iframe(.|\n)*>(\s|\n)*<\/iframe>)|(<embed(.|\n)*>))\W*$/i,It.IMAGE_EMBED_REGEX=/^\W*((<img(.|\n)*>(\s|\n)*))\W*$/i,It.IMAGE_TYPE="image/png",It.IMAGE_ALLOW_REGEX=/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i,It.PLUGINS.filesManager=function(L){var x,s,_,l,d,f,o,c,S=L.$,M="https://i.froala.com/upload",p=!1,t=!1,T=new Map,B=new Map,E=new Map,k=new Map,R=new Map,A=new Map,r=0,a=[],g=-1,D=[],u=0,m=["file","image","imageTUI","video"],U=1,v=2,C=3,I=4,z=5,O=6,$=10,P=["video/avi","video/mpeg","video/x-ms-wmv"],h={};function b(){var e=L.popups.get("filesManager.insert"),t=e.find(".fr-files-by-url-layer input");t.val(""),e.find(".fr-files-embed-layer textarea").val("").trigger("change"),t.trigger("change")}function y(e){var t;L.hasOwnProperty("imageTUI")||(o="fr-disabled"),A.forEach(function(e,t){q(t)}),w()?(t=L.popups.get("filesManager.insert"))||(t=Fe()):(t=L.popups.get("filesManager.insert"))||(t=function s(){var e="<div style= 'padding:10px'>\n <div class = 'fr-message'><h3 style ='font-size: 16px; margin: 10px 10px;font-weight: normal;'>".concat(L.language.translate(function n(){var e="",t=function i(){var t=[];return m.forEach(function(e){L.opts.pluginsEnabled.indexOf(e)<0&&t.push(e.charAt(0).toUpperCase()+e.slice(1))}),t}();e=t.join(", "),1<t.length?e+=" plugin are":e+=" plugin is";return e}()+" not enabled. Do you want to enable?"),"</h3></div>\n <div style='text-align:right;'>\n <button class='fr-trim-button fr-plugins-enable'>").concat(L.language.translate("Enable"),"</button> \n <button class='fr-trim-button fr-plugins-cancel'>").concat(L.language.translate("Cancel"),"</button>\n </div>"),t={buttons:'<div class="fr-buttons fr-tabs"></div>',upload_layer:e,by_url_layer:"",embed_layer:"",upload_progress_layer:"",progress_bar:""},i=L.popups.create("filesManager.insert",t);return Re(i),i}());var i=L.$tb.find('.fr-command[data-cmd="insertFiles"]');if(Q(),e||!t.hasClass("fr-active"))if(e||Z(),L.popups.refresh("filesManager.insert"),L.popups.setContainer("filesManager.insert",L.$tb),i.isVisible()){var n=L.button.getPosition(i,T.size),a=n.left,r=n.top;L.popups.show("filesManager.insert",a,r,i.outerHeight())}else L.position.forSelection(t),L.popups.show("filesManager.insert");L.popups.setPopupDimensions(t),w()&&L.popups.setFileListHeight(t),t.find(".fr-upload-progress")&&0==T.size&&t.find(".fr-upload-progress").addClass("fr-none")}function w(){var t=!0;return m.forEach(function(e){L.opts.pluginsEnabled.indexOf(e)<0&&(t=!1)}),t}function F(){Q()}function N(){if(l||function s(){var e;L.shared.$image_resizer?(l=L.shared.$image_resizer,f=L.shared.$img_overlay,L.events.on("destroy",function(){S("body").first().append(l.removeClass("fr-active"))},!0)):(L.shared.$image_resizer=S(document.createElement("div")).attr("class","fr-image-resizer"),l=L.shared.$image_resizer,L.events.$on(l,"mousedown",function(e){e.stopPropagation()},!0),L.opts.imageResize&&(l.append(H("nw")+H("ne")+H("sw")+H("se")),L.shared.$img_overlay=S(document.createElement("div")).attr("class","fr-image-overlay"),f=L.shared.$img_overlay,e=l.get(0).ownerDocument,S(e).find("body").first().append(f)));L.events.on("shared.destroy",function(){l.html("").removeData().remove(),l=null,L.opts.imageResize&&(f.remove(),f=null)},!0),L.helpers.isMobile()||L.events.$on(S(L.o_win),"resize",function(){x&&!x.hasClass("fr-uploading")?it(!0):x&&(N(),replace(),J(!1))});if(L.opts.imageResize){e=l.get(0).ownerDocument,L.events.$on(l,L._mousedown,".fr-handler",Y),L.events.$on(S(e),L._mousemove,V),L.events.$on(S(e.defaultView||e.parentWindow),L._mouseup,W),L.events.$on(f,"mouseleave",W);var n=1,a=null,r=0;L.events.on("keydown",function(e){if(x){var t=-1!=navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,i=e.which;(i!==a||200<e.timeStamp-r)&&(n=1),(i==It.KEYCODE.EQUALS||L.browser.mozilla&&i==It.KEYCODE.FF_EQUALS)&&t&&!e.altKey?n=Xe.call(this,e,1,1,n):(i==It.KEYCODE.HYPHEN||L.browser.mozilla&&i==It.KEYCODE.FF_HYPHEN)&&t&&!e.altKey?n=Xe.call(this,e,2,-1,n):L.keys.ctrlKey(e)||i!=It.KEYCODE.ENTER||(x.before("<br>"),Ee(x)),a=i,r=e.timeStamp}},!0),L.events.on("keyup",function(){n=1})}}(),!x)return!1;var e=L.$wp||L.$sc;e.append(l),l.data("instance",L);var t=e.scrollTop()-("static"!=e.css("position")?e.offset().top:0),i=e.scrollLeft()-("static"!=e.css("position")?e.offset().left:0);i-=L.helpers.getPX(e.css("border-left-width")),t-=L.helpers.getPX(e.css("border-top-width")),L.$el.is("img")&&L.$sc.is("body")&&(i=t=0);var n=lt();dt()&&(n=n.find(".fr-img-wrap"));var a=0,r=0;L.opts.iframe&&(a=L.helpers.getPX(L.$wp.find(".fr-iframe").css("padding-top")),r=L.helpers.getPX(L.$wp.find(".fr-iframe").css("padding-left"))),l.css("top",(L.opts.iframe?n.offset().top+a:n.offset().top+t)-1).css("left",(L.opts.iframe?n.offset().left+r:n.offset().left+i)-1).css("width",n.get(0).getBoundingClientRect().width).css("height",n.get(0).getBoundingClientRect().height).addClass("fr-active")}function H(e){return'<div class="fr-handler fr-h'.concat(e,'"></div>')}function K(e){dt()?x.parents(".fr-img-caption").css("width",e):x.css("width",e)}function Y(e){if(!L.core.sameInstance(l))return!0;if(e.preventDefault(),e.stopPropagation(),L.$el.find("img.fr-error").left)return!1;L.undo.canDo()||L.undo.saveStep();var t=e.pageX||e.originalEvent.touches[0].pageX;if("mousedown"==e.type){var i=L.$oel.get(0).ownerDocument,n=i.defaultView||i.parentWindow,a=!1;try{a=n.location!=n.parent.location&&!(n.$&&n.$.FE)}catch(o){}a&&n.frameElement&&(t+=L.helpers.getPX(S(n.frameElement).offset().left)+n.frameElement.clientLeft)}(d=S(this)).data("start-x",t),d.data("start-width",x.width()),d.data("start-height",x.height());var r=x.width();if(L.opts.imageResizeWithPercent){var s=x.parentsUntil(L.$el,L.html.blockTagsQuery()).get(0)||L.el;r=(r/S(s).outerWidth()*100).toFixed(2)+"%"}K(r),f.show(),L.popups.hideAll(),rt()}function V(e){if(!L.core.sameInstance(l))return!0;var t;if(d&&x){if(e.preventDefault(),L.$el.find("img.fr-error").left)return!1;var i=e.pageX||(e.originalEvent.touches?e.originalEvent.touches[0].pageX:null);if(!i)return!1;var n=i-d.data("start-x"),a=d.data("start-width");if((d.hasClass("fr-hnw")||d.hasClass("fr-hsw"))&&(n=0-n),L.opts.imageResizeWithPercent){var r=x.parentsUntil(L.$el,L.html.blockTagsQuery()).get(0)||L.el;a=((a+n)/S(r).outerWidth()*100).toFixed(2),L.opts.imageRoundPercent&&(a=Math.round(a)),K("".concat(a,"%")),(t=dt()?(L.helpers.getPX(x.parents(".fr-img-caption").css("width"))/S(r).outerWidth()*100).toFixed(2):(L.helpers.getPX(x.css("width"))/S(r).outerWidth()*100).toFixed(2))===a||L.opts.imageRoundPercent||K("".concat(t,"%")),x.css("height","").removeAttr("height")}else a+n>=L.opts.imageMinWidth&&(K(a+n),t=dt()?L.helpers.getPX(x.parents(".fr-img-caption").css("width")):L.helpers.getPX(x.css("width"))),t!==a+n&&K(t),((x.attr("style")||"").match(/(^height:)|(; *height:)/)||x.attr("height"))&&(x.css("height",d.data("start-height")*x.width()/d.data("start-width")),x.removeAttr("height"));N(),L.events.trigger("image.resize",[ot()])}}function W(e){if(!L.core.sameInstance(l))return!0;if(d&&x){if(e&&e.stopPropagation(),L.$el.find("img.fr-error").left)return!1;d=null,f.hide(),N(),L.undo.saveStep(),L.events.trigger("image.resizeEnd",[ot()])}else l.removeClass("fr-active")}function G(){A.forEach(function(e,t){var i=L.popups.get("filesManager.insert");i.find(".fr-checkbox-file-"+t).get(0).disabled=!0,document.getElementById("fr-file-autoplay-button-"+t)&&(document.getElementById("fr-file-autoplay-button-"+t).disabled=!0,document.getElementById("fr-file-autoplay-button-"+t).parentElement.classList.add("fr-checkbox-disabled"),document.getElementById("fr-file-autoplay-button-"+t).parentElement.classList.remove("fr-files-checkbox")),i.find(".fr-checkbox-"+t).get(0).classList.remove("fr-files-checkbox"),i.find(".fr-checkbox-"+t).get(0).classList.add("fr-checkbox-disabled")})}function X(e,t,i,n){L.edit.on(),x&&x.addClass("fr-error"),h[e]?(e!=C&&e!=v&&e!=I||we(100,n,!0),A.set(n,h[e]),G(),function a(){A.forEach(function(e,t){L.popups.get("filesManager.insert"),document.getElementById("fr-file-edit-button-".concat(t))&&(document.getElementById("fr-file-edit-button-".concat(t)).classList.add("fr-disabled"),document.getElementById("fr-file-view-button-".concat(t)).classList.add("fr-disabled"),document.getElementById("fr-file-insert-button-".concat(t)).classList.add("fr-disabled"))})}(),ie(L.language.translate(h[e]),n)):ie(L.language.translate("Something went wrong. Please try again."),n),!x&&i&&je(i),L.events.trigger("filesManager.error",[{code:e,message:h[e]},t,i])}function j(){var e=L.popups.get("filesManager.insert"),t=e.find('.fr-command[data-cmd="insertAll"]'),i=e.find('.fr-command[data-cmd="deleteAll"]'),n=!0;R.forEach(function a(e,t,i){R.get(t)&&(n=!1)}),n?t.addClass("fr-disabled"):t.removeClass("fr-disabled"),n?i.addClass("fr-disabled"):i.removeClass("fr-disabled")}function q(e){B.get(e)&&B.get(e).link&&L.events.trigger("filesManager.removed",[B.get(e).link]);var t=L.popups.get("filesManager.insert");t.find(".fr-file-"+e).get(0)!==undefined&&(t.find(".fr-file-"+e).get(0).outerHTML=""),B["delete"](e),T["delete"](e),R["delete"](e),j(),0==T.size&&(u=0),A["delete"](e),L.popups.setPopupDimensions(t,!0),L.opts.toolbarBottom?y(!0):L.popups.setPopupDimensions(t),t.find(".fr-upload-progress")&&0==T.size&&t.find(".fr-upload-progress").addClass("fr-none")}function Z(){for(var e=L.popups.get("filesManager.insert"),t=e.find(".fr-insert-checkbox"),i=0;i<t.length;i++)t.get(i).children.target.checked=!1,e.find(".fr-file-"+t.get(i).id.split("-").pop()).get(0).classList.add("fr-unchecked");if(_)document.getElementById("fr-file-autoplay-button-".concat(_))&&(document.getElementById("fr-file-autoplay-button-".concat(_)).checked=!1),D=D.filter(function(e){return e!=_});else{for(var n=e.find(".fr-file-autoplay-button"),a=0;a<n.length;a++)n.get(a).checked=!1;D=[]}R=new Map,j()}function J(e){var t=L.popups.get("filesManager.insert");if(t||(t=Fe()),t.find(".fr-layer.fr-active").removeClass("fr-active").addClass("fr-pactive"),t.find(".fr-files-progress-bar-layer").addClass("fr-active"),t.find(".fr-buttons").hide(),x){var i=lt();L.popups.setContainer("filesManager.insert",L.$sc);var n=i.offset().left,a=i.offset().top+i.height();L.popups.show("filesManager.insert",n,a,i.outerHeight())}void 0===e&&ee(L.language.translate("Uploading"),0)}function Q(e){var t=L.popups.get("filesManager.insert");if(t&&(t.find(".fr-layer.fr-pactive").addClass("fr-active").removeClass("fr-pactive"),t.find(".fr-files-progress-bar-layer").removeClass("fr-active"),t.find(".fr-buttons").show(),e||L.$el.find("img.fr-error").length)){if(L.events.focus(),L.$el.find("img.fr-error").length&&(L.$el.find("img.fr-error").remove(),L.undo.saveStep(),L.undo.run(),L.undo.dropRedo()),!L.$wp&&x){var i=x;it(!0),L.selection.setAfter(i.get(0)),L.selection.restore()}L.popups.hide("filesManager.insert")}}function ee(e,t){var i=L.popups.get("filesManager.insert");if(i){var n=i.find(".fr-files-progress-bar-layer");n.find("h3").text(e+(t?" ".concat(t,"%"):"")),n.removeClass("fr-error"),t?(n.find("div").removeClass("fr-indeterminate"),n.find("div > span").css("width","".concat(t,"%"))):n.find("div").addClass("fr-indeterminate")}}function te(e){J();var t=L.popups.get("filesManager.insert").find(".fr-files-progress-bar-layer");t.addClass("fr-error");var i=t.find("h3");i.text(e),L.events.disableBlur(),i.focus()}function ie(e,t){var i=L.popups.get("filesManager.insert"),n=i.find(".fr-upload-progress-layer"),a=i.find(".fr-file-".concat(t));n.addClass("fr-error"),a.find("h5").text(e)}h[U]="File cannot be loaded from the passed link.",h[v]="No link in upload response.",h[C]="Error during file upload.",h[I]="Parsing response failed.",h[z]="File is too large.",h[O]="File type is invalid.",h[7]="Files can be uploaded only to same domain in IE 8 and IE 9.",h[8]="File is corrupted.",h[9]="Error during file loading.",h[$]="File upload cancelled";var i,ne,ae,re,se,oe,n,le,de,fe,ce="";function pe(e){ce=e,i=document.getElementsByClassName(e),Array.prototype.map.call(i,function(e){!function n(e){if(e.addEventListener("dragover",function(e){e.preventDefault(),e.stopPropagation(),ne=e.pageX,ae=e.pageY;var t=document.getElementById("filesList");ae+20>t.getBoundingClientRect().bottom&&ge(t,0,10),ae-20<t.getBoundingClientRect().top&&ge(t,0,-10)},!1),L.helpers.isMobile()){var t=e.getElementsByClassName("dot");t[0].addEventListener("touchmove",function(e){e.preventDefault(),e.stopPropagation();for(var t=e.target;t&&!t.classList.contains(ce);)t=t.parentElement;for(var i=document.elementFromPoint(e.targetTouches[0].clientX,e.targetTouches[0].clientY);i&&!i.classList.contains(ce);)i=i.parentElement;var n=document.getElementsByClassName("fr-hovered-over-file");Array.prototype.forEach.call(n,function(e){e.classList.remove("fr-hovered-over-file")}),i&&!t.classList.contains("fr-unchecked")&&i.classList.add("fr-hovered-over-file");var a=document.getElementById("filesList");e.targetTouches[0].clientY+5>a.getBoundingClientRect().bottom&&ge(a,0,5),e.targetTouches[0].clientY-5<a.getBoundingClientRect().top&&ge(a,0,-5)},!1)}if(e.ondrag=ue,e.ondragend=me,L.helpers.isMobile()){var i=e.getElementsByClassName("dot");i[0].addEventListener("touchmove",ue,!1),i[0].addEventListener("touchend",me,!1)}}(e)})}function ge(e,t,i){e.scrollLeft+=t,e.scrollTop+=i}function ue(e){for(L.helpers.isMobile()&&(se=event.touches[0].clientX,oe=event.touches[0].clientY),re=e.target;!re.classList.contains(ce);)re=re.parentElement;re.classList.contains(ce)&&!re.classList.contains("fr-unchecked")?L.helpers.isMobile()&&re.classList.add("drag-sort-active"):re=undefined}function me(e){var t;if(re!==undefined){var i,n;if(L.helpers.isMobile())for(i=se,n=oe,t=event.target;!t.classList.contains(ce);)t=t.parentElement;else i=event.clientX,n=event.clientY;L.helpers.isMobile()||!L.browser.safari&&!L.browser.mozilla||(i=ne,n=ae);for(var a=document.elementFromPoint(i,n);a&&!a.classList.contains(ce);)a=a.parentElement;a&&!a.classList.contains(ce)?a=undefined:a&&re!==a&&function o(e,t){var i,n,a=e.parentNode,r=t.parentNode;if(!a||!r||a.isEqualNode(t)||r.isEqualNode(e))return;for(var s=0;s<a.children.length;s++)a.children[s].isEqualNode(e)&&(i=s);for(var s=0;s<r.children.length;s++)r.children[s].isEqualNode(t)&&(n=s);a.isEqualNode(r)&&i<n&&n++;a.insertBefore(t,a.children[i]),r.insertBefore(e,r.children[n])}(re,a),L.helpers.isMobile()&&(t.classList.remove("fr-hovered-over-file"),a.classList.remove("fr-hovered-over-file"))}}function ve(e){var n=L.popups.get("filesManager.insert");n.find(".fr-upload-progress-layer").hasClass("fr-active")||n.find(".fr-upload-progress-layer").addClass("fr-active"),n.find(".fr-upload-progress").removeClass("fr-none");var t=T.get(e),i=function s(e){var t,i={weekday:"long",year:"numeric",month:"long",day:"numeric"};try{t=e.toLocaleDateString(L.opts.language?L.opts.language:undefined,i)}catch(n){t=e.toLocaleDateString(undefined,i)}return t+""}(new Date),a=R.get(e)?"":"fr-unchecked ",r="\n <div id='fr-file-".concat(e,"' class='fr-file-list-item fr-file-").concat(e," ").concat(a,"' draggable = \"").concat(!a,'" >\n <div class=\'fr-file-item-left\' >\n\n \n <div class="fr-file-item-insert-checkbox fr-files-checkbox-line">\n ').concat(L.helpers.isMobile()?"<div id='fr-pick-".concat(e,"}' class='dot'>\n </div>"):"",'\n <div id="checkbox-key-').concat(e,'" class="fr-files-checkbox fr-insert-checkbox fr-checkbox-').concat(e,'">\n <input name="target" class="fr-insert-attr fr-checkbox-file-').concat(e,' fr-file-insert-check" data-cmd="fileInsertCheckbox"\n data-checked="_blank" type="checkbox" id="fr-link-target-').concat(L.id,'" tabIndex="0" />\n <span>').concat('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10" viewBox="0 0 32 32"><path d="M27 4l-15 15-7-7-5 5 12 12 20-20z" fill="#FFF"></path></svg>','\n </span>\n </div>\n <label id="fr-label-target-').concat(L.id,"\"></label>\n </div>\n \n <div class='fr-file-item-icon fr-file-item-icon-").concat(e,"' >\n <img src='https://secure.webtoolhub.com/static/resources/icons/set112/f2afb6f7.png' alt='Image preview' class='fr-thumbnail-padding' height='36px' width='36px' />\n </div>\n\n <div class='fr-file-item-description' >\n <div class='fr-file-name fr-files-manager-tooltip'>\n ").concat(function o(e,t,i){null==t&&(t=100);null==i&&(i="...");return e.length>t?e.substring(0,t-i.length)+i:e}(t.name,20),'\n <span class="').concat(20<t.name.length?"tooltiptext":"fr-none",'">').concat(t.name,"\n </span>\n </div>\n <div class='fr-file-details'>\n <div class='fr-file-date'>").concat(i,"\n </div>\n \n <div class='fr-file-size'>\n ").concat(function l(e){if(0==e)return"0 Bytes";var t=Math.floor(Math.log(e)/Math.log(1024));return" | "+1*(e/Math.pow(1024,t)).toFixed(2)+" "+["Bytes","KB","MB","GB","TB"][t]}(t.size),"\n </div>\n </div>\n\n <div class='fr-file-error'>\n <h5 class='fr-file-error-h5'></h5>\n </div>\n </div>\n \n </div>\n\n <div class='fr-file-item-right fr-file-item-right-").concat(e,"'>")+ye(e)+"</div>\n </div>";n.find(".fr-upload-progress-layer")[0].innerHTML=r+n.find(".fr-upload-progress-layer")[0].innerHTML,T.forEach(function d(e,t,i){R.get(t)&&n.find("input.fr-insert-attr.fr-checkbox-file-".concat(t))[0].setAttribute("checked",null)}),D.forEach(function(e){document.getElementById("fr-file-autoplay-button-"+e).checked=!0}),be(e,t),Q(),L.opts.toolbarBottom?y(!0):L.popups.setPopupDimensions(n),pe("fr-file-list-item")}function he(e){switch(e){case"application/msword":return L.icon.getFileIcon("docIcon");case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return L.icon.getFileIcon("docxIcon");case"image/gif":return L.icon.getFileIcon("gifIcon");case"image/jpeg":return L.icon.getFileIcon("jpegIcon");case"image/jpeg":return L.icon.getFileIcon("jpgIcon");case"type/text":return L.icon.getFileIcon("logIcon");case"video/quicktime":return L.icon.getFileIcon("movIcon");case"audio/mp3":case"audio/mpeg":return L.icon.getFileIcon("mp3Icon");case"video/mp4":return L.icon.getFileIcon("mp4Icon");case"audio/ogg":return L.icon.getFileIcon("oggIcon");case"video/ogg":return L.icon.getFileIcon("ogvIcon");case"application/pdf":return L.icon.getFileIcon("pdfIcon");case"image/png":return L.icon.getFileIcon("pngIcon");case"text/plain":return L.icon.getFileIcon("txtIcon");case"video/webm":return L.icon.getFileIcon("webmIcon");case"image/webp":return L.icon.getFileIcon("webpIcon");case"video/x-ms-wmv":return L.icon.getFileIcon("wmvIcon");case"application/vnd.ms-excel":return L.icon.getFileIcon("xlsIcon");case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return L.icon.getFileIcon("xlsxIcon");case"application/x-zip-compressed":case"application/zip":return L.icon.getFileIcon("zipIcon");default:return L.icon.getFileIcon("defaultIcon")}}function be(n,a,e){var r=L.popups.get("filesManager.insert"),t=r.find(".fr-file-item-icon-"+n).get(0);if(Ue(Le(a))&&"image/gif"!=Le(a)&&"image/webp"!=Le(a)){"a"!=t.children[0].localName&&(t.innerHTML="<a target='_blank' href=''>"+t.innerHTML+"</a>");r.find(".fr-file-item-icon-"+n).get(0).children[0].children[0];var s=new FileReader;if(null!=e&&e){var i=T.get(n);a.name=i.name,T.set(n,a)}if(s.onloadend=function(){r.find(".fr-file-item-icon-"+n).get(0).children[0].children[0].src=s.result;for(var e=atob(s.result.split(",")[1]),t=[],i=0;i<e.length;i++)t.push(e.charCodeAt(i));r.find(".fr-file-item-icon-"+n).get(0).children[0].href=window.URL.createObjectURL(new Blob([new Uint8Array(t)],{type:Le(a)})),r.find(".fr-file-item-icon-"+n).get(0).classList.add("fr-file-item-thumbnail-hover")},a)s.readAsDataURL(a);else{var o=he(Le(a));t.innerHTML='<svg height="40px" width="40px" viewBox="0 0 55 5" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n '.concat(o.path,"\n </svg>")}}else{var l=he(Le(a));t.innerHTML='<svg height="40px" width="40px" viewBox="0 0 55 55" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n '.concat(l.path,"\n </svg>")}}function ye(e){var t="";if(Oe(Le(T.get(e)))){var i="fr-files-checkbox",n="";Pe(Le(T.get(e)))||(i="fr-checkbox-disabled",n="disabled");t='\n <div class="fr-files-checkbox-line align-autoplay">\n <div id="checkbox-key-'.concat(e,'" class="').concat(i," fr-autoplay-checkbox fr-checkbox-").concat(e,'"> \n \n <input type="checkbox" id="fr-file-autoplay-button-').concat(e,'" class="fr-file-button-').concat(e,' fr-file-autoplay-button" data-title="Edit" data-param1="').concat(e,'" role="button" ').concat(n,"/>\n\n <span>").concat('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10" viewBox="0 0 32 32"><path d="M27 4l-15 15-7-7-5 5 12 12 20-20z" fill="#FFF"></path></svg>'," </span>\n </div> \n <label class='fr-autoplay-checkbox-label'>Autoplay </label>\n </div>")}var a="application/msword",r="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s="";return!$e(Le(T.get(e)))&&Pe(Le(T.get(e)))||(o="fr-disabled"),Oe(Le(T.get(e)))&&(o="fr-disabled"),ze(Le(T.get(e)))&&(o="fr-disabled",Le(T.get(e))!=a&&Le(T.get(e))!=r||L.opts.googleOptions&&!L.helpers.isMobile()&&L.opts.googleOptions.API_KEY&&L.opts.googleOptions.CLIENT_ID&&(o=""),"text/plain"!=Le(T.get(e))&&Le(T.get(e))!=a&&"application/pdf"!=Le(T.get(e))&&Le(T.get(e))!=r&&"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"!=Le(T.get(e))&&"application/vnd.ms-excel"!=Le(T.get(e))&&"type/text"!=Le(T.get(e))||(s="")),"video/url"===Le(T.get(e))&&(o="fr-disabled"),t+='<div class=\'fr-file-item-action-buttons\' >\n <button type="button" id="fr-file-insert-button-'.concat(e,'" class=" fr-doc-edit-').concat(e," fr-img-icon fr-btn fr-command fr-submit fr-file-action-icons \n fr-file-button-").concat(e," fr-file-insert-button-").concat(e,' fr-file-insert-button" data-cmd="imageInsertByUpload" data-title="Insert" data-param1="').concat(e,'" tabIndex="2" role="button">\n <svg style=\'margin:0px !important; opacity:0.9\' class = "fr-svg" focusable="false" width="16px" height="16px" viewBox = "-5 0 28 28" xlmns = "http://w3.org/200/svg"><path d = \'M 9.25 12 L 6.75 12 C 6.335938 12 6 11.664062 6 11.25 L 6 6 L 3.257812 6 C 2.703125 6 2.425781 5.328125 2.820312 4.933594 L 7.570312 0.179688 C 7.804688 -0.0546875 8.191406 -0.0546875 8.425781 0.179688 L 13.179688 4.933594 C 13.574219 5.328125 13.296875 6 12.742188 6 L 10 6 L 10 11.25 C 10 11.664062 9.664062 12 9.25 12 Z M 16 11.75 L 16 15.25 C 16 15.664062 15.664062 16 15.25 16 L 0.75 16 C 0.335938 16 0 15.664062 0 15.25 L 0 11.75 C 0 11.335938 0.335938 11 0.75 11 L 5 11 L 5 11.25 C 5 12.214844 5.785156 13 6.75 13 L 9.25 13 C 10.214844 13 11 12.214844 11 11.25 L 11 11 L 15.25 11 C 15.664062 11 16 11.335938 16 11.75 Z M 12.125 14.5 C 12.125 14.15625 11.84375 13.875 11.5 13.875 C 11.15625 13.875 10.875 14.15625 10.875 14.5 C 10.875 14.84375 11.15625 15.125 11.5 15.125 C 11.84375 15.125 12.125 14.84375 12.125 14.5 Z M 14.125 14.5 C 14.125 14.15625 13.84375 13.875 13.5 13.875 C 13.15625 13.875 12.875 14.15625 12.875 14.5 C 12.875 14.84375 13.15625 15.125 13.5 15.125 C 13.84375 15.125 14.125 14.84375 14.125 14.5 Z M 14.125 14.5 \'></path></svg>\n </button>\n\n <button type="button" id="fr-file-edit-button-').concat(e,'" class=" fr-doc-edit-').concat(e," ").concat(o," fr-img-icon fr-btn fr-command fr-submit \n fr-file-action-icons fr-file-edit-button-").concat(e," fr-file-button-").concat(e,' fr-file-edit-button" data-cmd="editImage" data-title="Edit" data-param1="').concat(e,'" role="button">\n <svg style=\'margin:0px !important; opacity:0.9\' class = "fr-svg" focusable="false" width="16px" height="16px" viewBox = "0 4 25 25" xlmns = "http://w3.org/200/svg"><path d = \'M17,11.2L12.8,7L5,14.8V19h4.2L17,11.2z M7,16.8v-1.5l5.6-5.6l1.4,1.5l-5.6,5.6H7z M13.5,6.3l0.7-0.7c0.8-0.8,2.1-0.8,2.8,0 c0,0,0,0,0,0L18.4,7c0.8,0.8,0.8,2,0,2.8l-0.7,0.7L13.5,6.3z\'></path></svg>\n </button>\n \n <span class="fr-file-view-').concat(e,'"><button type="button" id="fr-file-view-button-').concat(e,'" class=" fr-doc-edit-').concat(e," ").concat(s," fr-img-icon fr-btn fr-command fr-submit fr-file-action-icons \n fr-file-view-button-").concat(e,' fr-file-view-button" data-cmd="viewImage" data-title="View" data-param1="').concat(e,'" tabIndex="2" role="button">\n <svg style=\'margin:0px !important; opacity:0.9\' class = "fr-svg" focusable="false" width="16px" height="16px" viewBox = "15 19 21 21" xlmns = "http://w3.org/200/svg"> <path style="fill:none;stroke-width:0.9077;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 19.086094 16.541466 C 16.185625 16.541466 14.318281 19.447115 14.318281 19.447115 L 14.318281 19.555288 C 14.318281 19.555288 16.176719 22.475962 19.077187 22.475962 C 21.977656 22.475962 23.847969 19.576322 23.847969 19.576322 L 23.847969 19.465144 C 23.847969 19.465144 21.989531 16.541466 19.086094 16.541466 Z M 19.07125 21.024639 C 18.248906 21.024639 17.583906 20.357572 17.583906 19.53726 C 17.583906 18.716947 18.248906 18.04988 19.07125 18.04988 C 19.890625 18.04988 20.555625 18.716947 20.555625 19.53726 C 20.555625 20.357572 19.890625 21.024639 19.07125 21.024639 Z M 19.07125 21.024639 " transform="matrix(1.315789,0,0,1.3,0,0)"/></svg></button></span>\n\n <button type="button" id="fr-file-delete-button-').concat(e,'" class=" fr-doc-edit-').concat(e," fr-img-icon fr-btn fr-command fr-submit fr-file-action-icons\n fr-file-button-").concat(e,' fr-file-delete-button" data-cmd="deleteImage" data-title="Delete" data-param1="').concat(e,'" role="button">\n <svg style=\'margin:0px !important; opacity:0.9\' class = "fr-svg" focusable="false" width="16px" height="16px" viewBox = "-2 3 30 30" xlmns = "http://w3.org/200/svg"><path d = \'M15,10v8H9v-8H15 M14,4H9.9l-1,1H6v2h12V5h-3L14,4z M17,8H7v10c0,1.1,0.9,2,2,2h6c1.1,0,2-0.9,2-2V8z\'></path></svg>\n </button>\n \n </div>\n <div id="user_area-').concat(e,"\" style=\"display: none;\">\n \n <div id=\"file_container\"></div>\n\n <div style='display:block;text-align: center; margin-left:50%; id='edit-file-loader' class='fr-file-loader'></div>\n\n </div> \n ")}function we(e,t,i){var n=L.popups.get("filesManager.insert");if(!i&&e<=100){n.find(".fr-checkbox-file-"+t).get(0).disabled=!0,n.find(".fr-checkbox-"+t).get(0).classList.remove("fr-files-checkbox"),n.find(".fr-checkbox-"+t).get(0).classList.add("fr-checkbox-disabled");var a=n.find(".fr-file-progress-circle-"+t),r=n.find(".fr-file-upload-percent-"+t);return 50<e?a.get(0).setAttribute("class","fr-file-progress-circle-"+t+" progress-circle p"+Math.floor(e)+" over50"):a.get(0).setAttribute("class","fr-file-progress-circle-"+t+" progress-circle p"+Math.floor(e)),r.get(0).innerHTML=Math.floor(e)+"%",void xe(t,e,i)}i&&(n.find(".fr-checkbox-file-"+t).get(0).disabled=!1,n.find(".fr-checkbox-"+t).get(0).classList.remove("fr-checkbox-disabled"),n.find(".fr-checkbox-"+t).get(0).classList.add("fr-files-checkbox"),n.find(".fr-file-item-right-"+t).get(0).innerHTML=ye(t),xe(t,100,i))}function xe(e,t,i){var n=L.popups.get("filesManager.insert");n.find(".fr-progress-bar").removeClass("fr-none").addClass("fr-display-block"),n.find(".fr-upload-progress").hasClass("fr-height-set")&&L.popups.setFileListHeight(n);var a=0;k.set(e,t),k.forEach(function(e,t){a+=e}),a/=k.size,100==t&&i&&r++,n.find('.fr-command[data-cmd="filesUpload"]').addClass("fr-disabled"),n.find('.fr-command[data-cmd="filesByURL"]').addClass("fr-disabled"),n.find('.fr-command[data-cmd="filesEmbed"]').addClass("fr-disabled"),n.find(".fr-progress-bar").get(0).style.width=a+"%",r==k.size&&(n.find(".fr-progress-bar").removeClass("fr-display-block").addClass("fr-none"),k=new Map,r=0,n.find('.fr-command[data-cmd="filesUpload"]').removeClass("fr-disabled"),n.find('.fr-command[data-cmd="filesByURL"]').removeClass("fr-disabled"),n.find('.fr-command[data-cmd="filesEmbed"]').removeClass("fr-disabled"))}function Me(i,n){Q(),L.popups.get("filesManager.insert").find(".fr-upload-progress-layer").addClass("fr-active"),i.forEach(function(e,t){Ue(Le(e))&&L.opts.imageUploadRemoteUrls&&L.opts.imageCORSProxy&&L.opts.imageUpload?Be(e,i,x,n[t]):B.set(n[t],e)})}function Ee(e){e&&e.get&&function i(e){if("false"==S(this).parents("[contenteditable]").not(".fr-element").not(".fr-img-caption").not("body").first().attr("contenteditable"))return!0;if(e&&"touchend"==e.type&&fe)return!0;if(e&&L.edit.isDisabled())return e.stopPropagation(),e.preventDefault(),!1;for(var t=0;t<It.INSTANCES.length;t++)It.INSTANCES[t]!=L&&It.INSTANCES[t].events.trigger("image.hideResizer");L.toolbar.disable(),e&&(e.stopPropagation(),e.preventDefault());L.helpers.isMobile()&&(L.events.disableBlur(),L.$el.blur(),L.events.enableBlur());L.opts.iframe&&L.size.syncIframe();x=S(this),N(),L.browser.msie?(L.popups.areVisible()&&L.events.disableBlur(),L.win.getSelection&&(L.win.getSelection().removeAllRanges(),L.win.getSelection().addRange(L.doc.createRange()))):L.selection.clear();L.helpers.isIOS()&&(L.events.disableBlur(),L.$el.blur());L.button.bulkRefresh(),L.events.trigger("video.hideResizer")}.call(e.get(0))}function ke(){var e=S(this);e.removeClass("fr-uploading"),e.next().is("br")&&e.next().remove(),(0==a.length||0<a.length&&a.length==g)&&(c=e),"VIDEO"==e.get(0).tagName||"AUDIO"==e.get(0).tagName?L.selection.setAfter(e.parent()):L.selection.setAfter(e),L.undo.saveStep(),L.events.trigger("filesManager.loaded",[e]),Ce(a)}function Ae(){var e,t=Array.prototype.slice.call(L.el.querySelectorAll("video, .fr-video > *")),i=[];for(e=0;e<t.length;e++)i.push(t[e].getAttribute("src")),S(t[e]).toggleClass("fr-draggable",L.opts.videoMove),""===t[e].getAttribute("class")&&t[e].removeAttribute("class"),""===t[e].getAttribute("style")&&t[e].removeAttribute("style");if(n)for(e=0;e<n.length;e++)i.indexOf(n[e].getAttribute("src"))<0&&L.events.trigger("video.removed",[S(n[e])]);n=t}function Ce(e){if(null!=e){if(0==e.length)return void(null!=c&&("VIDEO"==c.get(0).tagName?L.video._editVideo(c.parent()):"IMG"==c.get(0).tagName?L.image.edit(c):c.trigger("click"),L.toolbar.disable()));_e(e.shift(),e)}}function Ie(e){var t=!1;if(Oe(Le(B.get(e))))L.trimVideoPlugin.trimVideo(T.get(e),e,T),t=!0;else if(Ue(Le(B.get(e)))){var i=B.get(e).link,n=L.o_doc.createElement("img");n.src=i,x=n,s=e,L.imageTUI.launch(L,!1,e),t=!0}else if(ze(Le(B.get(e)))){var a={apiKey:L.opts.googleOptions.API_KEY,clientId:L.opts.googleOptions.CLIENT_ID,authorizeButton:"authorize_button-".concat(e),signoutButton:"signout_button",userArea:"user_area-".concat(e),fileInput:"file_input",fileIndex:e,file:T.get(e),fileContainer:"file_container",loadingText:"File is being uploaded...",events:{onInvalidFile:function(e){},onError:function(e){}}};de=function f(p){var r,e=["https://www.googleapis.com/discovery/v1/apis/drive/v2/rest"],g="id,title,mimeType,userPermission,editable,copyable,shared,fileSize",u="-------314159265358979323846",m="\r\n--"+u+"\r\n",v="\r\n--"+u+"--",t=(document.getElementById(p.authorizeButton),document.getElementById(p.userArea));p.events||(p.events={});function i(){gapi.client.init({apiKey:p.apiKey,clientId:p.clientId,discoveryDocs:e,scope:"https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.appdata"}).then(function(){gapi.auth2.getAuthInstance().isSignedIn.listen(n),n(gapi.auth2.getAuthInstance().isSignedIn.get()),function t(e){!gapi.auth2.getAuthInstance().isSignedIn.get()||gapi.auth.getToken()!==undefined&&gapi.auth.getToken().access_token===undefined?Promise.resolve(gapi.auth2.getAuthInstance().signIn()).then(function(){s()}):s()}()},function(e){p.events.onError(e)})}function n(e){e&&(t.style.display="block")}function a(e){var t=gapi.auth.getToken().access_token,i=r,n="https://docs.google.com/feeds/download/documents/export/Export?id="+i+"&format=docx&access_token="+t,a=new XMLHttpRequest;a.open("get",n),a.responseType="arraybuffer",a.onload=function(){var e=new Blob([new Uint8Array(this.response)],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}),t=T.get(p.fileIndex);e.name=t.name,e.lastModified=t.lastModified,e.lastModifiedDate=t.lastModifiedDate,T.set(p.fileIndex,e),L.filesManager.upload(e,B,x,p.fileIndex),l()},a.send()}function s(e){!function n(e){for(var t=document.getElementsByClassName("fr-doc-edit-".concat(e)),i=0;i<t.length;i++)t[i].setAttribute("disabled",!0),t[i].classList.add("fr-disabled")}(p.fileIndex);var t=p.file;t?function i(d,f){var c=new FileReader;c.readAsArrayBuffer(d),c.onload=function(e){for(var t={title:d.name,mimeType:"application/vnd.google-apps.document"},i="",n=new Uint8Array(c.result),a=n.byteLength,r=0;r<a;r++)i+=String.fromCharCode(n[r]);var s=btoa(i),o=m+"Content-Type: application/json; charset=UTF-8\r\n\r\n"+JSON.stringify(t)+m+"Content-Type: application/octet-stream\r\nContent-Transfer-Encoding: base64\r\n\r\n"+s+v,l=gapi.client.request({path:"/upload/drive/v2/files",method:"POST",params:{uploadType:"multipart",fields:g},headers:{"Content-Type":'multipart/related; boundary="'+u+'"',"Content-Length":o.Length},body:o});f||(f=function(e){}),l.execute(function(e,t){e.error?p.events.onError(e.error):f(e)})}}(t,o):p.events.onInvalidFile("File is not selected")}function o(e){r=e.id;var t="https://docs.google.com/document/d/"+e.id+"/edit",i=L.o_doc.body,n=L.o_doc.createElement("div");n.setAttribute("id","editDocContainer"),n.style.cssText="position: fixed; top: 0;left: 0;padding: 0;width: 100%;height: 100%;background: rgba(255,255,255,1);z-index: 9998;display:block",n.innerHTML='<div style="margin-top:25px; text-align:center"><label>Sign Out : </label><input type="checkbox" id ="markSignOut" role="button"/> <button id="signout_button" class="fr-trim-button" >Save </button> <button id="cancel_file_edit" class="fr-trim-button">Cancel</button></div> <iframe title="Edit your file" frameBorder="0" width="100%" height="700px" src="'+t+'"></iframe>',i.appendChild(n),document.getElementById("signout_button").onclick=a,document.getElementById("cancel_file_edit").onclick=l}function l(){document.getElementById("markSignOut").checked&&gapi.auth2.getAuthInstance().signOut().then(function(){gapi.auth.getToken()&&(gapi.auth.getToken().access_token=undefined)});var e=document.getElementById("editDocContainer");e.parentNode.removeChild(e),document.getElementById("user_area-".concat(p.fileIndex))&&(document.getElementById("user_area-".concat(p.fileIndex)).style.display="none"),function n(e){for(var t=document.getElementsByClassName("fr-doc-edit-".concat(e)),i=0;i<t.length;i++)t[i].removeAttribute("disabled"),t[i].classList.remove("fr-disabled")}(p.fileIndex)}p.events.onInvalidFile=p.events.onInvalidFile||function(e){},p.events.onError=p.events.onError||function(e){};var d={};return d.handleClientLoad=function(){gapi.load("client:auth2",i)},d}(a),function r(e,t){var n=function n(e,t){var i=document.createElement("script");i.src=e,i.onload=function(){this.onload=function(){},de.handleClientLoad()},i.onreadystatechange=function(){"complete"===this.readyState&&this.onload()},(document.getElementsByTagName("head")[0]||document.body).appendChild(i)};!function i(){0!=e.length?n(e.shift(),i):t&&t()}()}(["https://apis.google.com/js/api.js"],function(){})}t&&(p=!0)}function Le(e){var i;if(""!=e.type)return e.type;if(e.name&&e.name.endsWith(".msg"))return i="application/vnd.ms-outlook";var n=/(?:\.([^.]+))?$/.exec(e.name)[1];return[[".doc","application/msword"],[".docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],[".gif","image/gif"],[".jpeg","image/jpeg"],[".jpg","image/jpeg"],[".txt","text/plain"],[".log","type/text"],[".mov","video/quicktime"],[".mp3","audio/mpeg"],[".mp4","video/mp4"],[".ogg","audio/ogg"],[".ogv","video/ogg"],[".pdf","application/pdf"],[".png","image/png"],[".webm","video/webm"],[".webp","image/webp"],[".wmv","video/x-ms-wmv"],[".xls","application/vnd.ms-excel"],[".xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],[".zip","application/x-zip-compressed"],[".hex","application/octet-stream"]].forEach(function(e,t){e[0]==".".concat(n)&&(i=e[1])}),i}function _e(o,e){if(ze(Le(B.get(o)))||!Pe(Le(B.get(o)))){var t,i=B.get(o).link,n=B.get(o).text,a=B.get(o).data;!n&&T.get(o)&&T.get(o).name&&(n=T.get(o).name);var r=B.get(o).response;L.edit.on(),L.events.focus(!0),L.selection.restore(),L.opts.fileUseSelectedText&&L.selection.text().length&&(n=L.selection.text());var s='<a href="'.concat(i,'" target="_blank" id="fr-inserted-file" ');if(void 0!==a)for(t in a)a.hasOwnProperty(t)&&"link"!=t&&(s+="".concat(t,'="').concat(a[t],'" '));-1==s.indexOf(' class="')&&(s+='class="fr-file" '),s+=">".concat(n,"</a>"),L.html.insert(s);var l=L.$el.find("#fr-inserted-file");l.removeAttr("id"),L.undo.saveStep(),function A(){var e,t=Array.prototype.slice.call(L.el.querySelectorAll("a.fr-file")),i=[];for(e=0;e<t.length;e++)i.push(t[e].getAttribute("href"));if(le)for(e=0;e<le.length;e++)i.indexOf(le[e].getAttribute("href"))<0&&L.events.trigger("file.unlink",[le[e]]);le=t}(),L.selection.clear(),L.selection.setAfter(l),L.events.trigger("file.inserted",[l,r]),Ce(e)}if(Ue(Le(B.get(o)))&&Pe(Le(B.get(o)))){var d=B.get(o).link,f=B.get(o).sanitize,c=B.get(o).data,p=B.get(o).$existing_img,g=B.get(o).response;p&&"string"==typeof p&&(p=L.$(p)),L.edit.off(),ee(L.language.translate("Loading image")),f&&(d=L.helpers.sanitizeURL(d));var u=new Image;u.onload=function(){var e,t;if(p){L.undo.canDo()||p.hasClass("fr-uploading")||L.undo.saveStep();var i=p.data("fr-old-src");p.data("fr-image-pasted")&&(i=null),L.$wp?((e=p.clone().removeData("fr-old-src").removeClass("fr-uploading").removeAttr("data-fr-image-pasted")).off("load"),i&&p.attr("src",i),p.replaceWith(e)):e=p;for(var n=e.get(0).attributes,a=0;a<n.length;a++){var r=n[a];0===r.nodeName.indexOf("data-")&&e.removeAttr(r.nodeName)}if(void 0!==c)for(t in c)c.hasOwnProperty(t)&&"link"!=t&&e.attr("data-".concat(t),c[t]);e.on("load",ke),e.attr("src",d),L.edit.on(),L.undo.saveStep(),L.events.disableBlur(),L.$el.blur(),L.events.trigger(i?"image.replaced":"image.inserted",[e,g])}else e=function o(e,t,i){var n,a=S(document.createElement("img")).attr("src",e);if(t&&void 0!==t)for(n in t)t.hasOwnProperty(n)&&"link"!=n&&(" data-".concat(n,'="').concat(t[n],'"'),a.attr("data-".concat(n),t[n]));var r=L.opts.imageDefaultWidth;r&&"auto"!=r&&(r=L.opts.imageResizeWithPercent?"100%":"".concat(r,"px"));a.attr("style",r?"width: ".concat(r,";"):""),st(a,L.opts.imageDefaultDisplay,L.opts.imageDefaultAlign),a.on("load",i),a.on("error",i),L.edit.on(),L.events.focus(!0),L.selection.restore(),L.undo.saveStep(),L.opts.imageSplitHTML?L.markers.split():L.markers.insert();L.html.wrap();var s=L.$el.find(".fr-marker");s.length?(s.parent().is("hr")&&s.parent().after(s),L.node.isLastSibling(s)&&s.parent().hasClass("fr-deletable")&&s.insertAfter(s.parent()),s.replaceWith(a)):L.$el.append(a);return a}(d,c,ke),L.undo.saveStep(),L.events.disableBlur(),L.$el.blur(),L.events.trigger("image.inserted",[e,g])},u.onerror=function(){X(U,null,null,o),Ce(e)},u.src=d}if((Oe(Le(B.get(o)))||$e(Le(B.get(o))))&&Pe(Le(B.get(o))))if(_=o,"video/url"==Le(B.get(o))){var m=!1;if(document.getElementById("fr-file-autoplay-button-"+o)!==undefined&&(m=document.getElementById("fr-file-autoplay-button-"+o).checked),m&&B.get(o)!==undefined&&-1<B.get(o).video.indexOf("iframe")&&B.get(o).video.indexOf("autoplay=1")<0){var v=B.get(o).video.substring(B.get(o).video.indexOf("src")+3),h="&";(v=(v=v.substring(v.indexOf('"')+1)).substring(0,v.indexOf('"'))).indexOf("?")<0&&(h="?"),B.get(o).video=B.get(o).video.replace(v,v+=h+"autoplay=1&mute=1")}else!m&&B.get(o).video.indexOf(!1)&&(-1<B.get(o).video.indexOf("&autoplay=1")&&(B.get(o).video=B.get(o).video.replace("&autoplay=1","")),-1<B.get(o).video.indexOf("?autoplay=1")&&(B.get(o).video=B.get(o).video.replace("?autoplay=1","")));L.events.focus(!0),L.selection.restore(),L.html.insert('<span contenteditable="false" draggable="true" class="fr-jiv fr-video fr-deletable">'.concat(B.get(o).video,"</span>"),!1,L.opts.videoSplitHTML),L.popups.hide("filesManager.insert");var b=L.$el.find(".fr-jiv");b.removeClass("fr-jiv"),b.toggleClass("fr-rv",L.opts.videoResponsive),function C(e,t,i){!L.opts.htmlUntouched&&L.opts.useClasses?(e.removeClass("fr-fvl fr-fvr fr-dvb fr-dvi"),e.addClass("fr-fv".concat(i[0]," fr-dv").concat(t[0]))):"inline"==t?(e.css({display:"inline-block"}),"center"==i?e.css({"float":"none"}):"left"==i?e.css({"float":"left"}):e.css({"float":"right"})):(e.css({display:"block",clear:"both"}),"left"==i?e.css({textAlign:"left"}):"right"==i?e.css({textAlign:"right"}):e.css({textAlign:"center"}))}(b,L.opts.videoDefaultDisplay,L.opts.videoDefaultAlign),b.toggleClass("fr-draggable",L.opts.videoMove),L.events.trigger("video.inserted",[b]),ke.call(b)}else{var y=B.get(o).link,w=B.get(o).sanitize,x=B.get(o).data,M=B.get(o).$existing_img,E=B.get(o).response;L.edit.off(),w&&(y=L.helpers.sanitizeURL(y)),function I(){var e,t;if(M){L.undo.canDo()||M.find("video").hasClass("fr-uploading")||L.undo.saveStep();var i=M.find("video").data("fr-old-src"),n=M.data("fr-replaced");M.data("fr-replaced",!1),L.$wp?((e=M.clone(!0)).find("video").removeData("fr-old-src").removeClass("fr-uploading"),e.find("video").off("canplay"),i&&M.find("video").attr("src",i),M.replaceWith(e)):e=M;for(var a=e.find("video").get(0).attributes,r=0;r<a.length;r++){var s=a[r];0===s.nodeName.indexOf("data-")&&e.find("video").removeAttr(s.nodeName)}if(void 0!==x)for(t in x)x.hasOwnProperty(t)&&"link"!=t&&e.find("video").attr("data-".concat(t),x[t]);e.find("video").on("canplay",ke),e.find("video").attr("src",y),L.edit.on(),Ae(),L.undo.saveStep(),L.$el.blur(),L.events.trigger(n?"video.replaced":"video.inserted",[e,E])}else e=function g(e,t,i,n,a){var r,s="";if(t&&void 0!==t)for(r in t)t.hasOwnProperty(r)&&"link"!=r&&(s+=" data-".concat(r,'="').concat(t[r],'"'));var o,l=L.opts.videoDefaultWidth;l&&"auto"!=l&&(l="".concat(l,"px"));if($e(n))o=S(document.createElement("span")).attr("contenteditable","false").attr("draggable","true").attr("class","fr-video fr-dv"+L.opts.videoDefaultDisplay[0]+("center"!=L.opts.videoDefaultAlign?" fr-fv"+L.opts.videoDefaultAlign[0]:"")).html('<audio src="'+e+'" '+s+" controls>"+L.language.translate("Your browser does not support HTML5 video.")+"</audio>");else{var d="",f=document.getElementById("fr-file-autoplay-button-"+a).checked;f&&(d="autoplay"),o=S(document.createElement("span")).attr("contenteditable","false").attr("draggable","true").attr("class","fr-video fr-dv"+L.opts.videoDefaultDisplay[0]+("center"!=L.opts.videoDefaultAlign?" fr-fv"+L.opts.videoDefaultAlign[0]:"")).html('<video src="'+e+'" '+s+(l?' style="width: '+l+';" ':"")+d+" controls>"+L.language.translate("Your browser does not support HTML5 video.")+"</video>")}o.toggleClass("fr-draggable",L.opts.videoMove),L.edit.on(),L.events.focus(!0),L.selection.restore(),L.undo.saveStep(),L.opts.videoSplitHTML?L.markers.split():L.markers.insert();L.html.wrap();var c=L.$el.find(".fr-marker");L.node.isLastSibling(c)&&c.parent().hasClass("fr-deletable")&&c.insertAfter(c.parent());c.replaceWith(o);var p="";p=$e(n)?"audio":"video",o.find(p).get(0).readyState>o.find(p).get(0).HAVE_FUTURE_DATA||L.helpers.isIOS()?i.call(o.find(p).get(0)):(o.find(p).on("canplaythrough load",i),o.find(p).on("error",i));return o}(y,x,ke,Le(B.get(o)),o),Ae(),L.undo.saveStep(),L.events.trigger("video.inserted",[e,E])}()}L.popups.hide("filesManager.insert"),R["delete"](o);var k=L.popups.get("filesManager.insert");k.find("input.fr-insert-attr.fr-checkbox-file-".concat(o))[0].checked=!1,k.find(".fr-file-"+o).get(0).classList.add("fr-unchecked"),j(),document.getElementById("fr-file-autoplay-button-"+o)&&(document.getElementById("fr-file-autoplay-button-"+o).checked=!1),D=D.filter(function(e){return e!=o})}function Se(e,t){try{if(!1===L.events.trigger("filesManager.uploaded",[e],!0))return L.edit.on(),!1;var i=JSON.parse(e);return i.link?i:(X(v,e,null,t),!1)}catch(n){return X(I,e,null,t),!1}}function Te(e,t){try{var i=S(e).find("Location").text(),n=S(e).find("Key").text();return!1===L.events.trigger("filesManager.uploadedToS3",[i,n,e],!0)?(L.edit.on(),!1):i}catch(a){return X(I,e,null,t),!1}}function Be(e,t,i,n){if(-1<P.indexOf(Le(e))||!Le(e))return X(O,null,null,n),!1;if(!1===L.events.trigger("filesManager.beforeUpload",[t]))return!1;if(!(null!==L.opts.filesManagerUploadURL&&L.opts.filesManagerUploadURL!=M||L.opts.filesManagerUploadToS3||L.opts.filesManagerUploadToAzure))return function y(o,l,d){var f=new FileReader;f.onload=function(){var e=f.result;if(f.result.indexOf("svg+xml")<0){for(var t=atob(f.result.split(",")[1]),i=[],n=0;n<t.length;n++)i.push(t.charCodeAt(n));if(e=window.URL.createObjectURL(new Blob([new Uint8Array(i)],{type:Le(l)})),Ue(Le(l))){var a={link:e,sanitize:!1,data:null,$existing_img: