text: if(!EnzeyNet)var EnzeyNet={};EnzeyNet.Services||(EnzeyNet.Services={}),EnzeyNet.Services.Eventing={},EnzeyNet.Services.Eventing.eventMatchers={HTMLEvents:{isEvent:function(a){return/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/.test(a)},fireEvent:function(a,b,c){var d=null;if(document.createEvent)d=document.createEvent("HTMLEvents"),d.initEvent(b,c.bubbles,c.cancelable),d.flyoutElem="foo",a.dispatchEvent(d);else{c.clientX=c.pointerX,c.clientY=c.pointerY;var e=document.createEventObject();d=extend(e,c),a.fireEvent("on"+b,d)}}},MouseEvents:{isEvent:function(a){return/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/.test(a)},fireEvent:function(a,b,c){var d=null;if(document.createEvent)d=document.createEvent("MouseEvents"),d.initMouseEvent(b,c.bubbles,c.cancelable,document.defaultView,c.button,c.pointerX,c.pointerY,c.pointerX,c.pointerY,c.ctrlKey,c.altKey,c.shiftKey,c.metaKey,c.button,c.element),a.dispatchEvent(d);else{c.clientX=c.pointerX,c.clientY=c.pointerY;var e=document.createEventObject();d=extend(e,c),a.fireEvent("on"+b,d)}}}},EnzeyNet.Services.Eventing.defaultOptions={pointerX:0,pointerY:0,button:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0},EnzeyNet.Services.dispatchEvent=function(a,b){var c=arguments[2]?arguments[2]:angular.copy(EnzeyNet.Services.Eventing.defaultOptions);c.element=c.element?c.element:a;var d=null,e=EnzeyNet.Services.Eventing.eventMatchers;for(var f in e)if(e[f].isEvent(b)){d=e[f].fireEvent;break}if(!d)throw new SyntaxError("Only HTMLEvents and MouseEvents interfaces are supported");d(a,b,c)},EnzeyNet.Services.dispatchCustomEvent=function(a,b){var c=arguments[2]?arguments[2]:angular.copy(EnzeyNet.Services.Eventing.defaultOptions);c.element=c.element?c.element:a;var d=EnzeyNet.Services.Eventing.eventMatchers.HTMLEvents.fireEvent;d(a,b,c)},EnzeyNet.Services.prepend=function(a,b){var c=a.children;0===c.length?a.appendChild(b):a.insertBefore(b,c[0])},EnzeyNet.Services.registerClickAwayAction=function(a){for(var b=function(a){if(!a instanceof HTMLElement)throw"must be an HTMLElement";var c=[];if(a.children)for(var d=a.children,e=0;e<d.length;e++)b(d[e]).forEach(function(a){c.push(a)});return c.push(a),c},c=[],d=1;d<arguments.length;d++)c.push(arguments[d]);var e=null;e=function(d){var f=[];c.forEach(function(a){b(a).forEach(function(a){f.push(a)})}),-1===f.indexOf(d.target)&&(document.removeEventListener("click",e),a(d))},setTimeout(function(){document.addEventListener("click",e)})},EnzeyNet.applyFunctions=function(a,b){for(var c in b.prototype)"function"==typeof b.prototype[c]&&(a[c]=b.prototype[c])},EnzeyNet.FlyoutServices=function(){},EnzeyNet.FlyoutServices.prototype.getParentPositioning=function(){return{attributes:[],classes:["flyout-against"]}},EnzeyNet.FlyoutServices.prototype.findParentToPositionAgainst=function(){var a,b=this,c=b.getParentPositioning();if(c.attributes){var d=c.attributes.slice(0);d.map(function(a){return"data-"+a}).forEach(function(a){c.attributes.push(a)})}for(var e=b.parentElement;e&&!a;)c.classes instanceof Array&&c.classes.forEach(function(b){a||e.classList.contains(b)&&(a=e)}),c.attributes instanceof Array&&c.attributes.forEach(function(b){a||e.attributes[b]&&(a=e)}),e=e.parentElement;return a||(a=b.parentElement),a},EnzeyNet.FlyoutServices.prototype.createdCallback=function(){var a=this.getAttribute("id");a||(a=Date.now(),this.setAttribute("id",a)),this.flyoutTempalte=this.innerHTML,console.log(this.flyoutTempalte),this.innerHTML="",this.displayFlyout=this.displayFlyout.bind(this)},EnzeyNet.FlyoutServices.prototype.attachedCallback=function(){if(this.flyoutParent=this.parentElement,"BUTTON"===this.flyoutParent.nodeName.toUpperCase())throw"Parent of the flyout cannot be a button element.";this.flyoutParent.setAttribute("flyout-id",this.getAttribute("id")),this.attributeChangedCallback("flyout-display",null,this.getAttribute("flyout-display"))},EnzeyNet.FlyoutServices.prototype.detachedCallback=function(){this.flyoutParent.removeAttribute("flyout-id"),console.log("detachedCallback"),console.log(this.parentElement),console.log(this.flyoutParent),this.attributeChangedCallback("flyout-display",this.getAttribute("flyout-display"),null)},EnzeyNet.FlyoutServices.prototype.attributeChangedCallback=function(a,b,c){"flyout-display"===a&&this.bindFlyoutAction(c,b)},EnzeyNet.FlyoutServices.prototype.bindFlyoutAction=function(a,b){var c=this;"string"==typeof b&&(b=b.split(" "),b.forEach(function(a){c.flyoutParent.removeEventListener(a.trim(),c.displayFlyout)})),"string"==typeof a&&(a=a.split(" "),a.forEach(function(a){c.flyoutParent.addEventListener(a.trim(),c.displayFlyout)}))},EnzeyNet.FlyoutServices.prototype.displayFlyout=function(a){var b=this.findParentToPositionAgainst(),c=this;if(!c.flyoutContainer){c.flyoutContainer=document.createElement("div"),c.flyoutContainer.innerHTML=c.flyoutTempalte,EnzeyNet.Services.registerClickAwayAction(function(a){c.flyoutContainer.parentElement.removeChild(c.flyoutContainer),c.flyoutContainer=null},c.flyoutContainer,c.flyoutParent);var d=document.createElement("iframe");d.classList.add("shim"),EnzeyNet.Services.prepend(c.flyoutContainer,d),b.appendChild(c.flyoutContainer)}this.positionFlyout(c.flyoutContainer)},EnzeyNet.FlyoutServices.prototype.positionFlyout=function(a){var b=this.getAttribute("align-my"),c=this.getAttribute("align-to");if(c&&b){var d=b.split(" ");if(2!==d.length)return;var e=d[0],f=d[1],g=c.split(" ");if(2!==g.length)return;var h=g[0],i=g[1],j=a.parentElement,k=window.getComputedStyle(j);"static"===k.position&&(j.style.position="relative"),a.style.overflow="visible",a.style.position="absolute",a.style.transform="",a.classList.add("flyout-align-my-"+e+"-"+f+"-to-"+h+"-"+i)}},function(a){"use strict";var b=a.module("net.enzey.flyout",[]);b.directive("nzFlyout",["$compile",function(b){return{priority:9999,compile:function(c,d){return a.extend(c[0],EnzeyNet.FlyoutServices.prototype),c[0].createdCallback(),{pre:function(a,c,d){var e=c[0].displayFlyout,f=null;c[0].displayFlyout=function(){e.call(this,arguments),f!=c[0].flyoutContainer&&(f=c[0].flyoutContainer,b(f)(a),a.$apply())}},post:function(a,b,c){b[0].attachedCallback()}}}}}])}(angular);