var __awaiter=this&&this.__awaiter||function(t,n,e,i){function o(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function a(t){try{c(i["throw"](t))}catch(t){r(t)}}function c(t){t.done?e(t.value):o(t.value).then(s,a)}c((i=i.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(n){return c([t,n])}}function c(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(e=0)),e)try{if(i=1,o&&(r=a[0]&2?o["return"]:a[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;if(o=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:e.label++;return{value:a[1],done:false};case 5:e.label++;o=a[1];a=[0];continue;case 7:a=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){e=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){e.label=a[1];break}if(a[0]===6&&e.label<r[1]){e.label=r[1];r=a;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(a);break}if(r[2])e.ops.pop();e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t];o=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-245b445c.system.js","./p-529fafb4.system.js","./p-eba7a76e.system.js"],(function(t){"use strict";var n,e,i,o,r,s,a,c,u;return{setters:[function(t){n=t.r;e=t.h;i=t.H;o=t.g},function(t){r=t.c},function(t){s=t.c;a=t.f;c=t.s;u=t.o}],execute:function(){var f="x-dropdown{display:inherit;text-align:inherit}x-dropdown .dropdown-container{display:none;width:-webkit-max-content;width:-moz-max-content;width:max-content;top:0;left:0;position:absolute;z-index:10000}x-dropdown .dropdown-container.dropdown-show{display:block;-webkit-animation:0.3s fadeIn;animation:0.3s fadeIn}";var h=f;var d=t("x_dropdown",function(){function t(t){n(this,t);this.show=false;this.align="bottom";this.hover=false;this.syncWidth=false;this.offset=0}t.prototype.onAlignWatch=function(){this.updateDropdownContainer()};t.prototype.componentDidLoad=function(){this.container=this.el.querySelector(".dropdown-container");this.updateDropdownContainer();this.el.addEventListener("mouseenter",this.onMouseEnterOnContainer.bind(this));this.el.addEventListener("mouseleave",this.onMouseLeaveOnContainer.bind(this))};t.prototype.disconectedCallback=function(){if(this.el){this.el.removeEventListener("mouseenter",this.onMouseEnterOnContainer);this.el.removeEventListener("mouseleave",this.onMouseLeaveOnContainer)}};t.prototype.onMouseEnterOnContainer=function(){if(this.hover){this.show=true}};t.prototype.onMouseLeaveOnContainer=function(){if(this.hover){this.show=false}};t.prototype.updateDropdownContainer=function(){var t=this;if(this.syncWidth){this.container.style.maxWidth="".concat(this.el.offsetWidth,"px");this.container.style.width="100%"}else{this.container.style.maxWidth="auto";this.container.style.width="auto"}setTimeout((function(){s(t.el,t.container,{placement:t.align,middleware:[a(),c({padding:10}),u(t.offset)]}).then((function(n){var e=n.x,i=n.y;t.container.style.left="".concat(e,"px");t.container.style.top="".concat(i,"px")}))}),50)};t.prototype.display=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){this.show=t;return[2]}))}))};t.prototype.render=function(){return e(i,{key:"5f8255008c184d7631ccb4cd9551b116b5de5d41"},e("slot",{key:"e1ba19bc029636a57da7cc39b996d6bb074577d6"}),e("div",{key:"cf2519e2ac095151a8a32749dd1d3afd0feefb83",class:r("dropdown-container",{"dropdown-show":this.show,"dropdown-hover":this.hover})},e("slot",{key:"d272d43ac171bafd22fd83aba86bd693cbc87360",name:"dropdown"})))};Object.defineProperty(t.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{align:["onAlignWatch"],show:["onAlignWatch"]}},enumerable:false,configurable:true});return t}());d.style=h}}}));