{"version":3,"sources":["jsdelivr-header.js","/npm/@tiptap/extension-image@2.5.8/src/image.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,kTC2CO,MAAM,EAAa,2DAMb,EAAQ,OAAK,OAAqB,CAC7C,KAAM,QAEN,WAAU,KACD,CACL,QAAQ,EACR,aAAa,EACb,eAAgB,KAIpB,MAAA,GACE,OAAO,KAAK,QAAQ,M,EAGtB,KAAA,GACE,OAAO,KAAK,QAAQ,OAAS,SAAW,O,EAG1C,WAAW,EAEX,cAAa,KACJ,CACL,IAAK,CACH,QAAS,MAEX,IAAK,CACH,QAAS,MAEX,MAAO,CACL,QAAS,QAKf,SAAA,GACE,MAAO,CACL,CACE,IAAK,KAAK,QAAQ,YACd,WACA,gC,EAKV,UAAA,EAAW,eAAE,IACX,MAAO,CAAC,MAAO,kBAAgB,KAAK,QAAQ,eAAgB,G,EAG9D,WAAA,GACE,MAAO,CACL,SAAU,GAAW,EAAG,cACf,EAAS,cAAc,CAC5B,KAAM,KAAK,KACX,MAAO,I,EAMf,aAAA,GACE,MAAO,CACL,gBAAc,CACZ,KAAM,EACN,KAAM,KAAK,KACX,cAAe,IACb,MAAM,EAAI,EAAK,EAAK,GAAS,EAE7B,MAAO,CAAE,MAAK,MAAK,QAAO,I","file":"/npm/@tiptap/extension-image@2.5.8/dist/index.umd.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@tiptap/extension-image@2.5.8/dist/index.umd.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import {\n  mergeAttributes,\n  Node,\n  nodeInputRule,\n} from '@tiptap/core'\n\nexport interface ImageOptions {\n  /**\n   * Controls if the image node should be inline or not.\n   * @default false\n   * @example true\n   */\n  inline: boolean,\n\n  /**\n   * Controls if base64 images are allowed. Enable this if you want to allow\n   * base64 image urls in the `src` attribute.\n   * @default false\n   * @example true\n   */\n  allowBase64: boolean,\n\n  /**\n   * HTML attributes to add to the image element.\n   * @default {}\n   * @example { class: 'foo' }\n   */\n  HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n  interface Commands<ReturnType> {\n    image: {\n      /**\n       * Add an image\n       * @param options The image attributes\n       * @example\n       * editor\n       *   .commands\n       *   .setImage({ src: 'https://tiptap.dev/logo.png', alt: 'tiptap', title: 'tiptap logo' })\n       */\n      setImage: (options: { src: string, alt?: string, title?: string }) => ReturnType,\n    }\n  }\n}\n\n/**\n * Matches an image to a ![image](src \"title\") on input.\n */\nexport const inputRegex = /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/\n\n/**\n * This extension allows you to insert images.\n * @see https://www.tiptap.dev/api/nodes/image\n */\nexport const Image = Node.create<ImageOptions>({\n  name: 'image',\n\n  addOptions() {\n    return {\n      inline: false,\n      allowBase64: false,\n      HTMLAttributes: {},\n    }\n  },\n\n  inline() {\n    return this.options.inline\n  },\n\n  group() {\n    return this.options.inline ? 'inline' : 'block'\n  },\n\n  draggable: true,\n\n  addAttributes() {\n    return {\n      src: {\n        default: null,\n      },\n      alt: {\n        default: null,\n      },\n      title: {\n        default: null,\n      },\n    }\n  },\n\n  parseHTML() {\n    return [\n      {\n        tag: this.options.allowBase64\n          ? 'img[src]'\n          : 'img[src]:not([src^=\"data:\"])',\n      },\n    ]\n  },\n\n  renderHTML({ HTMLAttributes }) {\n    return ['img', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)]\n  },\n\n  addCommands() {\n    return {\n      setImage: options => ({ commands }) => {\n        return commands.insertContent({\n          type: this.name,\n          attrs: options,\n        })\n      },\n    }\n  },\n\n  addInputRules() {\n    return [\n      nodeInputRule({\n        find: inputRegex,\n        type: this.type,\n        getAttributes: match => {\n          const [,, alt, src, title] = match\n\n          return { src, alt, title }\n        },\n      }),\n    ]\n  },\n})\n"]}