/* Tiny PowerPaste plugin
*
* Copyright 2010-2019 Tiny Technologies LLC. All rights reserved.
*
* Version: 4.0.1-317
*/
!function(y){"use strict";var n=function(e){return parseInt(e,10)},r=function(e,t,n){return{major:e,minor:t,patch:n}},o=function(e){var t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?r(n(t[1]),n(t[2]),n(t[3])):r(0,0,0)},i=function(e,t){var n=e-t;return 0===n?0:0=a.length&&r(o)}))})})},ze=function(e){return Ge(e,Xe.nu)},Ke=function(e,t){var n=W(e,t);return ze(n)},Ze=0,Je=function(e){var t=(new Date).getTime();return e+"_"+Math.floor(1e9*Math.random())+ ++Ze+String(t)},Qe=function(n){var r,o=!1;return function(){for(var e=[],t=0;tAdobe Flash Player.',"cement.dialog.flash.press-escape":'Press "Close" to paste your content without images.',"loading.wait":"Please wait...","flash.clipboard.no.rtf":tinymce.Env.mac&&tinymce.Env.webkit?'Your browser security settings may be preventing images from being imported. More information on paste for Safari ':"Your browser security settings may be preventing images from being imported.","safari.imagepaste":'Safari does not support direct paste of images. More information on image pasting for Safari ',"webview.imagepaste":'Safari does not support direct paste of images. More information on image pasting for Safari ',"error.code.images.not.found":"The images service was not found: (","error.imageupload":"Image failed to upload: (","error.full.stop":").","errors.local.images.disallowed":"Local image paste has been disabled. Local images have been removed from pasted content.","flash.crashed":"Images have not been imported as Adobe Flash appears to have crashed. This may be caused by pasting large documents.","errors.imageimport.failed":"Some images failed to import.","errors.imageimport.unsupported":"Unsupported image type.","errors.imageimport.invalid":"Image is invalid."},ln={translate:function(e){return tinymce.translate(sn[e])}},fn={insert:function(e,t){var n,r=t.getDoc(),o="ephoxInsertMarker",i=t.selection,a=t.dom;i.setContent(' '),n=a.get(o);for(var u=r.createDocumentFragment();e.firstChild&&!a.isBlock(e.firstChild);)u.appendChild(e.firstChild);for(var c=r.createDocumentFragment();e.lastChild&&!a.isBlock(e.lastChild);)c.appendChild(e.lastChild);if(n.parentNode.insertBefore(u,n),a.insertAfter(c,n),e.firstChild){if(a.isBlock(e.firstChild)){for(;!a.isBlock(n.parentNode)&&n.parentNode!==a.getRoot();)n=a.split(n.parentNode,n);a.is(n.parentNode,"td,th")||n.parentNode===a.getRoot()||(n=a.split(n.parentNode,n))}a.replace(e,n)}else a.remove(n)}},dn={each:tinymce.each,trim:tinymce.trim,bind:function(e,t){return function(){return e.apply(t,arguments)}},extend:function(n){for(var e=[],t=1;t /g," ")},function(e){return e.replace(/ /g," ")},function(e){return e.replace(/ /g," ")},function(e){return/<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(e)?e.replace(/(?: [\s\r\n]+| )*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?: [\s\r\n]+| )*/g,"$1"):e}].concat(jn):jn,Bn={all:dn.compose(Un),textOnly:Fn},Yn=/^(mso-.*|tab-stops|tab-interval|language|text-underline|text-effect|text-line-through|font-color|horiz-align|list-image-[0-9]+|separator-image|table-border-color-(dark|light)|vert-align|vnd\..*)$/,Hn=An(function(e,t){var r,n=e.settings.get("retain_style_properties");t.filterStyles((r=n,function(e,t){var n=!1;switch(r){case"all":case"*":n=!0;break;case"valid":n=!Yn.test(e);break;case void 0:case"none":n="list-style-type"===e;break;default:n=0<=(","+r+",").indexOf(","+e+",")}return n?t:null})),e.emit(t)}),Wn=An(function(e,t){e.seenList||(e.inferring?"LI"===t.tag()&&(t.type()===Cn.START_ELEMENT_TYPE?e.inferring++:(e.inferring--,e.inferring||(e.needsClosing=!0))):("OL"===t.tag()||"UL"===t.tag()?e.seenList=!0:"LI"===t.tag()&&(e.inferring=1,e.needsClosing||e.emit(Cn.createStartElement("UL",{},{},e.document))),!e.needsClosing||e.inferring||t.isWhitespace()||(e.needsClosing=!1,e.emit(Cn.createEndElement("UL",e.document))))),e.emit(t)}),qn=_n(function(e,t){return"name"===e||"id"===e?null:t}),$n=_n(function(e,t){if("class"===e)switch(this.settings.get("strip_class_attributes")){case"mso":return 0===t.indexOf("Mso")?null:t;case"none":return t;default:return null}return t}),Vn=function(){if(0
'}catch(e){return!1}return"Ignore"===Cn.token(e.firstChild).getStyle("mso-list")}(),Xn=function(e,t){return e.type()===Cn.START_ELEMENT_TYPE?0===e.getAttributeCount()||t&&1===e.getAttributeCount()&&null!==e.getAttribute("style")&&void 0!==e.getAttribute("style"):e.type()===Cn.END_ELEMENT_TYPE},Gn=Vn,zn=function(e){return"A"===e.tag()||"SPAN"===e.tag()},Kn=function(e){var t=e.getStyle("mso-list");return t&&"skip"!==t},Zn=[],Jn=[],Qn=!1,er=function(e,t){var n,r,o=1;for(n=t+1;n")||0<=e.indexOf("p.MsoNormal, li.MsoNormal, div.MsoNormal")||0<=e.indexOf("MsoListParagraphCxSpFirst")||0<=e.indexOf("")},Xr={filter:function(e,t,n){var r=Bn.all(e),o=Vr(r);t.setWordContent(o);var i=fr;return o&&(i=qr.concat(fr)),$r(r,t,n,i)},filterPlainText:function(e,t,n){var r=Bn.textOnly(e);return $r(r,t,n,[Rn])},isWordContent:Vr},Gr={officeStyles:"prompt",htmlStyles:"clean"},zr={openDialog:function(e,t,n){var r,o=t("cement.dialog.paste.clean"),i=t("cement.dialog.paste.merge"),a=[{text:o,ariaLabel:o,onclick:function(){r.close(),n("clean")}},{text:i,ariaLabel:i,onclick:function(){r.close(),n("merge")}}],u={title:t("cement.dialog.paste.title"),spacing:10,padding:10,items:[{type:"container",html:t("cement.dialog.paste.instructions")}],buttons:a};r=e.windowManager.open(u),setTimeout(function(){r&&r.getEl().focus()},1)}},Kr={openDialog:function(e,t,n){var r=t("cement.dialog.paste.clean"),o=t("cement.dialog.paste.merge"),i={title:t("cement.dialog.paste.title"),body:{type:"panel",items:[{type:"htmlpanel",name:"instructions",html:t("cement.dialog.paste.instructions")}]},buttons:[{text:r,type:"custom",name:"clean"},{text:o,type:"custom",name:"merge"}],onAction:function(e,t){switch(t.name){case"clean":e.close(),n("clean");break;case"merge":e.close(),n("merge")}}};e.windowManager.open(i)}};function Zr(a,u,c){return{showDialog:function(o){var e,t=a.settings.powerpaste_word_import||Gr.officeStyles,n=a.settings.powerpaste_html_import||Gr.htmlStyles,r=Xr.isWordContent(o)?t:n,i=function(e){var t={content:o};a.fire("PastePreProcess",{content:t,internal:!1});var n=vn.create(e,e,!0),r=Xr.filter(t.content,n,a.getDoc());a.fire("PastePostProcess",{node:r,internal:!1}),a.undoManager.transact(function(){fn.insert(r,a)})};"clean"===(e=r)||"merge"===e?i(r):(c?Kr:zr).openDialog(a,u,i)}}}function Jr(u,e,t,r,c){var s,l=/^image\/(jpe?g|png|gif|bmp)$/i;u.on("dragstart dragend",function(e){s="dragstart"===e.type}),u.on("dragover dragend dragleave",function(e){s||e.preventDefault()});var f=function(e,t){return t in e&&0 ",e)})},$o=function(t){return Xe.nu(function(n){var e=Se();e.onload=function(e){var t=e.target;n(t.result)},e.readAsText(t)})},Vo=function(n){return{is:function(e){return n===e},isValue:I,isError:w,getOr:v(n),getOrThunk:v(n),getOrDie:v(n),or:function(e){return Vo(n)},orThunk:function(e){return Vo(n)},fold:function(e,t){return t(n)},map:function(e){return Vo(e(n))},mapError:function(e){return Vo(n)},each:function(e){e(n)},bind:function(e){return e(n)},exists:function(e){return e(n)},forall:function(e){return e(n)},toOption:function(){return _.some(n)}}},Xo=function(n){return{is:w,isValue:w,isError:I,getOr:m,getOrThunk:function(e){return e()},getOrDie:function(){return E(String(n))()},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return Xo(n)},mapError:function(e){return Xo(e(n))},each:C,bind:function(e){return Xo(n)},exists:w,forall:I,toOption:_.none}},Go={value:Vo,error:Xo},zo=function(){return we.getOrDie("JSON")},Ko={parse:function(e){return zo().parse(e)},stringify:function(e,t,n){return zo().stringify(e,t,n)}},Zo=function(e){try{var t=Ko.parse(e);return Go.value(t)}catch(e){return Go.error("Response was not JSON")}},Jo=no(["message","status","responseText"],[]),Qo=function(e){var t=Jo(e);return t.toString=t.message,t},ei={handle:function(n,e,r){var t=function(){return Xe.pure(r.response)};return e.match({json:function(){return Zo(r.response).fold(t,Xe.pure)},blob:function(){return e=r,_.from(e.response).map($o).getOr(Xe.pure("no response content"));var e},text:t,html:t,xml:t}).map(function(e){var t=0===r.status?"Unknown HTTP error (possible cross-domain request)":'Could not load url "'+n+'": '+r.statusText;return Qo({message:t,status:r.status,responseText:e})})},nu:Qo},ti=function(){return(ti=Object.assign||function(e){for(var t,n=1,r=arguments.length;n/i),p=null===m?d:m[0];return r(p)}if(!l.get("_mcePaste")){if(o=l.add(f,"div",{id:"_mcePaste",class:"mcePaste"},'\ufeff '),u=f!==t.getDoc().body?l.getPos(t.selection.getStart(),f).y:f.scrollTop,l.setStyles(o,{position:"absolute",left:-1e4,top:u,width:1,height:1,overflow:"hidden"}),tinymce.isIE)return(a=l.doc.body.createTextRange()).moveToElementText(o),a.execCommand("Paste"),l.remove(o),"\ufeff"===o.innerHTML?(t.execCommand("mcePasteWord"),void n.preventDefault()):(r(c?o.innerText:o.innerHTML),tinymce.dom.Event.cancel(n));var g=function(e){e.preventDefault()};if(l.bind(t.getDoc(),"mousedown",g),l.bind(t.getDoc(),"keydown",g),tinymce.isGecko&&(a=t.selection.getRng(!0)).startContainer===a.endContainer&&3===a.startContainer.nodeType){var v=l.select("p,h1,h2,h3,h4,h5,h6,pre",o);1===v.length&&l.remove(v.reverse(),!0)}i=t.selection.getRng(),o=o.firstChild,(a=t.getDoc().createRange()).setStart(o,0),a.setEnd(o,1),s.setRng(a),window.setTimeout(function(){var n="",e=l.select("div.mcePaste");dn.each(e,function(e){var t=e.firstChild;t&&"DIV"===t.nodeName&&t.style.marginTop&&t.style.backgroundColor&&l.remove(t,1),dn.each(l.select("div.mcePaste",e),function(e){l.remove(e,1)}),dn.each(l.select("span.Apple-style-span",e),function(e){l.remove(e,1)}),dn.each(l.select("br[_mce_bogus]",e),function(e){l.remove(e)}),n+=e.innerHTML}),dn.each(e,function(e){l.remove(e)}),i&&s.setRng(i),r(n),l.unbind(t.getDoc(),"mousedown",g),l.unbind(t.getDoc(),"keydown",g)},0)}},Ea={getOnPasteFunction:function(t,n,r){return function(e){Ta(t,n,r,e)}},getOnKeyDownFunction:function(t,n,r){return function(e){(tinymce.isOpera||0"),r.dom().innerHTML=n.substr(o+"]>".length),Wi(r,function(e){return Ut(e)===t})):_.none();var t,n,r,o},za=function(e){return Ro(e,".rtf-data-image")},Ka={local:function(e){if("img"===Ut(e)){var t=Gt(e,"src");if(null!=t&&Et(t,"file://")){var n=Ua(e),r=t.split(/[\/\\]/),o=r[r.length-1];return Vt(n,"data-image-id",o),Kt(n,"src"),Vt(n,"data-image-type","local"),Mi(n,"rtf-data-image"),_.some(n)}return _.none()}return _.none()},vshape:function(e){return Ga(e).map(function(e){var t=Gt(e,"o:spid"),n=void 0===t?Gt(e,"id"):t,r=cn.fromTag("img");return Mi(r,"rtf-data-image"),Vt(r,"data-image-id",n.substr("_x0000_".length)),Vt(r,"data-image-type","code"),Wa(r,{width:qa(e,"width"),height:qa(e,"height")}),r})},find:za,exists:function(e){return 0")||t.browser.isEdge()&&0<=e.indexOf('v:shapes="')||t.browser.isEdge()&&0<=e.indexOf("mso-")||0<=e.indexOf("mso-list")||0<=e.indexOf("p.MsoNormal, li.MsoNormal, div.MsoNormal")||0<=e.indexOf("MsoListParagraphCxSpFirst")||0<=e.indexOf("")},ju=function(e,t,n){var r=cn.fromTag("div",e.dom());return r.dom().innerHTML=t,q(n,function(e){e(r)}),Au(r)};function Uu(a,u,e){return function(t,e,n){var r=function(e){t.receive(e)},o=function(e,t,n){return n=void 0!==n?n:e.type()===Lu.END_ELEMENT_TYPE,Lu.token(t,n,{})},i={emit:r,emitTokens:function(e){q(e,r)},receive:function(e){a(i,e,o)},document:y.window.document};return u(i),i}}var Bu=function(e,t){var n=cn.fromDom(e.getNode());return Gt(n,t)},Yu=function(e,t){var n=cn.fromDom(e.getNode());return qa(n,t)},Hu=function(e){return e.type()===Lu.TEXT_TYPE&&/^[\s\u00A0]*$/.test(e.text())},Wu=function(e,t,n){return e===t||e&&t&&e.tag===t.tag&&e.type===t.type&&(n||e.variant===t.variant)},qu={guessFrom:function(t,n){return X(t,function(e){return"UL"===e.tag||n&&Wu(e,n,!0)}).orThunk(function(){return 0===(e=t).length?_.none():_.some(e[0]);var e})},eqListType:Wu},$u=function(e,t){if(void 0===e||void 0===t)throw y.console.trace(),"brick";e.nextFilter.set(t)},Vu=function(e,t,n){t.nextFilter.get()(e,t,n)},Xu=$u,Gu=Vu,zu=Qr("level","token","type"),Ku=function(e,n,t,r){var o=t.getCurrentListType(),i=t.getCurrentLevel()==r.level()?o:null;return qu.guessFrom(r.emblems(),i).filter(function(e){return!("OL"===e.tag&&(!Y(["P"],(t=n).tag())||/^MsoHeading/.test(Bu(t,"class"))));var t})},Zu=function(e,t){return zt(cn.fromDom(t.getNode()),"data-list-level")},Ju=function(d){return function(e,t,n){var r,o,i,a,u=(r=cn.fromDom(n.getNode()),o=parseInt(Gt(r,"data-list-level"),10),i=Gt(r,"data-list-emblems"),a=JSON.parse(i),Kt(r,"data-list-level"),Kt(r,"data-list-emblems"),{level:v(o),emblems:v(a)});u.level(),t.originalToken.set(n);var c,s,l,f=(c=n,s=u,Ku((l=t).listType.get(),c,l.emitter,s).each(l.listType.set),zu(s.level(),l.originalToken.get(),l.listType.get()));t.emitter.openItem(f.level(),f.token(),f.type()),Xu(t,d.inside())}};function Qu(e,t,n){return{pred:e,action:t,label:v(n)}}var ec=function(e,r){return function(e,t,n){return r(e,t,n)}};function tc(e,r,t){var o=ec(0,t),n=function(e,t,n){X(r,function(e){return e.pred(t,n)}).fold(v(o),function(e){var t=e.label();return void 0===t?e.action:ec(0,e.action)})(e,t,n)};return n.toString=function(){return"Handlers for "+e},n}var nc,rc,oc,ic,ac,uc=function(r){return tc("Inside.List.Item",[Qu(function(e,t){return t.type()===Lu.END_ELEMENT_TYPE&&e.originalToken.get()&&t.tag()===e.originalToken.get().tag()},function(e,t,n){Xu(t,r.outside())},"Closing open tag")],function(e,t,n){e.emit(n)})},cc=function(r){return tc("Outside.List.Item",[Qu(Zu,Ju(r),"Data List ****"),Qu(function(e,t){return t.type()===Lu.TEXT_TYPE&&Hu(t)},function(e,t,n){e.emit(n)},"Whitespace")],function(e,t,n){t.emitter.closeAllLists(),e.emit(n),Xu(t,r.outside())})},sc=Qr("state","result"),lc=Qr("state","value"),fc={state:Qr("level","type","types","items"),value:lc,result:sc},dc=function(e,t){var n=e.items().slice(0),r=void 0!==t&&"P"!==t?_.some(t):_.none();r.fold(function(){n.push("P")},function(e){n.push(e)});var o=fc.state(e.level(),e.type(),e.types(),n);return fc.value(o,r)},mc=function(e){var t=e.items().slice(0);if(0t},n)},hc=function(e){var t;return e?void 0!==(t=Yu(e,"margin-left"))&&"0px"!==t?{"margin-left":t}:{}:{"list-style-type":"none"}},yc=function(e,t,n){var r=t.start&&1t?Cc(e,t):fc.result(e,[]),h=v.state().level()===t?(f=v.state(),d=r,m=n,p=0=(t=r).start()&&n<=t.finish()?[e-r.start()]:[];var t,n});return 0~\.\[:]+)/g,"a"),e(/(\.[^\s\+>~\.\[:]+)/g,"b"),e(/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,"c"),e(/(:[\w-]+\([^\)]*\))/gi,"b"),e(/(:[^\s\+>~\.\[:]+)/g,"b"),s=(s=s.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," "),e(/([^\s\+>~\.\[:]+)/g,"c"),f.sort(function(e,t){return e.index-t.index}),{selector:c,specificity:"0,"+l.a.toString()+","+l.b.toString()+","+l.c.toString(),specificityArray:[0,l.a,l.b,l.c],parts:f}},{calculate:r,compare:function(e,t){var n,r,o;if("string"==typeof e){if(-1!==e.indexOf(","))throw"Invalid CSS selector";n=a(e).specificityArray}else{if(!Array.isArray(e))throw"Invalid CSS selector or specificity array";if(4!==e.filter(function(e){return"number"==typeof e}).length)throw"Invalid specificity array";n=e}if("string"==typeof t){if(-1!==t.indexOf(","))throw"Invalid CSS selector";r=a(t).specificityArray}else{if(!Array.isArray(t))throw"Invalid CSS selector or specificity array";if(4!==t.filter(function(e){return"number"==typeof e}).length)throw"Invalid specificity array";r=t}for(o=0;o<4;o+=1){if(n[o]r[o])return 1}return 0}});void 0!==n&&(n.calculate=o.calculate,n.compare=o.compare)},{}],2:[function(e,t,n){var r=e("specificity");t.exports={boltExport:r}},{specificity:1}]},{},[2])(2)});var Ad=Od.exports.boltExport,_d=Qr("selector","raw"),Pd=function(t,e){var n=J(e,function(i){var e=Ro(t,i.selector());return q(e,function(e){var n,r,o,t=(n=i.raw(),r=e,o={},q(n,function(e){if(void 0!==n[e]){var t=r.dom().style;Y(t,e)||(o[e]=n[e])}}),o);Wa(e,t)}),e});q(n,function(e){Kt(e,"class")})},kd=function(e,t){var n=function(e){return-1!==e.selector().indexOf(",")},r=J($(e,n),function(n){var e=n.selector().split(",");return W(e,function(e){var t=e.trim();return _d(t,n.raw())})}),o=$(e,function(e){return!n(e)}).concat(r);o.sort(function(e,t){return Ad.compare(e.selector(),t.selector())}).reverse(),Pd(t,o)},Md=function(e,t,r){var n=Sd(e),o=Nd(n).map(function(e){var t=e.selector(),n=r.hasOwnProperty(t)?r[t]:t;return _d(n,e.raw())});kd(o,t)},Rd=function(e,t,n){var r=Sd(e),o=Nd(r),i=$(o,function(e){return Et(e.selector(),n)});kd(i,t)},Fd={inlineStyles:function(e,t,n){Md(e,t,n)},inlinePrefixedStyles:function(e,t,n){Rd(e,t,n)}},jd={p:"p, li[data-converted-paragraph]"},Ud=C,Bd=function(l,e){var f=function(n){Kt(n,"data-list-level"),Kt(n,"data-text-indent-alt"),Kt(n,"data-border-margin"),Xa(n,"margin-left"),Xa(n,"text-indent"),ne(function(e){var t={},n=e.dom();if(Ba(n))for(var r=0;r ")});return 1===n.length?n[0]:W(n,function(e){return""+e+"
"}).join("")},rm=function(e){var a=Fl.asText(e).getOrDie("Required text input for Text Handler");return _a.sync(function(e){var t,n,r,o,i=0"+e("cement.dialog.flash.press-escape")+"")},jm=function(e){var t=cn.fromTag("div");Mi(t,ld.resolve("flashbin-helpcopy"));var n=At.detect().os.isOSX()?["\u2318"]:["Ctrl"],r=cn.fromHtml(""+e("cement.dialog.flash.trigger-paste")+"
"),o=cn.fromHtml(''+n+' + V
');return Mi(o,ld.resolve("flashbin-helpcopy-kbd")),ma(t,[r,o,Fm(e)]),t},Um=function(e){var t=cn.fromTag("div");Mi(t,ld.resolve("flashbin-helpcopy"));var n=cn.fromHtml(""+e("cement.dialog.flash.missing")+"
");return ma(t,[n,Fm(e)]),t},Bm=function(e){var t=cn.fromTag("div");Mi(t,ld.resolve("flashbin-loading"));var n=cn.fromTag("div");Mi(n,ld.resolve("flashbin-loading-spinner"));var r=cn.fromTag("p"),o=e("loading.wait");return _u(r,o),Vt(r,"aria-label",o),ma(t,[n,r]),t},Ym=At.detect(),Hm=function(){try{return void 0!==y.navigator.plugins["Shockwave Flash"]}catch(e){return!1}},Wm=function(e,t,n,r){var o=Um(r);return la(e,o),{reset:C}},qm=function(e,t,n,r){var o=jm(r),i=Bm(r);ma(e,[i,o,t.element()]);var a=function(){Ha(o,"display","block"),Ha(i,"display","none"),n()};return t.events.spin.bind(function(){Ha(o,"display","none"),Ha(i,"display","block"),Xa(i,"height"),Xa(i,"padding"),n()}),t.events.reset.bind(a),t.events.hide.bind(function(){Wa(i,{height:"0",padding:"0"})}),{reset:a}};function $m(c,s){var l=s.translations,f=ao.create({response:io(["rtf","hide"]),cancel:io([]),error:io(["message"]),failed:io(["message"])});return{open:function(){var e=function(r){var t=ao.create({response:io(["rtf"]),spin:io([]),cancel:io([]),error:io(["message"]),reset:io([]),hide:io([]),failed:io(["message"])}),e=!1,n=cn.fromTag("div");Mi(n,ld.resolve("flashbin-target"));var o=_m.responsive();o.events.crashed.bind(function(){t.trigger.failed("flash.crashed")}),o.events.timeout.bind(function(){t.trigger.failed("flash.crashed")});var i=function(){if(d.stop(),!e){e=!0;try{var r=l.dom();ne(s,function(e,t){var n=r[t];if(void 0===n)throw'Flash object does not have the method "'+t+'"';n.call(r,e)}),t.trigger.reset(),v(),m()}catch(e){y.console.log("Flash dialog - Error during load: ",e)}}},a=km.permanent(i),u=function(){return!vo(l)},c=function(){return!l.dom().SetVariable},s={setSpinCallback:km.permanent(function(){o.start(1e3,10,u,c),t.trigger.spin()}),setPasteCallback:km.permanent(function(e){o.stop(),y.setTimeout(function(){""===e?t.trigger.error("flash.crashed"):t.trigger.response(unescape(e))},0)}),setEscapeCallback:km.permanent(t.trigger.cancel),setErrorCallback:km.permanent(function(e){o.stop(),t.trigger.error(e)}),setStartPasteCallback:km.permanent(C)},l=function(){var e=r.replace(/^https?:\/\//,"//"),t=' ';if(Mm.browser.isIE()&&10===Mm.browser.version.major){var n=Je("flash-bin");return cn.fromHtml(' '+t+" ")}return cn.fromHtml(''+t+" ")}(),f=function(){Wa(l,{width:"2px",height:"2px"})};f();var d=Pm(l,te(s),i);la(n,l);var m=function(){Mm.browser.isFirefox()&&y.window.getSelection().removeAllRanges(),Am(l)},p=null,g=function(){Mi(n,ld.resolve("flash-activate")),Xa(l,"height"),Xa(l,"width"),t.trigger.hide()},v=function(){y.clearTimeout(p),Ri(n,ld.resolve("flash-activate")),f()},h=function(){Ha(n,"display","none"),Rm.each(function(e){q(e,function(e){e.unbind()})})};return{focus:m,element:function(){return n},activate:function(){p=y.setTimeout(g,3e3),t.trigger.spin(),Ha(n,"display","block"),m()},deactivate:h,destroy:function(){h(),q(ie(s),function(e){km.unregister(e)}),km.unregister(a),d.stop()},events:t.registry}}(s.swf);e.deactivate();var t=cn.fromDom(y.window),n=Ed(t,"mouseup",e.focus),r=function(){u()},o=function(){r(),f.trigger.cancel()};e.events.cancel.bind(o),e.events.response.bind(function(e){f.trigger.response(e.rtf(),r)}),e.events.error.bind(function(e){r(),f.trigger.error(e.message())}),e.events.failed.bind(function(e){r(),f.trigger.failed(e.message())});var i=c();i.setTitle(l("cement.dialog.flash.title"));var a=function(e,t,n){var r=cn.fromTag("div"),o="flashbin-wrapper-"+(Ym.os.isOSX()?"cmd":"ctrl");Mi(r,ld.resolve(o));var i=(Hm()?qm:Wm)(r,e,t,n.translations);return{element:v(r),reset:i.reset}}(e,i.reflow,s);a.reset(),i.setContent(a.element()),i.events.close.bind(o),i.show(),e.activate();var u=function(){n.unbind(),e.destroy(),i.destroy()}},events:f.registry}}function Vm(){var o={};return{getOrSetIndexed:function(e,t){return void 0!==o[e]?o[e]:(n=e,r=t(),o[n]=r);var n,r},waitForLoad:function(){var e=ie(o);return ze(e)}}}var Xm,Gm,zm=Om("ephox.henchman.features"),Km=function(i){return $e.nu(function(t){var e=function(){r.unbind(),o.unbind()},n=cn.fromTag("script");Vt(n,"src",i),Vt(n,"type","text/javascript"),Vt(n,"async","async"),Vt(n,"data-main",zm.ephemeral(function(e){t(Go.value(e))}));var r=Ed(n,"error",function(){e(),t(Go.error("Error loading external script tag "+i))}),o=Ed(n,"load",e);la(cn.fromDom(y.document.head),n)})},Zm=function(e,t){var n,r,o,i=t||cn.fromDom(y.document),a=cn.fromTag("link",i.dom());return Xt(a,{rel:"stylesheet",type:"text/css",href:e}),n=i,r=a,o=cn.fromDom(n.dom().head),la(o,r),a},Jm=function(o,i){return $e.nu(function(t){var n=function(e){q(r,function(e){e.unbind()}),t(e.fold(function(e){return Go.error(e+'Unable to download editor stylesheets from "'+o+'"')},Go.value))},e=Zm(o),r=[Ed(e,"load",function(e){!function(e){try{var t=e.target().dom().sheet.cssRules;return M(t)&&0===t.length}catch(e){}return!1}(e)?i(n):n(Go.error(""))}),Ed(e,"error",N(n,Go.error("")))]})},Qm=(Xm=Vm(),{preload:function(){Gm().get(m)},addStylesheet:function(e,t){return Xm.getOrSetIndexed(e,function(){return Jm(e,t)})},addScript:function(e,t){return Xm.getOrSetIndexed(e,function(){return Km(e).map(t)})},waitForLoad:Gm=function(){return Xm.waitForLoad()}}),ep=function(e,t){return Qm.addScript(e,t)},tp=At.detect(),np=tp.deviceType.isiOS()||tp.deviceType.isAndroid(),rp=v({isSupported:v(!1),cleanDocument:v(ui("not supported"))}),op=np?rp:function(e){var r=ep(e+"/wordimport.js",m);return r.get(function(e){e.fold(function(e){y.console.error("Unable to load word import: ",e)},C)}),{isSupported:v(!0),cleanDocument:function(t,n){return r.map(function(e){return e.map(function(e){return e.cleanDocument(t,n)})})}}};function ip(e,t,n,r){var o=Io(e,n)&&t===r;return{startContainer:v(e),startOffset:v(t),endContainer:v(n),endOffset:v(r),collapsed:v(o)}}var ap,up,cp=["b","i","u","sub","sup","strike"],sp=function(e){q(_o(e),function(e){var t;Wt(t=e)&&!t.dom().hasChildNodes()&&Y(cp,Ut(t))&&Fa(e)})},lp=function(e,o){var t=_o(e);q(t,function(e){var t,n,r;o(e)&&(n=_o(t=e),r=cn.fromTag("div",Lo(t).dom()),ma(r,n),ua(t,r),Fa(t))})},fp={consolidate:function(n,e){Oo(n).filter(e).each(function(e){var t=_o(e);ma(n,t),Fa(e)}),lp(n,e),sp(n)}},dp=function(e){return"rtl"===qa(e,"direction")?"rtl":"ltr"},mp=ef.bin(),pp=mp+Je(""),gp=(ap="-100000px",up="100000px",function(e){return"rtl"===dp(e)?up:ap});function vp(t,e,n){var r=function(t,e){var n=cn.fromTag("div");Xt(n,e),Xt(n,{contenteditable:"true","aria-hidden":"true"}),Wa(n,{position:"fixed",top:"0px",width:"100px",height:"100px",overflow:"hidden",opacity:"0"}),ji(n,[mp,pp]);var r=function(e){return Fi(e,pp)};return{attach:function(e){Ra(n),Ha(n,"left",gp(e)),la(e,n)},focus:function(){$i(n,"body").each(function(e){t.toOff(e,n)})},contents:function(){return fp.consolidate(n,r),Qr("elements","html","container")(_o(n),Au(n),n)},container:function(){return n},detach:function(){Fa(n)}}}(t,n),o=function(){t.cleanup();var e=r.contents();r.detach(),a.trigger.after(e.elements(),e.html(),r.container())},i=Jl.tap(function(){a.trigger.before(),r.attach(e),r.focus(),of.run(Lo(e),i,o)}),a=ao.create({before:io([]),after:io(["elements","html","container"])}),u=C;return{instance:v(function(){i.instance()}),destroy:u,events:a.registry}}var hp=function(e){return{startContainer:e.start,startOffset:e.soffset,endContainer:e.finish,endOffset:e.foffset}},yp={set:function(e,t){yf(e,t.startContainer(),t.startOffset(),t.endContainer(),t.endOffset())},get:function(e,t){return xf(e).map(hp)}};function bp(a){return function(t){var u,r,o,c,n=ao.create({after:io(["container"])}),i=(u=yp,r=cn.fromTag("br"),o=_.none(),c=function(e){return Lo(e).dom().defaultView},{cleanup:function(){Fa(r)},toOn:function(i,e){var a=c(e);o.each(function(e){var t=ko(i),n=Io(i,e.startContainer())&&t",n=cn.fromHtml(t);Vt(n,"type","text/css"),Vt(n,"id",xp);var r=qi("head").getOrDie("Head element could not be found.");la(r,n)}},removeStyles:function(){if(xl(Tp)){var e=qi("head").getOrDie("Head element could not be found."),t=Vi(e,Tp).getOrDie("The style element could not be removed");Fa(t)}}},wp="x-tinymce/html",Ip="\x3c!-- "+wp+" --\x3e",Sp={mark:function(e){return Ip+e},unmark:function(e){return e.replace(Ip,"")},isMarked:function(e){return-1!==e.indexOf(Ip)},retainContentEditable:function(e){return e.replace(/ contenteditable="([^"]+)"/g,' data-mce-contenteditable="$1"')},restoreContentEditable:function(e){return e.replace(/ data-mce-contenteditable="([^"]+)"/g,' contenteditable="$1"')},internalHtmlMime:v(wp)},Lp=function(){},Cp=function(e,t,n){if(r=e,!1!==tinymce.Env.iOS||void 0===r||"function"!=typeof r.setData)return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",n),e.setData(Sp.internalHtmlMime(),t),!0}catch(e){return!1}var r},Np=function(e,t,n,r){Cp(e.clipboardData,t.html,t.text)?(e.preventDefault(),r()):n(t.html,r)},Dp=function(a){return function(e,t){var n=a.dom.create("div",{contenteditable:"false","data-mce-bogus":"all"}),r=a.dom.create("div",{contenteditable:"true","data-mce-bogus":"all"},e);a.dom.setStyles(n,{position:"fixed",top:"50%",left:"-3000px",width:"1000px",overflow:"hidden"}),n.appendChild(r),a.dom.add(a.getBody(),n);var o=a.selection.getRng();r.focus();var i=a.dom.createRng();i.selectNodeContents(r),a.selection.setRng(i),setTimeout(function(){a.selection.setRng(o),n.parentNode.removeChild(n),t()},0)}},Op=function(e){var t=Sp.retainContentEditable(e.selection.getContent({contextual:!0}));return{html:Sp.mark(t),text:e.selection.getContent({format:"text"})}},Ap={register:function(e){var t,n;e.on("cut",(t=e,function(e){!1===t.selection.isCollapsed()&&Np(e,Op(t),Dp(t),function(){setTimeout(function(){t.execCommand("Delete")},0)})})),e.on("copy",(n=e,function(e){!1===n.selection.isCollapsed()&&Np(e,Op(n),Dp(n),Lp)}))}},_p={nodeToString:function(e){var t=document.createElement("div");t.appendChild(e.cloneNode(!0));var n=t.innerHTML;return t=e=null,n},restoreStyleAttrs:function(e){q(W(e.getElementsByTagName("*"),cn.fromDom),function(e){zt(e,"data-mce-style")&&!zt(e,"style")&&Vt(e,"style",Gt(e,"data-mce-style"))})}},Pp={showDialog:function(e,t){var n={title:"Error",body:{type:"panel",items:[{type:"htmlpanel",name:"errorpanel",html:t}]},initialData:{},buttons:[{text:"OK",type:"cancel",name:"ok",primary:!0}]};e.windowManager.open(n)}},kp={init:function(){var r=Ac([{text:"Close",name:"close",type:"custom",primary:!0}]),o=Ac({});return{setButtons:function(e){var n={},t=W(e,function(e){var t=e.text;return n[t.toLowerCase()]=e.click,{text:t,name:t.toLowerCase(),type:"custom"}});o.set(n),r.set(t)},getButtons:r.get,getAction:function(e){var t=o.get();return t.hasOwnProperty(e)?_.some(t[e]):_.none()}}}},Mp=Qr("url","html"),Rp=function(e){return/^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(e)},Fp=Rp,jp=function(e){return Rp(e)&&/.(gif|jpe?g|png)$/.test(e)},Up=function(n){var e=/^([^<]+)<\/a>$/.exec(n);return _.from(e).bind(function(e){var t=Mp(e[1],n);return e[1]===e[2]?_.some(t):_.none()})},Bp=function(e,t,n){return"extra"in e.undoManager?(e.undoManager.extra(function(){Yp(e,t)},n),_.some(!0)):_.none()},Yp=function(e,t){return e.insertContent(t,{merge:!1!==e.settings.paste_merge_formats,paste:!0}),_.some(!0)},Hp={until:function(t,n,e){return Pa(e,function(e){return e(t,n)})},linkSelection:function(r,e){return Up(e).bind(function(e){var t,n;return!1===r.selection.isCollapsed()&&Fp(e.url())?Bp(t=r,(n=e).html(),function(){t.execCommand("mceInsertLink",!1,n.url())}):_.none()})},insertImage:function(r,e){return Up(e).bind(function(e){return jp(e.url())?Bp(t=r,(n=e).html(),function(){t.insertContent(' ')}):_.none();var t,n})},insertContent:Yp},Wp=function(e,t){return e.hasEventListeners(t)},qp=function(e){return e.plugins.powerpaste},$p={process:function(e,t,n){var r,o,i,a,u,c,s,l,f,d,m,p,g,v=Sp.unmark(t);return d=v,m=n,o=Wp(f=r=e,"PastePreProcess")?(p=d,g=m,f.fire("PastePreProcess",{internal:g,content:p}).content):d,i=n,Wp(r,"PastePostProcess")?(u=o,c=i,s=(a=r).dom.add(a.getBody(),"div",{style:"display:none"},u),l=a.fire("PastePostProcess",{internal:c,node:s}).node.innerHTML,a.dom.remove(s),l):o},registerEvents:function(t){var n=t.settings;n.paste_preprocess&&t.on("PastePreProcess",function(e){n.paste_preprocess.call(t,qp(t),e)}),n.paste_postprocess&&t.on("PastePostProcess",function(e){n.paste_postprocess.call(t,qp(t),e)})}};function Vp(v,h,e,t,y,b){var x,T,E,w,I=Ac(_.none()),n=function(e,t){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")};w=n(t?t.jsUrl:e,"/js"),T=n(t?t.swfUrl:e,"/flash/textboxpaste.swf"),E=n(t?t.imgUrl:e,"/img/spinner_96.gif");var S=function(e,t,n){var r,o=!1!==e.settings.smart_paste?[Hp.linkSelection,Hp.insertImage]:[];Hp.until(e,t,o.concat([(r=n,function(e,t){return e.undoManager.transact(function(){Hp.insertContent(e,t),_p.restoreStyleAttrs(e.getBody()),y.prepareImages(r)}),_.some(!0)})]))},L=function(){x&&v.selection.moveToBookmark(x),x=null};v.on("init",function(e){Ep.injectStyles(E);var s,a,t,n,r,o,i,u,c,l={baseUrl:w,swf:T,officeStyles:v.settings.powerpaste_word_import||Gr.officeStyles,htmlStyles:v.settings.powerpaste_html_import||Gr.htmlStyles,translations:ln.translate,allowLocalImages:!1!==v.settings.powerpaste_allow_local_images,enableFlashImport:!1!==v.settings.powerpaste_enable_flash_import,pasteBinAttrs:{"data-mce-bogus":"all"},intraFlag:{clipboardType:Sp.internalHtmlMime,findClipboardTags:function(e){var t=$(e,function(e){return Ht(e)&&xt(Ts(e),Sp.internalHtmlMime())});return t.length?_.some(t):_.none()}},preprocessor:function(e){return Xe.pure(e)}},f=b?(a=v,{createDialog:function(){var n="",r=null,o=kp.init(),t=ao.create({close:io([])}),i=function(e){t.trigger.close()};return{events:t.registry,setTitle:function(e){return n=e},setContent:function(e){return r=e},setButtons:function(e){o.setButtons(e)},show:function(){var e=_p.nodeToString(r.dom()),t={title:n,body:{type:"panel",items:[{type:"htmlpanel",name:"contentPanel",html:e}]},initialData:{},buttons:o.getButtons(),onCancel:i,onAction:function(t,e){o.getAction(e.name).each(function(e){return e(t)}),t.close()}};a.windowManager.open(t)},destroy:C,reflow:function(){}}}}):(s=v,{createDialog:function(){var r,o="",i="",a=[],u=null,t=ao.create({close:io([])}),c=function(e){t.trigger.close()},e=function(){r.off("close",c),r.close("close")};return{events:t.registry,setTitle:function(e){o=e},setContent:function(e){var t=_p.nodeToString(e.dom());i=[{type:"container",html:t}],u=e},setButtons:function(e){var r=[];e.forEach(function(e,t,n){r.push({text:e.text,ariaLabel:e.text,onclick:e.click})}),a=r},show:function(){0===a.length&&(a=[{text:"Close",onclick:function(){r.close()}}]);var e={title:o,spacing:10,padding:10,minWidth:300,minHeight:100,layout:"flex",items:i,buttons:a};r=s.windowManager.open(e);var t=cn.fromDom(r.getEl()),n=Vi(t,"."+Gt(u,"class")).getOrDie("We must find this element or we cannot continue");ua(n,u),Fa(n),r.on("close",c)},hide:function(){e()},destroy:function(){e()},reflow:function(){}}}}),d=cn.fromDom(v.getBody()),m=(t=d,n=f.createDialog,r=C,i=op((o=l).baseUrl),u=N($m,n),c=bp(void 0!==o.pasteBinAttrs?o.pasteBinAttrs:{}),Ef([Dm.onlyText(),Dm.wordimport(i,n,o,u),Dm.googledocs(o,r,t),Dm.nativeHtml(n,o,r,t),Dm.image(o)],Dm.fallback(n,o,r,c,t,u))),p=Ef([Dm.text()],Dm.none());q([m,p],function(e){e.events.cancel.bind(function(){L()}),e.events.error.bind(function(e){L(),v.notificationManager?v.notificationManager.open({text:ln.translate(e.message()),type:"error"}):(b?Pp:ha).showDialog(v,ln.translate(e.message()))}),e.events.insert.bind(function(e){var t=W(e.elements(),function(e){return _p.nodeToString(e.dom())}).join(""),n=Sp.restoreContentEditable(t);v.focus(),y.importImages(e.assets()).get(function(){L(),S(v,$p.process(v,n,e.isInternal()),e.assets()),y.uploadImages(e.assets())})})}),v.addCommand("mceInsertClipboardContent",function(e,t){void 0!==t.content?m.pasteCustom(zl.fromHtml(t.content)):void 0!==t.text&&p.pasteCustom(zl.fromText(t.text))});var g=Ed(d,"paste",function(e){x||(x=v.selection.getBookmark(1)),(h.isText()?p:m).paste(e.raw()),h.reset()});I.set(_.some(g)),Ap.register(v)}),v.on("remove",function(e){1===tinymce.editors.length&&Ep.removeStyles(),I.get().each(function(e){return e.unbind()})})}var Xp=function(e){return tinymce.util.VK.metaKeyPressed(e)&&86===e.keyCode&&e.shiftKey};function Gp(u){return c(tinymce,"4.0.28")?(t.error('The "powerpaste" plugin requires at least 4.0.28 version of TinyMCE.'),function(){}):function(n,e){var t,r=!c(tinymce,"5.0.0"),o=function(t,n){var r=Ac(f(t)),o=Ac(!1);t.on("keydown",function(e){Xp(e)&&(o.set(!0),tinymce.Env.ie&&tinymce.Env.ie<10&&(e.preventDefault(),t.fire("paste",{})))});var i=function(){var e=!r.get();r.set(e),t.fire("PastePlainTextToggle",{state:e}),t.focus()};return{buttonToggle:function(e){var t=!r.get();n?e.setActive(t):this.active(t),i()},toggle:i,reset:function(){o.set(!1)},isText:function(){return o.get()||r.get()}}}(n,r),i=function(t){t.setActive(o.isText());var e=function(e){t.setActive(e.state)};return n.on("PastePlainTextToggle",e),function(){return n.off("PastePlainTextToggle",e)}},a=function(){var t=this;t.active(o.isText()),n.on("PastePlainTextToggle",function(e){t.active(e.state)})};tinymce.Env.ie&&tinymce.Env.ie<10?function(t,e,n){var r,o,i=this,a=Zr(t,ln.translate,!1),u=function(t){return function(e){t(e)}};r=Ea.getOnPasteFunction(t,a.showDialog,e),t.on("paste",u(r)),o=Ea.getOnKeyDownFunction(t,a.showDialog,e),t.on("keydown",u(o)),t.addCommand("mceInsertClipboardContent",function(e,t){a.showDialog(t.content||t)}),t.settings.paste_preprocess&&t.on("PastePreProcess",function(e){t.settings.paste_preprocess.call(i,i,e)})}(n,o):(t=xa(n),Vp(n,o,e,u,t,r),l(n)?d(n):Jr(n,0,0,t,r)),$p.registerEvents(n),r?(n.ui.registry.addToggleButton("pastetext",{icon:"paste-text",tooltip:"Paste as text",onAction:o.buttonToggle,onSetup:i}),n.ui.registry.addToggleMenuItem("pastetext",{icon:"paste-text",text:"Paste as text",selectable:!0,onAction:o.buttonToggle,onSetup:i})):(n.addButton("pastetext",{icon:"pastetext",tooltip:"Paste as text",onclick:o.buttonToggle,onPostRender:a}),n.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,onclick:o.buttonToggle,onPostRender:a})),s.register(n,o)}}return function(e){tinymce.PluginManager.requireLangPack("powerpaste","ar,ca,cs,da,de,el,es,fa,fi,fr_FR,he_IL,hr,hu_HU,it,ja,kk,ko_KR,nb_NO,nl,pl,pt_BR,pt_PT,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,zh_CN,zh_TW"),tinymce.PluginManager.add("powerpaste",Gp(e))}}(window)();