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 u=t.CommandManager,x=t.Editor,r=t.Extension,_=t.InputRule,m=t.Mark,k=t.Node,b=t.NodePos,y=t.NodeView,f=t.PasteRule,h=t.Tracker,A=t.callOrReturn,E=t.canInsertNode,T=t.combineTransactionSteps,R=t.createChainableState,P=t.createDocument,S=t.createNodeFromContent,C=t.createStyleTag,N=t.defaultBlockAt,O=t.deleteProps,B=t.elementFromString,w=t.escapeForRegEx,v=t.extensions,M=t.findChildren,I=t.findChildrenInRange,j=t.findDuplicates,F=t.findParentNode,D=t.findParentNodeClosestToPos,L=t.fromString,K=t.generateHTML,G=t.generateJSON,H=t.generateText,q=t.getAttributes,z=t.getAttributesFromExtensions,J=t.getChangedRanges,U=t.getDebugJSON,V=t.getExtensionField,Y=t.getHTMLFromFragment,$=t.getMarkAttributes,Q=t.getMarkRange,W=t.getMarkType,X=t.getMarksBetween,Z=t.getNodeAtPosition,tt=t.getNodeAttributes,et=t.getNodeType,nt=t.getRenderedAttributes,ot=t.getSchema,it=t.getSchemaByResolvedExtensions,rt=t.getSchemaTypeByName,st=t.getSchemaTypeNameByName,lt=t.getSplittedAttributes,at=t.getText,dt=t.getTextBetween,pt=t.getTextContentFromNodes,gt=t.getTextSerializersFromSchema,ct=t.injectExtensionAttributesToParseRule,ut=t.inputRulesPlugin,xt=t.isActive,_t=t.isAtEndOfNode,mt=t.isAtStartOfNode,kt=t.isEmptyObject,bt=t.isExtensionRulesEnabled,yt=t.isFunction,ft=t.isList,ht=t.isMacOS,At=t.isMarkActive,Et=t.isNodeActive,Tt=t.isNodeEmpty,Rt=t.isNodeSelection,Pt=t.isNumber,St=t.isPlainObject,Ct=t.isRegExp,Nt=t.isSafari,Ot=t.isString,Bt=t.isTextSelection,wt=t.isiOS,vt=t.markInputRule,Mt=t.markPasteRule,It=t.mergeAttributes,jt=t.mergeDeep,Ft=t.minMax,Dt=t.nodeInputRule,Lt=t.nodePasteRule,Kt=t.objectIncludes,Gt=t.pasteRulesPlugin,Ht=t.posToDOMRect,qt=t.removeDuplicates,zt=t.resolveFocusPosition,Jt=t.rewriteUnknownContent,Ut=t.selectionToInsertionEnd,Vt=t.splitExtensions,Yt=t.textInputRule,$t=t.textPasteRule,Qt=t.textblockTypeInputRule,Wt=t.wrappingInputRule;var s=r.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let n=e.style.textAlign;return this.options.alignments.includes(n)?n:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:n})=>this.options.alignments.includes(e)?this.options.types.map(o=>n.updateAttributes(o,{textAlign:e})).every(o=>o):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(n=>e.resetAttributes(n,"textAlign")).every(n=>n),toggleTextAlign:e=>({editor:n,commands:o})=>this.options.alignments.includes(e)?n.isActive({textAlign:e})?o.unsetTextAlign():o.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});var l="__LEPTOS_TIPTAP_BRIDGE__";function g(){let e=globalThis,n=e[l];if(n!=null)return n;let o={modules:{},registerExtension:()=>{throw new Error("leptos-tiptap bridge runtime is not initialized")}};return e[l]=o,o}function a(){return g()}function d(e){a().registerExtension(e)}var p=["left","center","right","justify"],c={name:"text_align",create:()=>s.configure({types:["heading","paragraph"]}),commands:{set_text_align:(e,n)=>n.kind==="set_text_align"&&p.includes(n.alignment)?e.chain().focus().setTextAlign(n.alignment).run():!1,toggle_text_align:(e,n)=>n.kind==="toggle_text_align"&&p.includes(n.alignment)?e.chain().focus().toggleTextAlign(n.alignment).run():!1,unset_text_align:e=>e.chain().focus().unsetTextAlign().run()},selection_keys:["align_left","align_center","align_right","align_justify"],selection_state:e=>({align_left:e.isActive({textAlign:"left"}),align_center:e.isActive({textAlign:"center"}),align_right:e.isActive({textAlign:"right"}),align_justify:e.isActive({textAlign:"justify"})})};function se(){d(c)}export{se as register_text_align};
