!function(r,l,o){var c,e,t,n,i,h=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$/i,u=/^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,63}[^ "]*$/i,p={},a={},s="ontouchend"in document;function d(){return c?c.$('a[data-wplink-edit="true"]'):null}window.wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",textarea:"",modalOpen:!1,init:function(){p.wrap=r("#wp-link-wrap"),p.dialog=r("#wp-link"),p.backdrop=r("#wp-link-backdrop"),p.submit=r("#wp-link-submit"),p.close=r("#wp-link-close"),p.text=r("#wp-link-text"),p.url=r("#wp-link-url"),p.nonce=r("#_ajax_linking_nonce"),p.openInNewTab=r("#wp-link-target"),p.search=r("#wp-link-search"),a.search=new t(r("#search-results")),a.recent=new t(r("#most-recent-results")),a.elements=p.dialog.find(".query-results"),p.queryNotice=r("#query-notice-message"),p.queryNoticeTextDefault=p.queryNotice.find(".query-notice-default"),p.queryNoticeTextHint=p.queryNotice.find(".query-notice-hint"),p.dialog.keydown(wpLink.keydown),p.dialog.keyup(wpLink.keyup),p.submit.click(function(e){e.preventDefault(),wpLink.update()}),p.close.add(p.backdrop).add("#wp-link-cancel button").click(function(e){e.preventDefault(),wpLink.close()}),a.elements.on("river-select",wpLink.updateFields),p.search.on("focus.wplink",function(){p.queryNoticeTextDefault.hide(),p.queryNoticeTextHint.removeClass("screen-reader-text").show()}).on("blur.wplink",function(){p.queryNoticeTextDefault.show(),p.queryNoticeTextHint.addClass("screen-reader-text").hide()}),p.search.on("keyup input",function(){window.clearTimeout(e),e=window.setTimeout(function(){wpLink.searchInternalLinks()},500)}),p.url.on("paste",function(){setTimeout(wpLink.correctURL,0)}),p.url.on("blur",wpLink.correctURL)},correctURL:function(){var e=r.trim(p.url.val());e&&i!==e&&!/^(?:[a-z]+:|#|\?|\.|\/)/.test(e)&&(p.url.val("http://"+e),i=e)},open:function(e,t,n){var i=r(document.body);i.addClass("modal-open"),wpLink.modalOpen=!0,wpLink.range=null,e&&(window.wpActiveEditor=e),window.wpActiveEditor&&(this.textarea=r("#"+window.wpActiveEditor).get(0),void 0!==window.tinymce&&(i.append(p.backdrop,p.wrap),i=window.tinymce.get(window.wpActiveEditor),c=i&&!i.isHidden()?i:null),!wpLink.isMCE()&&document.selection&&(this.textarea.focus(),this.range=document.selection.createRange()),p.wrap.show(),p.backdrop.show(),wpLink.refresh(t,n),r(document).trigger("wplink-open",p.wrap))},isMCE:function(){return c&&!c.isHidden()},refresh:function(e,t){a.search.refresh(),a.recent.refresh(),wpLink.isMCE()?wpLink.mceRefresh(e,t):(p.wrap.hasClass("has-text-field")||p.wrap.addClass("has-text-field"),document.selection?document.selection.createRange().text:void 0!==this.textarea.selectionStart&&this.textarea.selectionStart!==this.textarea.selectionEnd&&(t=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd)||t||""),p.text.val(t),wpLink.setDefaultValues()),s?p.url.focus().blur():window.setTimeout(function(){p.url[0].select(),p.url.focus()}),a.recent.ul.children().length||a.recent.ajax(),i=p.url.val().replace(/^http:\/\//,"")},hasSelectedText:function(e){var t,n,i,a=c.selection.getContent();if(/]+>[^<]+<\/a>$/.test(a)||-1===a.indexOf("href=")))return!1;if(e.length){if(!(n=e[0].childNodes)||!n.length)return!1;for(i=n.length-1;0<=i;i--)if(3!=(t=n[i]).nodeType&&!window.tinymce.dom.BookmarkManager.isBookmarkNode(t))return!1}return!0},mceRefresh:function(e,t){var n,i,a=d(),s=this.hasSelectedText(a);a.length?(n=a.text(),i=a.attr("href"),r.trim(n)||(n=t||""),"_wp_link_placeholder"!==(i=e&&(u.test(e)||h.test(e))?e:i)?(p.url.val(i),p.openInNewTab.prop("checked","_blank"===a.attr("target")),p.submit.val(l.update)):this.setDefaultValues(n),e&&e!==i?p.search.val(e):p.search.val(""),window.setTimeout(function(){wpLink.searchInternalLinks()})):(n=c.selection.getContent({format:"text"})||t||"",this.setDefaultValues(n)),s?(p.text.val(n),p.wrap.addClass("has-text-field")):(p.text.val(""),p.wrap.removeClass("has-text-field"))},close:function(e){r(document.body).removeClass("modal-open"),wpLink.modalOpen=!1,"noReset"!==e&&(wpLink.isMCE()?(c.plugins.wplink&&c.plugins.wplink.close(),c.focus()):(wpLink.textarea.focus(),wpLink.range&&(wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select()))),p.backdrop.hide(),p.wrap.hide(),i=!1,r(document).trigger("wplink-close",p.wrap)},getAttrs:function(){return wpLink.correctURL(),{href:r.trim(p.url.val()),target:p.openInNewTab.prop("checked")?"_blank":null}},buildHtml:function(e){var t='"},update:function(){wpLink.isMCE()?wpLink.mceUpdate():wpLink.htmlUpdate()},htmlUpdate:function(){var e,t,n,i,a,s=wpLink.textarea;s&&(n=wpLink.getAttrs(),i=p.text.val(),(a=document.createElement("a")).href=n.href,"javascript:"!==a.protocol&&"data:"!==a.protocol||(n.href=""),n.href&&(e=wpLink.buildHtml(n),document.selection&&wpLink.range?(s.focus(),wpLink.range.text=e+(i||wpLink.range.text)+"",wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select(),wpLink.range=null):void 0!==s.selectionStart&&(t=s.selectionStart,a=s.selectionEnd,i=t+(e=e+(n=i||s.value.substring(t,a))+"").length,t!==a||n||(i-=4),s.value=s.value.substring(0,t)+e+s.value.substring(a,s.value.length),s.selectionStart=s.selectionEnd=i),wpLink.close(),s.focus(),r(s).trigger("change"),o.a11y.speak(l.linkInserted)))},mceUpdate:function(){var e,t,n,i=wpLink.getAttrs(),a=document.createElement("a");if(a.href=i.href,"javascript:"!==a.protocol&&"data:"!==a.protocol||(i.href=""),!i.href)return c.execCommand("unlink"),void wpLink.close();e=d(),c.undoManager.transact(function(){e.length||(c.execCommand("mceInsertLink",!1,{href:"_wp_link_placeholder","data-wp-temp-link":1}),e=c.$('a[data-wp-temp-link="1"]').removeAttr("data-wp-temp-link"),n=r.trim(e.text())),e.length?(p.wrap.hasClass("has-text-field")&&((t=p.text.val())?e.text(t):n||e.text(i.href)),i["data-wplink-edit"]=null,i["data-mce-href"]=i.href,e.attr(i)):c.execCommand("unlink")}),wpLink.close("noReset"),c.focus(),e.length&&(c.selection.select(e[0]),c.plugins.wplink&&c.plugins.wplink.checkLink(e[0])),c.nodeChanged(),o.a11y.speak(l.linkInserted)},updateFields:function(e,t){p.url.val(t.children(".item-permalink").val()),p.wrap.hasClass("has-text-field")&&!p.text.val()&&p.text.val(t.children(".item-title").text())},getUrlFromSelection:function(e){return e||(this.isMCE()?e=c.selection.getContent({format:"text"}):document.selection&&wpLink.range?e=wpLink.range.text:void 0!==this.textarea.selectionStart&&(e=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd))),(e=r.trim(e))&&h.test(e)?"mailto:"+e:e&&u.test(e)?e.replace(/&|?38;/gi,"&"):""},setDefaultValues:function(e){p.url.val(this.getUrlFromSelection(e)),p.search.val(""),wpLink.searchInternalLinks(),p.submit.val(l.save)},searchInternalLinks:function(){var e,t=p.search.val()||"";2':"",i+='',i+='',i+=this.title||l.noTitle,i+=''+this.info+"",a=!a}):t&&(i+=''+l.noMatchesFound+""),this.ul[t?"html":"append"](i)},maybeLoad:function(){var n=this,i=this.element,e=i.scrollTop()+i.height();!this.query.ready()||e