UNPKG

reactjs-tiptap-editor

Version:

A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React

1,105 lines 154 kB
import { N as ia, t as Bt, m as sa } from "./index-CXIIg9Sq.js"; import { N as oa, c as Le, R as la } from "./dom-dataset-2RXYq9wp.js"; import { jsxs as _e, jsx as k } from "react/jsx-runtime"; import { d as ne, A as ca, _ as da, a5 as ua, k as xe } from "./RichTextEditor-iSPxjLdO.js"; import * as ue from "react"; import { useRef as Gt, useCallback as pa, useEffect as zt } from "react"; import * as F from "@radix-ui/react-select"; import { ChevronDown as Tn, ChevronUp as fa, Check as ba } from "lucide-react"; const Ht = F.Root, ga = F.Value, bt = ue.forwardRef(({ className: e, children: t, ...n }, i) => /* @__PURE__ */ _e( F.Trigger, { ref: i, className: ne( "richtext-flex richtext-h-10 richtext-w-full richtext-items-center richtext-justify-between richtext-rounded-md richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 [&>span]:richtext-line-clamp-1", e ), ...n, children: [ t, /* @__PURE__ */ k(F.Icon, { asChild: !0, children: /* @__PURE__ */ k(Tn, { className: "richtext-h-4 richtext-w-4 richtext-opacity-50" }) }) ] } )); bt.displayName = F.Trigger.displayName; const Nn = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ k( F.ScrollUpButton, { ref: n, className: ne( "richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1", e ), ...t, children: /* @__PURE__ */ k(fa, { className: "richtext-h-4 richtext-w-4" }) } )); Nn.displayName = F.ScrollUpButton.displayName; const On = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ k( F.ScrollDownButton, { ref: n, className: ne( "richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1", e ), ...t, children: /* @__PURE__ */ k(Tn, { className: "richtext-h-4 richtext-w-4" }) } )); On.displayName = F.ScrollDownButton.displayName; const gt = ue.forwardRef(({ className: e, children: t, position: n = "popper", ...i }, d) => /* @__PURE__ */ k(F.Portal, { children: /* @__PURE__ */ _e( F.Content, { ref: d, className: ne( "richtext-relative richtext-z-50 richtext-max-h-60 richtext-overflow-y-auto richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md richtext-border richtext-bg-popover richtext-text-popover-foreground richtext-shadow-md data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2", n === "popper" && "data-[side=bottom]:richtext-translate-y-1 data-[side=left]:richtext--translate-x-1 data-[side=right]:richtext-translate-x-1 data-[side=top]:richtext--translate-y-1", e ), position: n, ...i, children: [ /* @__PURE__ */ k(Nn, {}), /* @__PURE__ */ k( F.Viewport, { className: ne( "richtext-p-1", n === "popper" && "richtext-h-[var(--radix-select-trigger-height)] richtext-w-full richtext-min-w-[var(--radix-select-trigger-width)]" ), children: t } ), /* @__PURE__ */ k(On, {}) ] } ) })); gt.displayName = F.Content.displayName; const ma = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ k( F.Label, { ref: n, className: ne("richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-font-semibold", e), ...t } )); ma.displayName = F.Label.displayName; const mt = ue.forwardRef(({ className: e, children: t, ...n }, i) => /* @__PURE__ */ _e( F.Item, { ref: i, className: ne( "richtext-relative richtext-flex richtext-w-full richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50", e ), ...n, children: [ /* @__PURE__ */ k("span", { className: "richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center", children: /* @__PURE__ */ k(F.ItemIndicator, { children: /* @__PURE__ */ k(ba, { className: "richtext-h-4 richtext-w-4" }) }) }), /* @__PURE__ */ k(F.ItemText, { children: t }) ] } )); mt.displayName = F.Item.displayName; const ha = ue.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ k( F.Separator, { ref: n, className: ne("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted", e), ...t } )); ha.displayName = F.Separator.displayName; function _a({ action: e, ...t }) { return /* @__PURE__ */ k( ca, { action: e, disabled: t == null ? void 0 : t.disabled, icon: t == null ? void 0 : t.icon, tooltip: t == null ? void 0 : t.tooltip } ); } var Ce = {}, Y = Symbol(), ee = Symbol(), Lt = (e) => typeof e == "string" ? b[e] : e, b = { plain: Ce, plaintext: Ce, text: Ce, txt: Ce }, Ne = (e, t) => (t[ee] || Oe)(e, t), Oe = (e, t) => { for (var n = [e], i, d = [], p = 0; i = Lt(t[Y]); ) delete t[Y], Object.assign(t, i); for (Mn(e, t, n, 0); d[p++] = n[0], n = n[1]; ) ; return d; }, Vt = "</span>", Me = "", Ae = "", Ln = (e) => { for (var t = "", n = e.length, i = 0; i < n; ) t += Cn(e[i++]); return t; }, Cn = (e) => { if (e instanceof be) { var { type: t, alias: n, content: i } = e, d = Me, p = Ae, g = `<span class="token ${t + (n ? " " + n : "") + (t == "keyword" && typeof i == "string" ? " keyword-" + i : "")}">`; Ae += Vt, Me += g; var h = Cn(i); return Me = d, Ae = p, g + h + Vt; } return typeof e != "string" ? Ln(e) : (e = e.replace(/&/g, "&amp;").replace(/</g, "&lt;"), Ae && e.includes(` `) ? e.replace(/\n/g, Ae + ` ` + Me) : e); }, Mn = (e, t, n, i, d) => { for (var p in t) if (t[p]) for (var g = 0, h = t[p], E = Array.isArray(h) ? h : [h]; g < E.length; ++g) { if (d && d[0] == p && d[1] == g) return; for (var y = E[g], l = y.pattern || y, c = Lt(y.inside), w = y.lookbehind, m = y.greedy && l.global, _ = y.alias, a = n, r = i; a && (!d || r < d[2]); r += a[0].length, a = a[1]) { var u = a[0], o = 0, s, f; if (!(u instanceof be)) { if (l.lastIndex = m ? r : 0, s = l.exec(m ? e : u), s && w && s[1] && (f = s[1].length, s.index += f, s[0] = s[0].slice(f)), m) { if (!s) break; if (s[0]) { for (var S = s.index, R = S + s[0].length, A; S >= r + (A = a[0].length); a = a[1], r += A) ; if (a[0] instanceof be) continue; for (var v = a, h = r; (h += v[0].length) < R; v = v[1], o++) ; u = e.slice(r, h), s.index -= r; } } if (s && s[0]) { for (var S = s.index, N = s[0], T = u.slice(S + N.length), L = r + u.length, P = new be(p, c ? Ne(N, c) : N, N, _), M = a, Z = 0, H; M = M[1], Z++ < o; ) ; T && (!M || M[0] instanceof be ? M = [T, M] : M[0] = T + M[0]), r += S, a[0] = S ? u.slice(0, S) : P, S ? a = a[1] = [P, M] : a[1] = M, o && (Mn(e, t, a, r, H = [p, g, L]), L = H[2]), d && L > d[2] && (d[2] = L); } } } } }; function be(e, t, n, i) { this.type = e, this.content = t, this.alias = i, this.length = n.length; } var Ze = "\\b(?:BASH(?:OPTS|_ALIASES|_ARG[CV]|_CMDS|_COMPLETION_COMPAT_DIR|_LINENO|_REMATCH|_SOURCE|_VERSINFO|_VERSION)?|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|E?UID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_(?:ADDRESS|ALL|IDENTIFICATION|MEASUREMENT|MONETARY|NAME|NUMERIC|PAPER|TELEPHONE|TIME)|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS[1-4]|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_(?:CONFIG_DIRS|CURRENT_DESKTOP|DATA_DIRS|GREETER_DATA_DIR|MENU_PREFIX|RUNTIME_DIR|SEAT|SEAT_PATH|SESSION_DESKTOP|SESSION_ID|SESSION_PATH|SESSION_TYPE|VTNR)|XMODIFIERS)\\b", ht = { pattern: /(^(["']?)\w+\2)[ ]+\S.*/, lookbehind: !0, alias: "punctuation" // this looks reasonably well in all themes }, Pn = { variable: /^\$\(|^`|\)$|`$/ }, Pe = { bash: ht, environment: { pattern: RegExp("\\$" + Ze), alias: "constant" }, variable: [ // [0]: Arithmetic Environment { pattern: /\$?\(\([^]*?\)\)/g, greedy: !0, inside: { // If there is a $ sign at the beginning highlight $(( and )) as variable variable: [ { pattern: /(^\$[^]+)../, lookbehind: !0 }, /^\$\(\(/ ], number: /\b0x[a-fA-F\d]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/, // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic operator: /--|\+\+|&&|\|\||(?:\*\*|<<|>>|[%&|^!=<>/*+-])=?|[?:~]/, // If there is no $ sign at the beginning highlight (( and )) as punctuation punctuation: /\(\(?|\)\)?|,|;/ } }, // [1]: Command Substitution { pattern: /\$\((?:[^()]|\([^)]*\))*\)|`[^`]+`/g, greedy: !0, inside: Pn }, // [2]: Brace expansion { pattern: /\$\{[^}]*\}/g, greedy: !0, inside: { operator: /:[?=+-]?|[!/]|##?|%%?|\^\^?|,,?/, punctuation: /[[\]]/, environment: { pattern: RegExp("(\\{)" + Ze), lookbehind: !0, alias: "constant" } } }, /\$(?:\w+|[#?*!@$])/ ], // Escape sequences from echo and printf's manuals, and escaped quotes. entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[a-fA-F\d]{8}|u[a-fA-F\d]{4}|x[a-fA-F\d]{1,2})/ }, Ea = ht.inside = b.sh = b.shell = b.bash = { shebang: { pattern: /^#!\s*\/.*/, alias: "important" }, comment: { pattern: /(^|[^"{\\$])#.*/, lookbehind: !0 }, "function-name": [ // a) function foo { // b) foo() { // c) function foo() { // but not “foo {” { // a) and c) pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/, lookbehind: !0, alias: "function" }, { // b) pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/, alias: "function" } ], // Highlight variable names as variables in for and select beginnings. "for-or-select": { pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/, lookbehind: !0, alias: "variable" }, // Highlight variable names as variables in the left-hand part // of assignments (“=” and “+=”). "assign-left": { pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/, lookbehind: !0, alias: "variable", inside: { environment: { pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + Ze), lookbehind: !0, alias: "constant" } } }, // Highlight parameter names as variables parameter: { pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?![^\s=])/, lookbehind: !0, alias: "variable" }, string: [ // Support for Here-documents https://en.wikipedia.org/wiki/Here_document { pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[^]*?\n\2/g, lookbehind: !0, greedy: !0, inside: Pe }, // Here-document with quotes around the tag // → No expansion (so no “inside”). { pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[^]*?\n\3/g, lookbehind: !0, greedy: !0, inside: { bash: ht } }, // “Normal” string { // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html pattern: /(^|[^\\](?:\\\\)*)"(?:\\[^]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^\\"`$])*"/g, lookbehind: !0, greedy: !0, inside: Pe }, { // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html pattern: /(^|[^$\\])'[^']*'/g, lookbehind: !0, greedy: !0 }, { // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html pattern: /\$'(?:\\[^]|[^\\'])*'/g, greedy: !0, inside: { entity: Pe.entity } } ], environment: { pattern: RegExp("\\$?" + Ze), alias: "constant" }, variable: Pe.variable, function: { pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|c?fdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cron|crontab|c?split|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff3?|dig|dircolors|dirname|dirs?|dmesg|docker|docker-compose|du|[ef]?grep|eject|env|ethtool|expand|expect|expr|fdformat|fg|file|find|fmt|fold|format|free|fsck|fuser|g?awk|git|g?parted|groupadd|groupdel|groupmod|groups|grub-mkconfig|halt|head|hg|history|host|hostname|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|killall|less|link|ln|logname|logrotate|look|lpc|lprint[dq]?|lprm?|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mm?v|more|most|mtools|m?tr|mutt|nano|nc|netstat|nice|nl|node|nohup|notify-send|nslookup|op|open|passwd|paste|pathchk|ping|p?kill|p?npm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ra[mr]|reboot|remsync|rename|renice|rev|rmdir|rp?m|r?sync|[sr]?cp|screen|sdiff|se[dq]|sendmail|service|s?ftp|shellcheck|shuf|shutdown|sleep|s?locate|[sz]?sh|stat|strace|sudo|sum?|suspend|swapon|sysctl|tac|tail|tar|tee|time|timeout|h?top|touch|traceroute|t?sort|tty|u?mount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vim?|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|g?zip|zsh|zypper)(?=$|[)\s;|&])/, lookbehind: !0 }, keyword: { pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/, lookbehind: !0 }, // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html builtin: { pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|[ls]et|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/, lookbehind: !0, // Alias added to make those easier to distinguish from strings. alias: "class-name" }, boolean: { pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/, lookbehind: !0 }, "file-descriptor": { pattern: /\B&\d\b/, alias: "important" }, operator: { // Lots of redirections here, but not just that. pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/, inside: { "file-descriptor": { pattern: /^\d/, alias: "important" } } }, punctuation: /\$?\(\(?|\)\)?|\.\.|[[\]{};\\]/, number: { pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/, lookbehind: !0 } }; [ "comment", "function-name", "for-or-select", "assign-left", "parameter", "string", "environment", "function", "keyword", "builtin", "boolean", "file-descriptor", "operator", "punctuation", "number" ].forEach((e) => Pn[e] = Ea[e]); var $n = /(?:"(?:\\[^]|[^\\\n"])*"|'(?:\\[^]|[^\\\n'])*')/g, $e = $n.source, Zt = { rule: /^@[\w-]+/, "selector-function-argument": { pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^)]*\))*\))+(?=\s*\))/, lookbehind: !0, alias: "selector" }, keyword: { pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/, lookbehind: !0 } // See rest below }; Zt[Y] = b.css = { comment: /\/\*[^]*?\*\//, atrule: { pattern: RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|${$e})*?(?:;|(?=\\s*\\{))`), inside: Zt }, url: { // https://drafts.csswg.org/css-values-3/#urls pattern: RegExp(`\\burl\\((?:${$e}|(?:[^\\\\ "')=]|\\\\[^])*)\\)`, "gi"), greedy: !0, inside: { function: /^url/i, punctuation: /^\(|\)$/, string: { pattern: RegExp("^" + $e + "$"), alias: "url" } } }, selector: { pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|${$e})*(?=\\s*\\{)`), lookbehind: !0 }, string: { pattern: $n, greedy: !0 }, property: { pattern: /(^|[^-\w\xa0-\uffff])(?!\d)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*:)/i, lookbehind: !0 }, important: /!important\b/i, function: { pattern: /(^|[^-a-z\d])[-a-z\d]+(?=\()/i, lookbehind: !0 }, punctuation: /[(){},:;]/ }; var Be = (e, t) => { if (t.has(e)) return t.get(e); var n = e, i = ya.call(e).slice(8, -1); if (i == "Object") { t.set(e, n = {}); for (var d in e) n[d] = Be(e[d], t); e[Y] && (n[Y] = Be(e[Y], t)), e[ee] && (n[ee] = e[ee]); } else if (i == "Array") { t.set(e, n = []); for (var p = 0, g = e.length; p < g; p++) n[p] = Be(e[p], t); } return n; }, et = (e) => Be(e, /* @__PURE__ */ new Map()), ie = (e, t) => Object.assign(et(b[e]), t), $ = (e, t, n) => { var i = {}; for (var d in e) i[d] = e[d], delete e[d]; for (var d in i) d == t && Object.assign(e, n), n.hasOwnProperty(d) || (e[d] = i[d]); }, ya = {}.toString, qe = b.css, qt = { pattern: /(\b\d+)(?:%|[a-z]+(?![\w-]))/, lookbehind: !0 }, Kt = { pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/, lookbehind: !0 }; qe.selector.inside = qe.atrule.inside["selector-function-argument"].inside = { "pseudo-element": /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/, "pseudo-class": /:[-\w]+/, class: /\.[-\w]+/, id: /#[-\w]+/, attribute: { pattern: /\[(?:[^[\]"']|(["'])(?:\\[^]|(?!\1)[^\\\n])*\1)*\]/g, greedy: !0, inside: { punctuation: /^\[|\]$/, "case-sensitivity": { pattern: /(\s)[si]$/i, lookbehind: !0, alias: "keyword" }, namespace: { pattern: /^(\s*)(?:(?!\s)[-*\w\xa0-\uffff])*\|(?!=)/, lookbehind: !0, inside: { punctuation: /\|$/ } }, "attr-name": { pattern: /^(\s*)(?:(?!\s)[-\w\xa0-\uffff])+/, lookbehind: !0 }, "attr-value": { pattern: /(=\s*)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*$)|(["'])(?:\\[^]|(?!\2)[^\\\n])*\2/, lookbehind: !0 }, operator: /[|~*^$]?=/ } }, "n-th": [ { pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/, lookbehind: !0, inside: { number: /[\dn]+/, operator: /[+-]/ } }, { pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i, lookbehind: !0 } ], combinator: />|\+|~|\|\|/, // the `tag` token has been existed and removed. // because we can't find a perfect tokenize to match it. // if you want to add it, please read https://github.com/PrismJS/prism/pull/2373 first. punctuation: /[(),]/ }; $(qe, "property", { variable: { pattern: /(^|[^-\w\xa0-\uffff])--(?!\d)(?:(?!\s)[-\w\xa0-\uffff])*/i, lookbehind: !0 } }); $(qe, "function", { operator: { pattern: /(\s)[/*+-](?!\S)/, lookbehind: !0 }, // CAREFUL! // Previewers and Inline color use hexcode and color. hexcode: { pattern: /\B#[a-f\d]{3,8}\b/i, alias: "color" }, color: [ { pattern: /(^|[^\w-])(?:(?:alice|cadet|cornflower|deepsky|dodger|midnight|powder|royal|sky|steel)blue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blueviolet|brown|burlywood|chartreuse|chocolate|coral|cornsilk|crimson|(?:dark)?(?:blue|cyan|goldenrod|gr[ae]y|green|khaki|magenta|olivegreen|orange|orchid|red|salmon|seagreen|slateblue|slategr[ae]y|turquoise|violet)|deeppink|dimgr[ae]y|firebrick|floralwhite|(?:forest|lawn|lime|pale|spring)green|fuchsia|gainsboro|ghostwhite|gold|greenyellow|honeydew|hotpink|indianred|indigo|ivory|lavender|lavenderblush|lemonchiffon|light(?:blue|coral|cyan|goldenrodyellow|gr[ae]y|green|pink|salmon|seagreen|skyblue|slategr[ae]y|steelblue|yellow)|lime|linen|maroon|medium(?:aquamarine|blue|orchid|purple|seagreen|slateblue|springgreen|turquoise|violetred)|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orangered|palegoldenrod|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|purple|rebeccapurple|rosybrown|saddlebrown|sandybrown|seashell|sienna|silver|snow|tan|teal|thistle|tomato|transparent|wheat|white|whitesmoke|yellow|yellowgreen)(?![\w-])/i, lookbehind: !0 }, { pattern: /\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i, inside: { function: /^[^(]+/, unit: qt, number: Kt, punctuation: /[(),]/ } } ], // it's important that there is no boundary assertion after the hex digits entity: /\\[a-f\d]{1,8}/i, unit: qt, number: Kt }); b.ini = { /** * The component mimics the behavior of the Win32 API parser. * * @see {@link https://github.com/PrismJS/prism/issues/2775#issuecomment-787477723} */ comment: { pattern: /(^[ \f \v]*)[#;].*/m, lookbehind: !0 }, section: { pattern: /(^[ \f \v]*)\[[^\n\]]*\]?/m, lookbehind: !0, inside: { "section-name": { pattern: /(^\[[ \f \v]*)[^ \f \v\]]+(?:[ \f \v]+[^ \f \v\]]+)*/, lookbehind: !0, alias: "selector" }, punctuation: /[[\]]/ } }, key: { pattern: /(^[ \f \v]*)[^ \f\n \v=]+(?:[ \f \v]+[^ \f\n \v=]+)*(?=[ \f \v]*=)/m, lookbehind: !0, alias: "attr-name" }, value: { pattern: /(=[ \f \v]*)[^ \f\n \v]+(?:[ \f \v]+[^ \f\n \v]+)*/, lookbehind: !0, alias: "attr-value", inside: { "inner-value": { pattern: /^(["']).+(?=\1$)/, lookbehind: !0 } } }, punctuation: /=/ }; var se = () => ({ pattern: /\/\/.*|\/\*[^]*?(?:\*\/|$)/g, greedy: !0 }), Ct = () => ({ pattern: /(["'])(?:\\[^]|(?!\1)[^\\\n])*\1/g, greedy: !0 }), Dn = /\b0x[a-f\d]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i, ae = /[()[\]{}.,:;]/, K = /\b(?:false|true)\b/, it = { "interpolation-punctuation": { pattern: /^\$\{?|\}$/, alias: "punctuation" }, expression: { pattern: /[^]+/ } }; it.expression.inside = b.kts = b.kt = b.kotlin = { // https://kotlinlang.org/spec/expressions.html#string-interpolation-expressions "string-literal": [ { pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/, alias: "multiline", inside: { interpolation: { pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i, inside: it }, string: /[^]+/ } }, { pattern: /"(?:\\.|[^\\\n"$]|\$(?:(?!\{)|\{[^{}]*\}))*"/, alias: "singleline", inside: { interpolation: { pattern: /((?:^|[^\\])(?:\\\\)*)\$(?:[a-z_]\w*|\{[^{}]*\})/i, lookbehind: !0, inside: it }, string: /[^]+/ } } ], char: { // https://kotlinlang.org/spec/expressions.html#character-literals pattern: /'(?:[^\\\n']|\\(?:.|u[a-fA-F\d]{0,4}))'/g, greedy: !0 }, comment: se(), annotation: { pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/, alias: "builtin" }, keyword: { // The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/, lookbehind: !0 }, boolean: K, label: { pattern: /\b\w+@|@\w+/, alias: "symbol" }, function: { pattern: /(?:`[^\n`]+`|\b\w+)(?=\s*\()|(\.)(?:`[^\n`]+`|\w+)(?=\s*\{)/g, lookbehind: !0, greedy: !0 }, number: /\b(?:0[xX][a-fA-F\d]+(?:_[a-fA-F\d]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/, operator: /--|\+\+|&&|\|\||->|[!=]==|!!|[%!=<>/*+-]=?|[?:]:?|\.\.|\b(?:and|inv|shl|u?shr|x?or)\b/, punctuation: ae }; var Fn = [ { pattern: /&[a-z\d]{1,8};/i, alias: "named-entity" }, /&#x?[a-f\d]{1,8};/i ], va = { pattern: /<\/?(?!\d)[^\s/=>$<%]+(?:\s(?:\s*[^\s/=>]+(?:\s*=\s*(?!\s)(?:"[^"]*"|'[^']*'|[^\s"'=>]+(?=[\s>]))?|(?=[\s/>])))+)?\s*\/?>/g, greedy: !0, inside: { punctuation: /^<\/?|\/?>$/, tag: { pattern: /^\S+/, inside: { namespace: /^[^:]+:/ } }, "attr-value": [{ pattern: /(=\s*)(?:"[^"]*"|'[^']*'|[^\s"'=>]+)/g, lookbehind: !0, greedy: !0, inside: { punctuation: /^["']|["']$/, entity: Fn } }], "attr-equals": /=/, "attr-name": { pattern: /\S+/, inside: { namespace: /^[^:]+:/ } } } }; b.rss = b.atom = b.ssml = b.xml = { comment: { pattern: /<!--(?:(?!<!--)[^])*?-->/g, greedy: !0 }, prolog: { pattern: /<\?[^]+?\?>/g, greedy: !0 }, doctype: { // https://www.w3.org/TR/xml/#NT-doctypedecl pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/gi, greedy: !0, inside: { "internal-subset": { pattern: /(\[)[^]+(?=\]\s*>$)/, lookbehind: !0, inside: "xml" }, string: /"[^"]*"|'[^']*'/, punctuation: /^<!|[>[\]]/, "doctype-tag": /^DOCTYPE/i, name: /\S+/ } }, cdata: { pattern: /<!\[CDATA\[[^]*?\]\]>/gi, greedy: !0 }, tag: va, entity: Fn, "markup-bracket": { pattern: /[()[\]{}]/, alias: "punctuation" } }; var _t = (e, t) => (e["language-" + t] = { pattern: /[^]+/, inside: t }, e), Wt = (e, t) => ({ pattern: RegExp(`(<${e}[^>]*>)(?!</${e}>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])+?(?=</${e}>)`, "gi"), lookbehind: !0, greedy: !0, inside: _t({ "included-cdata": { pattern: /<!\[CDATA\[[^]*?\]\]>/i, inside: _t({ cdata: /^<!\[CDATA\[|\]\]>$/i }, t) } }, t) }), jt = (e, t) => ({ pattern: RegExp(`((?:^|["'\\s])(?:${e})\\s*=\\s*)(?:"[^"]*"|'[^']*'|[^\\s"'=>]+)`, "gi"), lookbehind: !0, greedy: !0, inside: _t({ punctuation: /^["']|["']$/ }, t) }), Un = b.svg = b.mathml = b.html = b.markup = et(b.xml); Un.tag.inside["attr-value"].unshift( jt("style", "css"), jt("on[a-z]+", "javascript") ); $(Un, "cdata", { style: Wt("style", "css"), script: Wt("script", "javascript") }); b.r = { comment: /#.*/, string: { pattern: /(["'])(?:\\.|(?!\1)[^\\\n])*\1/g, greedy: !0 }, "percent-operator": { // Includes user-defined operators // and %%, %*%, %/%, %in%, %o%, %x% pattern: /%[^%\s]*%/, alias: "operator" }, boolean: /\b(?:FALSE|TRUE)\b/, ellipsis: /\.\.(?:\.|\d+)/, number: [ /\b(?:Inf|NaN)\b/, /(?:\b0x[a-fA-F\d]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/ ], keyword: /\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/, operator: /->>?|<=|<<?-|[!=<>]=?|::?|&&?|\|\|?|[~^$@/*+-]/, punctuation: /[()[\]{},;]/ }; b.basic = { comment: { pattern: /(?:!|rem\b).+/i, inside: { keyword: /^rem/i } }, string: { pattern: /"(?:""|[#$%&'().,:;\w ?^!=<>/*+-])*"/g, greedy: !0 }, number: /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i, keyword: /\b(?:as|beep|bload|bsave|call absolute|call|case|chain|chdir|clear|close|cls|com|common|const|data|declare|def(?: fn| seg|dbl|int|[ls]ng|str)|dim|do|double|else|elseif|environ|erase|error|exit|field|files|for|function|get|gosub|goto|if|input|integer|ioctl|key|kill|line input|locate|lock|long|loop|[lr]set|mkdir|name|next|off|on(?: com| error| key| timer)?|open|option base|[op]ut|poke|read|redim|rem|restore|resume|return|rmdir|run|select case|shared|shell|single|sleep|static|step|stop|string|sub|swap|system|then|timer|to|troff|tron|type|unlock|until|using|view print|wait|w?end|while|write)(?:\$|\b)/i, function: /\b(?:abs|access|a?cos|angle|area|arithmetic|array|a?sin|ask|atn?|base|begin|break|cause|ceil|chr|clip|collate|color|co[nst]|cosh|csc|date|datum|debug|decimal|de[fgt]|degrees|delete|device|display|dot|elapsed|eps|erasable|exline|exp|external|extype|filetype|fixed|fp|go|graph|handler|idn|image|int?|internal|ip|is|keyed|[lu]bound|[lu]case|left|le[nt]|length|lines?|log2?|log10|[lr]trim|margin|ma[tx]|maxnum|mi[dn]|missing|mod|native|nul|numeric|of|option|ord|organization|outin|output|pi|pointer|points?|pos|print|program|prompt|rad|radians|randomize|record|recsize|rectype|relative|remainder|repeat|rest|retry|rewrite|right|rnd|round|same|se[ct]|select|sequential|setter|sgn|sinh|size|skip|s[qt]r|standard|status|stream|style|tab|tanh?|template|text|there|time|timeout|trace|transform|truncate|use|val|variable|viewport|when|window|with|zer|zonewidth)(?:\$|\b)/i, operator: /<=|<>|>=|[&^=<>/*+-]|\b(?:and|eqv|imp|not|x?or)\b/i, punctuation: /[(),:;]/ }; b.vbnet = ie("basic", { comment: { pattern: /(?:!|'|rem\b).*/i, inside: { keyword: /^rem/i } }, string: { pattern: /(^|[^"])"(?:""|[^"])*"(?!")/g, lookbehind: !0, greedy: !0 }, keyword: /(?:\b(?:addhandler|addressof|alias|and|andalso|as|beep|bload|boolean|bsave|byref|byval|call absolute|call|case|catch|cbool|c?byte|cc?har|c?date|cdbl|cdec|chain|chdir|cu?int|class|clear|close|cls|cobj|com|common|const|continue|c?sbyte|c?u?short|c?sng|cstr|c?type|cu?lng|data|decimal|declare|def(?: fn| seg|dbl|int|lng|sng|str)|default|delegate|dim|directcast|do|double|else|elseif|enum|environ|erase|error|event|exit|false|true|field|files|finally|for each|for|friend|function|[gls]et|gettype|getxmlnamespace|global|gosub|goto|handles|i[fns]|implements|imports|inherits|input|interface|ioctl|isnot|key|kill|lib|like|line input|locate|lock|loop|[lr]set|me|mkdir|mod|module|mustinherit|mustoverride|mybase|myclass|name|namespace|narrowing|new|next|not|nothing|notinheritable|notoverridable|object|off?|on (?:com|error|key|timer)|on|open|operator|option base|option|optional|orelse|out|overloads|overridable|overrides|paramarray|partial|poke|private|property|protected|public|put|raiseevent|read|readonly|redim|removehandler|restore|resume|return|rmdir|run|select case|select|shadows|shared|shell|single|sleep|static|step|stop|string|structure|sub|swap|synclock|system|[tw]hen|throw|timer|to|troff|tron|try|trycast|typeof|u?integer|u?long|unlock|until|using|view print|wait|w?end|while|widening|with|withevents|write|writeonly|x?or)|\B#(?:const|else|elseif|end|if))(?:\$|\b)/i, punctuation: /[(){},:;]/ }); var Yt = { // https://en.cppreference.com/w/c/language/character_constant pattern: /'(?:\\[^]|[^\\\n']){0,32}'/g, greedy: !0 }, Xt = { pattern: /\/\/(?:[^\\\n]|\\\n?)*|\/\*[^]*?(?:\*\/|$)/g, greedy: !0 }, Qt = { // https://en.cppreference.com/w/c/language/string_literal pattern: /"(?:\\[^]|[^\\\n"])*"/g, greedy: !0 }, Jt = { pattern: /\S[^]*/ }; Jt.inside = b.c = { comment: Xt, char: Yt, macro: { // allow for multiline macro definitions // spaces after the # character compile fine with gcc pattern: /(^[ ]*)#\s*[a-z](?:[^\\\n/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\[^])*/img, lookbehind: !0, greedy: !0, alias: "property", inside: { string: [ { // highlight the path of the include statement as a string pattern: /^(#\s*include\s*)<[^>]+>/, lookbehind: !0 }, Qt ], char: Yt, comment: Xt, "macro-name": [ { pattern: /(^#\s*define\s+)\w+\b(?!\()/i, lookbehind: !0 }, { pattern: /(^#\s*define\s+)\w+/i, lookbehind: !0, alias: "function" } ], // highlight macro directives as keywords directive: { pattern: /^(#\s*)[a-z]+/, lookbehind: !0, alias: "keyword" }, "directive-hash": /^#/, punctuation: /##|\\(?=\n)/, expression: Jt } }, string: Qt, "class-name": { pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([^]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/, lookbehind: !0 }, keyword: /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/, // highlight predefined macros as constants constant: /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/, function: /\b[a-z_]\w*(?=\s*\()/i, number: /(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i, operator: /->|([&|:+-])\1|[?:~]|>>=?|<<=?|[%&|^!=<>/*+-]=?/, punctuation: ae }; $( b.opencl = ie("c", { // Extracted from the official specs (2.0) and http://streamcomputing.eu/downloads/?opencl.lang (opencl-keywords, opencl-types) and http://sourceforge.net/tracker/?func=detail&aid=2957794&group_id=95717&atid=612384 (Words2, partly Words3) keyword: /\b(?:(?:__)?(?:constant|global|kernel|local|private|read_only|read_write|write_only)|__attribute__|auto|(?:bool|u?(?:char|int|long|short)|half|quad)(?:2|3|4|8|16)?|break|case|complex|const|continue|(?:double|float)(?:16(?:x(?:1|2|4|8|16))?|1x(?:1|2|4|8|16)|2(?:x(?:1|2|4|8|16))?|3|4(?:x(?:1|2|4|8|16))?|8(?:x(?:1|2|4|8|16))?)?|default|do|else|enum|extern|for|goto|if|imaginary|inline|packed|pipe|register|restrict|return|signed|sizeof|static|struct|switch|typedef|uniform|union|unsigned|void|volatile|while)\b/, // Extracted from http://streamcomputing.eu/downloads/?opencl.lang (opencl-const) // Math Constants: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/mathConstants.html // Macros and Limits: https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/macroLimits.html number: /(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[fuhl]{0,4}/i, boolean: K, "constant-opencl-kernel": { pattern: /\b(?:CHAR_(?:BIT|MAX|MIN)|CLK_(?:ADDRESS_(?:CLAMP(?:_TO_EDGE)?|NONE|REPEAT)|FILTER_(?:LINEAR|NEAREST)|(?:GLOBAL|LOCAL)_MEM_FENCE|NORMALIZED_COORDS_(?:FALSE|TRUE))|CL_(?:BGRA|(?:HALF_)?FLOAT|INTENSITY|LUMINANCE|A?R?G?B?[Ax]?|(?:(?:UN)?SIGNED|[US]NORM)_(?:INT(?:8|16|32))|UNORM_(?:INT_101010|SHORT_(?:555|565)))|(?:DBL|FLT|HALF)_(?:DIG|EPSILON|(?:MAX|MIN)(?:(?:_10)?_EXP)?|MANT_DIG)|FLT_RADIX|HUGE_VALF?|(?:INT|LONG|SCHAR|SHRT)_(?:MAX|MIN)|INFINITY|MAXFLOAT|M_(?:[12]_PI|2_SQRTPI|E|LN2|LN10|LOG2E?|LOG10E?|PI(?:_[24])?|SQRT(?:1_2|2))(?:_F|_H)?|NAN|(?:UCHAR|UINT|ULONG|USHRT)_MAX)\b/, alias: "constant" } }), "class-name", { // https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/scalarDataTypes.html // https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/otherDataTypes.html "builtin-type": { pattern: /\b(?:_cl_(?:command_queue|context|device_id|event|kernel|mem|platform_id|program|sampler)|cl_(?:image_format|mem_fence_flags)|clk_event_t|event_t|image(?:1d_(?:array_|buffer_)?t|2d_(?:array_(?:depth_|msaa_depth_|msaa_)?|depth_|msaa_depth_|msaa_)?t|3d_t)|ndrange_t|ptrdiff_t|queue_t|reserve_id_t|sampler_t|size_t|u?intptr_t)\b/, alias: "keyword" } } ); var Et = { // Extracted from http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-types and opencl-host) "type-opencl-host": { pattern: /\b(?:cl_(?:GLenum|GLint|GLuin|addressing_mode|bitfield|bool|buffer_create_type|build_status|channel_(?:order|type)|(?:u?(?:char|int|long|short)|double|float)(?:[2348]|16)?|command_(?:queue(?:_info|_properties)?|type)|context(?:_info|_properties)?|device_(?:exec_capabilities|fp_config|id|info|local_mem_type|mem_cache_type|type)|(?:event|sampler)(?:_info)?|filter_mode|half|image_info|kernel(?:_info|_work_group_info)?|map_flags|mem(?:_flags|_info|_object_type)?|platform_(?:id|info)|profiling_info|program(?:_build_info|_info)?))\b/, alias: "keyword" }, "boolean-opencl-host": { pattern: /\bCL_(?:FALSE|TRUE)\b/, alias: "boolean" }, // Extracted from cl.h (2.0) and http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-const) "constant-opencl-host": { pattern: /\bCL_(?:A|ABGR|ADDRESS_(?:CLAMP(?:_TO_EDGE)?|MIRRORED_REPEAT|NONE|REPEAT)|ARGB|BLOCKING|BUFFER_CREATE_TYPE_REGION|BUILD_(?:ERROR|IN_PROGRESS|NONE|PROGRAM_FAILURE|SUCCESS)|COMMAND_(?:ACQUIRE_GL_OBJECTS|BARRIER|COPY_(?:BUFFER(?:_RECT|_TO_IMAGE)?|IMAGE(?:_TO_BUFFER)?)|FILL_(?:BUFFER|IMAGE)|MAP(?:_BUFFER|_IMAGE)|MARKER|MIGRATE(?:_SVM)?_MEM_OBJECTS|NATIVE_KERNEL|NDRANGE_KERNEL|READ_(?:BUFFER(?:_RECT)?|IMAGE)|RELEASE_GL_OBJECTS|SVM_(?:FREE|MAP|MEMCPY|MEMFILL|UNMAP)|TASK|UNMAP_MEM_OBJECT|USER|WRITE_(?:BUFFER(?:_RECT)?|IMAGE))|COMPILER_NOT_AVAILABLE|COMPILE_PROGRAM_FAILURE|COMPLETE|CONTEXT_(?:DEVICES|INTEROP_USER_SYNC|NUM_DEVICES|PLATFORM|PROPERTIES|REFERENCE_COUNT)|DEPTH(?:_STENCIL)?|DEVICE_(?:ADDRESS_BITS|AFFINITY_DOMAIN_(?:L[1-4]_CACHE|NEXT_PARTITIONABLE|NUMA)|AVAILABLE|BUILT_IN_KERNELS|COMPILER_AVAILABLE|DOUBLE_FP_CONFIG|ENDIAN_LITTLE|ERROR_CORRECTION_SUPPORT|EXECUTION_CAPABILITIES|EXTENSIONS|GLOBAL_(?:MEM_(?:CACHELINE_SIZE|CACHE_SIZE|CACHE_TYPE|SIZE)|VARIABLE_PREFERRED_TOTAL_SIZE)|HOST_UNIFIED_MEMORY|IL_VERSION|IMAGE(?:2D_MAX_(?:HEIGHT|WIDTH)|3D_MAX_(?:DEPTH|HEIGHT|WIDTH)|_BASE_ADDRESS_ALIGNMENT|_MAX_ARRAY_SIZE|_MAX_BUFFER_SIZE|_PITCH_ALIGNMENT|_SUPPORT)|LINKER_AVAILABLE|LOCAL_MEM_SIZE|LOCAL_MEM_TYPE|MAX_(?:CLOCK_FREQUENCY|COMPUTE_UNITS|CONSTANT_ARGS|CONSTANT_BUFFER_SIZE|GLOBAL_VARIABLE_SIZE|MEM_ALLOC_SIZE|NUM_SUB_GROUPS|ON_DEVICE_(?:EVENTS|QUEUES)|PARAMETER_SIZE|PIPE_ARGS|READ_IMAGE_ARGS|READ_WRITE_IMAGE_ARGS|SAMPLERS|WORK_GROUP_SIZE|WORK_ITEM_DIMENSIONS|WORK_ITEM_SIZES|WRITE_IMAGE_ARGS)|MEM_BASE_ADDR_ALIGN|MIN_DATA_TYPE_ALIGN_SIZE|NAME|NATIVE_VECTOR_WIDTH_(?:CHAR|DOUBLE|FLOAT|HALF|INT|LONG|SHORT)|NOT_(?:AVAILABLE|FOUND)|OPENCL_C_VERSION|PARENT_DEVICE|PARTITION_(?:AFFINITY_DOMAIN|BY_AFFINITY_DOMAIN|BY_COUNTS|BY_COUNTS_LIST_END|EQUALLY|FAILED|MAX_SUB_DEVICES|PROPERTIES|TYPE)|PIPE_MAX_(?:ACTIVE_RESERVATIONS|PACKET_SIZE)|PLATFORM|PREFERRED_(?:GLOBAL_ATOMIC_ALIGNMENT|INTEROP_USER_SYNC|LOCAL_ATOMIC_ALIGNMENT|PLATFORM_ATOMIC_ALIGNMENT|VECTOR_WIDTH_(?:CHAR|DOUBLE|FLOAT|HALF|INT|LONG|SHORT))|PRINTF_BUFFER_SIZE|PROFILE|PROFILING_TIMER_RESOLUTION|QUEUE_(?:ON_(?:DEVICE_(?:MAX_SIZE|PREFERRED_SIZE|PROPERTIES)|HOST_PROPERTIES)|PROPERTIES)|REFERENCE_COUNT|SINGLE_FP_CONFIG|SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS|SVM_(?:ATOMICS|CAPABILITIES|COARSE_GRAIN_BUFFER|FINE_GRAIN_BUFFER|FINE_GRAIN_SYSTEM)|TYPE(?:_ACCELERATOR|_ALL|_CPU|_CUSTOM|_DEFAULT|_GPU)?|VENDOR(?:_ID)?|VERSION)|DRIVER_VERSION|EVENT_(?:COMMAND_(?:EXECUTION_STATUS|QUEUE|TYPE)|CONTEXT|REFERENCE_COUNT)|EXEC_(?:KERNEL|NATIVE_KERNEL|STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST)|FILTER_(?:LINEAR|NEAREST)|FLOAT|FP_(?:CORRECTLY_ROUNDED_DIVIDE_SQRT|DENORM|FMA|INF_NAN|ROUND_TO_INF|ROUND_TO_NEAREST|ROUND_TO_ZERO|SOFT_FLOAT)|GLOBAL|HALF_FLOAT|IMAGE_(?:ARRAY_SIZE|BUFFER|DEPTH|ELEMENT_SIZE|FORMAT|FORMAT_MISMATCH|FORMAT_NOT_SUPPORTED|HEIGHT|NUM_MIP_LEVELS|NUM_SAMPLES|ROW_PITCH|SLICE_PITCH|WIDTH)|INTENSITY|INVALID_(?:ARG_INDEX|ARG_SIZE|ARG_VALUE|BINARY|BUFFER_SIZE|BUILD_OPTIONS|COMMAND_QUEUE|COMPILER_OPTIONS|CONTEXT|DEVICE|DEVICE_PARTITION_COUNT|DEVICE_QUEUE|DEVICE_TYPE|EVENT|EVENT_WAIT_LIST|GLOBAL_OFFSET|GLOBAL_WORK_SIZE|GL_OBJECT|HOST_PTR|IMAGE_DESCRIPTOR|IMAGE_FORMAT_DESCRIPTOR|IMAGE_SIZE|KERNEL|KERNEL_ARGS|KERNEL_DEFINITION|KERNEL_NAME|LINKER_OPTIONS|MEM_OBJECT|MIP_LEVEL|OPERATION|PIPE_SIZE|PLATFORM|PROGRAM|PROGRAM_EXECUTABLE|PROPERTY|QUEUE_PROPERTIES|SAMPLER|VALUE|WORK_DIMENSION|WORK_GROUP_SIZE|WORK_ITEM_SIZE)|KERNEL_(?:ARG_(?:ACCESS_(?:NONE|QUALIFIER|READ_ONLY|READ_WRITE|WRITE_ONLY)|ADDRESS_(?:CONSTANT|GLOBAL|LOCAL|PRIVATE|QUALIFIER)|INFO_NOT_AVAILABLE|NAME|TYPE_(?:CONST|NAME|NONE|PIPE|QUALIFIER|RESTRICT|VOLATILE))|ATTRIBUTES|COMPILE_NUM_SUB_GROUPS|COMPILE_WORK_GROUP_SIZE|CONTEXT|EXEC_INFO_SVM_FINE_GRAIN_SYSTEM|EXEC_INFO_SVM_PTRS|FUNCTION_NAME|GLOBAL_WORK_SIZE|LOCAL_MEM_SIZE|LOCAL_SIZE_FOR_SUB_GROUP_COUNT|MAX_NUM_SUB_GROUPS|MAX_SUB_GROUP_SIZE_FOR_NDRANGE|NUM_ARGS|PREFERRED_WORK_GROUP_SIZE_MULTIPLE|PRIVATE_MEM_SIZE|PROGRAM|REFERENCE_COUNT|SUB_GROUP_COUNT_FOR_NDRANGE|WORK_GROUP_SIZE)|LINKER_NOT_AVAILABLE|LINK_PROGRAM_FAILURE|LOCAL|LUMINANCE|MAP_(?:FAILURE|READ|WRITE|WRITE_INVALIDATE_REGION)|MEM_(?:ALLOC_HOST_PTR|ASSOCIATED_MEMOBJECT|CONTEXT|COPY_HOST_PTR|COPY_OVERLAP|FLAGS|HOST_NO_ACCESS|HOST_PTR|HOST_READ_ONLY|HOST_WRITE_ONLY|KERNEL_READ_AND_WRITE|MAP_COUNT|OBJECT_(?:ALLOCATION_FAILURE|BUFFER|IMAGE1D|IMAGE1D_ARRAY|IMAGE1D_BUFFER|IMAGE2D|IMAGE2D_ARRAY|IMAGE3D|PIPE)|OFFSET|READ_ONLY|READ_WRITE|REFERENCE_COUNT|SIZE|SVM_ATOMICS|SVM_FINE_GRAIN_BUFFER|TYPE|USES_SVM_POINTER|USE_HOST_PTR|WRITE_ONLY)|MIGRATE_MEM_OBJECT_(?:CONTENT_UNDEFINED|HOST)|MISALIGNED_SUB_BUFFER_OFFSET|NONE|NON_BLOCKING|OUT_OF_(?:HOST_MEMORY|RESOURCES)|PIPE_(?:MAX_PACKETS|PACKET_SIZE)|PLATFORM_(?:EXTENSIONS|HOST_TIMER_RESOLUTION|NAME|PROFILE|VENDOR|VERSION)|PROFILING_(?:COMMAND_(?:COMPLETE|END|QUEUED|START|SUBMIT)|INFO_NOT_AVAILABLE)|PROGRAM_(?:BINARIES|BINARY_SIZES|BINARY_TYPE(?:_COMPILED_OBJECT|_EXECUTABLE|_LIBRARY|_NONE)?|BUILD_(?:GLOBAL_VARIABLE_TOTAL_SIZE|LOG|OPTIONS|STATUS)|CONTEXT|DEVICES|IL|KERNEL_NAMES|NUM_DEVICES|NUM_KERNELS|REFERENCE_COUNT|SOURCE)|QUEUED|QUEUE_(?:CONTEXT|DEVICE|DEVICE_DEFAULT|ON_DEVICE|ON_DEVICE_DEFAULT|OUT_OF_ORDER_EXEC_MODE_ENABLE|PROFILING_ENABLE|PROPERTIES|REFERENCE_COUNT|SIZE)|RA?|READ_(?:ONLY|WRITE)_CACHE|RG|RGB[Ax]?|RG?x|RUNNING|SAMPLER_(?:ADDRESSING_MODE|CONTEXT|FILTER_MODE|LOD_MAX|LOD_MIN|MIP_FILTER_MODE|NORMALIZED_COORDS|REFERENCE_COUNT)|(?:UN)?SIGNED_INT(?:8|16|32)|SNORM_INT(?:8|16)|SUBMITTED|SUCCESS|UNORM_INT(?:8|16|24|_101010|_101010_2)|UNORM_SHORT_5[56]5|VERSION_(?:1_[012]|2_[01])|s?BGRA|sRGB[Ax]?)\b/, alias: "constant" }, // Extracted from cl.h (2.0) and http://streamcomputing.eu/downloads/?opencl_host.lang (opencl-host) "function-opencl-host": { pattern: /\bcl(?:BuildProgram|CloneKernel|CompileProgram|Create(?:Buffer|CommandQueue(?:WithProperties)?|Context|ContextFromType|Image|Image[23]D|Kernel|KernelsInProgram|Pipe|ProgramWith(?:Binary|BuiltInKernels|IL|Source)|Sampler|SamplerWithProperties|SubBuffer|SubDevices|UserEvent)|Enqueue(?:(?:Barrier|Marker)(?:WithWaitList)?|Copy(?:Buffer(?:Rect|ToImage)?|Image(?:ToBuffer)?)|(?:Fill|Map)(?:Buffer|Image)|MigrateMemObjects|NDRangeKernel|NativeKernel|(?:Read|Write)(?:Buffer(?:Rect)?|Image)|SVM(?:Free|Map|MemFill|Memcpy|MigrateMem|Unmap)|Task|UnmapMemObject|WaitForEvents)|Finish|Flush|Get(?:CommandQueueInfo|ContextInfo|Device(?:AndHostTimer|IDs|Info)|Event(?:Profiling)?Info|ExtensionFunctionAddress(?:ForPlatform)?|HostTimer|ImageInfo|Kernel(?:ArgInfo|Info|SubGroupInfo|WorkGroupInfo)|MemObjectInfo|PipeInfo|Platform(?:IDs|Info)|Program(?:Build)?Info|SamplerInfo|SupportedImageFormats)|LinkProgram|(?:Release|Retain)(?:CommandQueue|Context|Device|Event|Kernel|MemObject|Program|Sampler)|SVM(?:Alloc|Free)|Set(?:CommandQueueProperty|DefaultDeviceCommandQueue|EventCallback|Kernel|Kernel(?:Arg(?:SVMPointer)?|ExecInfo)|MemObjectDestructorCallback|UserEventStatus)|Unload(?:Platform)?Compiler|WaitForEvents)\b/, alias: "function" } }; $(b.c, "keyword", Et); b.cpp && (Et["type-opencl-host-cpp"] = { pattern: /\b(?:Buffer|BufferGL|BufferRenderGL|CommandQueue|Context|Device|DeviceCommandQueue|EnqueueArgs|Event|Image(?:[123]D|[12]DArray|1DBuffer|[23]DGL|Format|GL)?|Kernel|KernelFunctor|LocalSpaceArg|Memory|NDRange|Pipe|Platform|Program|SVMAllocator|SVMTrait(?:Atomic|Coarse|Fine|ReadOnly|ReadWrite|WriteOnly)|Sampler|UserEvent)\b/, alias: "keyword" }, $(b.cpp, "keyword", Et)); var wa = b.diff = { // Match all kinds of coord lines (prefixed by "+++", "---" or "***"). // Match "@@ ... @@" coord lines in unified diff. // Match coord lines in normal diff (starts with a number). coord: /^(?:\*{3}|-{3}|\+{3}|\d).*$|^@@.*@@$/m // deleted, inserted, unchanged, diff }, st = { "deleted-sign": "-", "deleted-arrow": "<", "inserted-sign": "+", "inserted-arrow": ">", unchanged: " ", diff: "!" }; for (var pe in st) { var ot = pe.split("-")[0]; wa[pe] = { pattern: RegExp("^(?:[" + st[pe] + `].*$ ?)+`, "m"), alias: ot != pe ? ot : pe == "diff" ? "bold" : void 0, inside: { prefix: { pattern: RegExp("^[" + st[pe] + "]", "mg"), greedy: !0, alias: ot } } }; } var lt = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|opens?|package|permits|private|protected|provides|public|record(?!\s*[()[\]{}%~.,:;?%&|^=<>/*+-])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throws?|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/, Se = "(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*", yt = { pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/, inside: { punctuation: /\./ } }, vt = { namespace: yt, punctuation: /\./ }, en = { pattern: RegExp(`(^|[^\\w.])${Se}[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b`), lookbehind: !0, inside: vt }; b.java = { "doc-comment": { pattern: /\/\*\*(?!\/)[^]*?(?:\*\/|$)/g, greedy: !0, alias: "comment", inside: "javadoc" }, comment: se(), "triple-quoted-string": { // http://openjdk.java.net/jeps/355#Description pattern: /"""[ ]*\n(?:\\.|[^\\])*?"""/g, greedy: !0, alias: "string" }, char: { pattern: /'(?:\\.|[^\\\n']){1,6}'/g, greedy: !0 }, string: { pattern: /(^|[^\\])"(?:\\.|[^\\\n"])*"/g, lookbehind: !0, greedy: !0 }, annotation: { pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/, lookbehind: !0, alias: "punctuation" }, generics: { pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/, inside: { "class-name": en, keyword: lt, punctuation: /[().,:<>]/, operator: /[?&|]/ } }, import: [ { pattern: RegExp(`(\\bimport\\s+)${Se}(?:[A-Z]\\w*|\\*)(?=\\s*;)`), lookbehind: !0, inside: { namespace: yt, punctuation: /\./, operator: /\*/, "class-name": /\w+/ } }, { pattern: RegExp(`(\\bimport\\s+static\\s+)${Se}(?:\\w+|\\*)(?=\\s*;)`), lookbehind: !0, alias: "static", inside: { namespace: yt, static: /\b\w+$/, punctuation: /\./, operator: /\*/, "class-name": /\w+/ } } ], namespace: { pattern: RegExp( `(\\b(?:exports|import(?:\\s+static)?|module|opens?|package|provides|requires|to|transitive|uses|with)\\s+)(?!${lt.source})[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?` ), lookbehind: !0, inside: { punctuation: /\./ } }, "class-name": [ en, { // variables, parameters, and constructor references // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods) pattern: RegExp(`(^|[^\\w.])${Se}[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)`), lookbehind: !0, inside: vt }, { // class names based on keyword // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods) pattern: RegExp(`(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)${Se}[A-Z]\\w*\\b`), lookbehind: !0, inside: vt } ], keyword: lt, boolean: K, function: { pattern: /\b\w+(?=\()|(::\s*)[a-z_]\w*/, lookbehind: !0 }, number: /\b0b[01][01_]*l?\b|\b0x(?:\.[a-f\d_p+-]+|[a-f\d_]+(?:\.[a-f\d_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i, constant: /\b[A-Z][A-Z_\d]+\b/, operator: { pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[%&|^!=<>/*+-]=?)/m, lookbehind: !0 }, punctuation: ae }; $( b.less = ie("css", { comment: se(), atrule: { pattern: /@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/, inside: { punctuation: /[():]/ } }, // selectors and mixins are considered the same selector: { pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/, inside: { // mixin parameters variable: /@+[\w-]+/ } }, prop