├── .github └── preview.png ├── .gitignore ├── .vscode ├── launch.json └── settings.json ├── README.md ├── assets ├── icon.icns ├── icon.ico ├── icon.png └── windowsIcons │ ├── close.svg │ ├── minimize.svg │ └── square.svg ├── package.json ├── src ├── main │ ├── app.js │ ├── modules │ │ └── window-manager.js │ └── utils │ │ ├── assets-path.js │ │ └── check-url.js └── renderer │ ├── modules │ ├── content-only │ │ └── index.js │ ├── slides │ │ ├── bg-cover.css │ │ ├── bg-cover.js │ │ ├── configurator │ │ │ ├── button-action.js │ │ │ ├── highlight.css │ │ │ ├── highlight.js │ │ │ ├── index.js │ │ │ ├── modal.css │ │ │ └── modal.js │ │ ├── copy.js │ │ ├── get-slides.js │ │ ├── index.js │ │ ├── main-frame.js │ │ ├── render.js │ │ ├── slide-element.js │ │ ├── slides.css │ │ └── texting.css │ └── window-manager │ │ ├── create-window.controls.js │ │ ├── create-windows-menu.js │ │ └── windowControls.css │ ├── preload.js │ ├── styles │ └── style.css │ └── utils │ └── inject-css.js ├── webpack ├── main.webpack.js ├── renderer.webpack.js └── rules.webpack.js └── yarn.lock /.github/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maykbrito/electron-desktop-custom-notion-omni/18104c4003be03be8b3450b04fc1c3d913663e2e/.github/preview.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | packages/ 3 | .DS_Store 4 | out/ 5 | dist 6 | .webpack 7 | .idea -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Debug Main Process", 6 | "type": "node", 7 | "request": "launch", 8 | "cwd": "${workspaceFolder}", 9 | "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron", 10 | "windows": { 11 | "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd" 12 | }, 13 | "args": [ 14 | "." 15 | ], 16 | "outputCapture": "std" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | // editor 3 | "editor.wordWrap": "on", 4 | "editor.fontSize": 18, 5 | "editor.lineHeight": 30, 6 | "editor.tabSize": 2, 7 | "editor.bracketPairColorization.enabled": true, 8 | "editor.guides.bracketPairs": true, 9 | "editor.minimap.enabled": false, 10 | "editor.formatOnSave": true, 11 | "editor.formatOnPaste": true, 12 | "files.autoSave": "afterDelay", 13 | 14 | // explorer 15 | "explorer.compactFolders": false, 16 | 17 | // workbench 18 | "workbench.editor.enablePreview": false, 19 | "workbench.iconTheme": "material-icon-theme", 20 | "workbench.colorTheme": "Omni", 21 | 22 | // prettier 23 | "editor.defaultFormatter": "esbenp.prettier-vscode", 24 | "prettier.enable": true, 25 | "prettier.singleQuote": false, 26 | "prettier.tabWidth": 2, 27 | "prettier.semi": false, 28 | 29 | // terminal 30 | "terminal.integrated.fontSize": 16, 31 | "terminal.integrated.profiles.windows": { 32 | "Git Bash": { 33 | "source": "Git Bash" 34 | } 35 | }, 36 | "terminal.integrated.defaultProfile.windows": "Git Bash", 37 | 38 | // zen mode 39 | "zenMode.hideActivityBar": true, 40 | "zenMode.silentNotifications": true, 41 | "zenMode.fullScreen": false, 42 | "zenMode.centerLayout": false, 43 | "zenMode.hideLineNumbers": false, 44 | 45 | // 46 | "window.zoomLevel": 0, 47 | "zenMode.showTabs": "single", 48 | "cSpell.words": [ 49 | "Omni", 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Notion Omni 2 | 3 | Inject some JS/CSS to customize Notion ;) 4 | 5 | --- 6 | 7 |

8 | How to build     9 | Features 10 |      11 | Contact 12 |      13 |

14 | 15 | ![Preview](.github/preview.png) 16 | 17 | --- 18 | 19 | ## How to build 20 | 21 | 1. Install 22 | 23 | ```sh 24 | yarn 25 | ``` 26 | 27 | 2. Build 28 | 29 | ```sh 30 | yarn package 31 | ``` 32 | 33 | 3. Run your new app. 34 | _It will be at dir ./out_ 35 | 36 | 4. Put your Notion in Dark Mode ;) 37 | 38 | # Features 39 | 40 | ## Content Only 41 | 42 | Because we love a clean layout, we can toggle (show/hide) view of 43 | 44 | - header bar 45 | - page title & attributes block 46 | - help button 47 | 48 | by pressing `ctrl+esc` 49 | 50 | ![Imgur](https://i.imgur.com/NkJz7cn.gif) 51 | 52 | --- 53 | 54 | ## Slide Presentation 55 | 56 | You can use this app as a slide presentation. 57 | 58 | ![Slides preview](https://i.imgur.com/9QL2WTy.gif) 59 | 60 | ### 🤔 How? 61 | 62 | 1. Prepare your presentation 63 | 64 | - Each divider will be a new slide block 65 | 66 | 2. Toggle presentation with `SHIFT+ESC` 67 | 68 | Try this. 69 | 70 | Create a new Notion page and add code bellow, then hit `SHIFT+ESC` to see the magic. 71 | 72 | ```md 73 | --- 74 | # Slide one 75 | 76 | Some content 77 | --- 78 | 79 | ## Slide two 80 | 81 | Second slide 82 | 83 | --- 84 | ## With h2 header 85 | 86 | Try it! 87 | ``` 88 | 89 | # Contact 90 | 91 | Mayk Brito 92 | 93 | - [maykbrito.dev](https://maykbrito.dev) 94 | 95 | --- 96 | 97 | If this project helps you, please leave your star 🌟 Thank you 💛 98 | -------------------------------------------------------------------------------- /assets/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maykbrito/electron-desktop-custom-notion-omni/18104c4003be03be8b3450b04fc1c3d913663e2e/assets/icon.icns -------------------------------------------------------------------------------- /assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maykbrito/electron-desktop-custom-notion-omni/18104c4003be03be8b3450b04fc1c3d913663e2e/assets/icon.ico -------------------------------------------------------------------------------- /assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maykbrito/electron-desktop-custom-notion-omni/18104c4003be03be8b3450b04fc1c3d913663e2e/assets/icon.png -------------------------------------------------------------------------------- /assets/windowsIcons/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/windowsIcons/minimize.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/windowsIcons/square.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "notion-omni", 3 | "version": "1.0.0", 4 | "description": "Inject some CSS to custom Notion colors ;)", 5 | "main": "./.webpack/main/index.js", 6 | "scripts": { 7 | "start": "electron-forge start", 8 | "package": "electron-forge package", 9 | "make": "electron-forge make" 10 | }, 11 | "devDependencies": { 12 | "@electron-forge/cli": "^6.0.0-beta.61", 13 | "@electron-forge/maker-deb": "^6.0.0-beta.61", 14 | "@electron-forge/maker-rpm": "^6.0.0-beta.61", 15 | "@electron-forge/maker-squirrel": "^6.0.0-beta.61", 16 | "@electron-forge/maker-zip": "^6.0.0-beta.61", 17 | "@electron-forge/plugin-webpack": "^6.0.0-beta.61", 18 | "@marshallofsound/webpack-asset-relocator-loader": "^0.5.0", 19 | "electron": "^21", 20 | "node-loader": "^2.0.0", 21 | "webpack": "^5.61.0", 22 | "webpack-cli": "^4.9.1" 23 | }, 24 | "keywords": [ 25 | "Notion", 26 | "Styling", 27 | "Custom" 28 | ], 29 | "author": "Mayk Brito ", 30 | "license": "MIT", 31 | "dependencies": { 32 | "electron-squirrel-startup": "^1.0.0", 33 | "electron-window-state": "^5.0.3" 34 | }, 35 | "config": { 36 | "forge": { 37 | "packagerConfig": { 38 | "name": "notion-omni", 39 | "executableName": "notion-omni", 40 | "icon": "assets/icon", 41 | "extraResource": [ 42 | "assets", 43 | "src" 44 | ] 45 | }, 46 | "plugins": [ 47 | [ 48 | "@electron-forge/plugin-webpack", 49 | { 50 | "mainConfig": "./webpack/main.webpack.js", 51 | "renderer": { 52 | "config": "./webpack/renderer.webpack.js", 53 | "entryPoints": [ 54 | { 55 | "js": "./src/renderer/preload.js", 56 | "name": "main_window", 57 | "preload": { 58 | "js": "./src/renderer/preload.js" 59 | } 60 | } 61 | ] 62 | } 63 | } 64 | ] 65 | ], 66 | "makers": [ 67 | { 68 | "name": "@electron-forge/maker-squirrel", 69 | "config": { 70 | "name": "notion-omni", 71 | "setupExe": "${name}-${version}-setup.exe", 72 | "setupIcon": "./assets/icon.ico", 73 | "iconUrl": "https://raw.githubusercontent.com/maykbrito/electron-desktop-custom-notion-omni/feat/slides/assets/icon.ico" 74 | } 75 | }, 76 | { 77 | "name": "@electron-forge/maker-zip", 78 | "platforms": [ 79 | "darwin" 80 | ] 81 | }, 82 | { 83 | "name": "@electron-forge/maker-deb", 84 | "config": {} 85 | }, 86 | { 87 | "name": "@electron-forge/maker-rpm", 88 | "config": {} 89 | } 90 | ], 91 | "publishers": [ 92 | { 93 | "name": "@electron-forge/publisher-github", 94 | "config": { 95 | "repository": { 96 | "owner": "maykbrito", 97 | "name": "notion-omni" 98 | }, 99 | "draft": true 100 | } 101 | } 102 | ] 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/app.js: -------------------------------------------------------------------------------- 1 | import { app, BrowserWindow, screen, nativeImage } from "electron" 2 | import windowStateKeeper from "electron-window-state" 3 | import path from "path" 4 | 5 | import { assetsPath } from "./utils/assets-path" 6 | import { checkerURL } from "./utils/check-url" 7 | 8 | import "./modules/window-manager" 9 | 10 | let win = null 11 | app.allowRendererProcessReuse = true 12 | 13 | async function createWindow() { 14 | win = new BrowserWindow({ 15 | icon: nativeImage.createFromPath( 16 | path.join(assetsPath, "assets", "icon.png") 17 | ), 18 | frame: false, 19 | titleBarStyle: "customButtonsOnHover", 20 | draggable: true, 21 | webPreferences: { 22 | nodeIntegration: false, 23 | contextIsolation: true, 24 | sandbox: false, 25 | preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY, 26 | }, 27 | }) 28 | 29 | adjustWindow(win) 30 | 31 | win.loadURL("https://notion.so") 32 | 33 | win.webContents.on("new-window", checkerURL) // add event listener for URL check 34 | } 35 | 36 | function adjustWindow(win) { 37 | const mainScreen = screen.getPrimaryDisplay() 38 | const dimensions = mainScreen.size 39 | 40 | const mainWindowState = windowStateKeeper({ 41 | defaultWidth: dimensions.width, 42 | defaultHeight: dimensions.height, 43 | }) 44 | 45 | let { width, height, x, y } = mainWindowState 46 | x = x || 0 47 | y = y || 0 48 | 49 | win.setSize(width, height) 50 | win.setPosition(x, y) 51 | mainWindowState.manage(win) 52 | } 53 | 54 | const isUnicInstance = app.requestSingleInstanceLock() //Verifica se o app já foi iniciado 55 | 56 | if (!isUnicInstance) { 57 | app.quit() // Caso o app já tiver sido aberto ele é fechado 58 | } else { 59 | // This method will be called when Electron has finished 60 | // initialization and is ready to create browser windows. 61 | // Some APIs can only be used after this event occurs. 62 | app 63 | .whenReady() 64 | .then(createWindow) 65 | .catch((e) => console.error(e)) 66 | } 67 | 68 | // Faz com que o programa não inicie várias vezes durante a instalação no windows 69 | if (require("electron-squirrel-startup")) { 70 | app.quit() 71 | } 72 | 73 | app.on("second-instance", () => { 74 | const win = BrowserWindow.getAllWindows()[0] 75 | if (win.isMinimized()) { 76 | win.restore() 77 | } 78 | win.focus() 79 | }) 80 | 81 | // Quit when all windows are closed. 82 | app.on("window-all-closed", () => { 83 | // On macOS it is common for applications and their menu bar 84 | // to stay active until the user quits explicitly with Cmd + Q 85 | if (process.platform !== "darwin") { 86 | app.quit() 87 | } 88 | }) 89 | 90 | app.on("activate", recreateWindow) 91 | 92 | function recreateWindow() { 93 | // On macOS it's common to re-create a window in the app when the 94 | // dock icon is clicked and there are no other windows open. 95 | if (BrowserWindow.getAllWindows().length === 0) { 96 | setTimeout(createWindow, 200) 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/modules/window-manager.js: -------------------------------------------------------------------------------- 1 | import { ipcMain, BrowserWindow } from 'electron' 2 | import { assetsPath } from '../utils/assets-path' 3 | 4 | ipcMain.on('request-app-path', (event, arg) => { 5 | event.returnValue = assetsPath 6 | }) 7 | 8 | ipcMain.on('minimize', (event, arg) => { 9 | const win = BrowserWindow.getFocusedWindow() 10 | win.minimize() 11 | }) 12 | 13 | ipcMain.on('expand', (event, arg) => { 14 | const win = BrowserWindow.getFocusedWindow() 15 | if (win.isMaximized()) { 16 | win.restore() 17 | } else { 18 | win.maximize() 19 | } 20 | }) 21 | 22 | ipcMain.on('close', (event, arg) => { 23 | const win = BrowserWindow.getFocusedWindow() 24 | win.close() 25 | }) 26 | -------------------------------------------------------------------------------- /src/main/utils/assets-path.js: -------------------------------------------------------------------------------- 1 | import { app } from 'electron' 2 | 3 | const assetsPath = 4 | process.env.NODE_ENV === 'production' 5 | ? process.resourcesPath 6 | : app.getAppPath() 7 | 8 | export { assetsPath } 9 | -------------------------------------------------------------------------------- /src/main/utils/check-url.js: -------------------------------------------------------------------------------- 1 | import { shell } from 'electron' 2 | /** 3 | * This function is used electron's new-window event 4 | * It allows non-electron links to be opened with the computer's default browser 5 | * Keep opening pop-ups for google login for example 6 | * @param {NewWindowEvent} e 7 | * @param {String} url 8 | */ 9 | function checkerURL(e, url) { 10 | const isNotUrlOfTheNotion = !url.match('/www.notion.so/') 11 | 12 | if (isNotUrlOfTheNotion) { 13 | e.preventDefault() 14 | shell.openExternal(url) 15 | } 16 | } 17 | 18 | export { checkerURL } 19 | -------------------------------------------------------------------------------- /src/renderer/modules/content-only/index.js: -------------------------------------------------------------------------------- 1 | let showingOnlyContent = false 2 | const elementsToHide = [ 3 | '#notion-app > div > div:nth-child(1) > div > div:nth-child(2) > header', 4 | '.notion-ai-button' 5 | ] 6 | let notionFrameInitialHeight 7 | let elementsInitialDisplay = {} 8 | 9 | window.addEventListener('keydown', ev => { 10 | const shortcutKeys = ev.key === 'Escape' && ev.ctrlKey 11 | if (shortcutKeys) { 12 | showingOnlyContent = !showingOnlyContent 13 | showingOnlyContent ? hide() : show() 14 | } 15 | }) 16 | 17 | const elementDisplay = (element, display) => { 18 | const currentElement = document.querySelector(element) 19 | console.log({ currentElement }) 20 | if (!currentElement) return 21 | 22 | if (display === 'initial') { 23 | currentElement.style.display = elementsInitialDisplay[element] 24 | return 25 | } 26 | 27 | elementsInitialDisplay[element] = currentElement.style.display 28 | currentElement.style.display = display; 29 | } 30 | 31 | const hide = () => { 32 | elementsToHide.forEach(element => elementDisplay(element, 'none')) 33 | 34 | notionFrameInitialHeight = document.querySelector('.notion-frame').style.height 35 | document.querySelector('.notion-frame').style.height = '100vh' 36 | } 37 | const show = () => { 38 | elementsToHide.forEach(element => elementDisplay(element, 'initial')) 39 | document.querySelector('.notion-frame').style.height = notionFrameInitialHeight 40 | } 41 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/bg-cover.css: -------------------------------------------------------------------------------- 1 | .slides__cover-image { 2 | position: fixed; 3 | top: 0; 4 | left: 0; 5 | width: 100%; 6 | height: 100%; 7 | object-fit: cover; 8 | opacity: 0.6; 9 | } 10 | 11 | .slides.dark .slides__cover-image { 12 | opacity: 1; 13 | filter: brightness(0.5); 14 | } 15 | 16 | /* image appear in heading 1 only */ 17 | .slides.dark:not(:has([placeholder="Heading 1"])) .slides__cover-image { 18 | display: none; 19 | } 20 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/bg-cover.js: -------------------------------------------------------------------------------- 1 | module.exports.backgroundCover = function () { 2 | let bgImage = document.querySelector( 3 | '#notion-app div.notion-scroller [contenteditable="false"] img[style*="height: 30vh"]' 4 | ) 5 | 6 | if (bgImage === "undefined" || bgImage === null) return 7 | 8 | let imgElement = document.createElement("img") 9 | imgElement.src = bgImage.src 10 | imgElement.classList.add("slides__cover-image") 11 | 12 | return imgElement 13 | } 14 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/configurator/button-action.js: -------------------------------------------------------------------------------- 1 | const Modal = require("./modal.js") 2 | 3 | const ButtonAction = { 4 | targetElement: () => document.querySelector("#notion-app div.notion-page-controls"), 5 | createButton() { 6 | const content = ` 7 | 8 | Add script 9 | ` 10 | 11 | const button = document.createElement('div'); 12 | button.classList.add('add-script-button'); 13 | button.setAttribute('role', 'button'); 14 | button.setAttribute('tabindex', '0'); 15 | button.setAttribute('style', `user-select: none; transition: opacity 100ms ease 0s; cursor: pointer; opacity: 0; display: inline-flex; align-items: center; flex-shrink: 0; white-space: nowrap; height: 28px; border-radius: 6px; font-size: 14px; line-height: 1.2; min-width: 0px; padding-left: 6px; padding-right: 8px; color: rgba(255, 255, 255, 0.282); pointer-events: none;`); 16 | button.onmouseover = () => button.style.background = 'rgba(255, 255, 255, 0.055)'; 17 | button.onmouseout = () => button.style.background = 'transparent'; 18 | // button.innerText = 'ಠ'; 19 | button.innerHTML = content; 20 | button.onclick = Modal.open; 21 | button.onkeydown = ({ key }) => key === 'Space' && Modal.open(); 22 | return button; 23 | }, 24 | addToTargetElement() { 25 | const targetElement = this.targetElement(); 26 | 27 | if (targetElement && !targetElement.querySelector('.add-script-button')) { 28 | const button = this.createButton(); 29 | targetElement.appendChild(button); 30 | } 31 | }, 32 | removeFromTargetElement() { 33 | const targetElement = this.targetElement(); 34 | if (targetElement) { 35 | const button = targetElement.querySelector('.add-script-button'); 36 | if (button) { 37 | targetElement.removeChild(button); 38 | } 39 | } 40 | }, 41 | } 42 | 43 | module.exports = ButtonAction; -------------------------------------------------------------------------------- /src/renderer/modules/slides/configurator/highlight.css: -------------------------------------------------------------------------------- 1 | /*! 2 | Theme: Default 3 | Description: Original highlight.js style 4 | Author: (c) Ivan Sagalaev 5 | Maintainer: @highlightjs/core-team 6 | Website: https://highlightjs.org/ 7 | License: see project LICENSE 8 | Touched: 2021 9 | */pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#f3f3f3;color:#444}.hljs-comment{color:#697070}.hljs-punctuation,.hljs-tag{color:#444a}.hljs-tag .hljs-attr,.hljs-tag .hljs-name{color:#444}.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag{font-weight:700}.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type{color:#800}.hljs-section,.hljs-title{color:#800;font-weight:700}.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#ab5656}.hljs-literal{color:#695}.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta .hljs-string{color:#38a}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700} 10 | 11 | 12 | /*! 13 | Theme: GitHub Dark 14 | Description: Dark theme as seen on github.com 15 | Author: github.com 16 | Maintainer: @Hirse 17 | Updated: 2021-05-15 18 | 19 | Outdated base version: https://github.com/primer/github-syntax-dark 20 | Current colors taken from GitHub's CSS 21 | */ 22 | 23 | .hljs { 24 | color: #c9d1d9; 25 | background: var(--dark-0); 26 | } 27 | 28 | .hljs-doctag, 29 | .hljs-keyword, 30 | .hljs-meta .hljs-keyword, 31 | .hljs-template-tag, 32 | .hljs-template-variable, 33 | .hljs-type, 34 | .hljs-variable.language_ { 35 | /* prettylights-syntax-keyword */ 36 | color: #ff7b72; 37 | } 38 | 39 | .hljs-title, 40 | .hljs-title.class_, 41 | .hljs-title.class_.inherited__, 42 | .hljs-title.function_ { 43 | /* prettylights-syntax-entity */ 44 | color: #d2a8ff; 45 | } 46 | 47 | .hljs-attr, 48 | .hljs-attribute, 49 | .hljs-literal, 50 | .hljs-meta, 51 | .hljs-number, 52 | .hljs-operator, 53 | .hljs-variable, 54 | .hljs-selector-attr, 55 | .hljs-selector-class, 56 | .hljs-selector-id { 57 | /* prettylights-syntax-constant */ 58 | color: #79c0ff; 59 | } 60 | 61 | .hljs-regexp, 62 | .hljs-string, 63 | .hljs-meta .hljs-string { 64 | /* prettylights-syntax-string */ 65 | color: #a5d6ff; 66 | } 67 | 68 | .hljs-built_in, 69 | .hljs-symbol { 70 | /* prettylights-syntax-variable */ 71 | color: #ffa657; 72 | } 73 | 74 | .hljs-comment, 75 | .hljs-code, 76 | .hljs-formula { 77 | /* prettylights-syntax-comment */ 78 | color: #8b949e; 79 | } 80 | 81 | .hljs-name, 82 | .hljs-quote, 83 | .hljs-selector-tag, 84 | .hljs-selector-pseudo { 85 | /* prettylights-syntax-entity-tag */ 86 | color: #7ee787; 87 | } 88 | 89 | .hljs-subst { 90 | /* prettylights-syntax-storage-modifier-import */ 91 | color: #c9d1d9; 92 | } 93 | 94 | .hljs-section { 95 | /* prettylights-syntax-markup-heading */ 96 | color: #1f6feb; 97 | font-weight: bold; 98 | } 99 | 100 | .hljs-bullet { 101 | /* prettylights-syntax-markup-list */ 102 | color: #f2cc60; 103 | } 104 | 105 | .hljs-emphasis { 106 | /* prettylights-syntax-markup-italic */ 107 | color: #c9d1d9; 108 | font-style: italic; 109 | } 110 | 111 | .hljs-strong { 112 | /* prettylights-syntax-markup-bold */ 113 | color: #c9d1d9; 114 | font-weight: bold; 115 | } 116 | 117 | .hljs-addition { 118 | /* prettylights-syntax-markup-inserted */ 119 | color: #aff5b4; 120 | background-color: #033a16; 121 | } 122 | 123 | .hljs-deletion { 124 | /* prettylights-syntax-markup-deleted */ 125 | color: #ffdcd7; 126 | background-color: #67060c; 127 | } 128 | 129 | /* 130 | .hljs-char.escape_, 131 | .hljs-link, 132 | .hljs-params, 133 | .hljs-property, 134 | .hljs-punctuation, 135 | .hljs-tag { 136 | purposely ignored 137 | }*/ -------------------------------------------------------------------------------- /src/renderer/modules/slides/configurator/highlight.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Highlight.js v11.11.1 (git: 08cb242e7d) 3 | (c) 2006-2024 Josh Goebel and other contributors 4 | License: BSD-3-Clause 5 | */ 6 | var hljs = function () { 7 | "use strict"; function e(n) { 8 | return n instanceof Map ? n.clear = n.delete = n.set = () => { 9 | throw Error("map is read-only") 10 | } : n instanceof Set && (n.add = n.clear = n.delete = () => { 11 | throw Error("set is read-only") 12 | }), Object.freeze(n), Object.getOwnPropertyNames(n).forEach((t => { 13 | const a = n[t], i = typeof a; "object" !== i && "function" !== i || Object.isFrozen(a) || e(a) 14 | })), n 15 | } class n { 16 | constructor(e) { 17 | void 0 === e.data && (e.data = {}), this.data = e.data, this.isMatchIgnored = !1 18 | } 19 | ignoreMatch() { this.isMatchIgnored = !0 } 20 | } function t(e) { 21 | return e.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'") 22 | } function a(e, ...n) { 23 | const t = Object.create(null); for (const n in e) t[n] = e[n] 24 | ; return n.forEach((e => { for (const n in e) t[n] = e[n] })), t 25 | } const i = e => !!e.scope 26 | ; class r { 27 | constructor(e, n) { 28 | this.buffer = "", this.classPrefix = n.classPrefix, e.walk(this) 29 | } addText(e) { 30 | this.buffer += t(e) 31 | } openNode(e) { 32 | if (!i(e)) return; const n = ((e, { prefix: n }) => { 33 | if (e.startsWith("language:")) return e.replace("language:", "language-") 34 | ; if (e.includes(".")) { 35 | const t = e.split(".") 36 | ; return [`${n}${t.shift()}`, ...t.map(((e, n) => `${e}${"_".repeat(n + 1)}`))].join(" ") 37 | } return `${n}${e}` 38 | })(e.scope, { prefix: this.classPrefix }); this.span(n) 39 | } 40 | closeNode(e) { i(e) && (this.buffer += "") } value() { return this.buffer } span(e) { 41 | this.buffer += `` 42 | } 43 | } const s = (e = {}) => { 44 | const n = { children: [] } 45 | ; return Object.assign(n, e), n 46 | }; class o { 47 | constructor() { 48 | this.rootNode = s(), this.stack = [this.rootNode] 49 | } get top() { 50 | return this.stack[this.stack.length - 1] 51 | } get root() { return this.rootNode } add(e) { 52 | this.top.children.push(e) 53 | } openNode(e) { 54 | const n = s({ scope: e }) 55 | ; this.add(n), this.stack.push(n) 56 | } closeNode() { 57 | if (this.stack.length > 1) return this.stack.pop() 58 | } closeAllNodes() { 59 | for (; this.closeNode();); 60 | } toJSON() { return JSON.stringify(this.rootNode, null, 4) } 61 | walk(e) { return this.constructor._walk(e, this.rootNode) } static _walk(e, n) { 62 | return "string" == typeof n ? e.addText(n) : n.children && (e.openNode(n), 63 | n.children.forEach((n => this._walk(e, n))), e.closeNode(n)), e 64 | } static _collapse(e) { 65 | "string" != typeof e && e.children && (e.children.every((e => "string" == typeof e)) ? e.children = [e.children.join("")] : e.children.forEach((e => { 66 | o._collapse(e) 67 | }))) 68 | } 69 | } class l extends o { 70 | constructor(e) { super(), this.options = e } 71 | addText(e) { "" !== e && this.add(e) } startScope(e) { this.openNode(e) } endScope() { 72 | this.closeNode() 73 | } __addSublanguage(e, n) { 74 | const t = e.root 75 | ; n && (t.scope = "language:" + n), this.add(t) 76 | } toHTML() { 77 | return new r(this, this.options).value() 78 | } finalize() { 79 | return this.closeAllNodes(), !0 80 | } 81 | } function c(e) { 82 | return e ? "string" == typeof e ? e : e.source : null 83 | } function d(e) { return b("(?=", e, ")") } 84 | function g(e) { return b("(?:", e, ")*") } function u(e) { return b("(?:", e, ")?") } 85 | function b(...e) { return e.map((e => c(e))).join("") } function m(...e) { 86 | const n = (e => { 87 | const n = e[e.length - 1] 88 | ; return "object" == typeof n && n.constructor === Object ? (e.splice(e.length - 1, 1), n) : {} 89 | })(e); return "(" + (n.capture ? "" : "?:") + e.map((e => c(e))).join("|") + ")" 90 | } 91 | function p(e) { return RegExp(e.toString() + "|").exec("").length - 1 } 92 | const _ = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./ 93 | ; function h(e, { joinWith: n }) { 94 | let t = 0; return e.map((e => { 95 | t += 1; const n = t 96 | ; let a = c(e), i = ""; for (; a.length > 0;) { 97 | const e = _.exec(a); if (!e) { i += a; break } 98 | i += a.substring(0, e.index), 99 | a = a.substring(e.index + e[0].length), "\\" === e[0][0] && e[1] ? i += "\\" + (Number(e[1]) + n) : (i += e[0], 100 | "(" === e[0] && t++) 101 | } return i 102 | })).map((e => `(${e})`)).join(n) 103 | } 104 | const f = "[a-zA-Z]\\w*", E = "[a-zA-Z_]\\w*", y = "\\b\\d+(\\.\\d+)?", w = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", v = "\\b(0b[01]+)", N = { 105 | begin: "\\\\[\\s\\S]", relevance: 0 106 | }, k = { 107 | scope: "string", begin: "'", end: "'", 108 | illegal: "\\n", contains: [N] 109 | }, x = { 110 | scope: "string", begin: '"', end: '"', illegal: "\\n", 111 | contains: [N] 112 | }, O = (e, n, t = {}) => { 113 | const i = a({ 114 | scope: "comment", begin: e, end: n, 115 | contains: [] 116 | }, t); i.contains.push({ 117 | scope: "doctag", 118 | begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", 119 | end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/, excludeBegin: !0, relevance: 0 120 | }) 121 | ; const r = m("I", "a", "is", "so", "us", "to", "at", "if", "in", "it", "on", /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, /[A-Za-z]+[-][a-z]+/, /[A-Za-z][a-z]{2,}/) 122 | ; return i.contains.push({ begin: b(/[ ]+/, "(", r, /[.]?[:]?([.][ ]|[ ])/, "){3}") }), i 123 | }, M = O("//", "$"), A = O("/\\*", "\\*/"), S = O("#", "$"); var C = Object.freeze({ 124 | __proto__: null, APOS_STRING_MODE: k, BACKSLASH_ESCAPE: N, BINARY_NUMBER_MODE: { 125 | scope: "number", begin: v, relevance: 0 126 | }, BINARY_NUMBER_RE: v, COMMENT: O, 127 | C_BLOCK_COMMENT_MODE: A, C_LINE_COMMENT_MODE: M, C_NUMBER_MODE: { 128 | scope: "number", 129 | begin: w, relevance: 0 130 | }, C_NUMBER_RE: w, END_SAME_AS_BEGIN: e => Object.assign(e, { 131 | "on:begin": (e, n) => { n.data._beginMatch = e[1] }, "on:end": (e, n) => { 132 | n.data._beginMatch !== e[1] && n.ignoreMatch() 133 | } 134 | }), HASH_COMMENT_MODE: S, IDENT_RE: f, 135 | MATCH_NOTHING_RE: /\b\B/, METHOD_GUARD: { begin: "\\.\\s*" + E, relevance: 0 }, 136 | NUMBER_MODE: { scope: "number", begin: y, relevance: 0 }, NUMBER_RE: y, 137 | PHRASAL_WORDS_MODE: { 138 | begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ 139 | }, QUOTE_STRING_MODE: x, REGEXP_MODE: { 140 | scope: "regexp", begin: /\/(?=[^/\n]*\/)/, 141 | end: /\/[gimuy]*/, contains: [N, { begin: /\[/, end: /\]/, relevance: 0, contains: [N] }] 142 | }, 143 | RE_STARTERS_RE: "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", 144 | SHEBANG: (e = {}) => { 145 | const n = /^#![ ]*\// 146 | ; return e.binary && (e.begin = b(n, /.*\b/, e.binary, /\b.*/)), a({ 147 | scope: "meta", begin: n, 148 | end: /$/, relevance: 0, "on:begin": (e, n) => { 0 !== e.index && n.ignoreMatch() } 149 | }, e) 150 | }, 151 | TITLE_MODE: { scope: "title", begin: f, relevance: 0 }, UNDERSCORE_IDENT_RE: E, 152 | UNDERSCORE_TITLE_MODE: { scope: "title", begin: E, relevance: 0 } 153 | }); function T(e, n) { 154 | "." === e.input[e.index - 1] && n.ignoreMatch() 155 | } function R(e, n) { 156 | void 0 !== e.className && (e.scope = e.className, delete e.className) 157 | } function D(e, n) { 158 | n && e.beginKeywords && (e.begin = "\\b(" + e.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", 159 | e.__beforeBegin = T, e.keywords = e.keywords || e.beginKeywords, delete e.beginKeywords, 160 | void 0 === e.relevance && (e.relevance = 0)) 161 | } function I(e, n) { 162 | Array.isArray(e.illegal) && (e.illegal = m(...e.illegal)) 163 | } function L(e, n) { 164 | if (e.match) { 165 | if (e.begin || e.end) throw Error("begin & end are not supported with match") 166 | ; e.begin = e.match, delete e.match 167 | } 168 | } function B(e, n) { 169 | void 0 === e.relevance && (e.relevance = 1) 170 | } const $ = (e, n) => { 171 | if (!e.beforeMatch) return 172 | ; if (e.starts) throw Error("beforeMatch cannot be used with starts") 173 | ; const t = Object.assign({}, e); Object.keys(e).forEach((n => { 174 | delete e[n] 175 | })), e.keywords = t.keywords, e.begin = b(t.beforeMatch, d(t.begin)), e.starts = { 176 | relevance: 0, contains: [Object.assign(t, { endsParent: !0 })] 177 | }, e.relevance = 0, delete t.beforeMatch 178 | }, F = ["of", "and", "for", "in", "not", "or", "if", "then", "parent", "list", "value"] 179 | ; function z(e, n, t = "keyword") { 180 | const a = Object.create(null) 181 | ; return "string" == typeof e ? i(t, e.split(" ")) : Array.isArray(e) ? i(t, e) : Object.keys(e).forEach((t => { 182 | Object.assign(a, z(e[t], n, t)) 183 | })), a; function i(e, t) { 184 | n && (t = t.map((e => e.toLowerCase()))), t.forEach((n => { 185 | const t = n.split("|") 186 | ; a[t[0]] = [e, j(t[0], t[1])] 187 | })) 188 | } 189 | } function j(e, n) { 190 | return n ? Number(n) : (e => F.includes(e.toLowerCase()))(e) ? 0 : 1 191 | } const U = {}, P = e => { 192 | console.error(e) 193 | }, K = (e, ...n) => { console.log("WARN: " + e, ...n) }, q = (e, n) => { 194 | U[`${e}/${n}`] || (console.log(`Deprecated as of ${e}. ${n}`), U[`${e}/${n}`] = !0) 195 | }, H = Error(); function G(e, n, { key: t }) { 196 | let a = 0; const i = e[t], r = {}, s = {} 197 | ; for (let e = 1; e <= n.length; e++)s[e + a] = i[e], r[e + a] = !0, a += p(n[e - 1]) 198 | ; e[t] = s, e[t]._emit = r, e[t]._multi = !0 199 | } function Z(e) { 200 | (e => { 201 | e.scope && "object" == typeof e.scope && null !== e.scope && (e.beginScope = e.scope, 202 | delete e.scope) 203 | })(e), "string" == typeof e.beginScope && (e.beginScope = { 204 | _wrap: e.beginScope 205 | }), "string" == typeof e.endScope && (e.endScope = { 206 | _wrap: e.endScope 207 | }), (e => { 208 | if (Array.isArray(e.begin)) { 209 | if (e.skip || e.excludeBegin || e.returnBegin) throw P("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), 210 | H 211 | ; if ("object" != typeof e.beginScope || null === e.beginScope) throw P("beginScope must be object"), 212 | H; G(e, e.begin, { key: "beginScope" }), e.begin = h(e.begin, { joinWith: "" }) 213 | } 214 | })(e), (e => { 215 | if (Array.isArray(e.end)) { 216 | if (e.skip || e.excludeEnd || e.returnEnd) throw P("skip, excludeEnd, returnEnd not compatible with endScope: {}"), 217 | H 218 | ; if ("object" != typeof e.endScope || null === e.endScope) throw P("endScope must be object"), 219 | H; G(e, e.end, { key: "endScope" }), e.end = h(e.end, { joinWith: "" }) 220 | } 221 | })(e) 222 | } function W(e) { 223 | function n(n, t) { 224 | return RegExp(c(n), "m" + (e.case_insensitive ? "i" : "") + (e.unicodeRegex ? "u" : "") + (t ? "g" : "")) 225 | } class t { 226 | constructor() { 227 | this.matchIndexes = {}, this.regexes = [], this.matchAt = 1, this.position = 0 228 | } 229 | addRule(e, n) { 230 | n.position = this.position++, this.matchIndexes[this.matchAt] = n, this.regexes.push([n, e]), 231 | this.matchAt += p(e) + 1 232 | } compile() { 233 | 0 === this.regexes.length && (this.exec = () => null) 234 | ; const e = this.regexes.map((e => e[1])); this.matcherRe = n(h(e, { 235 | joinWith: "|" 236 | }), !0), this.lastIndex = 0 237 | } exec(e) { 238 | this.matcherRe.lastIndex = this.lastIndex 239 | ; const n = this.matcherRe.exec(e); if (!n) return null 240 | ; const t = n.findIndex(((e, n) => n > 0 && void 0 !== e)), a = this.matchIndexes[t] 241 | ; return n.splice(0, t), Object.assign(n, a) 242 | } 243 | } class i { 244 | constructor() { 245 | this.rules = [], this.multiRegexes = [], 246 | this.count = 0, this.lastIndex = 0, this.regexIndex = 0 247 | } getMatcher(e) { 248 | if (this.multiRegexes[e]) return this.multiRegexes[e]; const n = new t 249 | ; return this.rules.slice(e).forEach((([e, t]) => n.addRule(e, t))), 250 | n.compile(), this.multiRegexes[e] = n, n 251 | } resumingScanAtSamePosition() { 252 | return 0 !== this.regexIndex 253 | } considerAll() { this.regexIndex = 0 } addRule(e, n) { 254 | this.rules.push([e, n]), "begin" === n.type && this.count++ 255 | } exec(e) { 256 | const n = this.getMatcher(this.regexIndex); n.lastIndex = this.lastIndex 257 | ; let t = n.exec(e) 258 | ; if (this.resumingScanAtSamePosition()) if (t && t.index === this.lastIndex); else { 259 | const n = this.getMatcher(0); n.lastIndex = this.lastIndex + 1, t = n.exec(e) 260 | } 261 | return t && (this.regexIndex += t.position + 1, 262 | this.regexIndex === this.count && this.considerAll()), t 263 | } 264 | } 265 | if (e.compilerExtensions || (e.compilerExtensions = []), 266 | e.contains && e.contains.includes("self")) throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") 267 | ; return e.classNameAliases = a(e.classNameAliases || {}), function t(r, s) { 268 | const o = r 269 | ; if (r.isCompiled) return o 270 | ;[R, L, Z, $].forEach((e => e(r, s))), e.compilerExtensions.forEach((e => e(r, s))), 271 | r.__beforeBegin = null, [D, I, B].forEach((e => e(r, s))), r.isCompiled = !0; let l = null 272 | ; return "object" == typeof r.keywords && r.keywords.$pattern && (r.keywords = Object.assign({}, r.keywords), 273 | l = r.keywords.$pattern, 274 | delete r.keywords.$pattern), l = l || /\w+/, r.keywords && (r.keywords = z(r.keywords, e.case_insensitive)), 275 | o.keywordPatternRe = n(l, !0), 276 | s && (r.begin || (r.begin = /\B|\b/), o.beginRe = n(o.begin), r.end || r.endsWithParent || (r.end = /\B|\b/), 277 | r.end && (o.endRe = n(o.end)), 278 | o.terminatorEnd = c(o.end) || "", r.endsWithParent && s.terminatorEnd && (o.terminatorEnd += (r.end ? "|" : "") + s.terminatorEnd)), 279 | r.illegal && (o.illegalRe = n(r.illegal)), 280 | r.contains || (r.contains = []), r.contains = [].concat(...r.contains.map((e => (e => (e.variants && !e.cachedVariants && (e.cachedVariants = e.variants.map((n => a(e, { 281 | variants: null 282 | }, n)))), e.cachedVariants ? e.cachedVariants : Q(e) ? a(e, { 283 | starts: e.starts ? a(e.starts) : null 284 | }) : Object.isFrozen(e) ? a(e) : e))("self" === e ? r : e)))), r.contains.forEach((e => { 285 | t(e, o) 286 | })), r.starts && t(r.starts, s), o.matcher = (e => { 287 | const n = new i 288 | ; return e.contains.forEach((e => n.addRule(e.begin, { 289 | rule: e, type: "begin" 290 | }))), e.terminatorEnd && n.addRule(e.terminatorEnd, { 291 | type: "end" 292 | }), e.illegal && n.addRule(e.illegal, { type: "illegal" }), n 293 | })(o), o 294 | }(e) 295 | } function Q(e) { 296 | return !!e && (e.endsWithParent || Q(e.starts)) 297 | } class X extends Error { 298 | constructor(e, n) { super(e), this.name = "HTMLInjectionError", this.html = n } 299 | } 300 | const V = t, J = a, Y = Symbol("nomatch"), ee = t => { 301 | const a = Object.create(null), i = Object.create(null), r = []; let s = !0 302 | ; const o = "Could not find the language '{}', did you forget to load/include a language module?", c = { 303 | disableAutodetect: !0, name: "Plain text", contains: [] 304 | }; let p = { 305 | ignoreUnescapedHTML: !1, throwUnescapedHTML: !1, noHighlightRe: /^(no-?highlight)$/i, 306 | languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i, classPrefix: "hljs-", 307 | cssSelector: "pre code", languages: null, __emitter: l 308 | }; function _(e) { 309 | return p.noHighlightRe.test(e) 310 | } function h(e, n, t) { 311 | let a = "", i = "" 312 | ; "object" == typeof n ? (a = e, 313 | t = n.ignoreIllegals, i = n.language) : (q("10.7.0", "highlight(lang, code, ...args) has been deprecated."), 314 | q("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"), 315 | i = e, a = n), void 0 === t && (t = !0); const r = { code: a, language: i }; O("before:highlight", r) 316 | ; const s = r.result ? r.result : f(r.language, r.code, t) 317 | ; return s.code = r.code, O("after:highlight", s), s 318 | } function f(e, t, i, r) { 319 | const l = Object.create(null); function c() { 320 | if (!O.keywords) return void A.addText(S) 321 | ; let e = 0; O.keywordPatternRe.lastIndex = 0; let n = O.keywordPatternRe.exec(S), t = "" 322 | ; for (; n;) { 323 | t += S.substring(e, n.index) 324 | ; const i = v.case_insensitive ? n[0].toLowerCase() : n[0], r = (a = i, O.keywords[a]); if (r) { 325 | const [e, a] = r 326 | ; if (A.addText(t), t = "", l[i] = (l[i] || 0) + 1, l[i] <= 7 && (C += a), e.startsWith("_")) t += n[0]; else { 327 | const t = v.classNameAliases[e] || e; g(n[0], t) 328 | } 329 | } else t += n[0] 330 | ; e = O.keywordPatternRe.lastIndex, n = O.keywordPatternRe.exec(S) 331 | } var a 332 | ; t += S.substring(e), A.addText(t) 333 | } function d() { 334 | null != O.subLanguage ? (() => { 335 | if ("" === S) return; let e = null; if ("string" == typeof O.subLanguage) { 336 | if (!a[O.subLanguage]) return void A.addText(S) 337 | ; e = f(O.subLanguage, S, !0, M[O.subLanguage]), M[O.subLanguage] = e._top 338 | } else e = E(S, O.subLanguage.length ? O.subLanguage : null) 339 | ; O.relevance > 0 && (C += e.relevance), A.__addSublanguage(e._emitter, e.language) 340 | })() : c(), S = "" 341 | } function g(e, n) { 342 | "" !== e && (A.startScope(n), A.addText(e), A.endScope()) 343 | } function u(e, n) { 344 | let t = 1 345 | ; const a = n.length - 1; for (; t <= a;) { 346 | if (!e._emit[t]) { t++; continue } 347 | const a = v.classNameAliases[e[t]] || e[t], i = n[t]; a ? g(i, a) : (S = i, c(), S = ""), t++ 348 | } 349 | } 350 | function b(e, n) { 351 | return e.scope && "string" == typeof e.scope && A.openNode(v.classNameAliases[e.scope] || e.scope), 352 | e.beginScope && (e.beginScope._wrap ? (g(S, v.classNameAliases[e.beginScope._wrap] || e.beginScope._wrap), 353 | S = "") : e.beginScope._multi && (u(e.beginScope, n), S = "")), O = Object.create(e, { 354 | parent: { 355 | value: O 356 | } 357 | }), O 358 | } function m(e, t, a) { 359 | let i = ((e, n) => { 360 | const t = e && e.exec(n) 361 | ; return t && 0 === t.index 362 | })(e.endRe, a); if (i) { 363 | if (e["on:end"]) { 364 | const a = new n(e) 365 | ; e["on:end"](t, a), a.isMatchIgnored && (i = !1) 366 | } if (i) { 367 | for (; e.endsParent && e.parent;)e = e.parent; return e 368 | } 369 | } 370 | if (e.endsWithParent) return m(e.parent, t, a) 371 | } function _(e) { 372 | return 0 === O.matcher.regexIndex ? (S += e[0], 1) : (D = !0, 0) 373 | } function h(e) { 374 | const n = e[0], a = t.substring(e.index), i = m(O, e, a); if (!i) return Y; const r = O 375 | ; O.endScope && O.endScope._wrap ? (d(), 376 | g(n, O.endScope._wrap)) : O.endScope && O.endScope._multi ? (d(), 377 | u(O.endScope, e)) : r.skip ? S += n : (r.returnEnd || r.excludeEnd || (S += n), 378 | d(), r.excludeEnd && (S = n)); do { 379 | O.scope && A.closeNode(), O.skip || O.subLanguage || (C += O.relevance), O = O.parent 380 | } while (O !== i.parent); return i.starts && b(i.starts, e), r.returnEnd ? 0 : n.length 381 | } 382 | let y = {}; function w(a, r) { 383 | const o = r && r[0]; if (S += a, null == o) return d(), 0 384 | ; if ("begin" === y.type && "end" === r.type && y.index === r.index && "" === o) { 385 | if (S += t.slice(r.index, r.index + 1), !s) { 386 | const n = Error(`0 width match regex (${e})`) 387 | ; throw n.languageName = e, n.badRule = y.rule, n 388 | } return 1 389 | } 390 | if (y = r, "begin" === r.type) return (e => { 391 | const t = e[0], a = e.rule, i = new n(a), r = [a.__beforeBegin, a["on:begin"]] 392 | ; for (const n of r) if (n && (n(e, i), i.isMatchIgnored)) return _(t) 393 | ; return a.skip ? S += t : (a.excludeBegin && (S += t), 394 | d(), a.returnBegin || a.excludeBegin || (S = t)), b(a, e), a.returnBegin ? 0 : t.length 395 | })(r) 396 | ; if ("illegal" === r.type && !i) { 397 | const e = Error('Illegal lexeme "' + o + '" for mode "' + (O.scope || "") + '"') 398 | ; throw e.mode = O, e 399 | } if ("end" === r.type) { const e = h(r); if (e !== Y) return e } 400 | if ("illegal" === r.type && "" === o) return S += "\n", 1 401 | ; if (R > 1e5 && R > 3 * r.index) throw Error("potential infinite loop, way more iterations than matches") 402 | ; return S += o, o.length 403 | } const v = N(e) 404 | ; if (!v) throw P(o.replace("{}", e)), Error('Unknown language: "' + e + '"') 405 | ; const k = W(v); let x = "", O = r || k; const M = {}, A = new p.__emitter(p); (() => { 406 | const e = [] 407 | ; for (let n = O; n !== v; n = n.parent)n.scope && e.unshift(n.scope) 408 | ; e.forEach((e => A.openNode(e))) 409 | })(); let S = "", C = 0, T = 0, R = 0, D = !1; try { 410 | if (v.__emitTokens) v.__emitTokens(t, A); else { 411 | for (O.matcher.considerAll(); ;) { 412 | R++, D ? D = !1 : O.matcher.considerAll(), O.matcher.lastIndex = T 413 | ; const e = O.matcher.exec(t); if (!e) break; const n = w(t.substring(T, e.index), e) 414 | ; T = e.index + n 415 | } w(t.substring(T)) 416 | } return A.finalize(), x = A.toHTML(), { 417 | language: e, 418 | value: x, relevance: C, illegal: !1, _emitter: A, _top: O 419 | } 420 | } catch (n) { 421 | if (n.message && n.message.includes("Illegal")) return { 422 | language: e, value: V(t), 423 | illegal: !0, relevance: 0, _illegalBy: { 424 | message: n.message, index: T, 425 | context: t.slice(T - 100, T + 100), mode: n.mode, resultSoFar: x 426 | }, _emitter: A 427 | }; if (s) return { 428 | language: e, value: V(t), illegal: !1, relevance: 0, errorRaised: n, _emitter: A, _top: O 429 | } 430 | ; throw n 431 | } 432 | } function E(e, n) { 433 | n = n || p.languages || Object.keys(a); const t = (e => { 434 | const n = { value: V(e), illegal: !1, relevance: 0, _top: c, _emitter: new p.__emitter(p) } 435 | ; return n._emitter.addText(e), n 436 | })(e), i = n.filter(N).filter(x).map((n => f(n, e, !1))) 437 | ; i.unshift(t); const r = i.sort(((e, n) => { 438 | if (e.relevance !== n.relevance) return n.relevance - e.relevance 439 | ; if (e.language && n.language) { 440 | if (N(e.language).supersetOf === n.language) return 1 441 | ; if (N(n.language).supersetOf === e.language) return -1 442 | } return 0 443 | })), [s, o] = r, l = s 444 | ; return l.secondBest = o, l 445 | } function y(e) { 446 | let n = null; const t = (e => { 447 | let n = e.className + " "; n += e.parentNode ? e.parentNode.className : "" 448 | ; const t = p.languageDetectRe.exec(n); if (t) { 449 | const n = N(t[1]) 450 | ; return n || (K(o.replace("{}", t[1])), 451 | K("Falling back to no-highlight mode for this block.", e)), n ? t[1] : "no-highlight" 452 | } 453 | return n.split(/\s+/).find((e => _(e) || N(e))) 454 | })(e); if (_(t)) return 455 | ; if (O("before:highlightElement", { 456 | el: e, language: t 457 | }), e.dataset.highlighted) return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", e) 458 | ; if (e.children.length > 0 && (p.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), 459 | console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), 460 | console.warn("The element with unescaped HTML:"), 461 | console.warn(e)), p.throwUnescapedHTML)) throw new X("One of your code blocks includes unescaped HTML.", e.innerHTML) 462 | ; n = e; const a = n.textContent, r = t ? h(a, { language: t, ignoreIllegals: !0 }) : E(a) 463 | ; e.innerHTML = r.value, e.dataset.highlighted = "yes", ((e, n, t) => { 464 | const a = n && i[n] || t 465 | ; e.classList.add("hljs"), e.classList.add("language-" + a) 466 | })(e, t, r.language), e.result = { 467 | language: r.language, re: r.relevance, 468 | relevance: r.relevance 469 | }, r.secondBest && (e.secondBest = { 470 | language: r.secondBest.language, relevance: r.secondBest.relevance 471 | }), O("after:highlightElement", { el: e, result: r, text: a }) 472 | } let w = !1; function v() { 473 | if ("loading" === document.readyState) return w || window.addEventListener("DOMContentLoaded", (() => { 474 | v() 475 | }), !1), void (w = !0); document.querySelectorAll(p.cssSelector).forEach(y) 476 | } 477 | function N(e) { return e = (e || "").toLowerCase(), a[e] || a[i[e]] } 478 | function k(e, { languageName: n }) { 479 | "string" == typeof e && (e = [e]), e.forEach((e => { 480 | i[e.toLowerCase()] = n 481 | })) 482 | } function x(e) { 483 | const n = N(e) 484 | ; return n && !n.disableAutodetect 485 | } function O(e, n) { 486 | const t = e; r.forEach((e => { 487 | e[t] && e[t](n) 488 | })) 489 | } Object.assign(t, { 490 | highlight: h, highlightAuto: E, highlightAll: v, 491 | highlightElement: y, 492 | highlightBlock: e => (q("10.7.0", "highlightBlock will be removed entirely in v12.0"), 493 | q("10.7.0", "Please use highlightElement now."), y(e)), configure: e => { p = J(p, e) }, 494 | initHighlighting: () => { 495 | v(), q("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.") 496 | }, 497 | initHighlightingOnLoad: () => { 498 | v(), q("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.") 499 | }, registerLanguage: (e, n) => { 500 | let i = null; try { i = n(t) } catch (n) { 501 | if (P("Language definition for '{}' could not be registered.".replace("{}", e)), 502 | !s) throw n; P(n), i = c 503 | } 504 | i.name || (i.name = e), a[e] = i, i.rawDefinition = n.bind(null, t), i.aliases && k(i.aliases, { 505 | languageName: e 506 | }) 507 | }, unregisterLanguage: e => { 508 | delete a[e] 509 | ; for (const n of Object.keys(i)) i[n] === e && delete i[n] 510 | }, 511 | listLanguages: () => Object.keys(a), getLanguage: N, registerAliases: k, 512 | autoDetection: x, inherit: J, addPlugin: e => { 513 | (e => { 514 | e["before:highlightBlock"] && !e["before:highlightElement"] && (e["before:highlightElement"] = n => { 515 | e["before:highlightBlock"](Object.assign({ block: n.el }, n)) 516 | }), e["after:highlightBlock"] && !e["after:highlightElement"] && (e["after:highlightElement"] = n => { 517 | e["after:highlightBlock"](Object.assign({ block: n.el }, n)) 518 | }) 519 | })(e), r.push(e) 520 | }, 521 | removePlugin: e => { const n = r.indexOf(e); -1 !== n && r.splice(n, 1) } 522 | }), t.debugMode = () => { 523 | s = !1 524 | }, t.safeMode = () => { s = !0 }, t.versionString = "11.11.1", t.regex = { 525 | concat: b, 526 | lookahead: d, either: m, optional: u, anyNumberOfTimes: g 527 | } 528 | ; for (const n in C) "object" == typeof C[n] && e(C[n]); return Object.assign(t, C), t 529 | }, ne = ee({}); ne.newInstance = () => ee({}); const te = e => ({ 530 | IMPORTANT: { 531 | scope: "meta", 532 | begin: "!important" 533 | }, BLOCK_COMMENT: e.C_BLOCK_COMMENT_MODE, HEXCOLOR: { 534 | scope: "number", begin: /#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/ 535 | }, 536 | FUNCTION_DISPATCH: { className: "built_in", begin: /[\w-]+(?=\()/ }, 537 | ATTRIBUTE_SELECTOR_MODE: { 538 | scope: "selector-attr", begin: /\[/, end: /\]/, illegal: "$", 539 | contains: [e.APOS_STRING_MODE, e.QUOTE_STRING_MODE] 540 | }, CSS_NUMBER_MODE: { 541 | scope: "number", 542 | begin: e.NUMBER_RE + "(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?", 543 | relevance: 0 544 | }, CSS_VARIABLE: { className: "attr", begin: /--[A-Za-z_][A-Za-z0-9_-]*/ } 545 | }), ae = ["a", "abbr", "address", "article", "aside", "audio", "b", "blockquote", "body", "button", "canvas", "caption", "cite", "code", "dd", "del", "details", "dfn", "div", "dl", "dt", "em", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "mark", "menu", "nav", "object", "ol", "optgroup", "option", "p", "picture", "q", "quote", "samp", "section", "select", "source", "span", "strong", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "ul", "var", "video", "defs", "g", "marker", "mask", "pattern", "svg", "switch", "symbol", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feFlood", "feGaussianBlur", "feImage", "feMerge", "feMorphology", "feOffset", "feSpecularLighting", "feTile", "feTurbulence", "linearGradient", "radialGradient", "stop", "circle", "ellipse", "image", "line", "path", "polygon", "polyline", "rect", "text", "use", "textPath", "tspan", "foreignObject", "clipPath"], ie = ["any-hover", "any-pointer", "aspect-ratio", "color", "color-gamut", "color-index", "device-aspect-ratio", "device-height", "device-width", "display-mode", "forced-colors", "grid", "height", "hover", "inverted-colors", "monochrome", "orientation", "overflow-block", "overflow-inline", "pointer", "prefers-color-scheme", "prefers-contrast", "prefers-reduced-motion", "prefers-reduced-transparency", "resolution", "scan", "scripting", "update", "width", "min-width", "max-width", "min-height", "max-height"].sort().reverse(), re = ["active", "any-link", "blank", "checked", "current", "default", "defined", "dir", "disabled", "drop", "empty", "enabled", "first", "first-child", "first-of-type", "fullscreen", "future", "focus", "focus-visible", "focus-within", "has", "host", "host-context", "hover", "indeterminate", "in-range", "invalid", "is", "lang", "last-child", "last-of-type", "left", "link", "local-link", "not", "nth-child", "nth-col", "nth-last-child", "nth-last-col", "nth-last-of-type", "nth-of-type", "only-child", "only-of-type", "optional", "out-of-range", "past", "placeholder-shown", "read-only", "read-write", "required", "right", "root", "scope", "target", "target-within", "user-invalid", "valid", "visited", "where"].sort().reverse(), se = ["after", "backdrop", "before", "cue", "cue-region", "first-letter", "first-line", "grammar-error", "marker", "part", "placeholder", "selection", "slotted", "spelling-error"].sort().reverse(), oe = ["accent-color", "align-content", "align-items", "align-self", "alignment-baseline", "all", "anchor-name", "animation", "animation-composition", "animation-delay", "animation-direction", "animation-duration", "animation-fill-mode", "animation-iteration-count", "animation-name", "animation-play-state", "animation-range", "animation-range-end", "animation-range-start", "animation-timeline", "animation-timing-function", "appearance", "aspect-ratio", "backdrop-filter", "backface-visibility", "background", "background-attachment", "background-blend-mode", "background-clip", "background-color", "background-image", "background-origin", "background-position", "background-position-x", "background-position-y", "background-repeat", "background-size", "baseline-shift", "block-size", "border", "border-block", "border-block-color", "border-block-end", "border-block-end-color", "border-block-end-style", "border-block-end-width", "border-block-start", "border-block-start-color", "border-block-start-style", "border-block-start-width", "border-block-style", "border-block-width", "border-bottom", "border-bottom-color", "border-bottom-left-radius", "border-bottom-right-radius", "border-bottom-style", "border-bottom-width", "border-collapse", "border-color", "border-end-end-radius", "border-end-start-radius", "border-image", "border-image-outset", "border-image-repeat", "border-image-slice", "border-image-source", "border-image-width", "border-inline", "border-inline-color", "border-inline-end", "border-inline-end-color", "border-inline-end-style", "border-inline-end-width", "border-inline-start", "border-inline-start-color", "border-inline-start-style", "border-inline-start-width", "border-inline-style", "border-inline-width", "border-left", "border-left-color", "border-left-style", "border-left-width", "border-radius", "border-right", "border-right-color", "border-right-style", "border-right-width", "border-spacing", "border-start-end-radius", "border-start-start-radius", "border-style", "border-top", "border-top-color", "border-top-left-radius", "border-top-right-radius", "border-top-style", "border-top-width", "border-width", "bottom", "box-align", "box-decoration-break", "box-direction", "box-flex", "box-flex-group", "box-lines", "box-ordinal-group", "box-orient", "box-pack", "box-shadow", "box-sizing", "break-after", "break-before", "break-inside", "caption-side", "caret-color", "clear", "clip", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "color-scheme", "column-count", "column-fill", "column-gap", "column-rule", "column-rule-color", "column-rule-style", "column-rule-width", "column-span", "column-width", "columns", "contain", "contain-intrinsic-block-size", "contain-intrinsic-height", "contain-intrinsic-inline-size", "contain-intrinsic-size", "contain-intrinsic-width", "container", "container-name", "container-type", "content", "content-visibility", "counter-increment", "counter-reset", "counter-set", "cue", "cue-after", "cue-before", "cursor", "cx", "cy", "direction", "display", "dominant-baseline", "empty-cells", "enable-background", "field-sizing", "fill", "fill-opacity", "fill-rule", "filter", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "float", "flood-color", "flood-opacity", "flow", "font", "font-display", "font-family", "font-feature-settings", "font-kerning", "font-language-override", "font-optical-sizing", "font-palette", "font-size", "font-size-adjust", "font-smooth", "font-smoothing", "font-stretch", "font-style", "font-synthesis", "font-synthesis-position", "font-synthesis-small-caps", "font-synthesis-style", "font-synthesis-weight", "font-variant", "font-variant-alternates", "font-variant-caps", "font-variant-east-asian", "font-variant-emoji", "font-variant-ligatures", "font-variant-numeric", "font-variant-position", "font-variation-settings", "font-weight", "forced-color-adjust", "gap", "glyph-orientation-horizontal", "glyph-orientation-vertical", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", "grid-auto-rows", "grid-column", "grid-column-end", "grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns", "grid-template-rows", "hanging-punctuation", "height", "hyphenate-character", "hyphenate-limit-chars", "hyphens", "icon", "image-orientation", "image-rendering", "image-resolution", "ime-mode", "initial-letter", "initial-letter-align", "inline-size", "inset", "inset-area", "inset-block", "inset-block-end", "inset-block-start", "inset-inline", "inset-inline-end", "inset-inline-start", "isolation", "justify-content", "justify-items", "justify-self", "kerning", "left", "letter-spacing", "lighting-color", "line-break", "line-height", "line-height-step", "list-style", "list-style-image", "list-style-position", "list-style-type", "margin", "margin-block", "margin-block-end", "margin-block-start", "margin-bottom", "margin-inline", "margin-inline-end", "margin-inline-start", "margin-left", "margin-right", "margin-top", "margin-trim", "marker", "marker-end", "marker-mid", "marker-start", "marks", "mask", "mask-border", "mask-border-mode", "mask-border-outset", "mask-border-repeat", "mask-border-slice", "mask-border-source", "mask-border-width", "mask-clip", "mask-composite", "mask-image", "mask-mode", "mask-origin", "mask-position", "mask-repeat", "mask-size", "mask-type", "masonry-auto-flow", "math-depth", "math-shift", "math-style", "max-block-size", "max-height", "max-inline-size", "max-width", "min-block-size", "min-height", "min-inline-size", "min-width", "mix-blend-mode", "nav-down", "nav-index", "nav-left", "nav-right", "nav-up", "none", "normal", "object-fit", "object-position", "offset", "offset-anchor", "offset-distance", "offset-path", "offset-position", "offset-rotate", "opacity", "order", "orphans", "outline", "outline-color", "outline-offset", "outline-style", "outline-width", "overflow", "overflow-anchor", "overflow-block", "overflow-clip-margin", "overflow-inline", "overflow-wrap", "overflow-x", "overflow-y", "overlay", "overscroll-behavior", "overscroll-behavior-block", "overscroll-behavior-inline", "overscroll-behavior-x", "overscroll-behavior-y", "padding", "padding-block", "padding-block-end", "padding-block-start", "padding-bottom", "padding-inline", "padding-inline-end", "padding-inline-start", "padding-left", "padding-right", "padding-top", "page", "page-break-after", "page-break-before", "page-break-inside", "paint-order", "pause", "pause-after", "pause-before", "perspective", "perspective-origin", "place-content", "place-items", "place-self", "pointer-events", "position", "position-anchor", "position-visibility", "print-color-adjust", "quotes", "r", "resize", "rest", "rest-after", "rest-before", "right", "rotate", "row-gap", "ruby-align", "ruby-position", "scale", "scroll-behavior", "scroll-margin", "scroll-margin-block", "scroll-margin-block-end", "scroll-margin-block-start", "scroll-margin-bottom", "scroll-margin-inline", "scroll-margin-inline-end", "scroll-margin-inline-start", "scroll-margin-left", "scroll-margin-right", "scroll-margin-top", "scroll-padding", "scroll-padding-block", "scroll-padding-block-end", "scroll-padding-block-start", "scroll-padding-bottom", "scroll-padding-inline", "scroll-padding-inline-end", "scroll-padding-inline-start", "scroll-padding-left", "scroll-padding-right", "scroll-padding-top", "scroll-snap-align", "scroll-snap-stop", "scroll-snap-type", "scroll-timeline", "scroll-timeline-axis", "scroll-timeline-name", "scrollbar-color", "scrollbar-gutter", "scrollbar-width", "shape-image-threshold", "shape-margin", "shape-outside", "shape-rendering", "speak", "speak-as", "src", "stop-color", "stop-opacity", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "tab-size", "table-layout", "text-align", "text-align-all", "text-align-last", "text-anchor", "text-combine-upright", "text-decoration", "text-decoration-color", "text-decoration-line", "text-decoration-skip", "text-decoration-skip-ink", "text-decoration-style", "text-decoration-thickness", "text-emphasis", "text-emphasis-color", "text-emphasis-position", "text-emphasis-style", "text-indent", "text-justify", "text-orientation", "text-overflow", "text-rendering", "text-shadow", "text-size-adjust", "text-transform", "text-underline-offset", "text-underline-position", "text-wrap", "text-wrap-mode", "text-wrap-style", "timeline-scope", "top", "touch-action", "transform", "transform-box", "transform-origin", "transform-style", "transition", "transition-behavior", "transition-delay", "transition-duration", "transition-property", "transition-timing-function", "translate", "unicode-bidi", "user-modify", "user-select", "vector-effect", "vertical-align", "view-timeline", "view-timeline-axis", "view-timeline-inset", "view-timeline-name", "view-transition-name", "visibility", "voice-balance", "voice-duration", "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress", "voice-volume", "white-space", "white-space-collapse", "widows", "width", "will-change", "word-break", "word-spacing", "word-wrap", "writing-mode", "x", "y", "z-index", "zoom"].sort().reverse(), le = re.concat(se).sort().reverse() 546 | ; var ce = "[0-9](_*[0-9])*", de = `\\.(${ce})`, ge = "[0-9a-fA-F](_*[0-9a-fA-F])*", ue = { 547 | className: "number", variants: [{ 548 | begin: `(\\b(${ce})((${de})|\\.)?|(${de}))[eE][+-]?(${ce})[fFdD]?\\b` 549 | }, { 550 | begin: `\\b(${ce})((${de})[fFdD]?\\b|\\.([fFdD]\\b)?)` 551 | }, { 552 | begin: `(${de})[fFdD]?\\b` 553 | }, { begin: `\\b(${ce})[fFdD]\\b` }, { 554 | begin: `\\b0[xX]((${ge})\\.?|(${ge})?\\.(${ge}))[pP][+-]?(${ce})[fFdD]?\\b` 555 | }, { 556 | begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" 557 | }, { begin: `\\b0[xX](${ge})[lL]?\\b` }, { 558 | begin: "\\b0(_*[0-7])*[lL]?\\b" 559 | }, { begin: "\\b0[bB][01](_*[01])*[lL]?\\b" }], 560 | relevance: 0 561 | }; function be(e, n, t) { return -1 === t ? "" : e.replace(n, (a => be(e, n, t - 1))) } 562 | const me = "[A-Za-z$_][0-9A-Za-z$_]*", pe = ["as", "in", "of", "if", "for", "while", "finally", "var", "new", "function", "do", "return", "void", "else", "break", "catch", "instanceof", "with", "throw", "case", "default", "try", "switch", "continue", "typeof", "delete", "let", "yield", "const", "class", "debugger", "async", "await", "static", "import", "from", "export", "extends", "using"], _e = ["true", "false", "null", "undefined", "NaN", "Infinity"], he = ["Object", "Function", "Boolean", "Symbol", "Math", "Date", "Number", "BigInt", "String", "RegExp", "Array", "Float32Array", "Float64Array", "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Int32Array", "Uint16Array", "Uint32Array", "BigInt64Array", "BigUint64Array", "Set", "Map", "WeakSet", "WeakMap", "ArrayBuffer", "SharedArrayBuffer", "Atomics", "DataView", "JSON", "Promise", "Generator", "GeneratorFunction", "AsyncFunction", "Reflect", "Proxy", "Intl", "WebAssembly"], fe = ["Error", "EvalError", "InternalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError"], Ee = ["setInterval", "setTimeout", "clearInterval", "clearTimeout", "require", "exports", "eval", "isFinite", "isNaN", "parseFloat", "parseInt", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "escape", "unescape"], ye = ["arguments", "this", "super", "console", "window", "document", "localStorage", "sessionStorage", "module", "global"], we = [].concat(Ee, he, fe) 563 | ; function ve(e) { 564 | const n = e.regex, t = me, a = { 565 | begin: /<[A-Za-z0-9\\._:-]+/, 566 | end: /\/[A-Za-z0-9\\._:-]+>|\/>/, isTrulyOpeningTag: (e, n) => { 567 | const t = e[0].length + e.index, a = e.input[t] 568 | ; if ("<" === a || "," === a) return void n.ignoreMatch(); let i 569 | ; ">" === a && (((e, { after: n }) => { 570 | const t = " e + "\\s*\\(")), 658 | n.concat("(?!", N.join("|"), ")")), t, n.lookahead(/\s*\(/)), 659 | className: "title.function", relevance: 0 660 | }; var N; const k = { 661 | begin: n.concat(/\./, n.lookahead(n.concat(t, /(?![0-9A-Za-z$_(])/))), end: t, 662 | excludeBegin: !0, keywords: "prototype", className: "property", relevance: 0 663 | }, x = { 664 | match: [/get|set/, /\s+/, t, /(?=\()/], className: { 1: "keyword", 3: "title.function" }, 665 | contains: [{ begin: /\(\)/ }, f] 666 | }, O = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + e.UNDERSCORE_IDENT_RE + ")\\s*=>", M = { 667 | match: [/const|var|let/, /\s+/, t, /\s*/, /=\s*/, /(async\s*)?/, n.lookahead(O)], 668 | keywords: "async", className: { 1: "keyword", 3: "title.function" }, contains: [f] 669 | } 670 | ; return { 671 | name: "JavaScript", aliases: ["js", "jsx", "mjs", "cjs"], keywords: i, exports: { 672 | PARAMS_CONTAINS: h, CLASS_REFERENCE: y 673 | }, illegal: /#(?![$_A-z])/, 674 | contains: [e.SHEBANG({ label: "shebang", binary: "node", relevance: 5 }), { 675 | label: "use_strict", className: "meta", relevance: 10, 676 | begin: /^\s*['"]use (strict|asm)['"]/ 677 | }, e.APOS_STRING_MODE, e.QUOTE_STRING_MODE, d, g, u, b, m, { match: /\$\d+/ }, l, y, { 678 | scope: "attr", match: t + n.lookahead(":"), relevance: 0 679 | }, M, { 680 | begin: "(" + e.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*", 681 | keywords: "return throw case", relevance: 0, contains: [m, e.REGEXP_MODE, { 682 | className: "function", begin: O, returnBegin: !0, end: "\\s*=>", contains: [{ 683 | className: "params", variants: [{ begin: e.UNDERSCORE_IDENT_RE, relevance: 0 }, { 684 | className: null, begin: /\(\s*\)/, skip: !0 685 | }, { 686 | begin: /(\s*)\(/, end: /\)/, 687 | excludeBegin: !0, excludeEnd: !0, keywords: i, contains: h 688 | }] 689 | }] 690 | }, { 691 | begin: /,/, relevance: 0 692 | }, { match: /\s+/, relevance: 0 }, { 693 | variants: [{ begin: "<>", end: "" }, { 694 | match: /<[A-Za-z0-9\\._:-]+\s*\/>/ 695 | }, { 696 | begin: a.begin, 697 | "on:begin": a.isTrulyOpeningTag, end: a.end 698 | }], subLanguage: "xml", contains: [{ 699 | begin: a.begin, end: a.end, skip: !0, contains: ["self"] 700 | }] 701 | }] 702 | }, w, { 703 | beginKeywords: "while if switch catch for" 704 | }, { 705 | begin: "\\b(?!function)" + e.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", 706 | returnBegin: !0, label: "func.def", contains: [f, e.inherit(e.TITLE_MODE, { 707 | begin: t, 708 | className: "title.function" 709 | })] 710 | }, { match: /\.\.\./, relevance: 0 }, k, { 711 | match: "\\$" + t, 712 | relevance: 0 713 | }, { 714 | match: [/\bconstructor(?=\s*\()/], className: { 1: "title.function" }, 715 | contains: [f] 716 | }, v, { 717 | relevance: 0, match: /\b[A-Z][A-Z_0-9]+\b/, 718 | className: "variable.constant" 719 | }, E, x, { match: /\$[(.]/ }] 720 | } 721 | } 722 | const Ne = e => b(/\b/, e, /\w$/.test(e) ? /\b/ : /\B/), ke = ["Protocol", "Type"].map(Ne), xe = ["init", "self"].map(Ne), Oe = ["Any", "Self"], Me = ["actor", "any", "associatedtype", "async", "await", /as\?/, /as!/, "as", "borrowing", "break", "case", "catch", "class", "consume", "consuming", "continue", "convenience", "copy", "default", "defer", "deinit", "didSet", "distributed", "do", "dynamic", "each", "else", "enum", "extension", "fallthrough", /fileprivate\(set\)/, "fileprivate", "final", "for", "func", "get", "guard", "if", "import", "indirect", "infix", /init\?/, /init!/, "inout", /internal\(set\)/, "internal", "in", "is", "isolated", "nonisolated", "lazy", "let", "macro", "mutating", "nonmutating", /open\(set\)/, "open", "operator", "optional", "override", "package", "postfix", "precedencegroup", "prefix", /private\(set\)/, "private", "protocol", /public\(set\)/, "public", "repeat", "required", "rethrows", "return", "set", "some", "static", "struct", "subscript", "super", "switch", "throws", "throw", /try\?/, /try!/, "try", "typealias", /unowned\(safe\)/, /unowned\(unsafe\)/, "unowned", "var", "weak", "where", "while", "willSet"], Ae = ["false", "nil", "true"], Se = ["assignment", "associativity", "higherThan", "left", "lowerThan", "none", "right"], Ce = ["#colorLiteral", "#column", "#dsohandle", "#else", "#elseif", "#endif", "#error", "#file", "#fileID", "#fileLiteral", "#filePath", "#function", "#if", "#imageLiteral", "#keyPath", "#line", "#selector", "#sourceLocation", "#warning"], Te = ["abs", "all", "any", "assert", "assertionFailure", "debugPrint", "dump", "fatalError", "getVaList", "isKnownUniquelyReferenced", "max", "min", "numericCast", "pointwiseMax", "pointwiseMin", "precondition", "preconditionFailure", "print", "readLine", "repeatElement", "sequence", "stride", "swap", "swift_unboxFromSwiftValueWithType", "transcode", "type", "unsafeBitCast", "unsafeDowncast", "withExtendedLifetime", "withUnsafeMutablePointer", "withUnsafePointer", "withVaList", "withoutActuallyEscaping", "zip"], Re = m(/[/=\-+!*%<>&|^~?]/, /[\u00A1-\u00A7]/, /[\u00A9\u00AB]/, /[\u00AC\u00AE]/, /[\u00B0\u00B1]/, /[\u00B6\u00BB\u00BF\u00D7\u00F7]/, /[\u2016-\u2017]/, /[\u2020-\u2027]/, /[\u2030-\u203E]/, /[\u2041-\u2053]/, /[\u2055-\u205E]/, /[\u2190-\u23FF]/, /[\u2500-\u2775]/, /[\u2794-\u2BFF]/, /[\u2E00-\u2E7F]/, /[\u3001-\u3003]/, /[\u3008-\u3020]/, /[\u3030]/), De = m(Re, /[\u0300-\u036F]/, /[\u1DC0-\u1DFF]/, /[\u20D0-\u20FF]/, /[\uFE00-\uFE0F]/, /[\uFE20-\uFE2F]/), Ie = b(Re, De, "*"), Le = m(/[a-zA-Z_]/, /[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/, /[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/, /[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/, /[\u1E00-\u1FFF]/, /[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/, /[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/, /[\u2C00-\u2DFF\u2E80-\u2FFF]/, /[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/, /[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/, /[\uFE47-\uFEFE\uFF00-\uFFFD]/), Be = m(Le, /\d/, /[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/), $e = b(Le, Be, "*"), Fe = b(/[A-Z]/, Be, "*"), ze = ["attached", "autoclosure", b(/convention\(/, m("swift", "block", "c"), /\)/), "discardableResult", "dynamicCallable", "dynamicMemberLookup", "escaping", "freestanding", "frozen", "GKInspectable", "IBAction", "IBDesignable", "IBInspectable", "IBOutlet", "IBSegueAction", "inlinable", "main", "nonobjc", "NSApplicationMain", "NSCopying", "NSManaged", b(/objc\(/, $e, /\)/), "objc", "objcMembers", "propertyWrapper", "requires_stored_property_inits", "resultBuilder", "Sendable", "testable", "UIApplicationMain", "unchecked", "unknown", "usableFromInline", "warn_unqualified_access"], je = ["iOS", "iOSApplicationExtension", "macOS", "macOSApplicationExtension", "macCatalyst", "macCatalystApplicationExtension", "watchOS", "watchOSApplicationExtension", "tvOS", "tvOSApplicationExtension", "swift"] 723 | ; var Ue = Object.freeze({ 724 | __proto__: null, grmr_bash: e => { 725 | const n = e.regex, t = {}, a = { 726 | begin: /\$\{/, end: /\}/, contains: ["self", { begin: /:-/, contains: [t] }] 727 | } 728 | ; Object.assign(t, { 729 | className: "variable", variants: [{ 730 | begin: n.concat(/\$[\w\d#@][\w\d_]*/, "(?![\\w\\d])(?![$])") 731 | }, a] 732 | }); const i = { 733 | className: "subst", begin: /\$\(/, end: /\)/, contains: [e.BACKSLASH_ESCAPE] 734 | }, r = e.inherit(e.COMMENT(), { match: [/(^|\s)/, /#.*$/], scope: { 2: "comment" } }), s = { 735 | begin: /<<-?\s*(?=\w+)/, starts: { 736 | contains: [e.END_SAME_AS_BEGIN({ 737 | begin: /(\w+)/, 738 | end: /(\w+)/, className: "string" 739 | })] 740 | } 741 | }, o = { 742 | className: "string", begin: /"/, end: /"/, 743 | contains: [e.BACKSLASH_ESCAPE, t, i] 744 | }; i.contains.push(o); const l = { 745 | begin: /\$?\(\(/, 746 | end: /\)\)/, contains: [{ begin: /\d+#[0-9a-f]+/, className: "number" }, e.NUMBER_MODE, t] 747 | }, c = e.SHEBANG({ 748 | binary: "(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)", relevance: 10 749 | }), d = { 750 | className: "function", begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/, returnBegin: !0, 751 | contains: [e.inherit(e.TITLE_MODE, { begin: /\w[\w\d_]*/ })], relevance: 0 752 | }; return { 753 | name: "Bash", aliases: ["sh", "zsh"], keywords: { 754 | $pattern: /\b[a-z][a-z0-9._-]+\b/, 755 | keyword: ["if", "then", "else", "elif", "fi", "time", "for", "while", "until", "in", "do", "done", "case", "esac", "coproc", "function", "select"], 756 | literal: ["true", "false"], 757 | built_in: ["break", "cd", "continue", "eval", "exec", "exit", "export", "getopts", "hash", "pwd", "readonly", "return", "shift", "test", "times", "trap", "umask", "unset", "alias", "bind", "builtin", "caller", "command", "declare", "echo", "enable", "help", "let", "local", "logout", "mapfile", "printf", "read", "readarray", "source", "sudo", "type", "typeset", "ulimit", "unalias", "set", "shopt", "autoload", "bg", "bindkey", "bye", "cap", "chdir", "clone", "comparguments", "compcall", "compctl", "compdescribe", "compfiles", "compgroups", "compquote", "comptags", "comptry", "compvalues", "dirs", "disable", "disown", "echotc", "echoti", "emulate", "fc", "fg", "float", "functions", "getcap", "getln", "history", "integer", "jobs", "kill", "limit", "log", "noglob", "popd", "print", "pushd", "pushln", "rehash", "sched", "setcap", "setopt", "stat", "suspend", "ttyctl", "unfunction", "unhash", "unlimit", "unsetopt", "vared", "wait", "whence", "where", "which", "zcompile", "zformat", "zftp", "zle", "zmodload", "zparseopts", "zprof", "zpty", "zregexparse", "zsocket", "zstyle", "ztcp", "chcon", "chgrp", "chown", "chmod", "cp", "dd", "df", "dir", "dircolors", "ln", "ls", "mkdir", "mkfifo", "mknod", "mktemp", "mv", "realpath", "rm", "rmdir", "shred", "sync", "touch", "truncate", "vdir", "b2sum", "base32", "base64", "cat", "cksum", "comm", "csplit", "cut", "expand", "fmt", "fold", "head", "join", "md5sum", "nl", "numfmt", "od", "paste", "ptx", "pr", "sha1sum", "sha224sum", "sha256sum", "sha384sum", "sha512sum", "shuf", "sort", "split", "sum", "tac", "tail", "tr", "tsort", "unexpand", "uniq", "wc", "arch", "basename", "chroot", "date", "dirname", "du", "echo", "env", "expr", "factor", "groups", "hostid", "id", "link", "logname", "nice", "nohup", "nproc", "pathchk", "pinky", "printenv", "printf", "pwd", "readlink", "runcon", "seq", "sleep", "stat", "stdbuf", "stty", "tee", "test", "timeout", "tty", "uname", "unlink", "uptime", "users", "who", "whoami", "yes"] 758 | }, contains: [c, e.SHEBANG(), d, l, r, s, { match: /(\/[a-z._-]+)+/ }, o, { match: /\\"/ }, { 759 | className: "string", begin: /'/, end: /'/ 760 | }, { match: /\\'/ }, t] 761 | } 762 | }, grmr_c: e => { 763 | const n = e.regex, t = e.COMMENT("//", "$", { 764 | contains: [{ begin: /\\\n/ }] 765 | }), a = "decltype\\(auto\\)", i = "[a-zA-Z_]\\w*::", r = "(" + a + "|" + n.optional(i) + "[a-zA-Z_]\\w*" + n.optional("<[^<>]+>") + ")", s = { 766 | className: "type", variants: [{ begin: "\\b[a-z\\d_]*_t\\b" }, { 767 | match: /\batomic_[a-z]{3,6}\b/ 768 | }] 769 | }, o = { 770 | className: "string", variants: [{ 771 | begin: '(u8?|U|L)?"', end: '"', illegal: "\\n", contains: [e.BACKSLASH_ESCAPE] 772 | }, { 773 | begin: "(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", 774 | end: "'", illegal: "." 775 | }, e.END_SAME_AS_BEGIN({ 776 | begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/, end: /\)([^()\\ ]{0,16})"/ 777 | })] 778 | }, l = { 779 | className: "number", variants: [{ match: /\b(0b[01']+)/ }, { 780 | match: /(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/ 781 | }, { 782 | match: /(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/ 783 | }, { match: /(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/ }], relevance: 0 784 | }, c = { 785 | className: "meta", begin: /#\s*[a-z]+\b/, end: /$/, keywords: { 786 | keyword: "if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include" 787 | }, contains: [{ begin: /\\\n/, relevance: 0 }, e.inherit(o, { className: "string" }), { 788 | className: "string", begin: /<.*?>/ 789 | }, t, e.C_BLOCK_COMMENT_MODE] 790 | }, d = { 791 | className: "title", begin: n.optional(i) + e.IDENT_RE, relevance: 0 792 | }, g = n.optional(i) + e.IDENT_RE + "\\s*\\(", u = { 793 | keyword: ["asm", "auto", "break", "case", "continue", "default", "do", "else", "enum", "extern", "for", "fortran", "goto", "if", "inline", "register", "restrict", "return", "sizeof", "typeof", "typeof_unqual", "struct", "switch", "typedef", "union", "volatile", "while", "_Alignas", "_Alignof", "_Atomic", "_Generic", "_Noreturn", "_Static_assert", "_Thread_local", "alignas", "alignof", "noreturn", "static_assert", "thread_local", "_Pragma"], 794 | type: ["float", "double", "signed", "unsigned", "int", "short", "long", "char", "void", "_Bool", "_BitInt", "_Complex", "_Imaginary", "_Decimal32", "_Decimal64", "_Decimal96", "_Decimal128", "_Decimal64x", "_Decimal128x", "_Float16", "_Float32", "_Float64", "_Float128", "_Float32x", "_Float64x", "_Float128x", "const", "static", "constexpr", "complex", "bool", "imaginary"], 795 | literal: "true false NULL", 796 | built_in: "std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr" 797 | }, b = [c, s, t, e.C_BLOCK_COMMENT_MODE, l, o], m = { 798 | variants: [{ begin: /=/, end: /;/ }, { 799 | begin: /\(/, end: /\)/ 800 | }, { beginKeywords: "new throw return else", end: /;/ }], 801 | keywords: u, contains: b.concat([{ 802 | begin: /\(/, end: /\)/, keywords: u, 803 | contains: b.concat(["self"]), relevance: 0 804 | }]), relevance: 0 805 | }, p = { 806 | begin: "(" + r + "[\\*&\\s]+)+" + g, returnBegin: !0, end: /[{;=]/, excludeEnd: !0, 807 | keywords: u, illegal: /[^\w\s\*&:<>.]/, contains: [{ begin: a, keywords: u, relevance: 0 }, { 808 | begin: g, returnBegin: !0, contains: [e.inherit(d, { className: "title.function" })], 809 | relevance: 0 810 | }, { relevance: 0, match: /,/ }, { 811 | className: "params", begin: /\(/, end: /\)/, 812 | keywords: u, relevance: 0, contains: [t, e.C_BLOCK_COMMENT_MODE, o, l, s, { 813 | begin: /\(/, 814 | end: /\)/, keywords: u, relevance: 0, contains: ["self", t, e.C_BLOCK_COMMENT_MODE, o, l, s] 815 | }] 816 | }, s, t, e.C_BLOCK_COMMENT_MODE, c] 817 | }; return { 818 | name: "C", aliases: ["h"], keywords: u, 819 | disableAutodetect: !0, illegal: "=]/, contains: [{ 824 | beginKeywords: "final class struct" 825 | }, e.TITLE_MODE] 826 | }]), exports: { 827 | preprocessor: c, 828 | strings: o, keywords: u 829 | } 830 | } 831 | }, grmr_cpp: e => { 832 | const n = e.regex, t = e.COMMENT("//", "$", { 833 | contains: [{ begin: /\\\n/ }] 834 | }), a = "decltype\\(auto\\)", i = "[a-zA-Z_]\\w*::", r = "(?!struct)(" + a + "|" + n.optional(i) + "[a-zA-Z_]\\w*" + n.optional("<[^<>]+>") + ")", s = { 835 | className: "type", begin: "\\b[a-z\\d_]*_t\\b" 836 | }, o = { 837 | className: "string", variants: [{ 838 | begin: '(u8?|U|L)?"', end: '"', illegal: "\\n", contains: [e.BACKSLASH_ESCAPE] 839 | }, { 840 | begin: "(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", 841 | end: "'", illegal: "." 842 | }, e.END_SAME_AS_BEGIN({ 843 | begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/, end: /\)([^()\\ ]{0,16})"/ 844 | })] 845 | }, l = { 846 | className: "number", variants: [{ 847 | begin: "[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)" 848 | }, { 849 | begin: "[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)" 850 | }], relevance: 0 851 | }, c = { 852 | className: "meta", begin: /#\s*[a-z]+\b/, end: /$/, keywords: { 853 | keyword: "if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" 854 | }, contains: [{ begin: /\\\n/, relevance: 0 }, e.inherit(o, { className: "string" }), { 855 | className: "string", begin: /<.*?>/ 856 | }, t, e.C_BLOCK_COMMENT_MODE] 857 | }, d = { 858 | className: "title", begin: n.optional(i) + e.IDENT_RE, relevance: 0 859 | }, g = n.optional(i) + e.IDENT_RE + "\\s*\\(", u = { 860 | type: ["bool", "char", "char16_t", "char32_t", "char8_t", "double", "float", "int", "long", "short", "void", "wchar_t", "unsigned", "signed", "const", "static"], 861 | keyword: ["alignas", "alignof", "and", "and_eq", "asm", "atomic_cancel", "atomic_commit", "atomic_noexcept", "auto", "bitand", "bitor", "break", "case", "catch", "class", "co_await", "co_return", "co_yield", "compl", "concept", "const_cast|10", "consteval", "constexpr", "constinit", "continue", "decltype", "default", "delete", "do", "dynamic_cast|10", "else", "enum", "explicit", "export", "extern", "false", "final", "for", "friend", "goto", "if", "import", "inline", "module", "mutable", "namespace", "new", "noexcept", "not", "not_eq", "nullptr", "operator", "or", "or_eq", "override", "private", "protected", "public", "reflexpr", "register", "reinterpret_cast|10", "requires", "return", "sizeof", "static_assert", "static_cast|10", "struct", "switch", "synchronized", "template", "this", "thread_local", "throw", "transaction_safe", "transaction_safe_dynamic", "true", "try", "typedef", "typeid", "typename", "union", "using", "virtual", "volatile", "while", "xor", "xor_eq"], 862 | literal: ["NULL", "false", "nullopt", "nullptr", "true"], built_in: ["_Pragma"], 863 | _type_hints: ["any", "auto_ptr", "barrier", "binary_semaphore", "bitset", "complex", "condition_variable", "condition_variable_any", "counting_semaphore", "deque", "false_type", "flat_map", "flat_set", "future", "imaginary", "initializer_list", "istringstream", "jthread", "latch", "lock_guard", "multimap", "multiset", "mutex", "optional", "ostringstream", "packaged_task", "pair", "promise", "priority_queue", "queue", "recursive_mutex", "recursive_timed_mutex", "scoped_lock", "set", "shared_future", "shared_lock", "shared_mutex", "shared_timed_mutex", "shared_ptr", "stack", "string_view", "stringstream", "timed_mutex", "thread", "true_type", "tuple", "unique_lock", "unique_ptr", "unordered_map", "unordered_multimap", "unordered_multiset", "unordered_set", "variant", "vector", "weak_ptr", "wstring", "wstring_view"] 864 | }, b = { 865 | className: "function.dispatch", relevance: 0, keywords: { 866 | _hint: ["abort", "abs", "acos", "apply", "as_const", "asin", "atan", "atan2", "calloc", "ceil", "cerr", "cin", "clog", "cos", "cosh", "cout", "declval", "endl", "exchange", "exit", "exp", "fabs", "floor", "fmod", "forward", "fprintf", "fputs", "free", "frexp", "fscanf", "future", "invoke", "isalnum", "isalpha", "iscntrl", "isdigit", "isgraph", "islower", "isprint", "ispunct", "isspace", "isupper", "isxdigit", "labs", "launder", "ldexp", "log", "log10", "make_pair", "make_shared", "make_shared_for_overwrite", "make_tuple", "make_unique", "malloc", "memchr", "memcmp", "memcpy", "memset", "modf", "move", "pow", "printf", "putchar", "puts", "realloc", "scanf", "sin", "sinh", "snprintf", "sprintf", "sqrt", "sscanf", "std", "stderr", "stdin", "stdout", "strcat", "strchr", "strcmp", "strcpy", "strcspn", "strlen", "strncat", "strncmp", "strncpy", "strpbrk", "strrchr", "strspn", "strstr", "swap", "tan", "tanh", "terminate", "to_underlying", "tolower", "toupper", "vfprintf", "visit", "vprintf", "vsprintf"] 867 | }, 868 | begin: n.concat(/\b/, /(?!decltype)/, /(?!if)/, /(?!for)/, /(?!switch)/, /(?!while)/, e.IDENT_RE, n.lookahead(/(<[^<>]+>|)\s*\(/)) 869 | }, m = [b, c, s, t, e.C_BLOCK_COMMENT_MODE, l, o], p = { 870 | variants: [{ begin: /=/, end: /;/ }, { 871 | begin: /\(/, end: /\)/ 872 | }, { beginKeywords: "new throw return else", end: /;/ }], 873 | keywords: u, contains: m.concat([{ 874 | begin: /\(/, end: /\)/, keywords: u, 875 | contains: m.concat(["self"]), relevance: 0 876 | }]), relevance: 0 877 | }, _ = { 878 | className: "function", 879 | begin: "(" + r + "[\\*&\\s]+)+" + g, returnBegin: !0, end: /[{;=]/, excludeEnd: !0, 880 | keywords: u, illegal: /[^\w\s\*&:<>.]/, contains: [{ begin: a, keywords: u, relevance: 0 }, { 881 | begin: g, returnBegin: !0, contains: [d], relevance: 0 882 | }, { begin: /::/, relevance: 0 }, { 883 | begin: /:/, endsWithParent: !0, contains: [o, l] 884 | }, { relevance: 0, match: /,/ }, { 885 | className: "params", begin: /\(/, end: /\)/, keywords: u, relevance: 0, 886 | contains: [t, e.C_BLOCK_COMMENT_MODE, o, l, s, { 887 | begin: /\(/, end: /\)/, keywords: u, 888 | relevance: 0, contains: ["self", t, e.C_BLOCK_COMMENT_MODE, o, l, s] 889 | }] 890 | }, s, t, e.C_BLOCK_COMMENT_MODE, c] 891 | }; return { 892 | name: "C++", 893 | aliases: ["cc", "c++", "h++", "hpp", "hh", "hxx", "cxx"], keywords: u, illegal: "", keywords: u, contains: ["self", s] 898 | }, { begin: e.IDENT_RE + "::", keywords: u }, { 899 | match: [/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/, /\s+/, /\w+/], 900 | className: { 1: "keyword", 3: "title.class" } 901 | }]) 902 | } 903 | }, grmr_csharp: e => { 904 | const n = { 905 | keyword: ["abstract", "as", "base", "break", "case", "catch", "class", "const", "continue", "do", "else", "event", "explicit", "extern", "finally", "fixed", "for", "foreach", "goto", "if", "implicit", "in", "interface", "internal", "is", "lock", "namespace", "new", "operator", "out", "override", "params", "private", "protected", "public", "readonly", "record", "ref", "return", "scoped", "sealed", "sizeof", "stackalloc", "static", "struct", "switch", "this", "throw", "try", "typeof", "unchecked", "unsafe", "using", "virtual", "void", "volatile", "while"].concat(["add", "alias", "and", "ascending", "args", "async", "await", "by", "descending", "dynamic", "equals", "file", "from", "get", "global", "group", "init", "into", "join", "let", "nameof", "not", "notnull", "on", "or", "orderby", "partial", "record", "remove", "required", "scoped", "select", "set", "unmanaged", "value|0", "var", "when", "where", "with", "yield"]), 906 | built_in: ["bool", "byte", "char", "decimal", "delegate", "double", "dynamic", "enum", "float", "int", "long", "nint", "nuint", "object", "sbyte", "short", "string", "ulong", "uint", "ushort"], 907 | literal: ["default", "false", "null", "true"] 908 | }, t = e.inherit(e.TITLE_MODE, { 909 | begin: "[a-zA-Z](\\.?\\w)*" 910 | }), a = { 911 | className: "number", variants: [{ 912 | begin: "\\b(0b[01']+)" 913 | }, { 914 | begin: "(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)" 915 | }, { 916 | begin: "(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" 917 | }], relevance: 0 918 | }, i = { 919 | className: "string", begin: '@"', end: '"', contains: [{ begin: '""' }] 920 | }, r = e.inherit(i, { illegal: /\n/ }), s = { 921 | className: "subst", begin: /\{/, end: /\}/, 922 | keywords: n 923 | }, o = e.inherit(s, { illegal: /\n/ }), l = { 924 | className: "string", begin: /\$"/, 925 | end: '"', illegal: /\n/, contains: [{ begin: /\{\{/ }, { 926 | begin: /\}\}/ 927 | }, e.BACKSLASH_ESCAPE, o] 928 | }, c = { 929 | className: "string", begin: /\$@"/, end: '"', contains: [{ 930 | begin: /\{\{/ 931 | }, { begin: /\}\}/ }, { begin: '""' }, s] 932 | }, d = e.inherit(c, { 933 | illegal: /\n/, 934 | contains: [{ begin: /\{\{/ }, { begin: /\}\}/ }, { begin: '""' }, o] 935 | }) 936 | ; s.contains = [c, l, i, e.APOS_STRING_MODE, e.QUOTE_STRING_MODE, a, e.C_BLOCK_COMMENT_MODE], 937 | o.contains = [d, l, r, e.APOS_STRING_MODE, e.QUOTE_STRING_MODE, a, e.inherit(e.C_BLOCK_COMMENT_MODE, { 938 | illegal: /\n/ 939 | })]; const g = { 940 | variants: [{ 941 | className: "string", 942 | begin: /"""("*)(?!")(.|\n)*?"""\1/, relevance: 1 943 | }, c, l, i, e.APOS_STRING_MODE, e.QUOTE_STRING_MODE] 944 | }, u = { 945 | begin: "<", end: ">", 946 | contains: [{ beginKeywords: "in out" }, t] 947 | }, b = e.IDENT_RE + "(<" + e.IDENT_RE + "(\\s*,\\s*" + e.IDENT_RE + ")*>)?(\\[\\])?", m = { 948 | begin: "@" + e.IDENT_RE, relevance: 0 949 | }; return { 950 | name: "C#", aliases: ["cs", "c#"], 951 | keywords: n, illegal: /::/, contains: [e.COMMENT("///", "$", { 952 | returnBegin: !0, 953 | contains: [{ 954 | className: "doctag", variants: [{ begin: "///", relevance: 0 }, { 955 | begin: "\x3c!--|--\x3e" 956 | }, { begin: "" }] 957 | }] 958 | }), e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE, { 959 | className: "meta", begin: "#", 960 | end: "$", keywords: { 961 | keyword: "if else elif endif define undef warning error line region endregion pragma checksum" 962 | } 963 | }, g, a, { 964 | beginKeywords: "class interface", relevance: 0, end: /[{;=]/, 965 | illegal: /[^\s:,]/, contains: [{ 966 | beginKeywords: "where class" 967 | }, t, u, e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE] 968 | }, { 969 | beginKeywords: "namespace", 970 | relevance: 0, end: /[{;=]/, illegal: /[^\s:]/, 971 | contains: [t, e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE] 972 | }, { 973 | beginKeywords: "record", relevance: 0, end: /[{;=]/, illegal: /[^\s:]/, 974 | contains: [t, u, e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE] 975 | }, { 976 | className: "meta", 977 | begin: "^\\s*\\[(?=[\\w])", excludeBegin: !0, end: "\\]", excludeEnd: !0, contains: [{ 978 | className: "string", begin: /"/, end: /"/ 979 | }] 980 | }, { 981 | beginKeywords: "new return throw await else", relevance: 0 982 | }, { 983 | className: "function", 984 | begin: "(" + b + "\\s+)+" + e.IDENT_RE + "\\s*(<[^=]+>\\s*)?\\(", returnBegin: !0, 985 | end: /\s*[{;=]/, excludeEnd: !0, keywords: n, contains: [{ 986 | beginKeywords: "public private protected static internal protected abstract async extern override unsafe virtual new sealed partial", 987 | relevance: 0 988 | }, { 989 | begin: e.IDENT_RE + "\\s*(<[^=]+>\\s*)?\\(", returnBegin: !0, 990 | contains: [e.TITLE_MODE, u], relevance: 0 991 | }, { match: /\(\)/ }, { 992 | className: "params", 993 | begin: /\(/, end: /\)/, excludeBegin: !0, excludeEnd: !0, keywords: n, relevance: 0, 994 | contains: [g, a, e.C_BLOCK_COMMENT_MODE] 995 | }, e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE] 996 | }, m] 997 | } 998 | }, grmr_css: e => { 999 | const n = e.regex, t = te(e), a = [e.APOS_STRING_MODE, e.QUOTE_STRING_MODE]; return { 1000 | name: "CSS", case_insensitive: !0, illegal: /[=|'\$]/, keywords: { 1001 | keyframePosition: "from to" 1002 | }, classNameAliases: { keyframePosition: "selector-tag" }, 1003 | contains: [t.BLOCK_COMMENT, { 1004 | begin: /-(webkit|moz|ms|o)-(?=[a-z])/ 1005 | }, t.CSS_NUMBER_MODE, { 1006 | className: "selector-id", begin: /#[A-Za-z0-9_-]+/, relevance: 0 1007 | }, { 1008 | className: "selector-class", begin: "\\.[a-zA-Z-][a-zA-Z0-9_-]*", relevance: 0 1009 | }, t.ATTRIBUTE_SELECTOR_MODE, { 1010 | className: "selector-pseudo", variants: [{ 1011 | begin: ":(" + re.join("|") + ")" 1012 | }, { begin: ":(:)?(" + se.join("|") + ")" }] 1013 | }, t.CSS_VARIABLE, { className: "attribute", begin: "\\b(" + oe.join("|") + ")\\b" }, { 1014 | begin: /:/, end: /[;}{]/, 1015 | contains: [t.BLOCK_COMMENT, t.HEXCOLOR, t.IMPORTANT, t.CSS_NUMBER_MODE, ...a, { 1016 | begin: /(url|data-uri)\(/, end: /\)/, relevance: 0, keywords: { 1017 | built_in: "url data-uri" 1018 | }, contains: [...a, { 1019 | className: "string", begin: /[^)]/, endsWithParent: !0, 1020 | excludeEnd: !0 1021 | }] 1022 | }, t.FUNCTION_DISPATCH] 1023 | }, { 1024 | begin: n.lookahead(/@/), end: "[{;]", 1025 | relevance: 0, illegal: /:/, contains: [{ 1026 | className: "keyword", begin: /@-?\w[\w]*(-\w+)*/ 1027 | }, { 1028 | begin: /\s/, endsWithParent: !0, excludeEnd: !0, relevance: 0, keywords: { 1029 | $pattern: /[a-z-]+/, keyword: "and or not only", attribute: ie.join(" ") 1030 | }, contains: [{ 1031 | begin: /[a-z-]+(?=:)/, className: "attribute" 1032 | }, ...a, t.CSS_NUMBER_MODE] 1033 | }] 1034 | }, { 1035 | className: "selector-tag", begin: "\\b(" + ae.join("|") + ")\\b" 1036 | }] 1037 | } 1038 | }, grmr_diff: e => { 1039 | const n = e.regex; return { 1040 | name: "Diff", aliases: ["patch"], contains: [{ 1041 | className: "meta", relevance: 10, 1042 | match: n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/, /^\*\*\* +\d+,\d+ +\*\*\*\*$/, /^--- +\d+,\d+ +----$/) 1043 | }, { 1044 | className: "comment", variants: [{ 1045 | begin: n.either(/Index: /, /^index/, /={3,}/, /^-{3}/, /^\*{3} /, /^\+{3}/, /^diff --git/), 1046 | end: /$/ 1047 | }, { match: /^\*{15}$/ }] 1048 | }, { className: "addition", begin: /^\+/, end: /$/ }, { 1049 | className: "deletion", begin: /^-/, end: /$/ 1050 | }, { 1051 | className: "addition", begin: /^!/, 1052 | end: /$/ 1053 | }] 1054 | } 1055 | }, grmr_go: e => { 1056 | const n = { 1057 | keyword: ["break", "case", "chan", "const", "continue", "default", "defer", "else", "fallthrough", "for", "func", "go", "goto", "if", "import", "interface", "map", "package", "range", "return", "select", "struct", "switch", "type", "var"], 1058 | type: ["bool", "byte", "complex64", "complex128", "error", "float32", "float64", "int8", "int16", "int32", "int64", "string", "uint8", "uint16", "uint32", "uint64", "int", "uint", "uintptr", "rune"], 1059 | literal: ["true", "false", "iota", "nil"], 1060 | built_in: ["append", "cap", "close", "complex", "copy", "imag", "len", "make", "new", "panic", "print", "println", "real", "recover", "delete"] 1061 | }; return { 1062 | name: "Go", aliases: ["golang"], keywords: n, illegal: " { 1088 | const n = e.regex 1089 | ; return { 1090 | name: "GraphQL", aliases: ["gql"], case_insensitive: !0, disableAutodetect: !1, 1091 | keywords: { 1092 | keyword: ["query", "mutation", "subscription", "type", "input", "schema", "directive", "interface", "union", "scalar", "fragment", "enum", "on"], 1093 | literal: ["true", "false", "null"] 1094 | }, 1095 | contains: [e.HASH_COMMENT_MODE, e.QUOTE_STRING_MODE, e.NUMBER_MODE, { 1096 | scope: "punctuation", match: /[.]{3}/, relevance: 0 1097 | }, { 1098 | scope: "punctuation", 1099 | begin: /[\!\(\)\:\=\[\]\{\|\}]{1}/, relevance: 0 1100 | }, { 1101 | scope: "variable", begin: /\$/, 1102 | end: /\W/, excludeEnd: !0, relevance: 0 1103 | }, { scope: "meta", match: /@\w+/, excludeEnd: !0 }, { 1104 | scope: "symbol", begin: n.concat(/[_A-Za-z][_0-9A-Za-z]*/, n.lookahead(/\s*:/)), 1105 | relevance: 0 1106 | }], illegal: [/[;<']/, /BEGIN/] 1107 | } 1108 | }, grmr_ini: e => { 1109 | const n = e.regex, t = { 1110 | className: "number", relevance: 0, variants: [{ begin: /([+-]+)?[\d]+_[\d_]+/ }, { 1111 | begin: e.NUMBER_RE 1112 | }] 1113 | }, a = e.COMMENT(); a.variants = [{ begin: /;/, end: /$/ }, { 1114 | begin: /#/, 1115 | end: /$/ 1116 | }]; const i = { 1117 | className: "variable", variants: [{ begin: /\$[\w\d"][\w\d_]*/ }, { 1118 | begin: /\$\{(.*?)\}/ 1119 | }] 1120 | }, r = { 1121 | className: "literal", 1122 | begin: /\bon|off|true|false|yes|no\b/ 1123 | }, s = { 1124 | className: "string", 1125 | contains: [e.BACKSLASH_ESCAPE], variants: [{ begin: "'''", end: "'''", relevance: 10 }, { 1126 | begin: '"""', end: '"""', relevance: 10 1127 | }, { begin: '"', end: '"' }, { begin: "'", end: "'" }] 1128 | }, o = { 1129 | begin: /\[/, end: /\]/, contains: [a, r, i, s, t, "self"], relevance: 0 1130 | }, l = n.either(/[A-Za-z0-9_-]+/, /"(\\"|[^"])*"/, /'[^']*'/); return { 1131 | name: "TOML, also INI", aliases: ["toml"], case_insensitive: !0, illegal: /\S/, 1132 | contains: [a, { className: "section", begin: /\[+/, end: /\]+/ }, { 1133 | begin: n.concat(l, "(\\s*\\.\\s*", l, ")*", n.lookahead(/\s*=\s*[^#\s]/)), 1134 | className: "attr", starts: { end: /$/, contains: [a, o, r, i, s, t] } 1135 | }] 1136 | } 1137 | }, grmr_java: e => { 1138 | const n = e.regex, t = "[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*", a = t + be("(?:<" + t + "~~~(?:\\s*,\\s*" + t + "~~~)*>)?", /~~~/g, 2), i = { 1139 | keyword: ["synchronized", "abstract", "private", "var", "static", "if", "const ", "for", "while", "strictfp", "finally", "protected", "import", "native", "final", "void", "enum", "else", "break", "transient", "catch", "instanceof", "volatile", "case", "assert", "package", "default", "public", "try", "switch", "continue", "throws", "protected", "public", "private", "module", "requires", "exports", "do", "sealed", "yield", "permits", "goto", "when"], 1140 | literal: ["false", "true", "null"], 1141 | type: ["char", "boolean", "long", "float", "int", "byte", "short", "double"], 1142 | built_in: ["super", "this"] 1143 | }, r = { 1144 | className: "meta", begin: "@" + t, contains: [{ 1145 | begin: /\(/, end: /\)/, contains: ["self"] 1146 | }] 1147 | }, s = { 1148 | className: "params", begin: /\(/, 1149 | end: /\)/, keywords: i, relevance: 0, contains: [e.C_BLOCK_COMMENT_MODE], endsParent: !0 1150 | } 1151 | ; return { 1152 | name: "Java", aliases: ["jsp"], keywords: i, illegal: /<\/|#/, 1153 | contains: [e.COMMENT("/\\*\\*", "\\*/", { 1154 | relevance: 0, contains: [{ 1155 | begin: /\w+@/, 1156 | relevance: 0 1157 | }, { className: "doctag", begin: "@[A-Za-z]+" }] 1158 | }), { 1159 | begin: /import java\.[a-z]+\./, keywords: "import", relevance: 2 1160 | }, e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE, { 1161 | begin: /"""/, end: /"""/, 1162 | className: "string", contains: [e.BACKSLASH_ESCAPE] 1163 | }, e.APOS_STRING_MODE, e.QUOTE_STRING_MODE, { 1164 | match: [/\b(?:class|interface|enum|extends|implements|new)/, /\s+/, t], className: { 1165 | 1: "keyword", 3: "title.class" 1166 | } 1167 | }, { match: /non-sealed/, scope: "keyword" }, { 1168 | begin: [n.concat(/(?!else)/, t), /\s+/, t, /\s+/, /=(?!=)/], className: { 1169 | 1: "type", 1170 | 3: "variable", 5: "operator" 1171 | } 1172 | }, { 1173 | begin: [/record/, /\s+/, t], className: { 1174 | 1: "keyword", 1175 | 3: "title.class" 1176 | }, contains: [s, e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE] 1177 | }, { 1178 | beginKeywords: "new throw return else", relevance: 0 1179 | }, { 1180 | begin: ["(?:" + a + "\\s+)", e.UNDERSCORE_IDENT_RE, /\s*(?=\()/], className: { 1181 | 2: "title.function" 1182 | }, keywords: i, contains: [{ 1183 | className: "params", begin: /\(/, 1184 | end: /\)/, keywords: i, relevance: 0, 1185 | contains: [r, e.APOS_STRING_MODE, e.QUOTE_STRING_MODE, ue, e.C_BLOCK_COMMENT_MODE] 1186 | }, e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE] 1187 | }, ue, r] 1188 | } 1189 | }, grmr_javascript: ve, 1190 | grmr_json: e => { 1191 | const n = ["true", "false", "null"], t = { 1192 | scope: "literal", 1193 | beginKeywords: n.join(" ") 1194 | }; return { 1195 | name: "JSON", aliases: ["jsonc"], keywords: { 1196 | literal: n 1197 | }, contains: [{ 1198 | className: "attr", begin: /"(\\.|[^\\"\r\n])*"(?=\s*:)/, 1199 | relevance: 1.01 1200 | }, { 1201 | match: /[{}[\],:]/, className: "punctuation", relevance: 0 1202 | }, e.QUOTE_STRING_MODE, t, e.C_NUMBER_MODE, e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE], 1203 | illegal: "\\S" 1204 | } 1205 | }, grmr_kotlin: e => { 1206 | const n = { 1207 | keyword: "abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual", 1208 | built_in: "Byte Short Char Int Long Boolean Float Double Void Unit Nothing", 1209 | literal: "true false null" 1210 | }, t = { 1211 | className: "symbol", begin: e.UNDERSCORE_IDENT_RE + "@" 1212 | }, a = { className: "subst", begin: /\$\{/, end: /\}/, contains: [e.C_NUMBER_MODE] }, i = { 1213 | className: "variable", begin: "\\$" + e.UNDERSCORE_IDENT_RE 1214 | }, r = { 1215 | className: "string", 1216 | variants: [{ begin: '"""', end: '"""(?=[^"])', contains: [i, a] }, { 1217 | begin: "'", end: "'", 1218 | illegal: /\n/, contains: [e.BACKSLASH_ESCAPE] 1219 | }, { 1220 | begin: '"', end: '"', illegal: /\n/, 1221 | contains: [e.BACKSLASH_ESCAPE, i, a] 1222 | }] 1223 | }; a.contains.push(r); const s = { 1224 | className: "meta", 1225 | begin: "@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*" + e.UNDERSCORE_IDENT_RE + ")?" 1226 | }, o = { 1227 | className: "meta", begin: "@" + e.UNDERSCORE_IDENT_RE, contains: [{ 1228 | begin: /\(/, 1229 | end: /\)/, contains: [e.inherit(r, { className: "string" }), "self"] 1230 | }] 1231 | }, l = ue, c = e.COMMENT("/\\*", "\\*/", { contains: [e.C_BLOCK_COMMENT_MODE] }), d = { 1232 | variants: [{ className: "type", begin: e.UNDERSCORE_IDENT_RE }, { 1233 | begin: /\(/, end: /\)/, 1234 | contains: [] 1235 | }] 1236 | }, g = d; return g.variants[1].contains = [d], d.variants[1].contains = [g], 1237 | { 1238 | name: "Kotlin", aliases: ["kt", "kts"], keywords: n, 1239 | contains: [e.COMMENT("/\\*\\*", "\\*/", { 1240 | relevance: 0, contains: [{ 1241 | className: "doctag", 1242 | begin: "@[A-Za-z]+" 1243 | }] 1244 | }), e.C_LINE_COMMENT_MODE, c, { 1245 | className: "keyword", 1246 | begin: /\b(break|continue|return|this)\b/, starts: { 1247 | contains: [{ 1248 | className: "symbol", 1249 | begin: /@\w+/ 1250 | }] 1251 | } 1252 | }, t, s, o, { 1253 | className: "function", beginKeywords: "fun", end: "[(]|$", 1254 | returnBegin: !0, excludeEnd: !0, keywords: n, relevance: 5, contains: [{ 1255 | begin: e.UNDERSCORE_IDENT_RE + "\\s*\\(", returnBegin: !0, relevance: 0, 1256 | contains: [e.UNDERSCORE_TITLE_MODE] 1257 | }, { 1258 | className: "type", begin: //, 1259 | keywords: "reified", relevance: 0 1260 | }, { 1261 | className: "params", begin: /\(/, end: /\)/, 1262 | endsParent: !0, keywords: n, relevance: 0, contains: [{ 1263 | begin: /:/, end: /[=,\/]/, 1264 | endsWithParent: !0, contains: [d, e.C_LINE_COMMENT_MODE, c], relevance: 0 1265 | }, e.C_LINE_COMMENT_MODE, c, s, o, r, e.C_NUMBER_MODE] 1266 | }, c] 1267 | }, { 1268 | begin: [/class|interface|trait/, /\s+/, e.UNDERSCORE_IDENT_RE], beginScope: { 1269 | 3: "title.class" 1270 | }, keywords: "class interface trait", end: /[:\{(]|$/, excludeEnd: !0, 1271 | illegal: "extends implements", contains: [{ 1272 | beginKeywords: "public protected internal private constructor" 1273 | }, e.UNDERSCORE_TITLE_MODE, { 1274 | className: "type", begin: //, excludeBegin: !0, 1275 | excludeEnd: !0, relevance: 0 1276 | }, { 1277 | className: "type", begin: /[,:]\s*/, end: /[<\(,){\s]|$/, 1278 | excludeBegin: !0, returnEnd: !0 1279 | }, s, o] 1280 | }, r, { 1281 | className: "meta", begin: "^#!/usr/bin/env", 1282 | end: "$", illegal: "\n" 1283 | }, l] 1284 | } 1285 | }, grmr_less: e => { 1286 | const n = te(e), t = le, a = "[\\w-]+", i = "(" + a + "|@\\{" + a + "\\})", r = [], s = [], o = e => ({ 1287 | className: "string", begin: "~?" + e + ".*?" + e 1288 | }), l = (e, n, t) => ({ 1289 | className: e, begin: n, 1290 | relevance: t 1291 | }), c = { 1292 | $pattern: /[a-z-]+/, keyword: "and or not only", 1293 | attribute: ie.join(" ") 1294 | }, d = { 1295 | begin: "\\(", end: "\\)", contains: s, keywords: c, 1296 | relevance: 0 1297 | } 1298 | ; s.push(e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE, o("'"), o('"'), n.CSS_NUMBER_MODE, { 1299 | begin: "(url|data-uri)\\(", starts: { 1300 | className: "string", end: "[\\)\\n]", 1301 | excludeEnd: !0 1302 | } 1303 | }, n.HEXCOLOR, d, l("variable", "@@?" + a, 10), l("variable", "@\\{" + a + "\\}"), l("built_in", "~?`[^`]*?`"), { 1304 | className: "attribute", begin: a + "\\s*:", end: ":", returnBegin: !0, excludeEnd: !0 1305 | }, n.IMPORTANT, { beginKeywords: "and not" }, n.FUNCTION_DISPATCH); const g = s.concat({ 1306 | begin: /\{/, end: /\}/, contains: r 1307 | }), u = { 1308 | beginKeywords: "when", endsWithParent: !0, 1309 | contains: [{ beginKeywords: "and not" }].concat(s) 1310 | }, b = { 1311 | begin: i + "\\s*:", 1312 | returnBegin: !0, end: /[;}]/, relevance: 0, contains: [{ 1313 | begin: /-(webkit|moz|ms|o)-/ 1314 | }, n.CSS_VARIABLE, { 1315 | className: "attribute", begin: "\\b(" + oe.join("|") + ")\\b", 1316 | end: /(?=:)/, starts: { endsWithParent: !0, illegal: "[<=$]", relevance: 0, contains: s } 1317 | }] 1318 | }, m = { 1319 | className: "keyword", 1320 | begin: "@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b", 1321 | starts: { end: "[;{}]", keywords: c, returnEnd: !0, contains: s, relevance: 0 } 1322 | }, p = { 1323 | className: "variable", variants: [{ begin: "@" + a + "\\s*:", relevance: 15 }, { 1324 | begin: "@" + a 1325 | }], starts: { end: "[;}]", returnEnd: !0, contains: g } 1326 | }, _ = { 1327 | variants: [{ 1328 | begin: "[\\.#:&\\[>]", end: "[;{}]" 1329 | }, { begin: i, end: /\{/ }], returnBegin: !0, 1330 | returnEnd: !0, illegal: "[<='$\"]", relevance: 0, 1331 | contains: [e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE, u, l("keyword", "all\\b"), l("variable", "@\\{" + a + "\\}"), { 1332 | begin: "\\b(" + ae.join("|") + ")\\b", className: "selector-tag" 1333 | }, n.CSS_NUMBER_MODE, l("selector-tag", i, 0), l("selector-id", "#" + i), l("selector-class", "\\." + i, 0), l("selector-tag", "&", 0), n.ATTRIBUTE_SELECTOR_MODE, { 1334 | className: "selector-pseudo", begin: ":(" + re.join("|") + ")" 1335 | }, { 1336 | className: "selector-pseudo", begin: ":(:)?(" + se.join("|") + ")" 1337 | }, { 1338 | begin: /\(/, 1339 | end: /\)/, relevance: 0, contains: g 1340 | }, { begin: "!important" }, n.FUNCTION_DISPATCH] 1341 | }, h = { 1342 | begin: a + ":(:)?" + `(${t.join("|")})`, returnBegin: !0, contains: [_] 1343 | } 1344 | ; return r.push(e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE, m, p, h, b, _, u, n.FUNCTION_DISPATCH), 1345 | { name: "Less", case_insensitive: !0, illegal: "[=>'/<($\"]", contains: r } 1346 | }, 1347 | grmr_lua: e => { 1348 | const n = "\\[=*\\[", t = "\\]=*\\]", a = { 1349 | begin: n, end: t, contains: ["self"] 1350 | }, i = [e.COMMENT("--(?!" + n + ")", "$"), e.COMMENT("--" + n, t, { 1351 | contains: [a], relevance: 10 1352 | })]; return { 1353 | name: "Lua", aliases: ["pluto"], keywords: { 1354 | $pattern: e.UNDERSCORE_IDENT_RE, literal: "true false nil", 1355 | keyword: "and break do else elseif end for goto if in local not or repeat return then until while", 1356 | built_in: "_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove" 1357 | }, contains: i.concat([{ 1358 | className: "function", beginKeywords: "function", end: "\\)", 1359 | contains: [e.inherit(e.TITLE_MODE, { 1360 | begin: "([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*" 1361 | }), { 1362 | className: "params", 1363 | begin: "\\(", endsWithParent: !0, contains: i 1364 | }].concat(i) 1365 | }, e.C_NUMBER_MODE, e.APOS_STRING_MODE, e.QUOTE_STRING_MODE, { 1366 | className: "string", 1367 | begin: n, end: t, contains: [a], relevance: 5 1368 | }]) 1369 | } 1370 | }, grmr_makefile: e => { 1371 | const n = { 1372 | className: "variable", variants: [{ 1373 | begin: "\\$\\(" + e.UNDERSCORE_IDENT_RE + "\\)", 1374 | contains: [e.BACKSLASH_ESCAPE] 1375 | }, { begin: /\$[@% { 1396 | const n = { begin: /<\/?[A-Za-z_]/, end: ">", subLanguage: "xml", relevance: 0 }, t = { 1397 | variants: [{ begin: /\[.+?\]\[.*?\]/, relevance: 0 }, { 1398 | begin: /\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/, 1399 | relevance: 2 1400 | }, { 1401 | begin: e.regex.concat(/\[.+?\]\(/, /[A-Za-z][A-Za-z0-9+.-]*/, /:\/\/.*?\)/), 1402 | relevance: 2 1403 | }, { begin: /\[.+?\]\([./?&#].*?\)/, relevance: 1 }, { 1404 | begin: /\[.*?\]\(.*?\)/, relevance: 0 1405 | }], returnBegin: !0, contains: [{ 1406 | match: /\[(?=\])/ 1407 | }, { 1408 | className: "string", relevance: 0, begin: "\\[", end: "\\]", excludeBegin: !0, 1409 | returnEnd: !0 1410 | }, { 1411 | className: "link", relevance: 0, begin: "\\]\\(", end: "\\)", 1412 | excludeBegin: !0, excludeEnd: !0 1413 | }, { 1414 | className: "symbol", relevance: 0, begin: "\\]\\[", 1415 | end: "\\]", excludeBegin: !0, excludeEnd: !0 1416 | }] 1417 | }, a = { 1418 | className: "strong", contains: [], 1419 | variants: [{ begin: /_{2}(?!\s)/, end: /_{2}/ }, { begin: /\*{2}(?!\s)/, end: /\*{2}/ }] 1420 | }, i = { 1421 | className: "emphasis", contains: [], variants: [{ begin: /\*(?![*\s])/, end: /\*/ }, { 1422 | begin: /_(?![_\s])/, end: /_/, relevance: 0 1423 | }] 1424 | }, r = e.inherit(a, { 1425 | contains: [] 1426 | }), s = e.inherit(i, { contains: [] }); a.contains.push(s), i.contains.push(r) 1427 | ; let o = [n, t]; return [a, i, r, s].forEach((e => { 1428 | e.contains = e.contains.concat(o) 1429 | })), o = o.concat(a, i), { 1430 | name: "Markdown", aliases: ["md", "mkdown", "mkd"], contains: [{ 1431 | className: "section", variants: [{ begin: "^#{1,6}", end: "$", contains: o }, { 1432 | begin: "(?=^.+?\\n[=-]{2,}$)", contains: [{ begin: "^[=-]*$" }, { 1433 | begin: "^", end: "\\n", 1434 | contains: o 1435 | }] 1436 | }] 1437 | }, n, { 1438 | className: "bullet", begin: "^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)", 1439 | end: "\\s+", excludeEnd: !0 1440 | }, a, i, { 1441 | className: "quote", begin: "^>\\s+", contains: o, 1442 | end: "$" 1443 | }, { 1444 | className: "code", variants: [{ begin: "(`{3,})[^`](.|\\n)*?\\1`*[ ]*" }, { 1445 | begin: "(~{3,})[^~](.|\\n)*?\\1~*[ ]*" 1446 | }, { begin: "```", end: "```+[ ]*$" }, { 1447 | begin: "~~~", end: "~~~+[ ]*$" 1448 | }, { begin: "`.+?`" }, { 1449 | begin: "(?=^( {4}|\\t))", 1450 | contains: [{ begin: "^( {4}|\\t)", end: "(\\n)$" }], relevance: 0 1451 | }] 1452 | }, { 1453 | begin: "^[-\\*]{3,}", end: "$" 1454 | }, t, { 1455 | begin: /^\[[^\n]+\]:/, returnBegin: !0, contains: [{ 1456 | className: "symbol", begin: /\[/, end: /\]/, excludeBegin: !0, excludeEnd: !0 1457 | }, { 1458 | className: "link", begin: /:\s*/, end: /$/, excludeBegin: !0 1459 | }] 1460 | }, { 1461 | scope: "literal", 1462 | match: /&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/ 1463 | }] 1464 | } 1465 | }, 1466 | grmr_objectivec: e => { 1467 | const n = /[a-zA-Z@][a-zA-Z0-9_]*/, t = { 1468 | $pattern: n, 1469 | keyword: ["@interface", "@class", "@protocol", "@implementation"] 1470 | }; return { 1471 | name: "Objective-C", aliases: ["mm", "objc", "obj-c", "obj-c++", "objective-c++"], 1472 | keywords: { 1473 | "variable.language": ["this", "super"], $pattern: n, 1474 | keyword: ["while", "export", "sizeof", "typedef", "const", "struct", "for", "union", "volatile", "static", "mutable", "if", "do", "return", "goto", "enum", "else", "break", "extern", "asm", "case", "default", "register", "explicit", "typename", "switch", "continue", "inline", "readonly", "assign", "readwrite", "self", "@synchronized", "id", "typeof", "nonatomic", "IBOutlet", "IBAction", "strong", "weak", "copy", "in", "out", "inout", "bycopy", "byref", "oneway", "__strong", "__weak", "__block", "__autoreleasing", "@private", "@protected", "@public", "@try", "@property", "@end", "@throw", "@catch", "@finally", "@autoreleasepool", "@synthesize", "@dynamic", "@selector", "@optional", "@required", "@encode", "@package", "@import", "@defs", "@compatibility_alias", "__bridge", "__bridge_transfer", "__bridge_retained", "__bridge_retain", "__covariant", "__contravariant", "__kindof", "_Nonnull", "_Nullable", "_Null_unspecified", "__FUNCTION__", "__PRETTY_FUNCTION__", "__attribute__", "getter", "setter", "retain", "unsafe_unretained", "nonnull", "nullable", "null_unspecified", "null_resettable", "class", "instancetype", "NS_DESIGNATED_INITIALIZER", "NS_UNAVAILABLE", "NS_REQUIRES_SUPER", "NS_RETURNS_INNER_POINTER", "NS_INLINE", "NS_AVAILABLE", "NS_DEPRECATED", "NS_ENUM", "NS_OPTIONS", "NS_SWIFT_UNAVAILABLE", "NS_ASSUME_NONNULL_BEGIN", "NS_ASSUME_NONNULL_END", "NS_REFINED_FOR_SWIFT", "NS_SWIFT_NAME", "NS_SWIFT_NOTHROW", "NS_DURING", "NS_HANDLER", "NS_ENDHANDLER", "NS_VALUERETURN", "NS_VOIDRETURN"], 1475 | literal: ["false", "true", "FALSE", "TRUE", "nil", "YES", "NO", "NULL"], 1476 | built_in: ["dispatch_once_t", "dispatch_queue_t", "dispatch_sync", "dispatch_async", "dispatch_once"], 1477 | type: ["int", "float", "char", "unsigned", "signed", "short", "long", "double", "wchar_t", "unichar", "void", "bool", "BOOL", "id|0", "_Bool"] 1478 | }, illegal: "/, end: /$/, illegal: "\\n" 1494 | }, e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE] 1495 | }, { 1496 | className: "class", 1497 | begin: "(" + t.keyword.join("|") + ")\\b", end: /(\{|$)/, excludeEnd: !0, keywords: t, 1498 | contains: [e.UNDERSCORE_TITLE_MODE] 1499 | }, { 1500 | begin: "\\." + e.UNDERSCORE_IDENT_RE, 1501 | relevance: 0 1502 | }] 1503 | } 1504 | }, grmr_perl: e => { 1505 | const n = e.regex, t = /[dualxmsipngr]{0,12}/, a = { 1506 | $pattern: /[\w.]+/, 1507 | keyword: "abs accept alarm and atan2 bind binmode bless break caller chdir chmod chomp chop chown chr chroot class close closedir connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl field fileno flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat lt ma map method mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q|0 qq quotemeta qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x|0 xor y|0" 1508 | }, i = { className: "subst", begin: "[$@]\\{", end: "\\}", keywords: a }, r = { 1509 | begin: /->\{/, 1510 | end: /\}/ 1511 | }, s = { scope: "attr", match: /\s+:\s*\w+(\s*\(.*?\))?/ }, o = { 1512 | scope: "variable", 1513 | variants: [{ begin: /\$\d/ }, { 1514 | begin: n.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/, "(?![A-Za-z])(?![@$%])") 1515 | }, { begin: /[$%@](?!")[^\s\w{=]|\$=/, relevance: 0 }], contains: [s] 1516 | }, l = { 1517 | className: "number", variants: [{ match: /0?\.[0-9][0-9_]+\b/ }, { 1518 | match: /\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/ 1519 | }, { 1520 | match: /\b0[0-7][0-7_]*\b/ 1521 | }, { match: /\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/ }, { 1522 | match: /\b0b[0-1][0-1_]*\b/ 1523 | }], relevance: 0 1524 | }, c = [e.BACKSLASH_ESCAPE, i, o], d = [/!/, /\//, /\|/, /\?/, /'/, /"/, /#/], g = (e, a, i = "\\1") => { 1525 | const r = "\\1" === i ? i : n.concat(i, a) 1526 | ; return n.concat(n.concat("(?:", e, ")"), a, /(?:\\.|[^\\\/])*?/, r, /(?:\\.|[^\\\/])*?/, i, t) 1527 | }, u = (e, a, i) => n.concat(n.concat("(?:", e, ")"), a, /(?:\\.|[^\\\/])*?/, i, t), b = [o, e.HASH_COMMENT_MODE, e.COMMENT(/^=\w/, /=cut/, { 1528 | endsWithParent: !0 1529 | }), r, { 1530 | className: "string", contains: c, variants: [{ 1531 | begin: "q[qwxr]?\\s*\\(", end: "\\)", relevance: 5 1532 | }, { 1533 | begin: "q[qwxr]?\\s*\\[", 1534 | end: "\\]", relevance: 5 1535 | }, { begin: "q[qwxr]?\\s*\\{", end: "\\}", relevance: 5 }, { 1536 | begin: "q[qwxr]?\\s*\\|", end: "\\|", relevance: 5 1537 | }, { 1538 | begin: "q[qwxr]?\\s*<", end: ">", 1539 | relevance: 5 1540 | }, { begin: "qw\\s+q", end: "q", relevance: 5 }, { 1541 | begin: "'", end: "'", 1542 | contains: [e.BACKSLASH_ESCAPE] 1543 | }, { begin: '"', end: '"' }, { 1544 | begin: "`", end: "`", 1545 | contains: [e.BACKSLASH_ESCAPE] 1546 | }, { begin: /\{\w+\}/, relevance: 0 }, { 1547 | begin: "-?\\w+\\s*=>", relevance: 0 1548 | }] 1549 | }, l, { 1550 | begin: "(\\/\\/|" + e.RE_STARTERS_RE + "|\\b(split|return|print|reverse|grep)\\b)\\s*", 1551 | keywords: "split return print reverse grep", relevance: 0, 1552 | contains: [e.HASH_COMMENT_MODE, { 1553 | className: "regexp", variants: [{ 1554 | begin: g("s|tr|y", n.either(...d, { capture: !0 })) 1555 | }, { begin: g("s|tr|y", "\\(", "\\)") }, { 1556 | begin: g("s|tr|y", "\\[", "\\]") 1557 | }, { begin: g("s|tr|y", "\\{", "\\}") }], relevance: 2 1558 | }, { 1559 | className: "regexp", variants: [{ begin: /(m|qr)\/\//, relevance: 0 }, { 1560 | begin: u("(?:m|qr)?", /\//, /\//) 1561 | }, { 1562 | begin: u("m|qr", n.either(...d, { 1563 | capture: !0 1564 | }), /\1/) 1565 | }, { begin: u("m|qr", /\(/, /\)/) }, { begin: u("m|qr", /\[/, /\]/) }, { 1566 | begin: u("m|qr", /\{/, /\}/) 1567 | }] 1568 | }] 1569 | }, { 1570 | className: "function", beginKeywords: "sub method", 1571 | end: "(\\s*\\(.*?\\))?[;{]", excludeEnd: !0, relevance: 5, contains: [e.TITLE_MODE, s] 1572 | }, { 1573 | className: "class", beginKeywords: "class", end: "[;{]", excludeEnd: !0, relevance: 5, 1574 | contains: [e.TITLE_MODE, s, l] 1575 | }, { begin: "-\\w\\b", relevance: 0 }, { 1576 | begin: "^__DATA__$", 1577 | end: "^__END__$", subLanguage: "mojolicious", contains: [{ 1578 | begin: "^@@.*", end: "$", 1579 | className: "comment" 1580 | }] 1581 | }]; return i.contains = b, r.contains = b, { 1582 | name: "Perl", 1583 | aliases: ["pl", "pm"], keywords: a, contains: b 1584 | } 1585 | }, grmr_php: e => { 1586 | const n = e.regex, t = /(?![A-Za-z0-9])(?![$])/, a = n.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/, t), i = n.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/, t), r = n.concat(/[A-Z]+/, t), s = { 1587 | scope: "variable", match: "\\$+" + a 1588 | }, o = { 1589 | scope: "subst", variants: [{ begin: /\$\w+/ }, { 1590 | begin: /\{\$/, end: /\}/ 1591 | }] 1592 | }, l = e.inherit(e.APOS_STRING_MODE, { 1593 | illegal: null 1594 | }), c = "[ \t\n]", d = { 1595 | scope: "string", variants: [e.inherit(e.QUOTE_STRING_MODE, { 1596 | illegal: null, contains: e.QUOTE_STRING_MODE.contains.concat(o) 1597 | }), l, { 1598 | begin: /<<<[ \t]*(?:(\w+)|"(\w+)")\n/, end: /[ \t]*(\w+)\b/, 1599 | contains: e.QUOTE_STRING_MODE.contains.concat(o), "on:begin": (e, n) => { 1600 | n.data._beginMatch = e[1] || e[2] 1601 | }, "on:end": (e, n) => { 1602 | n.data._beginMatch !== e[1] && n.ignoreMatch() 1603 | } 1604 | }, e.END_SAME_AS_BEGIN({ 1605 | begin: /<<<[ \t]*'(\w+)'\n/, end: /[ \t]*(\w+)\b/ 1606 | })] 1607 | }, g = { 1608 | scope: "number", variants: [{ 1609 | begin: "\\b0[bB][01]+(?:_[01]+)*\\b" 1610 | }, { begin: "\\b0[oO][0-7]+(?:_[0-7]+)*\\b" }, { 1611 | begin: "\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b" 1612 | }, { 1613 | begin: "(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?" 1614 | }], relevance: 0 1615 | }, u = ["false", "null", "true"], b = ["__CLASS__", "__DIR__", "__FILE__", "__FUNCTION__", "__COMPILER_HALT_OFFSET__", "__LINE__", "__METHOD__", "__NAMESPACE__", "__TRAIT__", "die", "echo", "exit", "include", "include_once", "print", "require", "require_once", "array", "abstract", "and", "as", "binary", "bool", "boolean", "break", "callable", "case", "catch", "class", "clone", "const", "continue", "declare", "default", "do", "double", "else", "elseif", "empty", "enddeclare", "endfor", "endforeach", "endif", "endswitch", "endwhile", "enum", "eval", "extends", "final", "finally", "float", "for", "foreach", "from", "global", "goto", "if", "implements", "instanceof", "insteadof", "int", "integer", "interface", "isset", "iterable", "list", "match|0", "mixed", "new", "never", "object", "or", "private", "protected", "public", "readonly", "real", "return", "string", "switch", "throw", "trait", "try", "unset", "use", "var", "void", "while", "xor", "yield"], m = ["Error|0", "AppendIterator", "ArgumentCountError", "ArithmeticError", "ArrayIterator", "ArrayObject", "AssertionError", "BadFunctionCallException", "BadMethodCallException", "CachingIterator", "CallbackFilterIterator", "CompileError", "Countable", "DirectoryIterator", "DivisionByZeroError", "DomainException", "EmptyIterator", "ErrorException", "Exception", "FilesystemIterator", "FilterIterator", "GlobIterator", "InfiniteIterator", "InvalidArgumentException", "IteratorIterator", "LengthException", "LimitIterator", "LogicException", "MultipleIterator", "NoRewindIterator", "OutOfBoundsException", "OutOfRangeException", "OuterIterator", "OverflowException", "ParentIterator", "ParseError", "RangeException", "RecursiveArrayIterator", "RecursiveCachingIterator", "RecursiveCallbackFilterIterator", "RecursiveDirectoryIterator", "RecursiveFilterIterator", "RecursiveIterator", "RecursiveIteratorIterator", "RecursiveRegexIterator", "RecursiveTreeIterator", "RegexIterator", "RuntimeException", "SeekableIterator", "SplDoublyLinkedList", "SplFileInfo", "SplFileObject", "SplFixedArray", "SplHeap", "SplMaxHeap", "SplMinHeap", "SplObjectStorage", "SplObserver", "SplPriorityQueue", "SplQueue", "SplStack", "SplSubject", "SplTempFileObject", "TypeError", "UnderflowException", "UnexpectedValueException", "UnhandledMatchError", "ArrayAccess", "BackedEnum", "Closure", "Fiber", "Generator", "Iterator", "IteratorAggregate", "Serializable", "Stringable", "Throwable", "Traversable", "UnitEnum", "WeakReference", "WeakMap", "Directory", "__PHP_Incomplete_Class", "parent", "php_user_filter", "self", "static", "stdClass"], p = { 1616 | keyword: b, literal: (e => { 1617 | const n = []; return e.forEach((e => { 1618 | n.push(e), e.toLowerCase() === e ? n.push(e.toUpperCase()) : n.push(e.toLowerCase()) 1619 | })), n 1620 | })(u), built_in: m 1621 | }, _ = e => e.map((e => e.replace(/\|\d+$/, ""))), h = { 1622 | variants: [{ 1623 | match: [/new/, n.concat(c, "+"), n.concat("(?!", _(m).join("\\b|"), "\\b)"), i], scope: { 1624 | 1: "keyword", 4: "title.class" 1625 | } 1626 | }] 1627 | }, f = n.concat(a, "\\b(?!\\()"), E = { 1628 | variants: [{ 1629 | match: [n.concat(/::/, n.lookahead(/(?!class\b)/)), f], scope: { 1630 | 2: "variable.constant" 1631 | } 1632 | }, { match: [/::/, /class/], scope: { 2: "variable.language" } }, { 1633 | match: [i, n.concat(/::/, n.lookahead(/(?!class\b)/)), f], scope: { 1634 | 1: "title.class", 1635 | 3: "variable.constant" 1636 | } 1637 | }, { 1638 | match: [i, n.concat("::", n.lookahead(/(?!class\b)/))], 1639 | scope: { 1: "title.class" } 1640 | }, { 1641 | match: [i, /::/, /class/], scope: { 1642 | 1: "title.class", 1643 | 3: "variable.language" 1644 | } 1645 | }] 1646 | }, y = { 1647 | scope: "attr", 1648 | match: n.concat(a, n.lookahead(":"), n.lookahead(/(?!::)/)) 1649 | }, w = { 1650 | relevance: 0, 1651 | begin: /\(/, end: /\)/, keywords: p, contains: [y, s, E, e.C_BLOCK_COMMENT_MODE, d, g, h] 1652 | }, v = { 1653 | relevance: 0, 1654 | match: [/\b/, n.concat("(?!fn\\b|function\\b|", _(b).join("\\b|"), "|", _(m).join("\\b|"), "\\b)"), a, n.concat(c, "*"), n.lookahead(/(?=\()/)], 1655 | scope: { 3: "title.function.invoke" }, contains: [w] 1656 | }; w.contains.push(v) 1657 | ; const N = [y, E, e.C_BLOCK_COMMENT_MODE, d, g, h], k = { 1658 | begin: n.concat(/#\[\s*\\?/, n.either(i, r)), beginScope: "meta", end: /]/, 1659 | endScope: "meta", keywords: { literal: u, keyword: ["new", "array"] }, contains: [{ 1660 | begin: /\[/, end: /]/, keywords: { literal: u, keyword: ["new", "array"] }, 1661 | contains: ["self", ...N] 1662 | }, ...N, { scope: "meta", variants: [{ match: i }, { match: r }] }] 1663 | } 1664 | ; return { 1665 | case_insensitive: !1, keywords: p, 1666 | contains: [k, e.HASH_COMMENT_MODE, e.COMMENT("//", "$"), e.COMMENT("/\\*", "\\*/", { 1667 | contains: [{ scope: "doctag", match: "@[A-Za-z]+" }] 1668 | }), { 1669 | match: /__halt_compiler\(\);/, 1670 | keywords: "__halt_compiler", starts: { 1671 | scope: "comment", end: e.MATCH_NOTHING_RE, 1672 | contains: [{ match: /\?>/, scope: "meta", endsParent: !0 }] 1673 | } 1674 | }, { 1675 | scope: "meta", variants: [{ 1676 | begin: /<\?php/, relevance: 10 1677 | }, { begin: /<\?=/ }, { begin: /<\?/, relevance: .1 }, { 1678 | begin: /\?>/ 1679 | }] 1680 | }, { scope: "variable.language", match: /\$this\b/ }, s, v, E, { 1681 | match: [/const/, /\s/, a], scope: { 1: "keyword", 3: "variable.constant" } 1682 | }, h, { 1683 | scope: "function", relevance: 0, beginKeywords: "fn function", end: /[;{]/, 1684 | excludeEnd: !0, illegal: "[$%\\[]", contains: [{ 1685 | beginKeywords: "use" 1686 | }, e.UNDERSCORE_TITLE_MODE, { begin: "=>", endsParent: !0 }, { 1687 | scope: "params", 1688 | begin: "\\(", end: "\\)", excludeBegin: !0, excludeEnd: !0, keywords: p, 1689 | contains: ["self", k, s, E, e.C_BLOCK_COMMENT_MODE, d, g] 1690 | }] 1691 | }, { 1692 | scope: "class", variants: [{ 1693 | beginKeywords: "enum", illegal: /[($"]/ 1694 | }, { 1695 | beginKeywords: "class interface trait", 1696 | illegal: /[:($"]/ 1697 | }], relevance: 0, end: /\{/, excludeEnd: !0, contains: [{ 1698 | beginKeywords: "extends implements" 1699 | }, e.UNDERSCORE_TITLE_MODE] 1700 | }, { 1701 | beginKeywords: "namespace", relevance: 0, end: ";", illegal: /[.']/, 1702 | contains: [e.inherit(e.UNDERSCORE_TITLE_MODE, { scope: "title.class" })] 1703 | }, { 1704 | beginKeywords: "use", relevance: 0, end: ";", contains: [{ 1705 | match: /\b(as|const|function)\b/, scope: "keyword" 1706 | }, e.UNDERSCORE_TITLE_MODE] 1707 | }, d, g] 1708 | } 1709 | }, grmr_php_template: e => ({ 1710 | name: "PHP template", subLanguage: "xml", contains: [{ 1711 | begin: /<\?(php|=)?/, end: /\?>/, subLanguage: "php", contains: [{ 1712 | begin: "/\\*", 1713 | end: "\\*/", skip: !0 1714 | }, { begin: 'b"', end: '"', skip: !0 }, { 1715 | begin: "b'", end: "'", skip: !0 1716 | }, e.inherit(e.APOS_STRING_MODE, { 1717 | illegal: null, className: null, contains: null, 1718 | skip: !0 1719 | }), e.inherit(e.QUOTE_STRING_MODE, { 1720 | illegal: null, className: null, 1721 | contains: null, skip: !0 1722 | })] 1723 | }] 1724 | }), grmr_plaintext: e => ({ 1725 | name: "Plain text", 1726 | aliases: ["text", "txt"], disableAutodetect: !0 1727 | }), grmr_python: e => { 1728 | const n = e.regex, t = /[\p{XID_Start}_]\p{XID_Continue}*/u, a = ["and", "as", "assert", "async", "await", "break", "case", "class", "continue", "def", "del", "elif", "else", "except", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "match", "nonlocal|10", "not", "or", "pass", "raise", "return", "try", "while", "with", "yield"], i = { 1729 | $pattern: /[A-Za-z]\w+|__\w+__/, keyword: a, 1730 | built_in: ["__import__", "abs", "all", "any", "ascii", "bin", "bool", "breakpoint", "bytearray", "bytes", "callable", "chr", "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod", "enumerate", "eval", "exec", "filter", "float", "format", "frozenset", "getattr", "globals", "hasattr", "hash", "help", "hex", "id", "input", "int", "isinstance", "issubclass", "iter", "len", "list", "locals", "map", "max", "memoryview", "min", "next", "object", "oct", "open", "ord", "pow", "print", "property", "range", "repr", "reversed", "round", "set", "setattr", "slice", "sorted", "staticmethod", "str", "sum", "super", "tuple", "type", "vars", "zip"], 1731 | literal: ["__debug__", "Ellipsis", "False", "None", "NotImplemented", "True"], 1732 | type: ["Any", "Callable", "Coroutine", "Dict", "List", "Literal", "Generic", "Optional", "Sequence", "Set", "Tuple", "Type", "Union"] 1733 | }, r = { className: "meta", begin: /^(>>>|\.\.\.) / }, s = { 1734 | className: "subst", begin: /\{/, 1735 | end: /\}/, keywords: i, illegal: /#/ 1736 | }, o = { begin: /\{\{/, relevance: 0 }, l = { 1737 | className: "string", contains: [e.BACKSLASH_ESCAPE], variants: [{ 1738 | begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/, end: /'''/, 1739 | contains: [e.BACKSLASH_ESCAPE, r], relevance: 10 1740 | }, { 1741 | begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/, end: /"""/, 1742 | contains: [e.BACKSLASH_ESCAPE, r], relevance: 10 1743 | }, { 1744 | begin: /([fF][rR]|[rR][fF]|[fF])'''/, end: /'''/, 1745 | contains: [e.BACKSLASH_ESCAPE, r, o, s] 1746 | }, { 1747 | begin: /([fF][rR]|[rR][fF]|[fF])"""/, 1748 | end: /"""/, contains: [e.BACKSLASH_ESCAPE, r, o, s] 1749 | }, { 1750 | begin: /([uU]|[rR])'/, end: /'/, 1751 | relevance: 10 1752 | }, { begin: /([uU]|[rR])"/, end: /"/, relevance: 10 }, { 1753 | begin: /([bB]|[bB][rR]|[rR][bB])'/, end: /'/ 1754 | }, { 1755 | begin: /([bB]|[bB][rR]|[rR][bB])"/, 1756 | end: /"/ 1757 | }, { 1758 | begin: /([fF][rR]|[rR][fF]|[fF])'/, end: /'/, 1759 | contains: [e.BACKSLASH_ESCAPE, o, s] 1760 | }, { 1761 | begin: /([fF][rR]|[rR][fF]|[fF])"/, end: /"/, 1762 | contains: [e.BACKSLASH_ESCAPE, o, s] 1763 | }, e.APOS_STRING_MODE, e.QUOTE_STRING_MODE] 1764 | }, c = "[0-9](_?[0-9])*", d = `(\\b(${c}))?\\.(${c})|\\b(${c})\\.`, g = "\\b|" + a.join("|"), u = { 1765 | className: "number", relevance: 0, variants: [{ 1766 | begin: `(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${g})` 1767 | }, { begin: `(${d})[jJ]?` }, { 1768 | begin: `\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})` 1769 | }, { 1770 | begin: `\\b0[bB](_?[01])+[lL]?(?=${g})` 1771 | }, { 1772 | begin: `\\b0[oO](_?[0-7])+[lL]?(?=${g})` 1773 | }, { begin: `\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})` }, { 1774 | begin: `\\b(${c})[jJ](?=${g})` 1775 | }] 1776 | }, b = { 1777 | className: "comment", begin: n.lookahead(/# type:/), end: /$/, keywords: i, 1778 | contains: [{ begin: /# type:/ }, { begin: /#/, end: /\b\B/, endsWithParent: !0 }] 1779 | }, m = { 1780 | className: "params", variants: [{ className: "", begin: /\(\s*\)/, skip: !0 }, { 1781 | begin: /\(/, 1782 | end: /\)/, excludeBegin: !0, excludeEnd: !0, keywords: i, 1783 | contains: ["self", r, u, l, e.HASH_COMMENT_MODE] 1784 | }] 1785 | }; return s.contains = [l, u, r], { 1786 | name: "Python", aliases: ["py", "gyp", "ipython"], unicodeRegex: !0, keywords: i, 1787 | illegal: /(<\/|\?)|=>/, contains: [r, u, { 1788 | scope: "variable.language", match: /\bself\b/ 1789 | }, { beginKeywords: "if", relevance: 0 }, { 1790 | match: /\bor\b/, scope: "keyword" 1791 | }, l, b, e.HASH_COMMENT_MODE, { 1792 | match: [/\bdef/, /\s+/, t], scope: { 1793 | 1: "keyword", 1794 | 3: "title.function" 1795 | }, contains: [m] 1796 | }, { 1797 | variants: [{ 1798 | match: [/\bclass/, /\s+/, t, /\s*/, /\(\s*/, t, /\s*\)/] 1799 | }, { match: [/\bclass/, /\s+/, t] }], 1800 | scope: { 1: "keyword", 3: "title.class", 6: "title.class.inherited" } 1801 | }, { 1802 | className: "meta", begin: /^[\t ]*@/, end: /(?=#)|$/, contains: [u, m, l] 1803 | }] 1804 | } 1805 | }, 1806 | grmr_python_repl: e => ({ 1807 | aliases: ["pycon"], contains: [{ 1808 | className: "meta.prompt", 1809 | starts: { end: / |$/, starts: { end: "$", subLanguage: "python" } }, variants: [{ 1810 | begin: /^>>>(?=[ ]|$)/ 1811 | }, { begin: /^\.\.\.(?=[ ]|$)/ }] 1812 | }] 1813 | }), grmr_r: e => { 1814 | const n = e.regex, t = /(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/, a = n.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/, /0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/, /(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/), i = /[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/, r = n.either(/[()]/, /[{}]/, /\[\[/, /[[\]]/, /\\/, /,/) 1815 | ; return { 1816 | name: "R", keywords: { 1817 | $pattern: t, 1818 | keyword: "function if in break next repeat else for while", 1819 | literal: "NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10", 1820 | built_in: "LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm" 1821 | }, contains: [e.COMMENT(/#'/, /$/, { 1822 | contains: [{ 1823 | scope: "doctag", match: /@examples/, 1824 | starts: { 1825 | end: n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/, /\n^(?!#')/)), 1826 | endsParent: !0 1827 | } 1828 | }, { 1829 | scope: "doctag", begin: "@param", end: /$/, contains: [{ 1830 | scope: "variable", variants: [{ match: t }, { match: /`(?:\\.|[^`\\])+`/ }], endsParent: !0 1831 | }] 1832 | }, { scope: "doctag", match: /@[a-zA-Z]+/ }, { scope: "keyword", match: /\\[a-zA-Z]+/ }] 1833 | }), e.HASH_COMMENT_MODE, { 1834 | scope: "string", contains: [e.BACKSLASH_ESCAPE], 1835 | variants: [e.END_SAME_AS_BEGIN({ 1836 | begin: /[rR]"(-*)\(/, end: /\)(-*)"/ 1837 | }), e.END_SAME_AS_BEGIN({ 1838 | begin: /[rR]"(-*)\{/, end: /\}(-*)"/ 1839 | }), e.END_SAME_AS_BEGIN({ 1840 | begin: /[rR]"(-*)\[/, end: /\](-*)"/ 1841 | }), e.END_SAME_AS_BEGIN({ 1842 | begin: /[rR]'(-*)\(/, end: /\)(-*)'/ 1843 | }), e.END_SAME_AS_BEGIN({ 1844 | begin: /[rR]'(-*)\{/, end: /\}(-*)'/ 1845 | }), e.END_SAME_AS_BEGIN({ begin: /[rR]'(-*)\[/, end: /\](-*)'/ }), { 1846 | begin: '"', end: '"', 1847 | relevance: 0 1848 | }, { begin: "'", end: "'", relevance: 0 }] 1849 | }, { 1850 | relevance: 0, variants: [{ 1851 | scope: { 1852 | 1: "operator", 2: "number" 1853 | }, match: [i, a] 1854 | }, { 1855 | scope: { 1: "operator", 2: "number" }, 1856 | match: [/%[^%]*%/, a] 1857 | }, { scope: { 1: "punctuation", 2: "number" }, match: [r, a] }, { 1858 | scope: { 1859 | 2: "number" 1860 | }, match: [/[^a-zA-Z0-9._]|^/, a] 1861 | }] 1862 | }, { 1863 | scope: { 3: "operator" }, 1864 | match: [t, /\s+/, /<-/, /\s+/] 1865 | }, { 1866 | scope: "operator", relevance: 0, variants: [{ match: i }, { 1867 | match: /%[^%]*%/ 1868 | }] 1869 | }, { scope: "punctuation", relevance: 0, match: r }, { 1870 | begin: "`", end: "`", 1871 | contains: [{ begin: /\\./ }] 1872 | }] 1873 | } 1874 | }, grmr_ruby: e => { 1875 | const n = e.regex, t = "([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)", a = n.either(/\b([A-Z]+[a-z0-9]+)+/, /\b([A-Z]+[a-z0-9]+)+[A-Z]+/), i = n.concat(a, /(::\w+)*/), r = { 1876 | "variable.constant": ["__FILE__", "__LINE__", "__ENCODING__"], 1877 | "variable.language": ["self", "super"], 1878 | keyword: ["alias", "and", "begin", "BEGIN", "break", "case", "class", "defined", "do", "else", "elsif", "end", "END", "ensure", "for", "if", "in", "module", "next", "not", "or", "redo", "require", "rescue", "retry", "return", "then", "undef", "unless", "until", "when", "while", "yield", "include", "extend", "prepend", "public", "private", "protected", "raise", "throw"], 1879 | built_in: ["proc", "lambda", "attr_accessor", "attr_reader", "attr_writer", "define_method", "private_constant", "module_function"], 1880 | literal: ["true", "false", "nil"] 1881 | }, s = { className: "doctag", begin: "@[A-Za-z]+" }, o = { 1882 | begin: "#<", end: ">" 1883 | }, l = [e.COMMENT("#", "$", { 1884 | contains: [s] 1885 | }), e.COMMENT("^=begin", "^=end", { 1886 | contains: [s], relevance: 10 1887 | }), e.COMMENT("^__END__", e.MATCH_NOTHING_RE)], c = { 1888 | className: "subst", begin: /#\{/, 1889 | end: /\}/, keywords: r 1890 | }, d = { 1891 | className: "string", contains: [e.BACKSLASH_ESCAPE, c], 1892 | variants: [{ begin: /'/, end: /'/ }, { begin: /"/, end: /"/ }, { begin: /`/, end: /`/ }, { 1893 | begin: /%[qQwWx]?\(/, end: /\)/ 1894 | }, { begin: /%[qQwWx]?\[/, end: /\]/ }, { 1895 | begin: /%[qQwWx]?\{/, end: /\}/ 1896 | }, { begin: /%[qQwWx]?/ }, { 1897 | begin: /%[qQwWx]?\//, 1898 | end: /\// 1899 | }, { begin: /%[qQwWx]?%/, end: /%/ }, { begin: /%[qQwWx]?-/, end: /-/ }, { 1900 | begin: /%[qQwWx]?\|/, end: /\|/ 1901 | }, { begin: /\B\?(\\\d{1,3})/ }, { 1902 | begin: /\B\?(\\x[A-Fa-f0-9]{1,2})/ 1903 | }, { begin: /\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/ }, { 1904 | begin: /\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/ 1905 | }, { 1906 | begin: /\B\?\\(c|C-)[\x20-\x7e]/ 1907 | }, { begin: /\B\?\\?\S/ }, { 1908 | begin: n.concat(/<<[-~]?'?/, n.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)), 1909 | contains: [e.END_SAME_AS_BEGIN({ 1910 | begin: /(\w+)/, end: /(\w+)/, 1911 | contains: [e.BACKSLASH_ESCAPE, c] 1912 | })] 1913 | }] 1914 | }, g = "[0-9](_?[0-9])*", u = { 1915 | className: "number", 1916 | relevance: 0, variants: [{ 1917 | begin: `\\b([1-9](_?[0-9])*|0)(\\.(${g}))?([eE][+-]?(${g})|r)?i?\\b` 1918 | }, { 1919 | begin: "\\b0[dD][0-9](_?[0-9])*r?i?\\b" 1920 | }, { 1921 | begin: "\\b0[bB][0-1](_?[0-1])*r?i?\\b" 1922 | }, { begin: "\\b0[oO][0-7](_?[0-7])*r?i?\\b" }, { 1923 | begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b" 1924 | }, { 1925 | begin: "\\b0(_?[0-7])+r?i?\\b" 1926 | }] 1927 | }, b = { 1928 | variants: [{ match: /\(\)/ }, { 1929 | className: "params", begin: /\(/, end: /(?=\))/, excludeBegin: !0, endsParent: !0, 1930 | keywords: r 1931 | }] 1932 | }, m = [d, { 1933 | variants: [{ match: [/class\s+/, i, /\s+<\s+/, i] }, { 1934 | match: [/\b(class|module)\s+/, i] 1935 | }], scope: { 1936 | 2: "title.class", 1937 | 4: "title.class.inherited" 1938 | }, keywords: r 1939 | }, { 1940 | match: [/(include|extend)\s+/, i], scope: { 1941 | 2: "title.class" 1942 | }, keywords: r 1943 | }, { 1944 | relevance: 0, match: [i, /\.new[. (]/], scope: { 1945 | 1: "title.class" 1946 | } 1947 | }, { 1948 | relevance: 0, match: /\b[A-Z][A-Z_0-9]+\b/, 1949 | className: "variable.constant" 1950 | }, { relevance: 0, match: a, scope: "title.class" }, { 1951 | match: [/def/, /\s+/, t], scope: { 1: "keyword", 3: "title.function" }, contains: [b] 1952 | }, { 1953 | begin: e.IDENT_RE + "::" 1954 | }, { 1955 | className: "symbol", 1956 | begin: e.UNDERSCORE_IDENT_RE + "(!|\\?)?:", relevance: 0 1957 | }, { 1958 | className: "symbol", 1959 | begin: ":(?!\\s)", contains: [d, { begin: t }], relevance: 0 1960 | }, u, { 1961 | className: "variable", 1962 | begin: "(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])" 1963 | }, { 1964 | className: "params", begin: /\|(?!=)/, end: /\|/, excludeBegin: !0, excludeEnd: !0, 1965 | relevance: 0, keywords: r 1966 | }, { 1967 | begin: "(" + e.RE_STARTERS_RE + "|unless)\\s*", 1968 | keywords: "unless", contains: [{ 1969 | className: "regexp", contains: [e.BACKSLASH_ESCAPE, c], 1970 | illegal: /\n/, variants: [{ begin: "/", end: "/[a-z]*" }, { begin: /%r\{/, end: /\}[a-z]*/ }, { 1971 | begin: "%r\\(", end: "\\)[a-z]*" 1972 | }, { begin: "%r!", end: "![a-z]*" }, { 1973 | begin: "%r\\[", 1974 | end: "\\][a-z]*" 1975 | }] 1976 | }].concat(o, l), relevance: 0 1977 | }].concat(o, l) 1978 | ; c.contains = m, b.contains = m; const p = [{ 1979 | begin: /^\s*=>/, starts: { end: "$", contains: m } 1980 | }, { 1981 | className: "meta.prompt", 1982 | begin: "^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])", 1983 | starts: { end: "$", keywords: r, contains: m } 1984 | }]; return l.unshift(o), { 1985 | name: "Ruby", 1986 | aliases: ["rb", "gemspec", "podspec", "thor", "irb"], keywords: r, illegal: /\/\*/, 1987 | contains: [e.SHEBANG({ binary: "ruby" })].concat(p).concat(l).concat(m) 1988 | } 1989 | }, 1990 | grmr_rust: e => { 1991 | const n = e.regex, t = /(r#)?/, a = n.concat(t, e.UNDERSCORE_IDENT_RE), i = n.concat(t, e.IDENT_RE), r = { 1992 | className: "title.function.invoke", relevance: 0, 1993 | begin: n.concat(/\b/, /(?!let|for|while|if|else|match\b)/, i, n.lookahead(/\s*\(/)) 1994 | }, s = "([ui](8|16|32|64|128|size)|f(32|64))?", o = ["drop ", "Copy", "Send", "Sized", "Sync", "Drop", "Fn", "FnMut", "FnOnce", "ToOwned", "Clone", "Debug", "PartialEq", "PartialOrd", "Eq", "Ord", "AsRef", "AsMut", "Into", "From", "Default", "Iterator", "Extend", "IntoIterator", "DoubleEndedIterator", "ExactSizeIterator", "SliceConcatExt", "ToString", "assert!", "assert_eq!", "bitflags!", "bytes!", "cfg!", "col!", "concat!", "concat_idents!", "debug_assert!", "debug_assert_eq!", "env!", "eprintln!", "panic!", "file!", "format!", "format_args!", "include_bytes!", "include_str!", "line!", "local_data_key!", "module_path!", "option_env!", "print!", "println!", "select!", "stringify!", "try!", "unimplemented!", "unreachable!", "vec!", "write!", "writeln!", "macro_rules!", "assert_ne!", "debug_assert_ne!"], l = ["i8", "i16", "i32", "i64", "i128", "isize", "u8", "u16", "u32", "u64", "u128", "usize", "f32", "f64", "str", "char", "bool", "Box", "Option", "Result", "String", "Vec"] 1995 | ; return { 1996 | name: "Rust", aliases: ["rs"], keywords: { 1997 | $pattern: e.IDENT_RE + "!?", type: l, 1998 | keyword: ["abstract", "as", "async", "await", "become", "box", "break", "const", "continue", "crate", "do", "dyn", "else", "enum", "extern", "false", "final", "fn", "for", "if", "impl", "in", "let", "loop", "macro", "match", "mod", "move", "mut", "override", "priv", "pub", "ref", "return", "self", "Self", "static", "struct", "super", "trait", "true", "try", "type", "typeof", "union", "unsafe", "unsized", "use", "virtual", "where", "while", "yield"], 1999 | literal: ["true", "false", "Some", "None", "Ok", "Err"], built_in: o 2000 | }, illegal: "" }, r] 2048 | } 2049 | }, 2050 | grmr_scss: e => { 2051 | const n = te(e), t = se, a = re, i = "@[a-z-]+", r = { 2052 | className: "variable", 2053 | begin: "(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b", relevance: 0 2054 | }; return { 2055 | name: "SCSS", 2056 | case_insensitive: !0, illegal: "[=/|']", 2057 | contains: [e.C_LINE_COMMENT_MODE, e.C_BLOCK_COMMENT_MODE, n.CSS_NUMBER_MODE, { 2058 | className: "selector-id", begin: "#[A-Za-z0-9_-]+", relevance: 0 2059 | }, { 2060 | className: "selector-class", begin: "\\.[A-Za-z0-9_-]+", relevance: 0 2061 | }, n.ATTRIBUTE_SELECTOR_MODE, { 2062 | className: "selector-tag", 2063 | begin: "\\b(" + ae.join("|") + ")\\b", relevance: 0 2064 | }, { 2065 | className: "selector-pseudo", 2066 | begin: ":(" + a.join("|") + ")" 2067 | }, { 2068 | className: "selector-pseudo", 2069 | begin: ":(:)?(" + t.join("|") + ")" 2070 | }, r, { 2071 | begin: /\(/, end: /\)/, 2072 | contains: [n.CSS_NUMBER_MODE] 2073 | }, n.CSS_VARIABLE, { 2074 | className: "attribute", 2075 | begin: "\\b(" + oe.join("|") + ")\\b" 2076 | }, { 2077 | begin: "\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b" 2078 | }, { 2079 | begin: /:/, end: /[;}{]/, relevance: 0, 2080 | contains: [n.BLOCK_COMMENT, r, n.HEXCOLOR, n.CSS_NUMBER_MODE, e.QUOTE_STRING_MODE, e.APOS_STRING_MODE, n.IMPORTANT, n.FUNCTION_DISPATCH] 2081 | }, { begin: "@(page|font-face)", keywords: { $pattern: i, keyword: "@page @font-face" } }, { 2082 | begin: "@", end: "[{;]", returnBegin: !0, keywords: { 2083 | $pattern: /[a-z-]+/, 2084 | keyword: "and or not only", attribute: ie.join(" ") 2085 | }, contains: [{ 2086 | begin: i, 2087 | className: "keyword" 2088 | }, { 2089 | begin: /[a-z-]+(?=:)/, className: "attribute" 2090 | }, r, e.QUOTE_STRING_MODE, e.APOS_STRING_MODE, n.HEXCOLOR, n.CSS_NUMBER_MODE] 2091 | }, n.FUNCTION_DISPATCH] 2092 | } 2093 | }, grmr_shell: e => ({ 2094 | name: "Shell Session", 2095 | aliases: ["console", "shellsession"], contains: [{ 2096 | className: "meta.prompt", 2097 | begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/, starts: { 2098 | end: /[^\\](?=\s*$)/, 2099 | subLanguage: "bash" 2100 | } 2101 | }] 2102 | }), grmr_sql: e => { 2103 | const n = e.regex, t = e.COMMENT("--", "$"), a = ["abs", "acos", "array_agg", "asin", "atan", "avg", "cast", "ceil", "ceiling", "coalesce", "corr", "cos", "cosh", "count", "covar_pop", "covar_samp", "cume_dist", "dense_rank", "deref", "element", "exp", "extract", "first_value", "floor", "json_array", "json_arrayagg", "json_exists", "json_object", "json_objectagg", "json_query", "json_table", "json_table_primitive", "json_value", "lag", "last_value", "lead", "listagg", "ln", "log", "log10", "lower", "max", "min", "mod", "nth_value", "ntile", "nullif", "percent_rank", "percentile_cont", "percentile_disc", "position", "position_regex", "power", "rank", "regr_avgx", "regr_avgy", "regr_count", "regr_intercept", "regr_r2", "regr_slope", "regr_sxx", "regr_sxy", "regr_syy", "row_number", "sin", "sinh", "sqrt", "stddev_pop", "stddev_samp", "substring", "substring_regex", "sum", "tan", "tanh", "translate", "translate_regex", "treat", "trim", "trim_array", "unnest", "upper", "value_of", "var_pop", "var_samp", "width_bucket"], i = a, r = ["abs", "acos", "all", "allocate", "alter", "and", "any", "are", "array", "array_agg", "array_max_cardinality", "as", "asensitive", "asin", "asymmetric", "at", "atan", "atomic", "authorization", "avg", "begin", "begin_frame", "begin_partition", "between", "bigint", "binary", "blob", "boolean", "both", "by", "call", "called", "cardinality", "cascaded", "case", "cast", "ceil", "ceiling", "char", "char_length", "character", "character_length", "check", "classifier", "clob", "close", "coalesce", "collate", "collect", "column", "commit", "condition", "connect", "constraint", "contains", "convert", "copy", "corr", "corresponding", "cos", "cosh", "count", "covar_pop", "covar_samp", "create", "cross", "cube", "cume_dist", "current", "current_catalog", "current_date", "current_default_transform_group", "current_path", "current_role", "current_row", "current_schema", "current_time", "current_timestamp", "current_path", "current_role", "current_transform_group_for_type", "current_user", "cursor", "cycle", "date", "day", "deallocate", "dec", "decimal", "decfloat", "declare", "default", "define", "delete", "dense_rank", "deref", "describe", "deterministic", "disconnect", "distinct", "double", "drop", "dynamic", "each", "element", "else", "empty", "end", "end_frame", "end_partition", "end-exec", "equals", "escape", "every", "except", "exec", "execute", "exists", "exp", "external", "extract", "false", "fetch", "filter", "first_value", "float", "floor", "for", "foreign", "frame_row", "free", "from", "full", "function", "fusion", "get", "global", "grant", "group", "grouping", "groups", "having", "hold", "hour", "identity", "in", "indicator", "initial", "inner", "inout", "insensitive", "insert", "int", "integer", "intersect", "intersection", "interval", "into", "is", "join", "json_array", "json_arrayagg", "json_exists", "json_object", "json_objectagg", "json_query", "json_table", "json_table_primitive", "json_value", "lag", "language", "large", "last_value", "lateral", "lead", "leading", "left", "like", "like_regex", "listagg", "ln", "local", "localtime", "localtimestamp", "log", "log10", "lower", "match", "match_number", "match_recognize", "matches", "max", "member", "merge", "method", "min", "minute", "mod", "modifies", "module", "month", "multiset", "national", "natural", "nchar", "nclob", "new", "no", "none", "normalize", "not", "nth_value", "ntile", "null", "nullif", "numeric", "octet_length", "occurrences_regex", "of", "offset", "old", "omit", "on", "one", "only", "open", "or", "order", "out", "outer", "over", "overlaps", "overlay", "parameter", "partition", "pattern", "per", "percent", "percent_rank", "percentile_cont", "percentile_disc", "period", "portion", "position", "position_regex", "power", "precedes", "precision", "prepare", "primary", "procedure", "ptf", "range", "rank", "reads", "real", "recursive", "ref", "references", "referencing", "regr_avgx", "regr_avgy", "regr_count", "regr_intercept", "regr_r2", "regr_slope", "regr_sxx", "regr_sxy", "regr_syy", "release", "result", "return", "returns", "revoke", "right", "rollback", "rollup", "row", "row_number", "rows", "running", "savepoint", "scope", "scroll", "search", "second", "seek", "select", "sensitive", "session_user", "set", "show", "similar", "sin", "sinh", "skip", "smallint", "some", "specific", "specifictype", "sql", "sqlexception", "sqlstate", "sqlwarning", "sqrt", "start", "static", "stddev_pop", "stddev_samp", "submultiset", "subset", "substring", "substring_regex", "succeeds", "sum", "symmetric", "system", "system_time", "system_user", "table", "tablesample", "tan", "tanh", "then", "time", "timestamp", "timezone_hour", "timezone_minute", "to", "trailing", "translate", "translate_regex", "translation", "treat", "trigger", "trim", "trim_array", "true", "truncate", "uescape", "union", "unique", "unknown", "unnest", "update", "upper", "user", "using", "value", "values", "value_of", "var_pop", "var_samp", "varbinary", "varchar", "varying", "versioning", "when", "whenever", "where", "width_bucket", "window", "with", "within", "without", "year", "add", "asc", "collation", "desc", "final", "first", "last", "view"].filter((e => !a.includes(e))), s = { 2104 | match: n.concat(/\b/, n.either(...i), /\s*\(/), relevance: 0, keywords: { built_in: i } 2105 | } 2106 | ; function o(e) { 2107 | return n.concat(/\b/, n.either(...e.map((e => e.replace(/\s+/, "\\s+")))), /\b/) 2108 | } 2109 | const l = { 2110 | scope: "keyword", 2111 | match: o(["create table", "insert into", "primary key", "foreign key", "not null", "alter table", "add constraint", "grouping sets", "on overflow", "character set", "respect nulls", "ignore nulls", "nulls first", "nulls last", "depth first", "breadth first"]), 2112 | relevance: 0 2113 | }; return { 2114 | name: "SQL", case_insensitive: !0, illegal: /[{}]|<\//, keywords: { 2115 | $pattern: /\b[\w\.]+/, keyword: ((e, { exceptions: n, when: t } = {}) => { 2116 | const a = t 2117 | ; return n = n || [], e.map((e => e.match(/\|\d+$/) || n.includes(e) ? e : a(e) ? e + "|0" : e)) 2118 | })(r, { when: e => e.length < 3 }), literal: ["true", "false", "unknown"], 2119 | type: ["bigint", "binary", "blob", "boolean", "char", "character", "clob", "date", "dec", "decfloat", "decimal", "float", "int", "integer", "interval", "nchar", "nclob", "national", "numeric", "real", "row", "smallint", "time", "timestamp", "varchar", "varying", "varbinary"], 2120 | built_in: ["current_catalog", "current_date", "current_default_transform_group", "current_path", "current_role", "current_schema", "current_transform_group_for_type", "current_user", "session_user", "system_time", "system_user", "current_time", "localtime", "current_timestamp", "localtimestamp"] 2121 | }, contains: [{ 2122 | scope: "type", 2123 | match: o(["double precision", "large object", "with timezone", "without timezone"]) 2124 | }, l, s, { scope: "variable", match: /@[a-z0-9][a-z0-9_]*/ }, { 2125 | scope: "string", variants: [{ 2126 | begin: /'/, end: /'/, contains: [{ match: /''/ }] 2127 | }] 2128 | }, { 2129 | begin: /"/, end: /"/, contains: [{ 2130 | match: /""/ 2131 | }] 2132 | }, e.C_NUMBER_MODE, e.C_BLOCK_COMMENT_MODE, t, { 2133 | scope: "operator", 2134 | match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/, relevance: 0 2135 | }] 2136 | } 2137 | }, 2138 | grmr_swift: e => { 2139 | const n = { match: /\s+/, relevance: 0 }, t = e.COMMENT("/\\*", "\\*/", { 2140 | contains: ["self"] 2141 | }), a = [e.C_LINE_COMMENT_MODE, t], i = { 2142 | match: [/\./, m(...ke, ...xe)], 2143 | className: { 2: "keyword" } 2144 | }, r = { 2145 | match: b(/\./, m(...Me)), relevance: 0 2146 | }, s = Me.filter((e => "string" == typeof e)).concat(["_|0"]), o = { 2147 | variants: [{ 2148 | className: "keyword", 2149 | match: m(...Me.filter((e => "string" != typeof e)).concat(Oe).map(Ne), ...xe) 2150 | }] 2151 | }, l = { 2152 | $pattern: m(/\b\w+/, /#\w+/), keyword: s.concat(Ce), literal: Ae 2153 | }, c = [i, r, o], g = [{ 2154 | match: b(/\./, m(...Te)), relevance: 0 2155 | }, { 2156 | className: "built_in", 2157 | match: b(/\b/, m(...Te), /(?=\()/) 2158 | }], u = { match: /->/, relevance: 0 }, p = [u, { 2159 | className: "operator", relevance: 0, variants: [{ match: Ie }, { match: `\\.(\\.|${De})+` }] 2160 | }], _ = "([0-9]_*)+", h = "([0-9a-fA-F]_*)+", f = { 2161 | className: "number", relevance: 0, 2162 | variants: [{ match: `\\b(${_})(\\.(${_}))?([eE][+-]?(${_}))?\\b` }, { 2163 | match: `\\b0x(${h})(\\.(${h}))?([pP][+-]?(${_}))?\\b` 2164 | }, { 2165 | match: /\b0o([0-7]_*)+\b/ 2166 | }, { match: /\b0b([01]_*)+\b/ }] 2167 | }, E = (e = "") => ({ 2168 | className: "subst", variants: [{ 2169 | match: b(/\\/, e, /[0\\tnr"']/) 2170 | }, { match: b(/\\/, e, /u\{[0-9a-fA-F]{1,8}\}/) }] 2171 | }), y = (e = "") => ({ 2172 | className: "subst", match: b(/\\/, e, /[\t ]*(?:[\r\n]|\r\n)/) 2173 | }), w = (e = "") => ({ 2174 | className: "subst", label: "interpol", begin: b(/\\/, e, /\(/), end: /\)/ 2175 | }), v = (e = "") => ({ 2176 | begin: b(e, /"""/), end: b(/"""/, e), contains: [E(e), y(e), w(e)] 2177 | }), N = (e = "") => ({ begin: b(e, /"/), end: b(/"/, e), contains: [E(e), w(e)] }), k = { 2178 | className: "string", 2179 | variants: [v(), v("#"), v("##"), v("###"), N(), N("#"), N("##"), N("###")] 2180 | }, x = [e.BACKSLASH_ESCAPE, { 2181 | begin: /\[/, end: /\]/, relevance: 0, 2182 | contains: [e.BACKSLASH_ESCAPE] 2183 | }], O = { 2184 | begin: /\/[^\s](?=[^/\n]*\/)/, end: /\//, 2185 | contains: x 2186 | }, M = e => { 2187 | const n = b(e, /\//), t = b(/\//, e); return { 2188 | begin: n, end: t, 2189 | contains: [...x, { scope: "comment", begin: `#(?!.*${t})`, end: /$/ }] 2190 | } 2191 | }, A = { 2192 | scope: "regexp", variants: [M("###"), M("##"), M("#"), O] 2193 | }, S = { 2194 | match: b(/`/, $e, /`/) 2195 | }, C = [S, { className: "variable", match: /\$\d+/ }, { 2196 | className: "variable", 2197 | match: `\\$${Be}+` 2198 | }], T = [{ 2199 | match: /(@|#(un)?)available/, scope: "keyword", starts: { 2200 | contains: [{ begin: /\(/, end: /\)/, keywords: je, contains: [...p, f, k] }] 2201 | } 2202 | }, { 2203 | scope: "keyword", match: b(/@/, m(...ze), d(m(/\(/, /\s+/))) 2204 | }, { 2205 | scope: "meta", 2206 | match: b(/@/, $e) 2207 | }], R = { 2208 | match: d(/\b[A-Z]/), relevance: 0, contains: [{ 2209 | className: "type", 2210 | match: b(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/, Be, "+") 2211 | }, { className: "type", match: Fe, relevance: 0 }, { match: /[?!]+/, relevance: 0 }, { 2212 | match: /\.\.\./, relevance: 0 2213 | }, { match: b(/\s+&\s+/, d(Fe)), relevance: 0 }] 2214 | }, D = { 2215 | begin: //, keywords: l, contains: [...a, ...c, ...T, u, R] 2216 | }; R.contains.push(D) 2217 | ; const I = { 2218 | begin: /\(/, end: /\)/, relevance: 0, keywords: l, contains: ["self", { 2219 | match: b($e, /\s*:/), keywords: "_|0", relevance: 0 2220 | }, ...a, A, ...c, ...g, ...p, f, k, ...C, ...T, R] 2221 | }, L = { 2222 | begin: //, 2223 | keywords: "repeat each", contains: [...a, R] 2224 | }, B = { 2225 | begin: /\(/, end: /\)/, keywords: l, 2226 | contains: [{ 2227 | begin: m(d(b($e, /\s*:/)), d(b($e, /\s+/, $e, /\s*:/))), end: /:/, 2228 | relevance: 0, contains: [{ className: "keyword", match: /\b_\b/ }, { 2229 | className: "params", 2230 | match: $e 2231 | }] 2232 | }, ...a, ...c, ...p, f, k, ...T, R, I], endsParent: !0, illegal: /["']/ 2233 | }, $ = { 2234 | match: [/(func|macro)/, /\s+/, m(S.match, $e, Ie)], className: { 2235 | 1: "keyword", 2236 | 3: "title.function" 2237 | }, contains: [L, B, n], illegal: [/\[/, /%/] 2238 | }, F = { 2239 | match: [/\b(?:subscript|init[?!]?)/, /\s*(?=[<(])/], className: { 1: "keyword" }, 2240 | contains: [L, B, n], illegal: /\[|%/ 2241 | }, z = { 2242 | match: [/operator/, /\s+/, Ie], className: { 2243 | 1: "keyword", 3: "title" 2244 | } 2245 | }, j = { 2246 | begin: [/precedencegroup/, /\s+/, Fe], className: { 2247 | 1: "keyword", 3: "title" 2248 | }, contains: [R], keywords: [...Se, ...Ae], end: /}/ 2249 | }, U = { 2250 | begin: [/(struct|protocol|class|extension|enum|actor)/, /\s+/, $e, /\s*/], 2251 | beginScope: { 1: "keyword", 3: "title.class" }, keywords: l, contains: [L, ...c, { 2252 | begin: /:/, 2253 | end: /\{/, keywords: l, contains: [{ scope: "title.class.inherited", match: Fe }, ...c], 2254 | relevance: 0 2255 | }] 2256 | }; for (const e of k.variants) { 2257 | const n = e.contains.find((e => "interpol" === e.label)); n.keywords = l 2258 | ; const t = [...c, ...g, ...p, f, k, ...C]; n.contains = [...t, { 2259 | begin: /\(/, end: /\)/, 2260 | contains: ["self", ...t] 2261 | }] 2262 | } return { 2263 | name: "Swift", keywords: l, contains: [...a, $, F, { 2264 | match: [/class\b/, /\s+/, /func\b/, /\s+/, /\b[A-Za-z_][A-Za-z0-9_]*\b/], scope: { 2265 | 1: "keyword", 3: "keyword", 5: "title.function" 2266 | } 2267 | }, { 2268 | match: [/class\b/, /\s+/, /var\b/], 2269 | scope: { 1: "keyword", 3: "keyword" } 2270 | }, U, z, j, { 2271 | beginKeywords: "import", end: /$/, 2272 | contains: [...a], relevance: 0 2273 | }, A, ...c, ...g, ...p, f, k, ...C, ...T, R, I] 2274 | } 2275 | }, 2276 | grmr_typescript: e => { 2277 | const n = e.regex, t = ve(e), a = me, i = ["any", "void", "number", "boolean", "string", "object", "never", "symbol", "bigint", "unknown"], r = { 2278 | begin: [/namespace/, /\s+/, e.IDENT_RE], beginScope: { 1: "keyword", 3: "title.class" } 2279 | }, s = { 2280 | beginKeywords: "interface", end: /\{/, excludeEnd: !0, keywords: { 2281 | keyword: "interface extends", built_in: i 2282 | }, contains: [t.exports.CLASS_REFERENCE] 2283 | }, o = { 2284 | $pattern: me, 2285 | keyword: pe.concat(["type", "interface", "public", "private", "protected", "implements", "declare", "abstract", "readonly", "enum", "override", "satisfies"]), 2286 | literal: _e, built_in: we.concat(i), "variable.language": ye 2287 | }, l = { 2288 | className: "meta", 2289 | begin: "@" + a 2290 | }, c = (e, n, t) => { 2291 | const a = e.contains.findIndex((e => e.label === n)) 2292 | ; if (-1 === a) throw Error("can not find mode to replace"); e.contains.splice(a, 1, t) 2293 | } 2294 | ; Object.assign(t.keywords, o), t.exports.PARAMS_CONTAINS.push(l) 2295 | ; const d = t.contains.find((e => "attr" === e.scope)), g = Object.assign({}, d, { 2296 | match: n.concat(a, n.lookahead(/\s*\?:/)) 2297 | }) 2298 | ; return t.exports.PARAMS_CONTAINS.push([t.exports.CLASS_REFERENCE, d, g]), 2299 | t.contains = t.contains.concat([l, r, s, g]), 2300 | c(t, "shebang", e.SHEBANG()), c(t, "use_strict", { 2301 | className: "meta", relevance: 10, 2302 | begin: /^\s*['"]use strict['"]/ 2303 | }), t.contains.find((e => "func.def" === e.label)).relevance = 0, Object.assign(t, { 2304 | name: "TypeScript", aliases: ["ts", "tsx", "mts", "cts"] 2305 | }), t 2306 | }, grmr_vbnet: e => { 2307 | const n = e.regex, t = /\d{1,2}\/\d{1,2}\/\d{4}/, a = /\d{4}-\d{1,2}-\d{1,2}/, i = /(\d|1[012])(:\d+){0,2} *(AM|PM)/, r = /\d{1,2}(:\d{1,2}){1,2}/, s = { 2308 | className: "literal", variants: [{ begin: n.concat(/# */, n.either(a, t), / *#/) }, { 2309 | begin: n.concat(/# */, r, / *#/) 2310 | }, { begin: n.concat(/# */, i, / *#/) }, { 2311 | begin: n.concat(/# */, n.either(a, t), / +/, n.either(i, r), / *#/) 2312 | }] 2313 | }, o = e.COMMENT(/'''/, /$/, { 2314 | contains: [{ className: "doctag", begin: /<\/?/, end: />/ }] 2315 | }), l = e.COMMENT(null, /$/, { variants: [{ begin: /'/ }, { begin: /([\t ]|^)REM(?=\s)/ }] }) 2316 | ; return { 2317 | name: "Visual Basic .NET", aliases: ["vb"], case_insensitive: !0, 2318 | classNameAliases: { label: "symbol" }, keywords: { 2319 | keyword: "addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield", 2320 | built_in: "addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort", 2321 | type: "boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort", 2322 | literal: "true false nothing" 2323 | }, 2324 | illegal: "//|\\{|\\}|endif|gosub|variant|wend|^\\$ ", contains: [{ 2325 | className: "string", begin: /"(""|[^/n])"C\b/ 2326 | }, { 2327 | className: "string", begin: /"/, 2328 | end: /"/, illegal: /\n/, contains: [{ begin: /""/ }] 2329 | }, s, { 2330 | className: "number", relevance: 0, 2331 | variants: [{ 2332 | begin: /\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/ 2333 | }, { begin: /\b\d[\d_]*((U?[SIL])|[%&])?/ }, { begin: /&H[\dA-F_]+((U?[SIL])|[%&])?/ }, { 2334 | begin: /&O[0-7_]+((U?[SIL])|[%&])?/ 2335 | }, { begin: /&B[01_]+((U?[SIL])|[%&])?/ }] 2336 | }, { 2337 | className: "label", begin: /^\w+:/ 2338 | }, o, l, { 2339 | className: "meta", 2340 | begin: /[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/, 2341 | end: /$/, keywords: { 2342 | keyword: "const disable else elseif enable end externalsource if region then" 2343 | }, 2344 | contains: [l] 2345 | }] 2346 | } 2347 | }, grmr_wasm: e => { 2348 | e.regex; const n = e.COMMENT(/\(;/, /;\)/) 2349 | ; return n.contains.push("self"), { 2350 | name: "WebAssembly", keywords: { 2351 | $pattern: /[\w.]+/, 2352 | keyword: ["anyfunc", "block", "br", "br_if", "br_table", "call", "call_indirect", "data", "drop", "elem", "else", "end", "export", "func", "global.get", "global.set", "local.get", "local.set", "local.tee", "get_global", "get_local", "global", "if", "import", "local", "loop", "memory", "memory.grow", "memory.size", "module", "mut", "nop", "offset", "param", "result", "return", "select", "set_global", "set_local", "start", "table", "tee_local", "then", "type", "unreachable"] 2353 | }, contains: [e.COMMENT(/;;/, /$/), n, { 2354 | match: [/(?:offset|align)/, /\s*/, /=/], 2355 | className: { 1: "keyword", 3: "operator" } 2356 | }, { className: "variable", begin: /\$[\w_]+/ }, { 2357 | match: /(\((?!;)|\))+/, className: "punctuation", relevance: 0 2358 | }, { 2359 | begin: [/(?:func|call|call_indirect)/, /\s+/, /\$[^\s)]+/], className: { 2360 | 1: "keyword", 2361 | 3: "title.function" 2362 | } 2363 | }, e.QUOTE_STRING_MODE, { 2364 | match: /(i32|i64|f32|f64)(?!\.)/, 2365 | className: "type" 2366 | }, { 2367 | className: "keyword", 2368 | match: /\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/ 2369 | }, { 2370 | className: "number", relevance: 0, 2371 | match: /[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/ 2372 | }] 2373 | } 2374 | }, grmr_xml: e => { 2375 | const n = e.regex, t = n.concat(/[\p{L}_]/u, n.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), a = { 2376 | className: "symbol", begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/ 2377 | }, i = { 2378 | begin: /\s/, 2379 | contains: [{ className: "keyword", begin: /#?[a-z_][a-z1-9_-]+/, illegal: /\n/ }] 2380 | }, r = e.inherit(i, { begin: /\(/, end: /\)/ }), s = e.inherit(e.APOS_STRING_MODE, { 2381 | className: "string" 2382 | }), o = e.inherit(e.QUOTE_STRING_MODE, { className: "string" }), l = { 2383 | endsWithParent: !0, illegal: /`]+/ }] 2391 | }] 2392 | }] 2393 | }; return { 2394 | name: "HTML, XML", 2395 | aliases: ["html", "xhtml", "rss", "atom", "xjb", "xsd", "xsl", "plist", "wsf", "svg"], 2396 | case_insensitive: !0, unicodeRegex: !0, contains: [{ 2397 | className: "meta", begin: //, relevance: 10, contains: [i, o, s, r, { 2399 | begin: /\[/, end: /\]/, contains: [{ 2400 | className: "meta", begin: //, contains: [i, r, o, s] 2401 | }] 2402 | }] 2403 | }, e.COMMENT(//, { relevance: 10 }), { 2404 | begin: //, 2405 | relevance: 10 2406 | }, a, { 2407 | className: "meta", end: /\?>/, variants: [{ 2408 | begin: /<\?xml/, 2409 | relevance: 10, contains: [o] 2410 | }, { begin: /<\?[a-z][a-z0-9]+/ }] 2411 | }, { 2412 | className: "tag", 2413 | begin: /)/, end: />/, keywords: { name: "style" }, contains: [l], starts: { 2414 | end: /<\/style>/, returnEnd: !0, subLanguage: ["css", "xml"] 2415 | } 2416 | }, { 2417 | className: "tag", 2418 | begin: /)/, end: />/, keywords: { name: "script" }, contains: [l], starts: { 2419 | end: /<\/script>/, returnEnd: !0, subLanguage: ["javascript", "handlebars", "xml"] 2420 | } 2421 | }, { 2422 | className: "tag", begin: /<>|<\/>/ 2423 | }, { 2424 | className: "tag", 2425 | begin: n.concat(//, />/, /\s/)))), 2426 | end: /\/?>/, contains: [{ className: "name", begin: t, relevance: 0, starts: l }] 2427 | }, { 2428 | className: "tag", begin: n.concat(/<\//, n.lookahead(n.concat(t, />/))), contains: [{ 2429 | className: "name", begin: t, relevance: 0 2430 | }, { begin: />/, relevance: 0, endsParent: !0 }] 2431 | }] 2432 | } 2433 | }, grmr_yaml: e => { 2434 | const n = "true false yes no null", t = "[\\w#;/?:@&=+$,.~*'()[\\]]+", a = { 2435 | className: "string", relevance: 0, variants: [{ begin: /"/, end: /"/ }, { begin: /\S+/ }], 2436 | contains: [e.BACKSLASH_ESCAPE, { 2437 | className: "template-variable", variants: [{ 2438 | begin: /\{\{/, end: /\}\}/ 2439 | }, { begin: /%\{/, end: /\}/ }] 2440 | }] 2441 | }, i = e.inherit(a, { 2442 | variants: [{ 2443 | begin: /'/, end: /'/, contains: [{ begin: /''/, relevance: 0 }] 2444 | }, { begin: /"/, end: /"/ }, { 2445 | begin: /[^\s,{}[\]]+/ 2446 | }] 2447 | }), r = { 2448 | end: ",", endsWithParent: !0, excludeEnd: !0, keywords: n, 2449 | relevance: 0 2450 | }, s = { begin: /\{/, end: /\}/, contains: [r], illegal: "\\n", relevance: 0 }, o = { 2451 | begin: "\\[", end: "\\]", contains: [r], illegal: "\\n", relevance: 0 2452 | }, l = [{ 2453 | className: "attr", variants: [{ begin: /[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/ }, { 2454 | begin: /"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/ 2455 | }, { 2456 | begin: /'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/ 2457 | }] 2458 | }, { 2459 | className: "meta", 2460 | begin: "^---\\s*$", relevance: 10 2461 | }, { 2462 | className: "string", 2463 | begin: "[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*" 2464 | }, { 2465 | begin: "<%[%=-]?", end: "[%-]?%>", subLanguage: "ruby", excludeBegin: !0, excludeEnd: !0, 2466 | relevance: 0 2467 | }, { className: "type", begin: "!\\w+!" + t }, { 2468 | className: "type", 2469 | begin: "!<" + t + ">" 2470 | }, { className: "type", begin: "!" + t }, { 2471 | className: "type", begin: "!!" + t 2472 | }, { className: "meta", begin: "&" + e.UNDERSCORE_IDENT_RE + "$" }, { 2473 | className: "meta", 2474 | begin: "\\*" + e.UNDERSCORE_IDENT_RE + "$" 2475 | }, { 2476 | className: "bullet", begin: "-(?=[ ]|$)", 2477 | relevance: 0 2478 | }, e.HASH_COMMENT_MODE, { beginKeywords: n, keywords: { literal: n } }, { 2479 | className: "number", 2480 | begin: "\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b" 2481 | }, { className: "number", begin: e.C_NUMBER_RE + "\\b", relevance: 0 }, s, o, { 2482 | className: "string", relevance: 0, begin: /'/, end: /'/, contains: [{ 2483 | match: /''/, 2484 | scope: "char.escape", relevance: 0 2485 | }] 2486 | }, a], c = [...l] 2487 | ; return c.pop(), c.push(i), r.contains = c, { 2488 | name: "YAML", case_insensitive: !0, 2489 | aliases: ["yml"], contains: l 2490 | } 2491 | } 2492 | }); const Pe = ne; for (const e of Object.keys(Ue)) { 2493 | const n = e.replace("grmr_", "").replace("_", "-"); Pe.registerLanguage(n, Ue[e]) 2494 | } 2495 | return Pe 2496 | }() 2497 | ; "object" == typeof exports && "undefined" != typeof module && (module.exports = hljs); 2498 | 2499 | window.hljs = hljs; -------------------------------------------------------------------------------- /src/renderer/modules/slides/configurator/index.js: -------------------------------------------------------------------------------- 1 | const ButtonAction = require('./button-action.js') 2 | require('./highlight.js') 3 | const injectCSS = require("../../../utils/inject-css.js") 4 | injectCSS('src', 'renderer', 'modules', 'slides', 'configurator', 'highlight.css') 5 | injectCSS('src', 'renderer', 'modules', 'slides', 'configurator', 'modal.css') 6 | 7 | const observer = new MutationObserver((mutationsList) => { 8 | /* need to observe to show or hide the script button */ 9 | const notionControls = showOrHideButton.targetElement(); 10 | if (notionControls) { 11 | showOrHideButton.observer().observe(notionControls, { attributeFilter: ['style'], attributes: true }) 12 | } 13 | 14 | for (const mutation of mutationsList) { 15 | if (mutation.type === 'childList') { 16 | const configurator = [...document.querySelectorAll('div[contenteditable="true"]')].find( 17 | div => div.textContent.includes('[enable-slide-configurator=true]') 18 | ) 19 | 20 | if (configurator) { 21 | ButtonAction.addToTargetElement(); 22 | } else { 23 | ButtonAction.removeFromTargetElement(); 24 | } 25 | } 26 | } 27 | }); 28 | 29 | observer.observe(document.body, { childList: true, subtree: true }); 30 | 31 | 32 | /* need to observe to show or hide custom button */ 33 | const showOrHideButton = { 34 | targetElement: () => document.querySelector('.notion-page-controls > div:first-child'), 35 | elementoParaAplicarEstilo: () => document.querySelector('.add-script-button'), 36 | observer: () => new MutationObserver((mutationsList) => { 37 | const targetElement = showOrHideButton.targetElement(); 38 | const elementoParaAplicarEstilo = showOrHideButton.elementoParaAplicarEstilo(); 39 | 40 | if (!targetElement || !elementoParaAplicarEstilo) return; 41 | 42 | for (let mutation of mutationsList) { 43 | if (mutation.type === 'attributes' && mutation.attributeName === 'style') { 44 | const novoEstilo = targetElement.getAttribute('style'); 45 | elementoParaAplicarEstilo.setAttribute('style', novoEstilo); 46 | } 47 | } 48 | }) 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/configurator/modal.css: -------------------------------------------------------------------------------- 1 | #scriptModal { 2 | width: 90vw; 3 | padding: 20px; 4 | border: none; 5 | border-radius: 8px; 6 | box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); 7 | background: var(--dark); 8 | } 9 | 10 | #scriptModal h2 { 11 | margin-top: 0; 12 | margin-bottom: 0.5rem; 13 | font-size: 1.2rem; 14 | color: var(--white); 15 | } 16 | 17 | #scriptModal::backdrop { 18 | background-color: rgba(0, 0, 0, 0.5); 19 | } 20 | 21 | #scriptTextarea { 22 | width: 100%; 23 | height: 350px; 24 | margin-bottom: 10px; 25 | padding: 10px; 26 | border-radius: 4px; 27 | font-family: monospace; 28 | } 29 | 30 | #scriptModal header { 31 | display: flex; 32 | justify-content: space-between; 33 | align-items: center; 34 | } 35 | 36 | /* Estilo dos botões */ 37 | #buttonWrapper { 38 | display: flex; 39 | justify-content: flex-end; 40 | align-items: center; 41 | gap: 0.5rem; 42 | } 43 | 44 | #scriptModal button { 45 | padding: 0 0.5rem; 46 | border: none; 47 | border-radius: 4px; 48 | cursor: pointer; 49 | font-size: 14px; 50 | height: 1.5rem; 51 | display: flex; 52 | align-items: center; 53 | justify-content: center; 54 | color: var(--white); 55 | background-color: var(--dark-2); 56 | } 57 | 58 | #scriptModal button:hover { 59 | background-color: var(--dark-4); 60 | } 61 | 62 | #scriptModal button svg { 63 | width: 14px; 64 | } -------------------------------------------------------------------------------- /src/renderer/modules/slides/configurator/modal.js: -------------------------------------------------------------------------------- 1 | const Modal = { 2 | content: `
3 |

Inserir Script

4 |
5 | 11 | 17 | 20 | 26 |
27 |
28 |
29 | `, 30 | createDialog() { 31 | const dialog = document.createElement('dialog'); 32 | dialog.id = 'scriptModal' 33 | dialog.innerHTML = this.content; 34 | return dialog; 35 | }, 36 | open() { 37 | const scriptModal = document.getElementById('scriptModal'); 38 | const scriptTextarea = document.getElementById('scriptTextarea'); 39 | const scriptTextareaExecute = document.getElementById('scriptTextareaExecute'); 40 | const saveButton = document.getElementById('saveButton'); 41 | const executeButton = document.getElementById('executeButton'); 42 | const pasteButton = document.getElementById('pasteButton'); 43 | const closeButton = document.getElementById('closeButton'); 44 | 45 | scriptModal.showModal(); 46 | 47 | scriptTextareaExecute.value = localStorage.getItem('savedScript') || ''; 48 | scriptTextarea.innerHTML = scriptTextareaExecute.value; 49 | const highlightedValue = hljs.highlightAuto(scriptTextarea.textContent).value 50 | scriptTextarea.innerHTML = highlightedValue 51 | 52 | saveButton.addEventListener('click', () => { 53 | localStorage.setItem('savedScript', scriptTextareaExecute.value); 54 | alert('Script salvo com sucesso!'); 55 | }); 56 | 57 | executeButton.addEventListener('click', () => { 58 | try { 59 | eval(scriptTextareaExecute.value); 60 | alert('Script executado com sucesso!'); 61 | } catch (error) { 62 | alert(`Erro ao executar o script: ${error.message}`); 63 | } 64 | }); 65 | 66 | pasteButton.addEventListener('click', () => { 67 | navigator.clipboard.readText().then((text) => { 68 | scriptTextareaExecute.value = text; 69 | const highlightedValue = hljs.highlightAuto(text).value 70 | scriptTextarea.innerHTML = highlightedValue 71 | }); 72 | }); 73 | 74 | closeButton.addEventListener('click', () => { 75 | scriptModal.close(); 76 | }); 77 | } 78 | } 79 | 80 | document.body.appendChild(Modal.createDialog()) 81 | 82 | module.exports = Modal; -------------------------------------------------------------------------------- /src/renderer/modules/slides/copy.js: -------------------------------------------------------------------------------- 1 | async function copyCode(text) { 2 | await navigator.clipboard.writeText(text) 3 | } 4 | 5 | module.exports.createAndAttachCopyButtonToElement = function (attachToElement) { 6 | const button = document.createElement("button") 7 | button.innerText = "copy" 8 | button.classList.add("copyButton") 9 | button.onclick = async (e) => { 10 | let finalText = "" 11 | attachToElement.firstChild.querySelectorAll("span").forEach((span) => { 12 | finalText += span.innerText 13 | }) 14 | 15 | await copyCode(finalText) 16 | } 17 | 18 | attachToElement.appendChild(button) 19 | } 20 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/get-slides.js: -------------------------------------------------------------------------------- 1 | module.exports.getSlides = function () { 2 | const pageContent = [ 3 | ...document.querySelectorAll(".notion-page-content > div"), 4 | ] 5 | const newSlides = pageContent.filter((item) => 6 | item.classList.contains("notion-divider-block") 7 | ) 8 | 9 | const newSlide = (block) => ({ 10 | title: block, 11 | blocks: [], 12 | }) 13 | 14 | let currentSlide 15 | 16 | const slides = pageContent 17 | .map((block) => { 18 | const isNewSlide = newSlides.find((slide) => slide === block) 19 | 20 | if (isNewSlide) { 21 | currentSlide = newSlide(block) 22 | currentBlock = undefined 23 | return currentSlide 24 | } 25 | 26 | currentSlide && currentSlide.blocks.push(block) 27 | }) 28 | .filter(Boolean) 29 | 30 | return slides 31 | } 32 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/index.js: -------------------------------------------------------------------------------- 1 | require('./configurator/index.js') 2 | const { getSlides } = require("./get-slides.js") 3 | const { render, $slide, getMainFrame } = require("./render.js") 4 | 5 | const injectCSS = require("../../utils/inject-css") 6 | 7 | injectCSS("src", "renderer", "modules", "slides", "slides.css") 8 | injectCSS("src", "renderer", "modules", "slides", "texting.css") 9 | injectCSS("src", "renderer", "modules", "slides", "bg-cover.css") 10 | 11 | let data 12 | let slideIndex = 0 13 | let isRunning = false 14 | let mainFrame 15 | 16 | window.addEventListener("keydown", function (ev) { 17 | if (ev.key === "Escape" && ev.shiftKey) { 18 | isRunning ? hide() : show() 19 | isRunning = !isRunning 20 | } 21 | }) 22 | 23 | function show() { 24 | mainFrame && mainFrame.parentNode.removeChild(mainFrame) 25 | start(slideIndex) 26 | } 27 | 28 | function hide() { 29 | mainFrame.style.display = "none" 30 | window.removeEventListener("keydown", control) 31 | } 32 | 33 | function control(ev) { 34 | switch (ev.key) { 35 | case "ArrowLeft": 36 | move("backward") 37 | break 38 | case "ArrowRight": 39 | move("forward") 40 | break 41 | } 42 | } 43 | 44 | function move(dir) { 45 | var dx = dir === "backward" ? -1 : 1 46 | 47 | const isLeft = dx === -1 48 | 49 | if (isLeft) { 50 | if (slideIndex - 1 < 0) { 51 | return 52 | } else { 53 | slideIndex-- 54 | } 55 | } else { 56 | if (slideIndex + 1 >= data.length) { 57 | return 58 | } else { 59 | slideIndex++ 60 | } 61 | } 62 | 63 | render($slide, data[slideIndex]) 64 | } 65 | 66 | function start() { 67 | data = getSlides() 68 | mainFrame = getMainFrame() 69 | 70 | window.addEventListener("keydown", control) 71 | 72 | prepareSlideWrapper() 73 | render($slide, data[slideIndex]) 74 | } 75 | 76 | function prepareSlideWrapper() { 77 | const notionPageContentStyles = document 78 | .querySelector("#notion-app main .notion-page-content") 79 | .getAttribute("style") 80 | $slide.classList.add("notion-page-content") 81 | $slide.setAttribute("style", notionPageContentStyles) 82 | $slide.setAttribute("id", "slide-inner") 83 | } 84 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/main-frame.js: -------------------------------------------------------------------------------- 1 | const { backgroundCover } = require('./bg-cover') 2 | 3 | module.exports.createMainFrame = function () { 4 | let mainFrame = document.createElement('div') 5 | mainFrame.classList.add('notion-frame') 6 | mainFrame.classList.add('slides') 7 | 8 | const isDark = document.body.classList.contains('dark') 9 | if (isDark) { 10 | mainFrame.style.color = 'rgba(255, 255, 255, 0.9)' 11 | mainFrame.style.fill = 'rgba(255, 255, 255, 0.9)' 12 | mainFrame.classList.add('dark') 13 | } 14 | 15 | mainFrame.style.position = 'absolute' 16 | mainFrame.style.top = '0' 17 | mainFrame.style.bottom = '0' 18 | mainFrame.style.left = '0' 19 | mainFrame.style.right = '0' 20 | mainFrame.style.zIndex = '1000' 21 | mainFrame.style.overflow = 'overlay' 22 | 23 | let bgCover = backgroundCover() 24 | bgCover && mainFrame.append(bgCover) 25 | 26 | return mainFrame 27 | } 28 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/render.js: -------------------------------------------------------------------------------- 1 | const { createMainFrame } = require("./main-frame.js") 2 | const { createSlideElement } = require("./slide-element.js") 3 | const { createAndAttachCopyButtonToElement } = require("./copy.js") 4 | 5 | const $slide = createSlideElement() 6 | 7 | module.exports.$slide = $slide 8 | 9 | module.exports.getMainFrame = () => { 10 | const mainFrame = createMainFrame() 11 | mainFrame.appendChild($slide) 12 | document.body.appendChild(mainFrame) 13 | return mainFrame 14 | } 15 | 16 | module.exports.render = ($slide, currentSlide) => { 17 | $slide.innerHTML = "" 18 | if (!currentSlide) return 19 | 20 | for (let block of currentSlide.blocks) { 21 | const buildBlock = block.cloneNode(true) 22 | buildBlock.classList.add("appear") 23 | $slide.appendChild(buildBlock) 24 | } 25 | 26 | let notionCodeBlock = document.querySelectorAll(".slides .notion-code-block") 27 | 28 | if (!notionCodeBlock) return 29 | 30 | notionCodeBlock.forEach(createAndAttachCopyButtonToElement) 31 | } 32 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/slide-element.js: -------------------------------------------------------------------------------- 1 | module.exports.createSlideElement = function () { 2 | let $slide = document.createElement('div') 3 | return $slide 4 | } 5 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/slides.css: -------------------------------------------------------------------------------- 1 | .slides { 2 | --base-bg-color: #070715; 3 | --base-text-color: #f5f5fa; 4 | } 5 | 6 | .slides.notion-frame { 7 | width: 100%; 8 | box-sizing: border-box; 9 | display: flex; 10 | align-items: center; 11 | justify-content: center; 12 | } 13 | 14 | .slides.dark.notion-frame { 15 | background: var(--base-bg-color) !important; 16 | } 17 | 18 | .slides.notion-frame { 19 | background-color: var(--base-text-color) !important; 20 | } 21 | 22 | .slides #slide-inner { 23 | width: 90% !important; 24 | max-width: 800px !important; 25 | margin: 0 auto !important; 26 | padding-bottom: 10vh !important; 27 | padding-left: calc(4rem + env(safe-area-inset-left)) !important; 28 | padding-right: calc(4rem + env(safe-area-inset-right)) !important; 29 | } 30 | 31 | .slides > div > div { 32 | max-width: 100% !important; 33 | } 34 | 35 | /* the copy button is repeated an not needed */ 36 | .slides .copyButton { 37 | display: none !important; 38 | } 39 | 40 | /* animate slides */ 41 | .slides.notion-frame .appear { 42 | opacity: 0; 43 | transform: translateX(-10px); 44 | animation: appear 0.3s ease-in-out forwards; 45 | } 46 | 47 | @keyframes appear { 48 | to { 49 | opacity: 1; 50 | transform: translateX(0); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/renderer/modules/slides/texting.css: -------------------------------------------------------------------------------- 1 | .slides { 2 | --base-primary-color: var(--green); 3 | --font-family: "Plus Jakarta Sans", "Ubuntu", "PT Sans", "Helvetica", 4 | sans-serif; 5 | letter-spacing: 0.03em; 6 | } 7 | 8 | .slides.dark { 9 | color: #f5f5fa; 10 | } 11 | 12 | /* h1 */ 13 | .slides:has([placeholder="Heading 1"]) { 14 | text-align: center !important; 15 | } 16 | 17 | .slides [placeholder="Heading 1"] { 18 | font-size: 3em !important; 19 | line-height: 1 !important; 20 | font-family: var(--font-family) !important; 21 | } 22 | 23 | .slides [placeholder="Heading 1"]::after { 24 | display: block !important; 25 | content: ""; 26 | width: 1.25em !important; 27 | height: 0.125em !important; 28 | background: var(--base-primary-color); 29 | border-radius: 4em !important; 30 | margin: 0.225em auto 0.3875em !important; 31 | } 32 | 33 | /* h2 */ 34 | .slides [placeholder="Heading 2"] { 35 | font-size: 1em !important; 36 | margin-bottom: 0em !important; 37 | line-height: 1.6 !important; 38 | font-family: var(--font-family) !important; 39 | } 40 | 41 | .slides [placeholder="Heading 2"]::after { 42 | content: ""; 43 | display: block; 44 | background: var(--base-primary-color); 45 | height: 0.2em; 46 | width: 1.875em; 47 | border-radius: 10px; 48 | margin-top: 0.3125em; 49 | margin-bottom: 0.875em; 50 | } 51 | 52 | /* p */ 53 | .slides .notion-text-block > div > div > div { 54 | font-size: 1.125em !important; 55 | line-height: 1.6 !important; 56 | margin-inline: 0 !important; 57 | font-family: var(--font-family) !important ; 58 | } 59 | 60 | /* sub h1 p */ 61 | .slides .notion-header-block + .notion-text-block > div > div > div { 62 | font-family: "IBM Plex Mono", "American Typewriter", monospace !important; 63 | } 64 | 65 | /* list */ 66 | .slides 67 | .notion-bulleted_list-block.appear 68 | + .notion-bulleted_list-block.appear { 69 | margin-top: 1.5em !important; 70 | } 71 | 72 | .slides .notion-bulleted_list-block.appear [placeholder="List"] { 73 | font-size: 1.375em !important; 74 | line-height: 1.2 !important; 75 | font-family: var(--font-family) !important; 76 | } 77 | 78 | .slides .notion-bulleted_list-block .notion-text-block { 79 | font-size: 1em !important; 80 | line-height: 1.4 !important; 81 | opacity: 0.7; 82 | } 83 | 84 | .slides .notion-bulleted_list-block > div > div:nth-child(1) div::before { 85 | content: ""; 86 | display: inline-block; 87 | width: 0.3375em !important; 88 | height: 0.3375em !important; 89 | border-radius: 50%; 90 | background-color: var(--base-primary-color); 91 | border: 2px solid black; 92 | margin-right: 0.625em; 93 | display: block !important; 94 | } 95 | 96 | /* sub list item */ 97 | .slides .notion-bulleted_list-block .notion-bulleted_list-block { 98 | font-size: 0.8em !important; 99 | opacity: 0.8; 100 | } 101 | 102 | .slides 103 | .notion-bulleted_list-block 104 | .notion-bulleted_list-block 105 | > div 106 | > div:nth-child(1) 107 | div::before { 108 | background-color: transparent; 109 | border: 2px solid var(--base-primary-color); 110 | } 111 | 112 | /* code-block */ 113 | .slides .notion-code-block { 114 | position: relative; 115 | } 116 | 117 | .copyButton { 118 | border: 0; 119 | background-color: rgb(54 53 54 / 47%); 120 | color: white; 121 | border-radius: 4px; 122 | font-size: 10px; 123 | position: absolute; 124 | right: 8px; 125 | top: 8px; 126 | line-height: 0; 127 | display: flex; 128 | align-items: center; 129 | justify-content: center; 130 | height: 20px; 131 | padding: 0 10px; 132 | cursor: pointer; 133 | 134 | display: none; 135 | } 136 | 137 | .copyButton:hover { 138 | background-color: rgb(54 53 54 / 77%); 139 | } 140 | 141 | .slides .notion-code-block:hover .copyButton { 142 | display: block; 143 | } 144 | -------------------------------------------------------------------------------- /src/renderer/modules/window-manager/create-window.controls.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | const path = require('path') 3 | const fs = require('fs') 4 | const appPath = ipcRenderer.sendSync('request-app-path') 5 | 6 | function createWindowControls() { 7 | const iconsFolder = path.resolve(appPath, 'assets', 'windowsIcons') 8 | const wrapper = document.createElement('div') 9 | wrapper.id = 'window-controls-wrapper' 10 | 11 | wrapper.innerHTML = ` 12 |
13 | ${fs.readFileSync(path.resolve(iconsFolder, 'minimize.svg'))} 14 |
15 |
16 | ${fs.readFileSync(path.resolve(iconsFolder, 'square.svg'))} 17 |
18 |
19 | ${fs.readFileSync(path.resolve(iconsFolder, 'close.svg'))} 20 |
` 21 | return wrapper 22 | } 23 | 24 | module.exports = createWindowControls 25 | -------------------------------------------------------------------------------- /src/renderer/modules/window-manager/create-windows-menu.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | const injectCSS = require('../../utils/inject-css') 3 | 4 | const createWindowControls = require('./create-window.controls') 5 | 6 | function createWindowsMenu() { 7 | injectCSS( 8 | 'src', 9 | 'renderer', 10 | 'modules', 11 | 'window-manager', 12 | 'windowControls.css' 13 | ) 14 | 15 | const windowControlsMenu = createWindowControls() 16 | document.body.appendChild(windowControlsMenu) 17 | 18 | const hideMenu = () => windowControlsMenu.classList.remove('active') 19 | 20 | window.addEventListener('mousemove', event => { 21 | const { pageX, pageY } = event 22 | const { x, height, y } = windowControlsMenu.getBoundingClientRect() 23 | if (pageY <= 10 && pageX > x) { 24 | if (!windowControlsMenu.classList.contains('active')) { 25 | windowControlsMenu.classList.add('active') 26 | } 27 | } 28 | 29 | if (pageY > y + height + 10 || pageX < x) { 30 | if (windowControlsMenu.classList.contains('active')) { 31 | hideMenu() 32 | } 33 | } 34 | }) 35 | 36 | const minimize_btn = document.getElementById('minimize') 37 | minimize_btn.onclick = () => { 38 | ipcRenderer.send('minimize') 39 | hideMenu() 40 | } 41 | 42 | const maxime_btn = document.getElementById('expand') 43 | maxime_btn.onclick = () => { 44 | ipcRenderer.send('expand') 45 | hideMenu() 46 | } 47 | 48 | const close_btn = document.getElementById('close') 49 | close_btn.onclick = () => { 50 | ipcRenderer.send('close') 51 | hideMenu() 52 | } 53 | } 54 | 55 | module.exports = createWindowsMenu 56 | -------------------------------------------------------------------------------- /src/renderer/modules/window-manager/windowControls.css: -------------------------------------------------------------------------------- 1 | #window-controls-wrapper { 2 | position: fixed; 3 | background-color: #000; 4 | height: 35px; 5 | top: 0; 6 | right: 0; 7 | display: flex; 8 | z-index: 100; 9 | margin-top: -35px; 10 | transition: 300ms; 11 | } 12 | 13 | #window-controls-wrapper.active { 14 | margin-top: 0 !important; 15 | } 16 | 17 | #window-controls-wrapper > .button { 18 | width: 45px; 19 | height: 100%; 20 | display: flex; 21 | justify-content: center; 22 | align-items: center; 23 | } 24 | 25 | #window-controls-wrapper > .button:hover { 26 | background-color: #505050; 27 | } 28 | 29 | #window-controls-wrapper > .button:hover:last-child { 30 | background-color: rgba(255, 0, 0, 0.712); 31 | } 32 | 33 | #window-controls-wrapper > .button > svg { 34 | width: 20px; 35 | height: 20px; 36 | margin: auto; 37 | } 38 | -------------------------------------------------------------------------------- /src/renderer/preload.js: -------------------------------------------------------------------------------- 1 | const injectCSS = require("./utils/inject-css") 2 | 3 | window.addEventListener("DOMContentLoaded", () => { 4 | injectCSS("src", "renderer", "styles", "style.css") 5 | 6 | if (process.platform !== "darwin") { 7 | require("./modules/window-manager/create-windows-menu")() 8 | } 9 | 10 | /** slides feat */ 11 | require("./modules/slides/index.js") 12 | 13 | /** content-only feat */ 14 | require("./modules/content-only") 15 | 16 | // drag and move window 17 | var windowTopBar = document.createElement("div") 18 | windowTopBar.id = "maykbrito-eh-o-brabo" 19 | windowTopBar.style.width = "100%" 20 | windowTopBar.style.height = "2.75rem" 21 | windowTopBar.style.position = "absolute" 22 | windowTopBar.style.top = windowTopBar.style.left = 0 23 | windowTopBar.style.webkitAppRegion = "drag" 24 | windowTopBar.style.pointerEvents = "none" 25 | document.body.appendChild(windowTopBar) 26 | }) 27 | -------------------------------------------------------------------------------- /src/renderer/styles/style.css: -------------------------------------------------------------------------------- 1 | :root { 2 | /* Dark */ 3 | --dark-hue: 253; 4 | --dark-0: hsl(var(--dark-hue), 24%, 5%); 5 | --dark: hsl(var(--dark-hue), 24%, 10%); 6 | --dark-1: hsl(var(--dark-hue), 24%, 14%); 7 | --dark-2: hsl(var(--dark-hue), 24%, 18%); 8 | --dark-3: hsl(var(--dark-hue), 24%, 22%); 9 | --dark-4: hsl(var(--dark-hue), 24%, 26%); 10 | --dark-5: hsl(var(--dark-hue), 24%, 30%); 11 | /* Primary */ 12 | --primary-hue: 132; 13 | --primary: hsl(var(--primary-hue), 70%, 65%); 14 | --primary-1: hsl(var(--primary-hue), 70%, 55%); 15 | --primary-2: hsl(var(--primary-hue), 70%, 45%); 16 | --primary-3: hsl(var(--primary-hue), 70%, 35%); 17 | --primary-4: hsl(var(--primary-hue), 70%, 25%); 18 | --primary-5: hsl(var(--primary-hue), 70%, 15%); 19 | 20 | /* colors */ 21 | --pink: hsl(326, 100%, 74%); 22 | --green: #29e0a9; 23 | --purple: hsl(253, 35%, 66%); 24 | --purple-dark: hsl(257, 26%, 40%); 25 | --yellow: hsl(55, 70%, 69%); 26 | --blue: hsl(189, 64%, 68%); 27 | --white: hsl(240, 9%, 89%); 28 | --orange: hsl(26, 74%, 65%); 29 | --red: #ff5c39; 30 | } 31 | 32 | body.dark #notion-app .notion-sidebar { 33 | background-color: var(--dark-1) !important; 34 | color: #fff !important; 35 | } 36 | 37 | body.dark .notion-scroller > div:nth-child(1) { 38 | color: #eee !important; 39 | } 40 | 41 | body.dark 42 | #notion-app 43 | > div 44 | > div 45 | > div.notion-sidebar-container 46 | > div:nth-child(1) 47 | > div:nth-child(2) 48 | > div 49 | > div:nth-child(1), 50 | body.dark 51 | #notion-app 52 | > div 53 | > div 54 | > div.notion-sidebar-container 55 | > div:nth-child(1) 56 | > div:nth-child(2) 57 | > div 58 | > div:nth-child(5) 59 | > div:nth-child(1) 60 | > span 61 | > div 62 | > div 63 | > div:nth-child(2), 64 | body.dark .notion-topbar { 65 | color: #fff !important; 66 | background-color: var(--dark-1) !important; 67 | border-bottom: 1px solid var(--primary-4); 68 | } 69 | 70 | body.dark .notion-frame .notion-selectable a { 71 | background: rgb(43, 43, 43) !important; 72 | } 73 | 74 | body.dark 75 | div.notion-overlay-container.notion-default-overlay-container 76 | > div:nth-child(2) 77 | > div 78 | > div:nth-child(2) 79 | > div:nth-child(1) 80 | > div:nth-child(1) 81 | > div:nth-child(3) { 82 | background: transparent !important; 83 | } 84 | 85 | /* scrollbar */ 86 | 87 | body.dark .notion-scroller::-webkit-scrollbar { 88 | width: 0.4rem; 89 | height: 0.4rem; 90 | background: var(--dark-1); 91 | } 92 | 93 | body.dark .notion-scroller::-webkit-scrollbar * { 94 | background: transparent; 95 | } 96 | 97 | body.dark .notion-scroller::-webkit-scrollbar-thumb { 98 | background: var(--primary-2) !important; 99 | cursor: pointer; 100 | border-radius: 1.6rem; 101 | } 102 | 103 | body.dark .notion-scroller::-webkit-scrollbar-track { 104 | background: var(--dark-1); 105 | } 106 | 107 | body.dark #notion-app .notion-topbar > div > div:nth-child(2) { 108 | display: none !important; 109 | } 110 | 111 | /* links clickable */ 112 | 113 | body.dark .notion-frame .notion-selectable a { 114 | background: var(--dark-1) !important; 115 | } 116 | 117 | /* help button */ 118 | 119 | body.dark 120 | #notion-app 121 | > div 122 | > div.notion-cursor-listener 123 | > div.notion-help-button { 124 | background: var(--dark-1) !important; 125 | } 126 | 127 | body.dark .notion-frame, 128 | .notion-cursor-listener, 129 | /* float page */ 130 | body.dark .notion-peek-renderer>div>div, 131 | /* every style that has rgb(47, 52, 55) as bg */ 132 | [style*='rgb(47, 52, 55)'], 133 | [style*='background: rgb(32, 32, 32)'], 134 | [style*='background: rgb(25, 25, 25)'] { 135 | background: var(--dark-1) !important; 136 | } 137 | 138 | /* when hovering some elements */ 139 | [style*="rgb(71, 76, 80)"] { 140 | background: var(--dark-3) !important; 141 | } 142 | 143 | /* floating menu * floating options */ 144 | body.dark div[style*="rgb(55, 60, 63)"], 145 | body.dark div[style*="rgb(63, 68, 71)"] { 146 | background-color: var(--dark-1) !important; 147 | } 148 | 149 | /* code block */ 150 | body.dark .notion-code-block { 151 | background: var(--dark) !important; 152 | } 153 | body.dark [style*="rgba(255, 255, 255, 0.03)"] { 154 | background: rgba(255, 255, 255, 0) !important; 155 | } 156 | 157 | body.dark .notion-code-block .token.keyword, 158 | body.dark .notion-code-block .token.operator, 159 | body.dark .notion-code-block .token.unit, 160 | body.dark .notion-code-block .token.tag, 161 | body.dark .notion-code-block .token.selector, 162 | body.dark .notion-code-block .token.important { 163 | color: var(--pink); 164 | } 165 | 166 | body.dark .notion-code-block .token.property { 167 | color: var(--purple); 168 | } 169 | 170 | body.dark .notion-code-block .token.comment { 171 | color: var(--purple-dark); 172 | } 173 | 174 | body.dark .notion-code-block .token.variable { 175 | color: var(--white); 176 | } 177 | 178 | body.dark .notion-code-block .token.parameter { 179 | color: var(--orange); 180 | } 181 | 182 | body.dark .notion-code-block .token.function, 183 | body.dark .notion-code-block .token.attr-name, 184 | body.dark .notion-code-block .token.punctuation.attr-equals { 185 | color: var(--green); 186 | } 187 | 188 | body.dark .notion-code-block .token.number { 189 | color: var(--blue); 190 | } 191 | 192 | body.dark .notion-code-block .token.string, 193 | body.dark .notion-code-block .token.attr-value { 194 | color: var(--yellow); 195 | } 196 | 197 | /* colors */ 198 | body [style*="209, 87, 150"], 199 | body [style*="193, 76, 138"], 200 | body [style*="223, 132, 209"] { 201 | color: var(--pink) !important; 202 | } 203 | 204 | body [style*="223, 84, 82"], 205 | body [style*="212, 76, 71"] { 206 | color: var(--red) !important; 207 | } 208 | 209 | body [style*="68, 131, 97"], 210 | body [style*="82, 158, 114"], 211 | body [style*="113, 178, 131"] { 212 | color: var(--green) !important; 213 | } 214 | 215 | body [style*="217, 115, 13"], 216 | body [style*="199, 125, 72"], 217 | body [style*="217, 133, 56"] { 218 | color: var(--orange) !important; 219 | } 220 | 221 | body [style*="201, 145, 38"], 222 | body [style*="203, 145, 47"], 223 | body [style*="202, 152, 73"] { 224 | color: var(--yellow) !important; 225 | } 226 | 227 | body [style*="51, 126, 169"], 228 | body [style*="94, 135, 201"], 229 | body [style*="102, 170, 218"] { 230 | color: var(--blue) !important; 231 | } 232 | 233 | body [style*="144, 101, 176"], 234 | body [style*="157, 104, 211"], 235 | body [style*="176, 152, 217"] { 236 | color: var(--purple) !important; 237 | } 238 | 239 | .notion-topbar > div:first-child { 240 | -webkit-app-region: drag; 241 | } 242 | 243 | .notion-topbar > div:first-child * { 244 | -webkit-app-region: no-drag; 245 | } 246 | 247 | [style*="background: rgb(37, 37, 37)"] { 248 | background: var(--dark) !important; 249 | } -------------------------------------------------------------------------------- /src/renderer/utils/inject-css.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require("electron") 2 | const path = require("path") 3 | const appPath = ipcRenderer.sendSync("request-app-path") 4 | const fs = require("fs") 5 | 6 | function injectCSS(...cssPathSegments) { 7 | const cssPath = path.resolve(appPath, ...cssPathSegments) 8 | const cssContent = fs.readFileSync(cssPath) 9 | const styleEl = document.createElement("style") 10 | styleEl.innerHTML = cssContent 11 | document.head.append(styleEl) 12 | } 13 | 14 | module.exports = injectCSS 15 | -------------------------------------------------------------------------------- /webpack/main.webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | resolve: { 3 | extensions: ['.ts', '.js'] 4 | }, 5 | entry: './src/main/app.js', 6 | module: { 7 | rules: require('./rules.webpack') 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /webpack/renderer.webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | resolve: { 3 | extensions: ['.ts', '.js', '.scss', '.sass', '.css'], 4 | fallback: { 5 | path: false, 6 | fs: false, 7 | util: false, 8 | assert: false, 9 | stream: false, 10 | constants: false 11 | } 12 | }, 13 | target: 'electron-renderer', 14 | module: { 15 | rules: require('./rules.webpack') 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /webpack/rules.webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | { 3 | test: /\.node$/, 4 | use: 'node-loader' 5 | }, 6 | { 7 | test: /\.(m?js|node)$/, 8 | parser: { amd: false }, 9 | use: { 10 | loader: '@marshallofsound/webpack-asset-relocator-loader', 11 | options: { 12 | outputAssetBase: 'native_modules' 13 | } 14 | } 15 | } 16 | ] 17 | --------------------------------------------------------------------------------