define(["require","exports","tslib","metaserver/static/js/modules/core/notify","metaserver/static/js/modules/core/html","metaserver/static/js/modules/core/cookies","metaserver/static/js/modules/clean/security/csrf_hmac","metaserver/static/js/modules/clean/csrf"],(function(e,o,t,s,i,r,n,a){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.decodeToastCookie=o.showToastFromCookie=void 0;function c(e,o){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield n.readHmacCookieToken(e,o);if(null==t)return null;if(t.startsWith("er:"))return[!0,t.substring(3)];if(t.startsWith("ok:"))return[!1,t.substring(3)];throw new Error("unrecognized format of message in toast cookie")}))}o.showToastFromCookie=function(){var o;return t.__awaiter(this,void 0,void 0,(function*(){const n=r.Cookies.read("toast");if(n){const u=yield c(n,null!==(o=a.readCsrfToken())&&void 0!==o?o:void 0);if(null!=u){const[o,n]=u,{default:a}=yield new Promise((o,t)=>{e(["dompurify"],o,t)}).then(t.__importStar),c=a.sanitize(n),d=document.getElementById("flash");null!=d&&(d.innerHTML=c,d.style.display="block"),setTimeout(()=>r.Cookies.delete("toast"),2e3),o?s.Notify.error(new i.HTML(c),10):s.Notify.success(new i.HTML(c),10)}}}))},o.decodeToastCookie=c})); //# sourceMappingURL=toast_on_init.min.js-vflhh7G3o.map