//! Notification API compatibility snippet backed by permission emulation.

pub(super) const SOURCE: &str = "function __notificationState(){let st=__states['notifications'];if(!st){st='prompt';}return st;}function __notificationThen(v){let o={};o.then=function(cb){if(cb){cb(v);}return o;};o.catch=function(){return o;};return o;}function __notificationText(v,d){if(v!=undefined){return ''+v;}return d;}function Notification(title,options){let st=__notificationState();let o=options;if(!o){o={};}this.title=__notificationText(title,'');this.body=__notificationText(o.body,'');this.tag=__notificationText(o.tag,'');this.data=null;if(o.data!=undefined){this.data=o.data;}this.silent=false;if(o.silent){this.silent=true;}this.renotify=false;if(o.renotify){this.renotify=true;}this.requireInteraction=false;if(o.requireInteraction){this.requireInteraction=true;}this.permission=st;this.permissionState=st;this.permissionGranted=st=='granted';this.permissionDenied=st=='denied';this.closed=false;this.error=null;if(st!='granted'){this.error={name:'NotAllowedError',message:'notifications '+st};}this.onclick=null;this.onclose=null;this.onerror=null;this.onshow=null;this.__listeners=[];this.__nextListener=0;this.addEventListener=function(t,cb){let k='__notificationListener'+this.__nextListener;this.__nextListener=this.__nextListener+1;this[k]=cb;this.__listeners.push({type:''+t,key:k});return undefined;};this.removeEventListener=function(t,cb){let keep=[];let i=0;while(i<this.__listeners.length){let item=this.__listeners[i];if(!(item.type==''+t&&this[item.key]==cb)){keep.push(item);}i=i+1;}this.__listeners=keep;return undefined;};this.dispatchEvent=function(e){let ev=e;if(!ev){ev={};}let t=ev.type;if(!t){t='event';}ev.type=t;ev.target=this;ev.currentTarget=this;let key='on'+t;if(this[key]){this[key](ev);}let i=0;while(i<this.__listeners.length){let item=this.__listeners[i];if(item.type==t&&this[item.key]){this[item.key](ev);}i=i+1;}return true;};this.close=function(){this.closed=true;return this.dispatchEvent({type:'close'});};undefined;}let __notificationStatic={permission:__notificationState()};__notificationStatic.requestPermission=function(cb){let st=__notificationState();window.Notification.permission=st;if(cb){cb(st);}return __notificationThen(st);};window.Notification=__notificationStatic;";
