!function(a){tinymce.PluginManager.add("aiview",function(b){function c(a){return a.replace(/(\[aesop_([a-zA-Z_]+)\s([^\[\]]*)]([^\[\]]*)\[\/aesop_[a-zA-Z_]+]|\[aesop_([a-zA-Z_]+)\s?([^\[\]]*)])/g,function(a){return e("aesop-component",a)})}function d(a,b){var c;switch(a){case"parallax":case"video":case"document":case"image":c=b.caption;break;case"gallery":c="id:"+b.id;break;case"character":c=b.name;break;case"timeline_stop":case"chapter":case"audio":case"collection":c=b.title;break;case"quote":c=b.quote}return void 0===c?"":c}function e(a,b){var c=/\[aesop_([a-zA-Z_]+)\s([^\[\]]*)]([^\[\]]+)\[\/aesop_[a-zA-Z_]+]/g,e=/\[aesop_([a-zA-Z_]+)\s?([^\[\]]*)]/g,f=/(<\/p>[\s]*
<\/p>\s
)[\s]*$/,g=/(<\/p>[\s]*
)[\s]*$/,h=c.exec(b);if(h){var j=i(h),k=d(h[1],j);h[3]=h[3].replace(f,""),h[3]=h[3].replace(g,"");var l='
'+h[3]+"
\W<\/p>/,""),f=f.replace(h[1],e[2])),"
"+f+"
"}if(!(e=c.exec(a)))return a;var f=window.decodeURIComponent(e[1]);return""+f+"
"}function h(a){var b={"<":"<",">":">","[":"[","]":"]",""":'"'};return a.replace(/<|>|[|]|"/g,function(a){return b[a]||a})}function i(a){var b=/\[aesop_([a-zA-Z_]+)\s([^\[\]]*)]([^\[\]]+)\[\/aesop_[a-zA-Z_]+]/g,c=/\[aesop_([a-zA-Z_]+)\s([^\[\]]*)]/g,d=/","").replace("
",""),e=e.slice(0,-1),j[d]=e.substring(1)}),void 0!==f[3]&&(j.content=f[3].replace(d,"")),j}function j(a){"none"!==a.style.display&&(a.style.display="none")}function k(a){"block"!==a.style.display&&(a.style.display="block")}function l(b){window.clipboardSource=b;var c=tinymce.activeEditor,d=c.dom.create("div",{class:"clipboardControl mceNonEditable unselectable"},'');c.getBody().insertBefore(d,c.getBody().firstChild),window.clipboardControl=a(d)}function m(){var a=tinymce.activeEditor,b=a.dom.select(".clipboardControl");a.dom.remove(b),delete window.clipboard,delete window.clipboardSource,delete window.clipboardControl}function n(){var a=window.clipboardSource,b=tinymce.activeEditor;b.dom.remove(a),k(window.clipboard),b.execCommand("mceInsertRawHTML",!1,window.clipboard.outerHTML),m()}function o(a){tinymce.activeEditor;jQuery(a.outerHTML).insertAfter(a)}jQuery.fn.setCursorPosition=function(b){return 0==this.length?this:a(this).setSelection(b,b)},jQuery.fn.setSelection=function(a,b){if(0==this.length)return this;if(input=this[0],input.createTextRange){var c=input.createTextRange();c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select()}else input.setSelectionRange&&(input.focus(),input.setSelectionRange(a,b));return this},jQuery.fn.focusEnd=function(){return this.setCursorPosition(this.val().length),this},b.onClick.add(function(b,c){if(delete window.ailocked,delete window.aiactive,void 0!==a(b.selection.getNode()).parents(".aesop-component")[0]&&(window.aiactive=!0),c.target.className.indexOf("aesop-button-delete")>-1){!0===confirm("Are you sure you want to delete this Aesop Component?")&&c.target.parentNode.parentNode.parentNode.parentNode.removeChild(c.target.parentNode.parentNode.parentNode),delete window.aiactive,window.ailocked=!0,tinymce.execCommand("mceFocus",!1,b.id)}if(c.target.className.indexOf("aesop-button-edit")>-1){var d=/aesop-scope-([a-z_]*)/,e=d.exec(c.target.className),g=c.target.parentNode.parentNode.parentNode,h=g.getAttribute("data-aesop-sc");if(h?(h=window.decodeURIComponent(h),h=""+h+"
"):h=f(g.outerHTML),g.setAttribute("id","aesop-generator-editing"),e){a("body").toggleClass("modal-open"),a("body").addClass("modal-updating"),a("#aesop-generator-wrap").toggleClass("aesop-generator-open");var k=".dk_options li."+e[1]+" a";a(k).click();var m=i(h);for(var n in m)"content"===n?a("#aesop-generator-content").val(m[n]):a('#aesop-generator-settings [name="'+n+'"]').val(m[n])}tiny_ai_parent=b.dom.select("#aesop-generator-editing")[0],b.selection.select(tiny_ai_parent),b.selection.collapse(!1)}if(c.target.className.indexOf("aesop-button-clipboard")>-1){var g=c.target.parentNode.parentNode.parentNode;window.clipboard=g,j(g),l(g),b.selection.collapse(!1)}if(c.target.className.indexOf("aesop-button-clone")>-1){var g=c.target.parentNode.parentNode.parentNode;o(g),b.selection.collapse(!1)}}),b.onKeyDown.add(function(b,c){if(delete window.ailocked,13===c.keyCode&&!c.ctrlKey&&!c.shiftKey&&!c.altKey){var d=b.selection.getNode(),e=a(d).parents(".aesop-component");if(a(d).parents(".aesop-component")[0]){c.preventDefault(),c.stopPropagation();var f=a("