var i=globalThis.__LEPTOS_TIPTAP_BRIDGE__;if(i==null||i.modules==null)throw new Error("leptos-tiptap bridge bindings are unavailable");var t=i.modules["@tiptap/core"];if(t==null)throw new Error('leptos-tiptap bridge module "@tiptap/core" is unavailable');var k=t.CommandManager,b=t.Editor,y=t.Extension,f=t.InputRule,E=t.Mark,r=t.Node,h=t.NodePos,R=t.NodeView,P=t.PasteRule,C=t.Tracker,A=t.callOrReturn,T=t.canInsertNode,S=t.combineTransactionSteps,N=t.createChainableState,O=t.createDocument,B=t.createNodeFromContent,w=t.createStyleTag,I=t.defaultBlockAt,v=t.deleteProps,M=t.elementFromString,F=t.escapeForRegEx,D=t.extensions,j=t.findChildren,L=t.findChildrenInRange,H=t.findDuplicates,K=t.findParentNode,q=t.findParentNodeClosestToPos,G=t.fromString,z=t.generateHTML,J=t.generateJSON,U=t.generateText,V=t.getAttributes,Y=t.getAttributesFromExtensions,$=t.getChangedRanges,Q=t.getDebugJSON,W=t.getExtensionField,X=t.getHTMLFromFragment,Z=t.getMarkAttributes,tt=t.getMarkRange,et=t.getMarkType,nt=t.getMarksBetween,ot=t.getNodeAtPosition,it=t.getNodeAttributes,rt=t.getNodeType,st=t.getRenderedAttributes,lt=t.getSchema,at=t.getSchemaByResolvedExtensions,dt=t.getSchemaTypeByName,pt=t.getSchemaTypeNameByName,ut=t.getSplittedAttributes,ct=t.getText,gt=t.getTextBetween,_t=t.getTextContentFromNodes,xt=t.getTextSerializersFromSchema,mt=t.injectExtensionAttributesToParseRule,kt=t.inputRulesPlugin,bt=t.isActive,yt=t.isAtEndOfNode,ft=t.isAtStartOfNode,Et=t.isEmptyObject,ht=t.isExtensionRulesEnabled,Rt=t.isFunction,Pt=t.isList,Ct=t.isMacOS,At=t.isMarkActive,Tt=t.isNodeActive,St=t.isNodeEmpty,Nt=t.isNodeSelection,Ot=t.isNumber,Bt=t.isPlainObject,wt=t.isRegExp,It=t.isSafari,vt=t.isString,Mt=t.isTextSelection,Ft=t.isiOS,Dt=t.markInputRule,jt=t.markPasteRule,s=t.mergeAttributes,Lt=t.mergeDeep,Ht=t.minMax,l=t.nodeInputRule,Kt=t.nodePasteRule,qt=t.objectIncludes,Gt=t.pasteRulesPlugin,zt=t.posToDOMRect,Jt=t.removeDuplicates,Ut=t.resolveFocusPosition,Vt=t.rewriteUnknownContent,Yt=t.selectionToInsertionEnd,$t=t.splitExtensions,Qt=t.textInputRule,Wt=t.textPasteRule,Xt=t.textblockTypeInputRule,Zt=t.wrappingInputRule;var g=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,a=r.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",s(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:n})=>n.insertContent({type:this.name,attrs:e})}},addInputRules(){return[l({find:g,type:this.type,getAttributes:e=>{let[,,n,o,c]=e;return{src:o,alt:n,title:c}}})]}});var d="__LEPTOS_TIPTAP_BRIDGE__";function _(){let e=globalThis,n=e[d];if(n!=null)return n;let o={modules:{},registerExtension:()=>{throw new Error("leptos-tiptap bridge runtime is not initialized")}};return e[d]=o,o}function p(){return _()}function u(e){p().registerExtension(e)}function x(e){return{src:e.src,alt:e.alt??void 0,title:e.title??void 0}}var m={name:"image",create:()=>a,commands:{set_image:(e,n)=>n.kind==="set_image"?e.chain().focus().setImage(x(n)).run():!1}};function ae(){u(m)}export{ae as register_image};
