text: /*
   magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0
  */
  function rcube_elastic_ui(){function s(a,b,d){(a=v(a))&&rcmail.register_button(a.command,b,a.data.type,d,a.data.sel)}function t(a,b,d,c){var e=!0,h=$("<a>"),k=a.attr("id")||(new Date).getTime(),m=k+"-clone";d=a[0].className+(d?" "+d:"");if(b){if(c=a.data("popup"))h.data({popup:c,"toggle-button":a.data("toggle-button")}),D(h[0]),e=!1,rcmail.register_menu_button(h[0],c)}else d=$.trim(d.replace("btn-primary","primary").replace(/(btn[a-z-]*|button|disabled)/g,"")),d+=" button"+(!c?" disabled":"");h.attr({id:m,
  href:"#","class":d}).append($('<span class="inner">').text(a.text()));if(e)h.on("click",function(c){a.click()});n&&!b?(h.data("target",a),T.push($.extend({button_id:m},v(a[0].id)))):s(k,m,d.replace(" disabled",""));return h}function v(a){var b,d,c;for(c in rcmail.buttons)for(b=0;b<rcmail.buttons[c].length;b++)if(d=rcmail.buttons[c][b],d.id==a)return{command:c,index:b,data:d}}function A(){$("[data-list]").filter("ul,table").each(function(){var a,c=$(this),b=c.data("list");if(rcmail[b]&&rcmail[b].multiselect){var d,
  e=c.parents("layout-sidebar,#layout-list,#layout-content").last();d=e.find(".header");var g=d.find("ul");if(g.length){if(a=g.find("a.select").data("toggle-button"))a=$("#"+a)}else g=d;rcmail[b].enable_checkbox_selection();a||(a=$("<a>").attr({"class":"button selection disabled",role:"button",title:rcmail.gettext("select")}).on("click",function(){$(this).is(".active")&&c.toggleClass("withselection")}).append($('<span class="inner">').text(rcmail.gettext("select"))),g.is(".menu")?(a.prependTo(g).wrap('<li role="menuitem">'),
  f.content&&(e=t(a,!0,"hidden-big hidden-large"),$('<li role="menuitem">').append(e).appendTo("#toolbar-menu"),a=a.add(e))):(d=c.data("list-select-replace"))?$(d).replaceWith(a):(a.appendTo(g).addClass("icon"),e.is("#layout-sidebar")||a.addClass("toolbar-button")));rcmail.addEventListener("listupdate",function(c){c.list&&c.list==rcmail[b]&&(c.rowcount?a.addClass("active").removeClass("disabled").attr("tabindex",0):a.removeClass("active").addClass("disabled").attr("tabindex",-1))})}J&&rcmail[b]&&("function"==
  typeof rcmail[b].draggable?rcmail[b].draggable("destroy"):"boolean"==typeof rcmail[b].draggable&&(rcmail[b].draggable=!1))});window.MutationObserver&&$("[data-label-msg]").filter("ul,table").each(function(){var a,c,b=$('<div class="listing-info hidden">').insertAfter(this),d=$(this);a=function(){var a,c,e=d.data("label-msg");a=d.is("ul")?d:d.children("tbody");if(!rcmail.env.search_request&&!rcmail.env.qsearch&&e&&!a.children(":visible").length){a=d.data("label-ext");c=d.data("create-command");if(a&&
  (!c||rcmail.commands[c]))e+=" "+a;b.text(e).removeClass("hidden")}else b.addClass("hidden")};c=function(){if(rcmail.busy||!d.is(":visible"))return setTimeout(c,250);clearTimeout(g.list_timer);g.list_timer=setTimeout(a,50)};(new MutationObserver(c)).observe(d[0],{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]});c()});"print"!=rcmail.env.action&&$("#attachment-list > li").each(function(){U(this)});var a=function(a){"phone"==q&&rcmail.display_message(rcmail.gettext(a),"confirmation")};
  rcmail.addEventListener("fileappended",function(c){c.attachment.complete&&(U(c.item),"text/vcard"==c.attachment.mimetype&&rcmail.commands["attach-vcard"]&&a("vcard_attachments.vcardattached"))}).addEventListener("managesieve.insertrow",function(a){p(a.obj)}).addEventListener("add-recipient",function(){a("recipientsadded")});rcmail.init_pagejumper(".pagenav > input");if("mail"==rcmail.task){if("compose"==rcmail.env.action&&(rcmail.addEventListener("compose-encrypted",function(a){$("a.mode-html, button.attach").prop("disabled",
  a.active);$("a.attach, a.responses:not(.edit)")[a.active?"addClass":"removeClass"]("disabled")}),$("#layout-sidebar > .footer:not(.pagenav) > a.button").click(function(){$(this).is(".disabled")&&rcmail.display_message(rcmail.gettext("nocontactselected"),"warning")}),window.MutationObserver)){var b=$("#attachment-list"),d=function(){V("attach",0<b.children().length)};(new MutationObserver(d)).observe(b[0],{childList:!0});d()}!rcmail.env.extwin&&("compose"==rcmail.env.action||"show"==rcmail.env.action)&&
  $("a.mail",f.menu).attr({"aria-disabled":!1,onclick:"return rcmail.command('list','',this,event);"});("preview"==rcmail.env.action||"show"==rcmail.env.action)&&$("a").filter('[href^="mailto:"]').each(function(){ha(this)})}else"settings"==rcmail.task&&(rcmail.addEventListener("identity-encryption-show",function(a){p(a.container)}),rcmail.addEventListener("identity-encryption-update",function(a){p(a.container)}));rcmail.set_env({thread_padding:"1.5rem",popup_width_small:1025,popup_width:1200});rcmail.env.devel_mode&&
  window.less?less.pageLoadFinished.then(function(){E();rcmail.env.compose_focus_elem&&$(rcmail.env.compose_focus_elem).focus()}):E();var c,e=rcmail.env.date_format_localized;e&&(c=function(a){$(a).filter(".datepicker").attr("placeholder",e);$(a).parent().find("select").each(function(){K(this)})},$("input.datepicker").each(function(){c(this)}),rcmail.addEventListener("insert-edit-field",c))}function p(a){a||(a=document);$("input.button,button",a).not(".btn").addClass("btn").not(".btn-primary,.primary,.mainaction").addClass("btn-secondary");
  $("input.button.mainaction,button.primary,button.mainaction",a).addClass("btn-primary");$("button.btn.delete,button.btn.discard",a).addClass("btn-danger");$.each(["warning","error","information","confirmation"],function(){var c=this;$(".box"+c+":not(.ui.alert)",a).each(function(){L(this,c,!0)})});if(a!=document&&1==$(".popup",a).children().length){var b=$(".popup",a).children().first();if(b.is("img"))$(".popup",a).addClass("justified");else if(b.is("label")){var d=b.find("input").detach(),b=b.detach(),
  c=d.attr("id");c||d.attr("id",c="dialog-input-elastic");$(".popup",a).addClass("formcontent").append($('<div class="form-group row">').append(b.attr("for",c).addClass("col-sm-2 col-form-label")).append($('<div class="col-sm-10">').append(d)));d.focus()}}$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",$(".propform",a)).addClass("form-control");$("[type=checkbox]",$(".propform",a)).addClass("form-check-input");$("select",a).addClass("form-control custom-select");a!=
  document&&$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",a).addClass("form-control");$("table.propform",a).each(function(){var a=0,c=0,b=["sm",4,8];$(this).attr("class").match(/cols-([a-z]+)-(\d)-(\d)/)&&(b=[RegExp.$1,RegExp.$2,RegExp.$3]);$(this).find("> tbody > tr, > tr").each(function(){var d,l,f=$(this),g=["form-group","row"];l=f.children("td");2==l.length?(d=l.first(),l=l.last(),$("label",d).addClass("col-form-label"),d.addClass("col-"+b[0]+"-"+b[1]),l.addClass("col-"+
  b[0]+"-"+b[2]),1==l.find("[type=checkbox]").length&&!l.find(".proplist").length?(g.push("form-check"),l.find("a").length&&g.push("with-link"),c++):l.find("input:not([type=hidden]),textarea,radio,select").length?c++:(l.addClass("form-control-plaintext"),a++),l.children(".datepicker")&&2==l.children("input").length&&l.addClass("datetime")):1==l.length&&l.css("width","100%");f.addClass(g.join(" "))});a>c&&$(this).addClass("text-only")});$("td.input-group",a).each(function(){$(this).children().slice(1).addClass("input-group-append")});
  $("fieldset.propform:not(.groupped) div.row",a).each(function(){var a=0<$("input:not([type=hidden]),select,textarea",this).length;a&&$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",this).addClass("form-control");$(this).children().last().addClass("col-sm-8"+(!a?" form-control-plaintext":""));$(this).children().first().addClass("col-sm-4 col-form-label");$(this).addClass("form-group")});$("fieldset.propform.groupped fieldset",a).each(function(){$(".row",this).each(function(){var a,
  c=0<$("input,select,textarea",this).length,b=$(this).children();c&&$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",this).addClass("form-control");2>b.length||(a=b.first(),a.is("select")?a.addClass("input-group-prepend"):a.wrap('<span class="input-group-prepend">').addClass("input-group-text"),c||b.last().addClass("form-control-plaintext"),$(".content",this).addClass("input-group-prepend input-group-append input-group-text"),$("a.deletebutton",this).addClass("input-group-text icon delete").wrap('<span class="input-group-append">'),
  $(this).addClass("input-group"))})});$("fieldset.advanced",a).each(function(){var a=$(this).children(".propform").first();a.wrap($("<div>").addClass("collapse"));$(this).children("legend").first().addClass("closed").on("click",function(){a.parent().collapse("toggle");$(this).toggleClass("closed")})});$(".propform > .prop.block:not(.row)",a).each(function(){$(this).addClass("form-group row").each(function(){$("label",this).addClass("col-form-label").wrap($('<div class="col-sm-4">'));$("input,select,textarea",
  this).wrap($('<div class="col-sm-8">'));$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",this).addClass("form-control")})});$("td.rowbuttons > a",a).addClass("btn");$("form.tabbed,div.tabbed",a).each(function(a,c){var b=[],d=$("<ul>").attr({"class":"nav nav-tabs",role:"tablist"});$(this).addClass("tab-content").children("fieldset").each(function(c,d){var h;h=d.id||"tab"+a+"-"+c;var m=$(d).data("navlink-class");$(d).addClass("tab-pane").attr({id:h,role:"tabpanel"});
  h=$("<li>").addClass("nav-item").append($("<a>").addClass("nav-link"+(m?" "+m:"")).attr({role:"tab",href:"#"+h}).text($("legend",d).first().text()).click(function(a){$(this).tab("show");x(a);return!1}));$("legend",d).first().hide();b.push(h)});d.append(b).insertBefore(c);$("a.nav-link",d).first().click()});$("input[type=file]:not(.custom-file-input)",a).each(function(){var a=rcmail.gettext("choosefile"+(this.multiple?"s":"")),c=$("<label>").attr({"class":"custom-file-label","data-browse":rcmail.gettext("browse")}).text(a);
  $(this).addClass("custom-file-input").wrap('<div class="custom-file">');$(this).on("change",function(){var c=a;this.files.length&&(c=this.files[0].name,1<this.files.length&&(c+=", ..."));$(this).next().text(c)}).parent().append(c)});$("table:not(.table,.compact-table,.propform,.listing,.ui-datepicker-calendar)",a).filter(function(){return!$(this).parent().is(".propform")&&!$(this).parents(".message-htmlpart,.message-partheaders,.boxinformation,.raw-tables").length}).each(function(){var a=$(this).addClass("table");
  a.parent().addClass("table-responsive-sm");a.find("thead").addClass("thead-default")});$("input.pretty-checkbox, .propform input[type=checkbox], .form-check input, .popupmenu.form input[type=checkbox], .menu input[type=checkbox]",a).each(function(){F(this)});$(a).is(".actionrow")&&$("input[type=checkbox]",a).each(function(){F(this)});$(".input-group-combo > select",a).first().on("change",function(){var a=$(this),c=function(){a[a.next().is(":visible")?"removeClass":"addClass"]("alone")};setTimeout(c,
  50);setTimeout(c,2E3)}).trigger("change");$("#message-objects",a).children(":not(.ui.alert)").add(".part-notice").each(function(){var a=String($(this).removeClass("notice part-notice").attr("class")).split(/\s/)[0]||"warning";L(this,a);$(this).addClass("box"+a);$("a",this).addClass("btn btn-primary btn-sm")});$(".error",a).addClass("is-invalid");"login"==rcmail.env.task&&a==document&&($("#rcmloginsubmit").addClass("btn-lg text-uppercase w-100"),$("#login-form table tr").each(function(){var a=$("input,select",
  this),c=$("label",this),b=a.data("icon"),d=$("<i>").attr("class","input-group-text icon "+a.attr("name").replace("_",""));b&&d.addClass(b);$(this).addClass("form-group row");c.parent().css("display","none");a.addClass(a.is("select")?"custom-select":"form-control").attr("placeholder",c.text()).before($('<span class="input-group-prepend">').append(d)).parent().addClass("input-group input-group-lg")}));$("select:not([multiple])",a).each(function(){K(this)})}function ia(a){if($(a).is(".mce-window")){var b=
  $(a).find(".mce-window-body"),d=$(a).find(".mce-foot > .mce-container-body");b.length&&p(b[0]);b.find("button").filter(function(){return 0<$(this).parent(".mce-btn").length}).removeClass("btn btn-secondary");5===d.children(".mce-widget").length&&d.addClass("mce-search-foot");$(a).find(".mce-charmap").parent().parent().addClass("mce-charmap-dialog");$(a).find(".mce-combobox").each(function(){$(this).children(".mce-btn").length||$(this).addClass("mce-combobox-fake")});$(a).find(".mce-form > .mce-container-body").each(function(){4<
  $(this).children(".mce-formitem").length&&$(this).addClass("mce-form-split")});$(a).find(".mce-form").next(":not(.mce-formitem)").addClass("mce-form");if(!u()){var c=0,d=b.height();$(a).find(".mce-form").each(function(){c=Math.max(c,$(this).height())});d<c&&(c+=(b.find(".mce-tabs").height()||0)+25,b.height(c),$(a).height($(a).height()+(c-d)),$(a).css("top",($(window).height()-$(a).height())/2+"px"))}}else $(a).is(".mce-menu")&&($(a).prepend($('<h3 class="popover-header">').append($('<a class="button icon "cancel">').text(rcmail.gettext("close")).on("click",
  function(){$(document.body).click()}))),window.MutationObserver&&(new MutationObserver(function(){"phone"==q&&($(".mce-menu:visible").length?$("div.mce-overlay").length||$("<div>").attr("class","popover-overlay mce-overlay").appendTo("body").click(function(){$(this).remove()}):$("div.mce-overlay").click())})).observe(a,{attributes:!0}))}function ja(a,b){if(a.match(/_action=(create|add)/)||a.match(/_nav=hide/))$(g.frame_nav).addClass("hide-nav-buttons");else{var d,c,e,h=$("[data-list]",f.list).data("list");
  if(!h||!(e=rcmail[h]))$(g.frame_nav).is(".hide-nav-buttons")&&!$(".buttons",g.frame_nav).children().length&&$(g.frame_nav).addClass("hidden");else{$(g.frame_nav).removeClass("hide-nav-buttons hidden");if(c=e.get_single_selection())e.rows&&e.rows[c]&&!e.rows[c].expanded?e.expand_row(b,c):e.get_node&&((d=e.get_node(c))&&d.collapsed)&&e.expand(c);var k,m,l=$("#"+rcmail.env.contentframe);d=$("a.button.next",g.frame_nav).off("click").addClass("disabled");c=$("a.button.prev",g.frame_nav).off("click").addClass("disabled");
  if((m=e.get_next())||rcmail.env.current_page<rcmail.env.pagecount)d.removeClass("disabled").on("click",function(){g.content_lock=!0;G(l);m?e.select(m):(rcmail.env.list_uid="FIRST",rcmail.command("nextpage"))});if((k=e.get_prev())&&("*"!=k||"subscription_list"!=h)||1<rcmail.env.current_page)c.removeClass("disabled").on("click",function(){g.content_lock=!0;G(l);k?e.select(k):(rcmail.env.list_uid="LAST",rcmail.command("previouspage"))})}}}function ka(a){var b=[],d=$("#"+a.id).parent().is(".html-editor");
  a.config.plugins+=" autoresize";H().touch&&(a.config.toolbar_items_size=null,a.config.toolbar="undo redo | insert | styleselect",a.config.plugins.match(/emoticons/)&&(a.config.toolbar+=" emoticons"));if("mail"==rcmail.task&&"compose"==rcmail.env.action){var c=$("#compose-content > form"),e=function(a){"Tab"==a.key&&a.shiftKey&&$("#compose-content > form").scrollTop(0)};b.push(function(a){a.on("keypress",e)});$("#composebody").on("keypress",e);c.on("scroll",function(){var a=$(".mce-container-body",
  c),b=$(".mce-top-part",a),d=a.offset(),e=c.offset().top;d&&0>d.top-e?b.css({position:"fixed",top:e+"px",width:a.width()+"px"}):b.css({position:"relative",top:0,width:"auto"})});$(window).resize(function(){c.trigger("scroll")})}d&&(a.config.toolbar="plaintext | "+a.config.toolbar,a.config.setup_callback=function(a){a.addButton("plaintext",{tooltip:rcmail.gettext("plaintoggle"),icon:"plaintext",onclick:function(c){rcmail.command("toggle-editor",{id:a.id,html:!1},"",c.originalEvent)&&$("#"+a.id).parent().removeClass("ishtml")}})});
  rcmail.addEventListener("editor-load",function(a){$.each(b,function(){this(a.ref.editor)})})}function W(a){$("ul",a.obj).addClass("menu listing iconized");$(a.obj).addClass("popupmenu popover");p(a.obj);$("input",a.obj).addClass("form-control");if(u()&&$(a.obj).is(".googie_window")){var b=rcmail.gettext("close"),b=$("<a>").attr("class","button icon cancel").text(b).click(function(b){b.stopPropagation();$(".popover-overlay").remove();$(a.obj).hide()});$('<h3 class="popover-header">').append(b).prependTo(a.obj);
  $(".popover-overlay").length||$("<div>").attr("class","popover-overlay").appendTo("body").click(function(){$(this).remove()});$("ul,button",a.obj).click(function(a){$(a.target).is("input")||$(".popover-overlay").remove()})}}function la(a){n&&$.each(T,function(b,c){if(a.command==c.command)parent.$("#"+c.button_id)[a.status?"removeClass":"addClass"]("disabled")});if("mail"==rcmail.task)switch(a.command){case "reply-list":if(1==rcmail.env.reply_all_mode){var b=rcmail.gettext(a.status?"replylist":"replyall");
  $(".toolbar a.reply-all").attr("title",b).find(".inner").text(b)}break;case "compose-encrypted":a.status&&$(".toolbar a.encrypt").parent().show();break;case "compose-encrypted-signed":$("#encryption-menu-button").show()}}function X(){var a=$(window).width();J=1024>=a;q=480>=a?"phone":1200<a?"large":768<a?"normal":"small"}function E(){var a;X();M();ma();(a=u())?(rcmail.set_env(g.small_screen_config),rcmail.enable_command("extwin",!1)):(rcmail.set_env(g.config),rcmail.enable_command("extwin",!0));$.each(N,
  function(){$(this)[a?"hide":"show"]()})}function M(){if(n&&!f.sidebar.length&&!f.list.length)B();else{switch(q){case "phone":Y();y(!1);break;case "small":Y();y(!0);break;case "normal":na();break;case "large":oa()}"phone"==q&&$("#logo").data("src-small")?$("#logo").attr("src",$("#logo").data("src-small")):$("#logo").attr("src",$("#logo").data("src-default"));B();bw.webkit&&(bw.ipad&&bw.agent.match(/OS 9/))&&$(".iframe-wrapper").each(function(){var a=$(this).height();a&&$(this).children("iframe").height(a)})}}
  function ma(){var a=H(),b=$(document.documentElement);b[0].className.match(/layout-([a-z]+)/)?RegExp.$1!=a.mode&&b.removeClass("layout-"+RegExp.$1).addClass("layout-"+a.mode):b.addClass("layout-"+a.mode);a.touch&&!b.is(".touch")?b.addClass("touch"):!a.touch&&b.is(".touch")&&b.removeClass("touch")}function B(){$("#layout > div > .header").each(function(){var a,b=0,d=0,c={left:0,right:0};$(this).children(":visible:not(.position-absolute)").each(function(){!a&&$(this).is(".header-title")?a=$(this):c[a?
  "right":"left"]+=this.offsetWidth});0+c.right>=c.left?(b=0,d=c.right+0-c.left):(d=0,b=c.left-(0+c.right));$(a).css({"margin-right":b+"px","margin-left":d+"px","padding-right":"0px"})})}function na(){var a;f.list.length&&(a=f.list.is(g.last_selected)||!f.sidebar.is(g.last_selected)&&!f.sidebar.is(".layout-sticky"),f.list[a?"removeClass":"addClass"]("hidden"));f.sidebar.length&&(a=!f.list.length||f.sidebar.is(g.last_selected)||f.sidebar.is(".layout-sticky"),f.sidebar[a?"removeClass":"addClass"]("hidden"));
  f.content.removeClass("hidden");y(!0);Z();f.list.length&&$(".header > ul.menu",f.list).addClass("popupmenu")}function oa(){$.each(f,function(a,b){b.removeClass("hidden")});Z();f.list&&$(".header > ul.menu.popupmenu",f.list).removeClass("popupmenu")}function Y(){var a,b=!1;f.content.length&&(a=b=f.content.is(g.last_selected),f.content[a?"removeClass":"addClass"]("hidden"),$(".header > ul.menu",f.content).addClass("popupmenu"));f.list.length&&(a=!b&&f.list.is(g.last_selected),f.list[a?"removeClass":
  "addClass"]("hidden"),$(".header > ul.menu",f.list).addClass("popupmenu"));f.sidebar.length&&(a=!b&&(f.sidebar.is(g.last_selected)||!f.list.length),f.sidebar[a?"removeClass":"addClass"]("hidden"));b&&z.back_list.show()}function Z(){z.back_list.filter(function(){return 0==$(this).parents("#layout-sidebar").length}).hide();$("ul.menu.popupmenu").removeClass("popupmenu")}function O(a){f.list.addClass("hidden");f.sidebar.removeClass("hidden");a&&f.sidebar.addClass("layout-sticky");("small"==q||"phone"==
  q)&&f.content.addClass("hidden");B();g.last_selected=f.sidebar[0]}function P(a){!f.list.length&&!f.sidebar.length?history.back():(f.sidebar.addClass("hidden").removeClass("layout-sticky"),f.list.removeClass("hidden"),("small"==q||"phone"==q)&&pa(),a&&f.list.children(".scroller").scrollTop(0),g.last_selected=f.list[0]);B()}function pa(){g.last_selected=f.list[0]||f.sidebar[0];M();rcmail.show_contentframe(!1);$("[data-list]",f.list).each(function(){var a=$(this).data("list");rcmail[a]&&(rcmail[a].clear_selection?
  rcmail[a].clear_selection():rcmail[a].select&&rcmail[a].select())})}function y(a){a?("phone"==q&&($('<div id="menu-overlay" class="popover-overlay">').on("click",function(){y(!1)}).appendTo("body"),g.menu_initialized||(g.menu_initialized=!0,$("a",f.menu).on("click",function(a){"phone"==q&&y()})),f.menu.addClass("popover")),f.menu.removeClass("hidden")):($("#menu-overlay").remove(),f.menu.addClass("hidden").removeClass("popover"))}function qa(a){"loading"==a.type&&$(".iframe-loader:visible").length?
  rcmail.hide_message(a.object):(L(a.object,a.type,!0),$(a.object).attr("role","alert"))}function L(a,b,d){var c="ui alert",e=!$(a).is(".noicon");d&&(e&&!$(a).is(".aligned-buttons"))&&$(a).html($("<span>").html($(a).html()));b=b.split(" ")[0];if(b={information:"alert-info",notice:"alert-info",confirmation:"alert-success",warning:"alert-warning",error:"alert-danger",loading:"alert-info loading",uploading:"alert-info loading",vcardattachment:"alert-info"}[b])c+=" "+b,e&&$("<i>").attr("class","icon").prependTo(a);
  $(a).addClass(c)}function aa(a){var b=$(),d=$("a.button.options",a),c=$("input:not([type=hidden])",a),e=c.attr("placeholder");$("form",a);var h=function(){if(c.val()||"mail"==rcmail.task&&$("#s_interval").val()||rcmail.gui_objects.search_filter&&"ALL"!=$(rcmail.gui_objects.search_filter).val()||rcmail.gui_objects.foldersfilter&&"---"!=$(rcmail.gui_objects.foldersfilter).val())return!0},k=function(){$(a).is(".open")&&d.click()},m=function(){$(a)[h()?"addClass":"removeClass"]("active");b[rcmail.gui_objects.search_filter&&
  "UNSEEN"==$(rcmail.gui_objects.search_filter).val()?"addClass":"removeClass"]("selected")};c.is("#mailsearchform")&&(b=$("<a>").attr({"class":"button unread",href:"#",role:"button",title:rcmail.gettext("showunread")}).on("click",function(a){$(rcmail.gui_objects.search_filter).val($(a.target).is(".selected")?"ALL":"UNSEEN");rcmail.command("search")}).insertBefore(d));d.on("click",function(c){var b=$(this).data("target"),e=$("#"+b),h=$(a).is(".open");if(e.length){if(!h)if(C[b])C[b](e.get(0),this,c);
  else if("function"==typeof window[b])window[b](e.get(0),this,c);e.next()[h?"show":"hide"]();e.toggleClass("hidden");$(".floating-action-buttons").toggleClass("hidden");$(a).toggleClass("open");$("button.search",e).off("click.search").on("click.search",function(){d.click();m()})}});c.on("input change",m).on("focus blur",function(a){c.attr("placeholder","blur"==a.type?e:"")});$("a.reset",a).on("click",function(b){c.val("").change().trigger("keyup.treelist",{keyCode:27});$(a).is(".open")&&d.click();
  rcmail.gui_objects.search_filter&&$(rcmail.gui_objects.search_filter).val("ALL");rcmail.gui_objects.foldersfilter&&($(rcmail.gui_objects.foldersfilter).val("---").change(),rcmail.folder_filter("---"));m()});rcmail.addEventListener("init",m).addEventListener("responsebeforesearch",m).addEventListener("beforelist",k).addEventListener("afterlist",m).addEventListener("beforesearch",k)}function D(a,b){if(n&&u())return parent.UI.popup_init(a,b||window);b||(b=window);var d,c=$(a).data("popup"),e=$(b.$("#"+
  c).get(0)),h=e,k=$(a).attr("title");$(a).attr({"aria-haspopup":"true","aria-expanded":"false","aria-owns":c}).popover({content:function(){b!=window&&(e=h.clone(!0,!0),e.attr("id",c+"-clone").appendTo(document.body).find("li > a").attr("onclick","").off("click").on("click",function(c){$(this).is(".disabled")||($(a).popover("hide"),b.$("#"+$(this).attr("id")).click());return!1}));return e.get(0)},trigger:$(a).data("popup-trigger")||"click",placement:$(a).data("popup-pos")||"bottom",animation:!0,boundary:"window",
  html:!0}).on("show.bs.popover",function(h){var k=e.data("popup-init");c&&r[c]&&(r[c].transitioning=!0);if(k&&C[k])C[k](e.get(0),a,h);else if(k&&b[k])b[k](e.get(0),a,h);d=$("div.popover:visible").length+1;e.removeClass("hidden").attr("aria-hidden",!1).find('[aria-haspopup="true"]').data("level",d+1).off("click.popup").on("click.popup",function(a){a.stopPropagation()});u()||e.css("max-height",Math.min(539,$(window).height()-30))}).on("shown.bs.popover",function(b){b=u();var e=$("#"+$(a).attr("aria-describedby"));
  d=$(a).data("level")||1;if(b){var h=1<d?"back":"close",k=rcmail.gettext(h),h="button icon "+("back"==h?"back":"cancel");$(".popover-header",e).empty().append($("<a>").attr("class",h).text(k).on("click",function(c){$(a).popover("hide");1<d&&c.stopPropagation()}).on("mousedown",function(a){a.stopPropagation()}))}$.each(r,function(a,b){$(b.target).data("level")==d&&a!=c&&I(a)});"key"==$(a).data("event")&&(e.off("keydown.popup").on("keydown.popup","a.active",function(c){var b,d="next";switch(c.which){case 27:case 9:return $(a).popover("toggle").focus(),
  !1;case 38:case 63232:d="previous";case 40:case 63233:for(c=c.target.parentNode;c=c[d+"Sibling"];)if(b=$(c).children(".active")[0]){b.focus();break}return!1}}),e.find("a.active").first().focus());c&&r[c]&&(r[c].transitioning=!1);b&&!$(".popover-overlay").length&&$("<div>").attr("class","popover-overlay").appendTo("body").click(function(){$(this).remove()});$(".popover-body",e).addClass("webkit-scroller")}).on("hide.bs.popover",function(){1==d&&$(".popover-overlay").remove();c&&(r[c]&&e.is(":visible"))&&
  (r[c].transitioning=!0)}).on("hidden.bs.popover",function(){/-clone$/.test(e.attr("id"))?e.remove():e.attr("aria-hidden",!0).addClass("hidden").appendTo(e.data("popup-parent")||document.body);$(".popover-body:empty").each(function(){$(this).parent().remove()});c&&r[c]&&delete r[c]}).on("click",function(){$(this).data("event","mouse")}).on("keydown",function(a){if(a.originalEvent)switch(a.originalEvent.which){case 13:case 32:a.preventDefault();$(this).data("event","key").popover("toggle");break;case 27:$(this).popover("hide")}});
  k&&$(a).attr("title",k);e.attr("aria-hidden","true").data("button",a);if(e.data("editable"))e.on("click mousedown",function(a){a.stopPropagation()})}function x(a){Q&&Q>(new Date).getTime()-250||$(".popover.show").each(function(){var b=$(".popover-body",this).children().first().data("button");b&&(a.target!=b&&!$(b).find(a.target).length&&"string"!==typeof b)&&$(b).popover("hide");b||$(this).remove()})}function R(a){if(a&&a.name&&!(a.props&&!1===a.props.skinable)){if(n&&u())return a.win||(a.win=window),
  parent.UI.menu_toggle(a);if("messagelistmenu"==a.name)ra(a);else if("menu-open"==a.event){var b,d,c=$("ul",a.obj).first(),e=a.props&&a.props.link?a.props.link:a.originalEvent.target;$(e).is("span")&&(e=$(e).parents("a,li")[0]);a.name.match(/^drag/)&&(d=rcube_event.get_mouse_pos(a.originalEvent),e=$("<a>").css({position:"absolute",left:d.x,top:d.y,height:"1px",width:"1px",visibility:"hidden"}).appendTo(document.body).get(0));d=$(e).data("popup-pos")||"right";"folder-selector"==a.name?c.addClass("listing folderlist"):
  "addressbook-selector"==a.name||"contactgroup-selector"==a.name?c.addClass("listing contactlist"):c.hasClass("menu")&&c.addClass("listing");"pagejump-selector"==a.name&&(c.addClass("simplelist"),a.obj.addClass("simplelist"),d="top");r[a.name]&&I(a.name,a.originalEvent);b=function(){if(r[a.name]&&r[a.name].transitioning)return setTimeout(b,50);$(e).data("popup")||($(e).data({event:rcube_event.is_keyboard(a.originalEvent)?"key":"mouse",popup:a.name,"popup-pos":d,"popup-trigger":"manual"}),D(e,a.win));
  r[a.name]={target:e};$(e).popover("show")};b()}else I(a.name,a.originalEvent);a.originalEvent.stopPropagation()}}function I(a,b){var d;d=a;var c;r[d]?c=r[d].target:(c=$("#"+d).data("button"),c||(d.match(/(?!-)menu$/)&&(d=d.substr(0,d.length-4)),c=$("#"+d+"-menu").data("button")));d=c;a.match(/^drag/)?$(d).popover("dispose").remove():($(d).popover("hide"),"forwardmenu"==a&&x(b))}function ra(a){a=$("#listoptions-menu");a.width();var b=a.clone(!0);$('select[name="sort_col"]',b).val(rcmail.env.sort_col||
  "");$('select[name="sort_ord"]',b).val(rcmail.env.sort_order||"ASC");$('select[name="mode"]',b).val(rcmail.env.threading?"threads":"list");$("select",b).each(function(){this.id+="-clone"});$("label",b).each(function(){$(this).attr("for",$(this).attr("for")+"-clone")});b=rcmail.simple_dialog(b,rcmail.gettext("listoptionstitle"),function(a){rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus();a=$('select[name="sort_col"]',b).val();var c=$('select[name="sort_ord"]',b).val(),e=$('select[name="mode"]',
  b).val();rcmail.set_list_options([],a,c,"threads"==e?1:0);return!0},{closeOnEscape:!0,minWidth:400})}function ba(a,b){var d,c;d=rcmail.env.task;var e=rcmail.env.search_mods,h=rcmail.env.mailbox,k=$("#s_scope",a).val(),f=$("#s_interval",a).val();"all"==k&&(h="*");e||(e={});"mail"==d?(e[h]||(e[h]=rcube_clone_object(e["*"])),c=e[h],d="text",rcmail.env.search_scope=k,rcmail.env.search_interval=f):(c=e,d="*");b&&(b.checked?c[b.value]=1:delete c[b.value],b.value==d&&$('input[name="s_mods[]"]',a).map(function(){this!=
  b&&(this.checked=!0,b.checked?(this.disabled=!0,delete c[this.value]):(this.disabled=!1,c[this.value]=1))}),rcmail.set_searchmods(c))}function V(a,b){var d=$("#composestatusbar"),c=d.find("a.button.icon."+a);b?c.length||$("<a>").attr("class","button icon "+a).on("click",function(){O()}).appendTo(d):c.remove()}function ca(a,b,d){var c=$(b).parent().attr("id").replace(/^attach/,"");$.each(["open","download","rename"],function(){var b=this;$("#attachmenu"+b,a).off("click").attr("onclick","").click(function(a){return rcmail.command(b+
  "-attachment",c,this,a.originalEvent)})});return rcmail.command("menu-open",{menu:"attachmentmenu",id:c},a,d)}function U(a){a=$(a);if(!a.is(".no-menu")&&!a.children(".dropdown").length){var b=rcmail.gettext("options"),d=a.find("a.filename"),c=$("<a>").attr({href:"#",tabindex:d.attr("tabindex")||0,title:b,"class":"button icon dropdown skip-content"}).on("click",function(a){return ca($("#attachmentmenu"),c,a)}).append($("<span>").attr("class","inner").text(b));d.length?c.insertAfter(d):c.appendTo(a)}}
  function da(a,b,d,c){var e=$(b).attr("href").replace(/^mailto:/,"");if(0>e.indexOf("@"))return!0;a.find("a").off("click").removeClass("active");if(rcmail.env.has_writeable_addressbook)$(".addressbook",a).addClass("active").on("click",function(a){var c=e,d=$(b).filter(".rcmContactAddress").text(),c=c.split("?")[0].split(",")[0].replace(/(^<|>$)/g,"");d&&(d=d.replace("<"+c+">",""),c='"'+$.trim(d)+'" <'+c+">");return rcmail.command("add-contact",c,this,a.originalEvent)});$(".compose",a).addClass("active").on("click",
  function(a){c?(b.onclick=c,$(b).trigger("click",[!0]),b.onclick=null):rcmail.command("compose",e,this,a.originalEvent);return!1});return rcmail.command("menu-open",{menu:"mailto-menu",link:b},b,d.originalEvent)}function ha(a){var b=a.onclick;a.onclick=null;$(a).on("click",function(d,c){return c||da($("#mailto-menu"),a,d,b)})}function sa(a){var b=$("#quotadisplay"),d=b.find(".bar"),c=a.total?a.percent:0;d.length||(d=$('<span class="bar"><span class="value"></span></span>').appendTo(b));0<c&&10>c&&
  (c=10);d.find(".value").css("width",c+"%")[90<=c?"addClass":"removeClass"]("warning");b.attr({"data-original-title":"",title:b.find(".count").attr("title")});if(a.table)b.css("cursor","pointer").data("popup-pos","top").off("click").on("click",function(c){rcmail.simple_dialog(a.table,"quota",null,{cancel_button:"close"})});else b.tooltip("dispose").tooltip({trigger:u()?"click":"hover"})}function ta(a){var b,d,c="",e=function(){d.css("width",Math.max(5,15*d.val().length+10))},h=function(){$(a).val(b.text()+
  d.val())},k=function(a,c,b){var e=$('<li class="recipient">'),f=$('<span class="name">').html(ua(a||c)).on("dblclick",function(a){va(a,k)}),m=$('<span class="email">'),g=$("<a>").attr({"class":"button icon remove"}).click(function(){e.remove();h();d.focus();return!1});a&&(c=" <"+c+">");m.text((a?c:"")+",");e.attr("title",a?a+c:null).append([f,m,g]);b?b.replaceWith(e):e.insertBefore(d.parent());h()},f=function(a){a=(a||d.val()).replace(/[,;\s]+$/,"");a=ea(a);$.each(a.recipients,function(){k(this.name,
  this.email)});d.val(a.text);h();e();return 0<a.recipients.length};d=$("<input>").attr({type:"text",tabindex:$(a).attr("tabindex")}).on("paste change",function(a){var c,b=this.value;"paste"==a.type&&(c=(a.originalEvent.clipboardData||window.clipboardData).getData("text")||"",b=b.substring(0,this.selectionStart)+c+b.substring(this.selectionEnd),a.preventDefault());f(b)}).on("input",e).on("keydown",function(a){if(8==a.keyCode&&!d.val().length)return b.children("li.recipient").last().remove(),h(),!1;
  if((","==a.key||";"==a.key||"Enter"==a.key&&!rcmail.ksearch_visible())&&f())return!1;e()}).on("blur",function(){b.removeClass("focus")}).on("focus mousedown",function(){b.addClass("focus")});b=$("<ul>").addClass("form-control recipient-input ac-input rounded-left").append($("<li>").append(d)).on("mouseup",function(){c=window.getSelection().toString()}).on("click",function(){c.length||d.focus()});$(a).css({position:"absolute",opacity:0,left:"-5000px",width:"10px"}).attr("tabindex",-1).after(b).on("focus",
  function(a){d.focus();a.preventDefault()}).on("change",function(){$("li.recipient",b).remove();d.val(this.value).change()}).change();rcmail.init_address_input_events(d)}function ea(a){a=$.trim(a.replace(/[,;\s]*[\r\n]+/g,","));var b=[],d=/(<(\S+|("[^"]+"))@\S+>)/,c=/((\S+|("[^"]+"))@\S+)/,e=a.match(/(?=\S)[^",;]*(?:"[^\\"]*(?:\\[,;\S][^\\"]*)*"[^",;]*)*/g);$.each(e||[],function(){if(this.length&&(d.test(this)||c.test(this))){var e=RegExp.$1,k=$.trim(this.replace(e,""));b.push({name:k,email:e.replace(/(^<|>$)/g,
  ""),text:this});a=a.replace(this,"")}});a=a.replace(/[,;]+/,",").replace(/^[,;\s]+/,"");return{recipients:b,text:a}}function ua(a){var b,d,c="",e=a.length;'"'!=a.charAt(0)&&-1<a.indexOf('"')&&(a='"'+a.replace("\\","\\\\").replace('"','\\"')+'"');for(b=0;b<e;b++)switch(d=a.charAt(b),d){case '"':if(0<b&&b<e-1){c+='"';break}c+='<span class="quotes">'+d+"</span>";break;case "\\":c+='<span class="quotes">'+d+"</span>";"\\"==a.charAt(b+1)&&(c+=d,b++);break;case "<":c+="&lt;";break;case ">":c+="&gt;";break;
  default:c+=d}return c}function va(a,b){var d=$(a.target).parents(".recipient"),c=d.text().replace(/,+$/,""),e=$("<input>").attr({type:"text",size:50}).val(c),h=$("<label>").text(rcmail.gettext("recipient")).append(e);rcmail.simple_dialog(h,"recipientedit",function(){var a;if(a=e.val()){if(a!=c){a=ea(a);if(1!=a.recipients.length)return!1;b(a.recipients[0].name,a.recipients[0].email,d)}return!0}})}function wa(a){var b=$("<a>").attr({"class":"icon button delete",href:"#"}).click(function(a){rcmail.command("delete-photo",
  "",this,a);return!1}),d=$(a).find("img")[0],c=function(){var c=-1!=(d.currentSrc||d.src).indexOf(rcmail.env.photo_placeholder);$(a)[c?"removeClass":"addClass"]("changed")};$(a).append(b).click(function(){rcmail.upload_input("upload-form")});c();$(d).on("load",c)}function G(a){a=$(a);if(a.length){var b=$('<div class="iframe-loader">').append($('<div class="spinner spinner-border" role="status">').append($('<span class="sr-only">').text(rcmail.gettext("loading"))));a.on("load error loaded",function(){setTimeout(function(){b.remove()},
  500)}).parent().append(b);fa&&a.parent().addClass("ios-scroll")}}function F(a){var b,d;a=$(a);if(!a.is(".custom-control-input")){if(!(d=a.attr("id")))d="icochk"+ ++g.checkboxes,a.attr("id",d);a.parent().is("label")?(b=a.parent(),a=a.detach(),b.before(a)):b=$("<label>");b.attr({"for":d,"class":"custom-control-label",title:a.attr("title")||""}).on("click",function(a){a.stopPropagation()});a.addClass("form-check-input custom-control-input").wrap('<div class="custom-control custom-switch">').parent().append(b)}}
  function xa(a){var b=$(a.row).find("input[id^=icochk]");b.length&&(a="icochk"+ ++g.checkboxes,b.attr("id",a).next("label").attr("for",a))}function K(a){if(!bw.iphone&&!bw.ipad&&(a=$(a),!a.is(".pretty-select"))){var b="select"+a.attr("id")+a.attr("name"),d=function(){if(a[0].ownerDocument.defaultView.$(".select-menu .listing").data("ident")==b)return!0},c=function(){var c=d();a.popover("dispose").focus();return!c},e=function(d){var e,f=-1,g=[],n=[],r=a.closest(".ui-dialog")[0],q=(document.documentElement.clientHeight||
  $(document.body).height())-75,s=$(document.body).width()-20,t=Math.min(a.outerWidth(),s),v=a.val();u()||(q*=0.5);x(d);$("option",a).each(function(){var a=$(this).text(),c=$('<a href="#">').data("value",this.value).addClass(this.disabled?"disabled":"active"+(this.value==v?" selected":""));a.length?(c.text(a),n.push(this.disabled?"":a.charAt(0).toLowerCase())):(c.html("&nbsp;"),n.push(""));g.push($("<li>").append(c))});var p=$('<ul class="listing selectable iconized">').attr("data-ident",b).data("button",
  a[0]).append(g).on("click","a.active",function(){var b=$(this).data("value"),d=c();a.val(b).change();return d}).on("keydown","a.active",function(a){var b,d;b="next";switch(a.which){case 27:case 9:return c();case 13:case 32:return $(this).click(),!1;case 38:case 63232:b="previous";case 40:case 63233:for(a=a.target.parentNode;a=a[b+"Sibling"];)if(d=$(a).children(".active")[0]){d.focus();break}return!1;default:if((b=a.originalEvent.key)&&1==b.length)b=b.toLowerCase(),e!=b&&(f=-1),a=n.indexOf(b,f+1),
  (-1<a||-1<(a=n.indexOf(b)))&&p.find("a").eq(a).focus(),e=b,f=a}});a.popover("dispose").popover({container:r||document.body,content:p[0],placement:"bottom",trigger:"manual",boundary:"viewport",html:!0,offset:"0,2",sanitize:!1,template:'<div class="popover select-menu" style="min-width: '+t+"px; max-width: "+s+'px"><div class="popover-header"></div><div class="popover-body" style="max-height: '+q+'px"></div></div>'}).on("shown.bs.popover",function(){a.focus();p.parent().prev().empty().append($('<a class="button icon cancel">').text(rcmail.gettext("close")).on("click",
  function(a){a.stopPropagation();return c()}));var b=p.find("a.selected").first();if(b.focus().length){var g=p.parent();f=p.find("a").index(b[0]);e=n[f];5<f&&g.scrollTop(g.scrollTop()+g.height()/2)}else rcube_event.is_keyboard(d)&&p.find("a.active").first().focus();p.on("mousedown",function(a){a.stopPropagation()})}).popover("show")};a.addClass("pretty-select custom-select form-control").on("mousedown keydown",function(b){a=$(b.target);if(!a.prop("disabled")){if(9==b.which)return c(),!0;if(27==b.which||
  "mousedown"==b.type&&d())return c();a.focus();a.prop("disabled",!0);setTimeout(function(){a.prop("disabled",!1)},0);b.stopPropagation();if("mousedown"==b.type||13==b.which||32==b.which||40==b.which||63233==b.which)return e(b),Q=(new Date).getTime(),!1}})}}function ya(a){var b=!1,d=$(a),c=d.parent(),e=$('<a class="mce-i-html" href="#" tabindex="-1"></a>').attr("title",rcmail.gettext("htmltoggle")).on("click",function(a){rcmail.command("toggle-editor",{id:d.attr("id"),html:!0},"",a.originalEvent)&&
  c.addClass("ishtml")}).on("keydown",function(a){if(9==a.which)return d.focus(),!1}),h=$('<div class="editor-toolbar">').append(e);c.is("td")?(a=$('input[type="checkbox"]',c.parent().next()),b=!0):a=d.next("select.hidden");za(d);1==a.length&&(c.addClass("html-editor"),d.after(h).data("control",a).on("keydown",function(a){a.altKey&&121==a.which&&e.focus()}),b&&(a.parents("tr").first().hide(),c.prev().hide(),c.addClass("col-sm-12")))}function za(a){$(a).css("overflow-y","hidden").on("input",function(a){clearTimeout(g.textarea_timer);
  g.textarea_timer=setTimeout(function(){var d=$(a.target),c=d.data("initial-height"),e=d[0].scrollHeight;e&&(c||d.data("initial-height",c=e),2==d.outerHeight()-e&&(e-=19),d.outerHeight(Math.max(c,e)))},10)}).trigger("input");setInterval(function(){$(a).trigger("input")},1E3)}function S(a,b,d,c,e,h){c=$('<div class="input-group"><input type="text" class="form-control"><span class="input-group-append"><a class="icon reset input-group-text" href="#"></a></span></div>');b={value:b,name:d+"[]"};e&&(b.size=
  e);$("input",c).attr(b).keydown(function(c){var b=$(this);if(13==c.which){c=b.attr("name").replace(/\[\]$/,"");var d=(new Date).getTime(),b=S(a,"",c,d,e,b.parent());$("input",b).focus()}else if((8==c.which||46==c.which)&&""==b.val())if(b=b.parent(),1<a.children().length)return b.prev().length?b.prev().children("input").focus():b.next().children("input").focus(),b.remove(),!1});$("a.reset",c).click(function(){var c=$(this.parentNode.parentNode);1<a.children().length?($("input",c.next().length?c.next():
  c.prev()).focus(),c.remove()):$("input",c).val("").focus()});$(c).find("input,a").on("focus",function(){a.addClass("focused")}).on("blur",function(){a.removeClass("focused")});h?h.after(c):c.appendTo(a);return c}function ga(a){var b=a.find(".scroller .listing").first().attr("id"),d=rcmail.env.task+"."+(b||rcmail.env.action+"."+a.attr("id")),b=Aa(d),c=a.is(".sidebar-right"),e=function(c){a.css({width:Math.max(100,c),flex:"none"})};if(a[c?"prev":"next"]().length)$('<div class="column-resizer">').appendTo(a).on("mousedown",
  function(b){var f,g=$(this),l=a.position().left;g.width(1E4).css(c?"left":"right",-5E3);document.body.style.userSelect="none";$(document).on("mousemove.resizer",function(b){clearTimeout(f);f=setTimeout(function(){c&&(l=a.position().left);var d=rcube_event.get_mouse_pos(b).x,d=c?a.width()+(l-d):d-l;e(d)},5)}).on("mouseup.resizer",function(){$(document).off(".resizer");$("iframe").off(".resizer");document.body.style.userSelect="auto";g.width(6).css(c?"left":"right",-3);var b=a.width();w[d]=b;if(!rcmail.local_storage_set_item("prefs.elastic",
  w)){var e=new Date;e.setYear(e.getFullYear()+1);rcmail.set_cookie(d,b,e)}})}),b&&e(b)}function Ba(a){if(!u()||!0===arguments[3])return g.open_window.apply(rcmail,arguments);a=rcmail.add_url(a,"_framed",1);a=rcmail.add_url(a,"_extwin",1);var b,d="",c={cancel_button:"close",width:768,height:768},e=$("<iframe>").attr({id:"windowframe",src:a});if(/_action=([a-z_]+)/.test(a)&&(b=rcmail.labels[RegExp.$1]))d=b;/_frame=1/.test(a)&&(c.dialogClass="no-titlebar");rcmail.simple_dialog(e,d,null,c);return!0}function H(){if(n){var a=
  $(parent.document.documentElement);return{mode:a[0].className.match(/layout-([a-z]+)/)?RegExp.$1:q,touch:a.is(".touch")}}return{mode:q,touch:J}}function u(){var a=H();return"phone"==a.mode||"small"==a.mode}function Aa(a){w||(w=rcmail.local_storage_get_item("prefs.elastic",{}));if(null==w[a]){var b=rcmail.get_cookie(a);null!=b&&(w[a]=b,rcmail.local_storage_set_item("prefs.elastic",w)&&rcmail.set_cookie(a,b,new Date))}return w[a]}var w,C=this,q="normal",J=!1,fa=!1,Q,n=rcmail.is_framed(),g={config:{standard_windows:rcmail.env.standard_windows,
  message_extwin:rcmail.env.message_extwin,compose_extwin:rcmail.env.compose_extwin,help_open_extwin:rcmail.env.help_open_extwin},checkboxes:0,small_screen_config:{standard_windows:!0,message_extwin:!1,compose_extwin:!1,help_open_extwin:!1}},r={},N=[],T=[],f={menu:$("#layout-menu"),sidebar:$("#layout-sidebar"),list:$("#layout-list"),content:$("#layout-content")},z={menu:$("a.task-menu-button"),back_sidebar:$("a.back-sidebar-button"),back_list:$("a.back-list-button"),back_content:$("a.back-content-button")};
  this.register_content_buttons=function(a){if(g.frame_nav&&a&&a.length){var b=g.frame_nav.children(".buttons");N=[];$.each(a,function(){this.data("target")&&N.push(this.data("target"))});b.html("").append(a)}};this.menu_hide=I;this.menu_toggle=R;this.menu_destroy=function(a){$("[aria-owns="+a+"]").popover("dispose").data("popup",null)};this.popup_init=D;this.about_dialog=function(a){var b,d,c=!1,e=$("<iframe>").attr({id:"aboutframe",src:rcmail.url("settings/about",{_framed:1})}),h=$("#supportlink");
  if(h.length&&(b=h.attr("href")))c=h.text(),d=function(a){0>b.indexOf("mailto:")?window.open(b):location.href=b};rcmail.simple_dialog(e,$(a).text(),d,{button:c,button_class:"help",cancel_button:"close",height:400})};this.headers_dialog=function(){var a={_uid:rcmail.env.uid,_mbox:rcmail.env.mailbox,_framed:1},a=$("<iframe>").attr({id:"headersframe",src:rcmail.url("headers",a)});rcmail.simple_dialog(a,rcmail.gettext("arialabelmessageheaders"),null,{cancel_button:"close",height:400})};this.import_dialog=
  function(){if(rcmail.commands["import-messages"]){var a=$("#uploadform").clone(!0);rcmail.simple_dialog(a,rcmail.gettext("importmessages"),function(b){return rcmail.command("import-messages",$(a.find("form")[0]))},{button:"import",closeOnEscape:!0,minWidth:400})}};this.headers_show=function(a){a=$(a).parent().prev();a[a.is(".hidden")?"removeClass":"addClass"]("hidden")};this.spellmenu=function(a){var b,d,c,e=[],h=rcmail.spellcheck_lang(),f=$("ul",a);if(!f.length){f=$('<ul class="selectable listing iconized" role="menu">');
  for(b in rcmail.env.spell_langs)c=$('<li role="menuitem">'),d=$('<a href="#'+b+'" tabindex="0"></a>').text(rcmail.env.spell_langs[b]).addClass("active").data("lang",b).on("click keypress",function(a){if("keypress"!=a.type||13==rcube_event.get_keycode(a))return rcmail.spellcheck_lang_set($(this).data("lang")),rcmail.hide_menu("spell-menu",a),!1}),d.appendTo(c),e.push(c);f.append(e).appendTo(a)}$("li",f).each(function(){var a=$("a",this);a.data("lang")==h?a.addClass("selected").attr("aria-selected",
  "true"):a.hasClass("selected")&&a.removeClass("selected").removeAttr("aria-selected")})};this.searchmenu=function(a){var b,d,c=$('input[name="s_mods[]"]',a),e=$("#s_scope",a),h=rcmail.env.mailbox,f=rcmail.env.search_mods,g=rcmail.env.search_scope||"base";$(a).data("initialized")||($(a).data("initialized",!0),c.length&&(c.on("change",function(){ba(a,this)}),rcmail.addEventListener("beforesearch",function(){ba(a)})));if(rcmail.env.search_mods)if("mail"==rcmail.env.task?("all"==g&&(h="*"),f=f[h]?f[h]:
  f["*"],d="text",e.val(g)):d="*",f[d])c.map(function(){this.checked=!0;this.disabled=this.value!=d});else for(b in c.prop("disabled",!1).prop("checked",!1),f)c.filter('[value="'+b+'"]').prop("checked",!0)};this.headersmenu=function(a,b,d){$("li > a",a).each(function(){var a=$(this),b="#compose_"+a.data("target");a[$(b).is(":visible")?"removeClass":"addClass"]("active").off().on("click",function(){$(b).removeClass("hidden").find(".recipient-input input").focus();a.removeClass("active");rcmail.set_menu_buttons()})})};
  this.header_reset=function(a){$("#"+a).val("").change().closest(".form-group").nextAll(":not(.hidden)").first().find("input").focus();$("a[data-target="+a.replace(/^_/,"")+"]").addClass("active");rcmail.set_menu_buttons()};this.compose_status=V;this.attachmentmenu=ca;this.mailtomenu=da;this.recipient_selector=function(a,b){b||(b={});var d=rcmail.gettext(b.title||"insertcontact"),c=$("#recipient-dialog"),e=c.parent(),h=function(){c.is(":visible")&&rcmail.env.recipient_dialog.dialog("close")};rcmail.env.recipient_selector_initialized||
  (rcmail.addEventListener("add-recipient",h),rcmail.env.recipient_selector_initialized=!0);a&&(rcmail.env.focused_field="#_"+a);rcmail.contact_list.clear_selection();rcmail.contact_list.multiselect="multiselect"in b?b.multiselect:!0;rcmail.env.recipient_dialog=rcmail.simple_dialog(c,d,function(){b.action?(b.action(),h()):rcmail.command("add-recipient")},{button:rcmail.gettext(b.button||"insert"),button_class:b.button_class||"insert recipient",height:600,classes:{"ui-dialog-content":"p-0"},open:function(){$("#directorylist a").first().focus()},
  close:function(){c.appendTo(e);$(this).remove();$(b.focus||rcmail.env.focused_field).focus()}})};this.show_list=P;this.show_sidebar=O;this.smart_field_init=function(a){var b=a.id+"_list",d=$('<div class="multi-input"><div class="content"></div><div class="invalid-feedback"></div></div>'),c=a.value?a.value.split("\n"):[""];$("#"+b).length||($.each(c,function(c,b){S($(".content",d),b,a.name,c,$(a).data("size"))}),d.attr("id",b),a=$(a),a.attr("disabled")?d.hide():a.prop("disabled",!0),a.data("hidden")&&
  d.hide(),a.after(d),a.hasClass("is-invalid")&&(d.addClass("is-invalid"),$(".invalid-feedback",d).text(a.data("error-msg"))))};this.smart_field_reset=function(a,b){var d=b.length?b:[""],c=$("#"+(a.id+"_list")).children(".content");c.empty();$.each(d,function(b,d){S(c,d,a.name,b,$(a).data("size"))})};this.form_errors=function(a){$.each(a,function(){var a=$("#"+this[0]).addClass("is-invalid");"list"==a.data("type")?(a.data("error-msg",this[2]),$("#"+this[0]+"_list > .invalid-feedback").text(this[2])):
  a.after($('<span class="invalid-feedback">').text(this[2]))})};this.switch_nav_list=function(a){var b,d,c=$("a",a),e=$(a).next();e.height()?(e.animate({height:"0"},250),c.addClass("expand").removeClass("collapse"),$(a).removeClass("expanded")):(b=$("tr,li",e).filter(function(){return"none"!=this.style.display}),d=$(b[0]).height()||50,e.animate({height:Math.min(5,b.length)*d+1+"px"},250),c.addClass("collapse").removeClass("expand"),$(a).addClass("expanded"))};this.searchbar_init=aa;this.pretty_checkbox=
  F;this.pretty_select=K;this.datepicker_init=function(a){window.MutationObserver&&$(a).not("[data-observed]").each(function(){var a,d=!0,c=n?parent:window;$(this).attr("data-observed","1");n&&($(this).detach().appendTo(parent.document.body),$('<div id="ui-datepicker-div" class="hidden">').appendTo(document.body));(new MutationObserver(function(e){$.each(e,function(e,f){if("attributes"==f.type){var g="true"==$(f.target).attr("aria-hidden");g!=d&&(g?a&&a.remove():a=$("<div>").attr("class","ui-widget-overlay datepicker").appendTo(c.document.body).click(function(a){$(this).remove();
  n&&$.datepicker._hideDatepicker()}),d=g)}else f.addedNodes.length&&(c.UI.bootstrap_style(f.target),n&&(c.$("select.ui-datepicker-month",f.target).on("change",function(){$.datepicker._selectMonthYear($.datepicker._lastInput,this,"M")}),c.$("select.ui-datepicker-year",f.target).on("change",function(){$.datepicker._selectMonthYear($.datepicker._lastInput,this,"Y")})))})})).observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["aria-hidden"]})})};this.bootstrap_style=p;X();(function(){g.last_selected=
  $("#layout > div.selected")[0];!g.last_selected&&f.content.length&&$.each(["sidebar","list","content"],function(){if(f[this].length)return g.last_selected=f[this][0],f[this].addClass("selected"),!1});$(window).on("resize",function(){clearTimeout(g.resize_timeout);g.resize_timeout=setTimeout(function(){E()},25)});g.open_window=rcmail.open_window;rcmail.open_window=Ba;rcmail.addEventListener("message",qa).addEventListener("menu-open",R).addEventListener("menu-close",R).addEventListener("editor-init",
  ka).addEventListener("autocomplete_create",W).addEventListener("googiespell_create",W).addEventListener("setquota",sa).addEventListener("enable-command",la).addEventListener("clonerow",xa).addEventListener("init",A);window.MutationObserver&&window.tinymce&&(new MutationObserver(function(a){$.each(a,function(){$.each(this.addedNodes,function(){ia(this)})})})).observe(document.body,{childList:!0});if((f.list.length||f.content.length)&&u()){var a=[];$("[data-fab]").each(function(){var b=$(this),d=b.data("fab-task")||
  "*",c=b.data("fab-action")||"*";("*"==d||d==rcmail.env.task)&&("*"==c||c==rcmail.env.action||"none"==c&&!rcmail.env.action)&&a.push(t(b,!1,!1,!0))});a.length&&$('<div class="floating-action-buttons">').append(a).appendTo(f.list.length?f.list:f.content)}f.sidebar.length&&ga(f.sidebar);f.list.length&&ga(f.list)})();p();(function(){if(!g.got_smart_toolbar){g.got_smart_toolbar=!0;var a,b=[],d=[],c=H(),e=function(a,c,b){var d=$('<li role="menuitem">');a=b?t($(a),!0,"hidden-big hidden-large"):$(a).detach();
  a.contents().filter(function(){3==this.nodeType&&!$.trim(this.nodeValue).length&&$(this).remove()});a.is(".spacer")?d.addClass("spacer"):d.append(a);c.push(d)};f.content.find(".header > .menu").each(function(){var a=$(this);a.children().each(function(){e(this,b)});a.remove()});f.list.find(".header > .menu").each(function(){var f=$(this);a=f.next();f.children().each(function(){"large"!=c.mode&&$(this).data("popup-pos","right");e(this,b,!0);e(this,d)});f.remove()});$('ul[data-menu="toolbar-small"] > li > a').each(function(){var a=
  $(this).clone();a.attr("id",this.id+"_clone");b.push($('<li role="menuitem">').addClass("hidden-big").append(a))});if(d.length){var h=f.list.children(".header"),k={"class":"menu toolbar popupmenu listing iconized",id:"toolbar-list-menu"},m=$('<a class="button icon toolbar-list-button" href="#list-menu">').attr({"data-popup":"toolbar-list-menu"}),k=$("<ul>").attr(k).data("popup-parent",h).append(d);a.length?k.insertBefore(a):h.append(k);h.append(m)}b.length&&(h=f.content.children(".header"),k={"class":"menu toolbar popupmenu listing iconized",
  id:"toolbar-menu"},m=$('<a class="button icon toolbar-menu-button" href="#menu">').attr({"data-popup":"toolbar-menu"}),h.append($("<ul>").attr(k).data("popup-parent",h).append(b)).append(m),f.list.find("a.toolbar-menu-button").click(function(a){a.stopPropagation();m.click()}))}})();(function(){if(f.list.length){var a=g.last_selected,b=function(a){if("string"!==typeof a||!a.length)a=$("h1.voice").text()||$("title").text()||"";f.content.find(".header > .header-title").text(a)},d=function(c,d,e,l){u()&&
  g.frame_nav&&ja(d,c);e&&!f.content.is(":visible")?g.last_selected=f.content[0]:!e&&(g.last_selected!=a&&!g.content_lock)&&(g.last_selected=a);M();b(l&&e?l:null);g.content_lock=!1},c=function(a){"large"!=q&&(!g.content_lock&&a.force)&&P();g.content_lock=!1;a.title&&$(".header > .header-title",f.list).text(a.title)},e=function(a){var b={};if("addressbook"==rcmail.env.task||"mail"==rcmail.env.task)b.force=!0;"mail"==rcmail.env.task&&!rcmail.env.action&&(a="string"==$.type(a)?a:rcmail.env.mailbox,a=rcmail.env.mailboxes[a],
  b.title=a?a.name:"");c(b)};f.content.find("iframe").on("load",function(a){var c="",e=!0;$(this).parent(".iframe-wrapper").scrollTop(0);try{c=a.target.contentWindow.location.href,e=!c.endsWith(rcmail.env.blankpage),$(a.target.contentWindow).on("unload",b)}catch(f){}d(a,c,e)});rcmail.addEventListener("afterlist",e).addEventListener("afterlistgroup",e).addEventListener("afterlistsearch",e).addEventListener("show-list",function(a){a.force=!0;c(a)}).addEventListener("show-content",function(a){a.obj&&!$(a.obj).is("iframe")&&
  ($(a.scrollElement||a.obj).scrollTop(0),u()&&G(a.obj));d(a.event||new Event,"_action="+(a.mode||"edit"),!0,a.title)})}})();(function(){$("[data-popup]").each(function(){D(this)});$(document).on("click",x);rcube_webmail.set_iframe_events({mousedown:x,touchstart:x})})();(function(){var a,b,d=[];$.ui&&$.widget("ui.dialog",$.ui.dialog,{open:function(){$(this.element).is(".iframe")&&(this.options.width=Math.max(576,this.options.width));this._super();var a=$(this.uiDialog),b=a.width(),d=a.height(),f=$(window).width(),
  g=$(window).height();480>=f?a.css({width:"100%",height:"100%"}):(d>g&&a.css("height","100%"),b>f&&a.css("width","100%"));$(document).click();G($("div.popup > iframe",a));p(this.uiDialog);return this},close:function(){this._super();$(".select-menu:visible").remove();return this}});z.menu.on("click",function(){y(!0);return!1});z.back_sidebar.on("click",function(){O();return!1});z.back_list.on("click",function(){P();return!1});z.back_content.on("click",function(){f.list.addClass("hidden");f.sidebar.addClass("hidden");
  f.content.removeClass("hidden");f.sidebar.removeClass("layout-sticky");B();g.last_selected=f.content[0];return!1});$(".searchbar").each(function(){aa(this)});n&&!rcmail.env.extwin&&!parent.$(".ui-dialog:visible").length?(a=$("h1.voice").first().text())&&parent.$("#layout-content > .header > .header-title:not(.constant)").text(a):n||((a=f.content.find(".boxtitle").first().detach().text())||(a=$("h1.voice").first().text()),a&&f.content.find(".header > .header-title").text(a));!n&&(f.content.length&&
  !f.content.is(".no-navbar")&&!f.content.children(".frame-content").length)&&(g.frame_nav=$('<div class="footer menu toolbar content-frame-navigation hide-nav-buttons">').append($('<a class="button prev">').append($('<span class="inner"></span>').text(rcmail.gettext("previous")))).append($('<span class="buttons">')).append($('<a class="button next">').append($('<span class="inner"></span>').text(rcmail.gettext("next")))).appendTo(f.content));$("a[data-content-button]").each(function(){d.push(t($(this)))});
  $(".formbuttons").filter(function(){return!$(this).parent(".searchoptions").length}).children().each(function(){var a=$(this);if(n||a.parents("#layout-content").length)a.is(".cancel")?a.addClass("hidden"):d.push(t(a))});(n?parent.UI:C).register_content_buttons(d);if(b=rcmail.gui_objects.messageform)b=$('form[name="'+b+'"]'),$("#_cc, #_bcc, #_replyto, #_followupto",$(".compose-headers")).each(function(){$(this).on("change",function(){$("#compose"+$(this).attr("id"))[this.value?"removeClass":"addClass"]("hidden")})}),
  $("#compose-options").find("textarea,input,select").each(function(){var a=$("<input>").attr({type:"hidden",name:$(this).attr("name")}).appendTo(b);$(this).attr("tabindex",2).on("change",function(){a.val("checkbox"!=this.type||this.checked?$(this).val():"")}).change()});$("[data-recipient-input]").each(function(){ta(this)});$(".image-upload").each(function(){wa(this)});$("textarea[data-html-editor]").each(function(){ya(this)});$("#dragmessage-menu,#dragcontact-menu").each(function(){rcmail.gui_object("dragmenu",
  this.id)});$("#taskmenu > a").each(function(){if(/button-([a-z]+)/.test(this.className)){var a,b=RegExp.$1,d=v(this.id);if(d&&(a=d.data))a.sel&&(a.sel=a.sel.replace("button-selected","selected")+" "+b),a.act&&(a.act+=" "+b),rcmail.buttons[d.command][d.index]=a,rcmail.init_button(d.command,a);$(this).addClass(b);$(".button-inner",this).addClass("inner")}$(this).on("mouseover",function(){rcube_webmail.long_subject_title(this,0,$("span.inner",this))})});$(".listbutton").each(function(){var a=v(this.id);
  $(this).addClass("button").removeClass("listbutton");a.data.sel&&(a.data.sel=a.data.sel.replace("listbutton","button"));a.data.act&&(a.data.act=a.data.act.replace("listbutton","button"));rcmail.buttons[a.command][a.index]=a.data;rcmail.init_button(a.command,a.data)});$("[data-hidden]").each(function(){for(var a,b=$(this).data("hidden"),d=$(this).parent("li"),f=/(large|big|small|phone|lbs)/g;a=f.exec(b);)$(d.length?d:this).addClass("hidden-"+a[1])});$("[data-list]").each(function(){$("input[type=checkbox]",
  this).each(function(){F(this)})});n&&$(".formcontent").each(function(){$(this).next(".formbuttons").length&&$(this).parent().addClass("formcontainer")});$("#attachment-list + a.zipdownload").appendTo(".header-links");(fa=$("html").is(".ipad,.iphone"))&&$(".iframe-wrapper, .scroller").addClass("ios-scroll");$("html").filter(".ipad,.iphone,.webkit.mobile,.webkit.tablet").addClass("webkit-scroller").length&&$(f.menu).addClass("webkit-scroller");$(".treelist").each(function(){var a=this,b=function(){$(a)[0<
  $(".treetoggle",a).length?"removeClass":"addClass"]("notree")};window.MutationObserver&&(new MutationObserver(b)).observe(a,{childList:!0,subtree:!0});b();$("li.mailbox > a").on("mouseover",function(){rcube_webmail.long_subject_title_ex(this)})});$("#logo").data("src-default")||$("#logo").data("src-default",$("#logo").attr("src"))})();E()}
  if(window.rcmail)rcmail.show_menu=function(s,t,v){var A="object"==typeof s?s.menu:s,p=$("#"+A);"string"==typeof s&&(s={menu:A});return rcmail.triggerEvent(!1===t?"menu-close":"menu-open",{name:A,obj:p,props:s,originalEvent:v})},rcmail.hide_menu=function(s,t){return rcmail.triggerEvent("menu-close",{name:s,props:{menu:s},originalEvent:t})};else var rcmail=parent.rcmail,rcube_webmail=parent.rcube_webmail,bw={};var UI=new rcube_elastic_ui;
  if($&&$.datepicker){var __newInst=$.datepicker._newInst;$.extend($.datepicker,{_newInst:function(s,t){var v=__newInst.call(this,s,t);v.inline||UI.datepicker_init(v.dpDiv);return v}})};
  