UNPKG

@raster-app/sanity-plugin-raster

Version:

A Sanity Studio plugin that integrates [Raster](https://raster.app) - a modern Digital Asset Management (DAM) platform that helps teams organize, optimize, and deliver their media assets with powerful AI features and an intuitive interface.

1,961 lines 86.7 kB
import { jsx, jsxs, Fragment } from "react/jsx-runtime"; import { d as dist } from "./index-Du4XoehK.js"; import { createElement } from "react"; class Schema { /** * @param {SchemaType['property']} property * Property. * @param {SchemaType['normal']} normal * Normal. * @param {Space | undefined} [space] * Space. * @returns * Schema. */ constructor(property, normal, space) { this.normal = normal; this.property = property; if (space) { this.space = space; } } } Schema.prototype.normal = {}; Schema.prototype.property = {}; Schema.prototype.space = void 0; function merge(definitions, space) { const property = {}; const normal = {}; for (const definition of definitions) { Object.assign(property, definition.property); Object.assign(normal, definition.normal); } return new Schema(property, normal, space); } function normalize(value) { return value.toLowerCase(); } class Info { /** * @param {string} property * Property. * @param {string} attribute * Attribute. * @returns * Info. */ constructor(property, attribute) { this.attribute = attribute; this.property = property; } } Info.prototype.attribute = ""; Info.prototype.booleanish = false; Info.prototype.boolean = false; Info.prototype.commaOrSpaceSeparated = false; Info.prototype.commaSeparated = false; Info.prototype.defined = false; Info.prototype.mustUseProperty = false; Info.prototype.number = false; Info.prototype.overloadedBoolean = false; Info.prototype.property = ""; Info.prototype.spaceSeparated = false; Info.prototype.space = void 0; let powers = 0; const boolean = increment(); const booleanish = increment(); const overloadedBoolean = increment(); const number = increment(); const spaceSeparated = increment(); const commaSeparated = increment(); const commaOrSpaceSeparated = increment(); function increment() { return 2 ** ++powers; } const types = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, boolean, booleanish, commaOrSpaceSeparated, commaSeparated, number, overloadedBoolean, spaceSeparated }, Symbol.toStringTag, { value: "Module" })); const checks = ( /** @type {ReadonlyArray<keyof typeof types>} */ Object.keys(types) ); class DefinedInfo extends Info { /** * @constructor * @param {string} property * Property. * @param {string} attribute * Attribute. * @param {number | null | undefined} [mask] * Mask. * @param {Space | undefined} [space] * Space. * @returns * Info. */ constructor(property, attribute, mask, space) { let index = -1; super(property, attribute); mark(this, "space", space); if (typeof mask === "number") { while (++index < checks.length) { const check = checks[index]; mark(this, checks[index], (mask & types[check]) === types[check]); } } } } DefinedInfo.prototype.defined = true; function mark(values, key, value) { if (value) { values[key] = value; } } function create(definition) { const properties = {}; const normals = {}; for (const [property, value] of Object.entries(definition.properties)) { const info = new DefinedInfo( property, definition.transform(definition.attributes || {}, property), value, definition.space ); if (definition.mustUseProperty && definition.mustUseProperty.includes(property)) { info.mustUseProperty = true; } properties[property] = info; normals[normalize(property)] = property; normals[normalize(info.attribute)] = property; } return new Schema(properties, normals, definition.space); } const aria = create({ properties: { ariaActiveDescendant: null, ariaAtomic: booleanish, ariaAutoComplete: null, ariaBusy: booleanish, ariaChecked: booleanish, ariaColCount: number, ariaColIndex: number, ariaColSpan: number, ariaControls: spaceSeparated, ariaCurrent: null, ariaDescribedBy: spaceSeparated, ariaDetails: null, ariaDisabled: booleanish, ariaDropEffect: spaceSeparated, ariaErrorMessage: null, ariaExpanded: booleanish, ariaFlowTo: spaceSeparated, ariaGrabbed: booleanish, ariaHasPopup: null, ariaHidden: booleanish, ariaInvalid: null, ariaKeyShortcuts: null, ariaLabel: null, ariaLabelledBy: spaceSeparated, ariaLevel: number, ariaLive: null, ariaModal: booleanish, ariaMultiLine: booleanish, ariaMultiSelectable: booleanish, ariaOrientation: null, ariaOwns: spaceSeparated, ariaPlaceholder: null, ariaPosInSet: number, ariaPressed: booleanish, ariaReadOnly: booleanish, ariaRelevant: null, ariaRequired: booleanish, ariaRoleDescription: spaceSeparated, ariaRowCount: number, ariaRowIndex: number, ariaRowSpan: number, ariaSelected: booleanish, ariaSetSize: number, ariaSort: null, ariaValueMax: number, ariaValueMin: number, ariaValueNow: number, ariaValueText: null, role: null }, transform(_2, property) { return property === "role" ? property : "aria-" + property.slice(4).toLowerCase(); } }); function caseSensitiveTransform(attributes2, attribute) { return attribute in attributes2 ? attributes2[attribute] : attribute; } function caseInsensitiveTransform(attributes2, property) { return caseSensitiveTransform(attributes2, property.toLowerCase()); } const html$1 = create({ attributes: { acceptcharset: "accept-charset", classname: "class", htmlfor: "for", httpequiv: "http-equiv" }, mustUseProperty: ["checked", "multiple", "muted", "selected"], properties: { // Standard Properties. abbr: null, accept: commaSeparated, acceptCharset: spaceSeparated, accessKey: spaceSeparated, action: null, allow: null, allowFullScreen: boolean, allowPaymentRequest: boolean, allowUserMedia: boolean, alt: null, as: null, async: boolean, autoCapitalize: null, autoComplete: spaceSeparated, autoFocus: boolean, autoPlay: boolean, blocking: spaceSeparated, capture: null, charSet: null, checked: boolean, cite: null, className: spaceSeparated, cols: number, colSpan: null, content: null, contentEditable: booleanish, controls: boolean, controlsList: spaceSeparated, coords: number | commaSeparated, crossOrigin: null, data: null, dateTime: null, decoding: null, default: boolean, defer: boolean, dir: null, dirName: null, disabled: boolean, download: overloadedBoolean, draggable: booleanish, encType: null, enterKeyHint: null, fetchPriority: null, form: null, formAction: null, formEncType: null, formMethod: null, formNoValidate: boolean, formTarget: null, headers: spaceSeparated, height: number, hidden: overloadedBoolean, high: number, href: null, hrefLang: null, htmlFor: spaceSeparated, httpEquiv: spaceSeparated, id: null, imageSizes: null, imageSrcSet: null, inert: boolean, inputMode: null, integrity: null, is: null, isMap: boolean, itemId: null, itemProp: spaceSeparated, itemRef: spaceSeparated, itemScope: boolean, itemType: spaceSeparated, kind: null, label: null, lang: null, language: null, list: null, loading: null, loop: boolean, low: number, manifest: null, max: null, maxLength: number, media: null, method: null, min: null, minLength: number, multiple: boolean, muted: boolean, name: null, nonce: null, noModule: boolean, noValidate: boolean, onAbort: null, onAfterPrint: null, onAuxClick: null, onBeforeMatch: null, onBeforePrint: null, onBeforeToggle: null, onBeforeUnload: null, onBlur: null, onCancel: null, onCanPlay: null, onCanPlayThrough: null, onChange: null, onClick: null, onClose: null, onContextLost: null, onContextMenu: null, onContextRestored: null, onCopy: null, onCueChange: null, onCut: null, onDblClick: null, onDrag: null, onDragEnd: null, onDragEnter: null, onDragExit: null, onDragLeave: null, onDragOver: null, onDragStart: null, onDrop: null, onDurationChange: null, onEmptied: null, onEnded: null, onError: null, onFocus: null, onFormData: null, onHashChange: null, onInput: null, onInvalid: null, onKeyDown: null, onKeyPress: null, onKeyUp: null, onLanguageChange: null, onLoad: null, onLoadedData: null, onLoadedMetadata: null, onLoadEnd: null, onLoadStart: null, onMessage: null, onMessageError: null, onMouseDown: null, onMouseEnter: null, onMouseLeave: null, onMouseMove: null, onMouseOut: null, onMouseOver: null, onMouseUp: null, onOffline: null, onOnline: null, onPageHide: null, onPageShow: null, onPaste: null, onPause: null, onPlay: null, onPlaying: null, onPopState: null, onProgress: null, onRateChange: null, onRejectionHandled: null, onReset: null, onResize: null, onScroll: null, onScrollEnd: null, onSecurityPolicyViolation: null, onSeeked: null, onSeeking: null, onSelect: null, onSlotChange: null, onStalled: null, onStorage: null, onSubmit: null, onSuspend: null, onTimeUpdate: null, onToggle: null, onUnhandledRejection: null, onUnload: null, onVolumeChange: null, onWaiting: null, onWheel: null, open: boolean, optimum: number, pattern: null, ping: spaceSeparated, placeholder: null, playsInline: boolean, popover: null, popoverTarget: null, popoverTargetAction: null, poster: null, preload: null, readOnly: boolean, referrerPolicy: null, rel: spaceSeparated, required: boolean, reversed: boolean, rows: number, rowSpan: number, sandbox: spaceSeparated, scope: null, scoped: boolean, seamless: boolean, selected: boolean, shadowRootClonable: boolean, shadowRootDelegatesFocus: boolean, shadowRootMode: null, shape: null, size: number, sizes: null, slot: null, span: number, spellCheck: booleanish, src: null, srcDoc: null, srcLang: null, srcSet: null, start: number, step: null, style: null, tabIndex: number, target: null, title: null, translate: null, type: null, typeMustMatch: boolean, useMap: null, value: booleanish, width: number, wrap: null, writingSuggestions: null, // Legacy. // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis align: null, // Several. Use CSS `text-align` instead, aLink: null, // `<body>`. Use CSS `a:active {color}` instead archive: spaceSeparated, // `<object>`. List of URIs to archives axis: null, // `<td>` and `<th>`. Use `scope` on `<th>` background: null, // `<body>`. Use CSS `background-image` instead bgColor: null, // `<body>` and table elements. Use CSS `background-color` instead border: number, // `<table>`. Use CSS `border-width` instead, borderColor: null, // `<table>`. Use CSS `border-color` instead, bottomMargin: number, // `<body>` cellPadding: null, // `<table>` cellSpacing: null, // `<table>` char: null, // Several table elements. When `align=char`, sets the character to align on charOff: null, // Several table elements. When `char`, offsets the alignment classId: null, // `<object>` clear: null, // `<br>`. Use CSS `clear` instead code: null, // `<object>` codeBase: null, // `<object>` codeType: null, // `<object>` color: null, // `<font>` and `<hr>`. Use CSS instead compact: boolean, // Lists. Use CSS to reduce space between items instead declare: boolean, // `<object>` event: null, // `<script>` face: null, // `<font>`. Use CSS instead frame: null, // `<table>` frameBorder: null, // `<iframe>`. Use CSS `border` instead hSpace: number, // `<img>` and `<object>` leftMargin: number, // `<body>` link: null, // `<body>`. Use CSS `a:link {color: *}` instead longDesc: null, // `<frame>`, `<iframe>`, and `<img>`. Use an `<a>` lowSrc: null, // `<img>`. Use a `<picture>` marginHeight: number, // `<body>` marginWidth: number, // `<body>` noResize: boolean, // `<frame>` noHref: boolean, // `<area>`. Use no href instead of an explicit `nohref` noShade: boolean, // `<hr>`. Use background-color and height instead of borders noWrap: boolean, // `<td>` and `<th>` object: null, // `<applet>` profile: null, // `<head>` prompt: null, // `<isindex>` rev: null, // `<link>` rightMargin: number, // `<body>` rules: null, // `<table>` scheme: null, // `<meta>` scrolling: booleanish, // `<frame>`. Use overflow in the child context standby: null, // `<object>` summary: null, // `<table>` text: null, // `<body>`. Use CSS `color` instead topMargin: number, // `<body>` valueType: null, // `<param>` version: null, // `<html>`. Use a doctype. vAlign: null, // Several. Use CSS `vertical-align` instead vLink: null, // `<body>`. Use CSS `a:visited {color}` instead vSpace: number, // `<img>` and `<object>` // Non-standard Properties. allowTransparency: null, autoCorrect: null, autoSave: null, disablePictureInPicture: boolean, disableRemotePlayback: boolean, prefix: null, property: null, results: number, security: null, unselectable: null }, space: "html", transform: caseInsensitiveTransform }); const svg$1 = create({ attributes: { accentHeight: "accent-height", alignmentBaseline: "alignment-baseline", arabicForm: "arabic-form", baselineShift: "baseline-shift", capHeight: "cap-height", className: "class", clipPath: "clip-path", clipRule: "clip-rule", colorInterpolation: "color-interpolation", colorInterpolationFilters: "color-interpolation-filters", colorProfile: "color-profile", colorRendering: "color-rendering", crossOrigin: "crossorigin", dataType: "datatype", dominantBaseline: "dominant-baseline", enableBackground: "enable-background", fillOpacity: "fill-opacity", fillRule: "fill-rule", floodColor: "flood-color", floodOpacity: "flood-opacity", fontFamily: "font-family", fontSize: "font-size", fontSizeAdjust: "font-size-adjust", fontStretch: "font-stretch", fontStyle: "font-style", fontVariant: "font-variant", fontWeight: "font-weight", glyphName: "glyph-name", glyphOrientationHorizontal: "glyph-orientation-horizontal", glyphOrientationVertical: "glyph-orientation-vertical", hrefLang: "hreflang", horizAdvX: "horiz-adv-x", horizOriginX: "horiz-origin-x", horizOriginY: "horiz-origin-y", imageRendering: "image-rendering", letterSpacing: "letter-spacing", lightingColor: "lighting-color", markerEnd: "marker-end", markerMid: "marker-mid", markerStart: "marker-start", navDown: "nav-down", navDownLeft: "nav-down-left", navDownRight: "nav-down-right", navLeft: "nav-left", navNext: "nav-next", navPrev: "nav-prev", navRight: "nav-right", navUp: "nav-up", navUpLeft: "nav-up-left", navUpRight: "nav-up-right", onAbort: "onabort", onActivate: "onactivate", onAfterPrint: "onafterprint", onBeforePrint: "onbeforeprint", onBegin: "onbegin", onCancel: "oncancel", onCanPlay: "oncanplay", onCanPlayThrough: "oncanplaythrough", onChange: "onchange", onClick: "onclick", onClose: "onclose", onCopy: "oncopy", onCueChange: "oncuechange", onCut: "oncut", onDblClick: "ondblclick", onDrag: "ondrag", onDragEnd: "ondragend", onDragEnter: "ondragenter", onDragExit: "ondragexit", onDragLeave: "ondragleave", onDragOver: "ondragover", onDragStart: "ondragstart", onDrop: "ondrop", onDurationChange: "ondurationchange", onEmptied: "onemptied", onEnd: "onend", onEnded: "onended", onError: "onerror", onFocus: "onfocus", onFocusIn: "onfocusin", onFocusOut: "onfocusout", onHashChange: "onhashchange", onInput: "oninput", onInvalid: "oninvalid", onKeyDown: "onkeydown", onKeyPress: "onkeypress", onKeyUp: "onkeyup", onLoad: "onload", onLoadedData: "onloadeddata", onLoadedMetadata: "onloadedmetadata", onLoadStart: "onloadstart", onMessage: "onmessage", onMouseDown: "onmousedown", onMouseEnter: "onmouseenter", onMouseLeave: "onmouseleave", onMouseMove: "onmousemove", onMouseOut: "onmouseout", onMouseOver: "onmouseover", onMouseUp: "onmouseup", onMouseWheel: "onmousewheel", onOffline: "onoffline", onOnline: "ononline", onPageHide: "onpagehide", onPageShow: "onpageshow", onPaste: "onpaste", onPause: "onpause", onPlay: "onplay", onPlaying: "onplaying", onPopState: "onpopstate", onProgress: "onprogress", onRateChange: "onratechange", onRepeat: "onrepeat", onReset: "onreset", onResize: "onresize", onScroll: "onscroll", onSeeked: "onseeked", onSeeking: "onseeking", onSelect: "onselect", onShow: "onshow", onStalled: "onstalled", onStorage: "onstorage", onSubmit: "onsubmit", onSuspend: "onsuspend", onTimeUpdate: "ontimeupdate", onToggle: "ontoggle", onUnload: "onunload", onVolumeChange: "onvolumechange", onWaiting: "onwaiting", onZoom: "onzoom", overlinePosition: "overline-position", overlineThickness: "overline-thickness", paintOrder: "paint-order", panose1: "panose-1", pointerEvents: "pointer-events", referrerPolicy: "referrerpolicy", renderingIntent: "rendering-intent", shapeRendering: "shape-rendering", stopColor: "stop-color", stopOpacity: "stop-opacity", strikethroughPosition: "strikethrough-position", strikethroughThickness: "strikethrough-thickness", strokeDashArray: "stroke-dasharray", strokeDashOffset: "stroke-dashoffset", strokeLineCap: "stroke-linecap", strokeLineJoin: "stroke-linejoin", strokeMiterLimit: "stroke-miterlimit", strokeOpacity: "stroke-opacity", strokeWidth: "stroke-width", tabIndex: "tabindex", textAnchor: "text-anchor", textDecoration: "text-decoration", textRendering: "text-rendering", transformOrigin: "transform-origin", typeOf: "typeof", underlinePosition: "underline-position", underlineThickness: "underline-thickness", unicodeBidi: "unicode-bidi", unicodeRange: "unicode-range", unitsPerEm: "units-per-em", vAlphabetic: "v-alphabetic", vHanging: "v-hanging", vIdeographic: "v-ideographic", vMathematical: "v-mathematical", vectorEffect: "vector-effect", vertAdvY: "vert-adv-y", vertOriginX: "vert-origin-x", vertOriginY: "vert-origin-y", wordSpacing: "word-spacing", writingMode: "writing-mode", xHeight: "x-height", // These were camelcased in Tiny. Now lowercased in SVG 2 playbackOrder: "playbackorder", timelineBegin: "timelinebegin" }, properties: { about: commaOrSpaceSeparated, accentHeight: number, accumulate: null, additive: null, alignmentBaseline: null, alphabetic: number, amplitude: number, arabicForm: null, ascent: number, attributeName: null, attributeType: null, azimuth: number, bandwidth: null, baselineShift: null, baseFrequency: null, baseProfile: null, bbox: null, begin: null, bias: number, by: null, calcMode: null, capHeight: number, className: spaceSeparated, clip: null, clipPath: null, clipPathUnits: null, clipRule: null, color: null, colorInterpolation: null, colorInterpolationFilters: null, colorProfile: null, colorRendering: null, content: null, contentScriptType: null, contentStyleType: null, crossOrigin: null, cursor: null, cx: null, cy: null, d: null, dataType: null, defaultAction: null, descent: number, diffuseConstant: number, direction: null, display: null, dur: null, divisor: number, dominantBaseline: null, download: boolean, dx: null, dy: null, edgeMode: null, editable: null, elevation: number, enableBackground: null, end: null, event: null, exponent: number, externalResourcesRequired: null, fill: null, fillOpacity: number, fillRule: null, filter: null, filterRes: null, filterUnits: null, floodColor: null, floodOpacity: null, focusable: null, focusHighlight: null, fontFamily: null, fontSize: null, fontSizeAdjust: null, fontStretch: null, fontStyle: null, fontVariant: null, fontWeight: null, format: null, fr: null, from: null, fx: null, fy: null, g1: commaSeparated, g2: commaSeparated, glyphName: commaSeparated, glyphOrientationHorizontal: null, glyphOrientationVertical: null, glyphRef: null, gradientTransform: null, gradientUnits: null, handler: null, hanging: number, hatchContentUnits: null, hatchUnits: null, height: null, href: null, hrefLang: null, horizAdvX: number, horizOriginX: number, horizOriginY: number, id: null, ideographic: number, imageRendering: null, initialVisibility: null, in: null, in2: null, intercept: number, k: number, k1: number, k2: number, k3: number, k4: number, kernelMatrix: commaOrSpaceSeparated, kernelUnitLength: null, keyPoints: null, // SEMI_COLON_SEPARATED keySplines: null, // SEMI_COLON_SEPARATED keyTimes: null, // SEMI_COLON_SEPARATED kerning: null, lang: null, lengthAdjust: null, letterSpacing: null, lightingColor: null, limitingConeAngle: number, local: null, markerEnd: null, markerMid: null, markerStart: null, markerHeight: null, markerUnits: null, markerWidth: null, mask: null, maskContentUnits: null, maskUnits: null, mathematical: null, max: null, media: null, mediaCharacterEncoding: null, mediaContentEncodings: null, mediaSize: number, mediaTime: null, method: null, min: null, mode: null, name: null, navDown: null, navDownLeft: null, navDownRight: null, navLeft: null, navNext: null, navPrev: null, navRight: null, navUp: null, navUpLeft: null, navUpRight: null, numOctaves: null, observer: null, offset: null, onAbort: null, onActivate: null, onAfterPrint: null, onBeforePrint: null, onBegin: null, onCancel: null, onCanPlay: null, onCanPlayThrough: null, onChange: null, onClick: null, onClose: null, onCopy: null, onCueChange: null, onCut: null, onDblClick: null, onDrag: null, onDragEnd: null, onDragEnter: null, onDragExit: null, onDragLeave: null, onDragOver: null, onDragStart: null, onDrop: null, onDurationChange: null, onEmptied: null, onEnd: null, onEnded: null, onError: null, onFocus: null, onFocusIn: null, onFocusOut: null, onHashChange: null, onInput: null, onInvalid: null, onKeyDown: null, onKeyPress: null, onKeyUp: null, onLoad: null, onLoadedData: null, onLoadedMetadata: null, onLoadStart: null, onMessage: null, onMouseDown: null, onMouseEnter: null, onMouseLeave: null, onMouseMove: null, onMouseOut: null, onMouseOver: null, onMouseUp: null, onMouseWheel: null, onOffline: null, onOnline: null, onPageHide: null, onPageShow: null, onPaste: null, onPause: null, onPlay: null, onPlaying: null, onPopState: null, onProgress: null, onRateChange: null, onRepeat: null, onReset: null, onResize: null, onScroll: null, onSeeked: null, onSeeking: null, onSelect: null, onShow: null, onStalled: null, onStorage: null, onSubmit: null, onSuspend: null, onTimeUpdate: null, onToggle: null, onUnload: null, onVolumeChange: null, onWaiting: null, onZoom: null, opacity: null, operator: null, order: null, orient: null, orientation: null, origin: null, overflow: null, overlay: null, overlinePosition: number, overlineThickness: number, paintOrder: null, panose1: null, path: null, pathLength: number, patternContentUnits: null, patternTransform: null, patternUnits: null, phase: null, ping: spaceSeparated, pitch: null, playbackOrder: null, pointerEvents: null, points: null, pointsAtX: number, pointsAtY: number, pointsAtZ: number, preserveAlpha: null, preserveAspectRatio: null, primitiveUnits: null, propagate: null, property: commaOrSpaceSeparated, r: null, radius: null, referrerPolicy: null, refX: null, refY: null, rel: commaOrSpaceSeparated, rev: commaOrSpaceSeparated, renderingIntent: null, repeatCount: null, repeatDur: null, requiredExtensions: commaOrSpaceSeparated, requiredFeatures: commaOrSpaceSeparated, requiredFonts: commaOrSpaceSeparated, requiredFormats: commaOrSpaceSeparated, resource: null, restart: null, result: null, rotate: null, rx: null, ry: null, scale: null, seed: null, shapeRendering: null, side: null, slope: null, snapshotTime: null, specularConstant: number, specularExponent: number, spreadMethod: null, spacing: null, startOffset: null, stdDeviation: null, stemh: null, stemv: null, stitchTiles: null, stopColor: null, stopOpacity: null, strikethroughPosition: number, strikethroughThickness: number, string: null, stroke: null, strokeDashArray: commaOrSpaceSeparated, strokeDashOffset: null, strokeLineCap: null, strokeLineJoin: null, strokeMiterLimit: number, strokeOpacity: number, strokeWidth: null, style: null, surfaceScale: number, syncBehavior: null, syncBehaviorDefault: null, syncMaster: null, syncTolerance: null, syncToleranceDefault: null, systemLanguage: commaOrSpaceSeparated, tabIndex: number, tableValues: null, target: null, targetX: number, targetY: number, textAnchor: null, textDecoration: null, textRendering: null, textLength: null, timelineBegin: null, title: null, transformBehavior: null, type: null, typeOf: commaOrSpaceSeparated, to: null, transform: null, transformOrigin: null, u1: null, u2: null, underlinePosition: number, underlineThickness: number, unicode: null, unicodeBidi: null, unicodeRange: null, unitsPerEm: number, values: null, vAlphabetic: number, vMathematical: number, vectorEffect: null, vHanging: number, vIdeographic: number, version: null, vertAdvY: number, vertOriginX: number, vertOriginY: number, viewBox: null, viewTarget: null, visibility: null, width: null, widths: null, wordSpacing: null, writingMode: null, x: null, x1: null, x2: null, xChannelSelector: null, xHeight: number, y: null, y1: null, y2: null, yChannelSelector: null, z: null, zoomAndPan: null }, space: "svg", transform: caseSensitiveTransform }); const xlink = create({ properties: { xLinkActuate: null, xLinkArcRole: null, xLinkHref: null, xLinkRole: null, xLinkShow: null, xLinkTitle: null, xLinkType: null }, space: "xlink", transform(_2, property) { return "xlink:" + property.slice(5).toLowerCase(); } }); const xmlns = create({ attributes: { xmlnsxlink: "xmlns:xlink" }, properties: { xmlnsXLink: null, xmlns: null }, space: "xmlns", transform: caseInsensitiveTransform }); const xml = create({ properties: { xmlBase: null, xmlLang: null, xmlSpace: null }, space: "xml", transform(_2, property) { return "xml:" + property.slice(3).toLowerCase(); } }); const cap = /[A-Z]/g; const dash = /-[a-z]/g; const valid = /^data[-\w.:]+$/i; function find(schema, value) { const normal = normalize(value); let property = value; let Type = Info; if (normal in schema.normal) { return schema.property[schema.normal[normal]]; } if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value)) { if (value.charAt(4) === "-") { const rest = value.slice(5).replace(dash, camelcase); property = "data" + rest.charAt(0).toUpperCase() + rest.slice(1); } else { const rest = value.slice(4); if (!dash.test(rest)) { let dashes = rest.replace(cap, kebab); if (dashes.charAt(0) !== "-") { dashes = "-" + dashes; } value = "data" + dashes; } } Type = DefinedInfo; } return new Type(property, value); } function kebab($0) { return "-" + $0.toLowerCase(); } function camelcase($0) { return $0.charAt(1).toUpperCase(); } const html = merge([aria, html$1, xlink, xmlns, xml], "html"); const svg = merge([aria, svg$1, xlink, xmlns, xml], "svg"); function parse$1(value) { const tokens = []; const input = String(value || ""); let index = input.indexOf(","); let start = 0; let end = false; while (!end) { if (index === -1) { index = input.length; end = true; } const token = input.slice(start, index).trim(); if (token || !end) { tokens.push(token); } start = index + 1; index = input.indexOf(",", start); } return tokens; } const search = /[#.]/g; function parseSelector(selector, defaultTagName) { const value = selector || ""; const props = {}; let start = 0; let previous; let tagName; while (start < value.length) { search.lastIndex = start; const match = search.exec(value); const subvalue = value.slice(start, match ? match.index : value.length); if (subvalue) { if (!previous) { tagName = subvalue; } else if (previous === "#") { props.id = subvalue; } else if (Array.isArray(props.className)) { props.className.push(subvalue); } else { props.className = [subvalue]; } start += subvalue.length; } if (match) { previous = match[0]; start++; } } return { type: "element", // @ts-expect-error: tag name is parsed. tagName: tagName || defaultTagName || "div", properties: props, children: [] }; } function parse(value) { const input = String(value || "").trim(); return input ? input.split(/[ \t\n\r\f]+/g) : []; } function createH(schema, defaultTagName, caseSensitive) { const adjust = caseSensitive ? createAdjustMap(caseSensitive) : void 0; function h2(selector, properties, ...children) { let node; if (selector === null || selector === void 0) { node = { type: "root", children: [] }; const child = ( /** @type {Child} */ properties ); children.unshift(child); } else { node = parseSelector(selector, defaultTagName); const lower = node.tagName.toLowerCase(); const adjusted = adjust ? adjust.get(lower) : void 0; node.tagName = adjusted || lower; if (isChild(properties)) { children.unshift(properties); } else { for (const [key, value] of Object.entries(properties)) { addProperty(schema, node.properties, key, value); } } } for (const child of children) { addChild(node.children, child); } if (node.type === "element" && node.tagName === "template") { node.content = { type: "root", children: node.children }; node.children = []; } return node; } return h2; } function isChild(value) { if (value === null || typeof value !== "object" || Array.isArray(value)) { return true; } if (typeof value.type !== "string") return false; const record = ( /** @type {Record<string, unknown>} */ value ); const keys = Object.keys(value); for (const key of keys) { const value2 = record[key]; if (value2 && typeof value2 === "object") { if (!Array.isArray(value2)) return true; const list = ( /** @type {ReadonlyArray<unknown>} */ value2 ); for (const item of list) { if (typeof item !== "number" && typeof item !== "string") { return true; } } } } if ("children" in value && Array.isArray(value.children)) { return true; } return false; } function addProperty(schema, properties, key, value) { const info = find(schema, key); let result; if (value === null || value === void 0) return; if (typeof value === "number") { if (Number.isNaN(value)) return; result = value; } else if (typeof value === "boolean") { result = value; } else if (typeof value === "string") { if (info.spaceSeparated) { result = parse(value); } else if (info.commaSeparated) { result = parse$1(value); } else if (info.commaOrSpaceSeparated) { result = parse(parse$1(value).join(" ")); } else { result = parsePrimitive(info, info.property, value); } } else if (Array.isArray(value)) { result = [...value]; } else { result = info.property === "style" ? style(value) : String(value); } if (Array.isArray(result)) { const finalResult = []; for (const item of result) { finalResult.push( /** @type {number | string} */ parsePrimitive(info, info.property, item) ); } result = finalResult; } if (info.property === "className" && Array.isArray(properties.className)) { result = properties.className.concat( /** @type {Array<number | string> | number | string} */ result ); } properties[info.property] = result; } function addChild(nodes, value) { if (value === null || value === void 0) ; else if (typeof value === "number" || typeof value === "string") { nodes.push({ type: "text", value: String(value) }); } else if (Array.isArray(value)) { for (const child of value) { addChild(nodes, child); } } else if (typeof value === "object" && "type" in value) { if (value.type === "root") { addChild(nodes, value.children); } else { nodes.push(value); } } else { throw new Error("Expected node, nodes, or string, got `" + value + "`"); } } function parsePrimitive(info, name, value) { if (typeof value === "string") { if (info.number && value && !Number.isNaN(Number(value))) { return Number(value); } if ((info.boolean || info.overloadedBoolean) && (value === "" || normalize(value) === normalize(name))) { return true; } } return value; } function style(styles) { const result = []; for (const [key, value] of Object.entries(styles)) { result.push([key, value].join(": ")); } return result.join("; "); } function createAdjustMap(values) { const result = /* @__PURE__ */ new Map(); for (const value of values) { result.set(value.toLowerCase(), value); } return result; } const svgCaseSensitiveTagNames = [ "altGlyph", "altGlyphDef", "altGlyphItem", "animateColor", "animateMotion", "animateTransform", "clipPath", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "foreignObject", "glyphRef", "linearGradient", "radialGradient", "solidColor", "textArea", "textPath" ]; const h = createH(html, "div"); createH(svg, "g", svgCaseSensitiveTagNames); const characterEntitiesLegacy = [ "AElig", "AMP", "Aacute", "Acirc", "Agrave", "Aring", "Atilde", "Auml", "COPY", "Ccedil", "ETH", "Eacute", "Ecirc", "Egrave", "Euml", "GT", "Iacute", "Icirc", "Igrave", "Iuml", "LT", "Ntilde", "Oacute", "Ocirc", "Ograve", "Oslash", "Otilde", "Ouml", "QUOT", "REG", "THORN", "Uacute", "Ucirc", "Ugrave", "Uuml", "Yacute", "aacute", "acirc", "acute", "aelig", "agrave", "amp", "aring", "atilde", "auml", "brvbar", "ccedil", "cedil", "cent", "copy", "curren", "deg", "divide", "eacute", "ecirc", "egrave", "eth", "euml", "frac12", "frac14", "frac34", "gt", "iacute", "icirc", "iexcl", "igrave", "iquest", "iuml", "laquo", "lt", "macr", "micro", "middot", "nbsp", "not", "ntilde", "oacute", "ocirc", "ograve", "ordf", "ordm", "oslash", "otilde", "ouml", "para", "plusmn", "pound", "quot", "raquo", "reg", "sect", "shy", "sup1", "sup2", "sup3", "szlig", "thorn", "times", "uacute", "ucirc", "ugrave", "uml", "uuml", "yacute", "yen", "yuml" ]; const characterReferenceInvalid = { 0: "�", 128: "€", 130: "‚", 131: "ƒ", 132: "„", 133: "…", 134: "†", 135: "‡", 136: "ˆ", 137: "‰", 138: "Š", 139: "‹", 140: "Œ", 142: "Ž", 145: "‘", 146: "’", 147: "“", 148: "”", 149: "•", 150: "–", 151: "—", 152: "˜", 153: "™", 154: "š", 155: "›", 156: "œ", 158: "ž", 159: "Ÿ" }; function isDecimal(character) { const code = typeof character === "string" ? character.charCodeAt(0) : character; return code >= 48 && code <= 57; } function isHexadecimal(character) { const code = typeof character === "string" ? character.charCodeAt(0) : character; return code >= 97 && code <= 102 || code >= 65 && code <= 70 || code >= 48 && code <= 57; } function isAlphabetical(character) { const code = typeof character === "string" ? character.charCodeAt(0) : character; return code >= 97 && code <= 122 || code >= 65 && code <= 90; } function isAlphanumerical(character) { return isAlphabetical(character) || isDecimal(character); } const element = document.createElement("i"); function decodeNamedCharacterReference(value) { const characterReference = "&" + value + ";"; element.innerHTML = characterReference; const character = element.textContent; if ( // @ts-expect-error: TypeScript is wrong that `textContent` on elements can // yield `null`. character.charCodeAt(character.length - 1) === 59 && value !== "semi" ) { return false; } return character === characterReference ? false : character; } const messages = [ "", /* 1: Non terminated (named) */ "Named character references must be terminated by a semicolon", /* 2: Non terminated (numeric) */ "Numeric character references must be terminated by a semicolon", /* 3: Empty (named) */ "Named character references cannot be empty", /* 4: Empty (numeric) */ "Numeric character references cannot be empty", /* 5: Unknown (named) */ "Named character references must be known", /* 6: Disallowed (numeric) */ "Numeric character references cannot be disallowed", /* 7: Prohibited (numeric) */ "Numeric character references cannot be outside the permissible Unicode range" ]; function parseEntities(value, options) { const settings = {}; const additional = typeof settings.additional === "string" ? settings.additional.charCodeAt(0) : settings.additional; const result = []; let index = 0; let lines = -1; let queue = ""; let point; let indent; if (settings.position) { if ("start" in settings.position || "indent" in settings.position) { indent = settings.position.indent; point = settings.position.start; } else { point = settings.position; } } let line = (point ? point.line : 0) || 1; let column = (point ? point.column : 0) || 1; let previous = now(); let character; index--; while (++index <= value.length) { if (character === 10) { column = (indent ? indent[lines] : 0) || 1; } character = value.charCodeAt(index); if (character === 38) { const following = value.charCodeAt(index + 1); if (following === 9 || following === 10 || following === 12 || following === 32 || following === 38 || following === 60 || Number.isNaN(following) || additional && following === additional) { queue += String.fromCharCode(character); column++; continue; } const start = index + 1; let begin = start; let end = start; let type; if (following === 35) { end = ++begin; const following2 = value.charCodeAt(end); if (following2 === 88 || following2 === 120) { type = "hexadecimal"; end = ++begin; } else { type = "decimal"; } } else { type = "named"; } let characterReferenceCharacters = ""; let characterReference = ""; let characters = ""; const test = type === "named" ? isAlphanumerical : type === "decimal" ? isDecimal : isHexadecimal; end--; while (++end <= value.length) { const following2 = value.charCodeAt(end); if (!test(following2)) { break; } characters += String.fromCharCode(following2); if (type === "named" && characterEntitiesLegacy.includes(characters)) { characterReferenceCharacters = characters; characterReference = decodeNamedCharacterReference(characters); } } let terminated = value.charCodeAt(end) === 59; if (terminated) { end++; const namedReference = type === "named" ? decodeNamedCharacterReference(characters) : false; if (namedReference) { characterReferenceCharacters = characters; characterReference = namedReference; } } let diff = 1 + end - start; let reference = ""; if (!terminated && settings.nonTerminated === false) ; else if (!characters) { if (type !== "named") { warning(4, diff); } } else if (type === "named") { if (terminated && !characterReference) { warning(5, 1); } else { if (characterReferenceCharacters !== characters) { end = begin + characterReferenceCharacters.length; diff = 1 + end - begin; terminated = false; } if (!terminated) { const reason = characterReferenceCharacters ? 1 : 3; if (settings.attribute) { const following2 = value.charCodeAt(end); if (following2 === 61) { warning(reason, diff); characterReference = ""; } else if (isAlphanumerical(following2)) { characterReference = ""; } else { warning(reason, diff); } } else { warning(reason, diff); } } } reference = characterReference; } else { if (!terminated) { warning(2, diff); } let referenceCode = Number.parseInt( characters, type === "hexadecimal" ? 16 : 10 ); if (prohibited(referenceCode)) { warning(7, diff); reference = String.fromCharCode( 65533 /* `�` */ ); } else if (referenceCode in characterReferenceInvalid) { warning(6, diff); reference = characterReferenceInvalid[referenceCode]; } else { let output = ""; if (disallowed(referenceCode)) { warning(6, diff); } if (referenceCode > 65535) { referenceCode -= 65536; output += String.fromCharCode( referenceCode >>> (10 & 1023) | 55296 ); referenceCode = 56320 | referenceCode & 1023; } reference = output + String.fromCharCode(referenceCode); } } if (reference) { flush(); previous = now(); index = end - 1; column += end - start + 1; result.push(reference); const next = now(); next.offset++; if (settings.reference) { settings.reference.call( settings.referenceContext || void 0, reference, { start: previous, end: next }, value.slice(start - 1, end) ); } previous = next; } else { characters = value.slice(start - 1, end); queue += characters; column += characters.length; index = end - 1; } } else { if (character === 10) { line++; lines++; column = 0; } if (Number.isNaN(character)) { flush(); } else { queue += String.fromCharCode(character); column++; } } } return result.join(""); function now() { return { line, column, offset: index + ((point ? point.offset : 0) || 0) }; } function warning(code, offset) { let position; if (settings.warning) { position = now(); position.column += offset; position.offset += offset; settings.warning.call( settings.warningContext || void 0, messages[code], position, code ); } } function flush() { if (queue) { result.push(queue); if (settings.text) { settings.text.call(settings.textContext || void 0, queue, { start: previous, end: now() }); } queue = ""; } } } function prohibited(code) { return code >= 55296 && code <= 57343 || code > 1114111; } function disallowed(code) { return code >= 1 && code <= 8 || code === 11 || code >= 13 && code <= 31 || code >= 127 && code <= 159 || code >= 64976 && code <= 65007 || (code & 65535) === 65535 || (code & 65535) === 65534; } var uniqueId = 0; var plainTextGrammar = {}; var _ = { /** * A namespace for utility methods. * * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may * change or disappear at any time. * * @namespace * @memberof Prism */ util: { /** * Returns the name of the type of the given value. * * @param {any} o * @returns {string} * @example * type(null) === 'Null' * type(undefined) === 'Undefined' * type(123) === 'Number' * type('foo') === 'String' * type(true) === 'Boolean' * type([1, 2]) === 'Array' * type({}) === 'Object' * type(String) === 'Function' * type(/abc+/) === 'RegExp' */ type: function(o) { return Object.prototype.toString.call(o).slice(8, -1); }, /** * Returns a unique number for the given object. Later calls will still return the same number. * * @param {Object} obj * @returns {number} */ objId: function(obj) { if (!obj["__id"]) { Object.defineProperty(obj, "__id", { value: ++uniqueId }); } return obj["__id"]; }, /** * Creates a deep clone of the given object. * * The main intended use of this function is to clone language definitions. * * @param {T} o * @param {Record<number, any>} [visited] * @returns {T} * @template T */ clone: function deepClone(o, visited) { visited = visited || {}; var clone; var id; switch (_.util.type(o)) { case "Object": id = _.util.objId(o); if (visited[id]) { return visited[id]; } clone = /** @type {Record<string, any>} */ {}; visited[id] = clone; for (var key in o) { if (o.hasOwnProperty(key)) { clone[key] = deepClone(o[key], visited); } } return ( /** @type {any} */ clone ); case "Array": id = _.util.objId(o); if (visited[id]) { return visited[id]; } clone = []; visited[id] = clone; /** @type {any} */ o.forEach( function(v, i) { clone[i] = deepClone(v, visited); } ); return ( /** @type {any} */ clone ); default: return o; } } }, /** * This namespace contains all currently loaded languages and the some helper functions to create and modify languages. * * @namespace * @memberof Prism * @public */ languages: { /** * The grammar for plain, unformatted text. */ plain: plainTextGrammar, plaintext: plainTextGrammar, text: plainTextGrammar, txt: plainTextGrammar, /** * Creates a deep copy of the language with the given id and appends the given tokens. * * If a token in `redef` also appears in the copied language, then the existing token in the copied language * will be overwritten at its original po