function r(i,t,s={}){var e;return jQuery.ajax({url:window.ajaxurl,type:"GET",data:{...t,action:"wpb_ajax_get",_ajax_nonce:((e=window==null?void 0:window.wpbookit)==null?void 0:e._ajax_nonce)??wpb_nounce,route_name:i},...s})}function c(i,t,s={}){var n,a;let e={processData:!1,contentType:!1};return t instanceof FormData?(t.append("action","wpb_ajax_post"),t.append("route_name",i),t.append("_ajax_nonce",((n=window==null?void 0:window.wpbookit)==null?void 0:n._ajax_nonce)??wpb_nounce)):t={...t,action:"wpb_ajax_post",_ajax_nonce:((a=window==null?void 0:window.wpbookit)==null?void 0:a._ajax_nonce)??wpb_nounce,route_name:i},jQuery.ajax({url:window.ajaxurl,type:"POST",data:t,...t instanceof FormData?e:{},...s})}class o{constructor(t,s="",e={}){const n={type:"success",duration:3e3,autoClose:!0,enableProgressBar:!1,position:"top-right",checkIcon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>',closeIcon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg>',showMethod:"fadeIn",hideMethod:"fadeOut",closeButton:!0,progressBar:!0,preventDuplicates:!1,newestOnTop:!0};this.options=jQuery.extend({},n,e),this.message=t,this.title=s,!(this.options.preventDuplicates&&this.isDuplicate())&&(this.createToast(),this.show(),this.options.autoClose&&this.setupAutoClose(),this.options.autoClose&&this.options.progressBar&&this.setupProgressBar())}setupAutoClose(){const t=()=>{this.jQuerytoast[this.options.hideMethod]("slow",()=>{this.jQuerytoast.remove(),this.adjustToastPositions()}),clearTimeout(s)},s=setTimeout(()=>{this.jQuerytoast[this.options.hideMethod]("slow",()=>{this.jQuerytoast.remove(),this.adjustToastPositions()})},this.options.duration);this.jQueryiconClose.on("click",t)}setupProgressBar(){this.progressBarDiv.animate({width:"0%"},this.options.duration)}isDuplicate(){return jQuery(".notification-toast").filter((t,s)=>jQuery(s).find(".message .text-2").text()===this.message).length>0}getIcon(t){return{success:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
                                <path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/>
                            </svg>`,info:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
                            <path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/>
                        </svg>`,warning:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
                                <path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"/>
                            </svg>`,danger:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
                            <path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/>
                        </svg>`,error:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
                            <path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/>
                        </svg>`}[`${t}`]}createToast(){const t=`<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
                                <path d="M1 1L9.00001 9.00001" stroke="#7E7E7E" stroke-width="1.4" stroke-linecap="round"/>
                                <path d="M9.00006 1L1.00005 9.00001" stroke="#7E7E7E" stroke-width="1.4" stroke-linecap="round"/>
                            </svg>`,s=this.getIcon(this.options.type);this.jQuerytoast=jQuery("<div/>",{class:`notification-toast ${this.options.type}`}),this.jQuerytoastContent=jQuery("<div/>",{class:"toast-content"}),this.jQuerymessageContainer=jQuery("<div/>",{class:"message-container"}),this.jQuerymessageIcon=jQuery("<div/>",{class:"message-icon"}),this.jQuerymessageIcon.append(s),this.jQueryiconClose=jQuery("<div/>",{class:"icon-close"}).append(t),this.jQuerymessage=jQuery("<div/>",{class:"message"}),this.jQuerytitleSpan=jQuery("<h6/>",{class:"text text-1 mt-0 mb-2",text:this.title}),this.jQuerymessageSpan=jQuery("<span/>",{class:"text text-2",text:this.message}),this.jQuerymessage.append(this.jQuerytitleSpan,this.jQuerymessageSpan),this.jQuerymessageContainer.append(this.jQuerymessageIcon,this.jQuerymessage),this.jQuerytoastContent.append(this.jQuerymessageContainer),this.jQuerytoast.append(this.jQuerytoastContent),this.options.closeButton&&this.jQuerytoastContent.append(this.jQueryiconClose),this.options.progressBar&&(this.progressBarDiv=jQuery("<div/>",{class:"progress-bar",style:"width: 100%"}),this.jQuerytoast.append(this.progressBarDiv)),jQuery("body").append(this.jQuerytoast),this.adjustToastPositions();function e(){this.jQuerytoast.addClass("active")}setTimeout(()=>e.call(this),300)}adjustToastPositions(){const t=jQuery(".notification-toast").not(this.jQuerytoast);let s=60;t.each(function(){s+=jQuery(this).outerHeight(!0)+10}),this.options.position==="top-left"||this.options.position==="top-center"||this.options.position==="top-right"?this.jQuerytoast.css("top",s):this.jQuerytoast.css("bottom",s)}show(){this.jQuerytoast[this.options.showMethod]("slow")}static success(t,s="",e={}){e.type="success",new o(t,s,e)}static info(t,s="",e={}){e.type="info",new o(t,s,e)}static warning(t,s="",e={}){e.type="warning",new o(t,s,e)}static error(t,s="",e={}){e.type="danger",new o(t,s,e)}static remove(){jQuery(".notification-toast").remove()}static clear(){jQuery(".notification-toast").remove()}}export{r as g,o as n,c as p};
//# sourceMappingURL=notification-toast-2e483452.js.map
