(self.webpackChunkjupyterlab_notifications=self.webpackChunkjupyterlab_notifications||[]).push([[273],{273:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>a});var i=o(136);function n(e){"granted"!==e&&alert("Browser Notifications are not allowed. Please update your browser settings to allow notifications.")}const c={id:"jupyterlab-notifications:plugin",autoStart:!0,optional:[o(790).ISettingRegistry],activate:async(e,t)=>{"Notification"in window?"granted"!==Notification.permission&&(function(){try{Notification.requestPermission().then()}catch(e){return!1}return!0}()?Notification.requestPermission().then((e=>{n(e)})):Notification.requestPermission((e=>{n(e)}))):alert("This browser does not support notifications.");let o=!0,a=60,l=!0,s=!0,r="cell_index";if(t){const e=await t.load(c.id),i=()=>{o=e.get("enabled").composite,a=e.get("minimum_cell_execution_time").composite,l=e.get("report_cell_execution_time").composite,s=e.get("report_cell_number").composite,r=e.get("cell_number_type").composite};i(),e.changed.connect(i)}i.NotebookActions.executed.connect(((e,t)=>{if(o){const{cell:e,notebook:o}=t,i="code"===e.model.type,n=e.model.value.text.length>0,c=e.model.metadata;if(i&&n){const t=e.model;if(c.has("execution")){const[e,i]=function(e){const t=Object.assign({},e.get("execution"));return[new Date(t["shell.execute_reply.started"]||t["iopub.execute_input"]),new Date(t["shell.execute_reply"])]}(c),n=new Date(i-e);Math.floor(n.getTime()/1e3)>=a&&function(e,t,o,i,n){const c={icon:"/static/favicon.ico",body:""};let a="";i&&n?a=`Cell[${t}] Duration: ${e}`:i?a=`Cell Number: ${t}`:n&&(a=`Cell Duration: ${e}`),c.body=a,new Notification(`${o}`,c)}(n.toISOString().substr(11,8),"cell_index"===r?o.activeCellIndex:t.executionCount,o.title.label.replace(/\.[^/.]+$/,""),s,l)}else alert('Notebook Cell Timing needs to be enabled for Jupyterlab Notifications to work. Please go to Settings -> Advanced Settings Editor -> Notebook and update setting to {"recordTiming": true}')}}}))}},a=c}}]);