var __awaiter=this&&this.__awaiter||function(e,t,n,i){function a(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function o(e){try{c(i.next(e))}catch(e){r(e)}}function l(e){try{c(i["throw"](e))}catch(e){r(e)}}function c(e){e.done?n(e.value):a(e.value).then(o,l)}c((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,a,r,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(e){return function(t){return c([e,t])}}function c(o){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,a&&(r=o[0]&2?a["return"]:o[0]?a["throw"]||((r=a["return"])&&r.call(a),0):a.next)&&!(r=r.call(a,o[1])).done)return r;if(a=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:n.label++;return{value:o[1],done:false};case 5:n.label++;a=o[1];o=[0];continue;case 7:o=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]e.offsetHeight?0:-1};this.setContainerRef=function(e){i.containerEl=e};this.setDismissRef=function(e){i.dismissButtonEl=e};this.setBackRef=function(e){i.backButtonEl=e};this.panelKeyDownHandler=function(e){if(e.key==="Escape"){i.dismiss()}};this.dismiss=function(){i.dismissed=true;i.calcitePanelDismiss.emit()};this.panelScrollHandler=function(){i.calcitePanelScroll.emit()};this.backButtonClick=function(){i.calcitePanelBackClick.emit()};this.setPanelScrollEl=function(e){var t,n;i.panelScrollEl=e;(t=i.resizeObserver)===null||t===void 0?void 0:t.disconnect();if(e){(n=i.resizeObserver)===null||n===void 0?void 0:n.observe(e);i.resizeHandler()}}}e.prototype.dismissedHandler=function(){this.calcitePanelDismissedChange.emit()};e.prototype.componentDidRender=function(){u(this)};e.prototype.connectedCallback=function(){h(this)};e.prototype.disconnectedCallback=function(){var e;m(this);(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect()};e.prototype.setFocus=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i;return __generator(this,(function(a){if(e==="dismiss-button"){(t=this.dismissButtonEl)===null||t===void 0?void 0:t.setFocus();return[2]}if(e==="back-button"){(n=this.backButtonEl)===null||n===void 0?void 0:n.setFocus();return[2]}(i=this.containerEl)===null||i===void 0?void 0:i.focus();return[2]}))}))};e.prototype.scrollContentTo=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){(t=this.panelScrollEl)===null||t===void 0?void 0:t.scrollTo(e);return[2]}))}))};e.prototype.renderBackButton=function(){var e=this.el;var t=o(e)==="rtl";var n=this,a=n.showBackButton,r=n.intlBack,l=n.backButtonClick;var c=r||g.back;var s=t?b.backRight:b.backLeft;return a?i("calcite-action",{"aria-label":c,class:p.backButton,icon:s,key:"back-button",onClick:l,ref:this.setBackRef,scale:"s",slot:v.headerActionsStart,text:c}):null};e.prototype.renderHeaderContent=function(){var e=this,t=e.heading,n=e.headingLevel,a=e.summary;var r=t?i(s,{class:p.heading,level:n||w},t):null;var o=a?i("span",{class:p.summary},a):null;return r||o?i("div",{class:p.headerContent,key:"header-content"},r,o):null};e.prototype.renderHeaderSlottedContent=function(){return i("div",{class:p.headerContent,key:"slotted-header-content"},i("slot",{name:v.headerContent}))};e.prototype.renderHeaderStartActions=function(){var e;var t=this.el;var n=l(t,v.headerActionsStart);return n?i("div",{class:(e={},e[p.headerActionsStart]=true,e[p.headerActions]=true,e),key:"header-actions-start"},i("slot",{name:v.headerActionsStart})):null};e.prototype.renderHeaderActionsEnd=function(){var e;var t=this,n=t.dismiss,a=t.dismissible,r=t.el,o=t.intlClose;var c=o||g.close;var s=a?i("calcite-action",{"aria-label":c,icon:b.close,onClick:n,ref:this.setDismissRef,text:c}):null;var d=i("slot",{name:v.headerActionsEnd});var h=l(r,v.headerActionsEnd);return h||s?i("div",{class:(e={},e[p.headerActionsEnd]=true,e[p.headerActions]=true,e),key:"header-actions-end"},d,s):null};e.prototype.renderMenu=function(){var e=this,t=e.el,n=e.intlOptions,a=e.menuOpen;var r=l(t,v.headerMenuActions);return r?i("calcite-action-menu",{flipPlacements:["top","bottom"],key:"menu",label:n||g.options,open:a,placement:"bottom-end"},i("calcite-action",{icon:b.menu,slot:d.trigger,text:n||g.options}),i("slot",{name:v.headerMenuActions})):null};e.prototype.renderHeaderNode=function(){var e=this,t=e.el,n=e.showBackButton;var a=this.renderBackButton();var r=l(t,v.headerContent);var o=r?this.renderHeaderSlottedContent():this.renderHeaderContent();var c=this.renderHeaderStartActions();var s=this.renderHeaderActionsEnd();var d=this.renderMenu();return c||o||s||d||n?i("header",{class:p.header},a,c,o,s,d):null};e.prototype.renderFooterNode=function(){var e=this.el;var t=l(e,v.footer);var n=l(e,v.footerActions);return t||n?i("footer",{class:p.footer,key:"footer"},t?i("slot",{key:"footer-slot",name:v.footer}):null,n?i("slot",{key:"footer-actions-slot",name:v.footerActions}):null):null};e.prototype.renderContent=function(){var e,t;var n=this.el;var a=l(n,v.fab);var r=i("slot",{key:"default-slot"});var o="content-wrapper";return a?i("div",{class:(e={},e[p.contentWrapper]=true,e[p.contentHeight]=true,e),key:o,onScroll:this.panelScrollHandler,ref:this.setPanelScrollEl},i("section",{class:p.contentContainer},r),this.renderFab()):i("section",{class:(t={},t[p.contentWrapper]=true,t[p.contentContainer]=true,t),key:o,onScroll:this.panelScrollHandler,ref:this.setPanelScrollEl},r)};e.prototype.renderFab=function(){return i("div",{class:p.fabContainer},i("slot",{name:v.fab}))};e.prototype.render=function(){var e=this,t=e.dismissed,n=e.dismissible,r=e.loading,o=e.panelKeyDownHandler;var l=i("article",{"aria-busy":c(r),class:p.container,hidden:n&&t,onKeyDown:o,ref:this.setContainerRef,tabIndex:n?0:-1},this.renderHeaderNode(),this.renderContent(),this.renderFooterNode());return i(a,null,r?i("calcite-scrim",{loading:r}):null,l)};Object.defineProperty(e.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{dismissed:["dismissedHandler"]}},enumerable:false,configurable:true});return e}());y.style=x}}}));