"use strict";(self.webpackChunkvule_magics=self.webpackChunkvule_magics||[]).push([[568],{568:(t,e,i)=>{i.r(e),i.d(e,{default:()=>o});var n=i(123),r=i(191);const s={ipython:"text/x-ipython","%%sql":"text/x-pgsql","%%sh":"text/x-sh","%%bash":"text/x-sh","%%html":"text/html","%%javascript":"text/javascript","%%js":"text/javascript","%%latex":"text/x-stex","%%markdown":"text/x-markdown","%%gremlin":"text/x-groovy","%%opencypher":"application/x-cypher-query","%%oc":"application/x-cypher-query"};class c{constructor(t,e){this.app=t,this.tracker=e,this.app.restored.then((()=>{var t,e;null===(t=this.tracker.currentWidget)||void 0===t||t.content.fullyRendered.connect((t=>{var e,i,n=null===(e=this.tracker.currentWidget)||void 0===e?void 0:e.content.widgets.length;this.setSyntax(null===(i=this.tracker.currentWidget)||void 0===i?void 0:i.content.widgets.slice(n-1,n)[0])})),this.tracker.currentChanged.connect((()=>{var t,e;console.log("current changed",null===(t=this.tracker.currentWidget)||void 0===t?void 0:t.content.widgets),null===(e=this.tracker.currentWidget)||void 0===e||e.content.widgets.forEach((t=>this.setSyntax(t)))})),null===(e=this.tracker.currentWidget)||void 0===e||e.content.modelContentChanged.connect((()=>{this.tracker.activeCell&&this.setSyntax(this.tracker.activeCell)}))}))}setSyntax(t){const e=t.editor.editor;if(null!==t&&(0,r.isCodeCellModel)(t.model)){const t=e.getDoc().getLine(0).split(" ")[0];if(t.startsWith("%%")&&t in s)return void this.highlight(e,s[t]);e.getDoc().getLine(0).indexOf("spark.sql(")>=0||e.getDoc().getLine(1).indexOf("spark.sql(")>=0?this.highlight(e,s["%%sql"]):this.highlight(e,s.ipython)}}highlight(t,e,i=!0){const n=t.getOption("mode");"null"!==n?n!==e&&t.setOption("mode",e):i&&setTimeout((()=>this.highlight(t,e,!1)),0)}}const o={id:"vule-magics:plugin",autoStart:!0,requires:[n.INotebookTracker],activate:function(t,e){console.log("JupyterLab extension vule-magics is activated!"),new c(t,e)}}}}]);