{"version":3,"file":"client.cjs","sources":["../src/constants.ts","../src/api/destroy.ts","../src/api/focus.ts","../types/values.ts","../src/editor/adapters/selections.ts","../src/api/format.ts","../src/api/get_doc.ts","../src/api/selections.ts","../src/api/insert.ts","../src/utils/inspect.ts","../src/utils/options.ts","../src/markdown.ts","../src/ui/utils.ts","../src/editor/extensions/appearance.ts","../src/extensions.ts","../src/editor/extensions/blockquote.ts","../src/editor/extensions/code.ts","../src/editor/extensions/ink.ts","../src/editor/extensions/line_wrapping.ts","../src/editor/extensions/theme.ts","../src/editor/state.ts","../src/editor/view.ts","../src/utils/merge.ts","../src/api/load.ts","../src/api/options.ts","../src/api/reconfigure.ts","../src/api/select.ts","../src/api/update.ts","../src/api/wrap.ts","../src/utils/awaitable.ts","../src/instance.ts","../lib/codemirror-kit/decorations.ts","../lib/codemirror-kit/parsers.ts","../lib/codemirror-kit/markdown.ts","../plugins/katex/grammar.ts","../plugins/katex/index.ts","../src/utils/queue.ts","../src/store.ts","../src/utils/readability.ts","../src/ui/components/details/index.tsx","../src/ui/components/drop_zone/index.tsx","../src/ui/components/editor/index.tsx","../src/ui/components/button/index.tsx","../src/ui/components/toolbar/index.tsx","../src/ui/components/root/styles.tsx","../src/ui/components/root/index.tsx","../src/ui/app.tsx","../src/index.tsx","../src/editor/extensions/autocomplete.ts","../src/editor/extensions/images.ts","../src/editor/extensions/indentWithTab.ts","../src/editor/extensions/lists.ts","../src/editor/extensions/readonly.ts","../src/editor/extensions/search.tsx","../src/editor/extensions/spellcheck.ts"],"sourcesContent":["export const HYDRATION_MARKER = 'data-ink-mde-ssr-hydration-marker'\nexport const HYDRATION_MARKER_SELECTOR = `[${HYDRATION_MARKER}]`\n\nexport const getHydrationMarkerProps = () => {\n  if (import.meta.env.VITE_SSR) {\n    return {\n      [HYDRATION_MARKER]: true,\n    }\n  }\n\n  return {}\n}\n","import type InkInternal from '/types/internal'\n\nexport const destroy = ([state]: InkInternal.Store) => {\n  const { editor } = state()\n\n  editor.destroy()\n}\n","import type InkInternal from '/types/internal'\n\nexport const focus = ([state]: InkInternal.Store) => {\n  const { editor } = state()\n\n  if (!editor.hasFocus) {\n    editor.focus()\n  }\n}\n","export enum Appearance {\n  Auto = 'auto',\n  Dark = 'dark',\n  Light = 'light',\n}\n\nexport enum Extensions {\n  Appearance = 'appearance',\n  Attribution = 'attribution',\n  Autocomplete = 'autocomplete',\n  Images = 'images',\n  ReadOnly = 'readonly',\n  Spellcheck = 'spellcheck',\n  Vim = 'vim',\n}\n\nexport enum Markup {\n  Bold = 'bold',\n  Code = 'code',\n  CodeBlock = 'code_block',\n  Heading = 'heading',\n  Image = 'image',\n  Italic = 'italic',\n  Link = 'link',\n  List = 'list',\n  OrderedList = 'ordered_list',\n  Quote = 'quote',\n  TaskList = 'task_list',\n}\n\nexport enum PluginType {\n  Completion = 'completion',\n  Default = 'default',\n  Grammar = 'grammar',\n  Language = 'language',\n}\n\nexport enum Selection {\n  End = 'end',\n  Start = 'start',\n}\n\nexport const appearanceTypes = {\n  auto: 'auto',\n  dark: 'dark',\n  light: 'light',\n}\n\nexport const pluginTypes = {\n  completion: 'completion',\n  default: 'default',\n  grammar: 'grammar',\n  language: 'language',\n} as const\n","import { EditorSelection, SelectionRange } from '@codemirror/state'\nimport type * as Ink from '/types/ink'\n\nexport const toCodeMirror = (selections: Ink.Editor.Selection[]) => {\n  const ranges = selections.map((selection): SelectionRange => {\n    const range = SelectionRange.fromJSON({ anchor: selection.start, head: selection.end })\n\n    return range\n  })\n\n  return EditorSelection.create(ranges)\n}\n\nexport const toInk = (selection: EditorSelection) => {\n  const selections = selection.ranges.map((range: SelectionRange): Ink.Editor.Selection => {\n    return {\n      end: range.anchor < range.head ? range.head : range.anchor,\n      start: range.head < range.anchor ? range.head : range.anchor,\n    }\n  })\n\n  return selections\n}\n","import { syntaxTree } from '@codemirror/language'\nimport type { NodeType } from '@lezer/common'\nimport type * as Ink from '/types/ink'\nimport type InkInternal from '/types/internal'\nimport * as InkValues from '/types/values'\nimport { toInk } from '../editor/adapters/selections'\n\n// Todo:\n// - [ ] Handle special scenarios (e.g. headings in quote blocks).\n// - [ ] Handle multiline selections (e.g. bolding multiple lines worth of content).\n\ninterface ChangeDetails {\n  editor: InkInternal.Editor,\n  formatDefinition: FormatDefinition,\n  selection: Ink.Editor.Selection,\n  node?: NodeDefinition,\n}\n\ninterface FormatDefinition {\n  block: boolean,\n  line: boolean,\n  multiline: boolean,\n  nodes: string[],\n  prefix: string,\n  prefixStates: string[],\n  suffix: string,\n}\n\ntype Formats = {\n  [K in Ink.Values.Markup]: FormatDefinition\n}\n\ninterface NodeDefinition {\n  type: NodeType,\n  from: number,\n  to: number,\n}\n\nconst defineConfig = (overrides: Partial<FormatDefinition>): FormatDefinition => {\n  const defaults = {\n    block: false,\n    line: false,\n    multiline: false,\n    nodes: [],\n    prefix: '',\n    prefixStates: [],\n    suffix: '',\n  }\n\n  return { ...defaults, ...overrides }\n}\n\nexport const formatting: Formats = {\n  [InkValues.Markup.Bold]: defineConfig({\n    nodes: ['StrongEmphasis'],\n    prefix: '**',\n    suffix: '**',\n  }),\n  [InkValues.Markup.Code]: defineConfig({\n    nodes: ['InlineCode'],\n    prefix: '`',\n    suffix: '`',\n  }),\n  [InkValues.Markup.CodeBlock]: defineConfig({\n    block: true,\n    nodes: ['FencedCode'],\n    prefix: '```\\n',\n    suffix: '\\n```',\n  }),\n  [InkValues.Markup.Heading]: defineConfig({\n    multiline: true,\n    nodes: ['ATXHeading1', 'ATXHeading2', 'ATXHeading3', 'ATXHeading4', 'ATXHeading5', 'ATXHeading6'],\n    prefix: '# ',\n    prefixStates: ['# ', '## ', '### ', '#### ', '##### ', '###### ', ''],\n  }),\n  [InkValues.Markup.Image]: defineConfig({\n    nodes: ['Image'],\n    prefix: '![](',\n    suffix: ')',\n  }),\n  [InkValues.Markup.Italic]: defineConfig({\n    nodes: ['Emphasis'],\n    prefix: '*',\n    suffix: '*',\n  }),\n  [InkValues.Markup.Link]: defineConfig({\n    nodes: ['Link'],\n    prefix: '[](',\n    suffix: ')',\n  }),\n  [InkValues.Markup.OrderedList]: defineConfig({\n    line: true,\n    multiline: true,\n    nodes: ['OrderedList'],\n    prefix: '1. ',\n  }),\n  [InkValues.Markup.Quote]: defineConfig({\n    line: true,\n    multiline: true,\n    nodes: ['Blockquote'],\n    prefix: '> ',\n  }),\n  [InkValues.Markup.TaskList]: defineConfig({\n    line: true,\n    multiline: true,\n    nodes: ['BulletList'],\n    prefix: '- [ ] ',\n  }),\n  [InkValues.Markup.List]: defineConfig({\n    line: true,\n    multiline: true,\n    nodes: ['BulletList'],\n    prefix: '- ',\n  }),\n}\n\nconst splitSelectionByLines = ({ editor, selection }: ChangeDetails) => {\n  let position = selection.start\n  const selections: Ink.Editor.Selection[] = []\n\n  while (position <= selection.end) {\n    const line = editor.lineBlockAt(position)\n    const start = Math.max(selection.start, line.from)\n    const end = Math.min(selection.end, line.to)\n\n    selections.push({ start, end })\n\n    position = line.to + 1\n  }\n\n  return selections\n}\n\nconst getSelection = ({ editor, formatDefinition, selection }: Partial<ChangeDetails>) => {\n  if (!editor || !formatDefinition) return selection || { start: 0, end: 0 }\n\n  // Todo: expose an actual API for getting the current selection or fallback\n  const initialSelection = selection || toInk(editor.state.selection).pop() || { start: 0, end: 0 }\n\n  if (formatDefinition.block || formatDefinition.line || formatDefinition.multiline) {\n    const start = editor.lineBlockAt(initialSelection.start).from\n    const end = editor.lineBlockAt(initialSelection.end).to\n\n    return { start, end }\n  }\n\n  const start = editor.state.wordAt(initialSelection.start)?.from || initialSelection.start\n  const end = editor.state.wordAt(initialSelection.end)?.to || initialSelection.end\n\n  return { start, end }\n}\n\nconst getText = (changeDetails: ChangeDetails) => {\n  return changeDetails.editor.state.sliceDoc(changeDetails.selection.start, changeDetails.selection.end)\n}\n\nconst getNode = (editor: InkInternal.Editor, definition: FormatDefinition, selection: Ink.Editor.Selection) => {\n  const selectionNodes = getNodes(editor, selection)\n\n  return selectionNodes.find(({ type }) => definition.nodes.includes(type.name))\n}\n\nconst getNodes = (editor: InkInternal.Editor, selection: Ink.Editor.Selection) => {\n  const nodeDefinitions: NodeDefinition[] = []\n\n  syntaxTree(editor.state).iterate({\n    from: selection.start,\n    to: selection.end,\n    enter: ({ type, from, to }) => {\n      nodeDefinitions.push({ type, from, to })\n    },\n  })\n\n  return nodeDefinitions\n}\n\nconst unformat = (changeDetails: ChangeDetails) => {\n  const text = getText(changeDetails)\n  const sliceStart = changeDetails.formatDefinition.prefix.length\n  const sliceEnd = changeDetails.formatDefinition.suffix.length * -1 || text.length\n  const unformatted = text.slice(sliceStart, sliceEnd)\n\n  return [{ from: changeDetails.selection.start, to: changeDetails.selection.end, insert: unformatted }]\n}\n\nconst formatBlock = (changeDetails: ChangeDetails) => {\n  if (changeDetails.node) {\n    const start = changeDetails.node.from\n    const end = changeDetails.node.to\n\n    return unformat({ ...changeDetails, selection: { start, end } })\n  } else {\n    const before = changeDetails.formatDefinition.prefix\n    const after = changeDetails.formatDefinition.suffix\n\n    const changes = [\n      { from: changeDetails.selection.start, insert: before },\n      { from: changeDetails.selection.end, insert: after },\n    ]\n\n    return changes\n  }\n}\n\nconst formatMultiline = (changeDetails: ChangeDetails) => {\n  const selections = splitSelectionByLines(changeDetails)\n  const changes = <{ from: number, to?: number, insert: string }[]>[]\n\n  selections.forEach((selection) => {\n    const lineChanges = formatLine({ ...changeDetails, selection })\n\n    changes.push(...lineChanges)\n  })\n\n  return changes\n}\n\nconst formatLine = (changeDetails: ChangeDetails) => {\n  const hasPrefixStates = changeDetails.formatDefinition.prefixStates.length > 0\n  const text = getText(changeDetails)\n\n  if (changeDetails.node && hasPrefixStates) {\n    const prefixState = changeDetails.formatDefinition.prefixStates.find(prefix => text.startsWith(prefix))\n\n    if (prefixState) {\n      const prefixStateIndex = changeDetails.formatDefinition.prefixStates.indexOf(prefixState)\n      const nextPrefixState = changeDetails.formatDefinition.prefixStates[prefixStateIndex + 1]\n      const updatedText = text.replace(new RegExp(`^${prefixState}`), nextPrefixState)\n\n      return [{ from: changeDetails.selection.start, to: changeDetails.selection.end, insert: updatedText }]\n    }\n  } else if (changeDetails.node && text.startsWith(changeDetails.formatDefinition.prefix)) {\n    return unformat(changeDetails)\n  }\n\n  return [{ from: changeDetails.selection.start, insert: changeDetails.formatDefinition.prefix }]\n}\n\nconst formatInline = (changeDetails: ChangeDetails) => {\n  if (changeDetails.node) {\n    const start = changeDetails.node.from\n    const end = changeDetails.node.to\n\n    return unformat({ ...changeDetails, selection: { start, end } })\n  } else {\n    const { formatDefinition, selection } = changeDetails\n    const before = Array.isArray(formatDefinition.prefix) ? formatDefinition.prefix[0] : formatDefinition.prefix\n    const after = formatDefinition.suffix\n\n    return [\n      { from: selection.start, insert: before },\n      { from: selection.end, insert: after },\n    ]\n  }\n}\n\nconst getChanges = (changeDetails: ChangeDetails) => {\n  if (changeDetails.formatDefinition.block) {\n    return formatBlock(changeDetails)\n  } else if (changeDetails.formatDefinition.multiline) {\n    return formatMultiline(changeDetails)\n  } else if (changeDetails.formatDefinition.line) {\n    return formatLine(changeDetails)\n  }\n\n  return formatInline(changeDetails)\n}\n\nexport const format = ([state]: InkInternal.Store, formatType: Ink.EnumString<Ink.Values.Markup>, { selection: maybeSelection }: Ink.Instance.FormatOptions = {}) => {\n  const { editor } = state()\n  const formatDefinition = formatting[formatType]\n  const selection = getSelection({ editor, formatDefinition, selection: maybeSelection })\n  const node = getNode(editor, formatDefinition, selection)\n  const changeDetails: ChangeDetails = {\n    editor,\n    formatDefinition,\n    node,\n    selection,\n  }\n  const changes = getChanges(changeDetails)\n  const offset = changes.reduce((total, change: { from: number, insert: string, to?: number }) => {\n    const offset = change.insert.length - ((change.to || change.from) - change.from)\n\n    return total + offset\n  }, 0)\n\n  const updates = state().editor.state.update({ changes, selection: { head: selection.start, anchor: selection.end + offset } })\n\n  state().editor.dispatch(updates)\n}\n","import type InkInternal from '/types/internal'\n\nexport const getDoc = ([state]: InkInternal.Store) => {\n  const { editor } = state()\n\n  return editor.state.sliceDoc()\n}\n","import type * as Ink from '/types/ink'\nimport type InkInternal from '/types/internal'\nimport { toInk } from '../editor/adapters/selections'\n\nexport const selections = ([state]: InkInternal.Store): Ink.Editor.Selection[] => {\n  const { editor } = state()\n\n  return toInk(editor.state.selection)\n}\n","import type * as Ink from '/types/ink'\nimport type InkInternal from '/types/internal'\nimport { selections } from './selections'\n\nexport const insert = ([state, setState]: InkInternal.Store, text: string, selection?: Ink.Editor.Selection, updateSelection = false) => {\n  const { editor } = state()\n\n  let start = selection?.start\n  let end = selection?.end || selection?.start\n\n  if (typeof start === 'undefined') {\n    const current = selections([state, setState]).pop() as Ink.Editor.Selection\n\n    start = current.start\n    end = current.end\n  }\n\n  const updates = { changes: { from: start, to: end, insert: text } }\n\n  if (updateSelection) {\n    const anchor = start === end ? start + text.length : start\n    const head = start === end ? start + text.length : start + text.length\n\n    Object.assign(updates, { selection: { anchor, head } })\n  }\n\n  editor.dispatch(\n    editor.state.update(updates),\n  )\n}\n","export type ObjectTypeKey = keyof ObjectTypes\nexport type ObjectTypeValue = ObjectTypes[ObjectTypeKey]\nexport type ObjectTypes = typeof objectTypes\nexport type Thenable<T> = T extends { then: (...args: any[]) => any } ? T : never\n\nexport const objectTypes = {\n  array: '[object Array]',\n  asyncFunction: '[object AsyncFunction]',\n  boolean: '[object Boolean]',\n  function: '[object Function]',\n  null: '[object Null]',\n  number: '[object Number]',\n  object: '[object Object]',\n  promise: '[object Promise]',\n  string: '[object String]',\n  symbol: '[object Symbol]',\n  undefined: '[object Undefined]',\n  window: '[object Window]',\n} as const\n\nexport const is = <T>(type: ObjectTypeValue, object: T): object is T => {\n  return Object.prototype.toString.call(object) === type\n}\n\nexport const isArray = <T extends any[]>(object: T | any): object is T => is(objectTypes.array, object)\nexport const isAsyncFunction = <T extends (...args: any[]) => Promise<any>>(object: T | any): object is T => is(objectTypes.asyncFunction, object)\nexport const isBoolean = <T extends boolean>(object: T | any): object is T => is(objectTypes.boolean, object)\nexport const isFunction = <T extends (...args: any[]) => any>(object: T | any): object is T => is(objectTypes.function, object)\nexport const isNull = <T>(object: T | any): object is T => is(objectTypes.null, object)\nexport const isNumber = <T extends number>(object: T | any): object is T => is(objectTypes.number, object)\nexport const isObject = <T extends Record<any, any>>(object: T | any): object is T => is(objectTypes.object, object)\nexport const isPromise = <T>(object: T | Promise<T>): object is Promise<T> => is(objectTypes.promise, object)\nexport const isString = <T extends string>(object: T | any): object is T => is(objectTypes.string, object)\nexport const isSymbol = <T extends symbol>(object: T | any): object is T => is(objectTypes.symbol, object)\nexport const isUndefined = <T extends undefined>(object: T | any): object is T => is(objectTypes.undefined, object)\nexport const isWindow = <T extends Window>(object: T | any): object is T => is(objectTypes.window, object)\n\nexport const isThenable = <T extends { then: <A, R>(...args: A[]) => R }>(object: T | any): object is T => {\n  if (isPromise(object)) return true\n\n  return isObject(object) && ('then' in object) && (typeof object.then === 'function')\n}\n","import { isPromise } from '/src/utils/inspect'\nimport { type EnumString, type Options, type OptionsResolved, type Values } from '/types/ink'\n\nexport type FlattenArray<T> = ReturnType<typeof flatten<T>>\nexport type FnIntersectionToTuple<FnIntersection> = FnIntersection extends { (a: infer A): void, (b: infer B): void } ? [A, B] : never\nexport type FnUnionToFnIntersection<FnUnion> = (FnUnion extends unknown ? (arg: FnUnion) => void : never) extends ((arg: infer FnIntersection) => void) ? FnIntersection : never\nexport type Partition<T, V> = UnionToTuple<T> extends never\n? [T] extends [infer A]\n  ? V extends ((arg: any) => arg is A)\n    ? [A[], unknown[]]\n    : V extends ((arg: any) => arg is infer AssertionType)\n      ? [AssertionType[], Array<A>]\n      : never\n  : never\n: UnionToTuple<T> extends [infer A, infer B]\n  ? V extends ((arg: any) => arg is A)\n    ? [A[], B[]]\n    : V extends ((arg: any) => arg is B)\n      ? [B[], A[]]\n      : V extends ((arg: any) => arg is infer AssertionType)\n        ? [AssertionType[], Array<A | B>]\n        : never\n  : never\nexport type PluginHandler<T> = { [P in keyof T]: (variant: T[P]) => any }\nexport type PluginMatcher = { [K in PluginType]: Extract<Options.Plugin, { type: K }> }\nexport type PluginType = Options.Plugin['type']\nexport type PluginForType<T extends Values.PluginType> = Extract<Options.Plugin, { type: T }>\nexport type PluginValueForType<T extends Values.PluginType> = PluginForType<T>['value']\nexport type RecursiveArray<T> = Array<T | RecursiveArray<T>>\nexport type UnionToFnUnion<Union> = Union extends unknown ? (k: Union) => void : never\nexport type UnionToTuple<Union> = FnIntersectionToTuple<FnUnionToFnIntersection<UnionToFnUnion<Union>>>\nexport type ValidatorFn = (arg: any) => boolean\n\nexport const enumString = <T extends string>(value: T) => {\n  return `${value}` as EnumString<T>\n}\n\nexport const partitionPlugins = <T extends Options.Plugin['value']>(plugins: T[]) => {\n  return partition(plugins, isPromise)\n}\n\nexport const isPlugin = <T extends PluginType>(pluginType: T, plugin: Options.Plugin): plugin is PluginMatcher[T] => {\n  return plugin.type === pluginType\n}\n\nexport const isOptionsKey = (key: string, options: OptionsResolved): key is keyof OptionsResolved => {\n  return !!key && (key in options)\n}\n\nexport const filterPlugins = <T extends PluginType>(pluginType: T, options: OptionsResolved): PluginMatcher[T]['value'][] => {\n  return flatten(options.plugins).reduce<PluginMatcher[T]['value'][]>((matches, plugin: Options.Plugin) => {\n    if (isPlugin(pluginType, plugin)) {\n      // Todo: These \"plugin\" keys might be better suited under a namespace, but they are top-level for now.\n      // Individual key resolvers might be a good idea down the road to check for more fine-grained configuration options.\n      if (!plugin.key || (isOptionsKey(plugin.key, options) && options[plugin.key])) {\n        // @ts-expect-error Todo: Fix this type definition.\n        matches.push(plugin.value)\n      }\n    }\n\n    return matches\n  }, [])\n}\n\nexport const flatten = <T>(array: RecursiveArray<T>): T[] => {\n  return array.reduce<T[]>((flatArray, item) => {\n    if (Array.isArray(item)) {\n      return flatArray.concat(flatten(item))\n    }\n\n    return flatArray.concat(item)\n  }, [])\n}\n\nexport const partition = <ArrayTypes, Validator extends ValidatorFn>(array: ArrayTypes[], isValid: Validator): Partition<ArrayTypes, Validator> => {\n  return array.reduce<Partition<ArrayTypes, Validator>>((partitions, entry) => {\n    isValid(entry) ? partitions[0].push(entry) : partitions[1].push(entry)\n\n    return partitions\n  }, [[], []] as unknown as Partition<ArrayTypes, Validator>)\n}\n\n// partition(['string'], isNumber)\n// partition([1], isNumber)\n// partition(['hello', 1, 'yep', 4], isPromise)\n// partition(['hello', 1, 'yep', 4], isString)\n","import { markdown as markdownExtension, markdownLanguage } from '@codemirror/lang-markdown'\nimport { languages as baseLanguages } from '@codemirror/language-data'\nimport { Compartment } from '@codemirror/state'\nimport { type MarkdownExtension } from '@lezer/markdown'\nimport { buildVendorUpdates } from '/src/extensions'\nimport { filterPlugins, partitionPlugins } from '/src/utils/options'\nimport { type InkInternal, type OptionsResolved, pluginTypes } from '/types'\n\nconst makeExtension = ([state, setState]: InkInternal.Store) => {\n  const baseExtensions = [] as MarkdownExtension[]\n  const [lazyExtensions, extensions] = filterExtensions(state().options)\n  const [lazyLanguages, languages] = filterLanguages(state().options)\n\n  if (Math.max(lazyExtensions.length, lazyLanguages.length) > 0) {\n    state().workQueue.enqueue(async () => {\n      const effects = await buildVendorUpdates([state, setState])\n\n      state().editor.dispatch({ effects })\n    })\n  }\n\n  return markdownExtension({\n    base: markdownLanguage,\n    codeLanguages: [...baseLanguages, ...languages],\n    extensions: [...baseExtensions, ...extensions],\n  })\n}\n\nconst filterExtensions = (options: OptionsResolved) => {\n  return partitionPlugins(filterPlugins(pluginTypes.grammar, options))\n}\n\nconst filterLanguages = (options: OptionsResolved) => {\n  return partitionPlugins(filterPlugins(pluginTypes.language, options))\n}\n\nconst updateExtension = async ([state]: InkInternal.Store) => {\n  const baseExtensions = [] as MarkdownExtension[]\n  const extensions = await Promise.all(filterPlugins(pluginTypes.grammar, state().options))\n  const languages = await Promise.all(filterPlugins(pluginTypes.language, state().options))\n\n  return markdownExtension({\n    base: markdownLanguage,\n    codeLanguages: [...baseLanguages, ...languages],\n    extensions: [...baseExtensions, ...extensions],\n  })\n}\n\nexport const markdown = (): InkInternal.Extension => {\n  const compartment = new Compartment()\n\n  return {\n    compartment,\n    initialValue: (store: InkInternal.Store) => {\n      return compartment.of(makeExtension(store))\n    },\n    reconfigure: async (store: InkInternal.Store) => {\n      return compartment.reconfigure(await updateExtension(store))\n    },\n  }\n}\n","import type InkInternal from '/types/internal'\nimport type InkUi from '/types/ui'\nimport * as InkValues from '/types/values'\n\nexport const createElement = (): InkUi.Element => {\n  // Needed for tree-shaking purposes.\n  if (import.meta.env.VITE_SSR) {\n    return {} as InkUi.Element\n  }\n\n  return document.createElement('div')\n}\n\nexport const isAutoDark = () => {\n  // Needed for tree-shaking purposes.\n  if (import.meta.env.VITE_SSR) {\n    // Todo: Allow user to specify a default theme for SSR.\n    return true\n  }\n\n  return window.matchMedia('(prefers-color-scheme: dark)').matches\n}\n\nexport const isDark = (appearance: string) => {\n  if (appearance === InkValues.Appearance.Dark)\n    return true\n  if (appearance === InkValues.Appearance.Light)\n    return false\n\n  return isAutoDark()\n}\n\nexport const makeVars = (state: InkInternal.StateResolved) => {\n  // Todo: The syntax nodes should be merged with the tag nodes to ensure values are always set correctly. This might\n  // require extracting this out into a separate \"constants\" file or something similar.\n  const styles = [\n    // --ink-*\n    { suffix: 'border-radius', default: '0.25rem' },\n    { suffix: 'color', default: 'currentColor' },\n    { suffix: 'flex-direction', default: 'column' },\n    { suffix: 'font-family', default: 'inherit' },\n    // --ink-block-*\n    { suffix: 'block-background-color', default: '#121212', light: '#f5f5f5' },\n    { suffix: 'block-background-color-on-hover', default: '#0f0f0f', light: '#e0e0e0' },\n    { suffix: 'block-max-height', default: '20rem' },\n    { suffix: 'block-padding', default: '0.5rem' },\n    // --ink-code-*\n    { suffix: 'code-background-color', default: 'var(--ink-internal-block-background-color)' },\n    { suffix: 'code-color', default: 'inherit' },\n    { suffix: 'code-font-family', default: '\\'Monaco\\', Courier, monospace' },\n    // --ink-editor-*\n    { suffix: 'editor-font-size', default: '1em' },\n    { suffix: 'editor-line-height', default: '2em' },\n    { suffix: 'editor-padding', default: '0.5rem' },\n    { suffix: 'inline-padding', default: '0.125rem' },\n    // --ink-modal-*\n    { suffix: 'modal-position', default: 'fixed' },\n    // --ink-syntax-*\n    { suffix: 'syntax-atom-color', default: '#d19a66' },\n    { suffix: 'syntax-comment-color', default: '#abb2bf' },\n    { suffix: 'syntax-comment-font-style', default: 'italic' },\n    { suffix: 'syntax-emphasis-color', default: 'inherit' },\n    { suffix: 'syntax-emphasis-font-style', default: 'italic' },\n    { suffix: 'syntax-hashtag-background-color', default: '#222', light: '#eee' },\n    { suffix: 'syntax-hashtag-color', default: 'inherit' },\n    { suffix: 'syntax-heading-color', default: 'inherit' },\n    { suffix: 'syntax-heading-font-weight', default: '600' },\n    { suffix: 'syntax-heading1-color', default: 'var(--ink-internal-syntax-heading-color, inherit)' },\n    { suffix: 'syntax-heading1-font-size', default: '1.6em' },\n    { suffix: 'syntax-heading1-font-weight', default: '600' },\n    { suffix: 'syntax-heading2-color', default: 'var(--ink-internal-syntax-heading-color, inherit)' },\n    { suffix: 'syntax-heading2-font-size', default: '1.5em' },\n    { suffix: 'syntax-heading2-font-weight', default: '600' },\n    { suffix: 'syntax-heading3-color', default: 'var(--ink-internal-syntax-heading-color, inherit)' },\n    { suffix: 'syntax-heading3-font-size', default: '1.4em' },\n    { suffix: 'syntax-heading3-font-weight', default: '600' },\n    { suffix: 'syntax-heading4-color', default: 'var(--ink-internal-syntax-heading-color, inherit)' },\n    { suffix: 'syntax-heading4-font-size', default: '1.3em' },\n    { suffix: 'syntax-heading4-font-weight', default: '600' },\n    { suffix: 'syntax-heading5-color', default: 'var(--ink-internal-syntax-heading-color, inherit)' },\n    { suffix: 'syntax-heading5-font-size', default: '1.2em' },\n    { suffix: 'syntax-heading5-font-weight', default: '600' },\n    { suffix: 'syntax-heading6-color', default: 'var(--ink-internal-syntax-heading-color, inherit)' },\n    { suffix: 'syntax-heading6-font-size', default: '1.1em' },\n    { suffix: 'syntax-heading6-font-weight', default: '600' },\n    { suffix: 'syntax-highlight-background-color', default: '#555555' },\n    { suffix: 'syntax-keyword-color', default: '#c678dd' },\n    { suffix: 'syntax-link-color', default: 'inherit' },\n    { suffix: 'syntax-meta-color', default: '#abb2bf' },\n    { suffix: 'syntax-monospace-color', default: 'var(--ink-internal-code-color)' },\n    { suffix: 'syntax-monospace-font-family', default: 'var(--ink-internal-code-font-family)' },\n    { suffix: 'syntax-name-color', default: '#d19a66' },\n    { suffix: 'syntax-name-label-color', default: '#abb2bf' },\n    { suffix: 'syntax-name-property-color', default: '#96c0d8' },\n    { suffix: 'syntax-name-property-definition-color', default: '#e06c75' },\n    { suffix: 'syntax-name-variable-color', default: '#e06c75' },\n    { suffix: 'syntax-name-variable-definition-color', default: '#e5c07b' },\n    { suffix: 'syntax-name-variable-local-color', default: '#d19a66' },\n    { suffix: 'syntax-name-variable-special-color', default: 'inherit' },\n    { suffix: 'syntax-number-color', default: '#d19a66' },\n    { suffix: 'syntax-operator-color', default: '#96c0d8' },\n    { suffix: 'syntax-processing-instruction-color', default: '#444444', light: '#bbbbbb' },\n    { suffix: 'syntax-punctuation-color', default: '#abb2bf' },\n    { suffix: 'syntax-strikethrough-color', default: 'inherit' },\n    { suffix: 'syntax-strikethrough-text-decoration', default: 'line-through' },\n    { suffix: 'syntax-string-color', default: '#98c379' },\n    { suffix: 'syntax-string-special-color', default: 'inherit' },\n    { suffix: 'syntax-strong-color', default: 'inherit' },\n    { suffix: 'syntax-strong-font-weight', default: '600' },\n    { suffix: 'syntax-url-color', default: '#aaaaaa', light: '#666666' },\n    { suffix: 'toolbar-group-spacing', default: '2rem' },\n    { suffix: 'toolbar-item-spacing', default: '0' },\n  ]\n\n  const isLight = !isDark(state.options.interface.appearance)\n\n  return styles.map((style) => {\n    const value = (isLight && style.light) ? style.light : style.default\n\n    return `--ink-internal-${style.suffix}: var(--ink-${style.suffix}, ${value});`\n  })\n}\n","import type { Extension } from '@codemirror/state'\nimport { EditorView } from '@codemirror/view'\n\nexport const appearance = (isDark: boolean): Extension => {\n  return [\n    EditorView.theme({\n      '.cm-scroller': {\n        fontFamily: 'var(--ink-internal-font-family)',\n      },\n    }, { dark: isDark }),\n  ]\n}\n","import { Compartment } from '@codemirror/state'\nimport { markdown } from '/src/markdown'\nimport { isAutoDark } from '/src/ui/utils'\nimport { filterPlugins, partitionPlugins } from '/src/utils/options'\nimport { type InkInternal } from '/types'\nimport { appearanceTypes, pluginTypes } from '/types/values'\nimport { appearance } from './editor/extensions/appearance'\n\nexport const buildVendors = ([state, setState]: InkInternal.Store) => {\n  const extensions = state().extensions.map(e => e.initialValue([state, setState]))\n\n  return extensions\n}\n\nexport const buildVendorUpdates = async ([state, setState]: InkInternal.Store) => {\n  const effects = await Promise.all(\n    state().extensions.map(async (extension) => {\n      return await extension.reconfigure([state, setState])\n    }),\n  )\n\n  return effects\n}\n\nexport const extension = (resolver: InkInternal.ExtensionResolver): InkInternal.Extension => {\n  const compartment = new Compartment()\n\n  return {\n    compartment,\n    initialValue: (store: InkInternal.Store) => {\n      return compartment.of(resolver(store))\n    },\n    reconfigure: (store: InkInternal.Store) => {\n      return compartment.reconfigure(resolver(store))\n    },\n  }\n}\n\nexport const lazyExtension = (reconfigure: InkInternal.LazyExtensionResolver): InkInternal.LazyExtension => {\n  const compartment = new Compartment()\n\n  return {\n    compartment,\n    initialValue: () => {\n      return compartment.of([])\n    },\n    reconfigure: (store: InkInternal.Store) => {\n      return reconfigure(store, compartment)\n    },\n  }\n}\n\nexport const createExtensions = () => {\n  return [\n    markdown(),\n    ...resolvers.map(r => extension(r)),\n    ...lazyResolvers.map(r => lazyExtension(r)),\n  ]\n}\n\nexport const resolvers: InkInternal.ExtensionResolvers = [\n  ([state]: InkInternal.Store) => {\n    const [_lazyExtensions, extensions] = partitionPlugins(filterPlugins(pluginTypes.default, state().options))\n\n    return extensions\n  },\n  ([state]: InkInternal.Store) => {\n    const isDark = state().options.interface.appearance === appearanceTypes.dark\n    const isAuto = state().options.interface.appearance === appearanceTypes.auto\n    const extension = appearance(isDark || (isAuto && isAutoDark()))\n\n    return extension\n  },\n]\n\nexport const lazyResolvers: InkInternal.LazyExtensionResolvers = [\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    const [lazyExtensions] = partitionPlugins(filterPlugins(pluginTypes.default, state().options))\n\n    if (lazyExtensions.length > 0) {\n      return compartment.reconfigure(await Promise.all(lazyExtensions))\n    }\n\n    return compartment.reconfigure([])\n  },\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    if (state().options.interface.autocomplete) {\n      const { autocomplete } = await import('./editor/extensions/autocomplete')\n\n      return compartment.reconfigure(autocomplete(state().options))\n    }\n\n    return compartment.reconfigure([])\n  },\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    if (state().options.interface.images) {\n      const { images } = await import('./editor/extensions/images')\n\n      return compartment.reconfigure(images())\n    }\n\n    return compartment.reconfigure([])\n  },\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    const { keybindings, trapTab } = state().options\n    const tab = trapTab ?? keybindings.tab\n    const shiftTab = trapTab ?? keybindings.shiftTab\n\n    if (tab || shiftTab) {\n      const { indentWithTab } = await import('./editor/extensions/indentWithTab')\n\n      return compartment.reconfigure(indentWithTab({ tab, shiftTab }))\n    }\n\n    return compartment.reconfigure([])\n  },\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    const { options } = state()\n\n    if (options.lists || options.interface.lists) {\n      const { lists } = await import('./editor/extensions/lists')\n\n      let bullet = true\n      let number = true\n      let task = true\n\n      if (typeof options.lists === 'object') {\n        bullet = typeof options.lists.bullet === 'undefined' ? false : options.lists.bullet\n        number = typeof options.lists.number === 'undefined' ? false : options.lists.number\n        task = typeof options.lists.task === 'undefined' ? false : options.lists.task\n      }\n\n      return compartment.reconfigure(lists({ bullet, number, task }))\n    }\n\n    return compartment.reconfigure([])\n  },\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    if (state().options.placeholder) {\n      const { placeholder } = await import('./editor/extensions/placeholder')\n\n      return compartment.reconfigure(placeholder(state().options.placeholder))\n    }\n\n    return compartment.reconfigure([])\n  },\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    if (state().options.interface.readonly) {\n      const { readonly } = await import('./editor/extensions/readonly')\n\n      return compartment.reconfigure(readonly())\n    }\n\n    return compartment.reconfigure([])\n  },\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    if (state().options.search) {\n      const { search } = await import('./editor/extensions/search')\n\n      return compartment.reconfigure(search())\n    }\n\n    return compartment.reconfigure([])\n  },\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    if (state().options.interface.spellcheck) {\n      const { spellcheck } = await import('./editor/extensions/spellcheck')\n\n      return compartment.reconfigure(spellcheck())\n    }\n\n    return compartment.reconfigure([])\n  },\n  async ([state]: InkInternal.Store, compartment: InkInternal.Vendor.Compartment) => {\n    if (state().options.vim) {\n      const { vim } = await import('./editor/extensions/vim')\n\n      return compartment.reconfigure(vim())\n    }\n\n    return compartment.reconfigure([])\n  },\n]\n","import { syntaxTree } from '@codemirror/language'\nimport type { Extension } from '@codemirror/state'\nimport { RangeSetBuilder } from '@codemirror/state'\nimport type { EditorView } from '@codemirror/view'\nimport { Decoration, ViewPlugin } from '@codemirror/view'\n\n// const mark = 'QuoteMark'\n\nconst blockquoteSyntaxNodes = [\n  'Blockquote',\n]\n\nconst blockquoteDecoration = Decoration.line({ attributes: { class: 'cm-blockquote' } })\nconst blockquoteOpenDecoration = Decoration.line({ attributes: { class: 'cm-blockquote-open' } })\nconst blockquoteCloseDecoration = Decoration.line({ attributes: { class: 'cm-blockquote-close' } })\n\nconst blockquotePlugin = ViewPlugin.define((view: EditorView) => {\n  return {\n    update: () => {\n      return decorate(view)\n    },\n  }\n}, { decorations: plugin => plugin.update() })\n\nconst decorate = (view: EditorView) => {\n  const builder = new RangeSetBuilder<Decoration>()\n  const tree = syntaxTree(view.state)\n\n  for (const visibleRange of view.visibleRanges) {\n    for (let position = visibleRange.from; position < visibleRange.to;) {\n      const line = view.state.doc.lineAt(position)\n\n      tree.iterate({\n        enter({ type, from, to }) {\n          if (type.name !== 'Document') {\n            if (blockquoteSyntaxNodes.includes(type.name)) {\n              builder.add(line.from, line.from, blockquoteDecoration)\n\n              const openLine = view.state.doc.lineAt(from)\n              const closeLine = view.state.doc.lineAt(to)\n\n              if (openLine.number === line.number)\n                builder.add(line.from, line.from, blockquoteOpenDecoration)\n\n              if (closeLine.number === line.number)\n                builder.add(line.from, line.from, blockquoteCloseDecoration)\n\n              return false\n            }\n          }\n        },\n        from: line.from,\n        to: line.to,\n      })\n\n      position = line.to + 1\n    }\n  }\n\n  return builder.finish()\n}\n\nexport const blockquote = (): Extension => {\n  return [\n    blockquotePlugin,\n  ]\n}\n","import { syntaxTree } from '@codemirror/language'\nimport type { Extension } from '@codemirror/state'\nimport { RangeSetBuilder } from '@codemirror/state'\nimport type { EditorView } from '@codemirror/view'\nimport { Decoration, ViewPlugin } from '@codemirror/view'\n\nconst codeBlockSyntaxNodes = [\n  'CodeBlock',\n  'FencedCode',\n  'HTMLBlock',\n  'CommentBlock',\n]\n\nconst sharedAttributes = {\n  // Prevent spellcheck in all code blocks. The Grammarly extension might not respect these values.\n  'data-enable-grammarly': 'false',\n  'data-gramm': 'false',\n  'data-grammarly-skip': 'true',\n  'spellcheck': 'false',\n}\n\nconst codeBlockDecoration = Decoration.line({ attributes: { ...sharedAttributes, class: 'cm-codeblock' } })\nconst codeBlockOpenDecoration = Decoration.line({ attributes: { ...sharedAttributes, class: 'cm-codeblock-open' } })\nconst codeBlockCloseDecoration = Decoration.line({ attributes: { ...sharedAttributes, class: 'cm-codeblock-close' } })\nconst codeDecoration = Decoration.mark({ attributes: { ...sharedAttributes, class: 'cm-code' } })\nconst codeOpenDecoration = Decoration.mark({ attributes: { ...sharedAttributes, class: 'cm-code cm-code-open' } })\nconst codeCloseDecoration = Decoration.mark({ attributes: { ...sharedAttributes, class: 'cm-code cm-code-close' } })\n\nconst codeBlockPlugin = ViewPlugin.define((view: EditorView) => {\n  return {\n    update: () => {\n      return decorate(view)\n    },\n  }\n}, { decorations: plugin => plugin.update() })\n\nconst decorate = (view: EditorView) => {\n  const builder = new RangeSetBuilder<Decoration>()\n  const tree = syntaxTree(view.state)\n\n  for (const visibleRange of view.visibleRanges) {\n    for (let position = visibleRange.from; position < visibleRange.to;) {\n      const line = view.state.doc.lineAt(position)\n      let inlineCode: { from: number, to: number, innerFrom: number, innerTo: number }\n\n      tree.iterate({\n        enter({ type, from, to }) {\n          if (type.name !== 'Document') {\n            if (codeBlockSyntaxNodes.includes(type.name)) {\n              builder.add(line.from, line.from, codeBlockDecoration)\n\n              const openLine = view.state.doc.lineAt(from)\n              const closeLine = view.state.doc.lineAt(to)\n\n              if (openLine.number === line.number)\n                builder.add(line.from, line.from, codeBlockOpenDecoration)\n\n              if (closeLine.number === line.number)\n                builder.add(line.from, line.from, codeBlockCloseDecoration)\n\n              return false\n            } else if (type.name === 'InlineCode') {\n              // Store a reference for the last inline code node.\n              inlineCode = { from, to, innerFrom: from, innerTo: to }\n            } else if (type.name === 'CodeMark') {\n              // Make sure the code mark is a part of the previously stored inline code node.\n              if (from === inlineCode.from) {\n                inlineCode.innerFrom = to\n\n                builder.add(from, to, codeOpenDecoration)\n              } else if (to === inlineCode.to) {\n                inlineCode.innerTo = from\n\n                builder.add(inlineCode.innerFrom, inlineCode.innerTo, codeDecoration)\n                builder.add(from, to, codeCloseDecoration)\n              }\n            }\n          }\n        },\n        from: line.from,\n        to: line.to,\n      })\n\n      position = line.to + 1\n    }\n  }\n\n  return builder.finish()\n}\n\nexport const code = (): Extension => {\n  return [\n    codeBlockPlugin,\n  ]\n}\n","import type { Extension } from '@codemirror/state'\nimport { EditorView } from '@codemirror/view'\n\nconst inkClassExtensions = () => {\n  return [\n    EditorView.editorAttributes.of({\n      class: 'ink-mde-container',\n    }),\n    EditorView.contentAttributes.of({\n      class: 'ink-mde-editor-content',\n    }),\n    // Todo: Maybe open a PR to add scrollerAttributes?\n  ]\n}\n\nexport const ink = (): Extension => {\n  return [\n    ...inkClassExtensions(),\n  ]\n}\n","import type { Extension } from '@codemirror/state'\nimport { EditorView } from '@codemirror/view'\n\nexport const lineWrapping = (): Extension => {\n  return EditorView.lineWrapping\n}\n","import { HighlightStyle, syntaxHighlighting } from '@codemirror/language'\nimport type { Extension } from '@codemirror/state'\nimport { tags } from '@lezer/highlight'\n\nexport const theme = (): Extension => {\n  const extension = syntaxHighlighting(\n    HighlightStyle.define([\n      // ordered by lowest to highest precedence\n      {\n        tag: tags.atom,\n        color: 'var(--ink-internal-syntax-atom-color)',\n      },\n      {\n        tag: tags.meta,\n        color: 'var(--ink-internal-syntax-meta-color)',\n      },\n      // emphasis types\n      {\n        tag: tags.emphasis,\n        color: 'var(--ink-internal-syntax-emphasis-color)',\n        fontStyle: 'var(--ink-internal-syntax-emphasis-font-style)',\n      },\n      {\n        tag: tags.strong,\n        color: 'var(--ink-internal-syntax-strong-color)',\n        fontWeight: 'var(--ink-internal-syntax-strong-font-weight)',\n      },\n      {\n        tag: tags.strikethrough,\n        color: 'var(--ink-internal-syntax-strikethrough-color)',\n        textDecoration: 'var(--ink-internal-syntax-strikethrough-text-decoration)',\n      },\n      // comment group\n      {\n        tag: tags.comment,\n        color: 'var(--ink-internal-syntax-comment-color)',\n        fontStyle: 'var(--ink-internal-syntax-comment-font-style)',\n      },\n      // monospace\n      {\n        tag: tags.monospace,\n        color: 'var(--ink-internal-syntax-code-color)',\n        fontFamily: 'var(--ink-internal-syntax-code-font-family)',\n      },\n      // name group\n      {\n        tag: tags.name,\n        color: 'var(--ink-internal-syntax-name-color)',\n      },\n      {\n        tag: tags.labelName,\n        color: 'var(--ink-internal-syntax-name-label-color)',\n      },\n      {\n        tag: tags.propertyName,\n        color: 'var(--ink-internal-syntax-name-property-color)',\n      },\n      {\n        tag: tags.definition(tags.propertyName),\n        color: 'var(--ink-internal-syntax-name-property-definition-color)',\n      },\n      {\n        tag: tags.variableName,\n        color: 'var(--ink-internal-syntax-name-variable-color)',\n      },\n      {\n        tag: tags.definition(tags.variableName),\n        color: 'var(--ink-internal-syntax-name-variable-definition-color)',\n      },\n      {\n        tag: tags.local(tags.variableName),\n        color: 'var(--ink-internal-syntax-name-variable-local-color)',\n      },\n      {\n        tag: tags.special(tags.variableName),\n        color: 'var(--ink-internal-syntax-name-variable-special-color)',\n      },\n      // headings\n      {\n        tag: tags.heading,\n        color: 'var(--ink-internal-syntax-heading-color)',\n        fontWeight: 'var(--ink-internal-syntax-heading-font-weight)',\n      },\n      {\n        tag: tags.heading1,\n        color: 'var(--ink-internal-syntax-heading1-color)',\n        fontSize: 'var(--ink-internal-syntax-heading1-font-size)',\n        fontWeight: 'var(--ink-internal-syntax-heading1-font-weight)',\n      },\n      {\n        tag: tags.heading2,\n        color: 'var(--ink-internal-syntax-heading2-color)',\n        fontSize: 'var(--ink-internal-syntax-heading2-font-size)',\n        fontWeight: 'var(--ink-internal-syntax-heading2-font-weight)',\n      },\n      {\n        tag: tags.heading3,\n        color: 'var(--ink-internal-syntax-heading3-color)',\n        fontSize: 'var(--ink-internal-syntax-heading3-font-size)',\n        fontWeight: 'var(--ink-internal-syntax-heading3-font-weight)',\n      },\n      {\n        tag: tags.heading4,\n        color: 'var(--ink-internal-syntax-heading4-color)',\n        fontSize: 'var(--ink-internal-syntax-heading4-font-size)',\n        fontWeight: 'var(--ink-internal-syntax-heading4-font-weight)',\n      },\n      {\n        tag: tags.heading5,\n        color: 'var(--ink-internal-syntax-heading5-color)',\n        fontSize: 'var(--ink-internal-syntax-heading5-font-size)',\n        fontWeight: 'var(--ink-internal-syntax-heading5-font-weight)',\n      },\n      {\n        tag: tags.heading6,\n        color: 'var(--ink-internal-syntax-heading6-color)',\n        fontSize: 'var(--ink-internal-syntax-heading6-font-size)',\n        fontWeight: 'var(--ink-internal-syntax-heading6-font-weight)',\n      },\n      // contextual tag types\n      {\n        tag: tags.keyword,\n        color: 'var(--ink-internal-syntax-keyword-color)',\n      },\n      {\n        tag: tags.number,\n        color: 'var(--ink-internal-syntax-number-color)',\n      },\n      {\n        tag: tags.operator,\n        color: 'var(--ink-internal-syntax-operator-color)',\n      },\n      {\n        tag: tags.punctuation,\n        color: 'var(--ink-internal-syntax-punctuation-color)',\n      },\n      {\n        tag: tags.link,\n        color: 'var(--ink-internal-syntax-link-color)',\n        wordBreak: 'break-all',\n      },\n      {\n        tag: tags.url,\n        color: 'var(--ink-internal-syntax-url-color)',\n        wordBreak: 'break-all',\n      },\n      // string group\n      {\n        tag: tags.string,\n        color: 'var(--ink-internal-syntax-string-color)',\n      },\n      {\n        tag: tags.special(tags.string),\n        color: 'var(--ink-internal-syntax-string-special-color)',\n      },\n      // processing instructions\n      {\n        tag: tags.processingInstruction,\n        color: 'var(--ink-internal-syntax-processing-instruction-color)',\n      },\n    ]),\n  )\n\n  return [\n    extension,\n  ]\n}\n","import { defaultKeymap, history, historyKeymap } from '@codemirror/commands'\nimport type { EditorSelection } from '@codemirror/state'\nimport { EditorState } from '@codemirror/state'\nimport { keymap } from '@codemirror/view'\nimport { buildVendors } from '/src/extensions'\nimport type * as Ink from '/types/ink'\nimport type InkInternal from '/types/internal'\nimport { toCodeMirror } from './adapters/selections'\nimport { blockquote } from './extensions/blockquote'\nimport { code } from './extensions/code'\nimport { ink } from './extensions/ink'\nimport { lineWrapping } from './extensions/line_wrapping'\nimport { theme } from './extensions/theme'\n\nconst toVendorSelection = (selections: Ink.Editor.Selection[]): EditorSelection | undefined => {\n  if (selections.length > 0) {\n    return toCodeMirror(selections)\n  }\n}\n\nexport const createState = ([state, setState]: InkInternal.Store): InkInternal.Vendor.State => {\n  const { selections } = state().options\n\n  return EditorState.create({\n    doc: state().options.doc,\n    selection: toVendorSelection(selections),\n    extensions: [\n      keymap.of([\n        ...defaultKeymap,\n        ...historyKeymap,\n      ]),\n      blockquote(),\n      code(),\n      history(),\n      ink(),\n      lineWrapping(),\n      theme(),\n      ...buildVendors([state, setState]),\n    ],\n  })\n}\n","import { EditorView } from '@codemirror/view'\nimport type InkInternal from '/types/internal'\nimport { createState } from './state'\n\nexport const createView = ([state, setState]: InkInternal.Store, target?: HTMLElement): InkInternal.Editor => {\n  const rootNode = target?.getRootNode()\n  const root = rootNode?.nodeType === 11 ? rootNode as ShadowRoot : undefined\n\n  const editor = new EditorView({\n    dispatch: (transaction: InkInternal.Vendor.Transaction) => {\n      const { options } = state()\n      const newDoc = transaction.newDoc.toString()\n\n      options.hooks.beforeUpdate(newDoc)\n      editor.update([transaction])\n\n      if (transaction.docChanged) {\n        setState({ ...state(), doc: newDoc })\n\n        options.hooks.afterUpdate(newDoc)\n      }\n    },\n    root,\n    state: createState([state, setState]),\n  })\n\n  return editor\n}\n","const types = {\n  array: '[object Array]',\n  object: '[object Object]',\n  string: '[object String]',\n  undefined: '[object Undefined]',\n  window: '[object Window]',\n}\n\nconst getType = (object: any) => {\n  const type = Object.prototype.toString.call(object)\n\n  if (type === types.object) {\n    return `[object ${object.constructor.name}]`\n  }\n}\n\nconst is = (object: any, type: string) => {\n  return getType(object) === type\n}\n\nconst deepAssign = (target: any, source: any) => {\n  const seen = new WeakMap()\n\n  const assign = (target: any, source: any) => {\n    if (seen.get(target)) return target\n    if (is(target, types.object)) seen.set(target, true)\n    if (is(source, types.undefined)) return target\n\n    if (is(target, types.array) && is(source, types.array)) {\n      return [...source]\n    }\n\n    if (is(target, types.object) && is(source, types.object)) {\n      return Object.keys(target).reduce((replacement: Record<PropertyKey, unknown>, key: PropertyKey) => {\n        if (Object.hasOwnProperty.call(source, key)) {\n          replacement[key] = assign(target[key], source[key])\n        } else {\n          replacement[key] = target[key]\n        }\n\n        return replacement\n      }, {})\n    }\n\n    return source\n  }\n\n  return assign(target, source)\n}\n\nexport const override = <T>(a: T, b: unknown): T => {\n  return deepAssign(a, b) as unknown as T\n}\n","import { createState } from '/src/editor'\nimport { override } from '/src/utils/merge'\nimport type InkInternal from '/types/internal'\n\nexport const load = ([state, setState]: InkInternal.Store, doc: string) => {\n  setState(override(state(), { options: { doc } }))\n\n  state().editor.setState(createState([state, setState]))\n}\n","import type InkInternal from '/types/internal'\n\nexport const options = ([state]: InkInternal.Store) => {\n  return state().options\n}\n","import { buildVendorUpdates } from '/src/extensions'\nimport { override } from '/src/utils/merge'\nimport type * as Ink from '/types/ink'\nimport type InkInternal from '/types/internal'\n\nexport const reconfigure = async ([state, setState]: InkInternal.Store, options: Ink.Options) => {\n  const { workQueue } = state()\n\n  return workQueue.enqueue(async () => {\n    setState(override(state(), { options }))\n    const effects = await buildVendorUpdates([state, setState])\n\n    state().editor.dispatch({ effects })\n  })\n}\n","import type * as Ink from '/types/ink'\nimport type InkInternal from '/types/internal'\nimport * as InkValues from '/types/values'\nimport { toCodeMirror } from '../editor/adapters/selections'\n\nexport const select = (store: InkInternal.Store, options: Ink.Instance.SelectOptions = {}) => {\n  if (options.selections)\n    return selectMultiple(store, options.selections)\n  if (options.selection)\n    return selectOne(store, options.selection)\n  if (options.at)\n    return selectAt(store, options.at)\n}\n\nexport const selectAt = (store: InkInternal.Store, at: Ink.Values.Selection) => {\n  const [state] = store\n\n  if (at === InkValues.Selection.Start)\n    return selectOne(store, { start: 0, end: 0 })\n\n  if (at === InkValues.Selection.End) {\n    const position = state().editor.state.doc.length\n\n    return selectOne(store, { start: position, end: position })\n  }\n}\n\nexport const selectMultiple = ([state]: InkInternal.Store, selections: Ink.Editor.Selection[]) => {\n  const { editor } = state()\n\n  editor.dispatch(\n    editor.state.update({\n      selection: toCodeMirror(selections),\n    }),\n  )\n}\n\nexport const selectOne = (store: InkInternal.Store, selection: Ink.Editor.Selection) => {\n  return selectMultiple(store, [selection])\n}\n","import type InkInternal from '/types/internal'\n\nexport const update = ([state]: InkInternal.Store, doc: string) => {\n  const { editor } = state()\n\n  editor.dispatch(\n    editor.state.update({\n      changes: {\n        from: 0,\n        to: editor.state.doc.length,\n        insert: doc,\n      },\n    }),\n  )\n}\n","import type * as Ink from '/types/ink'\nimport type InkInternal from '/types/internal'\nimport { insert } from './insert'\nimport { select } from './select'\nimport { selections } from './selections'\n\nexport const wrap = ([state, setState]: InkInternal.Store, { after, before, selection: userSelection }: Ink.Instance.WrapOptions) => {\n  const { editor } = state()\n\n  const selection = userSelection || selections([state, setState]).pop() || { start: 0, end: 0 }\n  const text = editor.state.sliceDoc(selection.start, selection.end)\n\n  insert([state, setState], `${before}${text}${after}`, selection)\n  select([state, setState], { selections: [{ start: selection.start + before.length, end: selection.end + before.length }] })\n}\n","import { type Thenable } from '/src/utils/inspect'\n\nexport type Awaitable<T> = () => Promise<T>\nexport type AwaitableCallbacks = { fulfilled: AwaitableCallback[], rejected: AwaitableCallback[], settled: AwaitableCallback[] }\nexport type AwaitableSettler<T = any> = (value: T) => void\nexport type AwaitableThenSettler<T = any, R = any> = (value: T) => R | Thenable<R>\nexport type AwaitableCallback = () => void\nexport type AwaitableHandler<ResolvedValue = unknown, RejectedValue = unknown> = (resolve: AwaitableSettler<ResolvedValue>, reject: AwaitableSettler<RejectedValue>) => any\nexport type AwaitableState = { callbacks: AwaitableCallbacks, error?: any, status: AwaitableStatus, value?: any }\nexport type AwaitableStatus = 'fulfilled' | 'pending' | 'rejected'\n\n// Todo: Make it so that it allows 2 values to be returned: first one for initial return object (merged with awaitable), second one for resolved object (defaults to the first)\nexport const awaitable = <InitialValue extends object, ResolvedValue = InitialValue, RejectedValue = unknown>(initialValue: InitialValue, handler: AwaitableHandler<ResolvedValue, RejectedValue>): InitialValue & Promise<ResolvedValue> => {\n  const state: AwaitableState = {\n    callbacks: {\n      fulfilled: [],\n      rejected: [],\n      settled: [],\n    },\n    status: 'pending',\n  }\n\n  const callback = (settler: AwaitableThenSettler, { resolve, reject }: { reject: AwaitableSettler, resolve?: AwaitableSettler }) => {\n    return () => {\n      try {\n        const settledValue = settler(state.value)\n\n        Promise.resolve(settledValue).then(resolve, reject)\n      } catch (error: any) {\n        reject(error)\n      }\n    }\n  }\n\n  const reject = (value: RejectedValue) => {\n    if (state.status === 'pending') {\n      state.status = 'rejected'\n      state.value = value\n\n      state.callbacks.rejected.forEach(callback => callback())\n      state.callbacks.settled.forEach(callback => callback())\n    }\n  }\n\n  const resolve = (value: ResolvedValue) => {\n    if (state.status === 'pending') {\n      state.status = 'fulfilled'\n      state.value = value\n\n      state.callbacks.fulfilled.forEach(callback => callback())\n      state.callbacks.settled.forEach(callback => callback())\n    }\n  }\n\n  const then = <OnFulfilled extends AwaitableThenSettler, OnRejected extends AwaitableThenSettler>(onFulfilled?: OnFulfilled, onRejected?: OnRejected) => {\n    return new Promise<ReturnType<Awaited<OnFulfilled>>>((resolve, reject) => {\n      if (state.status === 'pending') {\n        if (onFulfilled) {\n          state.callbacks.fulfilled.push(callback(onFulfilled, { resolve, reject }))\n        }\n\n        if (onRejected) {\n          state.callbacks.rejected.push(callback(onRejected, { resolve: undefined, reject }))\n        }\n      }\n\n      if (state.status === 'fulfilled' && onFulfilled) {\n        callback(onFulfilled, { resolve, reject })()\n      }\n\n      if (state.status === 'rejected' && onRejected) {\n        callback(onRejected, { resolve: undefined, reject })()\n      }\n    })\n  }\n\n  queueMicrotask(() => {\n    try {\n      handler(resolve, reject)\n    } catch (error: any) {\n      reject(error)\n    }\n  })\n\n  return {\n    ...initialValue,\n    [Symbol.toStringTag]: 'awaitable',\n    catch: then.bind(undefined, undefined),\n    finally: (onSettled: () => void) => {\n      return new Promise((resolve, reject) => {\n        if (state.status === 'pending') {\n          state.callbacks.settled.push(callback(onSettled, { resolve, reject }))\n        }\n\n        if (state.status === 'fulfilled') {\n          onSettled()\n          resolve(state.value)\n        }\n\n        if (state.status === 'rejected') {\n          onSettled()\n          reject(state.value)\n        }\n      })\n    },\n    then,\n  }\n}\n","import {\n  destroy,\n  focus,\n  format,\n  getDoc,\n  insert,\n  load,\n  options,\n  reconfigure,\n  select,\n  selections,\n  update,\n  wrap,\n} from '/src/api'\nimport { awaitable } from '/src/utils/awaitable'\nimport type * as Ink from '/types/ink'\nimport type InkInternal from '/types/internal'\n\nexport const makeInstance = (store: InkInternal.Store): Ink.AwaitableInstance => {\n  const instance = {\n    destroy: destroy.bind(undefined, store),\n    focus: focus.bind(undefined, store),\n    format: format.bind(undefined, store),\n    getDoc: getDoc.bind(undefined, store),\n    insert: insert.bind(undefined, store),\n    load: load.bind(undefined, store),\n    options: options.bind(undefined, store),\n    reconfigure: reconfigure.bind(undefined, store),\n    select: select.bind(undefined, store),\n    selections: selections.bind(undefined, store),\n    update: update.bind(undefined, store),\n    wrap: wrap.bind(undefined, store),\n  }\n\n  return awaitable(instance, (resolve, reject) => {\n    try {\n      const [state] = store\n\n      // Ensure all other queued tasks are finished before resolving.\n      state().workQueue.enqueue(() => resolve(instance))\n    } catch (error: any) {\n      reject(error)\n    }\n  })\n}\n","import { syntaxTree } from '@codemirror/language'\nimport { type EditorState, type Range, type RangeCursor, RangeSet, StateField, type Transaction } from '@codemirror/state'\nimport { Decoration, EditorView, type WidgetType } from '@codemirror/view'\nimport { type SyntaxNodeRef } from '@lezer/common'\n\n// Todo: Maybe open a PR to expose these types.\n// https://github.com/codemirror/view/blob/3f1b991f3db20d152045ae9e6872466fc8d8fdac/src/decoration.ts\nexport type LineDecorationSpec = { attributes?: { [key: string]: string }, class?: string, [other: string]: any }\nexport type MarkDecorationSpec = { attributes?: { [key: string]: string }, class?: string, inclusive?: boolean, inclusiveEnd?: boolean, inclusiveStart?: boolean, tagName?: string, [other: string]: any }\nexport type ReplaceDecorationSpec = { block?: boolean, inclusive?: boolean, inclusiveEnd?: boolean, inclusiveStart?: boolean, widget?: WidgetType, [other: string]: any }\nexport type WidgetDecorationSpec = { widget: WidgetType, block?: boolean, side?: number, [other: string]: any }\n\nexport type Defined<T> = Required<{\n  [K in keyof T]: NonNullable<T[K]>\n}>\n\n// Custom types.\nexport type CustomDecorationArgs = Parameters<typeof Decoration.mark>[0]\nexport type CustomDecoration<T> = T & Decoration\nexport type CustomDecorationTypes = 'line' | 'mark' | 'replace' | 'widget'\nexport type CustomWidget<T> = T & WidgetSpec\nexport type CustomWidgetArgs<T extends PartialWidgetSpec> = {\n  [K in keyof T]?: K extends 'eq' ? (other: CustomWidget<Defined<T>>) => boolean : T[K]\n}\nexport type CustomWidgetOptions<T extends PartialWidgetSpec> = {\n  [K in keyof T]: K extends 'compare' | 'eq' ? (other: CustomWidget<Defined<T>>) => boolean : T[K]\n}\nexport type CustomWidgetDecoration<T> = T & WidgetDecoration<T> & Decoration\nexport type CustomWidgetDecorationArgs = WidgetDecorationSpec & Record<string, any>\nexport type NodeBlockDecoration<T> = CustomWidgetDecoration<T> & { widget: { node: SyntaxNodeRef } }\nexport type NodeDecoratorArgs<T extends Decoration> = {\n  nodes: string[],\n  onMatch: (state: EditorState, node: SyntaxNodeRef) => T | T[] | void,\n  optimize?: boolean,\n  range?: {\n    from?: number,\n    to?: number,\n  },\n}\nexport type PartialWidgetSpec = Partial<WidgetSpec>\nexport type TypedDecoration = Decoration & { spec: Decoration['spec'] & { type: CustomDecorationTypes } }\nexport type WidgetSpec = WidgetType & { id?: string }\nexport type WidgetDecoration<T> = { block: boolean, side: number, widget: CustomWidget<T> }\n\nexport const buildBlockWidgetDecoration = <T extends CustomWidgetDecorationArgs>(options: T) => {\n  return buildWidgetDecoration({\n    block: true,\n    side: -1,\n    ...options,\n  })\n}\n\nexport const buildLineDecoration = <T extends MarkDecorationSpec>(options: T) => {\n  return Decoration.line({\n    ...options,\n    type: 'line',\n  }) as CustomDecoration<T>\n}\n\nexport const buildMarkDecoration = <T extends MarkDecorationSpec>(options: T) => {\n  return Decoration.mark({\n    ...options,\n    type: 'mark',\n  }) as CustomDecoration<T>\n}\n\nexport type WidgetOptions<T extends Record<string, any>> = {\n  [K in ((keyof T) | 'compare' | 'eq')]?: K extends 'compare' | 'eq' ? (other: WidgetReturn<T>) => boolean\n    : K extends keyof WidgetSpec ? WidgetSpec[K]\n    : T[K]\n}\nexport type WidgetReturn<T extends Record<string, any>> = {\n  [K in keyof (T & WidgetSpec)]: K extends keyof T ? NonNullable<T[K]>\n    : K extends keyof WidgetSpec ? WidgetSpec[K]\n    : never\n}\n\nexport const buildWidget = <T extends Record<string, any>>(options: WidgetOptions<T>): WidgetSpec => {\n  const eq = (other: WidgetReturn<T>) => {\n    if (options.eq) return options.eq(other)\n    if (!options.id) return false\n\n    return options.id === other.id\n  }\n\n  return {\n    compare: (other: WidgetReturn<T>) => {\n      return eq(other)\n    },\n    coordsAt: () => null,\n    destroy: () => {},\n    eq: (other: WidgetReturn<T>) => {\n      return eq(other)\n    },\n    estimatedHeight: -1,\n    ignoreEvent: () => true,\n    lineBreaks: 0,\n    toDOM: () => {\n      return document.createElement('span')\n    },\n    updateDOM: () => false,\n    ...options,\n  }\n}\n\nexport const buildWidgetDecoration = <T extends CustomWidgetDecorationArgs>(options: T): CustomWidgetDecoration<T> => {\n  return Decoration.widget({\n    block: false,\n    side: 0,\n    ...options,\n    widget: buildWidget({\n      ...options.widget,\n    }),\n    type: 'widget',\n  }) as CustomWidgetDecoration<T>\n}\n\nexport const buildNodeDecorations = <T extends TypedDecoration>(state: EditorState, options: NodeDecoratorArgs<T>) => {\n  const decorationRanges: Range<NodeBlockDecoration<T>>[] = []\n\n  syntaxTree(state).iterate({\n    enter: (node) => {\n      if (options.nodes.includes(node.type.name)) {\n        const maybeDecorations = options.onMatch(state, node)\n\n        if (!maybeDecorations) return\n\n        const decorations = Array<T>().concat(maybeDecorations)\n\n        decorations.forEach((decoration) => {\n          if (decoration.spec.type === 'line') {\n            const wrapped = buildLineDecoration({ ...decoration.spec, node: { ...node } })\n\n            for (let line = state.doc.lineAt(node.from); line.from < node.to; line = state.doc.lineAt(line.to + 1)) {\n              decorationRanges.push(wrapped.range(line.from))\n\n              if (line.to === state.doc.length) break\n            }\n          }\n\n          if (decoration.spec.type === 'mark') {\n            const wrapped = buildMarkDecoration({ ...decoration.spec, node: { ...node } }).range(node.from, node.to)\n\n            decorationRanges.push(wrapped)\n          }\n\n          if (decoration.spec.type === 'widget') {\n            const wrapped = buildWidgetDecoration({ ...decoration.spec, node: { ...node } }).range(node.from)\n\n            decorationRanges.push(wrapped)\n          }\n        })\n      }\n    },\n    from: options.range?.from,\n    to: options.range?.to,\n  })\n\n  return decorationRanges.sort((left, right) => {\n    return left.from - right.from\n  })\n}\n\nexport const buildOptimizedNodeDecorations = <T extends Decoration>(rangeSet: RangeSet<NodeBlockDecoration<T>>, transaction: Transaction, options: NodeDecoratorArgs<T>) => {\n  const decorations = [] as Range<NodeBlockDecoration<T>>[]\n  const cursor = rangeSet.iter()\n  const cursors = [] as RangeCursor<NodeBlockDecoration<T>>[]\n  const cursorsToSkip = [] as RangeCursor<NodeBlockDecoration<T>>[]\n\n  while (cursor.value) {\n    cursors.push({ ...cursor })\n    cursor.next()\n  }\n\n  transaction.changes.iterChangedRanges((_beforeFrom, _beforeTo, changeFrom, changeTo) => {\n    cursors.forEach((cursor) => {\n      if (cursor.value) {\n        const nodeLength = cursor.value.spec.node.to - cursor.value.spec.node.from\n        const cursorFrom = cursor.from\n        const cursorTo = cursor.from + nodeLength\n\n        if (isOverlapping(cursorFrom, cursorTo, changeFrom, changeTo)) {\n          cursorsToSkip.push(cursor)\n        }\n      }\n    })\n\n    const range = { from: changeFrom, to: changeTo }\n\n    decorations.push(...buildNodeDecorations(transaction.state, { ...options, range }))\n  })\n\n  const cursorDecos = cursors.filter(cursor => !cursorsToSkip.includes(cursor)).flatMap((cursor) => {\n    const range = cursor.value?.range(cursor.from) as Range<NodeBlockDecoration<T>>\n\n    if (!range) return []\n\n    return [range]\n  })\n\n  decorations.push(...cursorDecos)\n\n  const allDecorations = decorations.sort((left, right) => {\n    return left.from - right.from\n  })\n\n  // This reprocesses the entire state.\n  return allDecorations\n}\n\nexport const isOverlapping = (x1: number, x2: number, y1: number, y2: number) => {\n  return Math.max(x1, y1) <= Math.min(x2, y2)\n}\n\nexport const nodeDecorator = <T extends Decoration>(options: NodeDecoratorArgs<T>) => {\n  return StateField.define<RangeSet<NodeBlockDecoration<T>>>({\n    create(state) {\n      return RangeSet.of(buildNodeDecorations(state, options))\n    },\n    update(rangeSet, transaction) {\n      // Reconfiguration and state effects will reprocess the entire state to ensure nothing is missed.\n      if (transaction.reconfigured || transaction.effects.length > 0) {\n        return RangeSet.of(buildNodeDecorations(transaction.state, options))\n      }\n\n      const updatedRangeSet = rangeSet.map(transaction.changes)\n\n      if (transaction.docChanged) {\n        // Only process the ranges that are affected by this change.\n        if (options.optimize) {\n          return RangeSet.of(buildOptimizedNodeDecorations(updatedRangeSet, transaction, options))\n        }\n\n        return RangeSet.of(buildNodeDecorations(transaction.state, options))\n      }\n\n      // No need to redecorate. Instead, just map the decorations through the transaction changes.\n      return updatedRangeSet\n    },\n    provide(field) {\n      // Provide the extension to the editor.\n      return EditorView.decorations.from(field)\n    },\n  })\n}\n","import { Tag } from '@lezer/highlight'\n\nexport const buildTag = <T extends Tag>(parent?: T) => {\n  return Tag.define(parent)\n}\n\nexport const getCharCode = (char: string) => {\n  return char.charCodeAt(0)\n}\n","import { type Tag, tags } from '@lezer/highlight'\nimport { type BlockParser, type DelimiterType, type InlineParser, type MarkdownConfig, type NodeSpec } from '@lezer/markdown'\nimport { buildTag, getCharCode } from './parsers'\n\nexport const buildMarkNode = (markName: string) => {\n  return buildTaggedNode(markName, [tags.processingInstruction])\n}\n\nexport const buildTaggedNode = (nodeName: string, styleTags: Tag[] = []) => {\n  const tag = buildTag()\n  const node = defineNode({\n    name: nodeName,\n    style: [tag, ...styleTags],\n  })\n\n  return {\n    node,\n    tag,\n  }\n}\n\nexport const defineBlockParser = <T extends BlockParser>(options: T) => options\nexport const defineDelimiter = <T extends DelimiterType>(options?: T) => ({ ...options })\nexport const defineInlineParser = <T extends InlineParser>(options: T) => options\nexport const defineMarkdown = <T extends MarkdownConfig>(options: T) => options\nexport const defineNode = <T extends NodeSpec>(options: T) => options\n\n/**\n * Build an inline Markdown parser that matches a custom expression. E.g. `[[hello]]` for wikilinks.\n *\n * @param options\n * @param options.name The name of the new node type. E.g. `WikiLink` for wikilinks.\n * @param options.prefix The tokens that indicate the start of the custom expression. E.g. `[[` for wikilinks.\n * @param options.suffix The tokens that indicate the end of the custom expression. E.g. `]]` for wikilinks.\n * @param options.matcher The regex that matches the custom expression. E.g. `/(?<prefix>\\[\\[)(?<content>.*?)(?<suffix>\\]\\])/` for wikilinks.\n */\nexport const buildInlineParser = (options: { name: string, prefix: string, matcher?: RegExp, suffix?: string }) => {\n  const { name, prefix, suffix } = options\n  const matcher = options.matcher || new RegExp(`(?<prefix>${prefix})(?<content>.*?)(?<suffix>${suffix})`)\n  const [firstCharCode, ...prefixCharCodes] = prefix.split('').map(getCharCode)\n\n  const taggedNode = buildTaggedNode(name)\n  const taggedNodeMark = buildMarkNode(`${name}Mark`)\n  const taggedNodeMarkStart = buildMarkNode(`${name}MarkStart`)\n  const taggedNodeMarkEnd = buildMarkNode(`${name}MarkEnd`)\n\n  return defineInlineParser({\n    name: taggedNode.node.name,\n    parse: (inlineContext, nextCharCode, position) => {\n      // Match the first char code as efficiently as possible.\n      if (nextCharCode !== firstCharCode) return -1\n\n      // Check the remaining char codes.\n      for (let i = 0; i < prefixCharCodes.length; i++) {\n        const prefixCharCode = prefixCharCodes[i]\n        const nextCharPosition = position + i + 1\n\n        if (inlineContext.text.charCodeAt(nextCharPosition) !== prefixCharCode) return -1\n      }\n\n      // Get all the line text left after the current position.\n      const remainingLineText = inlineContext.slice(position, inlineContext.end)\n\n      if (!matcher.test(remainingLineText)) return -1\n\n      const match = remainingLineText.match(matcher)\n\n      // Todo: Add config to allow empty?\n      if (!match?.groups?.content) return -1\n\n      const prefixLength = prefix.length\n      const contentLength = match.groups.content.length\n      const suffixLength = suffix?.length || 0\n\n      return inlineContext.addElement(\n        inlineContext.elt(\n          taggedNode.node.name,\n          position,\n          position + prefixLength + contentLength + suffixLength,\n          [\n            inlineContext.elt(\n              taggedNodeMark.node.name,\n              position,\n              position + prefixLength,\n              [\n                inlineContext.elt(\n                  taggedNodeMarkStart.node.name,\n                  position,\n                  position + prefixLength,\n                ),\n              ],\n            ),\n            inlineContext.elt(\n              taggedNodeMark.node.name,\n              position + prefixLength + contentLength,\n              position + prefixLength + contentLength + suffixLength,\n              [\n                inlineContext.elt(\n                  taggedNodeMarkEnd.node.name,\n                  position + prefixLength + contentLength,\n                  position + prefixLength + contentLength + suffixLength,\n                ),\n              ],\n            ),\n          ],\n        ),\n      )\n    },\n  })\n}\n","import { buildMarkNode, buildTaggedNode, defineBlockParser, defineInlineParser, defineMarkdown, getCharCode } from '/lib/codemirror-kit'\n\nexport const charCodes = {\n  dollarSign: getCharCode('$'),\n}\n\nexport const mathInlineTestRegex = /\\$.*?\\$/\nexport const mathInlineCaptureRegex = /\\$(?<math>.*?)\\$/\n\nexport const mathInline = buildTaggedNode('MathInline')\nexport const mathInlineMark = buildMarkNode('MathInlineMark')\nexport const mathInlineMarkOpen = buildMarkNode('MathInlineMarkOpen')\nexport const mathInlineMarkClose = buildMarkNode('MathInlineMarkClose')\nexport const mathInlineParser = defineInlineParser({\n  name: mathInline.node.name,\n  parse: (inlineContext, nextCharCode, position) => {\n    // Not a \"$\" char.\n    if (nextCharCode !== charCodes.dollarSign) return -1\n\n    const remainingLineText = inlineContext.slice(position, inlineContext.end)\n\n    // No ending \"$\" found.\n    if (!mathInlineTestRegex.test(remainingLineText)) return -1\n\n    const match = remainingLineText.match(mathInlineCaptureRegex)\n\n    // No match found.\n    if (!match?.groups?.math) return -1\n\n    const mathExpressionLength = match.groups.math.length\n\n    return inlineContext.addElement(\n      inlineContext.elt(\n        mathInline.node.name,\n        position,\n        position + mathExpressionLength + 2,\n        [\n          inlineContext.elt(\n            mathInlineMark.node.name,\n            position,\n            position + 1,\n            [\n              inlineContext.elt(\n                mathInlineMarkOpen.node.name,\n                position,\n                position + 1,\n              ),\n            ],\n          ),\n          inlineContext.elt(\n            mathInlineMark.node.name,\n            position + mathExpressionLength + 1,\n            position + mathExpressionLength + 2,\n            [\n              inlineContext.elt(\n                mathInlineMarkClose.node.name,\n                position + mathExpressionLength + 1,\n                position + mathExpressionLength + 2,\n              ),\n            ],\n          ),\n        ],\n      ),\n    )\n  },\n})\n\nexport const mathBlockTestRegex = /\\$.*?\\$/\nexport const mathBlockCaptureRegex = /\\$(?<math>.*?)\\$/\n\nexport const mathBlock = buildTaggedNode('MathBlock')\nexport const mathBlockMark = buildMarkNode('MathBlockMark')\nexport const mathBlockMarkOpen = buildMarkNode('MathBlockMarkOpen')\nexport const mathBlockMarkClose = buildMarkNode('MathBlockMarkClose')\nexport const mathBlockParser = defineBlockParser({\n  name: 'MathBlock',\n  parse: (blockContext, line) => {\n    // Not \"$\"\n    if (line.next !== charCodes.dollarSign) return false\n    // Not \"$$\"\n    if (line.text.charCodeAt(line.pos + 1) !== charCodes.dollarSign) return false\n\n    const openLineStart = blockContext.lineStart + line.pos\n    const openLineEnd = openLineStart + line.text.length\n\n    // Move past opening line.\n    while (blockContext.nextLine()) {\n      // Closing \"$$\"\n      if (line.next === charCodes.dollarSign && line.text.charCodeAt(line.pos + 1) === charCodes.dollarSign) {\n        const closeLineStart = blockContext.lineStart + line.pos\n        const closeLineEnd = closeLineStart + line.text.length\n\n        blockContext.addElement(\n          blockContext.elt(\n            mathBlock.node.name,\n            openLineStart,\n            closeLineEnd,\n            [\n              blockContext.elt(\n                mathBlockMark.node.name,\n                openLineStart,\n                openLineEnd,\n                [\n                  blockContext.elt(\n                    mathBlockMarkOpen.node.name,\n                    openLineStart,\n                    openLineEnd,\n                  ),\n                ],\n              ),\n              blockContext.elt(\n                mathBlockMark.node.name,\n                closeLineStart,\n                closeLineEnd,\n                [\n                  blockContext.elt(\n                    mathBlockMarkClose.node.name,\n                    closeLineStart,\n                    closeLineEnd,\n                  ),\n                ],\n              ),\n            ],\n          ),\n        )\n\n        blockContext.nextLine()\n\n        break\n      }\n    }\n\n    return true\n  },\n})\n\nexport const grammar = defineMarkdown({\n  defineNodes: [\n    mathInline.node,\n    mathInlineMark.node,\n    mathInlineMarkClose.node,\n    mathInlineMarkOpen.node,\n    mathBlock.node,\n    mathBlockMark.node,\n    mathBlockMarkOpen.node,\n    mathBlockMarkClose.node,\n  ],\n  parseBlock: [\n    mathBlockParser,\n  ],\n  parseInline: [\n    mathInlineParser,\n  ],\n})\n","import { HighlightStyle, syntaxHighlighting } from '@codemirror/language'\nimport { EditorView } from '@codemirror/view'\nimport { buildBlockWidgetDecoration, buildLineDecoration, buildWidget, nodeDecorator } from '/lib/codemirror-kit'\nimport { plugin, pluginTypes } from '/src/index'\nimport { grammar, mathInline, mathInlineMark, mathInlineMarkClose, mathInlineMarkOpen } from './grammar'\n\nexport const katex = () => {\n  return [\n    plugin({\n      key: 'katex',\n      type: pluginTypes.grammar,\n      value: async () => grammar,\n    }),\n    plugin({\n      key: 'katex',\n      value: async () => {\n        return nodeDecorator({\n          nodes: ['MathBlock', 'MathBlockMarkClose', 'MathBlockMarkOpen'],\n          onMatch: (_state, node) => {\n            const classes = ['ink-mde-line-math-block']\n\n            if (node.name === 'MathBlockMarkOpen') classes.push('ink-mde-line-math-block-open')\n            if (node.name === 'MathBlockMarkClose') classes.push('ink-mde-line-math-block-close')\n\n            return buildLineDecoration({\n              attributes: {\n                class: classes.join(' '),\n              },\n            })\n          },\n          optimize: false,\n        })\n      },\n    }),\n    plugin({\n      key: 'katex',\n      value: async () => {\n        return nodeDecorator({\n          nodes: ['MathBlock'],\n          onMatch: (state, node) => {\n            const text = state.sliceDoc(node.from, node.to).split('\\n').slice(1, -1).join('\\n')\n\n            if (text) {\n              return buildBlockWidgetDecoration({\n                widget: buildWidget({\n                  id: text,\n                  toDOM: (view) => {\n                    const container = document.createElement('div')\n                    const katexTarget = document.createElement('div')\n\n                    container.className = 'ink-mde-block-widget-container'\n                    katexTarget.className = 'ink-mde-block-widget ink-mde-katex-target'\n                    container.appendChild(katexTarget)\n\n                    import('katex').then(({ default: lib }) => {\n                      lib.render(text, katexTarget, { output: 'html', throwOnError: false })\n\n                      view.requestMeasure()\n                    })\n\n                    return container\n                  },\n                  updateDOM: (dom, view) => {\n                    const katexTarget = dom.querySelector<HTMLElement>('.ink-mde-katex-target')\n\n                    if (katexTarget) {\n                      import('katex').then(({ default: lib }) => {\n                        lib.render(text, katexTarget, { output: 'html', throwOnError: false })\n\n                        view.requestMeasure()\n                      })\n\n                      return true\n                    }\n\n                    return false\n                  },\n                }),\n              })\n            }\n          },\n          optimize: false,\n        })\n      },\n    }),\n    plugin({\n      key: 'katex',\n      value: async () => {\n        return syntaxHighlighting(\n          HighlightStyle.define([\n            {\n              tag: [mathInline.tag, mathInlineMark.tag],\n              backgroundColor: 'var(--ink-internal-block-background-color)',\n            },\n            {\n              tag: [mathInlineMarkClose.tag],\n              backgroundColor: 'var(--ink-internal-block-background-color)',\n              borderRadius: '0 var(--ink-internal-border-radius) var(--ink-internal-border-radius) 0',\n              paddingRight: 'var(--ink-internal-inline-padding)',\n            },\n            {\n              tag: [mathInlineMarkOpen.tag],\n              backgroundColor: 'var(--ink-internal-block-background-color)',\n              borderRadius: 'var(--ink-internal-border-radius) 0 0 var(--ink-internal-border-radius)',\n              paddingLeft: 'var(--ink-internal-inline-padding)',\n            },\n          ]),\n        )\n      },\n    }),\n    plugin({\n      key: 'katex',\n      value: async () => {\n        return EditorView.theme({\n          '.ink-mde-line-math-block': {\n            backgroundColor: 'var(--ink-internal-block-background-color)',\n            padding: '0 var(--ink-internal-block-padding) !important',\n          },\n          '.ink-mde-line-math-block-open': {\n            borderRadius: 'var(--ink-internal-border-radius) var(--ink-internal-border-radius) 0 0',\n          },\n          '.ink-mde-line-math-block-close': {\n            borderRadius: '0 0 var(--ink-internal-border-radius) var(--ink-internal-border-radius)',\n          },\n        })\n      },\n    }),\n  ]\n}\n","export type Queue = ReturnType<typeof makeQueue>\n\nexport const makeQueue = () => {\n  const state = {\n    queue: <(() => Promise<void>)[]>[],\n    workload: 0,\n  }\n\n  const process = async () => {\n    const task = state.queue.pop()\n\n    if (!task) return\n\n    await task()\n\n    state.workload--\n\n    await process()\n  }\n\n  return {\n    enqueue: (callback: () => void | Promise<void>): Promise<void> => {\n      return new Promise((resolve, reject) => {\n        const task = async () => {\n          try {\n            await callback()\n\n            resolve()\n          } catch (error) {\n            reject(error)\n          }\n        }\n\n        state.queue.push(task)\n        state.workload++\n\n        // If the queue has other items in it, then it will drain itself.\n        if (state.workload > 1) return\n\n        process()\n      })\n    },\n  }\n}\n","import { createSignal } from 'solid-js'\nimport { katex } from '/plugins/katex'\nimport { createExtensions } from '/src/extensions'\nimport { override } from '/src/utils/merge'\nimport { makeQueue } from '/src/utils/queue'\nimport type { Options } from '/types/ink'\nimport type InkInternal from '/types/internal'\nimport * as InkValues from '/types/values'\nimport { createElement } from './ui/utils'\n\nexport const blankState = (): InkInternal.StateResolved => {\n  const options = {\n    doc: '',\n    files: {\n      clipboard: false,\n      dragAndDrop: false,\n      handler: () => {},\n      injectMarkup: true,\n      types: ['image/*'],\n    },\n    hooks: {\n      afterUpdate: () => {},\n      beforeUpdate: () => {},\n    },\n    interface: {\n      appearance: InkValues.Appearance.Auto,\n      attribution: true,\n      autocomplete: false,\n      images: false,\n      lists: false,\n      readonly: false,\n      spellcheck: true,\n      toolbar: false,\n    },\n    katex: false,\n    keybindings: {\n      // Todo: Set these to false by default. https://codemirror.net/examples/tab\n      tab: true,\n      shiftTab: true,\n    },\n    lists: false,\n    placeholder: '',\n    plugins: [\n      katex(),\n    ],\n    readability: false,\n    search: true,\n    selections: [],\n    toolbar: {\n      bold: true,\n      code: true,\n      codeBlock: true,\n      heading: true,\n      image: true,\n      italic: true,\n      link: true,\n      list: true,\n      orderedList: true,\n      quote: true,\n      taskList: true,\n      upload: false,\n    },\n    // This value overrides both `tab` and `shiftTab` keybindings.\n    trapTab: undefined,\n    vim: false,\n  }\n\n  return {\n    doc: '',\n    editor: {} as InkInternal.Editor,\n    extensions: createExtensions(),\n    options,\n    root: createElement(),\n    target: createElement(),\n    workQueue: makeQueue(),\n  }\n}\n\nexport const makeState = (partialState: InkInternal.State): InkInternal.StateResolved => {\n  return override(blankState(), partialState)\n}\n\nexport const makeStore = (options: Options, overrides: InkInternal.State = {}): InkInternal.Store => {\n  const [state, setState] = createSignal(makeState({ ...overrides, doc: options.doc || '', options }))\n\n  return [state, setState]\n}\n","export const DEFAULT_WORDS_PER_MINUTE = 225\n\nexport const toHuman = (text: string, wordsPerMinute: number = DEFAULT_WORDS_PER_MINUTE): string => {\n  const readTime = toHumanReadTime(text, wordsPerMinute)\n  const wordCount = toHumanWordCount(text)\n  const lineCount = toHumanLineCount(text)\n  const charCount = toHumanCharCount(text)\n\n  return [readTime, wordCount, lineCount, charCount].join(' | ')\n}\n\nexport const toHumanCharCount = (text: string): string => {\n  const charCount = toCharCount(text)\n\n  return `${charCount} chars`\n}\n\nexport const toHumanLineCount = (text: string): string => {\n  const lineCount = toLineCount(text)\n\n  return `${lineCount} lines`\n}\n\nexport const toHumanReadTime = (text: string, wordsPerMinute: number = DEFAULT_WORDS_PER_MINUTE): string => {\n  const readTime = toReadTime(text, wordsPerMinute)\n  const readTimeMinutes = Math.floor(readTime)\n  const readTimeSeconds = Math.floor((readTime % 1) * 60)\n\n  if (readTimeMinutes === 0) {\n    return `${readTimeSeconds}s read`\n  }\n\n  return `${readTimeMinutes}m ${readTimeSeconds}s to read`\n}\n\nexport const toHumanWordCount = (text: string): string => {\n  const wordCount = toWordCount(text)\n\n  return `${wordCount} words`\n}\n\nexport const toCharCount = (text: string): number => {\n  return text.length\n}\n\nexport const toLineCount = (text: string): number => {\n  return text.split(/\\n/).length\n}\n\nexport const toReadTime = (text: string, wordsPerMinute: number = DEFAULT_WORDS_PER_MINUTE): number => {\n  return toWordCount(text) / wordsPerMinute\n}\n\nexport const toWordCount = (text: string): number => {\n  const scrubbed = text.replace(/[']/g, '').replace(/[^\\w\\d]+/g, ' ').trim()\n\n  if (!scrubbed) {\n    return 0\n  }\n\n  return scrubbed.split(/\\s+/).length\n}\n","import { type Component, Show } from 'solid-js'\nimport { toHuman } from '/src/utils/readability'\nimport type InkInternal from '/types/internal'\nimport { useStore } from '../../app'\n\nexport const Details: Component<{ store: InkInternal.Store }> = () => {\n  const [state] = useStore()\n\n  return (\n    <div class='ink-mde-details'>\n      <div class='ink-mde-container'>\n        <div class='ink-mde-details-content'>\n          <Show when={ state().options.readability }>\n            <div class='ink-mde-readability'>\n              <span>{ toHuman(state().doc) }</span>\n            </div>\n          </Show>\n          <Show when={ state().options.readability && state().options.interface.attribution }>\n            <span>&nbsp;|</span>\n          </Show>\n          <Show when={state().options.interface.attribution}>\n            <div class='ink-mde-attribution'>\n              <span>&nbsp;powered by <a class='ink-mde-attribution-link' href='https://github.com/davidmyersdev/ink-mde' rel='noopener noreferrer' target='_blank'>ink-mde</a></span>\n            </div>\n          </Show>\n        </div>\n      </div>\n    </div>\n  )\n}\n","import type { Component } from 'solid-js'\nimport { For, Show, createSignal, onCleanup, onMount } from 'solid-js'\nimport { insert } from '/src/api'\nimport { useStore } from '../../app'\nimport styles from './styles.css?inline'\n\nexport const DropZone: Component = () => {\n  const [depth, setDepth] = createSignal(0)\n  const [files, setFiles] = createSignal<File[]>([])\n  const [isLoading, setIsLoading] = createSignal(false)\n  const [isVisible, setIsVisible] = createSignal(false)\n  const [state, setState] = useStore()\n\n  const closeModal = () => {\n    setIsVisible(false)\n  }\n\n  const dropOnZone = (event: DragEvent) => {\n    if (state().options.files.dragAndDrop) {\n      event.preventDefault()\n      event.stopPropagation()\n\n      const transfer = event.dataTransfer\n\n      if (transfer?.files) {\n        uploadFiles(transfer.files)\n      } else {\n        setDepth(0)\n        setIsVisible(false)\n        setFiles([])\n      }\n    }\n  }\n\n  const onDragEnter = (event: DragEvent) => {\n    if (state().options.files.dragAndDrop) {\n      event.preventDefault()\n\n      setDepth(depth() + 1)\n      setIsVisible(true)\n    }\n  }\n\n  const onDragLeave = (event: DragEvent) => {\n    if (state().options.files.dragAndDrop) {\n      event.preventDefault()\n\n      setDepth(depth() - 1)\n\n      if (depth() === 0)\n        setIsVisible(false)\n    }\n  }\n\n  const onDragOver = (event: DragEvent) => {\n    if (state().options.files.dragAndDrop) {\n      event.preventDefault()\n\n      setIsVisible(true)\n    }\n  }\n\n  const onDrop = (event: DragEvent) => {\n    if (state().options.files.dragAndDrop) {\n      event.preventDefault()\n\n      setDepth(0)\n      setIsVisible(false)\n    }\n  }\n\n  const onPaste = (event: ClipboardEvent) => {\n    if (state().options.files.clipboard) {\n      event.preventDefault()\n\n      const transfer = event.clipboardData\n\n      if (transfer?.files && transfer.files.length > 0)\n        uploadFiles(transfer.files)\n    }\n  }\n\n  const uploadFiles = (userFiles: FileList) => {\n    Array.from(userFiles).forEach((file) => {\n      setFiles([...files(), file])\n    })\n\n    setIsLoading(true)\n    setIsVisible(true)\n\n    Promise.resolve(state().options.files.handler(userFiles)).then((url) => {\n      if (state().options.files.injectMarkup && url) {\n        const markup = `![](${url})`\n\n        insert([state, setState], markup)\n      }\n    }).finally(() => {\n      setDepth(0)\n      setIsLoading(false)\n      setIsVisible(false)\n      setFiles([])\n    })\n  }\n\n  onMount(() => {\n    document.addEventListener('dragenter', onDragEnter)\n    document.addEventListener('dragleave', onDragLeave)\n    document.addEventListener('dragover', onDragOver)\n    document.addEventListener('drop', onDrop)\n    state().root.addEventListener('paste', onPaste)\n  })\n\n  onCleanup(() => {\n    document.removeEventListener('dragenter', onDragEnter)\n    document.removeEventListener('dragleave', onDragLeave)\n    document.removeEventListener('dragover', onDragOver)\n    document.removeEventListener('drop', onDrop)\n    state().root.removeEventListener('paste', onPaste)\n  })\n\n  return (\n    <div class=\"ink-drop-zone\" classList={{ visible: isVisible() }}>\n      <style textContent={styles} />\n      <div class=\"ink-drop-zone-modal\">\n        <div class=\"ink-drop-zone-droppable-area\" onDrop={dropOnZone}>\n          <div class=\"ink-drop-zone-file-preview\">\n            <For each={files().slice(0, 8)}>{file => (\n              <img class=\"ink-drop-zone-file-preview-image\" alt={file.name} src={URL.createObjectURL(file)} />\n            )}</For>\n          </div>\n          <Show when={isLoading()} fallback={<span>drop files here</span>}>\n            <span>uploading files...</span>\n          </Show>\n        </div>\n        <div class=\"ink-drop-zone-hide\" onClick={closeModal}>\n          <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n            <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z\" />\n          </svg>\n        </div>\n      </div>\n    </div>\n  )\n}\n","import type { Component } from 'solid-js'\nimport { buildVendorUpdates } from '/src/extensions'\nimport { useStore } from '/src/ui/app'\nimport { override } from '/src/utils/merge'\nimport { createView } from '../../../editor'\n\nexport const Editor: Component<{ target?: HTMLElement }> = (props) => {\n  // Needed for tree-shaking purposes.\n  if (import.meta.env.VITE_SSR) {\n    return (\n      <div class='cm-editor'>\n        <div class='cm-scroller'>\n          <div class='cm-content' contenteditable={true}>\n            <div class='cm-line'>\n              <br />\n            </div>\n          </div>\n        </div>\n      </div>\n    )\n  }\n\n  const [state, setState] = useStore()\n  // eslint-disable-next-line solid/reactivity\n  const editor = createView([state, setState], props.target)\n\n  const { workQueue } = state()\n  setState(override(state(), { editor }))\n\n  workQueue.enqueue(async () => {\n    const effects = await buildVendorUpdates([state, setState])\n\n    editor.dispatch({ effects })\n  })\n\n  return editor.dom\n}\n","import type { Component, JSX } from 'solid-js'\n\nexport const Button: Component<{ children: JSX.Element, onclick: JSX.EventHandler<HTMLButtonElement, MouseEvent> }> = (props) => {\n  return (\n    <button class='ink-button' onClick={e => props.onclick(e)} type='button'>\n      {props.children}\n    </button>\n  )\n}\n","import { Show, createSignal } from 'solid-js'\nimport type { Component } from 'solid-js'\nimport { focus, format, insert } from '/src/api'\nimport { useStore } from '/src/ui/app'\nimport * as InkValues from '/types/values'\nimport { Button } from '../button'\nimport styles from './styles.css?inline'\n\nexport const Toolbar: Component = () => {\n  const [state, setState] = useStore()\n  const [uploader, setUploader] = createSignal<HTMLInputElement>()\n\n  const formatAs = (type: InkValues.Markup) => {\n    format([state, setState], type)\n    focus([state, setState])\n  }\n\n  const uploadChangeHandler = (event: Event) => {\n    const target = event.target as HTMLInputElement\n\n    if (target?.files) {\n      Promise.resolve(state().options.files.handler(target.files)).then((url) => {\n        if (url) {\n          const markup = `![](${url})`\n\n          insert([state, setState], markup)\n          focus([state, setState])\n        }\n      })\n    }\n  }\n\n  const uploadClickHandler = () => {\n    uploader()?.click()\n  }\n\n  return (\n    <div class='ink-mde-toolbar'>\n      <style textContent={styles} />\n      <div class='ink-mde-container'>\n        <Show when={state().options.toolbar.heading || state().options.toolbar.bold || state().options.toolbar.italic}>\n          <div class='ink-mde-toolbar-group'>\n            <Show when={state().options.toolbar.heading}>\n              <Button onclick={() => formatAs(InkValues.Markup.Heading)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M6 4V10M6 16V10M6 10H14M14 10V4M14 10V16'/>\n                </svg>\n              </Button>\n            </Show>\n            <Show when={state().options.toolbar.bold}>\n              <Button onclick={() => formatAs(InkValues.Markup.Bold)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.5' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M6.5 10H10.5C12.1569 10 13.5 11.3431 13.5 13C13.5 14.6569 12.1569 16 10.5 16H6.5V4H9.5C11.1569 4 12.5 5.34315 12.5 7C12.5 8.65686 11.1569 10 9.5 10'/>\n                </svg>\n              </Button>\n            </Show>\n            <Show when={state().options.toolbar.italic}>\n              <Button onclick={() => formatAs(InkValues.Markup.Italic)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M11 4L9 16M13 4H9M7 16H11'/>\n                </svg>\n              </Button>\n            </Show>\n          </div>\n        </Show>\n        <Show when={state().options.toolbar.quote || state().options.toolbar.codeBlock || state().options.toolbar.code}>\n          <div class='ink-mde-toolbar-group'>\n            <Show when={state().options.toolbar.quote}>\n              <Button onclick={() => formatAs(InkValues.Markup.Quote)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M2.00257 16H17.9955M2.00055 4H18M7 10H18.0659M2 8.5V11.4999C2.4 11.5 2.5 11.5 2.5 11.5V11V10.5M4 8.5V11.4999H4.5V11V10.5'/>\n                </svg>\n              </Button>\n            </Show>\n            <Show when={state().options.toolbar.codeBlock}>\n              <Button onclick={() => formatAs(InkValues.Markup.CodeBlock)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M13 4L7 16'/>\n                  <path d='M5 7L2 10L5 13'/>\n                  <path d='M15 7L18 10L15 13'/>\n                </svg>\n              </Button>\n            </Show>\n            <Show when={state().options.toolbar.code}>\n              <Button onclick={() => formatAs(InkValues.Markup.Code)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M7 4L8 6'/>\n                </svg>\n              </Button>\n            </Show>\n          </div>\n        </Show>\n        <Show when={state().options.toolbar.list || state().options.toolbar.orderedList || state().options.toolbar.taskList}>\n          <div class='ink-mde-toolbar-group'>\n            <Show when={state().options.toolbar.list}>\n              <Button onclick={() => formatAs(InkValues.Markup.List)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M7 16H17.8294'/>\n                  <path d='M2 16H4'/>\n                  <path d='M7 10H17.8294'/>\n                  <path d='M2 10H4'/>\n                  <path d='M7 4H17.8294'/>\n                  <path d='M2 4H4'/>\n                </svg>\n              </Button>\n            </Show>\n            <Show when={state().options.toolbar.orderedList}>\n              <Button onclick={() => formatAs(InkValues.Markup.OrderedList)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M7 16H18'/>\n                  <path d='M2 17.0242C2.48314 17.7569 3.94052 17.6154 3.99486 16.7919C4.05315 15.9169 3.1975 16.0044 2.99496 16.0044M2.0023 14.9758C2.48544 14.2431 3.94282 14.3846 3.99716 15.2081C4.05545 16.0831 3.1998 16.0002 2.99726 16.0002'/>\n                  <path d='M7 10H18'/>\n                  <path d='M2.00501 11.5H4M2.00193 8.97562C2.48449 8.24319 3.9401 8.38467 3.99437 9.20777C4.05259 10.0825 2.04342 10.5788 2 11.4996'/>\n                  <path d='M7 4H18'/>\n                  <path d='M2 5.5H4M2.99713 5.49952V2.5L2.215 2.93501'/>\n                </svg>\n              </Button>\n            </Show>\n            <Show when={state().options.toolbar.taskList}>\n              <Button onclick={() => formatAs(InkValues.Markup.TaskList)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M7 16H17.8294'/>\n                  <path d='M5 15L3 17L2 16'/>\n                  <path d='M7 10H17.8294'/>\n                  <path d='M5 9L3 11L2 10'/>\n                  <path d='M7 4H17.8294'/>\n                  <path d='M5 3L3 5L2 4'/>\n                </svg>\n              </Button>\n            </Show>\n          </div>\n        </Show>\n        <Show when={state().options.toolbar.link || state().options.toolbar.image || state().options.toolbar.upload}>\n          <div class='ink-mde-toolbar-group'>\n            <Show when={state().options.toolbar.link}>\n              <Button onclick={() => formatAs(InkValues.Markup.Link)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M9.12127 10.881C10.02 11.78 11.5237 11.7349 12.4771 10.7813L15.2546 8.00302C16.2079 7.04937 16.253 5.54521 15.3542 4.6462C14.4555 3.74719 12.9512 3.79174 11.9979 4.74539L10.3437 6.40007M10.8787 9.11903C9.97997 8.22002 8.47626 8.26509 7.52288 9.21874L4.74545 11.997C3.79208 12.9506 3.74701 14.4548 4.64577 15.3538C5.54452 16.2528 7.04876 16.2083 8.00213 15.2546L9.65633 13.5999'/>\n                </svg>\n              </Button>\n            </Show>\n            <Show when={state().options.toolbar.image}>\n              <Button onclick={() => formatAs(InkValues.Markup.Image)}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <rect x='2' y='4' width='16' height='12' rx='1'/>\n                  <path d='M7.42659 7.67597L13.7751 13.8831M2.00208 12.9778L7.42844 7.67175'/>\n                  <path d='M11.9119 12.0599L14.484 9.54443L17.9973 12.9785'/>\n                  <path d='M10.9989 7.95832C11.551 7.95832 11.9986 7.52072 11.9986 6.98092C11.9986 6.44113 11.551 6.00354 10.9989 6.00354C10.4468 6.00354 9.99921 6.44113 9.99921 6.98092C9.99921 7.52072 10.4468 7.95832 10.9989 7.95832Z'/>\n                </svg>\n              </Button>\n            </Show>\n            <Show when={state().options.toolbar.upload}>\n              <Button onclick={uploadClickHandler}>\n                <svg viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-miterlimit='5' stroke-linecap='round' stroke-linejoin='round'>\n                  <path d='M10 13V4M10 4L13 7M10 4L7 7'/>\n                  <path d='M2 13V15C2 15.5523 2.44772 16 3 16H17C17.5523 16 18 15.5523 18 15V13'/>\n                </svg>\n                <input style={{ display: 'none' }} type='file' onChange={uploadChangeHandler} ref={setUploader} />\n              </Button>\n            </Show>\n          </div>\n        </Show>\n      </div>\n    </div>\n  )\n}\n","import { type Component, createEffect, createSignal, onMount } from 'solid-js'\nimport { buildVendorUpdates } from '/src/extensions'\nimport { useStore } from '../../app'\nimport { makeVars } from '../../utils'\nimport styles from './styles.css?inline'\n\nexport const Styles: Component = () => {\n  const [state, setState] = useStore()\n  const [vars, setVars] = createSignal(makeVars(state()))\n\n  createEffect(() => {\n    setVars(makeVars(state()))\n  })\n\n  onMount(() => {\n    const mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)')\n    const listener = (_event: MediaQueryListEvent) => {\n      const { editor, root, workQueue } = state()\n\n      if (root.isConnected) {\n        workQueue.enqueue(async () => {\n          const effects = await buildVendorUpdates([state, setState])\n\n          editor.dispatch({ effects })\n          setVars(makeVars(state()))\n        })\n      } else {\n        mediaQueryList.removeEventListener('change', listener)\n      }\n    }\n\n    mediaQueryList.addEventListener('change', listener)\n  })\n\n  return (\n    <style textContent={`.ink {\\n  ${vars().join('\\n  ')}\\n}\\n${styles}`} />\n  )\n}\n","import { Show } from 'solid-js'\nimport type { Component } from 'solid-js'\nimport { getHydrationMarkerProps } from '/src/constants'\nimport { override } from '/src/utils/merge'\nimport type InkInternal from '/types/internal'\nimport { useStore } from '../../app'\nimport { Details } from '../details'\nimport { DropZone } from '../drop_zone'\nimport { Editor } from '../editor'\nimport { Toolbar } from '../toolbar'\nimport { Styles } from './styles'\n\nexport const Root: Component<{ store: InkInternal.Store, target?: HTMLElement }> = (props) => {\n  const [state, setState] = useStore()\n  const setRoot = (root: HTMLElement) => {\n    setState(override(state(), { root }))\n  }\n\n  return (\n    <div class='ink ink-mde' ref={setRoot} {...getHydrationMarkerProps()}>\n      <Styles />\n      <Show when={state().options.files.clipboard || state().options.files.dragAndDrop}>\n        <DropZone />\n      </Show>\n      <Show when={state().options.interface.toolbar}>\n        <Toolbar />\n      </Show>\n      <div class='ink-mde-editor'>\n        <Editor target={props.target} />\n      </div>\n      <Show when={state().options.readability || state().options.interface.attribution}>\n        <Details store={[state, setState]} />\n      </Show>\n    </div>\n  )\n}\n","import { createContext, useContext } from 'solid-js'\nimport type { Component, JSX } from 'solid-js'\nimport type InkInternal from '/types/internal'\nimport { blankState } from '../store'\nimport { Root } from './components/root'\n\nconst AppContext = createContext<InkInternal.Store>([() => blankState(), value => (typeof value === 'function' ? value(blankState()) : value)])\nconst AppProvider: Component<{ children: JSX.Element, store: InkInternal.Store }> = (props) => {\n  return (\n    // eslint-disable-next-line solid/reactivity\n    <AppContext.Provider value={props.store}>\n      {props.children}\n    </AppContext.Provider>\n  )\n}\n\nexport const useStore = () => {\n  return useContext(AppContext)\n}\n\nexport const App: Component<{ store: InkInternal.Store, target?: HTMLElement }> = (props) => {\n  return (\n    <AppProvider store={props.store}>\n      <Root store={props.store} target={props.target} />\n    </AppProvider>\n  )\n}\n","import { hydrate as solidHydrate, render as solidRender, renderToString as solidRenderToString } from 'solid-js/web'\nimport { HYDRATION_MARKER_SELECTOR } from '/src/constants'\nimport { makeInstance } from '/src/instance'\nimport { makeStore } from '/src/store'\nimport { App } from '/src/ui/app'\nimport { isPromise } from '/src/utils/inspect'\nimport { type PluginValueForType } from '/src/utils/options'\nimport type * as Ink from '/types/ink'\n\nexport type * from '/types/ink'\nexport { appearanceTypes, pluginTypes } from '/types/values'\n\nexport const defineConfig = <T extends Ink.Options>(config: T) => config\nexport const defineOptions = <T extends Ink.Options>(options: T) => options\nexport const definePlugin = <T extends Ink.Options.RecursivePlugin>(plugin: T) => plugin\n\nexport const hydrate = (target: HTMLElement, options: Ink.Options = {}): Ink.AwaitableInstance => {\n  const store = makeStore(options)\n\n  if (!import.meta.env.VITE_SSR) {\n    solidPrepareForHydration()\n    solidHydrate(() => <App store={store} target={target} />, target)\n  }\n\n  return makeInstance(store)\n}\n\nexport const ink = (target: HTMLElement, options: Ink.Options = {}): Ink.AwaitableInstance => {\n  const hasHydrationMarker = !!target.querySelector(HYDRATION_MARKER_SELECTOR)\n\n  if (hasHydrationMarker) {\n    return hydrate(target, options)\n  }\n\n  return render(target, options)\n}\n\nexport const inkPlugin = <T extends Ink.Values.PluginType>({ key = '', type, value }: { key?: string, type?: T, value: () => PluginValueForType<T> }) => {\n  return new Proxy({ key, type: type || 'default' } as Ink.Options.Plugin, {\n    get: (target, prop: keyof Ink.Options.Plugin, _receiver) => {\n      if (prop === 'value' && !target[prop]) {\n        target.value = value()\n\n        if (isPromise(target.value)) {\n          return target.value.then(val => target.value = val)\n        }\n\n        return target.value\n      }\n\n      return target[prop]\n    },\n  })\n}\n\nexport const plugin = inkPlugin\n\nexport const render = (target: HTMLElement, options: Ink.Options = {}): Ink.AwaitableInstance => {\n  const store = makeStore(options)\n\n  if (!import.meta.env.VITE_SSR) {\n    solidRender(() => <App store={store} target={target} />, target)\n  }\n\n  return makeInstance(store)\n}\n\nexport const renderToString = (options: Ink.Options = {}): string => {\n  const store = makeStore(options)\n\n  // Needed for tree-shaking purposes.\n  if (!import.meta.env.VITE_SSR) {\n    return ''\n  }\n\n  return solidRenderToString(() => <App store={store} />)\n}\n\nexport const solidPrepareForHydration = () => {\n  // @ts-expect-error Todo: This is a third-party vendor script.\n  // eslint-disable-next-line\n  let e,t;e=window._$HY||(window._$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute(\"data-hk\")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),['click', 'input'].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]}\n}\n\nexport const wrap = (textarea: HTMLTextAreaElement, options: Ink.Options = {}) => {\n  const replacement = <div class='ink-mde-textarea' /> as HTMLDivElement\n  const doc = textarea.value\n\n  textarea.after(replacement)\n  textarea.style.display = 'none'\n\n  const instance = render(replacement, { doc, ...options })\n\n  if (textarea.form) {\n    textarea.form.addEventListener('submit', () => {\n      textarea.value = instance.getDoc()\n    })\n  }\n\n  return instance\n}\n\nexport default ink\n","import { autocompletion, closeBrackets } from '@codemirror/autocomplete'\nimport { filterPlugins, partitionPlugins } from '/src/utils/options'\nimport type * as Ink from '/types/ink'\nimport { pluginTypes } from '/types/values'\n\nexport const autocomplete = (options: Ink.OptionsResolved) => {\n  // Todo: Handle lazy-loaded completions.\n  const [_lazyCompletions, completions] = partitionPlugins(filterPlugins(pluginTypes.completion, options))\n\n  return [\n    autocompletion({\n      defaultKeymap: true,\n      icons: false,\n      override: completions,\n      optionClass: () => 'ink-tooltip-option',\n    }),\n    closeBrackets(),\n  ]\n}\n","import { syntaxTree } from '@codemirror/language'\nimport type { EditorState, Extension, Range } from '@codemirror/state'\nimport { RangeSet, StateField } from '@codemirror/state'\nimport type { DecorationSet } from '@codemirror/view'\nimport { Decoration, EditorView, WidgetType } from '@codemirror/view'\n\ninterface ImageWidgetParams {\n  url: string,\n}\n\nclass ImageWidget extends WidgetType {\n  readonly url\n\n  constructor({ url }: ImageWidgetParams) {\n    super()\n\n    this.url = url\n  }\n\n  eq(imageWidget: ImageWidget) {\n    return imageWidget.url === this.url\n  }\n\n  toDOM() {\n    const container = document.createElement('div')\n    const backdrop = container.appendChild(document.createElement('div'))\n    const figure = backdrop.appendChild(document.createElement('figure'))\n    const image = figure.appendChild(document.createElement('img'))\n\n    container.setAttribute('aria-hidden', 'true')\n    container.className = 'cm-image-container'\n    backdrop.className = 'cm-image-backdrop'\n    figure.className = 'cm-image-figure'\n    image.className = 'cm-image-img'\n    image.src = this.url\n\n    container.style.paddingBottom = '0.5rem'\n    container.style.paddingTop = '0.5rem'\n\n    backdrop.classList.add('cm-image-backdrop')\n\n    backdrop.style.borderRadius = 'var(--ink-internal-border-radius)'\n    backdrop.style.display = 'flex'\n    backdrop.style.alignItems = 'center'\n    backdrop.style.justifyContent = 'center'\n    backdrop.style.overflow = 'hidden'\n    backdrop.style.maxWidth = '100%'\n\n    figure.style.margin = '0'\n\n    image.style.display = 'block'\n    image.style.maxHeight = 'var(--ink-internal-block-max-height)'\n    image.style.maxWidth = '100%'\n    image.style.width = '100%'\n\n    return container\n  }\n}\n\nexport const images = (): Extension => {\n  const imageRegex = /!\\[.*?\\]\\((?<url>.*?)\\)/\n\n  const imageDecoration = (imageWidgetParams: ImageWidgetParams) => Decoration.widget({\n    widget: new ImageWidget(imageWidgetParams),\n    side: -1,\n    block: true,\n  })\n\n  const decorate = (state: EditorState) => {\n    const widgets: Range<Decoration>[] = []\n\n    syntaxTree(state).iterate({\n      enter: ({ type, from, to }) => {\n        if (type.name === 'Image') {\n          const result = imageRegex.exec(state.doc.sliceString(from, to))\n\n          if (result && result.groups && result.groups.url)\n            widgets.push(imageDecoration({ url: result.groups.url }).range(state.doc.lineAt(from).from))\n        }\n      },\n    })\n\n    return widgets.length > 0 ? RangeSet.of(widgets) : Decoration.none\n  }\n\n  const imagesField = StateField.define<DecorationSet>({\n    create(state) {\n      return decorate(state)\n    },\n    update(images, transaction) {\n      if (transaction.docChanged)\n        return decorate(transaction.state)\n\n      return images.map(transaction.changes)\n    },\n    provide(field) {\n      return EditorView.decorations.from(field)\n    },\n  })\n\n  return [\n    imagesField,\n  ]\n}\n","import { indentLess, indentMore } from '@codemirror/commands'\nimport { type Extension } from '@codemirror/state'\nimport { keymap } from '@codemirror/view'\n\nexport const indentWithTab = ({ tab = true, shiftTab = true } = {}): Extension => {\n  return keymap.of([\n    {\n      key: 'Tab',\n      run: tab ? indentMore : undefined,\n    },\n    {\n      key: 'Shift-Tab',\n      run: shiftTab ? indentLess : undefined,\n    },\n  ])\n}\n","import { syntaxTree } from '@codemirror/language'\nimport { StateField } from '@codemirror/state'\nimport type { EditorState, Extension, Range } from '@codemirror/state'\nimport { Decoration, EditorView, ViewPlugin } from '@codemirror/view'\nimport type { DecorationSet } from '@codemirror/view'\nimport type { SyntaxNodeRef } from '@lezer/common'\nimport { buildWidget } from '/lib/codemirror-kit'\n\nconst tabSize = 2\n\nconst spacerWidget = () => {\n  return buildWidget({\n    toDOM: () => {\n      const spacer = document.createElement('span')\n\n      spacer.className = 'ink-mde-indent'\n      spacer.style.width = `2rem`\n      spacer.style.textDecoration = 'none'\n      spacer.style.display = 'inline-flex'\n\n      const spacerLine = document.createElement('span')\n\n      spacerLine.className = 'ink-mde-indent-marker'\n      spacerLine.innerHTML = '&nbsp;'\n\n      spacer.appendChild(spacerLine)\n\n      return spacer\n    },\n  })\n}\n\nconst createWrapper = () => {\n  const wrapper = document.createElement('label')\n\n  wrapper.setAttribute('aria-hidden', 'true')\n  wrapper.setAttribute('tabindex', '-1')\n  wrapper.className = 'ink-mde-list-marker'\n  wrapper.style.minWidth = '2rem'\n\n  return wrapper\n}\n\nconst taskWidget = (isChecked: boolean) => buildWidget({\n  eq: (other) => {\n    return other.isChecked === isChecked\n  },\n  ignoreEvent: () => false,\n  isChecked,\n  toDOM: () => {\n    const wrapper = createWrapper()\n    const input = document.createElement('input')\n\n    input.setAttribute('aria-hidden', 'true')\n    input.setAttribute('tabindex', '-1')\n    input.className = 'ink-mde-task-marker'\n    input.type = 'checkbox'\n    input.checked = isChecked\n\n    wrapper.classList.add('ink-mde-task')\n\n    wrapper.appendChild(input)\n\n    return wrapper\n  },\n})\n\nconst dotWidget = () => {\n  return buildWidget({\n    toDOM: () => {\n      const wrapper = createWrapper()\n\n      wrapper.setAttribute('inert', 'true')\n      wrapper.innerHTML = '&bull;'\n\n      return wrapper\n    },\n  })\n}\n\nconst numberWidget = (marker: string) => {\n  return buildWidget({\n    toDOM: () => {\n      const wrapper = createWrapper()\n      const content = document.createElement('span')\n\n      wrapper.setAttribute('inert', 'true')\n\n      wrapper.appendChild(content)\n\n      content.setAttribute('aria-hidden', 'true')\n      content.setAttribute('tabindex', '-1')\n      content.className = 'ink-mde-number-marker'\n      content.innerHTML = `${marker}`\n\n      return wrapper\n    },\n  })\n}\n\nconst getVals = (state: EditorState, { from, to, type }: SyntaxNodeRef) => {\n  // Todo: Determine whether to skip blockquote or not.\n  if (type.name === 'Blockquote') {\n    return false\n  }\n\n  if (type.name !== 'ListMark') {\n    return\n  }\n\n  const line = state.doc.lineAt(from)\n  const lineStart = line.from\n  const marker = state.sliceDoc(from, to)\n  const markerStart = from\n  const markerEnd = to\n  const markerHasTrailingSpace = state.sliceDoc(markerEnd, markerEnd + 1) === ' '\n  const indentation = markerStart - lineStart\n\n  if (!markerHasTrailingSpace) {\n    return\n  }\n\n  const indentLevel = Math.floor(indentation / tabSize)\n  const spacerDecorations = <Range<Decoration>[]>[]\n\n  for (const index of Array(indentLevel).keys()) {\n    const from = lineStart + (index * tabSize)\n    const to = from + tabSize\n\n    const spacerDec = Decoration.replace({ widget: spacerWidget() }).range(from, to)\n\n    spacerDecorations.push(spacerDec)\n  }\n\n  return {\n    indentLevel,\n    indentation,\n    lineStart,\n    marker,\n    markerEnd,\n    markerStart,\n    spacerDecorations,\n  }\n}\n\nconst bulletLists = (): Extension => {\n  const decorate = (state: EditorState): [DecorationSet, DecorationSet] => {\n    const atomicRanges = <Range<Decoration>[]>[]\n    const decorationRanges = <Range<Decoration>[]>[]\n\n    syntaxTree(state).iterate({\n      enter: (node) => {\n        const result = getVals(state, node)\n\n        if (!result) {\n          return result\n        }\n\n        const { indentLevel, lineStart, marker, markerEnd, markerStart, spacerDecorations } = result\n\n        if (!['-', '*'].includes(marker)) {\n          return\n        }\n\n        const lineDec = Decoration.line({\n          attributes: {\n            class: 'ink-mde-list ink-mde-bullet-list',\n            style: `--indent-level: ${indentLevel}`,\n          },\n        }).range(lineStart)\n\n        decorationRanges.push(lineDec)\n        decorationRanges.push(...spacerDecorations)\n        atomicRanges.push(...spacerDecorations)\n\n        const textStart = markerEnd + 1\n        const dotDec = Decoration.replace({\n          widget: dotWidget(),\n        }).range(markerStart, textStart)\n\n        decorationRanges.push(dotDec)\n        atomicRanges.push(dotDec)\n      },\n    })\n\n    return [Decoration.set(decorationRanges, true), Decoration.set(atomicRanges, true)]\n  }\n\n  const stateField = StateField.define<[DecorationSet, DecorationSet]>({\n    create(state) {\n      return decorate(state)\n    },\n    update(_references, { state }) {\n      return decorate(state)\n    },\n    provide(field) {\n      const result = [\n        EditorView.decorations.of((view) => {\n          const [decorationRanges, _atomicRanges] = view.state.field(field)\n\n          return decorationRanges\n        }),\n        EditorView.atomicRanges.of((view) => {\n          const [_decorationRanges, atomicRanges] = view.state.field(field)\n\n          return atomicRanges\n        }),\n      ]\n\n      return result\n    },\n  })\n\n  return [\n    stateField,\n  ]\n}\n\nconst numberLists = (): Extension => {\n  const decorate = (state: EditorState): [DecorationSet, DecorationSet] => {\n    const atomicRanges = <Range<Decoration>[]>[]\n    const decorationRanges = <Range<Decoration>[]>[]\n\n    syntaxTree(state).iterate({\n      enter: (node) => {\n        const result = getVals(state, node)\n\n        if (!result) {\n          return result\n        }\n\n        const { indentLevel, lineStart, marker, markerEnd, markerStart, spacerDecorations } = result\n\n        if (['-', '*'].includes(marker)) {\n          return\n        }\n\n        const lineDec = Decoration.line({\n          attributes: {\n            class: 'ink-mde-list ink-mde-number-list',\n            style: `--indent-level: ${indentLevel}`,\n          },\n        }).range(lineStart)\n\n        decorationRanges.push(lineDec)\n        decorationRanges.push(...spacerDecorations)\n        atomicRanges.push(...spacerDecorations)\n\n        const textStart = markerEnd + 1\n        const dotDec = Decoration.replace({\n          widget: numberWidget(marker),\n        }).range(markerStart, textStart)\n\n        decorationRanges.push(dotDec)\n        atomicRanges.push(dotDec)\n      },\n    })\n\n    return [Decoration.set(decorationRanges, true), Decoration.set(atomicRanges, true)]\n  }\n\n  const stateField = StateField.define<[DecorationSet, DecorationSet]>({\n    create(state) {\n      return decorate(state)\n    },\n    update(_references, { state }) {\n      return decorate(state)\n    },\n    provide(field) {\n      const result = [\n        EditorView.decorations.of((view) => {\n          const [decorationRanges, _atomicRanges] = view.state.field(field)\n\n          return decorationRanges\n        }),\n        EditorView.atomicRanges.of((view) => {\n          const [_decorationRanges, atomicRanges] = view.state.field(field)\n\n          return atomicRanges\n        }),\n      ]\n\n      return result\n    },\n  })\n\n  return [\n    stateField,\n  ]\n}\n\nconst taskLists = (): Extension => {\n  const decorate = (state: EditorState): [DecorationSet, DecorationSet] => {\n    const atomicRanges = <Range<Decoration>[]>[]\n    const decorationRanges = <Range<Decoration>[]>[]\n\n    syntaxTree(state).iterate({\n      enter: (node) => {\n        const result = getVals(state, node)\n\n        if (!result) {\n          return result\n        }\n\n        const { indentLevel, lineStart, marker, markerEnd, markerStart, spacerDecorations } = result\n\n        if (!['-', '*'].includes(marker)) {\n          return\n        }\n\n        const taskStart = markerEnd + 1\n        const taskEnd = taskStart + 3\n        const task = state.sliceDoc(taskStart, taskEnd)\n\n        if (!['[ ]', '[x]'].includes(task)) {\n          return\n        }\n\n        const textStart = taskEnd + 1\n        const taskHasTrailingSpace = state.sliceDoc(taskEnd, textStart) === ' '\n\n        if (!taskHasTrailingSpace) {\n          return\n        }\n\n        const isChecked = task === '[x]'\n\n        const lineDec = Decoration.line({\n          attributes: {\n            class: `ink-mde-list ink-mde-task-list ${isChecked ? 'ink-mde-task-checked' : 'ink-mde-task-unchecked'}`,\n            style: `--indent-level: ${indentLevel}`,\n          },\n        }).range(lineStart)\n\n        decorationRanges.push(lineDec)\n        decorationRanges.push(...spacerDecorations)\n        atomicRanges.push(...spacerDecorations)\n\n        const taskDec = Decoration.replace({\n          widget: taskWidget(isChecked),\n        }).range(markerStart, textStart)\n\n        decorationRanges.push(taskDec)\n        atomicRanges.push(taskDec)\n      },\n    })\n\n    return [Decoration.set(decorationRanges, true), Decoration.set(atomicRanges, true)]\n  }\n\n  const viewPlugin = ViewPlugin.define(() => ({}), {\n    eventHandlers: {\n      mousedown: (event, view) => {\n        const target = event.target as HTMLElement\n        const realTarget = target.closest('.ink-mde-list-marker')?.querySelector('.ink-mde-task-marker')\n\n        if (realTarget) {\n          const position = view.posAtDOM(realTarget)\n          const from = position - 4\n          const to = position - 1\n          const before = view.state.sliceDoc(from, to)\n\n          if (before === '[ ]') {\n            view.dispatch({\n              changes: {\n                from,\n                to,\n                insert: '[x]',\n              },\n            })\n          }\n\n          if (before === '[x]') {\n            view.dispatch({\n              changes: {\n                from,\n                to,\n                insert: '[ ]',\n              },\n            })\n          }\n\n          return true\n        }\n      },\n    },\n  })\n\n  const stateField = StateField.define<[DecorationSet, DecorationSet]>({\n    create(state) {\n      return decorate(state)\n    },\n    update(_references, { state }) {\n      return decorate(state)\n    },\n    provide(field) {\n      const result = [\n        EditorView.decorations.of((view) => {\n          const [decorationRanges, _atomicRanges] = view.state.field(field)\n\n          return decorationRanges\n        }),\n        EditorView.atomicRanges.of((view) => {\n          const [_decorationRanges, atomicRanges] = view.state.field(field)\n\n          return atomicRanges\n        }),\n      ]\n\n      return result\n    },\n  })\n\n  return [\n    viewPlugin,\n    stateField,\n  ]\n}\n\nexport const lists = (config: { task: boolean, bullet: boolean, number: boolean }): Extension => {\n  return [\n    config.task ? taskLists() : [],\n    config.bullet ? bulletLists() : [],\n    config.number ? numberLists() : [],\n    EditorView.theme({\n      ':where(.ink-mde-indent)': {\n        display: 'inline-flex',\n        justifyContent: 'center',\n      },\n      ':where(.ink-mde-indent-marker)': {\n        borderLeft: '1px solid var(--ink-internal-syntax-processing-instruction-color)',\n        bottom: '0',\n        overflow: 'hidden',\n        position: 'absolute',\n        top: '0',\n        width: '0',\n      },\n      ':where(.ink-mde-list)': {\n        paddingLeft: 'calc(var(--indent-level) * 2rem + 2rem) !important',\n        position: 'relative',\n        textIndent: 'calc((var(--indent-level) * 2rem + 2rem) * -1)',\n      },\n      ':where(.ink-mde-list *)': {\n        textIndent: '0',\n      },\n      ':where(.ink-mde-list-marker)': {\n        alignItems: 'center',\n        color: 'var(--ink-internal-syntax-processing-instruction-color)',\n        display: 'inline-flex',\n        justifyContent: 'center',\n        minWidth: '2rem',\n      },\n      ':where(.ink-mde-task-marker)': {\n        cursor: 'pointer',\n        margin: '0',\n        scale: '1.2',\n        transformOrigin: 'center center',\n      },\n      ':where(.ink-mde-task-list.ink-mde-task-checked)': {\n        textDecoration: 'line-through',\n        textDecorationColor: 'var(--ink-internal-syntax-processing-instruction-color)',\n      },\n    }),\n  ]\n}\n","import { EditorState } from '@codemirror/state'\n\nexport const readonly = () => {\n  return EditorState.readOnly.of(true)\n}\n","import {\n  SearchQuery,\n  findNext,\n  findPrevious,\n  getSearchQuery,\n  search as searchExtension,\n  searchKeymap,\n  setSearchQuery,\n} from '@codemirror/search'\nimport { keymap, runScopeHandlers } from '@codemirror/view'\n\nexport const search = () => {\n  return [\n    searchExtension({\n      top: true,\n      createPanel: (view) => {\n        let query = getSearchQuery(view.state)\n\n        const wrapper = document.createElement('div')\n        const input = document.createElement('input')\n\n        wrapper.setAttribute('class', 'ink-mde-search-panel')\n        input.setAttribute('attr:main-field', 'true')\n        input.setAttribute('class', 'ink-mde-search-input')\n        input.setAttribute('type', 'text')\n        input.setAttribute('value', query.search)\n\n        wrapper.appendChild(input)\n\n        const handleKeyDown = (event: KeyboardEvent) => {\n          if (runScopeHandlers(view, event, 'search-panel')) return event.preventDefault()\n\n          if (event.code === 'Enter') {\n            event.preventDefault()\n\n            if (event.shiftKey) {\n              findPrevious(view)\n            } else {\n              findNext(view)\n            }\n          }\n        }\n\n        const updateSearch = (event: Event) => {\n          // @ts-expect-error \"value\" is not a recognized property of EventTarget.\n          const { value } = event.target\n\n          query = new SearchQuery({ search: value })\n\n          view.dispatch({ effects: setSearchQuery.of(query) })\n        }\n\n        input.addEventListener('input', updateSearch)\n        input.addEventListener('keydown', handleKeyDown)\n\n        return {\n          dom: wrapper,\n          mount: () => {\n            input.focus()\n          },\n          top: true,\n        }\n      },\n    }),\n    keymap.of(searchKeymap),\n  ]\n}\n","import type { Extension } from '@codemirror/state'\nimport { EditorView } from '@codemirror/view'\n\nexport const spellcheck = (): Extension => {\n  return EditorView.contentAttributes.of({\n    spellcheck: 'true',\n  })\n}\n"],"names":["HYDRATION_MARKER","HYDRATION_MARKER_SELECTOR","getHydrationMarkerProps","destroy","state","editor","focus","Appearance","Markup","Selection","appearanceTypes","pluginTypes","toCodeMirror","selections","ranges","selection","SelectionRange","EditorSelection","toInk","range","defineConfig","overrides","formatting","InkValues.Markup","splitSelectionByLines","position","line","start","end","getSelection","formatDefinition","initialSelection","getText","changeDetails","getNode","definition","getNodes","type","nodeDefinitions","syntaxTree","from","to","unformat","text","sliceStart","sliceEnd","unformatted","formatBlock","before","after","formatMultiline","changes","lineChanges","formatLine","hasPrefixStates","prefixState","prefix","prefixStateIndex","nextPrefixState","updatedText","formatInline","getChanges","format","formatType","maybeSelection","node","offset","total","change","updates","getDoc","insert","setState","updateSelection","current","anchor","head","objectTypes","is","object","isPromise","partitionPlugins","plugins","partition","isPlugin","pluginType","plugin","isOptionsKey","key","options","filterPlugins","flatten","matches","array","flatArray","item","isValid","partitions","entry","makeExtension","baseExtensions","lazyExtensions","extensions","filterExtensions","lazyLanguages","languages","filterLanguages","effects","buildVendorUpdates","markdownExtension","markdownLanguage","baseLanguages","updateExtension","markdown","compartment","Compartment","store","createElement","isAutoDark","isDark","appearance","InkValues.Appearance","makeVars","styles","isLight","style","value","EditorView","buildVendors","e","extension","resolver","lazyExtension","reconfigure","createExtensions","resolvers","r","lazyResolvers","_lazyExtensions","isAuto","autocomplete","images","keybindings","trapTab","tab","shiftTab","indentWithTab","lists","bullet","number","task","placeholder","readonly","search","spellcheck","vim","blockquoteSyntaxNodes","blockquoteDecoration","Decoration","blockquoteOpenDecoration","blockquoteCloseDecoration","blockquotePlugin","ViewPlugin","view","decorate","builder","RangeSetBuilder","tree","visibleRange","openLine","closeLine","blockquote","codeBlockSyntaxNodes","sharedAttributes","codeBlockDecoration","codeBlockOpenDecoration","codeBlockCloseDecoration","codeDecoration","codeOpenDecoration","codeCloseDecoration","codeBlockPlugin","inlineCode","code","inkClassExtensions","ink","lineWrapping","theme","syntaxHighlighting","HighlightStyle","tags","toVendorSelection","createState","EditorState","keymap","defaultKeymap","historyKeymap","history","createView","target","rootNode","root","transaction","newDoc","types","getType","deepAssign","source","seen","assign","replacement","override","a","b","load","doc","workQueue","select","selectMultiple","selectOne","selectAt","at","InkValues.Selection","update","wrap","userSelection","awaitable","initialValue","handler","callback","settler","resolve","reject","settledValue","error","then","onFulfilled","onRejected","onSettled","makeInstance","instance","buildBlockWidgetDecoration","buildWidgetDecoration","buildLineDecoration","buildMarkDecoration","buildWidget","eq","other","buildNodeDecorations","decorationRanges","maybeDecorations","decoration","wrapped","left","right","buildOptimizedNodeDecorations","rangeSet","decorations","cursor","cursors","cursorsToSkip","_beforeFrom","_beforeTo","changeFrom","changeTo","nodeLength","cursorFrom","cursorTo","isOverlapping","cursorDecos","x1","x2","y1","y2","nodeDecorator","StateField","RangeSet","updatedRangeSet","field","buildTag","parent","Tag","getCharCode","char","buildMarkNode","markName","buildTaggedNode","nodeName","styleTags","tag","defineNode","defineBlockParser","defineInlineParser","defineMarkdown","charCodes","mathInlineTestRegex","mathInlineCaptureRegex","mathInline","mathInlineMark","mathInlineMarkOpen","mathInlineMarkClose","mathInlineParser","inlineContext","nextCharCode","remainingLineText","match","mathExpressionLength","mathBlock","mathBlockMark","mathBlockMarkOpen","mathBlockMarkClose","mathBlockParser","blockContext","openLineStart","openLineEnd","closeLineStart","closeLineEnd","grammar","katex","_state","classes","container","katexTarget","lib","dom","makeQueue","process","blankState","makeState","partialState","makeStore","createSignal","DEFAULT_WORDS_PER_MINUTE","toHuman","wordsPerMinute","readTime","toHumanReadTime","wordCount","toHumanWordCount","lineCount","toHumanLineCount","charCount","toHumanCharCount","toCharCount","toLineCount","toReadTime","readTimeMinutes","readTimeSeconds","toWordCount","scrubbed","Details","useStore","_el$","_$getNextElement","_tmpl$4","_el$2","firstChild","_el$3","_el$8","_el$9","_co$","_$getNextMarker","nextSibling","_el$10","_el$11","_co$2","_el$12","_el$13","_co$3","_$insert","_$createComponent","Show","when","readability","children","_el$4","_tmpl$","_el$5","_$memo","interface","attribution","_tmpl$2","_tmpl$3","DropZone","depth","setDepth","files","setFiles","isLoading","setIsLoading","isVisible","setIsVisible","closeModal","dropOnZone","event","dragAndDrop","preventDefault","stopPropagation","transfer","dataTransfer","uploadFiles","onDragEnter","onDragLeave","onDragOver","onDrop","onPaste","clipboard","clipboardData","length","userFiles","Array","forEach","file","Promise","url","injectMarkup","markup","finally","onMount","document","addEventListener","onCleanup","removeEventListener","_el$7","_$setProperty","For","each","slice","_$effect","_p$","_v$","name","_v$2","URL","createObjectURL","_$setAttribute","t","undefined","fallback","$$click","classList","toggle","_$runHydrationEvents","_$delegateEvents","Editor","props","enqueue","dispatch","Button","onclick","Toolbar","uploader","setUploader","formatAs","uploadChangeHandler","uploadClickHandler","click","_tmpl$15","_el$45","_el$46","_co$13","_el$47","_el$48","_co$14","_el$49","_el$50","_co$15","_el$51","_el$52","_co$16","toolbar","heading","bold","italic","InkValues","Heading","Bold","Italic","quote","codeBlock","_el$14","_el$18","_el$19","_co$4","_el$20","_el$21","_co$5","_el$22","_el$23","_co$6","Quote","_tmpl$5","CodeBlock","_tmpl$6","Code","_tmpl$7","list","orderedList","taskList","_el$24","_el$28","_el$29","_co$7","_el$30","_el$31","_co$8","_el$32","_el$33","_co$9","List","_tmpl$8","OrderedList","_tmpl$9","TaskList","_tmpl$10","link","image","upload","_el$34","_el$39","_el$40","_co$10","_el$41","_el$42","_co$11","_el$43","_el$44","_co$12","Link","_tmpl$11","Image","_tmpl$12","_tmpl$13","_el$38","_tmpl$14","_$use","setProperty","Styles","vars","setVars","createEffect","mediaQueryList","window","matchMedia","listener","_event","isConnected","join","Root","setRoot","_el$6","_$spread","_$mergeProps","AppContext","createContext","AppProvider","Provider","useContext","App","config","defineOptions","definePlugin","hydrate","solidPrepareForHydration","solidHydrate","querySelector","render","inkPlugin","Proxy","get","prop","_receiver","val","solidRender","renderToString","_$HY","events","completed","WeakSet","hasAttribute","host","Node","parentNode","o","s","composedPath","has","push","init","set","unset","textarea","display","form","_lazyCompletions","completions","autocompletion","closeBrackets","ImageWidget","WidgetType","imageWidget","backdrop","figure","imageRegex","imageDecoration","imageWidgetParams","widgets","result","indentMore","indentLess","tabSize","spacerWidget","spacer","spacerLine","createWrapper","wrapper","taskWidget","isChecked","input","dotWidget","numberWidget","marker","content","getVals","lineStart","markerStart","markerEnd","markerHasTrailingSpace","indentation","indentLevel","spacerDecorations","index","spacerDec","bulletLists","atomicRanges","lineDec","textStart","dotDec","_references","_atomicRanges","_decorationRanges","numberLists","taskLists","taskStart","taskEnd","taskDec","viewPlugin","realTarget","stateField","searchExtension","top","createPanel","query","getSearchQuery","setAttribute","appendChild","handleKeyDown","runScopeHandlers","shiftKey","findPrevious","findNext","updateSearch","SearchQuery","setSearchQuery","of","mount","searchKeymap"],"mappings":"w9BAAaA,GAAmB,oCACnBC,GAA4B,IAAID,EAAgB,IAEhDE,GAA0B,KAO9B,ICRIC,GAAU,CAAC,CAACC,CAAK,IAAyB,CAC/C,KAAA,CAAE,OAAAC,GAAWD,IAEnBC,EAAO,QAAQ,CACjB,ECJaC,GAAQ,CAAC,CAACF,CAAK,IAAyB,CAC7C,KAAA,CAAE,OAAAC,GAAWD,IAEdC,EAAO,UACVA,EAAO,MAAM,CAEjB,ECRY,IAAAE,IAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,MAAQ,QAHEA,IAAAA,IAAA,CAAA,CAAA,EAgBAC,GAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,UAAY,aACZA,EAAA,QAAU,UACVA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,YAAc,eACdA,EAAA,MAAQ,QACRA,EAAA,SAAW,YAXDA,IAAAA,GAAA,CAAA,CAAA,EAqBAC,IAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,MAAQ,QAFEA,IAAAA,IAAA,CAAA,CAAA,EAKL,MAAMC,GAAkB,CAC7B,KAAM,OACN,KAAM,OACN,MAAO,OACT,EAEaC,EAAc,CACzB,WAAY,aACZ,QAAS,UACT,QAAS,UACT,SAAU,UACZ,EClDaC,GAAgBC,GAAuC,CAClE,MAAMC,EAASD,EAAW,IAAKE,GACfC,EAAAA,eAAe,SA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