text: webpackJsonp([2],{303:function(e,t,n){(function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,Object.assign(e.POPUP_TEMPLATES,{"embedly.insert":"[_BUTTONS_][_URL_LAYER_]","embedly.edit":"[_BUTTONS_]"}),Object.assign(e.DEFAULTS,{embedlyKey:null,embedlyInsertButtons:["embedlyBack","|"],embedlyEditButtons:["embedlyRemove"],embedlyScriptPath:"https://cdn.embedly.com/widgets/platform.js"}),e.PLUGINS.embedly=function(t){var n,s,r=t.$;function o(s){t.events.on("html.processGet",d),s&&t.html._setHtml(t.$el,t.html.get()),t.events.$on(t.$el,"click touchend","div.fr-embedly",i),t.events.on("mousedown window.mousedown",u),t.events.on("window.touchmove",p),t.events.on("mouseup window.mouseup",c),t.events.on("commands.mousedown",function(e){0<e.parents(".fr-toolbar").length&&c()}),t.events.on("blur video.hideResizer commands.undo commands.redo element.dropped",function(){c(!0)}),t.events.on("element.beforeDrop",function(e){if(e.hasClass("fr-embedly"))return e.html(e.attr("data-original-embed")),e}),t.events.on("keydown",function(s){var r=s.which;return!n||r!=e.KEYCODE.BACKSPACE&&r!=e.KEYCODE.DELETE?n&&r==e.KEYCODE.ESC?(c(!0),s.preventDefault(),!1):n&&r!=e.KEYCODE.F10&&!t.keys.isBrowserAction(s)?(s.preventDefault(),!1):void 0:(s.preventDefault(),b(),!1)},!0),t.events.on("toolbar.esc",function(){if(n)return t.events.disableBlur(),t.events.focus(),!1},!0),t.events.on("toolbar.focusEditor",function(){if(n)return!1},!0),t.events.on("snapshot.after",function(e){var n=t.doc.createElement("div");n.innerHTML=e.html,d(n),e.html=n.innerHTML}),t.win.embedly&&(t.win.embedly("on","card.rendered",function(e){l(e)}),t.win.embedly("on","card.resize",function(e){l(e)})),a(!0)}function l(e){var n=r(e);n.parents(".fr-embedly").attr("contenteditable",!1).attr("draggable",!0).addClass("fr-draggable").css("height",n.height()).addClass("fr-draggable"),t.opts.iframe&&t.size.syncIframe()}function i(e){n=r(this),function(){s||(t.shared.$embedly_resizer?(s=t.shared.$embedly_resizer,t.shared.$embedly_overlay,t.events.on("destroy",function(){r("body").first().append(s)},!0)):(t.shared.$embedly_resizer=r(document.createElement("div")).attr("class","fr-embedly-resizer"),s=t.shared.$embedly_resizer,t.events.$on(s,"mousedown",function(e){e.stopPropagation()},!0)),t.events.on("shared.destroy",function(){s.html("").removeData().remove(),s=null},!0)),(t.$wp||t.$sc).append(s),s.data("instance",t);var e=0,o=0;t.opts.iframe&&(o=t.helpers.getPX(t.$wp.find(".fr-iframe").css("padding-top")),e=t.helpers.getPX(t.$wp.find(".fr-iframe").css("padding-left"))),s.css("top",(t.opts.iframe?n.offset().top+o-1+t.$iframe.position().top:n.offset().top-t.$wp.offset().top-1)+t.$wp.scrollTop()).css("left",(t.opts.iframe?n.offset().left+e-1:n.offset().left-t.$wp.offset().left-1)+t.$wp.scrollLeft()).css("width",n.outerWidth()).css("height",n.height()).addClass("fr-active")}(),function(){var e=t.popups.get("embedly.edit");if(e||(e=function(){var e="";if(0<t.opts.embedlyEditButtons.length){var s={buttons:e+='<div class="fr-buttons">\n      '.concat(t.button.buildList(t.opts.embedlyEditButtons),"\n      </div>")},r=t.popups.create("embedly.edit",s);return t.events.$on(t.$wp,"scroll.emebdly-edit",function(){var e;n&&t.popups.isVisible("embedly.edit")&&(t.events.disableBlur(),e=n,i.call(e.get(0)))}),r}return!1}()),e){t.popups.setContainer("embedly.edit",t.$sc),t.popups.refresh("embedly.edit");var s=n.offset().left+n.outerWidth()/2,r=n.offset().top+n.outerHeight();t.popups.show("embedly.edit",s,r,n.outerHeight())}}()}function d(e){if(e&&t.node.hasClass(e,"fr-embedly"))e.innerHTML=e.getAttribute("data-original-embed"),e.removeAttribute("draggable"),e.removeAttribute("contenteditable"),e.setAttribute("class",(e.getAttribute("class")||"").replace("fr-draggable",""));else if(e&&e.nodeType==Node.ELEMENT_NODE)for(var n=e.querySelectorAll(".fr-embedly"),s=0;s<n.length;s++)d(n[s])}function a(e){if(e)return t.popups.onRefresh("embedly.insert",f),!0;var n="";0<t.opts.embedlyInsertButtons.length&&(n+='<div class="fr-buttons fr-tabs">',n+=t.button.buildList(t.opts.embedlyInsertButtons),n+="</div>");var s={buttons:n,url_layer:'<div class="fr-embedly-layer fr-active fr-layer" id="fr-embedly-layer-'+t.id+'"><div class="fr-input-line"><input id="fr-embedly-layer-text-'+t.id+'" type="text" placeholder="'+t.language.translate("Paste in a URL to embed")+'" tabIndex="1" aria-required="true"></div><div class="fr-action-buttons"><button type="button" class="fr-command fr-submit" data-cmd="embedlyInsert" tabIndex="2" role="button">'+t.language.translate("Insert")+"</button></div></div>"};return t.popups.create("embedly.insert",s)}function f(){t.popups.get("embedly.insert").find(".fr-embedly-layer input").val("").trigger("change")}function m(e){if(e.length){var n="<a href='"+e+"' data-card-branding='0' class='embedly-card'"+(t.opts.embedlyKey?" data-card-key='"+t.opts.embedlyKey+"'":"")+"></a>";t.html.insert('<div class="fr-embedly fr-draggable" draggable="true" contenteditable="false" data-original-embed="'+n+'">'+n+"</div>"),t.popups.hideAll()}}function b(){if(n&&!1!==t.events.trigger("embedly.beforeRemove",[n])){var e=n;t.popups.hideAll(),c(!0),t.selection.setBefore(e.get(0))||t.selection.setAfter(e.get(0)),e.remove(),t.selection.restore(),t.html.fillEmptyBlocks(),t.undo.saveStep(),t.events.trigger("video.removed",[e])}}function c(e){n&&(t.shared.embedly_exit_flag||!0===e)&&(s.removeClass("fr-active"),t.toolbar.enable(),n.removeClass("fr-active"),n=null,p())}function u(){t.shared.embedly_exit_flag=!0}function p(){t.shared.embedly_exit_flag=!1}return t.shared.embedly_exit_flag=!1,{_init:function(){if(!t.$wp)return!1;if("undefined"!=typeof embedly)o(!0);else if(t.shared.embedlyLoaded)t.shared.embedlyCallbacks.push(o);else{t.shared.embedlyLoaded=!0,t.shared.embedlyCallbacks=[],t.shared.embedlyCallbacks.push(o);var e=t.doc.createElement("script");e.type="text/javascript",e.src=t.opts.embedlyScriptPath,e.innerText="",e.onload=function(){if(t.shared.embedlyCallbacks)for(var e=0;e<t.shared.embedlyCallbacks.length;e++)t.shared.embedlyCallbacks[e]()},t.doc.getElementsByTagName("head")[0].appendChild(e)}},showInsertPopup:function(){var e=t.$tb.find('.fr-command[data-cmd="embedly"]'),n=t.popups.get("embedly.insert");if(n||(n=a()),!n.hasClass("fr-active"))if(t.popups.refresh("embedly.insert"),t.popups.setContainer("embedly.insert",t.$tb),e.isVisible()){var s=t.button.getPosition(e),r=s.left,o=s.top;t.popups.show("embedly.insert",r,o,e.outerHeight())}else t.position.forSelection(n),t.popups.show("embedly.insert")},insert:function(){m(t.popups.get("embedly.insert").find(".fr-embedly-layer input").val())},remove:b,get:function(){return n},add:m,back:function(){n?(t.events.disableBlur(),n.trigger("click")):(t.events.disableBlur(),t.selection.restore(),t.events.enableBlur(),t.popups.hide("embedly.insert"),t.toolbar.showInline())}}},e.DefineIcon("embedly",{NAME:"share-alt",SVG_KEY:"insertEmbed"}),e.RegisterCommand("embedly",{undo:!0,focus:!0,title:"Embed URL",popup:!0,callback:function(){this.popups.isVisible("embedly.insert")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("embedly.insert")):this.embedly.showInsertPopup()},plugin:"embedly"}),e.RegisterCommand("embedlyInsert",{undo:!0,focus:!0,callback:function(){this.embedly.insert()}}),e.DefineIcon("embedlyRemove",{NAME:"trash",SVG_KEY:"remove"}),e.RegisterCommand("embedlyRemove",{title:"Remove",undo:!1,callback:function(){this.embedly.remove()}}),e.DefineIcon("embedlyBack",{NAME:"arrow-left",SVG_KEY:"back"}),e.RegisterCommand("embedlyBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.embedly.back()},refresh:function(e){this.embedly.get()||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}})})(n(82))}});