{"version":3,"file":"micro-learning-D8nWk14w.js","sources":["../../../resources/js/micro-learning.js"],"sourcesContent":["import _ from 'lodash';\nimport * as ace from 'ace-builds';\nimport themeXCodeUrl from 'ace-builds/src-noconflict/theme-xcode.js?url';\nimport monokaiCodeUrl from 'ace-builds/src-noconflict/theme-monokai.js?url';\nimport modePythonUrl from 'ace-builds/src-noconflict/mode-python?url';\n\nace.config.setModuleUrl('ace/mode/python', modePythonUrl);\nace.config.setModuleUrl('ace/theme/xcode', themeXCodeUrl);\nace.config.setModuleUrl('ace/theme/monokai', monokaiCodeUrl);\n\nconst modes = {\n py: 'ace/mode/python',\n};\n\nconst saveEditorContent = function (name, editor) {\n localStorage.setItem('code-block-' + name, editor.session.getValue());\n};\n\nconst initializeEditor = (name, code) => {\n const editorElement = document.getElementById(name);\n if (editorElement) {\n window[name] = ace.edit(document.getElementById(name), {\n useWorker: false,\n mode: modes['py'],\n theme: document.body.classList.contains('dark')\n ? 'ace/theme/monokai'\n : 'ace/theme/xcode',\n minLines: 1,\n fontSize: 14,\n enableAutoIndent: true,\n value: code,\n showGutter: true,\n showLineNumbers: true,\n });\n window[name].setOptions({\n autoScrollEditorIntoView: false,\n showPrintMargin: false,\n });\n window[name].container.classList.add('code-block-editor');\n window[name].session.on('change', (delta) => {\n _.debounce(saveEditorContent, 10)(name, window[name]);\n });\n document.addEventListener('setTheme', function (e) {\n window[name].setTheme(\n e.detail === 'dark' ? 'ace/theme/monokai' : 'ace/theme/xcode',\n );\n });\n }\n return window[name].session;\n};\n\nwindow.initializeEditor = initializeEditor;\n"],"names":["ace.config","modePythonUrl","themeXCodeUrl","monokaiCodeUrl","modes","saveEditorContent","name","editor","initializeEditor","code","ace.edit","delta","_","e"],"mappings":"0JAMAA,EAAAA,OAAW,aAAa,kBAAmBC,CAAa,EACxDD,EAAAA,OAAW,aAAa,kBAAmBE,CAAa,EACxDF,EAAAA,OAAW,aAAa,oBAAqBG,CAAc,EAE3D,MAAMC,EAAQ,CACZ,GAAI,iBACN,EAEMC,EAAoB,SAAUC,EAAMC,EAAQ,CAChD,aAAa,QAAQ,cAAgBD,EAAMC,EAAO,QAAQ,UAAU,CACtE,EAEMC,EAAmB,CAACF,EAAMG,KACR,SAAS,eAAeH,CAAI,IAEhD,OAAOA,CAAI,EAAII,EAAAA,KAAS,SAAS,eAAeJ,CAAI,EAAG,CACrD,UAAW,GACX,KAAMF,EAAM,GACZ,MAAO,SAAS,KAAK,UAAU,SAAS,MAAM,EAC1C,oBACA,kBACJ,SAAU,EACV,SAAU,GACV,iBAAkB,GAClB,MAAOK,EACP,WAAY,GACZ,gBAAiB,EACvB,CAAK,EACD,OAAOH,CAAI,EAAE,WAAW,CACtB,yBAA0B,GAC1B,gBAAiB,EACvB,CAAK,EACD,OAAOA,CAAI,EAAE,UAAU,UAAU,IAAI,mBAAmB,EACxD,OAAOA,CAAI,EAAE,QAAQ,GAAG,SAAWK,GAAU,CAC3CC,EAAE,SAASP,EAAmB,EAAE,EAAEC,EAAM,OAAOA,CAAI,CAAC,CAC1D,CAAK,EACD,SAAS,iBAAiB,WAAY,SAAUO,EAAG,CACjD,OAAOP,CAAI,EAAE,SACXO,EAAE,SAAW,OAAS,oBAAsB,iBAC7C,CACP,CAAK,GAEI,OAAOP,CAAI,EAAE,SAGtB,OAAO,iBAAmBE"}