var modal=function(){function e(){r.unbind("focus");r=null;n.unbind("focusout");n=null;t.unbind("focusout");t=null}function f(){return $(i).length>0}function o(){u||document.activeElement.blur()}function s(){$(i).last().find(":focusable").first().focus()}function h(){u&&n.focus()}function c(){if(f){r=$(document).contents().find(":focusable").not('[TabIndex*="99"]').first();r.focus(s);n=$(i).last().contents().find(":focusable").last();n.on("focusout",o);t=$(i).last().contents().find(":focusable").first();t.on("focusout",h);t.focus();$(document).on("keydown.kendoWindow",function(n){u=(n.key==="Tab"||n.keyCode===kendo.keys.TAB)&&n.shiftKey})}}var u=!1,i='.k-widget.k-window[style*="opacity: 1"]',r,n,t;return{onClose:e,onActivate:c,visible:f}}()