{"mappings":";mJA4CO,IAAMA,EAAa,yBAKbC,EAAa,0BAMbC,EAAOC,EAAK,OAAoB,CAC3C,KAAM,OAEN,YAAU,CACR,MAAO,CACL,eAAgB,CAAA,IAIpB,SAAU,IAEV,KAAM,GAEN,SAAU,GAEV,WAAS,CACP,MAAO,CACL,CAAE,IAAK,MAAM,IAIjB,WAAW,CAAE,eAAAC,CAAc,EAAE,CAC3B,MAAO,CAAC,OAAQC,EAAgB,KAAK,QAAQ,eAAgBD,CAAc,EAAG,CAAC,GAGjF,aAAW,CACT,MAAO,CACL,QAAS,IAAM,CAAC,CAAE,SAAAE,CAAQ,IACjBA,EAAS,QAAQ,KAAK,IAAI,EAEnC,WAAY,IAAM,CAAC,CAAE,SAAAA,CAAQ,IACpBA,EAAS,WAAW,KAAK,IAAI,EAEtC,UAAW,IAAM,CAAC,CAAE,SAAAA,CAAQ,IACnBA,EAAS,UAAU,KAAK,IAAI,IAKzC,sBAAoB,CAClB,MAAO,CACL,QAAS,IAAM,KAAK,OAAO,SAAS,WAAU,IAIlD,eAAa,CACX,MAAO,CACLC,EAAc,CACZ,KAAMP,EACN,KAAM,KAAK,KACZ,IAIL,eAAa,CACX,MAAO,CACLQ,EAAc,CACZ,KAAMP,EACN,KAAM,KAAK,KACZ,GAGN,CAAA","names":["inputRegex","pasteRegex","Code","Mark","HTMLAttributes","mergeAttributes","commands","markInputRule","markPasteRule"],"sources":["../esm/npm/@tiptap/extension-code@2.27.3/node_modules/@tiptap/extension-code/src/code.ts"],"sourcesContent":["import {\n  Mark,\n  markInputRule,\n  markPasteRule,\n  mergeAttributes,\n} from '@tiptap/core'\n\nexport interface CodeOptions {\n  /**\n   * The HTML attributes applied to the code element.\n   * @default {}\n   * @example { class: 'foo' }\n   */\n  HTMLAttributes: Record\u003cstring, any\u003e,\n}\n\ndeclare module '@tiptap/core' {\n  interface Commands\u003cReturnType\u003e {\n    code: {\n      /**\n       * Set a code mark\n       */\n      setCode: () =\u003e ReturnType,\n      /**\n       * Toggle inline code\n       */\n      toggleCode: () =\u003e ReturnType,\n      /**\n       * Unset a code mark\n       */\n      unsetCode: () =\u003e ReturnType,\n    }\n  }\n}\n\n/**\n * Regular expressions to match inline code blocks enclosed in backticks.\n *  It matches:\n *     - An opening backtick, followed by\n *     - Any text that doesn't include a backtick (captured for marking), followed by\n *     - A closing backtick.\n *  This ensures that any text between backticks is formatted as code,\n *  regardless of the surrounding characters (exception being another backtick).\n */\nexport const inputRegex = /(^|[^`])`([^`]+)`(?!`)/\n\n/**\n * Matches inline code while pasting.\n */\nexport const pasteRegex = /(^|[^`])`([^`]+)`(?!`)/g\n\n/**\n * This extension allows you to mark text as inline code.\n * @see https://tiptap.dev/api/marks/code\n */\nexport const Code = Mark.create\u003cCodeOptions\u003e({\n  name: 'code',\n\n  addOptions() {\n    return {\n      HTMLAttributes: {},\n    }\n  },\n\n  excludes: '_',\n\n  code: true,\n\n  exitable: true,\n\n  parseHTML() {\n    return [\n      { tag: 'code' },\n    ]\n  },\n\n  renderHTML({ HTMLAttributes }) {\n    return ['code', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n  },\n\n  addCommands() {\n    return {\n      setCode: () =\u003e ({ commands }) =\u003e {\n        return commands.setMark(this.name)\n      },\n      toggleCode: () =\u003e ({ commands }) =\u003e {\n        return commands.toggleMark(this.name)\n      },\n      unsetCode: () =\u003e ({ commands }) =\u003e {\n        return commands.unsetMark(this.name)\n      },\n    }\n  },\n\n  addKeyboardShortcuts() {\n    return {\n      'Mod-e': () =\u003e this.editor.commands.toggleCode(),\n    }\n  },\n\n  addInputRules() {\n    return [\n      markInputRule({\n        find: inputRegex,\n        type: this.type,\n      }),\n    ]\n  },\n\n  addPasteRules() {\n    return [\n      markPasteRule({\n        find: pasteRegex,\n        type: this.type,\n      }),\n    ]\n  },\n})\n"],"version":3}
