customizable-toast-notification 3.9.1 → 3.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.mjs +4 -4
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Customizable Toast Notifications 3.9.
|
|
3
|
-
* Build: 2025-09-
|
|
4
|
-
* Cache-Buster:
|
|
2
|
+
* Customizable Toast Notifications 3.9.2
|
|
3
|
+
* Build: 2025-09-18 02:31:41
|
|
4
|
+
* Cache-Buster: 1758162701572
|
|
5
5
|
* Author: Priyanshu Patel
|
|
6
6
|
* Email: [priyanshu.alt191@gmail.com](mailto:priyanshu.alt191@gmail.com)
|
|
7
7
|
* License: Apache-2.0
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
*/
|
|
15
15
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).customizableToast={})}(this,function(t){"use strict";function e(t,e,n,r,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,o)}function n(t){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=t.apply(n,r);function s(t){e(a,o,i,s,u,"next",t)}function u(t){e(a,o,i,s,u,"throw",t)}s(void 0)})}}function r(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach(function(e){r(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function a(){
|
|
16
16
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
17
|
-
var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var a=r&&r.prototype instanceof c?r:c,l=Object.create(a.prototype);return s(l,"_invoke",function(n,r,o){var i,a,s,c=0,l=o||[],p=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return i=e,a=0,s=t,f.n=n,u}};function d(n,r){for(a=n,s=r,e=0;!p&&c&&!o&&e<l.length;e++){var o,i=l[e],d=f.p,h=i[2];n>3?(o=h===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=n<2&&d<i[1])?(a=0,f.v=r,f.n=i[1]):d<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,f.n=h,a=0))}if(o||n>1)return u;throw p=!0,r}return function(o,l,h){if(c>1)throw TypeError("Generator is already running");for(p&&1===l&&d(l,h),a=l,s=h;(e=a<2?t:s)||!p;){i||(a?a<3?(a>1&&(f.n=-1),d(a,s)):f.n=s:f.v=s);try{if(c=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(p=f.n<0)?s:n.call(r,f))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:e,done:p}}}(n,o,i),!0),l}var u={};function c(){}function l(){}function p(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(s(e={},r,function(){return this}),e),d=p.prototype=c.prototype=Object.create(f);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,s(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t}return l.prototype=p,s(d,"constructor",p),s(p,"constructor",l),l.displayName="GeneratorFunction",s(p,o,"GeneratorFunction"),s(d),s(d,o,"Generator"),s(d,r,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:h}})()}function s(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}s=function(t,e,n,r){function i(e,n){s(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},s(t,e,n,r)}function u(t){return c.apply(this,arguments)}function c(){return(c=n(a().m(function t(e){return a().w(function(t){for(;;)if(0===t.n)return t.a(2,"".concat(e,"-").concat(Date.now(),"-").concat(Math.floor(1e5*Math.random())))},t)}))).apply(this,arguments)}function l(t,e){return p.apply(this,arguments)}function p(){return(p=n(a().m(function t(e,n){var r,o,i;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,e&&n){t.n=1;break}throw new Error("tagName and prefix is required");case 1:return r=document.createElement(e),t.n=2,u(n);case 2:return r.id=t.v,t.a(2,r);case 3:return t.p=3,t.v,t.p=4,o="div",i=document.createElement(o),t.n=5,u("fallback");case 5:return i.id=t.v,i.setAttribute("data-original-tag",o),t.a(2,i);case 6:t.p=6,t.v;case 7:return t.a(2)}},t,null,[[4,6],[0,3]])}))).apply(this,arguments)}function f(){return(f=n(a().m(function t(e){var n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e){t.n=1;break}return t.a(2,!0);case 1:if(t.p=1,null==e||null===(n=e.parentNode)||void 0===n||!n.id.includes("toast-container-")){t.n=2;break}return e.parentNode.removeChild(e),t.a(2,!0);case 2:case 5:t.n=9;break;case 3:if(t.p=3,t.v,t.p=4,!e.remove){t.n=5;break}return e.remove(),t.a(2,!0);case 6:return t.p=6,t.v,t.p=7,e.style.display="none",e.style.opacity="0",e.style.pointerEvents="none",e.style.position="absolute",e.style.left="-9999px",t.a(2,!0);case 8:return t.p=8,t.v,t.a(2,!1);case 9:return t.a(2,!0)}},t,null,[[7,8],[4,6],[1,3]])}))).apply(this,arguments)}function d(t){return h.apply(this,arguments)}function h(){return(h=n(a().m(function t(e){var n,r;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,!("number"==typeof e&&e>0)){t.n=1;break}return t.a(2,e);case 1:if("string"!=typeof e){t.n=3;break}if(!e.endsWith("s")||e.endsWith("ms")){t.n=2;break}return n=1e3*parseFloat(e),t.a(2,n>0?n:500);case 2:return r=parseFloat(e),t.a(2,r>0?r:500);case 3:t.n=5;break;case 4:t.p=4,t.v;case 5:return t.a(2,500)}},t,null,[[0,4]])}))).apply(this,arguments)}function m(t){try{return(null==t?void 0:t.offsetWidth)||0}catch(t){return 0}}function y(t){return b.apply(this,arguments)}function b(){return(b=n(a().m(function t(e){var n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e){t.n=1;break}return t.a(2,"black");case 1:return t.p=1,t.n=2,g(e);case 2:if(!(t.v>3.5)){t.n=3;break}n="black",t.n=4;break;case 3:n="white";case 4:return t.a(2,n);case 5:return t.p=5,t.v,t.a(2,"black")}},t,null,[[1,5]])}))).apply(this,arguments)}function g(t){return v.apply(this,arguments)}function v(){return(v=n(a().m(function t(e){var n,r,o,i,s,u,c;return a().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}throw new Error("Color is required");case 1:if(!e.startsWith("#")){t.n=5;break}if(3!==(i=e.substring(1)).length){t.n=2;break}n=parseInt(i[0]+i[0],16),r=parseInt(i[1]+i[1],16),o=parseInt(i[2]+i[2],16),t.n=4;break;case 2:if(6!==i.length){t.n=3;break}n=parseInt(i.substring(0,2),16),r=parseInt(i.substring(2,4),16),o=parseInt(i.substring(4,6),16),t.n=4;break;case 3:throw new Error("Invalid hex color format: ".concat(e));case 4:case 7:t.n=10;break;case 5:if(!e.startsWith("rgb")&&!e.startsWith("rgba")){t.n=8;break}if(!(s=e.match(/^rgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(?:,\s*(\d+(?:\.\d+)?))?\)$/))){t.n=6;break}n=parseInt(s[1]),r=parseInt(s[2]),o=parseInt(s[3]),t.n=7;break;case 6:throw new Error("Invalid rgb/rgba color format: ".concat(e));case 8:if(!(u={black:[0,0,0],white:[255,255,255]}[e.toLowerCase()])){t.n=9;break}n=u[0],r=u[1],o=u[2],t.n=10;break;case 9:throw new Error("Unsupported color format: ".concat(e));case 10:if(!(isNaN(n)||isNaN(r)||isNaN(o))){t.n=11;break}throw new Error("Invalid color value: ".concat(e));case 11:return c=(.2126*n+.7152*r+.0722*o)/255,t.a(2,(Math.max(c,.05)+.05)/Math.min(c,.05))}},t)}))).apply(this,arguments)}function w(t,e,n){return x.apply(this,arguments)}function x(){return(x=n(a().m(function t(e,n,r){var o;return a().w(function(t){for(;;)switch(t.n){case 0:(o=document.createElement("button")).setAttribute("aria-label","Close notification"),o.setAttribute("title","Close"),o.textContent="×",Object.assign(o.style,{background:"none",border:"none",color:n.textColor,fontSize:"18px",marginLeft:"10px",cursor:"pointer"}),o.onclick=()=>r(e),e.appendChild(o),e._cleanupCloseButton=()=>{o.onclick=null};case 1:return t.a(2)}},t)}))).apply(this,arguments)}function k(t,e){return C.apply(this,arguments)}function C(){return(C=n(a().m(function t(e,n){var r;return a().w(function(t){for(;;)switch(t.n){case 0:r=document.createElement("div"),Object.assign(r.style,{position:"absolute",left:"0",height:n.progressHeight||"4px",background:n.progressColor||"rgba(255, 255, 255, 0.3)",width:"100%",transition:"width ".concat(n.duration||1800,"ms linear"),["top"===n.progressPosition?"top":"bottom"]:"0"}),e.appendChild(r),setTimeout(()=>{m(r),r.style.width="0%"},100);case 1:return t.a(2)}},t)}))).apply(this,arguments)}function E(t){return T.apply(this,arguments)}function T(){return(T=n(a().m(function t(e){return a().w(function(t){for(;;)switch(t.n){case 0:setTimeout(()=>{requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="translateY(0)"})},50);case 1:return t.a(2)}},t)}))).apply(this,arguments)}function O(t,e,n){return S.apply(this,arguments)}function S(){return(S=n(a().m(function t(e,n,r){var o,i;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,d(n.animationDuration);case 1:return o=t.v,Object.assign(e.style,{background:n.backgroundColor,padding:"12px 20px",marginBottom:"10px",borderRadius:n.borderRadius,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:n.maxWidth,opacity:"0",position:"relative",transition:"opacity ".concat(n.animationDuration," ").concat(n.animationEasing,", transform ").concat(n.animationDuration," ").concat(n.animationEasing),transform:"translateY(20px)",zIndex:"9999"}),e._animationDuration=o,(i=document.createElement("span")).style.position=n.fontPosition,i.style.display="inline-block",i.style.flex="1",i.style.padding=n.fontPadding,i.style.borderRadius=n.fontBorderRadius,i.style.background=n.fontBackgroundColor,i.style.fontFamily=n.fontFamily,i.style.fontSize=n.fontSize,i.style.fontWeight=n.fontWeight,i.style.lineHeight=n.fontLineHeight,i.style.color=n.textColor,i.style.userSelect="text",i.style.wordBreak="break-word",i.style.direction=n.fontDirection,i.style.webkitLineClamp="3",i.style.webkitBoxOrient="vertical",i.style.whiteSpace=n.wrapText?"normal":"nowrap",i.style.display="block",i.style.overflow="hidden",i.style.textOverflow="ellipsis",i.style.lineClamp="3",i.style.boxOrient="vertical",i.style.display="-webkit-box",i.textContent=n.message,i.setAttribute("aria-label","Toast Notification Center"),i.setAttribute("title",n.message),e.appendChild(i),t.n=2,P(e,n,r);case 2:if(!n.showCloseButton){t.n=3;break}return t.n=3,w(e,n,r);case 3:if(!n.showProgressBar){t.n=4;break}return t.n=4,k(e,n);case 4:return t.n=5,E(e);case 5:return t.a(2)}},t)}))).apply(this,arguments)}function I(t,e){return j.apply(this,arguments)}function j(){return(j=n(a().m(function t(e,n){var r;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,(r=document.createElement("div")).id="emergency-".concat(Date.now()),r.innerHTML='\n <div style="\n background: #333 !important;\n color: white !important;\n padding: 10px 15px !important;\n position: fixed !important;\n top: 20px !important;\n right: 20px !important;\n z-index: 99999 !important;\n border-radius: 3px !important;\n max-width: 250px !important;\n word-wrap: break-word !important;\n font-family: Arial, sans-serif !important;\n font-size: 14px !important;\n box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;\n cursor: pointer !important;\n " onclick="this.parentNode.removeChild(this)">\n '.concat(e.message||"Emergency Toast Creation Showing!",'\n <span style="float: right; margin-left: 10px; font-weight: bold;">×</span>\n </div>\n '),r._animationDuration=500,r._isEmergencyToast=!0,setTimeout(()=>{try{r.parentNode&&r.parentNode.removeChild(r),n(r)}catch(t){}},e.duration||1800),t.a(2,r);case 1:return t.p=1,t.v,setTimeout(()=>{try{alert(e.message||"Toast Creation Failed!"),n(null)}catch(t){n(null)}},100),t.a(2,null)}},t,null,[[0,1]])}))).apply(this,arguments)}function P(t,e,n){return L.apply(this,arguments)}function L(){return L=n(a().m(function t(e,r,o){var i,s,u;return a().w(function(t){for(;;)switch(t.n){case 0:if((i=null==r?void 0:r.cta)&&i.label){t.n=1;break}return t.a(2);case 1:s=!!i.href&&"link"===i.variant,u=document.createElement(s?"a":"button"),s?(u.href=i.href,i.target&&(u.target=i.target),u.rel=i.rel||("_blank"===i.target?"noopener noreferrer":"")):u.type="button",u.setAttribute("aria-label",i.ariaLabel||i.label),Object.assign(u.style,{marginLeft:"10px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:"1px solid rgba(255,255,255,0.35)",color:r.textColor||"#fff",background:"rgba(255,255,255,0.15)",cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),u.textContent=i.label,u.addEventListener("click",function(){var t=n(a().m(function t(n){var r;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,"function"!=typeof i.onClick){t.n=1;break}if(null==(r=i.onClick(n))||!r.then){t.n=1;break}return t.n=1,r;case 1:return t.p=1,!1!==i.autoClose&&o(e),t.f(1);case 2:return t.a(2)}},t,null,[[0,,1,2]])}));return function(e){return t.apply(this,arguments)}}()),e.appendChild(u);case 2:return t.a(2)}},t)})),L.apply(this,arguments)}function D(t,e){return A.apply(this,arguments)}function A(){return(A=n(a().m(function t(e,n){var r;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(document.querySelector('[id^="toast-container-"]')){t.n=1;break}return t.a(2,null);case 1:return t.p=2,t.n=3,l("div","toast");case 3:return r=t.v,t.n=4,O(r,e,n);case 4:case 6:return t.a(2,r);case 5:return t.p=5,t.v,t.n=6,I(e,n)}},t,null,[[2,5]])}))).apply(this,arguments)}var B=new Map,M=new Map;function W(){return"toast-container-".concat(function(){return String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom-right").toLowerCase().trim().replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"-").replace(/\-+/g,"-")}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom-right"))}function z(){return N.apply(this,arguments)}function N(){return N=n(a().m(function t(){var e,r,o,i,s,u=arguments;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(r=u.length>1?u[1]:void 0,o=W((e=u.length>0&&void 0!==u[0]?u[0]:{}).position),!M.has(o)){t.n=1;break}return t.a(2,M.get(o));case 1:return i=n(a().m(function t(){var n,i,s,u;return a().w(function(t){for(;;)switch(t.n){case 0:if(!(n=B.get(o))||!n.isConnected){t.n=1;break}return t.a(2,n);case 1:if((i=document.getElementById(o))&&!i.isConnected&&document.body.appendChild(i),i){t.n=3;break}if((i=document.createElement("div")).id=o,i.setAttribute("role","status"),i.setAttribute("aria-atomic","true"),i.style.position="fixed",i.style.zIndex="9999",i.style.inset="auto 10px 10px auto",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center",i.style.flexDirection="column",i.style.overflow="hidden","function"!=typeof r){t.n=2;break}return t.n=2,r(i,e);case 2:document.body.appendChild(i),t.n=4;break;case 3:if(i.style.position=i.style.position||"fixed",i.style.zIndex=i.style.zIndex||"9999","function"!=typeof r){t.n=4;break}return t.n=4,r(i,e);case 4:if((s=document.querySelectorAll("#".concat(o))).length>1)for(u=1;u<s.length;u++)try{s[u].remove()}catch(t){}return B.set(o,i),t.a(2,i)}},t)}))(),M.set(o,i),t.p=2,t.n=3,i;case 3:return s=t.v,t.a(2,s);case 4:return t.p=4,M.delete(W(e.position)),t.f(4);case 5:return t.a(2)}},t,null,[[2,,4,5]])})),N.apply(this,arguments)}function R(t,e){return _.apply(this,arguments)}function _(){return(_=n(a().m(function t(e,n){var r;return a().w(function(t){for(;;)switch(t.n){case 0:if(e&&n.position){t.n=1;break}throw new Error("Invalid container or position!");case 1:if(F(e),r=H(n.position),!q(e,n,r)){t.n=2;break}return t.a(2);case 2:if(!G(e,r)){t.n=3;break}return t.a(2);case 3:U(e,r);case 4:return t.a(2)}},t)}))).apply(this,arguments)}function F(t){t.style.top="auto",t.style.bottom="auto",t.style.left="auto",t.style.right="auto",t.style.transform="none"}function H(t){var e=t.toLowerCase().trim();return{hasTop:e.includes("top"),hasBottom:e.includes("bottom")||e.includes("below"),hasLeft:e.includes("left"),hasRight:e.includes("right"),hasCenter:e.includes("center"),hasFullWidth:e.includes("top-full-width")||e.includes("bottom-full-width")||e.includes("fullwidth")}}function q(t,e,n){return!!n.hasFullWidth&&(e.maxWidth="100vw",n.hasTop?(t.style.top="10px",t.style.left="10px",t.style.right="10px",!0):!!n.hasBottom&&(t.style.bottom="10px",t.style.left="10px",t.style.right="10px",!0))}function G(t,e){return!!e.hasCenter&&(!e.hasTop||e.hasLeft||e.hasRight?!e.hasBottom||e.hasLeft||e.hasRight?!e.hasLeft||e.hasTop||e.hasBottom?!e.hasRight||e.hasTop||e.hasBottom?!(e.hasLeft||e.hasRight||e.hasTop||e.hasBottom)&&(t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",!0):(t.style.right="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):(t.style.left="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):(t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0):(t.style.top="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0))}function U(t,e){e.hasBottom?t.style.bottom="10px":e.hasTop&&(t.style.top="10px"),e.hasRight?t.style.right="10px":e.hasLeft?t.style.left="10px":(t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)")}class Y{constructor(t,e){this.callback=t,this.delay=e,this.remaining=e,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1}start(){return this.isCompleted||this.timeoutId||(this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null,this.callback()},this.remaining)),this}pause(){return this.isPaused||!this.timeoutId||this.isCompleted||(clearTimeout(this.timeoutId),this.timeoutId=null,this.remaining-=Date.now()-this.startTime,this.remaining=Math.max(0,this.remaining),this.isPaused=!0),this}resume(){return!this.isPaused||this.isCompleted||(this.isPaused=!1,this.start()),this}clear(){return this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.isCompleted=!0,this}getRemainingTime(){return this.isCompleted?0:this.isPaused?this.remaining:this.timeoutId?Math.max(0,this.remaining-(Date.now()-this.startTime)):this.delay}}var X=new Map,$=new Map,J=[],K=0;function Q(t){for(var e=5381,n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return e>>>0}function V(t){var e=t.type,n=void 0===e?"info":e,r=t.message,o=void 0===r?"":r,i=t.position,a=void 0===i?"bottom-right":i;return[String(n).trim().toLowerCase(),Q(String(o)).toString(16),String(a).trim().toLowerCase()].join("|")}function Z(){return tt.apply(this,arguments)}function tt(){return tt=n(a().m(function t(){var e,r,o,i,s=arguments;return a().w(function(t){for(;;)switch(t.n){case 0:if(r=V(e=s.length>0&&void 0!==s[0]?s[0]:{}),!X.has(r)){t.n=1;break}return(o=X.get(r)).count++,o.timer.clear(),o.timer=rt(o.toast,e),ot(o),ct(o),t.a(2);case 1:if(!$.has(r)){t.n=2;break}return $.get(r).count++,t.a(2);case 2:i={options:e,count:1,rafId:0},$.set(r,i),i.rafId=requestAnimationFrame(n(a().m(function t(){var e;return a().w(function(t){for(;;)switch(t.n){case 0:if(e=$.get(r)){t.n=1;break}return t.a(2);case 1:if($.delete(r),!(K>=3)){t.n=2;break}return J.push({options:e.options,key:r,count:e.count}),st(),t.a(2);case 2:return t.n=3,et(e.options,r,e.count);case 3:return t.a(2)}},t)})));case 3:return t.a(2)}},t)})),tt.apply(this,arguments)}function et(t,e,n){return nt.apply(this,arguments)}function nt(){return(nt=n(a().m(function t(e,n,r){var o,i,s,u,c,l;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,K++,t.n=1,z(e,R);case 1:return o=t.v,t.n=2,D(e,it);case 2:if(i=t.v){t.n=3;break}throw new Error("Toast element creation failed");case 3:s=document.createElement("div"),Object.assign(s.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%"}),u=document.createElement("div"),Object.assign(u.style,{position:"relative",overflow:"hidden",borderRadius:e.borderRadius||"8px",zIndex:"1"}),u.appendChild(i),s.appendChild(u),o.id.includes("toast-container-")&&o.appendChild(s),c=!1!==e.pauseOnHover&&(!0===e.pauseOnHover||!!e.cta),l={outer:s,toast:i,count:Math.max(1,0|r),timeout:null,pauseOnHover:c},X.set(n,l),i._key=n,l.count>1&&ct(l),l.timer=rt(i,e),ot(l),t.n=5;break;case 4:t.p=4,t.v,K=Math.max(0,K-1),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(I(e,it));case 5:return t.a(2)}},t,null,[[0,4]])}))).apply(this,arguments)}function rt(t,e){var n=(e.duration||1800)+10,r=new Y(()=>it(t),n);return r.start(),r}function ot(t){if(t.pauseOnHover&&t.outer&&t.timer){var e=t.outer,n=t.timer,r=()=>{n.pause()},o=()=>{n.resume()},i=t=>{t.target.matches("button, a, [tabindex]")&&n.pause()},a=t=>{e.contains(t.relatedTarget)||n.resume()};e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",o),e.addEventListener("focusin",i),e.addEventListener("focusout",a),e._pauseCleanup=()=>{e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",o),e.removeEventListener("focusin",i),e.removeEventListener("focusout",a)}}}function it(t){return at.apply(this,arguments)}function at(){return(at=n(a().m(function t(e){var n,r,o,i,s;return a().w(function(t){for(;;)switch(t.n){case 0:if(e&&e._key){t.n=1;break}return t.a(2);case 1:if(s=X.get(e._key)){t.n=2;break}return t.a(2);case 2:return null===(n=s.timer)||void 0===n||n.clear(),null===(r=s.outer)||void 0===r||null===(o=r._pauseCleanup)||void 0===o||o.call(r),X.delete(e._key),K=Math.max(0,K-1),null===(i=s.outer.querySelector(".toast-count-badge"))||void 0===i||i.remove(),t.n=3,ut(s.outer);case 3:st();case 4:return t.a(2)}},t)}))).apply(this,arguments)}function st(){for(;K<3&&J.length;){var t=J.shift();if(X.has(t.key)){var e=X.get(t.key);e.count+=t.count,ct(e)}else et(t.options,t.key,t.count)}}function ut(t){return new Promise(e=>{var n=!1,r=()=>{n||(n=!0,function(t){f.apply(this,arguments)}(t),e())},o=t.firstElementChild||t,i=t=>{t.target===o&&(o.removeEventListener("transitionend",i,!0),r())};o.addEventListener("transitionend",i,!0),setTimeout(()=>{o.removeEventListener("transitionend",i,!0),r()},700)})}function ct(t){var e=t.outer,n=t.count;if(n<2){var r;null===(r=e.querySelector(".toast-count-badge"))||void 0===r||r.remove()}else{var o=e.querySelector(".toast-count-badge");o||((o=document.createElement("span")).className="toast-count-badge",o.setAttribute("aria-label","".concat(n," identical notifications")),Object.assign(o.style,{position:"absolute",top:"6px",right:"6px",backgroundColor:"#f44336",color:"#fff",borderRadius:"50%",minWidth:"20px",height:"20px",fontSize:"12px",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid #fff",boxShadow:"0 2px 6px rgba(0,0,0,0.3)",zIndex:"2",pointerEvents:"none",transition:"transform 150ms ease"}),e.appendChild(o)),o.textContent=n>99?"99+":String(n),o.style.transform="scale(1.2)",setTimeout(()=>o.style.transform="scale(1)",150)}}var lt={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},pt={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"},ft=[],dt=!1;function ht(){return mt.apply(this,arguments)}function mt(){return(mt=n(a().m(function t(){return a().w(function(t){for(;;)switch(t.n){case 0:if(!dt){t.n=1;break}return t.a(2);case 1:"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"interactive"===document.readyState?(dt=!0,ft.forEach(t=>setTimeout(()=>yt(t),2e3)),ft.length=0):document.addEventListener("DOMContentLoaded",()=>{dt=!0,ft.forEach(t=>setTimeout(()=>yt(t),2e3)),ft.length=0},{once:!0}));case 2:return t.a(2)}},t)}))).apply(this,arguments)}function yt(){return bt.apply(this,arguments)}function bt(){return bt=n(a().m(function t(){var e,n,r,o,i=arguments;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return e=i.length>0&&void 0!==i[0]?i[0]:{},t.p=1,t.n=2,Ct(e);case 2:return n=t.v,t.n=3,xt(n);case 3:return t.n=4,Z(n);case 4:t.n=6;break;case 5:t.p=5,t.v,o="string"==typeof(null==e?void 0:e.message)&&null!==(null==e?void 0:e.message)?"".concat(null==e||null===(r=e.message)||void 0===r?void 0:r.substring(0,200)," toast creation failed!"):"Toast creation failed!",alert(o);case 6:return t.a(2)}},t,null,[[1,5]])})),bt.apply(this,arguments)}var gt=!1;function vt(){return wt.apply(this,arguments)}function wt(){return wt=n(a().m(function t(){var e,n,r=arguments;return a().w(function(t){for(;;)switch(t.n){case 0:if(e=r.length>0&&void 0!==r[0]?r[0]:{},"undefined"!=typeof window&&"undefined"!=typeof document){t.n=1;break}return t.a(2);case 1:return t.n=2,ht();case 2:if(dt){t.n=3;break}return ft.push(e),t.a(2);case 3:if(gt){t.n=5;break}return gt=!0,n=setTimeout,t.n=4,yt(e);case 4:n(t.v,2e3),t.n=6;break;case 5:return t.n=6,yt(e);case 6:return t.a(2)}},t)})),wt.apply(this,arguments)}function xt(t){return kt.apply(this,arguments)}function kt(){return(kt=n(a().m(function t(e){var n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,z(e,R);case 1:return n=t.v,t.a(2,n);case 2:return t.p=2,t.v,t.a(2,document.body)}},t,null,[[0,2]])}))).apply(this,arguments)}function Ct(t){return Et.apply(this,arguments)}function Et(){return(Et=n(a().m(function t(e){var n,r,o,s,u,c,l,p;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(o=null==e||null===(n=e.position)||void 0===n||null===(n=n.toLowerCase())||void 0===n?void 0:n.trim(),s=null!=o&&o.includes("top-full-width")||null!=o&&o.includes("bottom-full-width")?"100vw":"400px",(u=i(i({},{pauseOnHover:void 0,duration:1800,position:"bottom-right",type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationType:"fade",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressHeight:"4px",progressPosition:"bottom",fontPosition:"relative",fontPadding:void 0,fontBorderRadius:void 0,fontBackgroundColor:void 0,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"14px",fontWeight:"400",fontLineHeight:"1.4",fontDirection:"auto",wrapText:"normal",maxWidth:s}),"object"!=typeof e||Array.isArray(e)?{}:e)).message=null!==(r=null==e?void 0:e.message)&&void 0!==r?r:u.message,t.p=1,u.backgroundColor||(u.backgroundColor=null!==(l=null===(p=lt)||void 0===p?void 0:p[u.type])&&void 0!==l?l:window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111"),u.message=u.message||(null===(c=pt)||void 0===c?void 0:c[u.type])||"No Message Provided!",u.textColor||!u.backgroundColor){t.n=3;break}return t.n=2,y(u.backgroundColor);case 2:u.textColor=t.v;case 3:if(u.progressColor||!u.backgroundColor){t.n=5;break}return t.n=4,y(u.backgroundColor);case 4:u.progressColor=t.v;case 5:t.n=7;break;case 6:t.p=6,t.v;case 7:return"string"!=typeof u.message&&(u.message="No Message Provided!"),t.a(2,u)}},t,null,[[1,6]])}))).apply(this,arguments)}function Tt(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(lt=i(i({},lt),t))}catch(t){}}function Ot(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(pt=i(i({},pt),t))}catch(t){}}try{"undefined"!=typeof window&&(window.customizableToast={createToast:vt,setDefaultColors:Tt,setDefaultMessages:Ot})}catch(t){}t.createToast=vt,t.noop=function(){it(document.querySelector('[id^="toast-"]:not([id*="container"])'))},t.setDefaultColors=Tt,t.setDefaultMessages=Ot});
|
|
17
|
+
var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var a=r&&r.prototype instanceof c?r:c,l=Object.create(a.prototype);return s(l,"_invoke",function(n,r,o){var i,a,s,c=0,l=o||[],p=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return i=e,a=0,s=t,f.n=n,u}};function d(n,r){for(a=n,s=r,e=0;!p&&c&&!o&&e<l.length;e++){var o,i=l[e],d=f.p,h=i[2];n>3?(o=h===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=n<2&&d<i[1])?(a=0,f.v=r,f.n=i[1]):d<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,f.n=h,a=0))}if(o||n>1)return u;throw p=!0,r}return function(o,l,h){if(c>1)throw TypeError("Generator is already running");for(p&&1===l&&d(l,h),a=l,s=h;(e=a<2?t:s)||!p;){i||(a?a<3?(a>1&&(f.n=-1),d(a,s)):f.n=s:f.v=s);try{if(c=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(p=f.n<0)?s:n.call(r,f))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:e,done:p}}}(n,o,i),!0),l}var u={};function c(){}function l(){}function p(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(s(e={},r,function(){return this}),e),d=p.prototype=c.prototype=Object.create(f);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,s(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t}return l.prototype=p,s(d,"constructor",p),s(p,"constructor",l),l.displayName="GeneratorFunction",s(p,o,"GeneratorFunction"),s(d),s(d,o,"Generator"),s(d,r,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:h}})()}function s(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}s=function(t,e,n,r){function i(e,n){s(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},s(t,e,n,r)}function u(t){return c.apply(this,arguments)}function c(){return(c=n(a().m(function t(e){return a().w(function(t){for(;;)if(0===t.n)return t.a(2,"".concat(e,"-").concat(Date.now(),"-").concat(Math.floor(1e5*Math.random())))},t)}))).apply(this,arguments)}function l(t,e){return p.apply(this,arguments)}function p(){return(p=n(a().m(function t(e,n){var r,o,i;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,e&&n){t.n=1;break}throw new Error("tagName and prefix is required");case 1:return r=document.createElement(e),t.n=2,u(n);case 2:return r.id=t.v,t.a(2,r);case 3:return t.p=3,t.v,t.p=4,o="div",i=document.createElement(o),t.n=5,u("fallback");case 5:return i.id=t.v,i.setAttribute("data-original-tag",o),t.a(2,i);case 6:t.p=6,t.v;case 7:return t.a(2)}},t,null,[[4,6],[0,3]])}))).apply(this,arguments)}function f(){return(f=n(a().m(function t(e){var n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e){t.n=1;break}return t.a(2,!0);case 1:if(t.p=1,null==e||null===(n=e.parentNode)||void 0===n||!n.id.includes("toast-container-")){t.n=2;break}return e.parentNode.removeChild(e),t.a(2,!0);case 2:case 5:t.n=9;break;case 3:if(t.p=3,t.v,t.p=4,!e.remove){t.n=5;break}return e.remove(),t.a(2,!0);case 6:return t.p=6,t.v,t.p=7,e.style.display="none",e.style.opacity="0",e.style.pointerEvents="none",e.style.position="absolute",e.style.left="-9999px",t.a(2,!0);case 8:return t.p=8,t.v,t.a(2,!1);case 9:return t.a(2,!0)}},t,null,[[7,8],[4,6],[1,3]])}))).apply(this,arguments)}function d(t){return h.apply(this,arguments)}function h(){return(h=n(a().m(function t(e){var n,r;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,!("number"==typeof e&&e>0)){t.n=1;break}return t.a(2,e);case 1:if("string"!=typeof e){t.n=3;break}if(!e.endsWith("s")||e.endsWith("ms")){t.n=2;break}return n=1e3*parseFloat(e),t.a(2,n>0?n:500);case 2:return r=parseFloat(e),t.a(2,r>0?r:500);case 3:t.n=5;break;case 4:t.p=4,t.v;case 5:return t.a(2,500)}},t,null,[[0,4]])}))).apply(this,arguments)}function m(t){try{return(null==t?void 0:t.offsetWidth)||0}catch(t){return 0}}function y(t){return b.apply(this,arguments)}function b(){return(b=n(a().m(function t(e){var n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e){t.n=1;break}return t.a(2,"black");case 1:return t.p=1,t.n=2,g(e);case 2:if(!(t.v>3.5)){t.n=3;break}n="black",t.n=4;break;case 3:n="white";case 4:return t.a(2,n);case 5:return t.p=5,t.v,t.a(2,"black")}},t,null,[[1,5]])}))).apply(this,arguments)}function g(t){return v.apply(this,arguments)}function v(){return(v=n(a().m(function t(e){var n,r,o,i,s,u,c;return a().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}throw new Error("Color is required");case 1:if(!e.startsWith("#")){t.n=5;break}if(3!==(i=e.substring(1)).length){t.n=2;break}n=parseInt(i[0]+i[0],16),r=parseInt(i[1]+i[1],16),o=parseInt(i[2]+i[2],16),t.n=4;break;case 2:if(6!==i.length){t.n=3;break}n=parseInt(i.substring(0,2),16),r=parseInt(i.substring(2,4),16),o=parseInt(i.substring(4,6),16),t.n=4;break;case 3:throw new Error("Invalid hex color format: ".concat(e));case 4:case 7:t.n=10;break;case 5:if(!e.startsWith("rgb")&&!e.startsWith("rgba")){t.n=8;break}if(!(s=e.match(/^rgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(?:,\s*(\d+(?:\.\d+)?))?\)$/))){t.n=6;break}n=parseInt(s[1]),r=parseInt(s[2]),o=parseInt(s[3]),t.n=7;break;case 6:throw new Error("Invalid rgb/rgba color format: ".concat(e));case 8:if(!(u={black:[255,255,255],white:[0,0,0]}[e.toLowerCase()])){t.n=9;break}n=u[0],r=u[1],o=u[2],t.n=10;break;case 9:throw new Error("Unsupported color format: ".concat(e));case 10:if(!(isNaN(n)||isNaN(r)||isNaN(o))){t.n=11;break}throw new Error("Invalid color value: ".concat(e));case 11:return c=(.2126*n+.7152*r+.0722*o)/255,t.a(2,(Math.max(c,.05)+.05)/Math.min(c,.05))}},t)}))).apply(this,arguments)}function w(t,e,n){return x.apply(this,arguments)}function x(){return(x=n(a().m(function t(e,n,r){var o;return a().w(function(t){for(;;)switch(t.n){case 0:(o=document.createElement("button")).setAttribute("aria-label","Close notification"),o.setAttribute("title","Close"),o.textContent="×",Object.assign(o.style,{background:"none",border:"none",color:n.textColor,fontSize:"18px",marginLeft:"10px",cursor:"pointer"}),o.onclick=()=>r(e),e.appendChild(o),e._cleanupCloseButton=()=>{o.onclick=null};case 1:return t.a(2)}},t)}))).apply(this,arguments)}function k(t,e){return C.apply(this,arguments)}function C(){return(C=n(a().m(function t(e,n){var r;return a().w(function(t){for(;;)switch(t.n){case 0:r=document.createElement("div"),Object.assign(r.style,{position:"absolute",left:"0",height:n.progressHeight||"4px",background:n.progressColor||"rgba(255, 255, 255, 0.3)",width:"100%",transition:"width ".concat(n.duration||1800,"ms linear"),["top"===n.progressPosition?"top":"bottom"]:"0"}),e.appendChild(r),setTimeout(()=>{m(r),r.style.width="0%"},100);case 1:return t.a(2)}},t)}))).apply(this,arguments)}function E(t){return T.apply(this,arguments)}function T(){return(T=n(a().m(function t(e){return a().w(function(t){for(;;)switch(t.n){case 0:setTimeout(()=>{requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="translateY(0)"})},50);case 1:return t.a(2)}},t)}))).apply(this,arguments)}function O(t,e,n){return S.apply(this,arguments)}function S(){return(S=n(a().m(function t(e,n,r){var o,i;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,d(n.animationDuration);case 1:return o=t.v,Object.assign(e.style,{background:n.backgroundColor,padding:"12px 20px",marginBottom:"10px",borderRadius:n.borderRadius,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:n.maxWidth,opacity:"0",position:"relative",transition:"opacity ".concat(n.animationDuration," ").concat(n.animationEasing,", transform ").concat(n.animationDuration," ").concat(n.animationEasing),transform:"translateY(20px)",zIndex:"9999"}),e._animationDuration=o,(i=document.createElement("span")).style.position=n.fontPosition,i.style.display="inline-block",i.style.flex="1",i.style.padding=n.fontPadding,i.style.borderRadius=n.fontBorderRadius,i.style.background=n.fontBackgroundColor,i.style.fontFamily=n.fontFamily,i.style.fontSize=n.fontSize,i.style.fontWeight=n.fontWeight,i.style.lineHeight=n.fontLineHeight,i.style.color=n.textColor,i.style.userSelect="text",i.style.wordBreak="break-word",i.style.direction=n.fontDirection,i.style.webkitLineClamp="3",i.style.webkitBoxOrient="vertical",i.style.whiteSpace=n.wrapText?"normal":"nowrap",i.style.display="block",i.style.overflow="hidden",i.style.textOverflow="ellipsis",i.style.lineClamp="3",i.style.boxOrient="vertical",i.style.display="-webkit-box",i.textContent=n.message,i.setAttribute("aria-label","Toast Notification Center"),i.setAttribute("title",n.message),e.appendChild(i),t.n=2,P(e,n,r);case 2:if(!n.showCloseButton){t.n=3;break}return t.n=3,w(e,n,r);case 3:if(!n.showProgressBar){t.n=4;break}return t.n=4,k(e,n);case 4:return t.n=5,E(e);case 5:return t.a(2)}},t)}))).apply(this,arguments)}function I(t,e){return j.apply(this,arguments)}function j(){return(j=n(a().m(function t(e,n){var r;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,(r=document.createElement("div")).id="emergency-".concat(Date.now()),r.innerHTML='\n <div style="\n background: #333 !important;\n color: white !important;\n padding: 10px 15px !important;\n position: fixed !important;\n top: 20px !important;\n right: 20px !important;\n z-index: 99999 !important;\n border-radius: 3px !important;\n max-width: 250px !important;\n word-wrap: break-word !important;\n font-family: Arial, sans-serif !important;\n font-size: 14px !important;\n box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;\n cursor: pointer !important;\n " onclick="this.parentNode.removeChild(this)">\n '.concat(e.message||"Emergency Toast Creation Showing!",'\n <span style="float: right; margin-left: 10px; font-weight: bold;">×</span>\n </div>\n '),r._animationDuration=500,r._isEmergencyToast=!0,setTimeout(()=>{try{r.parentNode&&r.parentNode.removeChild(r),n(r)}catch(t){}},e.duration||1800),t.a(2,r);case 1:return t.p=1,t.v,setTimeout(()=>{try{alert(e.message||"Toast Creation Failed!"),n(null)}catch(t){n(null)}},100),t.a(2,null)}},t,null,[[0,1]])}))).apply(this,arguments)}function P(t,e,n){return L.apply(this,arguments)}function L(){return L=n(a().m(function t(e,r,o){var i,s,u;return a().w(function(t){for(;;)switch(t.n){case 0:if((i=null==r?void 0:r.cta)&&i.label){t.n=1;break}return t.a(2);case 1:s=!!i.href&&"link"===i.variant,u=document.createElement(s?"a":"button"),s?(u.href=i.href,i.target&&(u.target=i.target),u.rel=i.rel||("_blank"===i.target?"noopener noreferrer":"")):u.type="button",u.setAttribute("aria-label",i.ariaLabel||i.label),Object.assign(u.style,{marginLeft:"10px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:"1px solid rgba(255,255,255,0.35)",color:r.textColor||"#fff",background:"rgba(255,255,255,0.15)",cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),u.textContent=i.label,u.addEventListener("click",function(){var t=n(a().m(function t(n){var r;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,"function"!=typeof i.onClick){t.n=1;break}if(null==(r=i.onClick(n))||!r.then){t.n=1;break}return t.n=1,r;case 1:return t.p=1,!1!==i.autoClose&&o(e),t.f(1);case 2:return t.a(2)}},t,null,[[0,,1,2]])}));return function(e){return t.apply(this,arguments)}}()),e.appendChild(u);case 2:return t.a(2)}},t)})),L.apply(this,arguments)}function D(t,e){return A.apply(this,arguments)}function A(){return(A=n(a().m(function t(e,n){var r;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(document.querySelector('[id^="toast-container-"]')){t.n=1;break}return t.a(2,null);case 1:return t.p=2,t.n=3,l("div","toast");case 3:return r=t.v,t.n=4,O(r,e,n);case 4:case 6:return t.a(2,r);case 5:return t.p=5,t.v,t.n=6,I(e,n)}},t,null,[[2,5]])}))).apply(this,arguments)}var B=new Map,M=new Map;function W(){return"toast-container-".concat(function(){return String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom-right").toLowerCase().trim().replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"-").replace(/\-+/g,"-")}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom-right"))}function z(){return N.apply(this,arguments)}function N(){return N=n(a().m(function t(){var e,r,o,i,s,u=arguments;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(r=u.length>1?u[1]:void 0,o=W((e=u.length>0&&void 0!==u[0]?u[0]:{}).position),!M.has(o)){t.n=1;break}return t.a(2,M.get(o));case 1:return i=n(a().m(function t(){var n,i,s,u;return a().w(function(t){for(;;)switch(t.n){case 0:if(!(n=B.get(o))||!n.isConnected){t.n=1;break}return t.a(2,n);case 1:if((i=document.getElementById(o))&&!i.isConnected&&document.body.appendChild(i),i){t.n=3;break}if((i=document.createElement("div")).id=o,i.setAttribute("role","status"),i.setAttribute("aria-atomic","true"),i.style.position="fixed",i.style.zIndex="9999",i.style.inset="auto 10px 10px auto",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center",i.style.flexDirection="column",i.style.overflow="hidden","function"!=typeof r){t.n=2;break}return t.n=2,r(i,e);case 2:document.body.appendChild(i),t.n=4;break;case 3:if(i.style.position=i.style.position||"fixed",i.style.zIndex=i.style.zIndex||"9999","function"!=typeof r){t.n=4;break}return t.n=4,r(i,e);case 4:if((s=document.querySelectorAll("#".concat(o))).length>1)for(u=1;u<s.length;u++)try{s[u].remove()}catch(t){}return B.set(o,i),t.a(2,i)}},t)}))(),M.set(o,i),t.p=2,t.n=3,i;case 3:return s=t.v,t.a(2,s);case 4:return t.p=4,M.delete(W(e.position)),t.f(4);case 5:return t.a(2)}},t,null,[[2,,4,5]])})),N.apply(this,arguments)}function R(t,e){return _.apply(this,arguments)}function _(){return(_=n(a().m(function t(e,n){var r;return a().w(function(t){for(;;)switch(t.n){case 0:if(e&&n.position){t.n=1;break}throw new Error("Invalid container or position!");case 1:if(F(e),r=H(n.position),!q(e,n,r)){t.n=2;break}return t.a(2);case 2:if(!G(e,r)){t.n=3;break}return t.a(2);case 3:U(e,r);case 4:return t.a(2)}},t)}))).apply(this,arguments)}function F(t){t.style.top="auto",t.style.bottom="auto",t.style.left="auto",t.style.right="auto",t.style.transform="none"}function H(t){var e=t.toLowerCase().trim();return{hasTop:e.includes("top"),hasBottom:e.includes("bottom")||e.includes("below"),hasLeft:e.includes("left"),hasRight:e.includes("right"),hasCenter:e.includes("center"),hasFullWidth:e.includes("top-full-width")||e.includes("bottom-full-width")||e.includes("fullwidth")}}function q(t,e,n){return!!n.hasFullWidth&&(e.maxWidth="100vw",n.hasTop?(t.style.top="10px",t.style.left="10px",t.style.right="10px",!0):!!n.hasBottom&&(t.style.bottom="10px",t.style.left="10px",t.style.right="10px",!0))}function G(t,e){return!!e.hasCenter&&(!e.hasTop||e.hasLeft||e.hasRight?!e.hasBottom||e.hasLeft||e.hasRight?!e.hasLeft||e.hasTop||e.hasBottom?!e.hasRight||e.hasTop||e.hasBottom?!(e.hasLeft||e.hasRight||e.hasTop||e.hasBottom)&&(t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",!0):(t.style.right="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):(t.style.left="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):(t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0):(t.style.top="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0))}function U(t,e){e.hasBottom?t.style.bottom="10px":e.hasTop&&(t.style.top="10px"),e.hasRight?t.style.right="10px":e.hasLeft?t.style.left="10px":(t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)")}class Y{constructor(t,e){this.callback=t,this.delay=e,this.remaining=e,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1}start(){return this.isCompleted||this.timeoutId||(this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null,this.callback()},this.remaining)),this}pause(){return this.isPaused||!this.timeoutId||this.isCompleted||(clearTimeout(this.timeoutId),this.timeoutId=null,this.remaining-=Date.now()-this.startTime,this.remaining=Math.max(0,this.remaining),this.isPaused=!0),this}resume(){return!this.isPaused||this.isCompleted||(this.isPaused=!1,this.start()),this}clear(){return this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.isCompleted=!0,this}getRemainingTime(){return this.isCompleted?0:this.isPaused?this.remaining:this.timeoutId?Math.max(0,this.remaining-(Date.now()-this.startTime)):this.delay}}var X=new Map,$=new Map,J=[],K=0;function Q(t){for(var e=5381,n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return e>>>0}function V(t){var e=t.type,n=void 0===e?"info":e,r=t.message,o=void 0===r?"":r,i=t.position,a=void 0===i?"bottom-right":i;return[String(n).trim().toLowerCase(),Q(String(o)).toString(16),String(a).trim().toLowerCase()].join("|")}function Z(){return tt.apply(this,arguments)}function tt(){return tt=n(a().m(function t(){var e,r,o,i,s=arguments;return a().w(function(t){for(;;)switch(t.n){case 0:if(r=V(e=s.length>0&&void 0!==s[0]?s[0]:{}),!X.has(r)){t.n=1;break}return(o=X.get(r)).count++,o.timer.clear(),o.timer=rt(o.toast,e),ot(o),ct(o),t.a(2);case 1:if(!$.has(r)){t.n=2;break}return $.get(r).count++,t.a(2);case 2:i={options:e,count:1,rafId:0},$.set(r,i),i.rafId=requestAnimationFrame(n(a().m(function t(){var e;return a().w(function(t){for(;;)switch(t.n){case 0:if(e=$.get(r)){t.n=1;break}return t.a(2);case 1:if($.delete(r),!(K>=3)){t.n=2;break}return J.push({options:e.options,key:r,count:e.count}),st(),t.a(2);case 2:return t.n=3,et(e.options,r,e.count);case 3:return t.a(2)}},t)})));case 3:return t.a(2)}},t)})),tt.apply(this,arguments)}function et(t,e,n){return nt.apply(this,arguments)}function nt(){return(nt=n(a().m(function t(e,n,r){var o,i,s,u,c,l;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,K++,t.n=1,z(e,R);case 1:return o=t.v,t.n=2,D(e,it);case 2:if(i=t.v){t.n=3;break}throw new Error("Toast element creation failed");case 3:s=document.createElement("div"),Object.assign(s.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%"}),u=document.createElement("div"),Object.assign(u.style,{position:"relative",overflow:"hidden",borderRadius:e.borderRadius||"8px",zIndex:"1"}),u.appendChild(i),s.appendChild(u),o.id.includes("toast-container-")&&o.appendChild(s),c=!1!==e.pauseOnHover&&(!0===e.pauseOnHover||!!e.cta),l={outer:s,toast:i,count:Math.max(1,0|r),timeout:null,pauseOnHover:c},X.set(n,l),i._key=n,l.count>1&&ct(l),l.timer=rt(i,e),ot(l),t.n=5;break;case 4:t.p=4,t.v,K=Math.max(0,K-1),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(I(e,it));case 5:return t.a(2)}},t,null,[[0,4]])}))).apply(this,arguments)}function rt(t,e){var n=(e.duration||1800)+10,r=new Y(()=>it(t),n);return r.start(),r}function ot(t){if(t.pauseOnHover&&t.outer&&t.timer){var e=t.outer,n=t.timer,r=()=>{n.pause()},o=()=>{n.resume()},i=t=>{t.target.matches("button, a, [tabindex]")&&n.pause()},a=t=>{e.contains(t.relatedTarget)||n.resume()};e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",o),e.addEventListener("focusin",i),e.addEventListener("focusout",a),e._pauseCleanup=()=>{e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",o),e.removeEventListener("focusin",i),e.removeEventListener("focusout",a)}}}function it(t){return at.apply(this,arguments)}function at(){return(at=n(a().m(function t(e){var n,r,o,i,s;return a().w(function(t){for(;;)switch(t.n){case 0:if(e&&e._key){t.n=1;break}return t.a(2);case 1:if(s=X.get(e._key)){t.n=2;break}return t.a(2);case 2:return null===(n=s.timer)||void 0===n||n.clear(),null===(r=s.outer)||void 0===r||null===(o=r._pauseCleanup)||void 0===o||o.call(r),X.delete(e._key),K=Math.max(0,K-1),null===(i=s.outer.querySelector(".toast-count-badge"))||void 0===i||i.remove(),t.n=3,ut(s.outer);case 3:st();case 4:return t.a(2)}},t)}))).apply(this,arguments)}function st(){for(;K<3&&J.length;){var t=J.shift();if(X.has(t.key)){var e=X.get(t.key);e.count+=t.count,ct(e)}else et(t.options,t.key,t.count)}}function ut(t){return new Promise(e=>{var n=!1,r=()=>{n||(n=!0,function(t){f.apply(this,arguments)}(t),e())},o=t.firstElementChild||t,i=t=>{t.target===o&&(o.removeEventListener("transitionend",i,!0),r())};o.addEventListener("transitionend",i,!0),setTimeout(()=>{o.removeEventListener("transitionend",i,!0),r()},700)})}function ct(t){var e=t.outer,n=t.count;if(n<2){var r;null===(r=e.querySelector(".toast-count-badge"))||void 0===r||r.remove()}else{var o=e.querySelector(".toast-count-badge");o||((o=document.createElement("span")).className="toast-count-badge",o.setAttribute("aria-label","".concat(n," identical notifications")),Object.assign(o.style,{position:"absolute",top:"6px",right:"6px",backgroundColor:"#f44336",color:"#fff",borderRadius:"50%",minWidth:"20px",height:"20px",fontSize:"12px",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid #fff",boxShadow:"0 2px 6px rgba(0,0,0,0.3)",zIndex:"2",pointerEvents:"none",transition:"transform 150ms ease"}),e.appendChild(o)),o.textContent=n>99?"99+":String(n),o.style.transform="scale(1.2)",setTimeout(()=>o.style.transform="scale(1)",150)}}var lt={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},pt={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"},ft=[],dt=!1;function ht(){return mt.apply(this,arguments)}function mt(){return(mt=n(a().m(function t(){return a().w(function(t){for(;;)switch(t.n){case 0:if(!dt){t.n=1;break}return t.a(2);case 1:"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"interactive"===document.readyState?(dt=!0,ft.forEach(t=>setTimeout(()=>yt(t),2e3)),ft.length=0):document.addEventListener("DOMContentLoaded",()=>{dt=!0,ft.forEach(t=>setTimeout(()=>yt(t),2e3)),ft.length=0},{once:!0}));case 2:return t.a(2)}},t)}))).apply(this,arguments)}function yt(){return bt.apply(this,arguments)}function bt(){return bt=n(a().m(function t(){var e,n,r,o,i=arguments;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return e=i.length>0&&void 0!==i[0]?i[0]:{},t.p=1,t.n=2,Ct(e);case 2:return n=t.v,t.n=3,xt(n);case 3:return t.n=4,Z(n);case 4:t.n=6;break;case 5:t.p=5,t.v,o="string"==typeof(null==e?void 0:e.message)&&null!==(null==e?void 0:e.message)?"".concat(null==e||null===(r=e.message)||void 0===r?void 0:r.substring(0,200)," toast creation failed!"):"Toast creation failed!",alert(o);case 6:return t.a(2)}},t,null,[[1,5]])})),bt.apply(this,arguments)}var gt=!1;function vt(){return wt.apply(this,arguments)}function wt(){return wt=n(a().m(function t(){var e,n,r=arguments;return a().w(function(t){for(;;)switch(t.n){case 0:if(e=r.length>0&&void 0!==r[0]?r[0]:{},"undefined"!=typeof window&&"undefined"!=typeof document){t.n=1;break}return t.a(2);case 1:return t.n=2,ht();case 2:if(dt){t.n=3;break}return ft.push(e),t.a(2);case 3:if(gt){t.n=5;break}return gt=!0,n=setTimeout,t.n=4,yt(e);case 4:n(t.v,2e3),t.n=6;break;case 5:return t.n=6,yt(e);case 6:return t.a(2)}},t)})),wt.apply(this,arguments)}function xt(t){return kt.apply(this,arguments)}function kt(){return(kt=n(a().m(function t(e){var n;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,z(e,R);case 1:return n=t.v,t.a(2,n);case 2:return t.p=2,t.v,t.a(2,document.body)}},t,null,[[0,2]])}))).apply(this,arguments)}function Ct(t){return Et.apply(this,arguments)}function Et(){return(Et=n(a().m(function t(e){var n,r,o,s,u,c,l,p;return a().w(function(t){for(;;)switch(t.p=t.n){case 0:if(o=null==e||null===(n=e.position)||void 0===n||null===(n=n.toLowerCase())||void 0===n?void 0:n.trim(),s=null!=o&&o.includes("top-full-width")||null!=o&&o.includes("bottom-full-width")?"100vw":"400px",(u=i(i({},{pauseOnHover:void 0,duration:1800,position:"bottom-right",type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationType:"fade",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressHeight:"4px",progressPosition:"bottom",fontPosition:"relative",fontPadding:void 0,fontBorderRadius:void 0,fontBackgroundColor:void 0,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"14px",fontWeight:"400",fontLineHeight:"1.4",fontDirection:"auto",wrapText:"normal",maxWidth:s}),"object"!=typeof e||Array.isArray(e)?{}:e)).message=null!==(r=null==e?void 0:e.message)&&void 0!==r?r:u.message,t.p=1,u.backgroundColor||(u.backgroundColor=null!==(l=null===(p=lt)||void 0===p?void 0:p[u.type])&&void 0!==l?l:window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111"),u.message=u.message||(null===(c=pt)||void 0===c?void 0:c[u.type])||"No Message Provided!",u.textColor||!u.backgroundColor){t.n=3;break}return t.n=2,y(u.backgroundColor);case 2:u.textColor=t.v;case 3:if(u.progressColor||!u.backgroundColor){t.n=5;break}return t.n=4,y(u.backgroundColor);case 4:u.progressColor=t.v;case 5:t.n=7;break;case 6:t.p=6,t.v;case 7:return"string"!=typeof u.message&&(u.message="No Message Provided!"),t.a(2,u)}},t,null,[[1,6]])}))).apply(this,arguments)}function Tt(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(lt=i(i({},lt),t))}catch(t){}}function Ot(t){try{t&&"object"==typeof t&&!Array.isArray(t)&&(pt=i(i({},pt),t))}catch(t){}}try{"undefined"!=typeof window&&(window.customizableToast={createToast:vt,setDefaultColors:Tt,setDefaultMessages:Ot})}catch(t){}t.createToast=vt,t.noop=function(){it(document.querySelector('[id^="toast-"]:not([id*="container"])'))},t.setDefaultColors=Tt,t.setDefaultMessages=Ot});
|
|
18
18
|
//# sourceMappingURL=index.umd.js.map
|