import{r as t,f as e,h as o,H as i,d as a}from"./p-23450e8b.js";import{E as n,s as r}from"./p-573c3dca.js";import{p as s}from"./p-b4215fed.js";import{c as d,a as l,i as p,b as h,s as c,d as u,e as b,f as g,j as f}from"./p-4084433f.js";import{g as m,c as x}from"./p-b2d007f6.js";import{c as v,g as w}from"./p-1e77b5bd.js";import{c as y}from"./p-771a6f32.js";import{n as k}from"./p-8538de1a.js";import"./p-387cea7f.js";import"./p-94c84e79.js";import"./p-c76826f0.js";
/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */const j=(t,e)=>{const o=y();const i=y();const a=k(t);const n=a.querySelector(".toast-wrapper");const r=`calc(-10px - var(--ion-safe-area-bottom, 0px))`;const s=`calc(10px + var(--ion-safe-area-top, 0px))`;i.addElement(n);switch(e){case"top":i.fromTo("transform","translateY(-100%)",`translateY(${s})`);break;case"middle":const e=Math.floor(t.clientHeight/2-n.clientHeight/2);n.style.top=`${e}px`;i.fromTo("opacity",.01,1);break;default:i.fromTo("transform","translateY(100%)",`translateY(${r})`);break}return o.easing("cubic-bezier(.155,1.105,.295,1.12)").duration(400).addAnimation(i)};
/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */const z=(t,e)=>{const o=y();const i=y();const a=k(t);const n=a.querySelector(".toast-wrapper");const r=`calc(-10px - var(--ion-safe-area-bottom, 0px))`;const s=`calc(10px + var(--ion-safe-area-top, 0px))`;i.addElement(n);switch(e){case"top":i.fromTo("transform",`translateY(${s})`,"translateY(-100%)");break;case"middle":i.fromTo("opacity",.99,0);break;default:i.fromTo("transform",`translateY(${r})`,"translateY(100%)");break}return o.easing("cubic-bezier(.36,.66,.04,1)").duration(300).addAnimation(i)};
/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */const T=(t,e)=>{const o=y();const i=y();const a=k(t);const n=a.querySelector(".toast-wrapper");const r=`calc(8px + var(--ion-safe-area-bottom, 0px))`;const s=`calc(8px + var(--ion-safe-area-top, 0px))`;i.addElement(n);switch(e){case"top":n.style.top=s;i.fromTo("opacity",.01,1);break;case"middle":const e=Math.floor(t.clientHeight/2-n.clientHeight/2);n.style.top=`${e}px`;i.fromTo("opacity",.01,1);break;default:n.style.bottom=r;i.fromTo("opacity",.01,1);break}return o.easing("cubic-bezier(.36,.66,.04,1)").duration(400).addAnimation(i)};
/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */const D=t=>{const e=y();const o=y();const i=k(t);const a=i.querySelector(".toast-wrapper");o.addElement(a).fromTo("opacity",.99,0);return e.easing("cubic-bezier(.36,.66,.04,1)").duration(300).addAnimation(o)};const $=":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:normal;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}@supports (inset-inline-start: 0){:host{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host{left:0}:host-context([dir=rtl]){left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host:dir(rtl){left:unset;right:unset;right:0}}}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);box-shadow:var(--box-shadow)}@supports (inset-inline-start: 0){.toast-wrapper{inset-inline-start:var(--start);inset-inline-end:var(--end)}}@supports not (inset-inline-start: 0){.toast-wrapper{left:var(--start);right:var(--end)}:host-context([dir=rtl]) .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}[dir=rtl] .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}@supports selector(:dir(rtl)){.toast-wrapper:dir(rtl){left:unset;right:unset;left:var(--end);right:var(--start)}}}.toast-container{display:flex;align-items:center;pointer-events:auto;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-layout-stacked .toast-container{flex-wrap:wrap}.toast-layout-baseline .toast-content{display:flex;flex:1;flex-direction:column;justify-content:center}.toast-icon{-webkit-margin-start:16px;margin-inline-start:16px}.toast-message{flex:1;white-space:var(--white-space)}.toast-button-group{display:flex}.toast-layout-stacked .toast-button-group{justify-content:end;width:100%}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon,.toast-button-icon{font-size:1.4em}.toast-button-inner{display:flex;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-50, #f2f2f2);--border-radius:14px;--button-color:var(--ion-color-primary, #3880ff);--color:var(--ion-color-step-850, #262626);--max-width:700px;--start:10px;--end:10px;font-size:14px}.toast-wrapper{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;z-index:10}@supports (backdrop-filter: blur(0)){:host(.toast-translucent) .toast-wrapper{background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);backdrop-filter:saturate(180%) blur(20px)}:host(.ion-color.toast-translucent) .toast-wrapper{background:rgba(var(--ion-color-base-rgb), 0.8)}}.toast-wrapper.toast-top{transform:translate3d(0,  -100%,  0);top:0}.toast-wrapper.toast-middle{opacity:0.01}.toast-wrapper.toast-bottom{transform:translate3d(0,  100%,  0);bottom:0}.toast-content{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:15px;padding-bottom:15px}.toast-header{margin-bottom:2px;font-weight:500}.toast-button{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:10px;padding-bottom:10px;height:44px;transition:background-color, opacity 100ms linear;border:0;background-color:transparent;font-family:var(--ion-font-family);font-size:17px;font-weight:500;overflow:hidden}.toast-button.ion-activated{opacity:0.4}@media (any-hover: hover){.toast-button:hover{opacity:0.6}}";const C=":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:normal;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}@supports (inset-inline-start: 0){:host{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host{left:0}:host-context([dir=rtl]){left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host:dir(rtl){left:unset;right:unset;right:0}}}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);box-shadow:var(--box-shadow)}@supports (inset-inline-start: 0){.toast-wrapper{inset-inline-start:var(--start);inset-inline-end:var(--end)}}@supports not (inset-inline-start: 0){.toast-wrapper{left:var(--start);right:var(--end)}:host-context([dir=rtl]) .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}[dir=rtl] .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}@supports selector(:dir(rtl)){.toast-wrapper:dir(rtl){left:unset;right:unset;left:var(--end);right:var(--start)}}}.toast-container{display:flex;align-items:center;pointer-events:auto;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-layout-stacked .toast-container{flex-wrap:wrap}.toast-layout-baseline .toast-content{display:flex;flex:1;flex-direction:column;justify-content:center}.toast-icon{-webkit-margin-start:16px;margin-inline-start:16px}.toast-message{flex:1;white-space:var(--white-space)}.toast-button-group{display:flex}.toast-layout-stacked .toast-button-group{justify-content:end;width:100%}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon,.toast-button-icon{font-size:1.4em}.toast-button-inner{display:flex;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-800, #333333);--border-radius:4px;--box-shadow:0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);--button-color:var(--ion-color-primary, #3880ff);--color:var(--ion-color-step-50, #f2f2f2);--max-width:700px;--start:8px;--end:8px;font-size:14px}.toast-wrapper{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;opacity:0.01;z-index:10}.toast-content{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:14px;padding-bottom:14px}.toast-header{margin-bottom:2px;font-weight:500;line-height:20px}.toast-message{line-height:20px}.toast-layout-baseline .toast-button-group-start{-webkit-margin-start:8px;margin-inline-start:8px}.toast-layout-stacked .toast-button-group-start{-webkit-margin-end:8px;margin-inline-end:8px;margin-top:8px}.toast-layout-baseline .toast-button-group-end{-webkit-margin-end:8px;margin-inline-end:8px}.toast-layout-stacked .toast-button-group-end{-webkit-margin-end:8px;margin-inline-end:8px;margin-bottom:8px}.toast-button{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:10px;padding-bottom:10px;position:relative;background-color:transparent;font-family:var(--ion-font-family);font-size:14px;font-weight:500;letter-spacing:0.84px;text-transform:uppercase;overflow:hidden}.toast-button-cancel{color:var(--ion-color-step-100, #e6e6e6)}.toast-button-icon-only{border-radius:50%;-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px;padding-top:9px;padding-bottom:9px;width:36px;height:36px}@media (any-hover: hover){.toast-button:hover{background-color:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.08)}.toast-button-cancel:hover{background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.08)}}";const Y=class{constructor(o){t(this,o);this.didPresent=e(this,"ionToastDidPresent",7);this.willPresent=e(this,"ionToastWillPresent",7);this.willDismiss=e(this,"ionToastWillDismiss",7);this.didDismiss=e(this,"ionToastDidDismiss",7);this.didPresentShorthand=e(this,"didPresent",7);this.willPresentShorthand=e(this,"willPresent",7);this.willDismissShorthand=e(this,"willDismiss",7);this.didDismissShorthand=e(this,"didDismiss",7);this.delegateController=d(this);this.triggerController=l();this.customHTMLEnabled=v.get("innerHTMLTemplatesEnabled",n);this.presented=false;this.dispatchCancelHandler=t=>{const e=t.detail.role;if(p(e)){const t=this.getButtons().find((t=>t.role==="cancel"));this.callButtonHandler(t)}};this.revealContentToScreenReader=false;this.overlayIndex=undefined;this.delegate=undefined;this.hasController=false;this.color=undefined;this.enterAnimation=undefined;this.leaveAnimation=undefined;this.cssClass=undefined;this.duration=v.getNumber("toastDuration",0);this.header=undefined;this.layout="baseline";this.message=undefined;this.keyboardClose=false;this.position="bottom";this.buttons=undefined;this.translucent=false;this.animated=true;this.icon=undefined;this.htmlAttributes=undefined;this.isOpen=false;this.trigger=undefined}onIsOpenChange(t,e){if(t===true&&e===false){this.present()}else if(t===false&&e===true){this.dismiss()}}triggerChanged(){const{trigger:t,el:e,triggerController:o}=this;if(t){o.addClickListener(e,t)}}connectedCallback(){h(this.el);this.triggerChanged()}disconnectedCallback(){this.triggerController.removeClickListener()}componentWillLoad(){c(this.el)}async present(){if(this.currentTransition!==undefined){await this.currentTransition}await this.delegateController.attachViewToDom();this.currentTransition=u(this,"toastEnter",j,T,this.position);await this.currentTransition;this.revealContentToScreenReader=true;this.currentTransition=undefined;if(this.duration>0){this.durationTimeout=setTimeout((()=>this.dismiss(undefined,"timeout")),this.duration)}}async dismiss(t,e){if(this.durationTimeout){clearTimeout(this.durationTimeout)}this.currentTransition=b(this,t,e,"toastLeave",z,D,this.position);const o=await this.currentTransition;if(o){this.delegateController.removeViewFromDom();this.revealContentToScreenReader=false}return o}onDidDismiss(){return g(this.el,"ionToastDidDismiss")}onWillDismiss(){return g(this.el,"ionToastWillDismiss")}getButtons(){const t=this.buttons?this.buttons.map((t=>typeof t==="string"?{text:t}:t)):[];return t}async buttonClick(t){const e=t.role;if(p(e)){return this.dismiss(undefined,e)}const o=await this.callButtonHandler(t);if(o){return this.dismiss(undefined,e)}return Promise.resolve()}async callButtonHandler(t){if(t===null||t===void 0?void 0:t.handler){try{const e=await f(t.handler);if(e===false){return false}}catch(t){console.error(t)}}return true}renderButtons(t,e){if(t.length===0){return}const i=w(this);const a={"toast-button-group":true,[`toast-button-group-${e}`]:true};return o("div",{class:a},t.map((t=>o("button",{type:"button",class:H(t),tabIndex:0,onClick:()=>this.buttonClick(t),part:"button"},o("div",{class:"toast-button-inner"},t.icon&&o("ion-icon",{"aria-hidden":"true",icon:t.icon,slot:t.text===undefined?"icon-only":undefined,class:"toast-button-icon"}),t.text),i==="md"&&o("ion-ripple-effect",{type:t.icon!==undefined&&t.text===undefined?"unbounded":"bounded"})))))}renderToastMessage(t,e=null){const{customHTMLEnabled:i,message:a}=this;if(i){return o("div",{key:t,"aria-hidden":e,class:"toast-message",part:"message",innerHTML:r(a)})}return o("div",{key:t,"aria-hidden":e,class:"toast-message",part:"message"},a)}renderHeader(t,e=null){return o("div",{key:t,class:"toast-header","aria-hidden":e,part:"header"},this.header)}render(){const{layout:t,el:e,revealContentToScreenReader:a,header:n,message:r}=this;const d=this.getButtons();const l=d.filter((t=>t.side==="start"));const p=d.filter((t=>t.side!=="start"));const h=w(this);const c={"toast-wrapper":true,[`toast-${this.position}`]:true,[`toast-layout-${t}`]:true};if(t==="stacked"&&l.length>0&&p.length>0){s("This toast is using start and end buttons with the stacked toast layout. We recommend following the best practice of using either start or end buttons with the stacked toast layout.",e)}return o(i,Object.assign({tabindex:"-1"},this.htmlAttributes,{style:{zIndex:`${6e4+this.overlayIndex}`},class:x(this.color,Object.assign(Object.assign({[h]:true},m(this.cssClass)),{"overlay-hidden":true,"toast-translucent":this.translucent})),onIonToastWillDismiss:this.dispatchCancelHandler}),o("div",{class:c},o("div",{class:"toast-container",part:"container"},this.renderButtons(l,"start"),this.icon!==undefined&&o("ion-icon",{class:"toast-icon",part:"icon",icon:this.icon,lazy:false,"aria-hidden":"true"}),o("div",{class:"toast-content",role:"status","aria-atomic":"true","aria-live":"polite"},!a&&n!==undefined&&this.renderHeader("oldHeader","true"),!a&&r!==undefined&&this.renderToastMessage("oldMessage","true"),a&&n!==undefined&&this.renderHeader("header"),a&&r!==undefined&&this.renderToastMessage("header")),this.renderButtons(p,"end"))))}get el(){return a(this)}static get watchers(){return{isOpen:["onIsOpenChange"],trigger:["triggerChanged"]}}};const H=t=>Object.assign({"toast-button":true,"toast-button-icon-only":t.icon!==undefined&&t.text===undefined,[`toast-button-${t.role}`]:t.role!==undefined,"ion-focusable":true,"ion-activatable":true},m(t.cssClass));Y.style={ios:$,md:C};export{Y as ion_toast};
//# sourceMappingURL=p-58c0adbc.entry.js.map